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
3eedd29b
Commit
3eedd29b
authored
Nov 21, 2011
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bethsoftvideo: return proper consumed size for palette packets.
Also check for sufficient packet size.
parent
5872c781
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
73 deletions
+78
-73
bethsoftvideo.c
libavcodec/bethsoftvideo.c
+7
-3
bethsoft-vid
tests/ref/fate/bethsoft-vid
+71
-70
No files found.
libavcodec/bethsoftvideo.c
View file @
3eedd29b
...
@@ -46,14 +46,19 @@ static av_cold int bethsoftvid_decode_init(AVCodecContext *avctx)
...
@@ -46,14 +46,19 @@ static av_cold int bethsoftvid_decode_init(AVCodecContext *avctx)
return
0
;
return
0
;
}
}
static
void
set_palette
(
AVFrame
*
frame
,
const
uint8_t
*
palette_buffer
)
static
int
set_palette
(
AVFrame
*
frame
,
const
uint8_t
*
palette_buffer
,
int
buf_size
)
{
{
uint32_t
*
palette
=
(
uint32_t
*
)
frame
->
data
[
1
];
uint32_t
*
palette
=
(
uint32_t
*
)
frame
->
data
[
1
];
int
a
;
int
a
;
if
(
buf_size
<
256
*
3
)
return
AVERROR_INVALIDDATA
;
for
(
a
=
0
;
a
<
256
;
a
++
){
for
(
a
=
0
;
a
<
256
;
a
++
){
palette
[
a
]
=
AV_RB24
(
&
palette_buffer
[
a
*
3
])
*
4
;
palette
[
a
]
=
AV_RB24
(
&
palette_buffer
[
a
*
3
])
*
4
;
}
}
frame
->
palette_has_changed
=
1
;
frame
->
palette_has_changed
=
1
;
return
256
*
3
;
}
}
static
int
bethsoftvid_decode_frame
(
AVCodecContext
*
avctx
,
static
int
bethsoftvid_decode_frame
(
AVCodecContext
*
avctx
,
...
@@ -80,8 +85,7 @@ static int bethsoftvid_decode_frame(AVCodecContext *avctx,
...
@@ -80,8 +85,7 @@ static int bethsoftvid_decode_frame(AVCodecContext *avctx,
switch
(
block_type
=
*
buf
++
){
switch
(
block_type
=
*
buf
++
){
case
PALETTE_BLOCK
:
case
PALETTE_BLOCK
:
set_palette
(
&
vid
->
frame
,
buf
);
return
set_palette
(
&
vid
->
frame
,
buf
,
buf_size
);
return
0
;
case
VIDEO_YOFF_P_FRAME
:
case
VIDEO_YOFF_P_FRAME
:
yoffset
=
bytestream_get_le16
(
&
buf
);
yoffset
=
bytestream_get_le16
(
&
buf
);
if
(
yoffset
>=
avctx
->
height
)
if
(
yoffset
>=
avctx
->
height
)
...
...
tests/ref/fate/bethsoft-vid
View file @
3eedd29b
0, 0, 192000, 0x
00000000
0, 0, 192000, 0x
decc683b
1, 0, 1480, 0x00000000
1, 0, 1480, 0x00000000
0, 1500, 192000, 0x0
1a6cf45
0, 1500, 192000, 0x0
0000000
0, 3000, 192000, 0x
d07d57e9
0, 3000, 192000, 0x
01a6cf45
0, 4500, 192000, 0x
3cb1dff5
0, 4500, 192000, 0x
d07d57e9
1, 5994, 1480, 0x20a92bd4
1, 5994, 1480, 0x20a92bd4
0, 6000, 192000, 0x
d1aaa8fb
0, 6000, 192000, 0x
3cb1dff5
0, 7500, 192000, 0x
75f526cd
0, 7500, 192000, 0x
d1aaa8fb
0, 9000, 192000, 0x
0f673577
0, 9000, 192000, 0x
75f526cd
0, 10500, 192000, 0x
897b6781
0, 10500, 192000, 0x
0f673577
1, 11988, 1850, 0xa9e48a74
1, 11988, 1850, 0xa9e48a74
0, 12000, 192000, 0x8
1e6b7f7
0, 12000, 192000, 0x8
97b6781
0, 13500, 192000, 0x
1f45ce61
0, 13500, 192000, 0x
81e6b7f7
0, 15000, 192000, 0x
5a0772a6
0, 15000, 192000, 0x
1f45ce61
0, 16500, 192000, 0x
f78732b3
0, 16500, 192000, 0x
5a0772a6
0, 18000, 192000, 0x
8427f9e5
0, 18000, 192000, 0x
f78732b3
1, 19481, 1480, 0x23ecd018
1, 19481, 1480, 0x23ecd018
0, 19500, 192000, 0x
40473f11
0, 19500, 192000, 0x
8427f9e5
0, 21000, 192000, 0x
173ceebe
0, 21000, 192000, 0x
40473f11
0, 22500, 192000, 0x1
36b9516
0, 22500, 192000, 0x1
73ceebe
0, 24000, 192000, 0x13
8d11ae
0, 24000, 192000, 0x13
6b9516
1, 25475, 1480, 0x206bb915
1, 25475, 1480, 0x206bb915
0, 25500, 192000, 0x
063dbff3
0, 25500, 192000, 0x
138d11ae
0, 27000, 192000, 0x
5280852f
0, 27000, 192000, 0x
063dbff3
0, 28500, 192000, 0x
99943a8
f
0, 28500, 192000, 0x
5280852
f
0, 30000, 192000, 0x
0330a728
0, 30000, 192000, 0x
99943a8f
1, 31469, 1850, 0xb0e10e75
1, 31469, 1850, 0xb0e10e75
0, 31500, 192000, 0x
5d35467d
0, 31500, 192000, 0x
0330a728
0, 33000, 192000, 0x
fd436343
0, 33000, 192000, 0x
5d35467d
0, 34500, 192000, 0x
c323fcfe
0, 34500, 192000, 0x
fd436343
0, 36000, 192000, 0x
2a1530a0
0, 36000, 192000, 0x
c323fcfe
0, 37500, 192000, 0x
bd43bb6
0
0, 37500, 192000, 0x
2a1530a
0
1, 38961, 1480, 0x8d9baedd
1, 38961, 1480, 0x8d9baedd
0, 39000, 192000, 0x
a47f5eab
0, 39000, 192000, 0x
bd43bb60
0, 40500, 192000, 0x
ff17f5f7
0, 40500, 192000, 0x
a47f5eab
0, 42000, 192000, 0x
b4140b55
0, 42000, 192000, 0x
ff17f5f7
0, 43500, 192000, 0xb
8782cc4
0, 43500, 192000, 0xb
4140b55
1, 44955, 1480, 0xb802aae1
1, 44955, 1480, 0xb802aae1
0, 45000, 192000, 0x
92975b8b
0, 45000, 192000, 0x
b8782cc4
0, 46500, 192000, 0x
f42a64d6
0, 46500, 192000, 0x
92975b8b
0, 48000, 192000, 0x
2cc7077d
0, 48000, 192000, 0x
f42a64d6
0, 49500, 192000, 0x
00080cc8
0, 49500, 192000, 0x
2cc7077d
1, 50950, 1480, 0xecd7b5cc
1, 50950, 1480, 0xecd7b5cc
0, 51000, 192000, 0x
584b48f3
0, 51000, 192000, 0x
00080cc8
0, 52500, 192000, 0x
d68f57da
0, 52500, 192000, 0x
584b48f3
0, 54000, 192000, 0x
60158422
0, 54000, 192000, 0x
d68f57da
0, 55500, 192000, 0x
d7fb89e6
0, 55500, 192000, 0x
60158422
1, 56944, 1850, 0x16861355
1, 56944, 1850, 0x16861355
0, 57000, 192000, 0x
97f1c76a
0, 57000, 192000, 0x
d7fb89e6
0, 58500, 192000, 0x
46c4bb9e
0, 58500, 192000, 0x
97f1c76a
0, 60000, 192000, 0x
d32f9b66
0, 60000, 192000, 0x
46c4bb9e
0, 61500, 192000, 0x
74f4388
6
0, 61500, 192000, 0x
d32f9b6
6
0, 63000, 192000, 0x
3c4e47df
0, 63000, 192000, 0x
74f43886
1, 64436, 1480, 0xa51690bd
1, 64436, 1480, 0xa51690bd
0, 64500, 192000, 0x
b5ac0a58
0, 64500, 192000, 0x
3c4e47df
0, 66000, 192000, 0x
cc572b31
0, 66000, 192000, 0x
b5ac0a58
0, 67500, 192000, 0x
b1739d26
0, 67500, 192000, 0x
cc572b31
0, 69000, 192000, 0x
73da5473
0, 69000, 192000, 0x
b1739d26
1, 70430, 1480, 0xdd0b90d1
1, 70430, 1480, 0xdd0b90d1
0, 70500, 192000, 0x
5f79f5bc
0, 70500, 192000, 0x
73da5473
0, 72000, 192000, 0x
0affc0a0
0, 72000, 192000, 0x
5f79f5bc
0, 73500, 192000, 0x
2b4d5c1c
0, 73500, 192000, 0x
0affc0a0
0, 75000, 192000, 0x
309b41b
c
0, 75000, 192000, 0x
2b4d5c1
c
1, 76424, 1850, 0x3ce6e333
1, 76424, 1850, 0x3ce6e333
0, 76500, 192000, 0x
d42b6424
0, 76500, 192000, 0x
309b41bc
0, 78000, 192000, 0x
4795c948
0, 78000, 192000, 0x
d42b6424
0, 79500, 192000, 0x
bc1a3a8b
0, 79500, 192000, 0x
4795c948
0, 81000, 192000, 0x
16529c5
b
0, 81000, 192000, 0x
bc1a3a8
b
0, 82500, 192000, 0x
6b1b31ba
0, 82500, 192000, 0x
16529c5b
1, 83917, 1480, 0xf8ce8ea3
1, 83917, 1480, 0xf8ce8ea3
0, 84000, 192000, 0x
569182ce
0, 84000, 192000, 0x
6b1b31ba
0, 85500, 192000, 0x
e6ea9866
0, 85500, 192000, 0x
569182ce
0, 87000, 192000, 0x
102c607
6
0, 87000, 192000, 0x
e6ea986
6
0, 88500, 192000, 0x
b29f527a
0, 88500, 192000, 0x
102c6076
1, 89911, 1480, 0xda4597af
1, 89911, 1480, 0xda4597af
0, 90000, 192000, 0x
040b4eee
0, 90000, 192000, 0x
b29f527a
0, 91500, 192000, 0x
92574f4a
0, 91500, 192000, 0x
040b4eee
0, 93000, 192000, 0x
1e8acdce
0, 93000, 192000, 0x
92574f4a
0, 94500, 192000, 0x1
becf516
0, 94500, 192000, 0x1
e8acdce
1, 95905, 1480, 0x918f7cb3
1, 95905, 1480, 0x918f7cb3
0, 96000, 192000, 0x
b62e977
6
0, 96000, 192000, 0x
1becf51
6
0, 97500, 192000, 0x
ed37a08e
0, 97500, 192000, 0x
b62e9776
0, 99000, 192000, 0x
c0719912
0, 99000, 192000, 0x
ed37a08e
0, 100500, 192000, 0x
24cf7a7e
0, 100500, 192000, 0x
c0719912
1, 101899, 1850, 0xca6edb15
1, 101899, 1850, 0xca6edb15
0, 102000, 192000, 0x0307f62f
0, 102000, 192000, 0x24cf7a7e
0, 103500, 192000, 0x79b7417b
0, 103500, 192000, 0x0307f62f
0, 105000, 192000, 0x79b7417b
1, 109392, 1480, 0xba279597
1, 109392, 1480, 0xba279597
1, 115386, 1480, 0xc5a38a9e
1, 115386, 1480, 0xc5a38a9e
1, 121380, 1850, 0x8147eef5
1, 121380, 1850, 0x8147eef5
...
...
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