avcodec/jpeg2000dwt: Fix order of operations in integer decomposition wavelets
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 19 Jun 2015 22:41:12 +0000 (00:41 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 19 Jun 2015 22:53:56 +0000 (00:53 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/jpeg2000dwt.c
tests/ref/vsynth/vsynth1-jpeg2000
tests/ref/vsynth/vsynth1-jpeg2000-97
tests/ref/vsynth/vsynth2-jpeg2000
tests/ref/vsynth/vsynth2-jpeg2000-97
tests/ref/vsynth/vsynth3-jpeg2000
tests/ref/vsynth/vsynth3-jpeg2000-97
tests/ref/vsynth/vsynth_lena-jpeg2000
tests/ref/vsynth/vsynth_lena-jpeg2000-97

index ae150fb..381764f 100644 (file)
@@ -111,22 +111,6 @@ static void dwt_encode53(DWTContext *s, int *t)
         int *l;
 
         av_assert1(!mh && !mv);
-        // HOR_SD
-        l = line + mh;
-        for (lp = 0; lp < lv; lp++){
-            int i, j = 0;
-
-            for (i = 0; i < lh; i++)
-                l[i] = t[w*lp + i];
-
-            sd_1d53(line, mh, mh + lh);
-
-            // copy back and deinterleave
-            for (i =   mh; i < lh; i+=2, j++)
-                t[w*lp + j] = l[i];
-            for (i = 1-mh; i < lh; i+=2, j++)
-                t[w*lp + j] = l[i];
-        }
 
         // VER_SD
         l = line + mv;
@@ -144,6 +128,23 @@ static void dwt_encode53(DWTContext *s, int *t)
             for (i = 1-mv; i < lv; i+=2, j++)
                 t[w*j + lp] = l[i];
         }
+
+        // HOR_SD
+        l = line + mh;
+        for (lp = 0; lp < lv; lp++){
+            int i, j = 0;
+
+            for (i = 0; i < lh; i++)
+                l[i] = t[w*lp + i];
+
+            sd_1d53(line, mh, mh + lh);
+
+            // copy back and deinterleave
+            for (i =   mh; i < lh; i+=2, j++)
+                t[w*lp + j] = l[i];
+            for (i = 1-mh; i < lh; i+=2, j++)
+                t[w*lp + j] = l[i];
+        }
     }
 }
 static void sd_1d97_float(float *p, int i0, int i1)
@@ -265,6 +266,23 @@ static void dwt_encode97_int(DWTContext *s, int *t)
 
         av_assert1(!mh && !mv);
 
+        // VER_SD
+        l = line + mv;
+        for (lp = 0; lp < lh; lp++) {
+            int i, j = 0;
+
+            for (i = 0; i < lv; i++)
+                l[i] = t[w*i + lp];
+
+            sd_1d97_int(line, mv, mv + lv);
+
+            // copy back and deinterleave
+            for (i =   mv; i < lv; i+=2, j++)
+                t[w*j + lp] = ((l[i] * I_LFTG_X) + (1 << 16)) >> 17;
+            for (i = 1-mv; i < lv; i+=2, j++)
+                t[w*j + lp] = ((l[i] * I_LFTG_K) + (1 << 16)) >> 17;
+        }
+
         // HOR_SD
         l = line + mh;
         for (lp = 0; lp < lv; lp++){
@@ -282,22 +300,6 @@ static void dwt_encode97_int(DWTContext *s, int *t)
                 t[w*lp + j] = ((l[i] * I_LFTG_K) + (1 << 16)) >> 17;
         }
 
-        // VER_SD
-        l = line + mv;
-        for (lp = 0; lp < lh; lp++) {
-            int i, j = 0;
-
-            for (i = 0; i < lv; i++)
-                l[i] = t[w*i + lp];
-
-            sd_1d97_int(line, mv, mv + lv);
-
-            // copy back and deinterleave
-            for (i =   mv; i < lv; i+=2, j++)
-                t[w*j + lp] = ((l[i] * I_LFTG_X) + (1 << 16)) >> 17;
-            for (i = 1-mv; i < lv; i+=2, j++)
-                t[w*j + lp] = ((l[i] * I_LFTG_K) + (1 << 16)) >> 17;
-        }
     }
 }
 
