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
168ddcd3
Commit
168ddcd3
authored
Aug 23, 2012
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mjpeg: fix fliping with emu edges.
Fixes Ticket121 Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
628e6d01
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
6 deletions
+24
-6
mjpegdec.c
libavcodec/mjpegdec.c
+24
-6
No files found.
libavcodec/mjpegdec.c
View file @
168ddcd3
...
...
@@ -967,11 +967,6 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah,
if
(
mb_bitmask
)
init_get_bits
(
&
mb_bitmask_gb
,
mb_bitmask
,
s
->
mb_width
*
s
->
mb_height
);
if
(
s
->
flipped
&&
s
->
avctx
->
flags
&
CODEC_FLAG_EMU_EDGE
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Can not flip image with CODEC_FLAG_EMU_EDGE set!
\n
"
);
s
->
flipped
=
0
;
}
if
(
s
->
flipped
&&
s
->
avctx
->
lowres
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Can not flip image with lowres
\n
"
);
s
->
flipped
=
0
;
...
...
@@ -983,7 +978,7 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah,
reference_data
[
c
]
=
reference
?
reference
->
data
[
c
]
:
NULL
;
linesize
[
c
]
=
s
->
linesize
[
c
];
s
->
coefs_finished
[
c
]
|=
1
;
if
(
s
->
flipped
)
{
if
(
s
->
flipped
&&
!
(
s
->
avctx
->
flags
&
CODEC_FLAG_EMU_EDGE
)
)
{
// picture should be flipped upside-down for this codec
int
offset
=
(
linesize
[
c
]
*
(
s
->
v_scount
[
i
]
*
(
8
*
s
->
mb_height
-
((
s
->
height
/
s
->
v_max
)
&
7
))
-
1
));
...
...
@@ -1795,6 +1790,29 @@ the_end:
dst
-=
s
->
linesize
[
s
->
upscale_v
];
}
}
if
(
s
->
flipped
&&
(
s
->
avctx
->
flags
&
CODEC_FLAG_EMU_EDGE
))
{
int
hshift
,
vshift
,
j
;
avcodec_get_chroma_sub_sample
(
s
->
avctx
->
pix_fmt
,
&
hshift
,
&
vshift
);
for
(
index
=
0
;
index
<
4
;
index
++
)
{
uint8_t
*
dst
=
s
->
picture_ptr
->
data
[
index
];
int
w
=
s
->
width
;
int
h
=
s
->
height
;
if
(
index
&&
index
<
3
){
w
=
-
((
-
w
)
>>
hshift
);
h
=
-
((
-
h
)
>>
vshift
);
}
if
(
dst
){
uint8_t
*
dst2
=
dst
+
s
->
linesize
[
index
]
*
(
h
-
1
);
for
(
i
=
0
;
i
<
h
/
2
;
i
++
)
{
for
(
j
=
0
;
j
<
w
;
j
++
)
FFSWAP
(
int
,
dst
[
j
],
dst2
[
j
]);
dst
+=
s
->
linesize
[
index
];
dst2
-=
s
->
linesize
[
index
];
}
}
}
}
av_log
(
avctx
,
AV_LOG_DEBUG
,
"decode frame unused %td bytes
\n
"
,
buf_end
-
buf_ptr
);
// return buf_end - buf_ptr;
...
...
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