Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
99477adc
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,发现更多精彩内容 >>
提交
99477adc
编写于
6月 13, 2011
作者:
J
Justin Ruggles
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ac3enc: fix allocation of floating point samples.
sizeof(SampleType) is different for fixed and float encoders.
上级
35bdaf3d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
32 addition
and
9 deletion
+32
-9
libavcodec/ac3enc.c
libavcodec/ac3enc.c
+7
-9
libavcodec/ac3enc.h
libavcodec/ac3enc.h
+5
-0
libavcodec/ac3enc_template.c
libavcodec/ac3enc_template.c
+20
-0
未找到文件。
libavcodec/ac3enc.c
浏览文件 @
99477adc
...
...
@@ -2215,15 +2215,9 @@ static av_cold int allocate_buffers(AVCodecContext *avctx)
AC3EncodeContext
*
s
=
avctx
->
priv_data
;
int
channels
=
s
->
channels
+
1
;
/* includes coupling channel */
FF_ALLOC_OR_GOTO
(
avctx
,
s
->
windowed_samples
,
AC3_WINDOW_SIZE
*
sizeof
(
*
s
->
windowed_samples
),
alloc_fail
);
FF_ALLOC_OR_GOTO
(
avctx
,
s
->
planar_samples
,
s
->
channels
*
sizeof
(
*
s
->
planar_samples
),
alloc_fail
);
for
(
ch
=
0
;
ch
<
s
->
channels
;
ch
++
)
{
FF_ALLOCZ_OR_GOTO
(
avctx
,
s
->
planar_samples
[
ch
],
(
AC3_FRAME_SIZE
+
AC3_BLOCK_SIZE
)
*
sizeof
(
**
s
->
planar_samples
),
alloc_fail
);
}
if
(
s
->
allocate_sample_buffers
(
s
))
goto
alloc_fail
;
FF_ALLOC_OR_GOTO
(
avctx
,
s
->
bap_buffer
,
AC3_MAX_BLOCKS
*
channels
*
AC3_MAX_COEFS
*
sizeof
(
*
s
->
bap_buffer
),
alloc_fail
);
FF_ALLOC_OR_GOTO
(
avctx
,
s
->
bap1_buffer
,
AC3_MAX_BLOCKS
*
channels
*
...
...
@@ -2323,6 +2317,8 @@ av_cold int ff_ac3_encode_init(AVCodecContext *avctx)
AC3EncodeContext
*
s
=
avctx
->
priv_data
;
int
ret
,
frame_size_58
;
s
->
avctx
=
avctx
;
s
->
eac3
=
avctx
->
codec_id
==
CODEC_ID_EAC3
;
avctx
->
frame_size
=
AC3_FRAME_SIZE
;
...
...
@@ -2355,6 +2351,7 @@ av_cold int ff_ac3_encode_init(AVCodecContext *avctx)
s
->
apply_window
=
ff_ac3_fixed_apply_window
;
s
->
normalize_samples
=
ff_ac3_fixed_normalize_samples
;
s
->
scale_coefficients
=
ff_ac3_fixed_scale_coefficients
;
s
->
allocate_sample_buffers
=
ff_ac3_fixed_allocate_sample_buffers
;
s
->
deinterleave_input_samples
=
ff_ac3_fixed_deinterleave_input_samples
;
s
->
apply_mdct
=
ff_ac3_fixed_apply_mdct
;
s
->
apply_channel_coupling
=
ff_ac3_fixed_apply_channel_coupling
;
...
...
@@ -2364,6 +2361,7 @@ av_cold int ff_ac3_encode_init(AVCodecContext *avctx)
s
->
mdct_init
=
ff_ac3_float_mdct_init
;
s
->
apply_window
=
ff_ac3_float_apply_window
;
s
->
scale_coefficients
=
ff_ac3_float_scale_coefficients
;
s
->
allocate_sample_buffers
=
ff_ac3_float_allocate_sample_buffers
;
s
->
deinterleave_input_samples
=
ff_ac3_float_deinterleave_input_samples
;
s
->
apply_mdct
=
ff_ac3_float_apply_mdct
;
s
->
apply_channel_coupling
=
ff_ac3_float_apply_channel_coupling
;
...
...
libavcodec/ac3enc.h
浏览文件 @
99477adc
...
...
@@ -135,6 +135,7 @@ typedef struct AC3Block {
typedef
struct
AC3EncodeContext
{
AVClass
*
av_class
;
///< AVClass used for AVOption
AC3EncOptions
options
;
///< encoding options
AVCodecContext
*
avctx
;
///< parent AVCodecContext
PutBitContext
pb
;
///< bitstream writer context
DSPContext
dsp
;
AC3DSPContext
ac3dsp
;
///< AC-3 optimized functions
...
...
@@ -230,6 +231,7 @@ typedef struct AC3EncodeContext {
void
(
*
scale_coefficients
)(
struct
AC3EncodeContext
*
s
);
/* fixed vs. float templated function pointers */
int
(
*
allocate_sample_buffers
)(
struct
AC3EncodeContext
*
s
);
void
(
*
deinterleave_input_samples
)(
struct
AC3EncodeContext
*
s
,
const
SampleType
*
samples
);
void
(
*
apply_mdct
)(
struct
AC3EncodeContext
*
s
);
...
...
@@ -276,6 +278,9 @@ void ff_ac3_float_scale_coefficients(AC3EncodeContext *s);
/* prototypes for functions in ac3enc_template.c */
int
ff_ac3_fixed_allocate_sample_buffers
(
AC3EncodeContext
*
s
);
int
ff_ac3_float_allocate_sample_buffers
(
AC3EncodeContext
*
s
);
void
ff_ac3_fixed_deinterleave_input_samples
(
AC3EncodeContext
*
s
,
const
SampleType
*
samples
);
void
ff_ac3_float_deinterleave_input_samples
(
AC3EncodeContext
*
s
,
...
...
libavcodec/ac3enc_template.c
浏览文件 @
99477adc
...
...
@@ -31,6 +31,26 @@
#include "ac3enc.h"
int
AC3_NAME
(
allocate_sample_buffers
)(
AC3EncodeContext
*
s
)
{
int
ch
;
FF_ALLOC_OR_GOTO
(
s
->
avctx
,
s
->
windowed_samples
,
AC3_WINDOW_SIZE
*
sizeof
(
*
s
->
windowed_samples
),
alloc_fail
);
FF_ALLOC_OR_GOTO
(
s
->
avctx
,
s
->
planar_samples
,
s
->
channels
*
sizeof
(
*
s
->
planar_samples
),
alloc_fail
);
for
(
ch
=
0
;
ch
<
s
->
channels
;
ch
++
)
{
FF_ALLOCZ_OR_GOTO
(
s
->
avctx
,
s
->
planar_samples
[
ch
],
(
AC3_FRAME_SIZE
+
AC3_BLOCK_SIZE
)
*
sizeof
(
**
s
->
planar_samples
),
alloc_fail
);
}
return
0
;
alloc_fail:
return
AVERROR
(
ENOMEM
);
}
/**
* Deinterleave input samples.
* Channels are reordered from Libav's default order to AC-3 order.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录