| 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/rgb2rgb.h" | ||
| 28 | #include "libswscale/swscale.h" | ||
| 29 | #include "libswscale/swscale_internal.h" | ||
| 30 | |||
| 31 | #include "checkasm.h" | ||
| 32 | |||
| 33 | #define randomize_buffers(buf, size) \ | ||
| 34 | do { \ | ||
| 35 | int j; \ | ||
| 36 | for (j = 0; j < size; j+=4) \ | ||
| 37 | AV_WN32(buf + j, rnd()); \ | ||
| 38 | } while (0) | ||
| 39 | |||
| 40 | static const uint8_t width[] = {12, 16, 20, 32, 36, 128}; | ||
| 41 | static const struct {uint8_t w, h;} planes[] = { | ||
| 42 | {12,16}, {16,16}, {20,23}, {32,18}, {8,128}, {128,128}, | ||
| 43 | {1,1}, {1,4}, {3,8}, {13,16}, {21,9}, {63,7}, {127,5}, | ||
| 44 | {13,1}, {32,1}, {66,1} | ||
| 45 | }; | ||
| 46 | |||
| 47 | #define MAX_STRIDE 128 | ||
| 48 | #define MAX_HEIGHT 128 | ||
| 49 | |||
| 50 | 126 | static void check_shuffle_bytes(void * func, const char * report) | |
| 51 | { | ||
| 52 | int i; | ||
| 53 | 126 | LOCAL_ALIGNED_32(uint8_t, src0, [MAX_STRIDE]); | |
| 54 | 126 | LOCAL_ALIGNED_32(uint8_t, src1, [MAX_STRIDE]); | |
| 55 | 126 | LOCAL_ALIGNED_32(uint8_t, dst0, [MAX_STRIDE]); | |
| 56 | 126 | LOCAL_ALIGNED_32(uint8_t, dst1, [MAX_STRIDE]); | |
| 57 | |||
| 58 | 126 | declare_func(void, const uint8_t *src, uint8_t *dst, int src_size); | |
| 59 | |||
| 60 | 126 | memset(dst0, 0, MAX_STRIDE); | |
| 61 | 126 | memset(dst1, 0, MAX_STRIDE); | |
| 62 |
2/2✓ Branch 1 taken 4032 times.
✓ Branch 2 taken 126 times.
|
4158 | randomize_buffers(src0, MAX_STRIDE); |
| 63 | 126 | memcpy(src1, src0, MAX_STRIDE); | |
| 64 | |||
| 65 |
2/2✓ Branch 1 taken 27 times.
✓ Branch 2 taken 99 times.
|
126 | if (check_func(func, "%s", report)) { |
| 66 |
2/2✓ Branch 0 taken 162 times.
✓ Branch 1 taken 27 times.
|
189 | for (i = 0; i < 6; i ++) { |
| 67 |
1/2✗ Branch 2 not taken.
✓ Branch 3 taken 162 times.
|
162 | call_ref(src0, dst0, width[i]); |
| 68 | 162 | call_new(src1, dst1, width[i]); | |
| 69 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 162 times.
|
162 | if (memcmp(dst0, dst1, MAX_STRIDE)) |
| 70 | ✗ | fail(); | |
| 71 | } | ||
| 72 |
1/18✗ Branch 1 not taken.
✓ Branch 2 taken 27 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
|
27 | bench_new(src0, dst0, width[5]); |
| 73 | } | ||
| 74 | 126 | } | |
| 75 | |||
| 76 | 56 | static void check_interleaved_to_planar(void *func, const char *report, int odd_tail) | |
| 77 | { | ||
| 78 | int i; | ||
| 79 | |||
| 80 | 56 | LOCAL_ALIGNED_32(uint8_t, src0, [MAX_STRIDE * MAX_HEIGHT * 2]); | |
| 81 | 56 | LOCAL_ALIGNED_32(uint8_t, src1, [MAX_STRIDE * MAX_HEIGHT * 2]); | |
| 82 | 56 | LOCAL_ALIGNED_32(uint8_t, dst_y_0, [MAX_STRIDE * MAX_HEIGHT]); | |
| 83 | 56 | LOCAL_ALIGNED_32(uint8_t, dst_y_1, [MAX_STRIDE * MAX_HEIGHT]); | |
| 84 | 56 | LOCAL_ALIGNED_32(uint8_t, dst_u_0, [(MAX_STRIDE/2) * MAX_HEIGHT]); | |
| 85 | 56 | LOCAL_ALIGNED_32(uint8_t, dst_u_1, [(MAX_STRIDE/2) * MAX_HEIGHT]); | |
| 86 | 56 | LOCAL_ALIGNED_32(uint8_t, dst_v_0, [(MAX_STRIDE/2) * MAX_HEIGHT]); | |
| 87 | 56 | LOCAL_ALIGNED_32(uint8_t, dst_v_1, [(MAX_STRIDE/2) * MAX_HEIGHT]); | |
| 88 | |||
| 89 | 56 | declare_func(void, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, | |
| 90 | const uint8_t *src, int width, int height, | ||
| 91 | int lumStride, int chromStride, int srcStride); | ||
| 92 | |||
| 93 |
2/2✓ Branch 1 taken 458752 times.
✓ Branch 2 taken 56 times.
|
458808 | randomize_buffers(src0, MAX_STRIDE * MAX_HEIGHT * 2); |
| 94 | 56 | memcpy(src1, src0, MAX_STRIDE * MAX_HEIGHT * 2); | |
| 95 | |||
| 96 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 2 taken 46 times.
|
56 | if (check_func(func, "%s", report)) { |
| 97 |
2/2✓ Branch 0 taken 160 times.
✓ Branch 1 taken 10 times.
|
170 | for (i = 0; i < FF_ARRAY_ELEMS(planes); i ++) { |
| 98 | 160 | int w = planes[i].w, h = planes[i].h; | |
| 99 |
2/2✓ Branch 0 taken 80 times.
✓ Branch 1 taken 80 times.
|
160 | int srcStride = 2 * w + (w & 1 ? odd_tail : 0); |
| 100 | |||
| 101 | 160 | memset(dst_y_0, 0, MAX_STRIDE * MAX_HEIGHT); | |
| 102 | 160 | memset(dst_y_1, 0, MAX_STRIDE * MAX_HEIGHT); | |
| 103 | 160 | memset(dst_u_0, 0, (MAX_STRIDE/2) * MAX_HEIGHT); | |
| 104 | 160 | memset(dst_u_1, 0, (MAX_STRIDE/2) * MAX_HEIGHT); | |
| 105 | 160 | memset(dst_v_0, 0, (MAX_STRIDE/2) * MAX_HEIGHT); | |
| 106 | 160 | memset(dst_v_1, 0, (MAX_STRIDE/2) * MAX_HEIGHT); | |
| 107 | |||
| 108 |
1/2✗ Branch 2 not taken.
✓ Branch 3 taken 160 times.
|
160 | call_ref(dst_y_0, dst_u_0, dst_v_0, src0, w, h, |
| 109 | MAX_STRIDE, MAX_STRIDE / 2, srcStride); | ||
| 110 | 160 | call_new(dst_y_1, dst_u_1, dst_v_1, src1, w, h, | |
| 111 | MAX_STRIDE, MAX_STRIDE / 2, srcStride); | ||
| 112 |
1/2✓ Branch 0 taken 160 times.
✗ Branch 1 not taken.
|
160 | if (memcmp(dst_y_0, dst_y_1, MAX_STRIDE * MAX_HEIGHT) || |
| 113 |
1/2✓ Branch 0 taken 160 times.
✗ Branch 1 not taken.
|
160 | memcmp(dst_u_0, dst_u_1, (MAX_STRIDE/2) * MAX_HEIGHT) || |
| 114 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 160 times.
|
160 | memcmp(dst_v_0, dst_v_1, (MAX_STRIDE/2) * MAX_HEIGHT)) |
| 115 | ✗ | fail(); | |
| 116 | } | ||
| 117 |
1/18✗ Branch 1 not taken.
✓ Branch 2 taken 10 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
|
10 | bench_new(dst_y_1, dst_u_1, dst_v_1, src1, planes[5].w, planes[5].h, |
| 118 | MAX_STRIDE, MAX_STRIDE / 2, 2 * planes[5].w); | ||
| 119 | } | ||
| 120 | 56 | } | |
| 121 | |||
| 122 | #define NUM_LINES 5 | ||
| 123 | #define MAX_LINE_SIZE 1920 | ||
| 124 | #define BUFSIZE (NUM_LINES * MAX_LINE_SIZE) | ||
| 125 | |||
| 126 | 15 | static int cmp_off_by_n(const uint8_t *ref, const uint8_t *test, size_t n, int accuracy) | |
| 127 | { | ||
| 128 |
2/2✓ Branch 0 taken 72000 times.
✓ Branch 1 taken 15 times.
|
72015 | for (size_t i = 0; i < n; i++) { |
| 129 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 72000 times.
|
72000 | if (abs(ref[i] - test[i]) > accuracy) |
| 130 | ✗ | return 1; | |
| 131 | } | ||
| 132 | 15 | return 0; | |
| 133 | } | ||
| 134 | |||
| 135 | 14 | static void check_rgb24toyv12(SwsContext *sws) | |
| 136 | { | ||
| 137 | static const int input_sizes[] = {16, 128, 512, MAX_LINE_SIZE, -MAX_LINE_SIZE}; | ||
| 138 | 14 | SwsInternal *ctx = sws_internal(sws); | |
| 139 | |||
| 140 | 14 | LOCAL_ALIGNED_32(uint8_t, src, [BUFSIZE * 3]); | |
| 141 | 14 | LOCAL_ALIGNED_32(uint8_t, buf_y_0, [BUFSIZE]); | |
| 142 | 14 | LOCAL_ALIGNED_32(uint8_t, buf_y_1, [BUFSIZE]); | |
| 143 | 14 | LOCAL_ALIGNED_32(uint8_t, buf_u_0, [BUFSIZE / 4]); | |
| 144 | 14 | LOCAL_ALIGNED_32(uint8_t, buf_u_1, [BUFSIZE / 4]); | |
| 145 | 14 | LOCAL_ALIGNED_32(uint8_t, buf_v_0, [BUFSIZE / 4]); | |
| 146 | 14 | LOCAL_ALIGNED_32(uint8_t, buf_v_1, [BUFSIZE / 4]); | |
| 147 | |||
| 148 | 14 | declare_func(void, const uint8_t *src, uint8_t *ydst, uint8_t *udst, | |
| 149 | uint8_t *vdst, int width, int height, int lumStride, | ||
| 150 | int chromStride, int srcStride, const int32_t *rgb2yuv); | ||
| 151 | |||
| 152 |
2/2✓ Branch 1 taken 100800 times.
✓ Branch 2 taken 14 times.
|
100814 | randomize_buffers(src, BUFSIZE * 3); |
| 153 | |||
| 154 |
2/2✓ Branch 0 taken 70 times.
✓ Branch 1 taken 14 times.
|
84 | for (int isi = 0; isi < FF_ARRAY_ELEMS(input_sizes); isi++) { |
| 155 | 70 | int input_size = input_sizes[isi]; | |
| 156 | 70 | int negstride = input_size < 0; | |
| 157 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 56 times.
|
70 | const char *negstride_str = negstride ? "_negstride" : ""; |
| 158 | 70 | int width = FFABS(input_size); | |
| 159 | 70 | int linesize = width + 32; | |
| 160 | /* calculate height based on specified width to use the entire buffer. */ | ||
| 161 | 70 | int height = (BUFSIZE / linesize) & ~1; | |
| 162 | 70 | uint8_t *src0 = src; | |
| 163 | 70 | uint8_t *src1 = src; | |
| 164 | 70 | uint8_t *dst_y_0 = buf_y_0; | |
| 165 | 70 | uint8_t *dst_y_1 = buf_y_1; | |
| 166 | 70 | uint8_t *dst_u_0 = buf_u_0; | |
| 167 | 70 | uint8_t *dst_u_1 = buf_u_1; | |
| 168 | 70 | uint8_t *dst_v_0 = buf_v_0; | |
| 169 | 70 | uint8_t *dst_v_1 = buf_v_1; | |
| 170 | |||
| 171 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 56 times.
|
70 | if (negstride) { |
| 172 | 14 | src0 += (height - 1) * (linesize * 3); | |
| 173 | 14 | src1 += (height - 1) * (linesize * 3); | |
| 174 | 14 | dst_y_0 += (height - 1) * linesize; | |
| 175 | 14 | dst_y_1 += (height - 1) * linesize; | |
| 176 | 14 | dst_u_0 += ((height / 2) - 1) * (linesize / 2); | |
| 177 | 14 | dst_u_1 += ((height / 2) - 1) * (linesize / 2); | |
| 178 | 14 | dst_v_0 += ((height / 2) - 1) * (linesize / 2); | |
| 179 | 14 | dst_v_1 += ((height / 2) - 1) * (linesize / 2); | |
| 180 | 14 | linesize *= -1; | |
| 181 | } | ||
| 182 | |||
| 183 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 2 taken 65 times.
|
70 | if (check_func(ff_rgb24toyv12, "rgb24toyv12_%d_%d%s", width, height, negstride_str)) { |
| 184 | 5 | memset(buf_y_0, 0xFF, BUFSIZE); | |
| 185 | 5 | memset(buf_y_1, 0xFF, BUFSIZE); | |
| 186 | 5 | memset(buf_u_0, 0xFF, BUFSIZE / 4); | |
| 187 | 5 | memset(buf_u_1, 0xFF, BUFSIZE / 4); | |
| 188 | 5 | memset(buf_v_0, 0xFF, BUFSIZE / 4); | |
| 189 | 5 | memset(buf_v_1, 0xFF, BUFSIZE / 4); | |
| 190 | |||
| 191 |
1/2✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
|
5 | call_ref(src0, dst_y_0, dst_u_0, dst_v_0, width, height, |
| 192 | linesize, linesize / 2, linesize * 3, ctx->input_rgb2yuv_table); | ||
| 193 | 5 | call_new(src1, dst_y_1, dst_u_1, dst_v_1, width, height, | |
| 194 | linesize, linesize / 2, linesize * 3, ctx->input_rgb2yuv_table); | ||
| 195 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
|
10 | if (cmp_off_by_n(buf_y_0, buf_y_1, BUFSIZE, 1) || |
| 196 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
|
10 | cmp_off_by_n(buf_u_0, buf_u_1, BUFSIZE / 4, 1) || |
| 197 | 5 | cmp_off_by_n(buf_v_0, buf_v_1, BUFSIZE / 4, 1)) | |
| 198 | ✗ | fail(); | |
| 199 |
1/18✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
|
5 | bench_new(src1, dst_y_1, dst_u_1, dst_v_1, width, height, |
| 200 | linesize, linesize / 2, linesize * 3, ctx->input_rgb2yuv_table); | ||
| 201 | } | ||
| 202 | } | ||
| 203 | 14 | } | |
| 204 | |||
| 205 | #undef NUM_LINES | ||
| 206 | #undef MAX_LINE_SIZE | ||
| 207 | #undef BUFSIZE | ||
| 208 | |||
| 209 | 14 | static void check_interleave_bytes(void) | |
| 210 | { | ||
| 211 | 14 | LOCAL_ALIGNED_16(uint8_t, src0_buf, [MAX_STRIDE*MAX_HEIGHT+1]); | |
| 212 | 14 | LOCAL_ALIGNED_16(uint8_t, src1_buf, [MAX_STRIDE*MAX_HEIGHT+1]); | |
| 213 | 14 | LOCAL_ALIGNED_16(uint8_t, dst0_buf, [2*MAX_STRIDE*MAX_HEIGHT+2]); | |
| 214 | 14 | LOCAL_ALIGNED_16(uint8_t, dst1_buf, [2*MAX_STRIDE*MAX_HEIGHT+2]); | |
| 215 | // Intentionally using unaligned buffers, as this function doesn't have | ||
| 216 | // any alignment requirements. | ||
| 217 | 14 | uint8_t *src0 = src0_buf + 1; | |
| 218 | 14 | uint8_t *src1 = src1_buf + 1; | |
| 219 | 14 | uint8_t *dst0 = dst0_buf + 2; | |
| 220 | 14 | uint8_t *dst1 = dst1_buf + 2; | |
| 221 | |||
| 222 | 14 | declare_func(void, const uint8_t *, const uint8_t *, | |
| 223 | uint8_t *, int, int, int, int, int); | ||
| 224 | |||
| 225 |
2/2✓ Branch 1 taken 57344 times.
✓ Branch 2 taken 14 times.
|
57358 | randomize_buffers(src0, MAX_STRIDE * MAX_HEIGHT); |
| 226 |
2/2✓ Branch 1 taken 57344 times.
✓ Branch 2 taken 14 times.
|
57358 | randomize_buffers(src1, MAX_STRIDE * MAX_HEIGHT); |
| 227 | |||
| 228 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 2 taken 12 times.
|
14 | if (check_func(interleaveBytes, "interleave_bytes")) { |
| 229 |
2/2✓ Branch 0 taken 34 times.
✓ Branch 1 taken 2 times.
|
36 | for (int i = 0; i <= 16; i++) { |
| 230 | // Try all widths [1,16], and try one random width. | ||
| 231 | |||
| 232 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 32 times.
|
34 | int w = i > 0 ? i : (1 + (rnd() % (MAX_STRIDE-2))); |
| 233 | 34 | int h = 1 + (rnd() % (MAX_HEIGHT-2)); | |
| 234 | |||
| 235 | 34 | int src0_offset = 0, src0_stride = MAX_STRIDE; | |
| 236 | 34 | int src1_offset = 0, src1_stride = MAX_STRIDE; | |
| 237 | 34 | int dst_offset = 0, dst_stride = 2 * MAX_STRIDE; | |
| 238 | |||
| 239 | 34 | memset(dst0, 0, 2 * MAX_STRIDE * MAX_HEIGHT); | |
| 240 | 34 | memset(dst1, 0, 2 * MAX_STRIDE * MAX_HEIGHT); | |
| 241 | |||
| 242 | // Try different combinations of negative strides | ||
| 243 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 18 times.
|
34 | if (i & 1) { |
| 244 | 16 | src0_offset = (h-1)*src0_stride; | |
| 245 | 16 | src0_stride = -src0_stride; | |
| 246 | } | ||
| 247 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 18 times.
|
34 | if (i & 2) { |
| 248 | 16 | src1_offset = (h-1)*src1_stride; | |
| 249 | 16 | src1_stride = -src1_stride; | |
| 250 | } | ||
| 251 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 18 times.
|
34 | if (i & 4) { |
| 252 | 16 | dst_offset = (h-1)*dst_stride; | |
| 253 | 16 | dst_stride = -dst_stride; | |
| 254 | } | ||
| 255 | |||
| 256 |
1/2✗ Branch 2 not taken.
✓ Branch 3 taken 34 times.
|
34 | call_ref(src0 + src0_offset, src1 + src1_offset, dst0 + dst_offset, |
| 257 | w, h, src0_stride, src1_stride, dst_stride); | ||
| 258 | 34 | call_new(src0 + src0_offset, src1 + src1_offset, dst1 + dst_offset, | |
| 259 | w, h, src0_stride, src1_stride, dst_stride); | ||
| 260 | // Check a one pixel-pair edge around the destination area, | ||
| 261 | // to catch overwrites past the end. | ||
| 262 | 34 | checkasm_check(uint8_t, dst0, 2*MAX_STRIDE, dst1, 2*MAX_STRIDE, | |
| 263 | 2 * w + 2, h + 1, "dst"); | ||
| 264 | } | ||
| 265 | |||
| 266 |
1/18✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
|
2 | bench_new(src0, src1, dst1, 127, MAX_HEIGHT, |
| 267 | MAX_STRIDE, MAX_STRIDE, 2*MAX_STRIDE); | ||
| 268 | } | ||
| 269 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 2 taken 12 times.
|
14 | if (check_func(interleaveBytes, "interleave_bytes_aligned")) { |
| 270 | // Bench the function in a more typical case, with aligned | ||
| 271 | // buffers and widths. | ||
| 272 |
1/18✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
|
2 | bench_new(src0_buf, src1_buf, dst1_buf, 128, MAX_HEIGHT, |
| 273 | MAX_STRIDE, MAX_STRIDE, 2*MAX_STRIDE); | ||
| 274 | } | ||
| 275 | 14 | } | |
| 276 | |||
| 277 | 14 | static void check_deinterleave_bytes(void) | |
| 278 | { | ||
| 279 | 14 | LOCAL_ALIGNED_16(uint8_t, src_buf, [2*MAX_STRIDE*MAX_HEIGHT+2]); | |
| 280 | 14 | LOCAL_ALIGNED_16(uint8_t, dst0_u_buf, [MAX_STRIDE*MAX_HEIGHT+1]); | |
| 281 | 14 | LOCAL_ALIGNED_16(uint8_t, dst0_v_buf, [MAX_STRIDE*MAX_HEIGHT+1]); | |
| 282 | 14 | LOCAL_ALIGNED_16(uint8_t, dst1_u_buf, [MAX_STRIDE*MAX_HEIGHT+1]); | |
| 283 | 14 | LOCAL_ALIGNED_16(uint8_t, dst1_v_buf, [MAX_STRIDE*MAX_HEIGHT+1]); | |
| 284 | // Intentionally using unaligned buffers, as this function doesn't have | ||
| 285 | // any alignment requirements. | ||
| 286 | 14 | uint8_t *src = src_buf + 2; | |
| 287 | 14 | uint8_t *dst0_u = dst0_u_buf + 1; | |
| 288 | 14 | uint8_t *dst0_v = dst0_v_buf + 1; | |
| 289 | 14 | uint8_t *dst1_u = dst1_u_buf + 1; | |
| 290 | 14 | uint8_t *dst1_v = dst1_v_buf + 1; | |
| 291 | |||
| 292 | 14 | declare_func(void, const uint8_t *src, uint8_t *dst1, uint8_t *dst2, | |
| 293 | int width, int height, int srcStride, | ||
| 294 | int dst1Stride, int dst2Stride); | ||
| 295 | |||
| 296 |
2/2✓ Branch 1 taken 114688 times.
✓ Branch 2 taken 14 times.
|
114702 | randomize_buffers(src, 2*MAX_STRIDE*MAX_HEIGHT); |
| 297 | |||
| 298 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 2 taken 11 times.
|
14 | if (check_func(deinterleaveBytes, "deinterleave_bytes")) { |
| 299 |
2/2✓ Branch 0 taken 51 times.
✓ Branch 1 taken 3 times.
|
54 | for (int i = 0; i <= 16; i++) { |
| 300 | // Try all widths [1,16], and try one random width. | ||
| 301 | |||
| 302 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 48 times.
|
51 | int w = i > 0 ? i : (1 + (rnd() % (MAX_STRIDE-2))); |
| 303 | 51 | int h = 1 + (rnd() % (MAX_HEIGHT-2)); | |
| 304 | |||
| 305 | 51 | int src_offset = 0, src_stride = 2 * MAX_STRIDE; | |
| 306 | 51 | int dst_u_offset = 0, dst_u_stride = MAX_STRIDE; | |
| 307 | 51 | int dst_v_offset = 0, dst_v_stride = MAX_STRIDE; | |
| 308 | |||
| 309 | 51 | memset(dst0_u, 0, MAX_STRIDE * MAX_HEIGHT); | |
| 310 | 51 | memset(dst0_v, 0, MAX_STRIDE * MAX_HEIGHT); | |
| 311 | 51 | memset(dst1_u, 0, MAX_STRIDE * MAX_HEIGHT); | |
| 312 | 51 | memset(dst1_v, 0, MAX_STRIDE * MAX_HEIGHT); | |
| 313 | |||
| 314 | // Try different combinations of negative strides | ||
| 315 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 27 times.
|
51 | if (i & 1) { |
| 316 | 24 | src_offset = (h-1)*src_stride; | |
| 317 | 24 | src_stride = -src_stride; | |
| 318 | } | ||
| 319 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 27 times.
|
51 | if (i & 2) { |
| 320 | 24 | dst_u_offset = (h-1)*dst_u_stride; | |
| 321 | 24 | dst_u_stride = -dst_u_stride; | |
| 322 | } | ||
| 323 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 27 times.
|
51 | if (i & 4) { |
| 324 | 24 | dst_v_offset = (h-1)*dst_v_stride; | |
| 325 | 24 | dst_v_stride = -dst_v_stride; | |
| 326 | } | ||
| 327 | |||
| 328 |
1/2✗ Branch 2 not taken.
✓ Branch 3 taken 51 times.
|
51 | call_ref(src + src_offset, dst0_u + dst_u_offset, dst0_v + dst_v_offset, |
| 329 | w, h, src_stride, dst_u_stride, dst_v_stride); | ||
| 330 | 51 | call_new(src + src_offset, dst1_u + dst_u_offset, dst1_v + dst_v_offset, | |
| 331 | w, h, src_stride, dst_u_stride, dst_v_stride); | ||
| 332 | // Check a one pixel-pair edge around the destination area, | ||
| 333 | // to catch overwrites past the end. | ||
| 334 | 51 | checkasm_check(uint8_t, dst0_u, MAX_STRIDE, dst1_u, MAX_STRIDE, | |
| 335 | w + 1, h + 1, "dst_u"); | ||
| 336 | 51 | checkasm_check(uint8_t, dst0_v, MAX_STRIDE, dst1_v, MAX_STRIDE, | |
| 337 | w + 1, h + 1, "dst_v"); | ||
| 338 | } | ||
| 339 | |||
| 340 |
1/18✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
|
3 | bench_new(src, dst1_u, dst1_v, 127, MAX_HEIGHT, |
| 341 | 2*MAX_STRIDE, MAX_STRIDE, MAX_STRIDE); | ||
| 342 | } | ||
| 343 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 2 taken 11 times.
|
14 | if (check_func(deinterleaveBytes, "deinterleave_bytes_aligned")) { |
| 344 | // Bench the function in a more typical case, with aligned | ||
| 345 | // buffers and widths. | ||
| 346 |
1/18✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
|
3 | bench_new(src_buf, dst1_u_buf, dst1_v_buf, 128, MAX_HEIGHT, |
| 347 | 2*MAX_STRIDE, MAX_STRIDE, MAX_STRIDE); | ||
| 348 | } | ||
| 349 | 14 | } | |
| 350 | |||
| 351 | #define MAX_LINE_SIZE 1920 | ||
| 352 | static const int input_sizes[] = {8, 128, 1080, MAX_LINE_SIZE}; | ||
| 353 | static const enum AVPixelFormat rgb_formats[] = { | ||
| 354 | AV_PIX_FMT_RGB24, | ||
| 355 | AV_PIX_FMT_BGR24, | ||
| 356 | AV_PIX_FMT_RGBA, | ||
| 357 | AV_PIX_FMT_BGRA, | ||
| 358 | AV_PIX_FMT_ABGR, | ||
| 359 | AV_PIX_FMT_ARGB, | ||
| 360 | }; | ||
| 361 | |||
| 362 | 14 | static void check_rgb_to_y(SwsContext *sws) | |
| 363 | { | ||
| 364 | 14 | SwsInternal *ctx = sws_internal(sws); | |
| 365 | |||
| 366 | 14 | LOCAL_ALIGNED_16(uint8_t, src24, [MAX_LINE_SIZE * 3]); | |
| 367 | 14 | LOCAL_ALIGNED_16(uint8_t, src32, [MAX_LINE_SIZE * 4]); | |
| 368 | 14 | LOCAL_ALIGNED_32(uint8_t, dst0_y, [MAX_LINE_SIZE * 2]); | |
| 369 | 14 | LOCAL_ALIGNED_32(uint8_t, dst1_y, [MAX_LINE_SIZE * 2]); | |
| 370 | |||
| 371 | 14 | declare_func(void, uint8_t *dst, const uint8_t *src, | |
| 372 | const uint8_t *unused1, const uint8_t *unused2, int width, | ||
| 373 | uint32_t *rgb2yuv, void *opq); | ||
| 374 | |||
| 375 |
2/2✓ Branch 1 taken 20160 times.
✓ Branch 2 taken 14 times.
|
20174 | randomize_buffers(src24, MAX_LINE_SIZE * 3); |
| 376 |
2/2✓ Branch 1 taken 26880 times.
✓ Branch 2 taken 14 times.
|
26894 | randomize_buffers(src32, MAX_LINE_SIZE * 4); |
| 377 | |||
| 378 |
2/2✓ Branch 0 taken 84 times.
✓ Branch 1 taken 14 times.
|
98 | for (int i = 0; i < FF_ARRAY_ELEMS(rgb_formats); i++) { |
| 379 | 84 | const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(rgb_formats[i]); | |
| 380 | |||
| 381 | 84 | sws->src_format = rgb_formats[i]; | |
| 382 | 84 | ff_sws_init_scale(ctx); | |
| 383 | |||
| 384 |
2/2✓ Branch 0 taken 336 times.
✓ Branch 1 taken 84 times.
|
420 | for (int j = 0; j < FF_ARRAY_ELEMS(input_sizes); j++) { |
| 385 | 336 | int w = input_sizes[j]; | |
| 386 | |||
| 387 |
2/2✓ Branch 1 taken 104 times.
✓ Branch 2 taken 232 times.
|
336 | if (check_func(ctx->lumToYV12, "%s_to_y_%d", desc->name, w)) { |
| 388 |
2/2✓ Branch 0 taken 40 times.
✓ Branch 1 taken 64 times.
|
104 | const uint8_t *src = desc->nb_components == 3 ? src24 : src32; |
| 389 | 104 | memset(dst0_y, 0xFA, MAX_LINE_SIZE * 2); | |
| 390 | 104 | memset(dst1_y, 0xFA, MAX_LINE_SIZE * 2); | |
| 391 | |||
| 392 |
1/2✗ Branch 2 not taken.
✓ Branch 3 taken 104 times.
|
104 | call_ref(dst0_y, src, NULL, NULL, w, ctx->input_rgb2yuv_table, NULL); |
| 393 | 104 | call_new(dst1_y, src, NULL, NULL, w, ctx->input_rgb2yuv_table, NULL); | |
| 394 | |||
| 395 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 104 times.
|
104 | if (memcmp(dst0_y, dst1_y, w * 2)) |
| 396 | ✗ | fail(); | |
| 397 | |||
| 398 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 40 times.
|
104 | if (desc->nb_components == 3 || |
| 399 | // only bench native endian formats | ||
| 400 |
4/4✓ Branch 0 taken 48 times.
✓ Branch 1 taken 16 times.
✓ Branch 2 taken 16 times.
✓ Branch 3 taken 32 times.
|
64 | (sws->src_format == AV_PIX_FMT_RGB32 || sws->src_format == AV_PIX_FMT_RGB32_1)) |
| 401 |
1/18✗ Branch 1 not taken.
✓ Branch 2 taken 72 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
|
72 | bench_new(dst1_y, src, NULL, NULL, w, ctx->input_rgb2yuv_table, NULL); |
| 402 | } | ||
| 403 | } | ||
| 404 | } | ||
| 405 | 14 | } | |
| 406 | |||
| 407 | 14 | static void check_rgb_to_uv(SwsContext *sws) | |
| 408 | { | ||
| 409 | 14 | SwsInternal *ctx = sws_internal(sws); | |
| 410 | |||
| 411 | 14 | LOCAL_ALIGNED_16(uint8_t, src24, [MAX_LINE_SIZE * 3]); | |
| 412 | 14 | LOCAL_ALIGNED_16(uint8_t, src32, [MAX_LINE_SIZE * 4]); | |
| 413 | 14 | LOCAL_ALIGNED_16(uint8_t, dst0_u, [MAX_LINE_SIZE * 2]); | |
| 414 | 14 | LOCAL_ALIGNED_16(uint8_t, dst0_v, [MAX_LINE_SIZE * 2]); | |
| 415 | 14 | LOCAL_ALIGNED_16(uint8_t, dst1_u, [MAX_LINE_SIZE * 2]); | |
| 416 | 14 | LOCAL_ALIGNED_16(uint8_t, dst1_v, [MAX_LINE_SIZE * 2]); | |
| 417 | |||
| 418 | 14 | declare_func(void, uint8_t *dstU, uint8_t *dstV, | |
| 419 | const uint8_t *src1, const uint8_t *src2, const uint8_t *src3, | ||
| 420 | int width, uint32_t *pal, void *opq); | ||
| 421 | |||
| 422 |
2/2✓ Branch 1 taken 20160 times.
✓ Branch 2 taken 14 times.
|
20174 | randomize_buffers(src24, MAX_LINE_SIZE * 3); |
| 423 |
2/2✓ Branch 1 taken 26880 times.
✓ Branch 2 taken 14 times.
|
26894 | randomize_buffers(src32, MAX_LINE_SIZE * 4); |
| 424 | |||
| 425 |
2/2✓ Branch 0 taken 168 times.
✓ Branch 1 taken 14 times.
|
182 | for (int i = 0; i < 2 * FF_ARRAY_ELEMS(rgb_formats); i++) { |
| 426 | 168 | enum AVPixelFormat src_fmt = rgb_formats[i / 2]; | |
| 427 | 168 | const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(src_fmt); | |
| 428 | |||
| 429 | 168 | ctx->chrSrcHSubSample = (i % 2) ? 0 : 1; | |
| 430 | 168 | sws->src_format = src_fmt; | |
| 431 |
2/2✓ Branch 0 taken 84 times.
✓ Branch 1 taken 84 times.
|
168 | sws->dst_format = ctx->chrSrcHSubSample ? AV_PIX_FMT_YUV420P : AV_PIX_FMT_YUV444P; |
| 432 | 168 | ff_sws_init_scale(ctx); | |
| 433 | |||
| 434 |
2/2✓ Branch 0 taken 672 times.
✓ Branch 1 taken 168 times.
|
840 | for (int j = 0; j < FF_ARRAY_ELEMS(input_sizes); j++) { |
| 435 | 672 | int w = input_sizes[j] >> ctx->chrSrcHSubSample; | |
| 436 | |||
| 437 |
4/4✓ Branch 0 taken 336 times.
✓ Branch 1 taken 336 times.
✓ Branch 3 taken 128 times.
✓ Branch 4 taken 544 times.
|
672 | if (check_func(ctx->chrToYV12, "%s_to_uv%s_%d", desc->name, |
| 438 | ctx->chrSrcHSubSample ? "_half" : "", | ||
| 439 | input_sizes[j])) { | ||
| 440 |
2/2✓ Branch 0 taken 48 times.
✓ Branch 1 taken 80 times.
|
128 | const uint8_t *src = desc->nb_components == 3 ? src24 : src32; |
| 441 | 128 | memset(dst0_u, 0xFF, MAX_LINE_SIZE * 2); | |
| 442 | 128 | memset(dst0_v, 0xFF, MAX_LINE_SIZE * 2); | |
| 443 | 128 | memset(dst1_u, 0xFF, MAX_LINE_SIZE * 2); | |
| 444 | 128 | memset(dst1_v, 0xFF, MAX_LINE_SIZE * 2); | |
| 445 | |||
| 446 |
1/2✗ Branch 2 not taken.
✓ Branch 3 taken 128 times.
|
128 | call_ref(dst0_u, dst0_v, NULL, src, src, w, ctx->input_rgb2yuv_table, NULL); |
| 447 | 128 | call_new(dst1_u, dst1_v, NULL, src, src, w, ctx->input_rgb2yuv_table, NULL); | |
| 448 | |||
| 449 |
2/4✓ Branch 0 taken 128 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 128 times.
|
128 | if (memcmp(dst0_u, dst1_u, w * 2) || memcmp(dst0_v, dst1_v, w * 2)) |
| 450 | ✗ | fail(); | |
| 451 | |||
| 452 |
2/2✓ Branch 0 taken 80 times.
✓ Branch 1 taken 48 times.
|
128 | if (desc->nb_components == 3 || |
| 453 | // only bench native endian formats | ||
| 454 |
4/4✓ Branch 0 taken 60 times.
✓ Branch 1 taken 20 times.
✓ Branch 2 taken 20 times.
✓ Branch 3 taken 40 times.
|
80 | (sws->src_format == AV_PIX_FMT_RGB32 || sws->src_format == AV_PIX_FMT_RGB32_1)) |
| 455 |
1/18✗ Branch 1 not taken.
✓ Branch 2 taken 88 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
|
88 | bench_new(dst1_u, dst1_v, NULL, src, src, w, ctx->input_rgb2yuv_table, NULL); |
| 456 | } | ||
| 457 | } | ||
| 458 | } | ||
| 459 | 14 | } | |
| 460 | |||
| 461 | 14 | static void check_rgba_to_a(SwsContext *sws) | |
| 462 | { | ||
| 463 | 14 | SwsInternal *ctx = sws_internal(sws); | |
| 464 | |||
| 465 | 14 | LOCAL_ALIGNED_16(uint8_t, src, [MAX_LINE_SIZE * 4]); | |
| 466 | 14 | LOCAL_ALIGNED_32(uint8_t, dst0_y, [MAX_LINE_SIZE * 2]); | |
| 467 | 14 | LOCAL_ALIGNED_32(uint8_t, dst1_y, [MAX_LINE_SIZE * 2]); | |
| 468 | |||
| 469 | 14 | declare_func(void, uint8_t *dst, const uint8_t *src1, | |
| 470 | const uint8_t *src2, const uint8_t *src3, int width, | ||
| 471 | uint32_t *rgb2yuv, void *opq); | ||
| 472 | |||
| 473 |
2/2✓ Branch 1 taken 26880 times.
✓ Branch 2 taken 14 times.
|
26894 | randomize_buffers(src, MAX_LINE_SIZE * 4); |
| 474 | |||
| 475 |
2/2✓ Branch 0 taken 84 times.
✓ Branch 1 taken 14 times.
|
98 | for (int i = 0; i < FF_ARRAY_ELEMS(rgb_formats); i++) { |
| 476 | 84 | const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(rgb_formats[i]); | |
| 477 |
2/2✓ Branch 0 taken 28 times.
✓ Branch 1 taken 56 times.
|
84 | if (desc->nb_components < 4) |
| 478 | 28 | continue; | |
| 479 | |||
| 480 | 56 | sws->src_format = rgb_formats[i]; | |
| 481 | 56 | ff_sws_init_scale(ctx); | |
| 482 | |||
| 483 |
2/2✓ Branch 0 taken 224 times.
✓ Branch 1 taken 56 times.
|
280 | for (int j = 0; j < FF_ARRAY_ELEMS(input_sizes); j++) { |
| 484 | 224 | int w = input_sizes[j]; | |
| 485 | |||
| 486 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 224 times.
|
224 | if (check_func(ctx->alpToYV12, "%s_to_y_%d", desc->name, w)) { |
| 487 | ✗ | memset(dst0_y, 0xFA, MAX_LINE_SIZE * 2); | |
| 488 | ✗ | memset(dst1_y, 0xFA, MAX_LINE_SIZE * 2); | |
| 489 | |||
| 490 | ✗ | call_ref(dst0_y, NULL, NULL, src, w, ctx->input_rgb2yuv_table, NULL); | |
| 491 | ✗ | call_new(dst1_y, NULL, NULL, src, w, ctx->input_rgb2yuv_table, NULL); | |
| 492 | |||
| 493 | ✗ | if (memcmp(dst0_y, dst1_y, w * 2)) | |
| 494 | ✗ | fail(); | |
| 495 | |||
| 496 | // only bench native endian formats | ||
| 497 | ✗ | if (sws->src_format == AV_PIX_FMT_RGB32 || sws->src_format == AV_PIX_FMT_RGB32_1) | |
| 498 | ✗ | bench_new(dst1_y, NULL, NULL, src, w, ctx->input_rgb2yuv_table, NULL); | |
| 499 | } | ||
| 500 | } | ||
| 501 | } | ||
| 502 | 14 | } | |
| 503 | |||
| 504 | |||
| 505 | static const int packed_rgb_fmts[] = { | ||
| 506 | AV_PIX_FMT_RGB24, | ||
| 507 | AV_PIX_FMT_BGR24, | ||
| 508 | AV_PIX_FMT_ARGB, | ||
| 509 | AV_PIX_FMT_RGBA, | ||
| 510 | AV_PIX_FMT_ABGR, | ||
| 511 | AV_PIX_FMT_BGRA, | ||
| 512 | AV_PIX_FMT_RGB48BE, | ||
| 513 | AV_PIX_FMT_RGB48LE, | ||
| 514 | AV_PIX_FMT_RGB565BE, | ||
| 515 | AV_PIX_FMT_RGB565LE, | ||
| 516 | AV_PIX_FMT_RGB555BE, | ||
| 517 | AV_PIX_FMT_RGB555LE, | ||
| 518 | AV_PIX_FMT_BGR565BE, | ||
| 519 | AV_PIX_FMT_BGR565LE, | ||
| 520 | AV_PIX_FMT_BGR555BE, | ||
| 521 | AV_PIX_FMT_BGR555LE, | ||
| 522 | AV_PIX_FMT_RGB444LE, | ||
| 523 | AV_PIX_FMT_RGB444BE, | ||
| 524 | AV_PIX_FMT_BGR444LE, | ||
| 525 | AV_PIX_FMT_BGR444BE, | ||
| 526 | AV_PIX_FMT_BGR48BE, | ||
| 527 | AV_PIX_FMT_BGR48LE, | ||
| 528 | AV_PIX_FMT_RGBA64BE, | ||
| 529 | AV_PIX_FMT_RGBA64LE, | ||
| 530 | AV_PIX_FMT_BGRA64BE, | ||
| 531 | AV_PIX_FMT_BGRA64LE, | ||
| 532 | AV_PIX_FMT_RGB8, | ||
| 533 | AV_PIX_FMT_BGR8, | ||
| 534 | AV_PIX_FMT_RGB4, | ||
| 535 | AV_PIX_FMT_BGR4, | ||
| 536 | AV_PIX_FMT_RGB4_BYTE, | ||
| 537 | AV_PIX_FMT_BGR4_BYTE, | ||
| 538 | }; | ||
| 539 | |||
| 540 | #define INPUT_SIZE 512 | ||
| 541 | |||
| 542 | 14 | static void check_yuv2packed1(void) | |
| 543 | { | ||
| 544 | static const int alpha_values[] = {0, 2048, 4096}; | ||
| 545 | |||
| 546 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 2 taken 1 times.
|
14 | declare_func_emms(AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT, |
| 547 | void, SwsInternal *c, const int16_t *lumSrc, | ||
| 548 | const int16_t *chrUSrc[2], const int16_t *chrVSrc[2], | ||
| 549 | const int16_t *alpSrc, uint8_t *dest, | ||
| 550 | int dstW, int uvalpha, int y); | ||
| 551 | |||
| 552 | const int16_t *luma; | ||
| 553 | const int16_t *chru[2]; | ||
| 554 | const int16_t *chrv[2]; | ||
| 555 | const int16_t *alpha; | ||
| 556 | |||
| 557 | 14 | LOCAL_ALIGNED_8(int32_t, src_y, [2 * INPUT_SIZE]); | |
| 558 | 14 | LOCAL_ALIGNED_8(int32_t, src_u, [2 * INPUT_SIZE]); | |
| 559 | 14 | LOCAL_ALIGNED_8(int32_t, src_v, [2 * INPUT_SIZE]); | |
| 560 | 14 | LOCAL_ALIGNED_8(int32_t, src_a, [2 * INPUT_SIZE]); | |
| 561 | |||
| 562 | 14 | LOCAL_ALIGNED_8(uint8_t, dst0, [INPUT_SIZE * sizeof(int32_t[4])]); | |
| 563 | 14 | LOCAL_ALIGNED_8(uint8_t, dst1, [INPUT_SIZE * sizeof(int32_t[4])]); | |
| 564 | |||
| 565 |
2/2✓ Branch 1 taken 14336 times.
✓ Branch 2 taken 14 times.
|
14350 | randomize_buffers((uint8_t*)src_y, 2 * INPUT_SIZE * sizeof(int32_t)); |
| 566 |
2/2✓ Branch 1 taken 14336 times.
✓ Branch 2 taken 14 times.
|
14350 | randomize_buffers((uint8_t*)src_u, 2 * INPUT_SIZE * sizeof(int32_t)); |
| 567 |
2/2✓ Branch 1 taken 14336 times.
✓ Branch 2 taken 14 times.
|
14350 | randomize_buffers((uint8_t*)src_v, 2 * INPUT_SIZE * sizeof(int32_t)); |
| 568 |
2/2✓ Branch 1 taken 14336 times.
✓ Branch 2 taken 14 times.
|
14350 | randomize_buffers((uint8_t*)src_a, 2 * INPUT_SIZE * sizeof(int32_t)); |
| 569 | |||
| 570 | /* Limit to 14 bit input range */ | ||
| 571 |
2/2✓ Branch 0 taken 14336 times.
✓ Branch 1 taken 14 times.
|
14350 | for (int i = 0; i < 2 * INPUT_SIZE; i++) { |
| 572 | 14336 | src_y[i] &= 0x3FFF3FFF; | |
| 573 | 14336 | src_a[i] &= 0x3FFF3FFF; | |
| 574 | 14336 | src_u[i] &= 0x3FFF3FFF; | |
| 575 | 14336 | src_v[i] &= 0x3FFF3FFF; | |
| 576 | } | ||
| 577 | |||
| 578 | 14 | luma = (int16_t *)src_y; | |
| 579 | 14 | alpha = (int16_t *)src_a; | |
| 580 |
2/2✓ Branch 0 taken 28 times.
✓ Branch 1 taken 14 times.
|
42 | for (int i = 0; i < 2; i++) { |
| 581 | 28 | chru[i] = (int16_t *)(src_u + i*INPUT_SIZE); | |
| 582 | 28 | chrv[i] = (int16_t *)(src_v + i*INPUT_SIZE); | |
| 583 | } | ||
| 584 | |||
| 585 |
2/2✓ Branch 0 taken 448 times.
✓ Branch 1 taken 14 times.
|
462 | for (int fmi = 0; fmi < FF_ARRAY_ELEMS(packed_rgb_fmts); fmi++) { |
| 586 | 448 | const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(packed_rgb_fmts[fmi]); | |
| 587 | 448 | int line_size = INPUT_SIZE * desc->comp[0].step; | |
| 588 | SwsContext *sws; | ||
| 589 | SwsInternal *c; | ||
| 590 | |||
| 591 |
2/2✓ Branch 0 taken 28 times.
✓ Branch 1 taken 420 times.
|
448 | if (desc->flags & AV_PIX_FMT_FLAG_BITSTREAM) |
| 592 | 28 | line_size = AV_CEIL_RSHIFT(line_size, 3); | |
| 593 | |||
| 594 | 448 | sws = sws_getContext(MAX_LINE_SIZE, MAX_LINE_SIZE, AV_PIX_FMT_YUV420P, | |
| 595 | 448 | MAX_LINE_SIZE, MAX_LINE_SIZE, packed_rgb_fmts[fmi], | |
| 596 | SWS_ACCURATE_RND | SWS_BITEXACT, NULL, NULL, NULL); | ||
| 597 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 448 times.
|
448 | if (!sws) |
| 598 | ✗ | fail(); | |
| 599 | |||
| 600 | 448 | c = sws_internal(sws); | |
| 601 | |||
| 602 |
2/2✓ Branch 0 taken 1344 times.
✓ Branch 1 taken 448 times.
|
1792 | for (int ai = 0; ai < FF_ARRAY_ELEMS(alpha_values); ai++) { |
| 603 | 1344 | const int chr_alpha = alpha_values[ai]; | |
| 604 |
2/2✓ Branch 1 taken 96 times.
✓ Branch 2 taken 1248 times.
|
1344 | if (check_func(c->yuv2packed1, "yuv2%s_1_%d_%d", desc->name, chr_alpha, INPUT_SIZE)) { |
| 605 | 96 | memset(dst0, 0xFF, INPUT_SIZE * sizeof(int32_t[4])); | |
| 606 | 96 | memset(dst1, 0xFF, INPUT_SIZE * sizeof(int32_t[4])); | |
| 607 | |||
| 608 |
1/2✗ Branch 2 not taken.
✓ Branch 3 taken 96 times.
|
96 | call_ref(c, luma, chru, chrv, alpha, dst0, INPUT_SIZE, chr_alpha, 0); |
| 609 | 96 | call_new(c, luma, chru, chrv, alpha, dst1, INPUT_SIZE, chr_alpha, 0); | |
| 610 | |||
| 611 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 96 times.
|
96 | if (memcmp(dst0, dst1, line_size)) |
| 612 | ✗ | fail(); | |
| 613 | |||
| 614 |
1/18✗ Branch 1 not taken.
✓ Branch 2 taken 96 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
|
96 | bench_new(c, luma, chru, chrv, alpha, dst1, INPUT_SIZE, chr_alpha, 0); |
| 615 | } | ||
| 616 | } | ||
| 617 | |||
| 618 | 448 | sws_freeContext(sws); | |
| 619 | } | ||
| 620 | 14 | } | |
| 621 | |||
| 622 | 14 | static void check_yuv2packed2(void) | |
| 623 | { | ||
| 624 | static const int alpha_values[] = {0, 2048, 4096}; | ||
| 625 | |||
| 626 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 2 taken 1 times.
|
14 | declare_func_emms(AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT, |
| 627 | void, SwsInternal *c, const int16_t *lumSrc[2], | ||
| 628 | const int16_t *chrUSrc[2], const int16_t *chrVSrc[2], | ||
| 629 | const int16_t *alpSrc[2], uint8_t *dest, | ||
| 630 | int dstW, int yalpha, int uvalpha, int y); | ||
| 631 | |||
| 632 | const int16_t *luma[2]; | ||
| 633 | const int16_t *chru[2]; | ||
| 634 | const int16_t *chrv[2]; | ||
| 635 | const int16_t *alpha[2]; | ||
| 636 | |||
| 637 | 14 | LOCAL_ALIGNED_8(int32_t, src_y, [2 * INPUT_SIZE]); | |
| 638 | 14 | LOCAL_ALIGNED_8(int32_t, src_u, [2 * INPUT_SIZE]); | |
| 639 | 14 | LOCAL_ALIGNED_8(int32_t, src_v, [2 * INPUT_SIZE]); | |
| 640 | 14 | LOCAL_ALIGNED_8(int32_t, src_a, [2 * INPUT_SIZE]); | |
| 641 | |||
| 642 | 14 | LOCAL_ALIGNED_8(uint8_t, dst0, [INPUT_SIZE * sizeof(int32_t[4])]); | |
| 643 | 14 | LOCAL_ALIGNED_8(uint8_t, dst1, [INPUT_SIZE * sizeof(int32_t[4])]); | |
| 644 | |||
| 645 |
2/2✓ Branch 1 taken 14336 times.
✓ Branch 2 taken 14 times.
|
14350 | randomize_buffers((uint8_t*)src_y, 2 * INPUT_SIZE * sizeof(int32_t)); |
| 646 |
2/2✓ Branch 1 taken 14336 times.
✓ Branch 2 taken 14 times.
|
14350 | randomize_buffers((uint8_t*)src_u, 2 * INPUT_SIZE * sizeof(int32_t)); |
| 647 |
2/2✓ Branch 1 taken 14336 times.
✓ Branch 2 taken 14 times.
|
14350 | randomize_buffers((uint8_t*)src_v, 2 * INPUT_SIZE * sizeof(int32_t)); |
| 648 |
2/2✓ Branch 1 taken 14336 times.
✓ Branch 2 taken 14 times.
|
14350 | randomize_buffers((uint8_t*)src_a, 2 * INPUT_SIZE * sizeof(int32_t)); |
| 649 | |||
| 650 | /* Limit to 14 bit input range */ | ||
| 651 |
2/2✓ Branch 0 taken 14336 times.
✓ Branch 1 taken 14 times.
|
14350 | for (int i = 0; i < 2 * INPUT_SIZE; i++) { |
| 652 | 14336 | src_y[i] &= 0x3FFF3FFF; | |
| 653 | 14336 | src_u[i] &= 0x3FFF3FFF; | |
| 654 | 14336 | src_v[i] &= 0x3FFF3FFF; | |
| 655 | 14336 | src_a[i] &= 0x3FFF3FFF; | |
| 656 | } | ||
| 657 | |||
| 658 |
2/2✓ Branch 0 taken 28 times.
✓ Branch 1 taken 14 times.
|
42 | for (int i = 0; i < 2; i++) { |
| 659 | 28 | luma[i] = (int16_t *)(src_y + i*INPUT_SIZE); | |
| 660 | 28 | chru[i] = (int16_t *)(src_u + i*INPUT_SIZE); | |
| 661 | 28 | chrv[i] = (int16_t *)(src_v + i*INPUT_SIZE); | |
| 662 | 28 | alpha[i] = (int16_t *)(src_a + i*INPUT_SIZE); | |
| 663 | } | ||
| 664 | |||
| 665 |
2/2✓ Branch 0 taken 448 times.
✓ Branch 1 taken 14 times.
|
462 | for (int fmi = 0; fmi < FF_ARRAY_ELEMS(packed_rgb_fmts); fmi++) { |
| 666 | 448 | const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(packed_rgb_fmts[fmi]); | |
| 667 | 448 | int line_size = INPUT_SIZE * desc->comp[0].step; | |
| 668 | SwsContext *sws; | ||
| 669 | SwsInternal *c; | ||
| 670 | |||
| 671 |
2/2✓ Branch 0 taken 28 times.
✓ Branch 1 taken 420 times.
|
448 | if (desc->flags & AV_PIX_FMT_FLAG_BITSTREAM) |
| 672 | 28 | line_size = AV_CEIL_RSHIFT(line_size, 3); | |
| 673 | |||
| 674 | 448 | sws = sws_getContext(MAX_LINE_SIZE, MAX_LINE_SIZE, AV_PIX_FMT_YUV420P, | |
| 675 | 448 | MAX_LINE_SIZE, MAX_LINE_SIZE, packed_rgb_fmts[fmi], | |
| 676 | SWS_ACCURATE_RND | SWS_BITEXACT, NULL, NULL, NULL); | ||
| 677 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 448 times.
|
448 | if (!sws) |
| 678 | ✗ | fail(); | |
| 679 | |||
| 680 | 448 | c = sws_internal(sws); | |
| 681 | |||
| 682 |
2/2✓ Branch 0 taken 1344 times.
✓ Branch 1 taken 448 times.
|
1792 | for (int ai = 0; ai < FF_ARRAY_ELEMS(alpha_values); ai++) { |
| 683 | 1344 | const int lum_alpha = alpha_values[ai]; | |
| 684 | 1344 | const int chr_alpha = alpha_values[ai]; | |
| 685 |
2/2✓ Branch 1 taken 96 times.
✓ Branch 2 taken 1248 times.
|
1344 | if (check_func(c->yuv2packed2, "yuv2%s_2_%d_%d", desc->name, lum_alpha, INPUT_SIZE)) { |
| 686 | 96 | memset(dst0, 0xFF, INPUT_SIZE * sizeof(int32_t[4])); | |
| 687 | 96 | memset(dst1, 0xFF, INPUT_SIZE * sizeof(int32_t[4])); | |
| 688 | |||
| 689 |
1/2✗ Branch 2 not taken.
✓ Branch 3 taken 96 times.
|
96 | call_ref(c, luma, chru, chrv, alpha, dst0, INPUT_SIZE, lum_alpha, chr_alpha, 0); |
| 690 | 96 | call_new(c, luma, chru, chrv, alpha, dst1, INPUT_SIZE, lum_alpha, chr_alpha, 0); | |
| 691 | |||
| 692 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 96 times.
|
96 | if (memcmp(dst0, dst1, line_size)) |
| 693 | ✗ | fail(); | |
| 694 | |||
| 695 |
1/18✗ Branch 1 not taken.
✓ Branch 2 taken 96 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
|
96 | bench_new(c, luma, chru, chrv, alpha, dst1, INPUT_SIZE, lum_alpha, chr_alpha, 0); |
| 696 | } | ||
| 697 | } | ||
| 698 | |||
| 699 | 448 | sws_freeContext(sws); | |
| 700 | } | ||
| 701 | 14 | } | |
| 702 | |||
| 703 | 14 | static void check_yuv2packedX(void) | |
| 704 | { | ||
| 705 | #define LARGEST_FILTER 16 | ||
| 706 | static const int filter_sizes[] = {2, 16}; | ||
| 707 | |||
| 708 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 2 taken 1 times.
|
14 | declare_func_emms(AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT, |
| 709 | void, SwsInternal *c, const int16_t *lumFilter, | ||
| 710 | const int16_t **lumSrcx, int lumFilterSize, | ||
| 711 | const int16_t *chrFilter, const int16_t **chrUSrcx, | ||
| 712 | const int16_t **chrVSrcx, int chrFilterSize, | ||
| 713 | const int16_t **alpSrcx, uint8_t *dest, | ||
| 714 | int dstW, int y); | ||
| 715 | |||
| 716 | const int16_t *luma[LARGEST_FILTER]; | ||
| 717 | const int16_t *chru[LARGEST_FILTER]; | ||
| 718 | const int16_t *chrv[LARGEST_FILTER]; | ||
| 719 | const int16_t *alpha[LARGEST_FILTER]; | ||
| 720 | |||
| 721 | 14 | LOCAL_ALIGNED_8(int16_t, luma_filter, [LARGEST_FILTER]); | |
| 722 | 14 | LOCAL_ALIGNED_8(int16_t, chr_filter, [LARGEST_FILTER]); | |
| 723 | |||
| 724 | 14 | LOCAL_ALIGNED_8(int32_t, src_y, [LARGEST_FILTER * INPUT_SIZE]); | |
| 725 | 14 | LOCAL_ALIGNED_8(int32_t, src_u, [LARGEST_FILTER * INPUT_SIZE]); | |
| 726 | 14 | LOCAL_ALIGNED_8(int32_t, src_v, [LARGEST_FILTER * INPUT_SIZE]); | |
| 727 | 14 | LOCAL_ALIGNED_8(int32_t, src_a, [LARGEST_FILTER * INPUT_SIZE]); | |
| 728 | |||
| 729 | 14 | LOCAL_ALIGNED_8(uint8_t, dst0, [INPUT_SIZE * sizeof(int32_t[4])]); | |
| 730 | 14 | LOCAL_ALIGNED_8(uint8_t, dst1, [INPUT_SIZE * sizeof(int32_t[4])]); | |
| 731 | |||
| 732 |
2/2✓ Branch 1 taken 114688 times.
✓ Branch 2 taken 14 times.
|
114702 | randomize_buffers((uint8_t*)src_y, LARGEST_FILTER * INPUT_SIZE * sizeof(int32_t)); |
| 733 |
2/2✓ Branch 1 taken 114688 times.
✓ Branch 2 taken 14 times.
|
114702 | randomize_buffers((uint8_t*)src_u, LARGEST_FILTER * INPUT_SIZE * sizeof(int32_t)); |
| 734 |
2/2✓ Branch 1 taken 114688 times.
✓ Branch 2 taken 14 times.
|
114702 | randomize_buffers((uint8_t*)src_v, LARGEST_FILTER * INPUT_SIZE * sizeof(int32_t)); |
| 735 |
2/2✓ Branch 1 taken 114688 times.
✓ Branch 2 taken 14 times.
|
114702 | randomize_buffers((uint8_t*)src_a, LARGEST_FILTER * INPUT_SIZE * sizeof(int32_t)); |
| 736 | |||
| 737 | /* Limit to 14 bit input range */ | ||
| 738 |
2/2✓ Branch 0 taken 114688 times.
✓ Branch 1 taken 14 times.
|
114702 | for (int i = 0; i < LARGEST_FILTER * INPUT_SIZE; i++) { |
| 739 | 114688 | src_y[i] &= 0x3FFF3FFF; | |
| 740 | 114688 | src_u[i] &= 0x3FFF3FFF; | |
| 741 | 114688 | src_v[i] &= 0x3FFF3FFF; | |
| 742 | 114688 | src_a[i] &= 0x3FFF3FFF; | |
| 743 | } | ||
| 744 | |||
| 745 |
2/2✓ Branch 0 taken 224 times.
✓ Branch 1 taken 14 times.
|
238 | for (int i = 0; i < LARGEST_FILTER; i++) { |
| 746 | 224 | luma[i] = (int16_t *)(src_y + i*INPUT_SIZE); | |
| 747 | 224 | chru[i] = (int16_t *)(src_u + i*INPUT_SIZE); | |
| 748 | 224 | chrv[i] = (int16_t *)(src_v + i*INPUT_SIZE); | |
| 749 | 224 | alpha[i] = (int16_t *)(src_a + i*INPUT_SIZE); | |
| 750 | } | ||
| 751 | |||
| 752 |
2/2✓ Branch 0 taken 448 times.
✓ Branch 1 taken 14 times.
|
462 | for (int fmi = 0; fmi < FF_ARRAY_ELEMS(packed_rgb_fmts); fmi++) { |
| 753 | 448 | const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(packed_rgb_fmts[fmi]); | |
| 754 | 448 | int line_size = INPUT_SIZE * desc->comp[0].step; | |
| 755 | SwsContext *sws; | ||
| 756 | SwsInternal *c; | ||
| 757 | |||
| 758 |
2/2✓ Branch 0 taken 28 times.
✓ Branch 1 taken 420 times.
|
448 | if (desc->flags & AV_PIX_FMT_FLAG_BITSTREAM) |
| 759 | 28 | line_size = AV_CEIL_RSHIFT(line_size, 3); | |
| 760 | |||
| 761 | 448 | sws = sws_getContext(MAX_LINE_SIZE, MAX_LINE_SIZE, AV_PIX_FMT_YUV420P, | |
| 762 | 448 | MAX_LINE_SIZE, MAX_LINE_SIZE, packed_rgb_fmts[fmi], | |
| 763 | SWS_ACCURATE_RND | SWS_BITEXACT, NULL, NULL, NULL); | ||
| 764 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 448 times.
|
448 | if (!sws) |
| 765 | ✗ | fail(); | |
| 766 | |||
| 767 | 448 | c = sws_internal(sws); | |
| 768 | |||
| 769 |
2/2✓ Branch 0 taken 896 times.
✓ Branch 1 taken 448 times.
|
1344 | for (int fsi = 0; fsi < FF_ARRAY_ELEMS(filter_sizes); fsi++) { |
| 770 | 896 | const int luma_filter_size = filter_sizes[fsi]; | |
| 771 | 896 | const int chr_filter_size = filter_sizes[fsi]; | |
| 772 | |||
| 773 |
2/2✓ Branch 0 taken 8064 times.
✓ Branch 1 taken 896 times.
|
8960 | for (int i = 0; i < luma_filter_size; i++) |
| 774 | 8064 | luma_filter[i] = -((1 << 12) / (luma_filter_size - 1)); | |
| 775 | 896 | luma_filter[rnd() % luma_filter_size] = (1 << 13) - 1; | |
| 776 | |||
| 777 |
2/2✓ Branch 0 taken 8064 times.
✓ Branch 1 taken 896 times.
|
8960 | for (int i = 0; i < chr_filter_size; i++) |
| 778 | 8064 | chr_filter[i] = -((1 << 12) / (chr_filter_size - 1)); | |
| 779 | 896 | chr_filter[rnd() % chr_filter_size] = (1 << 13) - 1; | |
| 780 | |||
| 781 |
2/2✓ Branch 1 taken 64 times.
✓ Branch 2 taken 832 times.
|
896 | if (check_func(c->yuv2packedX, "yuv2%s_X_%d_%d", desc->name, luma_filter_size, INPUT_SIZE)) { |
| 782 | 64 | memset(dst0, 0xFF, INPUT_SIZE * sizeof(int32_t[4])); | |
| 783 | 64 | memset(dst1, 0xFF, INPUT_SIZE * sizeof(int32_t[4])); | |
| 784 | |||
| 785 |
1/2✗ Branch 2 not taken.
✓ Branch 3 taken 64 times.
|
64 | call_ref(c, luma_filter, luma, luma_filter_size, |
| 786 | chr_filter, chru, chrv, chr_filter_size, | ||
| 787 | alpha, dst0, INPUT_SIZE, 0); | ||
| 788 | |||
| 789 | 64 | call_new(c, luma_filter, luma, luma_filter_size, | |
| 790 | chr_filter, chru, chrv, chr_filter_size, | ||
| 791 | alpha, dst1, INPUT_SIZE, 0); | ||
| 792 | |||
| 793 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 64 times.
|
64 | if (memcmp(dst0, dst1, line_size)) |
| 794 | ✗ | fail(); | |
| 795 | |||
| 796 |
1/18✗ Branch 1 not taken.
✓ Branch 2 taken 64 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
|
64 | bench_new(c, luma_filter, luma, luma_filter_size, |
| 797 | chr_filter, chru, chrv, chr_filter_size, | ||
| 798 | alpha, dst1, INPUT_SIZE, 0); | ||
| 799 | } | ||
| 800 | } | ||
| 801 | |||
| 802 | 448 | sws_freeContext(sws); | |
| 803 | } | ||
| 804 | 14 | } | |
| 805 | |||
| 806 | #undef INPUT_SIZE | ||
| 807 | #undef LARGEST_FILTER | ||
| 808 | |||
| 809 | 14 | void checkasm_check_sw_rgb(void) | |
| 810 | { | ||
| 811 | SwsContext *sws; | ||
| 812 | |||
| 813 | 14 | ff_sws_rgb2rgb_init(); | |
| 814 | |||
| 815 | 14 | check_shuffle_bytes(shuffle_bytes_2103, "shuffle_bytes_2103"); | |
| 816 | 14 | report("shuffle_bytes_2103"); | |
| 817 | |||
| 818 | 14 | check_shuffle_bytes(shuffle_bytes_0321, "shuffle_bytes_0321"); | |
| 819 | 14 | report("shuffle_bytes_0321"); | |
| 820 | |||
| 821 | 14 | check_shuffle_bytes(shuffle_bytes_1230, "shuffle_bytes_1230"); | |
| 822 | 14 | report("shuffle_bytes_1230"); | |
| 823 | |||
| 824 | 14 | check_shuffle_bytes(shuffle_bytes_3012, "shuffle_bytes_3012"); | |
| 825 | 14 | report("shuffle_bytes_3012"); | |
| 826 | |||
| 827 | 14 | check_shuffle_bytes(shuffle_bytes_3210, "shuffle_bytes_3210"); | |
| 828 | 14 | report("shuffle_bytes_3210"); | |
| 829 | |||
| 830 | 14 | check_shuffle_bytes(shuffle_bytes_3102, "shuffle_bytes_3102"); | |
| 831 | 14 | report("shuffle_bytes_3102"); | |
| 832 | |||
| 833 | 14 | check_shuffle_bytes(shuffle_bytes_2013, "shuffle_bytes_2013"); | |
| 834 | 14 | report("shuffle_bytes_2013"); | |
| 835 | |||
| 836 | 14 | check_shuffle_bytes(shuffle_bytes_1203, "shuffle_bytes_1203"); | |
| 837 | 14 | report("shuffle_bytes_1203"); | |
| 838 | |||
| 839 | 14 | check_shuffle_bytes(shuffle_bytes_2130, "shuffle_bytes_2130"); | |
| 840 | 14 | report("shuffle_bytes_2130"); | |
| 841 | |||
| 842 | { | ||
| 843 | /* rgb24tobgr24 operates on 3-byte pixels, so test widths must be | ||
| 844 | * multiples of 3 to avoid reading past the source buffer. */ | ||
| 845 | static const int rgb24_width[] = {3, 12, 24, 36, 48, 126, 1920 * 3}; | ||
| 846 | int i; | ||
| 847 | #define RGB24_BENCH_WIDTH (1920 * 3) | ||
| 848 | 14 | LOCAL_ALIGNED_32(uint8_t, src0, [RGB24_BENCH_WIDTH]); | |
| 849 | 14 | LOCAL_ALIGNED_32(uint8_t, src1, [RGB24_BENCH_WIDTH]); | |
| 850 | 14 | LOCAL_ALIGNED_32(uint8_t, dst0, [RGB24_BENCH_WIDTH]); | |
| 851 | 14 | LOCAL_ALIGNED_32(uint8_t, dst1, [RGB24_BENCH_WIDTH]); | |
| 852 | |||
| 853 | 14 | declare_func(void, const uint8_t *src, uint8_t *dst, int src_size); | |
| 854 | |||
| 855 | 14 | memset(dst0, 0, RGB24_BENCH_WIDTH); | |
| 856 | 14 | memset(dst1, 0, RGB24_BENCH_WIDTH); | |
| 857 |
2/2✓ Branch 1 taken 20160 times.
✓ Branch 2 taken 14 times.
|
20174 | randomize_buffers(src0, RGB24_BENCH_WIDTH); |
| 858 | 14 | memcpy(src1, src0, RGB24_BENCH_WIDTH); | |
| 859 | |||
| 860 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 2 taken 12 times.
|
14 | if (check_func(rgb24tobgr24, "rgb24tobgr24")) { |
| 861 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 2 times.
|
16 | for (i = 0; i < FF_ARRAY_ELEMS(rgb24_width); i++) { |
| 862 |
1/2✗ Branch 2 not taken.
✓ Branch 3 taken 14 times.
|
14 | call_ref(src0, dst0, rgb24_width[i]); |
| 863 | 14 | call_new(src1, dst1, rgb24_width[i]); | |
| 864 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
|
14 | if (memcmp(dst0, dst1, rgb24_width[i])) |
| 865 | ✗ | fail(); | |
| 866 | } | ||
| 867 |
1/18✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
|
2 | bench_new(src0, dst0, RGB24_BENCH_WIDTH); |
| 868 | } | ||
| 869 | #undef RGB24_BENCH_WIDTH | ||
| 870 | } | ||
| 871 | 14 | report("rgb24tobgr24"); | |
| 872 | |||
| 873 | { | ||
| 874 | /* rgb32tobgr24: 4-byte pixels → 3-byte pixels. | ||
| 875 | * Test widths must be multiples of 4 (one pixel). | ||
| 876 | * Sizes chosen to exercise each codepath tier: | ||
| 877 | * 4 = scalar only (1 pixel) | ||
| 878 | * 16 = scalar only (4 pixels, loop iteration) | ||
| 879 | * 32 = medium only | ||
| 880 | * 48 = medium + scalar | ||
| 881 | * 64 = fast only (exact) | ||
| 882 | * 68 = fast + scalar (skip medium) | ||
| 883 | * 100 = fast + medium + scalar (all tiers) | ||
| 884 | * 128 = fast only (multi-iteration) | ||
| 885 | * 1920*4 = fast only (benchmark width) | ||
| 886 | */ | ||
| 887 | static const int rgb32_widths[] = {4, 16, 32, 48, 64, 68, 100, 128, 1920 * 4}; | ||
| 888 | #define RGB32_BENCH_WIDTH (1920 * 4) | ||
| 889 | #define RGB32_DST_SIZE (RGB32_BENCH_WIDTH * 3 / 4 + 8) | ||
| 890 | 14 | LOCAL_ALIGNED_32(uint8_t, src0, [RGB32_BENCH_WIDTH]); | |
| 891 | 14 | LOCAL_ALIGNED_32(uint8_t, src1, [RGB32_BENCH_WIDTH]); | |
| 892 | 14 | LOCAL_ALIGNED_32(uint8_t, dst0, [RGB32_DST_SIZE]); | |
| 893 | 14 | LOCAL_ALIGNED_32(uint8_t, dst1, [RGB32_DST_SIZE]); | |
| 894 | |||
| 895 | 14 | declare_func(void, const uint8_t *src, uint8_t *dst, int src_size); | |
| 896 | |||
| 897 |
2/2✓ Branch 1 taken 26880 times.
✓ Branch 2 taken 14 times.
|
26894 | randomize_buffers(src0, RGB32_BENCH_WIDTH); |
| 898 | 14 | memcpy(src1, src0, RGB32_BENCH_WIDTH); | |
| 899 | |||
| 900 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 2 taken 12 times.
|
14 | if (check_func(rgb32tobgr24, "rgb32tobgr24")) { |
| 901 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 2 times.
|
20 | for (int i = 0; i < FF_ARRAY_ELEMS(rgb32_widths); i++) { |
| 902 | 18 | int out_size = rgb32_widths[i] * 3 / 4; | |
| 903 | 18 | memset(dst0, 0xAA, RGB32_DST_SIZE); | |
| 904 | 18 | memset(dst1, 0xAA, RGB32_DST_SIZE); | |
| 905 |
1/2✗ Branch 2 not taken.
✓ Branch 3 taken 18 times.
|
18 | call_ref(src0, dst0, rgb32_widths[i]); |
| 906 | 18 | call_new(src1, dst1, rgb32_widths[i]); | |
| 907 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if (memcmp(dst0, dst1, out_size) || |
| 908 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | dst0[out_size] != 0xAA || |
| 909 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18 times.
|
18 | dst1[out_size] != 0xAA) |
| 910 | ✗ | fail(); | |
| 911 | } | ||
| 912 |
1/18✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
|
2 | bench_new(src0, dst0, RGB32_BENCH_WIDTH); |
| 913 | } | ||
| 914 | #undef RGB32_DST_SIZE | ||
| 915 | #undef RGB32_BENCH_WIDTH | ||
| 916 | } | ||
| 917 | 14 | report("rgb32tobgr24"); | |
| 918 | |||
| 919 | { | ||
| 920 | /* rgb24tobgr32: 3-byte pixels → 4-byte pixels. | ||
| 921 | * Test widths must be multiples of 3 (one pixel). | ||
| 922 | * Sizes chosen to exercise each codepath tier: | ||
| 923 | * 3 = scalar only (1 pixel) | ||
| 924 | * 12 = scalar only (4 pixels, loop iteration) | ||
| 925 | * 24 = medium only | ||
| 926 | * 36 = medium + scalar | ||
| 927 | * 48 = fast only (exact) | ||
| 928 | * 51 = fast + scalar (skip medium) | ||
| 929 | * 126 = fast + medium + scalar (all tiers) | ||
| 930 | * 1920*3 = fast only (benchmark width) | ||
| 931 | */ | ||
| 932 | static const int rgb24to32_widths[] = {3, 12, 24, 36, 48, 51, 126, 1920 * 3}; | ||
| 933 | #define RGB24TO32_BENCH_WIDTH (1920 * 3) | ||
| 934 | #define RGB24TO32_DST_SIZE (RGB24TO32_BENCH_WIDTH * 4 / 3 + 8) | ||
| 935 | 14 | LOCAL_ALIGNED_32(uint8_t, src0, [RGB24TO32_BENCH_WIDTH]); | |
| 936 | 14 | LOCAL_ALIGNED_32(uint8_t, src1, [RGB24TO32_BENCH_WIDTH]); | |
| 937 | 14 | LOCAL_ALIGNED_32(uint8_t, dst0, [RGB24TO32_DST_SIZE]); | |
| 938 | 14 | LOCAL_ALIGNED_32(uint8_t, dst1, [RGB24TO32_DST_SIZE]); | |
| 939 | |||
| 940 | 14 | declare_func(void, const uint8_t *src, uint8_t *dst, int src_size); | |
| 941 | |||
| 942 |
2/2✓ Branch 1 taken 20160 times.
✓ Branch 2 taken 14 times.
|
20174 | randomize_buffers(src0, RGB24TO32_BENCH_WIDTH); |
| 943 | 14 | memcpy(src1, src0, RGB24TO32_BENCH_WIDTH); | |
| 944 | |||
| 945 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 2 taken 12 times.
|
14 | if (check_func(rgb24tobgr32, "rgb24tobgr32")) { |
| 946 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 2 times.
|
18 | for (int i = 0; i < FF_ARRAY_ELEMS(rgb24to32_widths); i++) { |
| 947 | 16 | int out_size = rgb24to32_widths[i] * 4 / 3; | |
| 948 | 16 | memset(dst0, 0xAA, RGB24TO32_DST_SIZE); | |
| 949 | 16 | memset(dst1, 0xAA, RGB24TO32_DST_SIZE); | |
| 950 |
1/2✗ Branch 2 not taken.
✓ Branch 3 taken 16 times.
|
16 | call_ref(src0, dst0, rgb24to32_widths[i]); |
| 951 | 16 | call_new(src1, dst1, rgb24to32_widths[i]); | |
| 952 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if (memcmp(dst0, dst1, out_size) || |
| 953 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | dst0[out_size] != 0xAA || |
| 954 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
|
16 | dst1[out_size] != 0xAA) |
| 955 | ✗ | fail(); | |
| 956 | } | ||
| 957 |
1/18✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
|
2 | bench_new(src0, dst0, RGB24TO32_BENCH_WIDTH); |
| 958 | } | ||
| 959 | #undef RGB24TO32_DST_SIZE | ||
| 960 | #undef RGB24TO32_BENCH_WIDTH | ||
| 961 | } | ||
| 962 | 14 | report("rgb24tobgr32"); | |
| 963 | |||
| 964 | 14 | check_interleaved_to_planar(uyvytoyuv422, "uyvytoyuv422", 1); | |
| 965 | 14 | report("uyvytoyuv422"); | |
| 966 | 14 | check_interleaved_to_planar(yuyvtoyuv422, "yuyvtoyuv422", 2); | |
| 967 | 14 | report("yuyvtoyuv422"); | |
| 968 | 14 | check_interleaved_to_planar(uyvytoyuv420, "uyvytoyuv420", 1); | |
| 969 | 14 | report("uyvytoyuv420"); | |
| 970 | 14 | check_interleaved_to_planar(yuyvtoyuv420, "yuyvtoyuv420", 2); | |
| 971 | 14 | report("yuyvtoyuv420"); | |
| 972 | |||
| 973 | 14 | check_interleave_bytes(); | |
| 974 | 14 | report("interleave_bytes"); | |
| 975 | |||
| 976 | 14 | check_deinterleave_bytes(); | |
| 977 | 14 | report("deinterleave_bytes"); | |
| 978 | |||
| 979 | 14 | sws = sws_getContext(MAX_LINE_SIZE, MAX_LINE_SIZE, AV_PIX_FMT_RGB24, | |
| 980 | MAX_LINE_SIZE, MAX_LINE_SIZE, AV_PIX_FMT_YUV420P, | ||
| 981 | SWS_ACCURATE_RND | SWS_BITEXACT, NULL, NULL, NULL); | ||
| 982 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
|
14 | if (!sws) |
| 983 | ✗ | fail(); | |
| 984 | |||
| 985 | 14 | check_rgb_to_y(sws); | |
| 986 | 14 | report("rgb_to_y"); | |
| 987 | |||
| 988 | 14 | check_rgb_to_uv(sws); | |
| 989 | 14 | report("rgb_to_uv"); | |
| 990 | |||
| 991 | 14 | check_rgba_to_a(sws); | |
| 992 | 14 | report("rgba_to_a"); | |
| 993 | |||
| 994 | 14 | check_rgb24toyv12(sws); | |
| 995 | 14 | report("rgb24toyv12"); | |
| 996 | |||
| 997 | 14 | sws_freeContext(sws); | |
| 998 | |||
| 999 | 14 | check_yuv2packed1(); | |
| 1000 | 14 | report("yuv2packed1"); | |
| 1001 | |||
| 1002 | 14 | check_yuv2packed2(); | |
| 1003 | 14 | report("yuv2packed2"); | |
| 1004 | |||
| 1005 | 14 | check_yuv2packedX(); | |
| 1006 | 14 | report("yuv2packedX"); | |
| 1007 | 14 | } | |
| 1008 |