[x265] [PATCH] API changes to reconfigure scalinglists

vignesh at multicorewareinc.com vignesh at multicorewareinc.com
Tue Dec 27 11:44:32 CET 2016


# HG changeset patch
# User Vignesh Vijayakumar <vignesh at multicorewareinc.com>
# Date 1482231953 -19800
#      Tue Dec 20 16:35:53 2016 +0530
# Node ID baa535a4a9b2f96a93a8ce4c303a445501d97e7b
# Parent  78e1e1354a25d287f17359ed489833e46bf177f1
API changes to reconfigure scalinglists

diff -r 78e1e1354a25 -r baa535a4a9b2 source/encoder/api.cpp
--- a/source/encoder/api.cpp	Fri Dec 09 10:45:12 2016 +0530
+++ b/source/encoder/api.cpp	Tue Dec 20 16:35:53 2016 +0530
@@ -183,6 +183,20 @@
     }
     else
     {
+        if (encoder->m_latestParam->scalingLists && encoder->m_latestParam->scalingLists != encoder->m_param->scalingLists)
+        {
+            if (encoder->m_param->bRepeatHeaders)
+            {
+                if (encoder->m_scalingList.parseScalingList(encoder->m_latestParam->scalingLists))
+                    return -1;
+                encoder->m_scalingList.setupQuantMatrices();
+            }
+            else
+            {
+                x265_log(encoder->m_param, X265_LOG_ERROR, "Repeat headers is turned OFF, cannot reconfigure scalinglists\n");
+                return -1;
+            }
+        }
         encoder->m_reconfigure = true;
         encoder->printReconfigureParams();
     }
diff -r 78e1e1354a25 -r baa535a4a9b2 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Fri Dec 09 10:45:12 2016 +0530
+++ b/source/encoder/encoder.cpp	Tue Dec 20 16:35:53 2016 +0530
@@ -408,6 +408,14 @@
     if (m_analysisFile)
         fclose(m_analysisFile);
 
+    if (m_latestParam != NULL && m_latestParam != m_param)
+    {
+        if (m_latestParam->scalingLists != m_param->scalingLists)
+            free((char*)m_latestParam->scalingLists);
+
+        PARAM_NS::x265_param_free(m_latestParam);
+    }
+
     if (m_param)
     {
         /* release string arguments that were strdup'd */
@@ -420,8 +428,6 @@
 
         PARAM_NS::x265_param_free(m_param);
     }
-
-    PARAM_NS::x265_param_free(m_latestParam);
 }
 
 void Encoder::updateVbvPlan(RateControl* rc)
@@ -986,6 +992,8 @@
     encParam->bEnableRectInter = param->bEnableRectInter;
     encParam->maxNumMergeCand = param->maxNumMergeCand;
     encParam->bIntraInBFrames = param->bIntraInBFrames;
+    if (param->scalingLists && !encParam->scalingLists)
+        encParam->scalingLists = strdup(param->scalingLists);
     /* To add: Loop Filter/deblocking controls, transform skip, signhide require PPS to be resent */
     /* To add: SAO, temporal MVP, AMP, TU depths require SPS to be resent, at every CVS boundary */
     return x265_check_params(encParam);
@@ -2460,7 +2468,7 @@
     
     x265_log(newParam, X265_LOG_DEBUG, "Reconfigured param options, input Frame: %d\n", m_pocLast + 1);
 
-    char tmp[40];
+    char tmp[60];
 #define TOOLCMP(COND1, COND2, STR)  if (COND1 != COND2) { sprintf(tmp, STR, COND1, COND2); x265_log(newParam, X265_LOG_DEBUG, tmp); }
     TOOLCMP(oldParam->maxNumReferences, newParam->maxNumReferences, "ref=%d to %d\n");
     TOOLCMP(oldParam->bEnableFastIntra, newParam->bEnableFastIntra, "fast-intra=%d to %d\n");
@@ -2474,6 +2482,7 @@
     TOOLCMP(oldParam->bEnableRectInter, newParam->bEnableRectInter, "rect=%d to %d\n");
     TOOLCMP(oldParam->maxNumMergeCand, newParam->maxNumMergeCand, "max-merge=%d to %d\n");
     TOOLCMP(oldParam->bIntraInBFrames, newParam->bIntraInBFrames, "b-intra=%d to %d\n");
+    TOOLCMP(oldParam->scalingLists, newParam->scalingLists, "scalinglists=%s to %s\n");
 }
 
 bool Encoder::computeSPSRPSIndex()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x265.patch
Type: text/x-patch
Size: 3480 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20161227/d01dadfe/attachment-0001.bin>


More information about the x265-devel mailing list