[x265] A compiler warning and a question

2014-07-09 Thread Mario *LigH* Rohkrämer

v1.1+260-a1e46d813642

+
h:/MSYS/home/Entwicklung/x265/source/Lib/TLibEncoder/TEncCu.cpp:1192:6:  
warning: unused parameter 'outBestPredYuv' [-Wunused-parameter]
 void TEncCu::xCheckRDCostMerge2Nx2N(TComDataCU* outBestCU, TComDataCU*  
outTempCU, bool *earlyDetectionSkipMode, TComYuv* outBestPredYuv,  
TComYuv* rpcYuvReconBest)

  ^
h:/MSYS/home/Entwicklung/x265/source/Lib/TLibEncoder/TEncCu.cpp:1192:6:  
warning: unused parameter 'rpcYuvReconBest' [-Wunused-parameter]

+



I made a trivial shell script to compile each both architectures (32 + 64  
bit) and precisions (8 + 16 bpc) in a sequence. I noticed that the  
compiling order can be different for different runs. Sometimes target  
common is handled first, sometimes encoder. Probably nothing to worry  
about, just curious why it can be random.


--

Fun and success!
Mario *LigH* Rohkrämer
mailto:cont...@ligh.de

___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


Re: [x265] A compiler warning and a question

2014-07-09 Thread Deepthi Nandakumar
Thanks, that was a bug, fixed.


On Wed, Jul 9, 2014 at 1:34 PM, Mario *LigH* Rohkrämer cont...@ligh.de
wrote:

 v1.1+260-a1e46d813642

 +
 h:/MSYS/home/Entwicklung/x265/source/Lib/TLibEncoder/TEncCu.cpp:1192:6:
 warning: unused parameter 'outBestPredYuv' [-Wunused-parameter]
  void TEncCu::xCheckRDCostMerge2Nx2N(TComDataCU* outBestCU, TComDataCU*
 outTempCU, bool *earlyDetectionSkipMode, TComYuv* outBestPredYuv,
 TComYuv* rpcYuvReconBest)
   ^
 h:/MSYS/home/Entwicklung/x265/source/Lib/TLibEncoder/TEncCu.cpp:1192:6:
 warning: unused parameter 'rpcYuvReconBest' [-Wunused-parameter]
 +



 I made a trivial shell script to compile each both architectures (32 + 64
 bit) and precisions (8 + 16 bpc) in a sequence. I noticed that the
 compiling order can be different for different runs. Sometimes target
 common is handled first, sometimes encoder. Probably nothing to worry
 about, just curious why it can be random.

 --

 Fun and success!
 Mario *LigH* Rohkrämer
 mailto:cont...@ligh.de

 ___
 x265-devel mailing list
 x265-devel@videolan.org
 https://mailman.videolan.org/listinfo/x265-devel

___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] use std::swap() for readability

2014-07-09 Thread Satoshi Nakagawa
# HG changeset patch
# User Satoshi Nakagawa nakagawa...@oki.com
# Date 1404898046 -32400
#  Wed Jul 09 18:27:26 2014 +0900
# Node ID a3f4317f4acd89b7ef9bb8616068f9e4ff24328c
# Parent  644773b8532929a30f910fd269f521e44621f2f7
use std::swap() for readability

diff -r 644773b85329 -r a3f4317f4acd 
source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp
--- a/source/Lib/TLibCommon/TComSampleAdaptiveOffset.cppWed Jul 09 
13:55:42 2014 +0530
+++ b/source/Lib/TLibCommon/TComSampleAdaptiveOffset.cppWed Jul 09 
18:27:26 2014 +0900
@@ -535,12 +535,10 @@
 int isChroma = (yCbCr != 0) ? 1 : 0;
 int shift;
 int cuHeightTmp;
-pixel* tmpLSwap;
 pixel* tmpL;
 pixel* tmpU;
 pixel* clipTbl = NULL;
 int32_t *offsetBo = NULL;
