[FFmpeg-devel] [PATCH] lavc/aacenc_quantization: use cbrt table

Ganesh Ajjanagadde gajjanag at gmail.com
Tue Mar 15 01:24:22 CET 2016


On Mon, Mar 14, 2016 at 2:13 PM, Claudio Freire <klaussfreire at gmail.com> wrote:
> On Sun, Mar 13, 2016 at 10:30 PM, Ganesh Ajjanagadde <gajjanag at gmail.com> wrote:
>>  /**
>>   * Calculate rate distortion cost for quantizing with given codebook
>> @@ -105,7 +106,7 @@ static av_always_inline float quantize_and_encode_band_cost_template(
>>                          curbits += 21;
>>                      } else {
>>                          int c = av_clip_uintp2(quant(t, Q, ROUNDING), 13);
>> -                        quantized = c*cbrtf(c)*IQ;
>> +                        quantized = av_int2float(ff_cbrt_tab[c])*IQ;
>>                          curbits += av_log2(c)*2 - 4 + 1;
>>                      }
>>                  } else {
>
> Shouldn't that be c*av_int2float(ff_cbrt_tab[c])*IQ ?

cbrt_tab is a very unfortunate misnomer that stuck for a long time, it
is actually really x^(4/3). See e.g git checkout a9d986
libavcodec/cbrt_tablegen.h.


More information about the ffmpeg-devel mailing list