index 5a93be0..2f7ea3c 100644 (file)
@@ -1,4 +1,4 @@
-5572e09ae6826a5671fc868da4b153f5 *tests/data/fate/vsynth1-jpeg2000.avi
-2261220 tests/data/fate/vsynth1-jpeg2000.avi
-5cdeb5efd2343994b949718e278819f2 *tests/data/fate/vsynth1-jpeg2000.out.rawvideo
-stddev:    5.37 PSNR: 33.53 MAXDIFF:   60 bytes:  7603200/  7603200
+c742e656f20e6f4dfcf39d3c00a4d78c *tests/data/fate/vsynth1-jpeg2000.avi
+2265498 tests/data/fate/vsynth1-jpeg2000.avi
+15a8e49f6fd014193bbafd72f84936c7 *tests/data/fate/vsynth1-jpeg2000.out.rawvideo
+stddev:    5.36 PSNR: 33.55 MAXDIFF:   61 bytes:  7603200/  7603200
index a959e3b..6be35d9 100644 (file)
@@ -1,4 +1,4 @@
-26fdfa1bd7c072002ba9a8feefb8092a *tests/data/fate/vsynth1-jpeg2000-97.avi
-2200030 tests/data/fate/vsynth1-jpeg2000-97.avi
-99f8f9436e6d9d42a71e3d2a90de61d0 *tests/data/fate/vsynth1-jpeg2000-97.out.rawvideo
-stddev:    6.21 PSNR: 32.27 MAXDIFF:   60 bytes:  7603200/  7603200
+0bbcba25aaf987d1719a12c3f6e5a333 *tests/data/fate/vsynth1-jpeg2000-97.avi
+2188416 tests/data/fate/vsynth1-jpeg2000-97.avi
+9dd595c219b4ab5219a96b08cd18851f *tests/data/fate/vsynth1-jpeg2000-97.out.rawvideo
+stddev:    6.19 PSNR: 32.30 MAXDIFF:   57 bytes:  7603200/  7603200
index caedf80..0a9df9b 100644 (file)
@@ -1,4 +1,4 @@
-5118a520a8f776493ee6aeef9849e4a4 *tests/data/fate/vsynth2-jpeg2000.avi
-1495578 tests/data/fate/vsynth2-jpeg2000.avi
-025b1592f31bc71bb249af7e1124b50b *tests/data/fate/vsynth2-jpeg2000.out.rawvideo
-stddev:    5.00 PSNR: 34.14 MAXDIFF:   59 bytes:  7603200/  7603200
+618d3b5c498a0fde4debce5235fcc334 *tests/data/fate/vsynth2-jpeg2000.avi
+1494316 tests/data/fate/vsynth2-jpeg2000.avi
+36afd96d6e55bc83166fd615351ba366 *tests/data/fate/vsynth2-jpeg2000.out.rawvideo
+stddev:    5.00 PSNR: 34.15 MAXDIFF:   59 bytes:  7603200/  7603200
index 3bae07d..0c0782e 100644 (file)
@@ -1,4 +1,4 @@
-f72998d38afd03608e918a73a122595f *tests/data/fate/vsynth2-jpeg2000-97.avi
-1451520 tests/data/fate/vsynth2-jpeg2000-97.avi
-3351e4a11b4da2971194be7f571f2655 *tests/data/fate/vsynth2-jpeg2000-97.out.rawvideo
-stddev:    5.40 PSNR: 33.47 MAXDIFF:   58 bytes:  7603200/  7603200
+1894f3c438f817b6101a444e2af430d3 *tests/data/fate/vsynth2-jpeg2000-97.avi
+1448224 tests/data/fate/vsynth2-jpeg2000-97.avi
+c95f2c7138ec20a6f388d1d945cf0cf4 *tests/data/fate/vsynth2-jpeg2000-97.out.rawvideo
+stddev:    5.35 PSNR: 33.56 MAXDIFF:   55 bytes:  7603200/  7603200
index 404cb18..0f4c8f4 100644 (file)
@@ -1,4 +1,4 @@
-a9f02a1a91b1c261835ad457a18960e4 *tests/data/fate/vsynth3-jpeg2000.avi
-65358 tests/data/fate/vsynth3-jpeg2000.avi
-861d660c6618202cbbc70b71d5eae25b *tests/data/fate/vsynth3-jpeg2000.out.rawvideo
-stddev:    5.49 PSNR: 33.32 MAXDIFF:   47 bytes:    86700/    86700
+6a0f2a14f6b4628c8c51c360d7355093 *tests/data/fate/vsynth3-jpeg2000.avi
+65348 tests/data/fate/vsynth3-jpeg2000.avi
+2d8bd94d558755c47d7e23fd9556e164 *tests/data/fate/vsynth3-jpeg2000.out.rawvideo
+stddev:    5.48 PSNR: 33.34 MAXDIFF:   47 bytes:    86700/    86700
index c0b19c2..6af082d 100644 (file)
@@ -1,4 +1,4 @@
-696175c8fe6673baa7f91d5e0844c053 *tests/data/fate/vsynth3-jpeg2000-97.avi
-66706 tests/data/fate/vsynth3-jpeg2000-97.avi
-38058e324177a0ff064b48497ac2af4b *tests/data/fate/vsynth3-jpeg2000-97.out.rawvideo
-stddev:    6.26 PSNR: 32.19 MAXDIFF:   54 bytes:    86700/    86700
+324eac3241a5580725ba817a9d60f3f3 *tests/data/fate/vsynth3-jpeg2000-97.avi
+66568 tests/data/fate/vsynth3-jpeg2000-97.avi
+eb32ff15b5a23fc29cedd43430e1d46a *tests/data/fate/vsynth3-jpeg2000-97.out.rawvideo
+stddev:    6.15 PSNR: 32.35 MAXDIFF:   47 bytes:    86700/    86700
index 2b27899..cbb25b4 100644 (file)
@@ -1,4 +1,4 @@
-f47a18d3e5fc745e79d5677cbf65a66d *tests/data/fate/vsynth_lena-jpeg2000.avi
-1137232 tests/data/fate/vsynth_lena-jpeg2000.avi
-7630a7f2ae57be5827b4ade8323717e5 *tests/data/fate/vsynth_lena-jpeg2000.out.rawvideo
-stddev:    4.41 PSNR: 35.24 MAXDIFF:   58 bytes:  7603200/  7603200
+90976c5b9539111b33a46b4c882a3cb0 *tests/data/fate/vsynth_lena-jpeg2000.avi
+1137854 tests/data/fate/vsynth_lena-jpeg2000.avi
+955653ca7a08447e7b1501b444f24562 *tests/data/fate/vsynth_lena-jpeg2000.out.rawvideo
+stddev:    4.40 PSNR: 35.25 MAXDIFF:   58 bytes:  7603200/  7603200
index bcdb758..ce90be0 100644 (file)
@@ -1,4 +1,4 @@
-718f89507f5dfcf703290b9db796a073 *tests/data/fate/vsynth_lena-jpeg2000-97.avi
-1106208 tests/data/fate/vsynth_lena-jpeg2000-97.avi
-44f4d7a4cb6b0de932e2538fa75e983c *tests/data/fate/vsynth_lena-jpeg2000-97.out.rawvideo
-stddev:    4.91 PSNR: 34.30 MAXDIFF:   54 bytes:  7603200/  7603200
+aebe3eaa1fa5c6698cd1abc8d0569d7f *tests/data/fate/vsynth_lena-jpeg2000-97.avi
+1105382 tests/data/fate/vsynth_lena-jpeg2000-97.avi
+32069295493de2b3e348ecbed2ff41ab *tests/data/fate/vsynth_lena-jpeg2000-97.out.rawvideo
+stddev:    4.85 PSNR: 34.41 MAXDIFF:   58 bytes:  7603200/  7603200