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

Function ff_msmpeg4_encode_motion

libavcodec/msmpeg4.c:456–492  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

454#if CONFIG_ENCODERS
455
456void ff_msmpeg4_encode_motion(MpegEncContext * s,
457 int mx, int my)
458{
459 int code;
460 MVTable *mv;
461
462 /* modulo encoding */
463 /* WARNING : you cannot reach all the MVs even with the modulo
464 encoding. This is a somewhat strange compromise they took !!! */
465 if (mx <= -64)
466 mx += 64;
467 else if (mx >= 64)
468 mx -= 64;
469 if (my <= -64)
470 my += 64;
471 else if (my >= 64)
472 my -= 64;
473
474 mx += 32;
475 my += 32;
476#if 0
477 if ((unsigned)mx >= 64 ||
478 (unsigned)my >= 64)
479 av_log(s->avctx, AV_LOG_ERROR, "error mx=%d my=%d\n", mx, my);
480#endif
481 mv = &mv_tables[s->mv_table_index];
482
483 code = mv->table_mv_index[(mx << 6) | my];
484 put_bits(&s->pb,
485 mv->table_mv_bits[code],
486 mv->table_mv_code[code]);
487 if (code == mv->n) {
488 /* escape : code literally */
489 put_bits(&s->pb, 6, mx);
490 put_bits(&s->pb, 6, my);
491 }
492}
493
494void ff_msmpeg4_handle_slices(MpegEncContext *s){
495 if (s->mb_x == 0) {

Callers 2

ff_wmv2_encode_mbFunction · 0.85
msmpeg4_encode_mbFunction · 0.85

Calls 1

av_logFunction · 0.85

Tested by

no test coverage detected