ref: 19ba5a9431f2ed19c129d3e657df6290ddb97dfe
parent: d88abfec51e91832a64f36f90c7c61ce67a79333
author: Ronald S. Bultje <[email protected]>
date: Tue Sep 25 04:35:54 EDT 2018
Fix minor reconstruction bugs for 10-bit content.
--- a/src/ipred.c
+++ b/src/ipred.c
@@ -133,25 +133,39 @@
dc += topleft[-(i + 1)]; \
dc_gen)
+#if BITDEPTH == 8
+#define MULTIPLIER_1x2 0x5556
+#define MULTIPLIER_1x4 0x3334
+#define BASE_SHIFT 16
+#else
+#define MULTIPLIER_1x2 0xAAAB
+#define MULTIPLIER_1x4 0x6667
+#define BASE_SHIFT 17
+#endif
+
dc2d_lfn( 4, 4, dc >>= 3)
-dc2d_lfn( 4, 8, dc = iclip_pixel(0x5556 * dc >> 18))
-dc2d_lfn( 4, 16, dc = iclip_pixel(0x3334 * dc >> 18))
-dc2d_lfn( 8, 4, dc = iclip_pixel(0x5556 * dc >> 18))
+dc2d_lfn( 4, 8, dc = iclip_pixel(MULTIPLIER_1x2 * dc >> (BASE_SHIFT + 2)))
+dc2d_lfn( 4, 16, dc = iclip_pixel(MULTIPLIER_1x4 * dc >> (BASE_SHIFT + 2)))
+dc2d_lfn( 8, 4, dc = iclip_pixel(MULTIPLIER_1x2 * dc >> (BASE_SHIFT + 2)))
dc2d_lfn( 8, 8, dc >>= 4)
-dc2d_lfn( 8, 16, dc = iclip_pixel(0x5556 * dc >> 19))
-dc2d_lfn( 8, 32, dc = iclip_pixel(0x3334 * dc >> 19))
-dc2d_lfn(16, 4, dc = iclip_pixel(0x3334 * dc >> 18))
-dc2d_lfn(16, 8, dc = iclip_pixel(0x5556 * dc >> 19))
+dc2d_lfn( 8, 16, dc = iclip_pixel(MULTIPLIER_1x2 * dc >> (BASE_SHIFT + 3)))
+dc2d_lfn( 8, 32, dc = iclip_pixel(MULTIPLIER_1x4 * dc >> (BASE_SHIFT + 3)))
+dc2d_lfn(16, 4, dc = iclip_pixel(MULTIPLIER_1x4 * dc >> (BASE_SHIFT + 2)))
+dc2d_lfn(16, 8, dc = iclip_pixel(MULTIPLIER_1x2 * dc >> (BASE_SHIFT + 3)))
dc2d_lfn(16, 16, dc >>= 5)
-dc2d_lfn(16, 32, dc = iclip_pixel(0x5556 * dc >> 20))
-dc2d_lfn(16, 64, dc = iclip_pixel(0x3334 * dc >> 20))
-dc2d_lfn(32, 8, dc = iclip_pixel(0x3334 * dc >> 19))
-dc2d_lfn(32, 16, dc = iclip_pixel(0x5556 * dc >> 20))
+dc2d_lfn(16, 32, dc = iclip_pixel(MULTIPLIER_1x2 * dc >> (BASE_SHIFT + 4)))
+dc2d_lfn(16, 64, dc = iclip_pixel(MULTIPLIER_1x4 * dc >> (BASE_SHIFT + 4)))
+dc2d_lfn(32, 8, dc = iclip_pixel(MULTIPLIER_1x4 * dc >> (BASE_SHIFT + 3)))
+dc2d_lfn(32, 16, dc = iclip_pixel(MULTIPLIER_1x2 * dc >> (BASE_SHIFT + 4)))
dc2d_lfn(32, 32, dc >>= 6)
-dc2d_lfn(32, 64, dc = iclip_pixel(0x5556 * dc >> 21))
-dc2d_lfn(64, 16, dc = iclip_pixel(0x3334 * dc >> 20))
-dc2d_lfn(64, 32, dc = iclip_pixel(0x5556 * dc >> 21))
+dc2d_lfn(32, 64, dc = iclip_pixel(MULTIPLIER_1x2 * dc >> (BASE_SHIFT + 5)))
+dc2d_lfn(64, 16, dc = iclip_pixel(MULTIPLIER_1x4 * dc >> (BASE_SHIFT + 4)))
+dc2d_lfn(64, 32, dc = iclip_pixel(MULTIPLIER_1x2 * dc >> (BASE_SHIFT + 5)))
dc2d_lfn(64, 64, dc >>= 7)
+
+#undef MULTIPLIER_1x2
+#undef MULTIPLIER_1x4
+#undef BASE_SHIFT
#define dc128_lfn(width, height) \
dc_lfn(width, height, 128, const unsigned dc = (1 << BITDEPTH) >> 1)
--- a/src/loopfilter.c
+++ b/src/loopfilter.c
@@ -136,8 +136,8 @@
int f = iclip_diff(p1 - q1), f1, f2;
f = iclip_diff(3 * (q0 - p0) + f);
- f1 = imin(f + 4, 127) >> 3;
- f2 = imin(f + 3, 127) >> 3;
+ f1 = imin(f + 4, (128 << (BITDEPTH - 8)) - 1) >> 3;
+ f2 = imin(f + 3, (128 << (BITDEPTH - 8)) - 1) >> 3;
dst[strideb * -1] = iclip_pixel(p0 + f2);
dst[strideb * +0] = iclip_pixel(q0 - f1);
@@ -144,8 +144,8 @@
} else {
int f = iclip_diff(3 * (q0 - p0)), f1, f2;
- f1 = imin(f + 4, 127) >> 3;
- f2 = imin(f + 3, 127) >> 3;
+ f1 = imin(f + 4, (128 << (BITDEPTH - 8)) - 1) >> 3;
+ f2 = imin(f + 3, (128 << (BITDEPTH - 8)) - 1) >> 3;
dst[strideb * -1] = iclip_pixel(p0 + f2);
dst[strideb * +0] = iclip_pixel(q0 - f1);
--- a/src/recon.c
+++ b/src/recon.c
@@ -1237,8 +1237,8 @@
0, uvdst, f->cur.p.stride[1],
top_sb_edge, m,
&angle, cbw4, cbh4, tl_edge);
- dsp->ipred.intra_pred[ii_tx][m](tmp, cbw4 * 4, tl_edge, 0);
- dsp->mc.blend(uvdst, f->cur.p.stride[1], tmp, cbw4 * 4,
+ dsp->ipred.intra_pred[ii_tx][m](tmp, cbw4 * 4 * sizeof(pixel), tl_edge, 0);
+ dsp->mc.blend(uvdst, f->cur.p.stride[1], tmp, cbw4 * 4 * sizeof(pixel),
cbw4 * 4, cbh4 * 4, ii_mask, cbw4 * 4);
}
}