27 #define BITSTREAM_READER_LE
52 if (avctx->
width & 1) {
71 uint8_t *dst,
const int dst_size)
76 const uint8_t *dst_end = dst + dst_size;
80 tree_size = bytestream2_get_byte(&s->
gb);
81 eof = bytestream2_get_byte(&s->
gb);
82 tree_root = eof + tree_size;
86 bits = bytestream2_get_byte(&s->
gb);
89 int bit = !!(bits &
mask);
92 node = bytestream2_get_byte(&tree);
104 bits = bytestream2_get_byteu(&s->
gb);
113 uint8_t *dest,
const int dest_len)
118 const uint8_t *dest_end = dest + dest_len;
120 while (dest < dest_end) {
124 opcode = bytestream2_get_byteu(&s->
gb);
128 if ((opcode & 0x80) == 0) {
130 back = ((opcode & 0x60) << 3) + bytestream2_get_byte(&s->
gb) + 1;
131 size2 = ((opcode & 0x1c) >> 2) + 3;
132 }
else if ((opcode & 0x40) == 0) {
133 size = bytestream2_peek_byte(&s->
gb) >> 6;
134 back = (bytestream2_get_be16(&s->
gb) & 0x3fff) + 1;
135 size2 = (opcode & 0x3f) + 4;
138 back = ((opcode & 0x10) << 12) + bytestream2_get_be16(&s->
gb) + 1;
139 size2 = ((opcode & 0x0c) << 6) + bytestream2_get_byte(&s->
gb) + 5;
140 if (size + size2 > dest_end - dest)
143 if (dest + size + size2 > dest_end ||
144 dest - orig_dest + size < back)
151 int finish = opcode >= 0xfc;
153 size = finish ? opcode & 3 : ((opcode & 0x1f) << 2) + 4;
154 if (dest_end - dest < size)
162 return dest - orig_dest;
173 int mode, offset, dec_size, table_size;
182 mode = bytestream2_get_le16(&s->
gb);
184 table_size = bytestream2_get_le16(&s->
gb);
185 offset = table_size * 2;
204 src_end = src + dec_size;
206 for (j = 0; j < avctx->
height >> 1; j++) {
207 for (i = 0; i < avctx->
width >> 1; i++) {
209 if (val && val < table_size) {
210 val =
AV_RL16(table + (val << 1));
211 uval = (val >> 3) & 0xF8;
212 vval = (val >> 8) & 0xF8;
213 U[i] = uval | (uval >> 5);
214 V[i] = vval | (vval >> 5);
230 for (j = 0; j < avctx->
height >> 2; j++) {
231 for (i = 0; i < avctx->
width >> 1; i += 2) {
233 if (val && val < table_size) {
234 val =
AV_RL16(table + (val << 1));
235 uval = (val >> 3) & 0xF8;
236 vval = (val >> 8) & 0xF8;
237 U[i] = U[i+1] = U2[i] = U2[i+1] = uval | (uval >> 5);
238 V[i] = V[i+1] = V2[i] = V2[i+1] = vval | (vval >> 5);
247 int lines = ((avctx->
height + 1) >> 1) - (avctx->
height >> 2) * 2;
261 unsigned chroma_off, corr_off;
266 chroma_off = bytestream2_get_le32(&s->
gb);
267 corr_off = bytestream2_get_le32(&s->
gb);
286 for (j = 1; j < avctx->
width - 1; j += 2) {
287 cur = (last + *src++) & 0x1F;
288 ybuf[j] = last + cur;
289 ybuf[j+1] = cur << 1;
294 ybuf += avctx->
width;
296 for (i = 1; i < avctx->
height; i++) {
297 last = ((prev_buf[0] >> 1) + *src++) & 0x1F;
299 for (j = 1; j < avctx->
width - 1; j += 2) {
300 cur = ((prev_buf[j + 1] >> 1) + *src++) & 0x1F;
301 ybuf[j] = last + cur;
302 ybuf[j+1] = cur << 1;
307 ybuf += avctx->
width;
317 for (i = 0; i < dec_size; i++)
323 for (j = 0; j < avctx->
height; j++) {
324 for (i = 0; i < avctx->
width; i++)
325 ybuf[i] = (src[i] << 2) | (src[i] >> 3);
353 for (i = 0; i < avctx->
height; i++) {
354 last = (ybuf[0] + (*src++ << 1)) & 0x3F;
356 for (j = 1; j < avctx->
width - 1; j += 2) {
357 cur = (ybuf[j + 1] + (*src++ << 1)) & 0x3F;
358 ybuf[j] = (last + cur) >> 1;
363 ybuf += avctx->
width;
368 for (j = 0; j < avctx->
height; j++) {
369 for (i = 0; i < avctx->
width; i++)
370 ybuf[i] = (src[i] << 2) | (src[i] >> 3);
379 void *
data,
int *got_frame,
396 ftype = bytestream2_get_le32(&s->
gb);