diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2004-08-13 13:59:28 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2004-08-13 13:59:28 +0000 |
commit | baced9f5986a466c957456f5cf32a722d8b35512 (patch) | |
tree | 48f9ff3b97449b4b4f93e69eacf759cb575b488c /libavcodec | |
parent | c2b9685ecadbf07e8b351070eb50febb111ab1e3 (diff) | |
download | ffmpeg-baced9f5986a466c957456f5cf32a722d8b35512.tar.gz |
user overrideable level & profile
Originally committed as revision 3385 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/avcodec.h | 18 | ||||
-rw-r--r-- | libavcodec/h263.c | 19 | ||||
-rw-r--r-- | libavcodec/mpeg12.c | 22 | ||||
-rw-r--r-- | libavcodec/utils.c | 2 |
4 files changed, 51 insertions, 10 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index a40a83e37f..d8ab760d33 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -17,7 +17,7 @@ extern "C" { #define FFMPEG_VERSION_INT 0x000409 #define FFMPEG_VERSION "0.4.9-pre1" -#define LIBAVCODEC_BUILD 4719 +#define LIBAVCODEC_BUILD 4720 #define LIBAVCODEC_VERSION_INT FFMPEG_VERSION_INT #define LIBAVCODEC_VERSION FFMPEG_VERSION @@ -1624,6 +1624,22 @@ typedef struct AVCodecContext { * - decoding: set by user */ int skip_bottom; + + /** + * profile + * - encoding: set by user + * - decoding: set by lavc + */ + int profile; +#define FF_PROFILE_UNKNOWN -99 + + /** + * level + * - encoding: set by user + * - decoding: set by lavc + */ + int level; +#define FF_LEVEL_UNKNOWN -99 } AVCodecContext; diff --git a/libavcodec/h263.c b/libavcodec/h263.c index 8c26634de4..3cc1171855 100644 --- a/libavcodec/h263.c +++ b/libavcodec/h263.c @@ -2154,13 +2154,26 @@ static void mpeg4_encode_visual_object_header(MpegEncContext * s){ int profile_and_level_indication; int vo_ver_id; - if(s->max_b_frames || s->quarter_sample){ - profile_and_level_indication= 0xF1; // adv simple level 1 + if(s->avctx->profile != FF_PROFILE_UNKNOWN){ + profile_and_level_indication = s->avctx->profile << 4; + }else if(s->max_b_frames || s->quarter_sample){ + profile_and_level_indication= 0xF0; // adv simple + }else{ + profile_and_level_indication= 0x00; // simple + } + + if(s->avctx->level != FF_LEVEL_UNKNOWN){ + profile_and_level_indication |= s->avctx->level; + }else{ + profile_and_level_indication |= 1; //level 1 + } + + if(profile_and_level_indication>>4 == 0xF){ vo_ver_id= 5; }else{ - profile_and_level_indication= 0x01; // simple level 1 vo_ver_id= 1; } + //FIXME levels put_bits(&s->pb, 16, 0); diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index 5a2df29343..1c8a6e2bfa 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -314,8 +314,19 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s) put_header(s, EXT_START_CODE); put_bits(&s->pb, 4, 1); //seq ext put_bits(&s->pb, 1, 0); //esc - put_bits(&s->pb, 3, 4); //profile - put_bits(&s->pb, 4, 8); //level + + if(s->avctx->profile == FF_PROFILE_UNKNOWN){ + put_bits(&s->pb, 3, 4); //profile + }else{ + put_bits(&s->pb, 3, s->avctx->profile); //profile + } + + if(s->avctx->level == FF_LEVEL_UNKNOWN){ + put_bits(&s->pb, 4, 8); //level + }else{ + put_bits(&s->pb, 4, s->avctx->level); //level + } + put_bits(&s->pb, 1, s->progressive_sequence); put_bits(&s->pb, 2, 1); //chroma format 4:2:0 put_bits(&s->pb, 2, 0); //horizontal size ext @@ -1971,11 +1982,10 @@ static void mpeg_decode_sequence_extension(MpegEncContext *s) { int horiz_size_ext, vert_size_ext; int bit_rate_ext; - int level, profile; skip_bits(&s->gb, 1); /* profil and level esc*/ - profile= get_bits(&s->gb, 3); - level= get_bits(&s->gb, 4); + s->avctx->profile= get_bits(&s->gb, 3); + s->avctx->level= get_bits(&s->gb, 4); s->progressive_sequence = get_bits1(&s->gb); /* progressive_sequence */ s->chroma_format = get_bits(&s->gb, 2); /* chroma_format 1=420, 2=422, 3=444 */ horiz_size_ext = get_bits(&s->gb, 2); @@ -1999,7 +2009,7 @@ static void mpeg_decode_sequence_extension(MpegEncContext *s) if(s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_DEBUG, "profile: %d, level: %d vbv buffer: %d, bitrate:%d\n", - profile, level, s->avctx->rc_buffer_size, s->bit_rate); + s->avctx->profile, s->avctx->level, s->avctx->rc_buffer_size, s->bit_rate); } diff --git a/libavcodec/utils.c b/libavcodec/utils.c index c8bdd80010..2f50c4d07d 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -396,6 +396,8 @@ void avcodec_get_context_defaults(AVCodecContext *s){ s->lmax= FF_QP2LAMBDA * s->qmax; s->sample_aspect_ratio= (AVRational){0,1}; s->ildct_cmp= FF_CMP_VSAD; + s->profile= FF_PROFILE_UNKNOWN; + s->level= FF_LEVEL_UNKNOWN; s->intra_quant_bias= FF_DEFAULT_QUANT_BIAS; s->inter_quant_bias= FF_DEFAULT_QUANT_BIAS; |