diff mbox

[FFmpeg-devel,13/14] avcodec/vc1: correct AC inverse quantization scaling

Message ID 6bd8c5ed-f96f-1a87-7f5f-e08c399475c0@carpalis.nl
State New
Headers show

Commit Message

Jerome Borsboom April 23, 2018, 7 p.m. UTC
HALFQP should only be added to the inverse quantizer when the block is
coded with PQUANT. See 8.1.3.8 in VC-1 spec.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
---
 libavcodec/vc1_block.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/libavcodec/vc1_block.c b/libavcodec/vc1_block.c
index 7d6d5c781c..af40fbd21d 100644
--- a/libavcodec/vc1_block.c
+++ b/libavcodec/vc1_block.c
@@ -944,7 +944,7 @@  static int vc1_decode_intra_block(VC1Context *v, int16_t block[64], int n,
     ac_val = s->ac_val[0][0] + s->block_index[n] * 16;
     ac_val2 = ac_val;
 
-    scale = mquant * 2 + v->halfpq;
+    scale = mquant * 2 + ((mquant == v->pq) ? v->halfpq : 0);
 
     if (dc_pred_dir) //left
         ac_val -= 16;