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
178b4ea5
Commit
178b4ea5
authored
Apr 15, 2016
by
Alexandra Hájková
Committed by
Diego Biurrun
Nov 24, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xsubdec: Convert to the new bitstream reader
parent
be35ef92
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
xsubdec.c
libavcodec/xsubdec.c
+8
-7
No files found.
libavcodec/xsubdec.c
View file @
178b4ea5
...
...
@@ -21,8 +21,9 @@
#include "libavutil/mathematics.h"
#include "libavutil/imgutils.h"
#include "avcodec.h"
#include "
get_bits
.h"
#include "
bitstream
.h"
#include "bytestream.h"
static
av_cold
int
decode_init
(
AVCodecContext
*
avctx
)
{
...
...
@@ -55,7 +56,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
uint8_t
*
bitmap
;
int
w
,
h
,
x
,
y
,
i
;
int64_t
packet_time
=
0
;
GetBitContext
gb
;
BitstreamContext
bc
;
int
has_alpha
=
avctx
->
codec_tag
==
MKTAG
(
'D'
,
'X'
,
'S'
,
'A'
);
memset
(
sub
,
0
,
sizeof
(
*
sub
));
...
...
@@ -146,15 +147,15 @@ FF_ENABLE_DEPRECATION_WARNINGS
#endif
// process RLE-compressed data
init_get_bits
(
&
gb
,
buf
,
(
buf_end
-
buf
)
*
8
);
bitstream_init
(
&
bc
,
buf
,
(
buf_end
-
buf
)
*
8
);
bitmap
=
sub
->
rects
[
0
]
->
data
[
0
];
for
(
y
=
0
;
y
<
h
;
y
++
)
{
// interlaced: do odd lines
if
(
y
==
(
h
+
1
)
/
2
)
bitmap
=
sub
->
rects
[
0
]
->
data
[
0
]
+
w
;
for
(
x
=
0
;
x
<
w
;
)
{
int
log2
=
ff_log2_tab
[
show_bits
(
&
gb
,
8
)];
int
run
=
get_bits
(
&
gb
,
14
-
4
*
(
log2
>>
1
));
int
color
=
get_bits
(
&
gb
,
2
);
int
log2
=
ff_log2_tab
[
bitstream_peek
(
&
bc
,
8
)];
int
run
=
bitstream_read
(
&
bc
,
14
-
4
*
(
log2
>>
1
));
int
color
=
bitstream_read
(
&
bc
,
2
);
run
=
FFMIN
(
run
,
w
-
x
);
// run length 0 means till end of row
if
(
!
run
)
run
=
w
-
x
;
...
...
@@ -164,7 +165,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
}
// interlaced, skip every second line
bitmap
+=
w
;
align_get_bits
(
&
gb
);
bitstream_align
(
&
bc
);
}
*
data_size
=
1
;
return
buf_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