FFmpeg
Loading...
Searching...
No Matches
apv_dsp.c
Go to the documentation of this file.
1/*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (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 GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#include <stdint.h>
20#include <string.h>
21
22#include "checkasm.h"
23
25#include "libavcodec/apv_dsp.h"
26
28{
29 LOCAL_ALIGNED_16( int16_t, input, [64]);
30 LOCAL_ALIGNED_16( int16_t, qmatrix, [64]);
31 LOCAL_ALIGNED_16(uint16_t, new_output, [64]);
32 LOCAL_ALIGNED_16(uint16_t, ref_output, [64]);
33
34 declare_func(void,
35 void *output,
36 ptrdiff_t pitch,
37 const int16_t *input,
38 const int16_t *qmatrix,
39 int bit_depth,
40 int qp_shift);
41
42 for (int i = 0; i < 64; i++) {
43 // Any signed 14-bit integer.
44 input[i] = rnd() % 16384 - 8192;
45
46 // qmatrix input is premultiplied by level_scale, so
47 // range is 1 to 255 * 71. Interesting values are all
48 // at the low end of that, though.
49 qmatrix[i] = 16; //rnd() % 16 + 16;
50 }
51
52 call_ref(ref_output, 16, input, qmatrix, 10, 4);
53 call_new(new_output, 16, input, qmatrix, 10, 4);
54
55 if (memcmp(new_output, ref_output, 64 * sizeof(*ref_output)))
56 fail();
57
58 bench_new(new_output, 16, input, qmatrix, 10, 4);
59}
60
62{
63 APVDSPContext dsp;
64
65 ff_apv_dsp_init(&dsp);
66
67 if (check_func(dsp.decode_transquant, "decode_transquant_10"))
69
70 report("decode_transquant");
71}
static void bit_depth(AudioStatsContext *s, const uint64_t *const mask, uint8_t *depth)
Definition af_astats.c:246
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
#define rnd
Definition checkasm.h:136
#define declare_func
Definition test.h:489
#define fail
Definition test.h:479
#define bench_new
Definition test.h:487
#define check_func
Definition test.h:481
#define call_new
Definition test.h:486
#define call_ref
Definition test.h:485
#define report
Definition test.h:480
av_cold void ff_apv_dsp_init(APVDSPContext *dsp)
Definition apv_dsp.c:120
#define LOCAL_ALIGNED_16(t, v,...)
void(* decode_transquant)(void *output, ptrdiff_t pitch, const int16_t *input, const int16_t *qmatrix, int bit_depth, int qp_shift)
Definition apv_dsp.h:27
static void check_decode_transquant_10(void)
Definition apv_dsp.c:27
void checkasm_check_apv_dsp(void)
Definition apv_dsp.c:61