FFMPEG学习【libavcodec】:音频重采样

一、函数

废弃:使用 libswresample代替

attribute_deprecated 
ReSampleContext * 
av_audio_resample_init (int output_channels, int input_channels, int output_rate, int input_rate, enum AVSampleFormat sample_fmt_out, enum AVSampleFormat sample_fmt_in, int filter_length, int log2_phase_count, int linear, double cutoff)
初始化音频重采样上下文

参数:output_channels:输出通道数

  input_channels:输入通道数

  output_rate:输出采样率

  input_rate:输入采样率

  sample_fmt_out:请求输出示例格式

  sample_fmt_in:输入样品格式

  filter_length:滤波器组中每个FIR滤波器的长度相对于截止频率

  log2_phase_count:log2的多相滤波器组中的条目数

  linear:如果1,则所使用的FIR滤波器将在最接近的2之间进行线性内插,如果0将最接近使用

  cutoff:截止频率,1.0对应于输出采样率的一半

返回:分配的ReSampleContext,如果发生错误则为NULL


attribute_deprecated int  audio_resample (ReSampleContext *s, short *output, short *input, int nb_samples)

attribute_deprecated void  audio_resample_close (ReSampleContext *s)
自由重新采样上下文。

参数:s:前一个使用av_audio_resample_init()创建的重新抽样上下文的非NULL指针


attribute_deprecated struct 
AVResampleContext * 
av_resample_init (int out_rate, int in_rate, int filter_length, int log2_phase_count, int linear, double cutoff)
初始化音频重新采样器。

注意,如果任一速率不是一个整数,那么简单地将这两个速率缩放到一起就可以了。

参数:filter_length:滤波器组中每个FIR滤波器的长度相对于截止频率

  log2_phase_count:log2的多相滤波器组中的条目数

  linear:如果1,则所使用的FIR滤波器将在最接近的2之间被线性内插,如果0将被使用最接近的

  cutoff:截止频率,1.0对应于输出采样率的一半

  


attribute_deprecated int  av_resample (struct AVResampleContext *c, short *dst, short *srcint *consumed, int src_size, int dst_size, int update_ctx)
使用先前配置的上下文重新采样样本数组。

参数:src:一系列未消耗的样品

  consumed:已经在这里返回已经消耗的src的样本数

  src_size:未使用样品的数量

  dst_size:dst中可用样本的空间量

  update_ctx:如果这是0,那么上下文将不会被修改,这样几个通道可以用相同的上下文重新采样。

返回:如果发生错误,以dst或-1写入的样本数

  


attribute_deprecated void  av_resample_compensate (struct AVResampleContext *cint sample_delta, int compensation_distance)
补偿采样/时间戳漂移。

补偿通过更改重新采样器参数来完成,因此不会发生可听到的点击或类似的失真

参数:sample_delta:应在其上进行补偿的输出样本中的距离

  compensation_distance:应输出的输出样本数量较少

示例:av_resample_compensate(c,10,500)而不是510样本,只输出500个样本

注意,由于四舍五入,实际补偿可能略有不同,特别是如果补偿距离大,init中使用的in_rate小



attribute_deprecated void  av_resample_close (struct AVResampleContext *c)


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值