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 };
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);
85 coeff[1][0][n] = coeff[2][0][n] = 0;
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,
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++) {
149 coeff[0][0][n] = coeff[1][0][n] = coeff[2][0][n] = (1 << 14) | 1;
150 coeff[0][1][n] = coeff[2][2][n] = 0;
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; \ 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++) {
227 coeff[0][0][n] =
lrint(0.3 * (1 << 14));
228 coeff[0][1][n] =
lrint(0.6 * (1 << 14));
229 coeff[0][2][n] =
lrint(0.1 * (1 << 14));
230 coeff[1][0][n] =
lrint(-0.15 * (1 << 14));
231 coeff[1][1][n] =
lrint(-0.35 * (1 << 14));
232 coeff[1][2][n] =
lrint(0.5 * (1 << 14));
233 coeff[2][0][n] =
lrint(0.5 * (1 << 14));
234 coeff[2][1][n] =
lrint(-0.42 * (1 << 14));
235 coeff[2][2][n] =
lrint(-0.08 * (1 << 14));
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++) {
282 coeff[0][0][n] =
lrint(0.85 * (1 << 14));
283 coeff[0][1][n] =
lrint(0.10 * (1 << 14));
284 coeff[0][2][n] =
lrint(0.05 * (1 << 14));
285 coeff[1][0][n] =
lrint(-0.1 * (1 << 14));
286 coeff[1][1][n] =
lrint(0.95 * (1 << 14));
287 coeff[1][2][n] =
lrint(0.15 * (1 << 14));
288 coeff[2][0][n] =
lrint(-0.2 * (1 << 14));
289 coeff[2][1][n] =
lrint(0.30 * (1 << 14));
290 coeff[2][2][n] =
lrint(0.90 * (1 << 14));
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))) {
ptrdiff_t const GLvoid * data
void checkasm_check_colorspace(void)
void(* multiply3x3)(int16_t *data[3], ptrdiff_t stride, int w, int h, const int16_t m[3][3][8])
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
static void check_multiply3x3(void)
#define LOCAL_ALIGNED_32(t, v,...)
#define randomize_buffers()
#define declare_func(ret,...)
common internal API header
static void check_yuv2rgb(void)
static void check_yuv2yuv(void)
yuv2yuv_fn yuv2yuv[NB_BPP][NB_BPP][NB_SS]
rgb2yuv_fn rgb2yuv[NB_BPP][NB_SS]
#define check_func(func,...)
yuv2rgb_fn yuv2rgb[NB_BPP][NB_SS]
static const unsigned bpp_mask[]
GLint GLenum GLboolean GLsizei stride
common internal and external API header
void ff_colorspacedsp_init(ColorSpaceDSPContext *dsp)
static void check_rgb2yuv(void)
static const double coeff[2][5]