[x265] [PATCH] Modify TComPrediction structure to support multiple color space formats

ashok at multicorewareinc.com ashok at multicorewareinc.com
Fri Dec 20 14:56:34 CET 2013


# HG changeset patch
# User ashok at multicorewareinc.com
# Date 1387547775 -19800
#      Fri Dec 20 19:26:15 2013 +0530
# Node ID fd76abe06de0807faab6c89b5dbfc37c79632139
# Parent  02769c943b1fc6904b0335d797efed536004eae9
Modify TComPrediction structure to support multiple color space formats

diff -r 02769c943b1f -r fd76abe06de0 source/Lib/TLibCommon/TComPrediction.cpp
--- a/source/Lib/TLibCommon/TComPrediction.cpp	Fri Dec 20 19:25:18 2013 +0530
+++ b/source/Lib/TLibCommon/TComPrediction.cpp	Fri Dec 20 19:26:15 2013 +0530
@@ -100,6 +100,9 @@
 
 void TComPrediction::initTempBuff(int csp)
 {
+    m_hChromaShift = CHROMA_H_SHIFT(csp);
+    m_vChromaShift = CHROMA_V_SHIFT(csp);
+
     if (m_predBuf == NULL)
     {
         int extWidth  = MAX_CU_SIZE + 16;
@@ -570,8 +573,8 @@
     int xFrac = mv->x & 0x7;
     int yFrac = mv->y & 0x7;
     int partEnum = partitionFromSizes(width, height);
-    uint32_t cxWidth = width >> 1;
-    uint32_t cxHeight = height >> 1;
+    uint32_t cxWidth  = width  >> m_hChromaShift;
+    uint32_t cxHeight = height >> m_vChromaShift;
 
     if ((yFrac | xFrac) == 0)
     {
@@ -618,10 +621,9 @@
 
     int xFrac = mv->x & 0x7;
     int yFrac = mv->y & 0x7;
-    uint32_t cxWidth = width >> 1;
-    uint32_t cxHeight = height >> 1;
+    uint32_t cxWidth  = width  >> m_hChromaShift;
+    uint32_t cxHeight = height >> m_vChromaShift;
 
-    assert(dstStride == MAX_CU_SIZE / 2);
     assert(((cxWidth | cxHeight) % 2) == 0);
 
     if ((yFrac | xFrac) == 0)
diff -r 02769c943b1f -r fd76abe06de0 source/Lib/TLibCommon/TComPrediction.h
--- a/source/Lib/TLibCommon/TComPrediction.h	Fri Dec 20 19:25:18 2013 +0530
+++ b/source/Lib/TLibCommon/TComPrediction.h	Fri Dec 20 19:26:15 2013 +0530
@@ -83,6 +83,9 @@
     Pel*      m_lumaRecBuffer; ///< array for down-sampled reconstructed luma sample
     int       m_lumaRecStride; ///< stride of m_lumaRecBuffer
 
+    int m_hChromaShift;
+    int m_vChromaShift;
+
     // motion compensation functions
     void xPredInterUni(TComDataCU* cu, uint32_t partAddr, int width, int height, int picList, TComYuv* outPredYuv, bool bLuma = true, bool bChroma = true);
     void xPredInterUni(TComDataCU* cu, uint32_t partAddr, int width, int height, int picList, TShortYUV* outPredYuv, bool bLuma = true, bool bChroma = true);


More information about the x265-devel mailing list