Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
54624396
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,发现更多精彩内容 >>
提交
54624396
编写于
6月 07, 2008
作者:
J
Justin Ruggles
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
store cpl_in_use for all blocks in decode context
Originally committed as revision 13703 to
svn://svn.ffmpeg.org/ffmpeg/trunk
上级
be594ae4
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
19 addition
and
14 deletion
+19
-14
libavcodec/ac3dec.c
libavcodec/ac3dec.c
+17
-13
libavcodec/ac3dec.h
libavcodec/ac3dec.h
+2
-1
未找到文件。
libavcodec/ac3dec.c
浏览文件 @
54624396
...
...
@@ -711,6 +711,7 @@ static int ac3_parse_audio_block(AC3DecodeContext *s, int blk)
int
i
,
bnd
,
seg
,
ch
;
int
different_transforms
;
int
downmix_output
;
int
cpl_in_use
;
GetBitContext
*
gbc
=
&
s
->
gbc
;
uint8_t
bit_alloc_stages
[
AC3_MAX_CHANNELS
];
...
...
@@ -746,8 +747,8 @@ static int ac3_parse_audio_block(AC3DecodeContext *s, int blk)
/* coupling strategy */
if
(
get_bits1
(
gbc
))
{
memset
(
bit_alloc_stages
,
3
,
AC3_MAX_CHANNELS
);
s
->
cpl_in_use
=
get_bits1
(
gbc
);
if
(
s
->
cpl_in_use
)
{
cpl_in_use
=
get_bits1
(
gbc
);
if
(
cpl_in_use
)
{
/* coupling in use */
int
cpl_begin_freq
,
cpl_end_freq
;
...
...
@@ -789,10 +790,13 @@ static int ac3_parse_audio_block(AC3DecodeContext *s, int blk)
}
else
if
(
!
blk
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"new coupling strategy must be present in block 0
\n
"
);
return
-
1
;
}
else
{
cpl_in_use
=
s
->
cpl_in_use
[
blk
-
1
];
}
s
->
cpl_in_use
[
blk
]
=
cpl_in_use
;
/* coupling coordinates */
if
(
s
->
cpl_in_use
)
{
if
(
cpl_in_use
)
{
int
cpl_coords_exist
=
0
;
for
(
ch
=
1
;
ch
<=
fbw_channels
;
ch
++
)
{
...
...
@@ -828,7 +832,7 @@ static int ac3_parse_audio_block(AC3DecodeContext *s, int blk)
if
(
channel_mode
==
AC3_CHMODE_STEREO
)
{
if
(
get_bits1
(
gbc
))
{
s
->
num_rematrixing_bands
=
4
;
if
(
s
->
cpl_in_use
&&
s
->
start_freq
[
CPL_CH
]
<=
61
)
if
(
cpl_in_use
&&
s
->
start_freq
[
CPL_CH
]
<=
61
)
s
->
num_rematrixing_bands
-=
1
+
(
s
->
start_freq
[
CPL_CH
]
==
37
);
for
(
bnd
=
0
;
bnd
<
s
->
num_rematrixing_bands
;
bnd
++
)
s
->
rematrixing_flags
[
bnd
]
=
get_bits1
(
gbc
);
...
...
@@ -841,7 +845,7 @@ static int ac3_parse_audio_block(AC3DecodeContext *s, int blk)
/* exponent strategies for each channel */
s
->
exp_strategy
[
CPL_CH
]
=
EXP_REUSE
;
s
->
exp_strategy
[
s
->
lfe_ch
]
=
EXP_REUSE
;
for
(
ch
=
!
s
->
cpl_in_use
;
ch
<=
s
->
channels
;
ch
++
)
{
for
(
ch
=
!
cpl_in_use
;
ch
<=
s
->
channels
;
ch
++
)
{
s
->
exp_strategy
[
ch
]
=
get_bits
(
gbc
,
2
-
(
ch
==
s
->
lfe_ch
));
if
(
s
->
exp_strategy
[
ch
]
!=
EXP_REUSE
)
bit_alloc_stages
[
ch
]
=
3
;
...
...
@@ -869,13 +873,13 @@ static int ac3_parse_audio_block(AC3DecodeContext *s, int blk)
memset
(
bit_alloc_stages
,
3
,
AC3_MAX_CHANNELS
);
}
}
if
(
s
->
cpl_in_use
&&
s
->
exp_strategy
[
CPL_CH
]
!=
EXP_REUSE
)
{
if
(
cpl_in_use
&&
s
->
exp_strategy
[
CPL_CH
]
!=
EXP_REUSE
)
{
s
->
num_exp_groups
[
CPL_CH
]
=
(
s
->
end_freq
[
CPL_CH
]
-
s
->
start_freq
[
CPL_CH
])
/
(
3
<<
(
s
->
exp_strategy
[
CPL_CH
]
-
1
));
}
/* decode exponents for each channel */
for
(
ch
=
!
s
->
cpl_in_use
;
ch
<=
s
->
channels
;
ch
++
)
{
for
(
ch
=
!
cpl_in_use
;
ch
<=
s
->
channels
;
ch
++
)
{
if
(
s
->
exp_strategy
[
ch
]
!=
EXP_REUSE
)
{
s
->
dexps
[
ch
][
0
]
=
get_bits
(
gbc
,
4
)
<<
!
ch
;
decode_exponents
(
gbc
,
s
->
exp_strategy
[
ch
],
...
...
@@ -893,7 +897,7 @@ static int ac3_parse_audio_block(AC3DecodeContext *s, int blk)
s
->
bit_alloc_params
.
slow_gain
=
ff_ac3_slow_gain_tab
[
get_bits
(
gbc
,
2
)];
s
->
bit_alloc_params
.
db_per_bit
=
ff_ac3_db_per_bit_tab
[
get_bits
(
gbc
,
2
)];
s
->
bit_alloc_params
.
floor
=
ff_ac3_floor_tab
[
get_bits
(
gbc
,
3
)];
for
(
ch
=!
s
->
cpl_in_use
;
ch
<=
s
->
channels
;
ch
++
)
for
(
ch
=!
cpl_in_use
;
ch
<=
s
->
channels
;
ch
++
)
bit_alloc_stages
[
ch
]
=
FFMAX
(
bit_alloc_stages
[
ch
],
2
);
}
else
if
(
!
blk
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"new bit allocation info must be present in block 0
\n
"
);
...
...
@@ -904,7 +908,7 @@ static int ac3_parse_audio_block(AC3DecodeContext *s, int blk)
if
(
get_bits1
(
gbc
))
{
int
csnr
;
csnr
=
(
get_bits
(
gbc
,
6
)
-
15
)
<<
4
;
for
(
ch
=
!
s
->
cpl_in_use
;
ch
<=
s
->
channels
;
ch
++
)
{
/* snr offset and fast gain */
for
(
ch
=
!
cpl_in_use
;
ch
<=
s
->
channels
;
ch
++
)
{
/* snr offset and fast gain */
s
->
snr_offset
[
ch
]
=
(
csnr
+
get_bits
(
gbc
,
4
))
<<
2
;
s
->
fast_gain
[
ch
]
=
ff_ac3_fast_gain_tab
[
get_bits
(
gbc
,
3
)];
}
...
...
@@ -915,7 +919,7 @@ static int ac3_parse_audio_block(AC3DecodeContext *s, int blk)
}
/* coupling leak information */
if
(
s
->
cpl_in_use
)
{
if
(
cpl_in_use
)
{
if
(
get_bits1
(
gbc
))
{
s
->
bit_alloc_params
.
cpl_fast_leak
=
get_bits
(
gbc
,
3
);
s
->
bit_alloc_params
.
cpl_slow_leak
=
get_bits
(
gbc
,
3
);
...
...
@@ -929,7 +933,7 @@ static int ac3_parse_audio_block(AC3DecodeContext *s, int blk)
/* delta bit allocation information */
if
(
get_bits1
(
gbc
))
{
/* delta bit allocation exists (strategy) */
for
(
ch
=
!
s
->
cpl_in_use
;
ch
<=
fbw_channels
;
ch
++
)
{
for
(
ch
=
!
cpl_in_use
;
ch
<=
fbw_channels
;
ch
++
)
{
s
->
dba_mode
[
ch
]
=
get_bits
(
gbc
,
2
);
if
(
s
->
dba_mode
[
ch
]
==
DBA_RESERVED
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"delta bit allocation strategy reserved
\n
"
);
...
...
@@ -938,7 +942,7 @@ static int ac3_parse_audio_block(AC3DecodeContext *s, int blk)
bit_alloc_stages
[
ch
]
=
FFMAX
(
bit_alloc_stages
[
ch
],
2
);
}
/* channel delta offset, len and bit allocation */
for
(
ch
=
!
s
->
cpl_in_use
;
ch
<=
fbw_channels
;
ch
++
)
{
for
(
ch
=
!
cpl_in_use
;
ch
<=
fbw_channels
;
ch
++
)
{
if
(
s
->
dba_mode
[
ch
]
==
DBA_NEW
)
{
s
->
dba_nsegs
[
ch
]
=
get_bits
(
gbc
,
3
);
for
(
seg
=
0
;
seg
<=
s
->
dba_nsegs
[
ch
];
seg
++
)
{
...
...
@@ -957,7 +961,7 @@ static int ac3_parse_audio_block(AC3DecodeContext *s, int blk)
}
/* Bit allocation */
for
(
ch
=!
s
->
cpl_in_use
;
ch
<=
s
->
channels
;
ch
++
)
{
for
(
ch
=!
cpl_in_use
;
ch
<=
s
->
channels
;
ch
++
)
{
if
(
bit_alloc_stages
[
ch
]
>
2
)
{
/* Exponent mapping into PSD and PSD integration */
ff_ac3_bit_alloc_calc_psd
(
s
->
dexps
[
ch
],
...
...
libavcodec/ac3dec.h
浏览文件 @
54624396
...
...
@@ -42,6 +42,7 @@
#define AC3_MAX_COEFS 256
#define AC3_BLOCK_SIZE 256
#define MAX_BLOCKS 6
typedef
struct
{
AVCodecContext
*
avctx
;
///< parent context
...
...
@@ -63,7 +64,7 @@ typedef struct {
///@}
///@defgroup cpl standard coupling
int
cpl_in_use
;
///< coupling in use (cplinu)
int
cpl_in_use
[
MAX_BLOCKS
];
///< coupling in use (cplinu)
int
channel_in_cpl
[
AC3_MAX_CHANNELS
];
///< channel in coupling (chincpl)
int
phase_flags_in_use
;
///< phase flags in use (phsflginu)
int
phase_flags
[
18
];
///< phase flags (phsflg)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录