27 #define BITSTREAM_READER_LE
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;
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++) {
204 if (src_end - src < 1)
208 if (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);
228 for (j = 0; j < avctx->
height >> 2; j++) {
229 for (i = 0; i < avctx->
width >> 1; i += 2) {
230 if (src_end - src < 1)
234 if (val >= table_size)
236 val =
AV_RL16(table + (val << 1));
237 uval = (val >> 3) & 0xF8;
238 vval = (val >> 8) & 0xF8;
239 U[i] = U[i+1] = U2[i] = U2[i+1] = uval | (uval >> 5);
240 V[i] = V[i+1] = V2[i] = V2[i+1] = vval | (vval >> 5);
249 int lines = ((avctx->
height + 1) >> 1) - (avctx->
height >> 2) * 2;
263 unsigned chroma_off, corr_off;
268 chroma_off = bytestream2_get_le32(&s->
gb);
269 corr_off = bytestream2_get_le32(&s->
gb);
288 for (j = 1; j < avctx->
width - 1; j += 2) {
289 cur = (last + *src++) & 0x1F;
290 ybuf[j] = last + cur;
291 ybuf[j+1] = cur << 1;
297 ybuf += avctx->
width;
299 for (i = 1; i < avctx->
height; i++) {
300 last = ((prev_buf[0] >> 1) + *src++) & 0x1F;
302 for (j = 1; j < avctx->
width - 1; j += 2) {
303 cur = ((prev_buf[j + 1] >> 1) + *src++) & 0x1F;
304 ybuf[j] = last + cur;
305 ybuf[j+1] = cur << 1;
311 ybuf += avctx->
width;
324 for (i = 0; i < dec_size; i++)
330 for (j = 0; j < avctx->
height; j++) {
331 for (i = 0; i < avctx->
width; i++)
332 ybuf[i] = (src[i] << 2) | (src[i] >> 3);
360 for (i = 0; i < avctx->
height; i++) {
361 last = (ybuf[0] + (*src++ << 1)) & 0x3F;
363 for (j = 1; j < avctx->
width - 1; j += 2) {
364 cur = (ybuf[j + 1] + (*src++ << 1)) & 0x3F;
365 ybuf[j] = (last + cur) >> 1;
371 ybuf += avctx->
width;
376 for (j = 0; j < avctx->
height; j++) {
377 for (i = 0; i < avctx->
width; i++)
378 ybuf[i] = (src[i] << 2) | (src[i] >> 3);
387 void *
data,
int *got_frame,
404 ftype = bytestream2_get_le32(&s->
gb);