1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

Merge commit '16216b713f9a21865cc07993961cf5d0ece24916'

* commit '16216b713f9a21865cc07993961cf5d0ece24916':
  lavc: Drop exporting 2-pass encoding stats

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
This commit is contained in:
Hendrik Leppkes 2015-12-18 14:39:15 +01:00
commit 362028cac9
5 changed files with 35 additions and 8 deletions

View File

@ -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++;

View File

@ -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

View File

@ -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) {

View File

@ -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"},

View File

@ -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 */