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
388a221a
Commit
388a221a
authored
Feb 13, 2020
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/midivid: improve decoding of widths not multiple of 32
parent
018a4279
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
midivid.c
libavcodec/midivid.c
+8
-6
No files found.
libavcodec/midivid.c
View file @
388a221a
...
...
@@ -59,16 +59,17 @@ static int decode_mvdv(MidiVidContext *s, AVCodecContext *avctx, AVFrame *frame)
uint32_t
nb_blocks
;
nb_vectors
=
bytestream2_get_le16
(
gb
);
intra_flag
=
bytestream2_get_le16
(
gb
);
intra_flag
=
!!
bytestream2_get_le16
(
gb
);
if
(
intra_flag
)
{
nb_blocks
=
(
avctx
->
width
/
2
)
*
(
avctx
->
height
/
2
);
}
else
{
int
ret
,
skip_linesize
;
int
ret
,
skip_linesize
,
padding
;
nb_blocks
=
bytestream2_get_le32
(
gb
);
skip_linesize
=
avctx
->
width
>>
1
;
mask_start
=
gb
->
buffer_start
+
bytestream2_tell
(
gb
);
mask_size
=
(
avctx
->
width
>>
5
)
*
(
avctx
->
height
>>
2
);
mask_size
=
(
FFALIGN
(
avctx
->
width
,
32
)
>>
2
)
*
(
avctx
->
height
>>
2
)
>>
3
;
padding
=
(
FFALIGN
(
avctx
->
width
,
32
)
-
avctx
->
width
)
>>
2
;
if
(
bytestream2_get_bytes_left
(
gb
)
<
mask_size
)
return
AVERROR_INVALIDDATA
;
...
...
@@ -88,6 +89,7 @@ static int decode_mvdv(MidiVidContext *s, AVCodecContext *avctx, AVFrame *frame)
skip
[(
y
*
2
+
1
)
*
skip_linesize
+
x
*
2
]
=
flag
;
skip
[(
y
*
2
+
1
)
*
skip_linesize
+
x
*
2
+
1
]
=
flag
;
}
skip_bits_long
(
&
mask
,
padding
);
}
}
...
...
@@ -96,10 +98,10 @@ static int decode_mvdv(MidiVidContext *s, AVCodecContext *avctx, AVFrame *frame)
return
AVERROR_INVALIDDATA
;
bytestream2_skip
(
gb
,
nb_vectors
*
12
);
if
(
nb_vectors
>
256
)
{
if
(
bytestream2_get_bytes_left
(
gb
)
<
(
nb_blocks
+
7
)
/
8
)
if
(
bytestream2_get_bytes_left
(
gb
)
<
(
nb_blocks
+
7
*
!
intra_flag
)
/
8
)
return
AVERROR_INVALIDDATA
;
bytestream2_init
(
&
idx9
,
gb
->
buffer_start
+
bytestream2_tell
(
gb
),
(
nb_blocks
+
7
)
/
8
);
bytestream2_skip
(
gb
,
(
nb_blocks
+
7
)
/
8
);
bytestream2_init
(
&
idx9
,
gb
->
buffer_start
+
bytestream2_tell
(
gb
),
(
nb_blocks
+
7
*
!
intra_flag
)
/
8
);
bytestream2_skip
(
gb
,
(
nb_blocks
+
7
*
!
intra_flag
)
/
8
);
}
skip
=
s
->
skip
;
...
...
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