diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2015-12-18 16:39:15 +0300 |
---|---|---|
committer | Hendrik Leppkes <h.leppkes@gmail.com> | 2015-12-18 16:39:15 +0300 |
commit | 362028cac913e232ce8c3702fa4c96b33fc5e0de (patch) | |
tree | 9ddb25aabdab4278d23fb61c72735f4250ea588f | |
parent | 2630f7f709049113dc03d6b999efad6acc423d67 (diff) | |
parent | 16216b713f9a21865cc07993961cf5d0ece24916 (diff) |
Merge commit '16216b713f9a21865cc07993961cf5d0ece24916'
* commit '16216b713f9a21865cc07993961cf5d0ece24916':
lavc: Drop exporting 2-pass encoding stats
Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
-rw-r--r-- | libavcodec/aacenc.c | 6 | ||||
-rw-r--r-- | libavcodec/avcodec.h | 17 | ||||
-rw-r--r-- | libavcodec/mpegvideo_enc.c | 15 | ||||
-rw-r--r-- | libavcodec/options_table.h | 2 | ||||
-rw-r--r-- | libavcodec/version.h | 3 |
5 files changed, 35 insertions, 8 deletions
diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index ec09063e84..3b7dc164da 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -818,7 +818,13 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, put_bits(&s->pb, 3, TYPE_END); flush_put_bits(&s->pb); + +#if FF_API_STAT_BITS +FF_DISABLE_DEPRECATION_WARNINGS avctx->frame_bits = put_bits_count(&s->pb); +FF_ENABLE_DEPRECATION_WARNINGS +#endif + s->lambda_sum += s->lambda; s->lambda_count++; diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 616bcae03c..35965d7a25 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2672,22 +2672,29 @@ typedef struct AVCodecContext { /* This doesn't take account of any particular */ /* headers inside the transmitted RTP payload. */ +#if FF_API_STAT_BITS /* statistics, used for 2-pass encoding */ + attribute_deprecated int mv_bits; + attribute_deprecated int header_bits; + attribute_deprecated int i_tex_bits; + attribute_deprecated int p_tex_bits; + attribute_deprecated int i_count; + attribute_deprecated int p_count; + attribute_deprecated int skip_count; + attribute_deprecated int misc_bits; - /** - * number of bits used for the previously encoded frame - * - encoding: Set by libavcodec. - * - decoding: unused - */ + /** @deprecated this field is unused */ + attribute_deprecated int frame_bits; +#endif /** * pass1 encoding statistics output buffer diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 83a43c788c..a550685e4f 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1835,6 +1835,8 @@ vbv_retry: if (ret < 0) return -1; +#if FF_API_STAT_BITS +FF_DISABLE_DEPRECATION_WARNINGS avctx->header_bits = s->header_bits; avctx->mv_bits = s->mv_bits; avctx->misc_bits = s->misc_bits; @@ -1844,6 +1846,8 @@ vbv_retry: // FIXME f/b_count in avctx avctx->p_count = s->mb_num - s->i_count - s->skip_count; avctx->skip_count = s->skip_count; +FF_ENABLE_DEPRECATION_WARNINGS +#endif frame_end(s); @@ -1905,9 +1909,9 @@ vbv_retry: s->pict_type); if (s->avctx->flags & AV_CODEC_FLAG_PASS1) - assert(avctx->header_bits + avctx->mv_bits + avctx->misc_bits + - avctx->i_tex_bits + avctx->p_tex_bits == - put_bits_count(&s->pb)); + assert(put_bits_count(&s->pb) == s->header_bits + s->mv_bits + + s->misc_bits + s->i_tex_bits + + s->p_tex_bits); flush_put_bits(&s->pb); s->frame_bits = put_bits_count(&s->pb); @@ -1990,7 +1994,12 @@ FF_ENABLE_DEPRECATION_WARNINGS #endif } s->total_bits += s->frame_bits; +#if FF_API_STAT_BITS +FF_DISABLE_DEPRECATION_WARNINGS avctx->frame_bits = s->frame_bits; +FF_ENABLE_DEPRECATION_WARNINGS +#endif + pkt->pts = s->current_picture.f->pts; if (!s->low_delay && s->pict_type != AV_PICTURE_TYPE_B) { diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h index 878cf0c55e..cc119002cd 100644 --- a/libavcodec/options_table.h +++ b/libavcodec/options_table.h @@ -127,6 +127,7 @@ static const AVOption avcodec_options[] = { #endif {"b_strategy", "strategy to choose between I/P/B-frames", OFFSET(b_frame_strategy), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, V|E}, {"ps", "RTP payload size in bytes", OFFSET(rtp_payload_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, +#if FF_API_STAT_BITS {"mv_bits", NULL, OFFSET(mv_bits), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, {"header_bits", NULL, OFFSET(header_bits), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, {"i_tex_bits", NULL, OFFSET(i_tex_bits), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, @@ -136,6 +137,7 @@ static const AVOption avcodec_options[] = { {"skip_count", NULL, OFFSET(skip_count), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, {"misc_bits", NULL, OFFSET(misc_bits), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, {"frame_bits", NULL, OFFSET(frame_bits), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, +#endif {"codec_tag", NULL, OFFSET(codec_tag), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, {"bug", "work around not autodetected encoder bugs", OFFSET(workaround_bugs), AV_OPT_TYPE_FLAGS, {.i64 = FF_BUG_AUTODETECT }, INT_MIN, INT_MAX, V|D, "bug"}, {"autodetect", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_AUTODETECT }, INT_MIN, INT_MAX, V|D, "bug"}, diff --git a/libavcodec/version.h b/libavcodec/version.h index 163c8ca201..72b54beaeb 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -203,5 +203,8 @@ #ifndef FF_API_CODER_TYPE #define FF_API_CODER_TYPE (LIBAVCODEC_VERSION_MAJOR < 59) #endif +#ifndef FF_API_STAT_BITS +#define FF_API_STAT_BITS (LIBAVCODEC_VERSION_MAJOR < 59) +#endif #endif /* AVCODEC_VERSION_H */ |