/*1* Copyright (c) 2012 Justin Ruggles <[email protected]>2*3* This file is part of FFmpeg.4*5* FFmpeg is free software; you can redistribute it and/or6* modify it under the terms of the GNU Lesser General Public7* License as published by the Free Software Foundation; either8* version 2.1 of the License, or (at your option) any later version.9*10* FFmpeg is distributed in the hope that it will be useful,11* but WITHOUT ANY WARRANTY; without even the implied warranty of12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU13* Lesser General Public License for more details.14*15* You should have received a copy of the GNU Lesser General Public16* License along with FFmpeg; if not, write to the Free Software17* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA18*/1920#ifndef AVRESAMPLE_INTERNAL_H21#define AVRESAMPLE_INTERNAL_H2223#include "libavutil/audio_fifo.h"24#include "libavutil/log.h"25#include "libavutil/opt.h"26#include "libavutil/samplefmt.h"27#include "avresample.h"2829typedef struct AudioData AudioData;30typedef struct AudioConvert AudioConvert;31typedef struct AudioMix AudioMix;32typedef struct ResampleContext ResampleContext;3334enum RemapPoint {35REMAP_NONE,36REMAP_IN_COPY,37REMAP_IN_CONVERT,38REMAP_OUT_COPY,39REMAP_OUT_CONVERT,40};4142typedef struct ChannelMapInfo {43int channel_map[AVRESAMPLE_MAX_CHANNELS]; /**< source index of each output channel, -1 if not remapped */44int do_remap; /**< remap needed */45int channel_copy[AVRESAMPLE_MAX_CHANNELS]; /**< dest index to copy from */46int do_copy; /**< copy needed */47int channel_zero[AVRESAMPLE_MAX_CHANNELS]; /**< dest index to zero */48int do_zero; /**< zeroing needed */49int input_map[AVRESAMPLE_MAX_CHANNELS]; /**< dest index of each input channel */50} ChannelMapInfo;5152struct AVAudioResampleContext {53const AVClass *av_class; /**< AVClass for logging and AVOptions */5455uint64_t in_channel_layout; /**< input channel layout */56enum AVSampleFormat in_sample_fmt; /**< input sample format */57int in_sample_rate; /**< input sample rate */58uint64_t out_channel_layout; /**< output channel layout */59enum AVSampleFormat out_sample_fmt; /**< output sample format */60int out_sample_rate; /**< output sample rate */61enum AVSampleFormat internal_sample_fmt; /**< internal sample format */62enum AVMixCoeffType mix_coeff_type; /**< mixing coefficient type */63double center_mix_level; /**< center mix level */64double surround_mix_level; /**< surround mix level */65double lfe_mix_level; /**< lfe mix level */66int normalize_mix_level; /**< enable mix level normalization */67int force_resampling; /**< force resampling */68int filter_size; /**< length of each FIR filter in the resampling filterbank relative to the cutoff frequency */69int phase_shift; /**< log2 of the number of entries in the resampling polyphase filterbank */70int linear_interp; /**< if 1 then the resampling FIR filter will be linearly interpolated */71double cutoff; /**< resampling cutoff frequency. 1.0 corresponds to half the output sample rate */72enum AVResampleFilterType filter_type; /**< resampling filter type */73int kaiser_beta; /**< beta value for Kaiser window (only applicable if filter_type == AV_FILTER_TYPE_KAISER) */74enum AVResampleDitherMethod dither_method; /**< dither method */7576int in_channels; /**< number of input channels */77int out_channels; /**< number of output channels */78int resample_channels; /**< number of channels used for resampling */79int downmix_needed; /**< downmixing is needed */80int upmix_needed; /**< upmixing is needed */81int mixing_needed; /**< either upmixing or downmixing is needed */82int resample_needed; /**< resampling is needed */83int in_convert_needed; /**< input sample format conversion is needed */84int out_convert_needed; /**< output sample format conversion is needed */85int in_copy_needed; /**< input data copy is needed */8687AudioData *in_buffer; /**< buffer for converted input */88AudioData *resample_out_buffer; /**< buffer for output from resampler */89AudioData *out_buffer; /**< buffer for converted output */90AVAudioFifo *out_fifo; /**< FIFO for output samples */9192AudioConvert *ac_in; /**< input sample format conversion context */93AudioConvert *ac_out; /**< output sample format conversion context */94ResampleContext *resample; /**< resampling context */95AudioMix *am; /**< channel mixing context */96enum AVMatrixEncoding matrix_encoding; /**< matrixed stereo encoding */9798/**99* mix matrix100* only used if avresample_set_matrix() is called before avresample_open()101*/102double *mix_matrix;103104int use_channel_map;105enum RemapPoint remap_point;106ChannelMapInfo ch_map_info;107};108109110void ff_audio_resample_init_aarch64(ResampleContext *c,111enum AVSampleFormat sample_fmt);112void ff_audio_resample_init_arm(ResampleContext *c,113enum AVSampleFormat sample_fmt);114115#endif /* AVRESAMPLE_INTERNAL_H */116117118