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
bd36ec55
Commit
bd36ec55
authored
Jan 12, 2012
by
Paul B Mahol
Committed by
Michael Niedermayer
Jan 12, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bmpdec: proper check for alpha
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
f068ce57
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
bmp.c
libavcodec/bmp.c
+7
-4
No files found.
libavcodec/bmp.c
View file @
bd36ec55
...
...
@@ -49,6 +49,7 @@ static int bmp_decode_frame(AVCodecContext *avctx,
unsigned
int
ihsize
;
int
i
,
j
,
n
,
linesize
;
uint32_t
rgb
[
3
];
uint32_t
alpha
=
0
;
uint8_t
*
ptr
;
int
dsize
;
const
uint8_t
*
buf0
=
buf
;
...
...
@@ -131,6 +132,8 @@ static int bmp_decode_frame(AVCodecContext *avctx,
rgb
[
0
]
=
bytestream_get_le32
(
&
buf
);
rgb
[
1
]
=
bytestream_get_le32
(
&
buf
);
rgb
[
2
]
=
bytestream_get_le32
(
&
buf
);
if
(
ihsize
>=
108
)
alpha
=
bytestream_get_le32
(
&
buf
);
}
avctx
->
width
=
width
;
...
...
@@ -142,13 +145,13 @@ static int bmp_decode_frame(AVCodecContext *avctx,
case
32
:
if
(
comp
==
BMP_BITFIELDS
){
if
(
rgb
[
0
]
==
0xFF000000
&&
rgb
[
1
]
==
0x00FF0000
&&
rgb
[
2
]
==
0x0000FF00
)
avctx
->
pix_fmt
=
PIX_FMT_A
BGR
;
avctx
->
pix_fmt
=
alpha
?
PIX_FMT_ABGR
:
PIX_FMT_0
BGR
;
else
if
(
rgb
[
0
]
==
0x00FF0000
&&
rgb
[
1
]
==
0x0000FF00
&&
rgb
[
2
]
==
0x000000FF
)
avctx
->
pix_fmt
=
PIX_FMT_BGRA
;
avctx
->
pix_fmt
=
alpha
?
PIX_FMT_BGRA
:
PIX_FMT_BGR0
;
else
if
(
rgb
[
0
]
==
0x0000FF00
&&
rgb
[
1
]
==
0x00FF0000
&&
rgb
[
2
]
==
0xFF000000
)
avctx
->
pix_fmt
=
PIX_FMT_A
RGB
;
avctx
->
pix_fmt
=
alpha
?
PIX_FMT_ARGB
:
PIX_FMT_0
RGB
;
else
if
(
rgb
[
0
]
==
0x000000FF
&&
rgb
[
1
]
==
0x0000FF00
&&
rgb
[
2
]
==
0x00FF0000
)
avctx
->
pix_fmt
=
PIX_FMT_RGBA
;
avctx
->
pix_fmt
=
alpha
?
PIX_FMT_RGBA
:
PIX_FMT_RGB0
;
else
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Unknown bitfields %0X %0X %0X
\n
"
,
rgb
[
0
],
rgb
[
1
],
rgb
[
2
]);
return
AVERROR
(
EINVAL
);
...
...
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