Re: [x265] x265 patch(Store commonly-used RPS in SPS)

2016-10-25 Thread Zheng Wang
Hi, Pradeep,

I have resend the patch to x265 mail list by using a new email "
ayacc...@163.com" and sending patch with ubuntu(china's network has many
problems when connected to foreign), and this time i have test download the
patch and import it, it work well.
Please check it again.


2016-10-25 12:06 GMT+08:00 Pradeep Ramachandran <
prad...@multicorewareinc.com>:

> Thanks Zheng. Interestingly this worked from clipboard but when I went to
> patchwork to download the patch (https://patches.videolan.org/
> project/x265-devel/list/), it didn't work.
> Pradeep.
>
> On Tue, Oct 25, 2016 at 8:39 AM, Zheng Wang <zh...@multicorewareinc.com>
> wrote:
>
>> Hi Pradeep,
>>
>> I have check the x265 code, and now i can pull the newlist code version
>> is "(0e9e52640546) limitTU: fix energy calculation used in limiting TU
>> recursion …"
>> My patch is base on this:
>> # Node ID 19d3c5ea8bc10d3728ba2ae06190d188fe6093a3
>> # Parent  0e9e5264054606a38a3fe6c87272a1737b340b1a
>> Store commonly-used RPS in SPS  in 2 pass mode.
>>
>> I also try to import my patch base on version "(0e9e52640546)“, it
>> success by "Import from Clipboard" using TortoiseHg.
>>
>> If there are some problem, please tell me the detailed info about it.
>>
>>
>> 2016-10-24 19:33 GMT+08:00 Pradeep Ramachandran <
>> prad...@multicorewareinc.com>:
>>
>>> This patch doesn't apply at current x265 tip. Please fix and resend.
>>> Pradeep.
>>>
>>> On Mon, Oct 24, 2016 at 12:27 PM, Zheng Wang <zh...@multicorewareinc.com
>>> > wrote:
>>>
>>>> # HG changeset patch
>>>> # User ZhengWang <zh...@multicorewareinc.com>
>>>> # Date 1477292081 -28800
>>>> #  Mon Oct 24 14:54:41 2016 +0800
>>>> # Node ID 19d3c5ea8bc10d3728ba2ae06190d188fe6093a3
>>>> # Parent  0e9e5264054606a38a3fe6c87272a1737b340b1a
>>>> Store commonly-used RPS in SPS  in 2 pass mode.
>>>> Add new param --[no]-multi-pass-opt-rps to control it, default disabled.
>>>>
>>>> diff -r 0e9e52640546 -r 19d3c5ea8bc1 doc/reST/cli.rst
>>>> --- a/doc/reST/cli.rst Wed Oct 12 17:58:49 2016 +0530
>>>> +++ b/doc/reST/cli.rst Mon Oct 24 14:54:41 2016 +0800
>>>> @@ -1852,6 +1852,10 @@
>>>>   Discard optional VUI HRD info from bitstream. Default enabled when
>>>>   :option:`--hrd` is enabled.
>>>>
>>>> +.. option:: --[no]-multi-pass-opt-rps
>>>> +
>>>> + Enable storing commonly RPS in SPS in multi pass mode. Default
>>>> disabled.
>>>> +
>>>>
>>>>  Debugging options
>>>>  =
>>>> diff -r 0e9e52640546 -r 19d3c5ea8bc1 source/CMakeLists.txt
>>>> --- a/source/CMakeLists.txt Wed Oct 12 17:58:49 2016 +0530
>>>> +++ b/source/CMakeLists.txt Mon Oct 24 14:54:41 2016 +0800
>>>> @@ -30,7 +30,7 @@
>>>>  mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
>>>>
>>>>  # X265_BUILD must be incremented each time the public API is changed
>>>> -set(X265_BUILD 98)
>>>> +set(X265_BUILD 99)
>>>>  configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
>>>> "${PROJECT_BINARY_DIR}/x265.def")
>>>>  configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
>>>> diff -r 0e9e52640546 -r 19d3c5ea8bc1 source/common/common.h
>>>> --- a/source/common/common.h Wed Oct 12 17:58:49 2016 +0530
>>>> +++ b/source/common/common.h Mon Oct 24 14:54:41 2016 +0800
>>>> @@ -312,6 +312,7 @@
>>>>
>>>>  #define MAX_NUM_REF_PICS16 // max. number of pictures used
>>>> for reference
>>>>  #define MAX_NUM_REF 16 // max. number of entries in
>>>> picture reference list
>>>> +#define MAX_NUM_SHORT_TERM_RPS  64 // max. number of short term
>>>> reference picture set in SPS
>>>>
>>>>  #define REF_NOT_VALID   -1
>>>>
>>>> diff -r 0e9e52640546 -r 19d3c5ea8bc1 source/common/framedata.cpp
>>>> --- a/source/common/framedata.cpp Wed Oct 12 17:58:49 2016 +0530
>>>> +++ b/source/common/framedata.cpp Mon Oct 24 14:54:41 2016 +0800
>>>> @@ -37,6 +37,9 @@
>>>>  m_slice  = new Slice;
>>>>  m_picCTU = new CUData[sps.numCUsInFrame];
>>>>  m_picCsp = csp;
>>>> +m_spsrpsIdx = -1;
>>>> +if (pa

[x265] x265 patch(Store commonly-used RPS in SPS)

2016-10-25 Thread Zheng Wang
# HG changeset patch
# User ZhengWang 
# Date 1477292081 -28800
#  Mon Oct 24 14:54:41 2016 +0800
# Node ID 19d3c5ea8bc10d3728ba2ae06190d188fe6093a3
# Parent  0e9e5264054606a38a3fe6c87272a1737b340b1a
Store commonly-used RPS in SPS  in 2 pass mode.
Add new param --[no]-multi-pass-opt-rps to control it, default disabled.

diff -r 0e9e52640546 -r 19d3c5ea8bc1 doc/reST/cli.rst
--- a/doc/reST/cli.rst Wed Oct 12 17:58:49 2016 +0530
+++ b/doc/reST/cli.rst Mon Oct 24 14:54:41 2016 +0800
@@ -1852,6 +1852,10 @@
  Discard optional VUI HRD info from bitstream. Default enabled when
  :option:`--hrd` is enabled.

+.. option:: --[no]-multi-pass-opt-rps
+
+ Enable storing commonly RPS in SPS in multi pass mode. Default disabled.
+

 Debugging options
 =
diff -r 0e9e52640546 -r 19d3c5ea8bc1 source/CMakeLists.txt
--- a/source/CMakeLists.txt Wed Oct 12 17:58:49 2016 +0530
+++ b/source/CMakeLists.txt Mon Oct 24 14:54:41 2016 +0800
@@ -30,7 +30,7 @@
 mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)

 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 98)
