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

Function parse_seq_header

libavcodec/cavs_parser.c:79–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77}
78
79static int parse_seq_header(AVCodecParserContext *s, AVCodecContext *avctx,
80 GetBitContext *gb)
81{
82 int frame_rate_code;
83 int width, height;
84 int mb_width, mb_height;
85
86 skip_bits(gb, 8); // profile
87 skip_bits(gb, 8); // level
88 skip_bits1(gb); // progressive sequence
89
90 width = get_bits(gb, 14);
91 height = get_bits(gb, 14);
92 if (width <= 0 || height <= 0) {
93 av_log(avctx, AV_LOG_ERROR, "Dimensions invalid\n");
94 return AVERROR_INVALIDDATA;
95 }
96 mb_width = (width + 15) >> 4;
97 mb_height = (height + 15) >> 4;
98
99 skip_bits(gb, 2); // chroma format
100 skip_bits(gb, 3); // sample_precision
101 skip_bits(gb, 4); // aspect_ratio
102 frame_rate_code = get_bits(gb, 4);
103 if (frame_rate_code == 0 || frame_rate_code > 13) {
104 av_log(avctx, AV_LOG_WARNING,
105 "frame_rate_code %d is invalid\n", frame_rate_code);
106 frame_rate_code = 1;
107 }
108
109 skip_bits(gb, 18); // bit_rate_lower
110 skip_bits1(gb); // marker_bit
111 skip_bits(gb, 12); // bit_rate_upper
112 skip_bits1(gb); // low_delay
113
114 s->width = width;
115 s->height = height;
116 s->coded_width = 16 * mb_width;
117 s->coded_height = 16 * mb_height;
118 avctx->framerate = ff_mpeg12_frame_rate_tab[frame_rate_code];
119
120 return 0;
121}
122
123static int cavs_parse_frame(AVCodecParserContext *s, AVCodecContext *avctx,
124 const uint8_t *buf, int buf_size)

Callers 1

cavs_parse_frameFunction · 0.85

Calls 4

skip_bitsFunction · 0.85
skip_bits1Function · 0.85
av_logFunction · 0.85
get_bitsFunction · 0.70

Tested by

no test coverage detected