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
9aec009f
Commit
9aec009f
authored
Apr 12, 2016
by
Alexandra Hájková
Committed by
Diego Biurrun
Jan 09, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dvbsubdec: Convert to the new bitstream reader
parent
d7fe1163
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
34 deletions
+34
-34
dvbsubdec.c
libavcodec/dvbsubdec.c
+34
-34
No files found.
libavcodec/dvbsubdec.c
View file @
9aec009f
...
...
@@ -20,7 +20,7 @@
*/
#include "avcodec.h"
#include "
get_bits
.h"
#include "
bitstream
.h"
#include "bytestream.h"
#include "internal.h"
#include "libavutil/colorspace.h"
...
...
@@ -330,16 +330,16 @@ static int dvbsub_read_2bit_string(uint8_t *destbuf, int dbuf_len,
const
uint8_t
**
srcbuf
,
int
buf_size
,
int
non_mod
,
uint8_t
*
map_table
)
{
GetBitContext
gb
;
BitstreamContext
bc
;
int
bits
;
int
run_length
;
int
pixels_read
=
0
;
init_get_bits
(
&
gb
,
*
srcbuf
,
buf_size
<<
3
);
bitstream_init
(
&
bc
,
*
srcbuf
,
buf_size
<<
3
);
while
(
get_bits_count
(
&
gb
)
<
buf_size
<<
3
&&
pixels_read
<
dbuf_len
)
{
bits
=
get_bits
(
&
gb
,
2
);
while
(
bitstream_tell
(
&
bc
)
<
buf_size
<<
3
&&
pixels_read
<
dbuf_len
)
{
bits
=
bitstream_read
(
&
bc
,
2
);
if
(
bits
)
{
if
(
non_mod
!=
1
||
bits
!=
1
)
{
...
...
@@ -350,10 +350,10 @@ static int dvbsub_read_2bit_string(uint8_t *destbuf, int dbuf_len,
}
pixels_read
++
;
}
else
{
bits
=
get_bits1
(
&
gb
);
bits
=
bitstream_read_bit
(
&
bc
);
if
(
bits
==
1
)
{
run_length
=
get_bits
(
&
gb
,
3
)
+
3
;
bits
=
get_bits
(
&
gb
,
2
);
run_length
=
bitstream_read
(
&
bc
,
3
)
+
3
;
bits
=
bitstream_read
(
&
bc
,
2
);
if
(
non_mod
==
1
&&
bits
==
1
)
pixels_read
+=
run_length
;
...
...
@@ -366,12 +366,12 @@ static int dvbsub_read_2bit_string(uint8_t *destbuf, int dbuf_len,
}
}
}
else
{
bits
=
get_bits1
(
&
gb
);
bits
=
bitstream_read_bit
(
&
bc
);
if
(
bits
==
0
)
{
bits
=
get_bits
(
&
gb
,
2
);
bits
=
bitstream_read
(
&
bc
,
2
);
if
(
bits
==
2
)
{
run_length
=
get_bits
(
&
gb
,
4
)
+
12
;
bits
=
get_bits
(
&
gb
,
2
);
run_length
=
bitstream_read
(
&
bc
,
4
)
+
12
;
bits
=
bitstream_read
(
&
bc
,
2
);
if
(
non_mod
==
1
&&
bits
==
1
)
pixels_read
+=
run_length
;
...
...
@@ -384,8 +384,8 @@ static int dvbsub_read_2bit_string(uint8_t *destbuf, int dbuf_len,
}
}
}
else
if
(
bits
==
3
)
{
run_length
=
get_bits
(
&
gb
,
8
)
+
29
;
bits
=
get_bits
(
&
gb
,
2
);
run_length
=
bitstream_read
(
&
bc
,
8
)
+
29
;
bits
=
bitstream_read
(
&
bc
,
2
);
if
(
non_mod
==
1
&&
bits
==
1
)
pixels_read
+=
run_length
;
...
...
@@ -408,7 +408,7 @@ static int dvbsub_read_2bit_string(uint8_t *destbuf, int dbuf_len,
*
destbuf
++
=
bits
;
}
}
else
{
(
*
srcbuf
)
+=
(
get_bits_count
(
&
gb
)
+
7
)
>>
3
;
*
srcbuf
+=
(
bitstream_tell
(
&
bc
)
+
7
)
>>
3
;
return
pixels_read
;
}
}
else
{
...
...
@@ -423,10 +423,10 @@ static int dvbsub_read_2bit_string(uint8_t *destbuf, int dbuf_len,
}
}
if
(
get_bits
(
&
gb
,
6
))
if
(
bitstream_read
(
&
bc
,
6
))
av_log
(
NULL
,
AV_LOG_ERROR
,
"DVBSub error: line overflow
\n
"
);
(
*
srcbuf
)
+=
(
get_bits_count
(
&
gb
)
+
7
)
>>
3
;
*
srcbuf
+=
(
bitstream_tell
(
&
bc
)
+
7
)
>>
3
;
return
pixels_read
;
}
...
...
@@ -435,16 +435,16 @@ static int dvbsub_read_4bit_string(uint8_t *destbuf, int dbuf_len,
const
uint8_t
**
srcbuf
,
int
buf_size
,
int
non_mod
,
uint8_t
*
map_table
)
{
GetBitContext
gb
;
BitstreamContext
bc
;
int
bits
;
int
run_length
;
int
pixels_read
=
0
;
init_get_bits
(
&
gb
,
*
srcbuf
,
buf_size
<<
3
);
bitstream_init
(
&
bc
,
*
srcbuf
,
buf_size
<<
3
);
while
(
get_bits_count
(
&
gb
)
<
buf_size
<<
3
&&
pixels_read
<
dbuf_len
)
{
bits
=
get_bits
(
&
gb
,
4
);
while
(
bitstream_tell
(
&
bc
)
<
buf_size
<<
3
&&
pixels_read
<
dbuf_len
)
{
bits
=
bitstream_read
(
&
bc
,
4
);
if
(
bits
)
{
if
(
non_mod
!=
1
||
bits
!=
1
)
{
...
...
@@ -455,12 +455,12 @@ static int dvbsub_read_4bit_string(uint8_t *destbuf, int dbuf_len,
}
pixels_read
++
;
}
else
{
bits
=
get_bits1
(
&
gb
);
bits
=
bitstream_read_bit
(
&
bc
);
if
(
bits
==
0
)
{
run_length
=
get_bits
(
&
gb
,
3
);
run_length
=
bitstream_read
(
&
bc
,
3
);
if
(
run_length
==
0
)
{
(
*
srcbuf
)
+=
(
get_bits_count
(
&
gb
)
+
7
)
>>
3
;
*
srcbuf
+=
(
bitstream_tell
(
&
bc
)
+
7
)
>>
3
;
return
pixels_read
;
}
...
...
@@ -476,10 +476,10 @@ static int dvbsub_read_4bit_string(uint8_t *destbuf, int dbuf_len,
pixels_read
++
;
}
}
else
{
bits
=
get_bits1
(
&
gb
);
bits
=
bitstream_read_bit
(
&
bc
);
if
(
bits
==
0
)
{
run_length
=
get_bits
(
&
gb
,
2
)
+
4
;
bits
=
get_bits
(
&
gb
,
4
);
run_length
=
bitstream_read
(
&
bc
,
2
)
+
4
;
bits
=
bitstream_read
(
&
bc
,
4
);
if
(
non_mod
==
1
&&
bits
==
1
)
pixels_read
+=
run_length
;
...
...
@@ -492,10 +492,10 @@ static int dvbsub_read_4bit_string(uint8_t *destbuf, int dbuf_len,
}
}
}
else
{
bits
=
get_bits
(
&
gb
,
2
);
bits
=
bitstream_read
(
&
bc
,
2
);
if
(
bits
==
2
)
{
run_length
=
get_bits
(
&
gb
,
4
)
+
9
;
bits
=
get_bits
(
&
gb
,
4
);
run_length
=
bitstream_read
(
&
bc
,
4
)
+
9
;
bits
=
bitstream_read
(
&
bc
,
4
);
if
(
non_mod
==
1
&&
bits
==
1
)
pixels_read
+=
run_length
;
...
...
@@ -508,8 +508,8 @@ static int dvbsub_read_4bit_string(uint8_t *destbuf, int dbuf_len,
}
}
}
else
if
(
bits
==
3
)
{
run_length
=
get_bits
(
&
gb
,
8
)
+
25
;
bits
=
get_bits
(
&
gb
,
4
);
run_length
=
bitstream_read
(
&
bc
,
8
)
+
25
;
bits
=
bitstream_read
(
&
bc
,
4
);
if
(
non_mod
==
1
&&
bits
==
1
)
pixels_read
+=
run_length
;
...
...
@@ -544,10 +544,10 @@ static int dvbsub_read_4bit_string(uint8_t *destbuf, int dbuf_len,
}
}
if
(
get_bits
(
&
gb
,
8
))
if
(
bitstream_read
(
&
bc
,
8
))
av_log
(
NULL
,
AV_LOG_ERROR
,
"DVBSub error: line overflow
\n
"
);
(
*
srcbuf
)
+=
(
get_bits_count
(
&
gb
)
+
7
)
>>
3
;
*
srcbuf
+=
(
bitstream_tell
(
&
bc
)
+
7
)
>>
3
;
return
pixels_read
;
}
...
...
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