Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
8b1171e9
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,发现更多精彩内容 >>
提交
8b1171e9
编写于
5月 09, 2011
作者:
S
Stefano Sabatini
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
iff: remove get_palette_size() wrapper
Remove one level of indirection/improve readability.
上级
83294a32
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
9 addition
and
18 deletion
+9
-18
libavcodec/iff.c
libavcodec/iff.c
+9
-18
未找到文件。
libavcodec/iff.c
浏览文件 @
8b1171e9
...
...
@@ -38,18 +38,6 @@ typedef enum {
MASK_LASSO
}
mask_type
;
/**
* Gets the size of CMAP palette data beyond the IFF extra context.
* Please note that any value < 2 of IFF extra context or
* raw extradata < 0 is considered as illegal extradata.
*
* @param avctx the AVCodecContext where to extract palette data size from
* @return size of raw palette data in bytes
*/
static
av_always_inline
int
get_palette_size
(
const
AVCodecContext
*
const
avctx
)
{
return
avctx
->
extradata_size
-
AV_RB16
(
avctx
->
extradata
);
}
/**
* Gets the actual raw image data after video properties which
* contains the raw image data beyond the IFF extra context.
...
...
@@ -174,6 +162,7 @@ static int ff_cmap_read_palette(AVCodecContext *avctx, uint32_t *pal)
{
int
count
,
i
;
const
uint8_t
*
const
palette
=
avctx
->
extradata
+
AV_RB16
(
avctx
->
extradata
);
int
palette_size
=
avctx
->
extradata_size
-
AV_RB16
(
avctx
->
extradata
);
if
(
avctx
->
bits_per_coded_sample
>
8
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"bit_per_coded_sample > 8 not supported
\n
"
);
...
...
@@ -182,7 +171,7 @@ static int ff_cmap_read_palette(AVCodecContext *avctx, uint32_t *pal)
count
=
1
<<
avctx
->
bits_per_coded_sample
;
// If extradata is smaller than actually needed, fill the remaining with black.
count
=
FFMIN
(
get_palette_size
(
avctx
)
/
3
,
count
);
count
=
FFMIN
(
palette_size
/
3
,
count
);
if
(
count
)
{
for
(
i
=
0
;
i
<
count
;
i
++
)
{
pal
[
i
]
=
0xFF000000
|
AV_RB24
(
palette
+
i
*
3
);
...
...
@@ -210,6 +199,8 @@ static int extract_header(AVCodecContext *const avctx,
const
uint8_t
*
buf
;
unsigned
buf_size
;
IffContext
*
s
=
avctx
->
priv_data
;
int
palette_size
=
avctx
->
extradata_size
-
AV_RB16
(
avctx
->
extradata
);
if
(
avpkt
)
{
if
(
avpkt
->
size
<
2
)
return
AVERROR_INVALIDDATA
;
...
...
@@ -226,10 +217,10 @@ static int extract_header(AVCodecContext *const avctx,
return
AVERROR_INVALIDDATA
;
buf
=
avctx
->
extradata
;
buf_size
=
bytestream_get_be16
(
&
buf
);
if
(
buf_size
<=
1
||
get_palette_size
(
avctx
)
<
0
)
{
if
(
buf_size
<=
1
||
palette_size
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Invalid palette size received: %u -> palette data offset: %d
\n
"
,
buf_size
,
get_palette_size
(
avctx
)
);
buf_size
,
palette_size
);
return
AVERROR_INVALIDDATA
;
}
}
...
...
@@ -260,7 +251,7 @@ static int extract_header(AVCodecContext *const avctx,
av_freep
(
&
s
->
ham_palbuf
);
if
(
s
->
ham
)
{
int
i
,
count
=
FFMIN
(
get_palette_size
(
avctx
)
/
3
,
1
<<
s
->
ham
);
int
i
,
count
=
FFMIN
(
palette_size
/
3
,
1
<<
s
->
ham
);
const
uint8_t
*
const
palette
=
avctx
->
extradata
+
AV_RB16
(
avctx
->
extradata
);
s
->
ham_buf
=
av_malloc
((
s
->
planesize
*
8
)
+
FF_INPUT_BUFFER_PADDING_SIZE
);
if
(
!
s
->
ham_buf
)
...
...
@@ -311,9 +302,9 @@ static av_cold int decode_init(AVCodecContext *avctx)
int
err
;
if
(
avctx
->
bits_per_coded_sample
<=
8
)
{
int
palette_size
=
avctx
->
extradata_size
-
AV_RB16
(
avctx
->
extradata
);
avctx
->
pix_fmt
=
(
avctx
->
bits_per_coded_sample
<
8
)
||
(
avctx
->
extradata_size
>=
2
&&
get_palette_size
(
avctx
))
?
PIX_FMT_PAL8
:
PIX_FMT_GRAY8
;
(
avctx
->
extradata_size
>=
2
&&
palette_size
)
?
PIX_FMT_PAL8
:
PIX_FMT_GRAY8
;
}
else
if
(
avctx
->
bits_per_coded_sample
<=
32
)
{
avctx
->
pix_fmt
=
PIX_FMT_BGR32
;
}
else
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录