[x265] [PATCH] slicetype: bug fix for estimated frame costs

Aarthi Thirumalai aarthi at multicorewareinc.com
Wed Oct 23 12:27:44 CEST 2013


# HG changeset patch
# User Aarthi Thirumalai
# Date 1382524030 -19800
#      Wed Oct 23 15:57:10 2013 +0530
# Node ID a38471f17740ba5bd09edc8f9157a1a4e493d960
# Parent  6d96d64c4e9a2c526b57274760a7147241328cb3
slicetype: bug fix for estimated frame costs.

diff -r 6d96d64c4e9a -r a38471f17740 source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp	Tue Oct 22 23:36:36 2013 +0530
+++ b/source/encoder/ratecontrol.cpp	Wed Oct 23 15:57:10 2013 +0530
@@ -27,7 +27,7 @@
 #include "ratecontrol.h"
 #include "TLibEncoder/TEncCfg.h"
 #include <math.h>
-
+extern FILE* fp, *fp1;
 using namespace x265;
 
 #define BASE_FRAME_DURATION 0.04
@@ -121,6 +121,7 @@
                 int cu_xy = maxCols * cu_y + cu_x;
                 qp_adj = acEnergyCu(pic, cu_xy);
                 pic->m_lowres.m_qpAqOffset[cu_xy] = qp_adj;
+                fprintf(fp1,"\n cuxy: %d , qp : %f",cu_xy,qp_adj);
             }
         }
     }
@@ -177,12 +178,14 @@
 {
     curSlice = pic->getSlice();
     sliceType = curSlice->getSliceType();
-
+    int actualSatdCost = 0;
     switch (cfg->param.rc.rateControlMode)
     {
     case X265_RC_ABR:
     {
-        lastSatd = l->getEstimatedPictureCost(pic);
+        actualSatdCost = l->getEstimatedPictureCost(pic);
+        lastSatd = pic->m_lowres.satdCost;
+        fprintf(fp,"\n poc : %d , satdCost : %d ", curSlice->getPOC() , actualSatdCost);
         double q = qScale2qp(rateEstimateQscale(rce));
         qp = Clip3(MIN_QP, MAX_QP, (int)(q + 0.5));
         rce->qpaRc = q;
diff -r 6d96d64c4e9a -r a38471f17740 source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp	Tue Oct 22 23:36:36 2013 +0530
+++ b/source/encoder/slicetype.cpp	Wed Oct 23 15:57:10 2013 +0530
@@ -150,7 +150,7 @@
         break;
     case P_SLICE:
         d0 = poc - l0poc;
-        frames[0] = lastNonB;
+        frames[0] = &pic->getSlice()->getRefPic(REF_PIC_LIST_0, 0)->m_lowres;
         frames[d0] = &pic->m_lowres;
         p0 = 0;
         p1 = d0;
@@ -162,7 +162,7 @@
         {
             // L1 reference is truly in the future
             d1 = l1poc - poc;
-            frames[0] = lastNonB;
+            frames[0] = &pic->getSlice()->getRefPic(REF_PIC_LIST_0, 0)->m_lowres;
             frames[d0] = &pic->m_lowres;
             frames[d0 + d1] = &pic->getSlice()->getRefPic(REF_PIC_LIST_1, 0)->m_lowres;
             p0 = 0;
@@ -171,7 +171,7 @@
         }
         else
         {
-            frames[0] = lastNonB;
+            frames[0] = &pic->getSlice()->getRefPic(REF_PIC_LIST_0, 0)->m_lowres;
             frames[d0] = &pic->m_lowres;
             p0 = 0;
             p1 = d0;
diff -r 6d96d64c4e9a -r a38471f17740 source/x265.cpp
--- a/source/x265.cpp	Tue Oct 22 23:36:36 2013 +0530
+++ b/source/x265.cpp	Wed Oct 23 15:57:10 2013 +0530
@@ -160,7 +160,7 @@
 FILE* fp = NULL;
 FILE * fp1 = NULL;
 #endif
-
+FILE* fp, *fp1 , *fp2;
 /* Ctrl-C handler */
 static volatile sig_atomic_t b_ctrl_c /* = 0 */;
 static void sigint_handler(int)
@@ -636,7 +636,9 @@
     fp = fopen("Log_CU_stats.txt", "w");
     fp1 = fopen("LOG_CU_COST.txt", "w");
 #endif
-
+    fp = fopen("SatdCosts.txt","w");
+    fp1 = fopen ("qpAqOffsets.txt","w");
+    fp2 = fopen("qpCheck.txt","w");
     x265_param_t param;
     CLIOptions   cliopt;
 


More information about the x265-devel mailing list