Re: [x265] [PATCH] motion: skip the ME search if any of MVC sad cost is zero

2015-06-29 Thread Gopu Govindaswamy
Yes fixed the issue for  vc 11 32 bit compiler and i will resend the patch
with the detailed commit message (effect of the performance and quality
changes)

On Mon, Jun 29, 2015 at 11:33 AM, Deepthi Nandakumar 
deep...@multicorewareinc.com wrote:

 This crashes on 3 of the first 5 commandlines in the smoke test.

 On Fri, Jun 26, 2015 at 10:57 AM, g...@multicorewareinc.com wrote:

 # HG changeset patch
 # User Gopu Govindaswamy g...@multicorewareinc.com
 # Date 1435296461 -19800
 #  Fri Jun 26 10:57:41 2015 +0530
 # Node ID 6d7b0c5585cc6498ef40ddcf4a0d3c241892d5bf
 # Parent  09193c05af52b2024635037dbf9fa19d4b978e4b
 motion: skip the ME search if any of MVC sad cost is zero

 diff -r 09193c05af52 -r 6d7b0c5585cc source/encoder/motion.cpp
 --- a/source/encoder/motion.cpp Fri Jun 26 10:16:29 2015 +0530
 +++ b/source/encoder/motion.cpp Fri Jun 26 10:57:41 2015 +0530
 @@ -646,7 +646,15 @@
  MV m = mvc[i].clipped(qmvmin, qmvmax);
  if (m.notZero()  m != pmv  m != bestpre) // check already
 measured
  {
 -int cost = subpelCompare(ref, m, sad) + mvcost(m);
 +int cost = subpelCompare(ref, m, sad);
 +// skip ME Search if any of MVC sad cost is zero
 +if (!cost)
 +{
 +outQMv = m;
 +return mvcost(m);
 +}
 +else
 +cost += mvcost(m);
  if (cost  bprecost)
  {
  bprecost = cost;
 ___
 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




-- 
Thanks  Regards
Gopu G
Multicoreware Inc
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


Re: [x265] [PATCH] analysis: Fix blocking artifacts while sharing best merge candidates

2015-06-15 Thread Gopu Govindaswamy
On Fri, Jun 12, 2015 at 8:47 PM, Steve Borho st...@borho.org wrote:

 On 06/12, g...@multicorewareinc.com wrote:
  # HG changeset patch
  # User Gopu Govindaswamy g...@multicorewareinc.com
  # Date 1434098206 -19800
  #  Fri Jun 12 14:06:46 2015 +0530
  # Node ID e0327556bbcda705af8689ec0a77206599f5de61
  # Parent  2cd9183df03edff0b148bab6e133dfe1ae4f69a1
  analysis: Fix blocking artifacts while sharing best merge candidates
 
  While ecoding with --analysis-mode=load mode noticed there will blocking
  artifacts, this issue is while sharing best merge candidate,
 
  when sharing the merge candidate before selecting the best mode (SKIP
 MODE),
  first encode merge with residual (no skip) and if this mode hasCbf then
 try
  merge without residual(skip) then select the best mode (SKIP MODE) from
 this two
 
  diff -r 2cd9183df03e -r e0327556bbcd source/encoder/analysis.cpp
  --- a/source/encoder/analysis.cpp Thu Jun 11 17:06:46 2015 +0530
  +++ b/source/encoder/analysis.cpp Fri Jun 12 14:06:46 2015 +0530
  @@ -1455,19 +1455,50 @@
   bool foundCbf0Merge = false;
   bool triedPZero = false, triedBZero = false;
   bestPred-rdCost = MAX_INT64;
  +uint8_t hasCbf = true;
  +bool swapped = false;
 
   if (isSkipMode)

 this ends up being a lot of duplicate code.

 How about something like this instead?

   uint32_t first = 0, last = numMergeCand - 1;
   if (isSkipMode)
   first = last = *m_reuseBestMergeCand;

   for (uint32_t i = first; i = last; i++)
   {
 ...
   }

 also, isSkipMode should probably be renamed


yes  This is looks fine, i will resend the patch with the modifications


   {
   uint32_t i = *m_reuseBestMergeCand;
  -bestPred-cu.m_mvpIdx[0][0] = (uint8_t)i;
  -bestPred-cu.m_interDir[0] = candDir[i];
  -bestPred-cu.m_mv[0][0] = candMvField[i][0].mv;
  -bestPred-cu.m_mv[1][0] = candMvField[i][1].mv;
  -bestPred-cu.m_refIdx[0][0] = (int8_t)candMvField[i][0].refIdx;
  -bestPred-cu.m_refIdx[1][0] = (int8_t)candMvField[i][1].refIdx;
  +tempPred-cu.m_mvpIdx[0][0] = (uint8_t)i;/* merge candidate
 ID is stored in L0 MVP idx */
  +tempPred-cu.m_interDir[0] = candDir[i];
  +tempPred-cu.m_mv[0][0] = candMvField[i][0].mv;
  +tempPred-cu.m_mv[1][0] = candMvField[i][1].mv;
  +tempPred-cu.m_refIdx[0][0] = (int8_t)candMvField[i][0].refIdx;
  +tempPred-cu.m_refIdx[1][0] = (int8_t)candMvField[i][1].refIdx;
  +tempPred-cu.setPredModeSubParts(MODE_INTER); /* must be
 cleared between encode iterations */
 
  -motionCompensation(bestPred-cu, pu, bestPred-predYuv, true,
 true);
  -encodeResAndCalcRdSkipCU(*bestPred);
  +motionCompensation(tempPred-cu, pu, tempPred-predYuv, true,
 true);
  +
  +/* if the best prediction has CBF (not a skip) then try merge
 with residual */
  +encodeResAndCalcRdInterCU(*tempPred, cuGeom);
  +if (tempPred-rdCost  bestPred-rdCost)
  +{
  +hasCbf = tempPred-cu.getQtRootCbf(0);
  +std::swap(tempPred, bestPred);
  +swapped = true;
  +}
  +
  +if (!m_param-bLossless  hasCbf)
  +{
  +if (swapped)
  +{
  +tempPred-cu.m_mvpIdx[0][0] = (uint8_t)i;
  +tempPred-cu.m_interDir[0] = candDir[i];
  +tempPred-cu.m_mv[0][0] = candMvField[i][0].mv;
  +tempPred-cu.m_mv[1][0] = candMvField[i][1].mv;
  +tempPred-cu.m_refIdx[0][0] =
 (int8_t)candMvField[i][0].refIdx;
  +tempPred-cu.m_refIdx[1][0] =
 (int8_t)candMvField[i][1].refIdx;
  +tempPred-cu.setPredModeSubParts(MODE_INTER);
  +tempPred-predYuv.copyFromYuv(bestPred-predYuv);
  +}
  +
  +/* try merge without residual (skip), if not lossless
 coding */
  +encodeResAndCalcRdSkipCU(*tempPred);
  +if (tempPred-rdCost  bestPred-rdCost)
  +std::swap(tempPred, bestPred);
  +}
   }
   else
   {
  @@ -1504,8 +1535,6 @@
 
   motionCompensation(tempPred-cu, pu, tempPred-predYuv,
 true, true);
 
  -uint8_t hasCbf = true;
  -bool swapped = false;
   if (!foundCbf0Merge)
   {
   /* if the best prediction has CBF (not a skip) then try
 merge with residual */
  ___
  x265-devel mailing list
  x265-devel@videolan.org
  https://mailman.videolan.org/listinfo/x265-devel

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




-- 
Thanks  Regards
Gopu G
Multicoreware Inc
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


Re: [x265] --analysis-mode error

2015-06-12 Thread Gopu Govindaswamy
Hello Joshua,

   Thanks for reporting this blocking artifacts issue, we have identified
the issue, there is a bug while sharing the best merge candidates and we
have fixed this issue and sent the patch for it

Thanks
Gopu G

On Thu, Jun 11, 2015 at 6:06 PM, Joshua Bowman silverback...@gmail.com
wrote:

 I just made my first encode with --analysis-mode load and while it ran 3
 times as fast, the
 encoded file was completely broken. This is with 10-bit input and output,
 current git head.

 Original command line: x265 --preset veryslow --input pristest.y4m
 --analysis-mode save
 --analysis-file pristest.dat --crf 20 -o pristest-q20-veryslow.hevc
 Second command line: x265 --preset veryslow --input pristest.y4m
 --analysis-mode load
 --analysis-file pristest.dat --crf 24 -o pristest-q24-veryslow.hevc

 pristest.y4m:
 https://dl.dropboxusercontent.com/u/54412753/x265/pristest_30s.7z (first
 30s of
 the original 120s)
 pristest.dat:
 https://dl.dropboxusercontent.com/u/54412753/x265/pristest.7z
 pristest-q24-veryslow.hevc:

 https://dl.dropboxusercontent.com/u/54412753/x265/pristest-q24-veryslow.hevc

 All I changed was the crf, and I got tons of black blocks and echo blocks,
 especially beginning
 around 0:20, as if residuals sometimes weren't being applied at all. MPDN
 just freezes, other
 players play with major artifacts.

 Aside from that, holy crap is the analysis file huge. It's as large as the
 y4m; I had to put it
 on a ntfs compressed folder, where it went from 11gb to 800mb real bytes.
 (The 7-zip is only
 50mb.) Surely x265 can run some sort of compression over it while writing,
 either low xz (lzma2)
 or at least lzo/lz4? When I first attempted to use it from the same drive
 as my working file, I
 ended up thrashing the disk so badly that encoding speed was actually
 halved, until I moved it
 to my SSD system drive.
 ___
 x265-devel mailing list
 x265-devel@videolan.org
 https://mailman.videolan.org/listinfo/x265-devel




-- 
Thanks  Regards
Gopu G
Multicoreware Inc
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


Re: [x265] [PATCH] search: add lowres MV into search mv candidate list for search ME(CHANGESOUTPUT)

2015-05-18 Thread Gopu Govindaswamy
On Thu, May 14, 2015 at 8:18 PM, Steve Borho st...@borho.org wrote:

 On 05/14, Steve Borho wrote:
  On 05/14, Deepthi Nandakumar wrote:
   Ran the smoke test on this, the results were mixed - on some
 commandlines,
   the encode efficiency benefits were really good though.
 
  the results I've seen show loss of effiency at slower presets, which is
  a real head-scratcher since it should help them most. Adding an
  additional motion candidate shouldn't reduce efficiency.
 
  I think I'd like to see a general solution for this (not just 16x16 CUs)
  before it gets pushed.  I think passing the PU to the function and
  sampling the lowres MV array at the PU center rather than the CU origin
  would be adequate (just add half PU width to block_x and half PU height
  to block_y).

 and add the PU absPartIdx to the CU absPartIdx so you get the correct
 block starting position within the CTU.

   uint32_t block_x = cu.m_cuPelX + g_zscanToPelX[pu.cuAbsPartIdx +
 pu.puAbsPartIdx] + pu.width/2;

 also, please double-check that cu.m_cuPelX doesn't already include the
 CU's absPartIdx within the CTU. If it does, then adding the CU part
 offset again would be redundant (and might be why this isn't working as
 well as it should).


the above modification i have done, and this new modification will works
for all depths, i indexing the lowres MV
like
uint32_t block_x = cu.m_cuPelX + g_zscanToPelX[pu.puAbsPartIdx +
pu.cuAbsPartIdx] + pu.width/2;
uint32_t block_y = cu.m_cuPelY + g_zscanToPelY[pu.puAbsPartIdx +
pu.cuAbsPartIdx] + pu.height/2;

   uint32_t stride = m_frame-m_lowres.maxBlocksInRow;
   uint32_t idx = ((block_y / 16) * stride) + (block_x / 16);
   lmv = mv[idx];

but still i would see the mixed results and also i have verified, the
cu.m_cuPelX doesn't already include the
CU's absPartIdx within the CTU but the CU's absPartIdx has been included
into cu.m_cuPelX in initSubCU()

here is the sample results:

Adding lowresMV into MV candidate list

FPS

 Bitrate

 Y PSNR

 U PSNR

 V PSNR

 Global PSNR

 SSIM

 SSIM (dB)

72.98

2614.03

25.767

36.132

38.783

28.689

0.7565

6.135

67.85

2575.15

25.973

36.556

38.857

28.906

0.764529

6.281

48.24

2686.95

26.287

36.49

38.925

29.142

0.797709

6.94

31.54

2556.99

26.838

36.91

39.058

29.625

0.82559

7.584

22.27

2538.81

26.871

36.861

39.019

29.638

0.822282

7.503

8.16

2561.36

27.265

36.758

39.066

29.927

0.832109

7.75

1.76

2552.55

27.622

36.911

39.113

30.219

0.840274

7.966



without adding lowresMV into MV candidate list

FPS

 Bitrate

 Y PSNR

 U PSNR

 V PSNR

 Global PSNR

 SSIM

 SSIM (dB)

85.39

2632.82

25.739

36.123

38.737

28.662

0.755912

6.125

63.88

2574.34

25.975

36.551

38.845

28.906

0.764624

6.282

43.79

2688

26.289

36.497

38.91

29.142

0.79745

6.935

29.78

2557.27

26.838

36.906

39.045

29.623

0.825511

7.582

21.64

2539.7

26.872

36.854

39.032

29.639

0.822437

7.506

8.2

2561.21

27.265

36.757

39.072

29.927

0.832237

7.753

1.73

2550.44

27.615

36.901

39.098

30.211

0.840277

7.966

review this results and let me know so that i can send the final patch

  On Thu, May 14, 2015 at 10:53 AM, g...@multicorewareinc.com wrote:
  
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1431581025 -19800
#  Thu May 14 10:53:45 2015 +0530
# Node ID def132fbcf33352b18a31015dfefff79e95d21d7
# Parent  479087422e29a672d6e9bc8d0cd2a65649d71fe2
search: add lowres MV into search mv candidate list for search
ME(CHANGESOUTPUT)
   
Add one more mv (lowres MV) into MV candidates list and this extra
candidates
applicable only for depth 2, the lowres MV's are calculated 16x16
 blocks
   
diff -r 479087422e29 -r def132fbcf33 source/encoder/search.cpp
--- a/source/encoder/search.cpp Wed May 13 16:52:59 2015 -0700
+++ b/source/encoder/search.cpp Thu May 14 10:53:45 2015 +0530
@@ -1930,9 +1930,9 @@
 do
 {
 if (meId  m_slice-m_numRefIdx[0])
-slave.singleMotionEstimation(*this, pme.mode, pme.pu,
pme.puIdx, 0, meId);
+slave.singleMotionEstimation(*this, pme.mode,
 pme.cuGeom,
pme.pu, pme.puIdx, 0, meId);
 else
-slave.singleMotionEstimation(*this, pme.mode, pme.pu,
pme.puIdx, 1, meId - m_slice-m_numRefIdx[0]);
+slave.singleMotionEstimation(*this, pme.mode,
 pme.cuGeom,
pme.pu, pme.puIdx, 1, meId - m_slice-m_numRefIdx[0]);
   
 meId = -1;
 pme.m_lock.acquire();
@@ -1943,20 +1943,25 @@
 while (meId = 0);
 }
   
-void Search::singleMotionEstimation(Search master, Mode interMode,
const PredictionUnit pu, int part, int list, int ref)
+void Search::singleMotionEstimation(Search master, Mode interMode,
const CUGeom cuGeom, const PredictionUnit pu, int part, int list,
 int ref)
 {
 uint32_t bits = master.m_listSelBits

Re: [x265] [PATCH] search: remove the merge candidates from the motion candidate list

2015-04-26 Thread Gopu Govindaswamy
On Thu, Apr 23, 2015 at 9:34 AM, Gopu Govindaswamy 
g...@multicorewareinc.com wrote:



 On Wednesday, April 22, 2015, Steve Borho st...@borho.org wrote:
  On 04/22, g...@multicorewareinc.com wrote:
  # HG changeset patch
  # User Gopu Govindaswamy g...@multicorewareinc.com
  # Date 1429699945 -19800
  #  Wed Apr 22 16:22:25 2015 +0530
  # Node ID 61d6b2ba3206a3ebf7b38118ee62e6c5e64e1c1b
  # Parent  6d34a490302ee75f2ddc6ef7d841fb900dce1bb7
  search: remove the merge candidates from the motion candidate list
 
  The merge logic is already evaluating the cost of the merge MVs
 
  this is only addressing the temporal candidate, what about all the
  others?


I have verified on this, currently the merge candidates added into merge
MV's only if bTemporalMVPEnabled enabled,
else we will not add the merge candidates into merge MV's

 
  diff -r 6d34a490302e -r 61d6b2ba3206 source/common/cudata.cpp
  --- a/source/common/cudata.cppWed Apr 22 11:52:43 2015 +0530
  +++ b/source/common/cudata.cppWed Apr 22 16:22:25 2015 +0530
  @@ -1718,7 +1718,7 @@
   int curRefPOC = m_slice-m_refPOCList[picList][refIdx];
   int curPOC = m_slice-m_poc;
 
  -pmv[numMvc++] = amvpCand[num++] =
 scaleMvByPOCDist(neighbours[MD_COLLOCATED].mv[picList], curPOC, curRefPOC,
 colPOC, colRefPOC);
  +amvpCand[num++] =
 scaleMvByPOCDist(neighbours[MD_COLLOCATED].mv[picList], curPOC, curRefPOC,
 colPOC, colRefPOC);
   }
   }
 
  ___
  x265-devel mailing list
  x265-devel@videolan.org
  https://mailman.videolan.org/listinfo/x265-devel
 
  --
  Steve Borho
  ___
  x265-devel mailing list
  x265-devel@videolan.org
  https://mailman.videolan.org/listinfo/x265-devel
 

 --
 Thanks  Regards
 Gopu G
 Multicoreware Inc





-- 
Thanks  Regards
Gopu G
Multicoreware Inc
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


Re: [x265] [PATCH rfc] aq: implementation of Fine-grained Adaptive Quantization

2015-03-16 Thread Gopu Govindaswamy
Thanks for review

On Tue, Mar 17, 2015 at 4:27 AM, Steve Borho st...@borho.org wrote:

 On 03/16, g...@multicorewareinc.com wrote:
  # HG changeset patch
  # User Gopu Govindaswamy g...@multicorewareinc.com
  # Date 1426504011 -19800
  #  Mon Mar 16 16:36:51 2015 +0530
  # Node ID 615b61dd2be5e8ef1a7fe2f22edcac6e437f300d
  # Parent  6461985f33ac6fc5b205879bbb0f2a535226ca76
  aq: implementation of Fine-grained Adaptive Quantization

 nit: prefer lower case for Fine


OK,


  Currently adaptive quantization adjusts the QP values on 64x64 pixel
 coding tree
  units (CTUs) across a video frame. the new param option --max-dqp-depth
 will
  enable quantization parameter (QP) to be adjusted to individual
 quantization
  groups (QGs)
 
  Example:
  --max-dqp-depth=0 for 64x64 blocks
  --max-dqp-depth=1 for 32x32 blocks
  --max-dqp-depth=2 for 16x16 blocks

 what if --ctu is not 64?  This patch crashes about 1/3 of the smoke tests


Ok, this is my fault and i have added the validation in encoder configure
like

if (p-rc.maxCuDQPDepth  (int32_t)(g_maxCUDepth - 1))
  then setting default value(depth) for maxCuDQPDepth= 0

the current patch will support onlyCU size  64x64, 32x32 and 16x16
for example if --ctu=32 the maxCUDepth is 2 and we will support depth 0 and
1 i.e 32x32 and 16x16 same for --ctu=16


  currently this feature not supported for block 8x8
 
  sample test results for each depth
 
  clip - ducks_take_off_420_720p50.y4m
  preset=medium
  max-dqp-depth 0 - encoded 500 frames in 36.86s (13.56 fps), 4575.09 kb/s,
  Global PSNR: 29.587, SSIM Mean Y: 0.8309761 ( 7.721 dB)
  max-dqp-depth 1 - encoded 500 frames in 43.00s (11.63 fps), 4606.96 kb/s,
  Global PSNR: 29.590, SSIM Mean Y: 0.8313855 ( 7.731 dB)
  max-dqp-depth 2 - encoded 500 frames in 35.47s (14.10 fps), 4599.65 kb/s,
  Global PSNR: 29.575, SSIM Mean Y: 0.8311820 ( 7.726 dB)
 
  preset=veryslow
  max-dqp-depth 0 - encoded 500 frames in 499.24s (1.00 fps), 4407.79 kb/s,
  Global PSNR: 29.890, SSIM Mean Y: 0.8419664 ( 8.013 dB)
  max-dqp-depth 1 - encoded 500 frames in 497.96s (1.00 fps),
  4413.64 kb/s, Global PSNR: 29.884, SSIM Mean Y: 0.8420085 ( 8.014 dB)
  max-dqp-depth 2 - encoded 500 frames in 511.36s (0.98 fps), 4428.71 kb/s,
  Global PSNR: 29.877, SSIM Mean Y: 0.8419621 ( 8.012 dB)
 
  -
  clip - Cactus_1920x1080_50.y4m
  preset=medium
  max-dqp-depth 0 - encoded 100 frames in 13.61s (7.35 fps), 2588.25 kb/s,
  Global PSNR: 34.890, SSIMMean Y: 0.8685867 ( 8.814 dB)
  max-dqp-depth 1 - encoded 100 frames in 12.15s (8.23 fps), 2629.22 kb/s,
  Global PSNR: 34.901, SSIMMean Y: 0.8689989 ( 8.827 dB)
  max-dqp-depth 2 - encoded 100 frames in 12.26s (8.16 fps), 2624.31 kb/s,
  Global PSNR: 34.864, SSIMMean Y: 0.8688061 ( 8.821 dB)
 
  preset=veryslow
  max-dqp-depth 0 - encoded 100 frames in 138.68s (0.72 fps), 2277.00 kb/s,
  Global PSNR: 35.118, SSIM Mean Y: 0.8725818 ( 8.948 dB)
  max-dqp-depth 1 - encoded 100 frames in 137.21s (0.73 fps), 2293.83 kb/s,
  Global PSNR: 35.117, SSIM Mean Y: 0.8725589 ( 8.947 dB)
  max-dqp-depth 2 - encoded 100 frames in 134.96s (0.74 fps), 2299.79 kb/s,
  Global PSNR: 35.109, SSIM Mean Y: 0.8727326 ( 8.953 dB)

 this doesn't tell us much; I think the most compelling change from this
 commit will be in visual quality that is not easily measured.


OK,



  diff -r 6461985f33ac -r 615b61dd2be5 source/common/cudata.cpp
  --- a/source/common/cudata.cppSun Mar 15 11:58:32 2015 -0500
  +++ b/source/common/cudata.cppMon Mar 16 16:36:51 2015 +0530
  @@ -298,7 +298,7 @@
   }
 
   // initialize Sub partition
  -void CUData::initSubCU(const CUData ctu, const CUGeom cuGeom)
  +void CUData::initSubCU(const CUData ctu, const CUGeom cuGeom, const
 int qp)
   {
   m_absIdxInCTU   = cuGeom.absPartIdx;
   m_encData   = ctu.m_encData;
  @@ -312,8 +312,11 @@
   m_cuAboveRight  = ctu.m_cuAboveRight;
   X265_CHECK(m_numPartitions == cuGeom.numPartitions, initSubCU()
 size mismatch\n);
 
  -/* sequential memsets */
  -m_partSet((uint8_t*)m_qp, (uint8_t)ctu.m_qp[0]);
  +if (cuGeom.depth = (uint32_t)m_encData-m_param-rc.maxCuDQPDepth)
  +m_partSet((uint8_t*)m_qp, (uint8_t)qp);
  +else
  +m_partSet((uint8_t*)m_qp, (uint8_t)ctu.m_qp[0]);
  +
   m_partSet(m_log2CUSize,   (uint8_t)cuGeom.log2CUSize);
   m_partSet(m_lumaIntraDir, (uint8_t)DC_IDX);
   m_partSet(m_tqBypass, (uint8_t)m_encData-m_param-bLossless);
  diff -r 6461985f33ac -r 615b61dd2be5 source/common/cudata.h
  --- a/source/common/cudata.h  Sun Mar 15 11:58:32 2015 -0500
  +++ b/source/common/cudata.h  Mon Mar 16 16:36:51 2015 +0530
  @@ -182,7 +182,7 @@
   static void calcCTUGeoms(uint32_t ctuWidth, uint32_t ctuHeight,
 uint32_t maxCUSize, uint32_t minCUSize, CUGeom
 cuDataArray[CUGeom::MAX_GEOMS]);
 
   void initCTU(const Frame frame, uint32_t cuAddr, int qp);
  -void initSubCU(const CUData ctu, const CUGeom cuGeom);
  +void

Re: [x265] [PATCH] dqp: add param for maxCuDQPDepth

2015-03-12 Thread Gopu Govindaswamy
On Thu, Mar 12, 2015 at 10:15 PM, Steve Borho st...@borho.org wrote:

 On 03/12, g...@multicorewareinc.com wrote:
  # HG changeset patch
  # User Gopu Govindaswamy g...@multicorewareinc.com
  # Date 1426140129 -19800
  #  Thu Mar 12 11:32:09 2015 +0530
  # Node ID 1105c6db84119001ae0ed30849b00d4aca17018a
  # Parent  b931c50d55011a1ddc08f0a230b9632fcb4674d7
  dqp: add param for maxCuDQPDepth
 
  currently the maxCuDQPDepth is default set to 0, make mazCuDQPDepth as
  configurable

 typo

 
  diff -r b931c50d5501 -r 1105c6db8411 source/common/param.cpp
  --- a/source/common/param.cpp Wed Mar 11 21:58:02 2015 -0500
  +++ b/source/common/param.cpp Thu Mar 12 11:32:09 2015 +0530
  @@ -210,6 +210,7 @@
   param-rc.zones = NULL;
   param-rc.bEnableSlowFirstPass = 0;
   param-rc.bStrictCbr = 0;
  +param-rc.maxCuDQPDepth = 0;
 
   /* Video Usability Information (VUI) */
   param-vui.aspectRatioIdc = 0;
  @@ -838,6 +839,7 @@
   OPT2(pools, numa-pools) p-numaPools = strdup(value);
   OPT(lambda-file) p-rc.lambdaFileName = strdup(value);
   OPT(analysis-file) p-analysisFileName = strdup(value);
  +OPT(maxdqp-depth) p-rc.maxCuDQPDepth = atoi(value);

 is the max necessary in the param name?  In other places we use max it
 is max- something, so this either needs to be max-dqp-depth or just
 dqp-depth.


 Ok, i will make this as max-dqp-depth


   else
   return X265_PARAM_BAD_NAME;
   #undef OPT
  diff -r b931c50d5501 -r 1105c6db8411 source/encoder/encoder.cpp
  --- a/source/encoder/encoder.cpp  Wed Mar 11 21:58:02 2015 -0500
  +++ b/source/encoder/encoder.cpp  Thu Mar 12 11:32:09 2015 +0530
  @@ -1548,12 +1548,12 @@
   if (!m_param-bLossless  (m_param-rc.aqMode || bIsVbv))
   {
   pps-bUseDQP = true;
  -pps-maxCuDQPDepth = 0; /* TODO: make configurable? */
  +pps-maxCuDQPDepth = m_param-rc.maxCuDQPDepth;
   }
   else
   {
   pps-bUseDQP = false;
  -pps-maxCuDQPDepth = 0;
  +pps-maxCuDQPDepth = m_param-rc.maxCuDQPDepth;

 I think the point of the if() expression is to set it zero in the else
 clause. If you're forcing it to be zero in the logic below, you might as
 well remove 'pps-maxCuDQPDepth =' from this expression and set it
 unconditionally.  As far as I know, maxCuDQPDepth will not be signalled
 if bUseDQP is false, thus the encoder will (should) ignore the param.


if bUseDQP is false then  maxCuDQPDepth signalled once per CTU,


   }
 
   pps-chromaQpOffset[0] = m_param-cbQpOffset;
  @@ -1773,6 +1773,17 @@
   p-analysisMode = X265_ANALYSIS_OFF;
   x265_log(p, X265_LOG_WARNING, Analysis save and load mode not
 supported for distributed mode analysis\n);
   }
  +bool bIsVbv = m_param-rc.vbvBufferSize  0 
 m_param-rc.vbvMaxBitrate  0;
  +if (!m_param-bLossless  (m_param-rc.aqMode || bIsVbv))
  +{
  +if (p-rc.maxCuDQPDepth  (NUM_CU_DEPTH - 1))
  +{
  +p-rc.maxCuDQPDepth = 0;
  +x265_log(p, X265_LOG_WARNING, The maxCUDQPDepth should be
 less than maxCUDepth setting maxCUDQPDepth = %d \n, 0);
  +}
  +}
  +else
  +p-rc.maxCuDQPDepth = 0;
   }
 
   void Encoder::allocAnalysis(x265_analysis_data* analysis)
  diff -r b931c50d5501 -r 1105c6db8411 source/x265.h
  --- a/source/x265.h   Wed Mar 11 21:58:02 2015 -0500
  +++ b/source/x265.h   Thu Mar 12 11:32:09 2015 +0530
  @@ -977,6 +977,9 @@
   /* Enable stricter conditions to check bitrate deviations in
 CBR mode. May compromise
* quality to maintain bitrate adherence */
   int bStrictCbr;
  +
  +/* Max depth of a minimum CuDQP for sub-LCU-level delta QP */
  +int maxCuDQPDepth;
   } rc;
 
   /*== Video Usability Information ==*/
  diff -r b931c50d5501 -r 1105c6db8411 source/x265cli.h
  --- a/source/x265cli.hWed Mar 11 21:58:02 2015 -0500
  +++ b/source/x265cli.hThu Mar 12 11:32:09 2015 +0530
  @@ -202,6 +202,7 @@
   { strict-cbr,   no_argument, NULL, 0 },
   { temporal-layers,  no_argument, NULL, 0 },
   { no-temporal-layers,   no_argument, NULL, 0 },
  +{ maxdqp-depth,   required_argument, NULL, 0 },
   { 0, 0, 0, 0 },
   { 0, 0, 0, 0 },
   { 0, 0, 0, 0 },

 Needs restructured text documentation, including some analysis on what
 happens when the param is changed from the default.

 Ok

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




-- 
Thanks  Regards
Gopu G
Multicoreware Inc
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


Re: [x265] [PATCH] analysis: Dump the best MV statistics and re-use this for analysis load mode

