[FFmpeg-devel] [PATCH] bink: perform scan order permutation of quantization matrices in read_dct_coeffs()

Kostya kostya.shishkov
Sun Feb 13 07:41:32 CET 2011


On Sun, Feb 13, 2011 at 02:32:58PM +1100, Peter Ross wrote:
> This fixes visual glitches in Bink version 'b' files, as the quantization tables
> were not being permutated.
> ---
>  libavcodec/bink.c     |    4 +-
>  libavcodec/binkdata.h |  618 ++++++++++++++++++++++++-------------------------
>  2 files changed, 303 insertions(+), 319 deletions(-)
> 
> diff --git a/libavcodec/bink.c b/libavcodec/bink.c
> index 928bf53..5ebf98c 100644
> --- a/libavcodec/bink.c
> +++ b/libavcodec/bink.c
> @@ -678,8 +678,8 @@ static int read_dct_coeffs(GetBitContext *gb, DCTELEM block[64], const uint8_t *
>  
>      block[0] = (block[0] * quant[0]) >> 11;
>      for (i = 0; i < coef_count; i++) {
> -        int idx = coef_idx[i];
> -        block[scan[idx]] = (block[scan[idx]] * quant[idx]) >> 11;
> +        int idx = scan[coef_idx[i]];
> +        block[idx] = (block[idx] * quant[idx]) >> 11;
>      }

1) permutation depends on DCT type selected. Maybe in future Jason will
fullfill his promise and write optimised DCT for Bink and it will require
different permutation. Then decoder will be broken.
2) you generate bink-b tables anyway so you can permutate them during creation
unlike static data we have for latter Bink versions.



More information about the ffmpeg-devel mailing list