Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
d49db99c
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,发现更多精彩内容 >>
提交
d49db99c
编写于
5月 27, 2020
作者:
P
Paul B Mahol
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
avcodec: add PFM image decoder
上级
43912896
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
87 addition
and
5 deletion
+87
-5
Changelog
Changelog
+1
-0
libavcodec/Makefile
libavcodec/Makefile
+1
-0
libavcodec/allcodecs.c
libavcodec/allcodecs.c
+1
-0
libavcodec/codec_desc.c
libavcodec/codec_desc.c
+7
-0
libavcodec/codec_id.h
libavcodec/codec_id.h
+1
-0
libavcodec/pnm.c
libavcodec/pnm.c
+17
-4
libavcodec/pnm.h
libavcodec/pnm.h
+2
-0
libavcodec/pnmdec.c
libavcodec/pnmdec.c
+55
-0
libavcodec/version.h
libavcodec/version.h
+1
-1
libavformat/img2.c
libavformat/img2.c
+1
-0
未找到文件。
Changelog
浏览文件 @
d49db99c
...
...
@@ -72,6 +72,7 @@ version <next>:
- MediaFoundation encoder wrapper
- untile filter
- Simon & Schuster Interactive ADPCM encoder
- PFM decoder
version 4.2:
...
...
libavcodec/Makefile
浏览文件 @
d49db99c
...
...
@@ -530,6 +530,7 @@ OBJS-$(CONFIG_PBM_DECODER) += pnmdec.o pnm.o
OBJS-$(CONFIG_PBM_ENCODER)
+=
pnmenc.o
OBJS-$(CONFIG_PCX_DECODER)
+=
pcx.o
OBJS-$(CONFIG_PCX_ENCODER)
+=
pcxenc.o
OBJS-$(CONFIG_PFM_DECODER)
+=
pnmdec.o pnm.o
OBJS-$(CONFIG_PGM_DECODER)
+=
pnmdec.o pnm.o
OBJS-$(CONFIG_PGM_ENCODER)
+=
pnmenc.o
OBJS-$(CONFIG_PGMYUV_DECODER)
+=
pnmdec.o pnm.o
...
...
libavcodec/allcodecs.c
浏览文件 @
d49db99c
...
...
@@ -233,6 +233,7 @@ extern AVCodec ff_pbm_encoder;
extern
AVCodec
ff_pbm_decoder
;
extern
AVCodec
ff_pcx_encoder
;
extern
AVCodec
ff_pcx_decoder
;
extern
AVCodec
ff_pfm_decoder
;
extern
AVCodec
ff_pgm_encoder
;
extern
AVCodec
ff_pgm_decoder
;
extern
AVCodec
ff_pgmyuv_encoder
;
...
...
libavcodec/codec_desc.c
浏览文件 @
d49db99c
...
...
@@ -1770,6 +1770,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"NotchLC"
),
.
props
=
AV_CODEC_PROP_INTRA_ONLY
|
AV_CODEC_PROP_LOSSY
,
},
{
.
id
=
AV_CODEC_ID_PFM
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
name
=
"pfm"
,
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"PFM (Portable FloatMap) image"
),
.
props
=
AV_CODEC_PROP_INTRA_ONLY
|
AV_CODEC_PROP_LOSSLESS
,
},
/* various PCM "codecs" */
{
...
...
libavcodec/codec_id.h
浏览文件 @
d49db99c
...
...
@@ -294,6 +294,7 @@ enum AVCodecID {
AV_CODEC_ID_CDTOONS
,
AV_CODEC_ID_MV30
,
AV_CODEC_ID_NOTCHLC
,
AV_CODEC_ID_PFM
,
/* various PCM "codecs" */
AV_CODEC_ID_FIRST_AUDIO
=
0x10000
,
///< A dummy id pointing at the start of audio codecs
...
...
libavcodec/pnm.c
浏览文件 @
d49db99c
...
...
@@ -24,6 +24,7 @@
#include "libavutil/avassert.h"
#include "libavutil/imgutils.h"
#include "libavutil/avstring.h"
#include "avcodec.h"
#include "internal.h"
#include "pnm.h"
...
...
@@ -69,8 +70,9 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
if
(
s
->
bytestream_end
-
s
->
bytestream
<
3
||
s
->
bytestream
[
0
]
!=
'P'
||
s
->
bytestream
[
1
]
<
'1'
||
s
->
bytestream
[
1
]
>
'7'
)
{
(
s
->
bytestream
[
1
]
<
'1'
||
s
->
bytestream
[
1
]
>
'7'
&&
s
->
bytestream
[
1
]
!=
'F'
))
{
s
->
bytestream
+=
s
->
bytestream_end
>
s
->
bytestream
;
s
->
bytestream
+=
s
->
bytestream_end
>
s
->
bytestream
;
return
AVERROR_INVALIDDATA
;
...
...
@@ -78,7 +80,9 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
pnm_get
(
s
,
buf1
,
sizeof
(
buf1
));
s
->
type
=
buf1
[
1
]
-
'0'
;
if
(
s
->
type
==
1
||
s
->
type
==
4
)
{
if
(
buf1
[
1
]
==
'F'
)
{
avctx
->
pix_fmt
=
AV_PIX_FMT_GBRPF32
;
}
else
if
(
s
->
type
==
1
||
s
->
type
==
4
)
{
avctx
->
pix_fmt
=
AV_PIX_FMT_MONOWHITE
;
}
else
if
(
s
->
type
==
2
||
s
->
type
==
5
)
{
if
(
avctx
->
codec_id
==
AV_CODEC_ID_PGMYUV
)
...
...
@@ -173,7 +177,16 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
if
(
ret
<
0
)
return
ret
;
if
(
avctx
->
pix_fmt
!=
AV_PIX_FMT_MONOWHITE
&&
avctx
->
pix_fmt
!=
AV_PIX_FMT_MONOBLACK
)
{
if
(
avctx
->
pix_fmt
==
AV_PIX_FMT_GBRPF32
)
{
pnm_get
(
s
,
buf1
,
sizeof
(
buf1
));
if
(
av_sscanf
(
buf1
,
"%f"
,
&
s
->
scale
)
!=
1
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Invalid scale.
\n
"
);
return
AVERROR_INVALIDDATA
;
}
s
->
endian
=
s
->
scale
<
0
.
f
;
s
->
scale
=
fabsf
(
s
->
scale
);
s
->
maxval
=
(
1ULL
<<
32
)
-
1
;
}
else
if
(
avctx
->
pix_fmt
!=
AV_PIX_FMT_MONOWHITE
&&
avctx
->
pix_fmt
!=
AV_PIX_FMT_MONOBLACK
)
{
pnm_get
(
s
,
buf1
,
sizeof
(
buf1
));
s
->
maxval
=
atoi
(
buf1
);
if
(
s
->
maxval
<=
0
||
s
->
maxval
>
UINT16_MAX
)
{
...
...
libavcodec/pnm.h
浏览文件 @
d49db99c
...
...
@@ -30,6 +30,8 @@ typedef struct PNMContext {
uint8_t
*
bytestream_end
;
int
maxval
;
///< maximum value of a pixel
int
type
;
int
endian
;
float
scale
;
}
PNMContext
;
int
ff_pnm_decode_header
(
AVCodecContext
*
avctx
,
PNMContext
*
const
s
);
...
...
libavcodec/pnmdec.c
浏览文件 @
d49db99c
...
...
@@ -46,6 +46,7 @@ static int pnm_decode_frame(AVCodecContext *avctx, void *data,
int
i
,
j
,
k
,
n
,
linesize
,
h
,
upgrade
=
0
,
is_mono
=
0
;
unsigned
char
*
ptr
;
int
components
,
sample_len
,
ret
;
float
scale
;
s
->
bytestream_start
=
s
->
bytestream
=
(
uint8_t
*
)
buf
;
...
...
@@ -254,6 +255,48 @@ static int pnm_decode_frame(AVCodecContext *avctx, void *data,
}
}
break
;
case
AV_PIX_FMT_GBRPF32
:
if
(
avctx
->
width
*
avctx
->
height
*
12
>
s
->
bytestream_end
-
s
->
bytestream
)
return
AVERROR_INVALIDDATA
;
scale
=
1
.
f
/
s
->
scale
;
if
(
s
->
endian
)
{
float
*
r
,
*
g
,
*
b
;
r
=
(
float
*
)
p
->
data
[
2
];
g
=
(
float
*
)
p
->
data
[
0
];
b
=
(
float
*
)
p
->
data
[
1
];
for
(
int
i
=
0
;
i
<
avctx
->
height
;
i
++
)
{
for
(
int
j
=
0
;
j
<
avctx
->
width
;
j
++
)
{
r
[
j
]
=
av_int2float
(
av_le2ne32
(((
uint32_t
*
)
s
->
bytestream
)[
0
]))
*
scale
;
g
[
j
]
=
av_int2float
(
av_le2ne32
(((
uint32_t
*
)
s
->
bytestream
)[
4
]))
*
scale
;
b
[
j
]
=
av_int2float
(
av_le2ne32
(((
uint32_t
*
)
s
->
bytestream
)[
8
]))
*
scale
;
s
->
bytestream
+=
12
;
}
r
+=
p
->
linesize
[
2
]
/
4
;
g
+=
p
->
linesize
[
0
]
/
4
;
b
+=
p
->
linesize
[
1
]
/
4
;
}
}
else
{
float
*
r
,
*
g
,
*
b
;
r
=
(
float
*
)
p
->
data
[
2
];
g
=
(
float
*
)
p
->
data
[
0
];
b
=
(
float
*
)
p
->
data
[
1
];
for
(
int
i
=
0
;
i
<
avctx
->
height
;
i
++
)
{
for
(
int
j
=
0
;
j
<
avctx
->
width
;
j
++
)
{
r
[
j
]
=
av_int2float
(
av_be2ne32
(((
uint32_t
*
)
s
->
bytestream
)[
0
]))
*
scale
;
g
[
j
]
=
av_int2float
(
av_be2ne32
(((
uint32_t
*
)
s
->
bytestream
)[
4
]))
*
scale
;
b
[
j
]
=
av_int2float
(
av_be2ne32
(((
uint32_t
*
)
s
->
bytestream
)[
8
]))
*
scale
;
s
->
bytestream
+=
12
;
}
r
+=
p
->
linesize
[
2
]
/
4
;
g
+=
p
->
linesize
[
0
]
/
4
;
b
+=
p
->
linesize
[
1
]
/
4
;
}
}
break
;
}
*
got_frame
=
1
;
...
...
@@ -320,3 +363,15 @@ AVCodec ff_pam_decoder = {
.
capabilities
=
AV_CODEC_CAP_DR1
,
};
#endif
#if CONFIG_PFM_DECODER
AVCodec
ff_pfm_decoder
=
{
.
name
=
"pfm"
,
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"PFM (Portable FloatMap) image"
),
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
id
=
AV_CODEC_ID_PFM
,
.
priv_data_size
=
sizeof
(
PNMContext
),
.
decode
=
pnm_decode_frame
,
.
capabilities
=
AV_CODEC_CAP_DR1
,
};
#endif
libavcodec/version.h
浏览文件 @
d49db99c
...
...
@@ -28,7 +28,7 @@
#include "libavutil/version.h"
#define LIBAVCODEC_VERSION_MAJOR 58
#define LIBAVCODEC_VERSION_MINOR
89
#define LIBAVCODEC_VERSION_MINOR
90
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
...
...
libavformat/img2.c
浏览文件 @
d49db99c
...
...
@@ -40,6 +40,7 @@ const IdStrMap ff_img_tags[] = {
{
AV_CODEC_ID_PGMYUV
,
"pgmyuv"
},
{
AV_CODEC_ID_PBM
,
"pbm"
},
{
AV_CODEC_ID_PAM
,
"pam"
},
{
AV_CODEC_ID_PFM
,
"pfm"
},
{
AV_CODEC_ID_ALIAS_PIX
,
"pix"
},
{
AV_CODEC_ID_DDS
,
"dds"
},
{
AV_CODEC_ID_MPEG1VIDEO
,
"mpg1-img"
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录