[x265] [PATCH 7 of 7] entropy: after encodeCU, the CU structures need to be reset with the right QP

deepthi at multicorewareinc.com deepthi at multicorewareinc.com
Sat Apr 18 08:22:09 CEST 2015


# HG changeset patch
# User Deepthi Nandakumar <deepthi at multicorewareinc.com>
# Date 1429334781 -19800
#      Sat Apr 18 10:56:21 2015 +0530
# Node ID 313a17ef22f4b82e21098ce9f784d2c6d1e52163
# Parent  d138bbee3b0155e1433be7b8360afab9d5ccdaf0
entropy: after encodeCU, the CU structures need to be reset with the right QP

This is used by the deblocking filter to index into the the beta and tc tables.
Without deblocking, no-one cares about the QP structures of CU after encode,
so it wouldnt cause any problems.

diff -r d138bbee3b01 -r 313a17ef22f4 source/encoder/entropy.cpp
--- a/source/encoder/entropy.cpp	Thu Apr 09 00:48:54 2015 -0400
+++ b/source/encoder/entropy.cpp	Sat Apr 18 10:56:21 2015 +0530
@@ -585,7 +585,7 @@
         if (ctu.isSkipped(absPartIdx))
         {
             codeMergeIndex(ctu, absPartIdx);
-            finishCU(ctu, absPartIdx, depth);
+            finishCU(ctu, absPartIdx, depth, bEncodeDQP);
             return;
         }
         codePredMode(ctu.m_predMode[absPartIdx]);
@@ -606,7 +606,7 @@
     codeCoeff(ctu, absPartIdx, bEncodeDQP, tuDepthRange);
 
     // --- write terminating bit ---
-    finishCU(ctu, absPartIdx, depth);
+    finishCU(ctu, absPartIdx, depth, bEncodeDQP);
 }
 
 /* Return bit count of signaling inter mode */
@@ -658,7 +658,7 @@
 }
 
 /* finish encoding a cu and handle end-of-slice conditions */
-void Entropy::finishCU(const CUData& ctu, uint32_t absPartIdx, uint32_t depth)
+void Entropy::finishCU(const CUData& ctu, uint32_t absPartIdx, uint32_t depth, bool bCodeDQP)
 {
     const Slice* slice = ctu.m_slice;
     uint32_t realEndAddress = slice->m_endCUAddr;
@@ -672,6 +672,10 @@
     bool granularityBoundary = (((rpelx & granularityMask) == 0 || (rpelx == slice->m_sps->picWidthInLumaSamples )) &&
                                 ((bpely & granularityMask) == 0 || (bpely == slice->m_sps->picHeightInLumaSamples)));
 
+    if (slice->m_pps->bUseDQP)
+    {
+        ((CUData&)ctu).setQPSubParts(bCodeDQP ? ctu.getRefQP(absPartIdx) : ctu.m_qp[absPartIdx], absPartIdx, depth);
+    }
     if (granularityBoundary)
     {
         // Encode slice finish
diff -r d138bbee3b01 -r 313a17ef22f4 source/encoder/entropy.h
--- a/source/encoder/entropy.h	Thu Apr 09 00:48:54 2015 -0400
+++ b/source/encoder/entropy.h	Sat Apr 18 10:56:21 2015 +0530
@@ -221,7 +221,7 @@
     }
 
     void encodeCU(const CUData& ctu, const CUGeom &cuGeom, uint32_t absPartIdx, uint32_t depth, bool& bEncodeDQP);
-    void finishCU(const CUData& ctu, uint32_t absPartIdx, uint32_t depth);
+    void finishCU(const CUData& ctu, uint32_t absPartIdx, uint32_t depth, bool bEncodeDQP);
 
     void writeOut();
 


More information about the x265-devel mailing list