[FFmpeg-cvslog] cljrenc: fix scaling

Michael Niedermayer git at videolan.org
Wed Dec 28 22:26:21 CET 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Dec 28 21:29:03 2011 +0100| [a1ca45317df0993e98b4e3aec9ebdae64449478b] | committer: Michael Niedermayer

cljrenc: fix scaling

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/cljr.c      |   12 ++++++------
 tests/ref/vsynth1/cljr |    6 +++---
 tests/ref/vsynth2/cljr |    6 +++---
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/libavcodec/cljr.c b/libavcodec/cljr.c
index 2b0142b..daa13e5 100644
--- a/libavcodec/cljr.c
+++ b/libavcodec/cljr.c
@@ -161,13 +161,13 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf,
             case 1: dither = dither * 1664525 + 1013904223;    break;
             case 2: dither = ordered_dither[ y&1 ][ (x>>2)&1 ];break;
             }
-            put_bits(&pb, 5, (luma[3] +  (dither>>29)   ) >> 3);
-            put_bits(&pb, 5, (luma[2] + ((dither>>26)&7)) >> 3);
-            put_bits(&pb, 5, (luma[1] + ((dither>>23)&7)) >> 3);
-            put_bits(&pb, 5, (luma[0] + ((dither>>20)&7)) >> 3);
+            put_bits(&pb, 5, (249*(luma[3] +  (dither>>29)   )) >> 11);
+            put_bits(&pb, 5, (249*(luma[2] + ((dither>>26)&7))) >> 11);
+            put_bits(&pb, 5, (249*(luma[1] + ((dither>>23)&7))) >> 11);
+            put_bits(&pb, 5, (249*(luma[0] + ((dither>>20)&7))) >> 11);
             luma += 4;
-            put_bits(&pb, 6, (*(cb++) + ((dither>>18)&3)) >> 2);
-            put_bits(&pb, 6, (*(cr++) + ((dither>>16)&3)) >> 2);
+            put_bits(&pb, 6, (253*(*(cb++) + ((dither>>18)&3))) >> 10);
+            put_bits(&pb, 6, (253*(*(cr++) + ((dither>>16)&3))) >> 10);
         }
     }
 
diff --git a/tests/ref/vsynth1/cljr b/tests/ref/vsynth1/cljr
index 9a7a980..181f32f 100644
--- a/tests/ref/vsynth1/cljr
+++ b/tests/ref/vsynth1/cljr
@@ -1,4 +1,4 @@
-ff4eebcd5bd7b6470f97867cdecb0bec *./tests/data/vsynth1/cljr.avi
+041982e4fa83428c621a127647d47b3f *./tests/data/vsynth1/cljr.avi
  5075660 ./tests/data/vsynth1/cljr.avi
-0d473eb49653a05685178dd261de861c *./tests/data/cljr.vsynth1.out.yuv
-stddev:   30.70 PSNR: 18.39 MAXDIFF:  255 bytes:  7603200/  7603200
+f5173ae479fc104903b203260cadf507 *./tests/data/cljr.vsynth1.out.yuv
+stddev:   30.71 PSNR: 18.38 MAXDIFF:  225 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth2/cljr b/tests/ref/vsynth2/cljr
index cf3c8e1..4a69a4c 100644
--- a/tests/ref/vsynth2/cljr
+++ b/tests/ref/vsynth2/cljr
@@ -1,4 +1,4 @@
-8ca3f24da468f32561100d3a1a71348d *./tests/data/vsynth2/cljr.avi
+fdc1926e0a599de94513f0a3472b598f *./tests/data/vsynth2/cljr.avi
  5075660 ./tests/data/vsynth2/cljr.avi
-a0126ba9f2b2192b6b63b485e0118114 *./tests/data/cljr.vsynth2.out.yuv
-stddev:   10.26 PSNR: 27.90 MAXDIFF:   62 bytes:  7603200/  7603200
+3db163e55149786e7cf5499b3387bdb1 *./tests/data/cljr.vsynth2.out.yuv
+stddev:   10.80 PSNR: 27.46 MAXDIFF:   65 bytes:  7603200/  7603200



More information about the ffmpeg-cvslog mailing list