FFmpeg
swresample.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2011-2012 Michael Niedermayer (michaelni@gmx.at)
3  * Copyright (c) 2002 Fabrice Bellard
4  *
5  * This file is part of libswresample
6  *
7  * libswresample is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * libswresample is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with libswresample; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #include "libavutil/avassert.h"
24 #include "libavutil/common.h"
25 #include "libavutil/opt.h"
26 
28 
29 #undef time
30 #include <time.h>
31 #undef fprintf
32 
33 #define SAMPLES 1000
34 
35 #define SWR_CH_MAX 32
36 
37 #define ASSERT_LEVEL 2
38 
39 static double get(uint8_t *a[], int ch, int index, int ch_count, enum AVSampleFormat f){
40  const uint8_t *p;
43  p= a[ch];
44  }else{
45  p= a[0];
46  index= ch + index*ch_count;
47  }
48 
49  switch(f){
50  case AV_SAMPLE_FMT_U8 : return ((const uint8_t*)p)[index]/127.0-1.0;
51  case AV_SAMPLE_FMT_S16: return ((const int16_t*)p)[index]/32767.0;
52  case AV_SAMPLE_FMT_S32: return ((const int32_t*)p)[index]/2147483647.0;
53  case AV_SAMPLE_FMT_FLT: return ((const float *)p)[index];
54  case AV_SAMPLE_FMT_DBL: return ((const double *)p)[index];
55  default: av_assert0(0);
56  }
57 }
58 
59 static void set(uint8_t *a[], int ch, int index, int ch_count, enum AVSampleFormat f, double v){
60  uint8_t *p;
63  p= a[ch];
64  }else{
65  p= a[0];
66  index= ch + index*ch_count;
67  }
68  switch(f){
69  case AV_SAMPLE_FMT_U8 : ((uint8_t*)p)[index]= av_clip_uint8 (lrint((v+1.0)*127)); break;
70  case AV_SAMPLE_FMT_S16: ((int16_t*)p)[index]= av_clip_int16 (lrint(v*32767)); break;
71  case AV_SAMPLE_FMT_S32: ((int32_t*)p)[index]= av_clipl_int32(llrint(v*2147483647)); break;
72  case AV_SAMPLE_FMT_FLT: ((float *)p)[index]= v; break;
73  case AV_SAMPLE_FMT_DBL: ((double *)p)[index]= v; break;
74  default: av_assert2(0);
75  }
76 }
77 
78 static void shift(uint8_t *a[], int index, int ch_count, enum AVSampleFormat f){
79  int ch;
80 
83  for(ch= 0; ch<ch_count; ch++)
85  }else{
86  a[0] += index*ch_count*av_get_bytes_per_sample(f);
87  }
88 }
89 
90 static const enum AVSampleFormat formats[] = {
101 };
102 
103 static const int rates[] = {
104  8000,
105  11025,
106  16000,
107  22050,
108  32000,
109  48000,
110 };
111 
112 static const AVChannelLayout layouts[]={
127 };
128 
129 static void setup_array(uint8_t *out[SWR_CH_MAX], uint8_t *in, enum AVSampleFormat format, int samples){
131  int i;
132  int plane_size= av_get_bytes_per_sample(format&0xFF)*samples;
133  format&=0xFF;
134  for(i=0; i<SWR_CH_MAX; i++){
135  out[i]= in + i*plane_size;
136  }
137  }else{
138  out[0]= in;
139  }
140 }
141 
142 static int cmp(const void *a, const void *b){
143  return *(const int *)a - *(const int *)b;
144 }
145 
146 static void audiogen(void *data, enum AVSampleFormat sample_fmt,
147  int channels, int sample_rate, int nb_samples)
148 {
149  int i, ch, k;
150  double v, f, a, ampa;
151  double tabf1[SWR_CH_MAX];
152  double tabf2[SWR_CH_MAX];
153  double taba[SWR_CH_MAX];
154  unsigned static rnd;
155 
156 #define PUT_SAMPLE set(data, ch, k, channels, sample_fmt, v);
157 #define uint_rand(x) ((x) = (x) * 1664525 + 1013904223)
158 #define dbl_rand(x) (uint_rand(x)*2.0 / (double)UINT_MAX - 1)
159  k = 0;
160 
161  /* 1 second of single freq sinus at 1000 Hz */
162  a = 0;
163  for (i = 0; i < 1 * sample_rate && k < nb_samples; i++, k++) {
164  v = sin(a) * 0.30;
165  for (ch = 0; ch < channels; ch++)
166  PUT_SAMPLE
167  a += M_PI * 1000.0 * 2.0 / sample_rate;
168  }
169 
170  /* 1 second of varying frequency between 100 and 10000 Hz */
171  a = 0;
172  for (i = 0; i < 1 * sample_rate && k < nb_samples; i++, k++) {
173  v = sin(a) * 0.30;
174  for (ch = 0; ch < channels; ch++)
175  PUT_SAMPLE
176  f = 100.0 + (((10000.0 - 100.0) * i) / sample_rate);
177  a += M_PI * f * 2.0 / sample_rate;
178  }
179 
180  /* 0.5 second of low amplitude white noise */
181  for (i = 0; i < sample_rate / 2 && k < nb_samples; i++, k++) {
182  v = dbl_rand(rnd) * 0.30;
183  for (ch = 0; ch < channels; ch++)
184  PUT_SAMPLE
185  }
186 
187  /* 0.5 second of high amplitude white noise */
188  for (i = 0; i < sample_rate / 2 && k < nb_samples; i++, k++) {
189  v = dbl_rand(rnd);
190  for (ch = 0; ch < channels; ch++)
191  PUT_SAMPLE
192  }
193 
194  /* 1 second of unrelated ramps for each channel */
195  for (ch = 0; ch < channels; ch++) {
196  taba[ch] = 0;
197  tabf1[ch] = 100 + uint_rand(rnd) % 5000;
198  tabf2[ch] = 100 + uint_rand(rnd) % 5000;
199  }
200  for (i = 0; i < 1 * sample_rate && k < nb_samples; i++, k++) {
201  for (ch = 0; ch < channels; ch++) {
202  v = sin(taba[ch]) * 0.30;
203  PUT_SAMPLE
204  f = tabf1[ch] + (((tabf2[ch] - tabf1[ch]) * i) / sample_rate);
205  taba[ch] += M_PI * f * 2.0 / sample_rate;
206  }
207  }
208 
209  /* 2 seconds of 500 Hz with varying volume */
210  a = 0;
211  ampa = 0;
212  for (i = 0; i < 2 * sample_rate && k < nb_samples; i++, k++) {
213  for (ch = 0; ch < channels; ch++) {
214  double amp = (1.0 + sin(ampa)) * 0.15;
215  if (ch & 1)
216  amp = 0.30 - amp;
217  v = sin(a) * amp;
218  PUT_SAMPLE
219  a += M_PI * 500.0 * 2.0 / sample_rate;
220  ampa += M_PI * 2.0 / sample_rate;
221  }
222  }
223 }
224 
225 int main(int argc, char **argv){
226  int in_sample_rate, out_sample_rate, ch ,i, flush_count;
227  AVChannelLayout in_ch_layout = { 0 }, out_ch_layout = { 0 };
229  uint8_t array_in[SAMPLES*8*8];
230  uint8_t array_mid[SAMPLES*8*8*3];
231  uint8_t array_out[SAMPLES*8*8+100];
232  uint8_t *ain[SWR_CH_MAX];
233  uint8_t *aout[SWR_CH_MAX];
234  uint8_t *amid[SWR_CH_MAX];
235  int flush_i=0;
236  int mode;
237  int num_tests = 10000;
238  uint32_t seed = 0;
239  uint32_t rand_seed = 0;
241  int max_tests = FF_ARRAY_ELEMS(remaining_tests);
242  int test;
243  int specific_test= -1;
244 
245  struct SwrContext * forw_ctx= NULL;
246  struct SwrContext *backw_ctx= NULL;
247 
248  if (argc > 1) {
249  if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")) {
250  av_log(NULL, AV_LOG_INFO, "Usage: swresample-test [<num_tests>[ <test>]] \n"
251  "num_tests Default is %d\n", num_tests);
252  return 0;
253  }
254  num_tests = strtol(argv[1], NULL, 0);
255  if(num_tests < 0) {
256  num_tests = -num_tests;
257  rand_seed = time(0);
258  }
259  if(num_tests<= 0 || num_tests>max_tests)
260  num_tests = max_tests;
261  if(argc > 2) {
262  specific_test = strtol(argv[1], NULL, 0);
263  }
264  }
265 
266  for(i=0; i<max_tests; i++)
267  remaining_tests[i] = i;
268 
269  for(test=0; test<num_tests; test++){
270  unsigned r;
271  uint_rand(seed);
272  r = (seed * (uint64_t)(max_tests - test)) >>32;
273  FFSWAP(int, remaining_tests[r], remaining_tests[max_tests - test - 1]);
274  }
275  qsort(remaining_tests + max_tests - num_tests, num_tests, sizeof(remaining_tests[0]), cmp);
276  in_sample_rate=16000;
277  for(test=0; test<num_tests; test++){
278  char in_layout_string[256];
279  char out_layout_string[256];
280  unsigned vector= remaining_tests[max_tests - test - 1];
281  int in_ch_count;
282  int out_count, mid_count, out_ch_count;
283 
288  out_sample_rate = rates [vector % FF_ARRAY_ELEMS(rates )]; vector /= FF_ARRAY_ELEMS(rates);
289  av_assert0(!vector);
290 
291  if(specific_test == 0){
293  continue;
294  }
295 
296  in_ch_count= in_ch_layout.nb_channels;
297  out_ch_count= out_ch_layout.nb_channels;
298  av_channel_layout_describe(&in_ch_layout, in_layout_string, sizeof( in_layout_string));
299  av_channel_layout_describe(&out_ch_layout, out_layout_string, sizeof(out_layout_string));
300  fprintf(stderr, "TEST: %s->%s, rate:%5d->%5d, fmt:%s->%s\n",
301  in_layout_string, out_layout_string,
306  0, 0) < 0) {
307  fprintf(stderr, "Failed to init forw_cts\n");
308  return 1;
309  }
312  0, 0) < 0) {
313  fprintf(stderr, "Failed to init backw_ctx\n");
314  return 1;
315  }
316 
317  if(swr_init( forw_ctx) < 0)
318  fprintf(stderr, "swr_init(->) failed\n");
319  if(swr_init(backw_ctx) < 0)
320  fprintf(stderr, "swr_init(<-) failed\n");
321  //FIXME test planar
322  setup_array(ain , array_in , in_sample_fmt, SAMPLES);
323  setup_array(amid, array_mid, out_sample_fmt, 3*SAMPLES);
324  setup_array(aout, array_out, in_sample_fmt , SAMPLES);
325 #if 0
326  for(ch=0; ch<in_ch_count; ch++){
327  for(i=0; i<SAMPLES; i++)
328  set(ain, ch, i, in_ch_count, in_sample_fmt, sin(i*i*3/SAMPLES));
329  }
330 #else
331  audiogen(ain, in_sample_fmt, in_ch_count, SAMPLES/6+1, SAMPLES);
332 #endif
333  mode = uint_rand(rand_seed) % 3;
334  if(mode==0 /*|| out_sample_rate == in_sample_rate*/) {
335  mid_count= swr_convert(forw_ctx, amid, 3*SAMPLES, (const uint8_t **)ain, SAMPLES);
336  } else if(mode==1){
337  mid_count= swr_convert(forw_ctx, amid, 0, (const uint8_t **)ain, SAMPLES);
338  mid_count+=swr_convert(forw_ctx, amid, 3*SAMPLES, (const uint8_t **)ain, 0);
339  } else {
340  int tmp_count;
341  mid_count= swr_convert(forw_ctx, amid, 0, (const uint8_t **)ain, 1);
342  av_assert0(mid_count==0);
343  shift(ain, 1, in_ch_count, in_sample_fmt);
344  mid_count+=swr_convert(forw_ctx, amid, 3*SAMPLES, (const uint8_t **)ain, 0);
345  shift(amid, mid_count, out_ch_count, out_sample_fmt); tmp_count = mid_count;
346  mid_count+=swr_convert(forw_ctx, amid, 2, (const uint8_t **)ain, 2);
347  shift(amid, mid_count-tmp_count, out_ch_count, out_sample_fmt); tmp_count = mid_count;
348  shift(ain, 2, in_ch_count, in_sample_fmt);
349  mid_count+=swr_convert(forw_ctx, amid, 1, (const uint8_t **)ain, SAMPLES-3);
350  shift(amid, mid_count-tmp_count, out_ch_count, out_sample_fmt); tmp_count = mid_count;
351  shift(ain, -3, in_ch_count, in_sample_fmt);
352  mid_count+=swr_convert(forw_ctx, amid, 3*SAMPLES, (const uint8_t **)ain, 0);
353  shift(amid, -tmp_count, out_ch_count, out_sample_fmt);
354  }
355  out_count= swr_convert(backw_ctx,aout, SAMPLES, (const uint8_t **)amid, mid_count);
356 
357  for(ch=0; ch<in_ch_count; ch++){
358  double sse, maxdiff=0;
359  double sum_aa= 0;
360  double sum_bb= 0;
361  double sum_ab= 0;
362  for(i=0; i<out_count; i++){
363  double a= get(ain , ch, i, in_ch_count, in_sample_fmt);
364  double b= get(aout, ch, i, in_ch_count, in_sample_fmt);
365  sum_aa+= a*a;
366  sum_bb+= b*b;
367  sum_ab+= a*b;
368  maxdiff= FFMAX(maxdiff, fabs(a-b));
369  }
370  sse= sum_aa + sum_bb - 2*sum_ab;
371  if(sse < 0 && sse > -0.00001) sse=0; //fix rounding error
372 
373  fprintf(stderr, "[e:%f c:%f max:%f] len:%5d\n", out_count ? sqrt(sse/out_count) : 0, sum_ab/(sqrt(sum_aa*sum_bb)), maxdiff, out_count);
374  }
375 
376  flush_i++;
377  flush_i%=21;
378  flush_count = swr_convert(backw_ctx,aout, flush_i, 0, 0);
379  shift(aout, flush_i, in_ch_count, in_sample_fmt);
380  flush_count+= swr_convert(backw_ctx,aout, SAMPLES-flush_i, 0, 0);
381  shift(aout, -flush_i, in_ch_count, in_sample_fmt);
382  if(flush_count){
383  for(ch=0; ch<in_ch_count; ch++){
384  double sse, maxdiff=0;
385  double sum_aa= 0;
386  double sum_bb= 0;
387  double sum_ab= 0;
388  for(i=0; i<flush_count; i++){
389  double a= get(ain , ch, i+out_count, in_ch_count, in_sample_fmt);
390  double b= get(aout, ch, i, in_ch_count, in_sample_fmt);
391  sum_aa+= a*a;
392  sum_bb+= b*b;
393  sum_ab+= a*b;
394  maxdiff= FFMAX(maxdiff, fabs(a-b));
395  }
396  sse= sum_aa + sum_bb - 2*sum_ab;
397  if(sse < 0 && sse > -0.00001) sse=0; //fix rounding error
398 
399  fprintf(stderr, "[e:%f c:%f max:%f] len:%5d F:%3d\n", sqrt(sse/flush_count), sum_ab/(sqrt(sum_aa*sum_bb)), maxdiff, flush_count, flush_i);
400  }
401  }
402 
403 
404  fprintf(stderr, "\n");
405  }
406 
407  return 0;
408 }
formats
formats
Definition: signature.h:48
AV_SAMPLE_FMT_FLTP
@ AV_SAMPLE_FMT_FLTP
float, planar
Definition: samplefmt.h:66
r
const char * r
Definition: vf_curves.c:126
opt.h
out
FILE * out
Definition: movenc.c:54
AV_CHANNEL_LAYOUT_STEREO
#define AV_CHANNEL_LAYOUT_STEREO
Definition: channel_layout.h:369
SwrContext::in_sample_rate
int in_sample_rate
input sample rate
Definition: swresample_internal.h:104
AV_CHANNEL_LAYOUT_2_2
#define AV_CHANNEL_LAYOUT_2_2
Definition: channel_layout.h:376
SwrContext::out_sample_rate
int out_sample_rate
output sample rate
Definition: swresample_internal.h:105
b
#define b
Definition: input.c:41
AV_SAMPLE_FMT_S32P
@ AV_SAMPLE_FMT_S32P
signed 32 bits, planar
Definition: samplefmt.h:65
SwrContext::out_ch_layout
AVChannelLayout out_ch_layout
output channel layout
Definition: swresample_internal.h:103
data
const char data[16]
Definition: mxf.c:146
test
Definition: idctdsp.c:34
FFMAX
#define FFMAX(a, b)
Definition: macros.h:47
AVChannelLayout::nb_channels
int nb_channels
Number of channels in this layout.
Definition: channel_layout.h:311
cmp
static int cmp(const void *a, const void *b)
Definition: swresample.c:142
sample_rate
sample_rate
Definition: ffmpeg_filter.c:156
audiogen
static void audiogen(void *data, enum AVSampleFormat sample_fmt, int channels, int sample_rate, int nb_samples)
Definition: swresample.c:146
AV_CHANNEL_LAYOUT_7POINT1_WIDE
#define AV_CHANNEL_LAYOUT_7POINT1_WIDE
Definition: channel_layout.h:391
setup_array
static void setup_array(uint8_t *out[SWR_CH_MAX], uint8_t *in, enum AVSampleFormat format, int samples)
Definition: swresample.c:129
SwrContext::out_sample_fmt
enum AVSampleFormat out_sample_fmt
output sample format
Definition: swresample_internal.h:101
AV_CHANNEL_LAYOUT_SURROUND
#define AV_CHANNEL_LAYOUT_SURROUND
Definition: channel_layout.h:372
SAMPLES
#define SAMPLES
Definition: swresample.c:33
avassert.h
lrint
#define lrint
Definition: tablegen.h:53
rnd
#define rnd()
Definition: checkasm.h:118
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
set
static void set(uint8_t *a[], int ch, int index, int ch_count, enum AVSampleFormat f, double v)
Definition: swresample.c:59
swr_init
av_cold int swr_init(struct SwrContext *s)
Initialize context after user parameters have been set.
Definition: swresample.c:191
av_channel_layout_describe
int av_channel_layout_describe(const AVChannelLayout *channel_layout, char *buf, size_t buf_size)
Get a human-readable string describing the channel layout properties.
Definition: channel_layout.c:778
AV_CHANNEL_LAYOUT_4POINT0
#define AV_CHANNEL_LAYOUT_4POINT0
Definition: channel_layout.h:374
AV_CHANNEL_LAYOUT_7POINT1
#define AV_CHANNEL_LAYOUT_7POINT1
Definition: channel_layout.h:390
format
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample format(the sample packing is implied by the sample format) and sample rate. The lists are not just lists
AV_CHANNEL_LAYOUT_5POINT0_BACK
#define AV_CHANNEL_LAYOUT_5POINT0_BACK
Definition: channel_layout.h:380
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
av_sample_fmt_is_planar
int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)
Check if the sample format is planar.
Definition: samplefmt.c:114
channels
channels
Definition: aptx.h:31
av_get_sample_fmt_name
const char * av_get_sample_fmt_name(enum AVSampleFormat sample_fmt)
Return the name of sample_fmt, or NULL if sample_fmt is not recognized.
Definition: samplefmt.c:51
SwrContext
The libswresample context.
Definition: swresample_internal.h:95
SwrContext::in_ch_layout
AVChannelLayout in_ch_layout
input channel layout
Definition: swresample_internal.h:102
fabs
static __device__ float fabs(float a)
Definition: cuda_runtime.h:182
av_clip_int16
#define av_clip_int16
Definition: common.h:110
NULL
#define NULL
Definition: coverity.c:32
time.h
seed
static unsigned int seed
Definition: videogen.c:78
swresample.h
index
int index
Definition: gxfenc.c:89
uint_rand
#define uint_rand(x)
dbl_rand
#define dbl_rand(x)
main
int main(int argc, char **argv)
Definition: swresample.c:225
get
static double get(uint8_t *a[], int ch, int index, int ch_count, enum AVSampleFormat f)
Definition: swresample.c:39
f
f
Definition: af_crystalizer.c:122
swr_alloc_set_opts2
int swr_alloc_set_opts2(struct SwrContext **ps, const AVChannelLayout *out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate, const AVChannelLayout *in_ch_layout, enum AVSampleFormat in_sample_fmt, int in_sample_rate, int log_offset, void *log_ctx)
Allocate SwrContext if needed and set/reset common parameters.
Definition: swresample.c:85
AV_SAMPLE_FMT_U8P
@ AV_SAMPLE_FMT_U8P
unsigned 8 bits, planar
Definition: samplefmt.h:63
AVChannelLayout
An AVChannelLayout holds information about the channel layout of audio data.
Definition: channel_layout.h:301
av_clipl_int32
#define av_clipl_int32
Definition: common.h:113
swr_convert
int attribute_align_arg swr_convert(struct SwrContext *s, uint8_t **out_arg, int out_count, const uint8_t **in_arg, int in_count)
Convert audio.
Definition: swresample.c:816
a
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
Definition: undefined.txt:41
M_PI
#define M_PI
Definition: mathematics.h:52
AV_SAMPLE_FMT_S16P
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
Definition: samplefmt.h:64
av_channel_layout_compare
int av_channel_layout_compare(const AVChannelLayout *chl, const AVChannelLayout *chl1)
Check whether two channel layouts are semantically the same, i.e.
Definition: channel_layout.c:932
AV_LOG_INFO
#define AV_LOG_INFO
Standard information.
Definition: log.h:191
av_assert2
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
Definition: avassert.h:64
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:269
av_get_bytes_per_sample
int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt)
Return number of bytes per sample.
Definition: samplefmt.c:108
AV_CHANNEL_LAYOUT_QUAD
#define AV_CHANNEL_LAYOUT_QUAD
Definition: channel_layout.h:377
AV_SAMPLE_FMT_U8
@ AV_SAMPLE_FMT_U8
unsigned 8 bits
Definition: samplefmt.h:57
common.h
AVSampleFormat
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:55
AV_SAMPLE_FMT_S16
@ AV_SAMPLE_FMT_S16
signed 16 bits
Definition: samplefmt.h:58
FFSWAP
#define FFSWAP(type, a, b)
Definition: macros.h:52
SwrContext::in_sample_fmt
enum AVSampleFormat in_sample_fmt
input sample format
Definition: swresample_internal.h:99
AV_CHANNEL_LAYOUT_7POINT0
#define AV_CHANNEL_LAYOUT_7POINT0
Definition: channel_layout.h:388
AV_CHANNEL_LAYOUT_2_1
#define AV_CHANNEL_LAYOUT_2_1
Definition: channel_layout.h:371
test
static int test(void)
Definition: dnn-layer-dense.c:28
channel_layout.h
rates
static const int rates[]
Definition: swresample.c:103
mode
mode
Definition: ebur128.h:83
shift
static void shift(uint8_t *a[], int index, int ch_count, enum AVSampleFormat f)
Definition: swresample.c:78
layouts
static const AVChannelLayout layouts[]
Definition: swresample.c:112
AV_SAMPLE_FMT_DBLP
@ AV_SAMPLE_FMT_DBLP
double, planar
Definition: samplefmt.h:67
samples
Filter the word “frame” indicates either a video frame or a group of audio samples
Definition: filter_design.txt:8
av_clip_uint8
#define av_clip_uint8
Definition: common.h:101
av_channel_layout_copy
int av_channel_layout_copy(AVChannelLayout *dst, const AVChannelLayout *src)
Make a copy of a channel layout.
Definition: channel_layout.c:639
av_get_alt_sample_fmt
enum AVSampleFormat av_get_alt_sample_fmt(enum AVSampleFormat sample_fmt, int planar)
Return the planar<->packed alternative form of the given sample format, or AV_SAMPLE_FMT_NONE on erro...
Definition: samplefmt.c:68
llrint
#define llrint(x)
Definition: libm.h:394
AV_CHANNEL_LAYOUT_MONO
#define AV_CHANNEL_LAYOUT_MONO
Definition: channel_layout.h:368
SwrContext::in
AudioData in
input audio data
Definition: swresample_internal.h:152
int32_t
int32_t
Definition: audioconvert.c:56
AV_CHANNEL_LAYOUT_5POINT1_BACK
#define AV_CHANNEL_LAYOUT_5POINT1_BACK
Definition: channel_layout.h:381
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
sse
static int sse(MpegEncContext *s, const uint8_t *src1, const uint8_t *src2, int w, int h, int stride)
Definition: mpegvideo_enc.c:2617
SWR_CH_MAX
#define SWR_CH_MAX
Definition: swresample.c:35
AV_CHANNEL_LAYOUT_5POINT0
#define AV_CHANNEL_LAYOUT_5POINT0
Definition: channel_layout.h:378
AV_SAMPLE_FMT_DBL
@ AV_SAMPLE_FMT_DBL
double
Definition: samplefmt.h:61
AV_CHANNEL_LAYOUT_5POINT1
#define AV_CHANNEL_LAYOUT_5POINT1
Definition: channel_layout.h:379
AV_SAMPLE_FMT_S32
@ AV_SAMPLE_FMT_S32
signed 32 bits
Definition: samplefmt.h:59
AV_SAMPLE_FMT_FLT
@ AV_SAMPLE_FMT_FLT
float
Definition: samplefmt.h:60
PUT_SAMPLE
#define PUT_SAMPLE