2014-11-10 Thread Gopu Govindaswamy
On Tue, Nov 11, 2014 at 8:50 AM, Steve Borho st...@borho.org wrote:

 On 11/10, g...@multicorewareinc.com wrote:
  # HG changeset patch
  # User Gopu Govindaswamy g...@multicorewareinc.com
  # Date 1415611936 -19800
  #  Mon Nov 10 15:02:16 2014 +0530
  # Node ID 31b6ed10054e753331b65a5e08e512f2f5b22b2d
  # Parent  1e04e178a349ff3a27ed0207cca7bdd9f0db4ff8
  analysis: Dump the best MV statistics and re-use this for analysis load
 mode
 
  this patch is to fix the bug in inter information sharing when using
  analysis=load|save mode, existing algorithm always dump and share the
 last part
  best MV for each prediction, but there is multiple part's each with its
 own
  prediction, the fix is to dump and share all part best MV's for each
 prediction
 
  diff -r 1e04e178a349 -r 31b6ed10054e source/common/common.h
  --- a/source/common/common.h  Sun Nov 09 00:30:09 2014 -0600
  +++ b/source/common/common.h  Mon Nov 10 15:02:16 2014 +0530
  @@ -291,6 +291,7 @@
   #define MAX_NUM_REF 16 // max. number of entries in
 picture reference list
 
   #define REF_NOT_VALID   -1
  +#define MAX_NUM_PART 4

 in HEVC, inter cannot code NxN, so for the purpose of this data the max
 count is 2. If would be preferrable for this to be an enum in Mode
 rather than a general #define in common.h

   #define AMVP_NUM_CANDS  2 // number of AMVP candidates
   #define MRG_MAX_NUM_CANDS   5 // max number of final merge
 candidates
  diff -r 1e04e178a349 -r 31b6ed10054e source/encoder/analysis.cpp
  --- a/source/encoder/analysis.cpp Sun Nov 09 00:30:09 2014 -0600
  +++ b/source/encoder/analysis.cpp Mon Nov 10 15:02:16 2014 +0530
  @@ -1407,12 +1407,16 @@
 
   if (m_param-analysisMode == X265_ANALYSIS_LOAD 
 m_interAnalysisData)
   {
  -for (int32_t i = 0; i  numPredDir; i++)
  +for (uint32_t part = 0; part  interMode.cu.getNumPartInter();
 part++)
   {
  -interMode.bestME[i].costZero =
 !!m_interAnalysisData-costZero[i];
  -interMode.bestME[i].mv.x = m_interAnalysisData-mvx[i];
  -interMode.bestME[i].mv.y = m_interAnalysisData-mvy[i];
  -interMode.bestME[i].ref = m_interAnalysisData-ref[i];
  +for (int32_t i = 0; i  numPredDir; i++)
  +{
  +interMode.bestME[part][i].costZero =
 !!m_interAnalysisData-costZero[i];
  +interMode.bestME[part][i].mv.x =
 m_interAnalysisData-mvx[i];
  +interMode.bestME[part][i].mv.y =
 m_interAnalysisData-mvy[i];
  +interMode.bestME[part][i].ref =
 m_interAnalysisData-ref[i];
  +}
  +m_interAnalysisData++;
 

the pointers are incremented for load mode after copied into
interMode.bestME

 
   }
   }
   if (predInterSearch(interMode, cuGeom, false, false))
  @@ -1425,17 +1429,20 @@
 
   if (m_param-analysisMode == X265_ANALYSIS_SAVE 
 m_interAnalysisData)
   {
  -for (int32_t i = 0; i  numPredDir; i++)
  +for (uint32_t part = 0; part 
 interMode.cu.getNumPartInter(); part++)
   {
  -m_interAnalysisData-costZero[i] =
 interMode.bestME[i].costZero;
  -m_interAnalysisData-mvx[i] = interMode.bestME[i].mv.x;
  -m_interAnalysisData-mvy[i] = interMode.bestME[i].mv.y;
  -m_interAnalysisData-ref[i] = interMode.bestME[i].ref;
  +for (int32_t i = 0; i  numPredDir; i++)
  +{
  +m_interAnalysisData-costZero[i] =
 interMode.bestME[part][i].costZero;
  +m_interAnalysisData-mvx[i] =
 interMode.bestME[part][i].mv.x;
  +m_interAnalysisData-mvy[i] =
 interMode.bestME[part][i].mv.y;
  +m_interAnalysisData-ref[i] =
 interMode.bestME[part][i].ref;
  +}
  +m_interAnalysisData-zOrder = cuGeom.encodeIdx;
  +m_interAnalysisData-depth  = cuGeom.depth;
  +m_interAnalysisData++;

the pointers are incremented for save mode after copied into
interAnalysisData

   }
  -m_interAnalysisData-zOrder = cuGeom.encodeIdx;
  -m_interAnalysisData-depth  = cuGeom.depth;
   }
  -m_interAnalysisData++;
   }
   else
   {
  @@ -1453,12 +1460,16 @@
 
   if (m_param-analysisMode == X265_ANALYSIS_LOAD 
 m_interAnalysisData)
   {
  -for (int32_t i = 0; i  numPredDir; i++)
  +for (uint32_t part = 0; part  interMode.cu.getNumPartInter();
 part++)
   {
  -interMode.bestME[i].costZero =
 !!m_interAnalysisData-costZero[i];
  -interMode.bestME[i].mv.x = m_interAnalysisData-mvx[i];
  -interMode.bestME[i].mv.y = m_interAnalysisData-mvy[i];
  -interMode.bestME[i].ref = m_interAnalysisData-ref[i];
  +for (int32_t i = 0; i  numPredDir; i

Re: [x265] [PATCH] search: dump best motion statistics for P and B slices into analysisdata file

2014-10-14 Thread Gopu Govindaswamy
On Tue, Oct 14, 2014 at 11:51 AM, Steve Borho st...@borho.org wrote:

 On 10/14, g...@multicorewareinc.com wrote:
  # HG changeset patch
  # User Gopu Govindaswamy g...@multicorewareinc.com
  # Date 1413260936 -19800
  #  Tue Oct 14 09:58:56 2014 +0530
  # Node ID 585e8591cb95ef5a57e10f16e9f4bd61ec5a8913
  # Parent  f26e81eb555aa586380b34314c302ea9b148f357
  search: dump best motion statistics for P and B slices into analysisdata
 file
 
  diff -r f26e81eb555a -r 585e8591cb95 source/Lib/TLibCommon/TComRom.h
  --- a/source/Lib/TLibCommon/TComRom.h Mon Oct 13 14:36:40 2014 +0530
  +++ b/source/Lib/TLibCommon/TComRom.h Tue Oct 14 09:58:56 2014 +0530
  @@ -68,6 +68,8 @@
 
   #define SLFASE_CONSTANT 0x5f4e4a53
 
  +#define MAX_RECURSIVE 85 //maximum recursive call for each cu
  +
   void initROM();
   void destroyROM();
 
  diff -r f26e81eb555a -r 585e8591cb95 source/encoder/analysis.cpp
  --- a/source/encoder/analysis.cpp Mon Oct 13 14:36:40 2014 +0530
  +++ b/source/encoder/analysis.cpp Tue Oct 14 09:58:56 2014 +0530
  @@ -477,6 +477,9 @@
   }
   else
   {
  +if (m_param-analysisMode)
  +m_interAnalysisData = ctu-m_pic-m_interData +
 (ctu-m_cuAddr * MAX_RECURSIVE);
  +
   if (m_param-rdLevel  5)
   {
   TComDataCU* outBestCU = NULL;
  @@ -712,8 +715,6 @@
   for (uint32_t partUnitIdx = 0; partUnitIdx  4; partUnitIdx++)
   {
   CU *child_cu =
 pic-getCU(outTempCU-m_cuAddr)-m_cuLocalData + cu-childIdx + partUnitIdx;
  -int qp = outTempCU-getQP(0);
  -subBestPartCU-initSubCU(outTempCU, child_cu, partUnitIdx,
 nextDepth, qp); // clear sub partition datas or init.
   if (child_cu-flags  CU::PRESENT)
   {
   subTempPartCU-initSubCU(outTempCU, child_cu,
 partUnitIdx, nextDepth, qp); // clear sub partition datas or init.
  @@ -964,6 +965,10 @@
   m_bJobsQueued = false;
   m_modeCompletionEvent.wait();
 
  +/* increment the analysisData buffer for each recursive
 call */
  +if (m_interAnalysisData)
  +m_interAnalysisData++;

 this seems unlikely to be the right place for this. if the data is
 per-mode it needs to be handled in the mode functions. if it is per CU,
 it should probably be incremented at the end of this function or at
 least after the best non-split choice is selected


 yes this analysisData buffer is per cu, this can be incremented at the end
of function,
i will resend this patch


   if (m_param-bEnableEarlySkip 
 m_bestMergeCU[depth]-isSkipped(0))
   {
   outBestCU = m_bestMergeCU[depth];
  @@ -1450,6 +1455,10 @@
   outTempCU-initEstData();
   if (m_param-bEnableCbfFastMode)
   doNotBlockPu = outBestCU-getQtRootCbf(0) != 0;
  +
  +/* increment the analysisData buffer for each recursive
 call */
  +if (m_interAnalysisData)
  +m_interAnalysisData++;
   }
   }
 
  @@ -2093,7 +2102,7 @@
   cu-m_totalDistortion =
 primitives.sa8d[sizeIdx](m_origYuv[depth]-getLumaAddr(),
 m_origYuv[depth]-getStride(), predYuv-getLumaAddr(),
 predYuv-getStride());
   cu-m_sa8dCost = m_rdCost.calcRdSADCost(cu-m_totalDistortion,
 cu-m_totalBits);
   }
  -else if (predInterSearch(cu, cuData, predYuv, false, false))
  +else if (predInterSearch(cu, cuData, predYuv, false, false,
 m_interAnalysisData))
   {
   int sizeIdx = cu-getLog2CUSize(0) - 2;
   uint32_t distortion =
 primitives.sa8d[sizeIdx](m_origYuv[depth]-getLumaAddr(),
 m_origYuv[depth]-getStride(), predYuv-getLumaAddr(),
 predYuv-getStride());
  @@ -2124,7 +2133,7 @@
   checkDQP(tempCU);
   checkBestMode(bestCU, tempCU, depth);
   }
  -else if (predInterSearch(tempCU, cuData, m_tmpPredYuv[depth],
 bMergeOnly, true))
  +else if (predInterSearch(tempCU, cuData, m_tmpPredYuv[depth],
 bMergeOnly, true, m_interAnalysisData))
   {
   encodeResAndCalcRdInterCU(tempCU, cuData, m_origYuv[depth],
 m_tmpPredYuv[depth], m_tmpResiYuv[depth], m_bestResiYuv[depth],
 m_tmpRecoYuv[depth]);
   checkDQP(tempCU);
  diff -r f26e81eb555a -r 585e8591cb95 source/encoder/analysis.h
  --- a/source/encoder/analysis.h   Mon Oct 13 14:36:40 2014 +0530
  +++ b/source/encoder/analysis.h   Tue Oct 14 09:58:56 2014 +0530
  @@ -109,6 +109,7 @@
 
   StatisticLog  m_sliceTypeLog[3];
   StatisticLog* m_log;
  +x265_inter_data* m_interAnalysisData;// To store the inter
 analysis data per CU
 
   Analysis();
   bool create(uint32_t totalDepth, uint32_t maxWidth,
 ThreadLocalData* tld);
  diff -r f26e81eb555a -r 585e8591cb95 source/encoder/search.cpp
  --- a/source/encoder/search.cpp   Mon Oct 13 14:36:40 2014 +0530
  +++ b/source/encoder/search.cpp   Tue Oct

Re: [x265] [PATCH] search: dump best motion statistics for P and B slices into analysisdata file

2014-10-14 Thread Gopu Govindaswamy
Please ignore this patch

On Tue, Oct 14, 2014 at 12:08 PM, g...@multicorewareinc.com wrote:

 # HG changeset patch
 # User Gopu Govindaswamy g...@multicorewareinc.com
 # Date 1413268677 -19800
 #  Tue Oct 14 12:07:57 2014 +0530
 # Node ID ef61b042ab3678c9d27b819efed46f5be8969c32
 # Parent  f26e81eb555aa586380b34314c302ea9b148f357
 search: dump best motion statistics for P and B slices into analysisdata
 file

 diff -r f26e81eb555a -r ef61b042ab36 source/Lib/TLibCommon/TComRom.h
 --- a/source/Lib/TLibCommon/TComRom.h   Mon Oct 13 14:36:40 2014 +0530
 +++ b/source/Lib/TLibCommon/TComRom.h   Tue Oct 14 12:07:57 2014 +0530
 @@ -68,6 +68,8 @@

  #define SLFASE_CONSTANT 0x5f4e4a53

 +#define MAX_RECURSIVE 85 //maximum recursive call for each cu
 +
  void initROM();
  void destroyROM();

 diff -r f26e81eb555a -r ef61b042ab36 source/encoder/analysis.cpp
 --- a/source/encoder/analysis.cpp   Mon Oct 13 14:36:40 2014 +0530
 +++ b/source/encoder/analysis.cpp   Tue Oct 14 12:07:57 2014 +0530
 @@ -477,6 +477,9 @@
  }
  else
  {
 +if (m_param-analysisMode)
 +m_interAnalysisData = ctu-m_pic-m_interData +
 (ctu-m_cuAddr * MAX_RECURSIVE);
 +
  if (m_param-rdLevel  5)
  {
  TComDataCU* outBestCU = NULL;
 @@ -712,8 +715,6 @@
  for (uint32_t partUnitIdx = 0; partUnitIdx  4; partUnitIdx++)
  {
  CU *child_cu = pic-getCU(outTempCU-m_cuAddr)-m_cuLocalData
 + cu-childIdx + partUnitIdx;
 -int qp = outTempCU-getQP(0);
 -subBestPartCU-initSubCU(outTempCU, child_cu, partUnitIdx,
 nextDepth, qp); // clear sub partition datas or init.
  if (child_cu-flags  CU::PRESENT)
  {
  subTempPartCU-initSubCU(outTempCU, child_cu,
 partUnitIdx, nextDepth, qp); // clear sub partition datas or init.
 @@ -1386,6 +1387,10 @@
  m_bestRecoYuv[depth]-copyToPicYuv(pic-getPicYuvRec(),
 cuAddr, absPartIdx);
  }

 +/* increment the analysisData buffer for each recursive call */
 +if (m_interAnalysisData)
 +m_interAnalysisData++;
 +
  #if CHECKED_BUILD || _DEBUG
  /* Assert if Best prediction mode is NONE
   * Selected mode's RD-cost must be not MAX_INT64 */
 @@ -1450,6 +1455,10 @@
  outTempCU-initEstData();
  if (m_param-bEnableCbfFastMode)
  doNotBlockPu = outBestCU-getQtRootCbf(0) != 0;
 +
 +/* increment the analysisData buffer for each recursive
 call */
 +if (m_interAnalysisData)
 +m_interAnalysisData++;
  }
  }

 @@ -2093,7 +2102,7 @@
  cu-m_totalDistortion =
 primitives.sa8d[sizeIdx](m_origYuv[depth]-getLumaAddr(),
 m_origYuv[depth]-getStride(), predYuv-getLumaAddr(),
 predYuv-getStride());
  cu-m_sa8dCost = m_rdCost.calcRdSADCost(cu-m_totalDistortion,
 cu-m_totalBits);
  }
 -else if (predInterSearch(cu, cuData, predYuv, false, false))
 +else if (predInterSearch(cu, cuData, predYuv, false, false,
 m_interAnalysisData))
  {
  int sizeIdx = cu-getLog2CUSize(0) - 2;
  uint32_t distortion =
 primitives.sa8d[sizeIdx](m_origYuv[depth]-getLumaAddr(),
 m_origYuv[depth]-getStride(), predYuv-getLumaAddr(),
 predYuv-getStride());
 @@ -2124,7 +2133,7 @@
  checkDQP(tempCU);
  checkBestMode(bestCU, tempCU, depth);
  }
 -else if (predInterSearch(tempCU, cuData, m_tmpPredYuv[depth],
 bMergeOnly, true))
 +else if (predInterSearch(tempCU, cuData, m_tmpPredYuv[depth],
 bMergeOnly, true, m_interAnalysisData))
  {
  encodeResAndCalcRdInterCU(tempCU, cuData, m_origYuv[depth],
 m_tmpPredYuv[depth], m_tmpResiYuv[depth], m_bestResiYuv[depth],
 m_tmpRecoYuv[depth]);
  checkDQP(tempCU);
 diff -r f26e81eb555a -r ef61b042ab36 source/encoder/analysis.h
 --- a/source/encoder/analysis.h Mon Oct 13 14:36:40 2014 +0530
 +++ b/source/encoder/analysis.h Tue Oct 14 12:07:57 2014 +0530
 @@ -109,6 +109,7 @@

  StatisticLog  m_sliceTypeLog[3];
  StatisticLog* m_log;
 +x265_inter_data* m_interAnalysisData;// To store the inter
 analysis data per CU

  Analysis();
  bool create(uint32_t totalDepth, uint32_t maxWidth, ThreadLocalData*
 tld);
 diff -r f26e81eb555a -r ef61b042ab36 source/encoder/search.cpp
 --- a/source/encoder/search.cpp Mon Oct 13 14:36:40 2014 +0530
 +++ b/source/encoder/search.cpp Tue Oct 14 12:07:57 2014 +0530
 @@ -1684,7 +1684,7 @@

  /* search of the best candidate for inter prediction
   * returns true if predYuv was filled with a motion compensated
 prediction */
 -bool Search::predInterSearch(TComDataCU* cu, CU* cuData, TComYuv*
 predYuv, bool bMergeOnly, bool bChroma)
 +bool Search::predInterSearch(TComDataCU* cu, CU* cuData, TComYuv*
 predYuv, bool bMergeOnly, bool bChroma, x265_inter_data* interAnalysisData)
  {
  MV amvpCand[2][MAX_NUM_REF][AMVP_NUM_CANDS];
  MV mvc[(MD_ABOVE_LEFT + 1) * 2 + 1];
 @@ -1755,6 +1755,11

Re: [x265] [PATCH] search: dump the best motion statistics for PB slices into analysisdata file

2014-10-14 Thread Gopu Govindaswamy
On Wed, Oct 15, 2014 at 12:44 AM, Steve Borho st...@borho.org wrote:

 On 10/14, g...@multicorewareinc.com wrote:
  # HG changeset patch
  # User Gopu Govindaswamy g...@multicorewareinc.com
  # Date 1413280221 -19800
  #  Tue Oct 14 15:20:21 2014 +0530
  # Node ID 188757dfe944c7e70429ffe1316775d135d87d13
  # Parent  f26e81eb555aa586380b34314c302ea9b148f357
  search: dump the best motion statistics for PB slices into analysisdata
 file
 
  diff -r f26e81eb555a -r 188757dfe944 source/Lib/TLibCommon/TComRom.h
  --- a/source/Lib/TLibCommon/TComRom.h Mon Oct 13 14:36:40 2014 +0530
  +++ b/source/Lib/TLibCommon/TComRom.h Tue Oct 14 15:20:21 2014 +0530
  @@ -68,6 +68,8 @@
 
   #define SLFASE_CONSTANT 0x5f4e4a53
 
  +#define MAX_RECURSIVE 85 //maximum recursive call for each cu
  +
   void initROM();
   void destroyROM();
 
  diff -r f26e81eb555a -r 188757dfe944 source/encoder/analysis.cpp
  --- a/source/encoder/analysis.cpp Mon Oct 13 14:36:40 2014 +0530
  +++ b/source/encoder/analysis.cpp Tue Oct 14 15:20:21 2014 +0530
  @@ -477,6 +477,9 @@
   }
   else
   {
  +if (m_param-analysisMode)
  +m_interAnalysisData = ctu-m_pic-m_interData +
 (ctu-m_cuAddr * MAX_RECURSIVE);
  +
   if (m_param-rdLevel  5)
   {
   TComDataCU* outBestCU = NULL;
  @@ -712,10 +715,10 @@
   for (uint32_t partUnitIdx = 0; partUnitIdx  4; partUnitIdx++)
   {
   CU *child_cu =
 pic-getCU(outTempCU-m_cuAddr)-m_cuLocalData + cu-childIdx + partUnitIdx;
  -int qp = outTempCU-getQP(0);
  -subBestPartCU-initSubCU(outTempCU, child_cu, partUnitIdx,
 nextDepth, qp); // clear sub partition datas or init.
   if (child_cu-flags  CU::PRESENT)
   {
  +int qp = outTempCU-getQP(0);
  +subBestPartCU-initSubCU(outTempCU, child_cu,
 partUnitIdx, nextDepth, qp); // clear sub partition datas or init.
   subTempPartCU-initSubCU(outTempCU, child_cu,
 partUnitIdx, nextDepth, qp); // clear sub partition datas or init.
 
   if (partUnitIdx) // initialize RD with previous depth
 buffer
  @@ -1386,6 +1389,10 @@
   m_bestRecoYuv[depth]-copyToPicYuv(pic-getPicYuvRec(),
 cuAddr, absPartIdx);
   }
 
  +/* increment the analysisData buffer for each recursive call */
  +if (m_interAnalysisData)
  +m_interAnalysisData++;
  +
   #if CHECKED_BUILD || _DEBUG
   /* Assert if Best prediction mode is NONE
* Selected mode's RD-cost must be not MAX_INT64 */
  @@ -1450,6 +1457,10 @@
   outTempCU-initEstData();
   if (m_param-bEnableCbfFastMode)
   doNotBlockPu = outBestCU-getQtRootCbf(0) != 0;
  +
  +/* increment the analysisData buffer for each recursive
 call */
  +if (m_interAnalysisData)
  +m_interAnalysisData++;
   }
   }
 
  @@ -2093,7 +2104,7 @@
   cu-m_totalDistortion =
 primitives.sa8d[sizeIdx](m_origYuv[depth]-getLumaAddr(),
 m_origYuv[depth]-getStride(), predYuv-getLumaAddr(),
 predYuv-getStride());
   cu-m_sa8dCost = m_rdCost.calcRdSADCost(cu-m_totalDistortion,
 cu-m_totalBits);
   }
  -else if (predInterSearch(cu, cuData, predYuv, false, false))
  +else if (predInterSearch(cu, cuData, predYuv, false, false,
 m_interAnalysisData))
   {
   int sizeIdx = cu-getLog2CUSize(0) - 2;
   uint32_t distortion =
 primitives.sa8d[sizeIdx](m_origYuv[depth]-getLumaAddr(),
 m_origYuv[depth]-getStride(), predYuv-getLumaAddr(),
 predYuv-getStride());
  @@ -2124,7 +2135,7 @@
   checkDQP(tempCU);
   checkBestMode(bestCU, tempCU, depth);
   }
  -else if (predInterSearch(tempCU, cuData, m_tmpPredYuv[depth],
 bMergeOnly, true))
  +else if (predInterSearch(tempCU, cuData, m_tmpPredYuv[depth],
 bMergeOnly, true, m_interAnalysisData))
   {
   encodeResAndCalcRdInterCU(tempCU, cuData, m_origYuv[depth],
 m_tmpPredYuv[depth], m_tmpResiYuv[depth], m_bestResiYuv[depth],
 m_tmpRecoYuv[depth]);
   checkDQP(tempCU);
  diff -r f26e81eb555a -r 188757dfe944 source/encoder/analysis.h
  --- a/source/encoder/analysis.h   Mon Oct 13 14:36:40 2014 +0530
  +++ b/source/encoder/analysis.h   Tue Oct 14 15:20:21 2014 +0530
  @@ -109,6 +109,7 @@
 
   StatisticLog  m_sliceTypeLog[3];
   StatisticLog* m_log;
  +x265_inter_data* m_interAnalysisData;// To store the inter
 analysis data per CU
 
   Analysis();
   bool create(uint32_t totalDepth, uint32_t maxWidth,
 ThreadLocalData* tld);
  diff -r f26e81eb555a -r 188757dfe944 source/encoder/search.cpp
  --- a/source/encoder/search.cpp   Mon Oct 13 14:36:40 2014 +0530
  +++ b/source/encoder/search.cpp   Tue Oct 14 15:20:21 2014 +0530
  @@ -1684,7 +1684,7 @@
 
   /* search of the best candidate for inter prediction
* returns true if predYuv was filled with a motion

Re: [x265] [PATCH] cutree: adjust the rowSatd with qpoffset only for reference frames

2014-05-15 Thread Gopu Govindaswamy
On Thu, May 15, 2014 at 3:44 PM, Steve Borho st...@borho.org wrote:

 On Thu, May 15, 2014 at 4:44 AM,  g...@multicorewareinc.com wrote:
  # HG changeset patch
  # User Gopu Govindaswamy
  # Date 1400146948 -19800
  #  Thu May 15 15:12:28 2014 +0530
  # Node ID 794b7d744a14c653f76748b4ec3033b040c3e783
  # Parent  6ca880d7e68361e5b9e2353f05369d9e5c40a29f
  cutree: adjust the rowSatd with qpoffset only for reference frames

 these two are queued, is there one more for loglevel?


yes i am pushing on that too


  diff -r 6ca880d7e683 -r 794b7d744a14 source/encoder/slicetype.cpp
  --- a/source/encoder/slicetype.cpp  Thu May 15 12:31:06 2014 +0530
  +++ b/source/encoder/slicetype.cpp  Thu May 15 15:12:28 2014 +0530
  @@ -1148,7 +1148,7 @@
   {
   int64_t score = 0;
   int *rowSatd = frames[b]-rowSatds[b - p0][p1 - b];
  -double *qp_offset = IS_X265_TYPE_B(frames[b]-sliceType) ?
 frames[b]-qpAqOffset : frames[b]-qpOffset;
  +double *qp_offset = (frames[b]-sliceType = X265_TYPE_B) ?
 frames[b]-qpAqOffset : frames[b]-qpOffset;
 
   x265_emms();
   for (int cuy = heightInCU - 1; cuy = 0; cuy--)
  ___
  x265-devel mailing list
  x265-devel@videolan.org
  https://mailman.videolan.org/listinfo/x265-devel



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




-- 
Thanks  Regards
Gopu G
Multicoreware Inc
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


Re: [x265] [PATCH] frameencoder: store the reference state of the picture to FrameEncoder Member variable(m_keptAsRef)

2014-04-03 Thread Gopu Govindaswamy
Please Ignore this patch, I have sent an another patch, the member variable
name and commit message has been changed a bit

Thanks



On Thu, Apr 3, 2014 at 4:57 PM, g...@multicorewareinc.com wrote:

 # HG changeset patch
 # User Gopu Govindaswamy
 # Date 139652 -19800
 #  Thu Apr 03 16:57:24 2014 +0530
 # Node ID 099c17e87f7318c62b6f6323dfc0b84e8ff5f076
 # Parent  c0362b478e23777120ee2cf3c286ca1f2e740018
 frameencoder: store the reference state of the picture to FrameEncoder
 Member variable(m_keptAsRef)

 We find that reference state of the reference frame changed during the
 encode when we use frame-thread  1
 this cause the CU level QP for the frame is non-deterministic, this is
 leading the non-deterministic
 encoded output for the frame, to avoid this store the reference state of
 the frame to FrameEncoder-m_keptAsRef and
 when the QP is calculate for CU, refer the reference state of the frame
 from FrameEncoder-m_keptAsRef
 this stat will never change during the encode

 Moved slice reference state initialization from dpb to FrameEncoder
 initSlice()

 diff -r c0362b478e23 -r 099c17e87f73 source/encoder/dpb.cpp
 --- a/source/encoder/dpb.cppWed Apr 02 22:52:19 2014 -0500
 +++ b/source/encoder/dpb.cppThu Apr 03 16:57:24 2014 +0530
 @@ -79,17 +79,6 @@
  m_lastIDR = pocCurr;
  }
  slice-setLastIDR(m_lastIDR);
 -
 -if (slice-getSliceType() != B_SLICE)
 -slice-setReferenced(true);
 -else
 -{
 -if (pic-m_lowres.sliceType == X265_TYPE_BREF)
 -slice-setReferenced(true);
 -else
 -slice-setReferenced(false);
 -}
 -
  slice-setTemporalLayerNonReferenceFlag(!slice-isReferenced());
  // Set the nal unit type
  slice-setNalUnitType(getNalUnitType(pocCurr, m_lastIDR, pic));
 diff -r c0362b478e23 -r 099c17e87f73 source/encoder/frameencoder.cpp
 --- a/source/encoder/frameencoder.cpp   Wed Apr 02 22:52:19 2014 -0500
 +++ b/source/encoder/frameencoder.cpp   Thu Apr 03 16:57:24 2014 +0530
 @@ -265,7 +265,18 @@
  int type = pic-m_lowres.sliceType;
  SliceType sliceType = IS_X265_TYPE_B(type) ? B_SLICE : ((type ==
 X265_TYPE_P) ? P_SLICE : I_SLICE);
  slice-setSliceType(sliceType);
 -slice-setReferenced(true);
 +
 +if (sliceType != B_SLICE)
 +m_isReferenced = true;
 +else
 +{
 +if (pic-m_lowres.sliceType == X265_TYPE_BREF)
 +m_isReferenced = true;
 +else
 +m_isReferenced = false;
 +}
 +slice-setReferenced(m_isReferenced);
 +
  slice-setScalingList(m_top-getScalingList());

  slice-getScalingList()-setUseTransformSkip(m_pps.getUseTransformSkip());
  #if LOG_CU_STATISTICS
 @@ -1229,9 +1240,8 @@
  int block_x = (cuAddr * noOfBlocks) - block_y *
 m_pic-getPicSym()-getFrameWidthInCU();

  /* Use cuTree offsets in m_pic-m_lowres.qpOffset if cuTree enabled
 and
 - * frame is referenced (if P, ignore ref state). Else use AQ offsets
 */
 -double *qpoffs = ((m_pic-getSlice()-isReferenced() ||
 m_pic-getSlice()-getSliceType() == P_SLICE)  m_cfg-param-rc.cuTree) ?
 - m_pic-m_lowres.qpOffset :
 m_pic-m_lowres.qpAqOffset;
 + * frame is referenced Else use AQ offsets */
 +double *qpoffs = (m_isReferenced  m_cfg-param-rc.cuTree) ?
 m_pic-m_lowres.qpOffset : m_pic-m_lowres.qpAqOffset;

  int cnt = 0, idx = 0;
  for (int h = 0; h  noOfBlocks  block_y  maxBlockRows; h++,
 block_y++)
 diff -r c0362b478e23 -r 099c17e87f73 source/encoder/frameencoder.h
 --- a/source/encoder/frameencoder.h Wed Apr 02 22:52:19 2014 -0500
 +++ b/source/encoder/frameencoder.h Thu Apr 03 16:57:24 2014 +0530
 @@ -190,6 +190,7 @@
  int  m_filterRowDelay;
  Eventm_completionEvent;
  int64_t  m_totalTime;
 +bool m_isReferenced;
  };
  }




-- 
Thanks  Regards
Gopu G
Multicoreware Inc
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


Re: [x265] [PATCH] tencsbac: WritePCMCode for Cb and Cr merged into single block

2014-03-11 Thread Gopu Govindaswamy
Yes Currently the The PCM Code path not being used, but it can be used
when we enable the m_usePCM flag and cu size 32

Thanks
Gopu G

On Mon, Mar 10, 2014 at 11:34 PM, Steve Borho st...@borho.org wrote:
 On Mon, Mar 10, 2014 at 3:41 AM,  g...@multicorewareinc.com wrote:
 # HG changeset patch
 # User Gopu Govindaswamy
 # Date 1394440478 -19800
 #  Mon Mar 10 14:04:38 2014 +0530
 # Node ID 592b9b952a71f11b778fb4f8afadf86ff9c9a05c
 # Parent  ba31dfc650d88afa937293a40fdaafd20c10c83e
 tencsbac: WritePCMCode for Cb and Cr merged into single block

 I'm a little leary of changes to the PCM code paths, I don't know if
 they're currently used at all.  Did you check that this code path was
 exercised by your test sequence(s)?

 diff -r ba31dfc650d8 -r 592b9b952a71 source/Lib/TLibEncoder/TEncSbac.cpp
 --- a/source/Lib/TLibEncoder/TEncSbac.cpp   Mon Mar 10 12:14:41 2014 
 +0530
 +++ b/source/Lib/TLibEncoder/TEncSbac.cpp   Mon Mar 10 14:04:38 2014 
 +0530
 @@ -1261,7 +1261,7 @@
  int numZeroSubstreamsAtEndOfSlice = 
 slice-getPic()-getFrameHeightInCU() - 1 - ((slice-getSliceCurEndCUAddr() 
 - 1) / maxNumParts / slice-getPic()-getFrameWidthInCU());
  numEntryPointOffsets  = 
 slice-getPic()-getFrameHeightInCU() - numZeroSubstreamsAtEndOfSlice - 1;
  slice-setNumEntryPointOffsets(numEntryPointOffsets);
 -entryPointOffset = new uint32_t[numEntryPointOffsets];
 +entryPointOffset = X265_MALLOC(uint32_t, numEntryPointOffsets);
  for (int idx = 0; idx  numEntryPointOffsets; idx++)
  {
  entryPointOffset[idx] = (substreamSizes[idx]  3);
 @@ -1290,7 +1290,7 @@
  WRITE_CODE(entryPointOffset[idx] - 1, offsetLenMinus1 + 1, 
 entry_point_offset_minus1);
  }

 -delete [] entryPointOffset;
 +X265_FREE(entryPointOffset);
  }

  void TEncSbac::codeTerminatingBit(uint32_t lsLast)
 @@ -1891,37 +1891,22 @@
  pcmSample += width;
  }

 -pcmSample = cu-getPCMSampleCb() + chromaOffset;
  width = cu-getCUSize(absPartIdx) / 2;
  height = cu-getCUSize(absPartIdx) / 2;
  sampleBits = cu-getSlice()-getSPS()-getPCMBitDepthChroma();
 +pixel* pcmSampleCb = cu-getPCMSampleCb() + chromaOffset;
 +pixel* pcmSampleCr = cu-getPCMSampleCr() + chromaOffset;

  for (y = 0; y  height; y++)
  {
  for (x = 0; x  width; x++)
  {
 -uint32_t sample = pcmSample[x];
 -
 -m_binIf-xWritePCMCode(sample, sampleBits);
 +m_binIf-xWritePCMCode(pcmSampleCb[x], sampleBits);
 +m_binIf-xWritePCMCode(pcmSampleCr[x], sampleBits);
  }
 -
 -pcmSample += width;
 +pcmSampleCb += width;
 +pcmSampleCr += width;
  }
 -
 -pcmSample = cu-getPCMSampleCr() + chromaOffset;
 -
 -for (y = 0; y  height; y++)
 -{
 -for (x = 0; x  width; x++)
 -{
 -uint32_t sample = pcmSample[x];
 -
 -m_binIf-xWritePCMCode(sample, sampleBits);
 -}
 -
 -pcmSample += width;
 -}
 -
  m_binIf-resetBac();
  }
  }
 ___
 x265-devel mailing list
 x265-devel@videolan.org
 https://mailman.videolan.org/listinfo/x265-devel



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



-- 
Thanks  Regards
Gopu G
Multicoreware Inc
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


Re: [x265] [PATCH] slicetype: bug fix for cuTree, use type int32_t for listamount and propagate_amount to calculate valid propagate_cost

2014-02-06 Thread Gopu Govindaswamy
On Thu, Feb 6, 2014 at 3:10 AM, Deepthi Nandakumar
deep...@multicorewareinc.com wrote:



 On Fri, Feb 7, 2014 at 5:48 AM, g...@multicorewareinc.com wrote:

 # HG changeset patch
 # User Gopu Govindaswamy
 # Date 1391732264 28800
 #  Thu Feb 06 16:17:44 2014 -0800
 # Node ID 0198815523c1e653fee59f8b6ee58bffbfb12131
 # Parent  634bc0b1c24653dd254df77cd80f96f81e71e888
 slicetype: bug fix for cuTree, use type int32_t for listamount and
 propagate_amount to calculate valid propagate_cost

 diff -r 634bc0b1c246 -r 0198815523c1 source/encoder/slicetype.cpp
 --- a/source/encoder/slicetype.cpp  Wed Feb 05 23:10:22 2014 -0600
 +++ b/source/encoder/slicetype.cpp  Thu Feb 06 16:17:44 2014 -0800
 @@ -824,10 +824,10 @@
  void Lookahead::estimateCUPropagate(Lowres **frames, double
 averageDuration, int p0, int p1, int b, int referenced)
  {
  uint16_t *refCosts[2] = { frames[p0]-propagateCost,
 frames[p1]-propagateCost };
 -int distScaleFactor = (((b - p0)  8) + ((p1 - p0)  1)) / (p1 -
 p0);
 -int bipredWeight = cfg-param.bEnableWeightedBiPred ? 64 -
 (distScaleFactor  2) : 32;
 +int32_t distScaleFactor = (((b - p0)  8) + ((p1 - p0)  1)) / (p1
 - p0);
 +int32_t bipredWeight = cfg-param.bEnableWeightedBiPred ? 64 -
 (distScaleFactor  2) : 32;
  MV *mvs[2] = { frames[b]-lowresMvs[0][b - p0 - 1],
 frames[b]-lowresMvs[1][p1 - b - 1] };
 -int bipredWeights[2] = { bipredWeight, 64 - bipredWeight };
 +int32_t bipredWeights[2] = { bipredWeight, 64 - bipredWeight };

  memset(scratch, 0, widthInCU * sizeof(int));

 @@ -840,8 +840,8 @@
  if (!referenced)
  memset(frames[b]-propagateCost, 0, widthInCU *
 sizeof(uint16_t));

 -uint16_t StrideInCU = (uint16_t)widthInCU;
 -for (uint16_t blocky = 0; blocky  heightInCU; blocky++)
 +int32_t StrideInCU = widthInCU;
 +for (int32_t blocky = 0; blocky  heightInCU; blocky++)


 Why have these unsigned loop indices been changed to signed? rest looks
 valid.

Yeah, the change is not required in for loop, will change and send the new patch

  {
  int cuIndex = blocky * StrideInCU;
  /* TODO This function go into ASM */
 @@ -851,24 +851,24 @@

  if (referenced)
  propagateCost += widthInCU;
 -for (uint16_t blockx = 0; blockx  widthInCU; blockx++,
 cuIndex++)
 +for (int32_t blockx = 0; blockx  widthInCU; blockx++, cuIndex++)
  {
 -int propagate_amount = scratch[blockx];
 +int32_t propagate_amount = scratch[blockx];
  /* Don't propagate for an intra block. */
  if (propagate_amount  0)
  {
  /* Access width-2 bitfield. */
 -int lists_used = frames[b]-lowresCosts[b - p0][p1 -
 b][cuIndex]  LOWRES_COST_SHIFT;
 +int32_t lists_used = frames[b]-lowresCosts[b - p0][p1 -
 b][cuIndex]  LOWRES_COST_SHIFT;
  /* Follow the MVs to the previous frame(s). */
 -for (uint16_t list = 0; list  2; list++)
 +for (int32_t list = 0; list  2; list++)
  {
  if ((lists_used  list)  1)
  {
 -#define CLIP_ADD(s, x) (s) = X265_MIN((s) + (x), (1  16) - 1)
 -uint16_t listamount = (uint16_t)propagate_amount;
 +#define CLIP_ADD(s, x) (s) = (uint16_t) X265_MIN((s) + (x), (1  16) -
 1)
 +int32_t listamount = propagate_amount;

  /* Apply bipred weighting. */
  if (lists_used == 3)
 -listamount = (uint16_t)(listamount *
 bipredWeights[list] + 32)  6;
 +listamount = (listamount *
 bipredWeights[list] + 32)  6;

  /* Early termination for simple case of mv0. */
  if (!mvs[list][cuIndex].word)
 @@ -877,20 +877,20 @@
  continue;
  }

 -uint16_t x = mvs[list][cuIndex].x;
 -uint16_t y = mvs[list][cuIndex].y;

 -int cux = (x  5) + blockx;
 -int cuy = (y  5) + blocky;
 -int idx0 = cux + cuy * StrideInCU;
 -int idx1 = idx0 + 1;
 -int idx2 = idx0 + StrideInCU;
 -int idx3 = idx0 + StrideInCU + 1;
 +int32_t x = mvs[list][cuIndex].x;
 +int32_t y = mvs[list][cuIndex].y;
 +int32_t cux = (x  5) + blockx;
 +int32_t cuy = (y  5) + blocky;
 +int32_t idx0 = cux + cuy * StrideInCU;
 +int32_t idx1 = idx0 + 1;
 +int32_t idx2 = idx0 + StrideInCU;
 +int32_t idx3 = idx0 + StrideInCU + 1;
  x = 31;
  y = 31

[x265] [PATCH] cutree: Enable CUTree for ratecontrol when tune=ssim and bug fix for cutree

2013-12-17 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1387346740 -19800
# Node ID f16bb88d53318be9c032bef226d50c57abde4f04
# Parent  6f1a39a9e886cf7c7a9ccf2948ca3e87d45abb12
cutree: Enable CUTree for ratecontrol when tune=ssim and bug fix for cutree

1. added cutree into cli option, default cutree is disabled
2. --tune=ssim then aq and cutree is enabled
3. Fixed bug in slicetype-frameCostRecalculate()
   the qp offset for B and B-REF from lowres qpAqOffset, for non-B from lowres 
qpoffset
4. Fixed bug in Ratecontrol-getQScale - the clip duration should (frameduration 
* timescale)
   when cutree is enabled

diff -r 6f1a39a9e886 -r f16bb88d5331 source/common/common.cpp
--- a/source/common/common.cpp  Tue Dec 17 10:50:03 2013 +0530
+++ b/source/common/common.cpp  Wed Dec 18 11:35:40 2013 +0530
@@ -399,7 +399,7 @@
 else if (!strcmp(tune, ssim))
 {
 param-rc.aqMode = X265_AQ_VARIANCE;
-// not yet supported
+param-rc.cuTree = 1;
 }
 else if (!strcmp(tune, zero-latency))
 {
@@ -514,11 +514,13 @@
 {
 param-rc.aqMode = X265_AQ_NONE;
 param-rc.bitrate = 0;
+param-rc.cuTree = 0;
 }
 if (param-rc.aqStrength == 0)
 {
 x265_log(param, X265_LOG_WARNING, Aq mode specified, but Aq strength 
is  0, ignored\n);
 param-rc.aqMode = 0;
+param-rc.cuTree = 0;
 }
 if (param-rc.aqMode == 0  param-rc.cuTree)
 {
@@ -641,6 +643,7 @@
 }
 TOOLOPT(param-bEnableWeightedBiPred, weightbp);
 TOOLOPT(param-rc.aqMode, aq-mode);
+TOOLOPT(param-rc.cuTree, cutree);
 if (param-rc.aqMode)
 fprintf(stderr, aq-strength=%.2f , param-rc.aqStrength);
 fprintf(stderr, \n);
@@ -742,6 +745,9 @@
 }
 OPT(input-csp) p-internalCsp = parseName(value, x265_source_csp_names, 
berror);
 OPT(me)p-searchMethod = parseName(value, x265_motion_est_names, 
berror);
+OPT(cutree)p-rc.cuTree = bvalue;
+OPT(no-cutree) p-rc.cuTree = bvalue;
+
 else
 return X265_PARAM_BAD_NAME;
 #undef OPT
@@ -800,6 +806,7 @@
 s += sprintf(s,  sao-lcu-bounds=%d, p-saoLcuBoundary);
 s += sprintf(s,  sao-lcu-opt=%d, p-saoLcuBasedOptimization);
 s += sprintf(s,  b-pyramid=%d, p-bBPyramid);
+BOOL(p-rc.cuTree, cutree);
 #undef BOOL
 
 return buf;
diff -r 6f1a39a9e886 -r f16bb88d5331 source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cppTue Dec 17 10:50:03 2013 +0530
+++ b/source/encoder/ratecontrol.cppWed Dec 18 11:35:40 2013 +0530
@@ -601,7 +601,10 @@
 
 if (cfg-param.rc.cuTree)
 {
-q = pow(BASE_FRAME_DURATION / CLIP_DURATION(2 * frameDuration), 1 - 
cfg-param.rc.qCompress);
+double scale = 
curSlice-getSPS()-getVuiParameters()-getTimingInfo()-getTimeScale();
+double units = 
curSlice-getSPS()-getVuiParameters()-getTimingInfo()-getNumUnitsInTick();
+double timescale = units / scale;
+q = pow(BASE_FRAME_DURATION / CLIP_DURATION(frameDuration * 
timescale), 1 - cfg-param.rc.qCompress);
 }
 else
 q = pow(rce-blurredComplexity, 1 - cfg-param.rc.qCompress);
diff -r 6f1a39a9e886 -r f16bb88d5331 source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp  Tue Dec 17 10:50:03 2013 +0530
+++ b/source/encoder/slicetype.cpp  Wed Dec 18 11:35:40 2013 +0530
@@ -218,14 +218,12 @@
 return -1;
 }
 
+estimateFrameCost(p0, p1, b, false);
 if (cfg-param.rc.cuTree)
 {
 pic-m_lowres.satdCost = frameCostRecalculate(frames, p0, p1, b);
 return pic-m_lowres.satdCost;
 }
-
-estimateFrameCost(p0, p1, b, false);
-
 if (cfg-param.rc.aqMode)
 pic-m_lowres.satdCost = pic-m_lowres.costEstAq[b - p0][p1 - b];
 else
@@ -1523,7 +1521,7 @@
 {
 int score = 0;
 int *row_satd = Frames[b]-rowSatds[b-p0][p1-b]; 
-double *qp_offset = (Frames[0]-sliceType == X265_TYPE_B) ? 
Frames[b]-qpAqOffset : Frames[b]-qpOffset;
+double *qp_offset = IS_X265_TYPE_B(Frames[0]-sliceType) ? 
Frames[b]-qpAqOffset : Frames[b]-qpOffset;
 x265_emms();
 for (int cuy = heightInCU - 1; cuy = 0; cuy--)
 {
diff -r 6f1a39a9e886 -r f16bb88d5331 source/x265.cpp
--- a/source/x265.cpp   Tue Dec 17 10:50:03 2013 +0530
+++ b/source/x265.cpp   Wed Dec 18 11:35:40 2013 +0530
@@ -147,6 +147,8 @@
 { hash,   required_argument, NULL, 0 },
 { no-strong-intra-smoothing, no_argument, NULL, 0 },
 { strong-intra-smoothing,no_argument, NULL, 0 },
+{ no-cutree, no_argument, NULL, 0 },
+{ cutree,no_argument, NULL, 0 },
 { 0, 0, 0, 0 }
 };
 
@@ -339,6 +341,7 @@
 H0(   --recon-depth Bit-depth of reconstructed raw image 
file. Defaults to input bit depth\n);
 H0(\nSEI options:\n);
 H0(   --hashDecoded Picture Hash SEI 0: disabled, 
1: MD5, 2: CRC, 3: Checksum. Default %d\n, param-decodedPictureHashSEI);
+H0

[x265] [PATCH] rc: Calculate the variance data for weighted prediction if aq-mode is disable

2013-12-16 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1387195927 -19800
# Node ID bdc7afa5ba5afee7113ac0d427fbfc660359716d
# Parent  3dae450a06a4b390ce6fd947d5095b739b01c6d8
rc: Calculate the variance data for weighted prediction if aq-mode is disable

diff -r 3dae450a06a4 -r bdc7afa5ba5a source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cppMon Dec 16 13:57:58 2013 +0530
+++ b/source/encoder/ratecontrol.cppMon Dec 16 17:42:07 2013 +0530
@@ -116,6 +116,15 @@
 for (int cuxy = 0; cuxy  cuCount; cuxy++ )
 pic-m_lowres.invQscaleFactor[cuxy] = 256;
 }
+
+ /* Need variance data for weighted prediction */
+if (cfg-param.bEnableWeightedPred)
+{
+for (int cuy = 0; cuy  maxRow; cuy++ )
+for (int cux = 0; cux  maxCol; cux++ )
+acEnergyCu(pic, cux, cuy);
+}
+
 }
 else
 {
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] rc: bug fix for variance data calculation for weighted prediction when aq-mode is disable

2013-12-16 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1387257603 -19800
# Node ID 6f1a39a9e886cf7c7a9ccf2948ca3e87d45abb12
# Parent  baf811614a7a25816aa5a7a631966e1cd392518c
rc: bug fix for variance data calculation for weighted prediction when aq-mode 
is disable

diff -r baf811614a7a -r 6f1a39a9e886 source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cppMon Dec 16 17:42:07 2013 +0530
+++ b/source/encoder/ratecontrol.cppTue Dec 17 10:50:03 2013 +0530
@@ -120,9 +120,9 @@
  /* Need variance data for weighted prediction */
 if (cfg-param.bEnableWeightedPred)
 {
-for (int cuy = 0; cuy  maxRow; cuy++ )
-for (int cux = 0; cux  maxCol; cux++ )
-acEnergyCu(pic, cux, cuy);
+for (block_y = 0; block_y  maxRow; block_y += 16)
+for (block_x = 0; block_x  maxCol; block_x += 16)
+acEnergyCu(pic, block_x, block_y);
 }
 
 }
@@ -601,10 +601,7 @@
 
 if (cfg-param.rc.cuTree)
 {
-double scale = 
curSlice-getSPS()-getVuiParameters()-getTimingInfo()-getTimeScale();
-double units = 
curSlice-getSPS()-getVuiParameters()-getTimingInfo()-getNumUnitsInTick();
-double timescale = units / scale;
-q = pow(BASE_FRAME_DURATION / CLIP_DURATION(2 * timescale), 1 - 
cfg-param.rc.qCompress);
+q = pow(BASE_FRAME_DURATION / CLIP_DURATION(2 * frameDuration), 1 - 
cfg-param.rc.qCompress);
 }
 else
 q = pow(rce-blurredComplexity, 1 - cfg-param.rc.qCompress);
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] tcomtrquant: when useRDOQ is disabled, it recomputes qpScaled, the qpScaled for trQuant is already set

2013-12-11 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1386759688 -19800
# Node ID 8afda01fe3ea26e0f91797e2f42cbf7a9f52a0ee
# Parent  40895c94da21aed021097f40a62f921c8056ca61
tcomtrquant: when useRDOQ is disabled, it recomputes qpScaled, the qpScaled for 
trQuant is already set

diff -r 40895c94da21 -r 8afda01fe3ea source/Lib/TLibCommon/TComTrQuant.cpp
--- a/source/Lib/TLibCommon/TComTrQuant.cpp Wed Dec 11 14:52:38 2013 +0530
+++ b/source/Lib/TLibCommon/TComTrQuant.cpp Wed Dec 11 16:31:28 2013 +0530
@@ -273,42 +273,6 @@
 
 int deltaU[32 * 32];
 
-QpParam cQpBase;
-int qpbase = cu-getSlice()-getSliceQpBase();
-
-int qpScaled;
-int qpBDOffset = (ttype == TEXT_LUMA) ? 
cu-getSlice()-getSPS()-getQpBDOffsetY() : 
cu-getSlice()-getSPS()-getQpBDOffsetC();
-
-if (ttype == TEXT_LUMA)
-{
-qpScaled = qpbase + qpBDOffset;
-}
-else
-{
-int chromaQPOffset;
-if (ttype == TEXT_CHROMA_U)
-{
-chromaQPOffset = 
cu-getSlice()-getPPS()-getChromaCbQpOffset() + 
cu-getSlice()-getSliceQpDeltaCb();
-}
-else
-{
-chromaQPOffset = 
cu-getSlice()-getPPS()-getChromaCrQpOffset() + 
cu-getSlice()-getSliceQpDeltaCr();
-}
-qpbase = qpbase + chromaQPOffset;
-
-qpScaled = Clip3(-qpBDOffset, 57, qpbase);
-
-if (qpScaled  0)
-{
-qpScaled = qpScaled +  qpBDOffset;
-}
-else
-{
-qpScaled = g_chromaScale[qpScaled] + qpBDOffset;
-}
-}
-cQpBase.setQpParam(qpScaled);
-
 uint32_t log2TrSize = g_convertToBit[width] + 2;
 int scalingListType = (cu-isIntra(absPartIdx) ? 0 : 3) + 
g_eTTable[(int)ttype];
 assert(scalingListType  6);
@@ -317,7 +281,7 @@
 
 int transformShift = MAX_TR_DYNAMIC_RANGE - X265_DEPTH - log2TrSize; 
// Represents scaling through forward transform
 
-int qbits = QUANT_SHIFT + cQpBase.m_per + transformShift;
+int qbits = QUANT_SHIFT + m_qpParam.m_per + transformShift;
 add = (cu-getSlice()-getSliceType() == I_SLICE ? 171 : 85)  (qbits 
- 9);
 
 int numCoeff = width * height;
diff -r 40895c94da21 -r 8afda01fe3ea source/common/lowres.cpp
--- a/source/common/lowres.cpp  Wed Dec 11 14:52:38 2013 +0530
+++ b/source/common/lowres.cpp  Wed Dec 11 16:31:28 2013 +0530
@@ -50,6 +50,12 @@
 qpOffset = (double*)x265_malloc(sizeof(double) * cuCount);
 if (!qpAqOffset || !invQscaleFactor || !qpOffset)
 *aqMode = 0;
+else
+{
+::memset(qpAqOffset, 0, sizeof(double) * cuCount);
+::memset(invQscaleFactor, 0, sizeof(int) * cuCount);
+::memset(qpOffset, 0, sizeof(double) * cuCount);
+}
 }
 propagateCost = (uint16_t*)x265_malloc(sizeof(uint16_t) * cuCount);
 
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] cuTree: integrated CuTree into RateControl and Added b-references into RC

