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
b2af057a
Commit
b2af057a
authored
Mar 25, 2012
by
Ronald S. Bultje
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
smacker: convert palette and header reading to bytestream2.
parent
c3bbd0b5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
smacker.c
libavcodec/smacker.c
+10
-10
No files found.
libavcodec/smacker.c
View file @
b2af057a
...
...
@@ -357,17 +357,17 @@ static av_always_inline int smk_get_code(GetBitContext *gb, int *recode, int *la
static
int
decode_frame
(
AVCodecContext
*
avctx
,
void
*
data
,
int
*
data_size
,
AVPacket
*
avpkt
)
{
const
uint8_t
*
buf
=
avpkt
->
data
;
int
buf_size
=
avpkt
->
size
;
SmackVContext
*
const
smk
=
avctx
->
priv_data
;
uint8_t
*
out
;
uint32_t
*
pal
;
GetByteContext
gb2
;
GetBitContext
gb
;
int
blocks
,
blk
,
bw
,
bh
;
int
i
;
int
stride
;
int
flags
;
if
(
buf_
size
<=
769
)
if
(
avpkt
->
size
<=
769
)
return
0
;
smk
->
pic
.
reference
=
1
;
...
...
@@ -379,23 +379,23 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
/* make the palette available on the way out */
pal
=
(
uint32_t
*
)
smk
->
pic
.
data
[
1
];
smk
->
pic
.
palette_has_changed
=
buf
[
0
]
&
1
;
smk
->
pic
.
key_frame
=
!!
(
buf
[
0
]
&
2
);
bytestream2_init
(
&
gb2
,
avpkt
->
data
,
avpkt
->
size
);
flags
=
bytestream2_get_byteu
(
&
gb2
);
smk
->
pic
.
palette_has_changed
=
flags
&
1
;
smk
->
pic
.
key_frame
=
!!
(
flags
&
2
);
if
(
smk
->
pic
.
key_frame
)
smk
->
pic
.
pict_type
=
AV_PICTURE_TYPE_I
;
else
smk
->
pic
.
pict_type
=
AV_PICTURE_TYPE_P
;
buf
++
;
for
(
i
=
0
;
i
<
256
;
i
++
)
*
pal
++
=
bytestream_get_be24
(
&
buf
);
buf_size
-=
769
;
*
pal
++
=
bytestream2_get_be24u
(
&
gb2
);
last_reset
(
smk
->
mmap_tbl
,
smk
->
mmap_last
);
last_reset
(
smk
->
mclr_tbl
,
smk
->
mclr_last
);
last_reset
(
smk
->
full_tbl
,
smk
->
full_last
);
last_reset
(
smk
->
type_tbl
,
smk
->
type_last
);
init_get_bits
(
&
gb
,
buf
,
buf_size
*
8
);
init_get_bits
(
&
gb
,
avpkt
->
data
+
769
,
(
avpkt
->
size
-
769
)
*
8
);
blk
=
0
;
bw
=
avctx
->
width
>>
2
;
...
...
@@ -506,7 +506,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
*
(
AVFrame
*
)
data
=
smk
->
pic
;
/* always report that the buffer was completely consumed */
return
buf_
size
;
return
avpkt
->
size
;
}
...
...
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