j2k_dwt: fix scaling of 9/7 dwt

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
pull/23/head
Michael Niedermayer 12 years ago
parent ee189701a6
commit 1bbb46ff71
  1. 16
      libavcodec/j2k_dwt.c
  2. 8
      tests/ref/vsynth/vsynth1-j2k-97
  3. 8
      tests/ref/vsynth/vsynth2-j2k-97

@ -160,9 +160,9 @@ static void dwt_encode97(DWTContext *s, int *t)
// copy back and deinterleave
for (i = mh; i < lh; i+=2, j++)
t[w*lp + j] = scale97[mh] * l[i] / 2;
t[w*lp + j] = scale97[0] * l[i] / 2;
for (i = 1-mh; i < lh; i+=2, j++)
t[w*lp + j] = scale97[mh] * l[i] / 2;
t[w*lp + j] = scale97[1] * l[i] / 2;
}
// VER_SD
@ -177,9 +177,9 @@ static void dwt_encode97(DWTContext *s, int *t)
// copy back and deinterleave
for (i = mv; i < lv; i+=2, j++)
t[w*j + lp] = scale97[mv] * l[i] / 2;
t[w*j + lp] = scale97[0] * l[i] / 2;
for (i = 1-mv; i < lv; i+=2, j++)
t[w*j + lp] = scale97[mv] * l[i] / 2;
t[w*j + lp] = scale97[1] * l[i] / 2;
}
}
}
@ -288,9 +288,9 @@ static void dwt_decode97(DWTContext *s, int *t)
int i, j = 0;
// copy with interleaving
for (i = mh; i < lh; i+=2, j++)
l[i] = scale97[1-mh] * t[w*lp + j];
l[i] = scale97[1] * t[w*lp + j];
for (i = 1-mh; i < lh; i+=2, j++)
l[i] = scale97[1-mh] * t[w*lp + j];
l[i] = scale97[0] * t[w*lp + j];
sr_1d97(line, mh, mh + lh);
@ -304,9 +304,9 @@ static void dwt_decode97(DWTContext *s, int *t)
int i, j = 0;
// copy with interleaving
for (i = mv; i < lv; i+=2, j++)
l[i] = scale97[1-mv] * t[w*j + lp];
l[i] = scale97[1] * t[w*j + lp];
for (i = 1-mv; i < lv; i+=2, j++)
l[i] = scale97[1-mv] * t[w*j + lp];
l[i] = scale97[0] * t[w*j + lp];
sr_1d97(line, mv, mv + lv);

@ -1,4 +1,4 @@
a8e2db2dc6fcd4c9ea3150dc8d6d7619 *tests/data/fate/vsynth1-j2k-97.avi
2963264 tests/data/fate/vsynth1-j2k-97.avi
68f26a8d366fce47cbd003cadc861cd8 *tests/data/fate/vsynth1-j2k-97.out.rawvideo
stddev: 7.66 PSNR: 30.44 MAXDIFF: 58 bytes: 7603200/ 7603200
fc02bacb438c091a96ab327ab7aca5f9 *tests/data/fate/vsynth1-j2k-97.avi
2034146 tests/data/fate/vsynth1-j2k-97.avi
5975c315f9fd79e57e26bda1f749e8f6 *tests/data/fate/vsynth1-j2k-97.out.rawvideo
stddev: 8.77 PSNR: 29.26 MAXDIFF: 104 bytes: 7603200/ 7603200

@ -1,4 +1,4 @@
245c0ab429b553b39cac5989bb23c0ce *tests/data/fate/vsynth2-j2k-97.avi
1444170 tests/data/fate/vsynth2-j2k-97.avi
61c52045d566b70886113e2aeb8ddde4 *tests/data/fate/vsynth2-j2k-97.out.rawvideo
stddev: 7.13 PSNR: 31.06 MAXDIFF: 53 bytes: 7603200/ 7603200
316ae4cce1ba8cf0b359c9d25322711f *tests/data/fate/vsynth2-j2k-97.avi
1005146 tests/data/fate/vsynth2-j2k-97.avi
b7826bc75f9c04754d12fa01b3e69a4a *tests/data/fate/vsynth2-j2k-97.out.rawvideo
stddev: 7.91 PSNR: 30.16 MAXDIFF: 64 bytes: 7603200/ 7603200

Loading…
Cancel
Save