40 #define FREQUENCY_DOMAIN 1 
  105     nc_close(sofa->
ncid);
 
  115     int ncid, n_dims, n_vars, n_gatts, n_unlim_dim_id, status;
 
  116     char data_delay_dim_name[NC_MAX_NAME];
 
  117     float *sp_a, *sp_e, *sp_r, *
data_ir;
 
  118     char *sofa_conventions;
 
  119     char dim_name[NC_MAX_NAME];   
 
  123     int data_delay_dim_id[2];
 
  137     status = nc_open(filename, NC_NOWRITE, &ncid); 
 
  138     if (status != NC_NOERR) {
 
  144     nc_inq(ncid, &n_dims, &n_vars, &n_gatts, &n_unlim_dim_id);
 
  153     for (i = 0; i < n_dims; i++) { 
 
  154         nc_inq_dim(ncid, i, (
char *)&dim_name, &dim_length[i]); 
 
  155         if (!strncmp(
"M", (
const char *)&dim_name, 1)) 
 
  157         if (!strncmp(
"N", (
const char *)&dim_name, 1)) 
 
  161     if ((m_dim_id == -1) || (n_dim_id == -1)) { 
 
  168     n_samples = dim_length[n_dim_id]; 
 
  169     m_dim     = dim_length[m_dim_id]; 
 
  175     status = nc_inq_attlen(ncid, NC_GLOBAL, 
"Conventions", &att_len);
 
  176     if (status != NC_NOERR) {
 
  189     nc_get_att_text(ncid, NC_GLOBAL, 
"Conventions", text);
 
  190     *(text + att_len) = 0;
 
  191     if (strncmp(
"SOFA", text, 4)) {
 
  199     status = nc_inq_attlen(ncid, NC_GLOBAL, 
"License", &att_len);
 
  200     if (status == NC_NOERR) {
 
  203             nc_get_att_text(ncid, NC_GLOBAL, 
"License", text);
 
  204             *(text + att_len) = 0;
 
  210     status = nc_inq_attlen(ncid, NC_GLOBAL, 
"SourceDescription", &att_len);
 
  211     if (status == NC_NOERR) {
 
  214             nc_get_att_text(ncid, NC_GLOBAL, 
"SourceDescription", text);
 
  215             *(text + att_len) = 0;
 
  221     status = nc_inq_attlen(ncid, NC_GLOBAL, 
"Comment", &att_len);
 
  222     if (status == NC_NOERR) {
 
  225             nc_get_att_text(ncid, NC_GLOBAL, 
"Comment", text);
 
  226             *(text + att_len) = 0;
 
  232     status = nc_inq_attlen(ncid, NC_GLOBAL, 
"SOFAConventions", &att_len);
 
  233     if (status != NC_NOERR) {
 
  239     sofa_conventions = 
av_malloc(att_len + 1);
 
  240     if (!sofa_conventions) {
 
  245     nc_get_att_text(ncid, NC_GLOBAL, 
"SOFAConventions", sofa_conventions);
 
  246     *(sofa_conventions + att_len) = 0;
 
  247     if (strncmp(
"SimpleFreeFieldHRIR", sofa_conventions, att_len)) {
 
  257     status  = nc_inq_varid(ncid, 
"Data.SamplingRate", &samplingrate_id);
 
  258     status += nc_get_var_uint(ncid, samplingrate_id, &sample_rate);
 
  259     if (status != NC_NOERR) {
 
  274     if (!data_delay || !sp_a || !sp_e || !sp_r || !data_ir) {
 
  282     status = nc_inq_varid(ncid, 
"Data.IR", &data_ir_id);
 
  283     status += nc_get_var_float(ncid, data_ir_id, data_ir); 
 
  284     if (status != NC_NOERR) {
 
  291     status  = nc_inq_varid(ncid, 
"SourcePosition", &sp_id); 
 
  292     status += nc_get_vara_float(ncid, sp_id, (
size_t[2]){ 0, 0 } ,
 
  293                 (
size_t[2]){ m_dim, 1}, sp_a); 
 
  294     status += nc_get_vara_float(ncid, sp_id, (
size_t[2]){ 0, 1 } ,
 
  295                 (
size_t[2]){ m_dim, 1}, sp_e); 
 
  296     status += nc_get_vara_float(ncid, sp_id, (
size_t[2]){ 0, 2 } ,
 
  297                 (
size_t[2]){ m_dim, 1}, sp_r); 
 
  298     if (status != NC_NOERR) { 
 
  305     status  = nc_inq_varid(ncid, 
"Data.Delay", &data_delay_id);
 
  306     status += nc_inq_vardimid(ncid, data_delay_id, &data_delay_dim_id[0]);
 
  307     status += nc_inq_dimname(ncid, data_delay_dim_id[0], data_delay_dim_name);
 
  308     if (status != NC_NOERR) {
 
  316     if (!strncmp(data_delay_dim_name, 
"I", 2)) {
 
  321         status = nc_get_var_int(ncid, data_delay_id, &delay[0]);
 
  322         if (status != NC_NOERR) {
 
  327         int *data_delay_r = data_delay + m_dim;
 
  328         for (i = 0; i < m_dim; i++) { 
 
  330             data_delay[i]   = delay[0];
 
  331             data_delay_r[i] = delay[1];
 
  334     } 
else if (!strncmp(data_delay_dim_name, 
"M", 2)) {
 
  337         status = nc_get_var_int(ncid, data_delay_id, data_delay);
 
  338         if (status != NC_NOERR) {
 
  344         av_log(ctx, 
AV_LOG_ERROR, 
"Data.Delay does not have the required dimensions [I R] or [M R].\n");
 
  367     float azim[16] = { 0 };
 
  368     float elev[16] = { 0 };
 
  377     for (m = 0, ch = 0; ch < n_conv && m < 64; m++) {
 
  378         uint64_t 
mask = channels_layout & (1 << 
m);
 
  394                                           elev[ch] =  90;      
break;
 
  396                                           elev[ch] =  45;      
break;
 
  398                                           elev[ch] =  45;      
break;
 
  400                                           elev[ch] =  45;      
break;
 
  402                                           elev[ch] =  45;      
break;
 
  404                                           elev[ch] =  45;      
break;
 
  406                                           elev[ch] =  45;      
break;
 
  421     memcpy(speaker_azim, azim, n_conv * 
sizeof(
float));
 
  422     memcpy(speaker_elev, elev, n_conv * 
sizeof(
float));
 
  432     for (i = 0; i < sofa->
m_dim * 2; i++) {
 
  452     for (i = 0; i < m_dim; i++) {
 
  455         current = fabs(sp_a[i] - azim) +
 
  456                   fabs(sp_e[i] - elev) +
 
  457                   fabs(sp_r[i] - radius);
 
  458         if (current <= delta) {
 
  487         compensate = 256 / (sofa->
n_samples * sqrt(energy));
 
  515     int *write = &td->
write[jobnr];
 
  516     const int *
const delay = td->
delay[jobnr];
 
  517     const float *
const ir = td->
ir[jobnr];
 
  520     float *temp_src = td->
temp_src[jobnr];
 
  522     const float *
src = (
const float *)in->
data[0]; 
 
  523     float *dst = (
float *)
out->data[0]; 
 
  524     const int in_channels = s->
n_conv; 
 
  528     const uint32_t modulo = (uint32_t)buffer_length - 1;
 
  535     for (l = 0; l < in_channels; l++) {
 
  537         buffer[l] = ringbuffer + l * buffer_length;
 
  541         const float *temp_ir = ir; 
 
  544         for (l = 0; l < in_channels; l++) {
 
  546             *(buffer[l] + wr) = src[l];
 
  550         for (l = 0; l < in_channels; l++) {
 
  551             const float *
const bptr = buffer[l];
 
  557                 temp_ir += n_samples;
 
  564             read = (wr - *(delay + l) - (n_samples - 1) + buffer_length) & modulo;
 
  566             if (read + n_samples < buffer_length) {
 
  567                 memcpy(temp_src, bptr + read, n_samples * 
sizeof(*temp_src));
 
  569                 int len = 
FFMIN(n_samples - (read % n_samples), buffer_length - read);
 
  571                 memcpy(temp_src, bptr + read, len * 
sizeof(*temp_src));
 
  572                 memcpy(temp_src + len, bptr, (n_samples - len) * 
sizeof(*temp_src));
 
  577             temp_ir += n_samples;
 
  587         wr   = (wr + 1) & modulo; 
 
  601     int *write = &td->
write[jobnr];
 
  606     const float *
src = (
const float *)in->
data[0]; 
 
  607     float *dst = (
float *)
out->data[0]; 
 
  608     const int in_channels = s->
n_conv; 
 
  612     const uint32_t modulo = (uint32_t)buffer_length - 1;
 
  616     const int n_conv = s->
n_conv;
 
  617     const int n_fft = s->
n_fft;
 
  627     for (j = 0; j < n_read; j++) {
 
  629         dst[2 * j]     = ringbuffer[wr];
 
  630         ringbuffer[wr] = 0.0; 
 
  632         wr  = (wr + 1) & modulo;
 
  640     for (i = 0; i < n_conv; i++) {
 
  644                 dst[2 * j] += src[i + j * in_channels] * s->
gain_lfe;
 
  653         memset(fft_in, 0, 
sizeof(
FFTComplex) * n_fft);
 
  658             fft_in[j].
re = src[j * in_channels + i];
 
  664         for (j = 0; j < n_fft; j++) {
 
  665             const float re = fft_in[j].
re;
 
  666             const float im = fft_in[j].
im;
 
  670             fft_in[j].
re = re * (hrtf + offset + j)->re - im * (hrtf + offset + j)->im;
 
  672             fft_in[j].
im = re * (hrtf + offset + j)->im + im * (hrtf + offset + j)->re;
 
  681             dst[2 * j] += fft_in[j].
re / (float)n_fft;
 
  684         for (j = 0; j < n_samples - 1; j++) { 
 
  686             int write_pos = (wr + j) & modulo;
 
  688             *(ringbuffer + write_pos) += fft_in[in->
nb_samples + j].
re / (
float)n_fft;
 
  693     for (i = 0; i < 
out->nb_samples; i++) {
 
  695         if (fabs(*dst) > 1) { 
 
  696             *n_clippings = *n_clippings + 1;
 
  714     int n_clippings[2] = { 0 };
 
  738     if (n_clippings[0] + n_clippings[1] > 0) {
 
  740                n_clippings[0] + n_clippings[1], out->
nb_samples * 2);
 
  794     float gain_lin = 
expf((s->
gain - 3 * nb_input_channels) / 20 * 
M_LN10); 
 
  799     float *data_ir_l = 
NULL;
 
  800     float *data_ir_r = 
NULL;
 
  803     int i, j, azim_orig = azim, elev_orig = elev;
 
  806         av_log(ctx, 
AV_LOG_ERROR, 
"Selected SOFA file is invalid. Please select valid SOFA file.\n");
 
  826         if (!data_hrtf_r || !data_hrtf_l) {
 
  833     for (i = 0; i < s->
n_conv; i++) {
 
  838         m[i] = 
find_m(s, azim, elev, radius);
 
  845             offset = i * n_samples; 
 
  846             for (j = 0; j < n_samples; j++) {
 
  849                 *(data_ir_l + offset + j) = 
 
  850                 *(s->
sofa.
data_ir + 2 * m[i] * n_samples + n_samples - 1 - j) * gain_lin;
 
  851                 *(data_ir_r + offset + j) = 
 
  852                 *(s->
sofa.
data_ir + 2 * m[i] * n_samples + n_samples - 1 - j  + n_samples) * gain_lin;
 
  855             fft_in_l = 
av_calloc(n_fft, 
sizeof(*fft_in_l));
 
  856             fft_in_r = 
av_calloc(n_fft, 
sizeof(*fft_in_r));
 
  857             if (!fft_in_l || !fft_in_r) {
 
  866             for (j = 0; j < n_samples; j++) {
 
  871                 fft_in_l[delay_l[i] + j].
re = 
 
  872                 *(s->
sofa.
data_ir + 2 * m[i] * n_samples + j) * gain_lin;
 
  873                 fft_in_r[delay_r[i] + j].
re = 
 
  874                 *(s->
sofa.
data_ir + (2 * m[i] + 1) * n_samples + j) * gain_lin;
 
  880             memcpy(data_hrtf_l + offset, fft_in_l, n_fft * 
sizeof(*fft_in_l));
 
  883             memcpy(data_hrtf_r + offset, fft_in_r, n_fft * 
sizeof(*fft_in_r));
 
  886         av_log(ctx, 
AV_LOG_DEBUG, 
"Index: %d, Azimuth: %f, Elevation: %f, Radius: %f of SOFA file.\n",
 
  892         memcpy(s->
data_ir[0], data_ir_l, 
sizeof(
float) * n_conv * n_samples);
 
  893         memcpy(s->
data_ir[1], data_ir_r, 
sizeof(
float) * n_conv * n_samples);
 
  920     memcpy(s->
delay[0], &delay_l[0], 
sizeof(
int) * s->
n_conv);
 
  921     memcpy(s->
delay[1], &delay_r[0], 
sizeof(
int) * s->
n_conv);
 
  945         av_log(ctx, 
AV_LOG_ERROR, 
"No valid SOFA file could be loaded. Please specify valid SOFA file.\n");
 
  960     int nb_input_channels = inlink->
channels; 
 
  975     s->
n_conv = nb_input_channels;
 
  980     if (n_current > n_max) {
 
 1044         av_log(ctx, 
AV_LOG_ERROR, 
"Couldn't get speaker positions. Input channel configuration not supported.\n");
 
 1052     av_log(ctx, 
AV_LOG_DEBUG, 
"Samplerate: %d Channels to convolute: %d, Length of ringbuffer: %d x %d\n",
 
 1090 #define OFFSET(x) offsetof(SOFAlizerContext, x) 
 1091 #define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM 
 1126     .
name          = 
"sofalizer",
 
 1129     .priv_class    = &sofalizer_class,
 
static int sofalizer_fast_convolute(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
FFTComplex * data_hrtf[2]
#define AVERROR_INVALIDDATA
Invalid data found when processing input. 
This structure describes decoded (raw) audio or video data. 
#define AV_CH_TOP_FRONT_RIGHT
av_cold void av_fft_end(FFTContext *s)
#define AV_LOG_WARNING
Something somehow does not look correct. 
Main libavfilter public API header. 
AVFILTER_DEFINE_CLASS(sofalizer)
int max_samples
Maximum number of samples to filter at once. 
#define AV_CH_TOP_FRONT_LEFT
#define AV_CH_TOP_FRONT_CENTER
#define AV_CH_LOW_FREQUENCY_2
float(* scalarproduct_float)(const float *v1, const float *v2, int len)
Calculate the scalar product of two vectors of floats. 
void av_fft_permute(FFTContext *s, FFTComplex *z)
Do the permutation needed BEFORE calling ff_fft_calc(). 
static enum AVSampleFormat formats[]
#define AV_CH_SURROUND_DIRECT_RIGHT
#define AV_CH_LAYOUT_STEREO
struct AVFilterChannelLayouts * in_channel_layouts
const char * name
Pad name. 
AVFilterLink ** inputs
array of pointers to input links 
float avpriv_scalarproduct_float_c(const float *v1, const float *v2, int len)
Return the scalar product of two vectors. 
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter. 
#define AV_CH_TOP_BACK_LEFT
#define AV_CH_TOP_BACK_CENTER
#define AV_CH_LOW_FREQUENCY
static int find_m(SOFAlizerContext *s, int azim, int elev, float radius)
A filter pad used for either input or output. 
A link between two filters. 
static int load_data(AVFilterContext *ctx, int azim, int elev, float radius)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered. 
int min_samples
Minimum number of samples to filter at once. 
int sample_rate
samples per second 
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions. 
static const uint16_t mask[17]
static int get_speaker_pos(AVFilterContext *ctx, float *speaker_azim, float *speaker_elev)
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g. 
static int query_formats(AVFilterContext *ctx)
static int close_sofa(struct NCSofa *sofa)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void * priv
private data for use by the filter 
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers. 
struct AVFilterChannelLayouts * out_channel_layouts
FFTContext * av_fft_init(int nbits, int inverse)
Set up a complex FFT. 
static const uint8_t offset[127][2]
static int max_delay(struct NCSofa *sofa)
static const int sample_rates[]
#define AV_CH_STEREO_RIGHT
See AV_CH_STEREO_LEFT. 
void(* vector_fmul_scalar)(float *dst, const float *src, float mul, int len)
Multiply a vector of floats by a scalar float. 
#define AV_CH_FRONT_LEFT_OF_CENTER
int partial_buf_size
Size of the partial buffer to allocate. 
#define AV_CH_FRONT_CENTER
static int load_sofa(AVFilterContext *ctx, char *filename, int *samplingrate)
static const AVFilterPad outputs[]
#define AV_CH_FRONT_RIGHT_OF_CENTER
A list of supported channel layouts. 
static const AVOption sofalizer_options[]
#define AV_LOG_INFO
Standard information. 
static int config_input(AVFilterLink *inlink)
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;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);returnNULL;}returnac;}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;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->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);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> in
#define AV_CH_TOP_BACK_RIGHT
Describe the class of an AVClass context structure. 
const char * name
Filter name. 
av_cold AVFloatDSPContext * avpriv_float_dsp_alloc(int bit_exact)
Allocate a float DSP context. 
static const AVFilterPad inputs[]
AVFilterLink ** outputs
array of pointers to output links 
enum MovChannelLayoutTag * layouts
void * av_calloc(size_t nmemb, size_t size)
Allocate a block of nmemb * size bytes with alignment suitable for all memory accesses (including vec...
AVFilterInternal * internal
An opaque struct for libavfilter internal use. 
#define AV_CH_BACK_CENTER
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes. 
static int sofalizer_convolute(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static void fft(const int32_t in[2 *256], cplx32 out[256])
uint64_t channel_layout
channel layout of current buffer (see libavutil/channel_layout.h) 
int channels
Number of channels. 
avfilter_execute_func * execute
static av_cold int init(AVFilterContext *ctx)
AVFilterContext * dst
dest filter 
#define AV_CH_SURROUND_DIRECT_LEFT
#define AV_CH_FRONT_RIGHT
static int compensate_volume(AVFilterContext *ctx)
#define av_malloc_array(a, b)
static av_cold void uninit(AVFilterContext *ctx)
void av_fft_calc(FFTContext *s, FFTComplex *z)
Do a complex FFT with the parameters defined in av_fft_init(). 
int nb_samples
number of audio samples (per channel) described by this frame 
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst. 
#define AV_CH_STEREO_LEFT
Stereo downmix.