[FFmpeg-cvslog] avcodec/jpeg2000dwt: merge rescaling with interleave in 9/7 int IDWT

Michael Niedermayer git at videolan.org
Mon Jun 3 13:29:15 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Jun  2 22:21:14 2013 +0200| [8a266aaaacc0610c9ee1e3563ef345c46decb2b0] | committer: Michael Niedermayer

avcodec/jpeg2000dwt: merge rescaling with interleave in 9/7 int IDWT

Tha fate tests change because the edge mirroring was wrong before this commit

Reviewed-by: Nicolas BERTRAND <nicoinattendu at gmail.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/jpeg2000dwt.c             |   19 ++++++-------------
 tests/ref/vsynth/vsynth1-jpeg2000-97 |    4 ++--
 tests/ref/vsynth/vsynth2-jpeg2000-97 |    4 ++--
 3 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/libavcodec/jpeg2000dwt.c b/libavcodec/jpeg2000dwt.c
index 13712d9..266edec 100644
--- a/libavcodec/jpeg2000dwt.c
+++ b/libavcodec/jpeg2000dwt.c
@@ -431,13 +431,6 @@ static void sr_1d97_int(int32_t *p, int i0, int i1)
 
     extend97_int(p, i0, i1);
 
-    /*step 1*/
-    for (i = i0 / 2 - 1; i < i1 / 2 + 2; i++)
-        p[2 * i]      = ((p[2 * i] * I_LFTG_K)     + (1 << 15)) >> 16;
-    /* step 2*/
-    for (i = i0 / 2 - 2; i < i1 / 2 + 2; i++)
-        p[2 * i + 1]  = ((p[2 * i + 1] * I_LFTG_X) + (1 << 15)) >> 16;
-    /* step 3*/
     for (i = i0 / 2 - 1; i < i1 / 2 + 2; i++)
         p[2 * i]     -= (I_LFTG_DELTA * (p[2 * i - 1] + p[2 * i + 1]) + (1 << 15)) >> 16;
     /* step 4 */
@@ -471,11 +464,11 @@ static void dwt_decode97_int(DWTContext *s, int32_t *t)
         l = line + mh;
         for (lp = 0; lp < lv; lp++) {
             int i, j = 0;
-            // copy with interleaving
+            // rescale with interleaving
             for (i = mh; i < lh; i += 2, j++)
-                l[i] = data[w * lp + j];
+                l[i] = ((data[w * lp + j] * I_LFTG_K) + (1 << 15)) >> 16;
             for (i = 1 - mh; i < lh; i += 2, j++)
-                l[i] = data[w * lp + j];
+                l[i] = ((data[w * lp + j] * I_LFTG_X) + (1 << 15)) >> 16;
 
             sr_1d97_int(line, mh, mh + lh);
 
@@ -487,11 +480,11 @@ static void dwt_decode97_int(DWTContext *s, int32_t *t)
         l = line + mv;
         for (lp = 0; lp < lh; lp++) {
             int i, j = 0;
-            // copy with interleaving
+            // rescale with interleaving
             for (i = mv; i < lv; i += 2, j++)
-                l[i] = data[w * j + lp];
+                l[i] = ((data[w * j + lp] * I_LFTG_K) + (1 << 15)) >> 16;
             for (i = 1 - mv; i < lv; i += 2, j++)
-                l[i] = data[w * j + lp];
+                l[i] = ((data[w * j + lp] * I_LFTG_X) + (1 << 15)) >> 16;
 
             sr_1d97_int(line, mv, mv + lv);
 
diff --git a/tests/ref/vsynth/vsynth1-jpeg2000-97 b/tests/ref/vsynth/vsynth1-jpeg2000-97
index f219406..f8399f2 100644
--- a/tests/ref/vsynth/vsynth1-jpeg2000-97
+++ b/tests/ref/vsynth/vsynth1-jpeg2000-97
@@ -1,4 +1,4 @@
 c135eb14e9f219242180270c2a242634 *tests/data/fate/vsynth1-jpeg2000-97.avi
 2243132 tests/data/fate/vsynth1-jpeg2000-97.avi
-30a9c13e18fe4acaf28062b5003bb671 *tests/data/fate/vsynth1-jpeg2000-97.out.rawvideo
-stddev:    6.41 PSNR: 31.99 MAXDIFF:   75 bytes:  7603200/  7603200
+e1a095b40d7f6440f6c46f2995c4759c *tests/data/fate/vsynth1-jpeg2000-97.out.rawvideo
+stddev:    6.23 PSNR: 32.23 MAXDIFF:   75 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth/vsynth2-jpeg2000-97 b/tests/ref/vsynth/vsynth2-jpeg2000-97
index 001e840..e7fce13 100644
--- a/tests/ref/vsynth/vsynth2-jpeg2000-97
+++ b/tests/ref/vsynth/vsynth2-jpeg2000-97
@@ -1,4 +1,4 @@
 3ac3e49a89136bddde9e44bac3e5b4ed *tests/data/fate/vsynth2-jpeg2000-97.avi
 1118952 tests/data/fate/vsynth2-jpeg2000-97.avi
-9d69ac6d46152ed2d6dd6a90d5793c80 *tests/data/fate/vsynth2-jpeg2000-97.out.rawvideo
-stddev:    5.32 PSNR: 33.61 MAXDIFF:   60 bytes:  7603200/  7603200
+8ac8b9ee81fa73c873668e9f6b78764d *tests/data/fate/vsynth2-jpeg2000-97.out.rawvideo
+stddev:    4.95 PSNR: 34.23 MAXDIFF:   60 bytes:  7603200/  7603200



More information about the ffmpeg-cvslog mailing list