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
e91a3f1b
Commit
e91a3f1b
authored
Jan 18, 2014
by
Kostya Shishkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dxtory: correctly handle YUV slices with average odd height
parent
ade4ecb4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
dxtory.c
libavcodec/dxtory.c
+12
-6
No files found.
libavcodec/dxtory.c
View file @
e91a3f1b
...
...
@@ -118,7 +118,8 @@ static int dxtory_decode_v2(AVCodecContext *avctx, AVFrame *pic,
{
GetByteContext
gb
;
GetBitContext
gb2
;
int
nslices
,
slice
,
slice_height
;
int
nslices
,
slice
,
slice_height
,
ref_slice_height
;
int
cur_y
,
next_y
;
uint32_t
off
,
slice_size
;
uint8_t
*
Y
,
*
U
,
*
V
;
int
ret
;
...
...
@@ -137,10 +138,10 @@ static int dxtory_decode_v2(AVCodecContext *avctx, AVFrame *pic,
return
AVERROR
(
ENOSYS
);
}
slice_height
=
avctx
->
height
/
nslices
;
if
((
avctx
->
width
&
1
)
||
(
slice_
height
&
1
))
{
avpriv_request_sample
(
avctx
,
"
slic
e dimensions %dx%d"
,
avctx
->
width
,
slice_
height
);
ref_
slice_height
=
avctx
->
height
/
nslices
;
if
((
avctx
->
width
&
1
)
||
(
avctx
->
height
&
1
))
{
avpriv_request_sample
(
avctx
,
"
Fram
e dimensions %dx%d"
,
avctx
->
width
,
avctx
->
height
);
}
avctx
->
pix_fmt
=
AV_PIX_FMT_YUV420P
;
...
...
@@ -151,8 +152,11 @@ static int dxtory_decode_v2(AVCodecContext *avctx, AVFrame *pic,
U
=
pic
->
data
[
1
];
V
=
pic
->
data
[
2
];
cur_y
=
0
;
next_y
=
ref_slice_height
;
for
(
slice
=
0
;
slice
<
nslices
;
slice
++
)
{
slice_size
=
bytestream2_get_le32
(
&
gb
);
slice_size
=
bytestream2_get_le32
(
&
gb
);
slice_height
=
(
next_y
&
~
1
)
-
(
cur_y
&
~
1
);
if
(
slice_size
>
src_size
-
off
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"invalid slice size %d (only %d bytes left)
\n
"
,
...
...
@@ -177,6 +181,8 @@ static int dxtory_decode_v2(AVCodecContext *avctx, AVFrame *pic,
U
+=
pic
->
linesize
[
1
]
*
(
slice_height
>>
1
);
V
+=
pic
->
linesize
[
2
]
*
(
slice_height
>>
1
);
off
+=
slice_size
;
cur_y
=
next_y
;
next_y
+=
ref_slice_height
;
}
return
0
;
...
...
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