[FFmpeg-devel] [RFC] TwinVQ decoder

Kostya kostya.shishkov
Sat Mar 7 21:47:17 CET 2009


On Sat, Mar 07, 2009 at 05:47:51PM +0100, Vitor Sessak wrote:
> Hi,
> 
> This codec has some interesting features. It looks like whoever designed
> it wanted to improve quality/bitrate, no matter if it add to ugliness or
> file size. So they have a different set of codebooks for each possible
> combination of frame_type, sample rate and bit rate (what makes for a
> 370kb stripped object file).
> 
> This code is still not review-quality, but any comment is welcome.
> 
> -Vitor

[...]
> static void mulddd(int cont, const float *buf1, const float *buf2, float *buf3)
> {
>     while(cont--)
>         *buf3++ = (*buf1++)*(*buf2++);
> }
> 
> static void muldddre(int cont, const float *buf1, const float *buf2, float *buf3)
> {
>     while(cont--)
>         *buf3++ = (*buf1++)*(*buf2--);
> }
> 
> static void addddd(int cont, const float *buf1, const float *buf2, float *buf3)
> {
>     while(cont--)
>         *buf3++ = *buf1++ + *buf2++;
> }

You should use dsputil functions instead of those if possible
(i.e. no align problems)

[...] 
> 
> static void lsptowts(const float *a1, float *a2, TwinContext *tctx)
> {
>     float cos_vals[21];
>     int i,j;
>     const ModeTab *mtab = tctx->mtab;
>     int n_fr_s = mtab->n_fr / mtab->fmode[FT_SHORT].sub;
>     int mag_95 = 2 * mtab->fmode[FT_SHORT].sub;
>     float *cos_TT = ff_cos_tabs[av_log2(mtab->n_fr)-1];
> 
>     for (i=0; i < mtab->n_pr; i++)
>         cos_vals[i] = 2*cos(a1[1+i]);
> 
>     for (i=0; i < (n_fr_s/2); i++) {
>         float st0=1., st1=1., st2=1., st3=1.;
> 
>         for (j=0; j < mtab->n_pr; j += 2) {
>             st0 *= 2*cos_TT[mag_95*(2*i+1)] + cos_vals[j+1];
>             st1 *= 2*cos_TT[mag_95*(2*i+1)] - cos_vals[j+0];
>             st2 *= 2*cos_TT[mag_95*(2*i+1)] + cos_vals[j+0];
>             st3 *= 2*cos_TT[mag_95*(2*i+1)] - cos_vals[j+1];
>         }
> 
>         a2[i]         =st3*st3 + st1*st1 + (st1*st1 - st3*st3)*cos_TT[mag_95*(2*i+1)];
>         a2[n_fr_s-i-1]=st0*st0 + st2*st2 + (st0*st0 - st2*st2)*cos_TT[mag_95*(2*i+1)];
>     }
> }

I also suspect some of CELP functions can be used instead.
 
Also Diego-like person may complain about mix of CamelCased and
not_camel_cased function names not being very consistent.

And for the rest of it: yay! Another unknown codec REd :)
Personally I hope to see some documentation for it too.




More information about the ffmpeg-devel mailing list