Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
d66a546f
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,发现更多精彩内容 >>
提交
d66a546f
编写于
9月 24, 2010
作者:
M
Måns Rullgård
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
vorbisenc: remove VLAs
Originally committed as revision 25183 to
svn://svn.ffmpeg.org/ffmpeg/trunk
上级
a6881c6a
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
17 addition
and
6 deletion
+17
-6
libavcodec/vorbis_enc.c
libavcodec/vorbis_enc.c
+17
-6
未找到文件。
libavcodec/vorbis_enc.c
浏览文件 @
d66a546f
...
...
@@ -126,6 +126,17 @@ typedef struct {
int64_t
sample_count
;
}
vorbis_enc_context
;
#define MAX_CHANNELS 2
#define MAX_CODEBOOK_DIM 8
#define MAX_FLOOR_CLASS_DIM 4
#define NUM_FLOOR_PARTITIONS 8
#define MAX_FLOOR_VALUES (MAX_FLOOR_CLASS_DIM*NUM_FLOOR_PARTITIONS+2)
#define RESIDUE_SIZE 1600
#define RESIDUE_PART_SIZE 32
#define NUM_RESIDUE_PARTITIONS (RESIDUE_SIZE/RESIDUE_PART_SIZE)
static
inline
void
put_codeword
(
PutBitContext
*
pb
,
vorbis_enc_codebook
*
cb
,
int
entry
)
{
...
...
@@ -263,7 +274,7 @@ static void create_vorbis_context(vorbis_enc_context *venc,
// just 1 floor
fc
=
&
venc
->
floors
[
0
];
fc
->
partitions
=
8
;
fc
->
partitions
=
NUM_FLOOR_PARTITIONS
;
fc
->
partition_to_class
=
av_malloc
(
sizeof
(
int
)
*
fc
->
partitions
);
fc
->
nclasses
=
0
;
for
(
i
=
0
;
i
<
fc
->
partitions
;
i
++
)
{
...
...
@@ -668,7 +679,7 @@ static void floor_fit(vorbis_enc_context *venc, vorbis_enc_floor *fc,
int
range
=
255
/
fc
->
multiplier
+
1
;
int
i
;
float
tot_average
=
0
.;
float
averages
[
fc
->
values
];
float
averages
[
MAX_FLOOR_VALUES
];
for
(
i
=
0
;
i
<
fc
->
values
;
i
++
)
{
averages
[
i
]
=
get_floor_average
(
fc
,
coeffs
,
i
);
tot_average
+=
averages
[
i
];
...
...
@@ -699,7 +710,7 @@ static void floor_encode(vorbis_enc_context *venc, vorbis_enc_floor *fc,
float
*
floor
,
int
samples
)
{
int
range
=
255
/
fc
->
multiplier
+
1
;
int
coded
[
fc
->
values
];
// first 2 values are unused
int
coded
[
MAX_FLOOR_VALUES
];
// first 2 values are unused
int
i
,
counter
;
put_bits
(
pb
,
1
,
1
);
// non zero
...
...
@@ -807,7 +818,7 @@ static void residue_encode(vorbis_enc_context *venc, vorbis_enc_residue *rc,
int
psize
=
rc
->
partition_size
;
int
partitions
=
(
rc
->
end
-
rc
->
begin
)
/
psize
;
int
channels
=
(
rc
->
type
==
2
)
?
1
:
real_ch
;
int
classes
[
channels
][
partitions
];
int
classes
[
MAX_CHANNELS
][
NUM_RESIDUE_PARTITIONS
];
int
classwords
=
venc
->
codebooks
[
rc
->
classbook
].
ndimentions
;
assert
(
rc
->
type
==
2
);
...
...
@@ -864,7 +875,7 @@ static void residue_encode(vorbis_enc_context *venc, vorbis_enc_residue *rc,
s
=
real_ch
*
samples
;
for
(
k
=
0
;
k
<
psize
;
k
+=
book
->
ndimentions
)
{
int
dim
,
a2
=
a1
,
b2
=
b1
;
float
vec
[
book
->
ndimentions
],
*
pv
=
vec
;
float
vec
[
MAX_CODEBOOK_DIM
],
*
pv
=
vec
;
for
(
dim
=
book
->
ndimentions
;
dim
--
;
)
{
*
pv
++
=
coeffs
[
a2
+
b2
];
if
((
a2
+=
samples
)
==
s
)
{
...
...
@@ -999,7 +1010,7 @@ static int vorbis_encode_frame(AVCodecContext *avccontext,
for
(
i
=
0
;
i
<
venc
->
channels
;
i
++
)
{
vorbis_enc_floor
*
fc
=
&
venc
->
floors
[
mapping
->
floor
[
mapping
->
mux
[
i
]]];
uint_fast16_t
posts
[
fc
->
values
];
uint_fast16_t
posts
[
MAX_FLOOR_VALUES
];
floor_fit
(
venc
,
fc
,
&
venc
->
coeffs
[
i
*
samples
],
posts
,
samples
);
floor_encode
(
venc
,
fc
,
&
pb
,
posts
,
&
venc
->
floor
[
i
*
samples
],
samples
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录