Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
aca516cd
F
Ffmpeg
项目概览
小白菜888
/
Ffmpeg
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
Ffmpeg
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
aca516cd
编写于
9月 03, 2008
作者:
V
Vladimir Voroshilov
提交者:
Michael Niedermayer
9月 24, 2011
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
G.729 postfilter
上级
16bbb8df
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
683 addition
and
1 deletion
+683
-1
libavcodec/Makefile
libavcodec/Makefile
+1
-1
libavcodec/g729dec.c
libavcodec/g729dec.c
+25
-0
libavcodec/g729postfilter.c
libavcodec/g729postfilter.c
+562
-0
libavcodec/g729postfilter.h
libavcodec/g729postfilter.h
+95
-0
未找到文件。
libavcodec/Makefile
浏览文件 @
aca516cd
...
...
@@ -159,7 +159,7 @@ OBJS-$(CONFIG_FLIC_DECODER) += flicvideo.o
OBJS-$(CONFIG_FOURXM_DECODER)
+=
4xm.o
OBJS-$(CONFIG_FRAPS_DECODER)
+=
fraps.o
OBJS-$(CONFIG_FRWU_DECODER)
+=
frwu.o
OBJS-$(CONFIG_G729_DECODER)
+=
g729dec.o lsp.o celp_math.o acelp_filters.o acelp_pitch_delay.o acelp_vectors.o
OBJS-$(CONFIG_G729_DECODER)
+=
g729dec.o lsp.o celp_math.o acelp_filters.o acelp_pitch_delay.o acelp_vectors.o
g729postfilter.o
OBJS-$(CONFIG_GIF_DECODER)
+=
gifdec.o lzw.o
OBJS-$(CONFIG_GIF_ENCODER)
+=
gif.o lzwenc.o
OBJS-$(CONFIG_GSM_DECODER)
+=
gsmdec.o gsmdec_data.o msgsmdec.o
...
...
libavcodec/g729dec.c
浏览文件 @
aca516cd
...
...
@@ -39,6 +39,7 @@
#include "acelp_pitch_delay.h"
#include "acelp_vectors.h"
#include "g729data.h"
#include "g729postfilter.h"
/**
* minimum quantized LSF value (3.2.4)
...
...
@@ -122,6 +123,16 @@ typedef struct {
/// previous speech data for LP synthesis filter
int16_t
syn_filter_data
[
10
];
/// residual signal buffer (used in long-term postfilter)
int16_t
residual
[
SUBFRAME_SIZE
+
RES_PREV_DATA_SIZE
];
/// previous speech data for residual calculation filter
int16_t
res_filter_data
[
SUBFRAME_SIZE
+
10
];
/// previous speech data for short-term postfilter
int16_t
pos_filter_data
[
SUBFRAME_SIZE
+
10
];
/// (1.14) pitch gain of current and five previous subframes
int16_t
past_gain_pitch
[
6
];
...
...
@@ -133,6 +144,7 @@ typedef struct {
int16_t
onset
;
///< detected onset level (0-2)
int16_t
was_periodic
;
///< whether previous frame was declared as periodic or not (4.4)
int16_t
ht_prev_data
;
///< previous data for 4.2.3, equation 86
uint16_t
rand_value
;
///< random number generator value (4.4.4)
int
ma_predictor_prev
;
///< switched MA predictor of LSP quantizer from last good frame
...
...
@@ -625,6 +637,19 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
/* Save data (without postfilter) for use in next subframe. */
memcpy
(
ctx
->
syn_filter_data
,
synth
+
SUBFRAME_SIZE
,
10
*
sizeof
(
int16_t
));
/* Call postfilter and also update voicing decision for use in next frame. */
g729_postfilter
(
&
ctx
->
dsp
,
&
ctx
->
ht_prev_data
,
&
is_periodic
,
&
lp
[
i
][
0
],
pitch_delay_int
[
0
],
ctx
->
residual
,
ctx
->
res_filter_data
,
ctx
->
pos_filter_data
,
synth
+
10
,
SUBFRAME_SIZE
);
if
(
frame_erasure
)
ctx
->
pitch_delay_int_prev
=
FFMIN
(
ctx
->
pitch_delay_int_prev
+
1
,
PITCH_DELAY_MAX
);
else
...
...
libavcodec/g729postfilter.c
0 → 100644
浏览文件 @
aca516cd
此差异已折叠。
点击以展开。
libavcodec/g729postfilter.h
0 → 100644
浏览文件 @
aca516cd
/*
* G.729, G729 Annex D postfilter
* Copyright (c) 2008 Vladimir Voroshilov
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef FFMPEG_G729POSTFILTER_H
#define FFMPEG_G729POSTFILTER_H
#include <stdint.h>
/**
* tilt compensation factor (G.729, k1>0)
* 0.2 in Q15
*/
#define G729_TILT_FACTOR_PLUS 6554
/**
* tilt compensation factor (G.729, k1<0)
* 0.9 in Q15
*/
#define G729_TILT_FACTOR_MINUS 29491
/* 4.2.2 */
#define FORMANT_PP_FACTOR_NUM 18022 //0.55 in Q15
#define FORMANT_PP_FACTOR_DEN 22938 //0.70 in Q15
/**
* 1.0 / (1.0 + 0.5) in Q15
* where 0.5 is the minimum value of
* weight factor, controlling amount of long-term postfiltering
*/
#define MIN_LT_FILT_FACTOR_A 21845
/**
* Short interpolation filter length
*/
#define SHORT_INT_FILT_LEN 2
/**
* Long interpolation filter length
*/
#define LONG_INT_FILT_LEN 8
/**
* Number of analyzed fractional pitch delays in second stage of long-term
* postfilter
*/
#define ANALYZED_FRAC_DELAYS 7
/**
* Amount of past residual signal data stored in buffer
*/
#define RES_PREV_DATA_SIZE (PITCH_DELAY_MAX + LONG_INT_FILT_LEN + 1)
/**
* \brief Signal postfiltering (4.2)
* \param dsp initialized DSP context
* \param ht_prev_data [in/out] (Q12) pointer to variable receiving tilt
* compensation filter data from previous subframe
* \param voicing [in/out] (Q0) pointer to variable receiving voicing decision
* \param lp_filter_coeffs (Q12) LP filter coefficients
* \param pitch_delay_int integer part of the pitch delay
* \param residual [in/out] (Q0) residual signal buffer (used in long-term postfilter)
* \param res_filter_data [in/out] (Q0) speech data of previous subframe
* \param pos_filter_data [in/out] (Q0) previous speech data for short-term postfilter
* \param speech [in/out] (Q0) signal buffer
* \param subframe_size size of subframe
*
* Filtering has the following stages:
* Long-term postfilter (4.2.1)
* Short-term postfilter (4.2.2).
* Tilt-compensation (4.2.3)
*/
void
g729_postfilter
(
DSPContext
*
dsp
,
int16_t
*
ht_prev_data
,
int16_t
*
voicing
,
const
int16_t
*
lp_filter_coeffs
,
int
pitch_delay_int
,
int16_t
*
residual
,
int16_t
*
res_filter_data
,
int16_t
*
pos_filter_data
,
int16_t
*
speech
,
int
subframe_size
);
#endif // FFMPEG_G729POSTFILTER_H
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录