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

Function mpeg4_encode_visual_object_header

libavcodec/mpeg4videoenc.c:883–924  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

881}
882
883static void mpeg4_encode_visual_object_header(MPVMainEncContext *const m)
884{
885 MPVEncContext *const s = &m->s;
886 int profile_and_level_indication;
887 int vo_ver_id;
888
889 if (s->c.avctx->profile != AV_PROFILE_UNKNOWN) {
890 profile_and_level_indication = s->c.avctx->profile << 4;
891 } else if (m->max_b_frames || s->c.quarter_sample) {
892 profile_and_level_indication = 0xF0; // adv simple
893 } else {
894 profile_and_level_indication = 0x00; // simple
895 }
896
897 if (s->c.avctx->level != AV_LEVEL_UNKNOWN)
898 profile_and_level_indication |= s->c.avctx->level;
899 else
900 profile_and_level_indication |= 1; // level 1
901
902 if (profile_and_level_indication >> 4 == 0xF)
903 vo_ver_id = 5;
904 else
905 vo_ver_id = 1;
906
907 // FIXME levels
908
909 put_bits32(&s->pb, VOS_STARTCODE);
910
911 put_bits(&s->pb, 8, profile_and_level_indication);
912
913 put_bits32(&s->pb, VISUAL_OBJ_STARTCODE);
914
915 put_bits(&s->pb, 1, 1);
916 put_bits(&s->pb, 4, vo_ver_id);
917 put_bits(&s->pb, 3, 1); // priority
918
919 put_bits(&s->pb, 4, 1); // visual obj type== video obj
920
921 put_bits(&s->pb, 1, 0); // video signal type == no clue // FIXME
922
923 ff_mpeg4_stuffing(&s->pb);
924}
925
926static void mpeg4_encode_vol_header(Mpeg4EncContext *const m4,
927 int vo_number,

Callers 2

encode_initFunction · 0.85

Calls 3

put_bits32Function · 0.85
ff_mpeg4_stuffingFunction · 0.85
put_bitsFunction · 0.70

Tested by

no test coverage detected