[Ffmpeg-devel] [PATCH] imc.c log2() removal

Kostya kostya.shishkov
Sat Nov 11 06:12:40 CET 2006


On Fri, Nov 10, 2006 at 08:38:02PM +0100, Benjamin Larsson wrote:
> $topic.
> 
> MvH
> Benjamin Larsson
> 
> -- 
> new tiny signature
> 

> Index: libavcodec/imc.c
> ===================================================================
> --- libavcodec/imc.c	(revision 6934)
> +++ libavcodec/imc.c	(working copy)
> @@ -80,7 +80,6 @@
>      float sqrt_tab[30];
>      GetBitContext gb;
>      VLC huffman_vlc[4][4];
> -    float flcf1, flcf2;
>      int decoder_reset;
>      float one_div_log2;
>  
> @@ -125,8 +124,6 @@
>  
>          q->last_fft_im[i] = 0;
>      }
> -    q->flcf1 = log2(10) * 0.05703125;
> -    q->flcf2 = log2(10) * 0.25;
>  
>      /* Generate a square root table */
>  
> @@ -236,8 +233,8 @@
>      float tmp, tmp2;
>      //maybe some frequency division thingy
>  
> -    flcoeffs1[0] = 20000.0 / pow (2, levlCoeffBuf[0] * q->flcf1);
> -    flcoeffs2[0] = log2(flcoeffs1[0]);
> +    flcoeffs1[0] = 20000.0 / pow (2, levlCoeffBuf[0] * 0.18945);

Isn't pow(2, lev * log2(10)* 0.057...) == pow(10, lev * 0.057..) ?

> +    flcoeffs2[0] = log(flcoeffs1[0])/log(2);
>      tmp = flcoeffs1[0];
>      tmp2 = flcoeffs2[0];
>  
> @@ -255,7 +252,7 @@
>                  level -=16;
>  
>              tmp  *= imc_exp_tab[15 + level];
> -            tmp2 += q->flcf2 * level;
> +            tmp2 += 0.83048 * level;
>              flcoeffs1[i] = tmp;
>              flcoeffs2[i] = tmp2;
>          }
> @@ -273,7 +270,7 @@
>          flcoeffs1[i] = 0;
>          if(levlCoeffBuf[i] < 16) {
>              flcoeffs1[i] = imc_exp_tab2[levlCoeffBuf[i]] * old_floor[i];
> -            flcoeffs2[i] = (levlCoeffBuf[i]-7) * q->flcf2 + flcoeffs2[i];
> +            flcoeffs2[i] = (levlCoeffBuf[i]-7) * 0.83048 + flcoeffs2[i];
>          } else {
>              flcoeffs1[i] = old_floor[i];
>          }
> Index: MAINTAINERS
> ===================================================================
> --- MAINTAINERS	(revision 6934)
> +++ MAINTAINERS	(working copy)
> @@ -127,6 +127,7 @@
>    h263*                                 Michael Niedermayer
>    huffyuv.c                             Michael Niedermayer
>    idcinvideo.c                          Mike Melanson
> +  imc*                                  Benjamin Larsson
>    indeo2*                               Kostya Shishkov
>    interplayvideo.c                      Mike Melanson
>    jpeg_ls.c                             Kostya Shishkov

The rest is fine to me. BTW, man log2 states it should be supported by POSIX
and BSD4.3.




More information about the ffmpeg-devel mailing list