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

Function msmpeg4v34_decode_mb

libavcodec/msmpeg4dec.c:216–306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

214}
215
216static int msmpeg4v34_decode_mb(H263DecContext *const h)
217{
218 MSMP4DecContext *const ms = mpv_to_msmpeg4(h);
219 int cbp, code, i;
220 uint8_t *coded_val;
221 uint32_t * const mb_type_ptr = &h->c.cur_pic.mb_type[h->c.mb_x + h->c.mb_y*h->c.mb_stride];
222
223 if (get_bits_left(&h->gb) <= 0)
224 return AVERROR_INVALIDDATA;
225
226 if (h->c.pict_type == AV_PICTURE_TYPE_P) {
227 if (ms->use_skip_mb_code) {
228 if (get_bits1(&h->gb)) {
229 /* skip mb */
230 h->c.mb_intra = 0;
231 for(i=0;i<6;i++)
232 h->c.block_last_index[i] = -1;
233 h->c.mv_dir = MV_DIR_FORWARD;
234 h->c.mv_type = MV_TYPE_16X16;
235 h->c.mv[0][0][0] = 0;
236 h->c.mv[0][0][1] = 0;
237 h->c.mb_skipped = 1;
238 *mb_type_ptr = MB_TYPE_SKIP | MB_TYPE_FORWARD_MV | MB_TYPE_16x16;
239
240 return 0;
241 }
242 }
243
244 code = get_vlc2(&h->gb, ff_mb_non_intra_vlc[DEFAULT_INTER_INDEX], MB_NON_INTRA_VLC_BITS, 3);
245 //h->c.mb_intra = (code & 0x40) ? 0 : 1;
246 h->c.mb_intra = (~code & 0x40) >> 6;
247
248 cbp = code & 0x3f;
249 } else {
250 h->c.mb_intra = 1;
251 code = get_vlc2(&h->gb, ff_msmp4_mb_i_vlc, MSMP4_MB_INTRA_VLC_BITS, 2);
252 /* predict coded block pattern */
253 cbp = 0;
254 for(i=0;i<6;i++) {
255 int val = ((code >> (5 - i)) & 1);
256 if (i < 4) {
257 int pred = ff_msmpeg4_coded_block_pred(&h->c, i, &coded_val);
258 val = val ^ pred;
259 *coded_val = val;
260 }
261 cbp |= val << (5 - i);
262 }
263 }
264
265 if (!h->c.mb_intra) {
266 int mx, my;
267 if (ms->per_mb_rl_table && cbp) {
268 ms->rl_table_index = decode012(&h->gb);
269 ms->rl_chroma_table_index = ms->rl_table_index;
270 }
271 ff_h263_pred_motion(&h->c, 0, 0, &mx, &my);
272 ff_msmpeg4_decode_motion(ms, &mx, &my);
273 h->c.mv_dir = MV_DIR_FORWARD;

Callers

nothing calls this directly

Calls 11

get_bits_leftFunction · 0.85
get_bits1Function · 0.85
get_vlc2Function · 0.85
decode012Function · 0.85
ff_h263_pred_motionFunction · 0.85
ff_msmpeg4_decode_motionFunction · 0.85
show_bitsFunction · 0.85
ff_msmpeg4_decode_blockFunction · 0.85
av_logFunction · 0.85
mpv_to_msmpeg4Function · 0.70

Tested by

no test coverage detected