[x265] [PATCH 1 of 8] analysis-mode: make weights as part of x265_analysis

kavitha at multicorewareinc.com kavitha at multicorewareinc.com
Mon Feb 27 15:05:17 CET 2017


# HG changeset patch
# User Kavitha Sampath <kavitha at multicorewareinc.com>
# Date 1486033351 -19800
#      Thu Feb 02 16:32:31 2017 +0530
# Node ID acc482810fe75fd536436ae9b2db2c7aaf9a1212
# Parent  820f4327ddac44decb4328602ca63e84197ab473
analysis-mode: make weights as part of x265_analysis

analysis_inter_data structure holds CU level information. It is relevant to make
weights member of x265_analysis_data structure.

diff -r 820f4327ddac -r acc482810fe7 source/common/framedata.h
--- a/source/common/framedata.h	Mon Feb 20 17:18:53 2017 +0530
+++ b/source/common/framedata.h	Thu Feb 02 16:32:31 2017 +0530
@@ -176,7 +176,6 @@
 /* Stores inter analysis data for a single frame */
 struct analysis_inter_data
 {
-    WeightParam* wt;
     int32_t*    ref;
     uint8_t*    depth;
     uint8_t*    modes;
diff -r 820f4327ddac -r acc482810fe7 source/encoder/api.cpp
--- a/source/encoder/api.cpp	Mon Feb 20 17:18:53 2017 +0530
+++ b/source/encoder/api.cpp	Thu Feb 02 16:32:31 2017 +0530
@@ -222,6 +222,7 @@
     // encoder now owns these analysisData buffers.
     if (pic_in)
     {
+        pic_in->analysisData.wt = NULL;
         pic_in->analysisData.intraData = NULL;
         pic_in->analysisData.interData = NULL;
         pic_in->analysis2Pass.analysisFramedata = NULL;
diff -r 820f4327ddac -r acc482810fe7 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Mon Feb 20 17:18:53 2017 +0530
+++ b/source/encoder/encoder.cpp	Thu Feb 02 16:32:31 2017 +0530
@@ -733,6 +733,7 @@
             inFrame->m_analysisData.satdCost = inputPic->analysisData.satdCost;
             inFrame->m_analysisData.numCUsInFrame = inputPic->analysisData.numCUsInFrame;
             inFrame->m_analysisData.numPartitions = inputPic->analysisData.numPartitions;
+            inFrame->m_analysisData.wt = inputPic->analysisData.wt;
             inFrame->m_analysisData.interData = inputPic->analysisData.interData;
             inFrame->m_analysisData.intraData = inputPic->analysisData.intraData;
             sliceType = inputPic->analysisData.sliceType;
@@ -817,6 +818,7 @@
                     pic_out->analysisData.satdCost  = outFrame->m_lowres.satdCost;                    
                     pic_out->analysisData.numCUsInFrame = outFrame->m_analysisData.numCUsInFrame;
                     pic_out->analysisData.numPartitions = outFrame->m_analysisData.numPartitions;
+                    pic_out->analysisData.wt = outFrame->m_analysisData.wt;
                     pic_out->analysisData.interData = outFrame->m_analysisData.interData;
                     pic_out->analysisData.intraData = outFrame->m_analysisData.intraData;
                     writeAnalysisFile(&pic_out->analysisData, *outFrame->m_encData);
@@ -2336,7 +2338,8 @@
         CHECKED_MALLOC(interData->modes, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);
         CHECKED_MALLOC(interData->partSize, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);
         CHECKED_MALLOC(interData->mergeFlag, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);
-        CHECKED_MALLOC_ZERO(interData->wt, WeightParam, 3 * numDir);
+        uint32_t numPlanes = m_param->internalCsp == X265_CSP_I400 ? 1 : 3;
+        CHECKED_MALLOC_ZERO(analysis->wt, WeightParam, numPlanes * numDir);
         analysis->interData = interData;
     }
     return;
@@ -2363,7 +2366,7 @@
         X265_FREE(((analysis_inter_data*)analysis->interData)->modes);
         X265_FREE(((analysis_inter_data*)analysis->interData)->mergeFlag);
         X265_FREE(((analysis_inter_data*)analysis->interData)->partSize);
-        X265_FREE(((analysis_inter_data*)analysis->interData)->wt);
+        X265_FREE(analysis->wt);
         X265_FREE(analysis->interData);
     }
 }
@@ -2540,7 +2543,7 @@
         int numDir = analysis->sliceType == X265_TYPE_P ? 1 : 2;
         X265_FREAD(((analysis_inter_data *)analysis->interData)->ref, sizeof(int32_t), analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * numDir, m_analysisFile);
         uint32_t numPlanes = m_param->internalCsp == X265_CSP_I400 ? 1 : 3;
-        X265_FREAD(((analysis_inter_data *)analysis->interData)->wt, sizeof(WeightParam), numPlanes * numDir, m_analysisFile);
+        X265_FREAD((WeightParam*)analysis->wt, sizeof(WeightParam), numPlanes * numDir, m_analysisFile);
         consumedBytes += frameRecordSize;
         if (numDir == 1)
             totalConsumedBytes = consumedBytes;
@@ -2784,7 +2787,7 @@
         X265_FWRITE(((analysis_inter_data*)analysis->interData)->mergeFlag, sizeof(uint8_t), depthBytes, m_analysisFile);
         X265_FWRITE(((analysis_inter_data*)analysis->interData)->ref, sizeof(int32_t), analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * numDir, m_analysisFile);
         uint32_t numPlanes = m_param->internalCsp == X265_CSP_I400 ? 1 : 3;
-        X265_FWRITE(((analysis_inter_data*)analysis->interData)->wt, sizeof(WeightParam), numPlanes * numDir, m_analysisFile);
+        X265_FWRITE((WeightParam*)analysis->wt, sizeof(WeightParam), numPlanes * numDir, m_analysisFile);
     }
 #undef X265_FWRITE
 }
diff -r 820f4327ddac -r acc482810fe7 source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp	Mon Feb 20 17:18:53 2017 +0530
+++ b/source/encoder/frameencoder.cpp	Thu Feb 02 16:32:31 2017 +0530
@@ -384,7 +384,7 @@
 
     WeightParam* reuseWP = NULL;
     if (m_param->analysisMode && (bUseWeightP || bUseWeightB))
-        reuseWP = ((analysis_inter_data*)m_frame->m_analysisData.interData)->wt;
+        reuseWP = (WeightParam*)m_frame->m_analysisData.wt;
 
     if (bUseWeightP || bUseWeightB)
     {
diff -r 820f4327ddac -r acc482810fe7 source/x265.h
--- a/source/x265.h	Mon Feb 20 17:18:53 2017 +0530
+++ b/source/x265.h	Thu Feb 02 16:32:31 2017 +0530
@@ -99,6 +99,7 @@
     uint32_t         numCUsInFrame;
     uint32_t         numPartitions;
     int              bScenecut;
+    void*            wt;
     void*            interData;
     void*            intraData;
 } x265_analysis_data;


More information about the x265-devel mailing list