+set(X265_BUILD 99)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r 0e9e52640546 -r 19d3c5ea8bc1 source/common/common.h
--- a/source/common/common.h Wed Oct 12 17:58:49 2016 +0530
+++ b/source/common/common.h Mon Oct 24 14:54:41 2016 +0800
@@ -312,6 +312,7 @@

 #define MAX_NUM_REF_PICS16 // max. number of pictures used for
reference
 #define MAX_NUM_REF 16 // max. number of entries in
picture reference list
+#define MAX_NUM_SHORT_TERM_RPS  64 // max. number of short term
reference picture set in SPS

 #define REF_NOT_VALID   -1

diff -r 0e9e52640546 -r 19d3c5ea8bc1 source/common/framedata.cpp
--- a/source/common/framedata.cpp Wed Oct 12 17:58:49 2016 +0530
+++ b/source/common/framedata.cpp Mon Oct 24 14:54:41 2016 +0800
@@ -37,6 +37,9 @@
 m_slice  = new Slice;
 m_picCTU = new CUData[sps.numCUsInFrame];
 m_picCsp = csp;
+m_spsrpsIdx = -1;
+if (param.rc.bStatWrite)
+m_spsrps = const_cast(sps.spsrps);

 m_cuMemPool.create(0, param.internalCsp, sps.numCUsInFrame);
 for (uint32_t ctuAddr = 0; ctuAddr < sps.numCUsInFrame; ctuAddr++)
diff -r 0e9e52640546 -r 19d3c5ea8bc1 source/common/framedata.h
--- a/source/common/framedata.h Wed Oct 12 17:58:49 2016 +0530
+++ b/source/common/framedata.h Mon Oct 24 14:54:41 2016 +0800
@@ -106,6 +106,9 @@
 CUDataMemPool  m_cuMemPool;
 CUData*m_picCTU;

+RPS*   m_spsrps;
+intm_spsrpsIdx;
+
 /* Rate control data used during encode and by references */
 struct RCStatCU
 {
diff -r 0e9e52640546 -r 19d3c5ea8bc1 source/common/param.cpp
--- a/source/common/param.cpp Wed Oct 12 17:58:49 2016 +0530
+++ b/source/common/param.cpp Mon Oct 24 14:54:41 2016 +0800
@@ -198,6 +198,7 @@
 param->bCULossless = 0;
 param->bEnableTemporalSubLayers = 0;
 param->bEnableRdRefine = 0;
+param->bMultiPassOptRPS = 0;

 /* Rate control options */
 param->rc.vbvMaxBitrate = 0;
@@ -915,6 +916,8 @@
 OPT("limit-tu") p->limitTU = atoi(value);
 OPT("opt-qp-pps") p->bOptQpPPS = atobool(value);
 OPT("opt-ref-list-length-pps") p->bOptRefListLengthPPS =
atobool(value);
+OPT("multi-pass-opt-rps") p->bMultiPassOptRPS = atobool(value);
+
 else
 return X265_PARAM_BAD_NAME;
 }
diff -r 0e9e52640546 -r 19d3c5ea8bc1 source/common/slice.h
--- a/source/common/slice.h Wed Oct 12 17:58:49 2016 +0530
+++ b/source/common/slice.h Mon Oct 24 14:54:41 2016 +0800
@@ -239,6 +239,10 @@
 uint32_t maxLatencyIncrease;
 int  numReorderPics;

+RPS  spsrps[MAX_NUM_SHORT_TERM_RPS];
+int  spsrpsNum;
+int  numGOPBegin;
+
 bool bUseSAO; // use param
 bool bUseAMP; // use param
 bool bUseStrongIntraSmoothing; // use param
@@ -337,6 +341,7 @@
 int m_sliceQp;
 int m_poc;
 int m_lastIDR;
+int m_rpsIdx;

 uint32_tm_colRefIdx;   // never modified

@@ -352,6 +357,7 @@

 int m_iPPSQpMinus26;
 int numRefIdxDefault[2];
+int m_iNumRPSInSPS;

 Slice()
 {
@@ -365,6 +371,7 @@
 m_iPPSQpMinus26 = 0;
 numRefIdxDefault[0] = 1;
 numRefIdxDefault[1] = 1;
+m_rpsIdx = -1;
 }

 void disableWeights();
diff -r 0e9e52640546 -r 19d3c5ea8bc1 source/encoder/api.cpp
--- a/source/encoder/api.cpp Wed Oct 12 17:58:49 2016 +0530
+++ b/source/encoder/api.cpp Mon Oct 24 14:54:41 2016 +0800
@@ -141,6 +141,11 @@
 Encoder *encoder = static_cast(enc);
 Entropy sbacCoder;
 Bitstream bs;
