[x265] [PATCH] fix WP issue for 422 and 444 format

ashok at multicorewareinc.com ashok at multicorewareinc.com
Wed Apr 30 16:23:32 CEST 2014


# HG changeset patch
# User Ashok Kumar Mishra<ashok at multicorewareinc.com>
# Date 1398867340 -19800
#      Wed Apr 30 19:45:40 2014 +0530
# Node ID 487e501214ad81607ed9e874ff1767be45fa3613
# Parent  56b1d4a44798b1e8c0ea98a702ea53a975d254d1
fix WP issue for 422 and 444 format

diff -r 56b1d4a44798 -r 487e501214ad source/Lib/TLibCommon/TComWeightPrediction.cpp
--- a/source/Lib/TLibCommon/TComWeightPrediction.cpp	Mon Apr 28 17:48:59 2014 +0530
+++ b/source/Lib/TLibCommon/TComWeightPrediction.cpp	Wed Apr 30 19:45:40 2014 +0530
@@ -99,12 +99,12 @@
     if (bLuma)
     {
         // Luma : --------------------------------------------
-        int w0      = wp0[0].w;
-        int offset  = wp0[0].o + wp1[0].o;
+        int w0       = wp0[0].w;
+        int offset   = wp0[0].o + wp1[0].o;
         int shiftNum = IF_INTERNAL_PREC - X265_DEPTH;
-        int shift   = wp0[0].shift + shiftNum + 1;
-        int round   = shift ? (1 << (shift - 1)) * bRound : 0;
-        int w1      = wp1[0].w;
+        int shift    = wp0[0].shift + shiftNum + 1;
+        int round    = shift ? (1 << (shift - 1)) * bRound : 0;
+        int w1       = wp1[0].w;
 
         uint32_t  src0Stride = srcYuv0->getStride();
         uint32_t  src1Stride = srcYuv1->getStride();
@@ -145,8 +145,8 @@
         uint32_t src1Stride = srcYuv1->getCStride();
         uint32_t dststride  = outDstYuv->getCStride();
 
-        width  >>= 1;
-        height >>= 1;
+        width  >>= srcYuv0->getHorzChromaShift();
+        height >>= srcYuv0->getVertChromaShift();
 
         for (y = height - 1; y >= 0; y--)
         {
@@ -268,8 +268,8 @@
         src1Stride = srcYuv1->m_cwidth;
         dststride  = outDstYuv->getCStride();
 
-        width  >>= 1;
-        height >>= 1;
+        width  >>= srcYuv0->getHorzChromaShift();
+        height >>= srcYuv0->getVertChromaShift();
 
         for (y = height - 1; y >= 0; y--)
         {
@@ -379,8 +379,8 @@
         src0Stride = srcYuv0->getCStride();
         dststride  = outDstYuv->getCStride();
 
-        width  >>= 1;
-        height >>= 1;
+        width  >>= srcYuv0->getHorzChromaShift();
+        height >>= srcYuv0->getVertChromaShift();
 
         for (y = height - 1; y >= 0; y--)
         {
@@ -469,8 +469,8 @@
         srcStride = srcYuv0->m_cwidth;
         dstStride  = outDstYuv->getCStride();
 
-        width  >>= 1;
-        height >>= 1;
+        width  >>= srcYuv0->getHorzChromaShift();
+        height >>= srcYuv0->getVertChromaShift();
 
         primitives.weight_sp(srcU0, dstU, srcStride, dstStride, width, height, w0, round, shift, offset);
 
diff -r 56b1d4a44798 -r 487e501214ad source/Lib/TLibCommon/TComYuv.h
--- a/source/Lib/TLibCommon/TComYuv.h	Mon Apr 28 17:48:59 2014 +0530
+++ b/source/Lib/TLibCommon/TComYuv.h	Wed Apr 30 19:45:40 2014 +0530
@@ -202,6 +202,13 @@
     uint32_t getCHeight()   { return m_cheight; }
 
     uint32_t getCWidth()    { return m_cwidth;  }
+
+    // -------------------------------------------------------------------------------------------------------------------
+    // member functions to support multiple color space formats
+    // -------------------------------------------------------------------------------------------------------------------
+
+    int  getHorzChromaShift()  { return m_hChromaShift; }
+    int  getVertChromaShift()  { return m_vChromaShift; }
 };
 }
 //! \}
diff -r 56b1d4a44798 -r 487e501214ad source/common/shortyuv.h
--- a/source/common/shortyuv.h	Mon Apr 28 17:48:59 2014 +0530
+++ b/source/common/shortyuv.h	Wed Apr 30 19:45:40 2014 +0530
@@ -121,6 +121,13 @@
     void copyPartToPartLuma(TComYuv* dstPicYuv, uint32_t partIdx, uint32_t width, uint32_t height);
     void copyPartToPartChroma(TComYuv* dstPicYuv, uint32_t partIdx, uint32_t lumaSize, bool bChromaSame);
     void copyPartToPartYuvChroma(TComYuv* dstPicYuv, uint32_t partIdx, uint32_t lumaSize, uint32_t chromaId, const bool splitIntoSubTUs);
+
+    // -------------------------------------------------------------------------------------------------------------------
+    // member functions to support multiple color space formats
+    // -------------------------------------------------------------------------------------------------------------------
+
+    int  getHorzChromaShift()  { return m_hChromaShift; }
+    int  getVertChromaShift()  { return m_vChromaShift; }
 };
 }
 
diff -r 56b1d4a44798 -r 487e501214ad source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Mon Apr 28 17:48:59 2014 +0530
+++ b/source/encoder/encoder.cpp	Wed Apr 30 19:45:40 2014 +0530
@@ -1318,11 +1318,7 @@
         x265_log(p, X265_LOG_WARNING, "!! HEVC Range Extension specifications are not finalized !!\n");
         x265_log(p, X265_LOG_WARNING, "!! This output bitstream may not be compliant with the final spec !!\n");
     }
-    if ((p->internalCsp == X265_CSP_I444 || p->internalCsp == X265_CSP_I422) && p->bEnableWeightedPred)
-    {
-        x265_log(p, X265_LOG_WARNING, "Weightp not supported for 4:4:4/4:2:2 internal color space, weightp disabled\n");
-        p->bEnableWeightedPred = false;
-    }
+
     if (p->interlaceMode)
     {
         x265_log(p, X265_LOG_WARNING, "Support for interlaced video is experimental\n");


More information about the x265-devel mailing list