[x265-commits] [x265] cmake: disable idiotic uninitialized local variable warni...

Steve Borho steve at borho.org
Fri Dec 5 18:00:08 CET 2014


details:   http://hg.videolan.org/x265/rev/c9fd35f97e6d
branches:  
changeset: 8947:c9fd35f97e6d
user:      Steve Borho <steve at borho.org>
date:      Thu Dec 04 21:35:08 2014 -0600
description:
cmake: disable idiotic uninitialized local variable warnings from VC

If the compiler is not going to make any minimal attempt to figure out if a
variable was initialized, I am not going to make any attempt to look at their
stupid warnings.
Subject: [x265] fix chroma distortion for 4:2:2

details:   http://hg.videolan.org/x265/rev/42df5c8bdb25
branches:  
changeset: 8948:42df5c8bdb25
user:      Satoshi Nakagawa <nakagawa424 at oki.com>
date:      Fri Dec 05 13:12:25 2014 +0900
description:
fix chroma distortion for 4:2:2
Subject: [x265] analysis: comments

details:   http://hg.videolan.org/x265/rev/4ae9691c1a23
branches:  
changeset: 8949:4ae9691c1a23
user:      Deepthi Nandakumar <deepthi at multicorewareinc.com>
date:      Fri Dec 05 11:19:10 2014 +0530
description:
analysis: comments
Subject: [x265] rc: fix chroma qp and chroma lambda derivations.

details:   http://hg.videolan.org/x265/rev/a1e76461c0d4
branches:  
changeset: 8950:a1e76461c0d4
user:      Aarthi Thirumalai
date:      Thu Dec 04 12:19:41 2014 +0530
description:
rc: fix chroma qp and chroma lambda derivations.

fix the chroma qp values for Main10 profile, derive chroma qp from luma qp values
according to the HEVC spec.
improves quality at high qps.
Subject: [x265] rc : fix bug in deciding qp for first frame in CRF