+if (encoder->m_param->rc.bStatRead &&
encoder->m_param->bMultiPassOptRPS)
+{
+if 

[x265] x265 patch(Store commonly-used RPS in SPS)

2016-10-25 Thread Zheng Wang
# HG changeset patch
# User ZhengWang 
# Date 1477292081 -28800
#  Mon Oct 24 14:54:41 2016 +0800
# Node ID 19d3c5ea8bc10d3728ba2ae06190d188fe6093a3
# Parent  0e9e5264054606a38a3fe6c87272a1737b340b1a
Store commonly-used RPS in SPS  in 2 pass mode.
Add new param --[no]-multi-pass-opt-rps to control it, default disabled.

diff -r 0e9e52640546 -r 19d3c5ea8bc1 doc/reST/cli.rst
--- a/doc/reST/cli.rst Wed Oct 12 17:58:49 2016 +0530
+++ b/doc/reST/cli.rst Mon Oct 24 14:54:41 2016 +0800
@@ -1852,6 +1852,10 @@
  Discard optional VUI HRD info from bitstream. Default enabled when
  :option:`--hrd` is enabled.

+.. option:: --[no]-multi-pass-opt-rps
+
+ Enable storing commonly RPS in SPS in multi pass mode. Default disabled.
+

 Debugging options
 =
diff -r 0e9e52640546 -r 19d3c5ea8bc1 source/CMakeLists.txt
--- a/source/CMakeLists.txt Wed Oct 12 17:58:49 2016 +0530
+++ b/source/CMakeLists.txt Mon Oct 24 14:54:41 2016 +0800
@@ -30,7 +30,7 @@
 mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)

 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 98)
+set(X265_BUILD 99)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r 0e9e52640546 -r 19d3c5ea8bc1 source/common/common.h
--- a/source/common/common.h Wed Oct 12 17:58:49 2016 +0530
+++ b/source/common/common.h Mon Oct 24 14:54:41 2016 +0800
@@ -312,6 +312,7 @@

 #define MAX_NUM_REF_PICS16 // max. number of pictures used for
reference
 #define MAX_NUM_REF 16 // max. number of entries in
picture reference list
+#define MAX_NUM_SHORT_TERM_RPS  64 // max. number of short term
reference picture set in SPS

 #define REF_NOT_VALID   -1

diff -r 0e9e52640546 -r 19d3c5ea8bc1 source/common/framedata.cpp
--- a/source/common/framedata.cpp Wed Oct 12 17:58:49 2016 +0530
+++ b/source/common/framedata.cpp Mon Oct 24 14:54:41 2016 +0800
@@ -37,6 +37,9 @@
 m_slice  = new Slice;
 m_picCTU = new CUData[sps.numCUsInFrame];
 m_picCsp = csp;
+m_spsrpsIdx = -1;
+if (param.rc.bStatWrite)
+m_spsrps = const_cast(sps.spsrps);

 m_cuMemPool.create(0, param.internalCsp, sps.numCUsInFrame);
 for (uint32_t ctuAddr = 0; ctuAddr < sps.numCUsInFrame; ctuAddr++)
diff -r 0e9e52640546 -r 19d3c5ea8bc1 source/common/framedata.h
--- a/source/common/framedata.h Wed Oct 12 17:58:49 2016 +0530
+++ b/source/common/framedata.h Mon Oct 24 14:54:41 2016 +0800
@@ -106,6 +106,9 @@
 CUDataMemPool  m_cuMemPool;
 CUData*m_picCTU;

+RPS*   m_spsrps;
+intm_spsrpsIdx;
+
 /* Rate control data used during encode and by references */
 struct RCStatCU
 {
diff -r 0e9e52640546 -r 19d3c5ea8bc1 source/common/param.cpp
--- a/source/common/param.cpp Wed Oct 12 17:58:49 2016 +0530
+++ b/source/common/param.cpp Mon Oct 24 14:54:41 2016 +0800
@@ -198,6 +198,7 @@
 param->bCULossless = 0;
 param->bEnableTemporalSubLayers = 0;
 param->bEnableRdRefine = 0;
+param->bMultiPassOptRPS = 0;

 /* Rate control options */
 param->rc.vbvMaxBitrate = 0;
@@ -915,6 +916,8 @@
 OPT("limit-tu") p->limitTU = atoi(value);
 OPT("opt-qp-pps") p->bOptQpPPS = atobool(value);
 OPT("opt-ref-list-length-pps") p->bOptRefListLengthPPS =
atobool(value);
+OPT("multi-pass-opt-rps") p->bMultiPassOptRPS = atobool(value);
+
 else
 return X265_PARAM_BAD_NAME;
 }
diff -r 0e9e52640546 -r 19d3c5ea8bc1 source/common/slice.h
--- a/source/common/slice.h Wed Oct 12 17:58:49 2016 +0530
+++ b/source/common/slice.h Mon Oct 24 14:54:41 2016 +0800
@@ -239,6 +239,10 @@
 uint32_t maxLatencyIncrease;
 int  numReorderPics;

+RPS  spsrps[MAX_NUM_SHORT_TERM_RPS];
+int  spsrpsNum;
+int  numGOPBegin;
+
 bool bUseSAO; // use param
 bool bUseAMP; // use param
 bool bUseStrongIntraSmoothing; // use param
@@ -337,6 +341,7 @@
 int m_sliceQp;
 int m_poc;
 int m_lastIDR;
+int m_rpsIdx;

 uint32_tm_colRefIdx;   // never modified

@@ -352,6 +357,7 @@

 int m_iPPSQpMinus26;
 int numRefIdxDefault[2];
+int m_iNumRPSInSPS;

 Slice()
 {
@@ -365,6 +371,7 @@
 m_iPPSQpMinus26 = 0;
 numRefIdxDefault[0] = 1;
 numRefIdxDefault[1] = 1;
+m_rpsIdx = -1;
 }

 void disableWeights();
diff -r 0e9e52640546 -r 19d3c5ea8bc1 source/encoder/api.cpp
--- a/source/encoder/api.cpp Wed Oct 12 17:58:49 2016 +0530
+++ b/source/encoder/api.cpp Mon Oct 24 14:54:41 2016 +0800
@@ -141,6 +141,11 @@
 Encoder *encoder = static_cast(enc);
 Entropy sbacCoder;
 Bitstream bs;