2013-12-02 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1385986798 -19800
# Node ID 8617e8ab6fafd5dea42e63f135f6df02761d5dd6
# Parent  a0f2c87c5f0a27a2f7e6e96af675efc419988d6e
cuTree: integrated CuTree into RateControl and Added b-references into RC

diff -r a0f2c87c5f0a -r 8617e8ab6faf source/common/common.cpp
--- a/source/common/common.cpp  Mon Dec 02 12:53:59 2013 +0530
+++ b/source/common/common.cpp  Mon Dec 02 17:49:58 2013 +0530
@@ -398,6 +398,7 @@
 {
 //currently the default
 param-rc.aqMode = X265_AQ_NONE;
+param-rc.cuTree = 0;
 }
 else if (!strcmp(tune, ssim))
 {
diff -r a0f2c87c5f0a -r 8617e8ab6faf source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cppMon Dec 02 12:53:59 2013 +0530
+++ b/source/encoder/ratecontrol.cppMon Dec 02 17:49:58 2013 +0530
@@ -118,6 +118,7 @@
 if (cfg-param.rc.aqMode)
 {
 pic-m_lowres.qpAqOffset[block_xy] = qp_adj;
+pic-m_lowres.qpOffset[block_xy] = qp_adj;
 pic-m_lowres.invQscaleFactor[block_xy] = 
x265_exp2fix8(qp_adj);
 block_xy++;
 }
@@ -141,6 +142,14 @@
 this-cfg = _cfg;
 ncu = (int)((cfg-param.sourceHeight * cfg-param.sourceWidth) / 
pow((int)16, 2.0));
 
+if (cfg-param.rc.cuTree)
+{
+qCompress = 1;
+cfg-param.rc.pbFactor = 1;
+}
+else
+qCompress = cfg-param.rc.qCompress;
+
 // validate for cfg-param.rc, maybe it is need to add a function like 
x265_parameters_valiate()
 cfg-param.rc.rfConstant = Clip3((double)-QP_BD_OFFSET, (double)51, 
cfg-param.rc.rfConstant);
 if (cfg-param.rc.rateControlMode == X265_RC_CRF)
@@ -149,8 +158,8 @@
 cfg-param.rc.bitrate = 0;
 
 double baseCplx = ncu * (cfg-param.bframes ? 120 : 80);
-double mbtree_offset = 0; // added later
-rateFactorConstant = pow(baseCplx, 1 - cfg-param.rc.qCompress) /
+double mbtree_offset = cfg-param.rc.cuTree ? (1.0 - 
cfg-param.rc.qCompress) * 13.5 : 0;
+rateFactorConstant = pow(baseCplx, 1 - qCompress) /
 qp2qScale(cfg-param.rc.rfConstant + mbtree_offset + QP_BD_OFFSET);
 }
 
@@ -248,7 +257,7 @@
 accumPNorm = .01;
 accumPQp = (ABR_INIT_QP_MIN)*accumPNorm;
 /* estimated ratio that produces a reasonable QP for the first I-frame 
*/
-cplxrSum = .01 * pow(7.0e5, cfg-param.rc.qCompress) * pow(ncu, 0.5);
+cplxrSum = .01 * pow(7.0e5, qCompress) * pow(ncu, 0.5);
 wantedBitsWindow = bitrate * frameDuration;
 }
 else if (cfg-param.rc.rateControlMode == X265_RC_CRF)
@@ -257,7 +266,7 @@
 accumPNorm = .01;
 accumPQp = ABR_INIT_QP * accumPNorm;
 /* estimated ratio that produces a reasonable QP for the first I-frame 
*/
-cplxrSum = .01 * pow(7.0e5, cfg-param.rc.qCompress) * pow(ncu, 0.5);
+cplxrSum = .01 * pow(7.0e5, qCompress) * pow(ncu, 0.5);
 wantedBitsWindow = bitrate * frameDuration;
 }
 
@@ -351,9 +360,9 @@
 double q0 = prevRefSlice-getSliceQp();
 double q1 = nextRefSlice-getSliceQp();
 
-if (prevRefSlice-getSliceType() == B_SLICE  
prevRefSlice-isReferenced())
+if (prevRefSlice-getSliceType() == X265_TYPE_BREF  
prevRefSlice-isReferenced())
 q0 -= pbOffset / 2;
-if (nextRefSlice-getSliceType() == B_SLICE  
nextRefSlice-isReferenced())
+if (nextRefSlice-getSliceType() == X265_TYPE_BREF  
nextRefSlice-isReferenced())
 q1 -= pbOffset / 2;
 if (i0  i1)
 q = (q0 + q1) / 2 + ipOffset;
@@ -453,7 +462,7 @@
 q = Clip3(lqmin, lqmax, q);
 }
 }
-else if (cfg-param.rc.rateControlMode == X265_RC_CRF  
cfg-param.rc.qCompress != 1)
+else if (cfg-param.rc.rateControlMode == X265_RC_CRF  qCompress != 
1)
 {
 q = qp2qScale(ABR_INIT_QP) / fabs(cfg-param.rc.ipFactor);
 }
@@ -565,7 +574,15 @@
 {
 double q;
 
-q = pow(rce-blurredComplexity, 1 - cfg-param.rc.qCompress);
+if (cfg-param.rc.cuTree)
+{
+double scale = 
curSlice-getSPS()-getVuiParameters()-getTimingInfo()-getTimeScale();
+double units = 
curSlice-getSPS()-getVuiParameters()-getTimingInfo()-getNumUnitsInTick();
+double timescale = units / scale;
+q = pow(BASE_FRAME_DURATION / CLIP_DURATION(2 * timescale), 1 - 
cfg-param.rc.qCompress);
+}
+else
+q = pow(rce-blurredComplexity, 1 - cfg-param.rc.qCompress);
 
 // avoid NaN's in the rc_eq
 if (rce-texBits + rce-mvBits == 0)
diff -r a0f2c87c5f0a -r 8617e8ab6faf source/encoder/ratecontrol.h
--- a/source/encoder/ratecontrol.h  Mon Dec 02 12:53:59 2013 +0530
+++ b/source/encoder/ratecontrol.h  Mon Dec 02 17:49:58 2013 +0530
@@ -115,6 +115,7 @@
 int64_t totalBits;/* totalbits used for already encoded frames */
 double lastRceq;
 int

[x265] [PATCH] slicetype: CuTree Implementation for AQ RateControl

2013-12-01 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1385965090 -19800
# Node ID fbfc3fa2141d942c3a7f04429f3124e16712658f
# Parent  e83550d5f10d7cb950db34cbb96f476ce8b0ab2f
slicetype: CuTree Implementation for AQ RateControl

Added Following methods into slicetype for CuTree Implementation
1.cuTree - Entry Point for CuTree
2.estimateCUPropagate and estimateCUPropagateCost - Calculate the CU Propagate 
cost for CU's
3.cuTreeFinish - update the qpOffset using Precomputed PropagateCost, 
weightedCostDelta and lookahead costs

Added cuTree option into param-rc and make it as a Disable, still the cuTree 
is an Under Construction

diff -r e83550d5f10d -r fbfc3fa2141d source/common/common.cpp
--- a/source/common/common.cpp  Sun Dec 01 19:44:27 2013 -0600
+++ b/source/common/common.cpp  Mon Dec 02 11:48:10 2013 +0530
@@ -219,6 +219,7 @@
 param-rc.qp = 32;
 param-rc.aqMode = X265_AQ_NONE;
 param-rc.aqStrength = 1.0;
+param-rc.cuTree = 0;
 
 /* Quality Measurement Metrics */
 param-bEnablePsnr = 1;
diff -r e83550d5f10d -r fbfc3fa2141d source/common/lowres.cpp
--- a/source/common/lowres.cpp  Sun Dec 01 19:44:27 2013 -0600
+++ b/source/common/lowres.cpp  Mon Dec 02 11:48:10 2013 +0530
@@ -47,9 +47,11 @@
 {
 qpAqOffset = (double*)x265_malloc(sizeof(double) * cuCount);
 invQscaleFactor = (int*)x265_malloc(sizeof(int) * cuCount);
-if (!qpAqOffset || !invQscaleFactor)
+qpOffset = (double*)x265_malloc(sizeof(double) * cuCount);
+if (!qpAqOffset || !invQscaleFactor || !qpOffset)
 *aqMode = 0;
 }
+propagateCost = (uint16_t*)x265_malloc(sizeof(uint16_t) * cuCount);
 
 /* allocate lowres buffers */
 for (int i = 0; i  4; i++)
@@ -111,6 +113,8 @@
 
 X265_FREE(qpAqOffset);
 X265_FREE(invQscaleFactor);
+X265_FREE(qpOffset);
+X265_FREE(propagateCost);
 }
 
 // (re) initialize lowres state
diff -r e83550d5f10d -r fbfc3fa2141d source/common/lowres.h
--- a/source/common/lowres.hSun Dec 01 19:44:27 2013 -0600
+++ b/source/common/lowres.hMon Dec 02 11:48:10 2013 +0530
@@ -126,9 +126,13 @@
 /* rate control / adaptive quant data */
 double*   qpAqOffset;  // qp Aq offset values for each Cu
 int*  invQscaleFactor; // qScale values for qp Aq Offsets
+double*   qpOffset;
 uint64_t  wp_ssd[3];   // This is different than SSDY, this is 
sum(pixel^2) - sum(pixel)^2 for entire frame
 uint64_t  wp_sum[3];
 
+uint16_t* propagateCost;
+doubleweightedCostDelta[X265_BFRAME_MAX+2];
+
 void create(TComPicYuv *orig, int bframes, int32_t *aqMode);
 void destroy(int bframes);
 void init(TComPicYuv *orig, int poc, int sliceType, int bframes);
diff -r e83550d5f10d -r fbfc3fa2141d source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp   Sun Dec 01 19:44:27 2013 -0600
+++ b/source/encoder/frameencoder.cpp   Mon Dec 02 11:48:10 2013 +0530
@@ -1117,7 +1117,11 @@
 {
 for (int w = 0; w  noOfBlocks  (block_x + w)  maxBlockCols; 
w++)
 {
-qp_offset += pic-m_lowres.qpAqOffset[block_x + w + (block_y * 
maxBlockCols)];
+qp_offset += pic-m_lowres.qpAqOffset[block_x + w + (block_y * 
maxBlockCols)];
+if (pic-getSlice()-isReferenced()  m_cfg-param.rc.cuTree 
 m_cfg-param.rc.aqMode)
+qp_offset += pic-m_lowres.qpOffset[block_x + w + (block_y 
* maxBlockCols)];
+else
+qp_offset += pic-m_lowres.qpAqOffset[block_x + w + 
(block_y * maxBlockCols)];
 cnt++;
 }
 }
diff -r e83550d5f10d -r fbfc3fa2141d source/encoder/ratecontrol.h
--- a/source/encoder/ratecontrol.h  Sun Dec 01 19:44:27 2013 -0600
+++ b/source/encoder/ratecontrol.h  Mon Dec 02 11:48:10 2013 +0530
@@ -36,6 +36,14 @@
 class TComPic;
 class TEncCfg;
 
+#define BASE_FRAME_DURATION 0.04
+
+/* Arbitrary limitations as a sanity check. */
+#define MAX_FRAME_DURATION 1.00
+#define MIN_FRAME_DURATION 0.01
+
+#define CLIP_DURATION(f) Clip3(MIN_FRAME_DURATION, MAX_FRAME_DURATION, f)
+
 struct RateControlEntry
 {
 int sliceType;
diff -r e83550d5f10d -r fbfc3fa2141d source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp  Sun Dec 01 19:44:27 2013 -0600
+++ b/source/encoder/slicetype.cpp  Mon Dec 02 11:48:10 2013 +0530
@@ -31,6 +31,7 @@
 #include slicetype.h
 #include motion.h
 #include mv.h
+#include ratecontrol.h
 
 #define LOWRES_COST_MASK  ((1  14) - 1)
 #define LOWRES_COST_SHIFT 14
@@ -86,6 +87,8 @@
 lhrows[i].widthInCU = widthInCU;
 lhrows[i].heightInCU = heightInCU;
 }
+
+scratch = (int*)x265_malloc(widthInCU * sizeof(int));
 }
 
 Lookahead::~Lookahead()
@@ -127,6 +130,7 @@
 {
 x265_free(wbuffer[i]);
 }
+X265_FREE(scratch);
 }
 
 void Lookahead::addPicture(TComPic *pic, int sliceType)
@@ -265,6 +269,7 @@
 
 fenc = frames[b];
 ref  = frames[p0];
+int

[x265] [PATCH] slicetype: fix for gcc warnings

2013-12-01 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1385969039 -19800
# Node ID a0f2c87c5f0a27a2f7e6e96af675efc419988d6e
# Parent  c75c3431b108b7c3e5faa36b5f4ab95fbdf2e6a7
slicetype: fix for gcc warnings

diff -r c75c3431b108 -r a0f2c87c5f0a source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp  Mon Dec 02 11:48:10 2013 +0530
+++ b/source/encoder/slicetype.cpp  Mon Dec 02 12:53:59 2013 +0530
@@ -1273,7 +1273,7 @@
 }
 }
 
-void Lookahead::cuTree(Lowres **frames, int numframes, bool bintra)
+void Lookahead::cuTree(Lowres **Frames, int numframes, bool bintra)
 {
 int idx = !bintra;
 int lastnonb, curnonb = 1;
@@ -1291,7 +1291,7 @@
 if (bintra)
 estimateFrameCost(0, 0, 0, 0);
 
-while (i  0  frames[i]-sliceType == X265_TYPE_B)
+while (i  0  Frames[i]-sliceType == X265_TYPE_B)
 i--;
 lastnonb = i;
 
@@ -1302,36 +1302,36 @@
 {
 if (bintra)
 {
-memset(frames[0]-propagateCost, 0, cuCount * sizeof(uint16_t));
-memcpy(frames[0]-qpOffset, frames[0]-qpAqOffset, cuCount * 
sizeof(double));
+memset(Frames[0]-propagateCost, 0, cuCount * sizeof(uint16_t));
+memcpy(Frames[0]-qpOffset, Frames[0]-qpAqOffset, cuCount * 
sizeof(double));
 return;
 }
-std::swap(frames[lastnonb]-propagateCost, frames[0]-propagateCost);
-memset(frames[0]-propagateCost, 0, cuCount * sizeof(uint16_t));
+std::swap(Frames[lastnonb]-propagateCost, Frames[0]-propagateCost);
+memset(Frames[0]-propagateCost, 0, cuCount * sizeof(uint16_t));
 }
 else
 {
 if (lastnonb  idx)
 return;
-memset(frames[lastnonb]-propagateCost, 0, cuCount * sizeof(uint16_t));
+memset(Frames[lastnonb]-propagateCost, 0, cuCount * sizeof(uint16_t));
 }
 
 while (i--  idx)
 {
 curnonb = i;
-while (frames[curnonb]-sliceType == X265_TYPE_B  curnonb  0)
+while (Frames[curnonb]-sliceType == X265_TYPE_B  curnonb  0)
 curnonb--;
 if (curnonb  idx)
 break;
 
 estimateFrameCost(curnonb, lastnonb, lastnonb, 0);
-memset(frames[curnonb]-propagateCost, 0, cuCount * sizeof(uint16_t));
+memset(Frames[curnonb]-propagateCost, 0, cuCount * sizeof(uint16_t));
 bframes = lastnonb - curnonb - 1;
 if (cfg-param.bBPyramid  bframes  1)
 {
 int middle = (bframes + 1) / 2 + curnonb;
 estimateFrameCost(curnonb, lastnonb, middle, 0);
-memset(frames[middle]-propagateCost, 0, cuCount * 
sizeof(uint16_t));
+memset(Frames[middle]-propagateCost, 0, cuCount * 
sizeof(uint16_t));
 while (i  curnonb)
 {
 int p0 = i  middle ? middle : curnonb;
@@ -1339,54 +1339,54 @@
 if (i != middle)
 {
 estimateFrameCost(p0, p1, i, 0);
-estimateCUPropagate(frames, averageDuration, p0, p1, i, 0);
+estimateCUPropagate(Frames, averageDuration, p0, p1, i, 0);
 }
 i--;
 }
-estimateCUPropagate(frames, averageDuration, curnonb, lastnonb, 
middle, 1);
+estimateCUPropagate(Frames, averageDuration, curnonb, lastnonb, 
middle, 1);
 }
 else
 {
 while (i  curnonb)
 {
 estimateFrameCost(curnonb, lastnonb, i, 0);
-estimateCUPropagate(frames, averageDuration, curnonb, 
lastnonb, i, 0);
+estimateCUPropagate(Frames, averageDuration, curnonb, 
lastnonb, i, 0);
 i--;
 }
 }
-estimateCUPropagate(frames, averageDuration, curnonb, lastnonb, 
lastnonb, 1);
+estimateCUPropagate(Frames, averageDuration, curnonb, lastnonb, 
lastnonb, 1);
 lastnonb = curnonb;
 }
 
 if (!cfg-param.lookaheadDepth)
 {
 estimateFrameCost(0, lastnonb, lastnonb, 0);
-estimateCUPropagate(frames, averageDuration, 0, lastnonb, lastnonb, 1);
-std::swap(frames[lastnonb]-propagateCost, frames[0]-propagateCost);
+estimateCUPropagate(Frames, averageDuration, 0, lastnonb, lastnonb, 1);
+std::swap(Frames[lastnonb]-propagateCost, Frames[0]-propagateCost);
 }
 
-cuTreeFinish(frames[lastnonb], averageDuration, lastnonb);
+cuTreeFinish(Frames[lastnonb], averageDuration, lastnonb);
 if (cfg-param.bBPyramid  bframes  1 /*  
!h-param.rc.i_vbv_buffer_size */)
-cuTreeFinish(frames[lastnonb + (bframes + 1) / 2], averageDuration, 0);
+cuTreeFinish(Frames[lastnonb + (bframes + 1) / 2], averageDuration, 0);
 }
 
-void Lookahead::estimateCUPropagate(Lowres **frames, double averageDuration, 
int p0, int p1, int b, int referenced)
+void Lookahead::estimateCUPropagate(Lowres **Frames, double averageDuration, 
int p0, int p1, int b, int referenced)
 {
-uint16_t

[x265] [PATCH] slicetype: CuTree Implementation for AQ RateControl

2013-11-27 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1385553019 -19800
# Node ID 24b3e80a86f7511e7a17cb2cf57fb6bcad993603
# Parent  ece323e1b6035c125b8d1e892e02cca84917990b
slicetype: CuTree Implementation for AQ RateControl

Added Following methods into slicetype for CuTree Implementation
1.cuTree - Entry Point for CuTree
2.estimateCUPropagate and estimateCUPropagateCost - Calculate the CU Propagate 
cost for CU's
3.cuTreeFinish - set the qpOffset using Precomputed PropagateCost, 
weightedCostDelta and lookahead costs

Added cuTree option into param-rc and make it as a Disable, still the cuTree 
is an Under Construction

diff -r ece323e1b603 -r 24b3e80a86f7 source/common/common.cpp
--- a/source/common/common.cpp  Wed Nov 27 00:29:23 2013 -0600
+++ b/source/common/common.cpp  Wed Nov 27 17:20:19 2013 +0530
@@ -216,6 +216,7 @@
 param-rc.qp = 32;
 param-rc.aqMode = X265_AQ_NONE;
 param-rc.aqStrength = 1.0;
+param-rc.cuTree = 0;
 
 /* Quality Measurement Metrics */
 param-bEnablePsnr = 1;
diff -r ece323e1b603 -r 24b3e80a86f7 source/common/lowres.cpp
--- a/source/common/lowres.cpp  Wed Nov 27 00:29:23 2013 -0600
+++ b/source/common/lowres.cpp  Wed Nov 27 17:20:19 2013 +0530
@@ -47,10 +47,13 @@
 {
 qpAqOffset = (double*)x265_malloc(sizeof(double) * cuCount);
 invQscaleFactor = (int*)x265_malloc(sizeof(int) * cuCount);
-if (!qpAqOffset || !invQscaleFactor)
+qpOffset = (double*)x265_malloc(sizeof(double) * cuCount);
+if (!qpAqOffset || !invQscaleFactor || !qpOffset)
 *aqMode = 0;
 }
 
+propagateCost = (uint16_t*)x265_malloc(sizeof(uint16_t) * cuCount);
+
 /* allocate lowres buffers */
 for (int i = 0; i  4; i++)
 {
@@ -111,6 +114,8 @@
 
 X265_FREE(qpAqOffset);
 X265_FREE(invQscaleFactor);
+X265_FREE(qpOffset);
+X265_FREE(propagateCost);
 }
 
 // (re) initialize lowres state
diff -r ece323e1b603 -r 24b3e80a86f7 source/common/lowres.h
--- a/source/common/lowres.hWed Nov 27 00:29:23 2013 -0600
+++ b/source/common/lowres.hWed Nov 27 17:20:19 2013 +0530
@@ -128,6 +128,10 @@
 int*  invQscaleFactor; // qScale values for qp Aq Offsets
 uint64_t  wp_ssd[3];   // This is different than SSDY, this is 
sum(pixel^2) - sum(pixel)^2 for entire frame
 uint64_t  wp_sum[3];
+double*   qpOffset;
+
+uint16_t* propagateCost;
+doubleweightedCostDelta[X265_BFRAME_MAX+2];
 
 void create(TComPicYuv *orig, int bframes, int32_t *aqMode);
 void destroy(int bframes);
diff -r ece323e1b603 -r 24b3e80a86f7 source/encoder/ratecontrol.h
--- a/source/encoder/ratecontrol.h  Wed Nov 27 00:29:23 2013 -0600
+++ b/source/encoder/ratecontrol.h  Wed Nov 27 17:20:19 2013 +0530
@@ -44,6 +44,14 @@
 double qRceq;
 };
 
