[x265-commits] [x265] y4m: fix eof detection during header parsing

Steve Borho steve at borho.org
Tue Nov 5 05:53:08 CET 2013


details:   http://hg.videolan.org/x265/rev/9732c845db44
branches:  
changeset: 4834:9732c845db44
user:      Steve Borho <steve at borho.org>
date:      Mon Nov 04 20:45:18 2013 -0600
description:
y4m: fix eof detection during header parsing

Evaluating an istream as a bool returns the file status.  When ifs was converted
to a stream pointer, these while loops needed to be changed because a bool
evaluation of a pointer is always true if the pointer is not NULL
Subject: [x265] y4m: fix two more while loops

details:   http://hg.videolan.org/x265/rev/22d51335d4ec
branches:  
changeset: 4835:22d51335d4ec
user:      Steve Borho <steve at borho.org>
date:      Mon Nov 04 21:12:51 2013 -0600
description:
y4m: fix two more while loops
Subject: [x265] white-space fixes following UInt->uint32_t search and replace

details:   http://hg.videolan.org/x265/rev/686b5b502797
branches:  
changeset: 4836:686b5b502797
user:      Steve Borho <steve at borho.org>
date:      Mon Nov 04 22:50:48 2013 -0600
description:
white-space fixes following UInt->uint32_t search and replace

diffstat:

 source/Lib/TLibCommon/TComPic.h       |   26 ++--
 source/Lib/TLibCommon/TComPicSym.h    |   38 +++---
 source/Lib/TLibEncoder/TEncCfg.h      |   14 +-
 source/Lib/TLibEncoder/TEncCu.h       |    2 +-
 source/Lib/TLibEncoder/TEncSearch.cpp |  212 +++++++++++++++++-----------------
 source/input/y4m.cpp                  |   16 +-
 6 files changed, 154 insertions(+), 154 deletions(-)

diffs (truncated from 596 to 300 lines):

diff -r f3106abb88b2 -r 686b5b502797 source/Lib/TLibCommon/TComPic.h
--- a/source/Lib/TLibCommon/TComPic.h	Mon Nov 04 18:35:58 2013 -0600
+++ b/source/Lib/TLibCommon/TComPic.h	Mon Nov 04 22:50:48 2013 -0600
@@ -93,8 +93,8 @@ public:
     double                m_elapsedCompressTime;
     double                m_frameTime;
     MD5Context            m_state[3];
-    uint32_t                  m_crc[3];
-    uint32_t                  m_checksum[3];
+    uint32_t              m_crc[3];
+    uint32_t              m_checksum[3];
 
     TComPic();
     virtual ~TComPic();
@@ -121,31 +121,31 @@ public:
 
     int           getPOC()                { return m_picSym->getSlice()->getPOC(); }
 
-    TComDataCU*   getCU(uint32_t cuAddr)    { return m_picSym->getCU(cuAddr); }
+    TComDataCU*   getCU(uint32_t cuAddr)  { return m_picSym->getCU(cuAddr); }
 
     TComPicYuv*   getPicYuvOrg()          { return m_origPicYuv; }
 
     TComPicYuv*   getPicYuvRec()          { return m_reconPicYuv; }
 
-    uint32_t          getNumCUsInFrame()      { return m_picSym->getNumberOfCUsInFrame(); }
+    uint32_t      getNumCUsInFrame()      { return m_picSym->getNumberOfCUsInFrame(); }
 
-    uint32_t          getNumPartInWidth()     { return m_picSym->getNumPartInWidth(); }
+    uint32_t      getNumPartInWidth()     { return m_picSym->getNumPartInWidth(); }
 
-    uint32_t          getNumPartInHeight()    { return m_picSym->getNumPartInHeight(); }
+    uint32_t      getNumPartInHeight()    { return m_picSym->getNumPartInHeight(); }
 
-    uint32_t          getNumPartInCU()        { return m_picSym->getNumPartition(); }
+    uint32_t      getNumPartInCU()        { return m_picSym->getNumPartition(); }
 
-    uint32_t          getFrameWidthInCU()     { return m_picSym->getFrameWidthInCU(); }
+    uint32_t      getFrameWidthInCU()     { return m_picSym->getFrameWidthInCU(); }
 