+if (encoder->m_param->rc.bStatRead &&
encoder->m_param->bMultiPassOptRPS)
+{
+if 

Re: [x265] x265 patch(Store commonly-used RPS in SPS)

2016-10-24 Thread Zheng Wang
Hi Pradeep,

I have check the x265 code, and now i can pull the newlist code version is
"(0e9e52640546) limitTU: fix energy calculation used in limiting TU
recursion …"
My patch is base on this:
# Node ID 19d3c5ea8bc10d3728ba2ae06190d188fe6093a3
# Parent  0e9e5264054606a38a3fe6c87272a1737b340b1a
Store commonly-used RPS in SPS  in 2 pass mode.

I also try to import my patch base on version "(0e9e52640546)“, it success
by "Import from Clipboard" using TortoiseHg.

If there are some problem, please tell me the detailed info about it.


2016-10-24 19:33 GMT+08:00 Pradeep Ramachandran <
prad...@multicorewareinc.com>:

> This patch doesn't apply at current x265 tip. Please fix and resend.
> Pradeep.
>
> On Mon, Oct 24, 2016 at 12:27 PM, Zheng Wang <zh...@multicorewareinc.com>
> wrote:
>
>> # HG changeset patch
>> # User ZhengWang <zh...@multicorewareinc.com>
>> # Date 1477292081 -28800
>> #  Mon Oct 24 14:54:41 2016 +0800
>> # Node ID 19d3c5ea8bc10d3728ba2ae06190d188fe6093a3
>> # Parent  0e9e5264054606a38a3fe6c87272a1737b340b1a
>> Store commonly-used RPS in SPS  in 2 pass mode.
>> Add new param --[no]-multi-pass-opt-rps to control it, default disabled.
>>
>> diff -r 0e9e52640546 -r 19d3c5ea8bc1 doc/reST/cli.rst
>> --- a/doc/reST/cli.rst Wed Oct 12 17:58:49 2016 +0530
>> +++ b/doc/reST/cli.rst Mon Oct 24 14:54:41 2016 +0800
>> @@ -1852,6 +1852,10 @@
>>   Discard optional VUI HRD info from bitstream. Default enabled when
>>   :option:`--hrd` is enabled.
>>
>> +.. option:: --[no]-multi-pass-opt-rps
>> +
>> + Enable storing commonly RPS in SPS in multi pass mode. Default
>> disabled.
>> +
>>
>>  Debugging options
>>  =
>> diff -r 0e9e52640546 -r 19d3c5ea8bc1 source/CMakeLists.txt
>> --- a/source/CMakeLists.txt Wed Oct 12 17:58:49 2016 +0530
>> +++ b/source/CMakeLists.txt Mon Oct 24 14:54:41 2016 +0800
>> @@ -30,7 +30,7 @@
>>  mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
>>
>>  # X265_BUILD must be incremented each time the public API is changed
>> -set(X265_BUILD 98)
>> +set(X265_BUILD 99)
>>  configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
>> "${PROJECT_BINARY_DIR}/x265.def")
>>  configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
>> diff -r 0e9e52640546 -r 19d3c5ea8bc1 source/common/common.h
>> --- a/source/common/common.h Wed Oct 12 17:58:49 2016 +0530
>> +++ b/source/common/common.h Mon Oct 24 14:54:41 2016 +0800
>> @@ -312,6 +312,7 @@
>>
>>  #define MAX_NUM_REF_PICS16 // max. number of pictures used
>> for reference
>>  #define MAX_NUM_REF 16 // max. number of entries in
>> picture reference list
>> +#define MAX_NUM_SHORT_TERM_RPS  64 // max. number of short term
>> reference picture set in SPS
>>
>>  #define REF_NOT_VALID   -1
>>
>> diff -r 0e9e52640546 -r 19d3c5ea8bc1 source/common/framedata.cpp
>> --- a/source/common/framedata.cpp Wed Oct 12 17:58:49 2016 +0530
>> +++ b/source/common/framedata.cpp Mon Oct 24 14:54:41 2016 +0800
>> @@ -37,6 +37,9 @@
>>  m_slice  = new Slice;
>>  m_picCTU = new CUData[sps.numCUsInFrame];
>>  m_picCsp = csp;
>> +m_spsrpsIdx = -1;
>> +if (param.rc.bStatWrite)
>> +m_spsrps = const_cast<RPS*>(sps.spsrps);
>>
>>  m_cuMemPool.create(0, param.internalCsp, sps.numCUsInFrame);
>>  for (uint32_t ctuAddr = 0; ctuAddr < sps.numCUsInFrame; ctuAddr++)
>> diff -r 0e9e52640546 -r 19d3c5ea8bc1 source/common/framedata.h
>> --- a/source/common/framedata.h Wed Oct 12 17:58:49 2016 +0530
>> +++ b/source/common/framedata.h Mon Oct 24 14:54:41 2016 +0800
>> @@ -106,6 +106,9 @@
>>  CUDataMemPool  m_cuMemPool;
>>  CUData*m_picCTU;
>>
>> +RPS*   m_spsrps;
>> +intm_spsrpsIdx;
>> +
>>  /* Rate control data used during encode and by references */
>>  struct RCStatCU
>>  {
>> diff -r 0e9e52640546 -r 19d3c5ea8bc1 source/common/param.cpp
>> --- a/source/common/param.cpp Wed Oct 12 17:58:49 2016 +0530
>> +++ b/source/common/param.cpp Mon Oct 24 14:54:41 2016 +0800
>> @@ -198,6 +198,7 @@
>>  param->bCULossless = 0;
>>  param->bEnableTemporalSubLayers = 0;
>>  param->bEnableRdRefine = 0;
>> +param->bMultiPassOptRPS = 0;
>>
>>  /* Rate control options */
>>  param->rc.vbvMaxBitrate = 0;
>> @@ -915,6 +916,8 @@
>>  OPT("limit-tu") p->limit

[x265] x265 patch(Store commonly-used RPS in SPS)

2016-10-24 Thread Zheng Wang
# HG changeset patch
# User ZhengWang 
# Date 1477292081 -28800
#  Mon Oct 24 14:54:41 2016 +0800
# Node ID 19d3c5ea8bc10d3728ba2ae06190d188fe6093a3
# Parent  0e9e5264054606a38a3fe6c87272a1737b340b1a
Store commonly-used RPS in SPS  in 2 pass mode.
Add new param --[no]-multi-pass-opt-rps to control it, default disabled.

diff -r 0e9e52640546 -r 19d3c5ea8bc1 doc/reST/cli.rst
--- a/doc/reST/cli.rst Wed Oct 12 17:58:49 2016 +0530
+++ b/doc/reST/cli.rst Mon Oct 24 14:54:41 2016 +0800
@@ -1852,6 +1852,10 @@
  Discard optional VUI HRD info from bitstream. Default enabled when
  :option:`--hrd` is enabled.

+.. option:: --[no]-multi-pass-opt-rps
+
+ Enable storing commonly RPS in SPS in multi pass mode. Default disabled.
+

 Debugging options
 =
diff -r 0e9e52640546 -r 19d3c5ea8bc1 source/CMakeLists.txt
--- a/source/CMakeLists.txt Wed Oct 12 17:58:49 2016 +0530
+++ b/source/CMakeLists.txt Mon Oct 24 14:54:41 2016 +0800
@@ -30,7 +30,7 @@
 mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)

 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 98)
