Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
04af2efa
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,发现更多精彩内容 >>
提交
04af2efa
编写于
12月 07, 2011
作者:
N
Nathan Caldwell
提交者:
Alex Converse
1月 23, 2012
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
aacenc: Store channel count in AACEncContext.
Signed-off-by:
N
Alex Converse
<
alex.converse@gmail.com
>
上级
80d44277
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
23 addition
and
20 deletion
+23
-20
libavcodec/aacenc.c
libavcodec/aacenc.c
+22
-20
libavcodec/aacenc.h
libavcodec/aacenc.h
+1
-0
未找到文件。
libavcodec/aacenc.c
浏览文件 @
04af2efa
...
...
@@ -155,7 +155,7 @@ static void put_audio_specific_config(AVCodecContext *avctx)
init_put_bits
(
&
pb
,
avctx
->
extradata
,
avctx
->
extradata_size
*
8
);
put_bits
(
&
pb
,
5
,
2
);
//object type - AAC-LC
put_bits
(
&
pb
,
4
,
s
->
samplerate_index
);
//sample rate index
put_bits
(
&
pb
,
4
,
avctx
->
channels
);
put_bits
(
&
pb
,
4
,
s
->
channels
);
//GASpecificConfig
put_bits
(
&
pb
,
1
,
0
);
//frame length - 1024 samples
put_bits
(
&
pb
,
1
,
0
);
//does not depend on core coder
...
...
@@ -168,11 +168,11 @@ static void put_audio_specific_config(AVCodecContext *avctx)
flush_put_bits
(
&
pb
);
}
static
void
apply_window_and_mdct
(
A
VCodecContext
*
avctx
,
AACEncContext
*
s
,
SingleChannelElement
*
sce
,
float
*
audio
)
static
void
apply_window_and_mdct
(
A
ACEncContext
*
s
,
SingleChannelElement
*
sce
,
float
*
audio
)
{
int
i
,
k
;
const
int
chans
=
avctx
->
channels
;
const
int
chans
=
s
->
channels
;
const
float
*
lwindow
=
sce
->
ics
.
use_kb_window
[
0
]
?
ff_aac_kbd_long_1024
:
ff_sine_1024
;
const
float
*
swindow
=
sce
->
ics
.
use_kb_window
[
0
]
?
ff_aac_kbd_short_128
:
ff_sine_128
;
const
float
*
pwindow
=
sce
->
ics
.
use_kb_window
[
1
]
?
ff_aac_kbd_short_128
:
ff_sine_128
;
...
...
@@ -446,11 +446,11 @@ static int aac_encode_frame(AVCodecContext *avctx,
return
0
;
if
(
data
)
{
if
(
!
s
->
psypp
)
{
memcpy
(
s
->
samples
+
1024
*
avctx
->
channels
,
data
,
1024
*
avctx
->
channels
*
sizeof
(
s
->
samples
[
0
]));
memcpy
(
s
->
samples
+
1024
*
s
->
channels
,
data
,
1024
*
s
->
channels
*
sizeof
(
s
->
samples
[
0
]));
}
else
{
start_ch
=
0
;
samples2
=
s
->
samples
+
1024
*
avctx
->
channels
;
samples2
=
s
->
samples
+
1024
*
s
->
channels
;
for
(
i
=
0
;
i
<
s
->
chan_map
[
0
];
i
++
)
{
tag
=
s
->
chan_map
[
i
+
1
];
chans
=
tag
==
TYPE_CPE
?
2
:
1
;
...
...
@@ -461,8 +461,8 @@ static int aac_encode_frame(AVCodecContext *avctx,
}
}
if
(
!
avctx
->
frame_number
)
{
memcpy
(
s
->
samples
,
s
->
samples
+
1024
*
avctx
->
channels
,
1024
*
avctx
->
channels
*
sizeof
(
s
->
samples
[
0
]));
memcpy
(
s
->
samples
,
s
->
samples
+
1024
*
s
->
channels
,
1024
*
s
->
channels
*
sizeof
(
s
->
samples
[
0
]));
return
0
;
}
...
...
@@ -476,7 +476,7 @@ static int aac_encode_frame(AVCodecContext *avctx,
IndividualChannelStream
*
ics
=
&
cpe
->
ch
[
ch
].
ics
;
int
cur_channel
=
start_ch
+
ch
;
samples2
=
samples
+
cur_channel
;
la
=
samples2
+
(
448
+
64
)
*
avctx
->
channels
;
la
=
samples2
+
(
448
+
64
)
*
s
->
channels
;
if
(
!
data
)
la
=
NULL
;
if
(
tag
==
TYPE_LFE
)
{
...
...
@@ -504,7 +504,7 @@ static int aac_encode_frame(AVCodecContext *avctx,
for
(
w
=
0
;
w
<
ics
->
num_windows
;
w
++
)
ics
->
group_len
[
w
]
=
wi
[
ch
].
grouping
[
w
];
apply_window_and_mdct
(
avctx
,
s
,
&
cpe
->
ch
[
ch
],
samples2
);
apply_window_and_mdct
(
s
,
&
cpe
->
ch
[
ch
],
samples2
);
}
start_ch
+=
chans
;
}
...
...
@@ -570,8 +570,8 @@ static int aac_encode_frame(AVCodecContext *avctx,
}
frame_bits
=
put_bits_count
(
&
s
->
pb
);
if
(
frame_bits
<=
6144
*
avctx
->
channels
-
3
)
{
s
->
psy
.
bitres
.
bits
=
frame_bits
/
avctx
->
channels
;
if
(
frame_bits
<=
6144
*
s
->
channels
-
3
)
{
s
->
psy
.
bitres
.
bits
=
frame_bits
/
s
->
channels
;
break
;
}
...
...
@@ -592,8 +592,8 @@ static int aac_encode_frame(AVCodecContext *avctx,
if
(
!
data
)
s
->
last_frame
=
1
;
memcpy
(
s
->
samples
,
s
->
samples
+
1024
*
avctx
->
channels
,
1024
*
avctx
->
channels
*
sizeof
(
s
->
samples
[
0
]));
memcpy
(
s
->
samples
,
s
->
samples
+
1024
*
s
->
channels
,
1024
*
s
->
channels
*
sizeof
(
s
->
samples
[
0
]));
return
put_bits_count
(
&
s
->
pb
)
>>
3
;
}
...
...
@@ -633,7 +633,7 @@ static av_cold int dsp_init(AVCodecContext *avctx, AACEncContext *s)
static
av_cold
int
alloc_buffers
(
AVCodecContext
*
avctx
,
AACEncContext
*
s
)
{
FF_ALLOC_OR_GOTO
(
avctx
,
s
->
samples
,
2
*
1024
*
avctx
->
channels
*
sizeof
(
s
->
samples
[
0
]),
alloc_fail
);
FF_ALLOC_OR_GOTO
(
avctx
,
s
->
samples
,
2
*
1024
*
s
->
channels
*
sizeof
(
s
->
samples
[
0
]),
alloc_fail
);
FF_ALLOCZ_OR_GOTO
(
avctx
,
s
->
cpe
,
sizeof
(
ChannelElement
)
*
s
->
chan_map
[
0
],
alloc_fail
);
FF_ALLOCZ_OR_GOTO
(
avctx
,
avctx
->
extradata
,
5
+
FF_INPUT_BUFFER_PADDING_SIZE
,
alloc_fail
);
...
...
@@ -656,18 +656,20 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
if
(
avctx
->
sample_rate
==
avpriv_mpeg4audio_sample_rates
[
i
])
break
;
s
->
channels
=
avctx
->
channels
;
ERROR_IF
(
i
==
16
,
"Unsupported sample rate %d
\n
"
,
avctx
->
sample_rate
);
ERROR_IF
(
avctx
->
channels
>
AAC_MAX_CHANNELS
,
"Unsupported number of channels: %d
\n
"
,
avctx
->
channels
);
ERROR_IF
(
s
->
channels
>
AAC_MAX_CHANNELS
,
"Unsupported number of channels: %d
\n
"
,
s
->
channels
);
ERROR_IF
(
avctx
->
profile
!=
FF_PROFILE_UNKNOWN
&&
avctx
->
profile
!=
FF_PROFILE_AAC_LOW
,
"Unsupported profile %d
\n
"
,
avctx
->
profile
);
ERROR_IF
(
1024
.
0
*
avctx
->
bit_rate
/
avctx
->
sample_rate
>
6144
*
avctx
->
channels
,
ERROR_IF
(
1024
.
0
*
avctx
->
bit_rate
/
avctx
->
sample_rate
>
6144
*
s
->
channels
,
"Too many bits per frame requested
\n
"
);
s
->
samplerate_index
=
i
;
s
->
chan_map
=
aac_chan_configs
[
avctx
->
channels
-
1
];
s
->
chan_map
=
aac_chan_configs
[
s
->
channels
-
1
];
if
(
ret
=
dsp_init
(
avctx
,
s
))
goto
fail
;
...
...
libavcodec/aacenc.h
浏览文件 @
04af2efa
...
...
@@ -61,6 +61,7 @@ typedef struct AACEncContext {
float
*
samples
;
///< saved preprocessed input
int
samplerate_index
;
///< MPEG-4 samplerate index
int
channels
;
///< channel count
const
uint8_t
*
chan_map
;
///< channel configuration map
ChannelElement
*
cpe
;
///< channel elements
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录