-    uint32_t          getFrameHeightInCU()    { return m_picSym->getFrameHeightInCU(); }
+    uint32_t      getFrameHeightInCU()    { return m_picSym->getFrameHeightInCU(); }
 
-    uint32_t          getMinCUWidth()         { return m_picSym->getMinCUWidth(); }
+    uint32_t      getMinCUWidth()         { return m_picSym->getMinCUWidth(); }
 
-    uint32_t          getMinCUHeight()        { return m_picSym->getMinCUHeight(); }
+    uint32_t      getMinCUHeight()        { return m_picSym->getMinCUHeight(); }
 
-    uint32_t          getParPelX(UChar partIdx) { return getParPelX(partIdx); }
+    uint32_t      getParPelX(UChar partIdx) { return getParPelX(partIdx); }
 
-    uint32_t          getParPelY(UChar partIdx) { return getParPelX(partIdx); }
+    uint32_t      getParPelY(UChar partIdx) { return getParPelX(partIdx); }
 
     int           getStride()             { return m_reconPicYuv->getStride(); }
 
diff -r f3106abb88b2 -r 686b5b502797 source/Lib/TLibCommon/TComPicSym.h
--- a/source/Lib/TLibCommon/TComPicSym.h	Mon Nov 04 18:35:58 2013 -0600
+++ b/source/Lib/TLibCommon/TComPicSym.h	Mon Nov 04 22:50:48 2013 -0600
@@ -61,19 +61,19 @@ class TComPicSym
 {
 private:
 
-    uint32_t          m_widthInCU;
-    uint32_t          m_heightInCU;
+    uint32_t      m_widthInCU;
+    uint32_t      m_heightInCU;
 
-    uint32_t          m_maxCUWidth;
-    uint32_t          m_maxCUHeight;
-    uint32_t          m_minCUWidth;
-    uint32_t          m_minCUHeight;
+    uint32_t      m_maxCUWidth;
+    uint32_t      m_maxCUHeight;
+    uint32_t      m_minCUWidth;
+    uint32_t      m_minCUHeight;
 
     UChar         m_totalDepth;
-    uint32_t          m_numPartitions;
-    uint32_t          m_numPartInWidth;
-    uint32_t          m_numPartInHeight;
-    uint32_t          m_numCUsInFrame;
+    uint32_t      m_numPartitions;
+    uint32_t      m_numPartInWidth;
+    uint32_t      m_numPartInHeight;
+    uint32_t      m_numCUsInFrame;
 
     TComSlice*    m_slice;
     TComDataCU**  m_cuData;
@@ -89,23 +89,23 @@ public:
 
     TComSlice*  getSlice()                { return m_slice; }
 
-    uint32_t        getFrameWidthInCU()       { return m_widthInCU; }
+    uint32_t    getFrameWidthInCU()       { return m_widthInCU; }
 
-    uint32_t        getFrameHeightInCU()      { return m_heightInCU; }
+    uint32_t    getFrameHeightInCU()      { return m_heightInCU; }
 
-    uint32_t        getMinCUWidth()           { return m_minCUWidth; }
+    uint32_t    getMinCUWidth()           { return m_minCUWidth; }
 
-    uint32_t        getMinCUHeight()          { return m_minCUHeight; }
+    uint32_t    getMinCUHeight()          { return m_minCUHeight; }
 
-    uint32_t        getNumberOfCUsInFrame()   { return m_numCUsInFrame; }
+    uint32_t    getNumberOfCUsInFrame()   { return m_numCUsInFrame; }
 
-    TComDataCU*&  getCU(uint32_t cuAddr)      { return m_cuData[cuAddr]; }
+    TComDataCU*&  getCU(uint32_t cuAddr)  { return m_cuData[cuAddr]; }
 
-    uint32_t        getNumPartition()         { return m_numPartitions; }
+    uint32_t    getNumPartition()         { return m_numPartitions; }
 
-    uint32_t        getNumPartInWidth()       { return m_numPartInWidth; }
+    uint32_t    getNumPartInWidth()       { return m_numPartInWidth; }
 
-    uint32_t        getNumPartInHeight()      { return m_numPartInHeight; }
+    uint32_t    getNumPartInHeight()      { return m_numPartInHeight; }
 
     void allocSaoParam(TComSampleAdaptiveOffset *sao);
 
diff -r f3106abb88b2 -r 686b5b502797 source/Lib/TLibEncoder/TEncCfg.h
--- a/source/Lib/TLibEncoder/TEncCfg.h	Mon Nov 04 18:35:58 2013 -0600
+++ b/source/Lib/TLibEncoder/TEncCfg.h	Mon Nov 04 22:50:48 2013 -0600
@@ -79,8 +79,8 @@ protected:
                                                 // TODO: We need to have a common sliding mechanism used by both the encoder and decoder
 
     //======= Transform =============
-    uint32_t      m_quadtreeTULog2MaxSize;
-    uint32_t      m_quadtreeTULog2MinSize;
+    uint32_t  m_quadtreeTULog2MaxSize;
+    uint32_t  m_quadtreeTULog2MinSize;
 
     //====== Loop/Deblock Filter ========
     bool      m_loopFilterOffsetInPPS;
@@ -97,12 +97,12 @@ protected:
     //====== Tool list ========
     bool      m_bUseASR;
     bool      m_usePCM;
-    uint32_t      m_pcmLog2MaxSize;
-    uint32_t      m_pcmLog2MinSize;
+    uint32_t  m_pcmLog2MaxSize;
+    uint32_t  m_pcmLog2MinSize;
 
     bool      m_bPCMInputBitDepthFlag;
-    uint32_t      m_pcmBitDepthLuma;
-    uint32_t      m_pcmBitDepthChroma;
+    uint32_t  m_pcmBitDepthLuma;
+    uint32_t  m_pcmBitDepthChroma;
     bool      m_bPCMFilterDisableFlag;
     bool      m_loopFilterAcrossTilesEnabledFlag;
 
@@ -115,7 +115,7 @@ protected:
 
     //====== Weighted Prediction ========
 
-    uint32_t      m_log2ParallelMergeLevelMinus2;                 ///< Parallel merge estimation region
+    uint32_t  m_log2ParallelMergeLevelMinus2;                 ///< Parallel merge estimation region
 
     int       m_useScalingListId;                             ///< Using quantization matrix i.e. 0=off, 1=default.
 
diff -r f3106abb88b2 -r 686b5b502797 source/Lib/TLibEncoder/TEncCu.h
--- a/source/Lib/TLibEncoder/TEncCu.h	Mon Nov 04 18:35:58 2013 -0600
+++ b/source/Lib/TLibEncoder/TEncCu.h	Mon Nov 04 22:50:48 2013 -0600
@@ -101,7 +101,7 @@ private:
     TEncSbac***  m_rdSbacCoders;
     TEncSbac*    m_rdGoOnSbacCoder;
 
-    uint32_t         m_LCUPredictionSAD;
+    uint32_t     m_LCUPredictionSAD;
     int          m_addSADDepth;
     int          m_temporalSAD;
     UChar        m_totalDepth;
diff -r f3106abb88b2 -r 686b5b502797 source/Lib/TLibEncoder/TEncSearch.cpp
--- a/source/Lib/TLibEncoder/TEncSearch.cpp	Mon Nov 04 18:35:58 2013 -0600
+++ b/source/Lib/TLibEncoder/TEncSearch.cpp	Mon Nov 04 22:50:48 2013 -0600
@@ -196,10 +196,10 @@ void TEncSearch::setQPLambda(int QP, dou
 
 void TEncSearch::xEncSubdivCbfQT(TComDataCU* cu, uint32_t trDepth, uint32_t absPartIdx, bool bLuma, bool bChroma)
 {
-    uint32_t  fullDepth  = cu->getDepth(0) + trDepth;
-    uint32_t  trMode     = cu->getTransformIdx(absPartIdx);
-    uint32_t  subdiv     = (trMode > trDepth ? 1 : 0);
-    uint32_t  trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUWidth()] + 2 - fullDepth;
+    uint32_t fullDepth  = cu->getDepth(0) + trDepth;
+    uint32_t trMode     = cu->getTransformIdx(absPartIdx);
+    uint32_t subdiv     = (trMode > trDepth ? 1 : 0);
+    uint32_t trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUWidth()] + 2 - fullDepth;
 
     if (cu->getPredictionMode(0) == MODE_INTRA && cu->getPartitionSize(0) == SIZE_NxN && trDepth == 0)
     {
@@ -405,36 +405,36 @@ uint32_t TEncSearch::xGetIntraBitsQTChro
 }
 
 void TEncSearch::xIntraCodingLumaBlk(TComDataCU* cu,
-                                     uint32_t        trDepth,
-                                     uint32_t        absPartIdx,
+                                     uint32_t    trDepth,
+                                     uint32_t    absPartIdx,
                                      TComYuv*    fencYuv,
                                      TComYuv*    predYuv,
                                      TShortYUV*  resiYuv,
-                                     uint32_t&       outDist,
+                                     uint32_t&   outDist,
                                      int         default0Save1Load2)
 {
-    uint32_t    lumaPredMode = cu->getLumaIntraDir(absPartIdx);
-    uint32_t    fullDepth    = cu->getDepth(0)  + trDepth;
-    uint32_t    width        = cu->getWidth(0) >> trDepth;
-    uint32_t    height       = cu->getHeight(0) >> trDepth;
-    uint32_t    stride       = fencYuv->getStride();
-    Pel*    fenc         = fencYuv->getLumaAddr(absPartIdx);
-    Pel*    pred         = predYuv->getLumaAddr(absPartIdx);
-    int16_t*  residual     = resiYuv->getLumaAddr(absPartIdx);
-    Pel*    recon        = predYuv->getLumaAddr(absPartIdx);
-
-    uint32_t    trSizeLog2     = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUWidth() >> fullDepth] + 2;
-    uint32_t    qtLayer        = cu->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() - trSizeLog2;
-    uint32_t    numCoeffPerInc = cu->getSlice()->getSPS()->getMaxCUWidth() * cu->getSlice()->getSPS()->getMaxCUHeight() >> (cu->getSlice()->getSPS()->getMaxCUDepth() << 1);
-    TCoeff* coeff          = m_qtTempCoeffY[qtLayer] + numCoeffPerInc * absPartIdx;
-
-    int16_t*  reconQt        = m_qtTempTComYuv[qtLayer].getLumaAddr(absPartIdx);
-    uint32_t    reconQtStride  = m_qtTempTComYuv[qtLayer].m_width;
-
-    uint32_t    zorder           = cu->getZorderIdxInCU() + absPartIdx;
-    Pel*    reconIPred       = cu->getPic()->getPicYuvRec()->getLumaAddr(cu->getAddr(), zorder);
-    uint32_t    reconIPredStride = cu->getPic()->getPicYuvRec()->getStride();
-    bool    useTransformSkip = cu->getTransformSkip(absPartIdx, TEXT_LUMA);
+    uint32_t lumaPredMode = cu->getLumaIntraDir(absPartIdx);
+    uint32_t fullDepth    = cu->getDepth(0)  + trDepth;
+    uint32_t width        = cu->getWidth(0) >> trDepth;
+    uint32_t height       = cu->getHeight(0) >> trDepth;
+    uint32_t stride       = fencYuv->getStride();
+    Pel*     fenc         = fencYuv->getLumaAddr(absPartIdx);
+    Pel*     pred         = predYuv->getLumaAddr(absPartIdx);
+    int16_t* residual     = resiYuv->getLumaAddr(absPartIdx);
+    Pel*     recon        = predYuv->getLumaAddr(absPartIdx);
+
+    uint32_t trSizeLog2     = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUWidth() >> fullDepth] + 2;
+    uint32_t qtLayer        = cu->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() - trSizeLog2;
+    uint32_t numCoeffPerInc = cu->getSlice()->getSPS()->getMaxCUWidth() * cu->getSlice()->getSPS()->getMaxCUHeight() >> (cu->getSlice()->getSPS()->getMaxCUDepth() << 1);
+    TCoeff*  coeff          = m_qtTempCoeffY[qtLayer] + numCoeffPerInc * absPartIdx;
+
+    int16_t* reconQt        = m_qtTempTComYuv[qtLayer].getLumaAddr(absPartIdx);
+    uint32_t reconQtStride  = m_qtTempTComYuv[qtLayer].m_width;
+
+    uint32_t zorder           = cu->getZorderIdxInCU() + absPartIdx;
+    Pel*     reconIPred       = cu->getPic()->getPicYuvRec()->getLumaAddr(cu->getAddr(), zorder);
+    uint32_t reconIPredStride = cu->getPic()->getPicYuvRec()->getStride();
+    bool     useTransformSkip = cu->getTransformSkip(absPartIdx, TEXT_LUMA);
 
     //===== init availability pattern =====
 
