Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
d9b3097b
Commit
d9b3097b
authored
Feb 19, 2012
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pamdec: fix mono support.
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
3fa6d205
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
5 deletions
+6
-5
pnm.c
libavcodec/pnm.c
+2
-2
pnmdec.c
libavcodec/pnmdec.c
+4
-3
No files found.
libavcodec/pnm.c
View file @
d9b3097b
...
@@ -112,7 +112,7 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
...
@@ -112,7 +112,7 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
s
->
maxval
=
maxval
;
s
->
maxval
=
maxval
;
if
(
depth
==
1
)
{
if
(
depth
==
1
)
{
if
(
maxval
==
1
)
{
if
(
maxval
==
1
)
{
avctx
->
pix_fmt
=
PIX_FMT_MONO
WHITE
;
avctx
->
pix_fmt
=
PIX_FMT_MONO
BLACK
;
}
else
if
(
maxval
==
255
)
{
}
else
if
(
maxval
==
255
)
{
avctx
->
pix_fmt
=
PIX_FMT_GRAY8
;
avctx
->
pix_fmt
=
PIX_FMT_GRAY8
;
}
else
{
}
else
{
...
@@ -148,7 +148,7 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
...
@@ -148,7 +148,7 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
avctx
->
height
=
atoi
(
buf1
);
avctx
->
height
=
atoi
(
buf1
);
if
(
avctx
->
height
<=
0
||
av_image_check_size
(
avctx
->
width
,
avctx
->
height
,
0
,
avctx
))
if
(
avctx
->
height
<=
0
||
av_image_check_size
(
avctx
->
width
,
avctx
->
height
,
0
,
avctx
))
return
-
1
;
return
-
1
;
if
(
avctx
->
pix_fmt
!=
PIX_FMT_MONOWHITE
)
{
if
(
avctx
->
pix_fmt
!=
PIX_FMT_MONOWHITE
&&
avctx
->
pix_fmt
!=
PIX_FMT_MONOBLACK
)
{
pnm_get
(
s
,
buf1
,
sizeof
(
buf1
));
pnm_get
(
s
,
buf1
,
sizeof
(
buf1
));
s
->
maxval
=
atoi
(
buf1
);
s
->
maxval
=
atoi
(
buf1
);
if
(
s
->
maxval
<=
0
)
{
if
(
s
->
maxval
<=
0
)
{
...
...
libavcodec/pnmdec.c
View file @
d9b3097b
...
@@ -108,20 +108,21 @@ static int pnm_decode_frame(AVCodecContext *avctx, void *data,
...
@@ -108,20 +108,21 @@ static int pnm_decode_frame(AVCodecContext *avctx, void *data,
linesize
=
p
->
linesize
[
0
];
linesize
=
p
->
linesize
[
0
];
if
(
s
->
bytestream
+
n
*
avctx
->
height
>
s
->
bytestream_end
)
if
(
s
->
bytestream
+
n
*
avctx
->
height
>
s
->
bytestream_end
)
return
-
1
;
return
-
1
;
if
(
s
->
type
<
4
){
if
(
s
->
type
<
4
||
(
is_mono
&&
s
->
type
==
7
)
){
for
(
i
=
0
;
i
<
avctx
->
height
;
i
++
)
{
for
(
i
=
0
;
i
<
avctx
->
height
;
i
++
)
{
PutBitContext
pb
;
PutBitContext
pb
;
init_put_bits
(
&
pb
,
ptr
,
linesize
);
init_put_bits
(
&
pb
,
ptr
,
linesize
);
for
(
j
=
0
;
j
<
avctx
->
width
*
components
;
j
++
){
for
(
j
=
0
;
j
<
avctx
->
width
*
components
;
j
++
){
unsigned
int
c
=
0
;
unsigned
int
c
=
0
;
int
v
=
0
;
int
v
=
0
;
if
(
s
->
type
<
4
)
while
(
s
->
bytestream
<
s
->
bytestream_end
&&
(
*
s
->
bytestream
<
'0'
||
*
s
->
bytestream
>
'9'
))
while
(
s
->
bytestream
<
s
->
bytestream_end
&&
(
*
s
->
bytestream
<
'0'
||
*
s
->
bytestream
>
'9'
))
s
->
bytestream
++
;
s
->
bytestream
++
;
if
(
s
->
bytestream
>=
s
->
bytestream_end
)
if
(
s
->
bytestream
>=
s
->
bytestream_end
)
return
-
1
;
return
-
1
;
if
(
is_mono
)
{
if
(
is_mono
)
{
/* read a single digit */
/* read a single digit */
v
=
(
*
s
->
bytestream
++
)
-
'0'
;
v
=
(
*
s
->
bytestream
++
)
&
1
;
}
else
{
}
else
{
/* read a sequence of digits */
/* read a sequence of digits */
do
{
do
{
...
@@ -260,7 +261,7 @@ AVCodec ff_pam_decoder = {
...
@@ -260,7 +261,7 @@ AVCodec ff_pam_decoder = {
.
close
=
ff_pnm_end
,
.
close
=
ff_pnm_end
,
.
decode
=
pnm_decode_frame
,
.
decode
=
pnm_decode_frame
,
.
capabilities
=
CODEC_CAP_DR1
,
.
capabilities
=
CODEC_CAP_DR1
,
.
pix_fmts
=
(
const
enum
PixelFormat
[]){
PIX_FMT_RGB24
,
PIX_FMT_RGB32
,
PIX_FMT_GRAY8
,
PIX_FMT_MONO
WHITE
,
PIX_FMT_NONE
},
.
pix_fmts
=
(
const
enum
PixelFormat
[]){
PIX_FMT_RGB24
,
PIX_FMT_RGB32
,
PIX_FMT_GRAY8
,
PIX_FMT_MONO
BLACK
,
PIX_FMT_NONE
},
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"PAM (Portable AnyMap) image"
),
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"PAM (Portable AnyMap) image"
),
};
};
#endif
#endif
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