-int32_t *tmp_swap;
 
 picWidthTmp  = (isChroma == 0) ? m_picWidth  : m_picWidth   
m_hChromaShift;
 picHeightTmp = (isChroma == 0) ? m_picHeight : m_picHeight  
m_vChromaShift;
@@ -707,9 +705,7 @@
 
 m_upBufft[startX] = signDown2;
 
-tmp_swap  = m_upBuff1;
-m_upBuff1 = m_upBufft;
-m_upBufft = tmp_swap;
+std::swap(m_upBuff1, m_upBufft);
 
 rec += stride;
 }
@@ -775,9 +771,7 @@
 
 //   if (iSaoType!=SAO_BO_0 || iSaoType!=SAO_BO_1)
 {
-tmpLSwap = m_tmpL1;
-m_tmpL1  = m_tmpL2;
-m_tmpL2  = tmpLSwap;
+std::swap(m_tmpL1, m_tmpL2);
 }
 }
 
@@ -864,7 +858,6 @@
 int frameWidthInCU = m_pic-getFrameWidthInCU();
 int frameHeightInCU = m_pic-getFrameHeightInCU();
 int stride;
-pixel *tmpUSwap;
 int sChroma = (yCbCr == 0) ? 0 : 1;
 bool mergeLeftFlag;
 int saoBitIncrease = (yCbCr == 0) ? m_saoBitIncreaseY : m_saoBitIncreaseC;
@@ -976,9 +969,7 @@
 }
 }
 
-tmpUSwap   = m_tmpU1[yCbCr];
-m_tmpU1[yCbCr] = m_tmpU2[yCbCr];
-m_tmpU2[yCbCr] = tmpUSwap;
+std::swap(m_tmpU1[yCbCr], m_tmpU2[yCbCr]);
 }
 }
 
@@ -1018,7 +1009,6 @@
 int addr;
 int frameWidthInCU = m_pic-getFrameWidthInCU();
 int stride;
-pixel *tmpUSwap;
 int sChroma = (yCbCr == 0) ? 0 : 1;
 bool mergeLeftFlag;
 int saoBitIncrease = (yCbCr == 0) ? m_saoBitIncreaseY : m_saoBitIncreaseC;
@@ -1122,9 +1112,7 @@
 }
 }
 
-tmpUSwap   = m_tmpU1[yCbCr];
-m_tmpU1[yCbCr] = m_tmpU2[yCbCr];
-m_tmpU2[yCbCr] = tmpUSwap;
+std::swap(m_tmpU1[yCbCr], m_tmpU2[yCbCr]);
 }
 }
 
diff -r 644773b85329 -r a3f4317f4acd source/Lib/TLibEncoder/TEncCu.cpp
--- a/source/Lib/TLibEncoder/TEncCu.cpp Wed Jul 09 13:55:42 2014 +0530
+++ b/source/Lib/TLibEncoder/TEncCu.cpp Wed Jul 09 18:27:26 2014 +0900
@@ -1258,22 +1258,11 @@
 uint64_t bestCost = m_rdCost-psyRdEnabled() ? 
outBestCU-m_totalPsyCost : outBestCU-m_totalRDCost;
 if (tempCost  bestCost)
 {
-TComDataCU* tmp = outTempCU;
-outTempCU = outBestCU;
-outBestCU = tmp;
-
-// Change Prediction data
-TComYuv* yuv = NULL;
-yuv = outBestPredYuv;
-outBestPredYuv = m_tmpPredYuv[depth];
-m_tmpPredYuv[depth] = yuv;
-
-yuv = rpcYuvReconBest;
-rpcYuvReconBest = m_tmpRecoYuv[depth];
-m_tmpRecoYuv[depth] = yuv;
-
+std::swap(outBestCU, outTempCU);
+std::swap(outBestPredYuv, m_tmpPredYuv[depth]);
+std::swap(rpcYuvReconBest, m_tmpRecoYuv[depth]);
 
m_rdSbacCoders[depth][CI_TEMP_BEST]-store(m_rdSbacCoders[depth][CI_NEXT_BEST]);
-}
+}
 outTempCU-setQPSubParts(origQP, 0, depth);
 outTempCU-setSkipFlagSubParts(false, 0, depth);
 if (!bestIsSkip)
