[FFmpeg-cvslog] r24472 - trunk/libavcodec/aaccoder.c

Alex Converse alex.converse
Sat Jul 24 02:26:37 CEST 2010


On Fri, Jul 23, 2010 at 6:37 PM, alexc <subversion at mplayerhq.hu> wrote:
> Author: alexc
> Date: Sat Jul 24 00:37:42 2010
> New Revision: 24472
>
> Log:
> aacenc: Factorize some scalefactor utilities.
>
> Modified:
> ? trunk/libavcodec/aaccoder.c
>
> Modified: trunk/libavcodec/aaccoder.c
>

#define SCALE_DIV_512    36    ///< scalefactor difference that
corresponds to scale difference in 512 times
#define SCALE_ONE_POS   140    ///< scalefactor index that corresponds
to scale=1.0
#define SCALE_MAX_POS   255    ///< scalefactor index maximum value
#define SCALE_MAX_DIFF   60    ///< maximum scalefactor difference
allowed by standard
#define SCALE_DIFF_ZERO  60    ///< codebook index corresponding to
zero scalefactor indices difference


> --- trunk/libavcodec/aaccoder.c Fri Jul 23 23:46:30 2010 ? ? ? ?(r24471)
> +++ trunk/libavcodec/aaccoder.c Sat Jul 24 00:37:42 2010 ? ? ? ?(r24472)
> @@ -515,6 +515,16 @@ static void codebook_trellis_rate(AACEnc
> ? ? }
> ?}
>
> +/** Return the minimum scalefactor where the quantized coef does not clip. */
> +static av_always_inline uint8_t coef2minsf(float coef) {
> + ? ?return av_clip_uint8(log2(coef)*4 - 69 + SCALE_ONE_POS - SCALE_DIV_512);
> +}
> +
> +/** Return the maximum scalefactor where the quantized coef is not zero. */
> +static av_always_inline uint8_t coef2maxsf(float coef) {
> + ? ?return av_clip_uint8(log2(coef)*4 + ?6 + SCALE_ONE_POS - SCALE_DIV_512);
> +}
> +

= 4 * log2(coef) + 110

However

x_codec = x * exp2(-.25*(sf-100))^0.75 + .4054
1 =  x * exp2(-.25*(sf-100))^0.75 + .4054
sf = 4 * log2(x) + 104

Does this not make sense to anyone else or am I an idiot?

Regards,
Alex



More information about the ffmpeg-cvslog mailing list