+set(X265_BUILD 99)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r 0e9e52640546 -r 19d3c5ea8bc1 source/common/common.h
--- a/source/common/common.h Wed Oct 12 17:58:49 2016 +0530
+++ b/source/common/common.h Mon Oct 24 14:54:41 2016 +0800
@@ -312,6 +312,7 @@

 #define MAX_NUM_REF_PICS16 // max. number of pictures used for
reference
 #define MAX_NUM_REF 16 // max. number of entries in
picture reference list
+#define MAX_NUM_SHORT_TERM_RPS  64 // max. number of short term
reference picture set in SPS

 #define REF_NOT_VALID   -1

diff -r 0e9e52640546 -r 19d3c5ea8bc1 source/common/framedata.cpp
--- a/source/common/framedata.cpp Wed Oct 12 17:58:49 2016 +0530
+++ b/source/common/framedata.cpp Mon Oct 24 14:54:41 2016 +0800
@@ -37,6 +37,9 @@
 m_slice  = new Slice;
 m_picCTU = new CUData[sps.numCUsInFrame];
 m_picCsp = csp;
+m_spsrpsIdx = -1;
+if (param.rc.bStatWrite)
+m_spsrps = const_cast(sps.spsrps);

 m_cuMemPool.create(0, param.internalCsp, sps.numCUsInFrame);
 for (uint32_t ctuAddr = 0; ctuAddr < sps.numCUsInFrame; ctuAddr++)
diff -r 0e9e52640546 -r 19d3c5ea8bc1 source/common/framedata.h
--- a/source/common/framedata.h Wed Oct 12 17:58:49 2016 +0530
+++ b/source/common/framedata.h Mon Oct 24 14:54:41 2016 +0800
@@ -106,6 +106,9 @@
 CUDataMemPool  m_cuMemPool;
 CUData*m_picCTU;

+RPS*   m_spsrps;
+intm_spsrpsIdx;
+
 /* Rate control data used during encode and by references */
 struct RCStatCU
 {
diff -r 0e9e52640546 -r 19d3c5ea8bc1 source/common/param.cpp
--- a/source/common/param.cpp Wed Oct 12 17:58:49 2016 +0530
+++ b/source/common/param.cpp Mon Oct 24 14:54:41 2016 +0800
@@ -198,6 +198,7 @@
 param->bCULossless = 0;
 param->bEnableTemporalSubLayers = 0;
 param->bEnableRdRefine = 0;
+param->bMultiPassOptRPS = 0;

 /* Rate control options */
 param->rc.vbvMaxBitrate = 0;
@@ -915,6 +916,8 @@
 OPT("limit-tu") p->limitTU = atoi(value);
 OPT("opt-qp-pps") p->bOptQpPPS = atobool(value);
 OPT("opt-ref-list-length-pps") p->bOptRefListLengthPPS =
atobool(value);
+OPT("multi-pass-opt-rps") p->bMultiPassOptRPS = atobool(value);
+
 else
 return X265_PARAM_BAD_NAME;
 }
diff -r 0e9e52640546 -r 19d3c5ea8bc1 source/common/slice.h
--- a/source/common/slice.h Wed Oct 12 17:58:49 2016 +0530
+++ b/source/common/slice.h Mon Oct 24 14:54:41 2016 +0800
@@ -239,6 +239,10 @@
 uint32_t maxLatencyIncrease;
 int  numReorderPics;

+RPS  spsrps[MAX_NUM_SHORT_TERM_RPS];
+int  spsrpsNum;
+int  numGOPBegin;
+
 bool bUseSAO; // use param
 bool bUseAMP; // use param
 bool bUseStrongIntraSmoothing; // use param
@@ -337,6 +341,7 @@
 int m_sliceQp;
 int m_poc;
 int m_lastIDR;
+int m_rpsIdx;

 uint32_tm_colRefIdx;   // never modified

@@ -352,6 +357,7 @@

 int m_iPPSQpMinus26;
 int numRefIdxDefault[2];
+int m_iNumRPSInSPS;

 Slice()
 {
@@ -365,6 +371,7 @@
 m_iPPSQpMinus26 = 0;
 numRefIdxDefault[0] = 1;
 numRefIdxDefault[1] = 1;
+m_rpsIdx = -1;
 }

 void disableWeights();
diff -r 0e9e52640546 -r 19d3c5ea8bc1 source/encoder/api.cpp
--- a/source/encoder/api.cpp Wed Oct 12 17:58:49 2016 +0530
+++ b/source/encoder/api.cpp Mon Oct 24 14:54:41 2016 +0800
@@ -141,6 +141,11 @@
 Encoder *encoder = static_cast(enc);
 Entropy sbacCoder;
 Bitstream bs;
