28 #define ipixel uint8_t
30 #define ipixel uint16_t
36 #define fn3(a,b,c,d) a##_##d##p##b##to##c##_c
37 #define fn2(a,b,c,d) fn3(a,b,c,d)
38 #define fn(a) fn2(a, IN_BIT_DEPTH, OUT_BIT_DEPTH, ss)
40 static void fn(
yuv2yuv)(uint8_t *_dst[3],
const ptrdiff_t dst_stride[3],
41 uint8_t *_src[3],
const ptrdiff_t src_stride[3],
42 int w,
int h,
const int16_t
c[3][3][8],
43 const int16_t yuv_offset[2][8])
48 opixel *dst0 = dst[0], *dst1 = dst[1], *dst2 = dst[2];
51 const int rnd = 1 << (sh - 1);
52 int y_off_in = yuv_offset[0][0];
53 int y_off_out = yuv_offset[1][0] << sh;
56 int cyy =
c[0][0][0], cyu =
c[0][1][0], cyv =
c[0][2][0];
57 int cuu =
c[1][1][0], cuv =
c[1][2][0], cvu =
c[2][1][0], cvv =
c[2][2][0];
63 for (y = 0; y <
h; y++) {
64 for (x = 0; x <
w; x++) {
65 int y00 =
src0[x <<
SS_W] - y_off_in;
67 int y01 =
src0[2 * x + 1] - y_off_in;
69 int y10 =
src0[src_stride[0] /
sizeof(
ipixel) + 2 * x] - y_off_in;
70 int y11 =
src0[src_stride[0] /
sizeof(
ipixel) + 2 * x + 1] - y_off_in;
73 int u =
src1[x] - uv_off_in, v = src2[x] - uv_off_in;
74 int uv_val = cyu *
u + cyv * v +
rnd + y_off_out;
80 dst0[x * 2 + 0 + dst_stride[0] /
sizeof(
opixel)] =
82 dst0[x * 2 + 1 + dst_stride[0] /
sizeof(
opixel)] =
91 dst0 += (dst_stride[0] * (1 <<
SS_H)) /
sizeof(
opixel);
92 dst1 += dst_stride[1] /
sizeof(
opixel);
93 dst2 += dst_stride[2] /
sizeof(
opixel);
96 src2 += src_stride[2] /
sizeof(
ipixel);