@@ -503,13 +503,13 @@ void TEncSearch::xIntraCodingLumaBlk(TCo
 }
 
 void TEncSearch::xIntraCodingChromaBlk(TComDataCU* cu,
-                                       uint32_t        trDepth,
-                                       uint32_t        absPartIdx,
+                                       uint32_t    trDepth,
+                                       uint32_t    absPartIdx,
                                        TComYuv*    fencYuv,
                                        TComYuv*    predYuv,
                                        TShortYUV*  resiYuv,
-                                       uint32_t&       outDist,
-                                       uint32_t        chromaId,
+                                       uint32_t&   outDist,
+                                       uint32_t    chromaId,
                                        int         default0Save1Load2)
 {
     uint32_t origTrDepth = trDepth;
@@ -529,25 +529,25 @@ void TEncSearch::xIntraCodingChromaBlk(T
     }
 
     TextType ttype          = (chromaId > 0 ? TEXT_CHROMA_V : TEXT_CHROMA_U);
-    uint32_t     chromaPredMode = cu->getChromaIntraDir(absPartIdx);
-    uint32_t     width          = cu->getWidth(0) >> (trDepth + 1);
-    uint32_t     height         = cu->getHeight(0) >> (trDepth + 1);
-    uint32_t     stride         = fencYuv->getCStride();
+    uint32_t chromaPredMode = cu->getChromaIntraDir(absPartIdx);
+    uint32_t width          = cu->getWidth(0) >> (trDepth + 1);
+    uint32_t height         = cu->getHeight(0) >> (trDepth + 1);
+    uint32_t stride         = fencYuv->getCStride();
     Pel*     fenc           = (chromaId > 0 ? fencYuv->getCrAddr(absPartIdx) : fencYuv->getCbAddr(absPartIdx));
     Pel*     pred           = (chromaId > 0 ? predYuv->getCrAddr(absPartIdx) : predYuv->getCbAddr(absPartIdx));
-    int16_t*   residual       = (chromaId > 0 ? resiYuv->getCrAddr(absPartIdx) : resiYuv->getCbAddr(absPartIdx));
+    int16_t* residual       = (chromaId > 0 ? resiYuv->getCrAddr(absPartIdx) : resiYuv->getCbAddr(absPartIdx));
     Pel*     recon          = (chromaId > 0 ? predYuv->getCrAddr(absPartIdx) : predYuv->getCbAddr(absPartIdx));
 
-    uint32_t    qtlayer        = cu->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() - trSizeLog2;
-    uint32_t    numCoeffPerInc = (cu->getSlice()->getSPS()->getMaxCUWidth() * cu->getSlice()->getSPS()->getMaxCUHeight() >> (cu->getSlice()->getSPS()->getMaxCUDepth() << 1)) >> 2;
-    TCoeff* coeff          = (chromaId > 0 ? m_qtTempCoeffCr[qtlayer] : m_qtTempCoeffCb[qtlayer]) + numCoeffPerInc * absPartIdx;
-    int16_t*  reconQt        = (chromaId > 0 ? m_qtTempTComYuv[qtlayer].getCrAddr(absPartIdx) : m_qtTempTComYuv[qtlayer].getCbAddr(absPartIdx));
-    uint32_t    reconQtStride  = m_qtTempTComYuv[qtlayer].m_cwidth;
-
-    uint32_t    zorder           = cu->getZorderIdxInCU() + absPartIdx;
-    Pel*    reconIPred       = (chromaId > 0 ? cu->getPic()->getPicYuvRec()->getCrAddr(cu->getAddr(), zorder) : cu->getPic()->getPicYuvRec()->getCbAddr(cu->getAddr(), zorder));
-    uint32_t    reconIPredStride = cu->getPic()->getPicYuvRec()->getCStride();


More information about the x265-commits mailing list