+if (encoder->m_param->rc.bStatRead &&
encoder->m_param->bMultiPassOptRPS)
+{
+if 

[x265] x265 patch(Store commonly-used RPS in SPS)

2016-10-20 Thread Zheng Wang
# HG changeset patch
# User ZhengWang 
# Date 1476863434 -28800
#  Wed Oct 19 15:50:34 2016 +0800
# Node ID b1662beb64862095079cc1600ee2ecc8c05d8227
# Parent  0e9e5264054606a38a3fe6c87272a1737b340b1a
Store commonly-used RPS in SPS  in 2 pass mode.
Add new param --[no]-multi-pass-opt-rps to control it, default disabled.

diff -r 0e9e52640546 -r b1662beb6486 doc/reST/cli.rst
--- a/doc/reST/cli.rst Wed Oct 12 17:58:49 2016 +0530
+++ b/doc/reST/cli.rst Wed Oct 19 15:50:34 2016 +0800
@@ -1389,6 +1389,10 @@
  Specify file name of of the multi-pass stats file. If unspecified
  the encoder will use x265_2pass.log

+.. option:: --[no]-multi-pass-opt-rps
+
+ Enable storing commonly RPS in SPS in multi pass mode. Default disabled.
+
 .. option:: --slow-firstpass, --no-slow-firstpass

  Enable first pass encode with the exact settings specified.
diff -r 0e9e52640546 -r b1662beb6486 source/CMakeLists.txt
--- a/source/CMakeLists.txt Wed Oct 12 17:58:49 2016 +0530
+++ b/source/CMakeLists.txt Wed Oct 19 15:50:34 2016 +0800
@@ -30,7 +30,7 @@
 mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)

 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 98)
+set(X265_BUILD 99)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r 0e9e52640546 -r b1662beb6486 source/common/common.h
--- a/source/common/common.h Wed Oct 12 17:58:49 2016 +0530
+++ b/source/common/common.h Wed Oct 19 15:50:34 2016 +0800
@@ -312,6 +312,7 @@

 #define MAX_NUM_REF_PICS16 // max. number of pictures used for
reference
 #define MAX_NUM_REF 16 // max. number of entries in
picture reference list
+#define MAX_NUM_SHORT_TERM_RPS  64 // max. number of short term
reference picture set in SPS

 #define REF_NOT_VALID   -1

diff -r 0e9e52640546 -r b1662beb6486 source/common/framedata.cpp
--- a/source/common/framedata.cpp Wed Oct 12 17:58:49 2016 +0530
+++ b/source/common/framedata.cpp Wed Oct 19 15:50:34 2016 +0800
@@ -37,6 +37,9 @@
 m_slice  = new Slice;
 m_picCTU = new CUData[sps.numCUsInFrame];
 m_picCsp = csp;
+m_spsrpsIdx = -1;
+if (param.rc.bStatWrite)
+m_spsrps = const_cast(sps.spsrps);

 m_cuMemPool.create(0, param.internalCsp, sps.numCUsInFrame);
 for (uint32_t ctuAddr = 0; ctuAddr < sps.numCUsInFrame; ctuAddr++)
diff -r 0e9e52640546 -r b1662beb6486 source/common/framedata.h
--- a/source/common/framedata.h Wed Oct 12 17:58:49 2016 +0530
+++ b/source/common/framedata.h Wed Oct 19 15:50:34 2016 +0800
@@ -106,6 +106,9 @@
 CUDataMemPool  m_cuMemPool;
 CUData*m_picCTU;

+RPS*   m_spsrps;
+intm_spsrpsIdx;
+
 /* Rate control data used during encode and by references */
 struct RCStatCU
 {
diff -r 0e9e52640546 -r b1662beb6486 source/common/param.cpp
--- a/source/common/param.cpp Wed Oct 12 17:58:49 2016 +0530
+++ b/source/common/param.cpp Wed Oct 19 15:50:34 2016 +0800
@@ -198,6 +198,7 @@
 param->bCULossless = 0;
 param->bEnableTemporalSubLayers = 0;
 param->bEnableRdRefine = 0;
+param->bMultiPassOptRPS = 0;

 /* Rate control options */
 param->rc.vbvMaxBitrate = 0;
@@ -915,6 +916,8 @@
 OPT("limit-tu") p->limitTU = atoi(value);
 OPT("opt-qp-pps") p->bOptQpPPS = atobool(value);
 OPT("opt-ref-list-length-pps") p->bOptRefListLengthPPS =
atobool(value);
+OPT("multi-pass-opt-rps") p->bMultiPassOptRPS = atobool(value);
+
 else
 return X265_PARAM_BAD_NAME;
 }
diff -r 0e9e52640546 -r b1662beb6486 source/common/slice.h
--- a/source/common/slice.h Wed Oct 12 17:58:49 2016 +0530
+++ b/source/common/slice.h Wed Oct 19 15:50:34 2016 +0800
@@ -239,6 +239,10 @@
 uint32_t maxLatencyIncrease;
 int  numReorderPics;

+RPS  spsrps[MAX_NUM_SHORT_TERM_RPS];
+int  spsrpsNum;
+int  numGOPBegin;
+
 bool bUseSAO; // use param
 bool bUseAMP; // use param
 bool bUseStrongIntraSmoothing; // use param
@@ -337,6 +341,7 @@
 int m_sliceQp;
 int m_poc;
 int m_lastIDR;
+int m_rpsIdx;

 uint32_tm_colRefIdx;   // never modified

@@ -352,6 +357,7 @@

 int m_iPPSQpMinus26;
 int numRefIdxDefault[2];
+int m_iNumRPSInSPS;

 Slice()
 {
@@ -365,6 +371,7 @@
 m_iPPSQpMinus26 = 0;
 numRefIdxDefault[0] = 1;
 numRefIdxDefault[1] = 1;
+m_rpsIdx = -1;
 }

 void disableWeights();
diff -r 0e9e52640546 -r b1662beb6486 source/encoder/api.cpp
--- a/source/encoder/api.cpp Wed Oct 12 17:58:49 2016 +0530
+++ b/source/encoder/api.cpp Wed Oct 19 15:50:34 2016 +0800
@@ -141,6 +141,11 @@
 Encoder *encoder = static_cast(enc);
 Entropy sbacCoder;
 Bitstream bs;
+if 

[x265] x265 patch (Store commonly-used RPS in SPS)

