1 /*
2 * Copyright (c) 2015 James Almer
3 *
4 * This file is part of FFmpeg.
5 *
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.
10 *
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.
15 *
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.
19 */
20
21 #include <string.h>
29
31 #define MAX_CHANNELS 8
32
33 #define randomize_buffers() \
34 do { \
35 int i, j; \
36 for (i = 0; i < BUF_SIZE; i += 4) { \
37 for (j = 0; j < channels; j++) { \
38 uint32_t r = rnd() & (1 << (bits - 2)) - 1; \
39 AV_WN32A(ref_src[j] + i, r); \
40 AV_WN32A(new_src[j] + i, r); \
41 } \
42 } \
43 } while (0)
44
45 static void check_decorrelate(uint8_t **ref_dst, uint8_t **ref_src, uint8_t **new_dst, uint8_t **new_src,
48
56 }
57
59 {
60 int qlevel =
rnd() % 16;
61 int coeff_prec = (
rnd() % 15) + 1;
66
68
71
72 for (
int i = 0;
i < 32;
i++)
76
84 }
85
87 {
88 int qlevel =
rnd() % 16;
89 int coeff_prec = (
rnd() % 15) + 1;
95
97
98 for (
int i = 0;
i < 32;
i++)
100
104 }
105
113 }
114
116 {
117 int wasted =
rnd() % 32;
121
123
126
134 }
135
137 {
138 int wasted =
rnd() % 33;
142
144
146 residuals[
i] =
rnd();
147
153 }
154
156 {
165 static const char * const names[3] = { "ls", "rs", "ms" };
166 static const struct {
169 } fmts[] = {
172 };
173 static const signed char pred_orders[] = { 13, 16, 29, 32 };
176
177 for (
i = 0;
i < 2;
i++) {
179 for (j = 0; j < 3; j++)
180 if (
check_func(
h.decorrelate[j + 1],
"flac_decorrelate_%s_%d", names[j], fmts[
i].bits))
184 if (
check_func(
h.decorrelate[0],
"flac_decorrelate_indep%d_%d", j, fmts[
i].bits))
186 }
187 }
188
190
192 if (
check_func(
h.lpc16,
"flac_lpc_16_%d", pred_orders[
i]))
195 if (
check_func(
h.lpc32,
"flac_lpc_32_%d", pred_orders[
i]))
198 if (
check_func(
h.lpc33,
"flac_lpc_33_%d", pred_orders[
i]))
200
202
207
209 }