27 #define BITSTREAM_READER_LE
67 uint8_t *dst,
const int dst_size)
72 const uint8_t *dst_end = dst + dst_size;
76 tree_size = bytestream2_get_byte(&s->
gb);
77 eof = bytestream2_get_byte(&s->
gb);
78 tree_root = eof + tree_size;
82 bits = bytestream2_get_byte(&s->
gb);
85 int bit = !!(bits &
mask);
88 node = bytestream2_get_byte(&tree);
100 bits = bytestream2_get_byteu(&s->
gb);
109 uint8_t *dest,
const int dest_len)
114 const uint8_t *dest_end = dest + dest_len;
116 while (dest < dest_end) {
120 opcode = bytestream2_get_byteu(&s->
gb);
124 if ((opcode & 0x80) == 0) {
126 back = ((opcode & 0x60) << 3) + bytestream2_get_byte(&s->
gb) + 1;
127 size2 = ((opcode & 0x1c) >> 2) + 3;
128 }
else if ((opcode & 0x40) == 0) {
129 size = bytestream2_peek_byte(&s->
gb) >> 6;
130 back = (bytestream2_get_be16(&s->
gb) & 0x3fff) + 1;
131 size2 = (opcode & 0x3f) + 4;
134 back = ((opcode & 0x10) << 12) + bytestream2_get_be16(&s->
gb) + 1;
135 size2 = ((opcode & 0x0c) << 6) + bytestream2_get_byte(&s->
gb) + 5;
136 if (size + size2 > dest_end - dest)
139 if (dest + size + size2 > dest_end ||
140 dest - orig_dest + size < back)
147 int finish = opcode >= 0xfc;
149 size = finish ? opcode & 3 : ((opcode & 0x1f) << 2) + 4;
150 if (dest_end - dest < size)
158 return dest - orig_dest;
169 int mode, offset, dec_size, table_size;
178 mode = bytestream2_get_le16(&s->
gb);
180 table_size = bytestream2_get_le16(&s->
gb);
181 offset = table_size * 2;
200 src_end = src + dec_size;
202 for (j = 0; j < avctx->
height >> 1; j++) {
203 for (i = 0; i < avctx->
width >> 1; i++) {
205 if (val && val < table_size) {
206 val =
AV_RL16(table + (val << 1));
207 uval = (val >> 3) & 0xF8;
208 vval = (val >> 8) & 0xF8;
209 U[i] = uval | (uval >> 5);
210 V[i] = vval | (vval >> 5);
226 for (j = 0; j < avctx->
height >> 2; j++) {
227 for (i = 0; i < avctx->
width >> 1; i += 2) {
229 if (val && val < table_size) {
230 val =
AV_RL16(table + (val << 1));
231 uval = (val >> 3) & 0xF8;
232 vval = (val >> 8) & 0xF8;
233 U[i] = U[i+1] = U2[i] = U2[i+1] = uval | (uval >> 5);
234 V[i] = V[i+1] = V2[i] = V2[i+1] = vval | (vval >> 5);
243 int lines = ((avctx->
height + 1) >> 1) - (avctx->
height >> 2) * 2;
257 unsigned chroma_off, corr_off;
262 chroma_off = bytestream2_get_le32(&s->
gb);
263 corr_off = bytestream2_get_le32(&s->
gb);
282 for (j = 1; j < avctx->
width - 1; j += 2) {
283 cur = (last + *src++) & 0x1F;
284 ybuf[j] = last + cur;
285 ybuf[j+1] = cur << 1;
290 ybuf += avctx->
width;
292 for (i = 1; i < avctx->
height; i++) {
293 last = ((prev_buf[0] >> 1) + *src++) & 0x1F;
295 for (j = 1; j < avctx->
width - 1; j += 2) {
296 cur = ((prev_buf[j + 1] >> 1) + *src++) & 0x1F;
297 ybuf[j] = last + cur;
298 ybuf[j+1] = cur << 1;
303 ybuf += avctx->
width;
313 for (i = 0; i < dec_size; i++)
319 for (j = 0; j < avctx->
height; j++) {
320 for (i = 0; i < avctx->
width; i++)
321 ybuf[i] = (src[i] << 2) | (src[i] >> 3);
349 for (i = 0; i < avctx->
height; i++) {
350 last = (ybuf[0] + (*src++ << 1)) & 0x3F;
352 for (j = 1; j < avctx->
width - 1; j += 2) {
353 cur = (ybuf[j + 1] + (*src++ << 1)) & 0x3F;
354 ybuf[j] = (last + cur) >> 1;
359 ybuf += avctx->
width;
364 for (j = 0; j < avctx->
height; j++) {
365 for (i = 0; i < avctx->
width; i++)
366 ybuf[i] = (src[i] << 2) | (src[i] >> 3);
375 void *
data,
int *got_frame,
392 ftype = bytestream2_get_le32(&s->
gb);