2016-10-20 Thread Zheng Wang
# HG changeset patch
# User ZhengWang 
# Date 1476863434 -28800
#  Wed Oct 19 15:50:34 2016 +0800
# Node ID b1662beb64862095079cc1600ee2ecc8c05d8227
# Parent  0e9e5264054606a38a3fe6c87272a1737b340b1a
Store commonly-used RPS in SPS  in 2 pass mode.
Add new param --[no]-multi-pass-opt-rps to control it, default disabled.

diff -r 0e9e52640546 -r b1662beb6486 doc/reST/cli.rst
--- a/doc/reST/cli.rst Wed Oct 12 17:58:49 2016 +0530
+++ b/doc/reST/cli.rst Wed Oct 19 15:50:34 2016 +0800
@@ -1389,6 +1389,10 @@
  Specify file name of of the multi-pass stats file. If unspecified
  the encoder will use x265_2pass.log

+.. option:: --[no]-multi-pass-opt-rps
+
+ Enable storing commonly RPS in SPS in multi pass mode. Default disabled.
+
 .. option:: --slow-firstpass, --no-slow-firstpass

  Enable first pass encode with the exact settings specified.
diff -r 0e9e52640546 -r b1662beb6486 source/CMakeLists.txt
--- a/source/CMakeLists.txt Wed Oct 12 17:58:49 2016 +0530
+++ b/source/CMakeLists.txt Wed Oct 19 15:50:34 2016 +0800
@@ -30,7 +30,7 @@
 mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)

 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 98)
+set(X265_BUILD 99)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r 0e9e52640546 -r b1662beb6486 source/common/common.h
--- a/source/common/common.h Wed Oct 12 17:58:49 2016 +0530
+++ b/source/common/common.h Wed Oct 19 15:50:34 2016 +0800
@@ -312,6 +312,7 @@

 #define MAX_NUM_REF_PICS16 // max. number of pictures used for
reference
 #define MAX_NUM_REF 16 // max. number of entries in
picture reference list
+#define MAX_NUM_SHORT_TERM_RPS  64 // max. number of short term
reference picture set in SPS

 #define REF_NOT_VALID   -1

diff -r 0e9e52640546 -r b1662beb6486 source/common/framedata.cpp
--- a/source/common/framedata.cpp Wed Oct 12 17:58:49 2016 +0530
+++ b/source/common/framedata.cpp Wed Oct 19 15:50:34 2016 +0800
@@ -37,6 +37,9 @@
 m_slice  = new Slice;
 m_picCTU = new CUData[sps.numCUsInFrame];
 m_picCsp = csp;
+m_spsrpsIdx = -1;
+if (param.rc.bStatWrite)
+m_spsrps = const_cast(sps.spsrps);

 m_cuMemPool.create(0, param.internalCsp, sps.numCUsInFrame);
 for (uint32_t ctuAddr = 0; ctuAddr < sps.numCUsInFrame; ctuAddr++)
diff -r 0e9e52640546 -r b1662beb6486 source/common/framedata.h
--- a/source/common/framedata.h Wed Oct 12 17:58:49 2016 +0530
+++ b/source/common/framedata.h Wed Oct 19 15:50:34 2016 +0800
@@ -106,6 +106,9 @@
 CUDataMemPool  m_cuMemPool;
 CUData*m_picCTU;

+RPS*   m_spsrps;
+intm_spsrpsIdx;
+
 /* Rate control data used during encode and by references */
 struct RCStatCU
 {
diff -r 0e9e52640546 -r b1662beb6486 source/common/param.cpp
--- a/source/common/param.cpp Wed Oct 12 17:58:49 2016 +0530
+++ b/source/common/param.cpp Wed Oct 19 15:50:34 2016 +0800
@@ -198,6 +198,7 @@
 param->bCULossless = 0;
 param->bEnableTemporalSubLayers = 0;
 param->bEnableRdRefine = 0;
+param->bMultiPassOptRPS = 0;

 /* Rate control options */
 param->rc.vbvMaxBitrate = 0;
@@ -915,6 +916,8 @@
 OPT("limit-tu") p->limitTU = atoi(value);
 OPT("opt-qp-pps") p->bOptQpPPS = atobool(value);
 OPT("opt-ref-list-length-pps") p->bOptRefListLengthPPS =
atobool(value);
+OPT("multi-pass-opt-rps") p->bMultiPassOptRPS = atobool(value);
+
 else
 return X265_PARAM_BAD_NAME;
 }
diff -r 0e9e52640546 -r b1662beb6486 source/common/slice.h
--- a/source/common/slice.h Wed Oct 12 17:58:49 2016 +0530
+++ b/source/common/slice.h Wed Oct 19 15:50:34 2016 +0800
@@ -239,6 +239,10 @@
 uint32_t maxLatencyIncrease;
 int  numReorderPics;

+RPS  spsrps[MAX_NUM_SHORT_TERM_RPS];
+int  spsrpsNum;
+int  numGOPBegin;
+
 bool bUseSAO; // use param
 bool bUseAMP; // use param
 bool bUseStrongIntraSmoothing; // use param
@@ -337,6 +341,7 @@
 int m_sliceQp;
 int m_poc;
 int m_lastIDR;
+int m_rpsIdx;

 uint32_tm_colRefIdx;   // never modified

@@ -352,6 +357,7 @@

 int m_iPPSQpMinus26;
 int numRefIdxDefault[2];
+int m_iNumRPSInSPS;

 Slice()
 {
@@ -365,6 +371,7 @@
 m_iPPSQpMinus26 = 0;
 numRefIdxDefault[0] = 1;
 numRefIdxDefault[1] = 1;
+m_rpsIdx = -1;
 }

 void disableWeights();
diff -r 0e9e52640546 -r b1662beb6486 source/encoder/api.cpp
--- a/source/encoder/api.cpp Wed Oct 12 17:58:49 2016 +0530
+++ b/source/encoder/api.cpp Wed Oct 19 15:50:34 2016 +0800
@@ -141,6 +141,11 @@
 Encoder *encoder = static_cast(enc);
 Entropy sbacCoder;
 Bitstream bs;
+if 

[x265] x265 patch(Store commonly-used RPS in SPS)

