Lines Matching refs:gbc
47 static int parse_palette(AVCodecContext *avctx, GetByteContext *gbc, in parse_palette() argument
54 unsigned int idx = bytestream2_get_be16(gbc); /* color index */ in parse_palette()
58 bytestream2_skip(gbc, 6); in parse_palette()
63 r = bytestream2_get_byte(gbc); in parse_palette()
64 bytestream2_skip(gbc, 1); in parse_palette()
65 g = bytestream2_get_byte(gbc); in parse_palette()
66 bytestream2_skip(gbc, 1); in parse_palette()
67 b = bytestream2_get_byte(gbc); in parse_palette()
68 bytestream2_skip(gbc, 1); in parse_palette()
74 static int decode_rle_bpp2(AVCodecContext *avctx, AVFrame *p, GetByteContext *gbc) in decode_rle_bpp2() argument
87 size = left = bytestream2_get_be16(gbc); in decode_rle_bpp2()
89 size = left = bytestream2_get_byte(gbc); in decode_rle_bpp2()
90 if (bytestream2_get_bytes_left(gbc) < size) in decode_rle_bpp2()
95 code = bytestream2_get_byte(gbc); in decode_rle_bpp2()
97 pix = bytestream2_get_byte(gbc); in decode_rle_bpp2()
111 pix = bytestream2_get_byte(gbc); in decode_rle_bpp2()
129 static int decode_rle_bpp4(AVCodecContext *avctx, AVFrame *p, GetByteContext *gbc) in decode_rle_bpp4() argument
141 size = left = bytestream2_get_be16(gbc); in decode_rle_bpp4()
142 if (bytestream2_get_bytes_left(gbc) < size) in decode_rle_bpp4()
147 code = bytestream2_get_byte(gbc); in decode_rle_bpp4()
149 pix = bytestream2_get_byte(gbc); in decode_rle_bpp4()
159 pix = bytestream2_get_byte(gbc); in decode_rle_bpp4()
173 static int decode_rle16(AVCodecContext *avctx, AVFrame *p, GetByteContext *gbc) in decode_rle16() argument
185 size = left = bytestream2_get_be16(gbc); in decode_rle16()
186 if (bytestream2_get_bytes_left(gbc) < size) in decode_rle16()
191 code = bytestream2_get_byte(gbc); in decode_rle16()
193 pix = bytestream2_get_be16(gbc); in decode_rle16()
203 out[pos++] = bytestream2_get_be16(gbc); in decode_rle16()
205 bytestream2_skip(gbc, 2); in decode_rle16()
216 static int decode_rle(AVCodecContext *avctx, AVFrame *p, GetByteContext *gbc, in decode_rle() argument
229 size = left = bytestream2_get_be16(gbc); in decode_rle()
230 if (bytestream2_get_bytes_left(gbc) < size) in decode_rle()
235 code = bytestream2_get_byte(gbc); in decode_rle()
237 pix = bytestream2_get_byte(gbc); in decode_rle()
250 pix = bytestream2_get_byte(gbc); in decode_rle()
295 GetByteContext gbc; in decode_frame() local
300 bytestream2_init(&gbc, avpkt->data, avpkt->size); in decode_frame()
301 if ( bytestream2_get_bytes_left(&gbc) >= 552 in decode_frame()
302 && check_header(gbc.buffer + 512, bytestream2_get_bytes_left(&gbc) - 512) in decode_frame()
304 bytestream2_skip(&gbc, 512); in decode_frame()
306 ver = check_header(gbc.buffer, bytestream2_get_bytes_left(&gbc)); in decode_frame()
309 if (bytestream2_get_bytes_left(&gbc) < 40) { in decode_frame()
311 bytestream2_get_bytes_left(&gbc)); in decode_frame()
315 bytestream2_skip(&gbc, 6); in decode_frame()
316 h = bytestream2_get_be16(&gbc); in decode_frame()
317 w = bytestream2_get_be16(&gbc); in decode_frame()
329 avpriv_request_sample(avctx, "QuickDraw version unknown (%X)", bytestream2_get_be32(&gbc)); in decode_frame()
333 bytestream2_skip(&gbc, 4+26); in decode_frame()
335 while (bytestream2_get_bytes_left(&gbc) >= 4) { in decode_frame()
339 int opcode = bytestream2_get_be16(&gbc); in decode_frame()
343 bytestream2_skip(&gbc, 10); in decode_frame()
349 flags = bytestream2_get_be16(&gbc) & 0xC000; in decode_frame()
350 bytestream2_skip(&gbc, 28); in decode_frame()
351 bppcnt = bytestream2_get_be16(&gbc); /* cmpCount */ in decode_frame()
352 bpp = bytestream2_get_be16(&gbc); /* cmpSize */ in decode_frame()
369 bytestream2_skip(&gbc, 18); in decode_frame()
370 colors = bytestream2_get_be16(&gbc); in decode_frame()
377 if (bytestream2_get_bytes_left(&gbc) < (colors + 1) * 8) { in decode_frame()
379 bytestream2_get_bytes_left(&gbc)); in decode_frame()
385 ret = parse_palette(avctx, &gbc, (uint32_t *)p->data[1], colors, flags & 0x8000); in decode_frame()
391 bytestream2_skip(&gbc, 18); in decode_frame()
394 bytestream2_skip(&gbc, 2 + 8); /* size + rect */ in decode_frame()
399 ret = decode_rle16(avctx, p, &gbc); in decode_frame()
401 ret = decode_rle_bpp2(avctx, p, &gbc); in decode_frame()
403 ret = decode_rle_bpp4(avctx, p, &gbc); in decode_frame()
405 ret = decode_rle(avctx, p, &gbc, bppcnt); in decode_frame()
414 bytestream2_skip(&gbc, 4); in decode_frame()
415 rowbytes = bytestream2_get_be16(&gbc) & 0x3FFF; in decode_frame()
421 bytestream2_skip(&gbc, 4); in decode_frame()
422 h = bytestream2_get_be16(&gbc); in decode_frame()
423 w = bytestream2_get_be16(&gbc); in decode_frame()
424 bytestream2_skip(&gbc, 2); in decode_frame()
430 pack_type = bytestream2_get_be16(&gbc); in decode_frame()
432 bytestream2_skip(&gbc, 16); in decode_frame()
433 bppcnt = bytestream2_get_be16(&gbc); /* cmpCount */ in decode_frame()
434 bpp = bytestream2_get_be16(&gbc); /* cmpSize */ in decode_frame()
458 if (bytestream2_get_bytes_left(&gbc) < 30) in decode_frame()
464 bytestream2_skip(&gbc, 30); in decode_frame()
467 bytestream2_skip(&gbc, 2 + 8); /* size + rect */ in decode_frame()
472 ret = decode_rle16(avctx, p, &gbc); in decode_frame()
474 ret = decode_rle(avctx, p, &gbc, bppcnt); in decode_frame()
480 bytestream2_get_be16(&gbc); in decode_frame()
481 bytestream2_skip(&gbc, bytestream2_get_be16(&gbc)); in decode_frame()
492 bytestream2_skip(&gbc, bytestream2_get_bytes_left(&gbc) % 2); in decode_frame()
494 eop = bytestream2_get_be16(&gbc); in decode_frame()
495 trail = bytestream2_get_bytes_left(&gbc); in decode_frame()