Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
e0eddd12
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,发现更多精彩内容 >>
提交
e0eddd12
编写于
7月 15, 2007
作者:
M
Måns Rullgård
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
hardly anything in PNGContext is shared; split it
Originally committed as revision 9689 to
svn://svn.ffmpeg.org/ffmpeg/trunk
上级
9a5a05d0
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
71 addition
and
56 deletion
+71
-56
libavcodec/png.c
libavcodec/png.c
+0
-10
libavcodec/png.h
libavcodec/png.h
+0
-36
libavcodec/pngdec.c
libavcodec/pngdec.c
+46
-6
libavcodec/pngenc.c
libavcodec/pngenc.c
+25
-4
未找到文件。
libavcodec/png.c
浏览文件 @
e0eddd12
...
...
@@ -80,13 +80,3 @@ int ff_png_pass_row_size(int pass, int bits_per_pixel, int width)
pass_width
=
(
width
-
xmin
+
(
1
<<
shift
)
-
1
)
>>
shift
;
return
(
pass_width
*
bits_per_pixel
+
7
)
>>
3
;
}
int
ff_png_common_init
(
AVCodecContext
*
avctx
){
PNGContext
*
s
=
avctx
->
priv_data
;
avcodec_get_frame_defaults
((
AVFrame
*
)
&
s
->
picture
);
avctx
->
coded_frame
=
(
AVFrame
*
)
&
s
->
picture
;
// s->avctx= avctx;
return
0
;
}
libavcodec/png.h
浏览文件 @
e0eddd12
...
...
@@ -48,40 +48,6 @@
#define NB_PASSES 7
#define IOBUF_SIZE 4096
typedef
struct
PNGContext
{
uint8_t
*
bytestream
;
uint8_t
*
bytestream_start
;
uint8_t
*
bytestream_end
;
AVFrame
picture
;
int
state
;
int
width
,
height
;
int
bit_depth
;
int
color_type
;
int
compression_type
;
int
interlace_type
;
int
filter_type
;
int
channels
;
int
bits_per_pixel
;
int
bpp
;
uint8_t
*
image_buf
;
int
image_linesize
;
uint32_t
palette
[
256
];
uint8_t
*
crow_buf
;
uint8_t
*
last_row
;
uint8_t
*
tmp_row
;
int
pass
;
int
crow_size
;
/* compressed row size (include filter type) */
int
row_size
;
/* decompressed row size */
int
pass_row_size
;
/* decompress row size of the current pass */
int
y
;
z_stream
zstream
;
uint8_t
buf
[
IOBUF_SIZE
];
}
PNGContext
;
extern
const
uint8_t
ff_pngsig
[
8
];
/* Mask to determine which y pixels are valid in a pass */
...
...
@@ -106,6 +72,4 @@ extern int ff_png_get_nb_channels(int color_type);
/* compute the row size of an interleaved pass */
extern
int
ff_png_pass_row_size
(
int
pass
,
int
bits_per_pixel
,
int
width
);
extern
int
ff_png_common_init
(
AVCodecContext
*
avctx
);
#endif
libavcodec/pngdec.c
浏览文件 @
e0eddd12
...
...
@@ -30,6 +30,37 @@
//#define DEBUG
typedef
struct
PNGDecContext
{
uint8_t
*
bytestream
;
uint8_t
*
bytestream_start
;
uint8_t
*
bytestream_end
;
AVFrame
picture
;
int
state
;
int
width
,
height
;
int
bit_depth
;
int
color_type
;
int
compression_type
;
int
interlace_type
;
int
filter_type
;
int
channels
;
int
bits_per_pixel
;
int
bpp
;
uint8_t
*
image_buf
;
int
image_linesize
;
uint32_t
palette
[
256
];
uint8_t
*
crow_buf
;
uint8_t
*
last_row
;
uint8_t
*
tmp_row
;
int
pass
;
int
crow_size
;
/* compressed row size (include filter type) */
int
row_size
;
/* decompressed row size */
int
pass_row_size
;
/* decompress row size of the current pass */
int
y
;
z_stream
zstream
;
}
PNGDecContext
;
/* Mask to determine which y pixels can be written in a pass */
static
const
uint8_t
png_pass_dsp_ymask
[
NB_PASSES
]
=
{
0xff
,
0xff
,
0x0f
,
0xcc
,
0x33
,
0xff
,
0x55
,
...
...
@@ -182,7 +213,7 @@ static void convert_to_rgb32(uint8_t *dst, const uint8_t *src, int width)
}
/* process exactly one decompressed row */
static
void
png_handle_row
(
PNGContext
*
s
)
static
void
png_handle_row
(
PNG
Dec
Context
*
s
)
{
uint8_t
*
ptr
,
*
last_row
;
int
got_line
;
...
...
@@ -252,7 +283,7 @@ static void png_handle_row(PNGContext *s)
}
}
static
int
png_decode_idat
(
PNGContext
*
s
,
int
length
)
static
int
png_decode_idat
(
PNG
Dec
Context
*
s
,
int
length
)
{
int
ret
;
s
->
zstream
.
avail_in
=
length
;
...
...
@@ -283,7 +314,7 @@ static int decode_frame(AVCodecContext *avctx,
void
*
data
,
int
*
data_size
,
uint8_t
*
buf
,
int
buf_size
)
{
PNGContext
*
const
s
=
avctx
->
priv_data
;
PNG
Dec
Context
*
const
s
=
avctx
->
priv_data
;
AVFrame
*
picture
=
data
;
AVFrame
*
const
p
=
(
AVFrame
*
)
&
s
->
picture
;
uint32_t
tag
,
length
;
...
...
@@ -299,7 +330,7 @@ static int decode_frame(AVCodecContext *avctx,
s
->
bytestream
+=
8
;
s
->
y
=
s
->
state
=
0
;
// memset(s, 0, sizeof(PNGContext));
// memset(s, 0, sizeof(PNG
Dec
Context));
/* init the zlib */
s
->
zstream
.
zalloc
=
ff_png_zalloc
;
s
->
zstream
.
zfree
=
ff_png_zfree
;
...
...
@@ -498,12 +529,21 @@ static int decode_frame(AVCodecContext *avctx,
goto
the_end
;
}
static
int
png_dec_init
(
AVCodecContext
*
avctx
){
PNGDecContext
*
s
=
avctx
->
priv_data
;
avcodec_get_frame_defaults
((
AVFrame
*
)
&
s
->
picture
);
avctx
->
coded_frame
=
(
AVFrame
*
)
&
s
->
picture
;
return
0
;
}
AVCodec
png_decoder
=
{
"png"
,
CODEC_TYPE_VIDEO
,
CODEC_ID_PNG
,
sizeof
(
PNGContext
),
ff_png_common
_init
,
sizeof
(
PNG
Dec
Context
),
png_dec
_init
,
NULL
,
NULL
,
//decode_end,
decode_frame
,
...
...
libavcodec/pngenc.c
浏览文件 @
e0eddd12
...
...
@@ -31,6 +31,18 @@
//#define DEBUG
#define IOBUF_SIZE 4096
typedef
struct
PNGEncContext
{
uint8_t
*
bytestream
;
uint8_t
*
bytestream_start
;
uint8_t
*
bytestream_end
;
AVFrame
picture
;
z_stream
zstream
;
uint8_t
buf
[
IOBUF_SIZE
];
}
PNGEncContext
;
static
void
png_get_interlaced_row
(
uint8_t
*
dst
,
int
row_size
,
int
bits_per_pixel
,
int
pass
,
const
uint8_t
*
src
,
int
width
)
...
...
@@ -106,7 +118,7 @@ static void png_write_chunk(uint8_t **f, uint32_t tag,
}
/* XXX: do filtering */
static
int
png_write_row
(
PNGContext
*
s
,
const
uint8_t
*
data
,
int
size
)
static
int
png_write_row
(
PNG
Enc
Context
*
s
,
const
uint8_t
*
data
,
int
size
)
{
int
ret
;
...
...
@@ -127,7 +139,7 @@ static int png_write_row(PNGContext *s, const uint8_t *data, int size)
}
static
int
encode_frame
(
AVCodecContext
*
avctx
,
unsigned
char
*
buf
,
int
buf_size
,
void
*
data
){
PNGContext
*
s
=
avctx
->
priv_data
;
PNG
Enc
Context
*
s
=
avctx
->
priv_data
;
AVFrame
*
pict
=
data
;
AVFrame
*
const
p
=
(
AVFrame
*
)
&
s
->
picture
;
int
bit_depth
,
color_type
,
y
,
len
,
row_size
,
ret
,
is_progressive
;
...
...
@@ -297,12 +309,21 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
goto
the_end
;
}
static
int
png_enc_init
(
AVCodecContext
*
avctx
){
PNGEncContext
*
s
=
avctx
->
priv_data
;
avcodec_get_frame_defaults
((
AVFrame
*
)
&
s
->
picture
);
avctx
->
coded_frame
=
(
AVFrame
*
)
&
s
->
picture
;
return
0
;
}
AVCodec
png_encoder
=
{
"png"
,
CODEC_TYPE_VIDEO
,
CODEC_ID_PNG
,
sizeof
(
PNGContext
),
ff_png_common
_init
,
sizeof
(
PNG
Enc
Context
),
png_enc
_init
,
encode_frame
,
NULL
,
//encode_end,
.
pix_fmts
=
(
enum
PixelFormat
[]){
PIX_FMT_RGB24
,
PIX_FMT_RGB32
,
PIX_FMT_PAL8
,
PIX_FMT_GRAY8
,
PIX_FMT_MONOBLACK
,
-
1
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录