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)
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;
55 const int uv_off_out = rnd + (128 << (OUT_BIT_DEPTH - 8 + 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;
76 dst0[x << SS_W] = av_clip_pixel((cyy * y00 + uv_val) >> sh);
80 dst0[x * 2 + 0 + dst_stride[0] /
sizeof(
opixel)] =
82 dst0[x * 2 + 1 + dst_stride[0] /
sizeof(
opixel)] =
87 dst1[x] =
av_clip_pixel((u * cuu + v * cuv + uv_off_out) >> sh);
88 dst2[x] =
av_clip_pixel((u * cvu + v * cvv + uv_off_out) >> sh);
91 dst0 += (dst_stride[0] * (1 <<
SS_H)) /
sizeof(
opixel);
92 dst1 += dst_stride[1] /
sizeof(
opixel);
93 dst2 += dst_stride[2] /
sizeof(
opixel);
94 src0 += (src_stride[0] * (1 <<
SS_H)) /
sizeof(
ipixel);
95 src1 += src_stride[1] /
sizeof(
ipixel);
96 src2 += src_stride[2] /
sizeof(
ipixel);
static void fn() yuv2yuv(uint8_t *_dst[3], const ptrdiff_t dst_stride[3], uint8_t *_src[3], const ptrdiff_t src_stride[3], int w, int h, const int16_t c[3][3][8], const int16_t yuv_offset[2][8])
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
#define u(width, name, range_min, range_max)
simple assert() macros that are a bit more flexible than ISO C assert().
#define AV_CEIL_RSHIFT(a, b)