[FFmpeg-devel] [PATCH] E-AC-3 spectral extension (bump)

Justin Ruggles justin.ruggles
Wed Mar 24 03:42:32 CET 2010


Christophe Gisquet wrote:

> 2010/3/20 Justin Ruggles <justin.ruggles at gmail.com>:
>> Also, each band has multiple sub-bands of 12 coeffs each.  The copying
>> is done in multiples of 12, but the wrapping can occur in the middle of
>> a band.  If we want to reduce calculations, we could accumulate sum of
>> squared coeffs for each sub-band, then add them together for each band
>> before dividing by bandsize and taking the square root.
> 
> So, the pseudo-code would be:
> for (k=0; k<max(copy_size[i]); k+=12)
>    compute sum of square for 12 coeffs starting at s->spx_copy_start_freq+k
>    store it in some kind of array
> 
> Then actual RMS computation:
>    for each SPX band:
>      determine the subband(s) used,
>      read the corresponding sum of square value(s),
>      sum them and do the norm+sqrt
> 
> The more complex part is now "determine subbands". Probably not very
> complex but I'll stay there for tonight.

Determining source subbands for each band is done in the code above the
RMS computation (except that there seems to be a bug I didn't see before
where it uses 'copysize' before it is initialized).  The algorithm is
pretty simple though.  You either start copying a band where the last
band left off (if there is enough left in the copy region to copy the
whole band) or you start over at the beginning of the copy region.  It
only gets a little complex if a band is larger than the full copy region
(copysize < bandsize) since that is the only time you wrap in the middle
of a band.

-Justin



More information about the ffmpeg-devel mailing list