@@ -1446,21 +1435,14 @@
 
 if (tempCost  bestCost)
 {
-TComYuv* yuv;
 // Change Information data
-TComDataCU* cu = outBestCU;
-outBestCU = outTempCU;
-outTempCU = cu;
+std::swap(outBestCU, outTempCU);
 
 // Change Prediction data
-yuv = m_bestPredYuv[depth];
-m_bestPredYuv[depth] = m_tmpPredYuv[depth];
-m_tmpPredYuv[depth] = yuv;
+std::swap(m_bestPredYuv[depth], m_tmpPredYuv[depth]);
 
 // Change Reconstruction data
-yuv = m_bestRecoYuv[depth];
-m_bestRecoYuv[depth] = m_tmpRecoYuv[depth];
-m_tmpRecoYuv[depth] = yuv;
+std::swap(m_bestRecoYuv[depth], m_tmpRecoYuv[depth]);
 
 
m_rdSbacCoders[depth][CI_TEMP_BEST]-store(m_rdSbacCoders[depth][CI_NEXT_BEST]);
 }
diff -r 644773b85329 -r a3f4317f4acd 
source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp
--- 

Re: [x265] use std::swap() for readability

2014-07-09 Thread Deepthi Nandakumar
Hello,

We spent a bunch of effort last year to remove STL dependencies, since they
cause serious trouble between different compilers (even between different
compiler versions).  This is especially since a lot of users will use x265
as a static library.

Thanks,
Deepthi


