| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | * | ||
| 3 | * This file is part of FFmpeg. | ||
| 4 | * | ||
| 5 | * FFmpeg is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License as published by | ||
| 7 | * the Free Software Foundation; either version 2 of the License, or | ||
| 8 | * (at your option) any later version. | ||
| 9 | * | ||
| 10 | * FFmpeg is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License along | ||
| 16 | * with FFmpeg; if not, write to the Free Software Foundation, Inc., | ||
| 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 18 | */ | ||
| 19 | |||
| 20 | #include <string.h> | ||
| 21 | |||
| 22 | #include "libavutil/common.h" | ||
| 23 | #include "libavutil/intreadwrite.h" | ||
| 24 | #include "libavutil/mem_internal.h" | ||
| 25 | #include "libavutil/pixdesc.h" | ||
| 26 | |||
| 27 | #include "libswscale/swscale.h" | ||
| 28 | #include "libswscale/swscale_internal.h" | ||
| 29 | |||
| 30 | #include "checkasm.h" | ||
| 31 | |||
| 32 | #define randomize_buffers(buf, size) \ | ||
| 33 | do { \ | ||
| 34 | int j; \ | ||
| 35 | for (j = 0; j < size; j+=4) \ | ||
| 36 | AV_WN32(buf + j, rnd()); \ | ||
| 37 | } while (0) | ||
| 38 | |||
| 39 | static const int planar_fmts[] = { | ||
| 40 | AV_PIX_FMT_GBRP, | ||
| 41 | AV_PIX_FMT_GBRP9BE, | ||
| 42 | AV_PIX_FMT_GBRP9LE, | ||
| 43 | AV_PIX_FMT_GBRP10BE, | ||
| 44 | AV_PIX_FMT_GBRP10LE, | ||
| 45 | AV_PIX_FMT_GBRP12BE, | ||
| 46 | AV_PIX_FMT_GBRP12LE, | ||
| 47 | AV_PIX_FMT_GBRP14BE, | ||
| 48 | AV_PIX_FMT_GBRP14LE, | ||
| 49 | AV_PIX_FMT_GBRAP, | ||
| 50 | AV_PIX_FMT_GBRAP10BE, | ||
| 51 | AV_PIX_FMT_GBRAP10LE, | ||
| 52 | AV_PIX_FMT_GBRAP12BE, | ||
| 53 | AV_PIX_FMT_GBRAP12LE, | ||
| 54 | AV_PIX_FMT_GBRP16BE, | ||
| 55 | AV_PIX_FMT_GBRP16LE, | ||
| 56 | AV_PIX_FMT_GBRAP16BE, | ||
| 57 | AV_PIX_FMT_GBRAP16LE, | ||
| 58 | AV_PIX_FMT_GBRPF32BE, | ||
| 59 | AV_PIX_FMT_GBRPF32LE, | ||
| 60 | AV_PIX_FMT_GBRAPF32BE, | ||
| 61 | AV_PIX_FMT_GBRAPF32LE | ||
| 62 | }; | ||
| 63 | |||
| 64 | 14 | static void check_output_yuv2gbrp(void) | |
| 65 | { | ||
| 66 | SwsContext *sws; | ||
| 67 | SwsInternal *c; | ||
| 68 | const AVPixFmtDescriptor *desc; | ||
| 69 | int fmi, fsi, isi, i; | ||
| 70 | int dstW, byte_size, luma_filter_size, chr_filter_size; | ||
| 71 | #define LARGEST_FILTER 16 | ||
| 72 | #define FILTER_SIZES 4 | ||
| 73 | static const int filter_sizes[] = {1, 4, 8, 16}; | ||
| 74 | #define LARGEST_INPUT_SIZE 512 | ||
| 75 | static const int input_sizes[] = {8, 24, 128, 144, 256, 512}; | ||
| 76 | uint8_t *dst0[4]; | ||
| 77 | uint8_t *dst1[4]; | ||
| 78 | |||
| 79 | 14 | declare_func(void, SwsInternal *c, const int16_t *lumFilter, | |
| 80 | const int16_t **lumSrcx, int lumFilterSize, | ||
| 81 | const int16_t *chrFilter, const int16_t **chrUSrcx, | ||
| 82 | const int16_t **chrVSrcx, int chrFilterSize, | ||
| 83 | const int16_t **alpSrcx, uint8_t **dest, | ||
| 84 | int dstW, int y); | ||
| 85 | |||
| 86 | const int16_t *luma[LARGEST_FILTER]; | ||
| 87 | const int16_t *chru[LARGEST_FILTER]; | ||
| 88 | const int16_t *chrv[LARGEST_FILTER]; | ||
| 89 | const int16_t *alpha[LARGEST_FILTER]; | ||
| 90 | |||
| 91 | 14 | LOCAL_ALIGNED_8(int16_t, luma_filter, [LARGEST_FILTER]); | |
| 92 | 14 | LOCAL_ALIGNED_8(int16_t, chr_filter, [LARGEST_FILTER]); | |
| 93 | |||
| 94 | 14 | LOCAL_ALIGNED_8(int32_t, src_y, [LARGEST_FILTER * LARGEST_INPUT_SIZE]); | |
| 95 | 14 | LOCAL_ALIGNED_8(int32_t, src_u, [LARGEST_FILTER * LARGEST_INPUT_SIZE]); | |
| 96 | 14 | LOCAL_ALIGNED_8(int32_t, src_v, [LARGEST_FILTER * LARGEST_INPUT_SIZE]); | |
| 97 | 14 | LOCAL_ALIGNED_8(int32_t, src_a, [LARGEST_FILTER * LARGEST_INPUT_SIZE]); | |
| 98 | |||
| 99 | 14 | LOCAL_ALIGNED_8(uint8_t, dst0_r, [LARGEST_INPUT_SIZE * sizeof(int32_t)]); | |
| 100 | 14 | LOCAL_ALIGNED_8(uint8_t, dst0_g, [LARGEST_INPUT_SIZE * sizeof(int32_t)]); | |
| 101 | 14 | LOCAL_ALIGNED_8(uint8_t, dst0_b, [LARGEST_INPUT_SIZE * sizeof(int32_t)]); | |
| 102 | 14 | LOCAL_ALIGNED_8(uint8_t, dst0_a, [LARGEST_INPUT_SIZE * sizeof(int32_t)]); | |
| 103 | |||
| 104 | 14 | LOCAL_ALIGNED_8(uint8_t, dst1_r, [LARGEST_INPUT_SIZE * sizeof(int32_t)]); | |
| 105 | 14 | LOCAL_ALIGNED_8(uint8_t, dst1_g, [LARGEST_INPUT_SIZE * sizeof(int32_t)]); | |
| 106 | 14 | LOCAL_ALIGNED_8(uint8_t, dst1_b, [LARGEST_INPUT_SIZE * sizeof(int32_t)]); | |
| 107 | 14 | LOCAL_ALIGNED_8(uint8_t, dst1_a, [LARGEST_INPUT_SIZE * sizeof(int32_t)]); | |
| 108 | |||
| 109 |
2/2✓ Branch 1 taken 114688 times.
✓ Branch 2 taken 14 times.
|
114702 | randomize_buffers((uint8_t*)src_y, LARGEST_FILTER * LARGEST_INPUT_SIZE * sizeof(int32_t)); |
| 110 |
2/2✓ Branch 1 taken 114688 times.
✓ Branch 2 taken 14 times.
|
114702 | randomize_buffers((uint8_t*)src_u, LARGEST_FILTER * LARGEST_INPUT_SIZE * sizeof(int32_t)); |
| 111 |
2/2✓ Branch 1 taken 114688 times.
✓ Branch 2 taken 14 times.
|
114702 | randomize_buffers((uint8_t*)src_v, LARGEST_FILTER * LARGEST_INPUT_SIZE * sizeof(int32_t)); |
| 112 |
2/2✓ Branch 1 taken 114688 times.
✓ Branch 2 taken 14 times.
|
114702 | randomize_buffers((uint8_t*)src_a, LARGEST_FILTER * LARGEST_INPUT_SIZE * sizeof(int32_t)); |
| 113 |
2/2✓ Branch 1 taken 112 times.
✓ Branch 2 taken 14 times.
|
126 | randomize_buffers((uint8_t*)luma_filter, LARGEST_FILTER * sizeof(int16_t)); |
| 114 |
2/2✓ Branch 1 taken 112 times.
✓ Branch 2 taken 14 times.
|
126 | randomize_buffers((uint8_t*)chr_filter, LARGEST_FILTER * sizeof(int16_t)); |
| 115 | |||
| 116 | 14 | dst0[0] = (uint8_t*)dst0_g; | |
| 117 | 14 | dst0[1] = (uint8_t*)dst0_b; | |
| 118 | 14 | dst0[2] = (uint8_t*)dst0_r; | |
| 119 | 14 | dst0[3] = (uint8_t*)dst0_a; | |
| 120 | |||
| 121 | 14 | dst1[0] = (uint8_t*)dst1_g; | |
| 122 | 14 | dst1[1] = (uint8_t*)dst1_b; | |
| 123 | 14 | dst1[2] = (uint8_t*)dst1_r; | |
| 124 | 14 | dst1[3] = (uint8_t*)dst1_a; | |
| 125 | |||
| 126 |
2/2✓ Branch 0 taken 224 times.
✓ Branch 1 taken 14 times.
|
238 | for (i = 0; i < LARGEST_FILTER; i++) { |
| 127 | 224 | luma[i] = (int16_t *)(src_y + i*LARGEST_INPUT_SIZE); | |
| 128 | 224 | chru[i] = (int16_t *)(src_u + i*LARGEST_INPUT_SIZE); | |
| 129 | 224 | chrv[i] = (int16_t *)(src_v + i*LARGEST_INPUT_SIZE); | |
| 130 | 224 | alpha[i] = (int16_t *)(src_a + i*LARGEST_INPUT_SIZE); | |
| 131 | } | ||
| 132 | |||
| 133 | 14 | sws = sws_alloc_context(); | |
| 134 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 14 times.
|
14 | if (sws_init_context(sws, NULL, NULL) < 0) |
| 135 | ✗ | fail(); | |
| 136 | |||
| 137 | 14 | c = sws_internal(sws); | |
| 138 | 14 | sws->flags |= SWS_FULL_CHR_H_INT; | |
| 139 | |||
| 140 |
2/2✓ Branch 0 taken 308 times.
✓ Branch 1 taken 14 times.
|
322 | for (fmi = 0; fmi < FF_ARRAY_ELEMS(planar_fmts); fmi++) { |
| 141 |
2/2✓ Branch 0 taken 1232 times.
✓ Branch 1 taken 308 times.
|
1540 | for (fsi = 0; fsi < FILTER_SIZES; fsi++) { |
| 142 |
2/2✓ Branch 0 taken 7392 times.
✓ Branch 1 taken 1232 times.
|
8624 | for (isi = 0; isi < FF_ARRAY_ELEMS(input_sizes); isi++ ) { |
| 143 | 7392 | desc = av_pix_fmt_desc_get(planar_fmts[fmi]); | |
| 144 | 7392 | sws->dst_format = planar_fmts[fmi]; | |
| 145 | |||
| 146 | 7392 | dstW = input_sizes[isi]; | |
| 147 | 7392 | luma_filter_size = filter_sizes[fsi]; | |
| 148 | 7392 | chr_filter_size = filter_sizes[fsi]; | |
| 149 | |||
| 150 |
2/2✓ Branch 0 taken 1344 times.
✓ Branch 1 taken 6048 times.
|
7392 | if (desc->comp[0].depth > 16) { |
| 151 | 1344 | byte_size = 4; | |
| 152 |
2/2✓ Branch 0 taken 5376 times.
✓ Branch 1 taken 672 times.
|
6048 | } else if (desc->comp[0].depth > 8) { |
| 153 | 5376 | byte_size = 2; | |
| 154 | } else { | ||
| 155 | 672 | byte_size = 1; | |
| 156 | } | ||
| 157 | |||
| 158 | 7392 | ff_sws_init_scale(c); | |
| 159 |
2/2✓ Branch 3 taken 2112 times.
✓ Branch 4 taken 5280 times.
|
7392 | if (check_func(c->yuv2anyX, "yuv2%s_full_X_%d_%d", desc->name, luma_filter_size, dstW)) { |
| 160 |
2/2✓ Branch 0 taken 8448 times.
✓ Branch 1 taken 2112 times.
|
10560 | for (i = 0; i < 4; i ++) { |
| 161 | 8448 | memset(dst0[i], 0xFF, LARGEST_INPUT_SIZE * sizeof(int32_t)); | |
| 162 | 8448 | memset(dst1[i], 0xFF, LARGEST_INPUT_SIZE * sizeof(int32_t)); | |
| 163 | } | ||
| 164 | |||
| 165 | 2112 | call_ref(c, luma_filter, luma, luma_filter_size, | |
| 166 | chr_filter, chru, chrv, chr_filter_size, | ||
| 167 | alpha, dst0, dstW, 0); | ||
| 168 | 2112 | call_new(c, luma_filter, luma, luma_filter_size, | |
| 169 | chr_filter, chru, chrv, chr_filter_size, | ||
| 170 | alpha, dst1, dstW, 0); | ||
| 171 | |||
| 172 |
1/2✓ Branch 0 taken 2112 times.
✗ Branch 1 not taken.
|
2112 | if (memcmp(dst0[0], dst1[0], dstW * byte_size) || |
| 173 |
1/2✓ Branch 0 taken 2112 times.
✗ Branch 1 not taken.
|
2112 | memcmp(dst0[1], dst1[1], dstW * byte_size) || |
| 174 |
1/2✓ Branch 0 taken 2112 times.
✗ Branch 1 not taken.
|
2112 | memcmp(dst0[2], dst1[2], dstW * byte_size) || |
| 175 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2112 times.
|
2112 | memcmp(dst0[3], dst1[3], dstW * byte_size) ) |
| 176 | ✗ | fail(); | |
| 177 | |||
| 178 |
1/8✗ Branch 1 not taken.
✓ Branch 2 taken 2112 times.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
|
2112 | bench_new(c, luma_filter, luma, luma_filter_size, |
| 179 | chr_filter, chru, chrv, chr_filter_size, | ||
| 180 | alpha, dst1, dstW, 0); | ||
| 181 | } | ||
| 182 | } | ||
| 183 | } | ||
| 184 | } | ||
| 185 | 14 | sws_freeContext(sws); | |
| 186 | 14 | } | |
| 187 | |||
| 188 | #undef LARGEST_INPUT_SIZE | ||
| 189 | |||
| 190 | 14 | static void check_input_planar_rgb_to_y(void) | |
| 191 | { | ||
| 192 | SwsContext *sws; | ||
| 193 | SwsInternal *c; | ||
| 194 | const AVPixFmtDescriptor *desc; | ||
| 195 | int fmi, isi; | ||
| 196 | int dstW, byte_size; | ||
| 197 | #define LARGEST_INPUT_SIZE 512 | ||
| 198 | static const int input_sizes[] = {8, 24, 128, 144, 256, 512}; | ||
| 199 | const uint8_t *src[4]; | ||
| 200 | 14 | int32_t rgb2yuv[9] = {0}; | |
| 201 | |||
| 202 | 14 | declare_func(void, uint8_t *dst, const uint8_t *src[4], | |
| 203 | int w, int32_t *rgb2yuv, void *opaque); | ||
| 204 | |||
| 205 | 14 | LOCAL_ALIGNED_8(int32_t, src_r, [LARGEST_INPUT_SIZE]); | |
| 206 | 14 | LOCAL_ALIGNED_8(int32_t, src_g, [LARGEST_INPUT_SIZE]); | |
| 207 | 14 | LOCAL_ALIGNED_8(int32_t, src_b, [LARGEST_INPUT_SIZE]); | |
| 208 | 14 | LOCAL_ALIGNED_8(int32_t, src_a, [LARGEST_INPUT_SIZE]); | |
| 209 | |||
| 210 | 14 | LOCAL_ALIGNED_8(uint8_t, dst0_y, [LARGEST_INPUT_SIZE * sizeof(int32_t)]); | |
| 211 | 14 | LOCAL_ALIGNED_8(uint8_t, dst1_y, [LARGEST_INPUT_SIZE * sizeof(int32_t)]); | |
| 212 | |||
| 213 |
2/2✓ Branch 1 taken 7168 times.
✓ Branch 2 taken 14 times.
|
7182 | randomize_buffers((uint8_t*)src_r, LARGEST_INPUT_SIZE * sizeof(int32_t)); |
| 214 |
2/2✓ Branch 1 taken 7168 times.
✓ Branch 2 taken 14 times.
|
7182 | randomize_buffers((uint8_t*)src_g, LARGEST_INPUT_SIZE * sizeof(int32_t)); |
| 215 |
2/2✓ Branch 1 taken 7168 times.
✓ Branch 2 taken 14 times.
|
7182 | randomize_buffers((uint8_t*)src_b, LARGEST_INPUT_SIZE * sizeof(int32_t)); |
| 216 |
2/2✓ Branch 1 taken 7168 times.
✓ Branch 2 taken 14 times.
|
7182 | randomize_buffers((uint8_t*)src_a, LARGEST_INPUT_SIZE * sizeof(int32_t)); |
| 217 |
2/2✓ Branch 1 taken 126 times.
✓ Branch 2 taken 14 times.
|
140 | randomize_buffers((uint8_t*)rgb2yuv, 9 * sizeof(int32_t)); |
| 218 | |||
| 219 | 14 | src[0] = (uint8_t*)src_g; | |
| 220 | 14 | src[1] = (uint8_t*)src_b; | |
| 221 | 14 | src[2] = (uint8_t*)src_r; | |
| 222 | 14 | src[3] = (uint8_t*)src_a; | |
| 223 | |||
| 224 | 14 | sws = sws_alloc_context(); | |
| 225 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 14 times.
|
14 | if (sws_init_context(sws, NULL, NULL) < 0) |
| 226 | ✗ | fail(); | |
| 227 | |||
| 228 | 14 | c = sws_internal(sws); | |
| 229 |
2/2✓ Branch 0 taken 308 times.
✓ Branch 1 taken 14 times.
|
322 | for (fmi = 0; fmi < FF_ARRAY_ELEMS(planar_fmts); fmi++) { |
| 230 |
2/2✓ Branch 0 taken 1848 times.
✓ Branch 1 taken 308 times.
|
2156 | for (isi = 0; isi < FF_ARRAY_ELEMS(input_sizes); isi++ ) { |
| 231 | 1848 | desc = av_pix_fmt_desc_get(planar_fmts[fmi]); | |
| 232 | 1848 | sws->src_format = planar_fmts[fmi]; | |
| 233 | 1848 | sws->dst_format = AV_PIX_FMT_YUVA444P16; | |
| 234 | 1848 | byte_size = 2; | |
| 235 | 1848 | dstW = input_sizes[isi]; | |
| 236 | |||
| 237 | 1848 | ff_sws_init_scale(c); | |
| 238 |
2/2✓ Branch 3 taken 420 times.
✓ Branch 4 taken 1428 times.
|
1848 | if(check_func(c->readLumPlanar, "planar_%s_to_y_%d", desc->name, dstW)) { |
| 239 | 420 | memset(dst0_y, 0xFF, LARGEST_INPUT_SIZE * sizeof(int32_t)); | |
| 240 | 420 | memset(dst1_y, 0xFF, LARGEST_INPUT_SIZE * sizeof(int32_t)); | |
| 241 | |||
| 242 | 420 | call_ref(dst0_y, src, dstW, rgb2yuv, NULL); | |
| 243 | 420 | call_new(dst1_y, src, dstW, rgb2yuv, NULL); | |
| 244 | |||
| 245 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 420 times.
|
420 | if (memcmp(dst0_y, dst1_y, dstW * byte_size)) |
| 246 | ✗ | fail(); | |
| 247 | |||
| 248 |
1/8✗ Branch 1 not taken.
✓ Branch 2 taken 420 times.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
|
420 | bench_new(dst1_y, src, dstW, rgb2yuv, NULL); |
| 249 | |||
| 250 | } | ||
| 251 | } | ||
| 252 | } | ||
| 253 | 14 | sws_freeContext(sws); | |
| 254 | 14 | } | |
| 255 | |||
| 256 | #undef LARGEST_INPUT_SIZE | ||
| 257 | |||
| 258 | 14 | static void check_input_planar_rgb_to_uv(void) | |
| 259 | { | ||
| 260 | SwsContext *sws; | ||
| 261 | SwsInternal *c; | ||
| 262 | const AVPixFmtDescriptor *desc; | ||
| 263 | int fmi, isi; | ||
| 264 | int dstW, byte_size; | ||
| 265 | #define LARGEST_INPUT_SIZE 512 | ||
| 266 | static const int input_sizes[] = {8, 24, 128, 144, 256, 512}; | ||
| 267 | const uint8_t *src[4]; | ||
| 268 | 14 | int32_t rgb2yuv[9] = {0}; | |
| 269 | |||
| 270 | 14 | declare_func(void, uint8_t *dstU, uint8_t *dstV, | |
| 271 | const uint8_t *src[4], int w, int32_t *rgb2yuv, void *opaque); | ||
| 272 | |||
| 273 | 14 | LOCAL_ALIGNED_8(int32_t, src_r, [LARGEST_INPUT_SIZE]); | |
| 274 | 14 | LOCAL_ALIGNED_8(int32_t, src_g, [LARGEST_INPUT_SIZE]); | |
| 275 | 14 | LOCAL_ALIGNED_8(int32_t, src_b, [LARGEST_INPUT_SIZE]); | |
| 276 | 14 | LOCAL_ALIGNED_8(int32_t, src_a, [LARGEST_INPUT_SIZE]); | |
| 277 | |||
| 278 | 14 | LOCAL_ALIGNED_8(uint8_t, dst0_u, [LARGEST_INPUT_SIZE * sizeof(int32_t)]); | |
| 279 | 14 | LOCAL_ALIGNED_8(uint8_t, dst0_v, [LARGEST_INPUT_SIZE * sizeof(int32_t)]); | |
| 280 | |||
| 281 | 14 | LOCAL_ALIGNED_8(uint8_t, dst1_u, [LARGEST_INPUT_SIZE * sizeof(int32_t)]); | |
| 282 | 14 | LOCAL_ALIGNED_8(uint8_t, dst1_v, [LARGEST_INPUT_SIZE * sizeof(int32_t)]); | |
| 283 | |||
| 284 |
2/2✓ Branch 1 taken 7168 times.
✓ Branch 2 taken 14 times.
|
7182 | randomize_buffers((uint8_t*)src_r, LARGEST_INPUT_SIZE * sizeof(int32_t)); |
| 285 |
2/2✓ Branch 1 taken 7168 times.
✓ Branch 2 taken 14 times.
|
7182 | randomize_buffers((uint8_t*)src_g, LARGEST_INPUT_SIZE * sizeof(int32_t)); |
| 286 |
2/2✓ Branch 1 taken 7168 times.
✓ Branch 2 taken 14 times.
|
7182 | randomize_buffers((uint8_t*)src_b, LARGEST_INPUT_SIZE * sizeof(int32_t)); |
| 287 |
2/2✓ Branch 1 taken 7168 times.
✓ Branch 2 taken 14 times.
|
7182 | randomize_buffers((uint8_t*)src_a, LARGEST_INPUT_SIZE * sizeof(int32_t)); |
| 288 |
2/2✓ Branch 1 taken 126 times.
✓ Branch 2 taken 14 times.
|
140 | randomize_buffers((uint8_t*)rgb2yuv, 9 * sizeof(int32_t)); |
| 289 | |||
| 290 | 14 | src[0] = (uint8_t*)src_g; | |
| 291 | 14 | src[1] = (uint8_t*)src_b; | |
| 292 | 14 | src[2] = (uint8_t*)src_r; | |
| 293 | 14 | src[3] = (uint8_t*)src_a; | |
| 294 | |||
| 295 | 14 | sws = sws_alloc_context(); | |
| 296 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 14 times.
|
14 | if (sws_init_context(sws, NULL, NULL) < 0) |
| 297 | ✗ | fail(); | |
| 298 | |||
| 299 | 14 | c = sws_internal(sws); | |
| 300 |
2/2✓ Branch 0 taken 308 times.
✓ Branch 1 taken 14 times.
|
322 | for (fmi = 0; fmi < FF_ARRAY_ELEMS(planar_fmts); fmi++) { |
| 301 |
2/2✓ Branch 0 taken 1848 times.
✓ Branch 1 taken 308 times.
|
2156 | for (isi = 0; isi < FF_ARRAY_ELEMS(input_sizes); isi++ ) { |
| 302 | 1848 | desc = av_pix_fmt_desc_get(planar_fmts[fmi]); | |
| 303 | 1848 | sws->src_format = planar_fmts[fmi]; | |
| 304 | 1848 | sws->dst_format = AV_PIX_FMT_YUVA444P16; | |
| 305 | 1848 | byte_size = 2; | |
| 306 | 1848 | dstW = input_sizes[isi]; | |
| 307 | |||
| 308 | 1848 | ff_sws_init_scale(c); | |
| 309 |
2/2✓ Branch 3 taken 528 times.
✓ Branch 4 taken 1320 times.
|
1848 | if(check_func(c->readChrPlanar, "planar_%s_to_uv_%d", desc->name, dstW)) { |
| 310 | 528 | memset(dst0_u, 0xFF, LARGEST_INPUT_SIZE * sizeof(int32_t)); | |
| 311 | 528 | memset(dst0_v, 0xFF, LARGEST_INPUT_SIZE * sizeof(int32_t)); | |
| 312 | 528 | memset(dst1_u, 0xFF, LARGEST_INPUT_SIZE * sizeof(int32_t)); | |
| 313 | 528 | memset(dst1_v, 0xFF, LARGEST_INPUT_SIZE * sizeof(int32_t)); | |
| 314 | |||
| 315 | 528 | call_ref(dst0_u, dst0_v, src, dstW, rgb2yuv, NULL); | |
| 316 | 528 | call_new(dst1_u, dst1_v, src, dstW, rgb2yuv, NULL); | |
| 317 | |||
| 318 |
1/2✓ Branch 0 taken 528 times.
✗ Branch 1 not taken.
|
528 | if (memcmp(dst0_u, dst1_u, dstW * byte_size) || |
| 319 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 528 times.
|
528 | memcmp(dst0_v, dst1_v, dstW * byte_size)) |
| 320 | ✗ | fail(); | |
| 321 | |||
| 322 |
1/8✗ Branch 1 not taken.
✓ Branch 2 taken 528 times.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
|
528 | bench_new(dst1_u, dst1_v, src, dstW, rgb2yuv, NULL); |
| 323 | } | ||
| 324 | } | ||
| 325 | } | ||
| 326 | 14 | sws_freeContext(sws); | |
| 327 | 14 | } | |
| 328 | |||
| 329 | #undef LARGEST_INPUT_SIZE | ||
| 330 | |||
| 331 | 14 | static void check_input_planar_rgb_to_a(void) | |
| 332 | { | ||
| 333 | SwsContext *sws; | ||
| 334 | SwsInternal *c; | ||
| 335 | const AVPixFmtDescriptor *desc; | ||
| 336 | int fmi, isi; | ||
| 337 | int dstW, byte_size; | ||
| 338 | #define LARGEST_INPUT_SIZE 512 | ||
| 339 | static const int input_sizes[] = {8, 24, 128, 144, 256, 512}; | ||
| 340 | const uint8_t *src[4]; | ||
| 341 | 14 | int32_t rgb2yuv[9] = {0}; | |
| 342 | |||
| 343 | 14 | declare_func(void, uint8_t *dst, const uint8_t *src[4], | |
| 344 | int w, int32_t *rgb2yuv, void *opaque); | ||
| 345 | |||
| 346 | 14 | LOCAL_ALIGNED_8(int32_t, src_r, [LARGEST_INPUT_SIZE]); | |
| 347 | 14 | LOCAL_ALIGNED_8(int32_t, src_g, [LARGEST_INPUT_SIZE]); | |
| 348 | 14 | LOCAL_ALIGNED_8(int32_t, src_b, [LARGEST_INPUT_SIZE]); | |
| 349 | 14 | LOCAL_ALIGNED_8(int32_t, src_a, [LARGEST_INPUT_SIZE]); | |
| 350 | |||
| 351 | 14 | LOCAL_ALIGNED_8(uint8_t, dst0_a, [LARGEST_INPUT_SIZE * sizeof(int32_t)]); | |
| 352 | 14 | LOCAL_ALIGNED_8(uint8_t, dst1_a, [LARGEST_INPUT_SIZE * sizeof(int32_t)]); | |
| 353 | |||
| 354 |
2/2✓ Branch 1 taken 7168 times.
✓ Branch 2 taken 14 times.
|
7182 | randomize_buffers((uint8_t*)src_r, LARGEST_INPUT_SIZE * sizeof(int32_t)); |
| 355 |
2/2✓ Branch 1 taken 7168 times.
✓ Branch 2 taken 14 times.
|
7182 | randomize_buffers((uint8_t*)src_g, LARGEST_INPUT_SIZE * sizeof(int32_t)); |
| 356 |
2/2✓ Branch 1 taken 7168 times.
✓ Branch 2 taken 14 times.
|
7182 | randomize_buffers((uint8_t*)src_b, LARGEST_INPUT_SIZE * sizeof(int32_t)); |
| 357 |
2/2✓ Branch 1 taken 7168 times.
✓ Branch 2 taken 14 times.
|
7182 | randomize_buffers((uint8_t*)src_a, LARGEST_INPUT_SIZE * sizeof(int32_t)); |
| 358 |
2/2✓ Branch 1 taken 126 times.
✓ Branch 2 taken 14 times.
|
140 | randomize_buffers((uint8_t*)rgb2yuv, 9 * sizeof(int32_t)); |
| 359 | |||
| 360 | 14 | src[0] = (uint8_t*)src_g; | |
| 361 | 14 | src[1] = (uint8_t*)src_b; | |
| 362 | 14 | src[2] = (uint8_t*)src_r; | |
| 363 | 14 | src[3] = (uint8_t*)src_a; | |
| 364 | |||
| 365 | 14 | sws = sws_alloc_context(); | |
| 366 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 14 times.
|
14 | if (sws_init_context(sws, NULL, NULL) < 0) |
| 367 | ✗ | fail(); | |
| 368 | |||
| 369 | 14 | c = sws_internal(sws); | |
| 370 |
2/2✓ Branch 0 taken 308 times.
✓ Branch 1 taken 14 times.
|
322 | for (fmi = 0; fmi < FF_ARRAY_ELEMS(planar_fmts); fmi++) { |
| 371 |
2/2✓ Branch 0 taken 1848 times.
✓ Branch 1 taken 308 times.
|
2156 | for (isi = 0; isi < FF_ARRAY_ELEMS(input_sizes); isi++ ) { |
| 372 | 1848 | desc = av_pix_fmt_desc_get(planar_fmts[fmi]); | |
| 373 |
2/2✓ Branch 0 taken 1092 times.
✓ Branch 1 taken 756 times.
|
1848 | if (!(desc->flags & AV_PIX_FMT_FLAG_ALPHA)) |
| 374 | 1092 | continue; | |
| 375 | |||
| 376 | 756 | sws->src_format = planar_fmts[fmi]; | |
| 377 | 756 | sws->dst_format = AV_PIX_FMT_YUVA444P16; | |
| 378 | 756 | byte_size = 2; | |
| 379 | 756 | dstW = input_sizes[isi]; | |
| 380 | |||
| 381 | 756 | ff_sws_init_scale(c); | |
| 382 |
2/2✓ Branch 3 taken 174 times.
✓ Branch 4 taken 582 times.
|
756 | if(check_func(c->readAlpPlanar, "planar_%s_to_a_%d", desc->name, dstW)) { |
| 383 | 174 | memset(dst0_a, 0x00, LARGEST_INPUT_SIZE * sizeof(int32_t)); | |
| 384 | 174 | memset(dst1_a, 0x00, LARGEST_INPUT_SIZE * sizeof(int32_t)); | |
| 385 | |||
| 386 | 174 | call_ref(dst0_a, src, dstW, rgb2yuv, NULL); | |
| 387 | 174 | call_new(dst1_a, src, dstW, rgb2yuv, NULL); | |
| 388 | |||
| 389 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 174 times.
|
174 | if (memcmp(dst0_a, dst1_a, dstW * byte_size)) |
| 390 | ✗ | fail(); | |
| 391 |
1/8✗ Branch 1 not taken.
✓ Branch 2 taken 174 times.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
|
174 | bench_new(dst1_a, src, dstW, rgb2yuv, NULL); |
| 392 | } | ||
| 393 | } | ||
| 394 | } | ||
| 395 | 14 | sws_freeContext(sws); | |
| 396 | 14 | } | |
| 397 | |||
| 398 | 14 | void checkasm_check_sw_gbrp(void) | |
| 399 | { | ||
| 400 | 14 | check_output_yuv2gbrp(); | |
| 401 | 14 | report("output_yuv2gbrp"); | |
| 402 | |||
| 403 | 14 | check_input_planar_rgb_to_y(); | |
| 404 | 14 | report("input_planar_rgb_y"); | |
| 405 | |||
| 406 | 14 | check_input_planar_rgb_to_uv(); | |
| 407 | 14 | report("input_planar_rgb_uv"); | |
| 408 | |||
| 409 | 14 | check_input_planar_rgb_to_a(); | |
| 410 | 14 | report("input_planar_rgb_a"); | |
| 411 | 14 | } | |
| 412 |