Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
62cc8f4d
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,发现更多精彩内容 >>
提交
62cc8f4d
编写于
11月 20, 2015
作者:
V
Vittorio Giovara
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
sgienc: Port to bytestream2
上级
99f40fd0
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
35 addition
and
31 deletion
+35
-31
libavcodec/sgienc.c
libavcodec/sgienc.c
+35
-31
未找到文件。
libavcodec/sgienc.c
浏览文件 @
62cc8f4d
...
@@ -43,11 +43,11 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
...
@@ -43,11 +43,11 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
const
AVFrame
*
frame
,
int
*
got_packet
)
const
AVFrame
*
frame
,
int
*
got_packet
)
{
{
const
AVFrame
*
const
p
=
frame
;
const
AVFrame
*
const
p
=
frame
;
uint8_t
*
offsettab
,
*
lengthtab
,
*
in_buf
,
*
encode_buf
,
*
buf
;
PutByteContext
pbc
;
uint8_t
*
in_buf
,
*
encode_buf
;
int
x
,
y
,
z
,
length
,
tablesize
,
ret
;
int
x
,
y
,
z
,
length
,
tablesize
,
ret
;
unsigned
int
width
,
height
,
depth
,
dimension
;
unsigned
int
width
,
height
,
depth
,
dimension
;
unsigned
int
bytes_per_channel
,
pixmax
,
put_be
;
unsigned
int
bytes_per_channel
,
pixmax
,
put_be
;
unsigned
char
*
end_buf
;
#if FF_API_CODED_FRAME
#if FF_API_CODED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
FF_DISABLE_DEPRECATION_WARNINGS
...
@@ -117,40 +117,41 @@ FF_ENABLE_DEPRECATION_WARNINGS
...
@@ -117,40 +117,41 @@ FF_ENABLE_DEPRECATION_WARNINGS
av_log
(
avctx
,
AV_LOG_ERROR
,
"Error getting output packet of size %d.
\n
"
,
length
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"Error getting output packet of size %d.
\n
"
,
length
);
return
ret
;
return
ret
;
}
}
buf
=
pkt
->
data
;
end_buf
=
pkt
->
data
+
pkt
->
size
;
bytestream2_init_writer
(
&
pbc
,
pkt
->
data
,
pkt
->
size
)
;
/* Encode header. */
/* Encode header. */
bytestream
_put_be16
(
&
buf
,
SGI_MAGIC
);
bytestream
2_put_be16
(
&
pbc
,
SGI_MAGIC
);
bytestream
_put_byte
(
&
buf
,
avctx
->
coder_type
!=
FF_CODER_TYPE_RAW
);
/* RLE 1 - VERBATIM 0
*/
bytestream
2_put_byte
(
&
pbc
,
avctx
->
coder_type
!=
FF_CODER_TYPE_RAW
);
/* RLE 1 - VERBATIM 0
*/
bytestream
_put_byte
(
&
buf
,
bytes_per_channel
);
bytestream
2_put_byte
(
&
pbc
,
bytes_per_channel
);
bytestream
_put_be16
(
&
buf
,
dimension
);
bytestream
2_put_be16
(
&
pbc
,
dimension
);
bytestream
_put_be16
(
&
buf
,
width
);
bytestream
2_put_be16
(
&
pbc
,
width
);
bytestream
_put_be16
(
&
buf
,
height
);
bytestream
2_put_be16
(
&
pbc
,
height
);
bytestream
_put_be16
(
&
buf
,
depth
);
bytestream
2_put_be16
(
&
pbc
,
depth
);
bytestream
_put_be32
(
&
buf
,
0L
);
/* pixmin */
bytestream
2_put_be32
(
&
pbc
,
0L
);
/* pixmin */
bytestream
_put_be32
(
&
buf
,
pixmax
);
bytestream
2_put_be32
(
&
pbc
,
pixmax
);
bytestream
_put_be32
(
&
buf
,
0L
);
/* dummy */
bytestream
2_put_be32
(
&
pbc
,
0L
);
/* dummy */
/* name */
/* name */
memset
(
buf
,
0
,
SGI_HEADER_SIZE
);
bytestream2_skip_p
(
&
pbc
,
80
);
buf
+=
80
;
/* colormap */
/* colormap */
bytestream
_put_be32
(
&
buf
,
0L
);
bytestream
2_put_be32
(
&
pbc
,
0L
);
/* The rest of the 512 byte header is unused. */
/* The rest of the 512 byte header is unused. */
buf
+=
404
;
bytestream2_skip_p
(
&
pbc
,
404
);
offsettab
=
buf
;
if
(
avctx
->
coder_type
!=
FF_CODER_TYPE_RAW
)
{
if
(
avctx
->
coder_type
!=
FF_CODER_TYPE_RAW
)
{
PutByteContext
taboff_pcb
,
tablen_pcb
;
/* Skip RLE offset table. */
/* Skip RLE offset table. */
b
uf
+=
tablesize
;
b
ytestream2_init_writer
(
&
taboff_pcb
,
pbc
.
buffer
,
tablesize
)
;
lengthtab
=
buf
;
bytestream2_skip_p
(
&
pbc
,
tablesize
)
;
/* Skip RLE length table. */
/* Skip RLE length table. */
buf
+=
tablesize
;
bytestream2_init_writer
(
&
tablen_pcb
,
pbc
.
buffer
,
tablesize
);
bytestream2_skip_p
(
&
pbc
,
tablesize
);
/* Make an intermediate consecutive buffer. */
/* Make an intermediate consecutive buffer. */
if
(
!
(
encode_buf
=
av_malloc
(
width
)))
if
(
!
(
encode_buf
=
av_malloc
(
width
)))
...
@@ -160,18 +161,21 @@ FF_ENABLE_DEPRECATION_WARNINGS
...
@@ -160,18 +161,21 @@ FF_ENABLE_DEPRECATION_WARNINGS
in_buf
=
p
->
data
[
0
]
+
p
->
linesize
[
0
]
*
(
height
-
1
)
+
z
;
in_buf
=
p
->
data
[
0
]
+
p
->
linesize
[
0
]
*
(
height
-
1
)
+
z
;
for
(
y
=
0
;
y
<
height
;
y
++
)
{
for
(
y
=
0
;
y
<
height
;
y
++
)
{
bytestream
_put_be32
(
&
offsettab
,
buf
-
pkt
->
data
);
bytestream
2_put_be32
(
&
taboff_pcb
,
bytestream2_tell_p
(
&
pbc
)
);
for
(
x
=
0
;
x
<
width
;
x
++
)
for
(
x
=
0
;
x
<
width
;
x
++
)
encode_buf
[
x
]
=
in_buf
[
depth
*
x
];
encode_buf
[
x
]
=
in_buf
[
depth
*
x
];
if
((
length
=
ff_rle_encode
(
buf
,
end_buf
-
buf
-
1
,
encode_buf
,
1
,
width
,
0
,
0
,
0x80
,
0
))
<
1
)
{
length
=
ff_rle_encode
(
pbc
.
buffer
,
bytestream2_get_bytes_left_p
(
&
pbc
),
encode_buf
,
1
,
width
,
0
,
0
,
0x80
,
0
);
if
(
length
<
1
)
{
av_free
(
encode_buf
);
av_free
(
encode_buf
);
return
-
1
;
return
-
1
;
}
}
b
uf
+=
length
;
b
ytestream2_skip_p
(
&
pbc
,
length
)
;
bytestream
_put_be32
(
&
lengthta
b
,
length
);
bytestream
2_put_be32
(
&
tablen_pc
b
,
length
);
in_buf
-=
p
->
linesize
[
0
];
in_buf
-=
p
->
linesize
[
0
];
}
}
}
}
...
@@ -184,12 +188,12 @@ FF_ENABLE_DEPRECATION_WARNINGS
...
@@ -184,12 +188,12 @@ FF_ENABLE_DEPRECATION_WARNINGS
for
(
y
=
0
;
y
<
height
;
y
++
)
{
for
(
y
=
0
;
y
<
height
;
y
++
)
{
for
(
x
=
0
;
x
<
width
*
depth
;
x
+=
depth
)
for
(
x
=
0
;
x
<
width
*
depth
;
x
+=
depth
)
if
(
bytes_per_channel
==
1
)
if
(
bytes_per_channel
==
1
)
bytestream
_put_byte
(
&
buf
,
in_buf
[
x
]);
bytestream
2_put_byte
(
&
pbc
,
in_buf
[
x
]);
else
else
if
(
put_be
)
if
(
put_be
)
bytestream
_put_be16
(
&
buf
,
((
uint16_t
*
)
in_buf
)[
x
]);
bytestream
2_put_be16
(
&
pbc
,
((
uint16_t
*
)
in_buf
)[
x
]);
else
else
bytestream
_put_le16
(
&
buf
,
((
uint16_t
*
)
in_buf
)[
x
]);
bytestream
2_put_le16
(
&
pbc
,
((
uint16_t
*
)
in_buf
)[
x
]);
in_buf
-=
p
->
linesize
[
0
];
in_buf
-=
p
->
linesize
[
0
];
}
}
...
@@ -197,7 +201,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
...
@@ -197,7 +201,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
}
}
/* total length */
/* total length */
pkt
->
size
=
b
uf
-
pkt
->
data
;
pkt
->
size
=
b
ytestream2_tell_p
(
&
pbc
)
;
pkt
->
flags
|=
AV_PKT_FLAG_KEY
;
pkt
->
flags
|=
AV_PKT_FLAG_KEY
;
*
got_packet
=
1
;
*
got_packet
=
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录