+#define BASE_FRAME_DURATION 0.04
+
+/* Arbitrary limitations as a sanity check. */
+#define MAX_FRAME_DURATION 1.00
+#define MIN_FRAME_DURATION 0.01
+
+#define CLIP_DURATION(f) Clip3(MIN_FRAME_DURATION, MAX_FRAME_DURATION, f)
+
 struct RateControl
 {
 TComSlice *curSlice;  /* all info about the current frame */
diff -r ece323e1b603 -r 24b3e80a86f7 source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp  Wed Nov 27 00:29:23 2013 -0600
+++ b/source/encoder/slicetype.cpp  Wed Nov 27 17:20:19 2013 +0530
@@ -31,6 +31,7 @@
 #include slicetype.h
 #include motion.h
 #include mv.h
+#include ratecontrol.h
 
 #define LOWRES_COST_MASK  ((1  14) - 1)
 #define LOWRES_COST_SHIFT 14
@@ -86,6 +87,8 @@
 lhrows[i].widthInCU = widthInCU;
 lhrows[i].heightInCU = heightInCU;
 }
+
+scratch = (int*)x265_malloc(widthInCU * sizeof(int));
 }
 
 Lookahead::~Lookahead()
@@ -127,6 +130,8 @@
 {
 x265_free(wbuffer[i]);
 }
+X265_FREE(scratch);
+
 }
 
 void Lookahead::addPicture(TComPic *pic, int sliceType)
@@ -262,6 +267,7 @@
 Lowres *fenc, *ref;
 fenc = frames[b];
 ref  = frames[p0];
+int deltaIndex = fenc-frameNum - ref-frameNum;
 
 /* epsilon is chosen to require at least a numerator of 127 (with 
denominator = 128) */
 const float epsilon = 1.f / 128.f;
@@ -318,6 +324,9 @@
 {
 SET_WEIGHT(w, 1, minscale, mindenom, minoff);
 
+// set weighted delta cost
+fenc-weightedCostDelta[deltaIndex] = minscore / origscore;
+
 int offset = w.inputOffset  (X265_DEPTH - 8);
 int scale = w.inputWeight;
 int denom = w.log2WeightDenom;
@@ -906,7 +915,8 @@
 
 if (!framecnt)
 {
-// TODO: mb-tree
+if (cfg-param.rc.cuTree  cfg-param.rc.aqMode)
+cuTree(frames, 0, bKeyframe);
 return;
 }
 
@@ -1039,8 +1049,9 @@
 num_bframes = 0;
 }
 
-// TODO if rc.b_mb_tree Enabled the need to call  x264_macroblock_tree 
currently Ignored the call
-// if (!cfg-param.bIntraRefresh)
+if (cfg-param.rc.cuTree  cfg-param.rc.aqMode)
+cuTree(frames, X265_MIN(num_frames, cfg-param.keyframeMax

[x265] [PATCH] bpyramid: Support for b-pyramid with b-adapt 0

2013-11-20 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1384937803 -19800
# Node ID 8e9c965648f6a5f54fcadc6c4235a77d997b919f
# Parent  108ddc9e5c6b15e758ccbf08a0e923cbb7b28b5e
bpyramid: Support for b-pyramid with b-adapt 0

Test results for reference when enable and disable the b-pyramid with b-adapt=0

Cli option :  --bframes=10 --b-adapt=0 --b-pyramid=1 -f 100
Enable  B-references  : --b-pyramid=1
Disable B-references  : --b-pyramid=0

Results:
Enable / Disable

clip - BasketballDrive_1920x1080_50
Total time taken - 57.84s (1.73 fps) / 51.74s (1.93 fps)
Bitrates - 4725.37 / 5660.68
PSNR - 37.178 / 37.178


Clip - Cactus_1920x1080_50
Total time taken - 41.90s (2.39 fps) / 47.08s (2.12 fps)
Bitrates - 3800.62 / 4838.73
PSNR - 35.640 / 35.615


Clip - Johnny_1280x720_60
Total time taken - 10.41s (9.61 fps) / 10.34s (9.67 fps)
Bitrates - 327.21 / 383.25
PSNR - 40.674 / 40.631

Clip - FourPeople_1280x720_60
Total time taken - 10.72s (9.33 fps) / 10.18s (9.82 fps)
Bitrates - 547.18 / 640.88
PSNR - 39.808 / 39.789

diff -r 108ddc9e5c6b -r 8e9c965648f6 source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp  Tue Nov 19 23:45:52 2013 -0600
+++ b/source/encoder/slicetype.cpp  Wed Nov 20 14:26:43 2013 +0530
@@ -859,13 +859,29 @@
 pic-m_lowres.sliceType = X265_TYPE_P;
 outputQueue.pushBack(*pic);
 numDecided++;
+
+if (cfg-param.bpyramid  bframes  1)
+{
+int bref = bframes / 2;
+if (list[bref - 1]-m_lowres.sliceType == X265_TYPE_AUTO)
+{
+list[bref - 1]-m_lowres.sliceType = X265_TYPE_BREF;
+outputQueue.pushBack(*list[bref - 1]);
+numDecided++;
+}
+}
+
 for (int i = 0; i  bframes; i++)
 {
 pic = list[i];
 if (pic-m_lowres.sliceType == X265_TYPE_AUTO)
 pic-m_lowres.sliceType = X265_TYPE_B;
-outputQueue.pushBack(*pic);
-numDecided++;
+
+if (pic-m_lowres.sliceType != X265_TYPE_BREF)
+{
+outputQueue.pushBack(*pic);
+numDecided++;
+}
 }
 }
 }
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] b-pyramid implementation: Allow the use of B-frames as references for non B and B frames

2013-11-18 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1384769433 -19800
# Node ID 1e22b93638072ed805478d7af17f90e285fb4969
# Parent  2321ebe0bf64e5f3c0034076c7edb3ecbcd48039
b-pyramid implementation: Allow the use of B-frames as references for non B and 
B frames

when we enable the b-pyramid the bitrates efficienctly reduced and there is not 
much diff in the performance
and the PSNR 00. increased some of the clips and decreased some of clips

Test results for reference when enable and disable the b-pyramid:
cli option : -b 10 --hash=1 -f 100 --b-pyramid=1 --ref=1 --b-adapt=2
Enable B-reference  : --b-pyramid=1
Disable B-reference : --b-pyramid=0

Results:
Enable / Disable

clip - FourPeople_1280x720_60.yuv
Total time taken - 9.70s (10.31 fps) / 9.93s (10.07 fps)
Bitrates - 516.30 kb/s / 544.68 kb/s
PSNR - 39.725 / 39.701

clip - BasketballDrive_1920x1080_50.y4m
Total time taken - 39.06s (2.51 fps) / 38.98s (2.57 fps)
Bitrates -  4166.92 kb/s / 4370.43 kb/s
PSNR -  37.261 / 37.268

clip - Johnny_1280x720_60.y4m
Total time taken - 8.88s (11.27 fps) / 11.08s (9.03 fps)
Bitrates - 304.29 kb/s / 328.84 kb/s
PSNR - 40.605 / 40.551

Total time taken - 30.97s (3.23 fps) / 33.65s (2.97 fps)
Bitrates - 3496.84 kb/s / 3683.93 kb/s
PSNR - 35.645 / 35.660

diff -r 2321ebe0bf64 -r 1e22b9363807 source/common/common.cpp
--- a/source/common/common.cpp  Mon Nov 18 11:32:06 2013 +0530
+++ b/source/common/common.cpp  Mon Nov 18 15:40:33 2013 +0530
@@ -54,6 +54,7 @@
 
 static int parseCspName(const char *arg, int error);
 static int parseName(const char *arg, const char * const * names, int error);
+static int parse_enum(const char *, const char * const * names, int *dst);
 
 using namespace x265;
 
@@ -165,6 +166,7 @@
 param-bframes = 3;
 param-lookaheadDepth = 40;
 param-bFrameAdaptive = X265_B_ADAPT_FAST;
+param-bpyramid = 0;
 param-scenecutThreshold = 40; /* Magic number pulled in from x264*/
 
 /* Intra Coding Tools */
@@ -532,7 +534,7 @@
 }
 
 CHECK(param-bEnableWavefront  0, WaveFrontSynchro cannot be negative);
-
+CHECK(param-bpyramid = 2, b-pyramid is 0 or 1);
 return check_failed;
 }
 
@@ -620,6 +622,7 @@
 x265_log(param, X265_LOG_INFO, RDpenalty: %d\n, 
param-rdPenalty);
 }
 x265_log(param, X265_LOG_INFO, Lookahead / bframes / badapt : %d / %d / 
%d\n, param-lookaheadDepth, param-bframes, param-bFrameAdaptive);
+x265_log(param, X265_LOG_INFO, b-pyramid / weightp / ref: %d / %d / 
%d\n, param-bpyramid, param-bEnableWeightedPred, param-maxNumReferences);
 x265_log(param, X265_LOG_INFO, tools: );
 #define TOOLOPT(FLAG, STR) if (FLAG) fprintf(stderr, %s , STR)
 TOOLOPT(param-bEnableRectInter, rect);
@@ -628,7 +631,6 @@
 TOOLOPT(param-bEnableConstrainedIntra, cip);
 TOOLOPT(param-bEnableEarlySkip, esd);
 fprintf(stderr, rd=%d , param-rdLevel);
-fprintf(stderr, ref=%d , param-maxNumReferences);
 
 TOOLOPT(param-bEnableLoopFilter, lft);
 if (param-bEnableSAO)
@@ -650,7 +652,6 @@
 else
 fprintf(stderr, tskip );
 }
-TOOLOPT(param-bEnableWeightedPred, weightp);
 TOOLOPT(param-bEnableWeightedBiPred, weightbp);
 TOOLOPT(param-rc.aqMode, aq);
 fprintf(stderr, \n);
@@ -747,6 +748,15 @@
 }
 OPT(input-csp) p-sourceCsp = ::parseCspName(value, berror);
 OPT(me)p-searchMethod = ::parseName(value, 
x265_motion_est_names, berror);
+OPT(b-pyramid)
+{
+berror |= parse_enum(value, x265_b_pyramid_names, p-bpyramid);
+if (berror)
+{
+berror = 0;
+p-bpyramid = atoi(value);
+}
+}
 else
 return X265_PARAM_BAD_NAME;
 #undef OPT
@@ -802,6 +812,7 @@
 BOOL(p-bEnableSAO, sao);
 s += sprintf(s,  sao-lcu-bounds=%d, p-saoLcuBoundary);
 s += sprintf(s,  sao-lcu-opt=%d, p-saoLcuBasedOptimization);
+s += sprintf(s,  b-pyramid=%d, p-bpyramid);
 #undef BOOL
 
 return buf;
@@ -843,3 +854,13 @@
 error = 1;
 return a;
 }
+static int parse_enum(const char *arg, const char * const * names, int *dst)
+{
+for (int i = 0; names[i]; i++)
+if (!strcmp(arg, names[i]))
+{
+*dst = i;
+return 0;
+}
+return -1;
+}
diff -r 2321ebe0bf64 -r 1e22b9363807 source/common/common.h
--- a/source/common/common.hMon Nov 18 11:32:06 2013 +0530
+++ b/source/common/common.hMon Nov 18 15:40:33 2013 +0530
@@ -107,6 +107,7 @@
 #define X265_LOG2(x)  log2(x)
 #endif
 
+static const char * const x265_b_pyramid_names[] = {none, normal, 0};
 /* defined in common.cpp */
 int64_t x265_mdate(void);
 void x265_log(x265_param *param, int level, const char *fmt, ...);
diff -r 2321ebe0bf64 -r 1e22b9363807 source/encoder/dpb.cpp
--- a/source/encoder/dpb.cppMon Nov 18 11:32:06 2013 +0530
+++ b/source/encoder/dpb.cppMon Nov 18 15:40:33 2013 +0530
@@ -78,7 +78,17 @@
 m_lastIDR = pocCurr

Re: [x265] [PATCH] b-pyramid implementation: Allow the use of B-frames as references for non B and B frames

2013-11-18 Thread Gopu Govindaswamy
On Mon, Nov 18, 2013 at 4:47 PM, Deepthi Nandakumar
deep...@multicorewareinc.com wrote:



 On Mon, Nov 18, 2013 at 3:40 PM, Gopu Govindaswamy
 g...@multicorewareinc.com wrote:

 # HG changeset patch
 # User Gopu Govindaswamy g...@multicorewareinc.com
 # Date 1384769433 -19800
 # Node ID 1e22b93638072ed805478d7af17f90e285fb4969
 # Parent  2321ebe0bf64e5f3c0034076c7edb3ecbcd48039
 b-pyramid implementation: Allow the use of B-frames as references for non
 B and B frames

 when we enable the b-pyramid the bitrates efficienctly reduced and there
 is not much diff in the performance
 and the PSNR 00. increased some of the clips and decreased some of clips

 Test results for reference when enable and disable the b-pyramid:
 cli option : -b 10 --hash=1 -f 100 --b-pyramid=1 --ref=1 --b-adapt=2
 Enable B-reference  : --b-pyramid=1
 Disable B-reference : --b-pyramid=0

 Results:
 Enable / Disable

 clip - FourPeople_1280x720_60.yuv
 Total time taken - 9.70s (10.31 fps) / 9.93s (10.07 fps)
 Bitrates - 516.30 kb/s / 544.68 kb/s
 PSNR - 39.725 / 39.701

 clip - BasketballDrive_1920x1080_50.y4m
 Total time taken - 39.06s (2.51 fps) / 38.98s (2.57 fps)
 Bitrates -  4166.92 kb/s / 4370.43 kb/s
 PSNR -  37.261 / 37.268

 clip - Johnny_1280x720_60.y4m
 Total time taken - 8.88s (11.27 fps) / 11.08s (9.03 fps)
 Bitrates - 304.29 kb/s / 328.84 kb/s
 PSNR - 40.605 / 40.551

 Total time taken - 30.97s (3.23 fps) / 33.65s (2.97 fps)
 Bitrates - 3496.84 kb/s / 3683.93 kb/s
 PSNR - 35.645 / 35.660

 diff -r 2321ebe0bf64 -r 1e22b9363807 source/common/common.cpp
 --- a/source/common/common.cpp  Mon Nov 18 11:32:06 2013 +0530
 +++ b/source/common/common.cpp  Mon Nov 18 15:40:33 2013 +0530
 @@ -54,6 +54,7 @@

  static int parseCspName(const char *arg, int error);
  static int parseName(const char *arg, const char * const * names, int
 error);
 +static int parse_enum(const char *, const char * const * names, int
 *dst);

  using namespace x265;

 @@ -165,6 +166,7 @@
  param-bframes = 3;
  param-lookaheadDepth = 40;
  param-bFrameAdaptive = X265_B_ADAPT_FAST;
 +param-bpyramid = 0;
  param-scenecutThreshold = 40; /* Magic number pulled in from x264*/

  /* Intra Coding Tools */
 @@ -532,7 +534,7 @@
  }

  CHECK(param-bEnableWavefront  0, WaveFrontSynchro cannot be
 negative);
 -
 +CHECK(param-bpyramid = 2, b-pyramid is 0 or 1);
  return check_failed;
  }

 @@ -620,6 +622,7 @@
  x265_log(param, X265_LOG_INFO, RDpenalty:
 %d\n, param-rdPenalty);
  }
  x265_log(param, X265_LOG_INFO, Lookahead / bframes / badapt : %d /
 %d / %d\n, param-lookaheadDepth, param-bframes, param-bFrameAdaptive);
 +x265_log(param, X265_LOG_INFO, b-pyramid / weightp / ref: %d /
 %d / %d\n, param-bpyramid, param-bEnableWeightedPred,
 param-maxNumReferences);
  x265_log(param, X265_LOG_INFO, tools: );
  #define TOOLOPT(FLAG, STR) if (FLAG) fprintf(stderr, %s , STR)
  TOOLOPT(param-bEnableRectInter, rect);
 @@ -628,7 +631,6 @@
  TOOLOPT(param-bEnableConstrainedIntra, cip);
  TOOLOPT(param-bEnableEarlySkip, esd);
  fprintf(stderr, rd=%d , param-rdLevel);
 -fprintf(stderr, ref=%d , param-maxNumReferences);

  TOOLOPT(param-bEnableLoopFilter, lft);
  if (param-bEnableSAO)
 @@ -650,7 +652,6 @@
  else
  fprintf(stderr, tskip );
  }
 -TOOLOPT(param-bEnableWeightedPred, weightp);
  TOOLOPT(param-bEnableWeightedBiPred, weightbp);
  TOOLOPT(param-rc.aqMode, aq);
  fprintf(stderr, \n);
 @@ -747,6 +748,15 @@
  }
  OPT(input-csp) p-sourceCsp = ::parseCspName(value, berror);
  OPT(me)p-searchMethod = ::parseName(value,
 x265_motion_est_names, berror);
 +OPT(b-pyramid)
 +{
 +berror |= parse_enum(value, x265_b_pyramid_names, p-bpyramid);
 +if (berror)
 +{
 +berror = 0;
 +p-bpyramid = atoi(value);
 +}
 +}


 Not clear why parse_enum is required here? For now, this is a boolean flag
 which can be assigned directly to the param structure.

  Because we can use --b-pyramid=none  or --b-pyramid=0
 --b-pyramid=normalor --b-pyramid=1

 


  else
  return X265_PARAM_BAD_NAME;
  #undef OPT
 @@ -802,6 +812,7 @@
  BOOL(p-bEnableSAO, sao);
  s += sprintf(s,  sao-lcu-bounds=%d, p-saoLcuBoundary);
  s += sprintf(s,  sao-lcu-opt=%d, p-saoLcuBasedOptimization);
 +s += sprintf(s,  b-pyramid=%d, p-bpyramid);
  #undef BOOL

  return buf;
 @@ -843,3 +854,13 @@
  error = 1;
  return a;
  }
 +static int parse_enum(const char *arg, const char * const * names, int
 *dst)
 +{
 +for (int i = 0; names[i]; i++)
 +if (!strcmp(arg, names[i]))
 +{
 +*dst = i;
 +return 0;
 +}
 +return -1;
 +}
 diff -r 2321ebe0bf64 -r 1e22b9363807 source/common/common.h
 --- a/source/common/common.hMon Nov 18 11:32:06 2013 +0530
 +++ b

Re: [x265] [PATCH] b-pyramid implementation: Allow the use of B-frames as references for non B and B frames

2013-11-18 Thread Gopu Govindaswamy
yes the  numReorderdPics is 2, but once we increased the
numReorderPics then the max DPB size should also to increase by 1 if
we enable the b-pyramid,  instead of this i have directly increased by
3, i will change this to

numReorderdPics = 2 and
m_maxDecPicBuffering[i] = X265_MIN(MAX_NUM_REF,
X265_MAX(m_numReorderPics[i] + 1, _param-maxNumReferences) + 2 );

when we enable the b-pyramid else the compute RPS will not produce the
Correct L0 reference

On Mon, Nov 18, 2013 at 4:53 PM, Deepthi Devaki Akkoorath
deepthidev...@multicorewareinc.com wrote:



 On Mon, Nov 18, 2013 at 3:40 PM, Gopu Govindaswamy
 g...@multicorewareinc.com wrote:

 # HG changeset patch
 # User Gopu Govindaswamy g...@multicorewareinc.com
 # Date 1384769433 -19800
 # Node ID 1e22b93638072ed805478d7af17f90e285fb4969
 # Parent  2321ebe0bf64e5f3c0034076c7edb3ecbcd48039
 b-pyramid implementation: Allow the use of B-frames as references for non
 B and B frames

 when we enable the b-pyramid the bitrates efficienctly reduced and there
 is not much diff in the performance
 and the PSNR 00. increased some of the clips and decreased some of clips

 Test results for reference when enable and disable the b-pyramid:
 cli option : -b 10 --hash=1 -f 100 --b-pyramid=1 --ref=1 --b-adapt=2
 Enable B-reference  : --b-pyramid=1
 Disable B-reference : --b-pyramid=0

 Results:
 Enable / Disable

 clip - FourPeople_1280x720_60.yuv
 Total time taken - 9.70s (10.31 fps) / 9.93s (10.07 fps)
 Bitrates - 516.30 kb/s / 544.68 kb/s
 PSNR - 39.725 / 39.701

 clip - BasketballDrive_1920x1080_50.y4m
 Total time taken - 39.06s (2.51 fps) / 38.98s (2.57 fps)
 Bitrates -  4166.92 kb/s / 4370.43 kb/s
 PSNR -  37.261 / 37.268

 clip - Johnny_1280x720_60.y4m
 Total time taken - 8.88s (11.27 fps) / 11.08s (9.03 fps)
 Bitrates - 304.29 kb/s / 328.84 kb/s
 PSNR - 40.605 / 40.551

 Total time taken - 30.97s (3.23 fps) / 33.65s (2.97 fps)
 Bitrates - 3496.84 kb/s / 3683.93 kb/s
 PSNR - 35.645 / 35.660

 diff -r 2321ebe0bf64 -r 1e22b9363807 source/common/common.cpp
 --- a/source/common/common.cpp  Mon Nov 18 11:32:06 2013 +0530
 +++ b/source/common/common.cpp  Mon Nov 18 15:40:33 2013 +0530
 @@ -54,6 +54,7 @@

  static int parseCspName(const char *arg, int error);
  static int parseName(const char *arg, const char * const * names, int
 error);
 +static int parse_enum(const char *, const char * const * names, int
 *dst);

  using namespace x265;

 @@ -165,6 +166,7 @@
  param-bframes = 3;
  param-lookaheadDepth = 40;
  param-bFrameAdaptive = X265_B_ADAPT_FAST;
 +param-bpyramid = 0;
  param-scenecutThreshold = 40; /* Magic number pulled in from x264*/

  /* Intra Coding Tools */
 @@ -532,7 +534,7 @@
  }

  CHECK(param-bEnableWavefront  0, WaveFrontSynchro cannot be
 negative);
 -
 +CHECK(param-bpyramid = 2, b-pyramid is 0 or 1);
  return check_failed;
  }

 @@ -620,6 +622,7 @@
  x265_log(param, X265_LOG_INFO, RDpenalty:
 %d\n, param-rdPenalty);
  }
  x265_log(param, X265_LOG_INFO, Lookahead / bframes / badapt : %d /
 %d / %d\n, param-lookaheadDepth, param-bframes, param-bFrameAdaptive);
 +x265_log(param, X265_LOG_INFO, b-pyramid / weightp / ref: %d /
 %d / %d\n, param-bpyramid, param-bEnableWeightedPred,
 param-maxNumReferences);
  x265_log(param, X265_LOG_INFO, tools: );
  #define TOOLOPT(FLAG, STR) if (FLAG) fprintf(stderr, %s , STR)
  TOOLOPT(param-bEnableRectInter, rect);
 @@ -628,7 +631,6 @@
  TOOLOPT(param-bEnableConstrainedIntra, cip);
  TOOLOPT(param-bEnableEarlySkip, esd);
  fprintf(stderr, rd=%d , param-rdLevel);
 -fprintf(stderr, ref=%d , param-maxNumReferences);

  TOOLOPT(param-bEnableLoopFilter, lft);
  if (param-bEnableSAO)
 @@ -650,7 +652,6 @@
  else
  fprintf(stderr, tskip );
  }
 -TOOLOPT(param-bEnableWeightedPred, weightp);
  TOOLOPT(param-bEnableWeightedBiPred, weightbp);
  TOOLOPT(param-rc.aqMode, aq);
  fprintf(stderr, \n);
 @@ -747,6 +748,15 @@
  }
  OPT(input-csp) p-sourceCsp = ::parseCspName(value, berror);
  OPT(me)p-searchMethod = ::parseName(value,
 x265_motion_est_names, berror);
 +OPT(b-pyramid)
 +{
 +berror |= parse_enum(value, x265_b_pyramid_names, p-bpyramid);
 +if (berror)
 +{
 +berror = 0;
 +p-bpyramid = atoi(value);
 +}
 +}
  else
  return X265_PARAM_BAD_NAME;
  #undef OPT
 @@ -802,6 +812,7 @@
  BOOL(p-bEnableSAO, sao);
  s += sprintf(s,  sao-lcu-bounds=%d, p-saoLcuBoundary);
  s += sprintf(s,  sao-lcu-opt=%d, p-saoLcuBasedOptimization);
 +s += sprintf(s,  b-pyramid=%d, p-bpyramid);
  #undef BOOL

  return buf;
 @@ -843,3 +854,13 @@
  error = 1;
  return a;
  }
 +static int parse_enum(const char *arg, const char * const * names, int
 *dst)
 +{
 +for (int i = 0; names[i]; i++)
 +if (!strcmp(arg, names[i]))
 +{
 +*dst

[x265] [PATCH] b-pyramid implementation: Allow the use of B-frames as references for non B and B frames

2013-11-18 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1384842731 -19800
# Node ID c386acea7ba1ca48f32060f265586618ee744a9f
# Parent  2f5f538d2cbca3b46e8d27d860e9787cc19f406f
b-pyramid implementation: Allow the use of B-frames as references for non B and 
B frames

when we enable the b-pyramid the bitrates efficienctly reduced and there is not 
much diff in the performance
and the PSNR 00. increased some of the clips and decreased some of clips

Test results for reference when enable and disable the b-pyramid:
cli option : -b 10 --hash=1 -f 100 --b-pyramid=1 --b-adapt=2
Enable B-reference  : --b-pyramid=1
Disable B-reference : --b-pyramid=0

Results:
Enable / Disable

Clips - Johnny_1280x720_60.y4m
Total time taken - 11.19s (8.94 fps) / 13.44s (7.44 fps)
Bitrates  - 303.52 kb/s / 326.79 kb/s
PSNR  - 40.679 / 40.612

Clips - Cactus_1920x1080_50.y4m
Total Time taken - 44.61s (2.24 fps) / 48.23s (2.07 fps)
Bitrates   - 3420.80 kb/s / 3575.20 kb/s
PSNR   - 35.709 / 35.726

Clips  - BasketballDrive_1920x1080_50.y4m
Total time taken -  54.15s (1.85 fps) / 53.72s (1.86 fps)
Bitrates  - 4114.07 kb/s / 4310.45 kb/s
PSNR  - 37.283 / 37.290

Clips  - FourPeople_1280x720_60
Total time taken -  11.79s (8.48 fps) / 12.16s (8.23 fps)
Bitrates  - 514.90 kb/s / 539.08 kb/s
PSNR  - 39.782 / 39.757

diff -r 2f5f538d2cbc -r c386acea7ba1 source/common/common.cpp
--- a/source/common/common.cpp  Mon Nov 18 16:44:31 2013 -0600
+++ b/source/common/common.cpp  Tue Nov 19 12:02:11 2013 +0530
@@ -165,6 +165,7 @@
 param-bframes = 3;
 param-lookaheadDepth = 40;
 param-bFrameAdaptive = X265_B_ADAPT_FAST;
+param-bpyramid = 0;
 param-scenecutThreshold = 40; /* Magic number pulled in from x264*/
 
 /* Intra Coding Tools */
@@ -634,6 +635,7 @@
 x265_log(param, X265_LOG_INFO, RDpenalty: %d\n, 
param-rdPenalty);
 }
 x265_log(param, X265_LOG_INFO, Lookahead / bframes / badapt : %d / %d / 
%d\n, param-lookaheadDepth, param-bframes, param-bFrameAdaptive);
+x265_log(param, X265_LOG_INFO, b-pyramid / weightp / ref: %d / %d / 
%d\n, param-bpyramid, param-bEnableWeightedPred, param-maxNumReferences);
 x265_log(param, X265_LOG_INFO, tools: );
 #define TOOLOPT(FLAG, STR) if (FLAG) fprintf(stderr, %s , STR)
 TOOLOPT(param-bEnableRectInter, rect);
@@ -642,7 +644,6 @@
 TOOLOPT(param-bEnableConstrainedIntra, cip);
 TOOLOPT(param-bEnableEarlySkip, esd);
 fprintf(stderr, rd=%d , param-rdLevel);
-fprintf(stderr, ref=%d , param-maxNumReferences);
 
 TOOLOPT(param-bEnableLoopFilter, lft);
 if (param-bEnableSAO)
@@ -664,7 +665,6 @@
 else
 fprintf(stderr, tskip );
 }
-TOOLOPT(param-bEnableWeightedPred, weightp);
 TOOLOPT(param-bEnableWeightedBiPred, weightbp);
 TOOLOPT(param-rc.aqMode, aq-mode);
 if (param-rc.aqMode)
@@ -764,6 +764,7 @@
 }
 OPT(input-csp) p-sourceCsp = ::parseCspName(value, berror);
 OPT(me)p-searchMethod = ::parseName(value, 
x265_motion_est_names, berror);
+OPT(b-pyramid) p-bpyramid = ::parseName(value, x265_b_pyramid_names, 
berror);
 else
 return X265_PARAM_BAD_NAME;
 #undef OPT
@@ -821,6 +822,7 @@
 BOOL(p-bEnableSAO, sao);
 s += sprintf(s,  sao-lcu-bounds=%d, p-saoLcuBoundary);
 s += sprintf(s,  sao-lcu-opt=%d, p-saoLcuBasedOptimization);
+s += sprintf(s,  b-pyramid=%d, p-bpyramid);
 #undef BOOL
 
 return buf;
diff -r 2f5f538d2cbc -r c386acea7ba1 source/common/common.h
--- a/source/common/common.hMon Nov 18 16:44:31 2013 -0600
+++ b/source/common/common.hTue Nov 19 12:02:11 2013 +0530
@@ -107,6 +107,7 @@
 #define X265_LOG2(x)  log2(x)
 #endif
 
+static const char * const x265_b_pyramid_names[] = {none, normal, 0};
 /* defined in common.cpp */
 int64_t x265_mdate(void);
 void x265_log(x265_param *param, int level, const char *fmt, ...);
diff -r 2f5f538d2cbc -r c386acea7ba1 source/encoder/dpb.cpp
--- a/source/encoder/dpb.cppMon Nov 18 16:44:31 2013 -0600
+++ b/source/encoder/dpb.cppTue Nov 19 12:02:11 2013 +0530
@@ -78,7 +78,17 @@
 m_lastIDR = pocCurr;
 }
 slice-setLastIDR(m_lastIDR);
-slice-setReferenced(slice-getSliceType() != B_SLICE);
+
+if (slice-getSliceType() != B_SLICE)
+slice-setReferenced(true);
+else
+{
+if (pic-m_lowres.sliceType == X265_TYPE_BREF)
+slice-setReferenced(true);
+else
+slice-setReferenced(false);
+}
+
 slice-setTemporalLayerNonReferenceFlag(!slice-isReferenced());
 // Set the nal unit type
 slice-setNalUnitType(getNalUnitType(pocCurr, m_lastIDR, pic));
diff -r 2f5f538d2cbc -r c386acea7ba1 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cppMon Nov 18 16:44:31 2013 -0600
+++ b/source/encoder/encoder.cppTue Nov 19 12:02:11 2013 +0530
@@ -1180,6 +1180,11 @@
 {
 _param-bEnableRDOQTS = 0;
 }
+if (_param-bpyramid  !_param-bframes

[x265] [PATCH] tcomdatacu:remove unused setOutsideCUPart() function

2013-11-05 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1383649411 -19800
# Node ID a3754f543f500138058209a4618c56bab2791ca9
# Parent  1316071b3c5b70af54bc414022fab57a60164b11
tcomdatacu:remove unused setOutsideCUPart() function

diff -r 1316071b3c5b -r a3754f543f50 source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp  Tue Nov 05 15:56:31 2013 +0530
+++ b/source/Lib/TLibCommon/TComDataCU.cpp  Tue Nov 05 16:33:31 2013 +0530
@@ -531,19 +531,6 @@
 m_cuColocated[1] = cu-getCUColocated(REF_PIC_LIST_1);
 }
 
-void TComDataCU::setOutsideCUPart(uint32_t absPartIdx, uint32_t depth)
-{
-uint32_t numPartition = m_numPartitions  (depth  1);
-uint32_t sizeInUChar = sizeof(UChar) * numPartition;
-
-UChar width  = g_maxCUWidth   depth;
-UChar height = g_maxCUHeight  depth;
-
-memset(m_depth  + absPartIdx, depth,  sizeInUChar);
-memset(m_width  + absPartIdx, width,  sizeInUChar);
-memset(m_height + absPartIdx, height, sizeInUChar);
-}
-
 // 

 // Copy
 // 

diff -r 1316071b3c5b -r a3754f543f50 source/Lib/TLibCommon/TComDataCU.h
--- a/source/Lib/TLibCommon/TComDataCU.hTue Nov 05 15:56:31 2013 +0530
+++ b/source/Lib/TLibCommon/TComDataCU.hTue Nov 05 16:33:31 2013 +0530
@@ -191,7 +191,6 @@
 void  initCU(TComPic* pic, uint32_t cuAddr);
 void  initEstData(uint32_t depth, int qp);
 void  initSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth, int qp);
