summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandra Hájková <alexandra@khirnov.net>2016-04-12 12:29:20 +0200
committerAlexandra Hájková <alexandra@khirnov.net>2016-05-22 16:47:58 +0200
commit7b06de5468e7b7a8df0e133949aa76c026869e69 (patch)
tree4f504ff95c3ce0efc91d9d2475e372d2df2c938c
parent04ecb2d1cfbfa67ec4d18d9d668811384bf548dd (diff)
dvbsubdec: convert to the new bitstream reader
-rw-r--r--libavcodec/dvbsub_parser.c2
-rw-r--r--libavcodec/dvbsubdec.c68
2 files changed, 35 insertions, 35 deletions
diff --git a/libavcodec/dvbsub_parser.c b/libavcodec/dvbsub_parser.c
index 2e7d8c2aee..ce9a46b17c 100644
--- a/libavcodec/dvbsub_parser.c
+++ b/libavcodec/dvbsub_parser.c
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "avcodec.h"
-#include "get_bits.h"
+#include "bitstream.h"
#include "internal.h"
/* Parser (mostly) copied from dvdsub.c */
diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c
index 526f125262..bb409c0219 100644
--- a/libavcodec/dvbsubdec.c
+++ b/libavcodec/dvbsubdec.c
@@ -20,7 +20,7 @@
*/
#include "avcodec.h"
-#include "get_bits.h"
+#include "bitstream.h"
#include "bytestream.h"
#include "internal.h"
#include "libavutil/colorspace.h"
@@ -445,16 +445,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) {
@@ -465,10 +465,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;
@@ -481,12 +481,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;
@@ -499,8 +499,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;
@@ -523,7 +523,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 {
@@ -538,10 +538,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(0, AV_LOG_ERROR, "DVBSub error: line overflow\n");
- (*srcbuf) += (get_bits_count(&gb) + 7) >> 3;
+ (*srcbuf) += (bitstream_tell(&bc) + 7) >> 3;
return pixels_read;
}
@@ -550,16 +550,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) {
@@ -570,12 +570,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;
}
@@ -591,10 +591,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;
@@ -607,10 +607,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;
@@ -623,8 +623,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;
@@ -659,10 +659,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(0, AV_LOG_ERROR, "DVBSub error: line overflow\n");
- (*srcbuf) += (get_bits_count(&gb) + 7) >> 3;
+ (*srcbuf) += (bitstream_tell(&bc) + 7) >> 3;
return pixels_read;
}