Re: [x265] [PATCH] analysis: use AVC CU analysis-info for HEVC mode analysis

2017-11-20 Thread Ashok Kumar Mishra
On Mon, Nov 20, 2017 at 12:53 PM, Ashok Kumar Mishra <
as...@multicorewareinc.com> wrote:

>
>
> On Mon, Nov 20, 2017 at 11:01 AM, Pradeep Ramachandran <
> prad...@multicorewareinc.com> wrote:
>
>>
>> On Fri, Nov 17, 2017 at 7:23 PM,  wrote:
>>
>>> # HG changeset patch
>>> # User Praveen Tiwari 
>>> # Date 1510926794 -19800
>>> #  Fri Nov 17 19:23:14 2017 +0530
>>> # Node ID 6b248ccb14169d2b0d5b84d50d94a153bd8f3b4f
>>> # Parent  9723e8812e63ce51e38ede41f7d5edf73cad0849
>>> analysis: use AVC CU analysis-info for HEVC mode analysis
>>>
>>
>> Pushed to default. Thanks!
>>
>>
>>>
>>> This patch work implements the functionality for anlysis-reuselevel 7,
>>> here we want
>>> to use AVC analysis-info for HEVC mode decision and use the depth from
>>> offload
>>> for AVC sizes
>>>
>>> diff -r 9723e8812e63 -r 6b248ccb1416 source/common/cudata.cpp
>>> --- a/source/common/cudata.cpp  Fri Nov 17 14:16:31 2017 +0530
>>> +++ b/source/common/cudata.cpp  Fri Nov 17 19:23:14 2017 +0530
>>> @@ -201,6 +201,8 @@
>>>  m_cuDepth= charBuf; charBuf += m_numPartitions;
>>>  m_predMode   = charBuf; charBuf += m_numPartitions; /*
>>> the order up to here is important in initCTU() and initSubCU() */
>>>  m_partSize   = charBuf; charBuf += m_numPartitions;
>>> +m_skipFlag[0]= charBuf; charBuf += m_numPartitions;
>>> +m_skipFlag[1]= charBuf; charBuf += m_numPartitions;
>>>  m_mergeFlag  = charBuf; charBuf += m_numPartitions;
>>>  m_interDir   = charBuf; charBuf += m_numPartitions;
>>>  m_mvpIdx[0]  = charBuf; charBuf += m_numPartitions;
>>> @@ -239,6 +241,8 @@
>>>  m_cuDepth= charBuf; charBuf += m_numPartitions;
>>>  m_predMode   = charBuf; charBuf += m_numPartitions; /*
>>> the order up to here is important in initCTU() and initSubCU() */
>>>  m_partSize   = charBuf; charBuf += m_numPartitions;
>>> +m_skipFlag[0]= charBuf; charBuf += m_numPartitions;
>>> +m_skipFlag[1]= charBuf; charBuf += m_numPartitions;
>>>  m_mergeFlag  = charBuf; charBuf += m_numPartitions;
>>>  m_interDir   = charBuf; charBuf += m_numPartitions;
>>>  m_mvpIdx[0]  = charBuf; charBuf += m_numPartitions;
>>> diff -r 9723e8812e63 -r 6b248ccb1416 source/common/cudata.h
>>> --- a/source/common/cudata.hFri Nov 17 14:16:31 2017 +0530
>>> +++ b/source/common/cudata.hFri Nov 17 19:23:14 2017 +0530
>>> @@ -199,13 +199,14 @@
>>>  uint8_t*  m_predMode; // array of prediction modes
>>>  uint8_t*  m_partSize; // array of partition sizes
>>>  uint8_t*  m_mergeFlag;// array of merge flags
>>> +uint8_t*  m_skipFlag[2];
>>>  uint8_t*  m_interDir; // array of inter directions
>>>  uint8_t*  m_mvpIdx[2];// array of motion vector
>>> predictor candidates or merge candidate indices [0]
>>>  uint8_t*  m_tuDepth;  // array of transform indices
>>>  uint8_t*  m_transformSkip[3]; // array of transform skipping
>>> flags per plane
>>>  uint8_t*  m_cbf[3];   // array of coded block flags
>>> (CBF) per plane
>>>  uint8_t*  m_chromaIntraDir;   // array of intra directions
>>> (chroma)
>>> -enum { BytesPerPartition = 21 };  // combined sizeof() of all
>>> per-part data
>>> +enum { BytesPerPartition = 23 };  // combined sizeof() of all
>>> per-part data
>>>
>>>  sse_t*m_distortion;
>>>  coeff_t*  m_trCoeff[3];   // transformed coefficient buffer
>>> per plane
>>> diff -r 9723e8812e63 -r 6b248ccb1416 source/common/framedata.h
>>> --- a/source/common/framedata.h Fri Nov 17 14:16:31 2017 +0530
>>> +++ b/source/common/framedata.h Fri Nov 17 19:23:14 2017 +0530
>>> @@ -195,6 +195,7 @@
>>>  uint8_t*mvpIdx[2];
>>>  int8_t* refIdx[2];
>>>  MV* mv[2];
>>> +   int64_t* sadCost;
>>>  };
>>>
>>>  struct analysis2PassFrameData
>>> diff -r 9723e8812e63 -r 6b248ccb1416 source/encoder/analysis.cpp
>>> --- a/source/encoder/analysis.cpp   Fri Nov 17 14:16:31 2017 +0530
>>> +++ b/source/encoder/analysis.cpp   Fri Nov 17 19:23:14 2017 +0530
>>> @@ -75,6 +75,10 @@
>>>  m_reuseInterDataCTU = NULL;
>>>  m_reuseRef = NULL;
>>>  m_bHD = false;
>>> +m_modeFlag[0] = false;
>>> +m_modeFlag[1] = false;
>>> +m_checkMergeAndSkipOnly[0] = false;
>>> +m_checkMergeAndSkipOnly[1] = false;
>>>  m_evaluateInter = 0;
>>>  }
>>>
>>> @@ -247,6 +251,9 @@
>>>  memcpy(ctu.m_cuDepth, >depth[posCTU],
>>> sizeof(uint8_t) * numPartition);
>>>  memcpy(ctu.m_predMode, >modes[posCTU],
>>> sizeof(uint8_t) * numPartition);
>>>  memcpy(ctu.m_partSize, >partSize[posCTU],
>>> sizeof(uint8_t) * numPartition);
>>> +for (int list = 0; 

Re: [x265] [PATCH] analysis: use AVC CU analysis-info for HEVC mode analysis

2017-11-19 Thread Ashok Kumar Mishra
On Mon, Nov 20, 2017 at 11:01 AM, Pradeep Ramachandran <
prad...@multicorewareinc.com> wrote:

>
> On Fri, Nov 17, 2017 at 7:23 PM,  wrote:
>
>> # HG changeset patch
>> # User Praveen Tiwari 
>> # Date 1510926794 -19800
>> #  Fri Nov 17 19:23:14 2017 +0530
>> # Node ID 6b248ccb14169d2b0d5b84d50d94a153bd8f3b4f
>> # Parent  9723e8812e63ce51e38ede41f7d5edf73cad0849
>> analysis: use AVC CU analysis-info for HEVC mode analysis
>>
>
> Pushed to default. Thanks!
>
>
>>
>> This patch work implements the functionality for anlysis-reuselevel 7,
>> here we want
>> to use AVC analysis-info for HEVC mode decision and use the depth from
>> offload
>> for AVC sizes
>>
>> diff -r 9723e8812e63 -r 6b248ccb1416 source/common/cudata.cpp
>> --- a/source/common/cudata.cpp  Fri Nov 17 14:16:31 2017 +0530
>> +++ b/source/common/cudata.cpp  Fri Nov 17 19:23:14 2017 +0530
>> @@ -201,6 +201,8 @@
>>  m_cuDepth= charBuf; charBuf += m_numPartitions;
>>  m_predMode   = charBuf; charBuf += m_numPartitions; /*
>> the order up to here is important in initCTU() and initSubCU() */
>>  m_partSize   = charBuf; charBuf += m_numPartitions;
>> +m_skipFlag[0]= charBuf; charBuf += m_numPartitions;
>> +m_skipFlag[1]= charBuf; charBuf += m_numPartitions;
>>  m_mergeFlag  = charBuf; charBuf += m_numPartitions;
>>  m_interDir   = charBuf; charBuf += m_numPartitions;
>>  m_mvpIdx[0]  = charBuf; charBuf += m_numPartitions;
>> @@ -239,6 +241,8 @@
>>  m_cuDepth= charBuf; charBuf += m_numPartitions;
>>  m_predMode   = charBuf; charBuf += m_numPartitions; /*
>> the order up to here is important in initCTU() and initSubCU() */
>>  m_partSize   = charBuf; charBuf += m_numPartitions;
>> +m_skipFlag[0]= charBuf; charBuf += m_numPartitions;
>> +m_skipFlag[1]= charBuf; charBuf += m_numPartitions;
>>  m_mergeFlag  = charBuf; charBuf += m_numPartitions;
>>  m_interDir   = charBuf; charBuf += m_numPartitions;
>>  m_mvpIdx[0]  = charBuf; charBuf += m_numPartitions;
>> diff -r 9723e8812e63 -r 6b248ccb1416 source/common/cudata.h
>> --- a/source/common/cudata.hFri Nov 17 14:16:31 2017 +0530
>> +++ b/source/common/cudata.hFri Nov 17 19:23:14 2017 +0530
>> @@ -199,13 +199,14 @@
>>  uint8_t*  m_predMode; // array of prediction modes
>>  uint8_t*  m_partSize; // array of partition sizes
>>  uint8_t*  m_mergeFlag;// array of merge flags
>> +uint8_t*  m_skipFlag[2];
>>  uint8_t*  m_interDir; // array of inter directions
>>  uint8_t*  m_mvpIdx[2];// array of motion vector
>> predictor candidates or merge candidate indices [0]
>>  uint8_t*  m_tuDepth;  // array of transform indices
>>  uint8_t*  m_transformSkip[3]; // array of transform skipping
>> flags per plane
>>  uint8_t*  m_cbf[3];   // array of coded block flags
>> (CBF) per plane
>>  uint8_t*  m_chromaIntraDir;   // array of intra directions
>> (chroma)
>> -enum { BytesPerPartition = 21 };  // combined sizeof() of all
>> per-part data
>> +enum { BytesPerPartition = 23 };  // combined sizeof() of all
>> per-part data
>>
>>  sse_t*m_distortion;
>>  coeff_t*  m_trCoeff[3];   // transformed coefficient buffer
>> per plane
>> diff -r 9723e8812e63 -r 6b248ccb1416 source/common/framedata.h
>> --- a/source/common/framedata.h Fri Nov 17 14:16:31 2017 +0530
>> +++ b/source/common/framedata.h Fri Nov 17 19:23:14 2017 +0530
>> @@ -195,6 +195,7 @@
>>  uint8_t*mvpIdx[2];
>>  int8_t* refIdx[2];
>>  MV* mv[2];
>> +   int64_t* sadCost;
>>  };
>>
>>  struct analysis2PassFrameData
>> diff -r 9723e8812e63 -r 6b248ccb1416 source/encoder/analysis.cpp
>> --- a/source/encoder/analysis.cpp   Fri Nov 17 14:16:31 2017 +0530
>> +++ b/source/encoder/analysis.cpp   Fri Nov 17 19:23:14 2017 +0530
>> @@ -75,6 +75,10 @@
>>  m_reuseInterDataCTU = NULL;
>>  m_reuseRef = NULL;
>>  m_bHD = false;
>> +m_modeFlag[0] = false;
>> +m_modeFlag[1] = false;
>> +m_checkMergeAndSkipOnly[0] = false;
>> +m_checkMergeAndSkipOnly[1] = false;
>>  m_evaluateInter = 0;
>>  }
>>
>> @@ -247,6 +251,9 @@
>>  memcpy(ctu.m_cuDepth, >depth[posCTU],
>> sizeof(uint8_t) * numPartition);
>>  memcpy(ctu.m_predMode, >modes[posCTU],
>> sizeof(uint8_t) * numPartition);
>>  memcpy(ctu.m_partSize, >partSize[posCTU],
>> sizeof(uint8_t) * numPartition);
>> +for (int list = 0; list < m_slice->isInterB() + 1; list++)
>> +memcpy(ctu.m_skipFlag[list],
>> _frame->m_analysisData.modeFlag[list][posCTU], sizeof(uint8_t) *
>> numPartition);
>> +
>>  if 