-void  setOutsideCUPart(uint32_t absPartIdx, uint32_t depth);
 
 void  copySubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth);
 void  copyInterPredInfoFrom(TComDataCU* cu, uint32_t absPartIdx, 
int picList);
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] tcomdatacu:remove unused copyInterPredInfoFrom() function

2013-11-05 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1383649609 -19800
# Node ID 4f63624ce6b93f829960484746fbfab1b8d1dd85
# Parent  a3754f543f500138058209a4618c56bab2791ca9
tcomdatacu:remove unused copyInterPredInfoFrom() function

diff -r a3754f543f50 -r 4f63624ce6b9 source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp  Tue Nov 05 16:33:31 2013 +0530
+++ b/source/Lib/TLibCommon/TComDataCU.cpp  Tue Nov 05 16:36:49 2013 +0530
@@ -610,46 +610,6 @@
 m_cuMvField[1].linkToWithOffset(cu-getCUMvField(REF_PIC_LIST_1), part);
 }
 
-// Copy inter prediction info from the biggest CU
-void TComDataCU::copyInterPredInfoFrom(TComDataCU* cu, uint32_t absPartIdx, 
int picList)
-{
-m_pic  = cu-getPic();
-m_slice= cu-getSlice();
-m_cuAddr   = cu-getAddr();
-m_absIdxInLCU  = absPartIdx;
-
-int rastPartIdx = g_zscanToRaster[absPartIdx];
-m_cuPelX   = cu-getCUPelX() + m_pic-getMinCUWidth() * 
(rastPartIdx % m_pic-getNumPartInWidth());
-m_cuPelY   = cu-getCUPelY() + m_pic-getMinCUHeight() * 
(rastPartIdx / m_pic-getNumPartInWidth());
-
-m_cuAboveLeft  = cu-getCUAboveLeft();
-m_cuAboveRight = cu-getCUAboveRight();
-m_cuAbove  = cu-getCUAbove();
-m_cuLeft   = cu-getCULeft();
-
-m_cuColocated[0]  = cu-getCUColocated(REF_PIC_LIST_0);
-m_cuColocated[1]  = cu-getCUColocated(REF_PIC_LIST_1);
-
-m_skipFlag   = cu-getSkipFlag() + absPartIdx;
-
-m_partSizes = cu-getPartitionSize() + absPartIdx;
-m_predModes = cu-getPredictionMode() + absPartIdx;
-m_cuTransquantBypass = cu-getCUTransquantBypass() + absPartIdx;
-m_interDir= cu-getInterDir() + absPartIdx;
-
-m_depth   = cu-getDepth()+ absPartIdx;
-m_width   = cu-getWidth()+ absPartIdx;
-m_height  = cu-getHeight()   + absPartIdx;
-
-m_bMergeFlags = cu-getMergeFlag()+ absPartIdx;
-m_mergeIndex  = cu-getMergeIndex()   + absPartIdx;
-
-m_mvpIdx[picList] = cu-getMVPIdx(picList) + absPartIdx;
-m_mvpNum[picList] = cu-getMVPNum(picList) + absPartIdx;
-
-m_cuMvField[picList].linkToWithOffset(cu-getCUMvField(picList), 
absPartIdx);
-}
-
 // Copy small CU to bigger CU.
 // One of quarter parts overwritten by predicted sub part.
 void TComDataCU::copyPartFrom(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth, bool isRDObasedAnalysis)
diff -r a3754f543f50 -r 4f63624ce6b9 source/Lib/TLibCommon/TComDataCU.h
--- a/source/Lib/TLibCommon/TComDataCU.hTue Nov 05 16:33:31 2013 +0530
+++ b/source/Lib/TLibCommon/TComDataCU.hTue Nov 05 16:36:49 2013 +0530
@@ -193,7 +193,6 @@
 void  initSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth, int qp);
 
 void  copySubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth);
-void  copyInterPredInfoFrom(TComDataCU* cu, uint32_t absPartIdx, 
int picList);
 void  copyPartFrom(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth, bool isRDObasedAnalysis = true);
 
 void  copyToPic(UChar depth);
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] tenccu:remove calling outTempCU-initEstData() multiple time without modifying outTempCU

2013-11-05 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1383650977 -19800
# Node ID 5b27a08eaff941425d6fd15df72e9c124f2d3c5a
# Parent  7d42e412cea8a985c5c0d01d45f65271f004607f
tenccu:remove calling outTempCU-initEstData() multiple time without modifying 
outTempCU

diff -r 7d42e412cea8 -r 5b27a08eaff9 source/Lib/TLibEncoder/TEncCu.cpp
--- a/source/Lib/TLibEncoder/TEncCu.cpp Tue Nov 05 16:40:59 2013 +0530
+++ b/source/Lib/TLibEncoder/TEncCu.cpp Tue Nov 05 16:59:37 2013 +0530
@@ -528,7 +528,6 @@
 if (outTempCU-getWidth(0)  (1  
outTempCU-getSlice()-getSPS()-getQuadtreeTULog2MinSize()))
 {
 xCheckRDCostIntra(outBestCU, outTempCU, SIZE_NxN);
-outTempCU-initEstData(depth, qp);
 }
 }
 
@@ -918,7 +917,6 @@
 if ((bestbits  rawbits) || (outBestCU-m_totalCost  
m_rdCost-calcRdCost(0, rawbits)))
 {
 xCheckIntraPCM(outBestCU, outTempCU);
-outTempCU-initEstData(depth, qp);
 }
 }
 }
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] slicetype:lookaheadrow variable initialization using MACRO and removed the init()

2013-10-29 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1383032464 -19800
# Node ID 70f5410baece7d2b1d2c278611dadacf768c2b0e
# Parent  8846f5cf6d8d1b06496055a1bc756ed4dd3fa1c5
slicetype:lookaheadrow variable initialization using MACRO and removed the 
init()

diff -r 8846f5cf6d8d -r 70f5410baece source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp  Tue Oct 29 01:05:47 2013 -0500
+++ b/source/encoder/slicetype.cpp  Tue Oct 29 13:11:04 2013 +0530
@@ -191,6 +191,13 @@
 }
 
 #define NUM_CUS (widthInCU  2  heightInCU  2 ? (widthInCU - 2) * 
(heightInCU - 2) : widthInCU * heightInCU)
+#define INIT(lrows)lrows.costEst = 0; \
+lrows.costEstAq = 0; \
+lrows.costIntra = 0; \
+lrows.costIntraAq = 0; \
+lrows.intraMbs = 0; \
+lrows.active = false; \
+lrows.completed = 0; 
 
 int Lookahead::estimateFrameCost(int p0, int p1, int b, bool bIntraPenalty)
 {
@@ -218,7 +225,8 @@
 
 for (int i = 0; i  heightInCU; i++)
 {
-lhrows[i].init();
+LookaheadRow lrows = lhrows[i];
+INIT(lrows);
 lhrows[i].me.setSourcePlane(fenc-lowresPlane[0], 
fenc-lumaStride);
 }
 
@@ -275,17 +283,6 @@
 return score;
 }
 
-void LookaheadRow::init()
-{
-costEst = 0;
-costEstAq = 0;
-costIntra = 0;
-costIntraAq = 0;
-intraMbs = 0;
-active = false;
-completed = 0;
-}
-
 void LookaheadRow::estimateCUCost(int cux, int cuy, int p0, int p1, int b, 
bool bDoSearch[2])
 {
 Lowres *fref0 = frames[p0];
diff -r 8846f5cf6d8d -r 70f5410baece source/encoder/slicetype.h
--- a/source/encoder/slicetype.hTue Oct 29 01:05:47 2013 -0500
+++ b/source/encoder/slicetype.hTue Oct 29 13:11:04 2013 +0530
@@ -67,7 +67,6 @@
 X265_FREE(predictions);
 }
 
-void init();
 
 void estimateCUCost(int cux, int cuy, int p0, int p1, int b, bool 
bDoSearch[2]);
 };
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] tcomdataCU:Remove initialization (memset) in initCU() which was already initialized in create()

2013-10-29 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1383036328 -19800
# Node ID fee46b42d31061bf684864bf5f002b6804f57a7b
# Parent  4c618e33c25f98597d529d4e6ec9fb899bdc1d41
tcomdataCU:Remove initialization (memset) in initCU() which was already 
initialized in create()

currently m_partSizes, m_mvpIdx[0] and m_mvpIdx[1] all three variables 
initialized using memset in TComDataCU::create()
and same initialization in done in TComDataCU::initCU(), removed the memset in 
initCU() to avoid the duplicate initilization

diff -r 4c618e33c25f -r fee46b42d310 source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp  Tue Oct 29 11:16:32 2013 +0530
+++ b/source/Lib/TLibCommon/TComDataCU.cpp  Tue Oct 29 14:15:28 2013 +0530
@@ -287,7 +287,6 @@
 if (numElements  0)
 {
 memset(m_skipFlag + firstElement, false,
numElements * sizeof(*m_skipFlag));
-memset(m_partSizes+ firstElement, SIZE_NONE,
numElements * sizeof(*m_partSizes));
 memset(m_predModes+ firstElement, MODE_NONE,
numElements * sizeof(*m_predModes));
 memset(m_cuTransquantBypass + firstElement, false,  
numElements * sizeof(*m_cuTransquantBypass));
 memset(m_depth+ firstElement, 0,
numElements * sizeof(*m_depth));
@@ -297,8 +296,6 @@
 memset(m_transformSkip[2] + firstElement, 0,
numElements * sizeof(*m_transformSkip[2]));
 memset(m_width+ firstElement, g_maxCUWidth, 
numElements * sizeof(*m_width));
 memset(m_height   + firstElement, g_maxCUHeight,
numElements * sizeof(*m_height));
-memset(m_mvpIdx[0]+ firstElement, -1,   
numElements * sizeof(*m_mvpIdx[0]));
-memset(m_mvpIdx[1]+ firstElement, -1,   
numElements * sizeof(*m_mvpIdx[1]));
 memset(m_mvpNum[0]+ firstElement, -1,   
numElements * sizeof(*m_mvpNum[0]));
 memset(m_mvpNum[1]+ firstElement, -1,   
numElements * sizeof(*m_mvpNum[1]));
 memset(m_qp   + firstElement, getSlice()-getSliceQp(), 
numElements * sizeof(*m_qp));
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] y4m : bug fix for calculating framesize in skipFrames()

2013-10-28 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1382941787 -19800
# Node ID 7916afc6c9c4835e0db6abe4a87f9b7c3579deec
# Parent  ef2428fd32feddd60168f3430c50f4d7e6f02741
y4m : bug fix for calculating framesize in skipFrames()

diff -r ef2428fd32fe -r 7916afc6c9c4 source/input/y4m.cpp
--- a/source/input/y4m.cpp  Mon Oct 28 00:08:06 2013 -0500
+++ b/source/input/y4m.cpp  Mon Oct 28 11:59:47 2013 +0530
@@ -232,7 +232,7 @@
 
 void Y4MInput::skipFrames(int numFrames)
 {
-const size_t count = (width * height * 3 / 2) + strlen(header);
+const size_t count = (width * height * 3 / 2) + strlen(header) + 1;
 for (int i = 0; i  numFrames; i++)
 {
 ifs.ignore(count);
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] tenccfg : move loop filter configuration params from tenccfg to x265_param

2013-10-28 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1382952951 -19800
# Node ID 26475c9ced90e338399e9a93d886824aad55dc83
# Parent  7916afc6c9c4835e0db6abe4a87f9b7c3579deec
tenccfg : move loop filter configuration params from tenccfg to x265_param

diff -r 7916afc6c9c4 -r 26475c9ced90 source/Lib/TLibEncoder/TEncCfg.h
--- a/source/Lib/TLibEncoder/TEncCfg.h  Mon Oct 28 11:59:47 2013 +0530
+++ b/source/Lib/TLibEncoder/TEncCfg.h  Mon Oct 28 15:05:51 2013 +0530
@@ -82,11 +82,6 @@
 UInt  m_quadtreeTULog2MaxSize;
 UInt  m_quadtreeTULog2MinSize;
 
-//== Loop/Deblock Filter 
-bool  m_loopFilterOffsetInPPS;
-int   m_loopFilterBetaOffsetDiv2;
-int   m_loopFilterTcOffsetDiv2;
-int   m_maxNumOffsetsPerPic;
 
 //== Lossless 
 bool  m_useLossless;
@@ -183,11 +178,11 @@
 UInt getQuadtreeTULog2MinSize() const { return m_quadtreeTULog2MinSize; }
 
 // Loop/Deblock Filter 
-bool getLoopFilterOffsetInPPS() { return m_loopFilterOffsetInPPS; }
+//bool getLoopFilterOffsetInPPS() { return m_loopFilterOffsetInPPS; }
 
-int getLoopFilterBetaOffset() { return m_loopFilterBetaOffsetDiv2; }
+//int getLoopFilterBetaOffset() { return m_loopFilterBetaOffsetDiv2; }
 
-int getLoopFilterTcOffset() { return m_loopFilterTcOffsetDiv2; }
+//int getLoopFilterTcOffset() { return m_loopFilterTcOffsetDiv2; }
 
 // Quality control 
 int getMaxCuDQPDepth() { return m_maxCuDQPDepth; }
@@ -208,7 +203,7 @@
 
 UInt getPCMLog2MinSize() { return m_pcmLog2MinSize; }
 
-int   getMaxNumOffsetsPerPic() { return m_maxNumOffsetsPerPic; }
+ //   int   getMaxNumOffsetsPerPic() { return m_maxNumOffsetsPerPic; }
 
 bool  getLFCrossTileBoundaryFlag() { return 
m_loopFilterAcrossTilesEnabledFlag; }
 
diff -r 7916afc6c9c4 -r 26475c9ced90 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cppMon Oct 28 11:59:47 2013 +0530
+++ b/source/encoder/encoder.cppMon Oct 28 15:05:51 2013 +0530
@@ -847,7 +847,7 @@
 pps-setOutputFlagPresentFlag(false);
 pps-setSignHideFlag(param.bEnableSignHiding);
 pps-setDeblockingFilterControlPresentFlag(!param.bEnableLoopFilter);
-pps-setDeblockingFilterOverrideEnabledFlag(!m_loopFilterOffsetInPPS);
+pps-setDeblockingFilterOverrideEnabledFlag(!param.loopFilterOffsetInPPS);
 pps-setPicDisableDeblockingFilterFlag(!param.bEnableLoopFilter);
 pps-setLog2ParallelMergeLevelMinus2(m_log2ParallelMergeLevelMinus2);
 pps-setCabacInitPresentFlag(param.frameNumThreads  1 ? 0 : 
CABAC_INIT_PRESENT_FLAG);
@@ -1057,9 +1057,9 @@
 
 //== Enforce these hard coded settings before initializeGOP() to
 //   avoid a valgrind warning
-m_loopFilterOffsetInPPS = 0;
-m_loopFilterBetaOffsetDiv2 = 0;
-m_loopFilterTcOffsetDiv2 = 0;
+param.loopFilterOffsetInPPS = 0;
+param.loopFilterBetaOffsetDiv2 = 0;
+param.loopFilterTcOffsetDiv2 = 0;
 m_loopFilterAcrossTilesEnabledFlag = 1;
 
 //== HM Settings not exposed for configuration ==
@@ -1077,7 +1077,7 @@
 
 m_vps = vps;
 m_maxCuDQPDepth = 0;
-m_maxNumOffsetsPerPic = 2048;
+param.maxNumOffsetsPerPic = 2048;
 m_log2ParallelMergeLevelMinus2 = 0;
 
 //= set default display window ==
diff -r 7916afc6c9c4 -r 26475c9ced90 source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp   Mon Oct 28 11:59:47 2013 +0530
+++ b/source/encoder/frameencoder.cpp   Mon Oct 28 15:05:51 2013 +0530
@@ -268,16 +268,16 @@
 
 if (slice-getPPS()-getDeblockingFilterControlPresentFlag())
 {
-
slice-getPPS()-setDeblockingFilterOverrideEnabledFlag(!m_cfg-getLoopFilterOffsetInPPS());
-
slice-setDeblockingFilterOverrideFlag(!m_cfg-getLoopFilterOffsetInPPS());
+
slice-getPPS()-setDeblockingFilterOverrideEnabledFlag(!m_cfg-param.loopFilterOffsetInPPS);
+
slice-setDeblockingFilterOverrideFlag(!m_cfg-param.loopFilterOffsetInPPS);
 
slice-getPPS()-setPicDisableDeblockingFilterFlag(!m_cfg-param.bEnableLoopFilter);
 slice-setDeblockingFilterDisable(!m_cfg-param.bEnableLoopFilter);
 if (!slice-getDeblockingFilterDisable())
 {
-
slice-getPPS()-setDeblockingFilterBetaOffsetDiv2(m_cfg-getLoopFilterBetaOffset());
-
slice-getPPS()-setDeblockingFilterTcOffsetDiv2(m_cfg-getLoopFilterTcOffset());
-
slice-setDeblockingFilterBetaOffsetDiv2(m_cfg-getLoopFilterBetaOffset());
-
slice-setDeblockingFilterTcOffsetDiv2(m_cfg-getLoopFilterTcOffset());
+
slice-getPPS()-setDeblockingFilterBetaOffsetDiv2(m_cfg-param.loopFilterBetaOffsetDiv2);
+
slice-getPPS()-setDeblockingFilterTcOffsetDiv2(m_cfg-param.loopFilterTcOffsetDiv2);
+
slice-setDeblockingFilterBetaOffsetDiv2(m_cfg-param.loopFilterBetaOffsetDiv2);
+
slice-setDeblockingFilterTcOffsetDiv2(m_cfg

[x265] [PATCH] tenccfg : remove unused functions for loop filtes

2013-10-28 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1382953129 -19800
# Node ID 68042ac00ad6af0d9d7d85654e8c9968809ce8ce
# Parent  26475c9ced90e338399e9a93d886824aad55dc83
tenccfg : remove unused functions for loop filtes

diff -r 26475c9ced90 -r 68042ac00ad6 source/Lib/TLibEncoder/TEncCfg.h
--- a/source/Lib/TLibEncoder/TEncCfg.h  Mon Oct 28 15:05:51 2013 +0530
+++ b/source/Lib/TLibEncoder/TEncCfg.h  Mon Oct 28 15:08:49 2013 +0530
@@ -177,13 +177,6 @@
 
 UInt getQuadtreeTULog2MinSize() const { return m_quadtreeTULog2MinSize; }
 
-// Loop/Deblock Filter 
-//bool getLoopFilterOffsetInPPS() { return m_loopFilterOffsetInPPS; }
-
-//int getLoopFilterBetaOffset() { return m_loopFilterBetaOffsetDiv2; }
-
-//int getLoopFilterTcOffset() { return m_loopFilterTcOffsetDiv2; }
-
 // Quality control 
 int getMaxCuDQPDepth() { return m_maxCuDQPDepth; }
 
@@ -203,8 +196,6 @@
 
 UInt getPCMLog2MinSize() { return m_pcmLog2MinSize; }
 
- //   int   getMaxNumOffsetsPerPic() { return m_maxNumOffsetsPerPic; }
-
 bool  getLFCrossTileBoundaryFlag() { return 
m_loopFilterAcrossTilesEnabledFlag; }
 
 int   getBufferingPeriodSEIEnabled() { return m_bufferingPeriodSEIEnabled; 
}
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] input: read yuv input from stdin if filename is passed as -

2013-10-25 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1382685027 -19800
# Node ID 70e24526a1b57fbf57570c26b0d157f90219
# Parent  4125c74ff21d9b26ff697b30675460808953052b
input: read yuv input from stdin if filename is passed as -

diff -r 4125c74ff21d -r 70e24526a1b5 source/input/yuv.cpp
--- a/source/input/yuv.cpp  Fri Oct 25 01:15:58 2013 -0500
+++ b/source/input/yuv.cpp  Fri Oct 25 12:40:27 2013 +0530
@@ -26,20 +26,26 @@
 #include common.h
 #include stdio.h
 #include string.h
+#include iostream
 
 using namespace x265;
 using namespace std;
 
 YUVInput::YUVInput(const char *filename)
 {
-ifs.open(filename, ios::binary | ios::in);
+ifs = NULL;
+if (!strcmp(filename, -))
+ifs = cin;
+else
+ifs = new ifstream(filename, ios::binary | ios::in);
+
 width = height = 0;
 depth = 8;
 threadActive = false;
-if (!ifs.fail())
+if (ifs  !ifs-fail())
 threadActive = true;
 else
-ifs.close();
+if (ifs  ifs != cin) delete ifs;
 #if defined ENABLE_THREAD
 head = 0;
 tail = 0;
@@ -48,7 +54,7 @@
 
 YUVInput::~YUVInput()
 {
-ifs.close();
+if (ifs  ifs != cin) delete ifs;
 #if defined ENABLE_THREAD
 for (int i = 0; i  QUEUE_SIZE; i++)
 {
@@ -61,22 +67,25 @@
 
 int YUVInput::guessFrameCount()
 {
-ifstream::pos_type cur = ifs.tellg();
+if(!ifs) return -1;
+
+ifstream::pos_type cur = ifs-tellg();
 if (cur  0)
 return -1;
 
-ifs.seekg(0, ios::end);
-ifstream::pos_type size = ifs.tellg();
+ifs-seekg(0, ios::end);
+ifstream::pos_type size = ifs-tellg();
 if (size  0)
 return -1;
-ifs.seekg(cur, ios::beg);
+ifs-seekg(cur, ios::beg);
 
 return (int)((size - cur) / (width * height * pixelbytes * 3 / 2));
 }
 
 void YUVInput::skipFrames(int numFrames)
 {
-ifs.seekg(framesize * numFrames, ios::cur);
+if(ifs)
+ifs-seekg(framesize * numFrames, ios::cur);
 }
 
 void YUVInput::startReader()
@@ -97,7 +106,7 @@
 height  MIN_FRAME_HEIGHT || height  MAX_FRAME_HEIGHT)
 {
 threadActive = false;
-ifs.close();
+if (ifs  ifs != cin) delete ifs;
 }
 else
 {
@@ -137,8 +146,9 @@
 break;
 }
 
-ifs.read(buf[tail], framesize);
-frameStat[tail] = ifs.good();
+if (!ifs) return false;
+ifs-read(buf[tail], framesize);
+frameStat[tail] = ifs-good();
 if (!frameStat[tail])
 return false;
 tail = (tail + 1) % QUEUE_SIZE;
@@ -197,10 +207,11 @@
 
 pic.stride[1] = pic.stride[2] = pic.stride[0]  1;
 
-ifs.read(buf, framesize);
+if (!ifs) return false;
+ifs-read(buf, framesize);
 PPAStopCpuEventFunc(read_yuv);
 
-return ifs.good();
+return ifs-good();
 }
 
 #endif // if defined ENABLE_THREAD
diff -r 4125c74ff21d -r 70e24526a1b5 source/input/yuv.h
--- a/source/input/yuv.hFri Oct 25 01:15:58 2013 -0500
+++ b/source/input/yuv.hFri Oct 25 12:40:27 2013 +0530
@@ -71,7 +71,7 @@
 char* buf;
 #endif // if defined(ENABLE_THREAD)
 
-std::ifstream ifs;
+std::istream *ifs;
 
 public:
 
@@ -89,9 +89,9 @@
 
 int getHeight() const { return height; }
 
-bool isEof() const{ return ifs.eof(); }
+bool isEof() const{ return (ifs  
ifs-eof()); }
 
-bool isFail() { return !(ifs.is_open()  
threadActive); }
+bool isFail() { return !(ifs  
!ifs-fail()  threadActive); }
 
 void startReader();
 
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] input: read yuv input from stdin if filename is passed as -

2013-10-25 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1382685398 -19800
# Node ID f93a9c2e6df892c358a6df2dc99ee3a8cb897837
# Parent  4125c74ff21d9b26ff697b30675460808953052b
input: read yuv input from stdin if filename is passed as -

diff -r 4125c74ff21d -r f93a9c2e6df8 source/input/yuv.cpp
--- a/source/input/yuv.cpp  Fri Oct 25 01:15:58 2013 -0500
+++ b/source/input/yuv.cpp  Fri Oct 25 12:46:38 2013 +0530
@@ -26,20 +26,26 @@
 #include common.h
 #include stdio.h
 #include string.h
+#include iostream
 
 using namespace x265;
 using namespace std;
 
 YUVInput::YUVInput(const char *filename)
 {
-ifs.open(filename, ios::binary | ios::in);
+ifs = NULL;
+if (!strcmp(filename, -))
+ifs = cin;
+else
+ifs = new ifstream(filename, ios::binary | ios::in);
+
 width = height = 0;
 depth = 8;
 threadActive = false;
-if (!ifs.fail())
+if (ifs  !ifs-fail())
 threadActive = true;
 else
-ifs.close();
+if (ifs  ifs != cin) delete ifs;
 #if defined ENABLE_THREAD
 head = 0;
 tail = 0;
@@ -48,7 +54,7 @@
 
 YUVInput::~YUVInput()
 {
-ifs.close();
+if (ifs  ifs != cin) delete ifs;
 #if defined ENABLE_THREAD
 for (int i = 0; i  QUEUE_SIZE; i++)
 {
@@ -61,22 +67,25 @@
 
 int YUVInput::guessFrameCount()
 {
-ifstream::pos_type cur = ifs.tellg();
+if (!ifs) return -1;
+
+ifstream::pos_type cur = ifs-tellg();
 if (cur  0)
 return -1;
 
-ifs.seekg(0, ios::end);
-ifstream::pos_type size = ifs.tellg();
+ifs-seekg(0, ios::end);
+ifstream::pos_type size = ifs-tellg();
 if (size  0)
 return -1;
-ifs.seekg(cur, ios::beg);
+ifs-seekg(cur, ios::beg);
 
 return (int)((size - cur) / (width * height * pixelbytes * 3 / 2));
 }
 
 void YUVInput::skipFrames(int numFrames)
 {
-ifs.seekg(framesize * numFrames, ios::cur);
+if (ifs)
+ifs-seekg(framesize * numFrames, ios::cur);
 }
 
 void YUVInput::startReader()
@@ -97,7 +106,7 @@
 height  MIN_FRAME_HEIGHT || height  MAX_FRAME_HEIGHT)
 {
 threadActive = false;
-ifs.close();
+if (ifs  ifs != cin) delete ifs;
 }
 else
 {
@@ -137,8 +146,9 @@
 break;
 }
 
-ifs.read(buf[tail], framesize);
-frameStat[tail] = ifs.good();
+if (!ifs) return false;
+ifs-read(buf[tail], framesize);
+frameStat[tail] = ifs-good();
 if (!frameStat[tail])
 return false;
 tail = (tail + 1) % QUEUE_SIZE;
@@ -197,10 +207,11 @@
 
 pic.stride[1] = pic.stride[2] = pic.stride[0]  1;
 
-ifs.read(buf, framesize);
+if (!ifs) return false;
+ifs-read(buf, framesize);
 PPAStopCpuEventFunc(read_yuv);
 
-return ifs.good();
+return ifs-good();
 }
 
 #endif // if defined ENABLE_THREAD
diff -r 4125c74ff21d -r f93a9c2e6df8 source/input/yuv.h
--- a/source/input/yuv.hFri Oct 25 01:15:58 2013 -0500
+++ b/source/input/yuv.hFri Oct 25 12:46:38 2013 +0530
@@ -71,7 +71,7 @@
 char* buf;
 #endif // if defined(ENABLE_THREAD)
 
-std::ifstream ifs;
+std::istream *ifs;
 
 public:
 
@@ -89,9 +89,9 @@
 
 int getHeight() const { return height; }
 
-bool isEof() const{ return ifs.eof(); }
+bool isEof() const{ return (ifs  
ifs-eof()); }
 
-bool isFail() { return !(ifs.is_open()  
threadActive); }
+bool isFail() { return !(ifs  
!ifs-fail()  threadActive); }
 
 void startReader();
 
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] input: initialize the input buffer (buf) pointer

2013-10-25 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1382686661 -19800
# Node ID 5b0cf1b805fa14b52700c1ec3f1ce1ce4e2c95a6
# Parent  f93a9c2e6df892c358a6df2dc99ee3a8cb897837
input: initialize the input buffer (buf) pointer

diff -r f93a9c2e6df8 -r 5b0cf1b805fa source/input/y4m.cpp
--- a/source/input/y4m.cpp  Fri Oct 25 12:46:38 2013 +0530
+++ b/source/input/y4m.cpp  Fri Oct 25 13:07:41 2013 +0530
@@ -32,6 +32,14 @@
 
 Y4MInput::Y4MInput(const char *filename)
 {
+
+#if defined ENABLE_THREAD
+for (int i = 0; i  QUEUE_SIZE; i++)
+buf[i] = NULL;
+#else
+buf = NULL;
+#endif
+
 ifs.open(filename, ios::binary | ios::in);
 threadActive = false;
 if (!ifs.fail())
diff -r f93a9c2e6df8 -r 5b0cf1b805fa source/input/yuv.cpp
--- a/source/input/yuv.cpp  Fri Oct 25 12:46:38 2013 +0530
+++ b/source/input/yuv.cpp  Fri Oct 25 13:07:41 2013 +0530
@@ -33,6 +33,14 @@
 
 YUVInput::YUVInput(const char *filename)
 {
+
+#if defined ENABLE_THREAD
+for (int i = 0; i  QUEUE_SIZE; i++)
+buf[i] = NULL;
+#else
+buf = NULL;
+#endif
+
 ifs = NULL;
 if (!strcmp(filename, -))
 ifs = cin;
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] nal: remove unused helper functions

2013-10-25 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1382692835 -19800
# Node ID 35144b9a28d2b7db09a95bfd78c232f4684c5aa1
# Parent  4ca4da7bdd36fbef00b9eefe54c0a56bf11633f3
nal: remove unused helper functions

diff -r 4ca4da7bdd36 -r 35144b9a28d2 source/Lib/TLibCommon/NAL.h
--- a/source/Lib/TLibCommon/NAL.h   Fri Oct 25 12:11:31 2013 +0530
+++ b/source/Lib/TLibCommon/NAL.h   Fri Oct 25 14:50:35 2013 +0530
@@ -63,38 +63,6 @@
 
 /** default constructor - no initialization; must be perfomed by user */
 NALUnit() {}
-
-/** returns true if the NALunit is a slice NALunit */
-bool isSlice()
-{
-return m_nalUnitType == NAL_UNIT_CODED_SLICE_TRAIL_R
-   || m_nalUnitType == NAL_UNIT_CODED_SLICE_TRAIL_N
-   || m_nalUnitType == NAL_UNIT_CODED_SLICE_TLA_R
-   || m_nalUnitType == NAL_UNIT_CODED_SLICE_TSA_N
-   || m_nalUnitType == NAL_UNIT_CODED_SLICE_STSA_R
-   || m_nalUnitType == NAL_UNIT_CODED_SLICE_STSA_N
-   || m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_LP
-   || m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_RADL
-   || m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_N_LP
-   || m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL
-   || m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP
-   || m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA
-   || m_nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N
-   || m_nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R
-   || m_nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N
-   || m_nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R;
-}
-
-bool isSei()
-{
-return m_nalUnitType == NAL_UNIT_PREFIX_SEI
-   || m_nalUnitType == NAL_UNIT_SUFFIX_SEI;
-}
-
-bool isVcl()
-{
-return (UInt)m_nalUnitType  32;
-}
 };
 
 struct OutputNALUnit;
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] tenccu : remove unused functions

2013-10-25 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1382696900 -19800
# Node ID b8969609a82f047def8aa991803b302eb87e9985
# Parent  35144b9a28d2b7db09a95bfd78c232f4684c5aa1
tenccu : remove unused functions

diff -r 35144b9a28d2 -r b8969609a82f source/Lib/TLibEncoder/TEncCu.cpp
--- a/source/Lib/TLibEncoder/TEncCu.cpp Fri Oct 25 14:50:35 2013 +0530
+++ b/source/Lib/TLibEncoder/TEncCu.cpp Fri Oct 25 15:58:20 2013 +0530
@@ -1746,11 +1746,6 @@
 m_bestRecoYuv[nextDepth]-copyToPartYuv(m_tmpRecoYuv[nextDepth - 1], 
partUnitIdx);
 }
 
-void TEncCu::xCopyYuv2Best(UInt partUnitIdx, UInt nextDepth)
-{
-m_tmpRecoYuv[nextDepth]-copyToPartYuv(m_bestRecoYuv[nextDepth - 1], 
partUnitIdx);
-}
-
 /** Function for filling the PCM buffer of a CU using its original sample array
  * \param cu pointer to current CU
  * \param fencYuv pointer to original sample array
diff -r 35144b9a28d2 -r b8969609a82f source/Lib/TLibEncoder/TEncCu.h
--- a/source/Lib/TLibEncoder/TEncCu.h   Fri Oct 25 14:50:35 2013 +0530
+++ b/source/Lib/TLibEncoder/TEncCu.h   Fri Oct 25 15:58:20 2013 +0530
@@ -135,8 +135,6 @@
 
 void setBitCounter(TComBitCounter* pcBitCounter) { m_bitCounter = 
pcBitCounter; }
 
-UInt getLCUPredictionSAD() { return m_LCUPredictionSAD; }
-
 protected:
 
 void finishCU(TComDataCU* cu, UInt absPartIdx, UInt depth);
@@ -163,7 +161,6 @@
 void xCopyYuv2Pic(TComPic* outPic, UInt cuAddr, UInt absPartIdx, UInt 
depth, UInt uiSrcDepth, TComDataCU* cu,
   UInt lpelx, UInt tpely);
 void xCopyYuv2Tmp(UInt uhPartUnitIdx, UInt depth);
-void xCopyYuv2Best(UInt partUnitIdx, UInt uiNextDepth);
 
 bool getdQPFlag(){ return m_bEncodeDQP; }
 
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] output: use 64bit file offsets to prevent overflow with 4k video

2013-10-24 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1382605225 -19800
# Node ID 7443339bdc9b3bf10dd159ce01468b1cd2f61b6a
# Parent  0cb0692d6c69dbf6c5b49c51f6f528e29674baa9
output: use 64bit file offsets to prevent overflow with 4k video

diff -r 0cb0692d6c69 -r 7443339bdc9b source/output/y4m.cpp
--- a/source/output/y4m.cpp Wed Oct 23 20:09:33 2013 +0800
+++ b/source/output/y4m.cpp Thu Oct 24 14:30:25 2013 +0530
@@ -50,9 +50,8 @@
 bool Y4MOutput::writePicture(const x265_picture_t pic)
 {
 PPAStartCpuEventFunc(write_yuv);
-std::ofstream::pos_type outPicPos = header;
-outPicPos += pic.poc * (6 + 3 * (width * height) / 2);
-ofs.seekp(outPicPos);
+std::ofstream::pos_type frameSize = (6 + 3 * (width * height) / 2);
+ofs.seekp(header + frameSize * pic.poc); 
 ofs  FRAME\n;
 
 if (pic.bitDepth  8)
diff -r 0cb0692d6c69 -r 7443339bdc9b source/output/yuv.cpp
--- a/source/output/yuv.cpp Wed Oct 23 20:09:33 2013 +0800
+++ b/source/output/yuv.cpp Thu Oct 24 14:30:25 2013 +0530
@@ -47,7 +47,10 @@
 {
 PPAStartCpuEventFunc(write_yuv);
 int pixelbytes = (depth  8) ? 2 : 1;
-ofs.seekp(pic.poc * 3 * (width * height * pixelbytes) / 2);
+uint64_t size = (pic.poc * 3);
+size *= (width * height * pixelbytes);
+size /= 2;
+ofs.seekp(size);
 
 if (pic.bitDepth  8  depth == 8)
 {
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] input: If Any error in reading frame from file, deactivate the thread and exit encoder gracefully

2013-10-24 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1382616286 -19800
# Node ID 3a4864ff4357af1c342af26c9a8dca8d46b30600
# Parent  7443339bdc9b3bf10dd159ce01468b1cd2f61b6a
input: If Any error in reading frame from file, deactivate the thread and exit 
encoder gracefully

diff -r 7443339bdc9b -r 3a4864ff4357 source/input/y4m.cpp
--- a/source/input/y4m.cpp  Thu Oct 24 14:30:25 2013 +0530
+++ b/source/input/y4m.cpp  Thu Oct 24 17:34:46 2013 +0530
@@ -307,8 +307,13 @@
 
 ifs.read(buf[tail], count);
 frameStat[tail] = ifs.good();
+
 if (!frameStat[tail])
+{
+x265_log(NULL, X265_LOG_ERROR, y4m: error in frame reading from 
file);
+threadActive = false;
 return false;
+}
 tail = (tail + 1) % QUEUE_SIZE;
 notEmpty.trigger();
 return true;
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] recon : reconstructed image write frame position calculation logic modified

2013-10-23 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1382527593 -19800
# Node ID 8fa037e69d88666093a3b8b0aeec7361a17ee131
# Parent  6d96d64c4e9a2c526b57274760a7147241328cb3
recon : reconstructed image write frame position calculation logic modified

diff -r 6d96d64c4e9a -r 8fa037e69d88 source/output/yuv.cpp
--- a/source/output/yuv.cpp Tue Oct 22 23:36:36 2013 +0530
+++ b/source/output/yuv.cpp Wed Oct 23 16:56:33 2013 +0530
@@ -47,8 +47,10 @@
 {
 PPAStartCpuEventFunc(write_yuv);
 int pixelbytes = (depth  8) ? 2 : 1;
-ofs.seekp(pic.poc * 3 * (width * height * pixelbytes) / 2);
-
+uint64_t size = (pic.poc * 3);
+size *= (width * height * pixelbytes);
+size /= 2;
+ofs.seekp(size);
 if (pic.bitDepth  8  depth == 8)
 {
 // encoder gave us short pixels, downscale, then write
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] recon : seek position calculate and obtain to 64 bit precision variable

2013-10-23 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1382592648 -19800
# Node ID 153cfb6f7c4a51916ce4b732fae0ca29d6382ad0
# Parent  0cb0692d6c69dbf6c5b49c51f6f528e29674baa9
recon : seek position calculate and obtain to 64 bit precision variable

diff -r 0cb0692d6c69 -r 153cfb6f7c4a source/output/y4m.cpp
--- a/source/output/y4m.cpp Wed Oct 23 20:09:33 2013 +0800
+++ b/source/output/y4m.cpp Thu Oct 24 11:00:48 2013 +0530
@@ -51,7 +51,12 @@
 {
 PPAStartCpuEventFunc(write_yuv);
 std::ofstream::pos_type outPicPos = header;
-outPicPos += pic.poc * (6 + 3 * (width * height) / 2);
+uint64_t size = (width * height);
+size *= 3;
+size += 6;
+size /= 2;
+size *= pic.poc;
+outPicPos += size;
 ofs.seekp(outPicPos);
 ofs  FRAME\n;
 
diff -r 0cb0692d6c69 -r 153cfb6f7c4a source/output/yuv.cpp
--- a/source/output/yuv.cpp Wed Oct 23 20:09:33 2013 +0800
+++ b/source/output/yuv.cpp Thu Oct 24 11:00:48 2013 +0530
@@ -47,7 +47,10 @@
 {
 PPAStartCpuEventFunc(write_yuv);
 int pixelbytes = (depth  8) ? 2 : 1;
-ofs.seekp(pic.poc * 3 * (width * height * pixelbytes) / 2);
+uint64_t size = (pic.poc * 3);
+size *= (width * height * pixelbytes);
+size /= 2;
+ofs.seekp(size);
 
 if (pic.bitDepth  8  depth == 8)
 {
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] common : Added new function x265_param2string

2013-10-17 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1381993509 -19800
# Node ID 4cba7c453533731ef6bca965b6cebe7e6caff8bf
# Parent  1d6b3626f1b3d4b8f8f181e66eaaa649f90bac02
common : Added new function x265_param2string

diff -r 1d6b3626f1b3 -r 4cba7c453533 source/common/common.cpp
--- a/source/common/common.cpp  Wed Oct 16 20:38:44 2013 -0500
+++ b/source/common/common.cpp  Thu Oct 17 12:35:09 2013 +0530
@@ -543,3 +543,52 @@
 berror |= valuewasnull;
 return berror ? X265_PARAM_BAD_VALUE : 0;
 }
+
+char *x265_param2string( x265_param_t *p)
+{
+char *buf, *s;
+buf = s = (char *)X265_MALLOC(char, 2000);
+if (!buf)
+return NULL;
+
+s += sprintf(s,  %s, p-bEnableWavefront ? wpp : no-wpp);
+s += sprintf(s,  fps=%d, p-frameRate);
+s += sprintf(s,  threads=%d, p-poolNumThreads);
+s += sprintf(s,  frame-threads=%d, p-frameNumThreads);
+s += sprintf(s,  ctu=%d, p-maxCUSize);
+s += sprintf(s,  tu-intra-depth=%d, p-tuQTMaxIntraDepth);
+s += sprintf(s,  tu-inter-depth=%d,p-tuQTMaxInterDepth);
+s += sprintf(s,  me=%d, p-searchMethod);
+s += sprintf(s,  subme=%d, p-subpelRefine);
+s += sprintf(s,  merange=%d, p-searchRange);
+s += sprintf(s,  %s, p-bEnableRectInter ? rect : no-rect);
+s += sprintf(s,  %s, p-bEnableAMP ? amp : no-amp);
+s += sprintf(s,  max-merge=%d, p-maxNumMergeCand);
+s += sprintf(s,  %s, p-bEnableEarlySkip ? early-skip : 
no-early-skip);
+s += sprintf(s,  %s, p-bEnableCbfFastMode ? fast-cbf : no-fast-cbf);
+s += sprintf(s,  rdpenalty=%d, p-rdPenalty);
+s += sprintf(s,  %s, p-bEnableTransformSkip ? tskip : no-tskip);
+s += sprintf(s,  %s, p-bEnableTSkipFast ? tskip-fast : 
no-tskip-fast);
+s += sprintf(s,  bEnableStrongIntraSmoothing = %s, 
p-bEnableStrongIntraSmoothing ? strong-intra-smoothing : 
no-strong-intra-smoothing);
+s += sprintf(s,  %s, p-bEnableConstrainedIntra ? constrained-intra : 
no-constrained-intra);
+s += sprintf(s,  refresh=%d, p-decodingRefreshType);
+s += sprintf(s,  keyint=%d, p-keyframeMax);
+s += sprintf(s,  rc-lookahead=%d, p-lookaheadDepth);
+s += sprintf(s,  bframes=%d, p-bframes);
+s += sprintf(s,  bframe-bias=%d, p-bFrameBias);
+s += sprintf(s,  b-adapt=%d, p-bFrameAdaptive);
+s += sprintf(s,  ref=%d, p-maxNumReferences);
+s += sprintf(s,  %s, p-bEnableWeightedPred ? weightp : no-weightp);
+s += sprintf(s,  bitrate=%d, p-rc.bitrate);
+s += sprintf(s,  qp=%d, p-rc.qp);
+s += sprintf(s,  cbqpoffs=%d, p-cbQpOffset);
+s += sprintf(s,  crqpoffs=%d, p-crQpOffset);
+s += sprintf(s,  rd=%d, p-bRDLevel);
+s += sprintf(s,  %s, p-bEnableSignHiding ? signhide : no-signhide);
+s += sprintf(s,  %s, p-bEnableLoopFilter ? lft : no-lft);
+s += sprintf(s,  %s, p-bEnableSAO ? sao : no-sao);
+s += sprintf(s,  sao-lcu-bounds=%d, p-saoLcuBoundary);
+s += sprintf(s,  sao-lcu-opt=%d, p-saoLcuBasedOptimization);
+
+return buf;
+}
diff -r 1d6b3626f1b3 -r 4cba7c453533 source/common/common.h
--- a/source/common/common.hWed Oct 16 20:38:44 2013 -0500
+++ b/source/common/common.hThu Oct 17 12:35:09 2013 +0530
@@ -114,5 +114,6 @@
 int  x265_check_params(x265_param_t *param);
 void x265_print_params(x265_param_t *param);
 int x265_set_globals(x265_param_t *param);
+char *x265_param2string( x265_param_t *p);
 
 #endif // ifndef X265_COMMON_H
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


Re: [x265] [PATCH] common : Added new function x265_param2string

2013-10-17 Thread Gopu Govindaswamy
On Thu, Oct 17, 2013 at 2:07 PM, Steve Borho st...@borho.org wrote:




 On Thu, Oct 17, 2013 at 2:05 AM, Gopu Govindaswamy 
 g...@multicorewareinc.com wrote:

 # HG changeset patch
 # User Gopu Govindaswamy g...@multicorewareinc.com
 # Date 1381993509 -19800
 # Node ID 4cba7c453533731ef6bca965b6cebe7e6caff8bf
 # Parent  1d6b3626f1b3d4b8f8f181e66eaaa649f90bac02
 common : Added new function x265_param2string

 diff -r 1d6b3626f1b3 -r 4cba7c453533 source/common/common.cpp
 --- a/source/common/common.cpp  Wed Oct 16 20:38:44 2013 -0500
 +++ b/source/common/common.cpp  Thu Oct 17 12:35:09 2013 +0530
 @@ -543,3 +543,52 @@
  berror |= valuewasnull;
  return berror ? X265_PARAM_BAD_VALUE : 0;
  }
 +
 +char *x265_param2string( x265_param_t *p)
 +{
 +char *buf, *s;
 +buf = s = (char *)X265_MALLOC(char, 2000);
 +if (!buf)
 +return NULL;
 +
 +s += sprintf(s,  %s, p-bEnableWavefront ? wpp : no-wpp);


 it would be nice to have a macro that handled these bool parameters,
 something that relied on C string constant concatenation like:

 #define BOOL(param, cliopt) \
s += sprintf(s,  %s, (param) ? cliopt : no-cliopt);


 i will make this change


 +s += sprintf(s,  fps=%d, p-frameRate);
 +s += sprintf(s,  threads=%d, p-poolNumThreads);
 +s += sprintf(s,  frame-threads=%d, p-frameNumThreads);
 +s += sprintf(s,  ctu=%d, p-maxCUSize);
 +s += sprintf(s,  tu-intra-depth=%d, p-tuQTMaxIntraDepth);
 +s += sprintf(s,  tu-inter-depth=%d,p-tuQTMaxInterDepth);
 +s += sprintf(s,  me=%d, p-searchMethod);
 +s += sprintf(s,  subme=%d, p-subpelRefine);
 +s += sprintf(s,  merange=%d, p-searchRange);
 +s += sprintf(s,  %s, p-bEnableRectInter ? rect : no-rect);
 +s += sprintf(s,  %s, p-bEnableAMP ? amp : no-amp);
 +s += sprintf(s,  max-merge=%d, p-maxNumMergeCand);
 +s += sprintf(s,  %s, p-bEnableEarlySkip ? early-skip :
 no-early-skip);
 +s += sprintf(s,  %s, p-bEnableCbfFastMode ? fast-cbf :
 no-fast-cbf);
 +s += sprintf(s,  rdpenalty=%d, p-rdPenalty);
 +s += sprintf(s,  %s, p-bEnableTransformSkip ? tskip :
 no-tskip);
 +s += sprintf(s,  %s, p-bEnableTSkipFast ? tskip-fast :
 no-tskip-fast);
 +s += sprintf(s,  bEnableStrongIntraSmoothing = %s,
 p-bEnableStrongIntraSmoothing ? strong-intra-smoothing :
 no-strong-intra-smoothing);


 this one is wrong
  yes by mistake, thanks, i will remove

 +s += sprintf(s,  %s, p-bEnableConstrainedIntra ?
 constrained-intra : no-constrained-intra);
 +s += sprintf(s,  refresh=%d, p-decodingRefreshType);
 +s += sprintf(s,  keyint=%d, p-keyframeMax);
 +s += sprintf(s,  rc-lookahead=%d, p-lookaheadDepth);
 +s += sprintf(s,  bframes=%d, p-bframes);
 +s += sprintf(s,  bframe-bias=%d, p-bFrameBias);
 +s += sprintf(s,  b-adapt=%d, p-bFrameAdaptive);
 +s += sprintf(s,  ref=%d, p-maxNumReferences);
 +s += sprintf(s,  %s, p-bEnableWeightedPred ? weightp :
 no-weightp);
 +s += sprintf(s,  bitrate=%d, p-rc.bitrate);
 +s += sprintf(s,  qp=%d, p-rc.qp);
 +s += sprintf(s,  cbqpoffs=%d, p-cbQpOffset);
 +s += sprintf(s,  crqpoffs=%d, p-crQpOffset);
 +s += sprintf(s,  rd=%d, p-bRDLevel);


 bRdLevel? ouch.  that parameter shouldn't have a b prefix.  Can you fix
 that in a separate patch?

yes i will change this  and make the separate patch



 +s += sprintf(s,  %s, p-bEnableSignHiding ? signhide :
 no-signhide);
 +s += sprintf(s,  %s, p-bEnableLoopFilter ? lft : no-lft);
 +s += sprintf(s,  %s, p-bEnableSAO ? sao : no-sao);
 +s += sprintf(s,  sao-lcu-bounds=%d, p-saoLcuBoundary);
 +s += sprintf(s,  sao-lcu-opt=%d, p-saoLcuBasedOptimization);
 +
 +return buf;
 +}
 diff -r 1d6b3626f1b3 -r 4cba7c453533 source/common/common.h
 --- a/source/common/common.hWed Oct 16 20:38:44 2013 -0500
 +++ b/source/common/common.hThu Oct 17 12:35:09 2013 +0530
 @@ -114,5 +114,6 @@
  int  x265_check_params(x265_param_t *param);
  void x265_print_params(x265_param_t *param);
  int x265_set_globals(x265_param_t *param);
 +char *x265_param2string( x265_param_t *p);

  #endif // ifndef X265_COMMON_H
 ___
 x265-devel mailing list
 x265-devel@videolan.org
 https://mailman.videolan.org/listinfo/x265-devel




 --
 Steve Borho

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




-- 
Thanks  Regards
Gopu G
Multicoreware Inc
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] cli : Removed 'b'prefix in enable RD optimized quantization variable, modified bRDLevel to RDLevel

2013-10-17 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1382002354 -19800
# Node ID 2bc397397a14f90edd44e7bad401acb4dd4851fd
# Parent  844c9486a2296510641790c1dd492fc22190d8f5
cli : Removed 'b'prefix in enable RD optimized quantization variable, modified 
bRDLevel to RDLevel

diff -r 844c9486a229 -r 2bc397397a14 source/common/common.cpp
--- a/source/common/common.cpp  Thu Oct 17 14:52:17 2013 +0530
+++ b/source/common/common.cpp  Thu Oct 17 15:02:34 2013 +0530
@@ -138,7 +138,7 @@
 param-maxNumMergeCand = 5u;
 param-bEnableAMP = 1;
 param-bEnableRectInter = 1;
-param-bRDLevel = X265_FULL_RDO;
+param-RDLevel = X265_FULL_RDO;
 param-bEnableRDO = 1;
 param-bEnableRDOQ = 1;
 param-bEnableRDOQTS = 1;
@@ -280,8 +280,8 @@
   Picture height must be an integer multiple of the specified chroma 
subsampling);
 CHECK(param-rc.rateControlModeX265_RC_ABR || param-rc.rateControlMode 
X265_RC_CRF,
   Rate control mode is out of range);
-CHECK(param-bRDLevel  X265_NO_RDO_NO_RDOQ ||
-  param-bRDLevel  X265_FULL_RDO,
+CHECK(param-RDLevel  X265_NO_RDO_NO_RDOQ ||
+  param-RDLevel  X265_FULL_RDO,
   RD Level is out of range);
 CHECK(param-bframes  param-lookaheadDepth,
   Lookahead depth must be greater than the max consecutive bframe 
count);
@@ -395,7 +395,7 @@
 TOOLOPT(param-bEnableCbfFastMode, cfm);
 TOOLOPT(param-bEnableConstrainedIntra, cip);
 TOOLOPT(param-bEnableEarlySkip, esd);
-fprintf(stderr, rd=%d , param-bRDLevel);
+fprintf(stderr, rd=%d , param-RDLevel);
 
 TOOLOPT(param-bEnableLoopFilter, lft);
 if (param-bEnableSAO)
@@ -519,7 +519,7 @@
 OPT(crqpoffs)
 p-crQpOffset = atoi(value);
 OPT(rd)
-p-bRDLevel = atoi(value);
+p-RDLevel = atoi(value);
 OPT(signhide)
 p-bEnableSignHiding = bvalue;
 OPT(lft)
@@ -586,7 +586,7 @@
 s += sprintf(s,  qp=%d, p-rc.qp);
 s += sprintf(s,  cbqpoffs=%d, p-cbQpOffset);
 s += sprintf(s,  crqpoffs=%d, p-crQpOffset);
-s += sprintf(s,  rd=%d, p-bRDLevel);
+s += sprintf(s,  rd=%d, p-RDLevel);
 BOOL(p-bEnableSignHiding, signhide);
 BOOL(p-bEnableLoopFilter, lft);
 BOOL(p-bEnableSAO, sao);
diff -r 844c9486a229 -r 2bc397397a14 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cppThu Oct 17 14:52:17 2013 +0530
+++ b/source/encoder/encoder.cppThu Oct 17 15:02:34 2013 +0530
@@ -925,7 +925,7 @@
 }
 
 /* Set flags according to RDLevel specified - check_params has verified 
that RDLevel is within range */
-switch (_param-bRDLevel)
+switch (_param-RDLevel)
 {
 case X265_NO_RDO_NO_RDOQ:
 _param-bEnableRDO = _param-bEnableRDOQ = 0;
diff -r 844c9486a229 -r 2bc397397a14 source/x265.cpp
--- a/source/x265.cpp   Thu Oct 17 14:52:17 2013 +0530
+++ b/source/x265.cpp   Thu Oct 17 15:02:34 2013 +0530
@@ -399,7 +399,7 @@
 H0(-q/--qp  Base QP for CQP mode. Default %d\n, 
param-rc.qp);
 H0(   --cbqpoffsChroma Cb QP Offset. Default %d\n, 
param-cbQpOffset);
 H0(   --crqpoffsChroma Cr QP Offset. Default %d\n, 
param-crQpOffset);
-H0(   --rd  Level of RD in mode decision 
0:least2:full RDO. Default %d\n, param-bRDLevel);
+H0(   --rd  Level of RD in mode decision 
0:least2:full RDO. Default %d\n, param-RDLevel);
 H0(   --[no-]signhide   Hide sign bit of one coeff per TU 
(rdo). Default %s\n, OPT(param-bEnableSignHiding));
 H0(\nLoop filter:\n);
 H0(   --[no-]lftEnable Loop Filter. Default %s\n, 
OPT(param-bEnableLoopFilter));
diff -r 844c9486a229 -r 2bc397397a14 source/x265.h
--- a/source/x265.h Thu Oct 17 14:52:17 2013 +0530
+++ b/source/x265.h Thu Oct 17 15:02:34 2013 +0530
@@ -292,7 +292,7 @@
 int   bEnableRectInter;/// enable rectangular inter 
modes 2NxN, Nx2N
 int   bEnableCbfFastMode;  /// enable use of Cbf flags 
for fast mode decision
 int   bEnableEarlySkip;/// enable early skip (merge) 
detection
-int   bRDLevel; /// enable RD optimized 
quantization
+int   RDLevel; /// enable RD optimized 
quantization
 int   bEnableRDO;
 int   bEnableRDOQ;
 int   bEnableSignHiding;   /// enable hiding one sign bit 
per TU via implicit signaling
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] common: parse the command line arguments and set the Input parameters to the encoder

2013-10-16 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1381904011 -19800
# Node ID de3b1f54873c23189284f63f471d4c95440bacc6
# Parent  09c0e0209d84313a49a15ac3806f03223a1546de
common: parse the command line arguments and set the Input parameters to the 
encoder

diff -r 09c0e0209d84 -r de3b1f54873c source/common/common.cpp
--- a/source/common/common.cpp  Wed Oct 16 10:11:23 2013 +0530
+++ b/source/common/common.cpp  Wed Oct 16 11:43:31 2013 +0530
@@ -420,3 +420,149 @@
 fprintf(stderr, \n);
 fflush(stderr);
 }
