Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/vorbis/codec.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ typedef struct vorbis_dsp_state{

float **pcm;
float **pcmret;
float *preextrapolate_work;
int pcm_storage;
int pcm_current;
int pcm_returned;
Expand Down
12 changes: 10 additions & 2 deletions lib/block.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ void vorbis_dsp_clear(vorbis_dsp_state *v){
if(v->pcm[i])_ogg_free(v->pcm[i]);
_ogg_free(v->pcm);
if(v->pcmret)_ogg_free(v->pcmret);
if(v->preextrapolate_work)_ogg_free(v->preextrapolate_work);
}

if(b){
Expand Down Expand Up @@ -417,11 +418,18 @@ static void _preextrapolate_helper(vorbis_dsp_state *v){
int i;
int order=16;
float *lpc=alloca(order*sizeof(*lpc));
float *work=alloca(v->pcm_current*sizeof(*work));
float *work;
int workbuf=v->pcm_current*sizeof(*work);
long j;
v->preextrapolate=1;

if(v->pcm_current-v->centerW>order*2){ /* safety */
if(workbuf<256*1024)
work=alloca(workbuf);
else
/* workbuf is too big to safely allocate on the stack */
work=v->preextrapolate_work=_ogg_realloc(v->preextrapolate_work,workbuf);

if(v->pcm_current-v->centerW>order*2 && work){ /* safety */
for(i=0;i<v->vi->channels;i++){
/* need to run the extrapolation in reverse! */
for(j=0;j<v->pcm_current;j++)
Expand Down