2 * Copyright (c) 2019 James Darnley
4 * This file is part of FFmpeg.
6 * FFmpeg is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #include "libavcodec/v210dec.h"
25 static uint32_t get_v210(void)
27 uint32_t t0 = rnd() & 0x3ff,
36 #define NUM_SAMPLES 2048
38 static void randomize_buffers(uint32_t *src0, uint32_t *src1, int len)
40 for (int i = 0; i < len; i++) {
41 uint32_t value = get_v210();
47 void checkasm_check_v210dec(void)
54 if (check_func(h.unpack_frame, "v210_unpack")) {
55 uint32_t src0[NUM_SAMPLES/3];
56 uint32_t src1[NUM_SAMPLES/3];
57 uint16_t y0[NUM_SAMPLES/2];
58 uint16_t y1[NUM_SAMPLES/2];
59 uint16_t u0[NUM_SAMPLES/4];
60 uint16_t u1[NUM_SAMPLES/4];
61 uint16_t v0[NUM_SAMPLES/4];
62 uint16_t v1[NUM_SAMPLES/4];
63 declare_func(void, const uint32_t *src, uint16_t *y, uint16_t *u, uint16_t *v, int width);
64 const int pixels = NUM_SAMPLES / 2 / 6 * 6;
66 randomize_buffers(src0, src1, NUM_SAMPLES/3);
67 call_ref(src0, y0, u0, v0, pixels);
68 call_new(src1, y1, u1, v1, pixels);
69 if (memcmp(src0, src1, NUM_SAMPLES/3 * sizeof src0[0])
70 || memcmp(y0, y1, pixels * sizeof y0[0])
71 || memcmp(u0, u1, pixels/2 * sizeof u0[0])
72 || memcmp(v0, v1, pixels/2 * sizeof v0[0]))
74 bench_new(src1, y1, u1, v1, pixels);
76 report("v210_unpack");