+
+extern C
+int x265_param_parse(x265_param_t *p, const char *name, const char *value)
+{
+int berror = 0;
+int valuewasnull;
+
+/* Enable or Disable - default is Enable */
+int bvalue = 1;
+
+if (!name)
+return X265_PARAM_BAD_NAME;
+
+if (!value)
+value = 1;
+
+if (!strncmp(name, no-, 3))
+bvalue = 0; 
+else
+bvalue = 1;
+
+valuewasnull = !value;
+
+#define OPT(STR) else if (!strcmp( name, STR))
+if (0);
+OPT(fps)
+p-frameRate = atoi(value);
+OPT(threads)
+p-poolNumThreads = atoi(value);
+OPT(frame-threads)
+p-frameNumThreads = atoi(value);
+OPT(log)
+p-logLevel = atoi(value);
+OPT(no-wpp)
+p-bEnableWavefront = bvalue;
+OPT(wpp)
+p-bEnableWavefront = bvalue;
+OPT(ctu)
+p-maxCUSize =(uint32_t) atoi(value);
+OPT(tu-intra-depth)
+p-tuQTMaxIntraDepth = (uint32_t) atoi(value);
+OPT(tu-inter-depth)
+p-tuQTMaxInterDepth =(uint32_t) atoi(value);
+OPT(me)
+p-searchMethod = atoi(value);
+OPT(subme)
+p-subpelRefine = atoi(value);
+OPT(merange) 
+p-searchRange = atoi(value);
+OPT(no-rect)
+p-bEnableRectInter = bvalue;
+OPT(rect)
+p-bEnableRectInter = bvalue;
+OPT(no-amp)
+p-bEnableAMP = bvalue;
+OPT(amp)
+p-bEnableAMP = bvalue;
+OPT(max-merge)
+p-maxNumMergeCand = (uint32_t)atoi(value);
+OPT(no-early-skip)
+p-bEnableEarlySkip = bvalue;
+OPT(early-skip)
+p-bEnableEarlySkip = bvalue;
+OPT(no-fast-cbf)
+p-bEnableCbfFastMode = bvalue;
+OPT(fast-cbf)
+p-bEnableCbfFastMode = bvalue;
+OPT(rdpenalty)
+p-rdPenalty = atoi(value);
+OPT(no-tskip)
+p-bEnableTransformSkip = bvalue;
+OPT(tskip)
+p-bEnableTransformSkip = bvalue;
+OPT(no-tskip-fast)
+p-bEnableTSkipFast = bvalue;
+OPT(tskip-fast)
+p-bEnableTSkipFast = bvalue;
+OPT(no-strong-intra-smoothing)
+p-bEnableStrongIntraSmoothing = bvalue;
+OPT(strong-intra-smoothing)
+p-bEnableStrongIntraSmoothing = bvalue;
+OPT(no-constrained-intra)
+p-bEnableConstrainedIntra = bvalue;
+OPT(constrained-intra)
+p-bEnableConstrainedIntra = bvalue;
+OPT(refresh)
+p-decodingRefreshType = atoi(value);
+OPT(keyint)
+p-keyframeMax = atoi(value);
+OPT(rc-lookahead)
+p-lookaheadDepth = atoi(value);
+OPT(bframes)
+p-bframes = atoi(value);
+OPT(bframe-bias)
+p-bFrameBias = atoi(value);
+OPT(b-adapt)
+p-bFrameAdaptive = atoi(value);
+OPT(ref)
+p-maxNumReferences = atoi(value);
+OPT(no-weightp)
+p-bEnableWeightedPred = bvalue;
+OPT(weightp)
+p-bEnableWeightedPred = bvalue;
+OPT(bitrate)
+p-rc.bitrate = atoi(value);
+OPT(qp)
+p-rc.qp = atoi(value);
+OPT(cbqpoffs)
+p-cbQpOffset = atoi(value);
+OPT(crqpoffs)
+p-crQpOffset = atoi(value);
+OPT(rd)
+p-bRDLevel = atoi(value);
+OPT(no-signhide)
+p-bEnableSignHiding = bvalue;
+OPT(signhide)
+p-bEnableSignHiding = bvalue;
+OPT(no-lft)
+p-bEnableLoopFilter = bvalue;
+OPT(lft)
+p-bEnableLoopFilter = bvalue;
+OPT(no-sao)
+p-bEnableSAO = bvalue;
+OPT(sao)
+p-bEnableSAO = bvalue;
+OPT(sao-lcu-bounds)
+p-saoLcuBoundary = atoi(value);
+OPT(sao-lcu-opt)
+p-saoLcuBasedOptimization = atoi(value);
+OPT(no-ssim)
+p-bEnableSsim = bvalue;
+OPT(ssim)
+p-bEnableSsim = bvalue;
+OPT(no-psnr)
+p-bEnablePsnr = atoi(value);
+OPT(psnr)
+p-bEnablePsnr = bvalue;
+OPT(hash)
+p-decodedPictureHashSEI = atoi(value);
+else
+return X265_PARAM_BAD_NAME;
+#undef OPT
+
+berror |= valuewasnull;
+return berror ? X265_PARAM_BAD_VALUE : 0;
+}
diff -r 09c0e0209d84 -r de3b1f54873c source/x265.cpp
--- a/source/x265.cpp   Wed Oct 16 10:11:23 2013 +0530
+++ b/source/x265.cpp   Wed Oct 16 11:43:31 2013 +0530
@@ -290,6 +290,7 @@
 
 bool parse(int argc, char **argv, x265_param_t* param)
 {
+int berror = 0;
 int help = 0;
 int cpuid = 0;
 uint32_t inputBitDepth = 8;
@@ -345,16 +346,30 @@
 log(X265_LOG_WARNING, short option '%c' unrecognized\n, 
c

[x265] [PATCH] x265 : option - long_options structure initialization without using x265opts

2013-10-16 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1381919315 -19800
# Node ID 1b69368780ab4fe67349e089d6bf10482c9dbed4
# Parent  5f173d255d550efefbbf63837bee5fe9d2d12f00
x265 : option - long_options structure initialization without using x265opts

diff -r 5f173d255d55 -r 1b69368780ab source/x265.cpp
--- a/source/x265.cpp   Wed Oct 16 14:48:52 2013 +0530
+++ b/source/x265.cpp   Wed Oct 16 15:58:35 2013 +0530
@@ -81,14 +81,79 @@
 static const char short_options[] = o:f:F:r:i:b:s:q:m:hV;
 static struct option long_options[] =
 {
-#define HELP(message)
-#define OPT(longname, var, argreq, flag, helptext) { longname, argreq, NULL, 
flag },
-#define STROPT OPT
-#include x265opts.h
-{ 0, 0, 0, 0 }
-#undef OPT
-#undef STROPT
-#undef HELP
+{help, no_argument, NULL, 'h'},
+{cpuid, required_argument, NULL, 0},
+{threads, required_argument, NULL, 0},
+{frame-threads, required_argument, NULL, 'F'},
+{log, required_argument, NULL, 0},
+{csv, required_argument, NULL, 0},
+{no-progress, no_argument,   NULL, 0},
+{output, required_argument, NULL, 'o'},
+#if HIGH_BIT_DEPTH
+{depth, required_argument, NULL, 0},
+#endif
+{input, required_argument, NULL, 0},
+{input-depth, required_argument, NULL, 0},
+{input-res, required_argument, NULL, 0},
+{fps, required_argument, NULL, 0},
+{frame-skip, required_argument, NULL, 0},
+{frames, required_argument, NULL, 'f'},
+{recon, required_argument, NULL, 'r'},
+{recon-depth, required_argument, NULL, 0},
+{no-wpp, no_argument, NULL,0},
+{wpp, no_argument, NULL,0},
+{ctu, required_argument, NULL,'s'},
+{tu-intra-depth, required_argument, NULL, 0},
+{tu-inter-depth, required_argument, NULL, 0},
+{me, required_argument, NULL, 0},
+{subme, required_argument, NULL,'m'},
+{merange, required_argument, NULL, 0},
+{no-rect, no_argument, NULL, 0},
+{rect, no_argument, NULL, 0},
+{no-amp, no_argument, NULL, 0},
+{amp, no_argument, NULL, 0},
+{max-merge, required_argument, NULL, 0},
+{no-early-skip, no_argument, NULL, 0},
+{early-skip, no_argument, NULL, 0},
+{no-fast-cbf, no_argument, NULL, 0},
+{fast-cbf, no_argument, NULL, 0},
+{rdpenalty, required_argument, NULL, 0},
+{no-tskip, no_argument, NULL, 0},
+{tskip, no_argument, NULL, 0},
+{no-tskip-fast, no_argument, NULL, 0},
+{tskip-fast, no_argument, NULL, 0},
+{no-strong-intra-smoothing, no_argument, NULL, 0},
+{strong-intra-smoothing, no_argument, NULL, 0},
+{no-constrained-intra, no_argument, NULL, 0},
+{constrained-intra, no_argument, NULL, 0},
+{refresh, required_argument, NULL, 0},
+{keyint, required_argument, NULL, 'i'},
+{rc-lookahead, required_argument, NULL, 0},
+{bframes, required_argument, NULL, 'b'},
+{bframe-bias, required_argument, NULL, 0},
+{b-adapt, required_argument, NULL, 0},
+{ref, required_argument, NULL, 0},
+{no-weightp, no_argument, NULL, 0},
+{weightp, no_argument, NULL, 'w'},
+{bitrate, required_argument, NULL, 0},
+{qp, required_argument, NULL, 'q'},
+{cbqpoffs, required_argument, NULL, 0},
+{crqpoffs, required_argument, NULL, 0},
+{rd, required_argument, NULL, 0},
+{no-signhide, no_argument, NULL, 0},
+{signhide, no_argument, NULL, 0},
+{no-lft, no_argument, NULL, 0},
+{lft, no_argument, NULL, 0},
+{no-sao, no_argument, NULL, 0},
+{sao, no_argument, NULL, 0},
+{sao-lcu-bounds, required_argument, NULL, 0},
+{sao-lcu-opt, required_argument, NULL, 0},
+{no-ssim, no_argument, NULL, 0},
+{ssim, no_argument, NULL, 0},
+{no-psnr, no_argument, NULL, 0},
+{psnr, no_argument, NULL, 0},
+{hash, required_argument, NULL, 0},
+{ 0, 0, 0, 0}
 };
 
 #if CU_STAT_LOGFILE
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] x265 : Removed unused x265opts

2013-10-16 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1381919772 -19800
# Node ID d84ba96117b5c9f41361967211f524d459c2cd0b
# Parent  1b69368780ab4fe67349e089d6bf10482c9dbed4
x265 : Removed unused x265opts

diff -r 1b69368780ab -r d84ba96117b5 source/CMakeLists.txt
--- a/source/CMakeLists.txt Wed Oct 16 15:58:35 2013 +0530
+++ b/source/CMakeLists.txt Wed Oct 16 16:06:12 2013 +0530
@@ -211,7 +211,7 @@
 endif()
 
 add_executable(cli ../COPYING ${InputFiles} ${OutputFiles}
-   x265.cpp x265opts.h x265.h
+   x265.cpp x265.h
compat/msvc/getopt.c compat/msvc/getopt.h)
 target_link_libraries(cli x265-static ${PLATFORM_LIBS})
 set_target_properties(cli PROPERTIES OUTPUT_NAME x265)