details:   http://hg.videolan.org/x265/rev/1458ad34157c
branches:  
changeset: 8951:1458ad34157c
user:      Aarthi Thirumalai
date:      Thu Dec 04 17:13:29 2014 +0530
description:
rc : fix bug in deciding qp for first frame in CRF
Subject: [x265] cmake: do not use a cache string for version found in hg_archive.txt (refs #84)

details:   http://hg.videolan.org/x265/rev/35d086074bb5
branches:  
changeset: 8952:35d086074bb5
user:      Steve Borho <steve at borho.org>
date:      Fri Dec 05 10:59:33 2014 -0600
description:
cmake: do not use a cache string for version found in hg_archive.txt (refs #84)

This was not passing the tagged version number to version.cpp

diffstat:

 source/cmake/version.cmake     |   2 +-
 source/encoder/CMakeLists.txt  |   3 +++
 source/encoder/analysis.cpp    |  22 +++++++++++-----------
 source/encoder/ratecontrol.cpp |   2 +-
 source/encoder/rdcost.h        |  13 +++++++++----
 source/encoder/sao.cpp         |   7 +++++--
 6 files changed, 30 insertions(+), 19 deletions(-)

diffs (160 lines):

diff -r 23e637065aec -r 35d086074bb5 source/cmake/version.cmake
--- a/source/cmake/version.cmake	Thu Dec 04 10:57:35 2014 +0530
+++ b/source/cmake/version.cmake	Fri Dec 05 10:59:33 2014 -0600
@@ -22,7 +22,7 @@ if(EXISTS ${CMAKE_SOURCE_DIR}/../.hg_arc
         set(hg_${key} ${value})
     endforeach()
     if(DEFINED hg_tag)
-        set(X265_VERSION ${hg_tag} CACHE STRING "x265 version string.")
+        set(X265_VERSION ${hg_tag})
         set(X265_LATEST_TAG ${hg_tag})
         set(X265_TAG_DISTANCE "0")
     elseif(DEFINED hg_node)
diff -r 23e637065aec -r 35d086074bb5 source/encoder/CMakeLists.txt
--- a/source/encoder/CMakeLists.txt	Thu Dec 04 10:57:35 2014 +0530
+++ b/source/encoder/CMakeLists.txt	Fri Dec 05 10:59:33 2014 -0600
@@ -3,6 +3,9 @@
 if(GCC)
    add_definitions(-Wno-uninitialized)
 endif()
+if(MSVC)
+   add_definitions(/wd4701) # potentially uninitialized local variable 'foo' used
+endif()
 
 add_library(encoder OBJECT ../x265.h
     analysis.cpp analysis.h
diff -r 23e637065aec -r 35d086074bb5 source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp	Thu Dec 04 10:57:35 2014 +0530
+++ b/source/encoder/analysis.cpp	Fri Dec 05 10:59:33 2014 -0600
@@ -594,7 +594,7 @@ void Analysis::compressInterCU_dist(cons
             if (m_param->rdLevel > 2)
             {
                 /* RD selection between merge, inter, bidir and intra */
-                if (!m_bChromaSa8d)
+                if (!m_bChromaSa8d) /* When m_bChromaSa8d is enabled, chroma MC has already been done */
                 {
                     for (uint32_t puIdx = 0; puIdx < bestInter->cu.getNumPartInter(); puIdx++)
                     {
@@ -845,7 +845,7 @@ void Analysis::compressInterCU_rd0_4(con
             if (m_param->rdLevel >= 3)
             {
                 /* Calculate RD cost of best inter option */
-                if (!m_bChromaSa8d)
+                if (!m_bChromaSa8d) /* When m_bChromaSa8d is enabled, chroma MC has already been done */
                 {
                     for (uint32_t puIdx = 0; puIdx < bestInter->cu.getNumPartInter(); puIdx++)
                     {
@@ -1261,8 +1261,8 @@ void Analysis::checkMerge2Nx2N_rd0_4(Mod
         tempPred->distortion = primitives.sa8d[sizeIdx](fencYuv->m_buf[0], fencYuv->m_size, tempPred->predYuv.m_buf[0], tempPred->predYuv.m_size);
         if (m_bChromaSa8d)
         {
-            tempPred->distortion += primitives.sa8d[cpart](fencYuv->m_buf[1], fencYuv->m_csize, tempPred->predYuv.m_buf[1], tempPred->predYuv.m_csize);
-            tempPred->distortion += primitives.sa8d[cpart](fencYuv->m_buf[2], fencYuv->m_csize, tempPred->predYuv.m_buf[2], tempPred->predYuv.m_csize);
+            tempPred->distortion += primitives.sa8d_inter[cpart](fencYuv->m_buf[1], fencYuv->m_csize, tempPred->predYuv.m_buf[1], tempPred->predYuv.m_csize);
+            tempPred->distortion += primitives.sa8d_inter[cpart](fencYuv->m_buf[2], fencYuv->m_csize, tempPred->predYuv.m_buf[2], tempPred->predYuv.m_csize);
         }
         tempPred->sa8dCost = m_rdCost.calcRdSADCost(tempPred->distortion, tempPred->sa8dBits);
 
@@ -1278,7 +1278,7 @@ void Analysis::checkMerge2Nx2N_rd0_4(Mod
         return;
 
     /* calculate the motion compensation for chroma for the best mode selected */
-    if (!m_bChromaSa8d)
+    if (!m_bChromaSa8d) /* Chroma MC was done above */
     {
         prepMotionCompensation(bestPred->cu, cuGeom, 0);
         motionCompensation(bestPred->predYuv, false, true);
@@ -1458,8 +1458,8 @@ void Analysis::checkInter_rd0_4(Mode& in
         {
             uint32_t cuSize = 1 << cuGeom.log2CUSize;
             int cpart = partitionFromSizes(cuSize >> m_hChromaShift, cuSize >> m_vChromaShift);
-            interMode.distortion += primitives.sa8d[cpart](fencYuv.m_buf[1], fencYuv.m_csize, predYuv.m_buf[1], predYuv.m_csize);
-            interMode.distortion += primitives.sa8d[cpart](fencYuv.m_buf[2], fencYuv.m_csize, predYuv.m_buf[2], predYuv.m_csize);
+            interMode.distortion += primitives.sa8d_inter[cpart](fencYuv.m_buf[1], fencYuv.m_csize, predYuv.m_buf[1], predYuv.m_csize);
+            interMode.distortion += primitives.sa8d_inter[cpart](fencYuv.m_buf[2], fencYuv.m_csize, predYuv.m_buf[2], predYuv.m_csize);
         }
         interMode.sa8dCost = m_rdCost.calcRdSADCost(interMode.distortion, interMode.sa8dBits);
 
@@ -1582,8 +1582,8 @@ void Analysis::checkBidir2Nx2N(Mode& int
     if (m_bChromaSa8d)
     {
         /* Add in chroma distortion */
-        sa8d += primitives.sa8d[cpart](fencYuv.m_buf[1], fencYuv.m_csize, bidir2Nx2N.predYuv.m_buf[1], bidir2Nx2N.predYuv.m_csize);
-        sa8d += primitives.sa8d[cpart](fencYuv.m_buf[2], fencYuv.m_csize, bidir2Nx2N.predYuv.m_buf[2], bidir2Nx2N.predYuv.m_csize);
+        sa8d += primitives.sa8d_inter[cpart](fencYuv.m_buf[1], fencYuv.m_csize, bidir2Nx2N.predYuv.m_buf[1], bidir2Nx2N.predYuv.m_csize);
+        sa8d += primitives.sa8d_inter[cpart](fencYuv.m_buf[2], fencYuv.m_csize, bidir2Nx2N.predYuv.m_buf[2], bidir2Nx2N.predYuv.m_csize);
     }
     bidir2Nx2N.sa8dBits = bestME[0].bits + bestME[1].bits + m_listSelBits[2] - (m_listSelBits[0] + m_listSelBits[1]);
     bidir2Nx2N.sa8dCost = sa8d + m_rdCost.getCost(bidir2Nx2N.sa8dBits);
@@ -1616,8 +1616,8 @@ void Analysis::checkBidir2Nx2N(Mode& int
         if (m_bChromaSa8d)
         {
             /* Add in chroma distortion */
-            zsa8d += primitives.sa8d[cpart](fencYuv.m_buf[1], fencYuv.m_csize, tmpPredYuv.m_buf[1], tmpPredYuv.m_csize);
-            zsa8d += primitives.sa8d[cpart](fencYuv.m_buf[2], fencYuv.m_csize, tmpPredYuv.m_buf[2], tmpPredYuv.m_csize);
+            zsa8d += primitives.sa8d_inter[cpart](fencYuv.m_buf[1], fencYuv.m_csize, tmpPredYuv.m_buf[1], tmpPredYuv.m_csize);
+            zsa8d += primitives.sa8d_inter[cpart](fencYuv.m_buf[2], fencYuv.m_csize, tmpPredYuv.m_buf[2], tmpPredYuv.m_csize);
         }
         uint32_t bits0 = bestME[0].bits - m_me.bitcost(bestME[0].mv, mvp0) + m_me.bitcost(mvzero, mvp0);
         uint32_t bits1 = bestME[1].bits - m_me.bitcost(bestME[1].mv, mvp1) + m_me.bitcost(mvzero, mvp1);
diff -r 23e637065aec -r 35d086074bb5 source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp	Thu Dec 04 10:57:35 2014 +0530
+++ b/source/encoder/ratecontrol.cpp	Fri Dec 05 10:59:33 2014 -0600
@@ -1591,7 +1591,7 @@ double RateControl::rateEstimateQscale(F
             {
                 q = x265_qp2qScale(CRF_INIT_QP) / fabs(m_param->rc.ipFactor);
             }
-            else if (m_framesDone == 0 && !m_isVbv)
+            else if (m_framesDone == 0 && !m_isVbv && m_param->rc.rateControlMode == X265_RC_ABR)
             {
                 /* for ABR alone, clip the first I frame qp */
                 double lqmax = x265_qp2qScale(ABR_INIT_QP_MAX) * m_lstep;
diff -r 23e637065aec -r 35d086074bb5 source/encoder/rdcost.h
--- a/source/encoder/rdcost.h	Thu Dec 04 10:57:35 2014 +0530
+++ b/source/encoder/rdcost.h	Fri Dec 05 10:59:33 2014 -0600
@@ -50,19 +50,24 @@ public:
     void setQP(const Slice& slice, int qp)
     {
         m_qp = qp;
-
+        int qpCb, qpCr;
         /* Scale PSY RD factor by a slice type factor */
         static const uint32_t psyScaleFix8[3] = { 300, 256, 96 }; /* B, P, I */
         m_psyRd = (m_psyRdBase * psyScaleFix8[slice.m_sliceType]) >> 8;
 
         setLambda(x265_lambda2_tab[qp], x265_lambda_tab[qp]);
-
-        int qpCb = Clip3(QP_MIN, QP_MAX_MAX, qp + slice.m_pps->chromaQpOffset[0]);
+        if (slice.m_sps->chromaFormatIdc == X265_CSP_I420)
+            qpCb = Clip3(QP_MIN, QP_MAX_MAX, (int)g_chromaScale[qp + slice.m_pps->chromaQpOffset[0]]);
+        else
+            qpCb = X265_MIN(qp + slice.m_pps->chromaQpOffset[0], QP_MAX_SPEC);
         int chroma_offset_idx = X265_MIN(qp - qpCb + 12, MAX_CHROMA_LAMBDA_OFFSET);
         uint16_t lambdaOffset = m_psyRd ? x265_chroma_lambda2_offset_tab[chroma_offset_idx] : 256;
         setCbDistortionWeight(lambdaOffset);
 
-        int qpCr = Clip3(QP_MIN, QP_MAX_MAX, qp + slice.m_pps->chromaQpOffset[1]);
+        if (slice.m_sps->chromaFormatIdc == X265_CSP_I420)
+            qpCr = Clip3(QP_MIN, QP_MAX_MAX, (int)g_chromaScale[qp + slice.m_pps->chromaQpOffset[0]]);
+        else
+            qpCr = X265_MIN(qp + slice.m_pps->chromaQpOffset[0], QP_MAX_SPEC);
         chroma_offset_idx = X265_MIN(qp - qpCr + 12, MAX_CHROMA_LAMBDA_OFFSET);
         lambdaOffset = m_psyRd ? x265_chroma_lambda2_offset_tab[chroma_offset_idx] : 256;
         setCrDistortionWeight(lambdaOffset);
diff -r 23e637065aec -r 35d086074bb5 source/encoder/sao.cpp
--- a/source/encoder/sao.cpp	Thu Dec 04 10:57:35 2014 +0530
+++ b/source/encoder/sao.cpp	Fri Dec 05 10:59:33 2014 -0600
@@ -176,8 +176,11 @@ void SAO::allocSaoParam(SAOParam* saoPar
 void SAO::startSlice(Frame* frame, Entropy& initState, int qp)
 {
     Slice* slice = frame->m_encData->m_slice;
-
-    int qpCb = Clip3(0, QP_MAX_MAX, qp + slice->m_pps->chromaQpOffset[0]);
+    int qpCb = qp;
+    if (m_param->internalCsp == X265_CSP_I420)
+        qpCb = Clip3(QP_MIN, QP_MAX_MAX, (int)g_chromaScale[qp + slice->m_pps->chromaQpOffset[0]]);
+    else
+        qpCb = X265_MIN(qp + slice->m_pps->chromaQpOffset[0], QP_MAX_SPEC);
     m_lumaLambda = x265_lambda2_tab[qp];
     m_chromaLambda = x265_lambda2_tab[qpCb]; // Use Cb QP for SAO chroma
     m_frame = frame;


More information about the x265-commits mailing list