[x265] [PATCH] Add x265_rc_stats structure to collect rc data for each frame
Divya Manivannan
divya at multicorewareinc.com
Thu Feb 11 11:17:23 CET 2016
# HG changeset patch
# User Divya Manivannan <divya at multicorewareinc.com>
# Date 1454681600 -19800
# Fri Feb 05 19:43:20 2016 +0530
# Node ID 5de8de77a68efc03cc5c06f3d8ff226914399af6
# Parent 822782933427f19e76b34f340a3c52fb4bc95424
Add x265_rc_stats structure to collect rc data for each frame
diff -r 822782933427 -r 5de8de77a68e source/CMakeLists.txt
--- a/source/CMakeLists.txt Tue Feb 09 12:05:42 2016 +0530
+++ b/source/CMakeLists.txt Fri Feb 05 19:43:20 2016 +0530
@@ -30,7 +30,7 @@
mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
# X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 80)
+set(X265_BUILD 81)
configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r 822782933427 -r 5de8de77a68e source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp Tue Feb 09 12:05:42 2016 +0530
+++ b/source/encoder/encoder.cpp Fri Feb 05 19:43:20 2016 +0530
@@ -783,6 +783,21 @@
if (m_rateControl->writeRateControlFrameStats(outFrame, &curEncoder->m_rce))
m_aborted = true;
+ if (pic_out && !m_param->rc.bStatRead)
+ {
+ pic_out->rcData.qpaRc = outFrame->m_encData->m_avgQpRc;
+ pic_out->rcData.qRceq = curEncoder->m_rce.qRceq;
+ pic_out->rcData.qpNoVbv = curEncoder->m_rce.qpNoVbv;
+ pic_out->rcData.coeffBits = outFrame->m_encData->m_frameStats.coeffBits;
+ pic_out->rcData.miscBits = outFrame->m_encData->m_frameStats.miscBits;
+ pic_out->rcData.mvBits = outFrame->m_encData->m_frameStats.mvBits;
+ pic_out->rcData.newQScale = x265_qp2qScale(outFrame->m_encData->m_avgQpRc);
+ pic_out->rcData.poc = curEncoder->m_rce.poc;
+ pic_out->rcData.encodeOrder = curEncoder->m_rce.encodeOrder;
+ pic_out->rcData.sliceType = curEncoder->m_rce.sliceType;
+ pic_out->rcData.keptAsRef = curEncoder->m_rce.sliceType == B_SLICE && !IS_REFERENCED(outFrame) ? false : true;
+ }
+
/* Allow this frame to be recycled if no frame encoders are using it for reference */
if (!pic_out)
{
diff -r 822782933427 -r 5de8de77a68e source/input/y4m.cpp
--- a/source/input/y4m.cpp Tue Feb 09 12:05:42 2016 +0530
+++ b/source/input/y4m.cpp Fri Feb 05 19:43:20 2016 +0530
@@ -417,6 +417,8 @@
{
int pixelbytes = depth > 8 ? 2 : 1;
pic.bitDepth = depth;
+ pic.framesize = framesize;
+ pic.height = height;
pic.colorSpace = colorSpace;
pic.stride[0] = width * pixelbytes;
pic.stride[1] = pic.stride[0] >> x265_cli_csps[colorSpace].width[1];
diff -r 822782933427 -r 5de8de77a68e source/input/yuv.cpp
--- a/source/input/yuv.cpp Tue Feb 09 12:05:42 2016 +0530
+++ b/source/input/yuv.cpp Fri Feb 05 19:43:20 2016 +0530
@@ -225,6 +225,8 @@
uint32_t pixelbytes = depth > 8 ? 2 : 1;
pic.colorSpace = colorSpace;
pic.bitDepth = depth;
+ pic.framesize = framesize;
+ pic.height = height;
pic.stride[0] = width * pixelbytes;
pic.stride[1] = pic.stride[0] >> x265_cli_csps[colorSpace].width[1];
pic.stride[2] = pic.stride[0] >> x265_cli_csps[colorSpace].width[2];
diff -r 822782933427 -r 5de8de77a68e source/x265.h
--- a/source/x265.h Tue Feb 09 12:05:42 2016 +0530
+++ b/source/x265.h Fri Feb 05 19:43:20 2016 +0530
@@ -150,6 +150,21 @@
x265_cu_stats cuStats;
} x265_frame_stats;
+typedef struct x265_rc_stats
+{
+ double qpaRc;
+ double qRceq;
+ double qpNoVbv;
+ double newQScale;
+ int mvBits;
+ int miscBits;
+ int coeffBits;
+ int poc;
+ int encodeOrder;
+ int sliceType;
+ bool keptAsRef;
+} x265_rc_stats;
+
/* Used to pass pictures into the encoder, and to get picture data back out of
* the encoder. The input and output semantics are different */
typedef struct x265_picture
@@ -173,6 +188,10 @@
/* Stride is the number of bytes between row starts */
int stride[3];
+ size_t framesize;
+
+ int height;
+
/* Must be specified on input pictures. x265_picture_init() will set it to
* the encoder's internal bit depth, but this field must describe the depth
* of the input pictures. Must be between 8 and 16. Values larger than 8
@@ -221,6 +240,7 @@
/* Frame level statistics */
x265_frame_stats frameData;
+ x265_rc_stats rcData;
} x265_picture;
typedef enum
More information about the x265-devel
mailing list