[FFmpeg-devel] [RFC] TwinVQ decoder

Kostya kostya.shishkov
Sun Mar 8 07:07:45 CET 2009


On Sat, Mar 07, 2009 at 10:51:40PM +0100, Vitor Sessak wrote:
> Kostya wrote:
> > 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)
> 
> I'll look into it. What I find a bit surprising, is that there is no 
> equivalent to mulddd() in DSPutils, only the following:
> 
>       while(cont--)
>           *buf2++ *= (*buf1++);
 
vector_fmul
vector_fmul_reverse?
 
> > [...] 
> >> 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.
> 
> Thanks for the tip. Also, if any audio codec expert find other functions 
> already implemented somewhere else in FFmpeg, it would be very 
> appreciated...

look into libavcodec/lsp.[ch]
 
> > Also Diego-like person may complain about mix of CamelCased and
> > not_camel_cased function names not being very consistent.
> 
> I'll fix it before review. I have yet to find nice names to a lot of 
> functions/vars...
> 
> > And for the rest of it: yay! Another unknown codec REd :)
> 
> ;)
> 
> -Vitor




More information about the ffmpeg-devel mailing list