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
d5a3a20d
Commit
d5a3a20d
authored
Oct 21, 2014
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/mjpegdec: simplify chroma_height calculation
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
17702f1f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
9 deletions
+7
-9
mjpegdec.c
libavcodec/mjpegdec.c
+7
-8
mjpegdec.h
libavcodec/mjpegdec.h
+0
-1
No files found.
libavcodec/mjpegdec.c
View file @
d5a3a20d
...
@@ -444,12 +444,10 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
...
@@ -444,12 +444,10 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
s
->
avctx
->
pix_fmt
=
AV_PIX_FMT_GBRAP
;
s
->
avctx
->
pix_fmt
=
AV_PIX_FMT_GBRAP
;
s
->
upscale_v
=
6
;
s
->
upscale_v
=
6
;
s
->
upscale_h
=
6
;
s
->
upscale_h
=
6
;
s
->
chroma_height
=
s
->
height
;
}
else
if
(
s
->
adobe_transform
==
2
&&
s
->
bits
<=
8
)
{
}
else
if
(
s
->
adobe_transform
==
2
&&
s
->
bits
<=
8
)
{
s
->
avctx
->
pix_fmt
=
AV_PIX_FMT_YUVA444P
;
s
->
avctx
->
pix_fmt
=
AV_PIX_FMT_YUVA444P
;
s
->
upscale_v
=
6
;
s
->
upscale_v
=
6
;
s
->
upscale_h
=
6
;
s
->
upscale_h
=
6
;
s
->
chroma_height
=
s
->
height
;
s
->
avctx
->
color_range
=
s
->
cs_itu601
?
AVCOL_RANGE_MPEG
:
AVCOL_RANGE_JPEG
;
s
->
avctx
->
color_range
=
s
->
cs_itu601
?
AVCOL_RANGE_MPEG
:
AVCOL_RANGE_JPEG
;
}
else
{
}
else
{
if
(
s
->
bits
<=
8
)
s
->
avctx
->
pix_fmt
=
AV_PIX_FMT_YUVA420P
;
if
(
s
->
bits
<=
8
)
s
->
avctx
->
pix_fmt
=
AV_PIX_FMT_YUVA420P
;
...
@@ -466,7 +464,6 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
...
@@ -466,7 +464,6 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
else
else
goto
unk_pixfmt
;
goto
unk_pixfmt
;
s
->
avctx
->
color_range
=
s
->
cs_itu601
?
AVCOL_RANGE_MPEG
:
AVCOL_RANGE_JPEG
;
s
->
avctx
->
color_range
=
s
->
cs_itu601
?
AVCOL_RANGE_MPEG
:
AVCOL_RANGE_JPEG
;
s
->
chroma_height
=
s
->
height
;
break
;
break
;
case
0x22221100
:
case
0x22221100
:
case
0x22112200
:
case
0x22112200
:
...
@@ -475,7 +472,6 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
...
@@ -475,7 +472,6 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
else
else
goto
unk_pixfmt
;
goto
unk_pixfmt
;
s
->
avctx
->
color_range
=
s
->
cs_itu601
?
AVCOL_RANGE_MPEG
:
AVCOL_RANGE_JPEG
;
s
->
avctx
->
color_range
=
s
->
cs_itu601
?
AVCOL_RANGE_MPEG
:
AVCOL_RANGE_JPEG
;
s
->
chroma_height
=
(
s
->
height
+
1
)
/
2
;
break
;
break
;
case
0x11000000
:
case
0x11000000
:
case
0x13000000
:
case
0x13000000
:
...
@@ -499,7 +495,6 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
...
@@ -499,7 +495,6 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
else
else
goto
unk_pixfmt
;
goto
unk_pixfmt
;
s
->
avctx
->
color_range
=
s
->
cs_itu601
?
AVCOL_RANGE_MPEG
:
AVCOL_RANGE_JPEG
;
s
->
avctx
->
color_range
=
s
->
cs_itu601
?
AVCOL_RANGE_MPEG
:
AVCOL_RANGE_JPEG
;
s
->
chroma_height
=
(
s
->
height
+
1
)
/
2
;
break
;
break
;
case
0x21111100
:
case
0x21111100
:
if
(
s
->
bits
<=
8
)
s
->
avctx
->
pix_fmt
=
s
->
cs_itu601
?
AV_PIX_FMT_YUV422P
:
AV_PIX_FMT_YUVJ422P
;
if
(
s
->
bits
<=
8
)
s
->
avctx
->
pix_fmt
=
s
->
cs_itu601
?
AV_PIX_FMT_YUV422P
:
AV_PIX_FMT_YUVJ422P
;
...
@@ -521,7 +516,6 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
...
@@ -521,7 +516,6 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
s
->
avctx
->
color_range
=
s
->
cs_itu601
?
AVCOL_RANGE_MPEG
:
AVCOL_RANGE_JPEG
;
s
->
avctx
->
color_range
=
s
->
cs_itu601
?
AVCOL_RANGE_MPEG
:
AVCOL_RANGE_JPEG
;
if
(
pix_fmt_id
==
0x42111100
)
{
if
(
pix_fmt_id
==
0x42111100
)
{
s
->
upscale_h
=
6
;
s
->
upscale_h
=
6
;
s
->
chroma_height
=
(
s
->
height
+
1
)
/
2
;
}
else
if
(
pix_fmt_id
==
0x24111100
)
{
}
else
if
(
pix_fmt_id
==
0x24111100
)
{
s
->
upscale_v
=
6
;
s
->
upscale_v
=
6
;
}
}
...
@@ -2103,12 +2097,17 @@ the_end:
...
@@ -2103,12 +2097,17 @@ the_end:
for
(
p
=
0
;
p
<
4
;
p
++
)
{
for
(
p
=
0
;
p
<
4
;
p
++
)
{
uint8_t
*
line
=
s
->
picture_ptr
->
data
[
p
];
uint8_t
*
line
=
s
->
picture_ptr
->
data
[
p
];
int
w
=
s
->
width
;
int
w
=
s
->
width
;
int
h
=
s
->
height
;
if
(
!
(
s
->
upscale_h
&
(
1
<<
p
)))
if
(
!
(
s
->
upscale_h
&
(
1
<<
p
)))
continue
;
continue
;
if
(
p
==
1
||
p
==
2
)
if
(
p
==
1
||
p
==
2
)
{
w
>>=
hshift
;
w
>>=
hshift
;
h
=
FF_CEIL_RSHIFT
(
h
,
vshift
);
}
if
(
s
->
upscale_v
&
(
1
<<
p
))
h
=
(
h
+
1
)
>>
1
;
av_assert0
(
w
>
0
);
av_assert0
(
w
>
0
);
for
(
i
=
0
;
i
<
s
->
chroma_height
;
i
++
)
{
for
(
i
=
0
;
i
<
h
;
i
++
)
{
if
(
is16bit
)
((
uint16_t
*
)
line
)[
w
-
1
]
=
((
uint16_t
*
)
line
)[(
w
-
1
)
/
2
];
if
(
is16bit
)
((
uint16_t
*
)
line
)[
w
-
1
]
=
((
uint16_t
*
)
line
)[(
w
-
1
)
/
2
];
else
line
[
w
-
1
]
=
line
[(
w
-
1
)
/
2
];
else
line
[
w
-
1
]
=
line
[(
w
-
1
)
/
2
];
for
(
index
=
w
-
2
;
index
>
0
;
index
--
)
{
for
(
index
=
w
-
2
;
index
>
0
;
index
--
)
{
...
...
libavcodec/mjpegdec.h
View file @
d5a3a20d
...
@@ -63,7 +63,6 @@ typedef struct MJpegDecodeContext {
...
@@ -63,7 +63,6 @@ typedef struct MJpegDecodeContext {
int
progressive
;
int
progressive
;
int
rgb
;
int
rgb
;
int
upscale_h
;
int
upscale_h
;
int
chroma_height
;
int
upscale_v
;
int
upscale_v
;
int
rct
;
/* standard rct */
int
rct
;
/* standard rct */
int
pegasus_rct
;
/* pegasus reversible colorspace transform */
int
pegasus_rct
;
/* pegasus reversible colorspace transform */
...
...
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