21 #ifndef AVRESAMPLE_AVRESAMPLE_H 22 #define AVRESAMPLE_AVRESAMPLE_H 104 #define AVRESAMPLE_MAX_CHANNELS 32 367 const int *channel_map);
387 int compensation_distance);
452 int out_plane_size,
int out_samples,
453 uint8_t *
const *input,
int in_plane_size,
AV_RESAMPLE_DITHER_TRIANGULAR_HP
Triangular Dither with High Pass.
attribute_deprecated const char * avresample_license(void)
attribute_deprecated int avresample_set_matrix(AVAudioResampleContext *avr, const double *matrix, int stride)
attribute_deprecated int avresample_set_compensation(AVAudioResampleContext *avr, int sample_delta, int compensation_distance)
This structure describes decoded (raw) audio or video data.
attribute_deprecated int avresample_open(AVAudioResampleContext *avr)
attribute_deprecated int avresample_read(AVAudioResampleContext *avr, uint8_t **output, int nb_samples)
attribute_deprecated int avresample_get_delay(AVAudioResampleContext *avr)
enum attribute_deprecated AVResampleFilterType
attribute_deprecated int avresample_convert(AVAudioResampleContext *avr, uint8_t **output, int out_plane_size, int out_samples, uint8_t *const *input, int in_plane_size, int in_samples)
Convenience header that includes libavutil's core.
enum attribute_deprecated AVMixCoeffType
attribute_deprecated int avresample_convert_frame(AVAudioResampleContext *avr, AVFrame *output, AVFrame *input)
double surround_mix_level
surround mix level
attribute_deprecated int avresample_get_out_samples(AVAudioResampleContext *avr, int in_nb_samples)
AV_MIX_COEFF_TYPE_NB
floating-point
attribute_deprecated void avresample_close(AVAudioResampleContext *avr)
AV_RESAMPLE_DITHER_NONE
Do not use dithering.
AV_RESAMPLE_DITHER_TRIANGULAR_NS
Triangular Dither with Noise Shaping.
double center_mix_level
center mix level
attribute_deprecated int avresample_config(AVAudioResampleContext *avr, AVFrame *out, AVFrame *in)
AV_RESAMPLE_FILTER_TYPE_BLACKMAN_NUTTALL
Blackman Nuttall Windowed Sinc.
attribute_deprecated int avresample_available(AVAudioResampleContext *avr)
reference-counted frame API
AV_RESAMPLE_DITHER_NB
Number of dither types.
attribute_deprecated int avresample_get_matrix(AVAudioResampleContext *avr, double *matrix, int stride)
audio channel layout utility functions
attribute_deprecated const char * avresample_configuration(void)
attribute_deprecated unsigned avresample_version(void)
attribute_deprecated const AVClass * avresample_get_class(void)
attribute_deprecated int avresample_is_open(AVAudioResampleContext *avr)
attribute_deprecated int avresample_build_matrix(uint64_t in_layout, uint64_t out_layout, double center_mix_level, double surround_mix_level, double lfe_mix_level, int normalize, double *matrix, int stride, enum AVMatrixEncoding matrix_encoding)
attribute_deprecated int avresample_set_channel_mapping(AVAudioResampleContext *avr, const int *channel_map)
enum attribute_deprecated AVResampleDitherMethod
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)\", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> in
Describe the class of an AVClass context structure.
AV_RESAMPLE_FILTER_TYPE_CUBIC
Cubic.
attribute_deprecated AVAudioResampleContext * avresample_alloc_context(void)
enum AVMatrixEncoding matrix_encoding
matrixed stereo encoding
AV_RESAMPLE_DITHER_RECTANGULAR
Rectangular Dither.
attribute_deprecated void avresample_free(AVAudioResampleContext **avr)
AV_RESAMPLE_FILTER_TYPE_KAISER
Kaiser Windowed Sinc.
#define attribute_deprecated
AV_MIX_COEFF_TYPE_FLT
32-bit 17.15 fixed-point
AV_RESAMPLE_DITHER_TRIANGULAR
Triangular Dither.
Libavresample version macros.
AV_MIX_COEFF_TYPE_Q15
16-bit 8.8 fixed-point
double lfe_mix_level
lfe mix level