FFmpeg  4.3
mpegaudiodsp_template.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2001, 2002 Fabrice Bellard
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (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 GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include <stdint.h>
22 
23 #include "libavutil/attributes.h"
24 #include "libavutil/mem.h"
25 #include "dct32.h"
26 #include "mathops.h"
27 #include "mpegaudiodsp.h"
28 #include "mpegaudio.h"
29 
30 #if USE_FLOATS
31 #define RENAME(n) n##_float
32 
33 static inline float round_sample(float *sum)
34 {
35  float sum1=*sum;
36  *sum = 0;
37  return sum1;
38 }
39 
40 #define MACS(rt, ra, rb) rt+=(ra)*(rb)
41 #define MULS(ra, rb) ((ra)*(rb))
42 #define MULH3(x, y, s) ((s)*(y)*(x))
43 #define MLSS(rt, ra, rb) rt-=(ra)*(rb)
44 #define MULLx(x, y, s) ((y)*(x))
45 #define FIXHR(x) ((float)(x))
46 #define FIXR(x) ((float)(x))
47 #define SHR(a,b) ((a)*(1.0f/(1<<(b))))
48 
49 #else
50 
51 #define RENAME(n) n##_fixed
52 #define OUT_SHIFT (WFRAC_BITS + FRAC_BITS - 15)
53 
54 static inline int round_sample(int64_t *sum)
55 {
56  int sum1;
57  sum1 = (int)((*sum) >> OUT_SHIFT);
58  *sum &= (1<<OUT_SHIFT)-1;
59  return av_clip_int16(sum1);
60 }
61 
62 # define MULS(ra, rb) MUL64(ra, rb)
63 # define MACS(rt, ra, rb) MAC64(rt, ra, rb)
64 # define MLSS(rt, ra, rb) MLS64(rt, ra, rb)
65 # define MULH3(x, y, s) MULH((s)*(x), y)
66 # define MULLx(x, y, s) MULL((int)(x),(y),s)
67 # define SHR(a,b) (((int)(a))>>(b))
68 # define FIXR(a) ((int)((a) * FRAC_ONE + 0.5))
69 # define FIXHR(a) ((int)((a) * (1LL<<32) + 0.5))
70 #endif
71 
72 /** Window for MDCT. Actually only the elements in [0,17] and
73  [MDCT_BUF_SIZE/2, MDCT_BUF_SIZE/2 + 17] are actually used. The rest
74  is just to preserve alignment for SIMD implementations.
75 */
77 
78 DECLARE_ALIGNED(16, MPA_INT, RENAME(ff_mpa_synth_window))[512+256];
79 
80 #define SUM8(op, sum, w, p) \
81 { \
82  op(sum, (w)[0 * 64], (p)[0 * 64]); \
83  op(sum, (w)[1 * 64], (p)[1 * 64]); \
84  op(sum, (w)[2 * 64], (p)[2 * 64]); \
85  op(sum, (w)[3 * 64], (p)[3 * 64]); \
86  op(sum, (w)[4 * 64], (p)[4 * 64]); \
87  op(sum, (w)[5 * 64], (p)[5 * 64]); \
88  op(sum, (w)[6 * 64], (p)[6 * 64]); \
89  op(sum, (w)[7 * 64], (p)[7 * 64]); \
90 }
91 
92 #define SUM8P2(sum1, op1, sum2, op2, w1, w2, p) \
93 { \
94  INTFLOAT tmp;\
95  tmp = p[0 * 64];\
96  op1(sum1, (w1)[0 * 64], tmp);\
97  op2(sum2, (w2)[0 * 64], tmp);\
98  tmp = p[1 * 64];\
99  op1(sum1, (w1)[1 * 64], tmp);\
100  op2(sum2, (w2)[1 * 64], tmp);\
101  tmp = p[2 * 64];\
102  op1(sum1, (w1)[2 * 64], tmp);\
103  op2(sum2, (w2)[2 * 64], tmp);\
104  tmp = p[3 * 64];\
105  op1(sum1, (w1)[3 * 64], tmp);\
106  op2(sum2, (w2)[3 * 64], tmp);\
107  tmp = p[4 * 64];\
108  op1(sum1, (w1)[4 * 64], tmp);\
109  op2(sum2, (w2)[4 * 64], tmp);\
110  tmp = p[5 * 64];\
111  op1(sum1, (w1)[5 * 64], tmp);\
112  op2(sum2, (w2)[5 * 64], tmp);\
113  tmp = p[6 * 64];\
114  op1(sum1, (w1)[6 * 64], tmp);\
115  op2(sum2, (w2)[6 * 64], tmp);\
116  tmp = p[7 * 64];\
117  op1(sum1, (w1)[7 * 64], tmp);\
118  op2(sum2, (w2)[7 * 64], tmp);\
119 }
120 
122  int *dither_state, OUT_INT *samples,
123  ptrdiff_t incr)
124 {
125  register const MPA_INT *w, *w2, *p;
126  int j;
127  OUT_INT *samples2;
128 #if USE_FLOATS
129  float sum, sum2;
130 #else
131  int64_t sum, sum2;
132 #endif
133 
134  /* copy to avoid wrap */
135  memcpy(synth_buf + 512, synth_buf, 32 * sizeof(*synth_buf));
136 
137  samples2 = samples + 31 * incr;
138  w = window;
139  w2 = window + 31;
140 
141  sum = *dither_state;
142  p = synth_buf + 16;
143  SUM8(MACS, sum, w, p);
144  p = synth_buf + 48;
145  SUM8(MLSS, sum, w + 32, p);
146  *samples = round_sample(&sum);
147  samples += incr;
148  w++;
149 
150  /* we calculate two samples at the same time to avoid one memory
151  access per two sample */
152  for(j=1;j<16;j++) {
153  sum2 = 0;
154  p = synth_buf + 16 + j;
155  SUM8P2(sum, MACS, sum2, MLSS, w, w2, p);
156  p = synth_buf + 48 - j;
157  SUM8P2(sum, MLSS, sum2, MLSS, w + 32, w2 + 32, p);
158 
159  *samples = round_sample(&sum);
160  samples += incr;
161  sum += sum2;
162  *samples2 = round_sample(&sum);
163  samples2 -= incr;
164  w++;
165  w2--;
166  }
167 
168  p = synth_buf + 32;
169  SUM8(MLSS, sum, w + 32, p);
170  *samples = round_sample(&sum);
171  *dither_state= sum;
172 }
173 
174 /* 32 sub band synthesis filter. Input: 32 sub band samples, Output:
175  32 samples. */
177  int *synth_buf_offset,
178  MPA_INT *window, int *dither_state,
179  OUT_INT *samples, ptrdiff_t incr,
180  MPA_INT *sb_samples)
181 {
182  MPA_INT *synth_buf;
183  int offset;
184 
185  offset = *synth_buf_offset;
186  synth_buf = synth_buf_ptr + offset;
187 
188  s->RENAME(dct32)(synth_buf, sb_samples);
189  s->RENAME(apply_window)(synth_buf, window, dither_state, samples, incr);
190 
191  offset = (offset - 32) & 511;
192  *synth_buf_offset = offset;
193 }
194 
196 {
197  int i, j;
198 
199  /* max = 18760, max sum over all 16 coefs : 44736 */
200  for(i=0;i<257;i++) {
201  INTFLOAT v;
202  v = ff_mpa_enwindow[i];
203 #if USE_FLOATS
204  v *= 1.0 / (1LL<<(16 + FRAC_BITS));
205 #endif
206  window[i] = v;
207  if ((i & 63) != 0)
208  v = -v;
209  if (i != 0)
210  window[512 - i] = v;
211  }
212 
213 
214  // Needed for avoiding shuffles in ASM implementations
215  for(i=0; i < 8; i++)
216  for(j=0; j < 16; j++)
217  window[512+16*i+j] = window[64*i+32-j];
218 
219  for(i=0; i < 8; i++)
220  for(j=0; j < 16; j++)
221  window[512+128+16*i+j] = window[64*i+48-j];
222 }
223 
225 {
226  int i, j;
227  /* compute mdct windows */
228  for (i = 0; i < 36; i++) {
229  for (j = 0; j < 4; j++) {
230  double d;
231 
232  if (j == 2 && i % 3 != 1)
233  continue;
234 
235  d = sin(M_PI * (i + 0.5) / 36.0);
236  if (j == 1) {
237  if (i >= 30) d = 0;
238  else if (i >= 24) d = sin(M_PI * (i - 18 + 0.5) / 12.0);
239  else if (i >= 18) d = 1;
240  } else if (j == 3) {
241  if (i < 6) d = 0;
242  else if (i < 12) d = sin(M_PI * (i - 6 + 0.5) / 12.0);
243  else if (i < 18) d = 1;
244  }
245  //merge last stage of imdct into the window coefficients
246  d *= 0.5 * IMDCT_SCALAR / cos(M_PI * (2 * i + 19) / 72);
247 
248  if (j == 2)
249  RENAME(ff_mdct_win)[j][i/3] = FIXHR((d / (1<<5)));
250  else {
251  int idx = i < 18 ? i : i + (MDCT_BUF_SIZE/2 - 18);
252  RENAME(ff_mdct_win)[j][idx] = FIXHR((d / (1<<5)));
253  }
254  }
255  }
256 
257  /* NOTE: we do frequency inversion adter the MDCT by changing
258  the sign of the right window coefs */
259  for (j = 0; j < 4; j++) {
260  for (i = 0; i < MDCT_BUF_SIZE; i += 2) {
261  RENAME(ff_mdct_win)[j + 4][i ] = RENAME(ff_mdct_win)[j][i ];
262  RENAME(ff_mdct_win)[j + 4][i + 1] = -RENAME(ff_mdct_win)[j][i + 1];
263  }
264  }
265 }
266 /* cos(pi*i/18) */
267 #define C1 FIXHR(0.98480775301220805936/2)
268 #define C2 FIXHR(0.93969262078590838405/2)
269 #define C3 FIXHR(0.86602540378443864676/2)
270 #define C4 FIXHR(0.76604444311897803520/2)
271 #define C5 FIXHR(0.64278760968653932632/2)
272 #define C6 FIXHR(0.5/2)
273 #define C7 FIXHR(0.34202014332566873304/2)
274 #define C8 FIXHR(0.17364817766693034885/2)
275 
276 /* 0.5 / cos(pi*(2*i+1)/36) */
277 static const INTFLOAT icos36[9] = {
278  FIXR(0.50190991877167369479),
279  FIXR(0.51763809020504152469), //0
280  FIXR(0.55168895948124587824),
281  FIXR(0.61038729438072803416),
282  FIXR(0.70710678118654752439), //1
283  FIXR(0.87172339781054900991),
284  FIXR(1.18310079157624925896),
285  FIXR(1.93185165257813657349), //2
286  FIXR(5.73685662283492756461),
287 };
288 
289 /* 0.5 / cos(pi*(2*i+1)/36) */
290 static const INTFLOAT icos36h[9] = {
291  FIXHR(0.50190991877167369479/2),
292  FIXHR(0.51763809020504152469/2), //0
293  FIXHR(0.55168895948124587824/2),
294  FIXHR(0.61038729438072803416/2),
295  FIXHR(0.70710678118654752439/2), //1
296  FIXHR(0.87172339781054900991/2),
297  FIXHR(1.18310079157624925896/4),
298  FIXHR(1.93185165257813657349/4), //2
299 // FIXHR(5.73685662283492756461),
300 };
301 
302 /* using Lee like decomposition followed by hand coded 9 points DCT */
304 {
305  int i, j;
306  SUINTFLOAT t0, t1, t2, t3, s0, s1, s2, s3;
307  SUINTFLOAT tmp[18], *tmp1, *in1;
308 
309  for (i = 17; i >= 1; i--)
310  in[i] += in[i-1];
311  for (i = 17; i >= 3; i -= 2)
312  in[i] += in[i-2];
313 
314  for (j = 0; j < 2; j++) {
315  tmp1 = tmp + j;
316  in1 = in + j;
317 
318  t2 = in1[2*4] + in1[2*8] - in1[2*2];
319 
320  t3 = in1[2*0] + SHR(in1[2*6],1);
321  t1 = in1[2*0] - in1[2*6];
322  tmp1[ 6] = t1 - SHR(t2,1);
323  tmp1[16] = t1 + t2;
324 
325  t0 = MULH3(in1[2*2] + in1[2*4] , C2, 2);
326  t1 = MULH3(in1[2*4] - in1[2*8] , -2*C8, 1);
327  t2 = MULH3(in1[2*2] + in1[2*8] , -C4, 2);
328 
329  tmp1[10] = t3 - t0 - t2;
330  tmp1[ 2] = t3 + t0 + t1;
331  tmp1[14] = t3 + t2 - t1;
332 
333  tmp1[ 4] = MULH3(in1[2*5] + in1[2*7] - in1[2*1], -C3, 2);
334  t2 = MULH3(in1[2*1] + in1[2*5], C1, 2);
335  t3 = MULH3(in1[2*5] - in1[2*7], -2*C7, 1);
336  t0 = MULH3(in1[2*3], C3, 2);
337 
338  t1 = MULH3(in1[2*1] + in1[2*7], -C5, 2);
339 
340  tmp1[ 0] = t2 + t3 + t0;
341  tmp1[12] = t2 + t1 - t0;
342  tmp1[ 8] = t3 - t1 - t0;
343  }
344 
345  i = 0;
346  for (j = 0; j < 4; j++) {
347  t0 = tmp[i];
348  t1 = tmp[i + 2];
349  s0 = t1 + t0;
350  s2 = t1 - t0;
351 
352  t2 = tmp[i + 1];
353  t3 = tmp[i + 3];
354  s1 = MULH3(t3 + t2, icos36h[ j], 2);
355  s3 = MULLx(t3 - t2, icos36 [8 - j], FRAC_BITS);
356 
357  t0 = s0 + s1;
358  t1 = s0 - s1;
359  out[(9 + j) * SBLIMIT] = MULH3(t1, win[ 9 + j], 1) + buf[4*(9 + j)];
360  out[(8 - j) * SBLIMIT] = MULH3(t1, win[ 8 - j], 1) + buf[4*(8 - j)];
361  buf[4 * ( 9 + j )] = MULH3(t0, win[MDCT_BUF_SIZE/2 + 9 + j], 1);
362  buf[4 * ( 8 - j )] = MULH3(t0, win[MDCT_BUF_SIZE/2 + 8 - j], 1);
363 
364  t0 = s2 + s3;
365  t1 = s2 - s3;
366  out[(9 + 8 - j) * SBLIMIT] = MULH3(t1, win[ 9 + 8 - j], 1) + buf[4*(9 + 8 - j)];
367  out[ j * SBLIMIT] = MULH3(t1, win[ j], 1) + buf[4*( j)];
368  buf[4 * ( 9 + 8 - j )] = MULH3(t0, win[MDCT_BUF_SIZE/2 + 9 + 8 - j], 1);
369  buf[4 * ( j )] = MULH3(t0, win[MDCT_BUF_SIZE/2 + j], 1);
370  i += 4;
371  }
372 
373  s0 = tmp[16];
374  s1 = MULH3(tmp[17], icos36h[4], 2);
375  t0 = s0 + s1;
376  t1 = s0 - s1;
377  out[(9 + 4) * SBLIMIT] = MULH3(t1, win[ 9 + 4], 1) + buf[4*(9 + 4)];
378  out[(8 - 4) * SBLIMIT] = MULH3(t1, win[ 8 - 4], 1) + buf[4*(8 - 4)];
379  buf[4 * ( 9 + 4 )] = MULH3(t0, win[MDCT_BUF_SIZE/2 + 9 + 4], 1);
380  buf[4 * ( 8 - 4 )] = MULH3(t0, win[MDCT_BUF_SIZE/2 + 8 - 4], 1);
381 }
382 
384  int count, int switch_point, int block_type)
385 {
386  int j;
387  for (j=0 ; j < count; j++) {
388  /* apply window & overlap with previous buffer */
389 
390  /* select window */
391  int win_idx = (switch_point && j < 2) ? 0 : block_type;
392  INTFLOAT *win = RENAME(ff_mdct_win)[win_idx + (4 & -(j & 1))];
393 
394  imdct36(out, buf, in, win);
395 
396  in += 18;
397  buf += ((j&3) != 3 ? 1 : (72-3));
398  out++;
399  }
400 }
401 
SHR
#define SHR(a, b)
Definition: mpegaudiodsp_template.c:67
C7
#define C7
Definition: mpegaudiodsp_template.c:273
C2
#define C2
Definition: mpegaudiodsp_template.c:268
out
FILE * out
Definition: movenc.c:54
icos36h
static const INTFLOAT icos36h[9]
Definition: mpegaudiodsp_template.c:290
IMDCT_SCALAR
#define IMDCT_SCALAR
Definition: mpegaudio.h:56
MULH3
#define MULH3(x, y, s)
Definition: mpegaudiodsp_template.c:65
tmp
static uint8_t tmp[11]
Definition: aes_ctr.c:26
MPADSPContext
Definition: mpegaudiodsp.h:27
t0
#define t0
Definition: regdef.h:28
C8
#define C8
Definition: mpegaudiodsp_template.c:274
samples
FFmpeg Automated Testing Environment ************************************Introduction Using FATE from your FFmpeg source directory Submitting the results to the FFmpeg result aggregation server Uploading new samples to the fate suite FATE makefile targets and variables Makefile targets Makefile variables Examples Introduction **************FATE is an extended regression suite on the client side and a means for results aggregation and presentation on the server side The first part of this document explains how you can use FATE from your FFmpeg source directory to test your ffmpeg binary The second part describes how you can run FATE to submit the results to FFmpeg’s FATE server In any way you can have a look at the publicly viewable FATE results by visiting this as it can be seen if some test on some platform broke with their recent contribution This usually happens on the platforms the developers could not test on The second part of this document describes how you can run FATE to submit your results to FFmpeg’s FATE server If you want to submit your results be sure to check that your combination of OS and compiler is not already listed on the above mentioned website In the third part you can find a comprehensive listing of FATE makefile targets and variables Using FATE from your FFmpeg source directory **********************************************If you want to run FATE on your machine you need to have the samples in place You can get the samples via the build target fate rsync Use this command from the top level source this will cause FATE to fail NOTE To use a custom wrapper to run the pass ‘ target exec’ to ‘configure’ or set the TARGET_EXEC Make variable Submitting the results to the FFmpeg result aggregation server ****************************************************************To submit your results to the server you should run fate through the shell script ‘tests fate sh’ from the FFmpeg sources This script needs to be invoked with a configuration file as its first argument tests fate sh path to fate_config A configuration file template with comments describing the individual configuration variables can be found at ‘doc fate_config sh template’ Create a configuration that suits your based on the configuration template The ‘slot’ configuration variable can be any string that is not yet but it is suggested that you name it adhering to the following pattern ‘ARCH OS COMPILER COMPILER VERSION’ The configuration file itself will be sourced in a shell therefore all shell features may be used This enables you to setup the environment as you need it for your build For your first test runs the ‘fate_recv’ variable should be empty or commented out This will run everything as normal except that it will omit the submission of the results to the server The following files should be present in $workdir as specified in the configuration it may help to try out the ‘ssh’ command with one or more ‘ v’ options You should get detailed output concerning your SSH configuration and the authentication process The only thing left is to automate the execution of the fate sh script and the synchronisation of the samples directory Uploading new samples to the fate suite *****************************************If you need a sample uploaded send a mail to samples request This is for developers who have an account on the fate suite server If you upload new samples
Definition: fate.txt:139
t1
#define t1
Definition: regdef.h:29
ff_mpa_synth_init
av_cold void RENAME() ff_mpa_synth_init(MPA_INT *window)
Definition: mpegaudiodsp_template.c:195
ff_init_mpadsp_tabs
av_cold void RENAME() ff_init_mpadsp_tabs(void)
Definition: mpegaudiodsp_template.c:224
C5
#define C5
Definition: mpegaudiodsp_template.c:271
win
static float win(SuperEqualizerContext *s, float n, int N)
Definition: af_superequalizer.c:119
window
static SDL_Window * window
Definition: ffplay.c:368
s3
#define s3
Definition: regdef.h:40
SUM8P2
#define SUM8P2(sum1, op1, sum2, op2, w1, w2, p)
Definition: mpegaudiodsp_template.c:92
C1
#define C1
Definition: mpegaudiodsp_template.c:267
ff_mpa_synth_filter
void RENAME() ff_mpa_synth_filter(MPADSPContext *s, MPA_INT *synth_buf_ptr, int *synth_buf_offset, MPA_INT *window, int *dither_state, OUT_INT *samples, ptrdiff_t incr, MPA_INT *sb_samples)
Definition: mpegaudiodsp_template.c:176
MACS
#define MACS(rt, ra, rb)
Definition: mpegaudiodsp_template.c:63
SUM8
#define SUM8(op, sum, w, p)
Definition: mpegaudiodsp_template.c:80
av_cold
#define av_cold
Definition: attributes.h:90
s
#define s(width, name)
Definition: cbs_vp9.c:257
dct32
void dct32(INTFLOAT *out, const INTFLOAT *tab_arg)
Definition: dct32_template.c:126
s1
#define s1
Definition: regdef.h:38
C4
#define C4
Definition: mpegaudiodsp_template.c:270
mathops.h
dct32.h
SBLIMIT
#define SBLIMIT
Definition: mpegaudio.h:44
ff_mpa_enwindow
const int32_t ff_mpa_enwindow[257]
Definition: mpegaudiodsp_data.c:22
C3
#define C3
Definition: mpegaudiodsp_template.c:269
OUT_SHIFT
#define OUT_SHIFT
Definition: mpegaudiodsp_template.c:52
s2
#define s2
Definition: regdef.h:39
FIXHR
#define FIXHR(a)
Definition: mpegaudiodsp_template.c:69
MLSS
#define MLSS(rt, ra, rb)
Definition: mpegaudiodsp_template.c:64
OUT_INT
int16_t OUT_INT
Definition: mpegaudio.h:76
ff_mpadsp_apply_window
void RENAME() ff_mpadsp_apply_window(MPA_INT *synth_buf, MPA_INT *window, int *dither_state, OUT_INT *samples, ptrdiff_t incr)
Definition: mpegaudiodsp_template.c:121
offset
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
Definition: writing_filters.txt:86
attributes.h
M_PI
#define M_PI
Definition: mathematics.h:52
DECLARE_ALIGNED
#define DECLARE_ALIGNED(n, t, v)
Definition: mem.h:112
in
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) #define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac) { } void ff_audio_convert_free(AudioConvert **ac) { if(! *ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);} AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map) { AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method !=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt) > 2) { ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc) { av_free(ac);return NULL;} return ac;} in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar) { ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar ? ac->channels :1;} else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);return ac;} int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in) { int use_generic=1;int len=in->nb_samples;int p;if(ac->dc) { av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> in
Definition: audio_convert.c:326
imdct36
static void imdct36(INTFLOAT *out, INTFLOAT *buf, SUINTFLOAT *in, INTFLOAT *win)
Definition: mpegaudiodsp_template.c:303
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:269
t3
#define t3
Definition: regdef.h:31
apply_window
static void(*const apply_window[4])(AVFloatDSPContext *fdsp, SingleChannelElement *sce, const float *audio)
Definition: aacenc.c:192
mpegaudio.h
w
FFmpeg Automated Testing Environment ************************************Introduction Using FATE from your FFmpeg source directory Submitting the results to the FFmpeg result aggregation server Uploading new samples to the fate suite FATE makefile targets and variables Makefile targets Makefile variables Examples Introduction **************FATE is an extended regression suite on the client side and a means for results aggregation and presentation on the server side The first part of this document explains how you can use FATE from your FFmpeg source directory to test your ffmpeg binary The second part describes how you can run FATE to submit the results to FFmpeg’s FATE server In any way you can have a look at the publicly viewable FATE results by visiting this as it can be seen if some test on some platform broke with their recent contribution This usually happens on the platforms the developers could not test on The second part of this document describes how you can run FATE to submit your results to FFmpeg’s FATE server If you want to submit your results be sure to check that your combination of OS and compiler is not already listed on the above mentioned website In the third part you can find a comprehensive listing of FATE makefile targets and variables Using FATE from your FFmpeg source directory **********************************************If you want to run FATE on your machine you need to have the samples in place You can get the samples via the build target fate rsync Use this command from the top level source this will cause FATE to fail NOTE To use a custom wrapper to run the pass ‘ target exec’ to ‘configure’ or set the TARGET_EXEC Make variable Submitting the results to the FFmpeg result aggregation server ****************************************************************To submit your results to the server you should run fate through the shell script ‘tests fate sh’ from the FFmpeg sources This script needs to be invoked with a configuration file as its first argument tests fate sh path to fate_config A configuration file template with comments describing the individual configuration variables can be found at ‘doc fate_config sh template’ Create a configuration that suits your based on the configuration template The ‘slot’ configuration variable can be any string that is not yet but it is suggested that you name it adhering to the following pattern ‘ARCH OS COMPILER COMPILER VERSION’ The configuration file itself will be sourced in a shell therefore all shell features may be used This enables you to setup the environment as you need it for your build For your first test runs the ‘fate_recv’ variable should be empty or commented out This will run everything as normal except that it will omit the submission of the results to the server The following files should be present in $workdir as specified in the configuration it may help to try out the ‘ssh’ command with one or more ‘ v’ options You should get detailed output concerning your SSH configuration and the authentication process The only thing left is to automate the execution of the fate sh script and the synchronisation of the samples directory Uploading new samples to the fate suite *****************************************If you need a sample uploaded send a mail to samples request This is for developers who have an account on the fate suite server If you upload new please make sure they are as small as space on each network bandwidth and so on benefit from smaller test cases Also keep in mind older checkouts use existing sample that means in practice generally do not remove or overwrite files as it likely would break older checkouts or releases Also all needed samples for a commit should be ideally before the push If you need an account for frequently uploading samples or you wish to help others by doing that send a mail to ffmpeg devel rsync vauL Duo ug o o w
Definition: fate.txt:150
FIXR
#define FIXR(a)
Definition: mpegaudiodsp_template.c:68
void
typedef void(RENAME(mix_any_func_type))
Definition: rematrix_template.c:52
t2
#define t2
Definition: regdef.h:30
FRAC_BITS
#define FRAC_BITS
Definition: g729postfilter.c:33
RENAME
#define RENAME(n)
Definition: mpegaudiodsp_template.c:51
round_sample
static int round_sample(int64_t *sum)
Definition: mpegaudiodsp_template.c:54
icos36
static const INTFLOAT icos36[9]
Definition: mpegaudiodsp_template.c:277
mpegaudiodsp.h
MPA_INT
int32_t MPA_INT
Definition: mpegaudio.h:75
mem.h
MDCT_BUF_SIZE
#define MDCT_BUF_SIZE
For SSE implementation, MDCT_BUF_SIZE/2 should be 128-bit aligned.
Definition: mpegaudiodsp.h:89
s0
#define s0
Definition: regdef.h:37
ff_imdct36_blocks
void RENAME() ff_imdct36_blocks(INTFLOAT *out, INTFLOAT *buf, INTFLOAT *in, int count, int switch_point, int block_type)
Definition: mpegaudiodsp_template.c:383
SUINTFLOAT
#define SUINTFLOAT
Definition: dct32_template.c:45
int
int
Definition: ffmpeg_filter.c:192
INTFLOAT
float INTFLOAT
Definition: aac_defines.h:86
MULLx
#define MULLx(x, y, s)
Definition: mpegaudiodsp_template.c:66