Re: [x265] [PATCH] analysis: use AVC CU analysis-info for HEVC mode analysis

2017-11-19 Thread Pradeep Ramachandran
On Fri, Nov 17, 2017 at 7:23 PM,  wrote:

> # HG changeset patch
> # User Praveen Tiwari 
> # Date 1510926794 -19800
> #  Fri Nov 17 19:23:14 2017 +0530
> # Node ID 6b248ccb14169d2b0d5b84d50d94a153bd8f3b4f
> # Parent  9723e8812e63ce51e38ede41f7d5edf73cad0849
> analysis: use AVC CU analysis-info for HEVC mode analysis
>

Pushed to default. Thanks!


>
> This patch work implements the functionality for anlysis-reuselevel 7,
> here we want
> to use AVC analysis-info for HEVC mode decision and use the depth from
> offload
> for AVC sizes
>
> diff -r 9723e8812e63 -r 6b248ccb1416 source/common/cudata.cpp
> --- a/source/common/cudata.cpp  Fri Nov 17 14:16:31 2017 +0530
> +++ b/source/common/cudata.cpp  Fri Nov 17 19:23:14 2017 +0530
> @@ -201,6 +201,8 @@
>  m_cuDepth= charBuf; charBuf += m_numPartitions;
>  m_predMode   = charBuf; charBuf += m_numPartitions; /*
> the order up to here is important in initCTU() and initSubCU() */
>  m_partSize   = charBuf; charBuf += m_numPartitions;
> +m_skipFlag[0]= charBuf; charBuf += m_numPartitions;
> +m_skipFlag[1]= charBuf; charBuf += m_numPartitions;
>  m_mergeFlag  = charBuf; charBuf += m_numPartitions;
>  m_interDir   = charBuf; charBuf += m_numPartitions;
>  m_mvpIdx[0]  = charBuf; charBuf += m_numPartitions;
> @@ -239,6 +241,8 @@
>  m_cuDepth= charBuf; charBuf += m_numPartitions;
>  m_predMode   = charBuf; charBuf += m_numPartitions; /*
> the order up to here is important in initCTU() and initSubCU() */
>  m_partSize   = charBuf; charBuf += m_numPartitions;
> +m_skipFlag[0]= charBuf; charBuf += m_numPartitions;
> +m_skipFlag[1]= charBuf; charBuf += m_numPartitions;
>  m_mergeFlag  = charBuf; charBuf += m_numPartitions;
>  m_interDir   = charBuf; charBuf += m_numPartitions;
>  m_mvpIdx[0]  = charBuf; charBuf += m_numPartitions;
> diff -r 9723e8812e63 -r 6b248ccb1416 source/common/cudata.h
> --- a/source/common/cudata.hFri Nov 17 14:16:31 2017 +0530
> +++ b/source/common/cudata.hFri Nov 17 19:23:14 2017 +0530
> @@ -199,13 +199,14 @@
>  uint8_t*  m_predMode; // array of prediction modes
>  uint8_t*  m_partSize; // array of partition sizes
>  uint8_t*  m_mergeFlag;// array of merge flags
> +uint8_t*  m_skipFlag[2];
>  uint8_t*  m_interDir; // array of inter directions
>  uint8_t*  m_mvpIdx[2];// array of motion vector predictor
> candidates or merge candidate indices [0]
>  uint8_t*  m_tuDepth;  // array of transform indices
>  uint8_t*  m_transformSkip[3]; // array of transform skipping
> flags per plane
>  uint8_t*  m_cbf[3];   // array of coded block flags (CBF)
> per plane
>  uint8_t*  m_chromaIntraDir;   // array of intra directions
> (chroma)
> -enum { BytesPerPartition = 21 };  // combined sizeof() of all
> per-part data
> +enum { BytesPerPartition = 23 };  // combined sizeof() of all
> per-part data
>
>  sse_t*m_distortion;
>  coeff_t*  m_trCoeff[3];   // transformed coefficient buffer
> per plane
> diff -r 9723e8812e63 -r 6b248ccb1416 source/common/framedata.h
> --- a/source/common/framedata.h Fri Nov 17 14:16:31 2017 +0530
> +++ b/source/common/framedata.h Fri Nov 17 19:23:14 2017 +0530
> @@ -195,6 +195,7 @@
>  uint8_t*mvpIdx[2];
>  int8_t* refIdx[2];
>  MV* mv[2];
> +   int64_t* sadCost;
>  };
>
>  struct analysis2PassFrameData
> diff -r 9723e8812e63 -r 6b248ccb1416 source/encoder/analysis.cpp
> --- a/source/encoder/analysis.cpp   Fri Nov 17 14:16:31 2017 +0530
> +++ b/source/encoder/analysis.cpp   Fri Nov 17 19:23:14 2017 +0530
> @@ -75,6 +75,10 @@
>  m_reuseInterDataCTU = NULL;
>  m_reuseRef = NULL;
>  m_bHD = false;
> +m_modeFlag[0] = false;
> +m_modeFlag[1] = false;
> +m_checkMergeAndSkipOnly[0] = false;
> +m_checkMergeAndSkipOnly[1] = false;
>  m_evaluateInter = 0;
>  }
>
> @@ -247,6 +251,9 @@
>  memcpy(ctu.m_cuDepth, >depth[posCTU],
> sizeof(uint8_t) * numPartition);
>  memcpy(ctu.m_predMode, >modes[posCTU],
> sizeof(uint8_t) * numPartition);
>  memcpy(ctu.m_partSize, >partSize[posCTU],
> sizeof(uint8_t) * numPartition);
> +for (int list = 0; list < m_slice->isInterB() + 1; list++)
> +memcpy(ctu.m_skipFlag[list], 
> _frame->m_analysisData.modeFlag[list][posCTU],
> sizeof(uint8_t) * numPartition);
> +
>  if ((m_slice->m_sliceType == P_SLICE ||
> m_param->bIntraInBFrames) && !m_param->bMVType)
>  {
>  analysis_intra_data* intraDataCTU =
> 

[x265] [PATCH] analysis: use AVC CU analysis-info for HEVC mode analysis

2017-11-17 Thread praveen
# HG changeset patch
# User Praveen Tiwari 
# Date 1510926794 -19800
#  Fri Nov 17 19:23:14 2017 +0530
# Node ID 6b248ccb14169d2b0d5b84d50d94a153bd8f3b4f
# Parent  9723e8812e63ce51e38ede41f7d5edf73cad0849
analysis: use AVC CU analysis-info for HEVC mode analysis

This patch work implements the functionality for anlysis-reuselevel 7, here we 
want
to use AVC analysis-info for HEVC mode decision and use the depth from offload
for AVC sizes

diff -r 9723e8812e63 -r 6b248ccb1416 source/common/cudata.cpp
--- a/source/common/cudata.cpp  Fri Nov 17 14:16:31 2017 +0530
+++ b/source/common/cudata.cpp  Fri Nov 17 19:23:14 2017 +0530
@@ -201,6 +201,8 @@
 m_cuDepth= charBuf; charBuf += m_numPartitions;
 m_predMode   = charBuf; charBuf += m_numPartitions; /* the 
order up to here is important in initCTU() and initSubCU() */
 m_partSize   = charBuf; charBuf += m_numPartitions;
+m_skipFlag[0]= charBuf; charBuf += m_numPartitions;
+m_skipFlag[1]= charBuf; charBuf += m_numPartitions;
 m_mergeFlag  = charBuf; charBuf += m_numPartitions;
 m_interDir   = charBuf; charBuf += m_numPartitions;
 m_mvpIdx[0]  = charBuf; charBuf += m_numPartitions;
@@ -239,6 +241,8 @@
 m_cuDepth= charBuf; charBuf += m_numPartitions;
 m_predMode   = charBuf; charBuf += m_numPartitions; /* the 
order up to here is important in initCTU() and initSubCU() */
 m_partSize   = charBuf; charBuf += m_numPartitions;
+m_skipFlag[0]= charBuf; charBuf += m_numPartitions;
+m_skipFlag[1]= charBuf; charBuf += m_numPartitions;
 m_mergeFlag  = charBuf; charBuf += m_numPartitions;
 m_interDir   = charBuf; charBuf += m_numPartitions;
 m_mvpIdx[0]  = charBuf; charBuf += m_numPartitions;
diff -r 9723e8812e63 -r 6b248ccb1416 source/common/cudata.h
--- a/source/common/cudata.hFri Nov 17 14:16:31 2017 +0530
+++ b/source/common/cudata.hFri Nov 17 19:23:14 2017 +0530
@@ -199,13 +199,14 @@
 uint8_t*  m_predMode; // array of prediction modes
 uint8_t*  m_partSize; // array of partition sizes
 uint8_t*  m_mergeFlag;// array of merge flags
+uint8_t*  m_skipFlag[2];
 uint8_t*  m_interDir; // array of inter directions
 uint8_t*  m_mvpIdx[2];// array of motion vector predictor 
candidates or merge candidate indices [0]
 uint8_t*  m_tuDepth;  // array of transform indices
 uint8_t*  m_transformSkip[3]; // array of transform skipping flags per 
plane
 uint8_t*  m_cbf[3];   // array of coded block flags (CBF) per 
plane
 uint8_t*  m_chromaIntraDir;   // array of intra directions (chroma)
-enum { BytesPerPartition = 21 };  // combined sizeof() of all per-part data
+enum { BytesPerPartition = 23 };  // combined sizeof() of all per-part data
 
 sse_t*m_distortion;
 coeff_t*  m_trCoeff[3];   // transformed coefficient buffer per 
plane
diff -r 9723e8812e63 -r 6b248ccb1416 source/common/framedata.h
--- a/source/common/framedata.h Fri Nov 17 14:16:31 2017 +0530
+++ b/source/common/framedata.h Fri Nov 17 19:23:14 2017 +0530
@@ -195,6 +195,7 @@
 uint8_t*mvpIdx[2];
 int8_t* refIdx[2];
 MV* mv[2];
+   int64_t* sadCost;
 };
 
 struct analysis2PassFrameData
