avcodec/jpeg2000dwt: Support 9/7 singularity cases on the encoder side
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 17 Jun 2015 13:24:14 +0000 (15:24 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 17 Jun 2015 13:24:14 +0000 (15:24 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/jpeg2000dwt.c
tests/ref/vsynth/vsynth1-jpeg2000-97
tests/ref/vsynth/vsynth2-jpeg2000-97
tests/ref/vsynth/vsynth_lena-jpeg2000-97

index 511f223..ae150fb 100644 (file)
@@ -150,8 +150,13 @@ static void sd_1d97_float(float *p, int i0, int i1)
 {
     int i;
 
-    if (i1 == i0 + 1)
+    if (i1 <= i0 + 1) {
+        if (i0 == 1)
+            p[1] *= F_LFTG_X;
+        else
+            p[0] *= F_LFTG_K;
         return;
+    }
 
     extend97_float(p, i0, i1);
     i0++; i1++;
@@ -222,8 +227,13 @@ static void sd_1d97_int(int *p, int i0, int i1)
 {
     int i;
 
-    if (i1 == i0 + 1)
+    if (i1 <= i0 + 1) {
+        if (i0 == 1)
+            p[1] = (p[1] * I_LFTG_X + (1<<15)) >> 16;
+        else
+            p[0] = (p[0] * I_LFTG_K + (1<<15)) >> 16;
         return;
+    }
 
     extend97_int(p, i0, i1);
     i0++; i1++;
index 2d3e16c..7235245 100644 (file)
@@ -1,4 +1,4 @@
-dfb35e733795195c6519ecc37e953931 *tests/data/fate/vsynth1-jpeg2000-97.avi
-2243136 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
+95a06cbed5f085f5081653ec55a4dfe3 *tests/data/fate/vsynth1-jpeg2000-97.avi
+2243132 tests/data/fate/vsynth1-jpeg2000-97.avi
+cc52cfa56b1bbd0fb011af37a2b94170 *tests/data/fate/vsynth1-jpeg2000-97.out.rawvideo
+stddev:    6.23 PSNR: 32.23 MAXDIFF:   75 bytes:  7603200/  7603200
index e59811d..5de0222 100644 (file)
@@ -1,4 +1,4 @@
-f8880f48a46ad43623d00de15ecba2cd *tests/data/fate/vsynth2-jpeg2000-97.avi
-1467472 tests/data/fate/vsynth2-jpeg2000-97.avi
-9ec4f90641d5d0e6424184b654923676 *tests/data/fate/vsynth2-jpeg2000-97.out.rawvideo
-stddev:    6.32 PSNR: 32.11 MAXDIFF:   57 bytes:  7603200/  7603200
+156d67def9f0c1818a3e338bf85059c6 *tests/data/fate/vsynth2-jpeg2000-97.avi
+1467526 tests/data/fate/vsynth2-jpeg2000-97.avi
+f9bd95734ebc92843cfd66b418bbdb96 *tests/data/fate/vsynth2-jpeg2000-97.out.rawvideo
+stddev:    5.44 PSNR: 33.42 MAXDIFF:   57 bytes:  7603200/  7603200
index cb839c3..ea30c0d 100644 (file)
@@ -1,4 +1,4 @@
-ba27504dcabe43d6608798c9cadc5cca *tests/data/fate/vsynth_lena-jpeg2000-97.avi
-1118956 tests/data/fate/vsynth_lena-jpeg2000-97.avi
-9d69ac6d46152ed2d6dd6a90d5793c80 *tests/data/fate/vsynth_lena-jpeg2000-97.out.rawvideo
-stddev:    5.32 PSNR: 33.61 MAXDIFF:   60 bytes:  7603200/  7603200
+52771e812599277d65585b5849836bda *tests/data/fate/vsynth_lena-jpeg2000-97.avi
+1118958 tests/data/fate/vsynth_lena-jpeg2000-97.avi
+1e53a235d1378010e14859d4d0d740f7 *tests/data/fate/vsynth_lena-jpeg2000-97.out.rawvideo
+stddev:    4.94 PSNR: 34.24 MAXDIFF:   60 bytes:  7603200/  7603200