[FFmpeg-devel] [PATCH] RDFT for Bink audio

Michael Niedermayer michaelni
Sat Jan 17 01:49:42 CET 2009


On Fri, Jan 16, 2009 at 07:18:44PM -0500, Alex Converse wrote:
> On Fri, Jan 16, 2009 at 5:00 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> > On Fri, Jan 16, 2009 at 02:19:15PM -0500, Alex Converse wrote:
> >> On Thu, Jan 15, 2009 at 2:03 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> >> > On Thu, Jan 15, 2009 at 11:52:20AM -0500, Alex Converse wrote:
> >> > [...]
> >> >> +int ff_rdft_init(RDFTContext *s, int nbits, int inverse)
> >> >> +{
> >> >> +    int n = 1 << nbits;
> >> >> +    int i;
> >> >> +    const double theta = (1-2*inverse)*2*M_PI/n;
> >> >> +
> >> >> +    s->nbits = nbits;
> >> >> +    s->inverse = inverse;
> >> >> +
> >> >> +    if (ff_fft_init(&s->fft, nbits-1, !inverse) < 0)
> >> >> +        goto fail;
> >> >> +
> >> >> +    s->tcos = av_malloc((n>>2) * sizeof(FFTSample));
> >> >> +    if (!s->tcos)
> >> >> +        goto fail;
> >> >> +    s->tsin = av_malloc((n>>2) * sizeof(FFTSample));
> >> >> +    if (!s->tsin)
> >> >> +        goto fail;
> >> >> +    for (i = 0; i < (n>>2); i++) {
> >> >> +        s->tcos[i] = cos(i*theta);
> >> >> +        s->tsin[i] = sin(i*theta);
> >> >> +    }
> >> >
> >> > we have a large number of sin and cos tables already
> >> > see ff_sine_* / ff_cos_*, no need to duplicate them in each context
> >> >
> >>
> >> I agree with that in principle, but in practice It doesn't seem
> >> practical at the moment.
> >
> >> They are defined in different files,
> >
> > it should be very easy to split the tables out into their own file and
> > add dependancies to the Makefile
> >
> >
> >> available in different sizes.
> >
> > not sure if i understand you but i dont see the difference
> >
> >
> >> The sines seem to be at half at a half
> >> sample offset from what I need.
> >
> > indeed, ive missed that
> >
> >
> > still even if they wouldnt be shareable though i still think cos is,
> > then at least the same system of global shared tables should be used instead
> > of duplicating them per context.
> >
> 
> I'm looking at fft.c and those tables are a mess. Depending on the
> type of fft, different tables get initialized (exptab vs ff_cos_*).
> The exptab tables aren't shareable because they are half the needed
> size. Even if it isn't used exptab is still allocated.

i wasnt really talking about the exptab


> 
> If the tables get presented in a usable fashion I will use them. I

is there a problem with using ff_cos_* ?


> have no current desire to re-factor fft.c, because I don't want to
> deal with benchmarking such an important chunk of code.

i did not really suggest that you should refactor fft.c, just that you
use the existing tables or where they dont exist add them without per
context duplication

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch
-------------- 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/20090117/8e01cba9/attachment.pgp>



More information about the ffmpeg-devel mailing list