Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
a2a8da6d
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,发现更多精彩内容 >>
提交
a2a8da6d
编写于
11月 15, 2020
作者:
A
Andreas Rheinhardt
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
avcodec/mpc8: Make decoder init-threadsafe
Signed-off-by:
N
Andreas Rheinhardt
<
andreas.rheinhardt@gmail.com
>
上级
3dee5fa1
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
33 addition
and
29 deletion
+33
-29
libavcodec/mpc8.c
libavcodec/mpc8.c
+33
-29
未找到文件。
libavcodec/mpc8.c
浏览文件 @
a2a8da6d
...
...
@@ -27,6 +27,7 @@
#include "libavutil/channel_layout.h"
#include "libavutil/lfg.h"
#include "libavutil/thread.h"
#include "avcodec.h"
#include "get_bits.h"
#include "internal.h"
...
...
@@ -107,15 +108,40 @@ static av_cold void build_vlc(VLC *vlc, unsigned *buf_offset,
*
syms
+=
num
;
}
static
av_cold
int
mpc8_decode_init
(
AVCodecContext
*
avctx
)
static
av_cold
void
mpc8_init_static
(
void
)
{
int
i
,
offset
=
0
;
MPCContext
*
c
=
avctx
->
priv_data
;
GetBitContext
gb
;
static
int
vlc_initialized
=
0
;
const
uint8_t
*
q_syms
=
mpc8_q_syms
,
*
bands_syms
=
mpc8_bands_syms
;
const
uint8_t
*
res_syms
=
mpc8_res_syms
,
*
scfi_syms
=
mpc8_scfi_syms
;
const
uint8_t
*
dscf_syms
=
mpc8_dscf_syms
;
unsigned
offset
=
0
;
build_vlc
(
&
band_vlc
,
&
offset
,
mpc8_bands_len_counts
,
&
bands_syms
,
0
);
build_vlc
(
&
q1_vlc
,
&
offset
,
mpc8_q1_len_counts
,
&
q_syms
,
0
);
build_vlc
(
&
q9up_vlc
,
&
offset
,
mpc8_q9up_len_counts
,
&
q_syms
,
0
);
for
(
int
i
=
0
;
i
<
2
;
i
++
){
build_vlc
(
&
scfi_vlc
[
i
],
&
offset
,
mpc8_scfi_len_counts
[
i
],
&
scfi_syms
,
0
);
build_vlc
(
&
dscf_vlc
[
i
],
&
offset
,
mpc8_dscf_len_counts
[
i
],
&
dscf_syms
,
0
);
build_vlc
(
&
res_vlc
[
i
],
&
offset
,
mpc8_res_len_counts
[
i
],
&
res_syms
,
0
);
build_vlc
(
&
q2_vlc
[
i
],
&
offset
,
mpc8_q2_len_counts
[
i
],
&
q_syms
,
0
);
build_vlc
(
&
q3_vlc
[
i
],
&
offset
,
mpc8_q34_len_counts
[
i
],
&
q_syms
,
-
48
-
16
*
i
);
for
(
int
j
=
0
;
j
<
4
;
j
++
)
build_vlc
(
&
quant_vlc
[
j
][
i
],
&
offset
,
mpc8_q5_8_len_counts
[
i
][
j
],
&
q_syms
,
-
((
8
<<
j
)
-
1
));
}
ff_mpa_synth_init_fixed
();
}
static
av_cold
int
mpc8_decode_init
(
AVCodecContext
*
avctx
)
{
static
AVOnce
init_static_once
=
AV_ONCE_INIT
;
MPCContext
*
c
=
avctx
->
priv_data
;
GetBitContext
gb
;
int
channels
;
if
(
avctx
->
extradata_size
<
2
){
...
...
@@ -146,30 +172,7 @@ static av_cold int mpc8_decode_init(AVCodecContext * avctx)
avctx
->
channel_layout
=
(
channels
==
2
)
?
AV_CH_LAYOUT_STEREO
:
AV_CH_LAYOUT_MONO
;
avctx
->
channels
=
channels
;
if
(
vlc_initialized
)
return
0
;
av_log
(
avctx
,
AV_LOG_DEBUG
,
"Initing VLC
\n
"
);
build_vlc
(
&
band_vlc
,
&
offset
,
mpc8_bands_len_counts
,
&
bands_syms
,
0
);
build_vlc
(
&
q1_vlc
,
&
offset
,
mpc8_q1_len_counts
,
&
q_syms
,
0
);
build_vlc
(
&
q9up_vlc
,
&
offset
,
mpc8_q9up_len_counts
,
&
q_syms
,
0
);
for
(
i
=
0
;
i
<
2
;
i
++
){
build_vlc
(
&
scfi_vlc
[
i
],
&
offset
,
mpc8_scfi_len_counts
[
i
],
&
scfi_syms
,
0
);
build_vlc
(
&
dscf_vlc
[
i
],
&
offset
,
mpc8_dscf_len_counts
[
i
],
&
dscf_syms
,
0
);
build_vlc
(
&
res_vlc
[
i
],
&
offset
,
mpc8_res_len_counts
[
i
],
&
res_syms
,
0
);
build_vlc
(
&
q2_vlc
[
i
],
&
offset
,
mpc8_q2_len_counts
[
i
],
&
q_syms
,
0
);
build_vlc
(
&
q3_vlc
[
i
],
&
offset
,
mpc8_q34_len_counts
[
i
],
&
q_syms
,
-
48
-
16
*
i
);
for
(
int
j
=
0
;
j
<
4
;
j
++
)
build_vlc
(
&
quant_vlc
[
j
][
i
],
&
offset
,
mpc8_q5_8_len_counts
[
i
][
j
],
&
q_syms
,
-
((
8
<<
j
)
-
1
));
}
vlc_initialized
=
1
;
ff_mpa_synth_init_fixed
();
ff_thread_once
(
&
init_static_once
,
mpc8_init_static
);
return
0
;
}
...
...
@@ -392,4 +395,5 @@ AVCodec ff_mpc8_decoder = {
.
capabilities
=
AV_CODEC_CAP_DR1
,
.
sample_fmts
=
(
const
enum
AVSampleFormat
[])
{
AV_SAMPLE_FMT_S16P
,
AV_SAMPLE_FMT_NONE
},
.
caps_internal
=
FF_CODEC_CAP_INIT_THREADSAFE
,
};
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录