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
6db57fa8
Commit
6db57fa8
authored
Jul 24, 2013
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/mjpegdec: Support RGBA lpegs
Fixes Ticket896 Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
436616fd
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
8 deletions
+23
-8
mjpegdec.c
libavcodec/mjpegdec.c
+23
-8
No files found.
libavcodec/mjpegdec.c
View file @
6db57fa8
...
...
@@ -337,7 +337,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
return
AVERROR_INVALIDDATA
;
}
}
else
{
if
(
s
->
v_max
==
1
&&
s
->
h_max
==
1
&&
s
->
lossless
==
1
&&
nb_components
==
3
)
if
(
s
->
v_max
==
1
&&
s
->
h_max
==
1
&&
s
->
lossless
==
1
&&
(
nb_components
==
3
||
nb_components
==
4
)
)
s
->
rgb
=
1
;
else
if
(
!
s
->
lossless
)
s
->
rgb
=
0
;
...
...
@@ -368,6 +368,15 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
}
av_assert0
(
s
->
nb_components
==
3
);
break
;
case
0x11111111
:
if
(
s
->
rgb
)
s
->
avctx
->
pix_fmt
=
AV_PIX_FMT_ABGR
;
else
{
s
->
avctx
->
pix_fmt
=
/*s->cs_itu601 ?*/
AV_PIX_FMT_YUVA444P
/* : AV_PIX_FMT_YUVJA444P*/
;
s
->
avctx
->
color_range
=
s
->
cs_itu601
?
AVCOL_RANGE_MPEG
:
AVCOL_RANGE_JPEG
;
}
av_assert0
(
s
->
nb_components
==
4
);
break
;
case
0x12121100
:
case
0x22122100
:
s
->
avctx
->
pix_fmt
=
s
->
cs_itu601
?
AV_PIX_FMT_YUV444P
:
AV_PIX_FMT_YUVJ444P
;
...
...
@@ -774,7 +783,7 @@ static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int nb_components, int p
{
int
i
,
mb_x
,
mb_y
;
uint16_t
(
*
buffer
)[
4
];
int
left
[
3
],
top
[
3
],
topleft
[
3
];
int
left
[
4
],
top
[
4
],
topleft
[
4
];
const
int
linesize
=
s
->
linesize
[
0
];
const
int
mask
=
(
1
<<
s
->
bits
)
-
1
;
int
resync_mb_y
=
0
;
...
...
@@ -786,7 +795,7 @@ static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int nb_components, int p
(
unsigned
)
s
->
mb_width
*
4
*
sizeof
(
s
->
ljpeg_buffer
[
0
][
0
]));
buffer
=
s
->
ljpeg_buffer
;
for
(
i
=
0
;
i
<
3
;
i
++
)
for
(
i
=
0
;
i
<
4
;
i
++
)
buffer
[
0
][
i
]
=
1
<<
(
s
->
bits
-
1
);
for
(
mb_y
=
0
;
mb_y
<
s
->
mb_height
;
mb_y
++
)
{
...
...
@@ -795,7 +804,7 @@ static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int nb_components, int p
if
(
s
->
interlaced
&&
s
->
bottom_field
)
ptr
+=
linesize
>>
1
;
for
(
i
=
0
;
i
<
3
;
i
++
)
for
(
i
=
0
;
i
<
4
;
i
++
)
top
[
i
]
=
left
[
i
]
=
topleft
[
i
]
=
buffer
[
0
][
i
];
for
(
mb_x
=
0
;
mb_x
<
s
->
mb_width
;
mb_x
++
)
{
...
...
@@ -805,7 +814,7 @@ static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int nb_components, int p
s
->
restart_count
=
s
->
restart_interval
;
resync_mb_x
=
mb_x
;
resync_mb_y
=
mb_y
;
for
(
i
=
0
;
i
<
3
;
i
++
)
for
(
i
=
0
;
i
<
4
;
i
++
)
top
[
i
]
=
left
[
i
]
=
topleft
[
i
]
=
1
<<
(
s
->
bits
-
1
);
}
if
(
mb_y
==
resync_mb_y
||
mb_y
==
resync_mb_y
+
1
&&
mb_x
<
resync_mb_x
||
!
mb_x
)
...
...
@@ -832,8 +841,14 @@ static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int nb_components, int p
skip_bits
(
&
s
->
gb
,
16
);
/* skip RSTn */
}
}
if
(
s
->
rct
)
{
if
(
s
->
nb_components
==
4
)
{
for
(
i
=
0
;
i
<
nb_components
;
i
++
)
{
int
c
=
s
->
comp_index
[
i
];
for
(
mb_x
=
0
;
mb_x
<
s
->
mb_width
;
mb_x
++
)
{
ptr
[
4
*
mb_x
+
3
-
c
]
=
buffer
[
mb_x
][
i
];
}
}
}
else
if
(
s
->
rct
)
{
for
(
mb_x
=
0
;
mb_x
<
s
->
mb_width
;
mb_x
++
)
{
ptr
[
3
*
mb_x
+
1
]
=
buffer
[
mb_x
][
0
]
-
((
buffer
[
mb_x
][
1
]
+
buffer
[
mb_x
][
2
]
-
0x200
)
>>
2
);
ptr
[
3
*
mb_x
+
0
]
=
buffer
[
mb_x
][
1
]
+
ptr
[
3
*
mb_x
+
1
];
...
...
@@ -867,7 +882,7 @@ static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor,
point_transform
+=
bits
-
s
->
bits
;
av_assert0
(
nb_components
>=
1
&&
nb_components
<=
3
);
av_assert0
(
nb_components
>=
1
&&
nb_components
<=
4
);
for
(
mb_y
=
0
;
mb_y
<
s
->
mb_height
;
mb_y
++
)
{
for
(
mb_x
=
0
;
mb_x
<
s
->
mb_width
;
mb_x
++
)
{
...
...
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