[FFmpeg-devel] [RFC] Lowpass filter

Michael Niedermayer michaelni
Wed Aug 27 16:12:03 CEST 2008


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

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

There will always be a question for which you do not know the correct awnser.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080827/ef681df9/attachment.pgp>



More information about the ffmpeg-devel mailing list