Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
00182190
Commit
00182190
authored
Feb 22, 2009
by
Peter Ross
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support 48-bit RGB PPM image.
Originally committed as revision 17511 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
88c21a6f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
3 deletions
+13
-3
pnm.c
libavcodec/pnm.c
+4
-1
pnmenc.c
libavcodec/pnmenc.c
+9
-2
No files found.
libavcodec/pnm.c
View file @
00182190
...
...
@@ -138,8 +138,11 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s){
avctx
->
pix_fmt
=
PIX_FMT_GRAY16BE
;
if
(
s
->
maxval
!=
65535
)
avctx
->
pix_fmt
=
PIX_FMT_GRAY16
;
}
if
(
avctx
->
pix_fmt
==
PIX_FMT_RGB24
)
{
if
(
s
->
maxval
>
255
)
avctx
->
pix_fmt
=
PIX_FMT_RGB48BE
;
}
else
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"
16-bit components are only supported for grayscale
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"
Unsupported pixel format
\n
"
);
avctx
->
pix_fmt
=
PIX_FMT_NONE
;
return
-
1
;
}
...
...
libavcodec/pnmenc.c
View file @
00182190
...
...
@@ -63,6 +63,9 @@ static int pnm_decode_frame(AVCodecContext *avctx,
switch
(
avctx
->
pix_fmt
)
{
default
:
return
-
1
;
case
PIX_FMT_RGB48BE
:
n
=
avctx
->
width
*
6
;
goto
do_read
;
case
PIX_FMT_RGB24
:
n
=
avctx
->
width
*
3
;
goto
do_read
;
...
...
@@ -195,6 +198,10 @@ static int pnm_encode_frame(AVCodecContext *avctx, unsigned char *outbuf, int bu
c
=
'6'
;
n
=
avctx
->
width
*
3
;
break
;
case
PIX_FMT_RGB48BE
:
c
=
'6'
;
n
=
avctx
->
width
*
6
;
break
;
case
PIX_FMT_YUV420P
:
c
=
'5'
;
n
=
avctx
->
width
;
...
...
@@ -209,7 +216,7 @@ static int pnm_encode_frame(AVCodecContext *avctx, unsigned char *outbuf, int bu
s
->
bytestream
+=
strlen
(
s
->
bytestream
);
if
(
avctx
->
pix_fmt
!=
PIX_FMT_MONOWHITE
)
{
snprintf
(
s
->
bytestream
,
s
->
bytestream_end
-
s
->
bytestream
,
"%d
\n
"
,
(
avctx
->
pix_fmt
!=
PIX_FMT_GRAY16BE
)
?
255
:
65535
);
"%d
\n
"
,
(
avctx
->
pix_fmt
!=
PIX_FMT_GRAY16BE
&&
avctx
->
pix_fmt
!=
PIX_FMT_RGB48BE
)
?
255
:
65535
);
s
->
bytestream
+=
strlen
(
s
->
bytestream
);
}
...
...
@@ -394,7 +401,7 @@ AVCodec ppm_encoder = {
pnm_encode_frame
,
NULL
,
//encode_end,
pnm_decode_frame
,
.
pix_fmts
=
(
enum
PixelFormat
[]){
PIX_FMT_RGB24
,
PIX_FMT_NONE
},
.
pix_fmts
=
(
enum
PixelFormat
[]){
PIX_FMT_RGB24
,
PIX_FMT_
RGB48BE
,
PIX_FMT_
NONE
},
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"PPM (Portable PixelMap) image"
),
};
#endif // CONFIG_PPM_ENCODER
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment