[x265] [PATCH] refactor: (common files)check need of signed/unsigned int

kavitha at multicorewareinc.com kavitha at multicorewareinc.com
Thu Oct 31 11:17:30 CET 2013


# HG changeset patch
# User Kavitha Sampath <kavitha at multicorewareinc.com>
# Date 1383214228 -19800
#      Thu Oct 31 15:40:28 2013 +0530
# Node ID 9bff4295adfc760e9fdebb6c9499e4a3b2cb7fab
# Parent  0666d56aaa4259590dffdd5aa3bc7859c4763931
refactor: (common files)check need of signed/unsigned int

diff -r 0666d56aaa42 -r 9bff4295adfc source/Lib/TLibCommon/TComLoopFilter.cpp
--- a/source/Lib/TLibCommon/TComLoopFilter.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/Lib/TLibCommon/TComLoopFilter.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -528,7 +528,7 @@
     Pel* src = reconYuv->getLumaAddr(cu->getAddr(), absZOrderIdx);
     Pel* tmpsrc = src;
 
-    int stride = reconYuv->getStride();
+    intptr_t stride = reconYuv->getStride();
     int qp = 0;
     int qpP = 0;
     int qpQ = 0;
@@ -637,7 +637,7 @@
 void TComLoopFilter::xEdgeFilterChroma(TComDataCU* cu, uint32_t absZOrderIdx, uint32_t depth, int dir, int edge)
 {
     TComPicYuv* reconYuv = cu->getPic()->getPicYuvRec();
-    int stride = reconYuv->getCStride();
+    intptr_t stride = reconYuv->getCStride();
     Pel* srcCb = reconYuv->getCbAddr(cu->getAddr(), absZOrderIdx);
     Pel* srcCr = reconYuv->getCrAddr(cu->getAddr(), absZOrderIdx);
     int qp = 0;
diff -r 0666d56aaa42 -r 9bff4295adfc source/Lib/TLibCommon/TComPattern.cpp
--- a/source/Lib/TLibCommon/TComPattern.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/Lib/TLibCommon/TComPattern.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -68,7 +68,7 @@
  \param  offsetAbove  neighbor offset (above)
  */
 void TComPatternParam::setPatternParamPel(Pel* texture, int roiWidth, int roiHeight,
-                                          int stride, int offsetLeft, int offsetAbove)
+                                          intptr_t stride, int offsetLeft, int offsetAbove)
 {
     m_patternOrigin  = texture;
     m_roiWidth       = roiWidth;
@@ -121,7 +121,7 @@
 // Public member functions (TComPattern)
 // ====================================================================================================================
 
-void TComPattern::initPattern(Pel* y, Pel* cb, Pel* cr, int roiWidth, int roiHeight, int stride,
+void TComPattern::initPattern(Pel* y, Pel* cb, Pel* cr, int roiWidth, int roiHeight, intptr_t stride,
                               int offsetLeft, int offsetAbove)
 {
     m_patternY.setPatternParamPel(y,  roiWidth,      roiHeight,      stride,      offsetLeft,      offsetAbove);
@@ -157,7 +157,7 @@
 }
 
 void TComPattern::initAdiPattern(TComDataCU* cu, uint32_t zOrderIdxInPart, uint32_t partDepth, Pel* adiBuf,
-                                 int strideOrig, int heightOrig)
+                                 intptr_t strideOrig, int heightOrig)
 {
     Pel* roiOrigin;
     Pel* adiTemp;
@@ -167,7 +167,7 @@
     uint32_t cuHeight2 = cuHeight << 1;
     uint32_t width;
     uint32_t height;
-    int  picStride = cu->getPic()->getStride();
+    intptr_t  picStride = cu->getPic()->getStride();
     int  unitSize = 0;
     int  numUnitsInCU = 0;
     int  totalUnits = 0;
@@ -287,7 +287,7 @@
 }
 
 // Overloaded initialization of ADI buffers to support buffered references for xpredIntraAngBufRef
-void TComPattern::initAdiPattern(TComDataCU* cu, uint32_t zOrderIdxInPart, uint32_t partDepth, Pel* adiBuf, int strideOrig, int heightOrig,
+void TComPattern::initAdiPattern(TComDataCU* cu, uint32_t zOrderIdxInPart, uint32_t partDepth, Pel* adiBuf, intptr_t strideOrig, int heightOrig,
                                  Pel* refAbove, Pel* refLeft, Pel* refAboveFlt, Pel* refLeftFlt)
 {
     initAdiPattern(cu, zOrderIdxInPart, partDepth, adiBuf, strideOrig, heightOrig);
@@ -312,7 +312,7 @@
     }
 }
 
-void TComPattern::initAdiPatternChroma(TComDataCU* cu, uint32_t zOrderIdxInPart, uint32_t partDepth, Pel* adiBuf, int strideOrig, int heightOrig)
+void TComPattern::initAdiPatternChroma(TComDataCU* cu, uint32_t zOrderIdxInPart, uint32_t partDepth, Pel* adiBuf, intptr_t strideOrig, int heightOrig)
 {
     Pel*  roiOrigin;
     Pel*  adiTemp;
@@ -320,7 +320,7 @@
     uint32_t  cuHeight = cu->getHeight(0) >> partDepth;
     uint32_t  width;
     uint32_t  height;
-    int   picStride = cu->getPic()->getCStride();
+    intptr_t   picStride = cu->getPic()->getCStride();
 
     int   unitSize = 0;
     int   numUnitsInCU = 0;
@@ -370,7 +370,7 @@
                          cuWidth, cuHeight, width, height, picStride);
 }
 
-void TComPattern::fillReferenceSamples(Pel* roiOrigin, Pel* adiTemp, bool* bNeighborFlags, int numIntraNeighbor, int unitSize, int numUnitsInCU, int totalUnits, uint32_t cuWidth, uint32_t cuHeight, uint32_t width, uint32_t height, int picStride)
+void TComPattern::fillReferenceSamples(Pel* roiOrigin, Pel* adiTemp, bool* bNeighborFlags, int numIntraNeighbor, int unitSize, int numUnitsInCU, int totalUnits, uint32_t cuWidth, uint32_t cuHeight, uint32_t width, uint32_t height, intptr_t picStride)
 {
     Pel* piRoiTemp;
     int  i, j;
diff -r 0666d56aaa42 -r 9bff4295adfc source/Lib/TLibCommon/TComPattern.h
--- a/source/Lib/TLibCommon/TComPattern.h	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/Lib/TLibCommon/TComPattern.h	Thu Oct 31 15:40:28 2013 +0530
@@ -66,7 +66,7 @@
 
     int m_roiWidth;
     int m_roiHeight;
-    int m_patternStride;
+    intptr_t m_patternStride;
 
     /// return starting position of buffer
     Pel* getPatternOrigin()        { return m_patternOrigin; }
@@ -78,7 +78,7 @@
     }
 
     /// set parameters from Pel buffer for accessing neighboring pixels
-    void setPatternParamPel(Pel* piTexture, int roiWidth, int roiHeight, int stride,
+    void setPatternParamPel(Pel* piTexture, int roiWidth, int roiHeight, intptr_t stride,
                             int offsetLeft, int offsetAbove);
 
     /// set parameters of one color component from CU data for accessing neighboring pixels
@@ -106,7 +106,7 @@
 
     int   getROIYHeight()           { return m_patternY.m_roiHeight; }
 
-    int   getPatternLStride()       { return m_patternY.m_patternStride; }
+    intptr_t   getPatternLStride()       { return m_patternY.m_patternStride; }
 
     // access functions of ADI buffers
     Pel*  getAdiOrgBuf(int cuWidth, int cuHeight, Pel* adiBuf);
@@ -120,11 +120,11 @@
     // -------------------------------------------------------------------------------------------------------------------
 
     /// set parameters from Pel buffers for accessing neighboring pixels
-    void initPattern(Pel* y, Pel* cb, Pel* cr, int roiWidth, int roiHeight, int stride,
+    void initPattern(Pel* y, Pel* cb, Pel* cr, int roiWidth, int roiHeight, intptr_t stride,
                      int offsetLeft, int offsetAbove);
 
     void initAdiPattern(TComDataCU* cu, uint32_t zOrderIdxInPart, uint32_t partDepth, Pel* adiBuf,
-                        int strideOrig, int heightOrig, Pel* refAbove, Pel* refLeft,
+                        intptr_t strideOrig, int heightOrig, Pel* refAbove, Pel* refLeft,
                         Pel* refAboveFlt, Pel* refLeftFlt);
 
     /// set parameters from CU data for accessing neighboring pixels
@@ -132,16 +132,16 @@
 
     /// set luma parameters from CU data for accessing ADI data
     void  initAdiPattern(TComDataCU* cu, uint32_t zOrderIdxInPart, uint32_t partDepth, Pel* adiBuf,
-                         int strideOrig, int heightOrig);
+                         intptr_t strideOrig, int heightOrig);
 
     /// set chroma parameters from CU data for accessing ADI data
     void  initAdiPatternChroma(TComDataCU* cu, uint32_t zOrderIdxInPart, uint32_t partDepth,
-                               Pel* adiBuf, int strideOrig, int heightOrig);
+                               Pel* adiBuf, intptr_t strideOrig, int heightOrig);
 
 private:
 
     /// padding of unavailable reference samples for intra prediction
-    void fillReferenceSamples(Pel* roiOrigin, Pel* adiTemp, bool* bNeighborFlags, int numIntraNeighbor, int unitSize, int numUnitsInCU, int totalUnits, uint32_t cuWidth, uint32_t cuHeight, uint32_t width, uint32_t height, int picStride);
+    void fillReferenceSamples(Pel* roiOrigin, Pel* adiTemp, bool* bNeighborFlags, int numIntraNeighbor, int unitSize, int numUnitsInCU, int totalUnits, uint32_t cuWidth, uint32_t cuHeight, uint32_t width, uint32_t height, intptr_t picStride);
 
     /// constrained intra prediction
     bool  isAboveLeftAvailable(TComDataCU* cu, uint32_t partIdxLT);
diff -r 0666d56aaa42 -r 9bff4295adfc source/Lib/TLibCommon/TComPic.h
--- a/source/Lib/TLibCommon/TComPic.h	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/Lib/TLibCommon/TComPic.h	Thu Oct 31 15:40:28 2013 +0530
@@ -147,9 +147,9 @@
 
     uint32_t          getParPelY(UChar partIdx) { return getParPelX(partIdx); }
 
-    int           getStride()             { return m_reconPicYuv->getStride(); }
+    intptr_t           getStride()             { return m_reconPicYuv->getStride(); }
 
-    int           getCStride()            { return m_reconPicYuv->getCStride(); }
+    intptr_t           getCStride()            { return m_reconPicYuv->getCStride(); }
 
     Window&       getConformanceWindow()  { return m_conformanceWindow; }
 
diff -r 0666d56aaa42 -r 9bff4295adfc source/Lib/TLibCommon/TComPicYuv.cpp
--- a/source/Lib/TLibCommon/TComPicYuv.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/Lib/TLibCommon/TComPicYuv.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -224,7 +224,7 @@
     ::memcpy(destPicYuv->getBufV(), m_picBufV, sizeof(Pel) * ((m_picWidth >> 1) + (m_chromaMarginX << 1)) * ((m_picHeight >> 1) + (m_chromaMarginY << 1)));
 }
 
-void TComPicYuv::xExtendPicCompBorder(Pel* recon, int stride, int width, int height, int iMarginX, int iMarginY)
+void TComPicYuv::xExtendPicCompBorder(Pel* recon, intptr_t stride, int width, int height, int iMarginX, int iMarginY)
 {
     int x, y;
 
diff -r 0666d56aaa42 -r 9bff4295adfc source/Lib/TLibCommon/TComPicYuv.h
--- a/source/Lib/TLibCommon/TComPicYuv.h	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/Lib/TLibCommon/TComPicYuv.h	Thu Oct 31 15:40:28 2013 +0530
@@ -89,8 +89,8 @@
     int   m_lumaMarginY;
     int   m_chromaMarginX;
     int   m_chromaMarginY;
-    int   m_stride;
-    int   m_strideC;
+    intptr_t   m_stride;
+    intptr_t   m_strideC;
 
     int   m_numCuInWidth;
     int   m_numCuInHeight;
@@ -98,7 +98,7 @@
     TComPicYuv();
     virtual ~TComPicYuv();
 
-    void xExtendPicCompBorder(Pel* recon, int stride, int width, int height, int marginX, int marginY);
+    void xExtendPicCompBorder(Pel* recon, intptr_t stride, int width, int height, int marginX, int marginY);
 
     // ------------------------------------------------------------------------------------------------
     //  Memory management
@@ -118,9 +118,9 @@
 
     int   getHeight()     { return m_picHeight; }
 
-    int   getStride()     { return m_stride; }
+    intptr_t   getStride()     { return m_stride; }
 
-    int   getCStride()    { return m_strideC; }
+    intptr_t   getCStride()    { return m_strideC; }
 
     int   getLumaMarginX() { return m_lumaMarginX; }
 
@@ -178,11 +178,11 @@
     void  dump(char* pFileName, bool bAdd = false);
 }; // END CLASS DEFINITION TComPicYuv
 
-void updateChecksum(const Pel* plane, uint32_t& checksumVal, uint32_t height, uint32_t width, uint32_t stride, int row, uint32_t cu_Height);
-void updateCRC(const Pel* plane, uint32_t& crcVal, uint32_t height, uint32_t width, uint32_t stride);
+void updateChecksum(const Pel* plane, uint32_t& checksumVal, uint32_t height, uint32_t width, intptr_t stride, int row, uint32_t cu_Height);
+void updateCRC(const Pel* plane, uint32_t& crcVal, uint32_t height, uint32_t width, intptr_t stride);
 void crcFinish(uint32_t& crc, UChar digest[16]);
 void checksumFinish(uint32_t& checksum, UChar digest[16]);
-void updateMD5Plane(MD5Context& md5, const Pel* plane, uint32_t width, uint32_t height, uint32_t stride);
+void updateMD5Plane(MD5Context& md5, const Pel* plane, uint32_t width, uint32_t height, intptr_t stride);
 }
 //! \}
 
diff -r 0666d56aaa42 -r 9bff4295adfc source/Lib/TLibCommon/TComPicYuvMD5.cpp
--- a/source/Lib/TLibCommon/TComPicYuvMD5.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/Lib/TLibCommon/TComPicYuvMD5.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -66,7 +66,7 @@
  * is adjusted to OUTBIT_BITDEPTH_DIV8.
  */
 template<uint32_t OUTPUT_BITDEPTH_DIV8>
-static void md5_plane(MD5Context& md5, const Pel* plane, uint32_t width, uint32_t height, uint32_t stride)
+static void md5_plane(MD5Context& md5, const Pel* plane, uint32_t width, uint32_t height, intptr_t stride)
 {
     /* N is the number of samples to process per md5 update.
      * All N samples must fit in buf */
@@ -88,7 +88,7 @@
     }
 }
 
-void updateCRC(const Pel* plane, uint32_t& crcVal, uint32_t height, uint32_t width, uint32_t stride)
+void updateCRC(const Pel* plane, uint32_t& crcVal, uint32_t height, uint32_t width, intptr_t stride)
 {
     uint32_t crcMsb;
     uint32_t bitVal;
@@ -132,7 +132,7 @@
     digest[1] =  crcVal        & 0xff;
 }
 
-void updateChecksum(const Pel* plane, uint32_t& checksumVal, uint32_t height, uint32_t width, uint32_t stride, int row, uint32_t cuHeight)
+void updateChecksum(const Pel* plane, uint32_t& checksumVal, uint32_t height, uint32_t width, intptr_t stride, int row, uint32_t cuHeight)
 {
     UChar xor_mask;
 
@@ -159,7 +159,7 @@
     digest[3] =  checksum        & 0xff;
 }
 
-void updateMD5Plane(MD5Context& md5, const Pel* plane, uint32_t width, uint32_t height, uint32_t stride)
+void updateMD5Plane(MD5Context& md5, const Pel* plane, uint32_t width, uint32_t height, intptr_t stride)
 {
     /* choose an md5_plane packing function based on the system bitdepth */
     typedef void (*MD5PlaneFunc)(MD5Context&, const Pel*, uint32_t, uint32_t, uint32_t);
diff -r 0666d56aaa42 -r 9bff4295adfc source/Lib/TLibCommon/TComPrediction.cpp
--- a/source/Lib/TLibCommon/TComPrediction.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/Lib/TLibCommon/TComPrediction.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -148,7 +148,7 @@
 // Public member functions
 // ====================================================================================================================
 
-void TComPrediction::predIntraLumaAng(uint32_t dirMode, Pel* dst, uint32_t stride, int size)
+void TComPrediction::predIntraLumaAng(uint32_t dirMode, Pel* dst, intptr_t stride, int size)
 {
     assert(g_convertToBit[size] >= 0);   //   4x  4
     assert(g_convertToBit[size] <= 5);   // 128x128
@@ -196,7 +196,7 @@
 }
 
 // Angular chroma
-void TComPrediction::predIntraChromaAng(Pel* src, uint32_t dirMode, Pel* dst, uint32_t stride, int width)
+void TComPrediction::predIntraChromaAng(Pel* src, uint32_t dirMode, Pel* dst, intptr_t stride, int width)
 {
     // Create the prediction
     Pel refAbv[3 * MAX_CU_SIZE];
@@ -469,12 +469,12 @@
  * \param height   Height of block
  * \param dstPic   Pointer to destination picture
  */
-void TComPrediction::xPredInterLumaBlk(TComDataCU *cu, TComPicYuv *refPic, uint32_t partAddr, MV *mv, int width, int height, TComYuv *dstPic)
+void TComPrediction::xPredInterLumaBlk(TComDataCU *cu, TComPicYuv *refPic, uint32_t partAddr, MV *mv, uint32_t width, uint32_t height, TComYuv *dstPic)
 {
-    int dstStride = dstPic->getStride();
+    intptr_t dstStride = dstPic->getStride();
     Pel *dst      = dstPic->getLumaAddr(partAddr);
 
-    int srcStride = refPic->getStride();
+    intptr_t srcStride = refPic->getStride();
     int srcOffset = (mv->x >> 2) + (mv->y >> 2) * srcStride;
     Pel* src = refPic->getLumaAddr(cu->getAddr(), cu->getZorderIdxInCU() + partAddr) + srcOffset;
 
@@ -504,13 +504,13 @@
 }
 
 //Motion compensated block for biprediction
-void TComPrediction::xPredInterLumaBlk(TComDataCU *cu, TComPicYuv *refPic, uint32_t partAddr, MV *mv, int width, int height, TShortYUV *dstPic)
+void TComPrediction::xPredInterLumaBlk(TComDataCU *cu, TComPicYuv *refPic, uint32_t partAddr, MV *mv, uint32_t width, uint32_t height, TShortYUV *dstPic)
 {
-    int refStride = refPic->getStride();
+    intptr_t refStride = refPic->getStride();
     int refOffset = (mv->x >> 2) + (mv->y >> 2) * refStride;
     Pel *ref      =  refPic->getLumaAddr(cu->getAddr(), cu->getZorderIdxInCU() + partAddr) + refOffset;
 
-    int dstStride = dstPic->m_width;
+    intptr_t dstStride = dstPic->m_width;
     int16_t *dst    = dstPic->getLumaAddr(partAddr);
 
     int xFrac = mv->x & 0x3;
@@ -550,10 +550,10 @@
  * \param dstPic   Pointer to destination picture
  * \param bi       Flag indicating whether bipred is used
  */
-void TComPrediction::xPredInterChromaBlk(TComDataCU *cu, TComPicYuv *refPic, uint32_t partAddr, MV *mv, int width, int height, TComYuv *dstPic)
+void TComPrediction::xPredInterChromaBlk(TComDataCU *cu, TComPicYuv *refPic, uint32_t partAddr, MV *mv, uint32_t width, uint32_t height, TComYuv *dstPic)
 {
-    int refStride = refPic->getCStride();
-    int dstStride = dstPic->getCStride();
+    intptr_t refStride = refPic->getCStride();
+    intptr_t dstStride = dstPic->getCStride();
 
     int refOffset = (mv->x >> 3) + (mv->y >> 3) * refStride;
 
@@ -585,7 +585,7 @@
     }
     else
     {
-        int extStride = cxWidth;
+        intptr_t extStride = cxWidth;
         int filterSize = NTAPS_CHROMA;
         int halfFilterSize = (filterSize >> 1);
 
@@ -598,10 +598,10 @@
 }
 
 // Generate motion compensated block when biprediction
-void TComPrediction::xPredInterChromaBlk(TComDataCU *cu, TComPicYuv *refPic, uint32_t partAddr, MV *mv, int width, int height, TShortYUV *dstPic)
+void TComPrediction::xPredInterChromaBlk(TComDataCU *cu, TComPicYuv *refPic, uint32_t partAddr, MV *mv, uint32_t width, uint32_t height, TShortYUV *dstPic)
 {
-    int refStride = refPic->getCStride();
-    int dstStride = dstPic->m_cwidth;
+    intptr_t refStride = refPic->getCStride();
+    intptr_t dstStride = dstPic->m_cwidth;
 
     int refOffset = (mv->x >> 3) + (mv->y >> 3) * refStride;
 
@@ -633,7 +633,7 @@
     }
     else
     {
-        int extStride = cxWidth;
+        intptr_t extStride = cxWidth;
         int filterSize = NTAPS_CHROMA;
         int halfFilterSize = (filterSize >> 1);
         primitives.ipfilter_ps[FILTER_H_P_S_4](refCb - (halfFilterSize - 1) * refStride, refStride, m_immedVals, extStride, cxWidth, cxHeight + filterSize - 1, g_chromaFilter[xFrac]);
diff -r 0666d56aaa42 -r 9bff4295adfc source/Lib/TLibCommon/TComPrediction.h
--- a/source/Lib/TLibCommon/TComPrediction.h	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/Lib/TLibCommon/TComPrediction.h	Thu Oct 31 15:40:28 2013 +0530
@@ -65,7 +65,7 @@
 
     Pel*      m_predBuf;
     Pel*      m_predAllAngsBuf;
-    int       m_predBufStride;
+    intptr_t  m_predBufStride;
     int       m_predBufHeight;
 
     // references sample for IntraPrediction
@@ -79,22 +79,22 @@
     /* This holds intermediate values for filtering operations which need to maintain short precision */
     TShortYUV m_filteredBlockTmp[4];
 
-    int16_t*    m_immedVals;
+    int16_t*  m_immedVals;
     Pel*      m_lumaRecBuffer; ///< array for down-sampled reconstructed luma sample
-    int       m_lumaRecStride; ///< stride of m_lumaRecBuffer
+    intptr_t  m_lumaRecStride; ///< stride of m_lumaRecBuffer
 
     // 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);
-    void xPredInterLumaBlk(TComDataCU *cu, TComPicYuv *refPic, uint32_t partAddr, MV *mv, int width, int height, TComYuv *dstPic);
-    void xPredInterLumaBlk(TComDataCU *cu, TComPicYuv *refPic, uint32_t partAddr, MV *mv, int width, int height, TShortYUV *dstPic);
-    void xPredInterChromaBlk(TComDataCU *cu, TComPicYuv *refPic, uint32_t partAddr, MV *mv, int width, int height, TComYuv *dstPic);
-    void xPredInterChromaBlk(TComDataCU *cu, TComPicYuv *refPic, uint32_t partAddr, MV *mv, int width, int height, TShortYUV *dstPic);
+    void xPredInterLumaBlk(TComDataCU *cu, TComPicYuv *refPic, uint32_t partAddr, MV *mv, uint32_t width, uint32_t height, TComYuv *dstPic);
+    void xPredInterLumaBlk(TComDataCU *cu, TComPicYuv *refPic, uint32_t partAddr, MV *mv, uint32_t width, uint32_t height, TShortYUV *dstPic);
+    void xPredInterChromaBlk(TComDataCU *cu, TComPicYuv *refPic, uint32_t partAddr, MV *mv, uint32_t width, uint32_t height, TComYuv *dstPic);
+    void xPredInterChromaBlk(TComDataCU *cu, TComPicYuv *refPic, uint32_t partAddr, MV *mv, uint32_t width, uint32_t height, TShortYUV *dstPic);
 
     void xPredInterBi(TComDataCU* cu, uint32_t partAddr, int width, int height, TComYuv*& outPredYuv, bool bLuma = true, bool bChroma = true);
     void xWeightedAverage(TComYuv* srcYuv0, TComYuv* srcYuv1, int refIdx0, int refIdx1, uint32_t partAddr, int width, int height, TComYuv*& outDstYuv, bool bLuma = true, bool bChroma = true);
 
-    void xGetLLSPrediction(TComPattern* pcPattern, int* src0, int srcstride, Pel* dst0, int dststride, uint32_t width, uint32_t height, uint32_t ext0);
+    void xGetLLSPrediction(TComPattern* pcPattern, int* src0, intptr_t srcstride, Pel* dst0, intptr_t dststride, uint32_t width, uint32_t height, uint32_t ext0);
 
     bool xCheckIdenticalMotion(TComDataCU* cu, uint32_t PartAddr);
 
@@ -114,12 +114,12 @@
     void getMvPredAMVP(TComDataCU* cu, uint32_t partIdx, uint32_t partAddr, int picList, MV& mvPred);
 
     // Angular Intra
-    void predIntraLumaAng(uint32_t dirMode, Pel* pred, uint32_t stride, int width);
-    void predIntraChromaAng(Pel* src, uint32_t dirMode, Pel* pred, uint32_t stride, int width);
+    void predIntraLumaAng(uint32_t dirMode, Pel* pred, intptr_t stride, int width);
+    void predIntraChromaAng(Pel* src, uint32_t dirMode, Pel* pred, intptr_t stride, int width);
 
     Pel* getPredicBuf()             { return m_predBuf; }
 
-    int  getPredicBufWidth()        { return m_predBufStride; }
+    intptr_t  getPredicBufWidth()   { return m_predBufStride; }
 
     int  getPredicBufHeight()       { return m_predBufHeight; }
 };
diff -r 0666d56aaa42 -r 9bff4295adfc source/Lib/TLibCommon/TComRom.cpp
--- a/source/Lib/TLibCommon/TComRom.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/Lib/TLibCommon/TComRom.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -94,7 +94,7 @@
 // Data structure related table & variable
 // ====================================================================================================================
 
-int  g_bitDepth = 8;
+uint32_t  g_bitDepth = 8;
 uint32_t g_maxCUWidth  = MAX_CU_SIZE;
 uint32_t g_maxCUHeight = MAX_CU_SIZE;
 uint32_t g_maxCUDepth  = MAX_CU_DEPTH;
@@ -106,9 +106,9 @@
 
 uint32_t g_puOffset[8] = { 0, 8, 4, 4, 2, 10, 1, 5 };
 
-void initZscanToRaster(int maxDepth, int depth, uint32_t startVal, uint32_t*& curIdx)
+void initZscanToRaster(uint32_t maxDepth, int depth, uint32_t startVal, uint32_t*& curIdx)
 {
-    int stride = 1 << (maxDepth - 1);
+    intptr_t stride = 1 << (maxDepth - 1);
 
     if (depth == maxDepth)
     {
diff -r 0666d56aaa42 -r 9bff4295adfc source/Lib/TLibCommon/TComRom.h
--- a/source/Lib/TLibCommon/TComRom.h	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/Lib/TLibCommon/TComRom.h	Thu Oct 31 15:40:28 2013 +0530
@@ -76,7 +76,7 @@
 extern uint32_t g_zscanToRaster[MAX_NUM_SPU_W * MAX_NUM_SPU_W];
 extern uint32_t g_rasterToZscan[MAX_NUM_SPU_W * MAX_NUM_SPU_W];
 
-void initZscanToRaster(int maxDepth, int depth, uint32_t startVal, uint32_t*& curIdx);
+void initZscanToRaster(uint32_t maxDepth, int depth, uint32_t startVal, uint32_t*& curIdx);
 void initRasterToZscan(uint32_t maxCUWidth, uint32_t maxCUHeight, uint32_t maxCUDepth);
 
 // conversion of partition index to picture pel position
@@ -155,7 +155,7 @@
 // Bit-depth
 // ====================================================================================================================
 
-extern int g_bitDepth;
+extern uint32_t g_bitDepth;
 
 /** clip x, such that 0 <= x <= #g_maxLumaVal */
 template<typename T>
diff -r 0666d56aaa42 -r 9bff4295adfc source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp
--- a/source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -525,7 +525,7 @@
     int x, y;
     TComDataCU *tmpCu = m_pic->getCU(addr);
     Pel* rec;
-    int  stride;
+    intptr_t  stride;
     int  lcuWidth  = m_maxCUWidth;
     int  lcuHeight = m_maxCUHeight;
     uint32_t lpelx     = tmpCu->getCUPelX();
@@ -850,7 +850,7 @@
     int addr;
     int frameWidthInCU = m_pic->getFrameWidthInCU();
     int frameHeightInCU = m_pic->getFrameHeightInCU();
-    int stride;
+    intptr_t stride;
     Pel *tmpUSwap;
     int sChroma = (yCbCr == 0) ? 0 : 1;
     bool mergeLeftFlag;
@@ -1020,7 +1020,7 @@
     int idxX;
     int addr;
     int frameWidthInCU = m_pic->getFrameWidthInCU();
-    int stride;
+    intptr_t stride;
     Pel *tmpUSwap;
     int sChroma = (yCbCr == 0) ? 0 : 1;
     bool mergeLeftFlag;
@@ -1339,7 +1339,7 @@
     TComPicYuv* pcPicYuvRec = cu->getPic()->getPicYuvRec();
     Pel* src;
     Pel* pcm;
-    uint32_t stride;
+    intptr_t stride;
     uint32_t width;
     uint32_t height;
     uint32_t pcmLeftShiftBit;
diff -r 0666d56aaa42 -r 9bff4295adfc source/Lib/TLibCommon/TComTrQuant.cpp
--- a/source/Lib/TLibCommon/TComTrQuant.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/Lib/TLibCommon/TComTrQuant.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -129,7 +129,7 @@
 }
 
 // To minimize the distortion only. No rate is considered.
-void TComTrQuant::signBitHidingHDQ(TCoeff* qCoef, TCoeff* coef, uint32_t const *scan, int32_t* deltaU, int width, int height)
+void TComTrQuant::signBitHidingHDQ(TCoeff* qCoef, TCoeff* coef, uint32_t const *scan, int32_t* deltaU, uint32_t width, uint32_t height)
 {
     int lastCG = -1;
     int absSum = 0;
@@ -252,7 +252,7 @@
     } // TU loop
 }
 
-uint32_t TComTrQuant::xQuant(TComDataCU* cu, int32_t* coef, TCoeff* qCoef, int width, int height,
+uint32_t TComTrQuant::xQuant(TComDataCU* cu, int32_t* coef, TCoeff* qCoef, uint32_t width, uint32_t height,
                          TextType ttype, uint32_t absPartIdx, int32_t *lastPos)
 {
     uint32_t acSum = 0;
@@ -320,7 +320,7 @@
         int qbits = QUANT_SHIFT + cQpBase.m_per + transformShift;
         add = (cu->getSlice()->getSliceType() == I_SLICE ? 171 : 85) << (qbits - 9);
 
-        int numCoeff = width * height;
+        uint32_t numCoeff = width * height;
         acSum += primitives.quant(coef, quantCoeff, deltaU, qCoef, qbits, add, numCoeff, lastPos);
 
         if (cu->getSlice()->getPPS()->getSignHideFlag() && acSum >= 2)
@@ -340,7 +340,7 @@
 
 uint32_t TComTrQuant::transformNxN(TComDataCU* cu,
                                int16_t*      residual,
-                               uint32_t        stride,
+                               intptr_t        stride,
                                TCoeff*     coeff,
                                uint32_t        width,
                                uint32_t        height,
@@ -388,7 +388,7 @@
     return xQuant(cu, m_tmpCoeff, coeff, width, height, ttype, absPartIdx, lastPos);
 }
 
-void TComTrQuant::invtransformNxN(bool transQuantBypass, uint32_t mode, int16_t* residual, uint32_t stride, TCoeff* coeff, uint32_t width, uint32_t height, int scalingListType, bool useTransformSkip, int lastPos)
+void TComTrQuant::invtransformNxN(bool transQuantBypass, uint32_t mode, int16_t* residual, intptr_t stride, TCoeff* coeff, uint32_t width, uint32_t height, int scalingListType, bool useTransformSkip, int lastPos)
 {
     if (transQuantBypass)
     {
@@ -450,7 +450,7 @@
  *  \param stride stride of input residual data
  *  \param size transform size (size x size)
  */
-void TComTrQuant::xTransformSkip(int16_t* resiBlock, uint32_t stride, int32_t* coeff, int width, int height)
+void TComTrQuant::xTransformSkip(int16_t* resiBlock, intptr_t stride, int32_t* coeff, int width, int height)
 {
     assert(width == height);
     uint32_t log2TrSize = g_convertToBit[width] + 2;
@@ -483,7 +483,7 @@
  *  \param stride stride of input residual data
  *  \param size transform size (size x size)
  */
-void TComTrQuant::xITransformSkip(int32_t* coef, int16_t* residual, uint32_t stride, int width, int height)
+void TComTrQuant::xITransformSkip(int32_t* coef, int16_t* residual, intptr_t stride, int width, int height)
 {
     assert(width == height);
     uint32_t log2TrSize = g_convertToBit[width] + 2;
diff -r 0666d56aaa42 -r 9bff4295adfc source/Lib/TLibCommon/TComTrQuant.h
--- a/source/Lib/TLibCommon/TComTrQuant.h	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/Lib/TLibCommon/TComTrQuant.h	Thu Oct 31 15:40:28 2013 +0530
@@ -127,10 +127,10 @@
     void init(uint32_t maxTrSize, int useRDOQ, int useRDOQTS, int useTransformSkipFast);
 
     // transform & inverse transform functions
-    uint32_t transformNxN(TComDataCU* cu, int16_t* residual, uint32_t stride, TCoeff* coeff, uint32_t width, uint32_t height,
+    uint32_t transformNxN(TComDataCU* cu, int16_t* residual, intptr_t stride, TCoeff* coeff, uint32_t width, uint32_t height,
                       TextType ttype, uint32_t absPartIdx, int32_t* lastPos, bool useTransformSkip = false);
 
-    void invtransformNxN(bool transQuantBypass, uint32_t mode, int16_t* residual, uint32_t stride, TCoeff* coeff, uint32_t width, uint32_t height, int scalingListType, bool useTransformSkip = false, int lastPos = MAX_INT);
+    void invtransformNxN(bool transQuantBypass, uint32_t mode, int16_t* residual, intptr_t stride, TCoeff* coeff, uint32_t width, uint32_t height, int scalingListType, bool useTransformSkip = false, int lastPos = MAX_INT);
 
     // Misc functions
     void setQPforQuant(int qpy, TextType ttype, int qpBdOffset, int chromaQPOffset);
@@ -190,11 +190,11 @@
 
 private:
 
-    void xTransformSkip(int16_t* resiBlock, uint32_t stride, int32_t* coeff, int width, int height);
+    void xTransformSkip(int16_t* resiBlock, intptr_t stride, int32_t* coeff, int width, int height);
 
-    void signBitHidingHDQ(TCoeff* qcoeff, TCoeff* coeff, const uint32_t* scan, int32_t* deltaU, int width, int height);
+    void signBitHidingHDQ(TCoeff* qcoeff, TCoeff* coeff, const uint32_t* scan, int32_t* deltaU, uint32_t width, uint32_t height);
 
-    uint32_t xQuant(TComDataCU* cu, int32_t* src, TCoeff* dst, int width, int height, TextType ttype, uint32_t absPartIdx, int32_t *lastPos);
+    uint32_t xQuant(TComDataCU* cu, int32_t* src, TCoeff* dst, uint32_t width, uint32_t height, TextType ttype, uint32_t absPartIdx, int32_t *lastPos);
 
     // RDOQ functions
     uint32_t xRateDistOptQuant(TComDataCU* cu, int32_t* srcCoeff, TCoeff* dstCoeff, uint32_t width, uint32_t height, TextType ttype, uint32_t absPartIdx, int32_t *lastPos);
@@ -217,7 +217,7 @@
 
     inline uint32_t xGetIEPRate() const          { return 32768; }            ///< Get the cost of an equal probable bit
 
-    void xITransformSkip(int32_t* coeff, int16_t* residual, uint32_t stride, int width, int height);
+    void xITransformSkip(int32_t* coeff, int16_t* residual, intptr_t stride, int width, int height);
 };
 }
 //! \}
diff -r 0666d56aaa42 -r 9bff4295adfc source/Lib/TLibCommon/TComWeightPrediction.cpp
--- a/source/Lib/TLibCommon/TComWeightPrediction.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/Lib/TLibCommon/TComWeightPrediction.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -106,9 +106,9 @@
         int round   = shift ? (1 << (shift - 1)) * bRound : 0;
         int w1      = wp1[0].w;
 
-        uint32_t  src0Stride = srcYuv0->getStride();
-        uint32_t  src1Stride = srcYuv1->getStride();
-        uint32_t  dststride  = outDstYuv->getStride();
+        intptr_t  src0Stride = srcYuv0->getStride();
+        intptr_t  src1Stride = srcYuv1->getStride();
+        intptr_t  dststride  = outDstYuv->getStride();
 
         for (y = height - 1; y >= 0; y--)
         {
@@ -141,9 +141,9 @@
         int round   = shift ? (1 << (shift - 1)) : 0;
         int w1      = wp1[1].w;
 
-        uint32_t src0Stride = srcYuv0->getCStride();
-        uint32_t src1Stride = srcYuv1->getCStride();
-        uint32_t dststride  = outDstYuv->getCStride();
+        intptr_t src0Stride = srcYuv0->getCStride();
+        intptr_t src1Stride = srcYuv1->getCStride();
+        intptr_t dststride  = outDstYuv->getCStride();
 
         width  >>= 1;
         height >>= 1;
@@ -205,7 +205,7 @@
     int x, y;
 
     int w0, w1, offset, shiftNum, shift, round;
-    uint32_t src0Stride, src1Stride, dststride;
+    intptr_t src0Stride, src1Stride, dststride;
 
     int16_t* srcY0  = srcYuv0->getLumaAddr(partUnitIdx);
     int16_t* srcU0  = srcYuv0->getCbAddr(partUnitIdx);
@@ -326,7 +326,7 @@
     int x, y;
 
     int w0, offset, shiftNum, shift, round;
-    uint32_t src0Stride, dststride;
+    intptr_t src0Stride, dststride;
 
     Pel* srcY0  = srcYuv0->getLumaAddr(partUnitIdx);
     Pel* srcU0  = srcYuv0->getCbAddr(partUnitIdx);
@@ -441,7 +441,7 @@
     Pel* dstV   = outDstYuv->getCrAddr(partUnitIdx);
 
     int w0, offset, shiftNum, shift, round;
-    uint32_t srcStride, dstStride;
+    intptr_t srcStride, dstStride;
 
     if (bLuma)
     {
diff -r 0666d56aaa42 -r 9bff4295adfc source/Lib/TLibCommon/TComYuv.cpp
--- a/source/Lib/TLibCommon/TComYuv.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/Lib/TLibCommon/TComYuv.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -110,8 +110,8 @@
     Pel* src = getLumaAddr(partIdx, width);
     Pel* dst = destPicYuv->getLumaAddr(cuAddr, absZOrderIdx);
 
-    uint32_t srcstride = getStride();
-    uint32_t dststride = destPicYuv->getStride();
+    intptr_t srcstride = getStride();
+    intptr_t dststride = destPicYuv->getStride();
 
     primitives.blockcpy_pp(width, height, dst, dststride, src, srcstride);
 }
@@ -128,8 +128,8 @@
     Pel* dstU = destPicYuv->getCbAddr(cuAddr, absZOrderIdx);
     Pel* dstV = destPicYuv->getCrAddr(cuAddr, absZOrderIdx);
 
-    uint32_t srcstride = getCStride();
-    uint32_t dststride = destPicYuv->getCStride();
+    intptr_t srcstride = getCStride();
+    intptr_t dststride = destPicYuv->getCStride();
 
     primitives.blockcpy_pp(width, height, dstU, dststride, srcU, srcstride);
     primitives.blockcpy_pp(width, height, dstV, dststride, srcV, srcstride);
@@ -146,8 +146,8 @@
     Pel* dst = m_bufY;
     Pel* src = srcPicYuv->getLumaAddr(cuAddr, absZOrderIdx);
 
-    uint32_t dststride = getStride();
-    uint32_t srcstride = srcPicYuv->getStride();
+    intptr_t dststride = getStride();
+    intptr_t srcstride = srcPicYuv->getStride();
 
     primitives.blockcpy_pp(m_width, m_height, dst, dststride, src, srcstride);
 }
@@ -159,8 +159,8 @@
     Pel* srcU = srcPicYuv->getCbAddr(cuAddr, absZOrderIdx);
     Pel* srcV = srcPicYuv->getCrAddr(cuAddr, absZOrderIdx);
 
-    uint32_t dststride = getCStride();
-    uint32_t srcstride = srcPicYuv->getCStride();
+    intptr_t dststride = getCStride();
+    intptr_t srcstride = srcPicYuv->getCStride();
 
     primitives.blockcpy_pp(m_cwidth, m_cheight, dstU, dststride, srcU, srcstride);
     primitives.blockcpy_pp(m_cwidth, m_cheight, dstV, dststride, srcV, srcstride);
@@ -177,8 +177,8 @@
     Pel* src = m_bufY;
     Pel* dst = dstPicYuv->getLumaAddr(uiDstPartIdx);
 
-    uint32_t srcstride = getStride();
-    uint32_t dststride = dstPicYuv->getStride();
+    intptr_t srcstride = getStride();
+    intptr_t dststride = dstPicYuv->getStride();
 
     primitives.blockcpy_pp(m_width, m_height, dst, dststride, src, srcstride);
 }
@@ -190,8 +190,8 @@
     Pel* dstU = dstPicYuv->getCbAddr(uiDstPartIdx);
     Pel* dstV = dstPicYuv->getCrAddr(uiDstPartIdx);
 
-    uint32_t srcstride = getCStride();
-    uint32_t dststride = dstPicYuv->getCStride();
+    intptr_t srcstride = getCStride();
+    intptr_t dststride = dstPicYuv->getCStride();
 
     primitives.blockcpy_pp(m_cwidth, m_cheight, dstU, dststride, srcU, srcstride);
     primitives.blockcpy_pp(m_cwidth, m_cheight, dstV, dststride, srcV, srcstride);
@@ -208,8 +208,8 @@
     Pel* src = getLumaAddr(partIdx);
     Pel* dst = dstPicYuv->getLumaAddr(0);
 
-    uint32_t srcstride = getStride();
-    uint32_t dststride = dstPicYuv->getStride();
+    intptr_t srcstride = getStride();
+    intptr_t dststride = dstPicYuv->getStride();
 
     uint32_t height = dstPicYuv->getHeight();
     uint32_t width = dstPicYuv->getWidth();
@@ -224,8 +224,8 @@
     Pel* dstU = dstPicYuv->getCbAddr(0);
     Pel* dstV = dstPicYuv->getCrAddr(0);
 
-    uint32_t srcstride = getCStride();
-    uint32_t dststride = dstPicYuv->getCStride();
+    intptr_t srcstride = getCStride();
+    intptr_t dststride = dstPicYuv->getCStride();
 
     uint32_t uiCHeight = dstPicYuv->getCHeight();
     uint32_t uiCWidth = dstPicYuv->getCWidth();
@@ -257,8 +257,8 @@
 
     if (src == dst) return;
 
-    uint32_t srcstride = getStride();
-    uint32_t dststride = dstPicYuv->getStride();
+    intptr_t srcstride = getStride();
+    intptr_t dststride = dstPicYuv->getStride();
 
     primitives.blockcpy_pp(width, height, dst, dststride, src, srcstride);
 }
@@ -268,8 +268,8 @@
     Pel* src = getLumaAddr(partIdx);
     int16_t* dst = dstPicYuv->getLumaAddr(partIdx);
 
-    uint32_t  srcstride = getStride();
-    uint32_t  dststride = dstPicYuv->m_width;
+    intptr_t  srcstride = getStride();
+    intptr_t  dststride = dstPicYuv->m_width;
 
     primitives.blockcpy_sp(width, height, dst, dststride, src, srcstride);
 }
@@ -283,8 +283,8 @@
 
     if (srcU == dstU && srcV == dstV) return;
 
-    uint32_t srcstride = getCStride();
-    uint32_t dststride = dstPicYuv->getCStride();
+    intptr_t srcstride = getCStride();
+    intptr_t dststride = dstPicYuv->getCStride();
 
     primitives.blockcpy_pp(width, height, dstU, dststride, srcU, srcstride);
     primitives.blockcpy_pp(width, height, dstV, dststride, srcV, srcstride);
@@ -297,8 +297,8 @@
     int16_t* dstU = dstPicYuv->getCbAddr(partIdx);
     int16_t* dstV = dstPicYuv->getCrAddr(partIdx);
 
-    uint32_t srcstride = getCStride();
-    uint32_t dststride = dstPicYuv->m_cwidth;
+    intptr_t srcstride = getCStride();
+    intptr_t dststride = dstPicYuv->m_cwidth;
 
     primitives.blockcpy_sp(width, height, dstU, dststride, srcU, srcstride);
     primitives.blockcpy_sp(width, height, dstV, dststride, srcV, srcstride);
@@ -311,8 +311,8 @@
         Pel* srcU = getCbAddr(partIdx);
         Pel* dstU = dstPicYuv->getCbAddr(partIdx);
         if (srcU == dstU) return;
-        uint32_t srcstride = getCStride();
-        uint32_t dststride = dstPicYuv->getCStride();
+        intptr_t srcstride = getCStride();
+        intptr_t dststride = dstPicYuv->getCStride();
         primitives.blockcpy_pp(width, height, dstU, dststride, srcU, srcstride);
     }
     else if (chromaId == 1)
@@ -320,8 +320,8 @@
         Pel* srcV = getCrAddr(partIdx);
         Pel* dstV = dstPicYuv->getCrAddr(partIdx);
         if (srcV == dstV) return;
-        uint32_t srcstride = getCStride();
-        uint32_t dststride = dstPicYuv->getCStride();
+        intptr_t srcstride = getCStride();
+        intptr_t dststride = dstPicYuv->getCStride();
         primitives.blockcpy_pp(width, height, dstV, dststride, srcV, srcstride);
     }
     else
@@ -331,8 +331,8 @@
         Pel* dstU = dstPicYuv->getCbAddr(partIdx);
         Pel* dstV = dstPicYuv->getCrAddr(partIdx);
         if (srcU == dstU && srcV == dstV) return;
-        uint32_t srcstride = getCStride();
-        uint32_t dststride = dstPicYuv->getCStride();
+        intptr_t srcstride = getCStride();
+        intptr_t dststride = dstPicYuv->getCStride();
         primitives.blockcpy_pp(width, height, dstU, dststride, srcU, srcstride);
         primitives.blockcpy_pp(width, height, dstV, dststride, srcV, srcstride);
     }
@@ -345,8 +345,8 @@
         Pel*   srcU = getCbAddr(partIdx);
         int16_t* dstU = dstPicYuv->getCbAddr(partIdx);
 
-        uint32_t srcstride = getCStride();
-        uint32_t dststride = dstPicYuv->m_cwidth;
+        intptr_t srcstride = getCStride();
+        intptr_t dststride = dstPicYuv->m_cwidth;
 
         primitives.blockcpy_sp(width, height, dstU, dststride, srcU, srcstride);
     }
@@ -355,8 +355,8 @@
         Pel*  srcV = getCrAddr(partIdx);
         int16_t* dstV = dstPicYuv->getCrAddr(partIdx);
 
-        uint32_t srcstride = getCStride();
-        uint32_t dststride = dstPicYuv->m_cwidth;
+        intptr_t srcstride = getCStride();
+        intptr_t dststride = dstPicYuv->m_cwidth;
 
         primitives.blockcpy_sp(width, height, dstV, dststride, srcV, srcstride);
     }
@@ -367,8 +367,8 @@
         int16_t* dstU = dstPicYuv->getCbAddr(partIdx);
         int16_t* dstV = dstPicYuv->getCrAddr(partIdx);
 
-        uint32_t srcstride = getCStride();
-        uint32_t dststride = dstPicYuv->m_cwidth;
+        intptr_t srcstride = getCStride();
+        intptr_t dststride = dstPicYuv->m_cwidth;
 
         primitives.blockcpy_sp(width, height, dstU, dststride, srcU, srcstride);
         primitives.blockcpy_sp(width, height, dstV, dststride, srcV, srcstride);
@@ -393,9 +393,9 @@
     Pel* src1 = srcYuv1->getLumaAddr(trUnitIdx, partSize);
     Pel* dst  = getLumaAddr(trUnitIdx, partSize);
 
-    uint32_t src0Stride = srcYuv0->getStride();
-    uint32_t src1Stride = srcYuv1->getStride();
-    uint32_t dststride = getStride();
+    intptr_t src0Stride = srcYuv0->getStride();
+    intptr_t src1Stride = srcYuv1->getStride();
+    intptr_t dststride = getStride();
 
     primitives.pixeladd_pp(partSize, partSize, dst, dststride, src0, src1, src0Stride, src1Stride);
 }
@@ -408,9 +408,9 @@
     int16_t* src1 = srcYuv1->getLumaAddr(trUnitIdx, partSize);
     Pel* dst = getLumaAddr(trUnitIdx, partSize);
 
-    uint32_t src0Stride = srcYuv0->getStride();
-    uint32_t src1Stride = srcYuv1->m_width;
-    uint32_t dststride  = getStride();
+    intptr_t src0Stride = srcYuv0->getStride();
+    intptr_t src1Stride = srcYuv1->m_width;
+    intptr_t dststride  = getStride();
 
     for (y = partSize - 1; y >= 0; y--)
     {
@@ -434,9 +434,9 @@
     Pel* dstU = getCbAddr(trUnitIdx, partSize);
     Pel* dstV = getCrAddr(trUnitIdx, partSize);
 
-    uint32_t src0Stride = srcYuv0->getCStride();
-    uint32_t src1Stride = srcYuv1->getCStride();
-    uint32_t dststride  = getCStride();
+    intptr_t src0Stride = srcYuv0->getCStride();
+    intptr_t src1Stride = srcYuv1->getCStride();
+    intptr_t dststride  = getCStride();
 
     primitives.pixeladd_pp(partSize, partSize, dstU, dststride, srcU0, srcU1, src0Stride, src1Stride);
     primitives.pixeladd_pp(partSize, partSize, dstV, dststride, srcV0, srcV1, src0Stride, src1Stride);
@@ -453,9 +453,9 @@
     Pel* dstU = getCbAddr(trUnitIdx, partSize);
     Pel* dstV = getCrAddr(trUnitIdx, partSize);
 
-    uint32_t src0Stride = srcYuv0->getCStride();
-    uint32_t src1Stride = srcYuv1->m_cwidth;
-    uint32_t dststride  = getCStride();
+    intptr_t src0Stride = srcYuv0->getCStride();
+    intptr_t src1Stride = srcYuv1->m_cwidth;
+    intptr_t dststride  = getCStride();
 
     for (y = partSize - 1; y >= 0; y--)
     {
@@ -488,9 +488,9 @@
     Pel* src1 = srcYuv1->getLumaAddr(trUnitIdx, partSize);
     Pel* dst  = getLumaAddr(trUnitIdx, partSize);
 
-    int src0Stride = srcYuv0->getStride();
-    int src1Stride = srcYuv1->getStride();
-    int dststride  = getStride();
+    intptr_t src0Stride = srcYuv0->getStride();
+    intptr_t src1Stride = srcYuv1->getStride();
+    intptr_t dststride  = getStride();
 
     for (y = partSize - 1; y >= 0; y--)
     {
@@ -516,9 +516,9 @@
     Pel* dstU  = getCbAddr(trUnitIdx, partSize);
     Pel* dstV  = getCrAddr(trUnitIdx, partSize);
 
-    int src0Stride = srcYuv0->getCStride();
-    int src1Stride = srcYuv1->getCStride();
-    int dststride  = getCStride();
+    intptr_t src0Stride = srcYuv0->getCStride();
+    intptr_t src1Stride = srcYuv1->getCStride();
+    intptr_t dststride  = getCStride();
 
     for (y = partSize - 1; y >= 0; y--)
     {
@@ -540,7 +540,7 @@
 void TComYuv::addAvg(TComYuv* srcYuv0, TComYuv* srcYuv1, uint32_t partUnitIdx, uint32_t width, uint32_t height, bool bLuma, bool bChroma)
 {
     int x, y;
-    uint32_t src0Stride, src1Stride, dststride;
+    intptr_t src0Stride, src1Stride, dststride;
     int shiftNum, offset;
 
     Pel* srcY0 = srcYuv0->getLumaAddr(partUnitIdx);
@@ -616,7 +616,7 @@
 void TComYuv::addAvg(TShortYUV* srcYuv0, TShortYUV* srcYuv1, uint32_t partUnitIdx, uint32_t width, uint32_t height, bool bLuma, bool bChroma)
 {
     int x, y;
-    uint32_t src0Stride, src1Stride, dststride;
+    intptr_t src0Stride, src1Stride, dststride;
     int shiftNum, offset;
 
     int16_t* srcY0 = srcYuv0->getLumaAddr(partUnitIdx);
@@ -704,8 +704,8 @@
     Pel* dstU = getCbAddr(partIdx);
     Pel* dstV = getCrAddr(partIdx);
 
-    int srcstride = srcYuv->getStride();
-    int dststride = getStride();
+    intptr_t srcstride = srcYuv->getStride();
+    intptr_t dststride = getStride();
 
     for (y = height - 1; y >= 0; y--)
     {
diff -r 0666d56aaa42 -r 9bff4295adfc source/Lib/TLibCommon/TypeDef.h
--- a/source/Lib/TLibCommon/TypeDef.h	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/Lib/TLibCommon/TypeDef.h	Thu Oct 31 15:40:28 2013 +0530
@@ -73,7 +73,7 @@
 #if HIGH_BIT_DEPTH
 typedef UShort Pel;            // 16-bit pixel type
 #define X265_DEPTH x265::g_bitDepth  // runtime configurable bit depth
-extern int g_bitDepth;
+extern uint32_t g_bitDepth;
 #else
 typedef UChar  Pel;            // 8-bit pixel type
 #define X265_DEPTH 8           // compile time configurable bit depth
diff -r 0666d56aaa42 -r 9bff4295adfc source/Lib/TLibEncoder/TEncCu.cpp
--- a/source/Lib/TLibEncoder/TEncCu.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/Lib/TLibEncoder/TEncCu.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -1758,7 +1758,7 @@
 
     Pel* srcY = fencYuv->getLumaAddr(0, width);
     Pel* dstY = cu->getPCMSampleY();
-    uint32_t srcStride = fencYuv->getStride();
+    intptr_t srcStride = fencYuv->getStride();
 
     for (int y = 0; y < height; y++)
     {
@@ -1777,7 +1777,7 @@
     Pel* dstCb = cu->getPCMSampleCb();
     Pel* dstCr = cu->getPCMSampleCr();
 
-    uint32_t srcStrideC = fencYuv->getCStride();
+    intptr_t srcStrideC = fencYuv->getCStride();
     uint32_t heightC = height >> 1;
     uint32_t widthC = width >> 1;
 
diff -r 0666d56aaa42 -r 9bff4295adfc source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp
--- a/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -553,7 +553,7 @@
  * \param  height block height
  * \param  bBorderAvail availabilities of block border pixels
  */
-void TEncSampleAdaptiveOffset::calcSaoStatsBlock(Pel* recStart, Pel* orgStart, int stride, Int64** stats, Int64** counts, uint32_t width, uint32_t height, bool* bBorderAvail, int yCbCr)
+void TEncSampleAdaptiveOffset::calcSaoStatsBlock(Pel* recStart, Pel* orgStart, intptr_t stride, Int64** stats, Int64** counts, uint32_t width, uint32_t height, bool* bBorderAvail, int yCbCr)
 {
     Int64 *stat, *count;
     int classIdx, posShift, startX, endX, startY, endY, signLeft, signRight, signDown, signDown1;
@@ -812,7 +812,7 @@
 
     Pel* fenc;
     Pel* pRec;
-    int stride;
+    intptr_t stride;
     int iLcuHeight = pTmpSPS->getMaxCUHeight();
     int iLcuWidth  = pTmpSPS->getMaxCUWidth();
     uint32_t lpelx   = pTmpCu->getCUPelX();
@@ -1084,7 +1084,7 @@
 
     Pel* fenc;
     Pel* pRec;
-    int stride;
+    intptr_t stride;
     int lcuHeight = pTmpSPS->getMaxCUHeight();
     int lcuWidth  = pTmpSPS->getMaxCUWidth();
     uint32_t rPelX;
diff -r 0666d56aaa42 -r 9bff4295adfc source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.h
--- a/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.h	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.h	Thu Oct 31 15:40:28 2013 +0530
@@ -101,7 +101,7 @@
     void disablePartTree(SAOQTPart *psQTPart, int partIdx);
     void getSaoStats(SAOQTPart *psQTPart, int yCbCr);
     void calcSaoStatsCu(int addr, int partIdx, int yCbCr);
-    void calcSaoStatsBlock(Pel* recStart, Pel* orgStart, int stride, Int64** stats, Int64** counts, uint32_t width, uint32_t height, bool* bBorderAvail, int yCbCr);
+    void calcSaoStatsBlock(Pel* recStart, Pel* orgStart, intptr_t stride, Int64** stats, Int64** counts, uint32_t width, uint32_t height, bool* bBorderAvail, int yCbCr);
     void calcSaoStatsRowCus_BeforeDblk(TComPic* pic, int idxY);
     void destroyEncBuffer();
     void createEncBuffer();
diff -r 0666d56aaa42 -r 9bff4295adfc source/Lib/TLibEncoder/TEncSearch.cpp
--- a/source/Lib/TLibEncoder/TEncSearch.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/Lib/TLibEncoder/TEncSearch.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -417,7 +417,7 @@
     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();
+    intptr_t    stride       = fencYuv->getStride();
     Pel*    fenc         = fencYuv->getLumaAddr(absPartIdx);
     Pel*    pred         = predYuv->getLumaAddr(absPartIdx);
     int16_t*  residual     = resiYuv->getLumaAddr(absPartIdx);
@@ -429,11 +429,11 @@
     TCoeff* coeff          = m_qtTempCoeffY[qtLayer] + numCoeffPerInc * absPartIdx;
 
     int16_t*  reconQt        = m_qtTempTComYuv[qtLayer].getLumaAddr(absPartIdx);
-    uint32_t    reconQtStride  = m_qtTempTComYuv[qtLayer].m_width;
+    intptr_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();
+    intptr_t    reconIPredStride = cu->getPic()->getPicYuvRec()->getStride();
     bool    useTransformSkip = cu->getTransformSkip(absPartIdx, TEXT_LUMA);
 
     //===== init availability pattern =====
@@ -532,7 +532,7 @@
     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();
+    intptr_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));
@@ -542,11 +542,11 @@
     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;
+    intptr_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();
+    intptr_t    reconIPredStride = cu->getPic()->getPicYuvRec()->getCStride();
     bool    useTransformSkipChroma = cu->getTransformSkip(absPartIdx, ttype);
 
     //===== update chroma mode =====
@@ -948,9 +948,9 @@
         uint32_t  qtLayer   = cu->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() - trSizeLog2;
         uint32_t  zorder    = cu->getZorderIdxInCU() + absPartIdx;
         int16_t* src      = m_qtTempTComYuv[qtLayer].getLumaAddr(absPartIdx);
-        uint32_t  srcstride = m_qtTempTComYuv[qtLayer].m_width;
+        intptr_t  srcstride = m_qtTempTComYuv[qtLayer].m_width;
         Pel*  dst       = cu->getPic()->getPicYuvRec()->getLumaAddr(cu->getAddr(), zorder);
-        uint32_t  dststride = cu->getPic()->getPicYuvRec()->getStride();
+        intptr_t  dststride = cu->getPic()->getPicYuvRec()->getStride();
         primitives.blockcpy_ps(width, height, dst, dststride, src, srcstride);
 
         if (!bLumaOnly)
@@ -1126,9 +1126,9 @@
 
     uint32_t   zOrder           = cu->getZorderIdxInCU() + absPartIdx;
     Pel*   reconIPred       = cu->getPic()->getPicYuvRec()->getLumaAddr(cu->getAddr(), zOrder);
-    uint32_t   reconIPredStride = cu->getPic()->getPicYuvRec()->getStride();
+    intptr_t   reconIPredStride = cu->getPic()->getPicYuvRec()->getStride();
     int16_t* reconQt          = m_qtTempTComYuv[qtlayer].getLumaAddr(absPartIdx);
-    uint32_t   reconQtStride    = m_qtTempTComYuv[qtlayer].m_width;
+    intptr_t   reconQtStride    = m_qtTempTComYuv[qtlayer].m_width;
     uint32_t   width            = cu->getWidth(0) >> trDepth;
     uint32_t   height           = cu->getHeight(0) >> trDepth;
     primitives.blockcpy_ps(width, height, reconIPred, reconIPredStride, reconQt, reconQtStride);
@@ -1249,8 +1249,8 @@
         uint32_t zorder           = cu->getZorderIdxInCU() + absPartIdx;
         uint32_t width            = cu->getWidth(0) >> (trDepth + 1);
         uint32_t height           = cu->getHeight(0) >> (trDepth + 1);
-        uint32_t reconQtStride    = m_qtTempTComYuv[qtlayer].m_cwidth;
-        uint32_t reconIPredStride = cu->getPic()->getPicYuvRec()->getCStride();
+        intptr_t reconQtStride    = m_qtTempTComYuv[qtlayer].m_cwidth;
+        intptr_t reconIPredStride = cu->getPic()->getPicYuvRec()->getCStride();
 
         if (stateU0V1Both2 == 0 || stateU0V1Both2 == 2)
         {
@@ -1473,7 +1473,7 @@
 {
     uint32_t width  = cu->getWidth(0) >> 1;
     uint32_t height = cu->getHeight(0) >> 1;
-    uint32_t stride = fencYuv->getCStride();
+    intptr_t stride = fencYuv->getCStride();
     Pel* fencU  = fencYuv->getCbAddr(0);
     Pel* fencV  = fencYuv->getCrAddr(0);
     Pel* predU  = predYuv->getCbAddr(0);
@@ -1552,7 +1552,7 @@
         int numModesAvailable = 35; //total number of Intra modes
         Pel* fenc   = fencYuv->getLumaAddr(pu, width);
         Pel* pred   = predYuv->getLumaAddr(pu, width);
-        uint32_t stride = predYuv->getStride();
+        intptr_t stride = predYuv->getStride();
         uint32_t rdModeList[FAST_UDI_MAX_RDMODE_NUM];
         int numModesForFullRD = g_intraModeNumFast[widthBit];
         int log2SizeMinus2 = g_convertToBit[width];
@@ -1817,9 +1817,9 @@
             uint32_t compHeight  = cu->getHeight(0) >> initTrDepth;
             uint32_t zorder      = cu->getZorderIdxInCU() + partOffset;
             Pel* dst         = cu->getPic()->getPicYuvRec()->getLumaAddr(cu->getAddr(), zorder);
-            uint32_t dststride   = cu->getPic()->getPicYuvRec()->getStride();
+            intptr_t dststride   = cu->getPic()->getPicYuvRec()->getStride();
             Pel* src         = reconYuv->getLumaAddr(partOffset);
-            uint32_t srcstride   = reconYuv->getStride();
+            intptr_t srcstride   = reconYuv->getStride();
             primitives.blockcpy_pp(compWidth, compHeight, dst, dststride, src, srcstride);
 
             if (!bLumaOnly && !bSkipChroma)
@@ -1954,10 +1954,10 @@
  * \param ttText texture component type
  * \returns void
  */
-void TEncSearch::xEncPCM(TComDataCU* cu, uint32_t absPartIdx, Pel* fenc, Pel* pcm, Pel* pred, int16_t* resi, Pel* recon, uint32_t stride, uint32_t width, uint32_t height, TextType eText)
+void TEncSearch::xEncPCM(TComDataCU* cu, uint32_t absPartIdx, Pel* fenc, Pel* pcm, Pel* pred, int16_t* resi, Pel* recon, intptr_t stride, uint32_t width, uint32_t height, TextType eText)
 {
     uint32_t x, y;
-    uint32_t reconStride;
+    intptr_t reconStride;
     Pel* pcmTmp = pcm;
     Pel* reconPic;
     int shiftPcm;
@@ -2036,8 +2036,8 @@
     uint32_t depth      = cu->getDepth(0);
     uint32_t width      = cu->getWidth(0);
     uint32_t height     = cu->getHeight(0);
-    uint32_t stride     = predYuv->getStride();
-    uint32_t strideC    = predYuv->getCStride();
+    intptr_t stride     = predYuv->getStride();
+    intptr_t strideC    = predYuv->getCStride();
     uint32_t widthC     = width  >> 1;
     uint32_t heightC    = height >> 1;
     uint32_t distortion = 0;
@@ -2350,7 +2350,7 @@
                     satdCost = primitives.satd[partEnum](pu, fenc->getStride(), avg, roiWidth);
                     x265_emms();
 
-                    unsigned int bitsZero0, bitsZero1;
+                    uint32_t bitsZero0, bitsZero1;
                     m_me.setMVP(mvPredBi[0][refIdxBidir[0]]);
                     bitsZero0 = bits[0] - m_me.bitcost(mv[0]) + m_me.bitcost(mvzero);
 
@@ -3122,7 +3122,7 @@
         if (!absSumY)
         {
             int16_t *ptr =  m_qtTempTComYuv[qtlayer].getLumaAddr(absTUPartIdx);
-            const uint32_t stride = m_qtTempTComYuv[qtlayer].m_width;
+            const intptr_t stride = m_qtTempTComYuv[qtlayer].m_width;
 
             assert(trWidth == trHeight);
             primitives.blockfill_s[(int)g_convertToBit[trWidth]](ptr, stride, 0);
@@ -3196,7 +3196,7 @@
             if (!absSumU)
             {
                 int16_t *ptr = m_qtTempTComYuv[qtlayer].getCbAddr(absTUPartIdxC);
-                const uint32_t stride = m_qtTempTComYuv[qtlayer].m_cwidth;
+                const intptr_t stride = m_qtTempTComYuv[qtlayer].m_cwidth;
 
                 assert(trWidthC == trHeightC);
                 primitives.blockfill_s[(int)g_convertToBit[trWidthC]](ptr, stride, 0);
@@ -3262,7 +3262,7 @@
             if (!absSumV)
             {
                 int16_t *ptr =  m_qtTempTComYuv[qtlayer].getCrAddr(absTUPartIdxC);
-                const uint32_t stride = m_qtTempTComYuv[qtlayer].m_cwidth;
+                const intptr_t stride = m_qtTempTComYuv[qtlayer].m_cwidth;
 
                 assert(trWidthC == trHeightC);
                 primitives.blockfill_s[(int)g_convertToBit[trWidthC]](ptr, stride, 0);
@@ -3282,7 +3282,7 @@
             UInt64 singleCostY = MAX_INT64;
 
             int16_t *curResiY = m_qtTempTComYuv[qtlayer].getLumaAddr(absTUPartIdx);
-            uint32_t resiStride = m_qtTempTComYuv[qtlayer].m_width;
+            intptr_t resiStride = m_qtTempTComYuv[qtlayer].m_width;
 
             TCoeff bestCoeffY[32 * 32];
             memcpy(bestCoeffY, coeffCurY, sizeof(TCoeff) * numSamplesLuma);
@@ -3358,7 +3358,7 @@
 
             int16_t *curResiU = m_qtTempTComYuv[qtlayer].getCbAddr(absTUPartIdxC);
             int16_t *curResiV = m_qtTempTComYuv[qtlayer].getCrAddr(absTUPartIdxC);
-            uint32_t stride = m_qtTempTComYuv[qtlayer].m_cwidth;
+            intptr_t stride = m_qtTempTComYuv[qtlayer].m_cwidth;
 
             TCoeff bestCoeffU[32 * 32], bestCoeffV[32 * 32];
             memcpy(bestCoeffU, coeffCurU, sizeof(TCoeff) * numSamplesChroma);
diff -r 0666d56aaa42 -r 9bff4295adfc source/Lib/TLibEncoder/TEncSearch.h
--- a/source/Lib/TLibEncoder/TEncSearch.h	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/Lib/TLibEncoder/TEncSearch.h	Thu Oct 31 15:40:28 2013 +0530
@@ -152,7 +152,7 @@
     /// set ME search range
     void setAdaptiveSearchRange(int dir, int refIdx, int merange) { m_adaptiveRange[dir][refIdx] = merange; }
 
-    void xEncPCM(TComDataCU* cu, uint32_t absPartIdx, Pel* fenc, Pel* pcm, Pel* pred, int16_t* residual, Pel* recon, uint32_t stride,
+    void xEncPCM(TComDataCU* cu, uint32_t absPartIdx, Pel* fenc, Pel* pcm, Pel* pred, int16_t* residual, Pel* recon, intptr_t stride,
                  uint32_t width, uint32_t height, TextType ttype);
 
     void IPCMSearch(TComDataCU* cu, TComYuv* fencYuv, TComYuv* predYuv, TShortYUV* resiYuv, TComYuv* reconYuv);
diff -r 0666d56aaa42 -r 9bff4295adfc source/Lib/TLibEncoder/WeightPredAnalysis.cpp
--- a/source/Lib/TLibEncoder/WeightPredAnalysis.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/Lib/TLibEncoder/WeightPredAnalysis.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -289,8 +289,8 @@
         {
             Pel*  fenc = pic->getLumaAddr();
             Pel*  fref = slice->getRefPic(list, refIdxTmp)->getPicYuvOrg()->getLumaAddr();
-            int   orgStride = pic->getStride();
-            int   refStride = slice->getRefPic(list, refIdxTmp)->getPicYuvOrg()->getStride();
+            intptr_t   orgStride = pic->getStride();
+            intptr_t   refStride = slice->getRefPic(list, refIdxTmp)->getPicYuvOrg()->getStride();
 
             // calculate SAD costs with/without wp for luma
             SADWP   = this->xCalcSADvalueWP(X265_DEPTH, fenc, fref, width, height, orgStride, refStride, denom, weightPredTable[list][refIdxTmp][0].inputWeight, weightPredTable[list][refIdxTmp][0].inputOffset);
@@ -338,7 +338,7 @@
 Int64 WeightPredAnalysis::xCalcDCValueSlice(TComSlice *slice, Pel *pels, int32_t *sample)
 {
     TComPicYuv* pic = slice->getPic()->getPicYuvOrg();
-    int stride = pic->getStride();
+    intptr_t stride = pic->getStride();
 
     *sample = 0;
     int width  = pic->getWidth();
@@ -358,7 +358,7 @@
 Int64 WeightPredAnalysis::xCalcACValueSlice(TComSlice *slice, Pel *pels, Int64 dc)
 {
     TComPicYuv* pic = slice->getPic()->getPicYuvOrg();
-    int stride = pic->getStride();
+    intptr_t stride = pic->getStride();
 
     int width  = pic->getWidth();
     int height = pic->getHeight();
@@ -376,7 +376,7 @@
 Int64 WeightPredAnalysis::xCalcDCValueUVSlice(TComSlice *slice, Pel *pels, int32_t *sample)
 {
     TComPicYuv* pic = slice->getPic()->getPicYuvOrg();
-    int cstride = pic->getCStride();
+    intptr_t cstride = pic->getCStride();
 
     *sample = 0;
     int width  = pic->getWidth() >> 1;
@@ -396,7 +396,7 @@
 Int64 WeightPredAnalysis::xCalcACValueUVSlice(TComSlice *slice, Pel *pels, Int64 dc)
 {
     TComPicYuv* pic = slice->getPic()->getPicYuvOrg();
-    int cstride = pic->getCStride();
+    intptr_t cstride = pic->getCStride();
 
     int width  = pic->getWidth() >> 1;
     int height = pic->getHeight() >> 1;
@@ -412,7 +412,7 @@
  * \param int stride
  * \returns Int64
  */
-Int64 WeightPredAnalysis::xCalcDCValue(Pel *pels, int width, int height, int stride)
+Int64 WeightPredAnalysis::xCalcDCValue(Pel *pels, int width, int height, intptr_t stride)
 {
     int x, y;
     Int64 dc = 0;
@@ -434,11 +434,11 @@
  * \param Pel *pels
  * \param int width
  * \param int height
- * \param int stride
+ * \param intptr_t stride
  * \param int dc
  * \returns Int64
  */
-Int64 WeightPredAnalysis::xCalcACValue(Pel *pels, int width, int height, int stride, Int64 dc)
+Int64 WeightPredAnalysis::xCalcACValue(Pel *pels, int width, int height, intptr_t stride, Int64 dc)
 {
     int x, y;
     Int64 ac = 0;
@@ -461,14 +461,14 @@
  * \param Pel *refPel
  * \param int width
  * \param int height
- * \param int orgStride
- * \param int refStride
+ * \param intptr_t orgStride
+ * \param intptr_t refStride
  * \param int denom
  * \param int inputWeight
  * \param int inputOffset
  * \returns Int64
  */
-Int64 WeightPredAnalysis::xCalcSADvalueWP(int bitDepth, Pel *orgPel, Pel *refPel, int width, int height, int orgStride, int refStride, int denom, int inputWeight, int inputOffset)
+Int64 WeightPredAnalysis::xCalcSADvalueWP(int bitDepth, Pel *orgPel, Pel *refPel, int width, int height, intptr_t orgStride, intptr_t refStride, int denom, int inputWeight, int inputOffset)
 {
     int x, y;
     Int64 sad = 0;
diff -r 0666d56aaa42 -r 9bff4295adfc source/Lib/TLibEncoder/WeightPredAnalysis.h
--- a/source/Lib/TLibEncoder/WeightPredAnalysis.h	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/Lib/TLibEncoder/WeightPredAnalysis.h	Thu Oct 31 15:40:28 2013 +0530
@@ -55,9 +55,9 @@
     Int64   xCalcACValueUVSlice(TComSlice *slice, Pel *pels, Int64 dc);
     Int64   xCalcSADvalueWPSlice(TComSlice *slice, Pel *orgPel, Pel *refPel, int denom, int inputWeight, int inputOffset);
 
-    Int64   xCalcDCValue(Pel *pels, int width, int height, int stride);
-    Int64   xCalcACValue(Pel *pels, int width, int height, int stride, Int64 iDC);
-    Int64   xCalcSADvalueWP(int bitDepth, Pel *orgPel, Pel *refPel, int width, int height, int orgStride, int refStride, int denom, int inputWeight, int inputOffset);
+    Int64   xCalcDCValue(Pel *pels, int width, int height, intptr_t stride);
+    Int64   xCalcACValue(Pel *pels, int width, int height, intptr_t stride, Int64 iDC);
+    Int64   xCalcSADvalueWP(int bitDepth, Pel *orgPel, Pel *refPel, int width, int height, intptr_t orgStride, intptr_t refStride, int denom, int inputWeight, int inputOffset);
     bool    xSelectWP(TComSlice * slice, wpScalingParam weightPredTable[2][MAX_NUM_REF][3], int denom);
     bool    xUpdatingWPParameters(TComSlice* slice, int log2Denom);
 
diff -r 0666d56aaa42 -r 9bff4295adfc source/common/TShortYUV.cpp
--- a/source/common/TShortYUV.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/common/TShortYUV.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -43,7 +43,7 @@
 TShortYUV::~TShortYUV()
 {}
 
-void TShortYUV::create(unsigned int width, unsigned int height)
+void TShortYUV::create(uint32_t width, uint32_t height)
 {
     m_bufY  = (int16_t*)X265_MALLOC(int16_t, width * height);
     m_bufCb = (int16_t*)X265_MALLOC(int16_t, width * height >> 2);
@@ -73,30 +73,30 @@
     ::memset(m_bufCr, 0, (m_cwidth * m_cheight) * sizeof(int16_t));
 }
 
-void TShortYUV::subtract(TComYuv* srcYuv0, TComYuv* srcYuv1, unsigned int trUnitIdx, unsigned int partSize)
+void TShortYUV::subtract(TComYuv* srcYuv0, TComYuv* srcYuv1, uint32_t trUnitIdx, uint32_t partSize)
 {
     subtractLuma(srcYuv0, srcYuv1,  trUnitIdx, partSize);
     subtractChroma(srcYuv0, srcYuv1,  trUnitIdx, partSize >> 1);
 }
 
-void TShortYUV::subtractLuma(TComYuv* srcYuv0, TComYuv* srcYuv1, unsigned int trUnitIdx, unsigned int partSize)
+void TShortYUV::subtractLuma(TComYuv* srcYuv0, TComYuv* srcYuv1, uint32_t trUnitIdx, uint32_t partSize)
 {
-    int x = partSize, y = partSize;
+    uint32_t x = partSize, y = partSize;
 
     Pel* src0 = srcYuv0->getLumaAddr(trUnitIdx, partSize);
     Pel* src1 = srcYuv1->getLumaAddr(trUnitIdx, partSize);
     int16_t* dst = getLumaAddr(trUnitIdx, partSize);
 
-    int src0Stride = srcYuv0->getStride();
-    int src1Stride = srcYuv1->getStride();
-    int dstStride  = m_width;
+    intptr_t src0Stride = srcYuv0->getStride();
+    intptr_t src1Stride = srcYuv1->getStride();
+    intptr_t dstStride  = m_width;
 
     primitives.pixelsub_sp(x, y, dst, dstStride, src0, src1, src0Stride, src1Stride);
 }
 
-void TShortYUV::subtractChroma(TComYuv* srcYuv0, TComYuv* srcYuv1, unsigned int trUnitIdx, unsigned int partSize)
+void TShortYUV::subtractChroma(TComYuv* srcYuv0, TComYuv* srcYuv1, uint32_t trUnitIdx, uint32_t partSize)
 {
-    int x = partSize, y = partSize;
+    uint32_t x = partSize, y = partSize;
 
     Pel* srcU0 = srcYuv0->getCbAddr(trUnitIdx, partSize);
     Pel* srcU1 = srcYuv1->getCbAddr(trUnitIdx, partSize);
@@ -105,15 +105,15 @@
     int16_t* dstU = getCbAddr(trUnitIdx, partSize);
     int16_t* dstV = getCrAddr(trUnitIdx, partSize);
 
-    int src0Stride = srcYuv0->getCStride();
-    int src1Stride = srcYuv1->getCStride();
-    int dstStride  = m_cwidth;
+    intptr_t src0Stride = srcYuv0->getCStride();
+    intptr_t src1Stride = srcYuv1->getCStride();
+    intptr_t dstStride  = m_cwidth;
 
     primitives.pixelsub_sp(x, y, dstU, dstStride, srcU0, srcU1, src0Stride, src1Stride);
     primitives.pixelsub_sp(x, y, dstV, dstStride, srcV0, srcV1, src0Stride, src1Stride);
 }
 
-void TShortYUV::addClip(TShortYUV* srcYuv0, TShortYUV* srcYuv1, unsigned int trUnitIdx, unsigned int partSize)
+void TShortYUV::addClip(TShortYUV* srcYuv0, TShortYUV* srcYuv1, uint32_t trUnitIdx, uint32_t partSize)
 {
     addClipLuma(srcYuv0, srcYuv1, trUnitIdx, partSize);
     addClipChroma(srcYuv0, srcYuv1, trUnitIdx, partSize >> 1);
@@ -123,20 +123,20 @@
 #pragma warning (disable: 4244)
 #endif
 
-void TShortYUV::addClipLuma(TShortYUV* srcYuv0, TShortYUV* srcYuv1, unsigned int trUnitIdx, unsigned int partSize)
+void TShortYUV::addClipLuma(TShortYUV* srcYuv0, TShortYUV* srcYuv1, uint32_t trUnitIdx, uint32_t partSize)
 {
     int16_t* src0 = srcYuv0->getLumaAddr(trUnitIdx, partSize);
     int16_t* src1 = srcYuv1->getLumaAddr(trUnitIdx, partSize);
     int16_t* dst  = getLumaAddr(trUnitIdx, partSize);
 
-    unsigned int src0Stride = srcYuv0->m_width;
-    unsigned int src1Stride = srcYuv1->m_width;
-    unsigned int dstStride  = m_width;
+    intptr_t src0Stride = srcYuv0->m_width;
+    intptr_t src1Stride = srcYuv1->m_width;
+    intptr_t dstStride  = m_width;
 
     primitives.pixeladd_ss(partSize, partSize, dst, dstStride, src0, src1, src0Stride, src1Stride);
 }
 
-void TShortYUV::addClipChroma(TShortYUV* srcYuv0, TShortYUV* srcYuv1, unsigned int trUnitIdx, unsigned int partSize)
+void TShortYUV::addClipChroma(TShortYUV* srcYuv0, TShortYUV* srcYuv1, uint32_t trUnitIdx, uint32_t partSize)
 {
     int16_t* srcU0 = srcYuv0->getCbAddr(trUnitIdx, partSize);
     int16_t* srcU1 = srcYuv1->getCbAddr(trUnitIdx, partSize);
@@ -145,9 +145,9 @@
     int16_t* dstU = getCbAddr(trUnitIdx, partSize);
     int16_t* dstV = getCrAddr(trUnitIdx, partSize);
 
-    unsigned int src0Stride = srcYuv0->m_cwidth;
-    unsigned int src1Stride = srcYuv1->m_cwidth;
-    unsigned int dstStride  = m_cwidth;
+    intptr_t src0Stride = srcYuv0->m_cwidth;
+    intptr_t src1Stride = srcYuv1->m_cwidth;
+    intptr_t dstStride  = m_cwidth;
 
     primitives.pixeladd_ss(partSize, partSize, dstU, dstStride, srcU0, srcU1, src0Stride, src1Stride);
     primitives.pixeladd_ss(partSize, partSize, dstV, dstStride, srcV0, srcV1, src0Stride, src1Stride);
@@ -157,28 +157,28 @@
 #pragma warning (default: 4244)
 #endif
 
-void TShortYUV::copyPartToPartYuv(TShortYUV* dstPicYuv, unsigned int partIdx, unsigned int width, unsigned int height)
+void TShortYUV::copyPartToPartYuv(TShortYUV* dstPicYuv, uint32_t partIdx, uint32_t width, uint32_t height)
 {
     copyPartToPartLuma(dstPicYuv, partIdx, width, height);
     copyPartToPartChroma(dstPicYuv, partIdx, width >> 1, height >> 1);
 }
 
-void TShortYUV::copyPartToPartYuv(TComYuv* dstPicYuv, unsigned int partIdx, unsigned int width, unsigned int height)
+void TShortYUV::copyPartToPartYuv(TComYuv* dstPicYuv, uint32_t partIdx, uint32_t width, uint32_t height)
 {
     copyPartToPartLuma(dstPicYuv, partIdx, width, height);
     copyPartToPartChroma(dstPicYuv, partIdx, width >> 1, height >> 1);
 }
 
-void TShortYUV::copyPartToPartLuma(TShortYUV* dstPicYuv, unsigned int partIdx, unsigned int width, unsigned int height)
+void TShortYUV::copyPartToPartLuma(TShortYUV* dstPicYuv, uint32_t partIdx, uint32_t width, uint32_t height)
 {
     int16_t* src = getLumaAddr(partIdx);
     int16_t* dst = dstPicYuv->getLumaAddr(partIdx);
 
     if (src == dst) return;
 
-    unsigned int srcStride = m_width;
-    unsigned int dstStride = dstPicYuv->m_width;
-    for (unsigned int y = height; y != 0; y--)
+    intptr_t srcStride = m_width;
+    intptr_t dstStride = dstPicYuv->m_width;
+    for (uint32_t y = height; y != 0; y--)
     {
         ::memcpy(dst, src, width * sizeof(int16_t));
         src += srcStride;
@@ -186,18 +186,18 @@
     }
 }
 
-void TShortYUV::copyPartToPartLuma(TComYuv* dstPicYuv, unsigned int partIdx, unsigned int width, unsigned int height)
+void TShortYUV::copyPartToPartLuma(TComYuv* dstPicYuv, uint32_t partIdx, uint32_t width, uint32_t height)
 {
     int16_t* src = getLumaAddr(partIdx);
     Pel* dst = dstPicYuv->getLumaAddr(partIdx);
 
-    unsigned int srcStride = m_width;
-    unsigned int dstStride = dstPicYuv->getStride();
+    intptr_t srcStride = m_width;
+    intptr_t dstStride = dstPicYuv->getStride();
 
     primitives.blockcpy_ps(width, height, dst, dstStride, src, srcStride);
 }
 
-void TShortYUV::copyPartToPartChroma(TShortYUV* dstPicYuv, unsigned int partIdx, unsigned int width, unsigned int height)
+void TShortYUV::copyPartToPartChroma(TShortYUV* dstPicYuv, uint32_t partIdx, uint32_t width, uint32_t height)
 {
     int16_t* srcU = getCbAddr(partIdx);
     int16_t* srcV = getCrAddr(partIdx);
@@ -206,9 +206,9 @@
 
     if (srcU == dstU && srcV == dstV) return;
 
-    unsigned int srcStride = m_cwidth;
-    unsigned int dstStride = dstPicYuv->m_cwidth;
-    for (unsigned int y = height; y != 0; y--)
+    intptr_t srcStride = m_cwidth;
+    intptr_t dstStride = dstPicYuv->m_cwidth;
+    for (uint32_t y = height; y != 0; y--)
     {
         ::memcpy(dstU, srcU, width * sizeof(int16_t));
         ::memcpy(dstV, srcV, width * sizeof(int16_t));
@@ -219,21 +219,21 @@
     }
 }
 
-void TShortYUV::copyPartToPartChroma(TComYuv* dstPicYuv, unsigned int partIdx, unsigned int width, unsigned int height)
+void TShortYUV::copyPartToPartChroma(TComYuv* dstPicYuv, uint32_t partIdx, uint32_t width, uint32_t height)
 {
     int16_t* srcU = getCbAddr(partIdx);
     int16_t* srcV = getCrAddr(partIdx);
     Pel* dstU = dstPicYuv->getCbAddr(partIdx);
     Pel* dstV = dstPicYuv->getCrAddr(partIdx);
 
-    unsigned int srcStride = m_cwidth;
-    unsigned int dstStride = dstPicYuv->getCStride();
+    intptr_t srcStride = m_cwidth;
+    intptr_t dstStride = dstPicYuv->getCStride();
 
     primitives.blockcpy_ps(width, height, dstU, dstStride, srcU, srcStride);
     primitives.blockcpy_ps(width, height, dstV, dstStride, srcV, srcStride);
 }
 
-void TShortYUV::copyPartToPartChroma(TShortYUV* dstPicYuv, unsigned int partIdx, unsigned int width, unsigned int height, unsigned int chromaId)
+void TShortYUV::copyPartToPartChroma(TShortYUV* dstPicYuv, uint32_t partIdx, uint32_t width, uint32_t height, uint32_t chromaId)
 {
     if (chromaId == 0)
     {
@@ -243,9 +243,9 @@
         {
             return;
         }
-        unsigned int srcStride = m_cwidth;
-        unsigned int dstStride = dstPicYuv->m_cwidth;
-        for (unsigned int y = height; y != 0; y--)
+        intptr_t srcStride = m_cwidth;
+        intptr_t dstStride = dstPicYuv->m_cwidth;
+        for (uint32_t y = height; y != 0; y--)
         {
             ::memcpy(dstU, srcU, width * sizeof(int16_t));
             srcU += srcStride;
@@ -257,9 +257,9 @@
         int16_t* srcV = getCrAddr(partIdx);
         int16_t* dstV = dstPicYuv->getCrAddr(partIdx);
         if (srcV == dstV) return;
-        unsigned int srcStride = m_cwidth;
-        unsigned int dstStride = dstPicYuv->m_cwidth;
-        for (unsigned int y = height; y != 0; y--)
+        intptr_t srcStride = m_cwidth;
+        intptr_t dstStride = dstPicYuv->m_cwidth;
+        for (uint32_t y = height; y != 0; y--)
         {
             ::memcpy(dstV, srcV, width * sizeof(int16_t));
             srcV += srcStride;
@@ -273,9 +273,9 @@
         int16_t* dstU = dstPicYuv->getCbAddr(partIdx);
         int16_t* dstV = dstPicYuv->getCrAddr(partIdx);
         if (srcU == dstU && srcV == dstV) return;
-        unsigned int srcStride = m_cwidth;
-        unsigned int dstStride = dstPicYuv->m_cwidth;
-        for (unsigned int y = height; y != 0; y--)
+        intptr_t srcStride = m_cwidth;
+        intptr_t dstStride = dstPicYuv->m_cwidth;
+        for (uint32_t y = height; y != 0; y--)
         {
             ::memcpy(dstU, srcU, width * sizeof(int16_t));
             ::memcpy(dstV, srcV, width * sizeof(int16_t));
@@ -287,22 +287,22 @@
     }
 }
 
-void TShortYUV::copyPartToPartChroma(TComYuv* dstPicYuv, unsigned int partIdx, unsigned int width, unsigned int height, unsigned int chromaId)
+void TShortYUV::copyPartToPartChroma(TComYuv* dstPicYuv, uint32_t partIdx, uint32_t width, uint32_t height, uint32_t chromaId)
 {
     if (chromaId == 0)
     {
         int16_t* srcU = getCbAddr(partIdx);
         Pel* dstU = dstPicYuv->getCbAddr(partIdx);
-        unsigned int srcStride = m_cwidth;
-        unsigned int dstStride = dstPicYuv->getCStride();
+        intptr_t srcStride = m_cwidth;
+        intptr_t dstStride = dstPicYuv->getCStride();
         primitives.blockcpy_ps(width, height, dstU, dstStride, srcU, srcStride);
     }
     else if (chromaId == 1)
     {
         int16_t* srcV = getCrAddr(partIdx);
         Pel* dstV = dstPicYuv->getCrAddr(partIdx);
-        unsigned int srcStride = m_cwidth;
-        unsigned int dstStride = dstPicYuv->getCStride();
+        intptr_t srcStride = m_cwidth;
+        intptr_t dstStride = dstPicYuv->getCStride();
         primitives.blockcpy_ps(width, height, dstV, dstStride, srcV, srcStride);
     }
     else
@@ -312,8 +312,8 @@
         Pel* dstU = dstPicYuv->getCbAddr(partIdx);
         Pel* dstV = dstPicYuv->getCrAddr(partIdx);
 
-        unsigned int srcStride = m_cwidth;
-        unsigned int dstStride = dstPicYuv->getCStride();
+        intptr_t srcStride = m_cwidth;
+        intptr_t dstStride = dstPicYuv->getCStride();
         primitives.blockcpy_ps(width, height, dstU, dstStride, srcU, srcStride);
         primitives.blockcpy_ps(width, height, dstV, dstStride, srcV, srcStride);
     }
diff -r 0666d56aaa42 -r 9bff4295adfc source/common/TShortYUV.h
--- a/source/common/TShortYUV.h	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/common/TShortYUV.h	Thu Oct 31 15:40:28 2013 +0530
@@ -37,7 +37,7 @@
 {
 private:
 
-    static int getAddrOffset(unsigned int idx, unsigned int width)
+    static int getAddrOffset(uint32_t idx, uint32_t width)
     {
         int blkX = g_rasterToPelX[g_zscanToRaster[idx]];
         int blkY = g_rasterToPelY[g_zscanToRaster[idx]];
@@ -45,7 +45,7 @@
         return blkX + blkY * width;
     }
 
-    static int getAddrOffset(unsigned int idx, unsigned int size, unsigned int width)
+    static int getAddrOffset(uint32_t idx, uint32_t size, uint32_t width)
     {
         int blkX = (idx * size) &  (width - 1);
         int blkY = (idx * size) & ~(width - 1);
@@ -59,15 +59,15 @@
     int16_t* m_bufCb;
     int16_t* m_bufCr;
 
-    unsigned int m_width;
-    unsigned int m_height;
-    unsigned int m_cwidth;
-    unsigned int m_cheight;
+    uint32_t m_width;
+    uint32_t m_height;
+    uint32_t m_cwidth;
+    uint32_t m_cheight;
 
     TShortYUV();
     virtual ~TShortYUV();
 
-    void create(unsigned int width, unsigned int height);
+    void create(uint32_t width, uint32_t height);
     void destroy();
     void clear();
 
@@ -78,36 +78,36 @@
     int16_t* getCrAddr()    { return m_bufCr; }
 
     //  Access starting position of YUV partition unit buffer
-    int16_t* getLumaAddr(unsigned int partUnitIdx) { return m_bufY + getAddrOffset(partUnitIdx, m_width); }
+    int16_t* getLumaAddr(uint32_t partUnitIdx) { return m_bufY + getAddrOffset(partUnitIdx, m_width); }
 
-    int16_t* getCbAddr(unsigned int partUnitIdx) { return m_bufCb + (getAddrOffset(partUnitIdx, m_cwidth) >> 1); }
+    int16_t* getCbAddr(uint32_t partUnitIdx) { return m_bufCb + (getAddrOffset(partUnitIdx, m_cwidth) >> 1); }
 
-    int16_t* getCrAddr(unsigned int partUnitIdx) { return m_bufCr + (getAddrOffset(partUnitIdx, m_cwidth) >> 1); }
+    int16_t* getCrAddr(uint32_t partUnitIdx) { return m_bufCr + (getAddrOffset(partUnitIdx, m_cwidth) >> 1); }
 
     //  Access starting position of YUV transform unit buffer
-    int16_t* getLumaAddr(unsigned int partIdx, unsigned int size) { return m_bufY + getAddrOffset(partIdx, size, m_width); }
+    int16_t* getLumaAddr(uint32_t partIdx, uint32_t size) { return m_bufY + getAddrOffset(partIdx, size, m_width); }
 
-    int16_t* getCbAddr(unsigned int partIdx, unsigned int size) { return m_bufCb + getAddrOffset(partIdx, size, m_cwidth); }
+    int16_t* getCbAddr(uint32_t partIdx, uint32_t size) { return m_bufCb + getAddrOffset(partIdx, size, m_cwidth); }
 
-    int16_t* getCrAddr(unsigned int partIdx, unsigned int size) { return m_bufCr + getAddrOffset(partIdx, size, m_cwidth); }
+    int16_t* getCrAddr(uint32_t partIdx, uint32_t size) { return m_bufCr + getAddrOffset(partIdx, size, m_cwidth); }
 
-    void subtractLuma(TComYuv* srcYuv0, TComYuv* srcYuv1, unsigned int trUnitIdx, unsigned int partSize);
-    void subtractChroma(TComYuv* srcYuv0, TComYuv* srcYuv1, unsigned int trUnitIdx, unsigned int partSize);
-    void subtract(TComYuv* srcYuv0, TComYuv* srcYuv1, unsigned int trUnitIdx, unsigned int partSize);
+    void subtractLuma(TComYuv* srcYuv0, TComYuv* srcYuv1, uint32_t trUnitIdx, uint32_t partSize);
+    void subtractChroma(TComYuv* srcYuv0, TComYuv* srcYuv1, uint32_t trUnitIdx, uint32_t partSize);
+    void subtract(TComYuv* srcYuv0, TComYuv* srcYuv1, uint32_t trUnitIdx, uint32_t partSize);
 
-    void addClip(TShortYUV* srcYuv0, TShortYUV* srcYuv1, unsigned int trUnitIdx, unsigned int partSize);
-    void addClipLuma(TShortYUV* srcYuv0, TShortYUV* srcYuv1, unsigned int trUnitIdx, unsigned int partSize);
-    void addClipChroma(TShortYUV* srcYuv0, TShortYUV* srcYuv1, unsigned int trUnitIdx, unsigned int partSize);
+    void addClip(TShortYUV* srcYuv0, TShortYUV* srcYuv1, uint32_t trUnitIdx, uint32_t partSize);
+    void addClipLuma(TShortYUV* srcYuv0, TShortYUV* srcYuv1, uint32_t trUnitIdx, uint32_t partSize);
+    void addClipChroma(TShortYUV* srcYuv0, TShortYUV* srcYuv1, uint32_t trUnitIdx, uint32_t partSize);
 
-    void copyPartToPartYuv(TShortYUV* dstPicYuv, unsigned int partIdx, unsigned int width, unsigned int height);
-    void copyPartToPartLuma(TShortYUV* dstPicYuv, unsigned int partIdx, unsigned int width, unsigned int height);
-    void copyPartToPartChroma(TShortYUV* dstPicYuv, unsigned int partIdx, unsigned int width, unsigned int height);
-    void copyPartToPartChroma(TShortYUV* dstPicYuv, unsigned int partIdx, unsigned int iWidth, unsigned int iHeight, unsigned int chromaId);
+    void copyPartToPartYuv(TShortYUV* dstPicYuv, uint32_t partIdx, uint32_t width, uint32_t height);
+    void copyPartToPartLuma(TShortYUV* dstPicYuv, uint32_t partIdx, uint32_t width, uint32_t height);
+    void copyPartToPartChroma(TShortYUV* dstPicYuv, uint32_t partIdx, uint32_t width, uint32_t height);
+    void copyPartToPartChroma(TShortYUV* dstPicYuv, uint32_t partIdx, uint32_t iWidth, uint32_t iHeight, uint32_t chromaId);
 
-    void copyPartToPartYuv(TComYuv* dstPicYuv, unsigned int partIdx, unsigned int width, unsigned int height);
-    void copyPartToPartLuma(TComYuv* dstPicYuv, unsigned int partIdx, unsigned int width, unsigned int height);
-    void copyPartToPartChroma(TComYuv* dstPicYuv, unsigned int partIdx, unsigned int width, unsigned int height);
-    void copyPartToPartChroma(TComYuv* dstPicYuv, unsigned int partIdx, unsigned int width, unsigned int height, unsigned int chromaId);
+    void copyPartToPartYuv(TComYuv* dstPicYuv, uint32_t partIdx, uint32_t width, uint32_t height);
+    void copyPartToPartLuma(TComYuv* dstPicYuv, uint32_t partIdx, uint32_t width, uint32_t height);
+    void copyPartToPartChroma(TComYuv* dstPicYuv, uint32_t partIdx, uint32_t width, uint32_t height);
+    void copyPartToPartChroma(TComYuv* dstPicYuv, uint32_t partIdx, uint32_t width, uint32_t height, uint32_t chromaId);
 };
 }
 
diff -r 0666d56aaa42 -r 9bff4295adfc source/common/common.cpp
--- a/source/common/common.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/common/common.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -247,17 +247,17 @@
     return 1;
 }
 
-int x265_check_params(x265_param *param)
+uint32_t x265_check_params(x265_param *param)
 {
 #define CHECK(expr, msg) check_failed |= _confirm(param, expr, msg)
-    int check_failed = 0; /* abort if there is a fatal configuration problem */
+    uint32_t check_failed = 0; /* abort if there is a fatal configuration problem */
     uint32_t maxCUDepth = (uint32_t)g_convertToBit[param->maxCUSize];
     uint32_t tuQTMaxLog2Size = maxCUDepth + 2 - 1;
     uint32_t tuQTMinLog2Size = 2; //log2(4)
 
     CHECK(param->internalBitDepth > x265_max_bit_depth,
           "InternalBitDepth must be <= x265_max_bit_depth");
-    CHECK(param->rc.qp < -6 * (param->internalBitDepth - 8) || param->rc.qp > 51,
+    CHECK(param->rc.qp < -6 * (int)(param->internalBitDepth - 8) || param->rc.qp > 51,
           "QP exceeds supported range (-QpBDOffsety to 51)");
     CHECK(param->frameRate <= 0,
           "Frame rate must be more than 1");
@@ -456,7 +456,7 @@
     int valuewasnull;
 
     /* Enable or Disable - default is Enable */
-    int bvalue = 1;
+    uint32_t bvalue = 1;
 
     if (!name)
         return X265_PARAM_BAD_NAME;
@@ -476,42 +476,45 @@
 
 #define OPT(STR) else if (!strcmp(name, STR))
     if (0) ;
+
+#define CHECKSIGN(VAL, PARAM) if (atoi(VAL) >= 0) p->PARAM = (uint32_t)atoi(VAL); else return X265_PARAM_BAD_VALUE;
+
     OPT("fps")
-        p->frameRate = atoi(value);
+        CHECKSIGN(value, frameRate)
     OPT("csv")
         p->csvfn = value;
     OPT("threads")
-        p->poolNumThreads = atoi(value);
+        CHECKSIGN(value, poolNumThreads)
     OPT("frame-threads")
-        p->frameNumThreads = atoi(value);
+        CHECKSIGN(value, frameNumThreads)
     OPT("log")
         p->logLevel = atoi(value);
     OPT("wpp")
         p->bEnableWavefront = bvalue;
     OPT("ctu")
-        p->maxCUSize =(uint32_t) atoi(value);
+        CHECKSIGN(value, maxCUSize)
     OPT("tu-intra-depth")
-        p->tuQTMaxIntraDepth = (uint32_t) atoi(value);
+        CHECKSIGN(value, tuQTMaxIntraDepth)
     OPT("tu-inter-depth")
-        p->tuQTMaxInterDepth =(uint32_t) atoi(value);
+        CHECKSIGN(value, tuQTMaxInterDepth)
     OPT("me")
-        p->searchMethod = atoi(value);
+        CHECKSIGN(value, searchMethod)
     OPT("subme")
-        p->subpelRefine = atoi(value);
+        CHECKSIGN(value, subpelRefine)
     OPT("merange") 
-        p->searchRange = atoi(value);
+        CHECKSIGN(value, searchRange)
     OPT("rect")
         p->bEnableRectInter = bvalue;
     OPT("amp")
         p->bEnableAMP = bvalue;
     OPT("max-merge")
-        p->maxNumMergeCand = (uint32_t)atoi(value);
+        CHECKSIGN(value, maxNumMergeCand)
     OPT("early-skip")
         p->bEnableEarlySkip = bvalue;
     OPT("fast-cbf")
         p->bEnableCbfFastMode = bvalue;
     OPT("rdpenalty")
-        p->rdPenalty = atoi(value);
+        CHECKSIGN(value,rdPenalty)
     OPT("tskip")
         p->bEnableTransformSkip = bvalue;
     OPT("no-tskip-fast")
@@ -523,7 +526,7 @@
     OPT("constrained-intra")
         p->bEnableConstrainedIntra = bvalue;
     OPT("refresh")
-        p->decodingRefreshType = atoi(value);
+        CHECKSIGN(value, decodingRefreshType)
     OPT("keyint")
         p->keyframeMax = atoi(value);
     OPT("rc-lookahead")
@@ -533,13 +536,13 @@
     OPT("bframe-bias")
         p->bFrameBias = atoi(value);
     OPT("b-adapt")
-        p->bFrameAdaptive = atoi(value);
+        CHECKSIGN(value, bFrameAdaptive)
     OPT("ref")
         p->maxNumReferences = atoi(value);
     OPT("weightp")
         p->bEnableWeightedPred = bvalue;
     OPT("bitrate")
-        p->rc.bitrate = atoi(value);
+        CHECKSIGN(value, rc.bitrate)
     OPT("qp")
         p->rc.qp = atoi(value);
     OPT("cbqpoffs")
@@ -547,7 +550,7 @@
     OPT("crqpoffs")
         p->crQpOffset = atoi(value);
     OPT("rd")
-        p->rdLevel = atoi(value);
+        CHECKSIGN(value, rdLevel)
     OPT("signhide")
         p->bEnableSignHiding = bvalue;
     OPT("lft")
@@ -555,17 +558,18 @@
     OPT("sao")
         p->bEnableSAO = bvalue;
     OPT("sao-lcu-bounds")
-        p->saoLcuBoundary = atoi(value);
+        CHECKSIGN(value, saoLcuBoundary)
     OPT("sao-lcu-opt")
-        p->saoLcuBasedOptimization = atoi(value);
+        CHECKSIGN(value, saoLcuBasedOptimization)
     OPT("ssim")
         p->bEnableSsim = bvalue;
     OPT("psnr")
         p->bEnablePsnr = bvalue;
     OPT("hash")
-        p->decodedPictureHashSEI = atoi(value);
+        CHECKSIGN(value, decodedPictureHashSEI)
     else
         return X265_PARAM_BAD_NAME;
+#undef CHECKSIGN
 #undef OPT
 
     berror |= valuewasnull;
diff -r 0666d56aaa42 -r 9bff4295adfc source/common/common.h
--- a/source/common/common.h	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/common/common.h	Thu Oct 31 15:40:28 2013 +0530
@@ -112,7 +112,7 @@
 /* defined in common.cpp */
 int64_t x265_mdate(void);
 void x265_log(x265_param *param, int level, const char *fmt, ...);
-int  x265_check_params(x265_param *param);
+uint32_t  x265_check_params(x265_param *param);
 void x265_print_params(x265_param *param);
 int x265_set_globals(x265_param *param);
 int x265_exp2fix8(double x);
diff -r 0666d56aaa42 -r 9bff4295adfc source/common/dct.cpp
--- a/source/common/dct.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/common/dct.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -42,7 +42,7 @@
 
 // Fast DST Algorithm. Full matrix multiplication for DST and Fast DST algorithm
 // give identical results
-void fastForwardDst(int16_t *block, int16_t *coeff, int shift)  // input block, output coeff
+void fastForwardDst(int16_t *block, int16_t *coeff, uint32_t shift)  // input block, output coeff
 {
     int c[4];
     int rnd_factor = 1 << (shift - 1);
@@ -62,7 +62,7 @@
     }
 }
 
-void inversedst(int16_t *tmp, int16_t *block, int shift)  // input tmp, output block
+void inversedst(int16_t *tmp, int16_t *block, uint32_t shift)  // input tmp, output block
 {
     int i, c[4];
     int rnd_factor = 1 << (shift - 1);
@@ -82,9 +82,9 @@
     }
 }
 
-void partialButterfly16(int16_t *src, int16_t *dst, int shift, int line)
+void partialButterfly16(int16_t *src, int16_t *dst, uint32_t shift, uint32_t line)
 {
-    int j, k;
+    uint32_t j, k;
     int E[8], O[8];
     int EE[4], EO[4];
     int EEE[2], EEO[2];
@@ -135,9 +135,9 @@
     }
 }
 
-void partialButterfly32(int16_t *src, int16_t *dst, int shift, int line)
+void partialButterfly32(int16_t *src, int16_t *dst, uint32_t shift, uint32_t line)
 {
-    int j, k;
+    uint32_t j, k;
     int E[16], O[16];
     int EE[8], EO[8];
     int EEE[4], EEO[4];
@@ -204,9 +204,9 @@
     }
 }
 
-void partialButterfly8(int16_t *src, int16_t *dst, int shift, int line)
+void partialButterfly8(int16_t *src, int16_t *dst, uint32_t shift, uint32_t line)
 {
-    int j, k;
+    uint32_t j, k;
     int E[4], O[4];
     int EE[2], EO[2];
     int add = 1 << (shift - 1);
@@ -241,9 +241,9 @@
     }
 }
 
-void partialButterflyInverse4(int16_t *src, int16_t *dst, int shift, int line)
+void partialButterflyInverse4(int16_t *src, int16_t *dst, uint32_t shift, uint32_t line)
 {
-    int j;
+    uint32_t j;
     int E[2], O[2];
     int add = 1 << (shift - 1);
 
@@ -266,9 +266,9 @@
     }
 }
 
-void partialButterflyInverse8(int16_t *src, int16_t *dst, int shift, int line)
+void partialButterflyInverse8(int16_t *src, int16_t *dst, uint32_t shift, uint32_t line)
 {
-    int j, k;
+    uint32_t j, k;
     int E[4], O[4];
     int EE[2], EO[2];
     int add = 1 << (shift - 1);
@@ -302,9 +302,9 @@
     }
 }
 
-void partialButterflyInverse16(int16_t *src, int16_t *dst, int shift, int line)
+void partialButterflyInverse16(int16_t *src, int16_t *dst, uint32_t shift, uint32_t line)
 {
-    int j, k;
+    uint32_t j, k;
     int E[8], O[8];
     int EE[4], EO[4];
     int EEE[2], EEO[2];
@@ -353,9 +353,9 @@
     }
 }
 
-void partialButterflyInverse32(int16_t *src, int16_t *dst, int shift, int line)
+void partialButterflyInverse32(int16_t *src, int16_t *dst, uint32_t shift, uint32_t line)
 {
-    int j, k;
+    uint32_t j, k;
     int E[16], O[16];
     int EE[8], EO[8];
     int EEE[4], EEO[4];
@@ -417,9 +417,9 @@
     }
 }
 
-void partialButterfly4(int16_t *src, int16_t *dst, int shift, int line)
+void partialButterfly4(int16_t *src, int16_t *dst, uint32_t shift, uint32_t line)
 {
-    int j;
+    uint32_t j;
     int E[2], O[2];
     int add = 1 << (shift - 1);
 
@@ -443,8 +443,8 @@
 
 void dst4_c(int16_t *src, int32_t *dst, intptr_t stride)
 {
-    const int shift_1st = 1;
-    const int shift_2nd = 8;
+    const uint32_t shift_1st = 1;
+    const uint32_t shift_2nd = 8;
 
     ALIGN_VAR_32(int16_t, coef[4 * 4]);
     ALIGN_VAR_32(int16_t, block[4 * 4]);
@@ -458,9 +458,9 @@
     fastForwardDst(coef, block, shift_2nd);
 
 #define N (4)
-    for (int i = 0; i < N; i++)
+    for (uint32_t i = 0; i < N; i++)
     {
-        for (int j = 0; j < N; j++)
+        for (uint32_t j = 0; j < N; j++)
         {
             dst[i * N + j] = block[i * N + j];
         }
@@ -471,13 +471,13 @@
 
 void dct4_c(int16_t *src, int32_t *dst, intptr_t stride)
 {
-    const int shift_1st = 1;
-    const int shift_2nd = 8;
+    const uint32_t shift_1st = 1;
+    const uint32_t shift_2nd = 8;
 
     ALIGN_VAR_32(int16_t, coef[4 * 4]);
     ALIGN_VAR_32(int16_t, block[4 * 4]);
 
-    for (int i = 0; i < 4; i++)
+    for (uint32_t i = 0; i < 4; i++)
     {
         memcpy(&block[i * 4], &src[i * stride], 4 * sizeof(int16_t));
     }
@@ -485,9 +485,9 @@
     partialButterfly4(block, coef, shift_1st, 4);
     partialButterfly4(coef, block, shift_2nd, 4);
 #define N (4)
-    for (int i = 0; i < N; i++)
+    for (uint32_t i = 0; i < N; i++)
     {
-        for (int j = 0; j < N; j++)
+        for (uint32_t j = 0; j < N; j++)
         {
             dst[i * N + j] = block[i * N + j];
         }
@@ -498,13 +498,13 @@
 
 void dct8_c(int16_t *src, int32_t *dst, intptr_t stride)
 {
-    const int shift_1st = 2;
-    const int shift_2nd = 9;
+    const uint32_t shift_1st = 2;
+    const uint32_t shift_2nd = 9;
 
     ALIGN_VAR_32(int16_t, coef[8 * 8]);
     ALIGN_VAR_32(int16_t, block[8 * 8]);
 
-    for (int i = 0; i < 8; i++)
+    for (uint32_t i = 0; i < 8; i++)
     {
         memcpy(&block[i * 8], &src[i * stride], 8 * sizeof(int16_t));
     }
@@ -513,9 +513,9 @@
     partialButterfly8(coef, block, shift_2nd, 8);
 
 #define N (8)
-    for (int i = 0; i < N; i++)
+    for (uint32_t i = 0; i < N; i++)
     {
-        for (int j = 0; j < N; j++)
+        for (uint32_t j = 0; j < N; j++)
         {
             dst[i * N + j] = block[i * N + j];
         }
@@ -526,13 +526,13 @@
 
 void dct16_c(int16_t *src, int32_t *dst, intptr_t stride)
 {
-    const int shift_1st = 3;
-    const int shift_2nd = 10;
+    const uint32_t shift_1st = 3;
+    const uint32_t shift_2nd = 10;
 
     ALIGN_VAR_32(int16_t, coef[16 * 16]);
     ALIGN_VAR_32(int16_t, block[16 * 16]);
 
-    for (int i = 0; i < 16; i++)
+    for (uint32_t i = 0; i < 16; i++)
     {
         memcpy(&block[i * 16], &src[i * stride], 16 * sizeof(int16_t));
     }
@@ -541,9 +541,9 @@
     partialButterfly16(coef, block, shift_2nd, 16);
 
 #define N (16)
-    for (int i = 0; i < N; i++)
+    for (uint32_t i = 0; i < N; i++)
     {
-        for (int j = 0; j < N; j++)
+        for (uint32_t j = 0; j < N; j++)
         {
             dst[i * N + j] = block[i * N + j];
         }
@@ -554,8 +554,8 @@
 
 void dct32_c(int16_t *src, int32_t *dst, intptr_t stride)
 {
-    const int shift_1st = 4;
-    const int shift_2nd = 11;
+    const uint32_t shift_1st = 4;
+    const uint32_t shift_2nd = 11;
 
     ALIGN_VAR_32(int16_t, coef[32 * 32]);
     ALIGN_VAR_32(int16_t, block[32 * 32]);
@@ -569,9 +569,9 @@
     partialButterfly32(coef, block, shift_2nd, 32);
 
 #define N (32)
-    for (int i = 0; i < N; i++)
+    for (uint32_t i = 0; i < N; i++)
     {
-        for (int j = 0; j < N; j++)
+        for (uint32_t j = 0; j < N; j++)
         {
             dst[i * N + j] = block[i * N + j];
         }
@@ -582,16 +582,16 @@
 
 void idst4_c(int32_t *src, int16_t *dst, intptr_t stride)
 {
-    const int shift_1st = 7;
-    const int shift_2nd = 12;
+    const uint32_t shift_1st = 7;
+    const uint32_t shift_2nd = 12;
 
     ALIGN_VAR_32(int16_t, coef[4 * 4]);
     ALIGN_VAR_32(int16_t, block[4 * 4]);
 
 #define N (4)
-    for (int i = 0; i < N; i++)
+    for (uint32_t i = 0; i < N; i++)
     {
-        for (int j = 0; j < N; j++)
+        for (uint32_t j = 0; j < N; j++)
         {
             block[i * N + j] = (int16_t)src[i * N + j];
         }
@@ -602,7 +602,7 @@
     inversedst(block, coef, shift_1st); // Forward DST BY FAST ALGORITHM, block input, coef output
     inversedst(coef, block, shift_2nd); // Forward DST BY FAST ALGORITHM, coef input, coeff output
 
-    for (int i = 0; i < 4; i++)
+    for (uint32_t i = 0; i < 4; i++)
     {
         memcpy(&dst[i * stride], &block[i * 4], 4 * sizeof(int16_t));
     }
@@ -610,16 +610,16 @@
 
 void idct4_c(int32_t *src, int16_t *dst, intptr_t stride)
 {
-    const int shift_1st = 7;
-    const int shift_2nd = 12;
+    const uint32_t shift_1st = 7;
+    const uint32_t shift_2nd = 12;
 
     ALIGN_VAR_32(int16_t, coef[4 * 4]);
     ALIGN_VAR_32(int16_t, block[4 * 4]);
 
 #define N (4)
-    for (int i = 0; i < N; i++)
+    for (uint32_t i = 0; i < N; i++)
     {
-        for (int j = 0; j < N; j++)
+        for (uint32_t j = 0; j < N; j++)
         {
             block[i * N + j] = (int16_t)src[i * N + j];
         }
@@ -630,7 +630,7 @@
     partialButterflyInverse4(block, coef, shift_1st, 4); // Forward DST BY FAST ALGORITHM, block input, coef output
     partialButterflyInverse4(coef, block, shift_2nd, 4); // Forward DST BY FAST ALGORITHM, coef input, coeff output
 
-    for (int i = 0; i < 4; i++)
+    for (uint32_t i = 0; i < 4; i++)
     {
         memcpy(&dst[i * stride], &block[i * 4], 4 * sizeof(int16_t));
     }
@@ -638,16 +638,16 @@
 
 void idct8_c(int32_t *src, int16_t *dst, intptr_t stride)
 {
-    const int shift_1st = 7;
-    const int shift_2nd = 12;
+    const uint32_t shift_1st = 7;
+    const uint32_t shift_2nd = 12;
 
     ALIGN_VAR_32(int16_t, coef[8 * 8]);
     ALIGN_VAR_32(int16_t, block[8 * 8]);
 
 #define N (8)
-    for (int i = 0; i < N; i++)
+    for (uint32_t i = 0; i < N; i++)
     {
-        for (int j = 0; j < N; j++)
+        for (uint32_t j = 0; j < N; j++)
         {
             block[i * N + j] = (int16_t)src[i * N + j];
         }
@@ -657,7 +657,7 @@
 
     partialButterflyInverse8(block, coef, shift_1st, 8);
     partialButterflyInverse8(coef, block, shift_2nd, 8);
-    for (int i = 0; i < 8; i++)
+    for (uint32_t i = 0; i < 8; i++)
     {
         memcpy(&dst[i * stride], &block[i * 8], 8 * sizeof(int16_t));
     }
@@ -665,16 +665,16 @@
 
 void idct16_c(int32_t *src, int16_t *dst, intptr_t stride)
 {
-    const int shift_1st = 7;
-    const int shift_2nd = 12;
+    const uint32_t shift_1st = 7;
+    const uint32_t shift_2nd = 12;
 
     ALIGN_VAR_32(int16_t, coef[16 * 16]);
     ALIGN_VAR_32(int16_t, block[16 * 16]);
 
 #define N (16)
-    for (int i = 0; i < N; i++)
+    for (uint32_t i = 0; i < N; i++)
     {
-        for (int j = 0; j < N; j++)
+        for (uint32_t j = 0; j < N; j++)
         {
             block[i * N + j] = (int16_t)src[i * N + j];
         }
@@ -684,7 +684,7 @@
 
     partialButterflyInverse16(block, coef, shift_1st, 16);
     partialButterflyInverse16(coef, block, shift_2nd, 16);
-    for (int i = 0; i < 16; i++)
+    for (uint32_t i = 0; i < 16; i++)
     {
         memcpy(&dst[i * stride], &block[i * 16], 16 * sizeof(int16_t));
     }
@@ -692,16 +692,16 @@
 
 void idct32_c(int32_t *src, int16_t *dst, intptr_t stride)
 {
-    const int shift_1st = 7;
-    const int shift_2nd = 12;
+    const uint32_t shift_1st = 7;
+    const uint32_t shift_2nd = 12;
 
     ALIGN_VAR_32(int16_t, coef[32 * 32]);
     ALIGN_VAR_32(int16_t, block[32 * 32]);
 
 #define N (32)
-    for (int i = 0; i < N; i++)
+    for (uint32_t i = 0; i < N; i++)
     {
-        for (int j = 0; j < N; j++)
+        for (uint32_t j = 0; j < N; j++)
         {
             block[i * N + j] = (int16_t)src[i * N + j];
         }
@@ -712,13 +712,13 @@
     partialButterflyInverse32(block, coef, shift_1st, 32);
     partialButterflyInverse32(coef, block, shift_2nd, 32);
 
-    for (int i = 0; i < 32; i++)
+    for (uint32_t i = 0; i < 32; i++)
     {
         memcpy(&dst[i * stride], &block[i * 32], 32 * sizeof(int16_t));
     }
 }
 
-void dequant_c(const int32_t* quantCoef, int32_t* coef, int width, int height, int per, int rem, bool useScalingList, unsigned int log2TrSize, int32_t *dequantCoef)
+void dequant_c(const int32_t* quantCoef, int32_t* coef, uint32_t width, uint32_t height, int per, int rem, bool useScalingList, uint32_t log2TrSize, int32_t *dequantCoef)
 {
     int invQuantScales[6] = { 40, 45, 51, 57, 64, 72 };
 
@@ -742,7 +742,7 @@
         {
             add = 1 << (shift - per - 1);
 
-            for (int n = 0; n < width * height; n++)
+            for (uint32_t n = 0; n < width * height; n++)
             {
                 clipQCoef = Clip3(-32768, 32767, quantCoef[n]);
                 coeffQ = ((clipQCoef * dequantCoef[n]) + add) >> (shift - per);
@@ -751,7 +751,7 @@
         }
         else
         {
-            for (int n = 0; n < width * height; n++)
+            for (uint32_t n = 0; n < width * height; n++)
             {
                 clipQCoef = Clip3(-32768, 32767, quantCoef[n]);
                 coeffQ   = Clip3(-32768, 32767, clipQCoef * dequantCoef[n]);
@@ -764,7 +764,7 @@
         add = 1 << (shift - 1);
         int scale = invQuantScales[rem] << per;
 
-        for (int n = 0; n < width * height; n++)
+        for (uint32_t n = 0; n < width * height; n++)
         {
             clipQCoef = Clip3(-32768, 32767, quantCoef[n]);
             coeffQ = (clipQCoef * scale + add) >> shift;
@@ -773,12 +773,12 @@
     }
 }
 
-uint32_t quant_c(int32_t* coef, int32_t* quantCoeff, int32_t* deltaU, int32_t* qCoef, int qBits, int add, int numCoeff, int32_t* lastPos)
+uint32_t quant_c(int32_t* coef, int32_t* quantCoeff, int32_t* deltaU, int32_t* qCoef, int qBits, int add, uint32_t numCoeff, int32_t* lastPos)
 {
     int qBits8 = qBits - 8;
     uint32_t acSum = 0;
 
-    for (int blockpos = 0; blockpos < numCoeff; blockpos++)
+    for (uint32_t blockpos = 0; blockpos < numCoeff; blockpos++)
     {
         int level;
         int sign;
diff -r 0666d56aaa42 -r 9bff4295adfc source/common/intrapred.cpp
--- a/source/common/intrapred.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/common/intrapred.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -44,7 +44,7 @@
 namespace {
 pixel predIntraGetPredValDC(pixel* above, pixel* left, intptr_t width)
 {
-    int w, sum = 0;
+    uint32_t w, sum = 0;
     pixel pDcVal;
 
     for (w = 0; w < width; w++)
@@ -62,7 +62,7 @@
     return pDcVal;
 }
 
-void DCPredFiltering(pixel* above, pixel* left, pixel* dst, intptr_t dststride, int width, int height)
+void DCPredFiltering(pixel* above, pixel* left, pixel* dst, intptr_t dststride, uint32_t width, uint32_t height)
 {
     intptr_t x, y, dstride2;
 
@@ -80,10 +80,10 @@
     }
 }
 
-void PredIntraDC(pixel* above, pixel* left, pixel* dst, intptr_t dstStride, int width, int bFilter)
+void PredIntraDC(pixel* above, pixel* left, pixel* dst, intptr_t dstStride, uint32_t width, int bFilter)
 {
-    int k, l;
-    int blkSize = width;
+    uint32_t k, l;
+    uint32_t blkSize = width;
 
     // Do the DC prediction
     pixel dcval = (pixel)predIntraGetPredValDC(above, left, width);
@@ -102,19 +102,19 @@
     }
 }
 
-void PredIntraPlanar(pixel* above, pixel* left, pixel* dst, intptr_t dstStride, int width)
+void PredIntraPlanar(pixel* above, pixel* left, pixel* dst, intptr_t dstStride, uint32_t width)
 {
     //assert(width == height);
 
-    int k, l;
+    uint32_t k, l;
     pixel bottomLeft, topRight;
     int horPred;
     // OPT_ME: when width is 64, the shift1D is 8, then the dynamic range is 17 bits or [-65280, 65280], so we have to use 32 bits here
     int32_t leftColumn[MAX_CU_SIZE + 1], topRow[MAX_CU_SIZE + 1];
     // CHECK_ME: dynamic range is 9 bits or 15 bits(I assume max input bit_depth is 14 bits)
     int16_t bottomRow[MAX_CU_SIZE], rightColumn[MAX_CU_SIZE];
-    int blkSize = width;
-    int offset2D = width;
+    uint32_t blkSize = width;
+    uint32_t offset2D = width;
     int shift1D = g_convertToBit[width] + 2;
     int shift2D = shift1D + 1;
 
@@ -139,7 +139,7 @@
     // Generate prediction signal
     for (k = 0; k < blkSize; k++)
     {
-        horPred = leftColumn[k] + offset2D;
+        horPred = leftColumn[k] + (int32_t)offset2D;
         for (l = 0; l < blkSize; l++)
         {
             horPred += rightColumn[k];
@@ -149,17 +149,17 @@
     }
 }
 
-void PredIntraAngBufRef(pixel* dst, int dstStride, int width, int dirMode, bool bFilter, pixel *refLeft, pixel *refAbove)
+void PredIntraAngBufRef(pixel* dst, intptr_t dstStride, uint32_t width, uint32_t dirMode, bool bFilter, pixel *refLeft, pixel *refAbove)
 {
     int k, l;
-    int blkSize  = width;
+    int blkSize  = (int)width;
 
     // Map the mode index to main prediction direction and angle
     assert(dirMode > 1); //no planar and dc
     bool modeHor       = (dirMode < 18);
     bool modeVer       = !modeHor;
     int intraPredAngle = modeVer ? (int)dirMode - VER_IDX : modeHor ? -((int)dirMode - HOR_IDX) : 0;
-    int absAng         = abs(intraPredAngle);
+    uint32_t absAng         = abs(intraPredAngle);
     int signAng        = intraPredAngle < 0 ? -1 : 1;
 
     // Set bitshifts and scale the angle parameter to block size
@@ -262,10 +262,10 @@
     }
 }
 
-template<int size>
+template<uint32_t size>
 void PredIntraAngs_C(pixel *Dst0, pixel *pAbove0, pixel *pLeft0, pixel *pAbove1, pixel *pLeft1, bool bLuma)
 {
-    int iMode;
+    uint32_t iMode;
 
     for (iMode = 2; iMode <= 34; iMode++)
     {
@@ -281,9 +281,9 @@
         if (modeHor)
         {
             pixel  tmp;
-            for (int k = 0; k < size - 1; k++)
+            for (uint32_t k = 0; k < size - 1; k++)
             {
-                for (int l = k + 1; l < size; l++)
+                for (uint32_t l = k + 1; l < size; l++)
                 {
                     tmp                = dst[k * size + l];
                     dst[k * size + l] = dst[l * size + k];
diff -r 0666d56aaa42 -r 9bff4295adfc source/common/ipfilter.cpp
--- a/source/common/ipfilter.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/common/ipfilter.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -150,7 +150,7 @@
     }
 }
 
-template<int N>
+template<uint32_t N>
 void filterVertical_ps_c(pixel *src, intptr_t srcStride, int16_t *dst, intptr_t dstStride, int width, int height, int16_t const *c)
 {
     int headRoom = IF_INTERNAL_PREC - X265_DEPTH;
@@ -186,7 +186,7 @@
     }
 }
 
-template<int N>
+template<uint32_t N>
 void filterHorizontal_ps_c(pixel *src, intptr_t srcStride, int16_t *dst, intptr_t dstStride, int width, int height, int16_t const *coeff)
 {
     int headRoom = IF_INTERNAL_PREC - X265_DEPTH;
diff -r 0666d56aaa42 -r 9bff4295adfc source/common/lowres.cpp
--- a/source/common/lowres.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/common/lowres.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -27,7 +27,7 @@
 
 using namespace x265;
 
-void Lowres::create(TComPic *pic, int bframes, int32_t *aqMode)
+void Lowres::create(TComPic *pic, uint32_t bframes, int32_t *aqMode)
 {
     TComPicYuv *orig = pic->getPicYuvOrg();
 
@@ -54,7 +54,7 @@
     }
 
     /* allocate lowres buffers */
-    for (int i = 0; i < 4; i++)
+    for (uint32_t i = 0; i < 4; i++)
     {
         buffer[i] = (Pel*)X265_MALLOC(Pel, lumaStride * (lines + 2 * orig->getLumaMarginY()));
     }
@@ -67,16 +67,16 @@
 
     intraCost = (int32_t*)X265_MALLOC(int, cuCount);
 
-    for (int i = 0; i < bframes + 2; i++)
+    for (uint32_t i = 0; i < bframes + 2; i++)
     {
-        for (int j = 0; j < bframes + 2; j++)
+        for (uint32_t j = 0; j < bframes + 2; j++)
         {
             rowSatds[i][j] = (int32_t*)X265_MALLOC(int, cuHeight);
             lowresCosts[i][j] = (uint16_t*)X265_MALLOC(uint16_t, cuCount);
         }
     }
 
-    for (int i = 0; i < bframes + 1; i++)
+    for (uint32_t i = 0; i < bframes + 1; i++)
     {
         lowresMvs[0][i] = (MV*)X265_MALLOC(MV, cuCount);
         lowresMvs[1][i] = (MV*)X265_MALLOC(MV, cuCount);
@@ -85,25 +85,25 @@
     }
 }
 
-void Lowres::destroy(int bframes)
+void Lowres::destroy(uint32_t bframes)
 {
-    for (int i = 0; i < 4; i++)
+    for (uint32_t i = 0; i < 4; i++)
     {
         X265_FREE(buffer[i]);
     }
 
     X265_FREE(intraCost);
 
-    for (int i = 0; i < bframes + 2; i++)
+    for (uint32_t i = 0; i < bframes + 2; i++)
     {
-        for (int j = 0; j < bframes + 2; j++)
+        for (uint32_t j = 0; j < bframes + 2; j++)
         {
             X265_FREE(rowSatds[i][j]);
             X265_FREE(lowresCosts[i][j]);
         }
     }
 
-    for (int i = 0; i < bframes + 1; i++)
+    for (uint32_t i = 0; i < bframes + 1; i++)
     {
         X265_FREE(lowresMvs[0][i]);
         X265_FREE(lowresMvs[1][i]);
@@ -115,7 +115,7 @@
 }
 
 // (re) initialize lowres state
-void Lowres::init(TComPicYuv *orig, int poc, int type, int bframes)
+void Lowres::init(TComPicYuv *orig, int poc, int type, uint32_t bframes)
 {
     bScenecut = true;
     bIntraCalculated = false;
@@ -130,27 +130,27 @@
     if (m_qpAqOffset && m_invQscaleFactor)
         memset(costEstAq, -1, sizeof(costEstAq));
 
-    for (int y = 0; y < bframes + 2; y++)
+    for (uint32_t y = 0; y < bframes + 2; y++)
     {
-        for (int x = 0; x < bframes + 2; x++)
+        for (uint32_t x = 0; x < bframes + 2; x++)
         {
             rowSatds[y][x][0] = -1;
         }
     }
 
-    for (int i = 0; i < bframes + 1; i++)
+    for (uint32_t i = 0; i < bframes + 1; i++)
     {
         lowresMvs[0][i][0].x = 0x7FFF;
         lowresMvs[1][i][0].x = 0x7FFF;
     }
 
-    for (int i = 0; i < bframes + 2; i++)
+    for (uint32_t i = 0; i < bframes + 2; i++)
     {
         intraMbs[i] = 0;
     }
 
     int y, extWidth = (orig->getWidth() + X265_LOWRES_CU_SIZE - 1);
-    int srcStride = orig->getStride();
+    intptr_t srcStride = orig->getStride();
     int srcHeight = orig->getHeight();
     int srcWidth  = orig->getWidth();
     Pel *src;
diff -r 0666d56aaa42 -r 9bff4295adfc source/common/lowres.h
--- a/source/common/lowres.h	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/common/lowres.h	Thu Oct 31 15:40:28 2013 +0530
@@ -41,7 +41,7 @@
     int    lines;     // height of lowres frame in pixel lines
     int    frameNum;  // Presentation frame number
     int    sliceType; // Slice type decided by lookahead
-    int    leadingBframes; // number of leading B frames for P or I
+    uint32_t    leadingBframes; // number of leading B frames for P or I
 
     bool   bIntraCalculated;
     bool   bScenecut; // Set to false if the frame cannot possibly be part of a real scenecut.
@@ -59,9 +59,9 @@
     int32_t      *lowresMvCosts[2][X265_BFRAME_MAX + 1];
     MV       *lowresMvs[2][X265_BFRAME_MAX + 1];
 
-    void create(TComPic *pic, int bframes, int32_t *aqMode);
-    void destroy(int bframes);
-    void init(TComPicYuv *orig, int poc, int sliceType, int bframes);
+    void create(TComPic *pic, uint32_t bframes, int32_t *aqMode);
+    void destroy(uint32_t bframes);
+    void init(TComPicYuv *orig, int poc, int sliceType, uint32_t bframes);
 };
 }
 
diff -r 0666d56aaa42 -r 9bff4295adfc source/common/md5.cpp
--- a/source/common/md5.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/common/md5.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -31,15 +31,15 @@
 #ifndef ARCH_BIG_ENDIAN
 #define byteReverse(buf, len)   /* Nothing */
 #else
-static void byteReverse(uint8_t_t *buf, unsigned int nSize)
+static void byteReverse(uint8_t_t *buf, uint32_t nSize)
 {
-    int i;
+    uint32_t i;
     uint32_t tmp;
 
     for (i = 0; i < nSize; i++)
     {
-        tmp = ((unsigned int)buf[3] << 8 | buf[2]) << 16 |
-            ((unsigned int)buf[1] << 8 | buf[0]);
+        tmp = ((uint32_t)buf[3] << 8 | buf[2]) << 16 |
+            ((uint32_t)buf[1] << 8 | buf[0]);
         *(uint32_t*)buf = tmp;
         buf += 4;
     }
diff -r 0666d56aaa42 -r 9bff4295adfc source/common/mv.h
--- a/source/common/mv.h	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/common/mv.h	Thu Oct 31 15:40:28 2013 +0530
@@ -110,7 +110,7 @@
 
     bool isWeighted;
     bool isLowres;
-    int  lumaStride;
+    intptr_t  lumaStride;
     int  weight;
     int  offset;
     int  shift;
diff -r 0666d56aaa42 -r 9bff4295adfc source/common/pixel.cpp
--- a/source/common/pixel.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/common/pixel.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -469,7 +469,7 @@
 }
 
 template<int blockSize>
-void getResidual(pixel *fenc, pixel *pred, int16_t *residual, int stride)
+void getResidual(pixel *fenc, pixel *pred, int16_t *residual, intptr_t stride)
 {
     for (int uiY = 0; uiY < blockSize; uiY++)
     {
@@ -485,7 +485,7 @@
 }
 
 template<int blockSize>
-void calcRecons(pixel* pred, int16_t* residual, pixel* recon, int16_t* recqt, pixel* recipred, int stride, int qtstride, int ipredstride)
+void calcRecons(pixel* pred, int16_t* residual, pixel* recon, int16_t* recqt, pixel* recipred, intptr_t stride, int qtstride, int ipredstride)
 {
     for (int uiY = 0; uiY < blockSize; uiY++)
     {
@@ -552,11 +552,11 @@
     }
 }
 
-void pixelsub_sp_c(int bx, int by, int16_t *a, intptr_t dstride, pixel *b0, pixel *b1, intptr_t sstride0, intptr_t sstride1)
+void pixelsub_sp_c(uint32_t bx, uint32_t by, int16_t *a, intptr_t dstride, pixel *b0, pixel *b1, intptr_t sstride0, intptr_t sstride1)
 {
-    for (int y = 0; y < by; y++)
+    for (uint32_t y = 0; y < by; y++)
     {
-        for (int x = 0; x < bx; x++)
+        for (uint32_t x = 0; x < bx; x++)
         {
             a[x] = (int16_t)(b0[x] - b1[x]);
         }
diff -r 0666d56aaa42 -r 9bff4295adfc source/common/primitives.h
--- a/source/common/primitives.h	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/common/primitives.h	Thu Oct 31 15:40:28 2013 +0530
@@ -173,15 +173,15 @@
 typedef void (*blockcpy_sp_t)(int bx, int by, int16_t *dst, intptr_t dstride, pixel *src, intptr_t sstride); // dst is aligned
 typedef void (*blockcpy_ps_t)(int bx, int by, pixel *dst, intptr_t dstride, int16_t *src, intptr_t sstride); // dst is aligned
 typedef void (*blockcpy_sc_t)(int bx, int by, int16_t *dst, intptr_t dstride, uint8_t *src, intptr_t sstride); // dst is aligned
-typedef void (*pixelsub_sp_t)(int bx, int by, int16_t *dst, intptr_t dstride, pixel *src0, pixel *src1, intptr_t sstride0, intptr_t sstride1);
+typedef void (*pixelsub_sp_t)(uint32_t bx, uint32_t by, int16_t *dst, intptr_t dstride, pixel *src0, pixel *src1, intptr_t sstride0, intptr_t sstride1);
 typedef void (*pixeladd_ss_t)(int bx, int by, int16_t *dst, intptr_t dstride, int16_t *src0, int16_t *src1, intptr_t sstride0, intptr_t sstride1);
 typedef void (*pixeladd_pp_t)(int bx, int by, pixel *dst, intptr_t dstride, pixel *src0, pixel *src1, intptr_t sstride0, intptr_t sstride1);
 typedef void (*pixelavg_pp_t)(pixel *dst, intptr_t dstride, pixel *src0, intptr_t sstride0, pixel *src1, intptr_t sstride1, int weight);
 typedef void (*blockfill_s_t)(int16_t *dst, intptr_t dstride, int16_t val);
 
-typedef void (*intra_dc_t)(pixel* above, pixel* left, pixel* dst, intptr_t dstStride, int width, int bFilter);
-typedef void (*intra_planar_t)(pixel* above, pixel* left, pixel* dst, intptr_t dstStride, int width);
-typedef void (*intra_ang_t)(pixel* dst, int dstStride, int width, int dirMode, bool bFilter, pixel *refLeft, pixel *refAbove);
+typedef void (*intra_dc_t)(pixel* above, pixel* left, pixel* dst, intptr_t dstStride, uint32_t width, int bFilter);
+typedef void (*intra_planar_t)(pixel* above, pixel* left, pixel* dst, intptr_t dstStride, uint32_t width);
+typedef void (*intra_ang_t)(pixel* dst, intptr_t dstStride, uint32_t width, uint32_t dirMode, bool bFilter, pixel *refLeft, pixel *refAbove);
 typedef void (*intra_allangs_t)(pixel *dst, pixel *above0, pixel *left0, pixel *above1, pixel *left1, bool bLuma);
 
 typedef void (*cvt16to32_shl_t)(int32_t *dst, int16_t *src, intptr_t, int, int);
@@ -190,12 +190,12 @@
 
 typedef void (*dct_t)(int16_t *src, int32_t *dst, intptr_t stride);
 typedef void (*idct_t)(int32_t *src, int16_t *dst, intptr_t stride);
-typedef void (*calcresidual_t)(pixel *fenc, pixel *pred, int16_t *residual, int stride);
-typedef void (*calcrecon_t)(pixel* pred, int16_t* residual, pixel* recon, int16_t* reconqt, pixel *reconipred, int stride, int strideqt, int strideipred);
+typedef void (*calcresidual_t)(pixel *fenc, pixel *pred, int16_t *residual, intptr_t stride);
+typedef void (*calcrecon_t)(pixel* pred, int16_t* residual, pixel* recon, int16_t* reconqt, pixel *reconipred, intptr_t stride, int strideqt, int strideipred);
 typedef void (*transpose_t)(pixel* dst, pixel* src, intptr_t stride);
-typedef uint32_t (*quant_t)(int32_t *coef, int32_t *quantCoeff, int32_t *deltaU, int32_t *qCoef, int qBits, int add, int numCoeff, int32_t* lastPos);
-typedef void (*dequant_t)(const int32_t* src, int32_t* dst, int width, int height, int mcqp_miper, int mcqp_mirem, bool useScalingList,
-                          unsigned int trSizeLog2, int32_t *dequantCoef);
+typedef uint32_t (*quant_t)(int32_t *coef, int32_t *quantCoeff, int32_t *deltaU, int32_t *qCoef, int qBits, int add, uint32_t numCoeff, int32_t* lastPos);
+typedef void (*dequant_t)(const int32_t* src, int32_t* dst, uint32_t width, uint32_t height, int mcqp_miper, int mcqp_mirem, bool useScalingList,
+                          uint32_t trSizeLog2, int32_t *dequantCoef);
 
 typedef void (*weightpUniPixel_t)(pixel *src, pixel *dst, intptr_t srcStride, intptr_t dstStride, int width, int height, int w0, int round, int shift, int offset);
 typedef void (*weightpUni_t)(int16_t *src, pixel *dst, intptr_t srcStride, intptr_t dstStride, int width, int height, int w0, int round, int shift, int offset);
diff -r 0666d56aaa42 -r 9bff4295adfc source/common/vec/blockcopy-sse3.cpp
--- a/source/common/vec/blockcopy-sse3.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/common/vec/blockcopy-sse3.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -245,16 +245,16 @@
     }
 }
 
-void pixelsub_sp(int bx, int by, int16_t *dst, intptr_t dstride, uint8_t *src0, uint8_t *src1, intptr_t sstride0, intptr_t sstride1)
+void pixelsub_sp(uint32_t bx, uint32_t by, int16_t *dst, intptr_t dstride, uint8_t *src0, uint8_t *src1, intptr_t sstride0, intptr_t sstride1)
 {
     size_t aligncheck = (size_t)dst | (size_t)src0 | bx | sstride0 | sstride1 | dstride;
 
     if (!(aligncheck & 15))
     {
         // fast path, multiples of 16 pixel wide blocks
-        for (int y = 0; y < by; y++)
+        for (uint32_t y = 0; y < by; y++)
         {
-            for (int x = 0; x < bx; x += 16)
+            for (uint32_t x = 0; x < bx; x += 16)
             {
                 __m128i word0, word1;
                 __m128i word3, word4;
@@ -280,9 +280,9 @@
     else
     {
         // slow path, irregular memory alignments or sizes
-        for (int y = 0; y < by; y++)
+        for (uint32_t y = 0; y < by; y++)
         {
-            for (int x = 0; x < bx; x++)
+            for (uint32_t x = 0; x < bx; x++)
             {
                 dst[x] = (int16_t)(src0[x] - src1[x]);
             }
diff -r 0666d56aaa42 -r 9bff4295adfc source/common/vec/dct-sse41.cpp
--- a/source/common/vec/dct-sse41.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/common/vec/dct-sse41.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -46,7 +46,7 @@
                int32_t* qCoef,
                int  qBits,
                int  add,
-               int  numCoeff,
+               uint32_t  numCoeff,
                int32_t* lastPos)
 {
     int qBits8 = qBits - 8;
@@ -58,7 +58,7 @@
     __m128i posNext4 = _mm_set1_epi32(4);
     __m128i lastPos4 = _mm_set1_epi32(-1);
 
-    for (int blockpos = 0; blockpos < numCoeff; blockpos += 8)
+    for (uint32_t blockpos = 0; blockpos < numCoeff; blockpos += 8)
     {
         __m128i maskZero;
         __m128i level1 = _mm_loadu_si128((__m128i*)(coef + blockpos));
@@ -117,7 +117,7 @@
     return acSum;
 }
 
-void dequant(const int32_t* quantCoef, int32_t* coef, int width, int height, int per, int rem, bool useScalingList, unsigned int log2TrSize, int32_t *deQuantCoef)
+void dequant(const int32_t* quantCoef, int32_t* coef, uint32_t width, uint32_t height, int per, int rem, bool useScalingList, uint32_t log2TrSize, int32_t *deQuantCoef)
 {
     int invQuantScales[6] = { 40, 45, 51, 57, 64, 72 };
 
@@ -140,7 +140,7 @@
             valueToAdd = 1 << (shift - per - 1);
             __m128i IAdd = _mm_set1_epi32(valueToAdd);
 
-            for (int n = 0; n < width * height; n = n + 8)
+            for (uint32_t n = 0; n < width * height; n = n + 8)
             {
                 __m128i quantCoef1, quantCoef2, deQuantCoef1, deQuantCoef2, quantCoef12, sign;
 
@@ -168,7 +168,7 @@
         }
         else
         {
-            for (int n = 0; n < width * height; n = n + 8)
+            for (uint32_t n = 0; n < width * height; n = n + 8)
             {
                 __m128i quantCoef1, quantCoef2, deQuantCoef1, deQuantCoef2, quantCoef12, sign;
 
@@ -211,7 +211,7 @@
         __m128i vScale = _mm_set1_epi32(scale);
         __m128i vAdd = _mm_set1_epi32(valueToAdd);
 
-        for (int n = 0; n < width * height; n = n + 8)
+        for (uint32_t n = 0; n < width * height; n = n + 8)
         {
             __m128i quantCoef1, quantCoef2, quantCoef12, sign;
 
diff -r 0666d56aaa42 -r 9bff4295adfc source/common/vec/intra-sse41.cpp
--- a/source/common/vec/intra-sse41.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/common/vec/intra-sse41.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -102,7 +102,7 @@
     }
 }
 
-void intra_pred_dc(pixel* above, pixel* left, pixel* dst, intptr_t dstStride, int width, int filter)
+void intra_pred_dc(pixel* above, pixel* left, pixel* dst, intptr_t dstStride, uint32_t width, int filter)
 {
     int sum;
     int logSize = g_convertToBit[width] + 2;
@@ -611,7 +611,7 @@
     intra_pred_planar64_sse4,
 };
 
-void intra_pred_planar(pixel* above, pixel* left, pixel* dst, intptr_t dstStride, int width)
+void intra_pred_planar(pixel* above, pixel* left, pixel* dst, intptr_t dstStride, uint32_t width)
 {
     int nLog2Size = g_convertToBit[width] + 2;
 
diff -r 0666d56aaa42 -r 9bff4295adfc source/common/vec/intra-ssse3.cpp
--- a/source/common/vec/intra-ssse3.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/common/vec/intra-ssse3.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -152,7 +152,7 @@
         *(uint32_t*)(dst + (3 * dstStride)) = _mm_cvtsi128_si32(_mm_packus_epi16(row41, row41)); \
     }
 
-void predIntraAng4_32(pixel* dst, int dstStride, pixel *refMain, int /*dirMode*/)
+void predIntraAng4_32(pixel* dst, intptr_t dstStride, pixel *refMain, int /*dirMode*/)
 {
     __m128i tmp16_1;
 
@@ -166,7 +166,7 @@
     *(uint32_t*)(dst + 3 * dstStride) = _mm_cvtsi128_si32(tmp16_1);
 }
 
-void predIntraAng4_26(pixel* dst, int dstStride, pixel *refMain, int dirMode)
+void predIntraAng4_26(pixel* dst, intptr_t dstStride, pixel *refMain, int dirMode)
 {
     PRED_INTRA_ANGLE_4_START();
 
@@ -205,7 +205,7 @@
     PRED_INTRA_ANGLE_4_END();
 }
 
-void predIntraAng4_21(pixel* dst, int dstStride, pixel *refMain, int dirMode)
+void predIntraAng4_21(pixel* dst, intptr_t dstStride, pixel *refMain, int dirMode)
 {
     PRED_INTRA_ANGLE_4_START();
 
@@ -240,7 +240,7 @@
     PRED_INTRA_ANGLE_4_END();
 }
 
-void predIntraAng4_17(pixel* dst, int dstStride, pixel *refMain, int dirMode)
+void predIntraAng4_17(pixel* dst, intptr_t dstStride, pixel *refMain, int dirMode)
 {
     PRED_INTRA_ANGLE_4_START();
 
@@ -275,7 +275,7 @@
     PRED_INTRA_ANGLE_4_END();
 }
 
-void predIntraAng4_13(pixel* dst, int dstStride, pixel *refMain, int dirMode)
+void predIntraAng4_13(pixel* dst, intptr_t dstStride, pixel *refMain, int dirMode)
 {
     PRED_INTRA_ANGLE_4_START();
 
@@ -306,7 +306,7 @@
     PRED_INTRA_ANGLE_4_END();
 }
 
-void predIntraAng4_9(pixel* dst, int dstStride, pixel *refMain, int dirMode)
+void predIntraAng4_9(pixel* dst, intptr_t dstStride, pixel *refMain, int dirMode)
 {
     PRED_INTRA_ANGLE_4_START();
 
@@ -336,7 +336,7 @@
     PRED_INTRA_ANGLE_4_END();
 }
 
-void predIntraAng4_5(pixel* dst, int dstStride, pixel *refMain, int dirMode)
+void predIntraAng4_5(pixel* dst, intptr_t dstStride, pixel *refMain, int dirMode)
 {
     PRED_INTRA_ANGLE_4_START();
 
@@ -361,7 +361,7 @@
     PRED_INTRA_ANGLE_4_END();
 }
 
-void predIntraAng4_2(pixel* dst, int dstStride, pixel *refMain, int dirMode)
+void predIntraAng4_2(pixel* dst, intptr_t dstStride, pixel *refMain, int dirMode)
 {
     PRED_INTRA_ANGLE_4_START();
 
@@ -386,7 +386,7 @@
     PRED_INTRA_ANGLE_4_END();
 }
 
-void predIntraAng4_m_2(pixel* dst, int dstStride, pixel *refMain, int dirMode)
+void predIntraAng4_m_2(pixel* dst, intptr_t dstStride, pixel *refMain, int dirMode)
 {
     PRED_INTRA_ANGLE_4_START();
 
@@ -411,7 +411,7 @@
     PRED_INTRA_ANGLE_4_END();
 }
 
-void predIntraAng4_m_5(pixel* dst, int dstStride, pixel *refMain, int dirMode)
+void predIntraAng4_m_5(pixel* dst, intptr_t dstStride, pixel *refMain, int dirMode)
 {
     PRED_INTRA_ANGLE_4_START();
 
@@ -436,7 +436,7 @@
     PRED_INTRA_ANGLE_4_END();
 }
 
-void predIntraAng4_m_9(pixel* dst, int dstStride, pixel *refMain, int dirMode)
+void predIntraAng4_m_9(pixel* dst, intptr_t dstStride, pixel *refMain, int dirMode)
 {
     PRED_INTRA_ANGLE_4_START();
 
@@ -466,7 +466,7 @@
     PRED_INTRA_ANGLE_4_END();
 }
 
-void predIntraAng4_m_13(pixel* dst, int dstStride, pixel *refMain, int dirMode)
+void predIntraAng4_m_13(pixel* dst, intptr_t dstStride, pixel *refMain, int dirMode)
 {
     PRED_INTRA_ANGLE_4_START();
 
@@ -497,7 +497,7 @@
     PRED_INTRA_ANGLE_4_END();
 }
 
-void predIntraAng4_m_17(pixel* dst, int dstStride, pixel *refMain, int dirMode)
+void predIntraAng4_m_17(pixel* dst, intptr_t dstStride, pixel *refMain, int dirMode)
 {
     PRED_INTRA_ANGLE_4_START();
 
@@ -532,7 +532,7 @@
     PRED_INTRA_ANGLE_4_END();
 }
 
-void predIntraAng4_m_21(pixel* dst, int dstStride, pixel *refMain, int dirMode)
+void predIntraAng4_m_21(pixel* dst, intptr_t dstStride, pixel *refMain, int dirMode)
 {
     PRED_INTRA_ANGLE_4_START();
 
@@ -567,7 +567,7 @@
     PRED_INTRA_ANGLE_4_END();
 }
 
-void predIntraAng4_m_26(pixel* dst, int dstStride, pixel *refMain, int dirMode)
+void predIntraAng4_m_26(pixel* dst, intptr_t dstStride, pixel *refMain, int dirMode)
 {
     PRED_INTRA_ANGLE_4_START();
 
@@ -606,7 +606,7 @@
     PRED_INTRA_ANGLE_4_END();
 }
 
-void predIntraAng4_m_32(pixel* dst, int dstStride, pixel *refMain, int /*dirMode*/)
+void predIntraAng4_m_32(pixel* dst, intptr_t dstStride, pixel *refMain, int /*dirMode*/)
 {
     __m128i tmp16_1;
 
@@ -620,7 +620,7 @@
     *(uint32_t*)(dst + 3 * dstStride) = _mm_cvtsi128_si32(tmp16_1);
 }
 
-typedef void (*predIntraAng4x4_func)(pixel* dst, int dstStride, pixel *refMain, int dirMode);
+typedef void (*predIntraAng4x4_func)(pixel* dst, intptr_t dstStride, pixel *refMain, int dirMode);
 predIntraAng4x4_func predIntraAng4[] =
 {
     /* PredIntraAng4_0 is replaced with PredIntraAng4_2. For PredIntraAng4_0 we are going through default path in the
@@ -660,7 +660,7 @@
     predIntraAng4_32
 };
 
-void intraPredAng4x4(pixel* dst, int dstStride, int width, int dirMode, pixel *refLeft, pixel *refAbove, bool bFilter = true)
+void intraPredAng4x4(pixel* dst, intptr_t dstStride, int width, int dirMode, pixel *refLeft, pixel *refAbove, bool bFilter = true)
 {
     assert(dirMode > 1); //no planar and dc
     static const int mode_to_angle_table[] = { 32, 26, 21, 17, 13, 9, 5, 2, 0, -2, -5, -9, -13, -17, -21, -26, -32, -26, -21, -17, -13, -9, -5, -2, 0, 2, 5, 9, 13, 17, 21, 26, 32 };
@@ -859,7 +859,7 @@
         __m128i lowm, highm; \
         __m128i mask = _mm_set1_epi32(0x00FF00FF);
 
-void predIntraAng8_32(pixel* dst, int dstStride, pixel *refMain, int /*dirMode*/)
+void predIntraAng8_32(pixel* dst, intptr_t dstStride, pixel *refMain, int /*dirMode*/)
 {
     __m128i tmp16_1 = _mm_loadl_epi64((__m128i*)(refMain + 2));
     _mm_storel_epi64((__m128i*)(dst), tmp16_1);
@@ -879,7 +879,7 @@
     _mm_storel_epi64((__m128i*)(dst + 7 * dstStride), tmp16_1);
 }
 
-void predIntraAng8_26(pixel* dst, int dstStride, pixel *refMain, int dirMode)
+void predIntraAng8_26(pixel* dst, intptr_t dstStride, pixel *refMain, int dirMode)
 {
     // Map the mode index to main prediction direction and angle
     bool modeHor       = (dirMode < 18);
@@ -949,7 +949,7 @@
     }
 }
 
-void predIntraAng8_5(pixel* dst, int dstStride, pixel *refMain, int dirMode)
+void predIntraAng8_5(pixel* dst, intptr_t dstStride, pixel *refMain, int dirMode)
 {
     PRED_INTRA_ANGLE_8_START();
 
@@ -1038,7 +1038,7 @@
     }
 }
 
-void predIntraAng8_2(pixel* dst, int dstStride, pixel *refMain, int dirMode)
+void predIntraAng8_2(pixel* dst, intptr_t dstStride, pixel *refMain, int dirMode)
 {
     PRED_INTRA_ANGLE_8_START();
 
@@ -1122,7 +1122,7 @@
     }
 }
 
-void predIntraAng8_m_2(pixel* dst, int dstStride, pixel *refMain, int dirMode)
+void predIntraAng8_m_2(pixel* dst, intptr_t dstStride, pixel *refMain, int dirMode)
 {
     PRED_INTRA_ANGLE_8_START();
 
@@ -1206,7 +1206,7 @@
     }
 }
 
-void predIntraAng8_m_5(pixel* dst, int dstStride, pixel *refMain, int dirMode)
+void predIntraAng8_m_5(pixel* dst, intptr_t dstStride, pixel *refMain, int dirMode)
 {
     PRED_INTRA_ANGLE_8_START();
 
@@ -1295,7 +1295,7 @@
     }
 }
 
-typedef void (*predIntraAng8x8_func)(pixel* dst, int dstStride, pixel *refMain, int dirMode);
+typedef void (*predIntraAng8x8_func)(pixel* dst, intptr_t dstStride, pixel *refMain, int dirMode);
 predIntraAng8x8_func predIntraAng8[] =
 {
     /* PredIntraAng8_0 is replaced with PredIntraAng8_2. For PredIntraAng8_0 we are going through default path
@@ -1335,7 +1335,7 @@
     predIntraAng8_32
 };
 
-void intraPredAng8x8(pixel* dst, int dstStride, int width, int dirMode, pixel *refLeft, pixel *refAbove, bool bFilter = true)
+void intraPredAng8x8(pixel* dst, intptr_t dstStride, int width, int dirMode, pixel *refLeft, pixel *refAbove, bool bFilter = true)
 {
     int k;
     int blkSize = width;
@@ -1561,7 +1561,7 @@
     BLND2_4(R3, R7); \
     BLND2_4(R4, R8);
 
-void intraPredAng16x16(pixel* dst, int dstStride, int width, int dirMode, pixel *refLeft, pixel *refAbove, bool bFilter = true)
+void intraPredAng16x16(pixel* dst, intptr_t dstStride, int width, int dirMode, pixel *refLeft, pixel *refAbove, bool bFilter = true)
 {
     int k;
     int blkSize        = width;
@@ -2154,7 +2154,7 @@
     PREDANG_CALCROW_HOR_MODE2(R6) \
     PREDANG_CALCROW_HOR_MODE2(R7) \
 
-void intraPredAng32x32(pixel* dst, int dstStride, int width, int dirMode, pixel *refLeft, pixel *refAbove)
+void intraPredAng32x32(pixel* dst, intptr_t dstStride, int width, int dirMode, pixel *refLeft, pixel *refAbove)
 {
     int k;
     int blkSize = width;
@@ -3185,7 +3185,7 @@
 #undef MB4
 #undef CALC_BLND_8ROWS
 
-void intra_pred_ang(pixel* dst, int dstStride, int width, int dirMode, bool bFilter, pixel *refLeft, pixel *refAbove)
+void intra_pred_ang(pixel* dst, intptr_t dstStride, uint32_t width, uint32_t dirMode, bool bFilter, pixel *refLeft, pixel *refAbove)
 {
     switch (width)
     {
@@ -3739,7 +3739,7 @@
     }
 }
 
-void intraPredAng4x4(pixel* dst, int dstStride, int width, int dirMode, pixel *refLeft, pixel *refAbove)
+void intraPredAng4x4(pixel* dst, intptr_t dstStride, int width, int dirMode, pixel *refLeft, pixel *refAbove)
 {
     int blkSize        = width;
 
diff -r 0666d56aaa42 -r 9bff4295adfc source/common/vec/pixel-sse3.cpp
--- a/source/common/vec/pixel-sse3.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/common/vec/pixel-sse3.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -305,7 +305,7 @@
     }
 }
 
-void getResidual4(pixel *fenc, pixel *pred, int16_t *resi, int stride)
+void getResidual4(pixel *fenc, pixel *pred, int16_t *resi, intptr_t stride)
 {
     __m128i T00, T01, T02;
 
@@ -338,7 +338,7 @@
     _mm_storel_epi64((__m128i*)(resi + (3) * stride), T02);
 }
 
-void getResidual8(pixel *fenc, pixel *pred, int16_t *resi, int stride)
+void getResidual8(pixel *fenc, pixel *pred, int16_t *resi, intptr_t stride)
 {
     __m128i T00, T01, T02;
 
@@ -399,7 +399,7 @@
     _mm_storeu_si128((__m128i*)(resi + (7) * stride), T02);
 }
 
-void getResidual16(pixel *fenc, pixel *pred, int16_t *resi, int stride)
+void getResidual16(pixel *fenc, pixel *pred, int16_t *resi, intptr_t stride)
 {
     __m128i T00, T01, T02, T03, T04;
 
@@ -451,7 +451,7 @@
     RESIDUAL_16x4(12);
 }
 
-void getResidual32(pixel *fenc, pixel *pred, int16_t *resi, int stride)
+void getResidual32(pixel *fenc, pixel *pred, int16_t *resi, intptr_t stride)
 {
     __m128i T00, T01, T02, T03, T04;
 
@@ -484,7 +484,7 @@
     }
 }
 
-void getResidual64(pixel *fenc, pixel *pred, int16_t *resi, int stride)
+void getResidual64(pixel *fenc, pixel *pred, int16_t *resi, intptr_t stride)
 {
     __m128i T00, T01, T02, T03, T04;
 
@@ -497,7 +497,7 @@
     }
 }
 
-void calcRecons4(pixel* pred, int16_t* resi, pixel* reco, int16_t* recQt, pixel* recIPred, int stride, int recstride, int predstride)
+void calcRecons4(pixel* pred, int16_t* resi, pixel* reco, int16_t* recQt, pixel* recIPred, intptr_t stride, int recstride, int predstride)
 {
     for (int y = 0; y < 4; y++)
     {
@@ -531,7 +531,7 @@
     }
 }
 
-void calcRecons8(pixel* pred, int16_t* resi, pixel* reco, int16_t* recQt, pixel* recIPred, int stride, int recstride, int predstride)
+void calcRecons8(pixel* pred, int16_t* resi, pixel* reco, int16_t* recQt, pixel* recIPred, intptr_t stride, int recstride, int predstride)
 {
     for (int y = 0; y < 8; y++)
     {
@@ -566,7 +566,7 @@
 }
 
 template<int blockSize>
-void calcRecons(pixel* pred, int16_t* resi, pixel* reco, int16_t* recQt, pixel* recIPred, int stride, int recstride, int predstride)
+void calcRecons(pixel* pred, int16_t* resi, pixel* reco, int16_t* recQt, pixel* recIPred, intptr_t stride, int recstride, int predstride)
 {
     for (int y = 0; y < blockSize; y++)
     {
diff -r 0666d56aaa42 -r 9bff4295adfc source/common/version.cpp
--- a/source/common/version.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/common/version.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -75,10 +75,10 @@
 
 #if HIGH_BIT_DEPTH
 #define BITDEPTH "16bpp"
-const int x265_max_bit_depth = 8; // 12;
+const uint32_t x265_max_bit_depth = 8; // 12;
 #else
 #define BITDEPTH "8bpp"
-const int x265_max_bit_depth = 8;
+const uint32_t x265_max_bit_depth = 8;
 #endif
 
 const char *x265_version_str = XSTR(X265_VERSION);
diff -r 0666d56aaa42 -r 9bff4295adfc source/common/wavefront.cpp
--- a/source/common/wavefront.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/common/wavefront.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -31,7 +31,7 @@
 namespace x265 {
 // x265 private namespace
 
-bool WaveFront::init(int numRows)
+bool WaveFront::init(uint32_t numRows)
 {
     m_numRows = numRows;
 
diff -r 0666d56aaa42 -r 9bff4295adfc source/common/wavefront.h
--- a/source/common/wavefront.h	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/common/wavefront.h	Thu Oct 31 15:40:28 2013 +0530
@@ -54,7 +54,7 @@
     virtual ~WaveFront();
 
     // If returns false, the frame must be encoded in series.
-    bool init(int numRows);
+    bool init(uint32_t numRows);
 
     // Enqueue a row to be processed. A worker thread will later call ProcessRow(row)
     // This provider must be enqueued in the pool before enqueuing a row
@@ -77,7 +77,7 @@
 
     // Start or resume encode processing of this row, must be implemented by
     // derived classes.
-    virtual void processRow(int row) = 0;
+    virtual void processRow(uint32_t row) = 0;
 };
 } // end namespace x265
 
diff -r 0666d56aaa42 -r 9bff4295adfc source/compat/getopt/getopt.c
--- a/source/compat/getopt/getopt.c	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/compat/getopt/getopt.c	Thu Oct 31 15:40:28 2013 +0530
@@ -652,8 +652,8 @@
       for (p = longopts, option_index = 0; p->name; p++, option_index++)
 	if (!strncmp (p->name, nextchar, nameend - nextchar))
 	  {
-	    if ((unsigned int) (nameend - nextchar)
-		== (unsigned int) strlen (p->name))
+	    if ((uint32_t) (nameend - nextchar)
+		== (uint32_t) strlen (p->name))
 	      {
 		/* Exact match found.  */
 		pfound = p;
@@ -844,7 +844,7 @@
 	for (p = longopts, option_index = 0; p->name; p++, option_index++)
 	  if (!strncmp (p->name, nextchar, nameend - nextchar))
 	    {
-	      if ((unsigned int) (nameend - nextchar) == strlen (p->name))
+	      if ((uint32_t) (nameend - nextchar) == strlen (p->name))
 		{
 		  /* Exact match found.  */
 		  pfound = p;
diff -r 0666d56aaa42 -r 9bff4295adfc source/encoder/bitcost.cpp
--- a/source/encoder/bitcost.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/encoder/bitcost.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -31,7 +31,7 @@
 
 using namespace x265;
 
-void BitCost::setQP(unsigned int qp)
+void BitCost::setQP(uint32_t qp)
 {
     if (!s_costs[qp])
     {
diff -r 0666d56aaa42 -r 9bff4295adfc source/encoder/bitcost.h
--- a/source/encoder/bitcost.h	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/encoder/bitcost.h	Thu Oct 31 15:40:28 2013 +0530
@@ -38,7 +38,7 @@
 
     BitCost() : m_cost_mvx(0), m_cost_mvy(0), m_cost(0) {}
 
-    void setQP(unsigned int qp);
+    void setQP(uint32_t qp);
 
     void setMVP(const MV& mvp)                      { m_mvp = mvp; m_cost_mvx = m_cost - mvp.x; m_cost_mvy = m_cost - mvp.y; }
 
diff -r 0666d56aaa42 -r 9bff4295adfc source/encoder/compress.cpp
--- a/source/encoder/compress.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/encoder/compress.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -102,7 +102,7 @@
 
     Pel* fenc   = m_origYuv[depth]->getLumaAddr(0, width);
     Pel* pred   = m_modePredYuv[5][depth]->getLumaAddr(0, width);
-    uint32_t stride = m_modePredYuv[5][depth]->getStride();
+    intptr_t stride = m_modePredYuv[5][depth]->getStride();
 
     Pel *pAbove0 = m_search->refAbove    + width - 1;
     Pel *pAbove1 = m_search->refAboveFlt + width - 1;
diff -r 0666d56aaa42 -r 9bff4295adfc source/encoder/dpb.cpp
--- a/source/encoder/dpb.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/encoder/dpb.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -192,9 +192,9 @@
     }
 }
 
-void DPB::computeRPS(int curPoc, bool isRAP, TComReferencePictureSet * rps, unsigned int maxDecPicBuffer)
+void DPB::computeRPS(int curPoc, bool isRAP, TComReferencePictureSet * rps, uint32_t maxDecPicBuffer)
 {
-    unsigned int poci = 0, numNeg = 0, numPos = 0;
+    uint32_t poci = 0, numNeg = 0, numPos = 0;
 
     TComPic* iterPic = m_picList.first();
 
diff -r 0666d56aaa42 -r 9bff4295adfc source/encoder/dpb.h
--- a/source/encoder/dpb.h	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/encoder/dpb.h	Thu Oct 31 15:40:28 2013 +0530
@@ -64,7 +64,7 @@
 
 protected:
 
-    void computeRPS(int curPoc, bool isRAP, TComReferencePictureSet * rps, unsigned int maxDecPicBuffer);
+    void computeRPS(int curPoc, bool isRAP, TComReferencePictureSet * rps, uint32_t maxDecPicBuffer);
 
     void applyReferencePictureSet(TComReferencePictureSet *rps, int curPoc);
     void decodingRefreshMarking(int pocCurr, NalUnitType nalUnitType);
diff -r 0666d56aaa42 -r 9bff4295adfc source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/encoder/encoder.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -89,7 +89,7 @@
     m_frameEncoder = new FrameEncoder[param.frameNumThreads];
     if (m_frameEncoder)
     {
-        for (int i = 0; i < param.frameNumThreads; i++)
+        for (uint32_t i = 0; i < param.frameNumThreads; i++)
         {
             m_frameEncoder[i].setThreadPool(m_threadPool);
         }
@@ -128,7 +128,7 @@
 {
     if (m_frameEncoder)
     {
-        for (int i = 0; i < param.frameNumThreads; i++)
+        for (uint32_t i = 0; i < param.frameNumThreads; i++)
         {
             // Ensure frame encoder is idle before destroying it
             m_frameEncoder[i].getEncodedPicture(NULL);
@@ -169,7 +169,7 @@
     if (m_frameEncoder)
     {
         int numRows = (param.sourceHeight + g_maxCUHeight - 1) / g_maxCUHeight;
-        for (int i = 0; i < param.frameNumThreads; i++)
+        for (uint32_t i = 0; i < param.frameNumThreads; i++)
         {
             m_frameEncoder[i].init(this, numRows);
         }
diff -r 0666d56aaa42 -r 9bff4295adfc source/encoder/frameencoder.h
--- a/source/encoder/frameencoder.h	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/encoder/frameencoder.h	Thu Oct 31 15:40:28 2013 +0530
@@ -91,7 +91,7 @@
         WaveFront::enableRow(row * 2 + 1);
     }
 
-    void processRow(int row)
+    void processRow(uint32_t row)
     {
         const int realRow = row >> 1;
         const int typeNum = row & 1;
diff -r 0666d56aaa42 -r 9bff4295adfc source/encoder/framefilter.cpp
--- a/source/encoder/framefilter.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/encoder/framefilter.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -29,7 +29,7 @@
 
 using namespace x265;
 
-static UInt64 computeSSD(pixel *fenc, pixel *rec, int stride, int width, int height);
+static UInt64 computeSSD(pixel *fenc, pixel *rec, intptr_t stride, int width, int height);
 static float calculateSSIM(pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2, int width, int height, void *buf, int32_t *cnt);
 
 // **************************************************************************
@@ -280,7 +280,7 @@
         TComPicYuv* recon = m_pic->getPicYuvRec();
         TComPicYuv* orig  = m_pic->getPicYuvOrg();
 
-        int stride = recon->getStride();
+        intptr_t stride = recon->getStride();
         int width  = recon->getWidth() - m_cfg->m_pad[0];
         int height;
 
@@ -306,8 +306,8 @@
     {
         pixel *rec = (pixel*)m_pic->getPicYuvRec()->getLumaAddr();
         pixel *org = (pixel*)m_pic->getPicYuvOrg()->getLumaAddr();
-        int stride1 = m_pic->getPicYuvOrg()->getStride();
-        int stride2 = m_pic->getPicYuvRec()->getStride();
+        intptr_t stride1 = m_pic->getPicYuvOrg()->getStride();
+        intptr_t stride2 = m_pic->getPicYuvRec()->getStride();
         int bEnd = ((row + 1) == (this->m_numRows - 1));
         int bStart = (row == 0);
         int minPixY = row * 64 - 4 * !bStart;
@@ -326,7 +326,7 @@
     {
         uint32_t width = recon->getWidth();
         uint32_t height = recon->getCUHeight(row);
-        uint32_t stride = recon->getStride();
+        intptr_t stride = recon->getStride();
 
         if (row == 0)
         {
@@ -348,7 +348,7 @@
     {
         uint32_t width = recon->getWidth();
         uint32_t height = recon->getCUHeight(row);
-        uint32_t stride = recon->getStride();
+        intptr_t stride = recon->getStride();
         if (row == 0)
         {
             m_pic->m_crc[0] = m_pic->m_crc[1] = m_pic->m_crc[2] = 0xffff;
@@ -366,7 +366,7 @@
     {
         uint32_t width = recon->getWidth();
         uint32_t height = recon->getCUHeight(row);
-        uint32_t stride = recon->getStride();
+        intptr_t stride = recon->getStride();
         uint32_t cuHeight = g_maxCUHeight;
         if (row == 0)
         {
@@ -382,7 +382,7 @@
     }
 }
 
-static UInt64 computeSSD(pixel *fenc, pixel *rec, int stride, int width, int height)
+static UInt64 computeSSD(pixel *fenc, pixel *rec, intptr_t stride, int width, int height)
 {
     UInt64 ssd = 0;
 
diff -r 0666d56aaa42 -r 9bff4295adfc source/encoder/motion.cpp
--- a/source/encoder/motion.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/encoder/motion.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -116,7 +116,7 @@
     X265_FREE(immedVal2);
 }
 
-void MotionEstimate::setSourcePU(int offset, int width, int height)
+void MotionEstimate::setSourcePU(int offset, uint32_t width, uint32_t height)
 {
     /* copy PU block into cache */
     primitives.blockcpy_pp(width, height, fenc, FENC_STRIDE, fencplane + offset, fencLumaStride);
@@ -300,7 +300,7 @@
                                    MV &             outQMv)
 {
     ALIGN_VAR_16(int, costs[16]);
-    size_t stride = ref->lumaStride;
+    intptr_t stride = ref->lumaStride;
     pixel *fref = ref->fpelPlane + blockOffset;
 
     setMVP(qmvp);
@@ -899,7 +899,7 @@
 {
     ALIGN_VAR_16(int, costs[16]);
     pixel *fref = ref->fpelPlane + blockOffset;
-    size_t stride = ref->lumaStride;
+    intptr_t stride = ref->lumaStride;
 
     MV omv = bmv;
     int saved = bcost;
@@ -1179,8 +1179,8 @@
     int yFrac = qmv.y & 0x3;
 
     assert(yFrac | xFrac);
-    int realWidth = blockwidth + (dir == 2);
-    int realHeight = blockheight + (dir == 1);
+    uint32_t realWidth = blockwidth + (dir == 2);
+    uint32_t realHeight = blockheight + (dir == 1);
     intptr_t realStride = FENC_STRIDE + (dir == 2);
     pixel *fref = ref->unweightedFPelPlane + blockOffset + (qmv.x >> 2) + (qmv.y >> 2) * ref->lumaStride;
     int shiftNum = IF_INTERNAL_PREC - X265_DEPTH;
diff -r 0666d56aaa42 -r 9bff4295adfc source/encoder/motion.h
--- a/source/encoder/motion.h	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/encoder/motion.h	Thu Oct 31 15:40:28 2013 +0530
@@ -55,7 +55,7 @@
     pixel *subpelbuf;
     int16_t *immedVal;
     int16_t *immedVal2;
-    int blockwidth;
+    uint32_t blockwidth;
     int blockheight;
 
     MotionEstimate& operator =(const MotionEstimate&);
@@ -82,7 +82,7 @@
         fencLumaStride = luma;
     }
 
-    void setSourcePU(int offset, int pwidth, int pheight);
+    void setSourcePU(int offset, uint32_t pwidth, uint32_t pheight);
 
     /* buf*() and motionEstimate() methods all use cached fenc pixels and thus
      * require setSourcePU() to be called prior. */
diff -r 0666d56aaa42 -r 9bff4295adfc source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/encoder/ratecontrol.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -60,9 +60,9 @@
 }
 
 /* Find the energy of each block in Y/Cb/Cr plane */
-static inline uint32_t acEnergyPlane(pixel* src, int srcStride, int bChroma)
+static inline uint32_t acEnergyPlane(pixel* src, intptr_t srcStride, int bChroma)
 {
-    int blockStride = FENC_STRIDE >> 3;
+    intptr_t blockStride = FENC_STRIDE >> 3;
 
     if (bChroma)
     {
@@ -82,10 +82,10 @@
     pixel* srcLuma = pic->getPicYuvOrg()->getLumaAddr() ;
     pixel* srcCb = pic->getPicYuvOrg()->getCbAddr() ;
     pixel* srcCr = pic->getPicYuvOrg()->getCrAddr();
-    int frameStride = pic->getPicYuvOrg()->getStride();
-    int cStride = pic->getPicYuvOrg()->getCStride();
-    uint32_t blockOffsetLuma = block_x + (block_y * frameStride);
-    uint32_t blockOffsetChroma = (block_x >> 1) + ((block_y >> 1) * cStride);
+    intptr_t frameStride = pic->getPicYuvOrg()->getStride();
+    intptr_t cStride = pic->getPicYuvOrg()->getCStride();
+    uint32_t blockOffsetLuma = block_x + (block_y * (uint32_t)frameStride);
+    uint32_t blockOffsetChroma = (block_x >> 1) + ((block_y >> 1) * (uint32_t)cStride);
     var = acEnergyPlane(srcLuma + blockOffsetLuma, frameStride, 0);
     var += acEnergyPlane(srcCb + blockOffsetChroma, cStride, 1);
     var += acEnergyPlane(srcCr + blockOffsetChroma, cStride, 1);
diff -r 0666d56aaa42 -r 9bff4295adfc source/encoder/reference.cpp
--- a/source/encoder/reference.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/encoder/reference.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -89,7 +89,7 @@
     int height = ((rows - m_numWeightedRows) * g_maxCUHeight);
     if (rows == numRows)
         height = ((m_reconPic->getHeight() % g_maxCUHeight) ? (m_reconPic->getHeight() % g_maxCUHeight) : g_maxCUHeight);
-    size_t dstStride = lumaStride;
+    intptr_t dstStride = lumaStride;
 
     // Computing weighted CU rows
     int shiftNum = IF_INTERNAL_PREC - X265_DEPTH;
diff -r 0666d56aaa42 -r 9bff4295adfc source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/encoder/slicetype.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -72,7 +72,7 @@
     heightInCU = ((cfg->param.sourceHeight / 2) + X265_LOWRES_CU_SIZE - 1) >> X265_LOWRES_CU_BITS;
 
     lhrows = new LookaheadRow[heightInCU];
-    for (int i = 0; i < heightInCU; i++)
+    for (uint32_t i = 0; i < heightInCU; i++)
     {
         lhrows[i].widthInCU = widthInCU;
         lhrows[i].heightInCU = heightInCU;
@@ -216,7 +216,7 @@
         fenc->costEstAq[b - p0][p1 - b] = 0;
         // TODO: use lowres MVs as motion candidates in full-res search
 
-        for (int i = 0; i < heightInCU; i++)
+		for (uint32_t i = 0; i < heightInCU; i++)
         {
             lhrows[i].init();
             lhrows[i].me.setSourcePlane(fenc->lowresPlane[0], fenc->lumaStride);
@@ -238,14 +238,14 @@
         }
         else
         {
-            for (int row = 0; row < heightInCU; row++)
+            for (uint32_t row = 0; row < heightInCU; row++)
             {
                 processRow(row);
             }
         }
 
         // Accumulate cost from each row
-        for (int row = 0; row < heightInCU; row++)
+        for (uint32_t row = 0; row < heightInCU; row++)
         {
             score += lhrows[row].costEst;
             fenc->costEst[0][0] += lhrows[row].costIntra;
@@ -295,7 +295,7 @@
     const int bBidir = (b < p1);
     const int cuXY = cux + cuy * widthInCU;
     const int cuSize = X265_LOWRES_CU_SIZE;
-    const int pelOffset = cuSize * cux + cuSize * cuy * fenc->lumaStride;
+    const int pelOffset = cuSize * cux + cuSize * cuy * (int)fenc->lumaStride;
 
     // should this CU's cost contribute to the frame cost?
     const bool bFrameScoreCU = (cux > 0 && cux < widthInCU - 1 &&
@@ -1072,7 +1072,7 @@
     return cost;
 }
 
-void Lookahead::processRow(int row)
+void Lookahead::processRow(uint32_t row)
 {
     int realrow = heightInCU - 1 - row;
     Lowres *fenc = frames[curb];
diff -r 0666d56aaa42 -r 9bff4295adfc source/encoder/slicetype.h
--- a/source/encoder/slicetype.h	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/encoder/slicetype.h	Thu Oct 31 15:40:28 2013 +0530
@@ -79,8 +79,8 @@
     Lowres          *lastNonB;
     int              numDecided;
     int              lastKeyframe;
-    int              widthInCU;       // width of lowres frame in downscale CUs
-    int              heightInCU;      // height of lowres frame in downscale CUs
+    uint32_t         widthInCU;       // width of lowres frame in downscale CUs
+    uint32_t         heightInCU;      // height of lowres frame in downscale CUs
 
     PicList inputQueue;  // input pictures in order received
     PicList outputQueue; // pictures to be encoded, in encode order
@@ -109,7 +109,7 @@
     void slicetypePath(int length, char(*best_paths)[X265_LOOKAHEAD_MAX + 1]);
     int slicetypePathCost(char *path, int threshold);
 
-    void processRow(int row);
+    void processRow(uint32_t row);
 };
 }
 
diff -r 0666d56aaa42 -r 9bff4295adfc source/input/input.h
--- a/source/input/input.h	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/input/input.h	Thu Oct 31 15:40:28 2013 +0530
@@ -49,15 +49,15 @@
 
     static Input* open(const char *filename, bool bForceY4m);
 
-    virtual void setDimensions(int width, int height) = 0;
+    virtual void setDimensions(uint32_t width, uint32_t height) = 0;
 
     virtual void setBitDepth(uint32_t bitDepth) = 0;
 
     virtual float getRate() const = 0;
 
-    virtual int getWidth() const = 0;
+    virtual uint32_t getWidth() const = 0;
 
-    virtual int getHeight() const = 0;
+    virtual uint32_t getHeight() const = 0;
 
     virtual void startReader() = 0;
 
diff -r 0666d56aaa42 -r 9bff4295adfc source/input/y4m.h
--- a/source/input/y4m.h	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/input/y4m.h	Thu Oct 31 15:40:28 2013 +0530
@@ -47,9 +47,9 @@
 
     uint32_t rateDenom;
 
-    int width;
+    uint32_t width;
 
-    int height;
+    uint32_t height;
 
     bool threadActive;
 
@@ -78,15 +78,15 @@
 
     virtual ~Y4MInput();
 
-    void setDimensions(int, int)                  { /* ignore, warn */ }
+    void setDimensions(uint32_t, uint32_t)                  { /* ignore, warn */ }
 
     void setBitDepth(uint32_t)                         { /* ignore, warn */ }
 
     float getRate() const                         { return ((float)rateNum) / rateDenom; }
 
-    int getWidth() const                          { return width; }
+    uint32_t getWidth() const                          { return width; }
 
-    int getHeight() const                         { return height; }
+    uint32_t getHeight() const                         { return height; }
 
     bool isEof() const                            { return (ifs && ifs->eof()); }
 
diff -r 0666d56aaa42 -r 9bff4295adfc source/input/yuv.cpp
--- a/source/input/yuv.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/input/yuv.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -42,7 +42,7 @@
 YUVInput::YUVInput(const char *filename)
 {
 #if defined ENABLE_THREAD
-    for (int i = 0; i < QUEUE_SIZE; i++)
+    for (uint32_t i = 0; i < QUEUE_SIZE; i++)
         buf[i] = NULL;
     head = 0;
     tail = 0;
@@ -123,7 +123,7 @@
 #endif
 }
 
-void YUVInput::setDimensions(int w, int h)
+void YUVInput::setDimensions(uint32_t w, uint32_t h)
 {
     width = w;
     height = h;
diff -r 0666d56aaa42 -r 9bff4295adfc source/input/yuv.h
--- a/source/input/yuv.h	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/input/yuv.h	Thu Oct 31 15:40:28 2013 +0530
@@ -43,9 +43,9 @@
 {
 protected:
 
-    int width;
+    uint32_t width;
 
-    int height;
+    uint32_t height;
 
     uint32_t depth;
 
@@ -79,15 +79,15 @@
 
     virtual ~YUVInput();
 
-    void setDimensions(int w, int h);
+    void setDimensions(uint32_t w, uint32_t h);
 
     void setBitDepth(uint32_t bitDepth)                { depth = bitDepth; }
 
     float getRate() const                         { return 0.0f; }
 
-    int getWidth() const                          { return width; }
+    uint32_t getWidth() const                          { return width; }
 
-    int getHeight() const                         { return height; }
+    uint32_t getHeight() const                         { return height; }
 
     bool isEof() const                            { return (ifs && ifs->eof()); }
 
diff -r 0666d56aaa42 -r 9bff4295adfc source/output/output.cpp
--- a/source/output/output.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/output/output.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -28,7 +28,7 @@
 
 using namespace x265;
 
-Output* Output::open(const char *fname, int width, int height, uint32_t bitdepth, int rate)
+Output* Output::open(const char *fname, uint32_t width, uint32_t height, uint32_t bitdepth, uint32_t rate)
 {
     const char * s = strrchr(fname, '.');
 
diff -r 0666d56aaa42 -r 9bff4295adfc source/output/output.h
--- a/source/output/output.h	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/output/output.h	Thu Oct 31 15:40:28 2013 +0530
@@ -39,7 +39,7 @@
 
     Output()           {}
 
-    static Output* open(const char *fname, int width, int height, uint32_t bitdepth, int rate);
+    static Output* open(const char *fname, uint32_t width, uint32_t height, uint32_t bitdepth, uint32_t rate);
 
     virtual bool isFail() const = 0;
 
diff -r 0666d56aaa42 -r 9bff4295adfc source/output/y4m.cpp
--- a/source/output/y4m.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/output/y4m.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -28,7 +28,7 @@
 using namespace x265;
 using namespace std;
 
-Y4MOutput::Y4MOutput(const char *filename, int w, int h, int rate)
+Y4MOutput::Y4MOutput(const char *filename, uint32_t w, uint32_t h, uint32_t rate)
     : width(w)
     , height(h)
 {
@@ -58,9 +58,9 @@
     {
         // encoder gave us short pixels, downscale, then write
         uint16_t *Y = (uint16_t*)pic.planes[0];
-        for (int i = 0; i < height; i++)
+        for (uint32_t i = 0; i < height; i++)
         {
-            for (int j = 0; j < width; j++)
+            for (uint32_t j = 0; j < width; j++)
             {
                 buf[j] = (char)Y[j];
             }
@@ -69,9 +69,9 @@
             Y += pic.stride[0];
         }
         uint16_t *U = (uint16_t*)pic.planes[1];
-        for (int i = 0; i < height >> 1; i++)
+        for (uint32_t i = 0; i < height >> 1; i++)
         {
-            for (int j = 0; j < width >> 1; j++)
+            for (uint32_t j = 0; j < width >> 1; j++)
             {
                 buf[j] = (char)U[j];
             }
@@ -80,9 +80,9 @@
             U += pic.stride[1];
         }
         uint16_t *V = (uint16_t*)pic.planes[2];
-        for (int i = 0; i < height >> 1; i++)
+        for (uint32_t i = 0; i < height >> 1; i++)
         {
-            for (int j = 0; j < width >> 1; j++)
+            for (uint32_t j = 0; j < width >> 1; j++)
             {
                 buf[j] = (char)V[j];
             }
@@ -94,21 +94,21 @@
     else
     {
         char *Y = (char*)pic.planes[0];
-        for (int i = 0; i < height; i++)
+        for (uint32_t i = 0; i < height; i++)
         {
             ofs.write(Y, width);
             Y += pic.stride[0];
         }
 
         char *U = (char*)pic.planes[1];
-        for (int i = 0; i < height >> 1; i++)
+        for (uint32_t i = 0; i < height >> 1; i++)
         {
             ofs.write(U, width >> 1);
             U += pic.stride[1];
         }
 
         char *V = (char*)pic.planes[2];
-        for (int i = 0; i < height >> 1; i++)
+        for (uint32_t i = 0; i < height >> 1; i++)
         {
             ofs.write(V, width >> 1);
             V += pic.stride[2];
diff -r 0666d56aaa42 -r 9bff4295adfc source/output/y4m.h
--- a/source/output/y4m.h	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/output/y4m.h	Thu Oct 31 15:40:28 2013 +0530
@@ -34,9 +34,9 @@
 {
 protected:
 
-    int width;
+    uint32_t width;
 
-    int height;
+    uint32_t height;
 
     std::ofstream ofs;
 
@@ -48,7 +48,7 @@
 
 public:
 
-    Y4MOutput(const char *filename, int width, int height, int rate);
+    Y4MOutput(const char *filename, uint32_t width, uint32_t height, uint32_t rate);
 
     virtual ~Y4MOutput();
 
diff -r 0666d56aaa42 -r 9bff4295adfc source/output/yuv.cpp
--- a/source/output/yuv.cpp	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/output/yuv.cpp	Thu Oct 31 15:40:28 2013 +0530
@@ -28,7 +28,7 @@
 using namespace x265;
 using namespace std;
 
-YUVOutput::YUVOutput(const char *filename, int w, int h, uint32_t d)
+YUVOutput::YUVOutput(const char *filename, uint32_t w, uint32_t h, uint32_t d)
     : width(w)
     , height(h)
     , depth(d)
@@ -54,9 +54,9 @@
     {
         // encoder gave us short pixels, downscale, then write
         uint16_t *Y = (uint16_t*)pic.planes[0];
-        for (int i = 0; i < height; i++)
+        for (uint32_t i = 0; i < height; i++)
         {
-            for (int j = 0; j < width; j++)
+            for (uint32_t j = 0; j < width; j++)
             {
                 buf[j] = (char)Y[j];
             }
@@ -65,9 +65,9 @@
             Y += pic.stride[0];
         }
         uint16_t *U = (uint16_t*)pic.planes[1];
-        for (int i = 0; i < height >> 1; i++)
+        for (uint32_t i = 0; i < height >> 1; i++)
         {
-            for (int j = 0; j < width >> 1; j++)
+            for (uint32_t j = 0; j < width >> 1; j++)
             {
                 buf[j] = (char)U[j];
             }
@@ -76,9 +76,9 @@
             U += pic.stride[1];
         }
         uint16_t *V = (uint16_t*)pic.planes[2];
-        for (int i = 0; i < height >> 1; i++)
+        for (uint32_t i = 0; i < height >> 1; i++)
         {
-            for (int j = 0; j < width >> 1; j++)
+            for (uint32_t j = 0; j < width >> 1; j++)
             {
                 buf[j] = (char)V[j];
             }
@@ -91,21 +91,21 @@
     {
         // encoder pixels same size as output pixels, write them directly
         char *Y = (char*)pic.planes[0];
-        for (int i = 0; i < height; i++)
+        for (uint32_t i = 0; i < height; i++)
         {
             ofs.write(Y, width * pixelbytes);
             Y += pic.stride[0] * pixelbytes;
         }
 
         char *U = (char*)pic.planes[1];
-        for (int i = 0; i < height >> 1; i++)
+        for (uint32_t i = 0; i < height >> 1; i++)
         {
             ofs.write(U, (width >> 1) * pixelbytes);
             U += pic.stride[1] * pixelbytes;
         }
 
         char *V = (char*)pic.planes[2];
-        for (int i = 0; i < height >> 1; i++)
+        for (uint32_t i = 0; i < height >> 1; i++)
         {
             ofs.write(V, (width >> 1) * pixelbytes);
             V += pic.stride[2] * pixelbytes;
diff -r 0666d56aaa42 -r 9bff4295adfc source/output/yuv.h
--- a/source/output/yuv.h	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/output/yuv.h	Thu Oct 31 15:40:28 2013 +0530
@@ -35,9 +35,9 @@
 {
 protected:
 
-    int width;
+    uint32_t width;
 
-    int height;
+    uint32_t height;
 
     uint32_t depth;
 
@@ -47,7 +47,7 @@
 
 public:
 
-    YUVOutput(const char *filename, int width, int height, uint32_t bitdepth);
+    YUVOutput(const char *filename, uint32_t width, uint32_t height, uint32_t bitdepth);
 
     virtual ~YUVOutput();
 
diff -r 0666d56aaa42 -r 9bff4295adfc source/x265.h
--- a/source/x265.h	Mon Oct 28 16:13:05 2013 +0530
+++ b/source/x265.h	Thu Oct 31 15:40:28 2013 +0530
@@ -130,7 +130,7 @@
 typedef struct
 {
     void*   planes[3];
-    int     stride[3];
+    intptr_t stride[3];
     int     bitDepth;
     int     sliceType;
     int     poc;
@@ -245,18 +245,18 @@
 typedef struct
 {
     int       logLevel;
-    int       bEnableWavefront;                ///< enable wavefront parallel processing
-    int       poolNumThreads;                  ///< number of threads to allocate for thread pool
-    int       frameNumThreads;                 ///< number of concurrently encoded frames
+    uint32_t       bEnableWavefront;                ///< enable wavefront parallel processing
+    uint32_t       poolNumThreads;                  ///< number of threads to allocate for thread pool
+    uint32_t       frameNumThreads;                 ///< number of concurrently encoded frames
 
-    int       internalBitDepth;                ///< bit-depth at which the encoder operates
+    uint32_t       internalBitDepth;                ///< bit-depth at which the encoder operates
 
     const char *csvfn;                         ///< csv log filename. logLevel >= 3 is frame logging, else one line per run
 
     // source specification
-    int       frameRate;                       ///< source frame-rate in Hz
-    int       sourceWidth;                     ///< source width in pixels
-    int       sourceHeight;                    ///< source height in pixels
+    uint32_t       frameRate;                       ///< source frame-rate in Hz
+    uint32_t       sourceWidth;                     ///< source width in pixels
+    uint32_t       sourceHeight;                    ///< source height in pixels
 
     // coding unit (CU) definition
     uint32_t  maxCUSize;                       ///< max. CU width and height in pixels
@@ -265,60 +265,60 @@
     uint32_t  tuQTMaxIntraDepth;               ///< amount the TU is allow to recurse beyond the intra PU depth
 
     // coding structure
-    int       decodingRefreshType;             ///< Intra refresh type (0:none, 1:CDR, 2:IDR) default: 1
+    uint32_t       decodingRefreshType;             ///< Intra refresh type (0:none, 1:CDR, 2:IDR) default: 1
     int       keyframeMin;                     ///< Minimum intra period in frames
     int       keyframeMax;                     ///< Maximum intra period in frames
     int       bOpenGOP;                        ///< Enable Open GOP referencing
     int       bframes;                         ///< Max number of consecutive B-frames
     int       lookaheadDepth;                  ///< Number of frames to use for lookahead, determines encoder latency
-    int       bFrameAdaptive;                  ///< 0 - none, 1 - fast, 2 - full (trellis) adaptive B frame scheduling
+    uint32_t       bFrameAdaptive;                  ///< 0 - none, 1 - fast, 2 - full (trellis) adaptive B frame scheduling
     int       bFrameBias;
     int       scenecutThreshold;               ///< how aggressively to insert extra I frames
 
     // Intra coding tools
-    int       bEnableConstrainedIntra;         ///< enable constrained intra prediction (ignore inter predicted reference samples)
-    int       bEnableStrongIntraSmoothing;     ///< enable strong intra smoothing for 32x32 blocks where the reference samples are flat
+    uint32_t       bEnableConstrainedIntra;         ///< enable constrained intra prediction (ignore inter predicted reference samples)
+    uint32_t       bEnableStrongIntraSmoothing;     ///< enable strong intra smoothing for 32x32 blocks where the reference samples are flat
 
     // Inter coding tools
-    int       searchMethod;                    ///< ME search method (DIA, HEX, UMH, STAR, FULL)
-    int       subpelRefine;                    ///< amount of subpel work to perform (0 .. X265_MAX_SUBPEL_LEVEL)
-    int       searchRange;                     ///< ME search range
+    uint32_t       searchMethod;                    ///< ME search method (DIA, HEX, UMH, STAR, FULL)
+    uint32_t       subpelRefine;                    ///< amount of subpel work to perform (0 .. X265_MAX_SUBPEL_LEVEL)
+    uint32_t       searchRange;                     ///< ME search range
     uint32_t  maxNumMergeCand;                 ///< Max number of merge candidates
-    int       bEnableWeightedPred;             ///< enable weighted prediction in P slices
+    uint32_t       bEnableWeightedPred;             ///< enable weighted prediction in P slices
     int       bEnableWeightedBiPred;           ///< enable bi-directional weighted prediction in B slices
 
     int       bEnableAMP;                      ///< enable asymmetrical motion predictions
-    int       bEnableRectInter;                ///< enable rectangular inter modes 2NxN, Nx2N
-    int       bEnableCbfFastMode;              ///< enable use of Cbf flags for fast mode decision
+    uint32_t       bEnableRectInter;                ///< enable rectangular inter modes 2NxN, Nx2N
+    uint32_t       bEnableCbfFastMode;              ///< enable use of Cbf flags for fast mode decision
     int       bEnableEarlySkip;                ///< enable early skip (merge) detection
     int       rdLevel;                         ///< Configure RDO work level
-    int       bEnableRDO;
-    int       bEnableRDOQ;
-    int       bEnableSignHiding;               ///< enable hiding one sign bit per TU via implicit signaling
-    int       bEnableTransformSkip;            ///< enable intra transform skipping
-    int       bEnableTSkipFast;                ///< enable fast intra transform skipping
+    uint32_t       bEnableRDO;
+    uint32_t       bEnableRDOQ;
+    uint32_t       bEnableSignHiding;               ///< enable hiding one sign bit per TU via implicit signaling
+    uint32_t       bEnableTransformSkip;            ///< enable intra transform skipping
+    uint32_t       bEnableTSkipFast;                ///< enable fast intra transform skipping
     int       bEnableRDOQTS;                   ///< enable RD optimized quantization when transform skip is selected
     int       maxNumReferences;                ///< maximum number of references a frame can have in L0
 
     // loop filter
-    int       bEnableLoopFilter;               ///< enable Loop Filter
+    uint32_t       bEnableLoopFilter;               ///< enable Loop Filter
 
     // SAO loop filter
-    int       bEnableSAO;                      ///< enable SAO filter
-    int       saoLcuBoundary;                  ///< SAO parameter estimation using non-deblocked pixels for LCU bottom and right boundary areas
-    int       saoLcuBasedOptimization;         ///< SAO LCU-based optimization
+    uint32_t       bEnableSAO;                      ///< enable SAO filter
+    uint32_t       saoLcuBoundary;                  ///< SAO parameter estimation using non-deblocked pixels for LCU bottom and right boundary areas
+    uint32_t       saoLcuBasedOptimization;         ///< SAO LCU-based optimization
 
     // coding quality
     int       cbQpOffset;                      ///< Chroma Cb QP Offset (0:default)
     int       crQpOffset;                      ///< Chroma Cr QP Offset (0:default)
-    int       rdPenalty;                       ///< RD-penalty for 32x32 TU for intra in non-intra slices (0: no RD-penalty, 1: RD-penalty, 2: maximum RD-penalty)
+    uint32_t       rdPenalty;                       ///< RD-penalty for 32x32 TU for intra in non-intra slices (0: no RD-penalty, 1: RD-penalty, 2: maximum RD-penalty)
 
     // debugging
-    int       decodedPictureHashSEI;           ///< Checksum(3)/CRC(2)/MD5(1)/disable(0) acting on decoded picture hash SEI message
+    uint32_t       decodedPictureHashSEI;           ///< Checksum(3)/CRC(2)/MD5(1)/disable(0) acting on decoded picture hash SEI message
 
     // quality metrics
-    int       bEnablePsnr;
-    int       bEnableSsim;
+    uint32_t       bEnablePsnr;
+    uint32_t       bEnableSsim;
     struct
     {
         int       bitrate;
@@ -376,7 +376,7 @@
  *      x265_max_bit_depth is 12, the internal and input bit depths can be
  *      either 8, 10, or 12. Note that the internal bit depth must be the same
  *      for all encoders allocated in the same process. */
-extern const int x265_max_bit_depth;
+extern const uint32_t x265_max_bit_depth;
 
 /* x265_version_str:
  *      A static string containing the version of this compiled x265 library */


More information about the x265-devel mailing list