]> git.sesse.net Git - ffmpeg/commitdiff
speedhq: fix decoding artifacts
authorSteinar H. Gunderson <steinar+ffmpeg@gunderson.no>
Sat, 18 Feb 2017 18:41:02 +0000 (19:41 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Mon, 20 Feb 2017 23:40:20 +0000 (00:40 +0100)
The quantization table is stored in the natural order, but when we
access it, we use an index that's in zigzag order, causing us to read
the wrong value. This causes artifacts, especially in areas with
horizontal or vertical edges. The artifacts look a lot like the
DCT ringing artifacts you'd expect to see from a low-bitrate file,
but when comparing to NewTek's own decoder, it's obvious they're not
supposed to be there.

Fix by simply storing the scaled quantization table in zigzag order.
Performance is unchanged.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/speedhq.c

index 45ee37a4e6218c8986688161fbb18b827b56e781..60efb0222b2763243f188ea957c8d557f1471464 100644 (file)
@@ -409,7 +409,7 @@ static int decode_speedhq_field(const SHQContext *s, const uint8_t *buf, int buf
 static void compute_quant_matrix(int *output, int qscale)
 {
     int i;
-    for (i = 0; i < 64; i++) output[i] = unscaled_quant_matrix[i] * qscale;
+    for (i = 0; i < 64; i++) output[i] = unscaled_quant_matrix[ff_zigzag_direct[i]] * qscale;
 }
 
 static int speedhq_decode_frame(AVCodecContext *avctx,