32 #define randomize_buffers() \
34 unsigned mask = bpp_mask[idepth]; \
36 int bpp = 1 + (!!idepth); \
37 int buf_size = W * H * bpp; \
38 for (m = 0; m < 3; m++) { \
39 int ss = m ? ss_w + ss_h : 0; \
40 int plane_sz = buf_size >> ss; \
41 for (n = 0; n < plane_sz; n += 4) { \
42 unsigned r = rnd() & mask; \
43 AV_WN32A(&src[m][n], r); \
52 static const unsigned bpp_mask[] = { 0xffffffff, 0x03ff03ff, 0x0fff0fff };
56 declare_func(
void, uint8_t *dst[3], ptrdiff_t dst_stride[3],
57 uint8_t *
src[3], ptrdiff_t src_stride[3],
58 int w,
int h,
const int16_t
coeff[3][3][8],
59 const int16_t off[2][8]);
61 int idepth, odepth, fmt, n;
65 uint8_t *
src[3] = { src_y, src_u, src_v };
72 uint8_t *dst0[3] = { dst0_y, dst0_u, dst0_v }, *dst1[3] = { dst1_y, dst1_u, dst1_v };
75 int16_t (*
offset)[8] = (int16_t(*)[8]) offset_buf;
76 int16_t (*
coeff)[3][8] = (int16_t(*)[3][8]) coeff_buf;
79 for (n = 0; n < 8; n++) {
82 coeff[0][0][n] = (1 << 14) + (1 << 7) + 1;
83 coeff[0][1][n] = (1 << 7) - 1;
84 coeff[0][2][n] = -(1 << 8);
86 coeff[1][1][n] = (1 << 14) + (1 << 7);
87 coeff[1][2][n] = -(1 << 7);
88 coeff[2][2][n] = (1 << 14) - (1 << 6);
89 coeff[2][1][n] = 1 << 6;
91 for (idepth = 0; idepth < 3; idepth++) {
92 for (odepth = 0; odepth < 3; odepth++) {
93 for (fmt = 0; fmt < 3; fmt++) {
95 "ff_colorspacedsp_yuv2yuv_%sp%dto%d",
97 idepth * 2 + 8, odepth * 2 + 8)) {
98 int ss_w = !!fmt, ss_h = fmt == 2;
99 int y_src_stride =
W << !!idepth, y_dst_stride =
W << !!odepth;
100 int uv_src_stride = y_src_stride >> ss_w, uv_dst_stride = y_dst_stride >> ss_w;
103 call_ref(dst0, (ptrdiff_t[3]) { y_dst_stride, uv_dst_stride, uv_dst_stride },
104 src, (ptrdiff_t[3]) { y_src_stride, uv_src_stride, uv_src_stride },
106 call_new(dst1, (ptrdiff_t[3]) { y_dst_stride, uv_dst_stride, uv_dst_stride },
107 src, (ptrdiff_t[3]) { y_src_stride, uv_src_stride, uv_src_stride },
109 if (memcmp(dst0[0], dst1[0], y_dst_stride *
H) ||
110 memcmp(dst0[1], dst1[1], uv_dst_stride *
H >> ss_h) ||
111 memcmp(dst0[2], dst1[2], uv_dst_stride *
H >> ss_h)) {
124 declare_func(
void, int16_t *dst[3], ptrdiff_t dst_stride,
125 uint8_t *
src[3], ptrdiff_t src_stride[3],
126 int w,
int h,
const int16_t
coeff[3][3][8],
127 const int16_t off[8]);
133 uint8_t *
src[3] = { src_y, src_u, src_v };
140 int16_t *dst0[3] = { dst0_y, dst0_u, dst0_v }, *dst1[3] = { dst1_y, dst1_u, dst1_v };
143 int16_t (*
coeff)[3][8] = (int16_t(*)[3][8]) coeff_buf;
146 for (n = 0; n < 8; n++) {
151 coeff[0][2][n] = 1 << 13;
152 coeff[1][1][n] = -(1 << 12);
153 coeff[1][2][n] = 1 << 12;
154 coeff[2][1][n] = 1 << 11;
156 for (idepth = 0; idepth < 3; idepth++) {
157 for (fmt = 0; fmt < 3; fmt++) {
159 "ff_colorspacedsp_yuv2rgb_%sp%d",
161 int ss_w = !!fmt, ss_h = fmt == 2;
162 int y_src_stride =
W << !!idepth;
163 int uv_src_stride = y_src_stride >> ss_w;
167 (ptrdiff_t[3]) { y_src_stride, uv_src_stride, uv_src_stride },
170 (ptrdiff_t[3]) { y_src_stride, uv_src_stride, uv_src_stride },
172 if (memcmp(dst0[0], dst1[0],
W *
H *
sizeof(int16_t)) ||
173 memcmp(dst0[1], dst1[1],
W *
H *
sizeof(int16_t)) ||
174 memcmp(dst0[2], dst1[2],
W *
H *
sizeof(int16_t))) {
184 #undef randomize_buffers
185 #define randomize_buffers() \
188 for (p = 0; p < 3; p++) { \
189 for (y = 0; y < H; y++) { \
190 for (x = 0; x < W; x++) { \
191 int r = rnd() & 0x7fff; \
192 r -= (32768 - 28672) >> 1; \
193 src[p][y * W + x] = r; \
201 declare_func(
void, uint8_t *dst[3], ptrdiff_t dst_stride[3],
202 int16_t *
src[3], ptrdiff_t src_stride,
203 int w,
int h,
const int16_t
coeff[3][3][8],
204 const int16_t off[8]);
210 int16_t *
src[3] = { src_y, src_u, src_v };
217 uint8_t *dst0[3] = { dst0_y, dst0_u, dst0_v }, *dst1[3] = { dst1_y, dst1_u, dst1_v };
220 int16_t (*
coeff)[3][8] = (int16_t(*)[3][8]) coeff_buf;
223 for (n = 0; n < 8; n++) {
237 for (odepth = 0; odepth < 3; odepth++) {
238 for (fmt = 0; fmt < 3; fmt++) {
240 "ff_colorspacedsp_rgb2yuv_%sp%d",
242 int ss_w = !!fmt, ss_h = fmt == 2;
243 int y_dst_stride =
W << !!odepth;
244 int uv_dst_stride = y_dst_stride >> ss_w;
247 call_ref(dst0, (ptrdiff_t[3]) { y_dst_stride, uv_dst_stride, uv_dst_stride },
249 call_new(dst1, (ptrdiff_t[3]) { y_dst_stride, uv_dst_stride, uv_dst_stride },
251 if (memcmp(dst0[0], dst1[0],
H * y_dst_stride) ||
252 memcmp(dst0[1], dst1[1],
H * uv_dst_stride >> ss_h) ||
253 memcmp(dst0[2], dst1[2],
H * uv_dst_stride >> ss_h)) {
266 int w,
int h,
const int16_t
coeff[3][3][8]);
274 int16_t *dst0[3] = { dst0_y, dst0_u, dst0_v }, *dst1[3] = { dst1_y, dst1_u, dst1_v };
275 int16_t **
src = dst0;
277 int16_t (*
coeff)[3][8] = (int16_t(*)[3][8]) coeff_buf;
281 for (n = 0; n < 8; n++) {
294 memcpy(dst1_y, dst0_y,
W *
H *
sizeof(*dst1_y));
295 memcpy(dst1_u, dst0_u,
W *
H *
sizeof(*dst1_u));
296 memcpy(dst1_v, dst0_v,
W *
H *
sizeof(*dst1_v));
299 if (memcmp(dst0[0], dst1[0],
H *
W *
sizeof(*dst0_y)) ||
300 memcmp(dst0[1], dst1[1],
H *
W *
sizeof(*dst0_u)) ||
301 memcmp(dst0[2], dst1[2],
H *
W *
sizeof(*dst0_v))) {