diff -r 1b69368780ab -r d84ba96117b5 source/x265opts.h
--- a/source/x265opts.h Wed Oct 16 15:58:35 2013 +0530
+++ /dev/null   Thu Jan 01 00:00:00 1970 +
@@ -1,103 +0,0 @@
-/* Command line options for x265 */
-
-HELP(Standalone Executable Options:)
-OPT(help,help,no_argument, 'h', 
Show this help text)
-OPT(cpuid,   cpuid, required_argument, 0, Limit 
SIMD arch 0:auto 1:None 2:SSE2 .. 8:AVX2)
-OPT(threads, param-poolNumThreads, required_argument, 0, 
Number of threads for thread pool (0: detect CPU core count))
-OPT(frame-threads,   param-frameNumThreads,required_argument, 'F', 
Number of concurrently encoded frames)
-OPT(log, param-logLevel,   required_argument, 0, 
Logging level 0:ERROR 1:WARNING 2:INFO 3:DEBUG -1:NONE)
-STROPT(csv,  csvfn, required_argument, 0, 
`Comma separated value' log file, appends one line per run)
-OPT(no-progress, this-bProgress, no_argument, 0, 
Disable progress reports)
-STROPT(output,   bitstreamfn,   required_argument, 'o', 
Bitstream output file name)
-#if HIGH_BIT_DEPTH
-OPT(depth,   param-internalBitDepth,   required_argument, 0, 
Bit-depth of pixels within encoder)
-#endif
-
-HELP(Input Options:)
-STROPT(input,inputfn,   required_argument, 0, Raw 
YUV or Y4M input file name)
-OPT(input-depth, inputBitDepth, required_argument, 0, 
Bit-depth of input file (YUV only))
-STROPT(input-res,inputRes,  required_argument, 0, 
Source picture size [w x h], auto-detect if Y4M)
-OPT(fps, param-frameRate,  required_argument, 0, Frame 
rate, auto-detect if Y4M)
-OPT(frame-skip,  this-frameSkip,   required_argument, 0, 
Number of frames to skip at start of input file)
-OPT(frames,  this-framesToBeEncoded,   required_argument, 'f', 
Number of frames to be encoded (0 implies all))
-
-HELP(Reconstructed video options (debugging):)
-STROPT(recon,reconfn,   required_argument, 'r', 
Reconstructed image YUV or Y4M output file name)
-OPT(recon-depth, outputBitDepth,required_argument, 0, 
Bit-depth of output file)
-
-HELP(Quad-Tree analysis:)
-OPT(no-wpp,  param-bEnableWavefront, no_argument, 0, 
Disable Wavefront Parallel Processing)
-OPT(wpp, param-bEnableWavefront, no_argument, 0, 
Enable Wavefront Parallel Processing)
-OPT(ctu, param-maxCUSize,  required_argument, 's', 
Maximum CU size (default: 64x64))
-OPT(tu-intra-depth,  param-tuQTMaxIntraDepth,  required_argument, 0, Max 
TU recursive depth for intra CUs)
-OPT(tu-inter-depth,  param-tuQTMaxInterDepth,  required_argument, 0, Max 
TU recursive depth for inter CUs)
-
-HELP(Temporal / motion search options:)
-OPT(me,  param-searchMethod,   required_argument, 0, 
Motion search method 0:dia 1:hex 2:umh 3:star 4:full)
-OPT(subme,   param-subpelRefine,   required_argument, 'm', 
Amount of subpel refinement to perform (0:least .. 7:most))
-OPT(merange, param-searchRange,required_argument, 0, 
Motion search range)
-OPT(no-rect, param-bEnableRectInter, no_argument, 0, 
Disable rectangular motion partitions Nx2N and 2NxN)
-OPT(rect,param-bEnableRectInter, no_argument, 0, 
Enable rectangular motion partitions Nx2N and 2NxN)
-OPT(no-amp,  param-bEnableAMP,   no_argument, 0, 
Disable asymmetric motion partitions)
-OPT(amp, param-bEnableAMP,   no_argument, 0, 
Enable asymmetric motion partitions, requires --rect)
-OPT(max-merge,   param-maxNumMergeCand,required_argument, 0, 
Maximum number of merge candidates)
-OPT(no-early-skip,   param-bEnableEarlySkip, no_argument, 0, 
Disable early SKIP detection)
-OPT(early-skip,  param-bEnableEarlySkip, no_argument, 0, 
Enable early SKIP detection)
-OPT(no-fast-cbf, param-bEnableCbfFastMode,   no_argument, 0, 
Disable Cbf fast mode)
-OPT(fast-cbf,param-bEnableCbfFastMode

[x265] [PATCH] tcomslice:remove unused set methods

2013-10-10 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1381386998 -19800
# Node ID 75a05ed704816fe1a0f45dbbe2723d438043a836
# Parent  8ae52f2b159c8378e981e369aa15c4c36db48f7c
tcomslice:remove unused set methods

diff -r 8ae52f2b159c -r 75a05ed70481 source/Lib/TLibCommon/TComSlice.cpp
--- a/source/Lib/TLibCommon/TComSlice.cpp   Thu Oct 10 01:15:11 2013 -0500
+++ b/source/Lib/TLibCommon/TComSlice.cpp   Thu Oct 10 12:06:38 2013 +0530
@@ -1074,11 +1074,6 @@
 return m_numberOfReferencePictureSets;
 }
 
-void TComRPSList::setNumberOfReferencePictureSets(int 
numberOfReferencePictureSets)
-{
-m_numberOfReferencePictureSets = numberOfReferencePictureSets;
-}
-
 TComRefPicListModification::TComRefPicListModification()
 : m_bRefPicListModificationFlagL0(false)
 , m_bRefPicListModificationFlagL1(false)
diff -r 8ae52f2b159c -r 75a05ed70481 source/Lib/TLibCommon/TComSlice.h
--- a/source/Lib/TLibCommon/TComSlice.h Thu Oct 10 01:15:11 2013 -0500
+++ b/source/Lib/TLibCommon/TComSlice.h Thu Oct 10 12:06:38 2013 +0530
@@ -172,7 +172,6 @@
 
 TComReferencePictureSet* getReferencePictureSet(int 
referencePictureSetNum);
 int getNumberOfReferencePictureSets() const;
-void setNumberOfReferencePictureSets(int numberOfReferencePictureSets);
 };
 
 /// SCALING_LIST class
@@ -238,8 +237,6 @@
 
 int getProfileSpace() const { return m_profileSpace; }
 
-void setProfileSpace(int x) { m_profileSpace = x; }
-
 bool getTierFlag() const{ return m_tierFlag; }
 
 void setTierFlag(bool x){ m_tierFlag = x; }
@@ -289,8 +286,6 @@
 
 bool getSubLayerLevelPresentFlag(int i) const { return 
m_subLayerLevelPresentFlag[i]; }
 
-void setSubLayerLevelPresentFlag(int i, bool x) { 
m_subLayerLevelPresentFlag[i] = x; }
-
 ProfileTierLevel* getGeneralPTL() { return m_generalPTL; }
 
 ProfileTierLevel* getSubLayerPTL(int i) { return m_subLayerPTL[i]; }
@@ -443,10 +438,6 @@
 
 bool getCbrFlag(int layer, int cpbcnt, int nalOrVcl) { return 
m_HRD[layer].cbrFlag[cpbcnt][nalOrVcl]; }
 
-void setNumDU(UInt value) { m_numDU = value; }
-
-UInt getNumDU()   { return m_numDU; }
-
 bool getCpbDpbDelaysPresentFlag() { return 
getNalHrdParametersPresentFlag() || getVclHrdParametersPresentFlag(); }
 };
 
diff -r 8ae52f2b159c -r 75a05ed70481 source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp   Thu Oct 10 01:15:11 2013 -0500
+++ b/source/encoder/frameencoder.cpp   Thu Oct 10 12:06:38 2013 +0530
@@ -135,7 +135,6 @@
 m_sps.setNumLongTermRefPicSPS(0);
 if (m_cfg-getPictureTimingSEIEnabled() || 
m_cfg-getDecodingUnitInfoSEIEnabled())
 {
-m_sps.getVuiParameters()-getHrdParameters()-setNumDU(0);
 m_sps.setHrdParameters(m_cfg-param.frameRate, 0, 
m_cfg-param.rc.bitrate, m_cfg-param.bframes  0);
 }
 if (m_cfg-getBufferingPeriodSEIEnabled() || 
m_cfg-getPictureTimingSEIEnabled() || m_cfg-getDecodingUnitInfoSEIEnabled())
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] remove unused algorithm includes

2013-10-10 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1381387236 -19800
# Node ID dc733384852a48e15ef3be9f9dccdefbe6d87f0e
# Parent  75a05ed704816fe1a0f45dbbe2723d438043a836
remove unused algorithm includes

diff -r 75a05ed70481 -r dc733384852a source/Lib/TLibCommon/CommonDef.h
--- a/source/Lib/TLibCommon/CommonDef.h Thu Oct 10 12:06:38 2013 +0530
+++ b/source/Lib/TLibCommon/CommonDef.h Thu Oct 10 12:10:36 2013 +0530
@@ -38,7 +38,6 @@
 #ifndef X265_COMMONDEF_H
 #define X265_COMMONDEF_H
 
-#include algorithm
 #include cstdlib
 #include TypeDef.h
 
diff -r 75a05ed70481 -r dc733384852a source/Lib/TLibCommon/TComDataCU.h
--- a/source/Lib/TLibCommon/TComDataCU.hThu Oct 10 12:06:38 2013 +0530
+++ b/source/Lib/TLibCommon/TComDataCU.hThu Oct 10 12:10:36 2013 +0530
@@ -46,7 +46,6 @@
 #include TComPattern.h
 
 #include assert.h
-#include algorithm
 
 namespace x265 {
 // private namespace
diff -r 75a05ed70481 -r dc733384852a source/Lib/TLibEncoder/NALwrite.cpp
--- a/source/Lib/TLibEncoder/NALwrite.cpp   Thu Oct 10 12:06:38 2013 +0530
+++ b/source/Lib/TLibEncoder/NALwrite.cpp   Thu Oct 10 12:10:36 2013 +0530
@@ -36,9 +36,6 @@
 #include NALwrite.h
 #include common.h
 
-#include algorithm
-#include cstring
-
 namespace x265 {
 
 //! \ingroup TLibEncoder
diff -r 75a05ed70481 -r dc733384852a source/Lib/TLibEncoder/TEncSbac.cpp
--- a/source/Lib/TLibEncoder/TEncSbac.cpp   Thu Oct 10 12:06:38 2013 +0530
+++ b/source/Lib/TLibEncoder/TEncSbac.cpp   Thu Oct 10 12:10:36 2013 +0530
@@ -36,7 +36,6 @@
 */
 
 #include TEncSbac.h
-#include algorithm
 
 using namespace x265;
 
diff -r 75a05ed70481 -r dc733384852a source/common/dct.cpp
--- a/source/common/dct.cpp Thu Oct 10 12:06:38 2013 +0530
+++ b/source/common/dct.cpp Thu Oct 10 12:10:36 2013 +0530
@@ -29,7 +29,6 @@
 
 #include TLibCommon/TComRom.h
 #include primitives.h
-#include algorithm
 #include string.h
 
 using namespace x265;
diff -r 75a05ed70481 -r dc733384852a source/common/pixel.cpp
--- a/source/common/pixel.cpp   Thu Oct 10 12:06:38 2013 +0530
+++ b/source/common/pixel.cpp   Thu Oct 10 12:10:36 2013 +0530
@@ -27,7 +27,6 @@
 #include TLibCommon/TComRom.h
 #include primitives.h
 
-#include algorithm
 #include cstdlib // abs()
 
 using namespace x265;
diff -r 75a05ed70481 -r dc733384852a source/common/vec/dct-sse3.cpp
--- a/source/common/vec/dct-sse3.cppThu Oct 10 12:06:38 2013 +0530
+++ b/source/common/vec/dct-sse3.cppThu Oct 10 12:10:36 2013 +0530
@@ -37,7 +37,6 @@
 
 #include assert.h
 #include string.h
-#include algorithm
 
 using namespace x265;
 
diff -r 75a05ed70481 -r dc733384852a source/common/vec/dct-sse41.cpp
--- a/source/common/vec/dct-sse41.cpp   Thu Oct 10 12:06:38 2013 +0530
+++ b/source/common/vec/dct-sse41.cpp   Thu Oct 10 12:10:36 2013 +0530
@@ -37,7 +37,6 @@
 
 #include assert.h
 #include string.h
-#include algorithm
 #include smmintrin.h
 
 using namespace x265;
diff -r 75a05ed70481 -r dc733384852a source/x265.cpp
--- a/source/x265.cpp   Thu Oct 10 12:06:38 2013 +0530
+++ b/source/x265.cpp   Thu Oct 10 12:10:36 2013 +0530
@@ -53,7 +53,6 @@
 #include string.h
 #include stdio.h
 #include string
-#include list
 #include ostream
 #include fstream
 
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] tcomtrquant:remove unused methods

2013-10-10 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1381388381 -19800
# Node ID 9057b379051036554820697722d6849d52fd57e4
# Parent  dc733384852a48e15ef3be9f9dccdefbe6d87f0e
tcomtrquant:remove unused methods

diff -r dc733384852a -r 9057b3790510 source/Lib/TLibCommon/TComTrQuant.cpp
--- a/source/Lib/TLibCommon/TComTrQuant.cpp Thu Oct 10 12:10:36 2013 +0530
+++ b/source/Lib/TLibCommon/TComTrQuant.cpp Thu Oct 10 12:29:41 2013 +0530
@@ -328,63 +328,6 @@
 return acSum;
 }
 
-void TComTrQuant::xDeQuant(const TCoeff* qCoef, int* coef, int width, int 
height, int scalingListType)
-{
-if (width  (int)m_maxTrSize)
-{
-width  = m_maxTrSize;
-height = m_maxTrSize;
-}
-
-int shift, add, coeffQ;
-UInt log2TrSize = g_convertToBit[width] + 2;
-
-int transformShift = MAX_TR_DYNAMIC_RANGE - X265_DEPTH - log2TrSize;
-
-shift = QUANT_IQUANT_SHIFT - QUANT_SHIFT - transformShift;
-
-TCoeff clipQCoef;
-
-if (getUseScalingList())
-{
-shift += 4;
-int *dequantCoef = getDequantCoeff(scalingListType, m_qpParam.m_rem, 
log2TrSize - 2);
-
-if (shift  m_qpParam.m_per)
-{
-add = 1  (shift - m_qpParam.m_per - 1);
-
-for (int n = 0; n  width * height; n++)
-{
-clipQCoef = Clip3(-32768, 32767, qCoef[n]);
-coeffQ = ((clipQCoef * dequantCoef[n]) + add)  (shift -  
m_qpParam.m_per);
-coef[n] = Clip3(-32768, 32767, coeffQ);
-}
-}
-else
-{
-for (int n = 0; n  width * height; n++)
-{
-clipQCoef = Clip3(-32768, 32767, qCoef[n]);
-coeffQ   = Clip3(-32768, 32767, clipQCoef * dequantCoef[n]); 
// Clip to avoid possible overflow in following shift left operation
-coef[n] = Clip3(-32768, 32767, coeffQ  (m_qpParam.m_per - 
shift));
-}
-}
-}
-else
-{
-add = 1  (shift - 1);
-int scale = g_invQuantScales[m_qpParam.m_rem]  m_qpParam.m_per;
-
-for (int n = 0; n  width * height; n++)
-{
-clipQCoef = Clip3(-32768, 32767, qCoef[n]);
-coeffQ = (clipQCoef * scale + add)  shift;
-coef[n] = Clip3(-32768, 32767, coeffQ);
-}
-}
-}
-
 void TComTrQuant::init(UInt maxTrSize, int useRDOQ, int useRDOQTS, int 
useTransformSkipFast)
 {
 m_maxTrSize= maxTrSize;
@@ -499,20 +442,6 @@
 // Logical transform
 // 

 
-/** Wrapper function between HM interface and core NxN inverse transform (2D)
- *  \param plCoef input data (transform coefficients)
- *  \param pResidual output data (residual)
- *  \param stride stride of input residual data
- *  \param size transform size (size x size)
- *  \param mode is Intra Prediction mode used in Mode-Dependent DCT/DST only
- */
-void TComTrQuant::xIT(UInt mode, int* coeff, short* residual, UInt stride, int 
width, int /*height*/)
-{
-// TODO: this may need larger data types for X265_DEPTH  8
-const UInt log2BlockSize = g_convertToBit[width];
-primitives.idct[IDCT_4x4 + log2BlockSize - ((width == 4)  (mode != 
REG_DCT))](coeff, residual, stride);
-}
-
 /** Wrapper function between HM interface and core 4x4 transform skipping
  *  \param resiBlock input data (residual)
  *  \param psCoeff output data (transform coefficients)
@@ -1439,26 +1368,6 @@
 }
 }
 
-/** set quantized matrix coefficient for decode
- * \param scalingList quantized matrix address
- */
-void TComTrQuant::setScalingListDec(TComScalingList *scalingList)
-{
-UInt size, list;
-UInt qp;
-
-for (size = 0; size  SCALING_LIST_SIZE_NUM; size++)
-{
-for (list = 0; list  g_scalingListNum[size]; list++)
-{
-for (qp = 0; qp  SCALING_LIST_REM_NUM; qp++)
-{
-xSetScalingListDec(scalingList, list, size, qp);
-}
-}
-}
-}
-
 /** set error scale coefficients
  * \param list List ID
  * \param uiSize Size
diff -r dc733384852a -r 9057b3790510 source/Lib/TLibCommon/TComTrQuant.h
--- a/source/Lib/TLibCommon/TComTrQuant.h   Thu Oct 10 12:10:36 2013 +0530
+++ b/source/Lib/TLibCommon/TComTrQuant.h   Thu Oct 10 12:29:41 2013 +0530
@@ -157,7 +157,6 @@
 void xSetScalingListEnc(TComScalingList *scalingList, UInt list, UInt 
size, UInt qp);
 void xSetScalingListDec(TComScalingList *scalingList, UInt list, UInt 
size, UInt qp);
 void setScalingList(TComScalingList *scalingList);
-void setScalingListDec(TComScalingList *scalingList);
 void processScalingListEnc(int *coeff, int *quantcoeff, int quantScales, 
UInt height, UInt width, UInt ratio, int sizuNum, UInt dc);
 void processScalingListDec(int *coeff, int *dequantcoeff, int 
invQuantScales, UInt height, UInt width, UInt ratio, int sizuNum, UInt dc);
 
@@ -218,10 +217,6

[x265] [PATCH] piclist: Added new class piclist for list manipulations

2013-10-08 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1381221022 -19800
# Node ID 47898b009c16c02983092635b6ba292b34a8e7e8
# Parent  9b3a427a1009d1853bbdc30abe1fd891864e6b38
piclist: Added new class piclist for list manipulations

Created new file piclist.cpp and piclist.h for linked list manipulation, there 
will be
no intermediate storage in piclist, the piclist just link the TComPic object

piclist is used to Replace TComListTComPic and this will remove std::list 
dependency in X265

diff -r 9b3a427a1009 -r 47898b009c16 source/Lib/TLibCommon/TComPic.cpp
--- a/source/Lib/TLibCommon/TComPic.cpp Tue Oct 08 11:12:12 2013 +0530
+++ b/source/Lib/TLibCommon/TComPic.cpp Tue Oct 08 14:00:22 2013 +0530
@@ -59,6 +59,8 @@
 m_reconRowCount = 0;
 m_countRefEncoders = 0;
 memset(m_lowres, 0, sizeof(m_lowres));
+next = NULL;
+prev = NULL;
 }
 
 TComPic::~TComPic()
diff -r 9b3a427a1009 -r 47898b009c16 source/Lib/TLibCommon/TComPic.h
--- a/source/Lib/TLibCommon/TComPic.h   Tue Oct 08 11:12:12 2013 +0530
+++ b/source/Lib/TLibCommon/TComPic.h   Tue Oct 08 14:00:22 2013 +0530
@@ -81,6 +81,9 @@
 
 Lowresm_lowres;
 
+TComPic *next;
+TComPic *prev;
+
 TComPic();
 virtual ~TComPic();
 
diff -r 9b3a427a1009 -r 47898b009c16 source/common/CMakeLists.txt
--- a/source/common/CMakeLists.txt  Tue Oct 08 11:12:12 2013 +0530
+++ b/source/common/CMakeLists.txt  Tue Oct 08 14:00:22 2013 +0530
@@ -93,7 +93,8 @@
 TShortYUV.cpp TShortYUV.h mv.h
 reference.cpp reference.h
 common.cpp common.h
-lowres.cpp lowres.h)
+lowres.cpp lowres.h
+piclist.cpp piclist.h)
 
 if(ENABLE_PRIMITIVES_VEC)
 add_subdirectory(vec)
diff -r 9b3a427a1009 -r 47898b009c16 source/common/piclist.cpp
--- /dev/null   Thu Jan 01 00:00:00 1970 +
+++ b/source/common/piclist.cpp Tue Oct 08 14:00:22 2013 +0530
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2013 x265 project
+ *
+ * Authors: Gopu Govindaswamy g...@multicorewareinc.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111, USA.
+ *
+ * This program is also available under a commercial proprietary license.
+ * For more information, contact us at licens...@multicorewareinc.com.
+ */
+#include piclist.h
+#include TLibCommon/TComPic.h
+using namespace x265;
+
+void piclist::push_front(TComPic *pic)
+{
+if (pic)
+{
+count++;
+if (start == NULL)
+{
+start = pic;
+end = pic;
+}
+else
+{
+pic-next = start;
+start-prev = pic;
+start = pic;
+}
+}
+}
+
+void piclist::push_back(TComPic *pic)
+{
+if (pic)
+{
+count++;
+if (end == NULL)
+{
+start = pic;
+end = pic;
+}
+else
+{
+pic-prev = end;
+end-next = pic;
+end = pic;
+}
+}
+}
+
+TComPic *piclist::pop_front()
+{
+if (!empty())
+{
+TComPic *temp = start;
+start = start-next;
+temp-next = temp-prev = NULL;
+count--;
+return temp;
+}
+else
+return NULL;
+}
+
+TComPic *piclist::pop_back()
+{
+if (!empty())
+{
+TComPic* temp = end;
+TComPic* back = end-prev;
+back-next = NULL;
+end = back;
+count--;
+return temp;
+}
+else
+return NULL;
+}
diff -r 9b3a427a1009 -r 47898b009c16 source/common/piclist.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +
+++ b/source/common/piclist.h   Tue Oct 08 14:00:22 2013 +0530
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2013 x265 project
+ *
+ * Authors: Gopu Govindaswamy g...@multicorewareinc.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even

[x265] [PATCH] TComSlice: Removed un-used createExplicitReferencePictureSetFromReference() Method

2013-10-08 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1381222349 -19800
# Node ID fe870acd8a628e322d3a758f6af3fdf37857b7c0
# Parent  ac6cbc9cb2be08bd04c54b8e323633e676b0503f
TComSlice: Removed un-used createExplicitReferencePictureSetFromReference() 
Method

diff -r ac6cbc9cb2be -r fe870acd8a62 source/Lib/TLibCommon/TComSlice.cpp
--- a/source/Lib/TLibCommon/TComSlice.cpp   Tue Oct 08 14:16:51 2013 +0530
+++ b/source/Lib/TLibCommon/TComSlice.cpp   Tue Oct 08 14:22:29 2013 +0530
@@ -759,98 +759,6 @@
 }
 }
 
-/** Function for constructing an explicit Reference Picture Set out of the 
available pictures in a referenced Reference Picture Set
-*/
-void 
TComSlice::createExplicitReferencePictureSetFromReference(TComListTComPic* 
picList, TComReferencePictureSet *rps, bool isRAP)
-{
-TComPic* outPic;
-int i, j;
-int k = 0;
-int nrOfNegativePictures = 0;
-int nrOfPositivePictures = 0;
-TComReferencePictureSet* refRPS = this-getLocalRPS();
-
-// loop through all pictures in the Reference Picture Set
-for (i = 0; i  rps-getNumberOfPictures(); i++)
-{
-j = 0;
-// loop through all pictures in the reference picture buffer
-TComListTComPic*::iterator iterPic = picList.begin();
-while (iterPic != picList.end())
-{
-j++;
-outPic = *(iterPic++);
-
-if (outPic-getPicSym()-getSlice()-getPOC() == this-getPOC() + 
rps-getDeltaPOC(i)  outPic-getSlice()-isReferenced())
-{
-// This picture exists as a reference picture
-// and should be added to the explicit Reference Picture Set
-refRPS-setDeltaPOC(k, rps-getDeltaPOC(i));
-refRPS-setUsed(k, rps-getUsed(i)  (!isRAP));
-if (refRPS-getDeltaPOC(k)  0)
-{
-nrOfNegativePictures++;
-}
-else
-{
-nrOfPositivePictures++;
-}
-k++;
-}
-}
-}
-
-refRPS-setNumberOfNegativePictures(nrOfNegativePictures);
-refRPS-setNumberOfPositivePictures(nrOfPositivePictures);
-refRPS-setNumberOfPictures(nrOfNegativePictures + nrOfPositivePictures);
-// This is a simplistic inter rps example. A smarter encoder will look for 
a better reference RPS to do the
-// inter RPS prediction with.  Here we just use the reference used by 
pReferencePictureSet.
-// If pReferencePictureSet is not inter_RPS_predicted, then 
inter_RPS_prediction is for the current RPS also disabled.
-if (!rps-getInterRPSPrediction())
-{
-refRPS-setInterRPSPrediction(false);
-refRPS-setNumRefIdc(0);
-}
-else
-{
-int rIdx =  this-getRPSidx() - rps-getDeltaRIdxMinus1() - 1;
-int deltaRPS = rps-getDeltaRPS();
-const TComReferencePictureSet *refRPSOther = 
this-getSPS()-getRPSList()-getReferencePictureSet(rIdx);
-int refPics = refRPSOther-getNumberOfPictures();
-int newIdc = 0;
-for (i = 0; i = refPics; i++)
-{
-int deltaPOC = ((i != refPics) ? refRPSOther-getDeltaPOC(i) : 0); 
// check if the reference abs POC is = 0
-int refIdc = 0;
-for (j = 0; j  refRPS-getNumberOfPictures(); j++) // loop 
through the  pictures in the new RPS
-{
-if ((deltaPOC + deltaRPS) == refRPS-getDeltaPOC(j))
-{
-if (refRPS-getUsed(j))
-{
-refIdc = 1;
-}
-else
-{
-refIdc = 2;
-}
-}
-}
-
-refRPS-setRefIdc(i, refIdc);
-newIdc++;
-}
-
-refRPS-setInterRPSPrediction(true);
-refRPS-setNumRefIdc(newIdc);
-refRPS-setDeltaRPS(deltaRPS);
-refRPS-setDeltaRIdxMinus1(rps-getDeltaRIdxMinus1() + 
this-getSPS()-getRPSList()-getNumberOfReferencePictureSets() - 
this-getRPSidx());
-}
-
-this-setRPS(refRPS);
-this-setRPSidx(-1);
-}
-
 /** get AC and DC values for weighted pred
  * \param *wp
  * \returns void
diff -r ac6cbc9cb2be -r fe870acd8a62 source/Lib/TLibCommon/TComSlice.h
--- a/source/Lib/TLibCommon/TComSlice.h Tue Oct 08 14:16:51 2013 +0530
+++ b/source/Lib/TLibCommon/TComSlice.h Tue Oct 08 14:22:29 2013 +0530
@@ -1622,7 +1622,6 @@
 void setTLayerInfo(UInt tlayer);
 void decodingMarking(TComListTComPic* picList, int gopSize, int 
maxRefPicNum);
 int  checkThatAllRefPicsAreAvailable(TComListTComPic* picList, 
TComReferencePictureSet *rps, bool printErrors, int pocRandomAccess = 0);
-void createExplicitReferencePictureSetFromReference(TComListTComPic* 
picList, TComReferencePictureSet *rps, bool isRAP);
 
 void setMaxNumMergeCand(UInt val)  { m_maxNumMergeCand = val

[x265] [PATCH] tcomslice: removed un-used checkThatAllRefPicsAreAvailable() function

2013-10-08 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1381222532 -19800
# Node ID 565270489635b5b70f682eb03d47004b2b2fdeeb
# Parent  fe870acd8a628e322d3a758f6af3fdf37857b7c0
tcomslice: removed un-used checkThatAllRefPicsAreAvailable() function

diff -r fe870acd8a62 -r 565270489635 source/Lib/TLibCommon/TComSlice.cpp
--- a/source/Lib/TLibCommon/TComSlice.cpp   Tue Oct 08 14:22:29 2013 +0530
+++ b/source/Lib/TLibCommon/TComSlice.cpp   Tue Oct 08 14:25:32 2013 +0530
@@ -611,154 +611,6 @@
 m_maxNumMergeCand = src-m_maxNumMergeCand;
 }
 
-/** Function for applying picture marking based on the Reference Picture Set 
in pReferencePictureSet.
-*/
-int TComSlice::checkThatAllRefPicsAreAvailable(TComListTComPic* picList, 
TComReferencePictureSet *rps, bool printErrors, int pocRandomAccess)
-{
-TComPic* outPic;
-int i, isAvailable;
-int atLeastOneLost = 0;
-int atLeastOneRemoved = 0;
-int iPocLost = 0;
-
-// loop through all long-term pictures in the Reference Picture Set
-// to see if the picture should be kept as reference picture
-for (i = rps-getNumberOfNegativePictures() + 
rps-getNumberOfPositivePictures(); i  rps-getNumberOfPictures(); i++)
-{
-isAvailable = 0;
-// loop through all pictures in the reference picture buffer
-TComListTComPic*::iterator iterPic = picList.begin();
-while (iterPic != picList.end())
-{
-outPic = *(iterPic++);
-if (rps-getCheckLTMSBPresent(i) == true)
-{
-if (outPic-getIsLongTerm()  
(outPic-getPicSym()-getSlice()-getPOC()) == rps-getPOC(i)  
outPic-getSlice()-isReferenced())
-{
-isAvailable = 1;
-}
-}
-else
-{
-if (outPic-getIsLongTerm()  
(outPic-getPicSym()-getSlice()-getPOC() % (1  
outPic-getPicSym()-getSlice()-getSPS()-getBitsForPOC())) == rps-getPOC(i) 
% (1  outPic-getPicSym()-getSlice()-getSPS()-getBitsForPOC())  
outPic-getSlice()-isReferenced())
-{
-isAvailable = 1;
-}
-}
-}
-
-// if there was no such long-term check the short terms
-if (!isAvailable)
-{
-iterPic = picList.begin();
-while (iterPic != picList.end())
-{
-outPic = *(iterPic++);
-
-int pocCycle = 1  
outPic-getPicSym()-getSlice()-getSPS()-getBitsForPOC();
-int curPoc = outPic-getPicSym()-getSlice()-getPOC();
-int refPoc = rps-getPOC(i);
-if (!rps-getCheckLTMSBPresent(i))
-{
-curPoc = curPoc % pocCycle;
-refPoc = refPoc % pocCycle;
-}
-
-if (outPic-getSlice()-isReferenced()  curPoc == refPoc)
-{
-isAvailable = 1;
-outPic-setIsLongTerm(1);
-break;
-}
-}
-}
-// report that a picture is lost if it is in the Reference Picture Set
-// but not available as reference picture
-if (isAvailable == 0)
-{
-if (this-getPOC() + rps-getDeltaPOC(i) = pocRandomAccess)
-{
-if (!rps-getUsed(i))
-{
-if (printErrors)
-{
-printf(\nLong-term reference picture with POC = %3d 
seems to have been removed or not correctly decoded., this-getPOC() + 
rps-getDeltaPOC(i));
-}
-atLeastOneRemoved = 1;
-}
-else
-{
-if (printErrors)
-{
-printf(\nLong-term reference picture with POC = %3d 
is lost or not correctly decoded!, this-getPOC() + rps-getDeltaPOC(i));
-}
-atLeastOneLost = 1;
-iPocLost = this-getPOC() + rps-getDeltaPOC(i);
-}
-}
-}
-}
-
-// loop through all short-term pictures in the Reference Picture Set
-// to see if the picture should be kept as reference picture
-for (i = 0; i  rps-getNumberOfNegativePictures() + 
rps-getNumberOfPositivePictures(); i++)
-{
-isAvailable = 0;
-// loop through all pictures in the reference picture buffer
-TComListTComPic*::iterator iterPic = picList.begin();
-while (iterPic != picList.end())
-{
-outPic = *(iterPic++);
-
-if (!outPic-getIsLongTerm()  
outPic-getPicSym()-getSlice()-getPOC() == this-getPOC() + 
rps-getDeltaPOC(i) 
-outPic-getSlice()-isReferenced())
-{
-isAvailable = 1;
-}
-}
-
-// report that a picture is lost if it is in the Reference Picture Set
-// but not available

[x265] [PATCH] tcomslice: removed un-used sortPicList() function

2013-10-08 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1381222717 -19800
# Node ID 1bf71583de895064ef714978187265ce547ceb7b
# Parent  565270489635b5b70f682eb03d47004b2b2fdeeb
tcomslice: removed un-used sortPicList() function

diff -r 565270489635 -r 1bf71583de89 source/Lib/TLibCommon/TComSlice.cpp
--- a/source/Lib/TLibCommon/TComSlice.cpp   Tue Oct 08 14:25:32 2013 +0530
+++ b/source/Lib/TLibCommon/TComSlice.cpp   Tue Oct 08 14:28:37 2013 +0530
@@ -153,45 +153,6 @@
 m_substreamSizes = new UInt[numSubstreams  0 ? numSubstreams - 1 : 0];
 }
 
-void  TComSlice::sortPicList(TComListTComPic* picList)
-{
-TComPic* picExtract;
-TComPic* picInsert;
-
-TComListTComPic*::iterator iterPicExtract;
-TComListTComPic*::iterator iterPicExtract_1;
-TComListTComPic*::iterator iterPicInsert;
-
-for (int i = 1; i  (int)(picList.size()); i++)
-{
-iterPicExtract = picList.begin();
-for (int j = 0; j  i; j++)
-{
-iterPicExtract++;
-}
-
-picExtract = *(iterPicExtract);
-iterPicInsert = picList.begin();
-while (iterPicInsert != iterPicExtract)
-{
-picInsert = *(iterPicInsert);
-if (picInsert-getPOC() = picExtract-getPOC())
-{
-break;
-}
-
-iterPicInsert++;
-}
-
-iterPicExtract_1 = iterPicExtract;
-iterPicExtract_1++;
-
-//  swap iterPicExtract and iterPicInsert, iterPicExtract = curr. / 
iterPicInsert = insertion position
-picList.insert(iterPicInsert, iterPicExtract, iterPicExtract_1);
-picList.erase(iterPicExtract);
-}
-}
-
 TComPic* TComSlice::xGetRefPic(TComListTComPic* picList, int poc)
 {
 TComListTComPic*::iterator iterPic = picList.begin();
diff -r 565270489635 -r 1bf71583de89 source/Lib/TLibCommon/TComSlice.h
--- a/source/Lib/TLibCommon/TComSlice.h Tue Oct 08 14:25:32 2013 +0530
+++ b/source/Lib/TLibCommon/TComSlice.h Tue Oct 08 14:28:37 2013 +0530
@@ -1615,8 +1615,6 @@
 m_bEqualRef[e][refIdx1][refIdx2] = m_bEqualRef[e][refIdx2][refIdx1] = 
b;
 }
 
-static void sortPicList(TComListTComPic* picList);
-
 void setList1IdxToList0Idx();
 
 void setTLayerInfo(UInt tlayer);
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] tcomdatacu: Removed Un-used NDBFBlockInfo - Non-deblocking filter processing block information

2013-10-07 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1381130312 -19800
# Node ID ec5a502fafac3e6bc264dde1d962c7e21f9361fd
# Parent  c010342f7605c86867824f5b525a8f84c0d2de1c
tcomdatacu: Removed Un-used NDBFBlockInfo - Non-deblocking filter processing 
block information

1.setNDBFilterBlockBorderAvailability()
2.createNonDBFilterInfo()
3.createNonDBFilterInfoLCU()
4.destroyNonDBFilterInfo()

All the above methods are used to set and destroy the NDBFBlockInformation, but 
NDBFBlockInfo m_vNDFBlock is not getting
used encoding process

diff -r c010342f7605 -r ec5a502fafac source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp  Sun Oct 06 02:09:00 2013 -0500
+++ b/source/Lib/TLibCommon/TComDataCU.cpp  Mon Oct 07 12:48:32 2013 +0530
@@ -210,23 +210,6 @@
 m_cuMvField[1].destroy();
 }
 
-const NDBFBlockInfo NDBFBlockInfo::operator =(const NDBFBlockInfo src)
-{
-this-sliceID = src.sliceID;
-this-startSU = src.startSU;
-this-endSU  = src.endSU;
-this-widthSU = src.widthSU;
-this-heightSU = src.heightSU;
-this-posX   = src.posX;
-this-posY   = src.posY;
-this-width  = src.width;
-this-height = src.height;
-::memcpy(this-isBorderAvailable, src.isBorderAvailable, sizeof(bool) * 
((int)NUM_SGU_BORDER));
-this-allBordersAvailable = src.allBordersAvailable;
-
-return *this;
-}
-
 // 

 // Public member functions
 // 

@@ -3181,190 +3164,4 @@
 return (m_cuAddr) * (1  (m_slice-getSPS()-getMaxCUDepth()  1)) + 
m_absIdxInLCU;
 }
 
-/** Set neighboring blocks availabilities for non-deblocked filtering
- * \param numLCUInPicWidth number of LCUs in picture width
- * \param numLCUInPicHeight number of LCUs in picture height
- * \param numSUInLCUWidth number of SUs in LCU width
- * \param numSUInLCUHeight number of SUs in LCU height
- * \param picWidth picture width
- * \param picHeight picture height
- * \param bIndependentSliceBoundaryEnabled true for independent slice boundary 
enabled
- * \param bTopTileBoundary true means that top boundary coincides tile boundary
- * \param bDownTileBoundary true means that bottom boundary coincides tile 
boundary
- * \param bLeftTileBoundary true means that left boundary coincides tile 
boundary
- * \param bRightTileBoundary true means that right boundary coincides tile 
boundary
- * \param bIndependentTileBoundaryEnabled true for independent tile boundary 
enabled
- */
-void TComDataCU::setNDBFilterBlockBorderAvailability(UInt 
/*numLCUInPicWidth*/, UInt /*numLCUInPicHeight*/, UInt numSUInLCUWidth, UInt 
numSUInLCUHeight,
- UInt picWidth, UInt 
picHeight, bool bTopTileBoundary, bool bDownTileBoundary, bool 
bLeftTileBoundary,
- bool bRightTileBoundary, 
bool bIndependentTileBoundaryEnabled)
-{
-UInt lpelx, tpely;
-UInt width, height;
-bool bPicRBoundary, bPicBBoundary, bPicTBoundary, bPicLBoundary;
-bool bLCURBoundary = false, bLCUBBoundary = false, bLCUTBoundary = false, 
bLCULBoundary = false;
-bool* bAvailBorder;
-bool* bAvail;
-UInt rTLSU, rBRSU, widthSU;
-UInt numSGU = (UInt)m_vNDFBlock.size();
-
-for (int i = 0; i  numSGU; i++)
-{
-NDBFBlockInfo rSGU = m_vNDFBlock[i];
-
-lpelx = rSGU.posX;
-tpely = rSGU.posY;
-width   = rSGU.width;
-height  = rSGU.height;
-rTLSU = g_zscanToRaster[rSGU.startSU];
-rBRSU = g_zscanToRaster[rSGU.endSU];
-widthSU   = rSGU.widthSU;
-
-bAvailBorder = rSGU.isBorderAvailable;
-
-bPicTBoundary = (tpely == 0) ? (true) : (false);
-bPicLBoundary = (lpelx == 0) ? (true) : (false);
-bPicRBoundary = (!(lpelx + width  picWidth)) ? (true) : (false);
-bPicBBoundary = (!(tpely + height  picHeight)) ? (true) : (false);
-
-bLCULBoundary = (rTLSU % numSUInLCUWidth == 0) ? (true) : (false);
-bLCURBoundary = ((rTLSU + widthSU) % numSUInLCUWidth == 0) ? (true) : 
(false);
-bLCUTBoundary = ((UInt)(rTLSU / numSUInLCUWidth) == 0) ? (true) : 
(false);
-bLCUBBoundary = ((UInt)(rBRSU / numSUInLCUWidth) == (numSUInLCUHeight 
- 1)) ? (true) : (false);
-
-//   SGU_L
-bAvail = (bAvailBorder[SGU_L]);
-if (bPicLBoundary)
-{
-*bAvail = false;
-}
-else
-{
-*bAvail = true;
-}
-
-//   SGU_R
-bAvail = (bAvailBorder[SGU_R]);
-if (bPicRBoundary)
-{
-*bAvail = false;
-}
-else
-{
-*bAvail = true;
-}
-
-//   SGU_T
-bAvail = (bAvailBorder[SGU_T]);
-if (bPicTBoundary

[x265] [PATCH] NAL: Remove unused NALUnitEBSP functions

2013-09-25 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1380089030 -19800
# Node ID 4d0ced5c64fed290302b730ef8ac7d8613420a0d
# Parent  bb88bbe34c95b3f398a6af63c05e06a3fe7bc7d3
NAL: Remove unused NALUnitEBSP functions

Removed the unused NALUnitEBSP(OutputNALUnit nalu) and copyNaluData() methods 
from NAL

diff -r bb88bbe34c95 -r 4d0ced5c64fe source/Lib/TLibCommon/NAL.h
--- a/source/Lib/TLibCommon/NAL.h   Wed Sep 25 11:28:06 2013 +0530
+++ b/source/Lib/TLibCommon/NAL.h   Wed Sep 25 11:33:50 2013 +0530
@@ -113,7 +113,6 @@
  * the NALUnit header, then the rbsp_bytes including any
  * emulation_prevention_three_byte symbols.
  */
-NALUnitEBSP(OutputNALUnit nalu);
 void init(OutputNALUnit nalu);
 };
 }
diff -r bb88bbe34c95 -r 4d0ced5c64fe source/Lib/TLibEncoder/NALwrite.cpp
--- a/source/Lib/TLibEncoder/NALwrite.cpp   Wed Sep 25 11:28:06 2013 +0530
+++ b/source/Lib/TLibEncoder/NALwrite.cpp   Wed Sep 25 11:33:50 2013 +0530
@@ -143,15 +143,5 @@
 bs.writeAlignZero();
 }
 
-/**
- * Copy NALU from naluSrc to naluDest
- */
-void copyNaluData(OutputNALUnit naluDest, const OutputNALUnit naluSrc)
-{
-naluDest.m_nalUnitType = naluSrc.m_nalUnitType;
-naluDest.m_reservedZero6Bits  = naluSrc.m_reservedZero6Bits;
-naluDest.m_temporalId  = naluSrc.m_temporalId;
-naluDest.m_Bitstream   = naluSrc.m_Bitstream;
-}
 }
 //! \}
diff -r bb88bbe34c95 -r 4d0ced5c64fe source/Lib/TLibEncoder/NALwrite.h
--- a/source/Lib/TLibEncoder/NALwrite.h Wed Sep 25 11:28:06 2013 +0530
+++ b/source/Lib/TLibEncoder/NALwrite.h Wed Sep 25 11:33:50 2013 +0530
@@ -77,12 +77,6 @@
 void write(uint8_t* out, OutputNALUnit nalu, UInt packetSize);
 void writeRBSPTrailingBits(TComOutputBitstream bs);
 
-inline NALUnitEBSP::NALUnitEBSP(OutputNALUnit nalu)
-: NALUnit(nalu)
-{
-write(m_nalUnitData, nalu, m_packetSize);
-}
-
 void inline NALUnitEBSP::init(OutputNALUnit nalu)
 {
 m_nalUnitType = nalu.m_nalUnitType;
@@ -91,7 +85,6 @@
 write(m_nalUnitData, nalu, m_packetSize);
 }
 
-void copyNaluData(OutputNALUnit naluDest, const OutputNALUnit naluSrc);
 }
 
 //! \}
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] tcomBitstream: Removed Unused std::vector class code

2013-09-24 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1380023106 -19800
# Node ID 1752b4fce57e6e78a626642c07a1fd498c650256
# Parent  70ba2b3b7bc972ed04f5fd135d940e4759315fa8
tcomBitstream: Removed Unused std::vector class code

diff -r 70ba2b3b7bc9 -r 1752b4fce57e source/Lib/TLibCommon/TComBitStream.cpp
--- a/source/Lib/TLibCommon/TComBitStream.cpp   Tue Sep 24 16:15:10 2013 +0530
+++ b/source/Lib/TLibCommon/TComBitStream.cpp   Tue Sep 24 17:15:06 2013 +0530
@@ -208,27 +208,4 @@
 return cnt;
 }
 
-/**
- * insert the contents of the bytealigned (and flushed) bitstream src
- * into this at byte position pos.
- */
-void TComOutputBitstream::insertAt(const TComOutputBitstream src, UInt pos)
-{
-assert(0 == src.getNumberOfWrittenBits() % 8);
-
-vectoruint8_t::iterator at = this-m_fifo-begin() + pos;
-this-m_fifo-insert(at, src.m_fifo-begin(), src.m_fifo-end());
-}
-
-TComOutputBitstream TComOutputBitstream::operator =(const 
TComOutputBitstream src)
-{
-vectoruint8_t::iterator at = this-m_fifo-begin();
-this-m_fifo-insert(at, src.m_fifo-begin(), src.m_fifo-end());
-
-this-m_num_held_bits = src.m_num_held_bits;
-this-m_held_bits = src.m_held_bits;
-
-return *this;
-}
-
 //! \}
diff -r 70ba2b3b7bc9 -r 1752b4fce57e source/Lib/TLibCommon/TComBitStream.h
--- a/source/Lib/TLibCommon/TComBitStream.h Tue Sep 24 16:15:10 2013 +0530
+++ b/source/Lib/TLibCommon/TComBitStream.h Tue Sep 24 17:15:06 2013 +0530
@@ -142,16 +142,13 @@
  */
 UInt getNumberOfWrittenBits() const { return UInt(m_fifo-size()) * 8 + 
m_num_held_bits; }
 
-void insertAt(const TComOutputBitstream src, UInt pos);
-
-/**
+   /**
  * Return a reference to the internal fifo
  */
 std::vectoruint8_t getFIFO() { return *m_fifo; }
 
 UChar getHeldBits()  { return m_held_bits; }
 
-TComOutputBitstream operator =(const TComOutputBitstream src);
 /** Return a reference to the internal fifo */
 std::vectoruint8_t getFIFO() const { return *m_fifo; }
 
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] Encoder: do not use std::list for the class AccessUnit

2013-09-24 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1380019510 -19800
# Node ID 70ba2b3b7bc972ed04f5fd135d940e4759315fa8
# Parent  a8f6f62217d5e519f99a004c420e5906ac900f2f
Encoder: do not use std::list for the class AccessUnit

diff -r a8f6f62217d5 -r 70ba2b3b7bc9 source/Lib/TLibEncoder/TEncTop.cpp
--- a/source/Lib/TLibEncoder/TEncTop.cppTue Sep 24 14:22:02 2013 +0530
+++ b/source/Lib/TLibEncoder/TEncTop.cppTue Sep 24 16:15:10 2013 +0530
@@ -114,14 +114,16 @@
 for (int i = 0; i  param.frameNumThreads; i++)
 {
 // Ensure frame encoder is idle before destroying it
-AccessUnit tmp;
-m_frameEncoder[i].getEncodedPicture(tmp);
-for (AccessUnit::const_iterator it = tmp.begin(); it != tmp.end(); 
it++)
+NALUnitEBSP **nalunits = NULL;
+m_frameEncoder[i].getEncodedPicture(nalunits);
+if (nalunits)
 {
-const NALUnitEBSP nalu = **it;
-free(nalu.m_nalUnitData);
+for (int nalcount = 0; nalunits[nalcount] != NULL; nalcount++)
+{
+const NALUnitEBSP nalu = *nalunits[nalcount];
+free(nalu.m_nalUnitData);
+}
 }
-
 m_frameEncoder[i].destroy();
 }
 
@@ -161,9 +163,9 @@
 }
 }
 
-int TEncTop::getStreamHeaders(AccessUnit accessUnit)
+int TEncTop::getStreamHeaders(NALUnitEBSP **nalunits)
 {
-return m_frameEncoder-getStreamHeaders(accessUnit);
+return m_frameEncoder-getStreamHeaders(nalunits);
 }
 
 /**
@@ -173,7 +175,7 @@
  \param   accessUnitsOut  output bitstream
  \retval  number of encoded pictures
  */
-int TEncTop::encode(bool flush, const x265_picture_t* pic_in, x265_picture_t 
*pic_out, AccessUnit accessUnitOut)
+int TEncTop::encode(bool flush, const x265_picture_t* pic_in, x265_picture_t 
*pic_out, NALUnitEBSP **nalunits)
 {
 if (pic_in)
 {
@@ -213,7 +215,7 @@
 // getEncodedPicture() should block until the FrameEncoder has completed
 // encoding the frame.  This is how back-pressure through the API is
 // accomplished when the encoder is full.
-TComPic *out = curEncoder-getEncodedPicture(accessUnitOut);
+TComPic *out = curEncoder-getEncodedPicture(nalunits);
 
 if (!out  flush)
 {
@@ -227,7 +229,7 @@
 {
 curEncoder = m_frameEncoder[m_curEncoder];
 m_curEncoder = (m_curEncoder + 1) % param.frameNumThreads;
-out = curEncoder-getEncodedPicture(accessUnitOut);
+out = curEncoder-getEncodedPicture(nalunits);
 }
 while (!out  flushed != m_curEncoder);
 }
@@ -259,7 +261,7 @@
 pic_out-stride[2] = recpic-getCStride();
 }
 
-double bits = calculateHashAndPSNR(out, accessUnitOut);
+double bits = calculateHashAndPSNR(out, nalunits);
 // Allow this frame to be recycled if no frame encoders are using it 
for reference
 ATOMIC_DEC(out-m_countRefEncoders);
 
@@ -487,7 +489,7 @@
 
 /* Returns Number of bits in current encoded pic */
 
-double TEncTop::calculateHashAndPSNR(TComPic* pic, AccessUnit accessUnit)
+double TEncTop::calculateHashAndPSNR(TComPic* pic, NALUnitEBSP **nalunits)
 {
 TComPicYuv* recon = pic-getPicYuvRec();
 TComPicYuv* orig  = pic-getPicYuvOrg();
@@ -544,7 +546,10 @@
 m_frameEncoder-m_seiWriter.writeSEImessage(onalu.m_Bitstream, 
sei_recon_picture_digest, pic-getSlice()-getSPS());
 writeRBSPTrailingBits(onalu.m_Bitstream);
 
-accessUnit.insert(accessUnit.end(), new NALUnitEBSP(onalu));
+int count = 0;
+while(nalunits[count] != NULL)
+count++;
+nalunits[count]-init(onalu);
 }
 
 /* calculate the size of the access unit, excluding:
@@ -552,13 +557,14 @@
  *  - SEI NAL units
  */
 UInt numRBSPBytes = 0;
-for (AccessUnit::const_iterator it = accessUnit.begin(); it != 
accessUnit.end(); it++)
+int count = 0;
+for (;nalunits[count] != NULL; count++)
 {
-UInt numRBSPBytes_nal = (*it)-m_packetSize;
+UInt numRBSPBytes_nal = nalunits[count]-m_packetSize;
 #if VERBOSE_RATE
 printf(*** %6s numBytesInNALunit: %u\n, 
nalUnitTypeToString((*it)-m_nalUnitType), numRBSPBytes_nal);
 #endif
-if ((*it)-m_nalUnitType != NAL_UNIT_PREFIX_SEI  
(*it)-m_nalUnitType != NAL_UNIT_SUFFIX_SEI)
+if (nalunits[count]-m_nalUnitType != NAL_UNIT_PREFIX_SEI  
nalunits[count]-m_nalUnitType != NAL_UNIT_SUFFIX_SEI)
 {
 numRBSPBytes += numRBSPBytes_nal;
 }
diff -r a8f6f62217d5 -r 70ba2b3b7bc9 source/Lib/TLibEncoder/TEncTop.h
--- a/source/Lib/TLibEncoder/TEncTop.h  Tue Sep 24 14:22:02 2013 +0530
+++ b/source/Lib/TLibEncoder/TEncTop.h  Tue Sep 24 16:15:10 2013 +0530
@@ -101,9 +101,9 @@
 void xInitSPS(TComSPS *sps);
 void xInitPPS(TComPPS *pps);
 
-int encode(bool bEos, const

[x265] [PATCH] encoder: do not use std::list

2013-09-18 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1379491158 -19800
# Node ID 25182c943bfab1fde922c2b7f8f1b05a1c4b0fd6
# Parent  9d5d4e4e6d6ca312cb443f18fe6880127e5f6c75
encoder: do not use std::list

Removed std::list from encoder and nal

diff -r 9d5d4e4e6d6c -r 25182c943bfa source/Lib/TLibCommon/NAL.h
--- a/source/Lib/TLibCommon/NAL.h   Wed Sep 18 11:34:10 2013 +0530
+++ b/source/Lib/TLibCommon/NAL.h   Wed Sep 18 13:29:18 2013 +0530
@@ -114,6 +114,7 @@
  * emulation_prevention_three_byte symbols.
  */
 NALUnitEBSP(OutputNALUnit nalu);
+void init(OutputNALUnit nalu);
 };
 }
 //! \}
diff -r 9d5d4e4e6d6c -r 25182c943bfa source/Lib/TLibEncoder/NALwrite.cpp
--- a/source/Lib/TLibEncoder/NALwrite.cpp   Wed Sep 18 11:34:10 2013 +0530
+++ b/source/Lib/TLibEncoder/NALwrite.cpp   Wed Sep 18 13:29:18 2013 +0530
@@ -56,7 +56,7 @@
 void write(uint8_t* out, OutputNALUnit nalu, UInt packetSize)
 {
 packetSize = 0;
-
+
 TComOutputBitstream bsNALUHeader;
 bsNALUHeader.write(0, 1); // forbidden_zero_bit
 bsNALUHeader.write(nalu.m_nalUnitType, 6); // nal_unit_type
diff -r 9d5d4e4e6d6c -r 25182c943bfa source/Lib/TLibEncoder/NALwrite.h
--- a/source/Lib/TLibEncoder/NALwrite.h Wed Sep 18 11:34:10 2013 +0530
+++ b/source/Lib/TLibEncoder/NALwrite.h Wed Sep 18 13:29:18 2013 +0530
@@ -83,6 +83,14 @@
 write(m_nalUnitData, nalu, m_packetSize);
 }
 
+inline void NALUnitEBSP::init(OutputNALUnit nalu)
+{
+m_nalUnitType = nalu.m_nalUnitType;
+m_temporalId = nalu.m_temporalId;
+m_reservedZero6Bits = nalu.m_reservedZero6Bits;
+write(m_nalUnitData, nalu, m_packetSize);
+}
+
 void copyNaluData(OutputNALUnit naluDest, const OutputNALUnit naluSrc);
 }
 
diff -r 9d5d4e4e6d6c -r 25182c943bfa source/Lib/TLibEncoder/TEncTop.cpp
--- a/source/Lib/TLibEncoder/TEncTop.cppWed Sep 18 11:34:10 2013 +0530
+++ b/source/Lib/TLibEncoder/TEncTop.cppWed Sep 18 13:29:18 2013 +0530
@@ -113,7 +113,7 @@
 for (int i = 0; i  param.frameNumThreads; i++)
 {
 // Ensure frame encoder is idle before destroying it
-AccessUnit tmp;
+   NALUnitEBSP **tmp = NULL;
 m_frameEncoder[i].getEncodedPicture(tmp);
 m_frameEncoder[i].destroy();
 }
@@ -157,9 +157,9 @@
 }
 }
 
-int TEncTop::getStreamHeaders(AccessUnit accessUnit)
+int TEncTop::getStreamHeaders(NALUnitEBSP **nalunits)
 {
-return m_frameEncoder-getStreamHeaders(accessUnit);
+return m_frameEncoder-getStreamHeaders(nalunits);
 }
 
 /**
@@ -169,7 +169,7 @@
  \param   accessUnitsOut  output bitstream
  \retval  number of encoded pictures
  */
-int TEncTop::encode(bool flush, const x265_picture_t* pic_in, x265_picture_t 
*pic_out, AccessUnit accessUnitOut)
+int TEncTop::encode(bool flush, const x265_picture_t* pic_in, x265_picture_t 
*pic_out, NALUnitEBSP **nalunits)
 {
 if (pic_in)
 {
@@ -209,7 +209,7 @@
 // getEncodedPicture() should block until the FrameEncoder has completed
 // encoding the frame.  This is how back-pressure through the API is
 // accomplished when the encoder is full.
-TComPic *out = curEncoder-getEncodedPicture(accessUnitOut);
+TComPic *out = curEncoder-getEncodedPicture(nalunits);
 
 if (!out  flush)
 {
@@ -223,7 +223,7 @@
 {
 curEncoder = m_frameEncoder[m_curEncoder];
 m_curEncoder = (m_curEncoder + 1) % param.frameNumThreads;
-out = curEncoder-getEncodedPicture(accessUnitOut);
+out = curEncoder-getEncodedPicture(nalunits);
 }
 while (!out  flushed != m_curEncoder);
 }
@@ -255,7 +255,7 @@
 pic_out-stride[2] = recpic-getCStride();
 }
 
-double bits = calculateHashAndPSNR(out, accessUnitOut);
+double bits = calculateHashAndPSNR(out, nalunits);
 // Allow this frame to be recycled if no frame encoders are using it 
for reference
 ATOMIC_DEC(out-m_countRefEncoders);
 
@@ -483,7 +483,7 @@
 
 /* Returns Number of bits in current encoded pic */
 
-double TEncTop::calculateHashAndPSNR(TComPic* pic, AccessUnit accessUnit)
+double TEncTop::calculateHashAndPSNR(TComPic* pic, NALUnitEBSP **nalunits)
 {
 TComPicYuv* recon = pic-getPicYuvRec();
 TComPicYuv* orig  = pic-getPicYuvOrg();
@@ -540,7 +540,7 @@
 m_frameEncoder-m_seiWriter.writeSEImessage(onalu.m_Bitstream, 
sei_recon_picture_digest, pic-getSlice()-getSPS());
 writeRBSPTrailingBits(onalu.m_Bitstream);
 
-accessUnit.insert(accessUnit.end(), new NALUnitEBSP(onalu));
+//accessUnit.insert(accessUnit.end(), new NALUnitEBSP(onalu));
 }
 
 /* calculate the size of the access unit, excluding:
@@ -548,16 +548,18 @@
  *  - SEI NAL units
  */
 UInt numRBSPBytes = 0;
-for (AccessUnit::const_iterator it = accessUnit.begin(); it != 
accessUnit.end(); it++)
+int count = 0;
+while (nalunits[count

[x265] [PATCH] X265: header guards format Changed to X265_FILENAME_H

2013-09-16 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1379314396 -19800
# Node ID d09f36e4dc8b998a2ca42694fd1ce5cf04421eee
# Parent  6bab41a554b36133865fe3378964cb9e76c24ebd
X265: header guards format Changed to X265_FILENAME_H

Globally all the x265 header files header guards format changed into 
X265_FILENAME_H

diff -r 6bab41a554b3 -r d09f36e4dc8b source/Lib/TLibCommon/AccessUnit.h
--- a/source/Lib/TLibCommon/AccessUnit.hFri Sep 13 17:24:05 2013 +0530
+++ b/source/Lib/TLibCommon/AccessUnit.hMon Sep 16 12:23:16 2013 +0530
@@ -36,8 +36,8 @@
  \briefAccess Unit class (header)
  */
 
-#ifndef _ACCESS_UNIT_
-#define _ACCESS_UNIT_ 1
+#ifndef X265_ACCESSUNIT_H
+#define X265_ACCESSUNIT_H
 
 #include NAL.h
 #include list
@@ -74,4 +74,4 @@
 
 //! \}
 
-#endif // ifndef _ACCESS_UNIT_
+#endif // ifndef X265_ACCESSUNIT_H
diff -r 6bab41a554b3 -r d09f36e4dc8b source/Lib/TLibCommon/CommonDef.h
--- a/source/Lib/TLibCommon/CommonDef.h Fri Sep 13 17:24:05 2013 +0530
+++ b/source/Lib/TLibCommon/CommonDef.h Mon Sep 16 12:23:16 2013 +0530
@@ -35,8 +35,8 @@
 \briefDefines constants, macros and tool parameters
 */
 
-#ifndef __COMMONDEF__
-#define __COMMONDEF__
+#ifndef X265_COMMONDEF_H
+#define X265_COMMONDEF_H
 
 #include algorithm
 #include cstdlib
@@ -172,4 +172,4 @@
 
 //! \}
 
-#endif // end of #ifndef  __COMMONDEF__
+#endif // ifndef X265_COMMONDEF_H
diff -r 6bab41a554b3 -r d09f36e4dc8b source/Lib/TLibCommon/ContextModel.h
--- a/source/Lib/TLibCommon/ContextModel.h  Fri Sep 13 17:24:05 2013 +0530
+++ b/source/Lib/TLibCommon/ContextModel.h  Mon Sep 16 12:23:16 2013 +0530
@@ -35,8 +35,8 @@
 \briefcontext model class (header)
 */
 
-#ifndef __CONTEXT_MODEL__
-#define __CONTEXT_MODEL__
+#ifndef X265_CONTEXTMODEL_H
+#define X265_CONTEXTMODEL_H
 
 #include CommonDef.h
 
@@ -104,4 +104,4 @@
 }
 //! \}
 
-#endif // ifndef __CONTEXT_MODEL__
+#endif // ifndef X265_CONTEXTMODEL_H
diff -r 6bab41a554b3 -r d09f36e4dc8b 
source/Lib/TLibCommon/ContextModel3DBuffer.h
--- a/source/Lib/TLibCommon/ContextModel3DBuffer.h  Fri Sep 13 17:24:05 
2013 +0530
+++ b/source/Lib/TLibCommon/ContextModel3DBuffer.h  Mon Sep 16 12:23:16 
2013 +0530
@@ -35,8 +35,8 @@
 \briefcontext model 3D buffer class (header)
 */
 
-#ifndef _HM_CONTEXT_MODEL_3DBUFFER_H_
-#define _HM_CONTEXT_MODEL_3DBUFFER_H_
+#ifndef X265_CONTEXTMODEL3DBUFFER_H
+#define X265_CONTEXTMODEL3DBUFFER_H
 
 #include stdio.h
 #include assert.h
@@ -106,4 +106,4 @@
 }
 //! \}
 
-#endif // _HM_CONTEXT_MODEL_3DBUFFER_H_
+#endif // ifndef X265_CONTEXTMODEL3DBUFFER_H
diff -r 6bab41a554b3 -r d09f36e4dc8b source/Lib/TLibCommon/ContextTables.h
--- a/source/Lib/TLibCommon/ContextTables.h Fri Sep 13 17:24:05 2013 +0530
+++ b/source/Lib/TLibCommon/ContextTables.h Mon Sep 16 12:23:16 2013 +0530
@@ -36,8 +36,8 @@
 \todo number of context models is not matched to actual use, should be 
fixed
 */
 
-#ifndef __CONTEXTTABLES__
-#define __CONTEXTTABLES__
+#ifndef X265_CONTEXTTABLES_H
+#define X265_CONTEXTTABLES_H
 
 //! \ingroup TLibCommon
 //! \{
@@ -320,4 +320,4 @@
 }
 //! \}
 
-#endif // ifndef __CONTEXTTABLES__
+#endif // ifndef X265_CONTEXTTABLES_H
diff -r 6bab41a554b3 -r d09f36e4dc8b source/Lib/TLibCommon/NAL.h
--- a/source/Lib/TLibCommon/NAL.h   Fri Sep 13 17:24:05 2013 +0530
+++ b/source/Lib/TLibCommon/NAL.h   Mon Sep 16 12:23:16 2013 +0530
@@ -31,8 +31,8 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef _NAL_
-#define _NAL_ 1
+#ifndef X265_NAL_H
+#define X265_NAL_H
 
 #include CommonDef.h
 #include x265.h
@@ -118,4 +118,4 @@
 }
 //! \}
 
-#endif // ifndef _NAL_
+#endif // ifndef X265_NAL_H
diff -r 6bab41a554b3 -r d09f36e4dc8b source/Lib/TLibCommon/SEI.h
--- a/source/Lib/TLibCommon/SEI.h   Fri Sep 13 17:24:05 2013 +0530
+++ b/source/Lib/TLibCommon/SEI.h   Mon Sep 16 12:23:16 2013 +0530
@@ -31,8 +31,8 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef _SEI_
-#define _SEI_ 1
+#ifndef X265_SEI_H
+#define X265_SEI_H
 
 #include list
 #include vector
@@ -309,4 +309,4 @@
 }
 //! \}
 
-#endif // ifndef _SEI_
+#endif // ifndef X265_SEI_H
diff -r 6bab41a554b3 -r d09f36e4dc8b source/Lib/TLibCommon/TComBitCounter.h
--- a/source/Lib/TLibCommon/TComBitCounter.hFri Sep 13 17:24:05 2013 +0530
+++ b/source/Lib/TLibCommon/TComBitCounter.hMon Sep 16 12:23:16 2013 +0530
@@ -35,8 +35,8 @@
 \briefClass for counting bits (header)
 */
 
-#ifndef __COMBITCOUNTER__
-#define __COMBITCOUNTER__
+#ifndef X265_COMBITCOUNTER_H
+#define X265_COMBITCOUNTER_H
 
 #include TComBitStream.h
 
@@ -72,4 +72,4 @@
 }
 //! \}
 
-#endif // ifndef __COMBITCOUNTER__
+#endif // ifndef X265_COMBITCOUNTER_H
diff -r 6bab41a554b3 -r d09f36e4dc8b source/Lib/TLibCommon/TComBitStream.h
--- a/source/Lib/TLibCommon/TComBitStream.h Fri Sep 13 17:24:05 2013 +0530
+++ b/source/Lib/TLibCommon/TComBitStream.h Mon Sep 16 12:23:16 2013 +0530
@@ -35,8 +35,8 @@
 \briefclass for handling bitstream (header

[x265] [PATCH] List: std::list Implementation

2013-09-16 Thread Gopu Govindaswamy
# HG changeset patch
# User Gopu Govindaswamy g...@multicorewareinc.com
# Date 1379327475 -19800
# Node ID e499466c7c6591345af2a625da12185c7735347b
# Parent  6bab41a554b36133865fe3378964cb9e76c24ebd
List: std::list Implementation

To remove the std::list dependency from X265,  and this class can be enhanced 
based on the types of std::list API's used in current x265

diff -r 6bab41a554b3 -r e499466c7c65 source/common/CMakeLists.txt
--- a/source/common/CMakeLists.txt  Fri Sep 13 17:24:05 2013 +0530
+++ b/source/common/CMakeLists.txt  Mon Sep 16 16:01:15 2013 +0530
@@ -16,8 +16,10 @@
 
 file(GLOB LIBCOMMON_HDR ../Lib/TLibCommon/*.h)
 file(GLOB LIBCOMMON_SRC ../Lib/TLibCommon/*.cpp)
+file(GLOB LIBUTIL ../util/*.cpp ../util/*.h)
 source_group(TLibCommon FILES ${LIBCOMMON_SRC})
 source_group(TLibCommonH FILES ${LIBCOMMON_HDR})
+source_group(Util FILES ${LIBUTIL})
 if(GCC)
 set_source_files_properties(${LIBCOMMON_SRC} PROPERTIES COMPILE_FLAGS 
 -Wno-sign-compare)
@@ -38,7 +40,7 @@
 endif(MSVC)
 
 add_library(common STATIC ../../COPYING
-${LIBCOMMON_SRC} ${LIBCOMMON_HDR}
+${LIBCOMMON_SRC} ${LIBCOMMON_HDR} ${LIBUTIL}
 primitives.cpp primitives.h
 pixel.cpp dct.cpp ipfilter.cpp intrapred.cpp
 ../VectorClass/instrset_detect.cpp
diff -r 6bab41a554b3 -r e499466c7c65 source/util/list.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +
+++ b/source/util/list.hMon Sep 16 16:01:15 2013 +0530
@@ -0,0 +1,158 @@
+/*
+ * Copyright (C) 2013 x265 project
+ *
+ * Authors: Gopu Govindaswamy g...@multicorewareinc.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111, USA.
+ *
+ * This program is also available under a commercial proprietary license.
+ * For more information, contact us at licens...@multicorewareinc.com.
+ */
+
+#ifndef X265_LIST_H
+#define X265_LIST_H
+
+#include common.h
+
+// Short Notes: 
+// Under development
+// this class is used to remove the std::list dependency from x265, 
+// Providing Minimum std::list API implementation
+// this class can be enhanced based on types of std::list API's used in 
current x265
+
+templateclass T
+struct List
+{
+private:
+
+struct Node
+{
+T object;
+Node* next;
+};
+
+public:
+
+Node* head;
+Node* tail;
+int size;
+
+List() { head = 0; size = 0; }
+
+inline T* begin() { return head; }
+
+inline T* end() { return tail; }
+
+inline bool isEmpty()
+{
+if (head == NULL)
+return true;
+else
+return false;
+}
+
+inline void push_back(T value)
+{
+if (head == NULL)
+{
+head = (Node*)X265_MALLOC(Node, sizeof(Node));
+head-object = value;
+head-next = NULL;
+tail = head;
+}
+else
+{
+Node *nodePtr = tail;
+nodePtr-next = (Node*)X265_MALLOC(Node, sizeof(Node));
+nodePtr-next-object = value;
+nodePtr-next-next = NULL;
+tail = nodePtr-next;
+}
+size += 1;
+}
+
+inline void push_front(T value)
+{
+if (head == NULL)
+{
+head = (Node*)X265_MALLOC(Node, sizeof(Node));
+head-object = value;
+head-next = NULL;
+tail = head;
+}
+else
+{
+Node *front;
+front = (Node*)X265_MALLOC(Node, sizeof(Node));
+front-object = value;
+front-next = head;
+head = front;
+}
+size += 1;
+}
+
+inline void pop_front()
+{
+if (head != NULL)
+{
+if (head-next == NULL)
+X265_FREE(head);
+else
+{
+Node *temp = head-next;
+X265_FREE(head);
+head = temp;
+}
+size -= 1;
+}
+}
+
+inline void pop_back()
+{
+if (head != NULL)
+{
+if (head-next == NULL)
+X265_FREE(head);
+else
+{
+Node *ptr = head, *ptr1 = NULL;
+while (ptr-next != NULL