| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | * This file is part of FFmpeg. | ||
| 3 | * | ||
| 4 | * FFmpeg is free software; you can redistribute it and/or modify | ||
| 5 | * it under the terms of the GNU General Public License as published by | ||
| 6 | * the Free Software Foundation; either version 2 of the License, or | ||
| 7 | * (at your option) any later version. | ||
| 8 | * | ||
| 9 | * FFmpeg is distributed in the hope that it will be useful, | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | * GNU General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License along | ||
| 15 | * with FFmpeg; if not, write to the Free Software Foundation, Inc., | ||
| 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <string.h> | ||
| 20 | #include "checkasm.h" | ||
| 21 | #include "libavfilter/hflip.h" | ||
| 22 | #include "libavfilter/vf_hflip_init.h" | ||
| 23 | #include "libavutil/intreadwrite.h" | ||
| 24 | #include "libavutil/mem_internal.h" | ||
| 25 | |||
| 26 | #define WIDTH 256 | ||
| 27 | #define WIDTH_PADDED 256 + 32 | ||
| 28 | |||
| 29 | #define randomize_buffers(buf, size) \ | ||
| 30 | do { \ | ||
| 31 | int j; \ | ||
| 32 | uint8_t *tmp_buf = (uint8_t *)buf;\ | ||
| 33 | for (j = 0; j < size; j++) \ | ||
| 34 | tmp_buf[j] = rnd() & 0xFF; \ | ||
| 35 | } while (0) | ||
| 36 | |||
| 37 | 28 | static void check_hflip(int step, const char * report_name){ | |
| 38 | 28 | LOCAL_ALIGNED_32(uint8_t, src, [WIDTH_PADDED]); | |
| 39 | 28 | LOCAL_ALIGNED_32(uint8_t, dst_ref, [WIDTH_PADDED]); | |
| 40 | 28 | LOCAL_ALIGNED_32(uint8_t, dst_new, [WIDTH_PADDED]); | |
| 41 | 28 | int w = WIDTH; | |
| 42 | int i; | ||
| 43 | 28 | int step_array[4] = {1, 1, 1, 1}; | |
| 44 | FlipContext s; | ||
| 45 | |||
| 46 | 28 | declare_func(void, const uint8_t *src, uint8_t *dst, int w); | |
| 47 | |||
| 48 | 28 | s.bayer_plus1 = 1; | |
| 49 | 28 | memset(src, 0, WIDTH_PADDED); | |
| 50 | 28 | memset(dst_ref, 0, WIDTH_PADDED); | |
| 51 | 28 | memset(dst_new, 0, WIDTH_PADDED); | |
| 52 |
2/2✓ Branch 1 taken 8064 times.
✓ Branch 2 taken 28 times.
|
8092 | randomize_buffers(src, WIDTH_PADDED); |
| 53 | |||
| 54 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 14 times.
|
28 | if (step == 2) { |
| 55 | 14 | w /= 2; | |
| 56 |
2/2✓ Branch 0 taken 56 times.
✓ Branch 1 taken 14 times.
|
70 | for (i = 0; i < 4; i++) |
| 57 | 56 | step_array[i] = step; | |
| 58 | } | ||
| 59 | |||
| 60 | 28 | ff_hflip_init(&s, step_array, 4); | |
| 61 | |||
| 62 |
2/2✓ Branch 3 taken 6 times.
✓ Branch 4 taken 22 times.
|
28 | if (check_func(s.flip_line[0], "hflip_%s", report_name)) { |
| 63 |
2/2✓ Branch 0 taken 1146 times.
✓ Branch 1 taken 6 times.
|
1152 | for (i = 1; i < w; i++) { |
| 64 | 1146 | call_ref(src + (w - 1) * step, dst_ref, i); | |
| 65 | 1146 | call_new(src + (w - 1) * step, dst_new, i); | |
| 66 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1146 times.
|
1146 | if (memcmp(dst_ref, dst_new, i * step)) |
| 67 | ✗ | fail(); | |
| 68 | } | ||
| 69 |
1/8✗ Branch 1 not taken.
✓ Branch 2 taken 6 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.
|
6 | bench_new(src + (w - 1) * step, dst_new, w); |
| 70 | } | ||
| 71 | 28 | } | |
| 72 | 14 | void checkasm_check_vf_hflip(void) | |
| 73 | { | ||
| 74 | 14 | check_hflip(1, "byte"); | |
| 75 | 14 | report("hflip_byte"); | |
| 76 | |||
| 77 | 14 | check_hflip(2, "short"); | |
| 78 | 14 | report("hflip_short"); | |
| 79 | 14 | } | |
| 80 |