diff options
author | Ronald S. Bultje <rsbultje@gmail.com> | 2017-06-21 08:53:43 -0400 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2017-06-21 08:59:22 -0400 |
commit | 42dd1434bf6a7230e4175c08fcfabc3ba51a0463 (patch) | |
tree | 58c6b64246dfba0db3288d2f946f279ed59d74d9 | |
parent | 9e85c5d6a7e65c38aed6a75f9065dfa3b6c4418c (diff) | |
download | ffmpeg-42dd1434bf6a7230e4175c08fcfabc3ba51a0463.tar.gz |
mdec: use correctly permutated quant matrix for dequantization.
-rw-r--r-- | libavcodec/mdec.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libavcodec/mdec.c b/libavcodec/mdec.c index 97bfebbeb7..fabc19fd9a 100644 --- a/libavcodec/mdec.c +++ b/libavcodec/mdec.c @@ -49,6 +49,7 @@ typedef struct MDECContext { int mb_height; int mb_x, mb_y; DECLARE_ALIGNED(16, int16_t, block)[6][64]; + DECLARE_ALIGNED(16, uint16_t, quant_matrix)[64]; uint8_t *bitstream_buffer; unsigned int bitstream_buffer_size; int block_last_index[6]; @@ -61,7 +62,7 @@ static inline int mdec_decode_block_intra(MDECContext *a, int16_t *block, int n) int component; RLTable *rl = &ff_rl_mpeg1; uint8_t * const scantable = a->scantable.permutated; - const uint16_t *quant_matrix = ff_mpeg1_default_intra_matrix; + const uint16_t *quant_matrix = a->quant_matrix; const int qscale = a->qscale; /* DC coefficient */ @@ -212,6 +213,7 @@ static int decode_frame(AVCodecContext *avctx, static av_cold int decode_init(AVCodecContext *avctx) { MDECContext * const a = avctx->priv_data; + int i; if (avctx->idct_algo == FF_IDCT_AUTO) avctx->idct_algo = FF_IDCT_SIMPLE; @@ -231,6 +233,13 @@ static av_cold int decode_init(AVCodecContext *avctx) avctx->pix_fmt = AV_PIX_FMT_YUVJ420P; avctx->color_range = AVCOL_RANGE_JPEG; + /* init q matrix */ + for (i = 0; i < 64; i++) { + int j = a->idsp.idct_permutation[i]; + + a->quant_matrix[j] = ff_mpeg1_default_intra_matrix[i]; + } + return 0; } |