> From: Mathew Hendry [mailto:[EMAIL PROTECTED]]
> 
> > From: "Takehiro Tominaga" <[EMAIL PROTECTED]>
> >
> > so if you want to change,
> > 
> > >diff -r1.2 takehiro.c
> > >540c540
> > ><   {
> > >---
> > >>   if (highq) {
> > 
> > you should changed to make ix range check in choose_table().
> 
> And choose_table_short, I suppose. Something like
> 
> [...]

Can improve hq mode speed a bit as well. The bounds check within count_bits
can be removed entirely with this patch to quantize-pvt.c and takehiro.c.
Any obvious problems?

In quantize-pvt.c I've also adjusted iteration_init to use the pow43 lookup
table to generate adj43asm. Should be a bit faster, and fixes a bug which
would leave the last entry in the array uninitialised.

diff -r1.11 quantize-pvt.c
133,137c133,135
< 
<     adj43asm[0]=0.0;
<     for (i = 1; i < PRECALC_SIZE - 1; i++)
<     adj43asm[i] = i -.5 - pow(0.5 * (pow((double)(i - 1), 4.0/3.0)
<                          + pow((double)i,4.0/3.0)), 0.75);
---
>     adj43asm[0] = 0.0;
>     for (i = 1; i < PRECALC_SIZE; i++)
>         adj43asm[i] = i - 0.5 - pow(0.5 * (pow43[i - 1] + pow43[i]),
0.75);
376a375
>     FLOAT8 xrp_max;
378a378,390
> 
>     if (highq) {
>         int i;
>         const FLOAT8 *xrp = xrpow;
>         xrp_max = 0;
>         for (i = 576 / 4; i > 0; --i, xrp += 4) {
>             if (xrp[0] > xrp_max) xrp_max = xrp[0];
>             if (xrp[1] > xrp_max) xrp_max = xrp[1];
>             if (xrp[2] > xrp_max) xrp_max = xrp[2];
>             if (xrp[3] > xrp_max) xrp_max = xrp[3];
>         }
>     }
> 
381,382c393,398
<       cod_info->quantizerStepSize += 1.0;
<       bits = count_bits(l3_enc[gr][ch], xrpow, cod_info);  
---
>         cod_info->quantizerStepSize += 1.0;
>         if (highq && xrp_max * pow(2.0, cod_info->quantizerStepSize *
-0.1875) >= PRECALC_SIZE - 0.5) {
>             bits = 100000;
>         } else {
>             bits = count_bits(l3_enc[gr][ch], xrpow, cod_info);  
>         }
982a999,1012
>     FLOAT8 xrp_max;
> 
>     if (highq) {
>         int i;
>         const FLOAT8 *xrp = xrspow;
>         xrp_max = 0;
>         for (i = 576 / 4; i > 0; --i, xrp += 4) {
>             if (xrp[0] > xrp_max) xrp_max = xrp[0];
>             if (xrp[1] > xrp_max) xrp_max = xrp[1];
>             if (xrp[2] > xrp_max) xrp_max = xrp[2];
>             if (xrp[3] > xrp_max) xrp_max = xrp[3];
>         }
>     }
> 
986c1016,1020
<       nBits = count_bits(ix, xrspow, cod_info);  
---
>         if (highq && xrp_max * pow(2.0, cod_info->quantizerStepSize *
-0.1875) >= PRECALC_SIZE - 0.5) {
>             nBits = 100000;
>         } else {
>             nBits = count_bits(ix, xrspow, cod_info);  
>         }

diff -r1.3 takehiro.c
549a550,551
> 
> /*
556a559,560
> */
> 

-- Mat.
--
MP3 ENCODER mailing list ( http://geek.rcc.se/mp3encoder/ )

Reply via email to