*/
#include "avcodec.h"
-#include "get_bits.h"
+#include "bitstream.h"
#include "bytestream.h"
#include "internal.h"
#include "libavutil/colorspace.h"
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) {
}
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;
}
}
} 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;
}
}
} 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;
*destbuf++ = bits;
}
} else {
- (*srcbuf) += (get_bits_count(&gb) + 7) >> 3;
+ *srcbuf += (bitstream_tell(&bc) + 7) >> 3;
return pixels_read;
}
} else {
}
}
- 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;
}
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) {
}
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;
}
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;
}
}
} 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;
}
}
} 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;
}
}
- 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;
}