aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2019-12-28 13:34:19 -0300
committerJames Almer <jamrial@gmail.com>2020-01-01 13:50:39 -0300
commit3670a10c2d69dfb125ad1fe53fe8eddd9a687166 (patch)
tree454330ec22e297bbd77ec915e453a3cdd2f1b539
parent278a91f8fe192944292b134cd47d853c6b1d55d8 (diff)
downloadffmpeg-3670a10c2d69dfb125ad1fe53fe8eddd9a687166.tar.gz
avcodec/libx265: export encoded frame stats
Signed-off-by: James Almer <jamrial@gmail.com> (cherry picked from commit 66b6005301894823052b437a950003ffbe3ba6de)
-rw-r--r--libavcodec/libx265.c16
-rw-r--r--libavcodec/version.h2
2 files changed, 12 insertions, 6 deletions
diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index 3c3deb2bdb..f2e7d92329 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -482,6 +482,7 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
x265_picture x265pic_out = { 0 };
x265_nal *nal;
uint8_t *dst;
+ int pict_type;
int payload = 0;
int nnal;
int ret;
@@ -541,20 +542,23 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
pkt->pts = x265pic_out.pts;
pkt->dts = x265pic_out.dts;
-#if FF_API_CODED_FRAME
-FF_DISABLE_DEPRECATION_WARNINGS
switch (x265pic_out.sliceType) {
case X265_TYPE_IDR:
case X265_TYPE_I:
- avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
+ pict_type = AV_PICTURE_TYPE_I;
break;
case X265_TYPE_P:
- avctx->coded_frame->pict_type = AV_PICTURE_TYPE_P;
+ pict_type = AV_PICTURE_TYPE_P;
break;
case X265_TYPE_B:
- avctx->coded_frame->pict_type = AV_PICTURE_TYPE_B;
+ case X265_TYPE_BREF:
+ pict_type = AV_PICTURE_TYPE_B;
break;
}
+
+#if FF_API_CODED_FRAME
+FF_DISABLE_DEPRECATION_WARNINGS
+ avctx->coded_frame->pict_type = pict_type;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
@@ -565,6 +569,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
#endif
pkt->flags |= AV_PKT_FLAG_DISPOSABLE;
+ ff_side_data_set_encoder_stats(pkt, x265pic_out.frameData.qp * FF_QP2LAMBDA, NULL, 0, pict_type);
+
*got_packet = 1;
return 0;
}
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 4c4027d709..77da913df0 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
#define LIBAVCODEC_VERSION_MAJOR 58
#define LIBAVCODEC_VERSION_MINOR 65
-#define LIBAVCODEC_VERSION_MICRO 101
+#define LIBAVCODEC_VERSION_MICRO 102
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \