27 #define BITSTREAM_READER_LE
65 if (avctx->
width & 1) {
90 uint8_t *dst,
const int dst_size)
95 const uint8_t *dst_end = dst + dst_size;
99 tree_size = bytestream2_get_byte(&s->
gb);
100 eof = bytestream2_get_byte(&s->
gb);
101 tree_root = eof + tree_size;
105 bits = bytestream2_get_byte(&s->
gb);
108 int bit = !!(bits &
mask);
111 node = bytestream2_get_byte(&tree);
123 bits = bytestream2_get_byteu(&s->
gb);
132 uint8_t *dest,
const int dest_len)
137 const uint8_t *dest_end = dest + dest_len;
139 while (dest < dest_end) {
143 opcode = bytestream2_get_byteu(&s->
gb);
147 if ((opcode & 0x80) == 0) {
149 back = ((opcode & 0x60) << 3) + bytestream2_get_byte(&s->
gb) + 1;
150 size2 = ((opcode & 0x1c) >> 2) + 3;
151 }
else if ((opcode & 0x40) == 0) {
152 size = bytestream2_peek_byte(&s->
gb) >> 6;
153 back = (bytestream2_get_be16(&s->
gb) & 0x3fff) + 1;
154 size2 = (opcode & 0x3f) + 4;
157 back = ((opcode & 0x10) << 12) + bytestream2_get_be16(&s->
gb) + 1;
158 size2 = ((opcode & 0x0c) << 6) + bytestream2_get_byte(&s->
gb) + 5;
159 if (size + size2 > dest_end - dest)
162 if (dest + size + size2 > dest_end ||
163 dest - orig_dest + size < back)
170 int finish = opcode >= 0xfc;
172 size = finish ? opcode & 3 : ((opcode & 0x1f) << 2) + 4;
173 if (dest_end - dest < size)
181 return dest - orig_dest;
201 mode = bytestream2_get_le16(&s->
gb);
203 table_size = bytestream2_get_le16(&s->
gb);
204 offset = table_size * 2;
223 src_end = src + dec_size;
225 for (j = 0; j < avctx->
height >> 1; j++) {
226 for (i = 0; i < avctx->
width >> 1; i++) {
227 if (src_end - src < 1)
231 if (val >= table_size)
233 val =
AV_RL16(table + (val << 1));
234 uval = (val >> 3) & 0xF8;
235 vval = (val >> 8) & 0xF8;
236 U[i] = uval | (uval >> 5);
237 V[i] = vval | (vval >> 5);
251 for (j = 0; j < avctx->
height >> 2; j++) {
252 for (i = 0; i < avctx->
width >> 1; i += 2) {
253 if (src_end - src < 1)
257 if (val >= table_size)
259 val =
AV_RL16(table + (val << 1));
260 uval = (val >> 3) & 0xF8;
261 vval = (val >> 8) & 0xF8;
262 U[i] = U[i+1] = U2[i] = U2[i+1] = uval | (uval >> 5);
263 V[i] = V[i+1] = V2[i] = V2[i+1] = vval | (vval >> 5);
272 int lines = ((avctx->
height + 1) >> 1) - (avctx->
height >> 2) * 2;
286 unsigned chroma_off, corr_off;
291 chroma_off = bytestream2_get_le32(&s->
gb);
292 corr_off = bytestream2_get_le32(&s->
gb);
311 for (j = 1; j < avctx->
width - 1; j += 2) {
312 cur = (last + *src++) & 0x1F;
313 ybuf[j] = last + cur;
314 ybuf[j+1] = cur << 1;
319 ybuf += avctx->
width;
321 for (i = 1; i < avctx->
height; i++) {
322 last = ((prev_buf[0] >> 1) + *src++) & 0x1F;
324 for (j = 1; j < avctx->
width - 1; j += 2) {
325 cur = ((prev_buf[j + 1] >> 1) + *src++) & 0x1F;
326 ybuf[j] = last + cur;
327 ybuf[j+1] = cur << 1;
332 ybuf += avctx->
width;
345 for (i = 0; i < dec_size; i++)
351 for (j = 0; j < avctx->
height; j++) {
352 for (i = 0; i < avctx->
width; i++)
353 ybuf[i] = (src[i] << 2) | (src[i] >> 3);
381 for (i = 0; i < avctx->
height; i++) {
382 last = (ybuf[0] + (*src++ << 1)) & 0x3F;
384 for (j = 1; j < avctx->
width - 1; j += 2) {
385 cur = (ybuf[j + 1] + (*src++ << 1)) & 0x3F;
386 ybuf[j] = (last + cur) >> 1;
391 ybuf += avctx->
width;
396 for (j = 0; j < avctx->
height; j++) {
397 for (i = 0; i < avctx->
width; i++)
398 ybuf[i] = (src[i] << 2) | (src[i] >> 3);
407 void *
data,
int *got_frame,
418 ftype = bytestream2_get_le32(&s->
gb);