[FFmpeg-devel] [RFC] Lowpass filter

Michael Niedermayer michaelni
Wed Aug 27 19:12:46 CEST 2008


On Wed, Aug 27, 2008 at 08:04:12PM +0300, Kostya wrote:
> 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?

no, do as you see fit

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

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope
-------------- 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/52ebf71a/attachment.pgp>



More information about the ffmpeg-devel mailing list