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

Function ff_flv_decode_picture_header

libavcodec/flvdec.c:29–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27#include "mpegvideodec.h"
28
29int ff_flv_decode_picture_header(H263DecContext *const h)
30{
31 int format, width, height;
32
33 /* picture header */
34 if (get_bits(&h->gb, 17) != 1) {
35 av_log(h->c.avctx, AV_LOG_ERROR, "Bad picture start code\n");
36 return AVERROR_INVALIDDATA;
37 }
38 format = get_bits(&h->gb, 5);
39 if (format != 0 && format != 1) {
40 av_log(h->c.avctx, AV_LOG_ERROR, "Bad picture format\n");
41 return AVERROR_INVALIDDATA;
42 }
43 h->flv = format;
44 h->picture_number = get_bits(&h->gb, 8); /* picture timestamp */
45 format = get_bits(&h->gb, 3);
46 switch (format) {
47 case 0:
48 width = get_bits(&h->gb, 8);
49 height = get_bits(&h->gb, 8);
50 break;
51 case 1:
52 width = get_bits(&h->gb, 16);
53 height = get_bits(&h->gb, 16);
54 break;
55 case 2:
56 width = 352;
57 height = 288;
58 break;
59 case 3:
60 width = 176;
61 height = 144;
62 break;
63 case 4:
64 width = 128;
65 height = 96;
66 break;
67 case 5:
68 width = 320;
69 height = 240;
70 break;
71 case 6:
72 width = 160;
73 height = 120;
74 break;
75 default:
76 width = height = 0;
77 break;
78 }
79 if (av_image_check_size(width, height, 0, h->c.avctx))
80 return AVERROR(EINVAL);
81 h->c.width = width;
82 h->c.height = height;
83
84 h->c.pict_type = AV_PICTURE_TYPE_I + get_bits(&h->gb, 2);
85 h->c.droppable = h->c.pict_type > AV_PICTURE_TYPE_P;
86 if (h->c.droppable)

Callers

nothing calls this directly

Calls 6

av_logFunction · 0.85
av_image_check_sizeFunction · 0.85
skip_bits1Function · 0.85
skip_1stop_8data_bitsFunction · 0.85
av_get_picture_type_charFunction · 0.85
get_bitsFunction · 0.70

Tested by

no test coverage detected