diff -r 9723e8812e63 -r 6b248ccb1416 source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp   Fri Nov 17 14:16:31 2017 +0530
+++ b/source/encoder/analysis.cpp   Fri Nov 17 19:23:14 2017 +0530
@@ -75,6 +75,10 @@
 m_reuseInterDataCTU = NULL;
 m_reuseRef = NULL;
 m_bHD = false;
+m_modeFlag[0] = false;
+m_modeFlag[1] = false;
+m_checkMergeAndSkipOnly[0] = false;
+m_checkMergeAndSkipOnly[1] = false;
 m_evaluateInter = 0;
 }
 
@@ -247,6 +251,9 @@
 memcpy(ctu.m_cuDepth, >depth[posCTU], 
sizeof(uint8_t) * numPartition);
 memcpy(ctu.m_predMode, >modes[posCTU], 
sizeof(uint8_t) * numPartition);
 memcpy(ctu.m_partSize, >partSize[posCTU], 
sizeof(uint8_t) * numPartition);
+for (int list = 0; list < m_slice->isInterB() + 1; list++)
+memcpy(ctu.m_skipFlag[list], 
_frame->m_analysisData.modeFlag[list][posCTU], sizeof(uint8_t) * 
numPartition);
+
 if ((m_slice->m_sliceType == P_SLICE || m_param->bIntraInBFrames) 
&& !m_param->bMVType)
 {
 analysis_intra_data* intraDataCTU = 
(analysis_intra_data*)m_frame->m_analysisData.intraData;
@@ -1162,7 +1169,11 @@
 PicYuv& reconPic = *m_frame->m_reconPic;
 SplitData splitCUData;
 
-if ((m_param->bMVType && cuGeom.numPartitions > 16) || !m_param->bMVType)
+bool bHEVCBlockAnalysis = (m_param->bMVType && cuGeom.numPartitions > 16);
+bool bRefineAVCAnalysis =