On Wed, Jul 9, 2014 at 3:00 PM, Satoshi Nakagawa nakagawa...@oki.com
wrote:

 # HG changeset patch
 # User Satoshi Nakagawa nakagawa...@oki.com
 # Date 1404898046 -32400
 #  Wed Jul 09 18:27:26 2014 +0900
 # Node ID a3f4317f4acd89b7ef9bb8616068f9e4ff24328c
 # Parent  644773b8532929a30f910fd269f521e44621f2f7
 use std::swap() for readability

 diff -r 644773b85329 -r a3f4317f4acd
 source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp
 --- a/source/Lib/TLibCommon/TComSampleAdaptiveOffset.cppWed Jul 09
 13:55:42 2014 +0530
 +++ b/source/Lib/TLibCommon/TComSampleAdaptiveOffset.cppWed Jul 09
 18:27:26 2014 +0900
 @@ -535,12 +535,10 @@
  int isChroma = (yCbCr != 0) ? 1 : 0;
  int shift;
  int cuHeightTmp;
 -pixel* tmpLSwap;
  pixel* tmpL;
  pixel* tmpU;
  pixel* clipTbl = NULL;
  int32_t *offsetBo = NULL;
 -int32_t *tmp_swap;

  picWidthTmp  = (isChroma == 0) ? m_picWidth  : m_picWidth  
 m_hChromaShift;
  picHeightTmp = (isChroma == 0) ? m_picHeight : m_picHeight 
 m_vChromaShift;
 @@ -707,9 +705,7 @@

  m_upBufft[startX] = signDown2;

 -tmp_swap  = m_upBuff1;
 -m_upBuff1 = m_upBufft;
 -m_upBufft = tmp_swap;
 +std::swap(m_upBuff1, m_upBufft);

  rec += stride;
  }
 @@ -775,9 +771,7 @@

  //   if (iSaoType!=SAO_BO_0 || iSaoType!=SAO_BO_1)
  {
 -tmpLSwap = m_tmpL1;
 -m_tmpL1  = m_tmpL2;
 -m_tmpL2  = tmpLSwap;
 +std::swap(m_tmpL1, m_tmpL2);
  }
  }

 @@ -864,7 +858,6 @@
  int frameWidthInCU = m_pic-getFrameWidthInCU();
  int frameHeightInCU = m_pic-getFrameHeightInCU();
  int stride;
 -pixel *tmpUSwap;
  int sChroma = (yCbCr == 0) ? 0 : 1;
  bool mergeLeftFlag;
  int saoBitIncrease = (yCbCr == 0) ? m_saoBitIncreaseY :
 m_saoBitIncreaseC;
 @@ -976,9 +969,7 @@
  }
  }

 -tmpUSwap   = m_tmpU1[yCbCr];
 -m_tmpU1[yCbCr] = m_tmpU2[yCbCr];
 -m_tmpU2[yCbCr] = tmpUSwap;
 +std::swap(m_tmpU1[yCbCr], m_tmpU2[yCbCr]);
  }
  }

 @@ -1018,7 +1009,6 @@
  int addr;
  int frameWidthInCU = m_pic-getFrameWidthInCU();
  int stride;
 -pixel *tmpUSwap;
  int sChroma = (yCbCr == 0) ? 0 : 1;
  bool mergeLeftFlag;
  int saoBitIncrease = (yCbCr == 0) ? m_saoBitIncreaseY :
 m_saoBitIncreaseC;
 @@ -1122,9 +1112,7 @@
  }
  }

 -tmpUSwap   = m_tmpU1[yCbCr];
 -m_tmpU1[yCbCr] = m_tmpU2[yCbCr];
 -m_tmpU2[yCbCr] = tmpUSwap;
 +std::swap(m_tmpU1[yCbCr], m_tmpU2[yCbCr]);
  }
  }

 diff -r 644773b85329 -r a3f4317f4acd source/Lib/TLibEncoder/TEncCu.cpp
 --- a/source/Lib/TLibEncoder/TEncCu.cpp Wed Jul 09 13:55:42 2014 +0530
 +++ b/source/Lib/TLibEncoder/TEncCu.cpp Wed Jul 09 18:27:26 2014 +0900
 @@ -1258,22 +1258,11 @@
  uint64_t bestCost = m_rdCost-psyRdEnabled() ?
 outBestCU-m_totalPsyCost : outBestCU-m_totalRDCost;
  if (tempCost  bestCost)
  {
 -TComDataCU* tmp = outTempCU;
 -outTempCU = outBestCU;
 -outBestCU = tmp;
 -
 -// Change Prediction data
 -TComYuv* yuv = NULL;
 -yuv = outBestPredYuv;
 -outBestPredYuv = m_tmpPredYuv[depth];
 -m_tmpPredYuv[depth] = yuv;
 -
 -yuv = rpcYuvReconBest;
 -rpcYuvReconBest = m_tmpRecoYuv[depth];
 -m_tmpRecoYuv[depth] = yuv;
 -
 +std::swap(outBestCU, outTempCU);
 +std::swap(outBestPredYuv, m_tmpPredYuv[depth]);
 +std::swap(rpcYuvReconBest, m_tmpRecoYuv[depth]);

  
 m_rdSbacCoders[depth][CI_TEMP_BEST]-store(m_rdSbacCoders[depth][CI_NEXT_BEST]);
 -}
 +}
  outTempCU-setQPSubParts(origQP, 0, depth);
  outTempCU-setSkipFlagSubParts(false, 0, depth);
  if (!bestIsSkip)
 @@ -1446,21 +1435,14 @@

  if (tempCost  bestCost)
  {
 -TComYuv* yuv;
  // Change Information data
 -TComDataCU* cu = outBestCU;
 -outBestCU = outTempCU;
 -outTempCU = cu;
 +std::swap(outBestCU, outTempCU);

  // Change Prediction data
 -yuv = m_bestPredYuv[depth];
 -m_bestPredYuv[depth] = m_tmpPredYuv[depth];
 -m_tmpPredYuv[depth] = yuv;
 +std::swap(m_bestPredYuv[depth], m_tmpPredYuv[depth]);

  // Change Reconstruction data
 -yuv = 

[x265] [PATCH] compress: resetting CABAC contexts in lower rdLevels

2014-07-09 Thread deepthi
# HG changeset patch
# User Deepthi Nandakumar deep...@multicorewareinc.com
# Date 1404904548 -19800
#  Wed Jul 09 16:45:48 2014 +0530
# Node ID faf9c816d7ef28d1217a2919d646caf4c68265da
# Parent  644773b8532929a30f910fd269f521e44621f2f7
compress: resetting CABAC contexts in lower rdLevels.

diff -r 644773b85329 -r faf9c816d7ef source/encoder/compress.cpp
--- a/source/encoder/compress.cpp   Wed Jul 09 13:55:42 2014 +0530
+++ b/source/encoder/compress.cpp   Wed Jul 09 16:45:48 2014 +0530
@@ -330,6 +330,7 @@
 yuv = yuvReconBest;
 yuvReconBest = m_tmpRecoYuv[depth];
 m_tmpRecoYuv[depth] = yuv;
+
m_rdSbacCoders[depth][CI_TEMP_BEST]-store(m_rdSbacCoders[depth][CI_NEXT_BEST]);
 }
 
 //Encode with residue
