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;
 
   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);
 
   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);
 
   90     for (idepth = 0; idepth < 3; idepth++) {
 
   91         for (odepth = 0; odepth < 3; odepth++) {
 
   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]);
 
  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++) {
 
  151         coeff[1][1][
n] = -(1 << 12);
 
  155     for (idepth = 0; idepth < 3; idepth++) {
 
  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++) {
 
  236     for (odepth = 0; odepth < 3; odepth++) {
 
  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++) {
 
  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))) {