MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / decompress_5

Function decompress_5

libavcodec/gdv.c:286–331  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

284}
285
286static int decompress_5(AVCodecContext *avctx, unsigned skip)
287{
288 GDVContext *gdv = avctx->priv_data;
289 GetByteContext *gb = &gdv->gb;
290 GetByteContext *g2 = &gdv->g2;
291 PutByteContext *pb = &gdv->pb;
292 Bits8 bits = { 0 };
293
294 bytestream2_init(g2, gdv->frame, gdv->frame_size);
295 bytestream2_skip_p(pb, skip + PREAMBLE_SIZE);
296
297 while (bytestream2_get_bytes_left_p(pb) > 0 && bytestream2_get_bytes_left(gb) > 0) {
298 int tag = read_bits2(&bits, gb);
299 if (bytestream2_get_bytes_left(gb) < 1)
300 return AVERROR_INVALIDDATA;
301 if (tag == 0) {
302 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
303 } else if (tag == 1) {
304 int b = bytestream2_get_byte(gb);
305 int len = (b & 0xF) + 3;
306 int top = b >> 4;
307 int off = (bytestream2_get_byte(gb) << 4) + top - 4096;
308 lz_copy(pb, g2, off, len);
309 } else if (tag == 2) {
310 int len;
311 int b = bytestream2_get_byte(gb);
312 if (b == 0) {
313 return 0;
314 }
315 if (b != 0xFF) {
316 len = b;
317 } else {
318 len = bytestream2_get_le16(gb);
319 }
320 bytestream2_skip_p(pb, len + 1);
321 } else {
322 int b = bytestream2_get_byte(gb);
323 int len = (b & 0x3) + 2;
324 int off = -(b >> 2) - 1;
325 lz_copy(pb, g2, off, len);
326 }
327 }
328 if (bytestream2_get_bytes_left_p(pb) > 0)
329 return AVERROR_INVALIDDATA;
330 return 0;
331}
332
333static int decompress_68(AVCodecContext *avctx, unsigned skip, unsigned use8)
334{

Callers 1

gdv_decode_frameFunction · 0.85

Calls 6

bytestream2_initFunction · 0.85
bytestream2_skip_pFunction · 0.85
read_bits2Function · 0.85
lz_copyFunction · 0.85

Tested by

no test coverage detected