@@ -346,6 +347,7 @@
 yuv = yuvReconBest;
 yuvReconBest = m_tmpRecoYuv[depth];
 m_tmpRecoYuv[depth] = yuv;
+
m_rdSbacCoders[depth][CI_TEMP_BEST]-store(m_rdSbacCoders[depth][CI_NEXT_BEST]);
 }
 }
 }
@@ -514,6 +516,10 @@
 m_bestRecoYuv[depth] = m_bestMergeRecoYuv[depth];
 m_bestMergeRecoYuv[depth] = tempYuv;
 }
+else
+{
+
m_rdSbacCoders[depth][CI_TEMP_BEST]-store(m_rdSbacCoders[depth][CI_NEXT_BEST]);
+}
 }
 
 /* Check for Intra in inter frames only if its a P-slice*/
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


Re: [x265] use std::swap() for readability

2014-07-09 Thread Derek Buitenhuis
On 7/9/2014 11:16 AM, Deepthi Nandakumar wrote:
 We spent a bunch of effort last year to remove STL dependencies, since they 
 cause serious trouble between different compilers (even between different 
 compiler versions).  This is especially since a lot of users will use x265 as 
 a static library.

I tried to ask about this before to no avail: What compilers and how?

STL portability has not been an issue for a very long time.

- Derek
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


Re: [x265] A compiler warning and a question

2014-07-09 Thread Steve Borho
On Wed, Jul 9, 2014 at 3:04 AM, Mario *LigH* Rohkrämer cont...@ligh.de wrote:
 v1.1+260-a1e46d813642

 +
 h:/MSYS/home/Entwicklung/x265/source/Lib/TLibEncoder/TEncCu.cpp:1192:6:
 warning: unused parameter 'outBestPredYuv' [-Wunused-parameter]
  void TEncCu::xCheckRDCostMerge2Nx2N(TComDataCU* outBestCU, TComDataCU*
 outTempCU, bool *earlyDetectionSkipMode, TComYuv* outBestPredYuv, TComYuv*
 rpcYuvReconBest)
   ^
 h:/MSYS/home/Entwicklung/x265/source/Lib/TLibEncoder/TEncCu.cpp:1192:6:
 warning: unused parameter 'rpcYuvReconBest' [-Wunused-parameter]
 +



 I made a trivial shell script to compile each both architectures (32 + 64
 bit) and precisions (8 + 16 bpc) in a sequence. I noticed that the compiling
 order can be different for different runs. Sometimes target common is
 handled first, sometimes encoder. Probably nothing to worry about, just
 curious why it can be random.

If all of the Makefiles were generated by the same version of cmake,
I'm stumped by that.

It is harmless and inexplicable at the same time.  It might be
interesting to diff the Makefiles in the various folders and see if
anything interesting sticks out.  We're certainly not doing anything
deliberate to change the build order for the various configurations.

--
Steve
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel