31 #define randomize_buffers() \
33 unsigned mask = bpp_mask[idepth]; \
35 int bpp = 1 + (!!idepth); \
36 int buf_size = W * H * bpp; \
37 for (m = 0; m < 3; m++) { \
38 int ss = m ? ss_w + ss_h : 0; \
39 int plane_sz = buf_size >> ss; \
40 for (n = 0; n < plane_sz; n += 4) { \
41 unsigned r = rnd() & mask; \
42 AV_WN32A(&src[m][n], r); \
51 static const unsigned bpp_mask[] = { 0xffffffff, 0x03ff03ff, 0x0fff0fff };
57 int w,
int h,
const int16_t
coeff[3][3][8],
58 const int16_t off[2][8]);
60 int idepth, odepth,
fmt,
n;
64 uint8_t *src[3] = { src_y, src_u, src_v };
71 uint8_t *dst0[3] = { dst0_y, dst0_u, dst0_v }, *dst1[3] = { dst1_y, dst1_u, dst1_v };
74 int16_t (*
offset)[8] = (int16_t(*)[8]) offset_buf;
75 int16_t (*coeff)[3][8] = (int16_t(*)[3][8]) coeff_buf;
78 for (n = 0; n < 8; n++) {
81 coeff[0][0][
n] = (1 << 14) + (1 << 7) + 1;
82 coeff[0][1][
n] = (1 << 7) - 1;
83 coeff[0][2][
n] = -(1 << 8);
84 coeff[1][0][
n] = coeff[2][0][
n] = 0;
85 coeff[1][1][
n] = (1 << 14) + (1 << 7);
86 coeff[1][2][
n] = -(1 << 7);
87 coeff[2][2][
n] = (1 << 14) - (1 << 6);
88 coeff[2][1][
n] = 1 << 6;
90 for (idepth = 0; idepth < 3; idepth++) {
91 for (odepth = 0; odepth < 3; odepth++) {
92 for (fmt = 0; fmt < 3; fmt++) {
94 "ff_colorspacedsp_yuv2yuv_%sp%dto%d",
96 idepth * 2 + 8, odepth * 2 + 8)) {
97 int ss_w = !!
fmt, ss_h = fmt == 2;
98 int y_src_stride =
W << !!idepth, y_dst_stride =
W << !!odepth;
99 int uv_src_stride = y_src_stride >> ss_w, uv_dst_stride = y_dst_stride >> ss_w;
102 call_ref(dst0, (ptrdiff_t[3]) { y_dst_stride, uv_dst_stride, uv_dst_stride },
103 src, (ptrdiff_t[3]) { y_src_stride, uv_src_stride, uv_src_stride },
105 call_new(dst1, (ptrdiff_t[3]) { y_dst_stride, uv_dst_stride, uv_dst_stride },
106 src, (ptrdiff_t[3]) { y_src_stride, uv_src_stride, uv_src_stride },
108 if (memcmp(dst0[0], dst1[0], y_dst_stride * H) ||
109 memcmp(dst0[1], dst1[1], uv_dst_stride * H >> ss_h) ||
110 memcmp(dst0[2], dst1[2], uv_dst_stride * H >> ss_h)) {
125 int w,
int h,
const int16_t
coeff[3][3][8],
126 const int16_t off[8]);
132 uint8_t *src[3] = { src_y, src_u, src_v };
139 int16_t *dst0[3] = { dst0_y, dst0_u, dst0_v }, *dst1[3] = { dst1_y, dst1_u, dst1_v };
142 int16_t (*coeff)[3][8] = (int16_t(*)[3][8]) coeff_buf;
145 for (n = 0; n < 8; n++) {
148 coeff[0][0][
n] = coeff[1][0][
n] = coeff[2][0][
n] = (1 << 14) | 1;
149 coeff[0][1][
n] = coeff[2][2][
n] = 0;
150 coeff[0][2][
n] = 1 << 13;
151 coeff[1][1][
n] = -(1 << 12);
152 coeff[1][2][
n] = 1 << 12;
153 coeff[2][1][
n] = 1 << 11;
155 for (idepth = 0; idepth < 3; idepth++) {
156 for (fmt = 0; fmt < 3; fmt++) {
158 "ff_colorspacedsp_yuv2rgb_%sp%d",
160 int ss_w = !!
fmt, ss_h = fmt == 2;
161 int y_src_stride =
W << !!idepth;
162 int uv_src_stride = y_src_stride >> ss_w;
166 (ptrdiff_t[3]) { y_src_stride, uv_src_stride, uv_src_stride },
169 (ptrdiff_t[3]) { y_src_stride, uv_src_stride, uv_src_stride },
171 if (memcmp(dst0[0], dst1[0],
W * H *
sizeof(int16_t)) ||
172 memcmp(dst0[1], dst1[1],
W * H *
sizeof(int16_t)) ||
173 memcmp(dst0[2], dst1[2],
W * H *
sizeof(int16_t))) {
183 #undef randomize_buffers
184 #define randomize_buffers() \
187 for (p = 0; p < 3; p++) { \
188 for (y = 0; y < H; y++) { \
189 for (x = 0; x < W; x++) { \
190 int r = rnd() & 0x7fff; \
191 r -= (32768 - 28672) >> 1; \
192 src[p][y * W + x] = r; \
201 int16_t *
src[3], ptrdiff_t src_stride,
202 int w,
int h,
const int16_t
coeff[3][3][8],
203 const int16_t off[8]);
209 int16_t *src[3] = { src_y, src_u, src_v };
216 uint8_t *dst0[3] = { dst0_y, dst0_u, dst0_v }, *dst1[3] = { dst1_y, dst1_u, dst1_v };
219 int16_t (*coeff)[3][8] = (int16_t(*)[3][8]) coeff_buf;
222 for (n = 0; n < 8; n++) {
226 coeff[0][0][
n] =
lrint(0.3 * (1 << 14));
227 coeff[0][1][
n] =
lrint(0.6 * (1 << 14));
228 coeff[0][2][
n] =
lrint(0.1 * (1 << 14));
229 coeff[1][0][
n] =
lrint(-0.15 * (1 << 14));
230 coeff[1][1][
n] =
lrint(-0.35 * (1 << 14));
231 coeff[1][2][
n] =
lrint(0.5 * (1 << 14));
232 coeff[2][0][
n] =
lrint(0.5 * (1 << 14));
233 coeff[2][1][
n] =
lrint(-0.42 * (1 << 14));
234 coeff[2][2][
n] =
lrint(-0.08 * (1 << 14));
236 for (odepth = 0; odepth < 3; odepth++) {
237 for (fmt = 0; fmt < 3; fmt++) {
239 "ff_colorspacedsp_rgb2yuv_%sp%d",
241 int ss_w = !!
fmt, ss_h = fmt == 2;
242 int y_dst_stride =
W << !!odepth;
243 int uv_dst_stride = y_dst_stride >> ss_w;
246 call_ref(dst0, (ptrdiff_t[3]) { y_dst_stride, uv_dst_stride, uv_dst_stride },
248 call_new(dst1, (ptrdiff_t[3]) { y_dst_stride, uv_dst_stride, uv_dst_stride },
250 if (memcmp(dst0[0], dst1[0], H * y_dst_stride) ||
251 memcmp(dst0[1], dst1[1], H * uv_dst_stride >> ss_h) ||
252 memcmp(dst0[2], dst1[2], H * uv_dst_stride >> ss_h)) {
265 int w,
int h,
const int16_t
coeff[3][3][8]);
273 int16_t *dst0[3] = { dst0_y, dst0_u, dst0_v }, *dst1[3] = { dst1_y, dst1_u, dst1_v };
274 int16_t **
src = dst0;
276 int16_t (*coeff)[3][8] = (int16_t(*)[3][8]) coeff_buf;
280 for (n = 0; n < 8; n++) {
281 coeff[0][0][
n] =
lrint(0.85 * (1 << 14));
282 coeff[0][1][
n] =
lrint(0.10 * (1 << 14));
283 coeff[0][2][
n] =
lrint(0.05 * (1 << 14));
284 coeff[1][0][
n] =
lrint(-0.1 * (1 << 14));
285 coeff[1][1][
n] =
lrint(0.95 * (1 << 14));
286 coeff[1][2][
n] =
lrint(0.15 * (1 << 14));
287 coeff[2][0][
n] =
lrint(-0.2 * (1 << 14));
288 coeff[2][1][
n] =
lrint(0.30 * (1 << 14));
289 coeff[2][2][
n] =
lrint(0.90 * (1 << 14));
293 memcpy(dst1_y, dst0_y,
W * H *
sizeof(*dst1_y));
294 memcpy(dst1_u, dst0_u,
W * H *
sizeof(*dst1_u));
295 memcpy(dst1_v, dst0_v,
W * H *
sizeof(*dst1_v));
298 if (memcmp(dst0[0], dst1[0], H *
W *
sizeof(*dst0_y)) ||
299 memcmp(dst0[1], dst1[1], H *
W *
sizeof(*dst0_u)) ||
300 memcmp(dst0[2], dst1[2], H *
W *
sizeof(*dst0_v))) {
ptrdiff_t const GLvoid * data
void checkasm_check_colorspace(void)
static void check_multiply3x3(void)
#define randomize_buffers()
#define declare_func(ret,...)
static const uint8_t offset[127][2]
common internal API header
static void check_yuv2rgb(void)
static void check_yuv2yuv(void)
void(* multiply3x3)(int16_t *data[3], ptrdiff_t stride, int w, int h, const int16_t m[3][3][8])
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[]
#define LOCAL_ALIGNED_32(t, v,...)
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]