2016-10-20 Thread Zheng Wang
# HG changeset patch
# User ZhengWang 
# Date 1476863434 -28800
#  Wed Oct 19 15:50:34 2016 +0800
# Node ID b1662beb64862095079cc1600ee2ecc8c05d8227
# Parent  0e9e5264054606a38a3fe6c87272a1737b340b1a
Store commonly-used RPS in SPS  in 2 pass mode.
Add new param --[no]-multi-pass-opt-rps to control it, default disabled.

diff -r 0e9e52640546 -r b1662beb6486 doc/reST/cli.rst
--- a/doc/reST/cli.rst Wed Oct 12 17:58:49 2016 +0530
+++ b/doc/reST/cli.rst Wed Oct 19 15:50:34 2016 +0800
@@ -1389,6 +1389,10 @@
  Specify file name of of the multi-pass stats file. If unspecified
  the encoder will use x265_2pass.log

+.. option:: --[no]-multi-pass-opt-rps
+
+ Enable storing commonly RPS in SPS in multi pass mode. Default disabled.
+
 .. option:: --slow-firstpass, --no-slow-firstpass

  Enable first pass encode with the exact settings specified.
diff -r 0e9e52640546 -r b1662beb6486 source/CMakeLists.txt
--- a/source/CMakeLists.txt Wed Oct 12 17:58:49 2016 +0530
+++ b/source/CMakeLists.txt Wed Oct 19 15:50:34 2016 +0800
@@ -30,7 +30,7 @@
 mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)

 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 98)
+set(X265_BUILD 99)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r 0e9e52640546 -r b1662beb6486 source/common/common.h
--- a/source/common/common.h Wed Oct 12 17:58:49 2016 +0530
+++ b/source/common/common.h Wed Oct 19 15:50:34 2016 +0800
@@ -312,6 +312,7 @@

 #define MAX_NUM_REF_PICS16 // max. number of pictures used for
reference
 #define MAX_NUM_REF 16 // max. number of entries in
picture reference list
+#define MAX_NUM_SHORT_TERM_RPS  64 // max. number of short term
reference picture set in SPS

 #define REF_NOT_VALID   -1

diff -r 0e9e52640546 -r b1662beb6486 source/common/framedata.cpp
--- a/source/common/framedata.cpp Wed Oct 12 17:58:49 2016 +0530
+++ b/source/common/framedata.cpp Wed Oct 19 15:50:34 2016 +0800
@@ -37,6 +37,9 @@
 m_slice  = new Slice;
 m_picCTU = new CUData[sps.numCUsInFrame];
 m_picCsp = csp;
+m_spsrpsIdx = -1;
+if (param.rc.bStatWrite)
+m_spsrps = const_cast(sps.spsrps);

 m_cuMemPool.create(0, param.internalCsp, sps.numCUsInFrame);
 for (uint32_t ctuAddr = 0; ctuAddr < sps.numCUsInFrame; ctuAddr++)
diff -r 0e9e52640546 -r b1662beb6486 source/common/framedata.h
--- a/source/common/framedata.h Wed Oct 12 17:58:49 2016 +0530
+++ b/source/common/framedata.h Wed Oct 19 15:50:34 2016 +0800
@@ -106,6 +106,9 @@
 CUDataMemPool  m_cuMemPool;
 CUData*m_picCTU;

+RPS*   m_spsrps;
+intm_spsrpsIdx;
+
 /* Rate control data used during encode and by references */
 struct RCStatCU
 {
diff -r 0e9e52640546 -r b1662beb6486 source/common/param.cpp
--- a/source/common/param.cpp Wed Oct 12 17:58:49 2016 +0530
+++ b/source/common/param.cpp Wed Oct 19 15:50:34 2016 +0800
@@ -198,6 +198,7 @@
 param->bCULossless = 0;
 param->bEnableTemporalSubLayers = 0;
 param->bEnableRdRefine = 0;
+param->bMultiPassOptRPS = 0;

 /* Rate control options */
 param->rc.vbvMaxBitrate = 0;
@@ -915,6 +916,8 @@
 OPT("limit-tu") p->limitTU = atoi(value);
 OPT("opt-qp-pps") p->bOptQpPPS = atobool(value);
 OPT("opt-ref-list-length-pps") p->bOptRefListLengthPPS =
atobool(value);
+OPT("multi-pass-opt-rps") p->bMultiPassOptRPS = atobool(value);
+
 else
 return X265_PARAM_BAD_NAME;
 }
diff -r 0e9e52640546 -r b1662beb6486 source/common/slice.h
--- a/source/common/slice.h Wed Oct 12 17:58:49 2016 +0530
+++ b/source/common/slice.h Wed Oct 19 15:50:34 2016 +0800
@@ -239,6 +239,10 @@
 uint32_t maxLatencyIncrease;
 int  numReorderPics;

+RPS  spsrps[MAX_NUM_SHORT_TERM_RPS];
+int  spsrpsNum;
+int  numGOPBegin;
+
 bool bUseSAO; // use param
 bool bUseAMP; // use param
 bool bUseStrongIntraSmoothing; // use param
@@ -337,6 +341,7 @@
 int m_sliceQp;
 int m_poc;
 int m_lastIDR;
+int m_rpsIdx;

 uint32_tm_colRefIdx;   // never modified

@@ -352,6 +357,7 @@

 int m_iPPSQpMinus26;
 int numRefIdxDefault[2];
+int m_iNumRPSInSPS;

 Slice()
 {
@@ -365,6 +371,7 @@
 m_iPPSQpMinus26 = 0;
 numRefIdxDefault[0] = 1;
 numRefIdxDefault[1] = 1;
+m_rpsIdx = -1;
 }

 void disableWeights();
diff -r 0e9e52640546 -r b1662beb6486 source/encoder/api.cpp
--- a/source/encoder/api.cpp Wed Oct 12 17:58:49 2016 +0530
+++ b/source/encoder/api.cpp Wed Oct 19 15:50:34 2016 +0800
@@ -141,6 +141,11 @@
 Encoder *encoder = static_cast(enc);
 Entropy sbacCoder;
 Bitstream bs;
+if