changeset 11999:613d9f443769 draft

Add reorderedPts to x265_picture to signal the reordered pts value of each picture in encode order. Also shared the reordered pts value when analysis load is done by disabling lookahead.
author Divya Manivannan <divya@multicorewareinc.com>
date Mon, 05 Mar 2018 15:14:34 +0530
parents 59c02e68410f
children b7c8bfabc808
files source/CMakeLists.txt source/encoder/encoder.cpp source/x265.h
diffstat 3 files changed, 8 insertions(+-), 1 deletions(-) [+]
line wrap: on
line diff
--- a/source/CMakeLists.txt	Tue Feb 27 15:50:42 2018 +0530
+++ b/source/CMakeLists.txt	Mon Mar 05 15:14:34 2018 +0530
@@ -29,7 +29,7 @@ option(NATIVE_BUILD "Target the build CP
 option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)
 mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 153)
+set(X265_BUILD 154)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
                "${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
--- a/source/encoder/encoder.cpp	Tue Feb 27 15:50:42 2018 +0530
+++ b/source/encoder/encoder.cpp	Mon Mar 05 15:14:34 2018 +0530
@@ -1146,6 +1146,7 @@ int Encoder::encode(const x265_picture* 
 
                 pic_out->pts = outFrame->m_pts;
                 pic_out->dts = outFrame->m_dts;
+                pic_out->reorderedPts = outFrame->m_reorderedPts;
                 pic_out->sliceType = outFrame->m_lowres.sliceType;
                 pic_out->planes[0] = recpic->m_picOrg[0];
                 pic_out->stride[0] = (int)(recpic->m_stride * sizeof(pixel));
@@ -1178,6 +1179,7 @@ int Encoder::encode(const x265_picture* 
                             factor = m_param->scaleFactor * 2;
                         pic_out->analysisData.numCuInHeight = outFrame->m_analysisData.numCuInHeight;
                         pic_out->analysisData.lookahead.dts = outFrame->m_dts;
+                        pic_out->analysisData.lookahead.reorderedPts = outFrame->m_reorderedPts;
                         pic_out->analysisData.satdCost *= factor;
                         pic_out->analysisData.lookahead.keyframe = outFrame->m_lowres.bKeyframe;
                         pic_out->analysisData.lookahead.lastMiniGopBFrame = outFrame->m_lowres.bLastMiniGopBFrame;
@@ -1370,6 +1372,7 @@ int Encoder::encode(const x265_picture* 
             if (m_param->analysisLoad && m_param->bDisableLookahead)
             {
                 frameEnc->m_dts = frameEnc->m_analysisData.lookahead.dts;
+                frameEnc->m_reorderedPts = frameEnc->m_analysisData.lookahead.reorderedPts;
                 if (m_rateControl->m_isVbv)
                 {
                     for (uint32_t index = 0; index < frameEnc->m_analysisData.numCuInHeight; index++)
--- a/source/x265.h	Tue Feb 27 15:50:42 2018 +0530
+++ b/source/x265.h	Mon Mar 05 15:14:34 2018 +0530
@@ -105,6 +105,7 @@ typedef struct x265_lookahead_data
     int       lastMiniGopBFrame;
     int       plannedType[X265_LOOKAHEAD_MAX + 1];
     int64_t   dts;
+    int64_t   reorderedPts;
 } x265_lookahead_data;
 
 /* Stores all analysis data for a single frame */
@@ -363,6 +364,9 @@ typedef struct x265_picture
     int    height;
 
     x265_analysis_2Pass analysis2Pass;
+
+    // pts is reordered in the order of encoding.
+    int64_t reorderedPts;
 } x265_picture;
 
 typedef enum