27 #define BITSTREAM_READER_LE
76 uint8_t *dst,
const int dst_size)
81 const uint8_t *dst_end = dst + dst_size;
85 tree_size = bytestream2_get_byte(&s->
gb);
86 eof = bytestream2_get_byte(&s->
gb);
87 tree_root = eof + tree_size;
91 bits = bytestream2_get_byte(&s->
gb);
94 int bit = !!(bits &
mask);
97 node = bytestream2_get_byte(&tree);
109 bits = bytestream2_get_byteu(&s->
gb);
118 uint8_t *dest,
const int dest_len)
123 const uint8_t *dest_end = dest + dest_len;
125 while (dest < dest_end) {
129 opcode = bytestream2_get_byteu(&s->
gb);
133 if ((opcode & 0x80) == 0) {
135 back = ((opcode & 0x60) << 3) + bytestream2_get_byte(&s->
gb) + 1;
136 size2 = ((opcode & 0x1c) >> 2) + 3;
137 }
else if ((opcode & 0x40) == 0) {
138 size = bytestream2_peek_byte(&s->
gb) >> 6;
139 back = (bytestream2_get_be16(&s->
gb) & 0x3fff) + 1;
140 size2 = (opcode & 0x3f) + 4;
143 back = ((opcode & 0x10) << 12) + bytestream2_get_be16(&s->
gb) + 1;
144 size2 = ((opcode & 0x0c) << 6) + bytestream2_get_byte(&s->
gb) + 5;
145 if (size + size2 > dest_end - dest)
148 if (dest + size + size2 > dest_end ||
149 dest - orig_dest + size < back)
156 int finish = opcode >= 0xfc;
158 size = finish ? opcode & 3 : ((opcode & 0x1f) << 2) + 4;
159 if (dest_end - dest < size)
167 return dest - orig_dest;
187 mode = bytestream2_get_le16(&s->
gb);
189 table_size = bytestream2_get_le16(&s->
gb);
190 offset = table_size * 2;
209 src_end = src + dec_size;
211 for (j = 0; j < avctx->
height >> 1; j++) {
212 for (i = 0; i < avctx->
width >> 1; i++) {
213 if (src_end - src < 1)
217 if (val >= table_size)
219 val =
AV_RL16(table + (val << 1));
220 uval = (val >> 3) & 0xF8;
221 vval = (val >> 8) & 0xF8;
222 U[i] = uval | (uval >> 5);
223 V[i] = vval | (vval >> 5);
237 for (j = 0; j < avctx->
height >> 2; j++) {
238 for (i = 0; i < avctx->
width >> 1; i += 2) {
239 if (src_end - src < 1)
243 if (val >= table_size)
245 val =
AV_RL16(table + (val << 1));
246 uval = (val >> 3) & 0xF8;
247 vval = (val >> 8) & 0xF8;
248 U[i] = U[i+1] = U2[i] = U2[i+1] = uval | (uval >> 5);
249 V[i] = V[i+1] = V2[i] = V2[i+1] = vval | (vval >> 5);
258 int lines = ((avctx->
height + 1) >> 1) - (avctx->
height >> 2) * 2;
272 unsigned chroma_off, corr_off;
277 chroma_off = bytestream2_get_le32(&s->
gb);
278 corr_off = bytestream2_get_le32(&s->
gb);
297 for (j = 1; j < avctx->
width - 1; j += 2) {
298 cur = (last + *src++) & 0x1F;
299 ybuf[j] = last + cur;
300 ybuf[j+1] = cur << 1;
306 ybuf += avctx->
width;
308 for (i = 1; i < avctx->
height; i++) {
309 last = ((prev_buf[0] >> 1) + *src++) & 0x1F;
311 for (j = 1; j < avctx->
width - 1; j += 2) {
312 cur = ((prev_buf[j + 1] >> 1) + *src++) & 0x1F;
313 ybuf[j] = last + cur;
314 ybuf[j+1] = cur << 1;
320 ybuf += avctx->
width;
333 for (i = 0; i < dec_size; i++)
339 for (j = 0; j < avctx->
height; j++) {
340 for (i = 0; i < avctx->
width; i++)
341 ybuf[i] = (src[i] << 2) | (src[i] >> 3);
369 for (i = 0; i < avctx->
height; i++) {
370 last = (ybuf[0] + (*src++ << 1)) & 0x3F;
372 for (j = 1; j < avctx->
width - 1; j += 2) {
373 cur = (ybuf[j + 1] + (*src++ << 1)) & 0x3F;
374 ybuf[j] = (last + cur) >> 1;
380 ybuf += avctx->
width;
385 for (j = 0; j < avctx->
height; j++) {
386 for (i = 0; i < avctx->
width; i++)
387 ybuf[i] = (src[i] << 2) | (src[i] >> 3);
396 void *
data,
int *got_frame,
407 ftype = bytestream2_get_le32(&s->
gb);