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
79849081
Commit
79849081
authored
Mar 31, 2014
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/mjpegdec: upgrade upscale_v to support multiple planes
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
f9059ce7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
17 deletions
+22
-17
mjpegdec.c
libavcodec/mjpegdec.c
+22
-17
No files found.
libavcodec/mjpegdec.c
View file @
79849081
...
...
@@ -414,7 +414,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
else
goto
unk_pixfmt
;
s
->
avctx
->
color_range
=
s
->
cs_itu601
?
AVCOL_RANGE_MPEG
:
AVCOL_RANGE_JPEG
;
s
->
upscale_v
=
2
;
s
->
upscale_v
=
4
;
s
->
upscale_h
=
2
*
(
pix_fmt_id
==
0x22122100
);
s
->
chroma_height
=
s
->
height
;
break
;
...
...
@@ -424,7 +424,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
else
goto
unk_pixfmt
;
s
->
avctx
->
color_range
=
s
->
cs_itu601
?
AVCOL_RANGE_MPEG
:
AVCOL_RANGE_JPEG
;
s
->
upscale_v
=
(
pix_fmt_id
==
0x22211200
);
s
->
upscale_v
=
2
*
(
pix_fmt_id
==
0x22211200
);
s
->
upscale_h
=
4
;
s
->
chroma_height
=
s
->
height
;
break
;
...
...
@@ -433,7 +433,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
else
goto
unk_pixfmt
;
s
->
avctx
->
color_range
=
s
->
cs_itu601
?
AVCOL_RANGE_MPEG
:
AVCOL_RANGE_JPEG
;
s
->
upscale_v
=
2
;
s
->
upscale_v
=
4
;
s
->
upscale_h
=
4
;
s
->
chroma_height
=
s
->
height
/
2
;
break
;
...
...
@@ -472,7 +472,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
else
goto
unk_pixfmt
;
s
->
avctx
->
color_range
=
s
->
cs_itu601
?
AVCOL_RANGE_MPEG
:
AVCOL_RANGE_JPEG
;
s
->
upscale_v
=
(
pix_fmt_id
==
0x22121100
)
+
1
;
s
->
upscale_v
=
2
<<
(
pix_fmt_id
==
0x22121100
)
;
break
;
case
0x22111100
:
if
(
s
->
bits
<=
8
)
s
->
avctx
->
pix_fmt
=
s
->
cs_itu601
?
AV_PIX_FMT_YUV420P
:
AV_PIX_FMT_YUVJ420P
;
...
...
@@ -2052,24 +2052,29 @@ the_end:
}
}
if
(
s
->
upscale_v
)
{
uint8_t
*
dst
=
&
((
uint8_t
*
)
s
->
picture_ptr
->
data
[
s
->
upscale_v
])[(
s
->
height
-
1
)
*
s
->
linesize
[
s
->
upscale_v
]];
int
w
;
avcodec_get_chroma_sub_sample
(
s
->
avctx
->
pix_fmt
,
&
hshift
,
&
vshift
);
w
=
s
->
width
>>
hshift
;
int
p
;
av_assert0
(
avctx
->
pix_fmt
==
AV_PIX_FMT_YUVJ444P
||
avctx
->
pix_fmt
==
AV_PIX_FMT_YUV444P
||
avctx
->
pix_fmt
==
AV_PIX_FMT_YUVJ422P
||
avctx
->
pix_fmt
==
AV_PIX_FMT_YUV422P
);
for
(
i
=
s
->
height
-
1
;
i
;
i
--
)
{
uint8_t
*
src1
=
&
((
uint8_t
*
)
s
->
picture_ptr
->
data
[
s
->
upscale_v
])[
i
/
2
*
s
->
linesize
[
s
->
upscale_v
]];
uint8_t
*
src2
=
&
((
uint8_t
*
)
s
->
picture_ptr
->
data
[
s
->
upscale_v
])[(
i
+
1
)
/
2
*
s
->
linesize
[
s
->
upscale_v
]];
if
(
src1
==
src2
)
{
memcpy
(
dst
,
src1
,
w
);
}
else
{
for
(
index
=
0
;
index
<
w
;
index
++
)
dst
[
index
]
=
(
src1
[
index
]
+
src2
[
index
])
>>
1
;
avcodec_get_chroma_sub_sample
(
s
->
avctx
->
pix_fmt
,
&
hshift
,
&
vshift
);
for
(
p
=
1
;
p
<
4
;
p
++
)
{
uint8_t
*
dst
=
&
((
uint8_t
*
)
s
->
picture_ptr
->
data
[
p
])[(
s
->
height
-
1
)
*
s
->
linesize
[
p
]];
int
w
;
if
(
!
(
s
->
upscale_v
&
(
1
<<
p
)))
continue
;
w
=
s
->
width
>>
hshift
;
for
(
i
=
s
->
height
-
1
;
i
;
i
--
)
{
uint8_t
*
src1
=
&
((
uint8_t
*
)
s
->
picture_ptr
->
data
[
p
])[
i
/
2
*
s
->
linesize
[
p
]];
uint8_t
*
src2
=
&
((
uint8_t
*
)
s
->
picture_ptr
->
data
[
p
])[(
i
+
1
)
/
2
*
s
->
linesize
[
p
]];
if
(
src1
==
src2
)
{
memcpy
(
dst
,
src1
,
w
);
}
else
{
for
(
index
=
0
;
index
<
w
;
index
++
)
dst
[
index
]
=
(
src1
[
index
]
+
src2
[
index
])
>>
1
;
}
dst
-=
s
->
linesize
[
p
];
}
dst
-=
s
->
linesize
[
s
->
upscale_v
];
}
}
if
(
s
->
flipped
)
{
...
...
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