[FFmpeg-cvslog] tscc2: do not add/subtract 128 bias during DCT

Kostya Shishkov git at videolan.org
Wed Jul 18 22:44:49 CEST 2012


ffmpeg | branch: master | Kostya Shishkov <kostya.shishkov at gmail.com> | Tue Jul 17 18:12:41 2012 +0200| [4cfb0d871d4885a88061410ab8f3583018c1ac57] | committer: Kostya Shishkov

tscc2: do not add/subtract 128 bias during DCT

It turns out that the reference decoder subtracts 128 from DC during block
decode but adds it back during reordering block with zigzag pattern.
Transforming block with incorrect DC caused heavy visual artifacts for
many quantisers.

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

 libavcodec/tscc2.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/tscc2.c b/libavcodec/tscc2.c
index 91f79e2..5248c9f 100644
--- a/libavcodec/tscc2.c
+++ b/libavcodec/tscc2.c
@@ -95,7 +95,7 @@ static av_cold int init_vlcs(TSCC2Context *c)
     OP(d3, 5 * ((s0) - (s1) + (s2)) - 2 * (s3));  \
 
 #define COL_OP(a, b)  a = b
-#define ROW_OP(a, b)  a = (((b) + 0x20) >> 6) + 0x80
+#define ROW_OP(a, b)  a = ((b) + 0x20) >> 6
 
 static void tscc2_idct4_put(int *in, int q[3], uint8_t *dst, int stride)
 {
@@ -158,7 +158,7 @@ static int tscc2_decode_mb(TSCC2Context *c, int *q, int vlc_set,
             }
             dc          = (dc + prev_dc) & 0xFF;
             prev_dc     = dc;
-            c->block[0] = dc - 0x80;
+            c->block[0] = dc;
 
             nc = get_vlc2(gb, c->nc_vlc[vlc_set].table, 9, 1);
             if (nc == -1)



More information about the ffmpeg-cvslog mailing list