[FFmpeg-devel] [RFC] Lowpass filter

Kostya kostya.shishkov
Wed Aug 27 19:04:12 CEST 2008


On Wed, Aug 27, 2008 at 04:12:03PM +0200, Michael Niedermayer wrote:
> On Wed, Aug 27, 2008 at 04:30:38PM +0300, Kostya wrote:
> > On Wed, Aug 27, 2008 at 02:58:07PM +0200, Michael Niedermayer wrote:
> > > On Wed, Aug 27, 2008 at 08:00:14AM +0300, Kostya wrote:
> > > > On Tue, Aug 26, 2008 at 07:33:28PM +0200, Michael Niedermayer wrote:
> > > > > On Tue, Aug 26, 2008 at 07:48:07PM +0300, Kostya wrote:
> > > [...]
> > > > > [...]
> > > > > > /**
> > > > > >  * IIR filter state
> > > > > >  */
> > > > > > typedef struct FFFilterState{
> > > > > >     float *x;
> > > > > > }FFFilterState;
> > > > > 
> > > > > no, we do not want to do the extra pointer dereference nor do we want an
> > > > > extra pointer to be stored, the correct way is:
> > > > > 
> > > > > typedef struct FFFilterState{
> > > > >     float x[];
> > > > > }
> > > > 
> > > > only with your own compiler, gcc results in
> > > > iirfilter.c:45: error: flexible array member in otherwise empty struct
> > > 
> > > then use
> > > float x[1];
> > > and subtract that 1 during malloc
> > > 
> > > or use a void * and cast to float*
> > > 
> > > 
> > > [...]
> > > 
> > > > struct FFIIRFilterState* ff_iir_filter_init_state(int order)
> > > > {
> > > >     FFIIRFilterState* s = av_mallocz(sizeof(FFIIRFilterState) + sizeof(s->x[0]) * order);
> > > 
> > > >     s->x = (void*)s + sizeof(FFIIRFilterState);
> > > 
> > > this is not legal C, arithmetic on void* is not alowed or undefined
> > 
> > done
> 
> patch looks ok

I would prefer to commit it directly and drop old code. Any objections?
 
> [...]
> -- 
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> There will always be a question for which you do not know the correct awnser.




More information about the ffmpeg-devel mailing list