[FFmpeg-cvslog] speedhq: fix decoding artifacts

Steinar H. Gunderson git at videolan.org
Tue Feb 21 01:42:54 EET 2017


ffmpeg | branch: master | Steinar H. Gunderson <steinar+ffmpeg at gunderson.no> | Sat Feb 18 19:41:02 2017 +0100| [e3c14eaa54c87d4d8771bc75cb24b0b537fbcd19] | committer: Michael Niedermayer

speedhq: fix decoding artifacts

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 at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e3c14eaa54c87d4d8771bc75cb24b0b537fbcd19
---

 libavcodec/speedhq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/speedhq.c b/libavcodec/speedhq.c
index 45ee37a..60efb02 100644
--- a/libavcodec/speedhq.c
+++ b/libavcodec/speedhq.c
@@ -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,



More information about the ffmpeg-cvslog mailing list