Re: [x265] [PATCH 01/12] AArch64: Fix costCoeffNxN test on Apple Silicon

2024-05-09 Thread Santhoshini Sekar
Hi Hari,

Could you please share your 12 patches as a diff file attached to the
email. This way we can apply the patches cleaner and push them.



On Thu, May 9, 2024 at 2:27 PM Hari Limaye  wrote:

> Hi Karam,
>
> Thank you for reviewing this patch. Could you please clarify whether you
> are asking for the rest of this initial set of 12 patches, which are
> already on the mailing list, or for the optimisation patches that follow
> this initial set of changes?
>
> Thanks,
> Hari
> ___
> x265-devel mailing list
> x265-devel@videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>


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


[x265] [PATCH] Add codes to support field feature

2019-05-23 Thread santhoshini
# HG changeset patch
# User Shushuang 
# Date 1558582124 -28800
#  Thu May 23 11:28:44 2019 +0800
# Node ID 220cdb4328a1e2c7419546b50c4d07e652ae1537
# Parent  3f4fb9a2ac6817c9be4acab5c87746d405fcffd4
Add codes to support field feature

diff --git a/doc/reST/cli.rst b/doc/reST/cli.rst
--- a/doc/reST/cli.rst
+++ b/doc/reST/cli.rst
@@ -551,6 +551,10 @@
This feature can be enabled only in closed GOP structures.
Default 0 (disabled).
 
+.. option:: --field, --no-field
+
+   Enable or disable field coding. Default disabled.
+   
 Profile, Level, Tier
 
 
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -29,7 +29,7 @@
 option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)
 mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 174)
+set(X265_BUILD 175)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff --git a/source/common/frame.cpp b/source/common/frame.cpp
--- a/source/common/frame.cpp
+++ b/source/common/frame.cpp
@@ -56,6 +56,7 @@
 m_addOnCtuInfo = NULL;
 m_addOnPrevChange = NULL;
 m_classifyFrame = false;
+m_fieldNum = 0;
 }
 
 bool Frame::create(x265_param *param, float* quantOffsets)
diff --git a/source/common/frame.h b/source/common/frame.h
--- a/source/common/frame.h
+++ b/source/common/frame.h
@@ -129,6 +129,7 @@
 uint32_t*  m_classifyCount;
 
 bool   m_classifyFrame;
+intm_fieldNum;
 
 Frame();
 
diff --git a/source/common/param.cpp b/source/common/param.cpp
--- a/source/common/param.cpp
+++ b/source/common/param.cpp
@@ -140,6 +140,7 @@
 param->uhdBluray = 0;
 param->bHighTier = 1; //Allow high tier by default
 param->interlaceMode = 0;
+param->bField = 0;
 param->bAnnexB = 1;
 param->bRepeatHeaders = 0;
 param->bEnableAccessUnitDelimiters = 0;
@@ -1267,6 +1268,7 @@
 OPT("svt-fps-in-vps") x265_log(p, X265_LOG_WARNING, "Option %s is 
SVT-HEVC Encoder specific; Disabling it here \n", name);
 #endif
 OPT("fades") p->bEnableFades = atobool(value);
+OPT("field") p->bField = atobool( value );
 else
 return X265_PARAM_BAD_NAME;
 }
@@ -1639,6 +1641,12 @@
 if (param->dolbyProfile == 81)
 CHECK(!(param->masteringDisplayColorVolume), "Dolby Vision profile 
- 8.1 requires Mastering display color volume information\n");
 }
+
+if (param->bField && param->interlaceMode)
+{
+CHECK( (param->bFrameAdaptive==0), "Adaptive B-frame decision method 
should be closed for field feature.\n" );
+// to do
+}
 #if !X86_64
 CHECK(param->searchMethod == X265_SEA && (param->sourceWidth > 840 || 
param->sourceHeight > 480),
 "SEA motion search does not support resolutions greater than 480p in 
32 bit build");
@@ -2045,6 +2053,7 @@
 BOOL(p->bSingleSeiNal, "single-sei");
 BOOL(p->rc.hevcAq, "hevc-aq");
 BOOL(p->bEnableSvtHevc, "svt");
+BOOL(p->bField, "field");
 s += sprintf(s, " qp-adaptation-range=%.2f", p->rc.qpAdaptationRange);
 #undef BOOL
 return buf;
@@ -2370,6 +2379,7 @@
 dst->dolbyProfile = src->dolbyProfile;
 dst->bEnableSvtHevc = src->bEnableSvtHevc;
 dst->bEnableFades = src->bEnableFades;
+dst->bField = src->bField;
 
 #ifdef SVT_HEVC
 memcpy(dst->svtHevcParam, src->svtHevcParam, 
sizeof(EB_H265_ENC_CONFIGURATION));
diff --git a/source/common/slice.h b/source/common/slice.h
--- a/source/common/slice.h
+++ b/source/common/slice.h
@@ -361,6 +361,7 @@
 int numRefIdxDefault[2];
 int m_iNumRPSInSPS;
 const x265_param *m_param;
+int m_fieldNum;
 
 Slice()
 {
@@ -376,6 +377,7 @@
 numRefIdxDefault[1] = 1;
 m_rpsIdx = -1;
 m_chromaQpOffset[0] = m_chromaQpOffset[1] = 0;
+m_fieldNum = 0;
 }
 
 void disableWeights();
diff --git a/source/encoder/dpb.cpp b/source/encoder/dpb.cpp
--- a/source/encoder/dpb.cpp
+++ b/source/encoder/dpb.cpp
@@ -127,6 +127,7 @@
 {
 Slice* slice = newFrame->m_encData->m_slice;
 slice->m_poc = newFrame->m_poc;
+slice->m_fieldNum = newFrame->m_fieldNum;
 
 int pocCurr = slice->m_poc;
 int type = newFrame->m_lowres.sliceType;
diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp
+++ b/source/encoder/encoder.cpp
@@ -1107,6 +1107,8 @@
 inFrame->m_pts   = pic_in->pts;
 inFrame->m_forceqp   = pic_in->forceqp;
 inFrame->m_param = (m_reconfigure || m_reconfigureRc) ? 
m_latestParam : m_param;
+if (m_param->bField && m_param->interlaceMode)
+inFrame->m_fieldNum = pic_in->fieldNum;
 
 

[x265] [PATCH] fix conditions for single-sei NAL

2018-04-12 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1523526059 -19800
#  Thu Apr 12 15:10:59 2018 +0530
# Node ID ad37e53f78dcdd600f7ad31095db490b2a93a8c6
# Parent  593e63cda903370af926711c0ba05ce37d045c90
fix conditions for single-sei NAL

diff --git a/source/encoder/frameencoder.cpp b/source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp
+++ b/source/encoder/frameencoder.cpp
@@ -696,7 +696,7 @@
 sei->write(m_bs, *slice->m_sps);
 sei->alignAndSerialize(m_bs, false, m_param->bSingleSeiNal, 
NAL_UNIT_PREFIX_SEI, m_nalList);
 }
-
+bool isSei = false;
 /* Write user SEI */
 for (int i = 0; i < m_frame->m_userSEI.numPayloads; i++)
 {
@@ -710,6 +710,7 @@
 sei.setSize(payload->payloadSize);
 sei.write(m_bs, *slice->m_sps);
 sei.alignAndSerialize(m_bs, false, m_param->bSingleSeiNal, 
NAL_UNIT_PREFIX_SEI, m_nalList);
+isSei = true;
 }
 else if (payload->payloadType == USER_DATA_REGISTERED_ITU_T_T35)
 {
@@ -717,18 +718,19 @@
 {
 SEICreativeIntentMeta sei;
 sei.m_payload = payload->payload;
-m_bs.resetBits();
+if (!m_param->bSingleSeiNal)
+m_bs.resetBits();
 sei.setSize(payload->payloadSize);
 sei.write(m_bs, *slice->m_sps);
-sei.alignAndSerialize(m_bs, true, m_param->bSingleSeiNal, 
NAL_UNIT_PREFIX_SEI, m_nalList);
+sei.alignAndSerialize(m_bs, false, m_param->bSingleSeiNal, 
NAL_UNIT_PREFIX_SEI, m_nalList);
+isSei = true;
 }
 }
 else
 x265_log(m_param, X265_LOG_ERROR, "Unrecognized SEI type\n");
 }
-bool isSei = (m_frame->m_lowres.bKeyframe && 
-(m_param->bRepeatHeaders || m_param->bEmitHRDSEI 
-|| !!m_param->interlaceMode || m_param->bEmitIDRRecoverySEI));
+isSei |= ((m_frame->m_lowres.bKeyframe && m_param->bRepeatHeaders) || 
m_param->bEmitHRDSEI 
+|| !!m_param->interlaceMode || (m_frame->m_lowres.sliceType == 
X265_TYPE_IDR && m_param->bEmitIDRRecoverySEI));
 
 if (isSei && m_param->bSingleSeiNal)
 {
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1523526059 -19800
#  Thu Apr 12 15:10:59 2018 +0530
# Node ID ad37e53f78dcdd600f7ad31095db490b2a93a8c6
# Parent  593e63cda903370af926711c0ba05ce37d045c90
fix conditions for single-sei NAL

diff --git a/source/encoder/frameencoder.cpp b/source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp
+++ b/source/encoder/frameencoder.cpp
@@ -696,7 +696,7 @@
 sei->write(m_bs, *slice->m_sps);
 sei->alignAndSerialize(m_bs, false, m_param->bSingleSeiNal, NAL_UNIT_PREFIX_SEI, m_nalList);
 }
-
+bool isSei = false;
 /* Write user SEI */
 for (int i = 0; i < m_frame->m_userSEI.numPayloads; i++)
 {
@@ -710,6 +710,7 @@
 sei.setSize(payload->payloadSize);
 sei.write(m_bs, *slice->m_sps);
 sei.alignAndSerialize(m_bs, false, m_param->bSingleSeiNal, NAL_UNIT_PREFIX_SEI, m_nalList);
+isSei = true;
 }
 else if (payload->payloadType == USER_DATA_REGISTERED_ITU_T_T35)
 {
@@ -717,18 +718,19 @@
 {
 SEICreativeIntentMeta sei;
 sei.m_payload = payload->payload;
-m_bs.resetBits();
+if (!m_param->bSingleSeiNal)
+m_bs.resetBits();
 sei.setSize(payload->payloadSize);
 sei.write(m_bs, *slice->m_sps);
-sei.alignAndSerialize(m_bs, true, m_param->bSingleSeiNal, NAL_UNIT_PREFIX_SEI, m_nalList);
+sei.alignAndSerialize(m_bs, false, m_param->bSingleSeiNal, NAL_UNIT_PREFIX_SEI, m_nalList);
+isSei = true;
 }
 }
 else
 x265_log(m_param, X265_LOG_ERROR, "Unrecognized SEI type\n");
 }
-bool isSei = (m_frame->m_lowres.bKeyframe && 
-(m_param->bRepeatHeaders || m_param->bEmitHRDSEI 
-|| !!m_param->interlaceMode || m_param->bEmitIDRRecoverySEI));
+isSei |= ((m_frame->m_lowres.bKeyframe && m_param->bRepeatHeaders) || m_param->bEmitHRDSEI 
+|| !!m_param->interlaceMode || (m_frame->m_lowres.sliceType == X265_TYPE_IDR && m_param->bEmitIDRRecoverySEI));
 
 if (isSei && m_param->bSingleSeiNal)
 {
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] Fix condition check for single-sei

2018-04-03 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1522744817 -19800
#  Tue Apr 03 14:10:17 2018 +0530
# Node ID 2d95d7ec545ef3d57e7a57ac484f27c81f7be0e5
# Parent  2bbff45f761fdd9fb22495587640355432dc45bc
Fix condition check for single-sei

diff --git a/source/common/param.cpp b/source/common/param.cpp
--- a/source/common/param.cpp
+++ b/source/common/param.cpp
@@ -1386,11 +1386,11 @@
 
 bool isSingleSEI = ((param->bEmitHRDSEI || param->bEmitInfoSEI || 
param->decodedPictureHashSEI ||
  param->masteringDisplayColorVolume || param->maxCLL 
|| param->maxFALL || 
- param->bEmitHDRSEI || param->bEmitIDRRecoverySEI) && 
param->bSingleSeiNal);
-if (!isSingleSEI)
+ param->bEmitHDRSEI || param->bEmitIDRRecoverySEI));
+if (!isSingleSEI && param->bSingleSeiNal)
 {
 param->bSingleSeiNal = 0;
-x265_log(param, X265_LOG_WARNING, "None of the SEI messages are 
enabled. Diabling Single SEI NAL\n");
+x265_log(param, X265_LOG_WARNING, "None of the SEI messages are 
enabled. Disabling Single SEI NAL\n");
 }
 return check_failed;
 }
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1522744817 -19800
#  Tue Apr 03 14:10:17 2018 +0530
# Node ID 2d95d7ec545ef3d57e7a57ac484f27c81f7be0e5
# Parent  2bbff45f761fdd9fb22495587640355432dc45bc
Fix condition check for single-sei

diff --git a/source/common/param.cpp b/source/common/param.cpp
--- a/source/common/param.cpp
+++ b/source/common/param.cpp
@@ -1386,11 +1386,11 @@
 
 bool isSingleSEI = ((param->bEmitHRDSEI || param->bEmitInfoSEI || param->decodedPictureHashSEI ||
  param->masteringDisplayColorVolume || param->maxCLL || param->maxFALL || 
- param->bEmitHDRSEI || param->bEmitIDRRecoverySEI) && param->bSingleSeiNal);
-if (!isSingleSEI)
+ param->bEmitHDRSEI || param->bEmitIDRRecoverySEI));
+if (!isSingleSEI && param->bSingleSeiNal)
 {
 param->bSingleSeiNal = 0;
-x265_log(param, X265_LOG_WARNING, "None of the SEI messages are enabled. Diabling Single SEI NAL\n");
+x265_log(param, X265_LOG_WARNING, "None of the SEI messages are enabled. Disabling Single SEI NAL\n");
 }
 return check_failed;
 }
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] introduce new CLI single-sei to write all SEI messages in one single NAL

2018-04-02 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1522673234 -19800
#  Mon Apr 02 18:17:14 2018 +0530
# Node ID 6337356c86a4f5a49f275eb466d6fae32e6eb145
# Parent  946f82dbf4e80cb272f43a32a78ba2b186469845
introduce new CLI single-sei to write all SEI messages in one single NAL

diff --git a/doc/reST/cli.rst b/doc/reST/cli.rst
--- a/doc/reST/cli.rst
+++ b/doc/reST/cli.rst
@@ -2221,6 +2221,10 @@
 .. option:: --idr-recovery-sei, --no-idr-recoveery-sei
 Emit RecoveryPoint info as sei in bitstream for each IDR frame. Default 
disabled.
 
+.. option:: --single-sei, --no-single-sei
+Emit SEI messages in a single NAL unit instead of multiple NALs. Default 
disabled.
+When HRD SEI is enabled the HM decoder will throw a warning.
+
 DCT Approximations
 =
 
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -29,7 +29,7 @@
 option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)
 mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 156)
+set(X265_BUILD 157)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff --git a/source/common/param.cpp b/source/common/param.cpp
--- a/source/common/param.cpp
+++ b/source/common/param.cpp
@@ -301,6 +301,7 @@
 /* DCT Approximations */
 param->bLowPassDct = 0;
 param->bMVType = 0;
+param->bSingleSeiNal = 0;
 }
 
 int x265_param_default_preset(x265_param* param, const char* preset, const 
char* tune)
@@ -1017,6 +1018,7 @@
 OPT("radl") p->radl = atoi(value);
 OPT("max-ausize-factor") p->maxAUSizeFactor = atof(value);
 OPT("dynamic-refine") p->bDynamicRefine = atobool(value);
+OPT("single-sei") p->bSingleSeiNal = atobool(value);
 else
 return X265_PARAM_BAD_NAME;
 }
@@ -1382,6 +1384,14 @@
 if (param->masteringDisplayColorVolume || param->maxFALL || param->maxCLL)
 param->bEmitHDRSEI = 1;
 
+bool isSingleSEI = ((param->bEmitHRDSEI || param->bEmitInfoSEI || 
param->decodedPictureHashSEI ||
+ param->masteringDisplayColorVolume || param->maxCLL 
|| param->maxFALL || 
+ param->bEmitHDRSEI || param->bEmitIDRRecoverySEI) && 
param->bSingleSeiNal);
+if (!isSingleSEI)
+{
+param->bSingleSeiNal = 0;
+x265_log(param, X265_LOG_WARNING, "None of the SEI messages are 
enabled. Diabling Single SEI NAL\n");
+}
 return check_failed;
 }
 
@@ -1528,6 +1538,7 @@
 TOOLOPT(!param->bSaoNonDeblocked && param->bEnableSAO, "sao");
 TOOLOPT(param->rc.bStatWrite, "stats-write");
 TOOLOPT(param->rc.bStatRead,  "stats-read");
+TOOLOPT(param->bSingleSeiNal, "single-sei");
 #if ENABLE_HDR10_PLUS
 TOOLOPT(param->toneMapFile != NULL, "dhdr10-info");
 #endif
@@ -1751,6 +1762,7 @@
 s += sprintf(s, " copy-pic=%d", p->bCopyPicToFrame);
 s += sprintf(s, " max-ausize-factor=%.1f", p->maxAUSizeFactor);
 BOOL(p->bDynamicRefine, "dynamic-refine");
+BOOL(p->bSingleSeiNal, "single-sei");
 #undef BOOL
 return buf;
 }
diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp
+++ b/source/encoder/encoder.cpp
@@ -2289,26 +2289,26 @@
 sbacCoder.codePPS(m_pps, (m_param->maxSlices <= 1), m_iPPSQpMinus26);
 bs.writeByteAlignment();
 list.serialize(NAL_UNIT_PPS, bs);
-
+if (m_param->bSingleSeiNal)
+bs.resetBits();
 if (m_param->bEmitHDRSEI)
 {
 SEIContentLightLevel cllsei;
 cllsei.max_content_light_level = m_param->maxCLL;
 cllsei.max_pic_average_light_level = m_param->maxFALL;
-bs.resetBits();
+if (!m_param->bSingleSeiNal)
+bs.resetBits();
 cllsei.write(bs, m_sps);
-bs.writeByteAlignment();
-list.serialize(NAL_UNIT_PREFIX_SEI, bs);
-
+cllsei.alignAndSerialize(bs, false, m_param->bSingleSeiNal, 
NAL_UNIT_PREFIX_SEI, list);
 if (m_param->masteringDisplayColorVolume)
 {
 SEIMasteringDisplayColorVolume mdsei;
 if (mdsei.parse(m_param->masteringDisplayColorVolume))
 {
-bs.resetBits();
+if (!m_param->bSingleSeiNal)
+bs.resetBits();
 mdsei.write(bs, m_sps);
-bs.writeByteAlignment();
-list.serialize(NAL_UNIT_PREFIX_SEI, bs);
+ 

Re: [x265] [PATCH] introduce new CLI single-sei to write all SEI messages in one single NAL

2018-04-02 Thread Santhoshini Sekar
Thanks for pointing it out. Will correct and resend.

On Mon, Apr 2, 2018 at 6:24 PM, Mario Rohkrämer  wrote:

> Am 02.04.2018, 14:49 Uhr, schrieb :
>
> +When HRD SEI is enabled the HM decoder will through a warning.
>>
> *throw
>
> --
>
> Fun and success!
> Mario *LigH* Rohkrämer
> mailto:cont...@ligh.de
> ___
> x265-devel mailing list
> x265-devel@videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] introduce new CLI single-sei to write all SEI messages in one single NAL

2018-04-02 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1522673234 -19800
#  Mon Apr 02 18:17:14 2018 +0530
# Node ID e1b4fca6b9f7f916c11c69e5ec439857d71f58c6
# Parent  946f82dbf4e80cb272f43a32a78ba2b186469845
introduce new CLI single-sei to write all SEI messages in one single NAL

diff --git a/doc/reST/cli.rst b/doc/reST/cli.rst
--- a/doc/reST/cli.rst
+++ b/doc/reST/cli.rst
@@ -2221,6 +2221,10 @@
 .. option:: --idr-recovery-sei, --no-idr-recoveery-sei
 Emit RecoveryPoint info as sei in bitstream for each IDR frame. Default 
disabled.
 
+.. option:: --single-sei, --no-single-sei
+Emit SEI messages in a single NAL unit instead of multiple NALs. Default 
disabled.
+When HRD SEI is enabled the HM decoder will through a warning.
+
 DCT Approximations
 =
 
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -29,7 +29,7 @@
 option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)
 mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 156)
+set(X265_BUILD 157)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff --git a/source/common/param.cpp b/source/common/param.cpp
--- a/source/common/param.cpp
+++ b/source/common/param.cpp
@@ -301,6 +301,7 @@
 /* DCT Approximations */
 param->bLowPassDct = 0;
 param->bMVType = 0;
+param->bSingleSeiNal = 0;
 }
 
 int x265_param_default_preset(x265_param* param, const char* preset, const 
char* tune)
@@ -1017,6 +1018,7 @@
 OPT("radl") p->radl = atoi(value);
 OPT("max-ausize-factor") p->maxAUSizeFactor = atof(value);
 OPT("dynamic-refine") p->bDynamicRefine = atobool(value);
+OPT("single-sei") p->bSingleSeiNal = atobool(value);
 else
 return X265_PARAM_BAD_NAME;
 }
@@ -1382,6 +1384,14 @@
 if (param->masteringDisplayColorVolume || param->maxFALL || param->maxCLL)
 param->bEmitHDRSEI = 1;
 
+bool isSingleSEI = ((param->bEmitHRDSEI || param->bEmitInfoSEI || 
param->decodedPictureHashSEI ||
+ param->masteringDisplayColorVolume || param->maxCLL 
|| param->maxFALL || 
+ param->bEmitHDRSEI || param->bEmitIDRRecoverySEI) && 
param->bSingleSeiNal);
+if (!isSingleSEI)
+{
+param->bSingleSeiNal = 0;
+x265_log(param, X265_LOG_WARNING, "None of the SEI messages are 
enabled. Diabling Single SEI NAL\n");
+}
 return check_failed;
 }
 
@@ -1528,6 +1538,7 @@
 TOOLOPT(!param->bSaoNonDeblocked && param->bEnableSAO, "sao");
 TOOLOPT(param->rc.bStatWrite, "stats-write");
 TOOLOPT(param->rc.bStatRead,  "stats-read");
+TOOLOPT(param->bSingleSeiNal, "single-sei");
 #if ENABLE_HDR10_PLUS
 TOOLOPT(param->toneMapFile != NULL, "dhdr10-info");
 #endif
@@ -1751,6 +1762,7 @@
 s += sprintf(s, " copy-pic=%d", p->bCopyPicToFrame);
 s += sprintf(s, " max-ausize-factor=%.1f", p->maxAUSizeFactor);
 BOOL(p->bDynamicRefine, "dynamic-refine");
+BOOL(p->bSingleSeiNal, "single-sei");
 #undef BOOL
 return buf;
 }
diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp
+++ b/source/encoder/encoder.cpp
@@ -2289,26 +2289,26 @@
 sbacCoder.codePPS(m_pps, (m_param->maxSlices <= 1), m_iPPSQpMinus26);
 bs.writeByteAlignment();
 list.serialize(NAL_UNIT_PPS, bs);
-
+if (m_param->bSingleSeiNal)
+bs.resetBits();
 if (m_param->bEmitHDRSEI)
 {
 SEIContentLightLevel cllsei;
 cllsei.max_content_light_level = m_param->maxCLL;
 cllsei.max_pic_average_light_level = m_param->maxFALL;
-bs.resetBits();
+if (!m_param->bSingleSeiNal)
+bs.resetBits();
 cllsei.write(bs, m_sps);
-bs.writeByteAlignment();
-list.serialize(NAL_UNIT_PREFIX_SEI, bs);
-
+cllsei.alignAndSerialize(bs, false, m_param->bSingleSeiNal, 
NAL_UNIT_PREFIX_SEI, list);
 if (m_param->masteringDisplayColorVolume)
 {
 SEIMasteringDisplayColorVolume mdsei;
 if (mdsei.parse(m_param->masteringDisplayColorVolume))
 {
-bs.resetBits();
+if (!m_param->bSingleSeiNal)
+bs.resetBits();
 mdsei.write(bs, m_sps);
-bs.writeByteAlignment();
-list.serialize(NAL_UNIT_PREFIX_SEI, bs);
+ 

[x265] [PATCH] fix bug in SEI::write clean up

2018-03-29 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1522314350 -19800
#  Thu Mar 29 14:35:50 2018 +0530
# Node ID 22aa607166e0a9917b923b6b21b775055fc708fd
# Parent  1fafca24a3990106ecf203afc4e900fa0eddfbe1
fix bug in SEI::write clean up

diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp
+++ b/source/encoder/encoder.cpp
@@ -2332,7 +2332,7 @@
 bs.resetBits();
 SEIuserDataUnregistered idsei;
 idsei.m_userData = (uint8_t*)buffer;
-idsei.setSize((uint32_t)strlen(buffer) + 16);
+idsei.setSize((uint32_t)strlen(buffer));
 idsei.write(bs, m_sps);
 bs.writeByteAlignment();
 list.serialize(NAL_UNIT_PREFIX_SEI, bs);
@@ -2350,9 +2350,9 @@
 SEIActiveParameterSets sei;
 sei.m_selfContainedCvsFlag = true;
 sei.m_noParamSetUpdateFlag = true;
+bs.resetBits();
 int payloadSize = sei.countPayloadSize(m_sps);
 sei.setSize(payloadSize);
-bs.resetBits();
 sei.write(bs, m_sps);
 bs.writeByteAlignment();
 list.serialize(NAL_UNIT_PREFIX_SEI, bs);
diff --git a/source/encoder/frameencoder.cpp b/source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp
+++ b/source/encoder/frameencoder.cpp
@@ -633,9 +633,9 @@
 bpSei->m_dpbDelayOffset = 0;
 // hrdFullness() calculates the initial CPB removal delay and 
offset
 m_top->m_rateControl->hrdFullness(bpSei);
+m_bs.resetBits();
 int payloadSize = bpSei->countPayloadSize(*slice->m_sps);
 bpSei->setSize(payloadSize);
-m_bs.resetBits();
 bpSei->write(m_bs, *slice->m_sps);
 m_bs.writeByteAlignment();
 
@@ -651,8 +651,8 @@
 sei.m_recoveryPocCnt = 0;
 sei.m_exactMatchingFlag = true;
 sei.m_brokenLinkFlag = false;
+m_bs.resetBits();
 sei.setSize(sei.countPayloadSize(*slice->m_sps));
-m_bs.resetBits();
 sei.write(m_bs, *slice->m_sps);
 m_bs.writeByteAlignment();
 m_nalList.serialize(NAL_UNIT_PREFIX_SEI, m_bs);
@@ -704,7 +704,7 @@
 SEIuserDataUnregistered sei;
 sei.m_userData = payload->payload;
 m_bs.resetBits();
-sei.setSize(payload->payloadSize + 16);
+sei.setSize(payload->payloadSize);
 sei.write(m_bs, *slice->m_sps);
 m_bs.writeByteAlignment();
 m_nalList.serialize(NAL_UNIT_PREFIX_SEI, m_bs);
diff --git a/source/encoder/sei.cpp b/source/encoder/sei.cpp
--- a/source/encoder/sei.cpp
+++ b/source/encoder/sei.cpp
@@ -51,6 +51,8 @@
 uint32_t type = m_payloadType;
 m_bitIf = 
 uint32_t payloadSize = m_payloadSize;
+if (m_payloadType == USER_DATA_UNREGISTERED)
+payloadSize = m_payloadSize + 16;
 uint32_t payloadType = m_payloadType;
 for (; payloadType >= 0xff; payloadType -= 0xff)
 WRITE_CODE(0xff, 8, "payload_type");
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1522314350 -19800
#  Thu Mar 29 14:35:50 2018 +0530
# Node ID 22aa607166e0a9917b923b6b21b775055fc708fd
# Parent  1fafca24a3990106ecf203afc4e900fa0eddfbe1
fix bug in SEI::write clean up

diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp
+++ b/source/encoder/encoder.cpp
@@ -2332,7 +2332,7 @@
 bs.resetBits();
 SEIuserDataUnregistered idsei;
 idsei.m_userData = (uint8_t*)buffer;
-idsei.setSize((uint32_t)strlen(buffer) + 16);
+idsei.setSize((uint32_t)strlen(buffer));
 idsei.write(bs, m_sps);
 bs.writeByteAlignment();
 list.serialize(NAL_UNIT_PREFIX_SEI, bs);
@@ -2350,9 +2350,9 @@
 SEIActiveParameterSets sei;
 sei.m_selfContainedCvsFlag = true;
 sei.m_noParamSetUpdateFlag = true;
+bs.resetBits();
 int payloadSize = sei.countPayloadSize(m_sps);
 sei.setSize(payloadSize);
-bs.resetBits();
 sei.write(bs, m_sps);
 bs.writeByteAlignment();
 list.serialize(NAL_UNIT_PREFIX_SEI, bs);
diff --git a/source/encoder/frameencoder.cpp b/source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp
+++ b/source/encoder/frameencoder.cpp
@@ -633,9 +633,9 @@
 bpSei->m_dpbDelayOffset = 0;
 // hrdFullness() calculates the initial CPB removal delay and offset
 m_top->m_rateControl->hrdFullness(bpSei);
+m_bs.resetBits();
 int payloadSize = bpSei->countPayloadSize(*slice->m_sps);
 bpSei->setSize(payloadSize);
-m_bs.resetBits();
 b

Re: [x265] Report of possible issues with L-SMASH multiplexer, v2.7+14/+17

2018-03-28 Thread Santhoshini Sekar
Thanks for reporting this. We are looking into the issue.

On Wed, Mar 28, 2018 at 2:16 PM, enctac  wrote:

> x265 2.7+17 outputs broken SEI. (maybe SEIuserDataUnregistered, extra
> 16bytes)
> Not only 2pass encoding.
> Need to fix this.
>
>
>
> https://forum.doom9.org/showthread.php?p=1837693#post1837693
>
> ___
> x265-devel mailing list
> x265-devel@videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>
>
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] fix warning in getRefFrameList

2018-01-24 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1516779671 -19800
#  Wed Jan 24 13:11:11 2018 +0530
# Node ID 13b87f513337b4614edd09c419c17da217c2a926
# Parent  b763c22920f6b62c2a5ab7f4942ee480384807e3
fix warning in getRefFrameList

diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp
+++ b/source/encoder/encoder.cpp
@@ -490,7 +490,10 @@
 }
 }
 else
-x265_log(NULL, X265_LOG_WARNING, "Refrence List is not in 
piclist\n");
+{
+x265_log(NULL, X265_LOG_WARNING, "Current frame is not in DPB 
piclist.\n");
+return 1;
+}
 }
 else
 {
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1516779671 -19800
#  Wed Jan 24 13:11:11 2018 +0530
# Node ID 13b87f513337b4614edd09c419c17da217c2a926
# Parent  b763c22920f6b62c2a5ab7f4942ee480384807e3
fix warning in getRefFrameList

diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp
+++ b/source/encoder/encoder.cpp
@@ -490,7 +490,10 @@
 }
 }
 else
-x265_log(NULL, X265_LOG_WARNING, "Refrence List is not in piclist\n");
+{
+x265_log(NULL, X265_LOG_WARNING, "Current frame is not in DPB piclist.\n");
+return 1;
+}
 }
 else
 {
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] Fix possible NULL pointer dereferencing in cudata init

2017-12-22 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1513927117 -19800
#  Fri Dec 22 12:48:37 2017 +0530
# Branch stable
# Node ID f41671b53ae084a8207e24a91d3a7cf2a96cd1ce
# Parent  f7498acb38746d9b799d1b45343a3db56cdba306
Fix possible NULL pointer dereferencing in cudata init

diff --git a/source/common/framedata.cpp b/source/common/framedata.cpp
--- a/source/common/framedata.cpp
+++ b/source/common/framedata.cpp
@@ -41,9 +41,12 @@
 if (param.rc.bStatWrite)
 m_spsrps = const_cast<RPS*>(sps.spsrps);
 
-m_cuMemPool.create(0, param.internalCsp, sps.numCUsInFrame, param);
-for (uint32_t ctuAddr = 0; ctuAddr < sps.numCUsInFrame; ctuAddr++)
-m_picCTU[ctuAddr].initialize(m_cuMemPool, 0, param, ctuAddr);
+bool isallocated = m_cuMemPool.create(0, param.internalCsp, 
sps.numCUsInFrame, param);
+if (isallocated)
+for (uint32_t ctuAddr = 0; ctuAddr < sps.numCUsInFrame; ctuAddr++)
+m_picCTU[ctuAddr].initialize(m_cuMemPool, 0, param, ctuAddr);
+else
+return false;
 
 CHECKED_MALLOC_ZERO(m_cuStat, RCStatCU, sps.numCUsInFrame);
 CHECKED_MALLOC(m_rowStat, RCStatRow, sps.numCuInHeight);
diff --git a/source/encoder/analysis.cpp b/source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp
+++ b/source/encoder/analysis.cpp
@@ -101,15 +101,17 @@
 {
 ModeDepth  = m_modeDepth[depth];
 
-md.cuMemPool.create(depth, csp, MAX_PRED_TYPES, *m_param);
+ok &= md.cuMemPool.create(depth, csp, MAX_PRED_TYPES, *m_param);
 ok &= md.fencYuv.create(cuSize, csp);
-
-for (int j = 0; j < MAX_PRED_TYPES; j++)
+if (ok)
 {
-md.pred[j].cu.initialize(md.cuMemPool, depth, *m_param, j);
-ok &= md.pred[j].predYuv.create(cuSize, csp);
-ok &= md.pred[j].reconYuv.create(cuSize, csp);
-md.pred[j].fencYuv = 
+for (int j = 0; j < MAX_PRED_TYPES; j++)
+{
+md.pred[j].cu.initialize(md.cuMemPool, depth, *m_param, j);
+ok &= md.pred[j].predYuv.create(cuSize, csp);
+ok &= md.pred[j].reconYuv.create(cuSize, csp);
+md.pred[j].fencYuv = 
+}
 }
 }
 if (m_param->sourceHeight >= 1080)
diff --git a/source/encoder/api.cpp b/source/encoder/api.cpp
--- a/source/encoder/api.cpp
+++ b/source/encoder/api.cpp
@@ -286,7 +286,7 @@
 else if (pi_nal)
 *pi_nal = 0;
 
-if (numEncoded && encoder->m_param->csvLogLevel)
+if (numEncoded > 0 && encoder->m_param->csvLogLevel)
 x265_csvlog_frame(encoder->m_param, pic_out);
 
 if (numEncoded < 0)
diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp
+++ b/source/encoder/encoder.cpp
@@ -1342,7 +1342,9 @@
 }
 else
 {
-frameEnc->allocEncodeData(m_reconfigure ? m_latestParam : 
m_param, m_sps);
+bool isallocated = frameEnc->allocEncodeData(m_reconfigure ? 
m_latestParam : m_param, m_sps);
+if (!isallocated)
+return -1;
 Slice* slice = frameEnc->m_encData->m_slice;
     slice->m_sps = _sps;
 slice->m_pps = _pps;
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1513927117 -19800
#  Fri Dec 22 12:48:37 2017 +0530
# Branch stable
# Node ID f41671b53ae084a8207e24a91d3a7cf2a96cd1ce
# Parent  f7498acb38746d9b799d1b45343a3db56cdba306
Fix possible NULL pointer dereferencing in cudata init

diff --git a/source/common/framedata.cpp b/source/common/framedata.cpp
--- a/source/common/framedata.cpp
+++ b/source/common/framedata.cpp
@@ -41,9 +41,12 @@
 if (param.rc.bStatWrite)
 m_spsrps = const_cast<RPS*>(sps.spsrps);
 
-m_cuMemPool.create(0, param.internalCsp, sps.numCUsInFrame, param);
-for (uint32_t ctuAddr = 0; ctuAddr < sps.numCUsInFrame; ctuAddr++)
-m_picCTU[ctuAddr].initialize(m_cuMemPool, 0, param, ctuAddr);
+bool isallocated = m_cuMemPool.create(0, param.internalCsp, sps.numCUsInFrame, param);
+if (isallocated)
+for (uint32_t ctuAddr = 0; ctuAddr < sps.numCUsInFrame; ctuAddr++)
+m_picCTU[ctuAddr].initialize(m_cuMemPool, 0, param, ctuAddr);
+else
+return false;
 
 CHECKED_MALLOC_ZERO(m_cuStat, RCStatCU, sps.numCUsInFrame);
 CHECKED_MALLOC(m_rowStat, RCStatRow, sps.numCuInHeight);
diff --git a/source/encoder/analysis.cpp b/source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp
+++ b/source/encoder/analysis.cpp
@@ -101,15 +101,17 @@
 {
 ModeDepth  = m_modeDepth[depth];
 
-md.cuMemPool.create(depth, csp, MAX_PRED_TYPES, *m_param);
+ok &= md.cuMemPool.create(depth, csp, MAX_PRED_TYPES, *m_param);
 ok &=

[x265] [PATCH] fix bugs in analysis-reuse-level=7 and refine-mv-type=AVC

2017-12-21 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1513677810 -19800
#  Tue Dec 19 15:33:30 2017 +0530
# Node ID 61b2cbf1f0e4b19d5ec0d0d8675ad10a0befc0f1
# Parent  57eaef9abfd8204b568498d4a37a23391e790d44
fix bugs in analysis-reuse-level=7 and refine-mv-type=AVC

diff --git a/source/encoder/analysis.cpp b/source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp
+++ b/source/encoder/analysis.cpp
@@ -280,7 +280,7 @@
 /* generate residual for entire CTU at once and copy to reconPic */
 encodeResidue(ctu, cuGeom);
 }
-else if ((m_param->analysisReuseMode == X265_ANALYSIS_LOAD && 
m_param->analysisReuseLevel == 10) || ((m_param->bMVType == AVC_INFO) && 
m_param->analysisReuseLevel >= 7))
+else if ((m_param->analysisReuseMode == X265_ANALYSIS_LOAD && 
m_param->analysisReuseLevel == 10) || ((m_param->bMVType == AVC_INFO) && 
m_param->analysisReuseLevel >= 7 && ctu.m_numPartitions <= 16))
 {
 analysis_inter_data* interDataCTU = 
(analysis_inter_data*)m_frame->m_analysisData.interData;
 int posCTU = ctu.m_cuAddr * numPartition;
@@ -461,7 +461,7 @@
 int lambdaQP = lqp;
 
 bool doQPRefine = (bDecidedDepth && depth <= 
m_slice->m_pps->maxCuDQPDepth) || (!bDecidedDepth && depth == 
m_slice->m_pps->maxCuDQPDepth);
-if (m_param->analysisReuseLevel == 10)
+if (m_param->analysisReuseLevel >= 7)
 doQPRefine = false;
 
 if (doQPRefine)
@@ -1307,7 +1307,7 @@
 }
 
 /* Step 1. Evaluate Merge/Skip candidates for likely early-outs, if 
skip mode was not set above */
-if ((mightNotSplit && depth >= minDepth && !md.bestMode && 
!bCtuInfoCheck) || (m_param->bMVType && (m_modeFlag[0] || m_modeFlag[1]))) /* 
TODO: Re-evaluate if analysis load/save still works */
+if ((mightNotSplit && depth >= minDepth && !md.bestMode && 
!bCtuInfoCheck) || (m_param->bMVType && m_param->analysisReuseLevel == 7 && 
(m_modeFlag[0] || m_modeFlag[1]))) /* TODO: Re-evaluate if analysis load/save 
still works */
 {
 /* Compute Merge Cost */
 md.pred[PRED_MERGE].cu.initSubCU(parentCTU, cuGeom, qp);
@@ -1318,7 +1318,7 @@
 && md.bestMode && md.bestMode->cu.isSkipped(0); // TODO: sa8d 
threshold per depth
 }
 
-if (md.bestMode && m_param->bEnableRecursionSkip && !bCtuInfoCheck && 
!(m_param->bMVType && (m_modeFlag[0] || m_modeFlag[1])))
+if (md.bestMode && m_param->bEnableRecursionSkip && !bCtuInfoCheck && 
!(m_param->bMVType && m_param->analysisReuseLevel == 7 && (m_modeFlag[0] || 
m_modeFlag[1])))
 {
 skipRecursion = md.bestMode->cu.isSkipped(0);
 if (mightSplit && depth >= minDepth && !skipRecursion)
@@ -1330,7 +1330,7 @@
 }
 }
 
-if (m_param->bMVType && md.bestMode && cuGeom.numPartitions <= 16)
+if (m_param->bMVType && md.bestMode && cuGeom.numPartitions <= 16 && 
m_param->analysisReuseLevel == 7)
 skipRecursion = true;
 
 /* Step 2. Evaluate each of the 4 split sub-blocks in series */
@@ -1389,8 +1389,19 @@
 }
 
 /* If analysis mode is simple do not Evaluate other modes */
-if ((m_param->bMVType && cuGeom.numPartitions <= 16) && 
(m_slice->m_sliceType == P_SLICE || m_slice->m_sliceType == B_SLICE))
-mightNotSplit = !(m_checkMergeAndSkipOnly[0] || 
(m_checkMergeAndSkipOnly[0] && m_checkMergeAndSkipOnly[1]));
+if (m_param->bMVType && m_param->analysisReuseLevel == 7)
+{
+if (m_slice->m_sliceType == P_SLICE)
+{
+if (m_checkMergeAndSkipOnly[0])
+skipModes = true;
+}
+else
+{
+if (m_checkMergeAndSkipOnly[0] && m_checkMergeAndSkipOnly[1])
+skipModes = true;
+}
+}
 
 /* Split CUs
  *   0  1
@@ -2001,7 +2012,7 @@
 
 /* Step 1. Evaluate Merge/Skip candidates for likely early-outs */
 if ((mightNotSplit && !md.bestMode && !bCtuInfoCheck) ||
-(m_param->bMVType && (m_modeFlag[0] || m_modeFlag[1])))
+(m_param->bMVType && m_param->analysisReuseLevel == 7 && 
(m_modeFlag[0] || m_modeFlag[1])))
 {
 md.pred[PRED_SKIP].cu.initSubCU(parentCTU, cuGeom, qp);
 md.pred[PRED_MERGE].cu.initSubCU(parentCTU, cuGeom, qp);
@@ -2017,7 +2028,7 @@
 s

Re: [x265] [PATCH] fix bugs in analysis-reuse-level=7 and refine-mv-type=AVC

2017-12-20 Thread Santhoshini Sekar
On Thu, Dec 21, 2017 at 12:03 PM, Ashok Kumar Mishra <
as...@multicorewareinc.com> wrote:

>
>
> On Thu, Dec 21, 2017 at 9:03 AM, <santhosh...@multicorewareinc.com> wrote:
>
>> # HG changeset patch
>> # User Santhoshini Sekar <santhosh...@multicorewareinc.com>
>> # Date 1513677810 -19800
>> #  Tue Dec 19 15:33:30 2017 +0530
>> # Node ID 32a2cd5926ed3bc64fc5665f3ecc20e9b371cee2
>> # Parent  57eaef9abfd8204b568498d4a37a23391e790d44
>> fix bugs in analysis-reuse-level=7 and refine-mv-type=AVC
>>
>> diff --git a/source/encoder/analysis.cpp b/source/encoder/analysis.cpp
>> --- a/source/encoder/analysis.cpp
>> +++ b/source/encoder/analysis.cpp
>> @@ -280,7 +280,7 @@
>>  /* generate residual for entire CTU at once and copy to
>> reconPic */
>>  encodeResidue(ctu, cuGeom);
>>  }
>> -else if ((m_param->analysisReuseMode == X265_ANALYSIS_LOAD &&
>> m_param->analysisReuseLevel == 10) || ((m_param->bMVType == AVC_INFO) &&
>> m_param->analysisReuseLevel >= 7))
>> +else if ((m_param->analysisReuseMode == X265_ANALYSIS_LOAD &&
>> m_param->analysisReuseLevel == 10) || ((m_param->bMVType == AVC_INFO) &&
>> m_param->analysisReuseLevel >= 7 && ctu.m_numPartitions <= 16))
>>  {
>>  analysis_inter_data* interDataCTU =
>> (analysis_inter_data*)m_frame->m_analysisData.interData;
>>  int posCTU = ctu.m_cuAddr * numPartition;
>> @@ -461,7 +461,7 @@
>>  int lambdaQP = lqp;
>>
>>  bool doQPRefine = (bDecidedDepth && depth <=
>> m_slice->m_pps->maxCuDQPDepth) || (!bDecidedDepth && depth ==
>> m_slice->m_pps->maxCuDQPDepth);
>> -if (m_param->analysisReuseLevel == 10)
>> +if (m_param->analysisReuseLevel >= 7)
>>  doQPRefine = false;
>>
>>  if (doQPRefine)
>> @@ -1307,7 +1307,7 @@
>>  }
>>
>>  /* Step 1. Evaluate Merge/Skip candidates for likely early-outs,
>> if skip mode was not set above */
>> -if ((mightNotSplit && depth >= minDepth && !md.bestMode &&
>> !bCtuInfoCheck) || (m_param->bMVType && (m_modeFlag[0] || m_modeFlag[1])))
>> /* TODO: Re-evaluate if analysis load/save still works */
>> +if ((mightNotSplit && depth >= minDepth && !md.bestMode &&
>> !bCtuInfoCheck) || (m_param->bMVType && m_param->analysisReuseLevel == 7 &&
>> (m_modeFlag[0] || m_modeFlag[1]))) /* TODO: Re-evaluate if analysis
>> load/save still works */
>>  {
>>  /* Compute Merge Cost */
>>  md.pred[PRED_MERGE].cu.initSubCU(parentCTU, cuGeom, qp);
>> @@ -1318,7 +1318,7 @@
>>  && md.bestMode && md.bestMode->cu.isSkipped(0); // TODO:
>> sa8d threshold per depth
>>  }
>>
>> -if (md.bestMode && m_param->bEnableRecursionSkip &&
>> !bCtuInfoCheck && !(m_param->bMVType && (m_modeFlag[0] || m_modeFlag[1])))
>> +if (md.bestMode && m_param->bEnableRecursionSkip &&
>> !bCtuInfoCheck && !(m_param->bMVType && m_param->analysisReuseLevel == 7 &&
>> (m_modeFlag[0] || m_modeFlag[1])))
>>  {
>>  skipRecursion = md.bestMode->cu.isSkipped(0);
>>  if (mightSplit && depth >= minDepth && !skipRecursion)
>> @@ -1330,7 +1330,7 @@
>>  }
>>  }
>>
>> -if (m_param->bMVType && md.bestMode && cuGeom.numPartitions <=
>> 16)
>> +if (m_param->bMVType && md.bestMode && cuGeom.numPartitions <=
>> 16 && m_param->analysisReuseLevel == 7)
>>  skipRecursion = true;
>>
>>  /* Step 2. Evaluate each of the 4 split sub-blocks in series */
>> @@ -1389,8 +1389,19 @@
>>  }
>>
>>  /* If analysis mode is simple do not Evaluate other modes */
>> -if ((m_param->bMVType && cuGeom.numPartitions <= 16) &&
>> (m_slice->m_sliceType == P_SLICE || m_slice->m_sliceType == B_SLICE))
>> -mightNotSplit = !(m_checkMergeAndSkipOnly[0] ||
>> (m_checkMergeAndSkipOnly[0] && m_checkMergeAndSkipOnly[1]));
>> +if (m_param->bMVType && m_param->analysisReuseLevel == 7)
>> +{
>> +if (m_slice->m_sl

[x265] [PATCH] warn out saying that limitTU=3 or 4 with AVCINFO produces inconsistent output

2017-12-20 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1513827586 -19800
#  Thu Dec 21 09:09:46 2017 +0530
# Node ID 61d829f6d823b14242022a40737f2453865e8937
# Parent  32a2cd5926ed3bc64fc5665f3ecc20e9b371cee2
warn out saying that limitTU=3 or 4 with AVCINFO produces inconsistent output.
Set mincusize to 8  when it is not 8 for MVtype=AVCINFO as AVCINFO expects so

diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp
+++ b/source/encoder/encoder.cpp
@@ -2449,6 +2449,18 @@
 this->m_externalFlush = true;
 else 
 this->m_externalFlush = false;
+
+if (p->bMVType == AVC_INFO && (p->limitTU == 3 || p->limitTU == 4))
+{
+x265_log(p, X265_LOG_WARNING, "limit TU = 3 or 4 with MVType AVCINFO 
produces inconsistent output\n");
+}
+
+if (p->bMVType == AVC_INFO && p->minCUSize != 8)
+{
+p->minCUSize = 8;
+x265_log(p, X265_LOG_WARNING, "Setting minCuSize = 8, AVCINFO expects 
8x8 blocks\n");
+}
+
 if (p->keyframeMax < 0)
 {
 /* A negative max GOP size indicates the user wants only one I frame at
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1513827586 -19800
#  Thu Dec 21 09:09:46 2017 +0530
# Node ID 61d829f6d823b14242022a40737f2453865e8937
# Parent  32a2cd5926ed3bc64fc5665f3ecc20e9b371cee2
warn out saying that limitTU=3 or 4 with AVCINFO produces inconsistent output.
Set mincusize to 8  when it is not 8 for MVtype=AVCINFO as AVCINFO expects so

diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp
+++ b/source/encoder/encoder.cpp
@@ -2449,6 +2449,18 @@
 this->m_externalFlush = true;
 else 
 this->m_externalFlush = false;
+
+if (p->bMVType == AVC_INFO && (p->limitTU == 3 || p->limitTU == 4))
+{
+x265_log(p, X265_LOG_WARNING, "limit TU = 3 or 4 with MVType AVCINFO produces inconsistent output\n");
+}
+
+if (p->bMVType == AVC_INFO && p->minCUSize != 8)
+{
+p->minCUSize = 8;
+x265_log(p, X265_LOG_WARNING, "Setting minCuSize = 8, AVCINFO expects 8x8 blocks\n");
+}
+
 if (p->keyframeMax < 0)
 {
 /* A negative max GOP size indicates the user wants only one I frame at
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] fix bugs in analysis-reuse-level=7 and refine-mv-type=AVC

2017-12-20 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1513677810 -19800
#  Tue Dec 19 15:33:30 2017 +0530
# Node ID 32a2cd5926ed3bc64fc5665f3ecc20e9b371cee2
# Parent  57eaef9abfd8204b568498d4a37a23391e790d44
fix bugs in analysis-reuse-level=7 and refine-mv-type=AVC

diff --git a/source/encoder/analysis.cpp b/source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp
+++ b/source/encoder/analysis.cpp
@@ -280,7 +280,7 @@
 /* generate residual for entire CTU at once and copy to reconPic */
 encodeResidue(ctu, cuGeom);
 }
-else if ((m_param->analysisReuseMode == X265_ANALYSIS_LOAD && 
m_param->analysisReuseLevel == 10) || ((m_param->bMVType == AVC_INFO) && 
m_param->analysisReuseLevel >= 7))
+else if ((m_param->analysisReuseMode == X265_ANALYSIS_LOAD && 
m_param->analysisReuseLevel == 10) || ((m_param->bMVType == AVC_INFO) && 
m_param->analysisReuseLevel >= 7 && ctu.m_numPartitions <= 16))
 {
 analysis_inter_data* interDataCTU = 
(analysis_inter_data*)m_frame->m_analysisData.interData;
 int posCTU = ctu.m_cuAddr * numPartition;
@@ -461,7 +461,7 @@
 int lambdaQP = lqp;
 
 bool doQPRefine = (bDecidedDepth && depth <= 
m_slice->m_pps->maxCuDQPDepth) || (!bDecidedDepth && depth == 
m_slice->m_pps->maxCuDQPDepth);
-if (m_param->analysisReuseLevel == 10)
+if (m_param->analysisReuseLevel >= 7)
 doQPRefine = false;
 
 if (doQPRefine)
@@ -1307,7 +1307,7 @@
 }
 
 /* Step 1. Evaluate Merge/Skip candidates for likely early-outs, if 
skip mode was not set above */
-if ((mightNotSplit && depth >= minDepth && !md.bestMode && 
!bCtuInfoCheck) || (m_param->bMVType && (m_modeFlag[0] || m_modeFlag[1]))) /* 
TODO: Re-evaluate if analysis load/save still works */
+if ((mightNotSplit && depth >= minDepth && !md.bestMode && 
!bCtuInfoCheck) || (m_param->bMVType && m_param->analysisReuseLevel == 7 && 
(m_modeFlag[0] || m_modeFlag[1]))) /* TODO: Re-evaluate if analysis load/save 
still works */
 {
 /* Compute Merge Cost */
 md.pred[PRED_MERGE].cu.initSubCU(parentCTU, cuGeom, qp);
@@ -1318,7 +1318,7 @@
 && md.bestMode && md.bestMode->cu.isSkipped(0); // TODO: sa8d 
threshold per depth
 }
 
-if (md.bestMode && m_param->bEnableRecursionSkip && !bCtuInfoCheck && 
!(m_param->bMVType && (m_modeFlag[0] || m_modeFlag[1])))
+if (md.bestMode && m_param->bEnableRecursionSkip && !bCtuInfoCheck && 
!(m_param->bMVType && m_param->analysisReuseLevel == 7 && (m_modeFlag[0] || 
m_modeFlag[1])))
 {
 skipRecursion = md.bestMode->cu.isSkipped(0);
 if (mightSplit && depth >= minDepth && !skipRecursion)
@@ -1330,7 +1330,7 @@
 }
 }
 
-if (m_param->bMVType && md.bestMode && cuGeom.numPartitions <= 16)
+if (m_param->bMVType && md.bestMode && cuGeom.numPartitions <= 16 && 
m_param->analysisReuseLevel == 7)
 skipRecursion = true;
 
 /* Step 2. Evaluate each of the 4 split sub-blocks in series */
@@ -1389,8 +1389,19 @@
 }
 
 /* If analysis mode is simple do not Evaluate other modes */
-if ((m_param->bMVType && cuGeom.numPartitions <= 16) && 
(m_slice->m_sliceType == P_SLICE || m_slice->m_sliceType == B_SLICE))
-mightNotSplit = !(m_checkMergeAndSkipOnly[0] || 
(m_checkMergeAndSkipOnly[0] && m_checkMergeAndSkipOnly[1]));
+if (m_param->bMVType && m_param->analysisReuseLevel == 7)
+{
+if (m_slice->m_sliceType == P_SLICE)
+{
+if (m_checkMergeAndSkipOnly[0])
+skipModes = true;
+}
+else
+{
+if (m_checkMergeAndSkipOnly[0] && m_checkMergeAndSkipOnly[1])
+skipModes = true;
+}
+}
 
 /* Split CUs
  *   0  1
@@ -2001,7 +2012,7 @@
 
 /* Step 1. Evaluate Merge/Skip candidates for likely early-outs */
 if ((mightNotSplit && !md.bestMode && !bCtuInfoCheck) ||
-(m_param->bMVType && (m_modeFlag[0] || m_modeFlag[1])))
+(m_param->bMVType && m_param->analysisReuseLevel == 7 && 
(m_modeFlag[0] || m_modeFlag[1])))
 {
 md.pred[PRED_SKIP].cu.initSubCU(parentCTU, cuGeom, qp);
 md.pred[PRED_MERGE].cu.initSubCU(parentCTU, cuGeom, qp);
@@ -2017,7 +2028,7 @@
 s

[x265] [PATCH] modify api x265_get_ref_frame_list to provide POC lists for L0 and L1 references

2017-12-12 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1513082044 -19800
#  Tue Dec 12 18:04:04 2017 +0530
# Node ID e71e59aba01927aecd35115aba4a7180817c6da3
# Parent  6b079854e56e5ff3eaa11eab658989e95e2d9152
modify api x265_get_ref_frame_list to provide POC lists for L0 and L1 references

diff --git a/doc/reST/api.rst b/doc/reST/api.rst
--- a/doc/reST/api.rst
+++ b/doc/reST/api.rst
@@ -206,7 +206,7 @@
 /* x265_get_ref_frame_list:
  * returns negative on error, 0 when access unit were output.
  * This API must be called after(poc >= lookaheadDepth + bframes + 2) 
condition check */
- int x265_get_ref_frame_list(x265_encoder *encoder, x265_picyuv**, 
x265_picyuv**, int, int);
+ int x265_get_ref_frame_list(x265_encoder *encoder, x265_picyuv**, 
x265_picyuv**, int, int, int*, int*);
  
 **x265_encoder_ctu_info** may be used to provide additional CTU-specific 
information to the encoder::
 
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -29,7 +29,7 @@
 option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)
 mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 147)
+set(X265_BUILD 148)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff --git a/source/encoder/api.cpp b/source/encoder/api.cpp
--- a/source/encoder/api.cpp
+++ b/source/encoder/api.cpp
@@ -356,13 +356,13 @@
 return -1;
 }
 
-int x265_get_ref_frame_list(x265_encoder *enc, x265_picyuv** l0, x265_picyuv** 
l1, int sliceType, int poc)
+int x265_get_ref_frame_list(x265_encoder *enc, x265_picyuv** l0, x265_picyuv** 
l1, int sliceType, int poc, int* pocL0, int* pocL1)
 {
 if (!enc)
 return -1;
 
 Encoder *encoder = static_cast<Encoder*>(enc);
-return encoder->getRefFrameList((PicYuv**)l0, (PicYuv**)l1, sliceType, 
poc);
+return encoder->getRefFrameList((PicYuv**)l0, (PicYuv**)l1, sliceType, 
poc, pocL0, pocL1);
 }
 
 int x265_set_analysis_data(x265_encoder *enc, x265_analysis_data 
*analysis_data, int poc, uint32_t cuBytes)
diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp
+++ b/source/encoder/encoder.cpp
@@ -448,7 +448,7 @@
 return 0;
 }
 
-int Encoder::getRefFrameList(PicYuv** l0, PicYuv** l1, int sliceType, int poc)
+int Encoder::getRefFrameList(PicYuv** l0, PicYuv** l1, int sliceType, int poc, 
int* pocL0, int* pocL1)
 {
 if (!(IS_X265_TYPE_I(sliceType)))
 {
@@ -460,6 +460,7 @@
 if (framePtr->m_encData->m_slice->m_refFrameList[0][j] && 
framePtr->m_encData->m_slice->m_refFrameList[0][j]->m_reconPic != NULL)
 {
 int l0POC = 
framePtr->m_encData->m_slice->m_refFrameList[0][j]->m_poc;
+pocL0[j] = l0POC;
 Frame* l0Fp = m_dpb->m_picList.getPOC(l0POC);
 while (l0Fp->m_reconRowFlag[l0Fp->m_numRows - 1].get() == 
0)
 l0Fp->m_reconRowFlag[l0Fp->m_numRows - 
1].waitForChange(0); /* If recon is not ready, current frame encoder has to 
wait. */
@@ -471,6 +472,7 @@
 if (framePtr->m_encData->m_slice->m_refFrameList[1][j] && 
framePtr->m_encData->m_slice->m_refFrameList[1][j]->m_reconPic != NULL)
 {
 int l1POC = 
framePtr->m_encData->m_slice->m_refFrameList[1][j]->m_poc;
+pocL1[j] = l1POC;
 Frame* l1Fp = m_dpb->m_picList.getPOC(l1POC);
 while (l1Fp->m_reconRowFlag[l1Fp->m_numRows - 1].get() == 
0)
 l1Fp->m_reconRowFlag[l1Fp->m_numRows - 
1].waitForChange(0); /* If recon is not ready, current frame encoder has to 
wait. */
diff --git a/source/encoder/encoder.h b/source/encoder/encoder.h
--- a/source/encoder/encoder.h
+++ b/source/encoder/encoder.h
@@ -208,7 +208,7 @@
 
 int copySlicetypePocAndSceneCut(int *slicetype, int *poc, int *sceneCut);
 
-int getRefFrameList(PicYuv** l0, PicYuv** l1, int sliceType, int poc);
+int getRefFrameList(PicYuv** l0, PicYuv** l1, int sliceType, int poc, int* 
pocL0, int* pocL1);
 
 int setAnalysisDataAfterZScan(x265_analysis_data *analysis_data, Frame* 
curFrame);
 
diff --git a/source/x265.h b/source/x265.h
--- a/source/x265.h
+++ b/source/x265.h
@@ -1746,7 +1746,7 @@
 /* x265_get_ref_frame_list:
  * returns negative on error, 0 when access unit were output.
  * This API must be called after(poc >= lookaheadDepth + bframes + 2) 
condition check */
-int x265_get_ref_frame_list(x265_encoder *encoder, x265_picyuv**, 
x265_picyu

[x265] [PATCH 1 of 2] wait until the last row of recon is complete. Waiting on m_reconEncoded doesn't

2017-12-04 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1512383899 -19800
#  Mon Dec 04 16:08:19 2017 +0530
# Node ID ee9a82d856a5f726bbca9380c3539e70a8ab8913
# Parent  c353f34a532c16b0db02fbba7b928b71e9300996
wait until the last row of recon is complete. Waiting on m_reconEncoded doesn't
ensure full recon generation.

diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp
+++ b/source/encoder/encoder.cpp
@@ -463,8 +463,8 @@
 {
 int l0POC = 
framePtr->m_encData->m_slice->m_refFrameList[0][j]->m_poc;
 Frame* l0Fp = m_dpb->m_picList.getPOC(l0POC);
-if (l0Fp->m_reconPic->m_picOrg[0] == NULL)
-l0Fp->m_reconEncoded.wait(); /* If recon is not ready, 
current frame encoder need to wait. */
+while (l0Fp->m_reconRowFlag[l0Fp->m_numRows - 1].get() == 
0)
+l0Fp->m_reconRowFlag[l0Fp->m_numRows - 
1].waitForChange(0); /* If recon is not ready, current frame encoder has to 
wait. */
 l0[j] = l0Fp->m_reconPic;
 }
 }
@@ -474,8 +474,8 @@
 {
 int l1POC = 
framePtr->m_encData->m_slice->m_refFrameList[1][j]->m_poc;
 Frame* l1Fp = m_dpb->m_picList.getPOC(l1POC);
-if (l1Fp->m_reconPic->m_picOrg[0] == NULL)
-l1Fp->m_reconEncoded.wait(); /* If recon is not ready, 
current frame encoder need to wait. */
+while (l1Fp->m_reconRowFlag[l1Fp->m_numRows - 1].get() == 
0)
+l1Fp->m_reconRowFlag[l1Fp->m_numRows - 
1].waitForChange(0); /* If recon is not ready, current frame encoder has to 
wait. */
 l1[j] = l1Fp->m_reconPic;
 }
 }
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1512383899 -19800
#  Mon Dec 04 16:08:19 2017 +0530
# Node ID ee9a82d856a5f726bbca9380c3539e70a8ab8913
# Parent  c353f34a532c16b0db02fbba7b928b71e9300996
wait until the last row of recon is complete. Waiting on m_reconEncoded doesn't
ensure full recon generation.

diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp
+++ b/source/encoder/encoder.cpp
@@ -463,8 +463,8 @@
 {
 int l0POC = framePtr->m_encData->m_slice->m_refFrameList[0][j]->m_poc;
 Frame* l0Fp = m_dpb->m_picList.getPOC(l0POC);
-if (l0Fp->m_reconPic->m_picOrg[0] == NULL)
-l0Fp->m_reconEncoded.wait(); /* If recon is not ready, current frame encoder need to wait. */
+while (l0Fp->m_reconRowFlag[l0Fp->m_numRows - 1].get() == 0)
+l0Fp->m_reconRowFlag[l0Fp->m_numRows - 1].waitForChange(0); /* If recon is not ready, current frame encoder has to wait. */
 l0[j] = l0Fp->m_reconPic;
 }
 }
@@ -474,8 +474,8 @@
 {
 int l1POC = framePtr->m_encData->m_slice->m_refFrameList[1][j]->m_poc;
 Frame* l1Fp = m_dpb->m_picList.getPOC(l1POC);
-if (l1Fp->m_reconPic->m_picOrg[0] == NULL)
-l1Fp->m_reconEncoded.wait(); /* If recon is not ready, current frame encoder need to wait. */
+while (l1Fp->m_reconRowFlag[l1Fp->m_numRows - 1].get() == 0)
+l1Fp->m_reconRowFlag[l1Fp->m_numRows - 1].waitForChange(0); /* If recon is not ready, current frame encoder has to wait. */
 l1[j] = l1Fp->m_reconPic;
 }
 }
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH 2 of 2] remove unnecessary event m_reconEncoded from Frame class

2017-12-04 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1512384225 -19800
#  Mon Dec 04 16:13:45 2017 +0530
# Node ID 3a19517748f927b0587f0978eb4e9de213ec9ab1
# Parent  ee9a82d856a5f726bbca9380c3539e70a8ab8913
remove unnecessary event m_reconEncoded from Frame class

diff --git a/source/common/frame.h b/source/common/frame.h
--- a/source/common/frame.h
+++ b/source/common/frame.h
@@ -98,7 +98,6 @@
 
 float* m_quantOffsets;   // points to quantOffsets in 
x265_picture
 x265_sei   m_userSEI;
-Event  m_reconEncoded;
 
 /* Frame Parallelism - notification between FrameEncoders of available 
motion reference rows */
 ThreadSafeInteger* m_reconRowFlag;   // flag of CTU rows 
completely reconstructed and extended for motion reference
diff --git a/source/encoder/frameencoder.cpp b/source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp
+++ b/source/encoder/frameencoder.cpp
@@ -342,8 +342,6 @@
 }
 compressFrame();
 m_done.trigger(); /* FrameEncoder::getEncodedPicture() blocks for this 
event */
-if (m_frame != NULL)
-m_frame->m_reconEncoded.trigger();
 m_enable.wait();
 }
 }
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1512384225 -19800
#  Mon Dec 04 16:13:45 2017 +0530
# Node ID 3a19517748f927b0587f0978eb4e9de213ec9ab1
# Parent  ee9a82d856a5f726bbca9380c3539e70a8ab8913
remove unnecessary event m_reconEncoded from Frame class

diff --git a/source/common/frame.h b/source/common/frame.h
--- a/source/common/frame.h
+++ b/source/common/frame.h
@@ -98,7 +98,6 @@
 
 float* m_quantOffsets;   // points to quantOffsets in x265_picture
 x265_sei   m_userSEI;
-Event  m_reconEncoded;
 
 /* Frame Parallelism - notification between FrameEncoders of available motion reference rows */
 ThreadSafeInteger* m_reconRowFlag;   // flag of CTU rows completely reconstructed and extended for motion reference
diff --git a/source/encoder/frameencoder.cpp b/source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp
+++ b/source/encoder/frameencoder.cpp
@@ -342,8 +342,6 @@
 }
 compressFrame();
 m_done.trigger(); /* FrameEncoder::getEncodedPicture() blocks for this event */
-if (m_frame != NULL)
-m_frame->m_reconEncoded.trigger();
 m_enable.wait();
 }
 }
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] deblock: set reference frame to NULL if refIdx < 0. Dereferencing refFrameList when

2017-12-01 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1512043592 -19800
#  Thu Nov 30 17:36:32 2017 +0530
# Branch stable
# Node ID f9d08feabf7b2607561d337e5048657a786a7c68
# Parent  b0d89eaaebcf3534204e054243d402b6cf646234
deblock: set reference frame to NULL if refIdx < 0. Dereferencing refFrameList 
when
refIdx < 0 is not valid

diff --git a/source/common/deblock.cpp b/source/common/deblock.cpp
--- a/source/common/deblock.cpp
+++ b/source/common/deblock.cpp
@@ -208,8 +208,8 @@
 const Slice* const sliceQ = cuQ->m_slice;
 const Slice* const sliceP = cuP->m_slice;
 
-const Frame* refP0 = sliceP->m_refFrameList[0][cuP->m_refIdx[0][partP]];
-const Frame* refQ0 = sliceQ->m_refFrameList[0][cuQ->m_refIdx[0][partQ]];
+const Frame* refP0 = (cuP->m_refIdx[0][partP] >= 0) ? 
sliceP->m_refFrameList[0][cuP->m_refIdx[0][partP]] : NULL;
+const Frame* refQ0 = (cuQ->m_refIdx[0][partQ] >= 0) ? 
sliceQ->m_refFrameList[0][cuQ->m_refIdx[0][partQ]] : NULL;
 const MV& mvP0 = refP0 ? cuP->m_mv[0][partP] : zeroMv;
 const MV& mvQ0 = refQ0 ? cuQ->m_mv[0][partQ] : zeroMv;
 
@@ -220,8 +220,8 @@
 }
 
 // (sliceQ->isInterB() || sliceP->isInterB())
-const Frame* refP1 = sliceP->m_refFrameList[1][cuP->m_refIdx[1][partP]];
-const Frame* refQ1 = sliceQ->m_refFrameList[1][cuQ->m_refIdx[1][partQ]];
+const Frame* refP1 = (cuP->m_refIdx[1][partP] >= 0) ? 
sliceP->m_refFrameList[1][cuP->m_refIdx[1][partP]] : NULL;
+const Frame* refQ1 = (cuQ->m_refIdx[1][partQ] >= 0) ? 
sliceQ->m_refFrameList[1][cuQ->m_refIdx[1][partQ]] : NULL;
 const MV& mvP1 = refP1 ? cuP->m_mv[1][partP] : zeroMv;
 const MV& mvQ1 = refQ1 ? cuQ->m_mv[1][partQ] : zeroMv;
 
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1512043592 -19800
#  Thu Nov 30 17:36:32 2017 +0530
# Branch stable
# Node ID f9d08feabf7b2607561d337e5048657a786a7c68
# Parent  b0d89eaaebcf3534204e054243d402b6cf646234
deblock: set reference frame to NULL if refIdx < 0. Dereferencing refFrameList when
refIdx < 0 is not valid

diff --git a/source/common/deblock.cpp b/source/common/deblock.cpp
--- a/source/common/deblock.cpp
+++ b/source/common/deblock.cpp
@@ -208,8 +208,8 @@
 const Slice* const sliceQ = cuQ->m_slice;
 const Slice* const sliceP = cuP->m_slice;
 
-const Frame* refP0 = sliceP->m_refFrameList[0][cuP->m_refIdx[0][partP]];
-const Frame* refQ0 = sliceQ->m_refFrameList[0][cuQ->m_refIdx[0][partQ]];
+const Frame* refP0 = (cuP->m_refIdx[0][partP] >= 0) ? sliceP->m_refFrameList[0][cuP->m_refIdx[0][partP]] : NULL;
+const Frame* refQ0 = (cuQ->m_refIdx[0][partQ] >= 0) ? sliceQ->m_refFrameList[0][cuQ->m_refIdx[0][partQ]] : NULL;
 const MV& mvP0 = refP0 ? cuP->m_mv[0][partP] : zeroMv;
 const MV& mvQ0 = refQ0 ? cuQ->m_mv[0][partQ] : zeroMv;
 
@@ -220,8 +220,8 @@
 }
 
 // (sliceQ->isInterB() || sliceP->isInterB())
-const Frame* refP1 = sliceP->m_refFrameList[1][cuP->m_refIdx[1][partP]];
-const Frame* refQ1 = sliceQ->m_refFrameList[1][cuQ->m_refIdx[1][partQ]];
+const Frame* refP1 = (cuP->m_refIdx[1][partP] >= 0) ? sliceP->m_refFrameList[1][cuP->m_refIdx[1][partP]] : NULL;
+const Frame* refQ1 = (cuQ->m_refIdx[1][partQ] >= 0) ? sliceQ->m_refFrameList[1][cuQ->m_refIdx[1][partQ]] : NULL;
 const MV& mvP1 = refP1 ? cuP->m_mv[1][partP] : zeroMv;
 const MV& mvQ1 = refQ1 ? cuQ->m_mv[1][partQ] : zeroMv;
 
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


Re: [x265] [PATCH] Enable skip RD analysis intra (when sum of sub CUsplitcost bigger than non-split cost) in default param options

2017-11-15 Thread Santhoshini Sekar
Enabling splitRdSkip for Intra is not giving a bit exact output and there
is loss in compression efficiency. The reason behind this is that the
context of the entropy coder and bits are updated after all the sub CUs are
analysed whereas bEnableSplitRdSkip is terminating the analysis of the
subCUs at a much early stage.  The entropy coder can save more bits for the
sub CUs and finally the subCUs can become cheaper.

On Fri, Nov 10, 2017 at 4:11 PM,  wrote:

> # HG changeset patch
> # User Aasaipriya Chandran 
> # Date 1510220385 -19800
> #  Thu Nov 09 15:09:45 2017 +0530
> # Node ID 5f2c98ebd15e5935697c985ce856b9400d1a2ebc
> # Parent  bd438ce108435deb4f0063fca9a9e14a75e8de38
> Enable skip RD analysis intra (when sum of sub CUsplitcost bigger than
> non-split cost) in default param options
>
> diff -r bd438ce10843 -r 5f2c98ebd15e source/common/param.cpp
> --- a/source/common/param.cpp   Wed Nov 08 16:18:29 2017 +0530
> +++ b/source/common/param.cpp   Thu Nov 09 15:09:45 2017 +0530
> @@ -157,7 +157,7 @@
>  param->bEnableConstrainedIntra = 0;
>  param->bEnableStrongIntraSmoothing = 1;
>  param->bEnableFastIntra = 0;
> -param->bEnableSplitRdSkip = 0;
> +param->bEnableSplitRdSkip = 1;
>
>  /* Inter Coding tools */
>  param->searchMethod = X265_HEX_SEARCH;
> ___
> x265-devel mailing list
> x265-devel@videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] add help information for refine-mv-type

2017-11-08 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1510137267 -19800
#  Wed Nov 08 16:04:27 2017 +0530
# Node ID 6a882a9300c2ed97a8b7ee539eb58fd53953a0ac
# Parent  4ed6afba60476fb7620889c533248c6c396474ab
add help information for refine-mv-type

diff --git a/source/x265cli.h b/source/x265cli.h
--- a/source/x265cli.h
+++ b/source/x265cli.h
@@ -461,6 +461,7 @@
 H0("   --analysis-reuse-mode <string|int>  save - Dump analysis info into 
file, load - Load analysis buffers from the file. Default %d\n", 
param->analysisReuseMode);
 H0("   --analysis-reuse-file Specify file name used for 
either dumping or reading analysis data. Deault x265_analysis.dat\n");
 H0("   --analysis-reuse-level <1..10>  Level of analysis reuse 
indicates amount of info stored/reused in save/load mode, 1:least..10:most. 
Default %d\n", param->analysisReuseLevel);
+H0("   --refine-mv-type  Reuse MV information received through 
API call. Supported option is avc. Default disabled - %d\n", param->bMVType);
 H0("   --scale-factor   Specify factor by which input video 
is scaled down for analysis save mode. Default %d\n", param->scaleFactor);
 H0("   --refine-intra <0..3> Enable intra refinement for encode 
that uses analysis-reuse-mode=load.\n"
 "        - 0 : Forces both mode and depth 
from the save encode.\n"
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1510137267 -19800
#  Wed Nov 08 16:04:27 2017 +0530
# Node ID 6a882a9300c2ed97a8b7ee539eb58fd53953a0ac
# Parent  4ed6afba60476fb7620889c533248c6c396474ab
add help information for refine-mv-type

diff --git a/source/x265cli.h b/source/x265cli.h
--- a/source/x265cli.h
+++ b/source/x265cli.h
@@ -461,6 +461,7 @@
 H0("   --analysis-reuse-mode <string|int>  save - Dump analysis info into file, load - Load analysis buffers from the file. Default %d\n", param->analysisReuseMode);
 H0("   --analysis-reuse-file Specify file name used for either dumping or reading analysis data. Deault x265_analysis.dat\n");
 H0("   --analysis-reuse-level <1..10>  Level of analysis reuse indicates amount of info stored/reused in save/load mode, 1:least..10:most. Default %d\n", param->analysisReuseLevel);
+H0("   --refine-mv-type  Reuse MV information received through API call. Supported option is avc. Default disabled - %d\n", param->bMVType);
 H0("   --scale-factor   Specify factor by which input video is scaled down for analysis save mode. Default %d\n", param->scaleFactor);
 H0("   --refine-intra <0..3> Enable intra refinement for encode that uses analysis-reuse-mode=load.\n"
 "- 0 : Forces both mode and depth from the save encode.\n"
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


Re: [x265] [PATCH 2 of 4] add new CLI refine-mv-type

2017-11-08 Thread Santhoshini Sekar
Thanks for pointing this out. I'll make the change.



On Wed, Nov 8, 2017 at 3:17 PM, Mario *LigH* Rohkrämer 
wrote:

> A CLI help line is yet missing, even in full output level.
>
> --
>
> Fun and success!
> Mario *LigH* Rohkrämer
> mailto:cont...@ligh.de
>
> ___
> x265-devel mailing list
> x265-devel@videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH 1 of 2] export API functions x265_get_slicetype_poc_and_scenecut() and x265_get_ref_frame_list() to x265.def.in

2017-11-06 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1510038127 -19800
#  Tue Nov 07 12:32:07 2017 +0530
# Node ID efdaa0e92850f865adc7c5becba47623ba2b4ec1
# Parent  e5d68466150ca6d68e8222e346614c8e5a97f77f
export API functions x265_get_slicetype_poc_and_scenecut() and 
x265_get_ref_frame_list() to x265.def.in

diff --git a/source/x265.def.in b/source/x265.def.in
--- a/source/x265.def.in
+++ b/source/x265.def.in
@@ -24,3 +24,5 @@
 x265_api_query
 x265_encoder_intra_refresh
 x265_encoder_ctu_info
+x265_get_slicetype_poc_and_scenecut
+x265_get_ref_frame_list
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1510038127 -19800
#  Tue Nov 07 12:32:07 2017 +0530
# Node ID efdaa0e92850f865adc7c5becba47623ba2b4ec1
# Parent  e5d68466150ca6d68e8222e346614c8e5a97f77f
export API functions x265_get_slicetype_poc_and_scenecut() and x265_get_ref_frame_list() to x265.def.in

diff --git a/source/x265.def.in b/source/x265.def.in
--- a/source/x265.def.in
+++ b/source/x265.def.in
@@ -24,3 +24,5 @@
 x265_api_query
 x265_encoder_intra_refresh
 x265_encoder_ctu_info
+x265_get_slicetype_poc_and_scenecut
+x265_get_ref_frame_list
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH 2 of 2] rename function pointer names for x265_get_slicetype_poc_and_scenecut() and x265_get_ref_frame_list() in x265_api

2017-11-06 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1510038803 -19800
#  Tue Nov 07 12:43:23 2017 +0530
# Node ID 3922804ac1a9d3fff4a4ba8dcde0b36b827fea0b
# Parent  efdaa0e92850f865adc7c5becba47623ba2b4ec1
rename function pointer names for x265_get_slicetype_poc_and_scenecut() and 
x265_get_ref_frame_list() in x265_api

diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -29,7 +29,7 @@
 option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)
 mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 141)
+set(X265_BUILD 142)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff --git a/source/x265.h b/source/x265.h
--- a/source/x265.h
+++ b/source/x265.h
@@ -1791,8 +1791,8 @@
 int   sizeof_frame_stats;   /* sizeof(x265_frame_stats) */
 int   (*encoder_intra_refresh)(x265_encoder*);
 int   (*encoder_ctu_info)(x265_encoder*, int, x265_ctu_info_t**);
-int   (*x265_get_slicetype_poc_and_scenecut)(x265_encoder*, int*, 
int*, int*);
-int   (*x265_get_ref_frame_list)(x265_encoder*, x265_picyuv**, 
x265_picyuv**, int, int);
+int   (*get_slicetype_poc_and_scenecut)(x265_encoder*, int*, int*, 
int*);
+int   (*get_ref_frame_list)(x265_encoder*, x265_picyuv**, 
x265_picyuv**, int, int);
 /* add new pointers to the end, or increment X265_MAJOR_VERSION */
 } x265_api;
 
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1510038803 -19800
#  Tue Nov 07 12:43:23 2017 +0530
# Node ID 3922804ac1a9d3fff4a4ba8dcde0b36b827fea0b
# Parent  efdaa0e92850f865adc7c5becba47623ba2b4ec1
rename function pointer names for x265_get_slicetype_poc_and_scenecut() and x265_get_ref_frame_list() in x265_api

diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -29,7 +29,7 @@
 option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)
 mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 141)
+set(X265_BUILD 142)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff --git a/source/x265.h b/source/x265.h
--- a/source/x265.h
+++ b/source/x265.h
@@ -1791,8 +1791,8 @@
 int   sizeof_frame_stats;   /* sizeof(x265_frame_stats) */
 int   (*encoder_intra_refresh)(x265_encoder*);
 int   (*encoder_ctu_info)(x265_encoder*, int, x265_ctu_info_t**);
-int   (*x265_get_slicetype_poc_and_scenecut)(x265_encoder*, int*, int*, int*);
-int   (*x265_get_ref_frame_list)(x265_encoder*, x265_picyuv**, x265_picyuv**, int, int);
+int   (*get_slicetype_poc_and_scenecut)(x265_encoder*, int*, int*, int*);
+int   (*get_ref_frame_list)(x265_encoder*, x265_picyuv**, x265_picyuv**, int, int);
 /* add new pointers to the end, or increment X265_MAJOR_VERSION */
 } x265_api;
 
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH 3 of 4] wait for the event of copying MV data if refine-mv-type is enabled

2017-11-06 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1502274740 -19800
#  Wed Aug 09 16:02:20 2017 +0530
# Node ID 82708090cf1d29c4a81ff99acbb5945c86b81185
# Parent  429abad792be670195e22782b772eea814100f61
wait for the event of copying MV data if refine-mv-type is enabled

diff --git a/source/common/frame.h b/source/common/frame.h
--- a/source/common/frame.h
+++ b/source/common/frame.h
@@ -113,6 +113,8 @@
 x265_analysis_2Passm_analysis2Pass;
 RcStats*   m_rcData;
 
+Event  m_copyMVType;
+
 x265_ctu_info_t**  m_ctuInfo;
 Event  m_copied;
 int*   m_prevCtuInfoChange;
diff --git a/source/encoder/frameencoder.cpp b/source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp
+++ b/source/encoder/frameencoder.cpp
@@ -335,6 +335,11 @@
 while (!m_frame->m_ctuInfo)
 m_frame->m_copied.wait();
 }
+if ((m_param->bMVType == AVC_INFO) && !m_param->analysisReuseMode && 
!(IS_X265_TYPE_I(m_frame->m_lowres.sliceType)))
+{
+while (((m_frame->m_analysisData.interData == NULL && 
m_frame->m_analysisData.intraData == NULL) || (uint32_t)m_frame->m_poc != 
m_frame->m_analysisData.poc))
+m_frame->m_copyMVType.wait();
+}
 compressFrame();
 m_done.trigger(); /* FrameEncoder::getEncodedPicture() blocks for this 
event */
 if (m_frame != NULL)
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1502274740 -19800
#  Wed Aug 09 16:02:20 2017 +0530
# Node ID 82708090cf1d29c4a81ff99acbb5945c86b81185
# Parent  429abad792be670195e22782b772eea814100f61
wait for the event of copying MV data if refine-mv-type is enabled

diff --git a/source/common/frame.h b/source/common/frame.h
--- a/source/common/frame.h
+++ b/source/common/frame.h
@@ -113,6 +113,8 @@
 x265_analysis_2Passm_analysis2Pass;
 RcStats*   m_rcData;
 
+Event  m_copyMVType;
+
 x265_ctu_info_t**  m_ctuInfo;
 Event  m_copied;
 int*   m_prevCtuInfoChange;
diff --git a/source/encoder/frameencoder.cpp b/source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp
+++ b/source/encoder/frameencoder.cpp
@@ -335,6 +335,11 @@
 while (!m_frame->m_ctuInfo)
 m_frame->m_copied.wait();
 }
+if ((m_param->bMVType == AVC_INFO) && !m_param->analysisReuseMode && !(IS_X265_TYPE_I(m_frame->m_lowres.sliceType)))
+{
+while (((m_frame->m_analysisData.interData == NULL && m_frame->m_analysisData.intraData == NULL) || (uint32_t)m_frame->m_poc != m_frame->m_analysisData.poc))
+m_frame->m_copyMVType.wait();
+}
 compressFrame();
 m_done.trigger(); /* FrameEncoder::getEncodedPicture() blocks for this event */
 if (m_frame != NULL)
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH 2 of 4] add new CLI refine-mv-type

2017-11-06 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1509956542 -19800
#  Mon Nov 06 13:52:22 2017 +0530
# Node ID 429abad792be670195e22782b772eea814100f61
# Parent  dea515c3180ab2e45c1682bd258683fdf2f16ae6
add new CLI refine-mv-type

diff --git a/doc/reST/cli.rst b/doc/reST/cli.rst
--- a/doc/reST/cli.rst
+++ b/doc/reST/cli.rst
@@ -887,6 +887,11 @@
| 10 | Level 5 + Full CU analysis-info |
++-+
 
+.. option:: --refine-mv-type 
+
+Reuse MV information received through API call. Currently receives 
information for AVC size and the accepted 
+string input is "avc". Default is disabled.
+
 .. option:: --scale-factor
 
Factor by which input video is scaled down for analysis save mode.
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -29,7 +29,7 @@
 option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)
 mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 140)
+set(X265_BUILD 141)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff --git a/source/common/frame.cpp b/source/common/frame.cpp
--- a/source/common/frame.cpp
+++ b/source/common/frame.cpp
@@ -77,6 +77,14 @@
 }
 }
 
+if (param->bMVType == AVC_INFO)
+{
+m_analysisData.wt = NULL;
+m_analysisData.intraData = NULL;
+m_analysisData.interData = NULL;
+m_analysis2Pass.analysisFramedata = NULL;
+}
+
 if (m_fencPic->create(param) && m_lowres.create(m_fencPic, param->bframes, 
!!param->rc.aqMode || !!param->bAQMotion, param->rc.qgSize))
 {
 X265_CHECK((m_reconColCount == NULL), "m_reconColCount was 
initialized");
diff --git a/source/common/param.cpp b/source/common/param.cpp
--- a/source/common/param.cpp
+++ b/source/common/param.cpp
@@ -293,6 +293,7 @@
 
 /* DCT Approximations */
 param->bLowPassDct = 0;
+param->bMVType = 0;
 }
 
 int x265_param_default_preset(x265_param* param, const char* preset, const 
char* tune)
@@ -986,6 +987,21 @@
OPT("lowpass-dct") p->bLowPassDct = atobool(value);
 OPT("vbv-end") p->vbvBufferEnd = atof(value);
 OPT("vbv-end-fr-adj") p->vbvEndFrameAdjust = atof(value);
+OPT("refine-mv-type")
+{
+if (strcmp(strdup(value), "avc") == 0)
+{
+p->bMVType = AVC_INFO;
+}
+else if (strcmp(strdup(value), "off") == 0)
+{
+p->bMVType = NO_INFO;
+}
+else
+{
+bError = true;
+}
+ }
 else
 return X265_PARAM_BAD_NAME;
 }
@@ -1474,6 +1490,8 @@
 TOOLVAL(param->lookaheadSlices, "lslices=%d");
 TOOLVAL(param->lookaheadThreads, "lthreads=%d")
 TOOLVAL(param->bCTUInfo, "ctu-info=%d");
+if (param->bMVType == AVC_INFO)
+TOOLOPT(param->bMVType, "refine-mv-type=avc");
 if (param->maxSlices > 1)
 TOOLVAL(param->maxSlices, "slices=%d");
 if (param->bEnableLoopFilter)
@@ -1699,6 +1717,7 @@
 BOOL(p->bLimitSAO, "limit-sao");
 s += sprintf(s, " ctu-info=%d", p->bCTUInfo);
 BOOL(p->bLowPassDct, "lowpass-dct");
+s += sprintf(s, " refine-mv-type=%d", p->bMVType);
 #undef BOOL
 return buf;
 }
diff --git a/source/encoder/analysis.cpp b/source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp
+++ b/source/encoder/analysis.cpp
@@ -250,14 +250,14 @@
 /* generate residual for entire CTU at once and copy to reconPic */
 encodeResidue(ctu, cuGeom);
 }
-else if (m_param->analysisReuseMode == X265_ANALYSIS_LOAD && 
m_param->analysisReuseLevel == 10)
+else if ((m_param->analysisReuseMode == X265_ANALYSIS_LOAD && 
m_param->analysisReuseLevel == 10) || ((m_param->bMVType == AVC_INFO) && 
m_param->analysisReuseLevel >= 7))
 {
 analysis_inter_data* interDataCTU = 
(analysis_inter_data*)m_frame->m_analysisData.interData;
 int posCTU = ctu.m_cuAddr * numPartition;
 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);
-if (m_slice->m_slice

[x265] [PATCH 4 of 4] Do not wait until all the frames in a stream are flushed, return to API as soon as one frame is flushed

2017-11-06 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1502275399 -19800
#  Wed Aug 09 16:13:19 2017 +0530
# Node ID e5d68466150ca6d68e8222e346614c8e5a97f77f
# Parent  82708090cf1d29c4a81ff99acbb5945c86b81185
Do not wait until all the frames in a stream are flushed, return to API as soon 
as one frame is flushed.


In few cases it is better to flush only one frame in x265-lib and return to 
API. The
application should flush the remaining frames in the stream in these 
situations. This is
especially useful when the application wants to retrieve information from the 
lib.

diff --git a/source/encoder/api.cpp b/source/encoder/api.cpp
--- a/source/encoder/api.cpp
+++ b/source/encoder/api.cpp
@@ -257,7 +257,9 @@
 {
 numEncoded = encoder->encode(pic_in, pic_out);
 }
-while (numEncoded == 0 && !pic_in && encoder->m_numDelayedPic && 
!encoder->m_latestParam->forceFlush);
+while ((numEncoded == 0 && !pic_in && encoder->m_numDelayedPic && 
!encoder->m_latestParam->forceFlush) && !encoder->m_externalFlush);
+if (numEncoded)
+encoder->m_externalFlush = false;
 
 // do not allow reuse of these buffers for more than one picture. The
 // encoder now owns these analysisData buffers.
diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp
+++ b/source/encoder/encoder.cpp
@@ -2342,6 +2342,10 @@
 void Encoder::configure(x265_param *p)
 {
 this->m_param = p;
+if (p->bMVType == AVC_INFO)
+this->m_externalFlush = true;
+else 
+this->m_externalFlush = false;
 if (p->keyframeMax < 0)
 {
 /* A negative max GOP size indicates the user wants only one I frame at
diff --git a/source/encoder/encoder.h b/source/encoder/encoder.h
--- a/source/encoder/encoder.h
+++ b/source/encoder/encoder.h
@@ -138,6 +138,7 @@
 RateControl*   m_rateControl;
 Lookahead* m_lookahead;
 
+bool   m_externalFlush;
 /* Collect statistics globally */
 EncStats   m_analyzeAll;
 EncStats   m_analyzeI;
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1502275399 -19800
#  Wed Aug 09 16:13:19 2017 +0530
# Node ID e5d68466150ca6d68e8222e346614c8e5a97f77f
# Parent  82708090cf1d29c4a81ff99acbb5945c86b81185
Do not wait until all the frames in a stream are flushed, return to API as soon as one frame is flushed.


In few cases it is better to flush only one frame in x265-lib and return to API. The
application should flush the remaining frames in the stream in these situations. This is
especially useful when the application wants to retrieve information from the lib.

diff --git a/source/encoder/api.cpp b/source/encoder/api.cpp
--- a/source/encoder/api.cpp
+++ b/source/encoder/api.cpp
@@ -257,7 +257,9 @@
 {
 numEncoded = encoder->encode(pic_in, pic_out);
 }
-while (numEncoded == 0 && !pic_in && encoder->m_numDelayedPic && !encoder->m_latestParam->forceFlush);
+while ((numEncoded == 0 && !pic_in && encoder->m_numDelayedPic && !encoder->m_latestParam->forceFlush) && !encoder->m_externalFlush);
+if (numEncoded)
+encoder->m_externalFlush = false;
 
 // do not allow reuse of these buffers for more than one picture. The
 // encoder now owns these analysisData buffers.
diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp
+++ b/source/encoder/encoder.cpp
@@ -2342,6 +2342,10 @@
 void Encoder::configure(x265_param *p)
 {
 this->m_param = p;
+if (p->bMVType == AVC_INFO)
+this->m_externalFlush = true;
+else 
+this->m_externalFlush = false;
 if (p->keyframeMax < 0)
 {
 /* A negative max GOP size indicates the user wants only one I frame at
diff --git a/source/encoder/encoder.h b/source/encoder/encoder.h
--- a/source/encoder/encoder.h
+++ b/source/encoder/encoder.h
@@ -138,6 +138,7 @@
 RateControl*   m_rateControl;
 Lookahead* m_lookahead;
 
+bool   m_externalFlush;
 /* Collect statistics globally */
 EncStats   m_analyzeAll;
 EncStats   m_analyzeI;
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH 1 of 4] add function to copy analysis data after z scan

2017-11-06 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1502258938 -19800
#  Wed Aug 09 11:38:58 2017 +0530
# Node ID dea515c3180ab2e45c1682bd258683fdf2f16ae6
# Parent  8a121d8cc134cc348466e5d63a6a02d1531d8055
add function to copy analysis data after z scan

The pointer to x265_analysis_data sent as parameter to this function has data 
for
16x16 blocks stored continuously. To store this data in bigger CTU sizes(32x32 
or 64x64) we
need to perform z-scan of constituent 16x16 blocks before copying.

diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp
+++ b/source/encoder/encoder.cpp
@@ -487,6 +487,95 @@
 return 0;
 }
 
+int Encoder::setAnalysisDataAfterZScan(x265_analysis_data *analysis_data, 
Frame* curFrame)
+{
+int mbImageWidth, mbImageHeight;
+mbImageWidth = (curFrame->m_fencPic->m_picWidth + 16 - 1) >> 4; //AVC 
block sizes
+mbImageHeight = (curFrame->m_fencPic->m_picHeight + 16 - 1) >> 4;
+if (analysis_data->sliceType == X265_TYPE_IDR || analysis_data->sliceType 
== X265_TYPE_I)
+{
+curFrame->m_analysisData.sliceType = X265_TYPE_I;
+if (m_param->analysisReuseLevel < 7)
+return -1;
+curFrame->m_analysisData.numPartitions = m_param->num4x4Partitions;
+int num16x16inCUWidth = m_param->maxCUSize >> 4;
+uint32_t ctuAddr, offset, cuPos;
+analysis_intra_data * intraData = (analysis_intra_data 
*)curFrame->m_analysisData.intraData;
+analysis_intra_data * srcIntraData = (analysis_intra_data 
*)analysis_data->intraData;
+for (int i = 0; i < mbImageHeight; i++)
+{
+for (int j = 0; j < mbImageWidth; j++)
+{
+int mbIndex = j + i * mbImageWidth;
+ctuAddr = (j / num16x16inCUWidth + ((i / num16x16inCUWidth) * 
(mbImageWidth / num16x16inCUWidth)));
+offset = ((i % num16x16inCUWidth) << 5) + ((j % 
num16x16inCUWidth) << 4);
+if ((j % 4 >= 2) && m_param->maxCUSize == 64)
+offset += (2 * 16);
+if ((i % 4 >= 2) && m_param->maxCUSize == 64)
+offset += (2 * 32);
+cuPos = ctuAddr  * curFrame->m_analysisData.numPartitions + 
offset;
+memcpy(&(intraData)->depth[cuPos], 
&(srcIntraData)->depth[mbIndex * 16], 16);
+memcpy(&(intraData)->chromaModes[cuPos], 
&(srcIntraData)->chromaModes[mbIndex * 16], 16);
+memcpy(&(intraData)->partSizes[cuPos], 
&(srcIntraData)->partSizes[mbIndex * 16], 16);
+memcpy(&(intraData)->partSizes[cuPos], 
&(srcIntraData)->partSizes[mbIndex * 16], 16);
+}
+}
+memcpy(&(intraData)->modes, (srcIntraData)->modes, 
curFrame->m_analysisData.numPartitions * analysis_data->numCUsInFrame);
+}
+else
+{
+uint32_t numDir = analysis_data->sliceType == X265_TYPE_P ? 1 : 2;
+if (m_param->analysisReuseLevel < 7)
+return -1;
+curFrame->m_analysisData.numPartitions = m_param->num4x4Partitions;
+int num16x16inCUWidth = m_param->maxCUSize >> 4;
+uint32_t ctuAddr, offset, cuPos;
+analysis_inter_data * interData = (analysis_inter_data 
*)curFrame->m_analysisData.interData;
+analysis_inter_data * srcInterData = 
(analysis_inter_data*)analysis_data->interData;
+for (int i = 0; i < mbImageHeight; i++)
+{
+for (int j = 0; j < mbImageWidth; j++)
+{
+int mbIndex = j + i * mbImageWidth;
+ctuAddr = (j / num16x16inCUWidth + ((i / num16x16inCUWidth) * 
(mbImageWidth / num16x16inCUWidth)));
+offset = ((i % num16x16inCUWidth) << 5) + ((j % 
num16x16inCUWidth) << 4);
+if ((j % 4 >= 2) && m_param->maxCUSize == 64)
+offset += (2 * 16);
+if ((i % 4 >= 2) && m_param->maxCUSize == 64)
+offset += (2 * 32);
+cuPos = ctuAddr  * curFrame->m_analysisData.numPartitions + 
offset;
+memcpy(&(interData)->depth[cuPos], 
&(srcInterData)->depth[mbIndex * 16], 16);
+memcpy(&(interData)->modes[cuPos], 
&(srcInterData)->modes[mbIndex * 16], 16);
+
+memcpy(&(interData)->partSize[cuPos], 
&(srcInterData)->partSize[mbIndex * 16], 16);
+
+int bytes = curFrame->m_analysisData.numPartitions >> 
((srcInterData)->depth[mbIndex * 16] * 2);
+int cuCount = 1;
+if (bytes < 16)
+cuCount = 4;
+for (int cuI = 0; cuI < cuCount; cuI

[x265] [PATCH] add new CLI refine-mv-type

2017-11-06 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1509956542 -19800
#  Mon Nov 06 13:52:22 2017 +0530
# Node ID e6ad0fc2639ae0fb6579e8b3e480c43f2464f9d8
# Parent  2508de5ad27440f650a6ba68a42febc273a2cd17
add new CLI refine-mv-type

diff --git a/doc/reST/cli.rst b/doc/reST/cli.rst
--- a/doc/reST/cli.rst
+++ b/doc/reST/cli.rst
@@ -887,6 +887,11 @@
| 10 | Level 5 + Full CU analysis-info |
++-+
 
+.. option:: --refine-mv-type 
+
+Reuse MV information received through API call. Currently receives 
information for AVC size and the accepted 
+string input is "avc". Default is disabled.
+
 .. option:: --scale-factor
 
Factor by which input video is scaled down for analysis save mode.
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -29,7 +29,7 @@
 option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)
 mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 139)
+set(X265_BUILD 140)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff --git a/source/common/param.cpp b/source/common/param.cpp
--- a/source/common/param.cpp
+++ b/source/common/param.cpp
@@ -291,6 +291,7 @@
 
 /* DCT Approximations */
 param->bLowPassDct = 0;
+param->bMVType = 0;
 }
 
 int x265_param_default_preset(x265_param* param, const char* preset, const 
char* tune)
@@ -981,7 +982,22 @@
 OPT("refine-mv")p->mvRefine = atobool(value);
 OPT("force-flush")p->forceFlush = atoi(value);
 OPT("splitrd-skip") p->bEnableSplitRdSkip = atobool(value);
-   OPT("lowpass-dct") p->bLowPassDct = atobool(value);
+OPT("lowpass-dct") p->bLowPassDct = atobool(value);
+OPT("refine-mv-type")
+{
+if (strcmp(strdup(value), "avc") == 0)
+{
+p->bMVType = AVC_INFO;
+}
+else if (strcmp(strdup(value), "off") == 0)
+{
+p->bMVType = NO_INFO;
+}
+else
+{
+bError = true;
+}
+ }
 else
 return X265_PARAM_BAD_NAME;
 }
@@ -1458,6 +1474,8 @@
 TOOLVAL(param->lookaheadSlices, "lslices=%d");
 TOOLVAL(param->lookaheadThreads, "lthreads=%d")
 TOOLVAL(param->bCTUInfo, "ctu-info=%d");
+if (param->bMVType == AVC_INFO)
+TOOLOPT(param->bMVType, "refine-mv-type=avc");
 if (param->maxSlices > 1)
 TOOLVAL(param->maxSlices, "slices=%d");
 if (param->bEnableLoopFilter)
@@ -1681,6 +1699,7 @@
 BOOL(p->bLimitSAO, "limit-sao");
 s += sprintf(s, " ctu-info=%d", p->bCTUInfo);
 BOOL(p->bLowPassDct, "lowpass-dct");
+s += sprintf(s, " refine-mv-type=%d", p->bMVType);
 #undef BOOL
 return buf;
 }
diff --git a/source/encoder/analysis.cpp b/source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp
+++ b/source/encoder/analysis.cpp
@@ -250,14 +250,14 @@
 /* generate residual for entire CTU at once and copy to reconPic */
 encodeResidue(ctu, cuGeom);
 }
-else if (m_param->analysisReuseMode == X265_ANALYSIS_LOAD && 
m_param->analysisReuseLevel == 10)
+else if ((m_param->analysisReuseMode == X265_ANALYSIS_LOAD && 
m_param->analysisReuseLevel == 10) || ((m_param->bMVType == AVC_INFO) && 
m_param->analysisReuseLevel >= 7))
 {
 analysis_inter_data* interDataCTU = 
(analysis_inter_data*)m_frame->m_analysisData.interData;
 int posCTU = ctu.m_cuAddr * numPartition;
 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);
-if (m_slice->m_sliceType == P_SLICE || m_param->bIntraInBFrames)
+if ((m_slice->m_sliceType == P_SLICE || m_param->bIntraInBFrames) 
&& !(m_param->bMVType == AVC_INFO))
 {
 analysis_intra_data* intraDataCTU = 
(analysis_intra_data*)m_frame->m_analysisData.intraData;
 memcpy(ctu.m_lumaIntraDir, >modes[posCTU], 
sizeof(uint8_t) * numPartition);
@@ -1227,7 +1227,7 @@
 mightSplit &= !bDecidedDepth;
 }
 }
-if (m_param-&

Re: [x265] [PATCH 2 of 4] add new CLI refine-mv-type

2017-11-06 Thread Santhoshini Sekar
please ignore this patch. Will resend with few corrections.

On Mon, Nov 6, 2017 at 2:05 PM, <santhosh...@multicorewareinc.com> wrote:

> # HG changeset patch
> # User Santhoshini Sekar <santhosh...@multicorewareinc.com>
> # Date 1509956542 -19800
> #  Mon Nov 06 13:52:22 2017 +0530
> # Node ID 54bd61979fc47ee50d61a0f568b0d06efc7b6e2c
> # Parent  2508de5ad27440f650a6ba68a42febc273a2cd17
> add new CLI refine-mv-type
>
> diff --git a/doc/reST/cli.rst b/doc/reST/cli.rst
> --- a/doc/reST/cli.rst
> +++ b/doc/reST/cli.rst
> @@ -887,6 +887,11 @@
> | 10 | Level 5 + Full CU analysis-info |
> ++-+
>
> +.. option:: --refine-mv-type 
> +
> +Reuse MV information received through API call. Currently receives
> information for AVC size and the accepted
> +string input is "avc". Default is disabled.
> +
>  .. option:: --scale-factor
>
> Factor by which input video is scaled down for analysis save mode.
> diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
> --- a/source/CMakeLists.txt
> +++ b/source/CMakeLists.txt
> @@ -29,7 +29,7 @@
>  option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)
>  mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
>  # X265_BUILD must be incremented each time the public API is changed
> -set(X265_BUILD 139)
> +set(X265_BUILD 140)
>  configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
> "${PROJECT_BINARY_DIR}/x265.def")
>  configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
> diff --git a/source/common/param.cpp b/source/common/param.cpp
> --- a/source/common/param.cpp
> +++ b/source/common/param.cpp
> @@ -1458,6 +1458,8 @@
>  TOOLVAL(param->lookaheadSlices, "lslices=%d");
>  TOOLVAL(param->lookaheadThreads, "lthreads=%d")
>  TOOLVAL(param->bCTUInfo, "ctu-info=%d");
> +if (param->bMVType == AVC_INFO)
> +TOOLOPT(param->bMVType, "refine-mv-type=avc");
>  if (param->maxSlices > 1)
>  TOOLVAL(param->maxSlices, "slices=%d");
>  if (param->bEnableLoopFilter)
> diff --git a/source/encoder/analysis.cpp b/source/encoder/analysis.cpp
> --- a/source/encoder/analysis.cpp
> +++ b/source/encoder/analysis.cpp
> @@ -250,14 +250,14 @@
>  /* generate residual for entire CTU at once and copy to
> reconPic */
>  encodeResidue(ctu, cuGeom);
>  }
> -else if (m_param->analysisReuseMode == X265_ANALYSIS_LOAD &&
> m_param->analysisReuseLevel == 10)
> +else if ((m_param->analysisReuseMode == X265_ANALYSIS_LOAD &&
> m_param->analysisReuseLevel == 10) || ((m_param->bMVType == AVC_INFO) &&
> m_param->analysisReuseLevel >= 7))
>  {
>  analysis_inter_data* interDataCTU =
> (analysis_inter_data*)m_frame->m_analysisData.interData;
>  int posCTU = ctu.m_cuAddr * numPartition;
>  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);
> -if (m_slice->m_sliceType == P_SLICE ||
> m_param->bIntraInBFrames)
> +if ((m_slice->m_sliceType == P_SLICE ||
> m_param->bIntraInBFrames) && !(m_param->bMVType == AVC_INFO))
>  {
>  analysis_intra_data* intraDataCTU =
> (analysis_intra_data*)m_frame->m_analysisData.intraData;
>  memcpy(ctu.m_lumaIntraDir, >modes[posCTU],
> sizeof(uint8_t) * numPartition);
> @@ -1227,7 +1227,7 @@
>  mightSplit &= !bDecidedDepth;
>  }
>  }
> -if (m_param->analysisReuseMode == X265_ANALYSIS_LOAD &&
> m_param->analysisReuseLevel > 1 && m_param->analysisReuseLevel != 10)
> +if ((m_param->analysisReuseMode == X265_ANALYSIS_LOAD &&
> m_param->analysisReuseLevel > 1 && m_param->analysisReuseLevel != 10))
>  {
>  if (mightNotSplit && depth == m_reuseDepth[cuGeom.absPartIdx])
>  {
> diff --git a/source/encoder/api.cpp b/source/encoder/api.cpp
> --- a/source/encoder/api.cpp
> +++ b/source/encoder/api.cpp
> @@ -380,7 +380,7 @@
>  pic->userSEI.payloads = NULL;
>  pic->userSEI.numPayloads = 0;
>
> -if (param->analysisReuseMode)
> +if (param->analysisReuseMode || (param->bMVType == AVC_INFO))
>  {
>

[x265] [PATCH 3 of 4] wait for the event of copying MV data if refine-mv-type is enabled

2017-11-06 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1502274740 -19800
#  Wed Aug 09 16:02:20 2017 +0530
# Node ID 7af25e9b6dd505a3da18abae7b7fd000468302fb
# Parent  54bd61979fc47ee50d61a0f568b0d06efc7b6e2c
wait for the event of copying MV data if refine-mv-type is enabled

diff --git a/source/common/frame.h b/source/common/frame.h
--- a/source/common/frame.h
+++ b/source/common/frame.h
@@ -113,6 +113,8 @@
 x265_analysis_2Passm_analysis2Pass;
 RcStats*   m_rcData;
 
+Event  m_copyMVType;
+
 x265_ctu_info_t**  m_ctuInfo;
 Event  m_copied;
 int*   m_prevCtuInfoChange;
diff --git a/source/encoder/frameencoder.cpp b/source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp
+++ b/source/encoder/frameencoder.cpp
@@ -335,6 +335,11 @@
 while (!m_frame->m_ctuInfo)
 m_frame->m_copied.wait();
 }
+if ((m_param->bMVType == AVC_INFO) && !m_param->analysisReuseMode && 
!(IS_X265_TYPE_I(m_frame->m_lowres.sliceType)))
+{
+while (((m_frame->m_analysisData.interData == NULL && 
m_frame->m_analysisData.intraData == NULL) || (uint32_t)m_frame->m_poc != 
m_frame->m_analysisData.poc))
+m_frame->m_copyMVType.wait();
+}
 compressFrame();
 m_done.trigger(); /* FrameEncoder::getEncodedPicture() blocks for this 
event */
 if (m_frame != NULL)
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1502274740 -19800
#  Wed Aug 09 16:02:20 2017 +0530
# Node ID 7af25e9b6dd505a3da18abae7b7fd000468302fb
# Parent  54bd61979fc47ee50d61a0f568b0d06efc7b6e2c
wait for the event of copying MV data if refine-mv-type is enabled

diff --git a/source/common/frame.h b/source/common/frame.h
--- a/source/common/frame.h
+++ b/source/common/frame.h
@@ -113,6 +113,8 @@
 x265_analysis_2Passm_analysis2Pass;
 RcStats*   m_rcData;
 
+Event  m_copyMVType;
+
 x265_ctu_info_t**  m_ctuInfo;
 Event  m_copied;
 int*   m_prevCtuInfoChange;
diff --git a/source/encoder/frameencoder.cpp b/source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp
+++ b/source/encoder/frameencoder.cpp
@@ -335,6 +335,11 @@
 while (!m_frame->m_ctuInfo)
 m_frame->m_copied.wait();
 }
+if ((m_param->bMVType == AVC_INFO) && !m_param->analysisReuseMode && !(IS_X265_TYPE_I(m_frame->m_lowres.sliceType)))
+{
+while (((m_frame->m_analysisData.interData == NULL && m_frame->m_analysisData.intraData == NULL) || (uint32_t)m_frame->m_poc != m_frame->m_analysisData.poc))
+m_frame->m_copyMVType.wait();
+}
 compressFrame();
 m_done.trigger(); /* FrameEncoder::getEncodedPicture() blocks for this event */
 if (m_frame != NULL)
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH 4 of 4] Do not wait until all the frames in a stream are flushed, return to API as soon as one frame is flushed

2017-11-06 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1502275399 -19800
#  Wed Aug 09 16:13:19 2017 +0530
# Node ID baba97b098912a798c4674bff9abc487054f3020
# Parent  7af25e9b6dd505a3da18abae7b7fd000468302fb
Do not wait until all the frames in a stream are flushed, return to API as soon 
as one frame is flushed.


In few cases it is better to flush only one frame in x265-lib and return to 
API. The
application should flush the remaining frames in the stream in these 
situations. This is
especially useful when the application wants to retrieve information from the 
lib.

diff --git a/source/encoder/api.cpp b/source/encoder/api.cpp
--- a/source/encoder/api.cpp
+++ b/source/encoder/api.cpp
@@ -257,7 +257,9 @@
 {
 numEncoded = encoder->encode(pic_in, pic_out);
 }
-while (numEncoded == 0 && !pic_in && encoder->m_numDelayedPic && 
!encoder->m_latestParam->forceFlush);
+while ((numEncoded == 0 && !pic_in && encoder->m_numDelayedPic && 
!encoder->m_latestParam->forceFlush) && !encoder->m_externalFlush);
+if (numEncoded)
+encoder->m_externalFlush = false;
 
 // do not allow reuse of these buffers for more than one picture. The
 // encoder now owns these analysisData buffers.
diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp
+++ b/source/encoder/encoder.cpp
@@ -2342,6 +2342,8 @@
 void Encoder::configure(x265_param *p)
 {
 this->m_param = p;
+if (p->bMVType == AVC_INFO)
+this->m_externalFlush = true;
 if (p->keyframeMax < 0)
 {
 /* A negative max GOP size indicates the user wants only one I frame at
diff --git a/source/encoder/encoder.h b/source/encoder/encoder.h
--- a/source/encoder/encoder.h
+++ b/source/encoder/encoder.h
@@ -138,6 +138,7 @@
 RateControl*   m_rateControl;
 Lookahead* m_lookahead;
 
+bool   m_externalFlush;
 /* Collect statistics globally */
 EncStats   m_analyzeAll;
 EncStats   m_analyzeI;
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1502275399 -19800
#  Wed Aug 09 16:13:19 2017 +0530
# Node ID baba97b098912a798c4674bff9abc487054f3020
# Parent  7af25e9b6dd505a3da18abae7b7fd000468302fb
Do not wait until all the frames in a stream are flushed, return to API as soon as one frame is flushed.


In few cases it is better to flush only one frame in x265-lib and return to API. The
application should flush the remaining frames in the stream in these situations. This is
especially useful when the application wants to retrieve information from the lib.

diff --git a/source/encoder/api.cpp b/source/encoder/api.cpp
--- a/source/encoder/api.cpp
+++ b/source/encoder/api.cpp
@@ -257,7 +257,9 @@
 {
 numEncoded = encoder->encode(pic_in, pic_out);
 }
-while (numEncoded == 0 && !pic_in && encoder->m_numDelayedPic && !encoder->m_latestParam->forceFlush);
+while ((numEncoded == 0 && !pic_in && encoder->m_numDelayedPic && !encoder->m_latestParam->forceFlush) && !encoder->m_externalFlush);
+if (numEncoded)
+encoder->m_externalFlush = false;
 
 // do not allow reuse of these buffers for more than one picture. The
 // encoder now owns these analysisData buffers.
diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp
+++ b/source/encoder/encoder.cpp
@@ -2342,6 +2342,8 @@
 void Encoder::configure(x265_param *p)
 {
 this->m_param = p;
+if (p->bMVType == AVC_INFO)
+this->m_externalFlush = true;
 if (p->keyframeMax < 0)
 {
 /* A negative max GOP size indicates the user wants only one I frame at
diff --git a/source/encoder/encoder.h b/source/encoder/encoder.h
--- a/source/encoder/encoder.h
+++ b/source/encoder/encoder.h
@@ -138,6 +138,7 @@
 RateControl*   m_rateControl;
 Lookahead* m_lookahead;
 
+bool   m_externalFlush;
 /* Collect statistics globally */
 EncStats   m_analyzeAll;
 EncStats   m_analyzeI;
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH 1 of 4] add function to copy analysis data after z scan

2017-11-06 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1502258938 -19800
#  Wed Aug 09 11:38:58 2017 +0530
# Node ID 2508de5ad27440f650a6ba68a42febc273a2cd17
# Parent  aa9649a2aa8c30bcb84ee8287839fa877978d4a7
add function to copy analysis data after z scan

The pointer to x265_analysis_data sent as parameter to this function has data 
for
16x16 blocks stored continuously. To store this data in bigger CTU sizes(32x32 
or 64x64) we
need to perform z-scan of constituent 16x16 blocks before copying.

diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp
+++ b/source/encoder/encoder.cpp
@@ -487,6 +487,95 @@
 return 0;
 }
 
+int Encoder::setAnalysisDataAfterZScan(x265_analysis_data *analysis_data, 
Frame* curFrame)
+{
+int mbImageWidth, mbImageHeight;
+mbImageWidth = (curFrame->m_fencPic->m_picWidth + 16 - 1) >> 4; //AVC 
block sizes
+mbImageHeight = (curFrame->m_fencPic->m_picHeight + 16 - 1) >> 4;
+if (analysis_data->sliceType == X265_TYPE_IDR || analysis_data->sliceType 
== X265_TYPE_I)
+{
+curFrame->m_analysisData.sliceType = X265_TYPE_I;
+if (m_param->analysisReuseLevel < 7)
+return -1;
+curFrame->m_analysisData.numPartitions = m_param->num4x4Partitions;
+int num16x16inCUWidth = m_param->maxCUSize >> 4;
+uint32_t ctuAddr, offset, cuPos;
+analysis_intra_data * intraData = (analysis_intra_data 
*)curFrame->m_analysisData.intraData;
+analysis_intra_data * srcIntraData = (analysis_intra_data 
*)analysis_data->intraData;
+for (int i = 0; i < mbImageHeight; i++)
+{
+for (int j = 0; j < mbImageWidth; j++)
+{
+int mbIndex = j + i * mbImageWidth;
+ctuAddr = (j / num16x16inCUWidth + ((i / num16x16inCUWidth) * 
(mbImageWidth / num16x16inCUWidth)));
+offset = ((i % num16x16inCUWidth) << 5) + ((j % 
num16x16inCUWidth) << 4);
+if ((j % 4 >= 2) && m_param->maxCUSize == 64)
+offset += (2 * 16);
+if ((i % 4 >= 2) && m_param->maxCUSize == 64)
+offset += (2 * 32);
+cuPos = ctuAddr  * curFrame->m_analysisData.numPartitions + 
offset;
+memcpy(&(intraData)->depth[cuPos], 
&(srcIntraData)->depth[mbIndex * 16], 16);
+memcpy(&(intraData)->chromaModes[cuPos], 
&(srcIntraData)->chromaModes[mbIndex * 16], 16);
+memcpy(&(intraData)->partSizes[cuPos], 
&(srcIntraData)->partSizes[mbIndex * 16], 16);
+memcpy(&(intraData)->partSizes[cuPos], 
&(srcIntraData)->partSizes[mbIndex * 16], 16);
+}
+}
+memcpy(&(intraData)->modes, (srcIntraData)->modes, 
curFrame->m_analysisData.numPartitions * analysis_data->numCUsInFrame);
+}
+else
+{
+uint32_t numDir = analysis_data->sliceType == X265_TYPE_P ? 1 : 2;
+if (m_param->analysisReuseLevel < 7)
+return -1;
+curFrame->m_analysisData.numPartitions = m_param->num4x4Partitions;
+int num16x16inCUWidth = m_param->maxCUSize >> 4;
+uint32_t ctuAddr, offset, cuPos;
+analysis_inter_data * interData = (analysis_inter_data 
*)curFrame->m_analysisData.interData;
+analysis_inter_data * srcInterData = 
(analysis_inter_data*)analysis_data->interData;
+for (int i = 0; i < mbImageHeight; i++)
+{
+for (int j = 0; j < mbImageWidth; j++)
+{
+int mbIndex = j + i * mbImageWidth;
+ctuAddr = (j / num16x16inCUWidth + ((i / num16x16inCUWidth) * 
(mbImageWidth / num16x16inCUWidth)));
+offset = ((i % num16x16inCUWidth) << 5) + ((j % 
num16x16inCUWidth) << 4);
+if ((j % 4 >= 2) && m_param->maxCUSize == 64)
+offset += (2 * 16);
+if ((i % 4 >= 2) && m_param->maxCUSize == 64)
+offset += (2 * 32);
+cuPos = ctuAddr  * curFrame->m_analysisData.numPartitions + 
offset;
+memcpy(&(interData)->depth[cuPos], 
&(srcInterData)->depth[mbIndex * 16], 16);
+memcpy(&(interData)->modes[cuPos], 
&(srcInterData)->modes[mbIndex * 16], 16);
+
+memcpy(&(interData)->partSize[cuPos], 
&(srcInterData)->partSize[mbIndex * 16], 16);
+
+int bytes = curFrame->m_analysisData.numPartitions >> 
((srcInterData)->depth[mbIndex * 16] * 2);
+int cuCount = 1;
+if (bytes < 16)
+cuCount = 4;
+for (int cuI = 0; cuI < cuCount; cuI

[x265] [PATCH 2 of 4] add new CLI refine-mv-type

2017-11-06 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1509956542 -19800
#  Mon Nov 06 13:52:22 2017 +0530
# Node ID 54bd61979fc47ee50d61a0f568b0d06efc7b6e2c
# Parent  2508de5ad27440f650a6ba68a42febc273a2cd17
add new CLI refine-mv-type

diff --git a/doc/reST/cli.rst b/doc/reST/cli.rst
--- a/doc/reST/cli.rst
+++ b/doc/reST/cli.rst
@@ -887,6 +887,11 @@
| 10 | Level 5 + Full CU analysis-info |
++-+
 
+.. option:: --refine-mv-type 
+
+Reuse MV information received through API call. Currently receives 
information for AVC size and the accepted 
+string input is "avc". Default is disabled.
+
 .. option:: --scale-factor
 
Factor by which input video is scaled down for analysis save mode.
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -29,7 +29,7 @@
 option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)
 mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 139)
+set(X265_BUILD 140)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff --git a/source/common/param.cpp b/source/common/param.cpp
--- a/source/common/param.cpp
+++ b/source/common/param.cpp
@@ -1458,6 +1458,8 @@
 TOOLVAL(param->lookaheadSlices, "lslices=%d");
 TOOLVAL(param->lookaheadThreads, "lthreads=%d")
 TOOLVAL(param->bCTUInfo, "ctu-info=%d");
+if (param->bMVType == AVC_INFO)
+TOOLOPT(param->bMVType, "refine-mv-type=avc");
 if (param->maxSlices > 1)
 TOOLVAL(param->maxSlices, "slices=%d");
 if (param->bEnableLoopFilter)
diff --git a/source/encoder/analysis.cpp b/source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp
+++ b/source/encoder/analysis.cpp
@@ -250,14 +250,14 @@
 /* generate residual for entire CTU at once and copy to reconPic */
 encodeResidue(ctu, cuGeom);
 }
-else if (m_param->analysisReuseMode == X265_ANALYSIS_LOAD && 
m_param->analysisReuseLevel == 10)
+else if ((m_param->analysisReuseMode == X265_ANALYSIS_LOAD && 
m_param->analysisReuseLevel == 10) || ((m_param->bMVType == AVC_INFO) && 
m_param->analysisReuseLevel >= 7))
 {
 analysis_inter_data* interDataCTU = 
(analysis_inter_data*)m_frame->m_analysisData.interData;
 int posCTU = ctu.m_cuAddr * numPartition;
 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);
-if (m_slice->m_sliceType == P_SLICE || m_param->bIntraInBFrames)
+if ((m_slice->m_sliceType == P_SLICE || m_param->bIntraInBFrames) 
&& !(m_param->bMVType == AVC_INFO))
 {
 analysis_intra_data* intraDataCTU = 
(analysis_intra_data*)m_frame->m_analysisData.intraData;
 memcpy(ctu.m_lumaIntraDir, >modes[posCTU], 
sizeof(uint8_t) * numPartition);
@@ -1227,7 +1227,7 @@
 mightSplit &= !bDecidedDepth;
 }
 }
-if (m_param->analysisReuseMode == X265_ANALYSIS_LOAD && 
m_param->analysisReuseLevel > 1 && m_param->analysisReuseLevel != 10)
+if ((m_param->analysisReuseMode == X265_ANALYSIS_LOAD && 
m_param->analysisReuseLevel > 1 && m_param->analysisReuseLevel != 10))
 {
 if (mightNotSplit && depth == m_reuseDepth[cuGeom.absPartIdx])
 {
diff --git a/source/encoder/api.cpp b/source/encoder/api.cpp
--- a/source/encoder/api.cpp
+++ b/source/encoder/api.cpp
@@ -380,7 +380,7 @@
 pic->userSEI.payloads = NULL;
 pic->userSEI.numPayloads = 0;
 
-if (param->analysisReuseMode)
+if (param->analysisReuseMode || (param->bMVType == AVC_INFO))
 {
 uint32_t widthInCU = (param->sourceWidth + param->maxCUSize - 1) >> 
param->maxLog2CUSize;
 uint32_t heightInCU = (param->sourceHeight + param->maxCUSize - 1) >> 
param->maxLog2CUSize;
diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp
+++ b/source/encoder/encoder.cpp
@@ -1015,7 +1015,7 @@
 x265_frame_stats* frameData = NULL;
 
 /* Free up pic_in->analysisData since it has already been used */
-if (m_param->analysisReuseMode == X265_ANALYSIS_LOAD)
+if (m_param->analysisReuseMod

Re: [x265] memory consumption when encoding 8K video

2017-04-05 Thread Santhoshini Sekar
Hi Yiran Li,

We found such memory issues for 32-bit builds even with 4K content. It is
very natural for a 32 bit build to fail for high resolution videos. We have
a bitbucket issue pointing to this (
https://bitbucket.org/multicoreware/x265/issues/310/memory-error-crash-in-32-bit-compiler-for
).

Thanks,
Santhoshini

On Thu, Apr 6, 2017 at 9:42 AM, YIRAN LI <mrfun.ch...@gmail.com> wrote:

> Hi Pradeep,
>
> I'm now using x265.exe to reproduce this issue and yes I was able to
> reproduce it.
>
> The thing is, x265.exe only accepts .yuv or y4m which store uncompressed
> data so even only 1 second long clip takes more than 1 GB so I can't upload
> them.
>
> If you want, you can use MSPaint to create a 8K jpg, then use ffmpeg
> command to create a 1 second clip, here is the command line:
> * ffmpeg.exe -framerate 30 -loop 1 -i 0001.jpg
> -t 1 -pix_fmt yuv420p a.y4m*
>
> Once created, you can use x265.exe to convert it:
>
>
> $ x265.exe --input a.y4m -o a.mp4
>
> y4m  [info]: 8192x4096 fps 30/1 i420p8 sar 1:1 frames 0 - 29 of 30
>
> raw  [info]: output file: a.mp4
>
> x265 [info]: HEVC encoder version 2.3
>
> x265 [info]: build info [Windows][GCC 5.4.0][32 bit] 8bit
>
> x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2
> FMA3 LZCNT BMI2
>
> x265 [info]: Main profile, Level-6 (Main tier)
>
> x265 [info]: Thread pool created using 4 threads
>
> x265 [info]: Slices  : 1
>
> x265 [info]: frame threads / pool features   : 2 / wpp(64 rows)
>
> x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
>
> x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
>
> x265 [info]: ME / range / subpel / merge : hex / 57 / 2 / 2
>
> x265 [info]: Keyframe min / max / scenecut / bias: 25 / 250 / 40 / 5.00
>
> x265 [info]: Lookahead / bframes / badapt: 20 / 4 / 2
>
> x265 [info]: b-pyramid / weightp / weightb   : 1 / 1 / 0
>
> x265 [info]: References / ref-limit  cu / depth  : 3 / on / on
>
> x265 [info]: AQ: mode / str / qg-size / cu-tree  : 1 / 1.0 / 32 / 1
>
> x265 [info]: Rate Control / qCompress: CRF-28.0 / 0.60
>
> x265 [info]: tools: rd=3 psy-rd=2.00 rskip signhide tmvp
> strong-intra-smoothing
>
> x265 [info]: tools: lslices=8 deblock sao
>
> x265 [error]: malloc of size 37871616 failed
>
> x265 [error]: memory allocation failure, aborting encode
>
>
> encoded 0 frames
>
> aborted at input frame 15, output frame 0
>
> ​I've tried almost all possible options:
>
> *x265.exe --input ​a.y4m -F 1 --lookahead-threads 1 --rc-lookahead 0
> --bframes 0 --no-b-pyramid --ref 1 -o a.mp4*
>
> I
> ​'m not familiar with ​these parameters, could you tell me what possible
> problems/disadvantages will the generated file have by
> setting ref = 1, bframe = 0?
>
> Great thanks
>
> 2017-04-06 13:35 GMT+10:00 Pradeep Ramachandran <
> prad...@multicorewareinc.com>:
>
>> In general, I would recommend against a 32-bit build due to the fact that
>> several of our assembly optimizations (10-bit and 12-bit, in particular)
>> work only for 64-bit which would considerably restrict your encoding speed.
>> This is especially true for 8K where there is so many bits to deal with!
>>
>> If you can share with us the command-line that you are trying, along with
>> a sample clip, we can try to reproduce the failure from our side.
>>
>> Pradeep Ramachandran, PhD
>> Solution Architect at www.multicorewareinc.com/
>> Adjunct Faculty at www.cse.iitm.ac.in/
>> pradeeprama.info/
>> Ph:   +91 99627 82018 <+91%2099627%2082018>
>>
>> On Thu, Apr 6, 2017 at 6:22 AM, YIRAN LI <mrfun.ch...@gmail.com> wrote:
>>
>>> Hi guys,
>>>
>>> I'm writing a program which can encode video using X265 API.  It's a 32
>>> bit program.
>>>
>>> When the program runs to encode a 8K video, I can see every
>>> time encoder_encode is called, the program eats about 100MB so that after
>>> 12 frames are sent to encoder and when encoder_encode  is called for
>>> another frame,  encoder_encode  returns failure. (at this time, about 1.5GB
>>> in total is consumed by the encoder).
>>>
>>>
>>> I guess it's caused by memory limit so compiled everything to 64bit,
>>> this time everything went well and I could see maximum memory consumption
>>> is about 6GB.
>>>
>>>
>>> But I still need to fix the problem on 32bit because a lot of customers
>>> use 32 bit version. Just want to know, is there any option, to make encoder
>>

[x265] [PATCH] reuse analysis information from pass 1 to effectively reduce computation in pass 2

2016-12-26 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1482321849 -19800
#  Wed Dec 21 17:34:09 2016 +0530
# Node ID 9216f2375f1b26d96b6023f734be5f6bb8e888a0
# Parent  82e4e3b0bb460c0fe140953342e12a0a1b3da004
reuse analysis information from pass 1 to effectively reduce computation in 
pass 2

diff --git a/source/encoder/analysis.cpp b/source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp
+++ b/source/encoder/analysis.cpp
@@ -146,6 +146,23 @@
 m_modeDepth[0].fencYuv.copyFromPicYuv(*m_frame->m_fencPic, ctu.m_cuAddr, 
0);
 
 uint32_t numPartition = ctu.m_numPartitions;
+if (m_param->analysisMultiPassRefine && m_param->rc.bStatRead)
+{
+m_multipassAnalysis = 
(analysis2PassFrameData*)m_frame->m_analysis2Pass.analysisFramedata;
+m_multipassDepth = _multipassAnalysis->depth[ctu.m_cuAddr * 
ctu.m_numPartitions];
+if (m_slice->m_sliceType != I_SLICE)
+{
+int numPredDir = m_slice->isInterP() ? 1 : 2;
+for (int dir = 0; dir < numPredDir; dir++)
+{
+m_multipassMv[dir] = 
_multipassAnalysis->m_mv[dir][ctu.m_cuAddr * ctu.m_numPartitions];
+m_multipassMvpIdx[dir] = 
_multipassAnalysis->mvpIdx[dir][ctu.m_cuAddr * ctu.m_numPartitions];
+m_multipassRef[dir] = 
_multipassAnalysis->ref[dir][ctu.m_cuAddr * ctu.m_numPartitions];
+}
+m_multipassModes = _multipassAnalysis->modes[ctu.m_cuAddr * 
ctu.m_numPartitions];
+}
+}
+
 if (m_param->analysisMode && m_slice->m_sliceType != I_SLICE)
 {
 int numPredDir = m_slice->isInterP() ? 1 : 2;
@@ -1015,6 +1032,22 @@
 }
 }
 }
+if (m_param->analysisMultiPassRefine && m_param->rc.bStatRead && 
m_multipassAnalysis)
+{
+if (mightNotSplit && depth == m_multipassDepth[cuGeom.absPartIdx])
+{
+if (m_multipassModes[cuGeom.absPartIdx] == MODE_SKIP)
+{
+md.pred[PRED_MERGE].cu.initSubCU(parentCTU, cuGeom, qp);
+md.pred[PRED_SKIP].cu.initSubCU(parentCTU, cuGeom, qp);
+checkMerge2Nx2N_rd0_4(md.pred[PRED_SKIP], md.pred[PRED_MERGE], 
cuGeom);
+
+skipRecursion = !!m_param->bEnableRecursionSkip && md.bestMode;
+if (m_param->rdLevel)
+skipModes = m_param->bEnableEarlySkip && md.bestMode;
+}
+}
+}
 
 /* Step 1. Evaluate Merge/Skip candidates for likely early-outs, if skip 
mode was not set above */
 if (mightNotSplit && depth >= minDepth && !md.bestMode) /* TODO: 
Re-evaluate if analysis load/save still works */
@@ -1562,6 +1595,28 @@
 }
 }
 
+if (m_param->analysisMultiPassRefine && m_param->rc.bStatRead && 
m_multipassAnalysis)
+{
+if (mightNotSplit && depth == m_multipassDepth[cuGeom.absPartIdx])
+{
+if (m_multipassModes[cuGeom.absPartIdx] == MODE_SKIP)
+{
+md.pred[PRED_MERGE].cu.initSubCU(parentCTU, cuGeom, qp);
+md.pred[PRED_SKIP].cu.initSubCU(parentCTU, cuGeom, qp);
+checkMerge2Nx2N_rd0_4(md.pred[PRED_SKIP], md.pred[PRED_MERGE], 
cuGeom);
+
+skipModes = !!m_param->bEnableEarlySkip && md.bestMode;
+refMasks[0] = allSplitRefs;
+md.pred[PRED_2Nx2N].cu.initSubCU(parentCTU, cuGeom, qp);
+checkInter_rd5_6(md.pred[PRED_2Nx2N], cuGeom, SIZE_2Nx2N, 
refMasks);
+checkBestMode(md.pred[PRED_2Nx2N], cuGeom.depth);
+
+if (m_param->bEnableRecursionSkip && depth && 
m_modeDepth[depth - 1].bestMode)
+skipRecursion = md.bestMode && 
!md.bestMode->cu.getQtRootCbf(0);
+}
+}
+}
+
 /* Step 1. Evaluate Merge/Skip candidates for likely early-outs */
 if (mightNotSplit && !md.bestMode)
 {
@@ -2310,6 +2365,21 @@
 bestME[i].ref = m_reuseRef[refOffset + index++];
 }
 }
+
+if (m_param->analysisMultiPassRefine && m_param->rc.bStatRead && 
m_multipassAnalysis)
+{
+uint32_t numPU = interMode.cu.getNumPartInter(0);
+for (uint32_t part = 0; part < numPU; part++)
+{
+MotionData* bestME = interMode.bestME[part];
+for (int32_t i = 0; i < numPredDir; i++)
+{
+bestME[i].ref = m_multipassRef[i][cuGeom.absPartIdx];
+bestME[i].mv = m_multipassMv[i][cuGeom.absPartIdx];
+bestME[i].mvpIdx = m_multipassMvpIdx[i][cuGeom.absPartIdx];
+}
+}
+}
 predInterSearch(interMode, cuGeom, m_bChromaSa8d && (m_csp != 
X265_CSP_I400 && m_frame-

[x265] [PATCH] add analysis 2 pass structure

2016-12-26 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1482758979 -19800
#  Mon Dec 26 18:59:39 2016 +0530
# Node ID 82e4e3b0bb460c0fe140953342e12a0a1b3da004
# Parent  e40db0bdde4ac9659fae2b5b133fcadecece7412
add analysis 2 pass structure

diff --git a/doc/reST/cli.rst b/doc/reST/cli.rst
--- a/doc/reST/cli.rst
+++ b/doc/reST/cli.rst
@@ -1438,6 +1438,23 @@
* :option:`--subme` = MIN(2, :option:`--subme`)
* :option:`--rd` = MIN(2, :option:`--rd`)
 
+.. option:: --multi-pass-opt-analysis, --no-multi-pass-opt-analysis
+
+Enable/Disable multipass analysis refinement along with multipass 
ratecontrol. Based on 
+the information stored in pass 1, in subsequent passes analysis data is 
refined 
+and also redundant steps are skipped.
+In pass 1 analysis information like motion vector, depth, reference and 
prediction
+modes of the final best CTU partition is stored for each CTU.
+Default disabled.
+
+.. option:: --multi-pass-opt-distortion, --no-multi-pass-opt-distortion
+
+Enable/Disable multipass refinement of qp based on distortion data along 
with multipass
+ratecontrol. In pass 1 distortion of best CTU partition is stored. CTUs 
with high
+distortion get lower(negative)qp offsets and vice-versa for low distortion 
CTUs in pass 2.
+This helps to improve the subjective quality.
+Default disabled.
+
 .. option:: --strict-cbr, --no-strict-cbr

Enables stricter conditions to control bitrate deviance from the 
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -29,7 +29,7 @@
 option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)
 mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 104)
+set(X265_BUILD 105)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff --git a/source/common/frame.h b/source/common/frame.h
--- a/source/common/frame.h
+++ b/source/common/frame.h
@@ -98,6 +98,7 @@
 Frame* m_prev;
 x265_param*m_param;  // Points to the latest param 
set for the frame.
 x265_analysis_data m_analysisData;
+x265_analysis_2Passm_analysis2Pass;
 RcStats*   m_rcData;
 Frame();
 
diff --git a/source/common/framedata.h b/source/common/framedata.h
--- a/source/common/framedata.h
+++ b/source/common/framedata.h
@@ -181,5 +181,15 @@
 uint8_t*partSize;
 uint8_t*mergeFlag;
 };
+
+struct analysis2PassFrameData
+{
+uint8_t*  depth;
+MV*   m_mv[2];
+int*  mvpIdx[2];
+int32_t*  ref[2];
+uint8_t*  modes;
+};
+
 }
 #endif // ifndef X265_FRAMEDATA_H
diff --git a/source/common/param.cpp b/source/common/param.cpp
--- a/source/common/param.cpp
+++ b/source/common/param.cpp
@@ -193,6 +193,8 @@
 param->psyRd = 2.0;
 param->psyRdoq = 0.0;
 param->analysisMode = 0;
+param->analysisMultiPassRefine = 0;
+param->analysisMultiPassDistortion = 0;
 param->analysisFileName = NULL;
 param->bIntraInBFrames = 0;
 param->bLossless = 0;
@@ -922,6 +924,8 @@
 OPT("scenecut-bias") p->scenecutBias = atof(value);
 OPT("lookahead-threads") p->lookaheadThreads = atoi(value);
 OPT("opt-cu-delta-qp") p->bOptCUDeltaQP = atobool(value);
+OPT("multi-pass-opt-analysis") p->analysisMultiPassRefine = 
atobool(value);
+OPT("multi-pass-opt-distortion") p->analysisMultiPassDistortion = 
atobool(value);
 else
 return X265_PARAM_BAD_NAME;
 }
diff --git a/source/encoder/api.cpp b/source/encoder/api.cpp
--- a/source/encoder/api.cpp
+++ b/source/encoder/api.cpp
@@ -210,6 +210,7 @@
 {
 pic_in->analysisData.intraData = NULL;
 pic_in->analysisData.interData = NULL;
+pic_in->analysis2Pass.analysisFramedata = NULL;
 }
 
 if (pp_nal && numEncoded > 0)
diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp
+++ b/source/encoder/encoder.cpp
@@ -339,6 +339,20 @@
 }
 }
 
+if (m_param->analysisMultiPassRefine || 
m_param->analysisMultiPassDistortion)
+{
+const char* name = m_param->analysisFileName;
+if (!name)
+name = defaultAnalysisFileName;
+const char* mode = m_param->rc.bStatWrite ? "wb" : "rb";
+m_analysisFile = fopen(name, mode);
+if (!m_analysisFile)
+{
+x265_log(NULL, X265_LOG_ERROR, "Analysis 2 pass: failed to open 
file %s\n", name);
+m_abort

[x265] [PATCH] cudata: init mvmemblock with zero

2016-12-22 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1482401694 -19800
#  Thu Dec 22 15:44:54 2016 +0530
# Branch stable
# Node ID 1c8b8daacec009b124ebe6d937abea06b293113a
# Parent  ce19aaa0637df84d56fc985b0062c7fe2664cdf6
cudata: init mvmemblock with zero

diff --git a/source/common/cudata.h b/source/common/cudata.h
--- a/source/common/cudata.h
+++ b/source/common/cudata.h
@@ -358,7 +358,7 @@
 CHECKED_MALLOC(trCoeffMemBlock, coeff_t, (sizeL + sizeC * 2) * 
numInstances);
 }
 CHECKED_MALLOC(charMemBlock, uint8_t, numPartition * numInstances * 
CUData::BytesPerPartition);
-CHECKED_MALLOC(mvMemBlock, MV, numPartition * 4 * numInstances);
+CHECKED_MALLOC_ZERO(mvMemBlock, MV, numPartition * 4 * numInstances);
 return true;
 
 fail:
# HG changeset patch
# User Santhoshini Sekar <santhosh...@multicorewareinc.com>
# Date 1482401694 -19800
#  Thu Dec 22 15:44:54 2016 +0530
# Branch stable
# Node ID 1c8b8daacec009b124ebe6d937abea06b293113a
# Parent  ce19aaa0637df84d56fc985b0062c7fe2664cdf6
cudata: init mvmemblock with zero

diff --git a/source/common/cudata.h b/source/common/cudata.h
--- a/source/common/cudata.h
+++ b/source/common/cudata.h
@@ -358,7 +358,7 @@
 CHECKED_MALLOC(trCoeffMemBlock, coeff_t, (sizeL + sizeC * 2) * numInstances);
 }
 CHECKED_MALLOC(charMemBlock, uint8_t, numPartition * numInstances * CUData::BytesPerPartition);
-CHECKED_MALLOC(mvMemBlock, MV, numPartition * 4 * numInstances);
+CHECKED_MALLOC_ZERO(mvMemBlock, MV, numPartition * 4 * numInstances);
 return true;
 
 fail:
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] bugfix: encode only once the final best mode when picturecsp=400 and not merge2Nx2N

2016-07-22 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar<santhosh...@multicorewareinc.com>
# Date 1469173422 -19800
#  Fri Jul 22 13:13:42 2016 +0530
# Node ID ffe85684abfc3fb33e68036a81b00aee8edf71bc
# Parent  2737c6ff5f80895356c439ba225b06cb46e32db4
bugfix: encode only once the final best mode when picturecsp=400 and not 
merge2Nx2N

diff -r 2737c6ff5f80 -r ffe85684abfc source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp   Tue Jul 19 21:13:13 2016 +0200
+++ b/source/encoder/analysis.cpp   Fri Jul 22 13:13:42 2016 +0530
@@ -1731,17 +1731,18 @@
 ProfileCounter(parentCTU, skippedIntraCU[cuGeom.depth]);
 }
 }
-if ((md.bestMode->cu.isInter(0) && 
!(md.bestMode->cu.m_mergeFlag[0] && md.bestMode->cu.m_partSize[0] == 
SIZE_2Nx2N)) && (m_frame->m_fencPic->m_picCsp == X265_CSP_I400 && m_csp != 
X265_CSP_I400))
+}
+
+if ((md.bestMode->cu.isInter(0) && !(md.bestMode->cu.m_mergeFlag[0] && 
md.bestMode->cu.m_partSize[0] == SIZE_2Nx2N)) && (m_frame->m_fencPic->m_picCsp 
== X265_CSP_I400 && m_csp != X265_CSP_I400))
+{
+uint32_t numPU = md.bestMode->cu.getNumPartInter(0);
+
+for (uint32_t puIdx = 0; puIdx < numPU; puIdx++)
 {
-uint32_t numPU = md.bestMode->cu.getNumPartInter(0);
-
-for (uint32_t puIdx = 0; puIdx < numPU; puIdx++)
-{
-PredictionUnit pu(md.bestMode->cu, cuGeom, puIdx);
-motionCompensation(md.bestMode->cu, pu, 
md.bestMode->predYuv, false, m_csp != X265_CSP_I400);
-}
-encodeResAndCalcRdInterCU(*md.bestMode, cuGeom);
+PredictionUnit pu(md.bestMode->cu, cuGeom, puIdx);
+motionCompensation(md.bestMode->cu, pu, md.bestMode->predYuv, 
false, m_csp != X265_CSP_I400);
 }
+encodeResAndCalcRdInterCU(*md.bestMode, cuGeom);
 }
 
 if (m_bTryLossless)
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] analysis: compute Inter2Nx2N after merge in analysis mode=load if reuse mode chosen is skip

2016-07-04 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar<santhosh...@multicorewareinc.com>
# Date 1467619611 -19800
#  Mon Jul 04 13:36:51 2016 +0530
# Node ID 0c4c66ce33abba9d3f224af2bac79b243c426c28
# Parent  836a870ba76b46d4c0078289e320db1371fc3403
analysis: compute Inter2Nx2N after merge in analysis mode=load if reuse mode 
chosen is skip

diff -r 836a870ba76b -r 0c4c66ce33ab source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp   Fri Jul 01 11:49:57 2016 +0530
+++ b/source/encoder/analysis.cpp   Mon Jul 04 13:36:51 2016 +0530
@@ -1424,6 +1424,13 @@
 md.pred[PRED_2Nx2N].rdCost = 0;
 }
 
+   SplitData splitData[4];
+   splitData[0].initSplitCUData();
+   splitData[1].initSplitCUData();
+   splitData[2].initSplitCUData();
+   splitData[3].initSplitCUData();
+   uint32_t allSplitRefs = splitData[0].splitRefs | splitData[1].splitRefs 
| splitData[2].splitRefs | splitData[3].splitRefs;
+   uint32_t refMasks[2];
 if (m_param->analysisMode == X265_ANALYSIS_LOAD)
 {
 if (mightNotSplit && depth == m_reuseDepth[cuGeom.absPartIdx])
@@ -1433,23 +1440,20 @@
 md.pred[PRED_SKIP].cu.initSubCU(parentCTU, cuGeom, qp);
 md.pred[PRED_MERGE].cu.initSubCU(parentCTU, cuGeom, qp);
 checkMerge2Nx2N_rd5_6(md.pred[PRED_SKIP], md.pred[PRED_MERGE], 
cuGeom);
+skipModes = !!m_param->bEnableEarlySkip && md.bestMode;
+refMasks[0] = allSplitRefs;
+md.pred[PRED_2Nx2N].cu.initSubCU(parentCTU, cuGeom, qp);
+checkInter_rd5_6(md.pred[PRED_2Nx2N], cuGeom, SIZE_2Nx2N, 
refMasks);
+checkBestMode(md.pred[PRED_2Nx2N], cuGeom.depth);
 
-skipRecursion = !!m_param->bEnableRecursionSkip && md.bestMode;
-skipModes = !!m_param->bEnableEarlySkip && md.bestMode;
+if (m_param->bEnableRecursionSkip && depth && 
m_modeDepth[depth - 1].bestMode)
+   skipRecursion = md.bestMode && 
!md.bestMode->cu.getQtRootCbf(0);
 }
 if (m_reusePartSize[cuGeom.absPartIdx] == SIZE_2Nx2N)
 skipRectAmp = true && !!md.bestMode;
 }
 }
 
-SplitData splitData[4];
-splitData[0].initSplitCUData();
-splitData[1].initSplitCUData();
-splitData[2].initSplitCUData();
-splitData[3].initSplitCUData();
-
-uint32_t allSplitRefs = splitData[0].splitRefs | splitData[1].splitRefs | 
splitData[2].splitRefs | splitData[3].splitRefs;
-uint32_t refMasks[2];
 /* Step 1. Evaluate Merge/Skip candidates for likely early-outs */
 if (mightNotSplit && !md.bestMode)
 {
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] analysis: compute Inter2Nx2N after merge in analysis mode=load if reuse mode chosen is skip

2016-07-04 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar<santhosh...@multicorewareinc.com>
# Date 1467619611 -19800
#  Mon Jul 04 13:36:51 2016 +0530
# Node ID 0c4c66ce33abba9d3f224af2bac79b243c426c28
# Parent  836a870ba76b46d4c0078289e320db1371fc3403
analysis: compute Inter2Nx2N after merge in analysis mode=load if reuse mode 
chosen is skip

diff -r 836a870ba76b -r 0c4c66ce33ab source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp   Fri Jul 01 11:49:57 2016 +0530
+++ b/source/encoder/analysis.cpp   Mon Jul 04 13:36:51 2016 +0530
@@ -1424,6 +1424,13 @@
 md.pred[PRED_2Nx2N].rdCost = 0;
 }
 
+   SplitData splitData[4];
+   splitData[0].initSplitCUData();
+   splitData[1].initSplitCUData();
+   splitData[2].initSplitCUData();
+   splitData[3].initSplitCUData();
+   uint32_t allSplitRefs = splitData[0].splitRefs | splitData[1].splitRefs 
| splitData[2].splitRefs | splitData[3].splitRefs;
+   uint32_t refMasks[2];
 if (m_param->analysisMode == X265_ANALYSIS_LOAD)
 {
 if (mightNotSplit && depth == m_reuseDepth[cuGeom.absPartIdx])
@@ -1433,23 +1440,20 @@
 md.pred[PRED_SKIP].cu.initSubCU(parentCTU, cuGeom, qp);
 md.pred[PRED_MERGE].cu.initSubCU(parentCTU, cuGeom, qp);
 checkMerge2Nx2N_rd5_6(md.pred[PRED_SKIP], md.pred[PRED_MERGE], 
cuGeom);
+skipModes = !!m_param->bEnableEarlySkip && md.bestMode;
+refMasks[0] = allSplitRefs;
+md.pred[PRED_2Nx2N].cu.initSubCU(parentCTU, cuGeom, qp);
+checkInter_rd5_6(md.pred[PRED_2Nx2N], cuGeom, SIZE_2Nx2N, 
refMasks);
+checkBestMode(md.pred[PRED_2Nx2N], cuGeom.depth);
 
-skipRecursion = !!m_param->bEnableRecursionSkip && md.bestMode;
-skipModes = !!m_param->bEnableEarlySkip && md.bestMode;
+if (m_param->bEnableRecursionSkip && depth && 
m_modeDepth[depth - 1].bestMode)
+   skipRecursion = md.bestMode && 
!md.bestMode->cu.getQtRootCbf(0);
 }
 if (m_reusePartSize[cuGeom.absPartIdx] == SIZE_2Nx2N)
 skipRectAmp = true && !!md.bestMode;
 }
 }
 
-SplitData splitData[4];
-splitData[0].initSplitCUData();
-splitData[1].initSplitCUData();
-splitData[2].initSplitCUData();
-splitData[3].initSplitCUData();
-
-uint32_t allSplitRefs = splitData[0].splitRefs | splitData[1].splitRefs | 
splitData[2].splitRefs | splitData[3].splitRefs;
-uint32_t refMasks[2];
 /* Step 1. Evaluate Merge/Skip candidates for likely early-outs */
 if (mightNotSplit && !md.bestMode)
 {
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] introduce multi-level recursion skip

2016-06-23 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar<santhosh...@multicorewareinc.com>
# Date 1466656132 -19800
#  Thu Jun 23 09:58:52 2016 +0530
# Node ID efd68483f9f2de5e0c61d63b9d0dac1782b0d7c1
# Parent  626fcbac7ffba723dabd3a9f0507c4c80f3e7bc9
introduce multi-level recursion skip

diff -r 626fcbac7ffb -r efd68483f9f2 doc/reST/cli.rst
--- a/doc/reST/cli.rst  Thu Jun 16 12:57:38 2016 +0530
+++ b/doc/reST/cli.rst  Thu Jun 23 09:58:52 2016 +0530
@@ -732,12 +732,14 @@
Measure 2Nx2N merge candidates first; if no residual is found, 
additional modes at that depth are not analysed. Default disabled
 
-.. option:: --recursion-skip, --no-recursion-skip
+.. option:: --rskip, --no-rskip
 
-   Measure 2Nx2N merge candidates first; if no residual is found, then
-   do not recurse to higher depths. In rdlevels 4 and lower, additional 
-   heuristics such as neighbour costs are used to skip recursion. 
-   Default enabled.
+   In rdlevels 5 and 6 measure 2Nx2N merge candidates and compare it with
+   inter2Nx2N;if no residual is found, then do not recurse to higher depths
+   for depths > 0. At depth 0 recursion is allowed even when the residual 
is zero.
+   In rdlevels 4 and below additional heuristics such as neighbour costs 
+   are used to skip recursion when there is no residual after measuring 
2Nx2N merge
+   candidates.
 
 .. option:: --fast-intra, --no-fast-intra
 
diff -r 626fcbac7ffb -r efd68483f9f2 source/CMakeLists.txt
--- a/source/CMakeLists.txt Thu Jun 16 12:57:38 2016 +0530
+++ b/source/CMakeLists.txt Thu Jun 23 09:58:52 2016 +0530
@@ -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 86)
+set(X265_BUILD 87)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r 626fcbac7ffb -r efd68483f9f2 source/common/param.cpp
--- a/source/common/param.cpp   Thu Jun 16 12:57:38 2016 +0530
+++ b/source/common/param.cpp   Thu Jun 23 09:58:52 2016 +0530
@@ -389,7 +389,6 @@
 param->maxNumMergeCand = 4;
 param->searchMethod = X265_STAR_SEARCH;
 param->maxNumReferences = 5;
-param->bEnableRecursionSkip = 0;
 param->limitReferences = 1;
 param->limitModes = 1;
 param->bIntraInBFrames = 1;
@@ -620,7 +619,7 @@
 OPT("max-merge") p->maxNumMergeCand = (uint32_t)atoi(value);
 OPT("temporal-mvp") p->bEnableTemporalMvp = atobool(value);
 OPT("early-skip") p->bEnableEarlySkip = atobool(value);
-OPT("recursion-skip") p->bEnableRecursionSkip = atobool(value);
+OPT("rskip") p->bEnableRecursionSkip = atobool(value);
 OPT("rdpenalty") p->rdPenalty = atoi(value);
 OPT("tskip") p->bEnableTransformSkip = atobool(value);
 OPT("no-tskip-fast") p->bEnableTSkipFast = atobool(value);
@@ -1351,7 +1350,7 @@
 TOOLVAL(param->psyRdoq, "psy-rdoq=%.2lf");
 TOOLOPT(param->bEnableRdRefine, "rd-refine");
 TOOLOPT(param->bEnableEarlySkip, "early-skip");
-TOOLOPT(param->bEnableRecursionSkip, "recursion-skip");
+TOOLOPT(param->bEnableRecursionSkip, "rskip");
 TOOLVAL(param->noiseReductionIntra, "nr-intra=%d");
 TOOLVAL(param->noiseReductionInter, "nr-inter=%d");
 TOOLOPT(param->bEnableTSkipFast, "tskip-fast");
@@ -1410,7 +1409,7 @@
 s += sprintf(s, " max-merge=%d", p->maxNumMergeCand);
 BOOL(p->bEnableTemporalMvp, "temporal-mvp");
 BOOL(p->bEnableEarlySkip, "early-skip");
-BOOL(p->bEnableRecursionSkip, "recursion-skip");
+BOOL(p->bEnableRecursionSkip, "rskip");
 s += sprintf(s, " rdpenalty=%d", p->rdPenalty);
 BOOL(p->bEnableTransformSkip, "tskip");
 BOOL(p->bEnableTSkipFast, "tskip-fast");
diff -r 626fcbac7ffb -r efd68483f9f2 source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp   Thu Jun 16 12:57:38 2016 +0530
+++ b/source/encoder/analysis.cpp   Thu Jun 23 09:58:52 2016 +0530
@@ -1448,14 +1448,22 @@
 splitData[2].initSplitCUData();
 splitData[3].initSplitCUData();
 
+uint32_t allSplitRefs = splitData[0].splitRefs | splitData[1].splitRefs | 
splitData[2].splitRefs | splitData[3].splitRefs;
+uint32_t refMasks[2];
 /* Step 1. Evaluate Merge/Skip candidates for likely early-outs */
 if (mightNotSplit && !md.bestMode)
 {
 md.pred[PRED_SKIP].cu.initSubCU(parentCTU, cuGeom, qp);
 md.pred[PRED_MERGE].cu.initSubCU(parentCTU, cuGeom, qp);
 

[x265] [PATCH] introduce multi-level recursion skip

2016-06-22 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar<santhosh...@multicorewareinc.com>
# Date 1466656132 -19800
#  Thu Jun 23 09:58:52 2016 +0530
# Node ID bc0cbc5cb90c6f41e73c30b76fa7df1006581206
# Parent  626fcbac7ffba723dabd3a9f0507c4c80f3e7bc9
introduce multi-level recursion skip

diff -r 626fcbac7ffb -r bc0cbc5cb90c doc/reST/cli.rst
--- a/doc/reST/cli.rst  Thu Jun 16 12:57:38 2016 +0530
+++ b/doc/reST/cli.rst  Thu Jun 23 09:58:52 2016 +0530
@@ -732,12 +732,17 @@
Measure 2Nx2N merge candidates first; if no residual is found, 
additional modes at that depth are not analysed. Default disabled
 
-.. option:: --recursion-skip, --no-recursion-skip
+.. option:: --rskip <0|1|2>
 
-   Measure 2Nx2N merge candidates first; if no residual is found, then
-   do not recurse to higher depths. In rdlevels 4 and lower, additional 
-   heuristics such as neighbour costs are used to skip recursion. 
-   Default enabled.
+   Enable different levels of recursion skip for different presets.
+
+   0. disable recursion skip
+   1. Enable recursion skip in rdlevels 5 and 6. At this level recursion
+   is allowed at depth 0. For depths > 0 measure 2Nx2N merge candidates
+   and compare it with inter2Nx2N;if no residual is found, then do not
+   recurse to higher depths.
+   2. Enable recursion skip for rdlevels 0-4. At this level additional
+   heuristics such as neighbour costs are used to skip recursion.
 
 .. option:: --fast-intra, --no-fast-intra
 
diff -r 626fcbac7ffb -r bc0cbc5cb90c source/CMakeLists.txt
--- a/source/CMakeLists.txt Thu Jun 16 12:57:38 2016 +0530
+++ b/source/CMakeLists.txt Thu Jun 23 09:58:52 2016 +0530
@@ -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 86)
+set(X265_BUILD 87)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r 626fcbac7ffb -r bc0cbc5cb90c source/common/param.cpp
--- a/source/common/param.cpp   Thu Jun 16 12:57:38 2016 +0530
+++ b/source/common/param.cpp   Thu Jun 23 09:58:52 2016 +0530
@@ -164,7 +164,7 @@
 param->bEnableWeightedPred = 1;
 param->bEnableWeightedBiPred = 0;
 param->bEnableEarlySkip = 0;
-param->bEnableRecursionSkip = 1;
+param->bEnableRecursionSkip = 2;
 param->bEnableAMP = 0;
 param->bEnableRectInter = 0;
 param->rdLevel = 3;
@@ -368,6 +368,7 @@
 param->maxNumMergeCand = 3;
 param->searchMethod = X265_STAR_SEARCH;
 param->maxNumReferences = 4;
+param->bEnableRecursionSkip = 1;
 param->limitReferences = 2;
 param->limitModes = 1;
 param->bIntraInBFrames = 1;
@@ -389,7 +390,7 @@
 param->maxNumMergeCand = 4;
 param->searchMethod = X265_STAR_SEARCH;
 param->maxNumReferences = 5;
-param->bEnableRecursionSkip = 0;
+param->bEnableRecursionSkip = 1;
 param->limitReferences = 1;
 param->limitModes = 1;
 param->bIntraInBFrames = 1;
@@ -412,7 +413,7 @@
 param->maxNumMergeCand = 5;
 param->searchMethod = X265_STAR_SEARCH;
 param->bEnableTransformSkip = 1;
-param->bEnableRecursionSkip = 0;
+param->bEnableRecursionSkip = 1;
 param->maxNumReferences = 5;
 param->limitReferences = 0;
 param->bIntraInBFrames = 1;
@@ -620,7 +621,7 @@
 OPT("max-merge") p->maxNumMergeCand = (uint32_t)atoi(value);
 OPT("temporal-mvp") p->bEnableTemporalMvp = atobool(value);
 OPT("early-skip") p->bEnableEarlySkip = atobool(value);
-OPT("recursion-skip") p->bEnableRecursionSkip = atobool(value);
+OPT("rskip") p->bEnableRecursionSkip = atoi(value);
 OPT("rdpenalty") p->rdPenalty = atoi(value);
 OPT("tskip") p->bEnableTransformSkip = atobool(value);
 OPT("no-tskip-fast") p->bEnableTSkipFast = atobool(value);
@@ -1109,6 +1110,8 @@
   "RD Level is out of range");
 CHECK(param->rdoqLevel < 0 || param->rdoqLevel > 2,
 "RDOQ Level is out of range");
+CHECK(param->bEnableRecursionSkip < 0 || param->bEnableRecursionSkip > 2,
+  "rskip is out of range");
 CHECK(param->bframes && param->bframes >= param->lookaheadDepth && 
!param->rc.bStatRead,
   "Lookahead depth must be greater than the max consecutive bframe 
count");
 CHECK(param->bframes < 0,
@@ -1351,7 +1354,7 @@
 TOOLVAL(param->psyRdoq, &qu

Re: [x265] [PATCH] introduce multi-level recursion skip

2016-06-22 Thread Santhoshini Sekar
Will update and resend the patch.

On Thu, Jun 23, 2016 at 10:14 AM, Deepthi Nandakumar <
deep...@multicorewareinc.com> wrote:

> Documentation, build version updates...
>
> On Thu, Jun 23, 2016 at 10:03 AM, <santhosh...@multicorewareinc.com>
> wrote:
>
>> # HG changeset patch
>> # User Santhoshini Sekar<santhosh...@multicorewareinc.com>
>> # Date 1466656132 -19800
>> #  Thu Jun 23 09:58:52 2016 +0530
>> # Node ID 20e1abc4b08ca2d2da24c340728e3db96d2806f8
>> # Parent  626fcbac7ffba723dabd3a9f0507c4c80f3e7bc9
>> introduce multi-level recursion skip
>>
>> diff -r 626fcbac7ffb -r 20e1abc4b08c source/common/param.cpp
>> --- a/source/common/param.cpp   Thu Jun 16 12:57:38 2016 +0530
>> +++ b/source/common/param.cpp   Thu Jun 23 09:58:52 2016 +0530
>> @@ -164,7 +164,7 @@
>>  param->bEnableWeightedPred = 1;
>>  param->bEnableWeightedBiPred = 0;
>>  param->bEnableEarlySkip = 0;
>> -param->bEnableRecursionSkip = 1;
>> +param->bEnableRecursionSkip = 2;
>>  param->bEnableAMP = 0;
>>  param->bEnableRectInter = 0;
>>  param->rdLevel = 3;
>> @@ -368,6 +368,7 @@
>>  param->maxNumMergeCand = 3;
>>  param->searchMethod = X265_STAR_SEARCH;
>>  param->maxNumReferences = 4;
>> +param->bEnableRecursionSkip = 1;
>>  param->limitReferences = 2;
>>  param->limitModes = 1;
>>  param->bIntraInBFrames = 1;
>> @@ -389,7 +390,7 @@
>>  param->maxNumMergeCand = 4;
>>  param->searchMethod = X265_STAR_SEARCH;
>>  param->maxNumReferences = 5;
>> -param->bEnableRecursionSkip = 0;
>> +param->bEnableRecursionSkip = 1;
>>  param->limitReferences = 1;
>>  param->limitModes = 1;
>>  param->bIntraInBFrames = 1;
>> @@ -412,7 +413,7 @@
>>  param->maxNumMergeCand = 5;
>>  param->searchMethod = X265_STAR_SEARCH;
>>  param->bEnableTransformSkip = 1;
>> -param->bEnableRecursionSkip = 0;
>> +param->bEnableRecursionSkip = 1;
>>  param->maxNumReferences = 5;
>>  param->limitReferences = 0;
>>  param->bIntraInBFrames = 1;
>> @@ -620,7 +621,7 @@
>>  OPT("max-merge") p->maxNumMergeCand = (uint32_t)atoi(value);
>>  OPT("temporal-mvp") p->bEnableTemporalMvp = atobool(value);
>>  OPT("early-skip") p->bEnableEarlySkip = atobool(value);
>> -OPT("recursion-skip") p->bEnableRecursionSkip = atobool(value);
>> +OPT("rskip") p->bEnableRecursionSkip = atoi(value);
>>  OPT("rdpenalty") p->rdPenalty = atoi(value);
>>  OPT("tskip") p->bEnableTransformSkip = atobool(value);
>>  OPT("no-tskip-fast") p->bEnableTSkipFast = atobool(value);
>> @@ -1109,6 +1110,8 @@
>>"RD Level is out of range");
>>  CHECK(param->rdoqLevel < 0 || param->rdoqLevel > 2,
>>  "RDOQ Level is out of range");
>> +CHECK(param->bEnableRecursionSkip < 0 || param->bEnableRecursionSkip
>> > 2,
>> +  "rskip is out of range");
>>  CHECK(param->bframes && param->bframes >= param->lookaheadDepth &&
>> !param->rc.bStatRead,
>>"Lookahead depth must be greater than the max consecutive
>> bframe count");
>>  CHECK(param->bframes < 0,
>> @@ -1351,7 +1354,7 @@
>>  TOOLVAL(param->psyRdoq, "psy-rdoq=%.2lf");
>>  TOOLOPT(param->bEnableRdRefine, "rd-refine");
>>  TOOLOPT(param->bEnableEarlySkip, "early-skip");
>> -TOOLOPT(param->bEnableRecursionSkip, "recursion-skip");
>> +TOOLVAL(param->bEnableRecursionSkip, "rskip=%d");
>>  TOOLVAL(param->noiseReductionIntra, "nr-intra=%d");
>>  TOOLVAL(param->noiseReductionInter, "nr-inter=%d");
>>  TOOLOPT(param->bEnableTSkipFast, "tskip-fast");
>> @@ -1410,7 +1413,7 @@
>>  s += sprintf(s, " max-merge=%d", p->maxNumMergeCand);
>>  BOOL(p->bEnableTemporalMvp, "temporal-mvp");
>>  BOOL(p->bEnableEarlySkip, "early-skip");
>> -BOOL(p->bEnableRecursionSkip, "recursion-skip");
>&g

[x265] [PATCH] introduce multi-level recursion skip

2016-06-22 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar<santhosh...@multicorewareinc.com>
# Date 1466656132 -19800
#  Thu Jun 23 09:58:52 2016 +0530
# Node ID 20e1abc4b08ca2d2da24c340728e3db96d2806f8
# Parent  626fcbac7ffba723dabd3a9f0507c4c80f3e7bc9
introduce multi-level recursion skip

diff -r 626fcbac7ffb -r 20e1abc4b08c source/common/param.cpp
--- a/source/common/param.cpp   Thu Jun 16 12:57:38 2016 +0530
+++ b/source/common/param.cpp   Thu Jun 23 09:58:52 2016 +0530
@@ -164,7 +164,7 @@
 param->bEnableWeightedPred = 1;
 param->bEnableWeightedBiPred = 0;
 param->bEnableEarlySkip = 0;
-param->bEnableRecursionSkip = 1;
+param->bEnableRecursionSkip = 2;
 param->bEnableAMP = 0;
 param->bEnableRectInter = 0;
 param->rdLevel = 3;
@@ -368,6 +368,7 @@
 param->maxNumMergeCand = 3;
 param->searchMethod = X265_STAR_SEARCH;
 param->maxNumReferences = 4;
+param->bEnableRecursionSkip = 1;
 param->limitReferences = 2;
 param->limitModes = 1;
 param->bIntraInBFrames = 1;
@@ -389,7 +390,7 @@
 param->maxNumMergeCand = 4;
 param->searchMethod = X265_STAR_SEARCH;
 param->maxNumReferences = 5;
-param->bEnableRecursionSkip = 0;
+param->bEnableRecursionSkip = 1;
 param->limitReferences = 1;
 param->limitModes = 1;
 param->bIntraInBFrames = 1;
@@ -412,7 +413,7 @@
 param->maxNumMergeCand = 5;
 param->searchMethod = X265_STAR_SEARCH;
 param->bEnableTransformSkip = 1;
-param->bEnableRecursionSkip = 0;
+param->bEnableRecursionSkip = 1;
 param->maxNumReferences = 5;
 param->limitReferences = 0;
 param->bIntraInBFrames = 1;
@@ -620,7 +621,7 @@
 OPT("max-merge") p->maxNumMergeCand = (uint32_t)atoi(value);
 OPT("temporal-mvp") p->bEnableTemporalMvp = atobool(value);
 OPT("early-skip") p->bEnableEarlySkip = atobool(value);
-OPT("recursion-skip") p->bEnableRecursionSkip = atobool(value);
+OPT("rskip") p->bEnableRecursionSkip = atoi(value);
 OPT("rdpenalty") p->rdPenalty = atoi(value);
 OPT("tskip") p->bEnableTransformSkip = atobool(value);
 OPT("no-tskip-fast") p->bEnableTSkipFast = atobool(value);
@@ -1109,6 +1110,8 @@
   "RD Level is out of range");
 CHECK(param->rdoqLevel < 0 || param->rdoqLevel > 2,
 "RDOQ Level is out of range");
+CHECK(param->bEnableRecursionSkip < 0 || param->bEnableRecursionSkip > 2,
+  "rskip is out of range");
 CHECK(param->bframes && param->bframes >= param->lookaheadDepth && 
!param->rc.bStatRead,
   "Lookahead depth must be greater than the max consecutive bframe 
count");
 CHECK(param->bframes < 0,
@@ -1351,7 +1354,7 @@
 TOOLVAL(param->psyRdoq, "psy-rdoq=%.2lf");
 TOOLOPT(param->bEnableRdRefine, "rd-refine");
 TOOLOPT(param->bEnableEarlySkip, "early-skip");
-TOOLOPT(param->bEnableRecursionSkip, "recursion-skip");
+TOOLVAL(param->bEnableRecursionSkip, "rskip=%d");
 TOOLVAL(param->noiseReductionIntra, "nr-intra=%d");
 TOOLVAL(param->noiseReductionInter, "nr-inter=%d");
 TOOLOPT(param->bEnableTSkipFast, "tskip-fast");
@@ -1410,7 +1413,7 @@
 s += sprintf(s, " max-merge=%d", p->maxNumMergeCand);
 BOOL(p->bEnableTemporalMvp, "temporal-mvp");
 BOOL(p->bEnableEarlySkip, "early-skip");
-BOOL(p->bEnableRecursionSkip, "recursion-skip");
+s += sprintf(s, "rskip=%d", p->bEnableRecursionSkip);
 s += sprintf(s, " rdpenalty=%d", p->rdPenalty);
 BOOL(p->bEnableTransformSkip, "tskip");
 BOOL(p->bEnableTSkipFast, "tskip-fast");
diff -r 626fcbac7ffb -r 20e1abc4b08c source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp   Thu Jun 16 12:57:38 2016 +0530
+++ b/source/encoder/analysis.cpp   Thu Jun 23 09:58:52 2016 +0530
@@ -949,7 +949,7 @@
 skipRecursion = md.bestMode->cu.isSkipped(0);
 if (mightSplit && depth >= minDepth && !skipRecursion)
 {
-if (depth)
+if (depth && m_param->bEnableRecursionSkip == 2)
 skipRecursion = recursionDepthCheck(parentCTU, cuGeom, 
*md.bestMode);
 if (m_bHD && !skipRecursion && m_param->rdLevel == 2 && 
md.fencYuv.m_size != MAX_CU_SIZE)
 skipRecursion = complexityCheckCU(*md.bestMode);
@@ 

[x265] [PATCH] Allow different Csp for picture

2016-05-30 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar<santhosh...@multicorewareinc.com>
# Date 1464152658 -19800
#  Wed May 25 10:34:18 2016 +0530
# Node ID 028ccaa6486047ffafef38d78f9b00880908c0c3
# Parent  6d3849d648f0be5a8e334f1d75a2f7cf93c86cb3
Allow different Csp for picture

diff -r 6d3849d648f0 -r 028ccaa64860 source/common/cudata.cpp
--- a/source/common/cudata.cpp  Sun May 29 21:50:25 2016 +0800
+++ b/source/common/cudata.cpp  Wed May 25 10:34:18 2016 +0530
@@ -527,7 +527,7 @@
 }
 
 /* Only called by encodeResidue, these fields can be modified during 
inter/intra coding */
-void CUData::updatePic(uint32_t depth) const
+void CUData::updatePic(uint32_t depth, int picCsp) const
 {
 CUData& ctu = *m_encData->getPicCTU(m_cuAddr);
 
@@ -541,7 +541,7 @@
 uint32_t tmpY2 = m_absIdxInCTU << (LOG2_UNIT_SIZE * 2);
 memcpy(ctu.m_trCoeff[0] + tmpY2, m_trCoeff[0], sizeof(coeff_t)* tmpY);
 
-if (ctu.m_chromaFormat != X265_CSP_I400)
+if (ctu.m_chromaFormat != X265_CSP_I400 && picCsp != X265_CSP_I400)
 {
 m_partCopy(ctu.m_transformSkip[1] + m_absIdxInCTU, m_transformSkip[1]);
 m_partCopy(ctu.m_transformSkip[2] + m_absIdxInCTU, m_transformSkip[2]);
diff -r 6d3849d648f0 -r 028ccaa64860 source/common/cudata.h
--- a/source/common/cudata.hSun May 29 21:50:25 2016 +0800
+++ b/source/common/cudata.hWed May 25 10:34:18 2016 +0530
@@ -224,7 +224,7 @@
 
 /* RD-0 methods called only from encodeResidue */
 void copyFromPic(const CUData& ctu, const CUGeom& cuGeom, int csp, 
bool copyQp = true);
-void updatePic(uint32_t depth) const;
+void updatePic(uint32_t depth, int picCsp) const;
 
 void setPartSizeSubParts(PartSize size){ m_partSet(m_partSize, 
(uint8_t)size); }
 void setPredModeSubParts(PredMode mode){ m_partSet(m_predMode, 
(uint8_t)mode); }
diff -r 6d3849d648f0 -r 028ccaa64860 source/common/frame.cpp
--- a/source/common/frame.cpp   Sun May 29 21:50:25 2016 +0800
+++ b/source/common/frame.cpp   Wed May 25 10:34:18 2016 +0530
@@ -72,7 +72,7 @@
 m_reconPic = new PicYuv;
 m_param = param;
 m_encData->m_reconPic = m_reconPic;
-bool ok = m_encData->create(*param, sps) && 
m_reconPic->create(param->sourceWidth, param->sourceHeight, param->internalCsp);
+bool ok = m_encData->create(*param, sps, m_fencPic->m_picCsp) && 
m_reconPic->create(param->sourceWidth, param->sourceHeight, param->internalCsp);
 if (ok)
 {
 /* initialize right border of m_reconpicYuv as SAO may read beyond the
diff -r 6d3849d648f0 -r 028ccaa64860 source/common/framedata.cpp
--- a/source/common/framedata.cpp   Sun May 29 21:50:25 2016 +0800
+++ b/source/common/framedata.cpp   Wed May 25 10:34:18 2016 +0530
@@ -31,11 +31,12 @@
 memset(this, 0, sizeof(*this));
 }
 
-bool FrameData::create(const x265_param& param, const SPS& sps)
+bool FrameData::create(const x265_param& param, const SPS& sps, int csp)
 {
 m_param = 
 m_slice  = new Slice;
 m_picCTU = new CUData[sps.numCUsInFrame];
+m_picCsp = csp;
 
 m_cuMemPool.create(0, param.internalCsp, sps.numCUsInFrame);
 for (uint32_t ctuAddr = 0; ctuAddr < sps.numCUsInFrame; ctuAddr++)
diff -r 6d3849d648f0 -r 028ccaa64860 source/common/framedata.h
--- a/source/common/framedata.h Sun May 29 21:50:25 2016 +0800
+++ b/source/common/framedata.h Wed May 25 10:34:18 2016 +0530
@@ -146,10 +146,11 @@
 double m_avgQpRc;/* avg QP as decided by rate-control */
 double m_avgQpAq;/* avg QP as decided by AQ in addition to 
rate-control */
 double m_rateFactor; /* calculated based on the Frame QP */
+intm_picCsp;
 
 FrameData();
 
-bool create(const x265_param& param, const SPS& sps);
+bool create(const x265_param& param, const SPS& sps, int csp);
 void reinit(const SPS& sps);
 void destroy();
 inline CUData* getPicCTU(uint32_t ctuAddr) { return _picCTU[ctuAddr]; }
diff -r 6d3849d648f0 -r 028ccaa64860 source/common/picyuv.cpp
--- a/source/common/picyuv.cpp  Sun May 29 21:50:25 2016 +0800
+++ b/source/common/picyuv.cpp  Wed May 25 10:34:18 2016 +0530
@@ -180,6 +180,7 @@
  * warnings from valgrind about using uninitialized pixels */
 padx++;
 pady++;
+m_picCsp = pic.colorSpace;
 
 X265_CHECK(pic.bitDepth >= 8, "pic.bitDepth check failure");
 
@@ -194,7 +195,7 @@
 
 primitives.planecopy_cp(yChar, pic.stride[0] / sizeof(*yChar), 
yPixel, m_stride, width, height, shift);
 
-if (pic.colorSpace != X265_CSP_I400)
+if (param.internalCsp != X265_CSP_I400)
 {
 pixel *uPixel = m_picOrg[1];
 pixel *vPixel = m_picOrg[2];
@@ -220,7 +221,7 @@
 yChar += pic.stride[0] / sizeof(*yChar);
 }
 
-if (pic.colorSpace != X265_CSP_I40

[x265] [PATCH] add command lines to regression to test different rd levels at medium and veryslow presets

2016-05-24 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar<santhosh...@multicorewareinc.com>
# Date 1464149867 -19800
#  Wed May 25 09:47:47 2016 +0530
# Node ID 0108e73b0c070ab124d35c914dcf9817b08fbd0a
# Parent  4723933fdec920debefe606d50a9a312f7bc7f6b
add command lines to regression to test different rd levels at medium and 
veryslow presets

diff -r 4723933fdec9 -r 0108e73b0c07 source/test/regression-tests.txt
--- a/source/test/regression-tests.txt  Fri May 13 09:32:11 2016 +0530
+++ b/source/test/regression-tests.txt  Wed May 25 09:47:47 2016 +0530
@@ -24,6 +24,16 @@
 BasketballDrive_1920x1080_50.y4m,--preset veryslow --crf 4 --cu-lossless 
--pmode --limit-refs 1 --aq-mode 3
 BasketballDrive_1920x1080_50.y4m,--preset veryslow --no-cutree 
--analysis-mode=save --bitrate 7000 --tskip-fast,--preset veryslow --no-cutree 
--analysis-mode=load --bitrate 7000  --tskip-fast
 BasketballDrive_1920x1080_50.y4m,--preset veryslow --recon-y4m-exec "ffplay -i 
pipe:0 -autoexit"
+BasketballDrive_1920x1080_50.y4m,--preset medium --ctu 16 --max-tu-size 8 --rd 
2 --bitrate 7000
+BasketballDrive_1920x1080_50.y4m,--preset medium --lossless --chromaloc 3 
--subme 0 --rd 1
+BasketballDrive_1920x1080_50.y4m,--preset medium --ctu 16 --max-tu-size 8 --rd 
2 --bitrate 7000 --pmode
+BasketballDrive_1920x1080_50.y4m,--preset medium --lossless --chromaloc 3 
--subme 0 --rd 1 --pmode
+BasketballDrive_1920x1080_50.y4m,--preset medium --signhide --colormatrix 
bt709 --rd 5
+BasketballDrive_1920x1080_50.y4m,--preset medium --psy-rd 1 --ctu 16 --no-wpp 
--limit-modes --rd 5
+BasketballDrive_1920x1080_50.y4m,--preset medium --tune zerolatency 
--no-temporal-mvp --rd 5
+BasketballDrive_1920x1080_50.y4m,--preset medium --signhide --colormatrix 
bt709 --rd 5 --pmode
+BasketballDrive_1920x1080_50.y4m,--preset medium --psy-rd 1 --ctu 16 --no-wpp 
--limit-modes --rd 5 --pmode
+BasketballDrive_1920x1080_50.y4m,--preset medium --tune zerolatency 
--no-temporal-mvp --rd 5 --pmode
 Coastguard-4k.y4m,--preset ultrafast --recon-y4m-exec "ffplay -i pipe:0 
-autoexit"
 Coastguard-4k.y4m,--preset superfast --tune grain --overscan=crop
 Coastguard-4k.y4m,--preset veryfast --no-cutree --analysis-mode=save --bitrate 
15000,--preset veryfast --no-cutree --analysis-mode=load --bitrate 15000
@@ -48,6 +58,12 @@
 DucksAndLegs_1920x1080_60_10bit_444.yuv,--preset veryfast --weightp --nr-intra 
1000 -F4
 DucksAndLegs_1920x1080_60_10bit_444.yuv,--preset medium --nr-inter 500 -F4 
--no-psy-rdoq
 DucksAndLegs_1920x1080_60_10bit_444.yuv,--preset slower --no-weightp 
--rdoq-level 0 --limit-refs 3
+DucksAndLegs_1920x1080_60_10bit_444.yuv,--preset veryslow --qg-size 32 
--limit-refs 0 --rd 1 --bitrate 8000
+DucksAndLegs_1920x1080_60_10bit_444.yuv,--preset veryslow --qg-size 32 
--limit-refs 0 --rd 1 --bitrate 8000 --pmode 
+DucksAndLegs_1920x1080_60_10bit_444.yuv,--preset veryslow --rd 2 --crf 32 
--min-cu-size 32
+DucksAndLegs_1920x1080_60_10bit_444.yuv,--preset veryslow --rd 2 --crf 32 
--min-cu-size 32 --pmode
+DucksAndLegs_1920x1080_60_10bit_444.yuv,--preset veryslow --rd 4 --no-wpp 
--no-open-gop --bitrate 8000
+DucksAndLegs_1920x1080_60_10bit_444.yuv,--preset veryslow --rd 4 --no-wpp 
--no-open-gop --bitrate 8000 --pmode
 FourPeople_1280x720_60.y4m,--preset superfast --no-wpp --lookahead-slices 2
 FourPeople_1280x720_60.y4m,--preset medium --qp 38 --no-psy-rd
 FourPeople_1280x720_60.y4m,--preset medium --recon-y4m-exec "ffplay -i pipe:0 
-autoexit"
@@ -57,6 +73,8 @@
 Keiba_832x480_30.y4m,--preset slower --fast-intra --nr-inter 500 -F4 
--limit-refs 0
 Kimono1_1920x1080_24_10bit_444.yuv,--preset superfast --weightb
 Kimono1_1920x1080_24_10bit_444.yuv,--preset medium --min-cu-size 32
+Kimono1_1920x1080_24_10bit_444.yuv,--preset veryslow --rd 2 --fast-intra 
+Kimono1_1920x1080_24_10bit_444.yuv,--preset veryslow --rd 4 
--analysis-mode=save --bitrate 1,--preset veryslow --rd 4 
--analysis-mode=load --bitrate 1
 KristenAndSara_1280x720_60.y4m,--preset ultrafast --strong-intra-smoothing
 KristenAndSara_1280x720_60.y4m,--preset superfast --min-cu-size 16 --qg-size 
16 --limit-refs 1
 KristenAndSara_1280x720_60.y4m,--preset medium --no-cutree --max-tu-size 16
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] simplify math in intra refresh calculation (fixes #208)

2015-11-04 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar<santhosh...@multicorewareinc.com>
# Date 1446705159 -19800
#  Thu Nov 05 12:02:39 2015 +0530
# Node ID b2bcb012d101d8941911dbf51235ba6d581bbb71
# Parent  3103afbd31fa9b26533f06202516a511ee221439
simplify math in intra refresh calculation (fixes #208)

diff -r 3103afbd31fa -r b2bcb012d101 source/common/framedata.h
--- a/source/common/framedata.h Thu Nov 05 06:13:51 2015 +0530
+++ b/source/common/framedata.h Thu Nov 05 12:02:39 2015 +0530
@@ -137,7 +137,6 @@
 /* data needed for periodic intra refresh */
 struct PeriodicIR
 {
-double position;
 uint32_t   pirStartCol;
 uint32_t   pirEndCol;
 intframesSinceLastPir;
diff -r 3103afbd31fa -r b2bcb012d101 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cppThu Nov 05 06:13:51 2015 +0530
+++ b/source/encoder/encoder.cppThu Nov 05 12:02:39 2015 +0530
@@ -448,30 +448,29 @@
 m_bQueuedIntraRefresh = 0;
 /* PIR is currently only supported with ref == 1, so any intra frame 
effectively refreshes
  * the whole frame and counts as an intra refresh. */
-pir->position = numBlocksInRow;
+pir->pirEndCol = numBlocksInRow;
 }
 else if (slice->m_sliceType == P_SLICE)
 {
 Frame* ref = frameEnc->m_encData->m_slice->m_refFrameList[0][0];
 int pocdiff = frameEnc->m_poc - ref->m_poc;
-float increment = X265_MAX(((float)numBlocksInRow - 1) / 
m_param->keyframeMax, 1);
-pir->position = ref->m_encData->m_pir.position;
+int numPFramesInGOP = m_param->keyframeMax / pocdiff;
+int increment = (numBlocksInRow + numPFramesInGOP - 1) / 
numPFramesInGOP;
+pir->pirEndCol = ref->m_encData->m_pir.pirEndCol;
 pir->framesSinceLastPir = ref->m_encData->m_pir.framesSinceLastPir + 
pocdiff;
 if (pir->framesSinceLastPir >= m_param->keyframeMax ||
-   (m_bQueuedIntraRefresh && pir->position + 0.5 >= numBlocksInRow))
+(m_bQueuedIntraRefresh && pir->pirEndCol >= numBlocksInRow))
 {
-pir->position = 0;
+pir->pirEndCol = 0;
 pir->framesSinceLastPir = 0;
 m_bQueuedIntraRefresh = 0;
 frameEnc->m_lowres.bKeyframe = 1;
 }
-pir->pirStartCol = (uint32_t)(pir->position + 0.5);
-pir->position += increment * pocdiff;
-pir->pirEndCol = (uint32_t)(pir->position + 0.5);
+pir->pirStartCol = pir->pirEndCol;
+pir->pirEndCol += increment;
 /* If our intra refresh has reached the right side of the frame, we're 
done. */
 if (pir->pirEndCol >= numBlocksInRow)
 {
-pir->position = numBlocksInRow;
 pir->pirEndCol = numBlocksInRow;
 }
 }
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] add cli for Intra refresh

2015-10-07 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar<santhosh...@multicorewareinc.com>
# Date 1441626229 -19800
#  Mon Sep 07 17:13:49 2015 +0530
# Node ID dbfc496c0f9604cf9109f4c9ab95d89b5ec06074
# Parent  0e6dc779c1b21d47a2c510c18536e52e4c28c878
add cli for Intra refresh

diff -r 0e6dc779c1b2 -r dbfc496c0f96 doc/reST/cli.rst
--- a/doc/reST/cli.rst  Wed Sep 16 14:26:59 2015 +0530
+++ b/doc/reST/cli.rst  Mon Sep 07 17:13:49 2015 +0530
@@ -1087,7 +1087,8 @@
 
Max intra period in frames. A special case of infinite-gop (single
keyframe at the beginning of the stream) can be triggered with
-   argument -1. Use 1 to force all-intra. Default 250
+   argument -1. Use 1 to force all-intra. When intra-refresh is enabled
+   it specifies the interval between which refresh sweeps happen. Default 
250
 
 .. option:: --min-keyint, -i 
 
@@ -1106,6 +1107,14 @@
:option:`--scenecut` 0 or :option:`--no-scenecut` disables adaptive
I frame placement. Default 40
 
+.. option:: --intra-refresh
+
+   Enables Periodic Intra Refresh(PIR) instead of keyframe insertion.
+   PIR can replace keyframes by inserting a column of intra blocks in 
+   non-keyframes, that move across the video from one side to the other
+   and thereby refresh the image but over a period of multiple 
+   frames instead of a single keyframe.
+
 .. option:: --rc-lookahead 
 
Number of frames for slice-type decision lookahead (a key
diff -r 0e6dc779c1b2 -r dbfc496c0f96 source/common/param.cpp
--- a/source/common/param.cpp   Wed Sep 16 14:26:59 2015 +0530
+++ b/source/common/param.cpp   Mon Sep 07 17:13:49 2015 +0530
@@ -612,6 +612,7 @@
 OPT2("constrained-intra", "cip") p->bEnableConstrainedIntra = 
atobool(value);
 OPT("fast-intra") p->bEnableFastIntra = atobool(value);
 OPT("open-gop") p->bOpenGOP = atobool(value);
+OPT("intra-refresh") p->bIntraRefresh = atobool(value);
 OPT("lookahead-slices") p->lookaheadSlices = atoi(value);
 OPT("scenecut")
 {
@@ -1453,6 +1454,7 @@
 BOOL(p->bSaoNonDeblocked, "sao-non-deblock");
 BOOL(p->bBPyramid, "b-pyramid");
 BOOL(p->rc.cuTree, "cutree");
+BOOL(p->bIntraRefresh, "intra-refresh");
 s += sprintf(s, " rc=%s", p->rc.rateControlMode == X265_RC_ABR ? (
  p->rc.bStatRead ? "2 pass" : p->rc.bitrate == p->rc.vbvMaxBitrate ? 
"cbr" : "abr")
  : p->rc.rateControlMode == X265_RC_CRF ? "crf" : "cqp");
diff -r 0e6dc779c1b2 -r dbfc496c0f96 source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cppWed Sep 16 14:26:59 2015 +0530
+++ b/source/encoder/ratecontrol.cppMon Sep 07 17:13:49 2015 +0530
@@ -455,6 +455,7 @@
 CMP_OPT_FIRST_PASS("open-gop", m_param->bOpenGOP);
 CMP_OPT_FIRST_PASS("keyint", m_param->keyframeMax);
 CMP_OPT_FIRST_PASS("scenecut", m_param->scenecutThreshold);
+CMP_OPT_FIRST_PASS("intra_refresh", m_param->bIntraRefresh);
 
 if ((p = strstr(opts, "b-adapt=")) != 0 && sscanf(p, 
"b-adapt=%d", ) && i >= X265_B_ADAPT_NONE && i <= X265_B_ADAPT_TRELLIS)
 {
diff -r 0e6dc779c1b2 -r dbfc496c0f96 source/x265cli.h
--- a/source/x265cli.h  Wed Sep 16 14:26:59 2015 +0530
+++ b/source/x265cli.h  Mon Sep 07 17:13:49 2015 +0530
@@ -116,6 +116,7 @@
 { "min-keyint", required_argument, NULL, 'i' },
 { "scenecut",   required_argument, NULL, 0 },
 { "no-scenecut",  no_argument, NULL, 0 },
+{ "intra-refresh",no_argument, NULL, 0 },
 { "rc-lookahead",   required_argument, NULL, 0 },
 { "lookahead-slices", required_argument, NULL, 0 },
 { "bframes",required_argument, NULL, 'b' },
@@ -329,6 +330,7 @@
 H0("-i/--min-keyint Scenecuts closer together than this 
are coded as I, not IDR. Default: auto\n");
 H0("   --no-scenecut Disable adaptive I-frame decision\n");
 H0("   --scenecut   How aggressively to insert extra 
I-frames. Default %d\n", param->scenecutThreshold);
+H0("   --intra-refresh   Use Periodic Intra Refresh instead of 
IDR frames\n");
 H0("   --rc-lookahead   Number of frames for frame-type 
lookahead (determines encoder latency) Default %d\n", param->lookaheadDepth);
 H1("   --lookahead-slices <0..16>Number of slices to use per lookahead 
cost estimate. Default %d\n", param->lookaheadSlices);
 H0("   --bframesMaximum number of consecutive 
b-frames (now it only enables B GOP structure) Default %d\n", param->bframes);
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] Introduce structure needed for Intra refresh

2015-10-07 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar<santhosh...@multicorewareinc.com>
# Date 1441790555 -19800
#  Wed Sep 09 14:52:35 2015 +0530
# Node ID 7f24990073bb86ef6c632e5e2254c794daf3de3a
# Parent  f8b8ebdc54578e6735216d8b9abce5ba80c05bd8
Introduce structure needed for Intra refresh

diff -r f8b8ebdc5457 -r 7f24990073bb source/CMakeLists.txt
--- a/source/CMakeLists.txt Mon Sep 28 14:34:41 2015 +0530
+++ b/source/CMakeLists.txt Wed Sep 09 14:52:35 2015 +0530
@@ -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 75)
+set(X265_BUILD 76)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r f8b8ebdc5457 -r 7f24990073bb source/common/framedata.h
--- a/source/common/framedata.h Mon Sep 28 14:34:41 2015 +0530
+++ b/source/common/framedata.h Wed Sep 09 14:52:35 2015 +0530
@@ -134,7 +134,16 @@
 RCStatCU*  m_cuStat;
 RCStatRow* m_rowStat;
 FrameStats m_frameStats; // stats of current frame for multi-pass 
encodes
+/* data needed for periodic intra refresh */
+struct PeriodicIR
+{
+double position;
+uint32_t   pirStartCol;
+uint32_t   pirEndCol;
+intframesSinceLastPir;
+};
 
+PeriodicIR m_pir;
 double m_avgQpRc;/* avg QP as decided by rate-control */
 double m_avgQpAq;/* avg QP as decided by AQ in addition to 
rate-control */
 double m_rateFactor; /* calculated based on the Frame QP */
diff -r f8b8ebdc5457 -r 7f24990073bb source/encoder/encoder.cpp
--- a/source/encoder/encoder.cppMon Sep 28 14:34:41 2015 +0530
+++ b/source/encoder/encoder.cppWed Sep 09 14:52:35 2015 +0530
@@ -1515,6 +1515,7 @@
 p->rc.cuTree = 0;
 p->bEnableWeightedPred = 0;
 p->bEnableWeightedBiPred = 0;
+p->bIntraRefresh = 0;
 
 /* SPSs shall have sps_max_dec_pic_buffering_minus1[ 
sps_max_sub_layers_minus1 ] equal to 0 only */
 p->maxNumReferences = 1;
@@ -1605,6 +1606,34 @@
 
 if (p->totalFrames && p->totalFrames <= 2 * ((float)p->fpsNum) / 
p->fpsDenom && p->rc.bStrictCbr)
 p->lookaheadDepth = p->totalFrames;
+if (p->bIntraRefresh)
+{
+int numCuInWidth = (m_param->sourceWidth + g_maxCUSize - 1) / 
g_maxCUSize;
+if (p->maxNumReferences > 1)
+{
+x265_log(p,  X265_LOG_WARNING, "Max References > 1 + intra-refresh 
is not supported , setting max num references = 1\n");
+p->maxNumReferences = 1;
+}
+
+if (p->bBPyramid && p->bframes)
+x265_log(p,  X265_LOG_WARNING, "B pyramid cannot be enabled when 
max references is 1, Disabling B pyramid\n");
+p->bBPyramid = 0;
+
+
+if (p->bOpenGOP)
+{
+x265_log(p,  X265_LOG_WARNING, "Open Gop disabled, Intra Refresh 
is not compatible with openGop\n");
+p->bOpenGOP = 0;
+}
+
+x265_log(p,  X265_LOG_WARNING, "Scenecut is disabled when Intra 
Refresh is enabled\n");
+
+if (((float)numCuInWidth - 1) / m_param->keyframeMax > 1)
+x265_log(p,  X265_LOG_WARNING, "Keyint value is very low.It leads 
to frequent intra refreshes, can be almost every frame."
+ "Prefered use case would be high keyint value or an API 
call to refresh when necessary\n");
+
+}
+
 
 if (p->scalingLists && p->internalCsp == X265_CSP_I444)
 {
diff -r f8b8ebdc5457 -r 7f24990073bb source/x265.h
--- a/source/x265.h Mon Sep 28 14:34:41 2015 +0530
+++ b/source/x265.h Wed Sep 09 14:52:35 2015 +0530
@@ -703,6 +703,11 @@
  * should detect scene cuts. The default (40) is recommended. */
 int   scenecutThreshold;
 
+/* Replace keyframes by using a column of intra blocks that move across 
the video
+ * from one side to the other, thereby "refreshing" the image. In effect, 
instead of a
+ * big keyframe, the keyframe is "spread" over many frames. */
+int   bIntraRefresh;
+
 /*== Coding Unit (CU) definitions ==*/
 
 /* Maximum CU width and height in pixels.  The size must be 64, 32, or 16.
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH 1 of 3] Introduce structure needed for Intra refresh

2015-09-23 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar<santhosh...@multicorewareinc.com>
# Date 1441790555 -19800
#  Wed Sep 09 14:52:35 2015 +0530
# Node ID 98c0dcd5a10b8806aa1ceb775ff9342f7a7ae6c6
# Parent  975352b2c0223b9139aad233b43eaf2113ac8167
Introduce structure needed for Intra refresh

diff -r 975352b2c022 -r 98c0dcd5a10b source/common/framedata.h
--- a/source/common/framedata.h Wed Sep 23 16:19:48 2015 +0530
+++ b/source/common/framedata.h Wed Sep 09 14:52:35 2015 +0530
@@ -134,7 +134,16 @@
 RCStatCU*  m_cuStat;
 RCStatRow* m_rowStat;
 FrameStats m_frameStats; // stats of current frame for multi-pass 
encodes
+/* data needed for periodic intra refresh */
+struct PeriodicIR
+{
+double position;
+uint32_t   pirStartCol;
+uint32_t   pirEndCol;
+intframesSinceLastPir;
+};
 
+PeriodicIR m_pir;
 double m_avgQpRc;/* avg QP as decided by rate-control */
 double m_avgQpAq;/* avg QP as decided by AQ in addition to 
rate-control */
 double m_rateFactor; /* calculated based on the Frame QP */
diff -r 975352b2c022 -r 98c0dcd5a10b source/encoder/encoder.cpp
--- a/source/encoder/encoder.cppWed Sep 23 16:19:48 2015 +0530
+++ b/source/encoder/encoder.cppWed Sep 09 14:52:35 2015 +0530
@@ -1514,6 +1514,7 @@
 p->rc.cuTree = 0;
 p->bEnableWeightedPred = 0;
 p->bEnableWeightedBiPred = 0;
+p->bIntraRefresh = 0;
 
 /* SPSs shall have sps_max_dec_pic_buffering_minus1[ 
sps_max_sub_layers_minus1 ] equal to 0 only */
 p->maxNumReferences = 1;
@@ -1604,6 +1605,24 @@
 
 if (p->totalFrames && p->totalFrames <= 2 * ((float)p->fpsNum) / 
p->fpsDenom && p->rc.bStrictCbr)
 p->lookaheadDepth = p->totalFrames;
+if (p->bIntraRefresh && p->maxNumReferences > 1)
+{
+x265_log(p,  X265_LOG_WARNING, "Max References > 1 + intra-refresh is 
not supported , setting max num references = 1\n");
+p->maxNumReferences = 1;
+}
+if (p->bIntraRefresh)
+{
+if (p->bBPyramid && p->bframes)
+x265_log(p,  X265_LOG_WARNING, "B pyramid cannot be enabled when 
max references is 1, Disabling B pyramid\n");
+p->bBPyramid = 0;
+}
+
+if (p->bIntraRefresh && p->bOpenGOP)
+{
+x265_log(p,  X265_LOG_WARNING, "Open Gop disabled, Intra Refresh is 
not compatible with openGop\n");
+p->bOpenGOP = 0;
+}
+
 
 if (p->scalingLists && p->internalCsp == X265_CSP_I444)
 {
diff -r 975352b2c022 -r 98c0dcd5a10b source/x265.h
--- a/source/x265.h Wed Sep 23 16:19:48 2015 +0530
+++ b/source/x265.h Wed Sep 09 14:52:35 2015 +0530
@@ -703,6 +703,11 @@
  * should detect scene cuts. The default (40) is recommended. */
 int   scenecutThreshold;
 
+/* Replace keyframes by using a column of intra blocks that move across 
the video
+ * from one side to the other, thereby "refreshing" the image. In effect, 
instead of a
+ * big keyframe, the keyframe is "spread" over many frames. */
+int   bIntraRefresh;
+
 /*== Coding Unit (CU) definitions ==*/
 
 /* Maximum CU width and height in pixels.  The size must be 64, 32, or 16.
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH 3 of 3] add cli for Intra refresh

2015-09-23 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar<santhosh...@multicorewareinc.com>
# Date 1441626229 -19800
#  Mon Sep 07 17:13:49 2015 +0530
# Node ID 5520b8f17c5fc53f5d0afcb0e2df59eb8a4785b6
# Parent  97b62cb57bfa171e50d3fa736527634bb507cbe5
add cli for Intra refresh

diff -r 97b62cb57bfa -r 5520b8f17c5f doc/reST/cli.rst
--- a/doc/reST/cli.rst  Wed Sep 16 14:26:59 2015 +0530
+++ b/doc/reST/cli.rst  Mon Sep 07 17:13:49 2015 +0530
@@ -1087,7 +1087,8 @@
 
Max intra period in frames. A special case of infinite-gop (single
keyframe at the beginning of the stream) can be triggered with
-   argument -1. Use 1 to force all-intra. Default 250
+   argument -1. Use 1 to force all-intra. When intra-refresh is enabled
+   it specifies the interval between which refresh sweeps happen. Default 
250
 
 .. option:: --min-keyint, -i 
 
@@ -1106,6 +1107,14 @@
:option:`--scenecut` 0 or :option:`--no-scenecut` disables adaptive
I frame placement. Default 40
 
+.. option:: --intra-refresh
+
+   Enables Periodic Intra Refresh(PIR) instead of keyframe insertion.
+   PIR can replace keyframes by inserting a column of intra blocks in 
+   non-keyframes, that move across the video from one side to the other
+   and thereby refresh the image but over a period of multiple 
+   frames instead of a single keyframe.
+
 .. option:: --rc-lookahead 
 
Number of frames for slice-type decision lookahead (a key
diff -r 97b62cb57bfa -r 5520b8f17c5f source/CMakeLists.txt
--- a/source/CMakeLists.txt Wed Sep 16 14:26:59 2015 +0530
+++ b/source/CMakeLists.txt Mon Sep 07 17:13:49 2015 +0530
@@ -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 75)
+set(X265_BUILD 76)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r 97b62cb57bfa -r 5520b8f17c5f source/common/param.cpp
--- a/source/common/param.cpp   Wed Sep 16 14:26:59 2015 +0530
+++ b/source/common/param.cpp   Mon Sep 07 17:13:49 2015 +0530
@@ -612,6 +612,7 @@
 OPT2("constrained-intra", "cip") p->bEnableConstrainedIntra = 
atobool(value);
 OPT("fast-intra") p->bEnableFastIntra = atobool(value);
 OPT("open-gop") p->bOpenGOP = atobool(value);
+OPT("intra-refresh") p->bIntraRefresh = atobool(value);
 OPT("lookahead-slices") p->lookaheadSlices = atoi(value);
 OPT("scenecut")
 {
diff -r 97b62cb57bfa -r 5520b8f17c5f source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cppWed Sep 16 14:26:59 2015 +0530
+++ b/source/encoder/ratecontrol.cppMon Sep 07 17:13:49 2015 +0530
@@ -455,6 +455,7 @@
 CMP_OPT_FIRST_PASS("open-gop", m_param->bOpenGOP);
 CMP_OPT_FIRST_PASS("keyint", m_param->keyframeMax);
 CMP_OPT_FIRST_PASS("scenecut", m_param->scenecutThreshold);
+CMP_OPT_FIRST_PASS("intra_refresh", m_param->bIntraRefresh);
 
 if ((p = strstr(opts, "b-adapt=")) != 0 && sscanf(p, 
"b-adapt=%d", ) && i >= X265_B_ADAPT_NONE && i <= X265_B_ADAPT_TRELLIS)
 {
diff -r 97b62cb57bfa -r 5520b8f17c5f source/x265cli.h
--- a/source/x265cli.h  Wed Sep 16 14:26:59 2015 +0530
+++ b/source/x265cli.h  Mon Sep 07 17:13:49 2015 +0530
@@ -116,6 +116,7 @@
 { "min-keyint", required_argument, NULL, 'i' },
 { "scenecut",   required_argument, NULL, 0 },
 { "no-scenecut",  no_argument, NULL, 0 },
+{ "intra-refresh",no_argument, NULL, 0 },
 { "rc-lookahead",   required_argument, NULL, 0 },
 { "lookahead-slices", required_argument, NULL, 0 },
 { "bframes",required_argument, NULL, 'b' },
@@ -329,6 +330,7 @@
 H0("-i/--min-keyint Scenecuts closer together than this 
are coded as I, not IDR. Default: auto\n");
 H0("   --no-scenecut Disable adaptive I-frame decision\n");
 H0("   --scenecut   How aggressively to insert extra 
I-frames. Default %d\n", param->scenecutThreshold);
+H0("   --intra-refresh   Use Periodic Intra Refresh instead of 
IDR frames\n");
 H0("   --rc-lookahead   Number of frames for frame-type 
lookahead (determines encoder latency) Default %d\n", param->lookaheadDepth);
 H1("   --lookahead-slices <0..16>Number of slices to use per lookahead 
cost estimate. Default %d\n", param->lookaheadSlices);
 H0("   --bframesMaximum number of consecutive 
b-frames (now it only enables B GOP structure) Default %d\n", param->bframes);
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH 2 of 3] Implementation for Intra refresh

2015-09-23 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar<santhosh...@multicorewareinc.com>
# Date 1442393819 -19800
#  Wed Sep 16 14:26:59 2015 +0530
# Node ID 97b62cb57bfa171e50d3fa736527634bb507cbe5
# Parent  98c0dcd5a10b8806aa1ceb775ff9342f7a7ae6c6
Implementation for Intra refresh

diff -r 98c0dcd5a10b -r 97b62cb57bfa source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp   Wed Sep 09 14:52:35 2015 +0530
+++ b/source/encoder/analysis.cpp   Wed Sep 16 14:26:59 2015 +0530
@@ -171,10 +171,14 @@
 }
 else
 {
-if (!m_param->rdLevel)
+if (m_param->bIntraRefresh && m_slice->m_sliceType == P_SLICE &&
+ctu.m_cuPelX / g_maxCUSize >= frame.m_encData->m_pir.pirStartCol
+&& ctu.m_cuPelX / g_maxCUSize < frame.m_encData->m_pir.pirEndCol)
+compressIntraCU(ctu, cuGeom, zOrder, qp);
+else if (!m_param->rdLevel)
 {
 /* In RD Level 0/1, copy source pixels into the reconstructed 
block so
-* they are available for intra predictions */
+ * they are available for intra predictions */
 m_modeDepth[0].fencYuv.copyToPicYuv(*m_frame->m_reconPic, 
ctu.m_cuAddr, 0);
 
 compressInterCU_rd0_4(ctu, cuGeom, qp);
@@ -1458,13 +1462,23 @@
 bestPred->sa8dCost = MAX_INT64;
 int bestSadCand = -1;
 int sizeIdx = cuGeom.log2CUSize - 2;
-
+int safeX, maxSafeMv;
+if (m_param->bIntraRefresh && m_slice->m_sliceType == P_SLICE)
+{
+safeX = m_slice->m_refFrameList[0][0]->m_encData->m_pir.pirEndCol * 
g_maxCUSize - 3;
+maxSafeMv = (safeX - tempPred->cu.m_cuPelX) * 4;
+}
 for (uint32_t i = 0; i < numMergeCand; ++i)
 {
 if (m_bFrameParallel &&
 (candMvField[i][0].mv.y >= (m_param->searchRange + 1) * 4 ||
 candMvField[i][1].mv.y >= (m_param->searchRange + 1) * 4))
 continue;
+if (m_param->bIntraRefresh && m_slice->m_sliceType == P_SLICE &&
+tempPred->cu.m_cuPelX / g_maxCUSize < 
m_frame->m_encData->m_pir.pirEndCol &&
+candMvField[i][0].mv.x > maxSafeMv)
+// skip merge candidates which reference beyond safe reference area
+continue;
 
 tempPred->cu.m_mvpIdx[0][0] = (uint8_t)i; // merge candidate ID is 
stored in L0 MVP idx
 X265_CHECK(m_slice->m_sliceType == B_SLICE || !(candDir[i] & 0x10), " 
invalid merge for P slice\n");
@@ -1570,7 +1584,12 @@
 first = *m_reuseBestMergeCand;
 last = first + 1;
 }
-
+int safeX, maxSafeMv;
+if (m_param->bIntraRefresh && m_slice->m_sliceType == P_SLICE)
+{
+safeX = m_slice->m_refFrameList[0][0]->m_encData->m_pir.pirEndCol * 
g_maxCUSize - 3;
+maxSafeMv = (safeX - tempPred->cu.m_cuPelX) * 4;
+}
 for (uint32_t i = first; i < last; i++)
 {
 if (m_bFrameParallel &&
@@ -1593,7 +1612,11 @@
 continue;
 triedBZero = true;
 }
-
+if (m_param->bIntraRefresh && m_slice->m_sliceType == P_SLICE &&
+tempPred->cu.m_cuPelX / g_maxCUSize < 
m_frame->m_encData->m_pir.pirEndCol &&
+candMvField[i][0].mv.x > maxSafeMv)
+// skip merge candidates which reference beyond safe reference area
+continue;
 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;
diff -r 98c0dcd5a10b -r 97b62cb57bfa source/encoder/api.cpp
--- a/source/encoder/api.cppWed Sep 09 14:52:35 2015 +0530
+++ b/source/encoder/api.cppWed Sep 16 14:26:59 2015 +0530
@@ -245,6 +245,16 @@
 }
 }
 
+int x265_encoder_intra_refresh(x265_encoder *enc)
+{
+if (!enc)
+return -1;
+
+Encoder *encoder = static_cast<Encoder*>(enc);
+encoder->m_param->bQueuedIntraRefresh = 1;
+return 0;
+}
+
 void x265_cleanup(void)
 {
 if (!g_ctuSizeConfigured)
@@ -317,6 +327,7 @@
 _cleanup,
 
 sizeof(x265_frame_stats),
+_encoder_intra_refresh,
 };
 
 typedef const x265_api* (*api_get_func)(int bitDepth);
diff -r 98c0dcd5a10b -r 97b62cb57bfa source/encoder/encoder.cpp
--- a/source/encoder/encoder.cppWed Sep 09 14:52:35 2015 +0530
+++ b/source/encoder/encoder.cppWed Sep 16 14:26:59 2015 +0530
@@ -437,6 +437,46 @@
 }
 }
 
+void Encoder::calcRefreshInterval(Frame* frameEnc)
+{
+Slice* slice = frameEnc->m_encData->m_slice;
+uint32_t numBlocksInRow = slice->m_sps->numCuInWidth;
+FrameData::PeriodicIR* pir = >m_encData->m_pir;
+if (slice->m_sliceType == I_SLICE)
+{
+pir->framesSinceLastPir = 

Re: [x265] [PATCH] Implementation for Intra-refresh

2015-09-15 Thread Santhoshini Sekar
On Mon, Sep 14, 2015 at 9:16 PM, Steve Borho <st...@borho.org> wrote:

> On 09/14, santhosh...@multicorewareinc.com wrote:
> > # HG changeset patch
> > # User Santhoshini Sekar<santhosh...@multicorewareinc.com>
> > # Date 1442213046 -19800
> > #  Mon Sep 14 12:14:06 2015 +0530
> > # Node ID 0eb755da6cab80020bf26410438d83337f9aed9a
> > # Parent  f6892dcc7f4e74af58d7f39e085aed44afba919c
> > Implementation for Intra-refresh
> >
> > diff -r f6892dcc7f4e -r 0eb755da6cab source/encoder/analysis.cpp
> > --- a/source/encoder/analysis.cpp Wed Sep 09 14:52:35 2015 +0530
> > +++ b/source/encoder/analysis.cpp Mon Sep 14 12:14:06 2015 +0530
> > @@ -170,7 +170,12 @@
> >  }
> >  else
> >  {
> > -if (!m_param->rdLevel)
> > +int bForceIntra = m_param->bIntraRefresh &&
> m_slice->m_sliceType == P_SLICE &&
> > +  ctu.m_cuPelX / g_maxCUSize >=
> frame.m_encData->m_pir.pirStartPelX && ctu.m_cuPelX / g_maxCUSize <
> frame.m_encData->m_pir.pirEndPelX;
> > +
> > +if (bForceIntra)
> > +compressIntraCU(ctu, cuGeom, zOrder, qp);
> > +else if (!m_param->rdLevel)
> >  {
> >  /* In RD Level 0/1, copy source pixels into the
> reconstructed block so
> >  * they are available for intra predictions */
> > @@ -1464,7 +1469,13 @@
> >  (candMvField[i][0].mv.y >= (m_param->searchRange + 1) * 4 ||
> >  candMvField[i][1].mv.y >= (m_param->searchRange + 1) * 4))
> >  continue;
> > -
> > +if (m_param->bIntraRefresh && m_slice->m_sliceType == P_SLICE)
> > +{
> > +int maxX =
> (m_slice->m_refFrameList[0][0]->m_encData->m_pir.pirEndPelX * g_maxCUSize -
> 3) * 4;
>
> I'm not following this math, is m_pir.pirEndPelX not in units of PELs
> (pixels)?  The multiplication by g_maxCUSize would indicate it's in
> units of CTUs. And what is 3? is that the half-filter width? if so it
> needs to be adjusted for HEVC's filter-width (and probably use the
> existing macro)
>
> > +int maxMv = maxX - 4 * g_maxCUSize * candMvField[i][0].mv.x;
> > +if (maxMv > 0 && tempPred->cu.m_cuPelX / g_maxCUSize <
> m_frame->m_encData->m_pir.pirEndPelX)
> > +continue;
> > +}
> >  tempPred->cu.m_mvpIdx[0][0] = (uint8_t)i; // merge candidate ID
> is stored in L0 MVP idx
> >  X265_CHECK(m_slice->m_sliceType == B_SLICE || !(candDir[i] &
> 0x10), " invalid merge for P slice\n");
> >  tempPred->cu.m_interDir[0] = candDir[i];
> > @@ -1592,7 +1603,13 @@
> >  continue;
> >  triedBZero = true;
> >  }
> > -
> > +if (m_param->bIntraRefresh && m_slice->m_sliceType == P_SLICE)
> > +{
> > +int maxX =
> (m_slice->m_refFrameList[0][0]->m_encData->m_pir.pirEndPelX * g_maxCUSize -
> 3) * 4;
> > +int maxMv = maxX - 4 * g_maxCUSize * candMvField[i][0].mv.x;
> > +if (maxMv > 0 && tempPred->cu.m_cuPelX / g_maxCUSize <
> m_frame->m_encData->m_pir.pirEndPelX)
> > +continue;
> > +}
> >  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;
> > diff -r f6892dcc7f4e -r 0eb755da6cab source/encoder/api.cpp
> > --- a/source/encoder/api.cpp  Wed Sep 09 14:52:35 2015 +0530
> > +++ b/source/encoder/api.cpp  Mon Sep 14 12:14:06 2015 +0530
> > @@ -245,6 +245,16 @@
> >  }
> >  }
> >
> > +int x265_encoder_intra_refresh(x265_encoder *enc)
> > +{
> > +if (!enc)
> > +return -1;
> > +
> > +Encoder *encoder = static_cast<Encoder*>(enc);
> > +encoder->m_param->bQueuedIntraRefresh = 1;
> > +return 0;
> > +}
> > +
> >  void x265_cleanup(void)
> >  {
> >  if (!g_ctuSizeConfigured)
> > @@ -315,6 +325,7 @@
> >  _encoder_log,
> >  _encoder_close,
> >  _cleanup,
> > +_encoder_intra_refresh,
> >
> >  sizeof(x265_frame_stats),
> >  };
> > diff -r f6892dcc7f4e -r 0eb755da6cab source/encoder/encoder.cpp
> > --- a/source/encoder/encoder.cpp  Wed Sep 09 14:52:35 2015 +0530
> > +

[x265] [PATCH] Implementation for Intra-refresh

2015-09-14 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar<santhosh...@multicorewareinc.com>
# Date 1442213046 -19800
#  Mon Sep 14 12:14:06 2015 +0530
# Node ID 0eb755da6cab80020bf26410438d83337f9aed9a
# Parent  f6892dcc7f4e74af58d7f39e085aed44afba919c
Implementation for Intra-refresh

diff -r f6892dcc7f4e -r 0eb755da6cab source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp   Wed Sep 09 14:52:35 2015 +0530
+++ b/source/encoder/analysis.cpp   Mon Sep 14 12:14:06 2015 +0530
@@ -170,7 +170,12 @@
 }
 else
 {
-if (!m_param->rdLevel)
+int bForceIntra = m_param->bIntraRefresh && m_slice->m_sliceType == 
P_SLICE &&
+  ctu.m_cuPelX / g_maxCUSize >= 
frame.m_encData->m_pir.pirStartPelX && ctu.m_cuPelX / g_maxCUSize < 
frame.m_encData->m_pir.pirEndPelX;
+
+if (bForceIntra)
+compressIntraCU(ctu, cuGeom, zOrder, qp);
+else if (!m_param->rdLevel)
 {
 /* In RD Level 0/1, copy source pixels into the reconstructed 
block so
 * they are available for intra predictions */
@@ -1464,7 +1469,13 @@
 (candMvField[i][0].mv.y >= (m_param->searchRange + 1) * 4 ||
 candMvField[i][1].mv.y >= (m_param->searchRange + 1) * 4))
 continue;
-
+if (m_param->bIntraRefresh && m_slice->m_sliceType == P_SLICE)
+{
+int maxX = 
(m_slice->m_refFrameList[0][0]->m_encData->m_pir.pirEndPelX * g_maxCUSize - 3) 
* 4;
+int maxMv = maxX - 4 * g_maxCUSize * candMvField[i][0].mv.x;
+if (maxMv > 0 && tempPred->cu.m_cuPelX / g_maxCUSize < 
m_frame->m_encData->m_pir.pirEndPelX)
+continue;
+}
 tempPred->cu.m_mvpIdx[0][0] = (uint8_t)i; // merge candidate ID is 
stored in L0 MVP idx
 X265_CHECK(m_slice->m_sliceType == B_SLICE || !(candDir[i] & 0x10), " 
invalid merge for P slice\n");
 tempPred->cu.m_interDir[0] = candDir[i];
@@ -1592,7 +1603,13 @@
 continue;
 triedBZero = true;
 }
-
+if (m_param->bIntraRefresh && m_slice->m_sliceType == P_SLICE)
+{
+int maxX = 
(m_slice->m_refFrameList[0][0]->m_encData->m_pir.pirEndPelX * g_maxCUSize - 3) 
* 4;
+int maxMv = maxX - 4 * g_maxCUSize * candMvField[i][0].mv.x;
+if (maxMv > 0 && tempPred->cu.m_cuPelX / g_maxCUSize < 
m_frame->m_encData->m_pir.pirEndPelX)
+continue;
+}
 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;
diff -r f6892dcc7f4e -r 0eb755da6cab source/encoder/api.cpp
--- a/source/encoder/api.cppWed Sep 09 14:52:35 2015 +0530
+++ b/source/encoder/api.cppMon Sep 14 12:14:06 2015 +0530
@@ -245,6 +245,16 @@
 }
 }
 
+int x265_encoder_intra_refresh(x265_encoder *enc)
+{
+if (!enc)
+return -1;
+
+Encoder *encoder = static_cast<Encoder*>(enc);
+encoder->m_param->bQueuedIntraRefresh = 1;
+return 0;
+}
+
 void x265_cleanup(void)
 {
 if (!g_ctuSizeConfigured)
@@ -315,6 +325,7 @@
 _encoder_log,
 _encoder_close,
 _cleanup,
+_encoder_intra_refresh,
 
 sizeof(x265_frame_stats),
 };
diff -r f6892dcc7f4e -r 0eb755da6cab source/encoder/encoder.cpp
--- a/source/encoder/encoder.cppWed Sep 09 14:52:35 2015 +0530
+++ b/source/encoder/encoder.cppMon Sep 14 12:14:06 2015 +0530
@@ -768,6 +768,43 @@
 if (m_param->rc.rateControlMode != X265_RC_CQP)
 m_lookahead->getEstimatedPictureCost(frameEnc);
 
+if (m_param->bIntraRefresh)
+{
+Slice* slice = frameEnc->m_encData->m_slice;
+if (slice->m_sliceType == I_SLICE)
+{
+frameEnc->m_encData->m_pir.framesSinceLastPir = 0;
+m_param->bQueuedIntraRefresh = 0;
+/* PIR is currently only supported with ref == 1, so any 
intra frame effectively refreshes
+ * the whole frame and counts as an intra refresh. */
+frameEnc->m_encData->m_pir.position = 
frameEnc->m_lowres.maxBlocksInRow;
+}
+else if (slice->m_sliceType == P_SLICE)
+{
+Frame* ref = 
frameEnc->m_encData->m_slice->m_refFrameList[0][0];
+int pocdiff = (frameEnc->m_poc - ref->m_poc);
+float increment = 
X265_MAX(((float)frameEnc->m_lowres.maxBlocksInRow - 1) / m_param->keyframeMax, 
1);
+frameEnc->m_encData->m_pir.position = 
ref->m_encData->m_pir.position;
+

Re: [x265] [PATCH 2 of 3] Implementation for Intra-refresh

2015-09-08 Thread Santhoshini Sekar
Thanks Steve, will modify and resend the patches.

On Wed, Sep 9, 2015 at 1:32 AM, Steve Borho <st...@borho.org> wrote:

> On 09/07, santhosh...@multicorewareinc.com wrote:
> > # HG changeset patch
> > # User Santhoshini Sekar<santhosh...@multicorewareinc.com>
> > # Date 1441625035 -19800
> > #  Mon Sep 07 16:53:55 2015 +0530
> > # Node ID d91760d89cbd0e6f124fab60d7e4d684299b89a1
> > # Parent  2ba81f60f111c12a8f668ece13b23123702f2582
> > Implementation for Intra-refresh
> >
> > diff -r 2ba81f60f111 -r d91760d89cbd source/common/cudata.cpp
> > --- a/source/common/cudata.cppMon Sep 07 15:20:53 2015 +0530
> > +++ b/source/common/cudata.cppMon Sep 07 16:53:55 2015 +0530
> > @@ -1813,6 +1813,14 @@
> >  int16_t ymax = (int16_t)((m_slice->m_sps->picHeightInLumaSamples +
> offset - m_cuPelY - 1) << mvshift);
> >  int16_t ymin = -(int16_t)((g_maxCUSize + offset + m_cuPelY - 1) <<
> mvshift);
> >
> > +if (m_encData->m_param->bIntraRefresh && m_slice->m_sliceType ==
> P_SLICE)
> > +{
> > +int maxX =
> (m_slice->m_refFrameList[0][0]->m_encData->m_pir->pirEndPelX * 16 - 3) <<
> mvshift;
> > +int maxMv = maxX - 4* 16 * outMV.x;
> > +if (maxMv > 0 && m_cuPelX < m_encData->m_pir->pirStartPelX)
> > +xmax = X265_MIN(xmax, (int16_t)maxX);
> > +}
> > +
> >  outMV.x = X265_MIN(xmax, X265_MAX(xmin, outMV.x));
> >  outMV.y = X265_MIN(ymax, X265_MAX(ymin, outMV.y));
> >  }
> > diff -r 2ba81f60f111 -r d91760d89cbd source/common/cudata.h
> > --- a/source/common/cudata.h  Mon Sep 07 15:20:53 2015 +0530
> > +++ b/source/common/cudata.h  Mon Sep 07 16:53:55 2015 +0530
> > @@ -208,6 +208,7 @@
> >  const CUData* m_cuAbove;  // pointer to above neighbor CTU
> >  const CUData* m_cuLeft;   // pointer to left neighbor CTU
> >
> > +int   bForceIntra;// For Periodic Intra
> Refresh.Supported only in P-frames
>
> this could be a member of Analysis instead of CUData
>
> >  CUData();
> >
> >  void initialize(const CUDataMemPool& dataPool, uint32_t depth,
> int csp, int instance);
> > diff -r 2ba81f60f111 -r d91760d89cbd source/encoder/analysis.cpp
> > --- a/source/encoder/analysis.cpp Mon Sep 07 15:20:53 2015 +0530
> > +++ b/source/encoder/analysis.cpp Mon Sep 07 16:53:55 2015 +0530
> > @@ -170,6 +170,9 @@
> >  }
> >  else
> >  {
> > +ctu.bForceIntra = m_param->bIntraRefresh &&
> m_slice->m_sliceType == P_SLICE &&
> > +  ctu.m_cuPelX / g_maxCUSize >=
> frame.m_encData->m_pir->pirStartPelX && ctu.m_cuPelX / g_maxCUSize <
> frame.m_encData->m_pir->pirEndPelX;
> > +
> >  if (!m_param->rdLevel)
> >  {
> >  /* In RD Level 0/1, copy source pixels into the
> reconstructed block so
> > @@ -828,7 +831,7 @@
> >  bool splitIntra = true;
> >  uint32_t splitRefs[4] = { 0, 0, 0, 0 };
> >  /* Step 1. Evaluate Merge/Skip candidates for likely early-outs */
> > -if (mightNotSplit && depth >= minDepth)
> > +if (mightNotSplit && depth >= minDepth && !parentCTU.bForceIntra)
> >  {
> >  /* Compute Merge Cost */
> >  md.pred[PRED_MERGE].cu.initSubCU(parentCTU, cuGeom, qp);
> > @@ -909,7 +912,7 @@
> >  if (m_slice->m_pps->bUseDQP && depth <=
> m_slice->m_pps->maxCuDQPDepth && m_slice->m_pps->maxCuDQPDepth != 0)
> >  setLambdaFromQP(parentCTU, qp);
> >
> > -if (!earlyskip)
> > +if (!earlyskip && !parentCTU.bForceIntra)
> >  {
> >  uint32_t refMasks[2];
> >  refMasks[0] = allSplitRefs;
> > @@ -1119,7 +1122,21 @@
> >  }
> >  }
> >  }
> > -} // !earlyskip
> > +}
> > +if (!earlyskip && parentCTU.bForceIntra)
> > +{
> > +ProfileCounter(parentCTU, totalIntraCU[cuGeom.depth]);
> > +md.pred[PRED_INTRA].cu.initSubCU(parentCTU, cuGeom, qp);
> > +checkIntra(md.pred[PRED_INTRA], cuGeom, SIZE_2Nx2N, NULL,
> NULL);
> > +checkBestMode(md.pred[PRED_INTRA], depth);
> > +
> > +if (cuGeom.log2CUSize == 3 &&
> m_slice->m_sps->quadtreeTULog2MinSize

[x265] [PATCH 3 of 3] cli: add cli option for Intra-refresh

2015-09-07 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar<santhosh...@multicorewareinc.com>
# Date 1441626229 -19800
#  Mon Sep 07 17:13:49 2015 +0530
# Node ID d0f6a040aff28d0bb636d053fa894b834c13f51a
# Parent  d91760d89cbd0e6f124fab60d7e4d684299b89a1
cli: add cli option for Intra-refresh

diff -r d91760d89cbd -r d0f6a040aff2 doc/reST/cli.rst
--- a/doc/reST/cli.rst  Mon Sep 07 16:53:55 2015 +0530
+++ b/doc/reST/cli.rst  Mon Sep 07 17:13:49 2015 +0530
@@ -1092,6 +1092,14 @@
:option:`--scenecut` 0 or :option:`--no-scenecut` disables adaptive
I frame placement. Default 40
 
+.. option:: --intra-refresh
+
+   Enables Periodic Intra Refresh(PIR) instead of keyframe insertion.
+   PIR can replace keyframes by inserting a column of intra blocks in 
+   non-keyframes, that move across the video from one side to the other
+   and thereby refresh the image but over a period of multiple 
+   frames instead of a single keyframe.
+
 .. option:: --rc-lookahead 
 
Number of frames for slice-type decision lookahead (a key
diff -r d91760d89cbd -r d0f6a040aff2 source/CMakeLists.txt
--- a/source/CMakeLists.txt Mon Sep 07 16:53:55 2015 +0530
+++ b/source/CMakeLists.txt Mon Sep 07 17:13:49 2015 +0530
@@ -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 74)
+set(X265_BUILD 75)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r d91760d89cbd -r d0f6a040aff2 source/common/param.cpp
--- a/source/common/param.cpp   Mon Sep 07 16:53:55 2015 +0530
+++ b/source/common/param.cpp   Mon Sep 07 17:13:49 2015 +0530
@@ -610,6 +610,7 @@
 OPT2("constrained-intra", "cip") p->bEnableConstrainedIntra = 
atobool(value);
 OPT("fast-intra") p->bEnableFastIntra = atobool(value);
 OPT("open-gop") p->bOpenGOP = atobool(value);
+OPT("intra-refresh") p->bIntraRefresh = atobool(value);
 OPT("lookahead-slices") p->lookaheadSlices = atoi(value);
 OPT("scenecut")
 {
diff -r d91760d89cbd -r d0f6a040aff2 source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cppMon Sep 07 16:53:55 2015 +0530
+++ b/source/encoder/ratecontrol.cppMon Sep 07 17:13:49 2015 +0530
@@ -455,6 +455,7 @@
 CMP_OPT_FIRST_PASS("open-gop", m_param->bOpenGOP);
 CMP_OPT_FIRST_PASS("keyint", m_param->keyframeMax);
 CMP_OPT_FIRST_PASS("scenecut", m_param->scenecutThreshold);
+CMP_OPT_FIRST_PASS("intra_refresh", m_param->bIntraRefresh);
 
 if ((p = strstr(opts, "b-adapt=")) != 0 && sscanf(p, 
"b-adapt=%d", ) && i >= X265_B_ADAPT_NONE && i <= X265_B_ADAPT_TRELLIS)
 {
diff -r d91760d89cbd -r d0f6a040aff2 source/x265cli.h
--- a/source/x265cli.h  Mon Sep 07 16:53:55 2015 +0530
+++ b/source/x265cli.h  Mon Sep 07 17:13:49 2015 +0530
@@ -116,6 +116,7 @@
 { "min-keyint", required_argument, NULL, 'i' },
 { "scenecut",   required_argument, NULL, 0 },
 { "no-scenecut",  no_argument, NULL, 0 },
+{ "intra-refresh",no_argument, NULL, 0 },
 { "rc-lookahead",   required_argument, NULL, 0 },
 { "lookahead-slices", required_argument, NULL, 0 },
 { "bframes",required_argument, NULL, 'b' },
@@ -329,6 +330,7 @@
 H0("-i/--min-keyint Scenecuts closer together than this 
are coded as I, not IDR. Default: auto\n");
 H0("   --no-scenecut Disable adaptive I-frame decision\n");
 H0("   --scenecut   How aggressively to insert extra 
I-frames. Default %d\n", param->scenecutThreshold);
+H0("   --intra-refresh   Use Periodic Intra Refresh instead of 
IDR frames\n");
 H0("   --rc-lookahead   Number of frames for frame-type 
lookahead (determines encoder latency) Default %d\n", param->lookaheadDepth);
 H1("   --lookahead-slices <0..16>Number of slices to use per lookahead 
cost estimate. Default %d\n", param->lookaheadSlices);
 H0("   --bframesMaximum number of consecutive 
b-frames (now it only enables B GOP structure) Default %d\n", param->bframes);
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] add API and implementation for Region of Interest(ROI)

2015-08-11 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekarsanthosh...@multicorewareinc.com
# Date 1438839704 -19800
#  Thu Aug 06 11:11:44 2015 +0530
# Node ID 8dcbdddb663d0d93ad32ac36c764146dcbd9e883
# Parent  cbdefdfca87723342d21d90c41a93254553ed3d1
add API and implementation for Region of Interest(ROI)

diff -r cbdefdfca877 -r 8dcbdddb663d source/CMakeLists.txt
--- a/source/CMakeLists.txt Thu Aug 06 14:23:43 2015 +0530
+++ b/source/CMakeLists.txt Thu Aug 06 11:11:44 2015 +0530
@@ -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 68)
+set(X265_BUILD 69)
 configure_file(${PROJECT_SOURCE_DIR}/x265.def.in
${PROJECT_BINARY_DIR}/x265.def)
 configure_file(${PROJECT_SOURCE_DIR}/x265_config.h.in
diff -r cbdefdfca877 -r 8dcbdddb663d source/common/frame.cpp
--- a/source/common/frame.cpp   Thu Aug 06 14:23:43 2015 +0530
+++ b/source/common/frame.cpp   Thu Aug 06 11:11:44 2015 +0530
@@ -36,6 +36,7 @@
 m_countRefEncoders = 0;
 m_encData = NULL;
 m_reconPic = NULL;
+m_quantOffsets = NULL;
 m_next = NULL;
 m_prev = NULL;
 m_param = NULL;
@@ -100,5 +101,10 @@
 m_reconPic = NULL;
 }
 
+if (m_quantOffsets)
+{
+delete[] m_quantOffsets;
+}
+
 m_lowres.destroy();
 }
diff -r cbdefdfca877 -r 8dcbdddb663d source/common/frame.h
--- a/source/common/frame.h Thu Aug 06 14:23:43 2015 +0530
+++ b/source/common/frame.h Thu Aug 06 11:11:44 2015 +0530
@@ -59,6 +59,8 @@
 bool   m_lowresInit; // lowres init complete 
(pre-analysis)
 bool   m_bChromaExtended;// orig chroma planes motion 
extended for weight analysis
 
+float* m_quantOffsets;   // points to quantOffsets in 
x265_picture
+
 /* Frame Parallelism - notification between FrameEncoders of available 
motion reference rows */
 ThreadSafeInteger  m_reconRowCount;  // count of CTU rows 
completely reconstructed and extended for motion reference
 volatile uint32_t  m_countRefEncoders;   // count of FrameEncoder 
threads monitoring m_reconRowCount
diff -r cbdefdfca877 -r 8dcbdddb663d source/encoder/api.cpp
--- a/source/encoder/api.cppThu Aug 06 14:23:43 2015 +0530
+++ b/source/encoder/api.cppThu Aug 06 11:11:44 2015 +0530
@@ -268,6 +268,7 @@
 pic-bitDepth = param-internalBitDepth;
 pic-colorSpace = param-internalCsp;
 pic-forceqp = X265_QP_AUTO;
+pic-quantOffsets = NULL;
 if (param-analysisMode)
 {
 uint32_t widthInCU   = (param-sourceWidth  + g_maxCUSize - 1)  
g_maxLog2CUSize;
diff -r cbdefdfca877 -r 8dcbdddb663d source/encoder/encoder.cpp
--- a/source/encoder/encoder.cppThu Aug 06 14:23:43 2015 +0530
+++ b/source/encoder/encoder.cppThu Aug 06 11:11:44 2015 +0530
@@ -407,6 +407,7 @@
 }
 
 Frame *inFrame;
+int cuCount;
 if (m_dpb-m_freeList.empty())
 {
 inFrame = new Frame;
@@ -441,6 +442,11 @@
 m_buOffsetY = inFrame-m_fencPic-m_buOffsetY;
 }
 }
+if (pic_in-quantOffsets != NULL)
+{
+cuCount = inFrame-m_lowres.maxBlocksInRow * 
inFrame-m_lowres.maxBlocksInCol;
+inFrame-m_quantOffsets = new float[cuCount];
+}
 }
 else
 {
@@ -465,6 +471,8 @@
 inFrame-m_pts   = pic_in-pts;
 inFrame-m_forceqp   = pic_in-forceqp;
 inFrame-m_param = m_reconfigured ? m_latestParam : m_param;
+if (pic_in-quantOffsets != NULL)
+memcpy(inFrame-m_quantOffsets, pic_in-quantOffsets, cuCount * 
sizeof(float));
 
 if (m_pocLast == 0)
 m_firstPts = inFrame-m_pts;
diff -r cbdefdfca877 -r 8dcbdddb663d source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp  Thu Aug 06 14:23:43 2015 +0530
+++ b/source/encoder/slicetype.cpp  Thu Aug 06 11:11:44 2015 +0530
@@ -96,6 +96,7 @@
 int maxRow = curFrame-m_fencPic-m_picHeight;
 int blockCount = curFrame-m_lowres.maxBlocksInRow * 
curFrame-m_lowres.maxBlocksInCol;
 
+float* quantOffsets = curFrame-m_quantOffsets;
 for (int y = 0; y  3; y++)
 {
 curFrame-m_lowres.wp_ssd[y] = 0;
@@ -113,10 +114,21 @@
 
 if (param-rc.aqMode  param-rc.aqStrength == 0)
 {
-memset(curFrame-m_lowres.qpCuTreeOffset, 0, cuCount * 
sizeof(double));
-memset(curFrame-m_lowres.qpAqOffset, 0, cuCount * sizeof(double));
-for (int cuxy = 0; cuxy  cuCount; cuxy++)
-curFrame-m_lowres.invQscaleFactor[cuxy] = 256;
+if (quantOffsets)
+{
+for (int cuxy = 0; cuxy  cuCount; cuxy++)
+{
+curFrame-m_lowres.qpCuTreeOffset[cuxy] = 
curFrame-m_lowres.qpAqOffset[cuxy] = quantOffsets

[x265] [PATCH] add API and implementation for Region of Interest(ROI)

2015-08-05 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekarsanthosh...@multicorewareinc.com
# Date 1438839704 -19800
#  Thu Aug 06 11:11:44 2015 +0530
# Node ID fb00cab476a5d860e2fcddd51d764bdc3c8b96bc
# Parent  377a996a8d74110f838ff2e3cef1c42781d6d730
add API and implementation for Region of Interest(ROI)

diff -r 377a996a8d74 -r fb00cab476a5 source/CMakeLists.txt
--- a/source/CMakeLists.txt Wed Aug 05 15:09:14 2015 +0530
+++ b/source/CMakeLists.txt Thu Aug 06 11:11:44 2015 +0530
@@ -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 68)
+set(X265_BUILD 69)
 configure_file(${PROJECT_SOURCE_DIR}/x265.def.in
${PROJECT_BINARY_DIR}/x265.def)
 configure_file(${PROJECT_SOURCE_DIR}/x265_config.h.in
diff -r 377a996a8d74 -r fb00cab476a5 source/common/frame.h
--- a/source/common/frame.h Wed Aug 05 15:09:14 2015 +0530
+++ b/source/common/frame.h Thu Aug 06 11:11:44 2015 +0530
@@ -59,6 +59,8 @@
 bool   m_lowresInit; // lowres init complete 
(pre-analysis)
 bool   m_bChromaExtended;// orig chroma planes motion 
extended for weight analysis
 
+float* m_quantOffsets;   // points to quantOffsets in 
x265_picture
+
 /* Frame Parallelism - notification between FrameEncoders of available 
motion reference rows */
 ThreadSafeInteger  m_reconRowCount;  // count of CTU rows 
completely reconstructed and extended for motion reference
 volatile uint32_t  m_countRefEncoders;   // count of FrameEncoder 
threads monitoring m_reconRowCount
diff -r 377a996a8d74 -r fb00cab476a5 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cppWed Aug 05 15:09:14 2015 +0530
+++ b/source/encoder/encoder.cppThu Aug 06 11:11:44 2015 +0530
@@ -465,6 +465,7 @@
 inFrame-m_pts   = pic_in-pts;
 inFrame-m_forceqp   = pic_in-forceqp;
 inFrame-m_param = m_reconfigured ? m_latestParam : m_param;
+inFrame-m_quantOffsets = pic_in-quantOffsets;
 
 if (m_pocLast == 0)
 m_firstPts = inFrame-m_pts;
@@ -630,6 +631,10 @@
  * curEncoder is guaranteed to be idle at this point */
 if (!pass)
 frameEnc = m_lookahead-getDecidedPicture();
+
+if (pic_in  pic_in-quantOffsets_free)
+pic_in-quantOffsets_free(pic_in-quantOffsets);
+
 if (frameEnc  !pass)
 {
 /* give this frame a FrameData instance before encoding */
diff -r 377a996a8d74 -r fb00cab476a5 source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp  Wed Aug 05 15:09:14 2015 +0530
+++ b/source/encoder/slicetype.cpp  Thu Aug 06 11:11:44 2015 +0530
@@ -96,6 +96,7 @@
 int maxRow = curFrame-m_fencPic-m_picHeight;
 int blockCount = curFrame-m_lowres.maxBlocksInRow * 
curFrame-m_lowres.maxBlocksInCol;
 
+float* quantOffsets = curFrame-m_quantOffsets;
 for (int y = 0; y  3; y++)
 {
 curFrame-m_lowres.wp_ssd[y] = 0;
@@ -113,10 +114,21 @@
 
 if (param-rc.aqMode  param-rc.aqStrength == 0)
 {
-memset(curFrame-m_lowres.qpCuTreeOffset, 0, cuCount * 
sizeof(double));
-memset(curFrame-m_lowres.qpAqOffset, 0, cuCount * sizeof(double));
-for (int cuxy = 0; cuxy  cuCount; cuxy++)
-curFrame-m_lowres.invQscaleFactor[cuxy] = 256;
+if (quantOffsets)
+{
+for (int cuxy = 0; cuxy  cuCount; cuxy++)
+{
+curFrame-m_lowres.qpCuTreeOffset[cuxy] = 
curFrame-m_lowres.qpAqOffset[cuxy] = quantOffsets[cuxy];
+curFrame-m_lowres.invQscaleFactor[cuxy] = 
x265_exp2fix8(curFrame-m_lowres.qpCuTreeOffset[cuxy]);
+}
+}
+else
+{
+memset(curFrame-m_lowres.qpCuTreeOffset, 0, cuCount * 
sizeof(double));
+memset(curFrame-m_lowres.qpAqOffset, 0, cuCount * 
sizeof(double));
+for (int cuxy = 0; cuxy  cuCount; cuxy++)
+curFrame-m_lowres.invQscaleFactor[cuxy] = 256;
+}
 }
 
 /* Need variance data for weighted prediction */
@@ -177,6 +189,8 @@
 uint32_t energy = acEnergyCu(curFrame, blockX, blockY, 
param-internalCsp);
 qp_adj = strength * (X265_LOG2(X265_MAX(energy, 1)) - 
(14.427f + 2 * (X265_DEPTH - 8)));
 }
+if (quantOffsets)
+qp_adj += quantOffsets[blockXY];
 curFrame-m_lowres.qpAqOffset[blockXY] = qp_adj;
 curFrame-m_lowres.qpCuTreeOffset[blockXY] = qp_adj;
 curFrame-m_lowres.invQscaleFactor[blockXY] = 
x265_exp2fix8(qp_adj);
diff -r 377a996a8d74 -r fb00cab476a5 source/x265.h
--- a/source/x265.h Wed Aug 05 15:09:14 2015 +0530
+++ b/source/x265.h Thu Aug 06 11:11:44 2015 +0530
@@ -205,6

[x265] [PATCH] add API and implementation for Region of Interest(ROI)

2015-08-05 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekarsanthosh...@multicorewareinc.com
# Date 1438679012 -19800
#  Tue Aug 04 14:33:32 2015 +0530
# Node ID 14abf498e49b0963fb1c0db19e39aa5de18560a5
# Parent  3fa7f6838098854de79d3800b2d775dabaf45705
add API and implementation for Region of Interest(ROI)

diff -r 3fa7f6838098 -r 14abf498e49b source/CMakeLists.txt
--- a/source/CMakeLists.txt Mon Aug 03 14:56:21 2015 -0500
+++ b/source/CMakeLists.txt Tue Aug 04 14:33:32 2015 +0530
@@ -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 68)
+set(X265_BUILD 69)
 configure_file(${PROJECT_SOURCE_DIR}/x265.def.in
${PROJECT_BINARY_DIR}/x265.def)
 configure_file(${PROJECT_SOURCE_DIR}/x265_config.h.in
diff -r 3fa7f6838098 -r 14abf498e49b source/common/frame.h
--- a/source/common/frame.h Mon Aug 03 14:56:21 2015 -0500
+++ b/source/common/frame.h Tue Aug 04 14:33:32 2015 +0530
@@ -59,6 +59,8 @@
 bool   m_lowresInit; // lowres init complete 
(pre-analysis)
 bool   m_bChromaExtended;// orig chroma planes motion 
extended for weight analysis
 
+float* m_quantOffsets;   // points to quantOffsets in 
x265_picture
+
 /* Frame Parallelism - notification between FrameEncoders of available 
motion reference rows */
 ThreadSafeInteger  m_reconRowCount;  // count of CTU rows 
completely reconstructed and extended for motion reference
 volatile uint32_t  m_countRefEncoders;   // count of FrameEncoder 
threads monitoring m_reconRowCount
diff -r 3fa7f6838098 -r 14abf498e49b source/encoder/api.cpp
--- a/source/encoder/api.cppMon Aug 03 14:56:21 2015 -0500
+++ b/source/encoder/api.cppTue Aug 04 14:33:32 2015 +0530
@@ -281,6 +281,8 @@
 
 void x265_picture_free(x265_picture *p)
 {
+if (p-quantOffsets)
+X265_FREE(p-quantOffsets);
 return x265_free(p);
 }
 
diff -r 3fa7f6838098 -r 14abf498e49b source/encoder/encoder.cpp
--- a/source/encoder/encoder.cppMon Aug 03 14:56:21 2015 -0500
+++ b/source/encoder/encoder.cppTue Aug 04 14:33:32 2015 +0530
@@ -465,6 +465,7 @@
 inFrame-m_pts   = pic_in-pts;
 inFrame-m_forceqp   = pic_in-forceqp;
 inFrame-m_param = m_reconfigured ? m_latestParam : m_param;
+inFrame-m_quantOffsets = pic_in-quantOffsets;
 
 if (m_pocLast == 0)
 m_firstPts = inFrame-m_pts;
diff -r 3fa7f6838098 -r 14abf498e49b source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp  Mon Aug 03 14:56:21 2015 -0500
+++ b/source/encoder/slicetype.cpp  Tue Aug 04 14:33:32 2015 +0530
@@ -96,6 +96,7 @@
 int maxRow = curFrame-m_fencPic-m_picHeight;
 int blockCount = curFrame-m_lowres.maxBlocksInRow * 
curFrame-m_lowres.maxBlocksInCol;
 
+float* quantOffsets = curFrame-m_quantOffsets;
 for (int y = 0; y  3; y++)
 {
 curFrame-m_lowres.wp_ssd[y] = 0;
@@ -113,10 +114,21 @@
 
 if (param-rc.aqMode  param-rc.aqStrength == 0)
 {
-memset(curFrame-m_lowres.qpCuTreeOffset, 0, cuCount * 
sizeof(double));
-memset(curFrame-m_lowres.qpAqOffset, 0, cuCount * sizeof(double));
-for (int cuxy = 0; cuxy  cuCount; cuxy++)
-curFrame-m_lowres.invQscaleFactor[cuxy] = 256;
+if (quantOffsets)
+{
+for (int cuxy = 0; cuxy  cuCount; cuxy++)
+{
+curFrame-m_lowres.qpCuTreeOffset[cuxy] = 
curFrame-m_lowres.qpAqOffset[cuxy] = quantOffsets[cuxy];
+curFrame-m_lowres.invQscaleFactor[cuxy] = 
x265_exp2fix8(curFrame-m_lowres.qpCuTreeOffset[cuxy]);
+}
+}
+else
+{
+memset(curFrame-m_lowres.qpCuTreeOffset, 0, cuCount * 
sizeof(double));
+memset(curFrame-m_lowres.qpAqOffset, 0, cuCount * 
sizeof(double));
+for (int cuxy = 0; cuxy  cuCount; cuxy++)
+curFrame-m_lowres.invQscaleFactor[cuxy] = 256;
+}
 }
 
 /* Need variance data for weighted prediction */
@@ -177,6 +189,8 @@
 uint32_t energy = acEnergyCu(curFrame, blockX, blockY, 
param-internalCsp);
 qp_adj = strength * (X265_LOG2(X265_MAX(energy, 1)) - 
(14.427f + 2 * (X265_DEPTH - 8)));
 }
+if (quantOffsets)
+qp_adj += quantOffsets[blockXY];
 curFrame-m_lowres.qpAqOffset[blockXY] = qp_adj;
 curFrame-m_lowres.qpCuTreeOffset[blockXY] = qp_adj;
 curFrame-m_lowres.invQscaleFactor[blockXY] = 
x265_exp2fix8(qp_adj);
diff -r 3fa7f6838098 -r 14abf498e49b source/x265.h
--- a/source/x265.h Mon Aug 03 14:56:21 2015 -0500
+++ b/source/x265.h Tue Aug 04 14:33:32 2015 +0530
@@ -205,6 +205,13 @@
  * this data structure

Re: [x265] [PATCH] add API and implemenation for Region of Interest(ROI)

2015-08-04 Thread Santhoshini Sekar
Please ignore the previous mail. I'll resend the patch with few minor
corrections.

S.Santhoshini

On Tue, Aug 4, 2015 at 3:11 PM, santhosh...@multicorewareinc.com wrote:

 # HG changeset patch
 # User Santhoshini Sekarsanthosh...@multicorewareinc.com
 # Date 1438679012 -19800
 #  Tue Aug 04 14:33:32 2015 +0530
 # Node ID e0d248f6b8ab5ec1e1b4891c807086a62279c72b
 # Parent  d5278c76d341b3bac405938dbfb64cb7e2d9bce5
 add API and implemenation for Region of Interest(ROI)

 diff -r d5278c76d341 -r e0d248f6b8ab source/common/frame.h
 --- a/source/common/frame.h Mon Aug 03 10:18:46 2015 -0500
 +++ b/source/common/frame.h Tue Aug 04 14:33:32 2015 +0530
 @@ -59,6 +59,8 @@
  bool   m_lowresInit; // lowres init complete
 (pre-analysis)
  bool   m_bChromaExtended;// orig chroma planes
 motion extended for weight analysis

 +float  *quantOffsets;// points to
 quantOffsets in x265_picture
 +
  /* Frame Parallelism - notification between FrameEncoders of
 available motion reference rows */
  ThreadSafeInteger  m_reconRowCount;  // count of CTU rows
 completely reconstructed and extended for motion reference
  volatile uint32_t  m_countRefEncoders;   // count of FrameEncoder
 threads monitoring m_reconRowCount
 diff -r d5278c76d341 -r e0d248f6b8ab source/encoder/encoder.cpp
 --- a/source/encoder/encoder.cppMon Aug 03 10:18:46 2015 -0500
 +++ b/source/encoder/encoder.cppTue Aug 04 14:33:32 2015 +0530
 @@ -465,6 +465,7 @@
  inFrame-m_pts   = pic_in-pts;
  inFrame-m_forceqp   = pic_in-forceqp;
  inFrame-m_param = m_reconfigured ? m_latestParam : m_param;
 +inFrame-quantOffsets = pic_in-quantOffsets;

  if (m_pocLast == 0)
  m_firstPts = inFrame-m_pts;
 @@ -484,6 +485,9 @@
  }
  }

 +if(pic_in-quantOffsets_free)
 +pic_in-quantOffsets_free(pic_in-quantOffsets);
 +
  /* Use the frame types from the first pass, if available */
  int sliceType = (m_param-rc.bStatRead) ?
 m_rateControl-rateControlSliceType(inFrame-m_poc) : pic_in-sliceType;

 diff -r d5278c76d341 -r e0d248f6b8ab source/encoder/slicetype.cpp
 --- a/source/encoder/slicetype.cpp  Mon Aug 03 10:18:46 2015 -0500
 +++ b/source/encoder/slicetype.cpp  Tue Aug 04 14:33:32 2015 +0530
 @@ -96,6 +96,7 @@
  int maxRow = curFrame-m_fencPic-m_picHeight;
  int blockCount = curFrame-m_lowres.maxBlocksInRow *
 curFrame-m_lowres.maxBlocksInCol;

 +float* quantOffsets = curFrame-quantOffsets;
  for (int y = 0; y  3; y++)
  {
  curFrame-m_lowres.wp_ssd[y] = 0;
 @@ -113,10 +114,21 @@

  if (param-rc.aqMode  param-rc.aqStrength == 0)
  {
 -memset(curFrame-m_lowres.qpCuTreeOffset, 0, cuCount *
 sizeof(double));
 -memset(curFrame-m_lowres.qpAqOffset, 0, cuCount *
 sizeof(double));
 -for (int cuxy = 0; cuxy  cuCount; cuxy++)
 -curFrame-m_lowres.invQscaleFactor[cuxy] = 256;
 +if (quantOffsets)
 +{
 +for (int cuxy = 0; cuxy  cuCount; cuxy++)
 +{
 +curFrame-m_lowres.qpCuTreeOffset[cuxy] =
 curFrame-m_lowres.qpAqOffset[cuxy] = quantOffsets[cuxy];
 +curFrame-m_lowres.invQscaleFactor[cuxy] =
 x265_exp2fix8(curFrame-m_lowres.qpCuTreeOffset[cuxy]);
 +}
 +}
 +else
 +{
 +memset(curFrame-m_lowres.qpCuTreeOffset, 0, cuCount *
 sizeof(double));
 +memset(curFrame-m_lowres.qpAqOffset, 0, cuCount *
 sizeof(double));
 +for (int cuxy = 0; cuxy  cuCount; cuxy++)
 +curFrame-m_lowres.invQscaleFactor[cuxy] = 256;
 +}
  }

  /* Need variance data for weighted prediction */
 @@ -177,6 +189,8 @@
  uint32_t energy = acEnergyCu(curFrame, blockX,
 blockY, param-internalCsp);
  qp_adj = strength * (X265_LOG2(X265_MAX(energy, 1)) -
 (14.427f + 2 * (X265_DEPTH - 8)));
  }
 +if (quantOffsets)
 +qp_adj += quantOffsets[blockXY];
  curFrame-m_lowres.qpAqOffset[blockXY] = qp_adj;
  curFrame-m_lowres.qpCuTreeOffset[blockXY] = qp_adj;
  curFrame-m_lowres.invQscaleFactor[blockXY] =
 x265_exp2fix8(qp_adj);
 diff -r d5278c76d341 -r e0d248f6b8ab source/x265.h
 --- a/source/x265.h Mon Aug 03 10:18:46 2015 -0500
 +++ b/source/x265.h Tue Aug 04 14:33:32 2015 +0530
 @@ -205,6 +205,17 @@
   * this data structure */
  x265_analysis_data analysisData;

 +/* An array of quantizer offsets to be applied to this image during
 encoding.
 + * These are added on top of the decisions made by rateControl.
 + * Adaptive quantization must be enabled to use this feature. These
 quantizer

[x265] [PATCH] add API and implementation for Region of Interest(ROI)

2015-08-04 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekarsanthosh...@multicorewareinc.com
# Date 1438679012 -19800
#  Tue Aug 04 14:33:32 2015 +0530
# Node ID 1d61a8d12dc6bc446772817fcb90aab5b371b90e
# Parent  d5278c76d341b3bac405938dbfb64cb7e2d9bce5
add API and implementation for Region of Interest(ROI)

diff -r d5278c76d341 -r 1d61a8d12dc6 source/common/frame.h
--- a/source/common/frame.h Mon Aug 03 10:18:46 2015 -0500
+++ b/source/common/frame.h Tue Aug 04 14:33:32 2015 +0530
@@ -59,6 +59,8 @@
 bool   m_lowresInit; // lowres init complete 
(pre-analysis)
 bool   m_bChromaExtended;// orig chroma planes motion 
extended for weight analysis
 
+float* m_quantOffsets;// points to quantOffsets in 
x265_picture
+
 /* Frame Parallelism - notification between FrameEncoders of available 
motion reference rows */
 ThreadSafeInteger  m_reconRowCount;  // count of CTU rows 
completely reconstructed and extended for motion reference
 volatile uint32_t  m_countRefEncoders;   // count of FrameEncoder 
threads monitoring m_reconRowCount
diff -r d5278c76d341 -r 1d61a8d12dc6 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cppMon Aug 03 10:18:46 2015 -0500
+++ b/source/encoder/encoder.cppTue Aug 04 14:33:32 2015 +0530
@@ -465,6 +465,7 @@
 inFrame-m_pts   = pic_in-pts;
 inFrame-m_forceqp   = pic_in-forceqp;
 inFrame-m_param = m_reconfigured ? m_latestParam : m_param;
+inFrame-m_quantOffsets = pic_in-quantOffsets;
 
 if (m_pocLast == 0)
 m_firstPts = inFrame-m_pts;
@@ -484,6 +485,9 @@
 }
 }
 
+if(pic_in-quantOffsetsFree)
+pic_in-quantOffsetsFree(pic_in-quantOffsets);
+
 /* Use the frame types from the first pass, if available */
 int sliceType = (m_param-rc.bStatRead) ? 
m_rateControl-rateControlSliceType(inFrame-m_poc) : pic_in-sliceType;
 
diff -r d5278c76d341 -r 1d61a8d12dc6 source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp  Mon Aug 03 10:18:46 2015 -0500
+++ b/source/encoder/slicetype.cpp  Tue Aug 04 14:33:32 2015 +0530
@@ -96,6 +96,7 @@
 int maxRow = curFrame-m_fencPic-m_picHeight;
 int blockCount = curFrame-m_lowres.maxBlocksInRow * 
curFrame-m_lowres.maxBlocksInCol;
 
+float* quantOffsets = curFrame-m_quantOffsets;
 for (int y = 0; y  3; y++)
 {
 curFrame-m_lowres.wp_ssd[y] = 0;
@@ -113,10 +114,21 @@
 
 if (param-rc.aqMode  param-rc.aqStrength == 0)
 {
-memset(curFrame-m_lowres.qpCuTreeOffset, 0, cuCount * 
sizeof(double));
-memset(curFrame-m_lowres.qpAqOffset, 0, cuCount * sizeof(double));
-for (int cuxy = 0; cuxy  cuCount; cuxy++)
-curFrame-m_lowres.invQscaleFactor[cuxy] = 256;
+if (quantOffsets)
+{
+for (int cuxy = 0; cuxy  cuCount; cuxy++)
+{
+curFrame-m_lowres.qpCuTreeOffset[cuxy] = 
curFrame-m_lowres.qpAqOffset[cuxy] = quantOffsets[cuxy];
+curFrame-m_lowres.invQscaleFactor[cuxy] = 
x265_exp2fix8(curFrame-m_lowres.qpCuTreeOffset[cuxy]);
+}
+}
+else
+{
+memset(curFrame-m_lowres.qpCuTreeOffset, 0, cuCount * 
sizeof(double));
+memset(curFrame-m_lowres.qpAqOffset, 0, cuCount * 
sizeof(double));
+for (int cuxy = 0; cuxy  cuCount; cuxy++)
+curFrame-m_lowres.invQscaleFactor[cuxy] = 256;
+}
 }
 
 /* Need variance data for weighted prediction */
@@ -177,6 +189,8 @@
 uint32_t energy = acEnergyCu(curFrame, blockX, blockY, 
param-internalCsp);
 qp_adj = strength * (X265_LOG2(X265_MAX(energy, 1)) - 
(14.427f + 2 * (X265_DEPTH - 8)));
 }
+if (quantOffsets)
+qp_adj += quantOffsets[blockXY];
 curFrame-m_lowres.qpAqOffset[blockXY] = qp_adj;
 curFrame-m_lowres.qpCuTreeOffset[blockXY] = qp_adj;
 curFrame-m_lowres.invQscaleFactor[blockXY] = 
x265_exp2fix8(qp_adj);
diff -r d5278c76d341 -r 1d61a8d12dc6 source/x265.h
--- a/source/x265.h Mon Aug 03 10:18:46 2015 -0500
+++ b/source/x265.h Tue Aug 04 14:33:32 2015 +0530
@@ -205,6 +205,17 @@
  * this data structure */
 x265_analysis_data analysisData;
 
+/* An array of quantizer offsets to be applied to this image during 
encoding.
+ * These are added on top of the decisions made by rateControl.
+ * Adaptive quantization must be enabled to use this feature. These 
quantizer 
+ * offsets should be given for each 16x16 block. Behavior if quant
+ * offsets differ between encoding passes is undefined. */
+float*quantOffsets;
+
+/* optional callback to free quant_offsets when used.
+ * Useful if one

[x265] [PATCH] add API and implemenation for Region of Interest(ROI)

2015-08-04 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekarsanthosh...@multicorewareinc.com
# Date 1438679012 -19800
#  Tue Aug 04 14:33:32 2015 +0530
# Node ID e0d248f6b8ab5ec1e1b4891c807086a62279c72b
# Parent  d5278c76d341b3bac405938dbfb64cb7e2d9bce5
add API and implemenation for Region of Interest(ROI)

diff -r d5278c76d341 -r e0d248f6b8ab source/common/frame.h
--- a/source/common/frame.h Mon Aug 03 10:18:46 2015 -0500
+++ b/source/common/frame.h Tue Aug 04 14:33:32 2015 +0530
@@ -59,6 +59,8 @@
 bool   m_lowresInit; // lowres init complete 
(pre-analysis)
 bool   m_bChromaExtended;// orig chroma planes motion 
extended for weight analysis
 
+float  *quantOffsets;// points to quantOffsets in 
x265_picture
+
 /* Frame Parallelism - notification between FrameEncoders of available 
motion reference rows */
 ThreadSafeInteger  m_reconRowCount;  // count of CTU rows 
completely reconstructed and extended for motion reference
 volatile uint32_t  m_countRefEncoders;   // count of FrameEncoder 
threads monitoring m_reconRowCount
diff -r d5278c76d341 -r e0d248f6b8ab source/encoder/encoder.cpp
--- a/source/encoder/encoder.cppMon Aug 03 10:18:46 2015 -0500
+++ b/source/encoder/encoder.cppTue Aug 04 14:33:32 2015 +0530
@@ -465,6 +465,7 @@
 inFrame-m_pts   = pic_in-pts;
 inFrame-m_forceqp   = pic_in-forceqp;
 inFrame-m_param = m_reconfigured ? m_latestParam : m_param;
+inFrame-quantOffsets = pic_in-quantOffsets;
 
 if (m_pocLast == 0)
 m_firstPts = inFrame-m_pts;
@@ -484,6 +485,9 @@
 }
 }
 
+if(pic_in-quantOffsets_free)
+pic_in-quantOffsets_free(pic_in-quantOffsets);
+
 /* Use the frame types from the first pass, if available */
 int sliceType = (m_param-rc.bStatRead) ? 
m_rateControl-rateControlSliceType(inFrame-m_poc) : pic_in-sliceType;
 
diff -r d5278c76d341 -r e0d248f6b8ab source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp  Mon Aug 03 10:18:46 2015 -0500
+++ b/source/encoder/slicetype.cpp  Tue Aug 04 14:33:32 2015 +0530
@@ -96,6 +96,7 @@
 int maxRow = curFrame-m_fencPic-m_picHeight;
 int blockCount = curFrame-m_lowres.maxBlocksInRow * 
curFrame-m_lowres.maxBlocksInCol;
 
+float* quantOffsets = curFrame-quantOffsets;
 for (int y = 0; y  3; y++)
 {
 curFrame-m_lowres.wp_ssd[y] = 0;
@@ -113,10 +114,21 @@
 
 if (param-rc.aqMode  param-rc.aqStrength == 0)
 {
-memset(curFrame-m_lowres.qpCuTreeOffset, 0, cuCount * 
sizeof(double));
-memset(curFrame-m_lowres.qpAqOffset, 0, cuCount * sizeof(double));
-for (int cuxy = 0; cuxy  cuCount; cuxy++)
-curFrame-m_lowres.invQscaleFactor[cuxy] = 256;
+if (quantOffsets)
+{
+for (int cuxy = 0; cuxy  cuCount; cuxy++)
+{
+curFrame-m_lowres.qpCuTreeOffset[cuxy] = 
curFrame-m_lowres.qpAqOffset[cuxy] = quantOffsets[cuxy];
+curFrame-m_lowres.invQscaleFactor[cuxy] = 
x265_exp2fix8(curFrame-m_lowres.qpCuTreeOffset[cuxy]);
+}
+}
+else
+{
+memset(curFrame-m_lowres.qpCuTreeOffset, 0, cuCount * 
sizeof(double));
+memset(curFrame-m_lowres.qpAqOffset, 0, cuCount * 
sizeof(double));
+for (int cuxy = 0; cuxy  cuCount; cuxy++)
+curFrame-m_lowres.invQscaleFactor[cuxy] = 256;
+}
 }
 
 /* Need variance data for weighted prediction */
@@ -177,6 +189,8 @@
 uint32_t energy = acEnergyCu(curFrame, blockX, blockY, 
param-internalCsp);
 qp_adj = strength * (X265_LOG2(X265_MAX(energy, 1)) - 
(14.427f + 2 * (X265_DEPTH - 8)));
 }
+if (quantOffsets)
+qp_adj += quantOffsets[blockXY];
 curFrame-m_lowres.qpAqOffset[blockXY] = qp_adj;
 curFrame-m_lowres.qpCuTreeOffset[blockXY] = qp_adj;
 curFrame-m_lowres.invQscaleFactor[blockXY] = 
x265_exp2fix8(qp_adj);
diff -r d5278c76d341 -r e0d248f6b8ab source/x265.h
--- a/source/x265.h Mon Aug 03 10:18:46 2015 -0500
+++ b/source/x265.h Tue Aug 04 14:33:32 2015 +0530
@@ -205,6 +205,17 @@
  * this data structure */
 x265_analysis_data analysisData;
 
+/* An array of quantizer offsets to be applied to this image during 
encoding.
+ * These are added on top of the decisions made by rateControl.
+ * Adaptive quantization must be enabled to use this feature. These 
quantizer 
+ * offsets should be given for each 16x16 block. Behavior if quant
+ * offsets differ between encoding passes is undefined. */
+float*quantOffsets;
+
+/* optional callback to free quant_offsets when used.
+ * Useful if one wants

[x265] [PATCH] aq: new auto variance mode with biasing to dark scenes

2015-06-17 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekarsanthosh...@multicorewareinc.com
# Date 1434522753 -19800
#  Wed Jun 17 12:02:33 2015 +0530
# Node ID fb4eecc53e5789094d5a12999c7c2d8e56060b1e
# Parent  be0ed447922cc81e809d296e75424bb71822aea7
aq: new auto variance mode with biasing to dark scenes

diff -r be0ed447922c -r fb4eecc53e57 doc/reST/cli.rst
--- a/doc/reST/cli.rst  Tue Jun 16 11:15:03 2015 +0530
+++ b/doc/reST/cli.rst  Wed Jun 17 12:02:33 2015 +0530
@@ -1179,7 +1179,7 @@
ignored. Slower presets will generally achieve better compression
efficiency (and generate smaller bitstreams). Default disabled.
 
-.. option:: --aq-mode 0|1|2
+.. option:: --aq-mode 0|1|2|3
 
Adaptive Quantization operating mode. Raise or lower per-block
quantization based on complexity analysis of the source image. The
@@ -1190,6 +1190,7 @@
0. disabled
1. AQ enabled **(default)**
2. AQ enabled with auto-variance
+   3. AQ enabled with auto-variance and bias to dark scenes
 
 .. option:: --aq-strength float
 
diff -r be0ed447922c -r fb4eecc53e57 source/CMakeLists.txt
--- a/source/CMakeLists.txt Tue Jun 16 11:15:03 2015 +0530
+++ b/source/CMakeLists.txt Wed Jun 17 12:02:33 2015 +0530
@@ -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 63)
+set(X265_BUILD 64)
 configure_file(${PROJECT_SOURCE_DIR}/x265.def.in
${PROJECT_BINARY_DIR}/x265.def)
 configure_file(${PROJECT_SOURCE_DIR}/x265_config.h.in
diff -r be0ed447922c -r fb4eecc53e57 source/common/param.cpp
--- a/source/common/param.cpp   Tue Jun 16 11:15:03 2015 +0530
+++ b/source/common/param.cpp   Wed Jun 17 12:02:33 2015 +0530
@@ -1092,7 +1092,7 @@
   Lookahead depth must be less than 256);
 CHECK(param-lookaheadSlices  16 || param-lookaheadSlices  0,
   Lookahead slices must between 0 and 16);
-CHECK(param-rc.aqMode  X265_AQ_NONE || X265_AQ_AUTO_VARIANCE  
param-rc.aqMode,
+CHECK(param-rc.aqMode  X265_AQ_NONE || X265_AQ_AUTO_VARIANCE_BIASED  
param-rc.aqMode,
   Aq-Mode is out of range);
 CHECK(param-rc.aqStrength  0 || param-rc.aqStrength  3,
   Aq-Strength is out of range);
diff -r be0ed447922c -r fb4eecc53e57 source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp  Tue Jun 16 11:15:03 2015 +0530
+++ b/source/encoder/slicetype.cpp  Wed Jun 17 12:02:33 2015 +0530
@@ -131,15 +131,16 @@
 {
 blockXY = 0;
 double avg_adj_pow2 = 0, avg_adj = 0, qp_adj = 0;
-if (param-rc.aqMode == X265_AQ_AUTO_VARIANCE)
+double bias_strength = 0.f;
+if (param-rc.aqMode == X265_AQ_AUTO_VARIANCE || param-rc.aqMode == 
X265_AQ_AUTO_VARIANCE_BIASED)
 {
-double bit_depth_correction = pow(1  (X265_DEPTH - 8), 0.5);
+double bit_depth_correction = 1.f / (1  (2*(X265_DEPTH-8)));
 for (blockY = 0; blockY  maxRow; blockY += 16)
 {
 for (blockX = 0; blockX  maxCol; blockX += 16)
 {
 uint32_t energy = acEnergyCu(curFrame, blockX, blockY, 
param-internalCsp);
-qp_adj = pow(energy + 1, 0.1);
+qp_adj = pow(energy * bit_depth_correction + 1, 0.1);
 curFrame-m_lowres.qpCuTreeOffset[blockXY] = qp_adj;
 avg_adj += qp_adj;
 avg_adj_pow2 += qp_adj * qp_adj;
@@ -149,8 +150,9 @@
 
 avg_adj /= blockCount;
 avg_adj_pow2 /= blockCount;
-strength = param-rc.aqStrength * avg_adj / bit_depth_correction;
-avg_adj = avg_adj - 0.5f * (avg_adj_pow2 - (11.f * 
bit_depth_correction)) / avg_adj;
+strength = param-rc.aqStrength * avg_adj;
+avg_adj = avg_adj - 0.5f * (avg_adj_pow2 - (11.f)) / avg_adj;
+bias_strength = param-rc.aqStrength;
 }
 else
 strength = param-rc.aqStrength * 1.0397f;
@@ -160,7 +162,12 @@
 {
 for (blockX = 0; blockX  maxCol; blockX += 16)
 {
-if (param-rc.aqMode == X265_AQ_AUTO_VARIANCE)
+if(param-rc.aqMode == X265_AQ_AUTO_VARIANCE_BIASED)
+{
+qp_adj = curFrame-m_lowres.qpCuTreeOffset[blockXY];
+qp_adj = strength * (qp_adj - avg_adj) + bias_strength * 
(1.f - 11.f / (qp_adj * qp_adj));
+}
+else if (param-rc.aqMode == X265_AQ_AUTO_VARIANCE)
 {
 qp_adj = curFrame-m_lowres.qpCuTreeOffset[blockXY];
 qp_adj = strength * (qp_adj - avg_adj);
diff -r be0ed447922c -r fb4eecc53e57 source/x265.h
--- a/source/x265.h Tue Jun 16 11:15:03 2015 +0530
+++ b/source/x265.h Wed Jun 17 12:02:33 2015 +0530
@@ -278,6 +278,7 @@
 #define X265_AQ_NONE 0
 #define X265_AQ_VARIANCE 1

Re: [x265] [PATCH] analysis: add an additional round of sub-pel refinement for inter 2Nx2N in rd 5 and 6

2015-05-20 Thread Santhoshini Sekar
On Tue, May 19, 2015 at 9:35 PM, Steve Borho st...@borho.org wrote:

 On 05/19, santhosh...@multicorewareinc.com wrote:
  # HG changeset patch
  # User Santhoshini Sekarsanthosh...@multicorewareinc.com
  # Date 1432028003 -19800
  #  Tue May 19 15:03:23 2015 +0530
  # Node ID 904ac8808858baaeaaa333b5a105af50c1107db0
  # Parent  d7b100e51e828833eee006f1da93e499ac161d28
  analysis: add an additional round of sub-pel refinement for inter 2Nx2N
 in rd 5 and 6
 
  diff -r d7b100e51e82 -r 904ac8808858 source/common/cudata.cpp
  --- a/source/common/cudata.cppMon May 18 18:24:08 2015 -0500
  +++ b/source/common/cudata.cppTue May 19 15:03:23 2015 +0530
  @@ -456,6 +456,41 @@
   memcpy(ctu.m_trCoeff[2] + tmpC2, m_trCoeff[2], sizeof(coeff_t) *
 tmpC);
   }
 
  +void CUData::copyToCU(CUData ctu) const
  +{
  +m_partCopy((uint8_t*)ctu.m_qp, (uint8_t*)m_qp);
  +m_partCopy(ctu.m_log2CUSize, m_log2CUSize);
  +m_partCopy(ctu.m_lumaIntraDir, m_lumaIntraDir);
  +m_partCopy(ctu.m_tqBypass, m_tqBypass);
  +m_partCopy((uint8_t*)ctu.m_refIdx[0], (uint8_t*)m_refIdx[0]);
  +m_partCopy((uint8_t*)ctu.m_refIdx[1], (uint8_t*)m_refIdx[1]);
  +m_partCopy(ctu.m_cuDepth, m_cuDepth);
  +m_partCopy(ctu.m_predMode, m_predMode);
  +m_partCopy(ctu.m_partSize, m_partSize);
  +m_partCopy(ctu.m_mergeFlag, m_mergeFlag);
  +m_partCopy(ctu.m_interDir, m_interDir);
  +m_partCopy(ctu.m_mvpIdx[0], m_mvpIdx[0]);
  +m_partCopy(ctu.m_mvpIdx[1], m_mvpIdx[1]);
  +m_partCopy(ctu.m_tuDepth, m_tuDepth);
  +m_partCopy(ctu.m_transformSkip[0], m_transformSkip[0]);
  +m_partCopy(ctu.m_transformSkip[1], m_transformSkip[1]);
  +m_partCopy(ctu.m_transformSkip[2], m_transformSkip[2]);
  +m_partCopy(ctu.m_cbf[0], m_cbf[0]);
  +m_partCopy(ctu.m_cbf[1], m_cbf[1]);
  +m_partCopy(ctu.m_cbf[2], m_cbf[2]);
  +m_partCopy(ctu.m_chromaIntraDir, m_chromaIntraDir);
  +
  +memcpy(ctu.m_mv[0],  m_mv[0],  m_numPartitions * sizeof(MV));
  +memcpy(ctu.m_mv[1],  m_mv[1],  m_numPartitions * sizeof(MV));
  +memcpy(ctu.m_mvd[0], m_mvd[0], m_numPartitions * sizeof(MV));
  +memcpy(ctu.m_mvd[1], m_mvd[1], m_numPartitions * sizeof(MV));
  +
  +memcpy(ctu.m_trCoeff[0], m_trCoeff[0], sizeof(coeff_t));
  +
  +memcpy(ctu.m_trCoeff[1], m_trCoeff[1], sizeof(coeff_t));
  +memcpy(ctu.m_trCoeff[2], m_trCoeff[2], sizeof(coeff_t));
 w/s nit, remove the blank line above
  +}
  +
   /* The reverse of copyToPic, called only by encodeResidue */
   void CUData::copyFromPic(const CUData ctu, const CUGeom cuGeom)
   {
  diff -r d7b100e51e82 -r 904ac8808858 source/common/cudata.h
  --- a/source/common/cudata.h  Mon May 18 18:24:08 2015 -0500
  +++ b/source/common/cudata.h  Tue May 19 15:03:23 2015 +0530
  @@ -188,6 +188,7 @@
   void copyPartFrom(const CUData cu, const CUGeom childGeom,
 uint32_t subPartIdx);
   void setEmptyPart(const CUGeom childGeom, uint32_t subPartIdx);
   void copyToPic(uint32_t depth) const;
  +void copyToCU(CUData ctu) const;
 
   /* RD-0 methods called only from encodeResidue */
   void copyFromPic(const CUData ctu, const CUGeom cuGeom);
  diff -r d7b100e51e82 -r 904ac8808858 source/encoder/analysis.cpp
  --- a/source/encoder/analysis.cpp Mon May 18 18:24:08 2015 -0500
  +++ b/source/encoder/analysis.cpp Tue May 19 15:03:23 2015 +0530
  @@ -739,7 +739,31 @@
   cuStat.count[depth] += 1;
   cuStat.avgCost[depth] = (temp + md.bestMode-rdCost) /
 cuStat.count[depth];
   }
  +/* If zero-residual, do not bother doing subpelRefine */
  +bool subpelRefine = !!(md.bestMode-cu.m_predMode[0]  MODE_INTER)
  !(md.bestMode-cu.m_mergeFlag[0])  (md.bestMode-cu.m_partSize[0] ==
 SIZE_2Nx2N)  (md.bestMode-cu.m_cuDepth[0] == depth);
  +if (subpelRefine  m_param-rdLevel  4)
  +{
  +int hpelDirs =
 MotionEstimate::hpelDirCount(m_param-subpelRefine);
 
  +Mode* rdRefine = md.pred[PRED_RD_REFINE];
  +rdRefine-initCosts();
  +rdRefine-cu.initSubCU(parentCTU, cuGeom, qp);
  +memcpy(rdRefine-bestME[0], md.bestMode-bestME[0],
 sizeof(MotionData));
  +if (m_slice-m_sliceType == B_SLICE)
  +memcpy(rdRefine-bestME[0][1], md.bestMode-bestME[0][1],
 sizeof(MotionData));

 using copyToCU() here means cu.initSubCU() was probably a waste of time

  +md.bestMode-cu.copyToCU(rdRefine-cu);
  +rdRefine-reconYuv.copyFromYuv(md.bestMode-reconYuv);
  +rdRefine-predYuv.copyFromYuv(md.bestMode-predYuv);
  +
  +for (int i = 1; i = hpelDirs; i++)
  +{
  +qPelRefine(*rdRefine, cuGeom, true, i);
  +if (m_slice-m_pps-bUseDQP  depth =
 m_slice-m_pps-maxCuDQPDepth)
  +setLambdaFromQP(parentCTU,
 calculateQpforCuSize(parentCTU, cuGeom));

 why is this necessary here? calculateQpforCuSize(parentCTU, cuGeom))
 better return the same 'qp' value in bestMode-cu else you are in a lot

[x265] [PATCH] analysis: add an additional round of sub-pel refinement for inter 2Nx2N in rd 5 and 6

2015-05-20 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekarsanthosh...@multicorewareinc.com
# Date 1432182660 -19800
#  Thu May 21 10:01:00 2015 +0530
# Node ID 630b378b744f4bf442839680f5120d7d299d2acd
# Parent  dc4fcfc574ade14ecc841797ad08be9753fad58e
analysis: add an additional round of sub-pel refinement for inter 2Nx2N in rd 5 
and 6

diff -r dc4fcfc574ad -r 630b378b744f source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp   Wed May 20 12:17:44 2015 -0500
+++ b/source/encoder/analysis.cpp   Thu May 21 10:01:00 2015 +0530
@@ -742,6 +742,24 @@
 cuStat.avgCost[depth] = (temp + md.bestMode-rdCost) / 
cuStat.count[depth];
 }
 
+/* If zero-residual, do not bother doing subpelRefine */
+bool subpelRefine = !!(md.bestMode-cu.m_predMode[0]  MODE_INTER)  
!(md.bestMode-cu.m_mergeFlag[0])  (md.bestMode-cu.m_partSize[0] == 
SIZE_2Nx2N)  (md.bestMode-cu.m_cuDepth[0] == depth);
+if (subpelRefine  m_param-rdLevel  4)
+{
+int hpelDirs = MotionEstimate::hpelDirCount(m_param-subpelRefine);
+if (m_slice-m_pps-bUseDQP  depth = m_slice-m_pps-maxCuDQPDepth)
+setLambdaFromQP(parentCTU, calculateQpforCuSize(parentCTU, 
cuGeom));
+uint64_t bcost = md.bestMode-rdCost;
+int bdir = 0;
+for (int i = 1; i = hpelDirs; i++)
+{
+qPelRefine(*md.bestMode, cuGeom, true, i);
+encodeResAndCalcRdInterCU(*md.bestMode, cuGeom);
+COPY2_IF_LT(bcost, md.bestMode-rdCost, bdir, i);
+}
+qPelRefine(*md.bestMode, cuGeom, true, bdir);
+encodeResAndCalcRdInterCU(*md.bestMode, cuGeom);
+}
 /* Copy best data to encData CTU and recon */
 md.bestMode-cu.copyToPic(depth);
 if (md.bestMode != md.pred[PRED_SPLIT])
@@ -1312,6 +1330,24 @@
 checkBestMode(*splitPred, depth);
 }
 
+/* If zero-residual, do not bother doing subpelRefine */
+bool subpelRefine = !!(md.bestMode-cu.m_predMode[0]  MODE_INTER)  
!(md.bestMode-cu.m_mergeFlag[0])  (md.bestMode-cu.m_partSize[0] == 
SIZE_2Nx2N)  (md.bestMode-cu.m_cuDepth[0] == depth);
+if (subpelRefine)
+{
+int hpelDirs = MotionEstimate::hpelDirCount(m_param-subpelRefine);
+uint64_t bcost = md.bestMode-rdCost;
+int bdir = 0;
+if (m_slice-m_pps-bUseDQP  depth = m_slice-m_pps-maxCuDQPDepth)
+setLambdaFromQP(parentCTU, calculateQpforCuSize(parentCTU, 
cuGeom));
+for (int i = 1; i = hpelDirs; i++)
+{
+qPelRefine(*md.bestMode, cuGeom, true, i);
+encodeResAndCalcRdInterCU(*md.bestMode, cuGeom);
+COPY2_IF_LT(bcost, md.bestMode-rdCost, bdir, i);
+}
+qPelRefine(*md.bestMode, cuGeom, true, bdir);
+encodeResAndCalcRdInterCU(*md.bestMode, cuGeom);
+}
 /* Copy best data to encData CTU and recon */
 md.bestMode-cu.copyToPic(depth);
 if (md.bestMode != md.pred[PRED_SPLIT])
diff -r dc4fcfc574ad -r 630b378b744f source/encoder/motion.cpp
--- a/source/encoder/motion.cpp Wed May 20 12:17:44 2015 -0500
+++ b/source/encoder/motion.cpp Thu May 21 10:01:00 2015 +0530
@@ -155,6 +155,11 @@
workload[subme].qpel_iters / 2;
 }
 
+int MotionEstimate::hpelDirCount(int subme)
+{
+return workload[subme].hpel_dirs;
+}
+
 MotionEstimate::~MotionEstimate()
 {
 fencPUYuv.destroy();
@@ -1205,6 +1210,49 @@
 return bcost;
 }
 
+int MotionEstimate::qPelCompare(ReferencePlanes *ref,
+   const MVmvmin,
+   const MVmvmax,
+   const MVmvp,
+   const MVmv,
+   MV  outQMv,
+   int halfPelIdx)
+{
+setMVP(mvp);
+
+MV qmvmin = mvmin.toQPel();
+MV qmvmax = mvmax.toQPel();
+
+MV fmv = mv.roundToFPel();
+fmv = fmv.clipped(qmvmin, qmvmax);
+int bcost = INT_MAX;
+const SubpelWorkload wl = workload[this-subpelRefine];
+
+MV hmv = fmv + square1[halfPelIdx] * 2;
+bcost = subpelCompare(ref, hmv, satd) + mvcost(hmv);
+MV bmv = hmv;
+
+for (int iter = 0; iter  wl.qpel_iters; iter++)
+{
+int bdir = 0;
+for (int i = 1; i = wl.qpel_dirs; i++)
+{
+MV qmv = hmv + square1[i];
+int cost = subpelCompare(ref, qmv, satd) + mvcost(qmv);
+COPY2_IF_LT(bcost, cost, bdir, i);
+}
+
+if (bdir)
+bmv += square1[bdir];
+else
+break;
+}
+
+x265_emms();
+outQMv = bmv;
+return bcost;
+}
+
 int MotionEstimate::subpelCompare(ReferencePlanes *ref, const MV qmv, 
pixelcmp_t cmp)
 {
 intptr_t refStride = ref-lumaStride;
diff -r dc4fcfc574ad -r 630b378b744f source/encoder/motion.h
--- a/source/encoder/motion.h   Wed May 20 12:17:44 2015 -0500
+++ b/source/encoder/motion.h   Thu May 21 10:01:00 2015 +0530
@@ -69,6 +69,7 @@
 
 static void initScales

Re: [x265] [PATCH] analysis: add an additional round of sub-pel refinement for inter 2Nx2N in rd 5 and 6

2015-05-20 Thread Santhoshini Sekar
On Wed, May 20, 2015 at 9:21 PM, Steve Borho st...@borho.org wrote:

 On 05/20, Santhoshini Sekar wrote:
  On Tue, May 19, 2015 at 9:35 PM, Steve Borho st...@borho.org wrote:
 
   On 05/19, santhosh...@multicorewareinc.com wrote:
# HG changeset patch
# User Santhoshini Sekarsanthosh...@multicorewareinc.com
# Date 1432028003 -19800
#  Tue May 19 15:03:23 2015 +0530
# Node ID 904ac8808858baaeaaa333b5a105af50c1107db0
# Parent  d7b100e51e828833eee006f1da93e499ac161d28
analysis: add an additional round of sub-pel refinement for inter
 2Nx2N
   in rd 5 and 6
   
diff -r d7b100e51e82 -r 904ac8808858 source/common/cudata.cpp
--- a/source/common/cudata.cppMon May 18 18:24:08 2015 -0500
+++ b/source/common/cudata.cppTue May 19 15:03:23 2015 +0530
@@ -456,6 +456,41 @@
 memcpy(ctu.m_trCoeff[2] + tmpC2, m_trCoeff[2], sizeof(coeff_t) *
   tmpC);
 }
   
+void CUData::copyToCU(CUData ctu) const
+{
+m_partCopy((uint8_t*)ctu.m_qp, (uint8_t*)m_qp);
+m_partCopy(ctu.m_log2CUSize, m_log2CUSize);
+m_partCopy(ctu.m_lumaIntraDir, m_lumaIntraDir);
+m_partCopy(ctu.m_tqBypass, m_tqBypass);
+m_partCopy((uint8_t*)ctu.m_refIdx[0], (uint8_t*)m_refIdx[0]);
+m_partCopy((uint8_t*)ctu.m_refIdx[1], (uint8_t*)m_refIdx[1]);
+m_partCopy(ctu.m_cuDepth, m_cuDepth);
+m_partCopy(ctu.m_predMode, m_predMode);
+m_partCopy(ctu.m_partSize, m_partSize);
+m_partCopy(ctu.m_mergeFlag, m_mergeFlag);
+m_partCopy(ctu.m_interDir, m_interDir);
+m_partCopy(ctu.m_mvpIdx[0], m_mvpIdx[0]);
+m_partCopy(ctu.m_mvpIdx[1], m_mvpIdx[1]);
+m_partCopy(ctu.m_tuDepth, m_tuDepth);
+m_partCopy(ctu.m_transformSkip[0], m_transformSkip[0]);
+m_partCopy(ctu.m_transformSkip[1], m_transformSkip[1]);
+m_partCopy(ctu.m_transformSkip[2], m_transformSkip[2]);
+m_partCopy(ctu.m_cbf[0], m_cbf[0]);
+m_partCopy(ctu.m_cbf[1], m_cbf[1]);
+m_partCopy(ctu.m_cbf[2], m_cbf[2]);
+m_partCopy(ctu.m_chromaIntraDir, m_chromaIntraDir);
+
+memcpy(ctu.m_mv[0],  m_mv[0],  m_numPartitions * sizeof(MV));
+memcpy(ctu.m_mv[1],  m_mv[1],  m_numPartitions * sizeof(MV));
+memcpy(ctu.m_mvd[0], m_mvd[0], m_numPartitions * sizeof(MV));
+memcpy(ctu.m_mvd[1], m_mvd[1], m_numPartitions * sizeof(MV));
+
+memcpy(ctu.m_trCoeff[0], m_trCoeff[0], sizeof(coeff_t));
+
+memcpy(ctu.m_trCoeff[1], m_trCoeff[1], sizeof(coeff_t));
+memcpy(ctu.m_trCoeff[2], m_trCoeff[2], sizeof(coeff_t));
   w/s nit, remove the blank line above
+}
+
 /* The reverse of copyToPic, called only by encodeResidue */
 void CUData::copyFromPic(const CUData ctu, const CUGeom cuGeom)
 {
diff -r d7b100e51e82 -r 904ac8808858 source/common/cudata.h
--- a/source/common/cudata.h  Mon May 18 18:24:08 2015 -0500
+++ b/source/common/cudata.h  Tue May 19 15:03:23 2015 +0530
@@ -188,6 +188,7 @@
 void copyPartFrom(const CUData cu, const CUGeom childGeom,
   uint32_t subPartIdx);
 void setEmptyPart(const CUGeom childGeom, uint32_t
 subPartIdx);
 void copyToPic(uint32_t depth) const;
+void copyToCU(CUData ctu) const;
   
 /* RD-0 methods called only from encodeResidue */
 void copyFromPic(const CUData ctu, const CUGeom cuGeom);
diff -r d7b100e51e82 -r 904ac8808858 source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp Mon May 18 18:24:08 2015 -0500
+++ b/source/encoder/analysis.cpp Tue May 19 15:03:23 2015 +0530
@@ -739,7 +739,31 @@
 cuStat.count[depth] += 1;
 cuStat.avgCost[depth] = (temp + md.bestMode-rdCost) /
   cuStat.count[depth];
 }
+/* If zero-residual, do not bother doing subpelRefine */
+bool subpelRefine = !!(md.bestMode-cu.m_predMode[0] 
 MODE_INTER)
!(md.bestMode-cu.m_mergeFlag[0])  (md.bestMode-cu.m_partSize[0]
 ==
   SIZE_2Nx2N)  (md.bestMode-cu.m_cuDepth[0] == depth);
+if (subpelRefine  m_param-rdLevel  4)
+{
+int hpelDirs =
   MotionEstimate::hpelDirCount(m_param-subpelRefine);
   
+Mode* rdRefine = md.pred[PRED_RD_REFINE];
+rdRefine-initCosts();
+rdRefine-cu.initSubCU(parentCTU, cuGeom, qp);
+memcpy(rdRefine-bestME[0], md.bestMode-bestME[0],
   sizeof(MotionData));
+if (m_slice-m_sliceType == B_SLICE)
+memcpy(rdRefine-bestME[0][1],
 md.bestMode-bestME[0][1],
   sizeof(MotionData));
  
   using copyToCU() here means cu.initSubCU() was probably a waste of time
  
+md.bestMode-cu.copyToCU(rdRefine-cu);
+rdRefine-reconYuv.copyFromYuv(md.bestMode-reconYuv);
+rdRefine-predYuv.copyFromYuv(md.bestMode-predYuv);
+
+for (int i = 1; i = hpelDirs; i++)
+{
+qPelRefine(*rdRefine, cuGeom

[x265] [PATCH] analysis: add an additional round of sub-pel refinement for inter 2Nx2N in rd 5 and 6

2015-05-19 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekarsanthosh...@multicorewareinc.com
# Date 1432028003 -19800
#  Tue May 19 15:03:23 2015 +0530
# Node ID 904ac8808858baaeaaa333b5a105af50c1107db0
# Parent  d7b100e51e828833eee006f1da93e499ac161d28
analysis: add an additional round of sub-pel refinement for inter 2Nx2N in rd 5 
and 6

diff -r d7b100e51e82 -r 904ac8808858 source/common/cudata.cpp
--- a/source/common/cudata.cpp  Mon May 18 18:24:08 2015 -0500
+++ b/source/common/cudata.cpp  Tue May 19 15:03:23 2015 +0530
@@ -456,6 +456,41 @@
 memcpy(ctu.m_trCoeff[2] + tmpC2, m_trCoeff[2], sizeof(coeff_t) * tmpC);
 }
 
+void CUData::copyToCU(CUData ctu) const
+{
+m_partCopy((uint8_t*)ctu.m_qp, (uint8_t*)m_qp);
+m_partCopy(ctu.m_log2CUSize, m_log2CUSize);
+m_partCopy(ctu.m_lumaIntraDir, m_lumaIntraDir);
+m_partCopy(ctu.m_tqBypass, m_tqBypass);
+m_partCopy((uint8_t*)ctu.m_refIdx[0], (uint8_t*)m_refIdx[0]);
+m_partCopy((uint8_t*)ctu.m_refIdx[1], (uint8_t*)m_refIdx[1]);
+m_partCopy(ctu.m_cuDepth, m_cuDepth);
+m_partCopy(ctu.m_predMode, m_predMode);
+m_partCopy(ctu.m_partSize, m_partSize);
+m_partCopy(ctu.m_mergeFlag, m_mergeFlag);
+m_partCopy(ctu.m_interDir, m_interDir);
+m_partCopy(ctu.m_mvpIdx[0], m_mvpIdx[0]);
+m_partCopy(ctu.m_mvpIdx[1], m_mvpIdx[1]);
+m_partCopy(ctu.m_tuDepth, m_tuDepth);
+m_partCopy(ctu.m_transformSkip[0], m_transformSkip[0]);
+m_partCopy(ctu.m_transformSkip[1], m_transformSkip[1]);
+m_partCopy(ctu.m_transformSkip[2], m_transformSkip[2]);
+m_partCopy(ctu.m_cbf[0], m_cbf[0]);
+m_partCopy(ctu.m_cbf[1], m_cbf[1]);
+m_partCopy(ctu.m_cbf[2], m_cbf[2]);
+m_partCopy(ctu.m_chromaIntraDir, m_chromaIntraDir);
+
+memcpy(ctu.m_mv[0],  m_mv[0],  m_numPartitions * sizeof(MV));
+memcpy(ctu.m_mv[1],  m_mv[1],  m_numPartitions * sizeof(MV));
+memcpy(ctu.m_mvd[0], m_mvd[0], m_numPartitions * sizeof(MV));
+memcpy(ctu.m_mvd[1], m_mvd[1], m_numPartitions * sizeof(MV));
+
+memcpy(ctu.m_trCoeff[0], m_trCoeff[0], sizeof(coeff_t));
+
+memcpy(ctu.m_trCoeff[1], m_trCoeff[1], sizeof(coeff_t));
+memcpy(ctu.m_trCoeff[2], m_trCoeff[2], sizeof(coeff_t));
+}
+
 /* The reverse of copyToPic, called only by encodeResidue */
 void CUData::copyFromPic(const CUData ctu, const CUGeom cuGeom)
 {
diff -r d7b100e51e82 -r 904ac8808858 source/common/cudata.h
--- a/source/common/cudata.hMon May 18 18:24:08 2015 -0500
+++ b/source/common/cudata.hTue May 19 15:03:23 2015 +0530
@@ -188,6 +188,7 @@
 void copyPartFrom(const CUData cu, const CUGeom childGeom, uint32_t 
subPartIdx);
 void setEmptyPart(const CUGeom childGeom, uint32_t subPartIdx);
 void copyToPic(uint32_t depth) const;
+void copyToCU(CUData ctu) const;
 
 /* RD-0 methods called only from encodeResidue */
 void copyFromPic(const CUData ctu, const CUGeom cuGeom);
diff -r d7b100e51e82 -r 904ac8808858 source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp   Mon May 18 18:24:08 2015 -0500
+++ b/source/encoder/analysis.cpp   Tue May 19 15:03:23 2015 +0530
@@ -739,7 +739,31 @@
 cuStat.count[depth] += 1;
 cuStat.avgCost[depth] = (temp + md.bestMode-rdCost) / 
cuStat.count[depth];
 }
+/* If zero-residual, do not bother doing subpelRefine */
+bool subpelRefine = !!(md.bestMode-cu.m_predMode[0]  MODE_INTER)  
!(md.bestMode-cu.m_mergeFlag[0])  (md.bestMode-cu.m_partSize[0] == 
SIZE_2Nx2N)  (md.bestMode-cu.m_cuDepth[0] == depth);
+if (subpelRefine  m_param-rdLevel  4)
+{
+int hpelDirs = MotionEstimate::hpelDirCount(m_param-subpelRefine);
 
+Mode* rdRefine = md.pred[PRED_RD_REFINE];
+rdRefine-initCosts();
+rdRefine-cu.initSubCU(parentCTU, cuGeom, qp);
+memcpy(rdRefine-bestME[0], md.bestMode-bestME[0], 
sizeof(MotionData));
+if (m_slice-m_sliceType == B_SLICE)
+memcpy(rdRefine-bestME[0][1], md.bestMode-bestME[0][1], 
sizeof(MotionData));
+md.bestMode-cu.copyToCU(rdRefine-cu);
+rdRefine-reconYuv.copyFromYuv(md.bestMode-reconYuv);
+rdRefine-predYuv.copyFromYuv(md.bestMode-predYuv);
+
+for (int i = 1; i = hpelDirs; i++)
+{
+qPelRefine(*rdRefine, cuGeom, true, i);
+if (m_slice-m_pps-bUseDQP  depth = 
m_slice-m_pps-maxCuDQPDepth)
+setLambdaFromQP(parentCTU, calculateQpforCuSize(parentCTU, 
cuGeom));
+encodeResAndCalcRdInterCU(*rdRefine, cuGeom);
+checkBestMode(*rdRefine, depth);
+}
+}
 /* Copy best data to encData CTU and recon */
 md.bestMode-cu.copyToPic(depth);
 if (md.bestMode != md.pred[PRED_SPLIT])
@@ -1207,7 +1231,31 @@
 checkDQPForSplitPred(*splitPred, cuGeom);
 checkBestMode(*splitPred, depth);
 }
+/* If zero-residual, do not bother doing subpelRefine */
+bool subpelRefine = !!(md.bestMode-cu.m_predMode[0]  MODE_INTER)  
!(md.bestMode-cu.m_mergeFlag[0

[x265] [PATCH] rc: fix bug in ABR 2 pass, calculate aq-offset only for unreferenced frame in 2 pass

2015-03-30 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekarsanthosh...@multicorewareinc.com
# Date 1427716771 -19800
#  Mon Mar 30 17:29:31 2015 +0530
# Node ID 1bdeb44d775d5be7523925017a1483294da2575d
# Parent  22a312799bb033d40a66fc83a1ac7af192ce2420
rc: fix bug in ABR 2 pass, calculate aq-offset only for unreferenced frame in 2 
pass

diff -r 22a312799bb0 -r 1bdeb44d775d source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp  Fri Mar 27 22:59:30 2015 -0500
+++ b/source/encoder/slicetype.cpp  Mon Mar 30 17:29:31 2015 +0530
@@ -699,7 +699,7 @@
 ProfileScopeEvent(prelookahead);
 
 preFrame-m_lowres.init(preFrame-m_fencPic, preFrame-m_poc);
-if (m_bAdaptiveQuant)
+if (m_bAdaptiveQuant  (!m_param-rc.bStatRead 
||(m_param-rc.bStatRead (!m_param-rc.cuTree || ! IS_REFERENCED(preFrame)
 m_tld[tld].calcAdaptiveQuantFrame(preFrame, m_param);
 m_tld[tld].lowresIntraEstimate(preFrame-m_lowres);
 
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] CLI: add new option cu-min(minimum CU size)

2015-02-18 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekarsanthosh...@multicorewareinc.com
# Date 1424075543 -19800
#  Mon Feb 16 14:02:23 2015 +0530
# Node ID d0e4f7ae7d85b1d733d718fa557ab62a9c99861f
# Parent  21257215be0f5fe861f83a6f767a9741012cdf50
CLI: add new option cu-min(minimum CU size)

diff -r 21257215be0f -r d0e4f7ae7d85 doc/reST/cli.rst
--- a/doc/reST/cli.rst  Wed Feb 18 16:20:17 2015 +0530
+++ b/doc/reST/cli.rst  Mon Feb 16 14:02:23 2015 +0530
@@ -477,6 +477,10 @@
and less frame parallelism as well. Because of this the faster
presets use a CU size of 32. Default: 64
 
+.. option:: --min-cu-size, 64|32|16|8
+
+   Minimum CU size (width and height). Default: 8
+
 .. option:: --rect, --no-rect
 
Enable analysis of rectangular motion partitions Nx2N and 2NxN
diff -r 21257215be0f -r d0e4f7ae7d85 source/CMakeLists.txt
--- a/source/CMakeLists.txt Wed Feb 18 16:20:17 2015 +0530
+++ b/source/CMakeLists.txt Mon Feb 16 14:02:23 2015 +0530
@@ -21,7 +21,7 @@
 include(CheckCXXCompilerFlag)
 
 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 45)
+set(X265_BUILD 46)
 configure_file(${PROJECT_SOURCE_DIR}/x265.def.in
${PROJECT_BINARY_DIR}/x265.def)
 configure_file(${PROJECT_SOURCE_DIR}/x265_config.h.in
diff -r 21257215be0f -r d0e4f7ae7d85 source/common/param.cpp
--- a/source/common/param.cpp   Wed Feb 18 16:20:17 2015 +0530
+++ b/source/common/param.cpp   Mon Feb 16 14:02:23 2015 +0530
@@ -571,6 +571,7 @@
 OPT(repeat-headers) p-bRepeatHeaders = atobool(value);
 OPT(wpp) p-bEnableWavefront = atobool(value);
 OPT(ctu) p-maxCUSize = (uint32_t)atoi(value);
+OPT(min-cu-size) p-minCUSize = (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(max-tu-size) p-maxTUSize = (uint32_t)atoi(value);
@@ -1309,6 +1310,7 @@
 s += sprintf(s,  bitdepth=%d, p-internalBitDepth);
 BOOL(p-bEnableWavefront, wpp);
 s += sprintf(s,  ctu=%d, p-maxCUSize);
+s += sprintf(s,  min-cu-size=%d, p-minCUSize);
 s += sprintf(s,  max-tu-size=%d, p-maxTUSize);
 s += sprintf(s,  tu-intra-depth=%d, p-tuQTMaxIntraDepth);
 s += sprintf(s,  tu-inter-depth=%d, p-tuQTMaxInterDepth);
diff -r 21257215be0f -r d0e4f7ae7d85 source/x265cli.h
--- a/source/x265cli.h  Wed Feb 18 16:20:17 2015 +0530
+++ b/source/x265cli.h  Mon Feb 16 14:02:23 2015 +0530
@@ -71,6 +71,7 @@
 { no-wpp,   no_argument, NULL, 0 },
 { wpp,  no_argument, NULL, 0 },
 { ctu,required_argument, NULL, 's' },
+{ min-cu-size,required_argument, NULL, 's' },
 { max-tu-size,required_argument, NULL, 's' },
 { tu-intra-depth, required_argument, NULL, 0 },
 { tu-inter-depth, required_argument, NULL, 0 },
@@ -265,6 +266,7 @@
 H0( psnr, ssim, grain, zerolatency, 
fastdecode\n);
 H0(\nQuad-Tree size and depth:\n);
 H0(-s/--ctu 64|32|16  Maximum CU size (WxH). Default %d\n, 
param-maxCUSize);
+H0(   --min-cu-size 64|32|16|8Minimum CU size (WxH). Default %d\n, 
param-minCUSize);
 H0(   --max-tu-size 32|16|8|4 Maximum TU size (WxH). Default %d\n, 
param-maxTUSize);
 H0(   --tu-intra-depth integerMax TU recursive depth for intra CUs. 
Default %d\n, param-tuQTMaxIntraDepth);
 H0(   --tu-inter-depth integerMax TU recursive depth for inter CUs. 
Default %d\n, param-tuQTMaxInterDepth);
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] implementation for minimum CU size

2015-02-18 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekarsanthosh...@multicorewareinc.com
# Date 1424256617 -19800
#  Wed Feb 18 16:20:17 2015 +0530
# Node ID 21257215be0f5fe861f83a6f767a9741012cdf50
# Parent  63d75bd1cd53c7deb0c0430d18d618b9ed2fde10
implementation for minimum CU size

diff -r 63d75bd1cd53 -r 21257215be0f source/common/cudata.cpp
--- a/source/common/cudata.cpp  Mon Feb 16 14:28:19 2015 +0530
+++ b/source/common/cudata.cpp  Wed Feb 18 16:20:17 2015 +0530
@@ -2066,14 +2066,14 @@
 
 #define CU_SET_FLAG(bitfield, flag, value) (bitfield) = ((bitfield)  
(~(flag))) | ((~((value) - 1))  (flag))
 
-void CUData::calcCTUGeoms(uint32_t ctuWidth, uint32_t ctuHeight, uint32_t 
maxCUSize, CUGeom cuDataArray[CUGeom::MAX_GEOMS])
+void CUData::calcCTUGeoms(uint32_t ctuWidth, uint32_t ctuHeight, uint32_t 
maxCUSize, uint32_t minCUSize, CUGeom cuDataArray[CUGeom::MAX_GEOMS])
 {
 // Initialize the coding blocks inside the CTB
-for (uint32_t log2CUSize = g_log2Size[maxCUSize], rangeCUIdx = 0; 
log2CUSize = MIN_LOG2_CU_SIZE; log2CUSize--)
+for (uint32_t log2CUSize = g_log2Size[maxCUSize], rangeCUIdx = 0; 
log2CUSize = g_log2Size[minCUSize]; log2CUSize--)
 {
 uint32_t blockSize = 1  log2CUSize;
 uint32_t sbWidth   = 1  (g_log2Size[maxCUSize] - log2CUSize);
-int32_t lastLevelFlag = log2CUSize == MIN_LOG2_CU_SIZE;
+int32_t lastLevelFlag = log2CUSize == g_log2Size[minCUSize];
 for (uint32_t sbY = 0; sbY  sbWidth; sbY++)
 {
 for (uint32_t sbX = 0; sbX  sbWidth; sbX++)
diff -r 63d75bd1cd53 -r 21257215be0f source/common/cudata.h
--- a/source/common/cudata.hMon Feb 16 14:28:19 2015 +0530
+++ b/source/common/cudata.hWed Feb 18 16:20:17 2015 +0530
@@ -158,7 +158,7 @@
 CUData();
 
 void initialize(const CUDataMemPool dataPool, uint32_t depth, int 
csp, int instance);
-static void calcCTUGeoms(uint32_t ctuWidth, uint32_t ctuHeight, uint32_t 
maxCUSize, CUGeom cuDataArray[CUGeom::MAX_GEOMS]);
+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);
diff -r 63d75bd1cd53 -r 21257215be0f source/common/param.cpp
--- a/source/common/param.cpp   Mon Feb 16 14:28:19 2015 +0530
+++ b/source/common/param.cpp   Wed Feb 18 16:20:17 2015 +0530
@@ -127,6 +127,7 @@
 
 /* CU definitions */
 param-maxCUSize = 64;
+param-minCUSize = 8;
 param-tuQTMaxInterDepth = 1;
 param-tuQTMaxIntraDepth = 1;
 param-maxTUSize = 32;
@@ -978,6 +979,8 @@
   x265 was compiled for 8bit encodes, only 8bit internal depth 
supported);
 #endif
 
+CHECK(param-minCUSize != 64  param-minCUSize != 32  param-minCUSize 
!= 16  param-minCUSize != 8,
+  minimim CU size must be 8, 16, 32, or 64);
 CHECK(param-rc.qp  -6 * (param-internalBitDepth - 8) || param-rc.qp  
QP_MAX_SPEC,
   QP exceeds supported range (-QpBDOffsety to 51));
 CHECK(param-fpsNum == 0 || param-fpsDenom == 0,
@@ -1163,17 +1166,30 @@
 x265_log(param, X265_LOG_ERROR, maxCUSize must be the same for 
all encoders in a single process);
 return -1;
 }
+uint32_t maxLog2CUSize = (uint32_t)g_log2Size[param-maxCUSize];
+uint32_t minLog2CUSize = (uint32_t)g_log2Size[param-minCUSize];
+if (g_maxCUDepth != maxLog2CUSize - minLog2CUSize)
+{
+x265_log(param, X265_LOG_ERROR, maxCUDepth must be the same for 
all encoders in a single process);
+return -1;
+}
 }
 else
 {
+if (param-minCUSize  param-maxCUSize)
+{
+x265_log(param, X265_LOG_WARNING, Min CU size should be less than 
or equal to max CU size, setting min CU size = %d\n, param-maxCUSize);
+param-minCUSize = param-maxCUSize;
+}
 uint32_t maxLog2CUSize = (uint32_t)g_log2Size[param-maxCUSize];
+uint32_t minLog2CUSize = (uint32_t)g_log2Size[param-minCUSize];
 
 // set max CU width  height
 g_maxCUSize = param-maxCUSize;
 g_maxLog2CUSize = maxLog2CUSize;
 
 // compute actual CU depth with respect to config depth and max 
transform size
-g_maxCUDepth   = maxLog2CUSize - MIN_LOG2_CU_SIZE;
+g_maxCUDepth   = maxLog2CUSize - minLog2CUSize;
 g_unitSizeDepth = maxLog2CUSize - LOG2_UNIT_SIZE;
 
 // initialize partition order
@@ -1195,7 +1211,7 @@
 if (param-interlaceMode)
 x265_log(param, X265_LOG_INFO, Interlaced field inputs : 
%s\n, x265_interlace_names[param-interlaceMode]);
 
-x265_log(param, X265_LOG_INFO, Coding QT: max CU size, min CU size : %d / 
%d\n, param-maxCUSize, 8);
+x265_log(param, X265_LOG_INFO, Coding QT: max CU size, min CU size : %d / 
%d\n, param-maxCUSize, param-minCUSize);
 
 x265_log(param, X265_LOG_INFO

Re: [x265] [PATCH 3 of 3] CLI: add new option cu-min(minimum CU size)

2015-02-18 Thread Santhoshini Sekar
yeah, that would be better. I'll send out a patch.

On Wed, Feb 18, 2015 at 4:50 PM, Deepthi Nandakumar 
deep...@multicorewareinc.com wrote:

 Here, wouldnt it be better to call this --min-cu-size to go with the
 --max-tu-size introduced earlier?

 On Mon, Feb 16, 2015 at 4:55 PM, santhosh...@multicorewareinc.com wrote:

 # HG changeset patch
 # User Santhoshini Sekarsanthosh...@multicorewareinc.com
 # Date 1424075543 -19800
 #  Mon Feb 16 14:02:23 2015 +0530
 # Node ID 5fdaef859517b16ef37f26ec1a259a5c139744fe
 # Parent  24e3fc60cb4183fff50921a332f0fd0d98cc0f56
 CLI: add new option cu-min(minimum CU size)

 diff -r 24e3fc60cb41 -r 5fdaef859517 doc/reST/cli.rst
 --- a/doc/reST/cli.rst  Mon Feb 16 14:33:08 2015 +0530
 +++ b/doc/reST/cli.rst  Mon Feb 16 14:02:23 2015 +0530
 @@ -477,6 +477,10 @@
 and less frame parallelism as well. Because of this the faster
 presets use a CU size of 32. Default: 64

 +.. option:: --cu-min, 64|32|16|8
 +
 +   Minimum CU size (width and height). Default: 8
 +
  .. option:: --rect, --no-rect

 Enable analysis of rectangular motion partitions Nx2N and 2NxN
 diff -r 24e3fc60cb41 -r 5fdaef859517 source/CMakeLists.txt
 --- a/source/CMakeLists.txt Mon Feb 16 14:33:08 2015 +0530
 +++ b/source/CMakeLists.txt Mon Feb 16 14:02:23 2015 +0530
 @@ -21,7 +21,7 @@
  include(CheckCXXCompilerFlag)

  # X265_BUILD must be incremented each time the public API is changed
 -set(X265_BUILD 45)
 +set(X265_BUILD 46)
  configure_file(${PROJECT_SOURCE_DIR}/x265.def.in
 ${PROJECT_BINARY_DIR}/x265.def)
  configure_file(${PROJECT_SOURCE_DIR}/x265_config.h.in
 diff -r 24e3fc60cb41 -r 5fdaef859517 source/common/param.cpp
 --- a/source/common/param.cpp   Mon Feb 16 14:33:08 2015 +0530
 +++ b/source/common/param.cpp   Mon Feb 16 14:02:23 2015 +0530
 @@ -571,6 +571,7 @@
  OPT(repeat-headers) p-bRepeatHeaders = atobool(value);
  OPT(wpp) p-bEnableWavefront = atobool(value);
  OPT(ctu) p-maxCUSize = (uint32_t)atoi(value);
 +OPT(cu-min) p-minCUSize = (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(max-tu-size) p-maxTUSize = (uint32_t)atoi(value);
 @@ -1302,6 +1303,7 @@
  s += sprintf(s,  bitdepth=%d, p-internalBitDepth);
  BOOL(p-bEnableWavefront, wpp);
  s += sprintf(s,  ctu=%d, p-maxCUSize);
 +s += sprintf(s,  cu-min=%d, p-minCUSize);
  s += sprintf(s,  max-tu-size=%d, p-maxTUSize);
  s += sprintf(s,  tu-intra-depth=%d, p-tuQTMaxIntraDepth);
  s += sprintf(s,  tu-inter-depth=%d, p-tuQTMaxInterDepth);
 diff -r 24e3fc60cb41 -r 5fdaef859517 source/x265cli.h
 --- a/source/x265cli.h  Mon Feb 16 14:33:08 2015 +0530
 +++ b/source/x265cli.h  Mon Feb 16 14:02:23 2015 +0530
 @@ -71,6 +71,7 @@
  { no-wpp,   no_argument, NULL, 0 },
  { wpp,  no_argument, NULL, 0 },
  { ctu,required_argument, NULL, 's' },
 +{ cu-min,   required_argument, NULL, 's' },
  { max-tu-size,required_argument, NULL, 's' },
  { tu-intra-depth, required_argument, NULL, 0 },
  { tu-inter-depth, required_argument, NULL, 0 },
 @@ -265,6 +266,7 @@
  H0( psnr, ssim, grain, zerolatency,
 fastdecode\n);
  H0(\nQuad-Tree size and depth:\n);
  H0(-s/--ctu 64|32|16  Maximum CU size (WxH). Default
 %d\n, param-maxCUSize);
 +H0(   --cu-min 64|32|16|8Minimum CU size (WxH). Default
 %d\n, param-minCUSize);
  H0(   --max-tu-size 32|16|8|4 Maximum TU size (WxH). Default
 %d\n, param-maxTUSize);
  H0(   --tu-intra-depth integerMax TU recursive depth for
 intra CUs. Default %d\n, param-tuQTMaxIntraDepth);
  H0(   --tu-inter-depth integerMax TU recursive depth for
 inter CUs. Default %d\n, param-tuQTMaxInterDepth);
 ___
 x265-devel mailing list
 x265-devel@videolan.org
 https://mailman.videolan.org/listinfo/x265-devel



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


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


[x265] [PATCH 1 of 3] rename variable g_maxFullDepth to g_unitSizeDepth, NUM_CU_PARTITIONS to NUM_4x4_PARTITIONS

2015-02-16 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekarsanthosh...@multicorewareinc.com
# Date 1424077099 -19800
#  Mon Feb 16 14:28:19 2015 +0530
# Node ID 59466f1455ce52920eb642cf06db4b4de8d8ff10
# Parent  2495fbd5792104c96c4ca5faf18807cc45a35da0
rename variable g_maxFullDepth to g_unitSizeDepth, NUM_CU_PARTITIONS to 
NUM_4x4_PARTITIONS
for better clarity

diff -r 2495fbd57921 -r 59466f1455ce source/common/common.h
--- a/source/common/common.hMon Feb 16 16:16:04 2015 +0530
+++ b/source/common/common.hMon Feb 16 14:28:19 2015 +0530
@@ -258,7 +258,7 @@
 #define UNIT_SIZE   (1  LOG2_UNIT_SIZE)   // unit size of CU 
partition
 
 #define MAX_NUM_PARTITIONS  256
-#define NUM_CU_PARTITIONS   (1U  (g_maxFullDepth  1))
+#define NUM_4x4_PARTITIONS  (1U  (g_unitSizeDepth  1)) // number of 
4x4 units in max CU size
 
 #define MIN_PU_SIZE 4
 #define MIN_TU_SIZE 4
diff -r 2495fbd57921 -r 59466f1455ce source/common/constants.cpp
--- a/source/common/constants.cpp   Mon Feb 16 16:16:04 2015 +0530
+++ b/source/common/constants.cpp   Mon Feb 16 14:28:19 2015 +0530
@@ -121,7 +121,7 @@
 
 uint32_t g_maxLog2CUSize = MAX_LOG2_CU_SIZE;
 uint32_t g_maxCUSize = MAX_CU_SIZE;
-uint32_t g_maxFullDepth  = NUM_FULL_DEPTH - 1;
+uint32_t g_unitSizeDepth = NUM_CU_DEPTH;
 uint32_t g_maxCUDepth= NUM_CU_DEPTH - 1;
 uint32_t g_zscanToRaster[MAX_NUM_PARTITIONS] = { 0, };
 uint32_t g_rasterToZscan[MAX_NUM_PARTITIONS] = { 0, };
diff -r 2495fbd57921 -r 59466f1455ce source/common/constants.h
--- a/source/common/constants.h Mon Feb 16 16:16:04 2015 +0530
+++ b/source/common/constants.h Mon Feb 16 14:28:19 2015 +0530
@@ -55,7 +55,7 @@
 extern uint32_t g_maxLog2CUSize;
 extern uint32_t g_maxCUSize;
 extern uint32_t g_maxCUDepth;
-extern uint32_t g_maxFullDepth;
+extern uint32_t g_unitSizeDepth; // Depth at which 4x4 unit occurs from max CU 
size
 
 extern const int16_t g_t4[4][4];
 extern const int16_t g_t8[8][8];
diff -r 2495fbd57921 -r 59466f1455ce source/common/cudata.cpp
--- a/source/common/cudata.cpp  Mon Feb 16 16:16:04 2015 +0530
+++ b/source/common/cudata.cpp  Mon Feb 16 14:28:19 2015 +0530
@@ -159,11 +159,11 @@
 m_chromaFormat  = csp;
 m_hChromaShift  = CHROMA_H_SHIFT(csp);
 m_vChromaShift  = CHROMA_V_SHIFT(csp);
-m_numPartitions = NUM_CU_PARTITIONS  (depth * 2);
+m_numPartitions = NUM_4x4_PARTITIONS  (depth * 2);
 
 if (!s_partSet[0])
 {
-s_numPartInCUSize = 1  g_maxFullDepth;
+s_numPartInCUSize = 1  g_unitSizeDepth;
 switch (g_maxLog2CUSize)
 {
 case 6:
@@ -272,7 +272,7 @@
 m_cuPelX= (cuAddr % m_slice-m_sps-numCuInWidth)  
g_maxLog2CUSize;
 m_cuPelY= (cuAddr / m_slice-m_sps-numCuInWidth)  
g_maxLog2CUSize;
 m_absIdxInCTU   = 0;
-m_numPartitions = NUM_CU_PARTITIONS;
+m_numPartitions = NUM_4x4_PARTITIONS;
 
 /* sequential memsets */
 m_partSet((uint8_t*)m_qp, (uint8_t)qp);
@@ -559,7 +559,7 @@
 return this;
 }
 
-aPartUnitIdx = g_rasterToZscan[absPartIdx + NUM_CU_PARTITIONS - 
s_numPartInCUSize];
+aPartUnitIdx = g_rasterToZscan[absPartIdx + NUM_4x4_PARTITIONS - 
s_numPartInCUSize];
 return m_cuAbove;
 }
 
@@ -581,7 +581,7 @@
 return this;
 }
 }
-alPartUnitIdx = g_rasterToZscan[absPartIdx + NUM_CU_PARTITIONS - 
s_numPartInCUSize - 1];
+alPartUnitIdx = g_rasterToZscan[absPartIdx + NUM_4x4_PARTITIONS - 
s_numPartInCUSize - 1];
 return m_cuAbove;
 }
 
@@ -591,7 +591,7 @@
 return m_cuLeft;
 }
 
-alPartUnitIdx = g_rasterToZscan[NUM_CU_PARTITIONS - 1];
+alPartUnitIdx = g_rasterToZscan[NUM_4x4_PARTITIONS - 1];
 return m_cuAboveLeft;
 }
 
@@ -620,14 +620,14 @@
 }
 return NULL;
 }
-arPartUnitIdx = g_rasterToZscan[absPartIdxRT + NUM_CU_PARTITIONS - 
s_numPartInCUSize + 1];
+arPartUnitIdx = g_rasterToZscan[absPartIdxRT + NUM_4x4_PARTITIONS - 
s_numPartInCUSize + 1];
 return m_cuAbove;
 }
 
 if (!isZeroRow(absPartIdxRT, s_numPartInCUSize))
 return NULL;
 
-arPartUnitIdx = g_rasterToZscan[NUM_CU_PARTITIONS - s_numPartInCUSize];
+arPartUnitIdx = g_rasterToZscan[NUM_4x4_PARTITIONS - s_numPartInCUSize];
 return m_cuAboveRight;
 }
 
@@ -720,21 +720,21 @@
 }
 return NULL;
 }
-arPartUnitIdx = g_rasterToZscan[absPartIdxRT + NUM_CU_PARTITIONS - 
s_numPartInCUSize + partUnitOffset];
+arPartUnitIdx = g_rasterToZscan[absPartIdxRT + NUM_4x4_PARTITIONS - 
s_numPartInCUSize + partUnitOffset];
 return m_cuAbove;
 }
 
 if (!isZeroRow(absPartIdxRT, s_numPartInCUSize))
 return NULL;
 
-arPartUnitIdx = g_rasterToZscan[NUM_CU_PARTITIONS - s_numPartInCUSize + 
partUnitOffset - 1];
+arPartUnitIdx = g_rasterToZscan[NUM_4x4_PARTITIONS - s_numPartInCUSize + 
partUnitOffset - 1];
 return m_cuAboveRight;
 }
 
 /* Get left

[x265] [PATCH 3 of 3] CLI: add new option cu-min(minimum CU size)

2015-02-16 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekarsanthosh...@multicorewareinc.com
# Date 1424075543 -19800
#  Mon Feb 16 14:02:23 2015 +0530
# Node ID 5fdaef859517b16ef37f26ec1a259a5c139744fe
# Parent  24e3fc60cb4183fff50921a332f0fd0d98cc0f56
CLI: add new option cu-min(minimum CU size)

diff -r 24e3fc60cb41 -r 5fdaef859517 doc/reST/cli.rst
--- a/doc/reST/cli.rst  Mon Feb 16 14:33:08 2015 +0530
+++ b/doc/reST/cli.rst  Mon Feb 16 14:02:23 2015 +0530
@@ -477,6 +477,10 @@
and less frame parallelism as well. Because of this the faster
presets use a CU size of 32. Default: 64
 
+.. option:: --cu-min, 64|32|16|8
+
+   Minimum CU size (width and height). Default: 8
+
 .. option:: --rect, --no-rect
 
Enable analysis of rectangular motion partitions Nx2N and 2NxN
diff -r 24e3fc60cb41 -r 5fdaef859517 source/CMakeLists.txt
--- a/source/CMakeLists.txt Mon Feb 16 14:33:08 2015 +0530
+++ b/source/CMakeLists.txt Mon Feb 16 14:02:23 2015 +0530
@@ -21,7 +21,7 @@
 include(CheckCXXCompilerFlag)
 
 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 45)
+set(X265_BUILD 46)
 configure_file(${PROJECT_SOURCE_DIR}/x265.def.in
${PROJECT_BINARY_DIR}/x265.def)
 configure_file(${PROJECT_SOURCE_DIR}/x265_config.h.in
diff -r 24e3fc60cb41 -r 5fdaef859517 source/common/param.cpp
--- a/source/common/param.cpp   Mon Feb 16 14:33:08 2015 +0530
+++ b/source/common/param.cpp   Mon Feb 16 14:02:23 2015 +0530
@@ -571,6 +571,7 @@
 OPT(repeat-headers) p-bRepeatHeaders = atobool(value);
 OPT(wpp) p-bEnableWavefront = atobool(value);
 OPT(ctu) p-maxCUSize = (uint32_t)atoi(value);
+OPT(cu-min) p-minCUSize = (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(max-tu-size) p-maxTUSize = (uint32_t)atoi(value);
@@ -1302,6 +1303,7 @@
 s += sprintf(s,  bitdepth=%d, p-internalBitDepth);
 BOOL(p-bEnableWavefront, wpp);
 s += sprintf(s,  ctu=%d, p-maxCUSize);
+s += sprintf(s,  cu-min=%d, p-minCUSize);
 s += sprintf(s,  max-tu-size=%d, p-maxTUSize);
 s += sprintf(s,  tu-intra-depth=%d, p-tuQTMaxIntraDepth);
 s += sprintf(s,  tu-inter-depth=%d, p-tuQTMaxInterDepth);
diff -r 24e3fc60cb41 -r 5fdaef859517 source/x265cli.h
--- a/source/x265cli.h  Mon Feb 16 14:33:08 2015 +0530
+++ b/source/x265cli.h  Mon Feb 16 14:02:23 2015 +0530
@@ -71,6 +71,7 @@
 { no-wpp,   no_argument, NULL, 0 },
 { wpp,  no_argument, NULL, 0 },
 { ctu,required_argument, NULL, 's' },
+{ cu-min,   required_argument, NULL, 's' },
 { max-tu-size,required_argument, NULL, 's' },
 { tu-intra-depth, required_argument, NULL, 0 },
 { tu-inter-depth, required_argument, NULL, 0 },
@@ -265,6 +266,7 @@
 H0( psnr, ssim, grain, zerolatency, 
fastdecode\n);
 H0(\nQuad-Tree size and depth:\n);
 H0(-s/--ctu 64|32|16  Maximum CU size (WxH). Default %d\n, 
param-maxCUSize);
+H0(   --cu-min 64|32|16|8Minimum CU size (WxH). Default %d\n, 
param-minCUSize);
 H0(   --max-tu-size 32|16|8|4 Maximum TU size (WxH). Default %d\n, 
param-maxTUSize);
 H0(   --tu-intra-depth integerMax TU recursive depth for intra CUs. 
Default %d\n, param-tuQTMaxIntraDepth);
 H0(   --tu-inter-depth integerMax TU recursive depth for inter CUs. 
Default %d\n, param-tuQTMaxInterDepth);
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH 0 of 3 ] New command line option cu-min, support and implementation

2015-02-16 Thread santhoshini

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


[x265] [PATCH] rename maxCUSize in param to CTUSize to match with the CLI option --ctu

2015-02-16 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekarsanthosh...@multicorewareinc.com
# Date 1424087004 -19800
#  Mon Feb 16 17:13:24 2015 +0530
# Node ID 7bf665ad72b4cd59bec598d61b1361f22d762760
# Parent  5fdaef859517b16ef37f26ec1a259a5c139744fe
rename maxCUSize in param to CTUSize to match with the CLI option --ctu

diff -r 5fdaef859517 -r 7bf665ad72b4 source/common/param.cpp
--- a/source/common/param.cpp   Mon Feb 16 14:02:23 2015 +0530
+++ b/source/common/param.cpp   Mon Feb 16 17:13:24 2015 +0530
@@ -126,7 +126,7 @@
 param-bEmitInfoSEI = 1;
 
 /* CU definitions */
-param-maxCUSize = 64;
+param-CTUSize = 64;
 param-minCUSize = 8;
 param-tuQTMaxInterDepth = 1;
 param-tuQTMaxIntraDepth = 1;
@@ -249,7 +249,7 @@
 {
 param-lookaheadDepth = 10;
 param-scenecutThreshold = 0; // disable lookahead
-param-maxCUSize = 32;
+param-CTUSize = 32;
 param-searchRange = 25;
 param-bFrameAdaptive = 0;
 param-subpelRefine = 0;
@@ -268,7 +268,7 @@
 else if (!strcmp(preset, superfast))
 {
 param-lookaheadDepth = 10;
-param-maxCUSize = 32;
+param-CTUSize = 32;
 param-searchRange = 44;
 param-bFrameAdaptive = 0;
 param-subpelRefine = 1;
@@ -285,7 +285,7 @@
 else if (!strcmp(preset, veryfast))
 {
 param-lookaheadDepth = 15;
-param-maxCUSize = 32;
+param-CTUSize = 32;
 param-bFrameAdaptive = 0;
 param-subpelRefine = 1;
 param-bEnableEarlySkip = 1;
@@ -570,7 +570,7 @@
 OPT(cu-stats) p-bLogCuStats = atobool(value);
 OPT(repeat-headers) p-bRepeatHeaders = atobool(value);
 OPT(wpp) p-bEnableWavefront = atobool(value);
-OPT(ctu) p-maxCUSize = (uint32_t)atoi(value);
+OPT(ctu) p-CTUSize = (uint32_t)atoi(value);
 OPT(cu-min) p-minCUSize = (uint32_t)atoi(value);
 OPT(tu-intra-depth) p-tuQTMaxIntraDepth = (uint32_t)atoi(value);
 OPT(tu-inter-depth) p-tuQTMaxInterDepth = (uint32_t)atoi(value);
@@ -962,12 +962,12 @@
 #define CHECK(expr, msg) check_failed |= _confirm(param, expr, msg)
 int check_failed = 0; /* abort if there is a fatal configuration problem */
 
-CHECK(param-maxCUSize != 64  param-maxCUSize != 32  param-maxCUSize 
!= 16,
+CHECK(param-CTUSize != 64  param-CTUSize != 32  param-CTUSize != 16,
   max ctu size must be 16, 32, or 64);
 if (check_failed == 1)
 return check_failed;
 
-uint32_t maxLog2CUSize = (uint32_t)g_log2Size[param-maxCUSize];
+uint32_t maxLog2CUSize = (uint32_t)g_log2Size[param-CTUSize];
 uint32_t tuQTMaxLog2Size = X265_MIN(maxLog2CUSize, 5);
 uint32_t tuQTMinLog2Size = 2; //log2(4)
 
@@ -1024,7 +1024,7 @@
 CHECK(param-maxNumReferences  1, maxNumReferences must be 1 or 
greater.);
 CHECK(param-maxNumReferences  MAX_NUM_REF, maxNumReferences must be 16 
or smaller.);
 
-CHECK(param-sourceWidth  (int)param-maxCUSize || param-sourceHeight  
(int)param-maxCUSize,
+CHECK(param-sourceWidth  (int)param-CTUSize || param-sourceHeight  
(int)param-CTUSize,
   Picture size must be at least one CTU);
 CHECK(param-internalCsp  X265_CSP_I420 || X265_CSP_I444  
param-internalCsp,
   Color space must be i420, i422, or i444);
@@ -1162,7 +1162,7 @@
 
 if (ATOMIC_INC(once)  1)
 {
-if (param-maxCUSize != g_maxCUSize)
+if (param-CTUSize != g_maxCUSize)
 {
 x265_log(param, X265_LOG_ERROR, maxCUSize must be the same for 
all encoders in a single process);
 return -1;
@@ -1170,16 +1170,16 @@
 }
 else
 {
-if (param-minCUSize  param-maxCUSize)
+if (param-minCUSize  param-CTUSize)
 {
-x265_log(param, X265_LOG_WARNING, Min CU size should be less than or 
equal to max CU size, setting min CU size = %d\n, param-maxCUSize);
-param-minCUSize = param-maxCUSize;
+x265_log(param, X265_LOG_WARNING, Min CU size should be less than or 
equal to max CU size, setting min CU size = %d\n, param-CTUSize);
+param-minCUSize = param-CTUSize;
 }
-uint32_t maxLog2CUSize = (uint32_t)g_log2Size[param-maxCUSize];
+uint32_t maxLog2CUSize = (uint32_t)g_log2Size[param-CTUSize];
 uint32_t minLog2CUSize = (uint32_t)g_log2Size[param-minCUSize];
 
 // set max CU width  height
-g_maxCUSize = param-maxCUSize;
+g_maxCUSize = param-CTUSize;
 g_maxLog2CUSize = maxLog2CUSize;
 
 // compute actual CU depth with respect to config depth and max 
transform size
@@ -1205,7 +1205,7 @@
 if (param-interlaceMode)
 x265_log(param, X265_LOG_INFO, Interlaced field inputs : 
%s\n, x265_interlace_names[param-interlaceMode]);
 
-x265_log(param, X265_LOG_INFO, Coding QT: max CU size, min CU size : %d / 
%d\n, param-maxCUSize, param-minCUSize);
+x265_log(param

[x265] [PATCH 3 of 3 REVIEW] CLI: add new option ctu-min(minimum CU size)

2015-02-13 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekarsanthosh...@multicorewareinc.com
# Date 1423816031 -19800
#  Fri Feb 13 13:57:11 2015 +0530
# Node ID 1b9aabcb173803c3dcd0142990a9b8147fa88aa3
# Parent  047eba9f4f6208bf2278bd686d2b8e5277f83526
CLI: add new option ctu-min(minimum CU size)

diff -r 047eba9f4f62 -r 1b9aabcb1738 doc/reST/cli.rst
--- a/doc/reST/cli.rst  Fri Feb 13 13:55:57 2015 +0530
+++ b/doc/reST/cli.rst  Fri Feb 13 13:57:11 2015 +0530
@@ -477,6 +477,10 @@
and less frame parallelism as well. Because of this the faster
presets use a CU size of 32. Default: 64
 
+.. option:: --ctu-min, 64|32|16|8
+
+   Minimum CU size (width and height). Default: 8
+
 .. option:: --rect, --no-rect
 
Enable analysis of rectangular motion partitions Nx2N and 2NxN
diff -r 047eba9f4f62 -r 1b9aabcb1738 source/CMakeLists.txt
--- a/source/CMakeLists.txt Fri Feb 13 13:55:57 2015 +0530
+++ b/source/CMakeLists.txt Fri Feb 13 13:57:11 2015 +0530
@@ -21,7 +21,7 @@
 include(CheckCXXCompilerFlag)
 
 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 45)
+set(X265_BUILD 46)
 configure_file(${PROJECT_SOURCE_DIR}/x265.def.in
${PROJECT_BINARY_DIR}/x265.def)
 configure_file(${PROJECT_SOURCE_DIR}/x265_config.h.in
diff -r 047eba9f4f62 -r 1b9aabcb1738 source/common/param.cpp
--- a/source/common/param.cpp   Fri Feb 13 13:55:57 2015 +0530
+++ b/source/common/param.cpp   Fri Feb 13 13:57:11 2015 +0530
@@ -571,6 +571,7 @@
 OPT(repeat-headers) p-bRepeatHeaders = atobool(value);
 OPT(wpp) p-bEnableWavefront = atobool(value);
 OPT(ctu) p-maxCUSize = (uint32_t)atoi(value);
+OPT(ctu-min) p-minCUSize = (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(max-tu-size) p-maxTUSize = (uint32_t)atoi(value);
@@ -1297,6 +1298,7 @@
 s += sprintf(s,  bitdepth=%d, p-internalBitDepth);
 BOOL(p-bEnableWavefront, wpp);
 s += sprintf(s,  ctu=%d, p-maxCUSize);
+s += sprintf(s,  ctu-min=%d, p-minCUSize);
 s += sprintf(s,  max-tu-size=%d, p-maxTUSize);
 s += sprintf(s,  tu-intra-depth=%d, p-tuQTMaxIntraDepth);
 s += sprintf(s,  tu-inter-depth=%d, p-tuQTMaxInterDepth);
diff -r 047eba9f4f62 -r 1b9aabcb1738 source/x265cli.h
--- a/source/x265cli.h  Fri Feb 13 13:55:57 2015 +0530
+++ b/source/x265cli.h  Fri Feb 13 13:57:11 2015 +0530
@@ -71,6 +71,7 @@
 { no-wpp,   no_argument, NULL, 0 },
 { wpp,  no_argument, NULL, 0 },
 { ctu,required_argument, NULL, 's' },
+{ ctu-min,   required_argument, NULL, 's' },
 { max-tu-size,required_argument, NULL, 's' },
 { tu-intra-depth, required_argument, NULL, 0 },
 { tu-inter-depth, required_argument, NULL, 0 },
@@ -265,6 +266,7 @@
 H0( psnr, ssim, grain, zerolatency, 
fastdecode\n);
 H0(\nQuad-Tree size and depth:\n);
 H0(-s/--ctu 64|32|16  Maximum CU size (WxH). Default %d\n, 
param-maxCUSize);
+H0(   --ctu-min 64|32|16|8Minimum CU size (WxH). Default %d\n, 
param-minCUSize);
 H0(   --max-tu-size 32|16|8|4 Maximum TU size (WxH). Default %d\n, 
param-maxTUSize);
 H0(   --tu-intra-depth integerMax TU recursive depth for intra CUs. 
Default %d\n, param-tuQTMaxIntraDepth);
 H0(   --tu-inter-depth integerMax TU recursive depth for inter CUs. 
Default %d\n, param-tuQTMaxInterDepth);
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] CLI: remove wrong short option given to max-tu-size

2015-02-12 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekarsanthosh...@multicorewareinc.com
# Date 1423731606 -19800
#  Thu Feb 12 14:30:06 2015 +0530
# Node ID 9590baa6cca378b5a6645375fca7461a274f6ba4
# Parent  7a42ca02d1989dddc85ece2e438c23b85c7fcfc2
CLI: remove wrong short option given to max-tu-size

diff -r 7a42ca02d198 -r 9590baa6cca3 source/x265cli.h
--- a/source/x265cli.h  Wed Feb 11 10:31:20 2015 +0530
+++ b/source/x265cli.h  Thu Feb 12 14:30:06 2015 +0530
@@ -265,7 +265,7 @@
 H0( psnr, ssim, grain, zerolatency, 
fastdecode\n);
 H0(\nQuad-Tree size and depth:\n);
 H0(-s/--ctu 64|32|16  Maximum CU size (WxH). Default %d\n, 
param-maxCUSize);
-H0(-s/--max-tu-size 32|16|8|4 Maximum TU size (WxH). Default %d\n, 
param-maxTUSize);
+H0(   --max-tu-size 32|16|8|4 Maximum TU size (WxH). Default %d\n, 
param-maxTUSize);
 H0(   --tu-intra-depth integerMax TU recursive depth for intra CUs. 
Default %d\n, param-tuQTMaxIntraDepth);
 H0(   --tu-inter-depth integerMax TU recursive depth for inter CUs. 
Default %d\n, param-tuQTMaxInterDepth);
 H0(\nAnalysis:\n);
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] cli: add cli option max-tu-size and support for it

2015-02-10 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekarsanthosh...@multicorewareinc.com
# Date 1423630880 -19800
#  Wed Feb 11 10:31:20 2015 +0530
# Node ID 5320c5908a881abc477537a375a452ee663a3830
# Parent  1ed7dd760d0f605c3426ff45288e62fd6a5654ae
cli: add cli option max-tu-size and support for it

diff -r 1ed7dd760d0f -r 5320c5908a88 doc/reST/cli.rst
--- a/doc/reST/cli.rst  Tue Feb 10 15:15:25 2015 -0600
+++ b/doc/reST/cli.rst  Wed Feb 11 10:31:20 2015 +0530
@@ -598,6 +598,15 @@
partitions, in which case a TU split is implied and thus the
residual quad-tree begins one layer below the CU quad-tree.
 
+.. option:: --max-tu-size 32|16|8|4
+
+   Maximum TU size (width and height). The residual can be more
+   efficiently compressed by the DCT transform when the max TU size
+   is larger, but at the expense of more computation. Transform unit
+   quad-tree begins at the same depth of the coded tree unit, but if the
+   maximum TU size is smaller than the CU size then transform QT begins 
+   at the depth of the max-tu-size. Default: 32.
+
 Temporal / motion search options
 
 
diff -r 1ed7dd760d0f -r 5320c5908a88 source/CMakeLists.txt
--- a/source/CMakeLists.txt Tue Feb 10 15:15:25 2015 -0600
+++ b/source/CMakeLists.txt Wed Feb 11 10:31:20 2015 +0530
@@ -21,7 +21,7 @@
 include(CheckCXXCompilerFlag)
 
 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 44)
+set(X265_BUILD 45)
 configure_file(${PROJECT_SOURCE_DIR}/x265.def.in
${PROJECT_BINARY_DIR}/x265.def)
 configure_file(${PROJECT_SOURCE_DIR}/x265_config.h.in
diff -r 1ed7dd760d0f -r 5320c5908a88 source/common/param.cpp
--- a/source/common/param.cpp   Tue Feb 10 15:15:25 2015 -0600
+++ b/source/common/param.cpp   Wed Feb 11 10:31:20 2015 +0530
@@ -129,6 +129,7 @@
 param-maxCUSize = 64;
 param-tuQTMaxInterDepth = 1;
 param-tuQTMaxIntraDepth = 1;
+param-maxTUSize = 32;
 
 /* Coding Structure */
 param-keyframeMin = 0;
@@ -572,6 +573,7 @@
 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(max-tu-size) p-maxTUSize = (uint32_t)atoi(value);
 OPT(subme) p-subpelRefine = atoi(value);
 OPT(merange) p-searchRange = atoi(value);
 OPT(rect) p-bEnableRectInter = atobool(value);
@@ -1012,7 +1014,8 @@
   QuadtreeTUMaxDepthIntra must be greater 0 and less than 5);
 CHECK(maxLog2CUSize  tuQTMinLog2Size + param-tuQTMaxIntraDepth - 1,
   QuadtreeTUMaxDepthInter must be less than or equal to the 
difference between log2(maxCUSize) and QuadtreeTULog2MinSize plus 1);
-
+CHECK((param-maxTUSize != 32  param-maxTUSize != 16  
param-maxTUSize != 8  param-maxTUSize != 4) || param-maxTUSize  
param-maxCUSize,
+  max TU size must be 4, 8, 16, or 32 and should be less than max CU 
size);
 CHECK(param-maxNumMergeCand  1, MaxNumMergeCand must be 1 or greater.);
 CHECK(param-maxNumMergeCand  5, MaxNumMergeCand must be 5 or smaller.);
 
@@ -1194,8 +1197,10 @@
 if (param-interlaceMode)
 x265_log(param, X265_LOG_INFO, Interlaced field inputs : 
%s\n, x265_interlace_names[param-interlaceMode]);
 
-x265_log(param, X265_LOG_INFO, CTU size / RQT depth inter / intra  : %d / 
%d / %d\n,
- param-maxCUSize, param-tuQTMaxInterDepth, 
param-tuQTMaxIntraDepth);
+x265_log(param, X265_LOG_INFO, Coding QT: max CU size, min CU size : %d / 
%d\n, param-maxCUSize, 8);
+
+x265_log(param, X265_LOG_INFO, Residual QT: max TU size, max depth : %d / 
%d inter / %d intra\n,
+ param-maxTUSize, param-tuQTMaxInterDepth, 
param-tuQTMaxIntraDepth);
 
 x265_log(param, X265_LOG_INFO, ME / range / subpel / merge : %s / 
%d / %d / %d\n,
  x265_motion_est_names[param-searchMethod], param-searchRange, 
param-subpelRefine, param-maxNumMergeCand);
@@ -1291,6 +1296,7 @@
 s += sprintf(s,  bitdepth=%d, p-internalBitDepth);
 BOOL(p-bEnableWavefront, wpp);
 s += sprintf(s,  ctu=%d, p-maxCUSize);
+s += sprintf(s,  max-tu-size=%d, p-maxTUSize);
 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);
diff -r 1ed7dd760d0f -r 5320c5908a88 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cppTue Feb 10 15:15:25 2015 -0600
+++ b/source/encoder/encoder.cppWed Feb 11 10:31:20 2015 +0530
@@ -1438,8 +1438,8 @@
 
 sps-log2MinCodingBlockSize = g_maxLog2CUSize - g_maxCUDepth;
 sps-log2DiffMaxMinCodingBlockSize = g_maxCUDepth;
-
-sps-quadtreeTULog2MaxSize = X265_MIN(g_maxLog2CUSize, 5);
+uint32_t maxLog2TUSize = (uint32_t)g_log2Size[m_param-maxTUSize];
+sps-quadtreeTULog2MaxSize = X265_MIN(g_maxLog2CUSize, maxLog2TUSize);
 sps-quadtreeTULog2MinSize = 2

[x265] [PATCH REVIEW] cli: add cli option max-tu-size and support for it

2015-02-09 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekarsanthosh...@multicorewareinc.com
# Date 1423547171 -19800
#  Tue Feb 10 11:16:11 2015 +0530
# Node ID 3a32b6a482b38c1c87bc690fbef2c39d32da5094
# Parent  da3302cc67fb06c62726d175593fdfda0db2fd54
cli: add cli option max-tu-size and support for it

diff -r da3302cc67fb -r 3a32b6a482b3 source/common/param.cpp
--- a/source/common/param.cpp   Mon Feb 09 16:45:31 2015 -0600
+++ b/source/common/param.cpp   Tue Feb 10 11:16:11 2015 +0530
@@ -129,6 +129,7 @@
 param-maxCUSize = 64;
 param-tuQTMaxInterDepth = 1;
 param-tuQTMaxIntraDepth = 1;
+param-maxTUSize = 32;
 
 /* Coding Structure */
 param-keyframeMin = 0;
@@ -572,6 +573,7 @@
 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(max-tu-size) p-maxTUSize = (uint32_t)atoi(value);
 OPT(subme) p-subpelRefine = atoi(value);
 OPT(merange) p-searchRange = atoi(value);
 OPT(rect) p-bEnableRectInter = atobool(value);
@@ -1012,7 +1014,8 @@
   QuadtreeTUMaxDepthIntra must be greater 0 and less than 5);
 CHECK(maxLog2CUSize  tuQTMinLog2Size + param-tuQTMaxIntraDepth - 1,
   QuadtreeTUMaxDepthInter must be less than or equal to the 
difference between log2(maxCUSize) and QuadtreeTULog2MinSize plus 1);
-
+CHECK((param-maxTUSize != 32  param-maxTUSize != 16  
param-maxTUSize != 8  param-maxTUSize != 4) || param-maxTUSize  
param-maxCUSize,
+  max TU size must be 4, 8, 16, or 32 and should be less than max CU 
size);
 CHECK(param-maxNumMergeCand  1, MaxNumMergeCand must be 1 or greater.);
 CHECK(param-maxNumMergeCand  5, MaxNumMergeCand must be 5 or smaller.);
 
@@ -1194,8 +1197,8 @@
 if (param-interlaceMode)
 x265_log(param, X265_LOG_INFO, Interlaced field inputs : 
%s\n, x265_interlace_names[param-interlaceMode]);
 
-x265_log(param, X265_LOG_INFO, CTU size / RQT depth inter / intra  : %d / 
%d / %d\n,
- param-maxCUSize, param-tuQTMaxInterDepth, 
param-tuQTMaxIntraDepth);
+x265_log(param, X265_LOG_INFO, CTU size / TU size / RQT depth inter / 
intra  : %d / %d / %d / %d\n,
+param-maxCUSize, param-maxTUSize, param-tuQTMaxInterDepth, 
param-tuQTMaxIntraDepth);
 
 x265_log(param, X265_LOG_INFO, ME / range / subpel / merge : %s / 
%d / %d / %d\n,
  x265_motion_est_names[param-searchMethod], param-searchRange, 
param-subpelRefine, param-maxNumMergeCand);
@@ -1291,6 +1294,7 @@
 s += sprintf(s,  bitdepth=%d, p-internalBitDepth);
 BOOL(p-bEnableWavefront, wpp);
 s += sprintf(s,  ctu=%d, p-maxCUSize);
+s += sprintf(s,  max-tu-size=%d, p-maxTUSize);
 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);
diff -r da3302cc67fb -r 3a32b6a482b3 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cppMon Feb 09 16:45:31 2015 -0600
+++ b/source/encoder/encoder.cppTue Feb 10 11:16:11 2015 +0530
@@ -1438,8 +1438,8 @@
 
 sps-log2MinCodingBlockSize = g_maxLog2CUSize - g_maxCUDepth;
 sps-log2DiffMaxMinCodingBlockSize = g_maxCUDepth;
-
-sps-quadtreeTULog2MaxSize = X265_MIN(g_maxLog2CUSize, 5);
+uint32_t maxLog2TUSize = (uint32_t)g_log2Size[m_param-maxTUSize];
+sps-quadtreeTULog2MaxSize = X265_MIN(g_maxLog2CUSize, maxLog2TUSize);
 sps-quadtreeTULog2MinSize = 2;
 sps-quadtreeTUMaxDepthInter = m_param-tuQTMaxInterDepth;
 sps-quadtreeTUMaxDepthIntra = m_param-tuQTMaxIntraDepth;
diff -r da3302cc67fb -r 3a32b6a482b3 source/x265.h
--- a/source/x265.h Mon Feb 09 16:45:31 2015 -0600
+++ b/source/x265.h Tue Feb 10 11:16:11 2015 +0530
@@ -507,6 +507,11 @@
  * compressed by the DCT transforms, at the expense of much more compute */
 uint32_t  tuQTMaxIntraDepth;
 
+/* Maxiumum TU width and height in pixels.  The size must be 32, 16, 8 or 
4.
+ * The larger the size the more efficiently the residual can be
+ * compressed by the DCT transforms, at the expense of huge computation */
+uint32_t  maxTUSize;
+
 /*== GOP Structure and Lokoahead ==*/
 
 /* Enable open GOP - meaning I slices are not necessariy IDR and thus 
frames
diff -r da3302cc67fb -r 3a32b6a482b3 source/x265cli.h
--- a/source/x265cli.h  Mon Feb 09 16:45:31 2015 -0600
+++ b/source/x265cli.h  Tue Feb 10 11:16:11 2015 +0530
@@ -71,6 +71,7 @@
 { no-wpp,   no_argument, NULL, 0 },
 { wpp,  no_argument, NULL, 0 },
 { ctu,required_argument, NULL, 's' },
+{ max-tu-size,required_argument, NULL, 's' },
 { tu-intra-depth, required_argument, NULL, 0 },
 { tu-inter-depth, required_argument, NULL, 0 },
 { me, required_argument, NULL, 0 },
@@ -264,6 +265,7 @@
 H0( psnr, ssim, grain

[x265] [PATCH] wrap getICRateNegDiff inside CHECKED_BUILD condition

2015-02-05 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekarsanthosh...@multicorewareinc.com
# Date 1423128708 -19800
#  Thu Feb 05 15:01:48 2015 +0530
# Node ID d7a8363cf1ba5187061b37ee25c89410aec2ba94
# Parent  cd4117a34a19a76d0462c9a644ecc728d8e1c0ee
wrap getICRateNegDiff inside CHECKED_BUILD condition

diff -r cd4117a34a19 -r d7a8363cf1ba source/common/quant.cpp
--- a/source/common/quant.cpp   Thu Feb 05 12:27:23 2015 +0530
+++ b/source/common/quant.cpp   Thu Feb 05 15:01:48 2015 +0530
@@ -104,6 +104,7 @@
 return rate;
 }
 
+#if CHECKED_BUILD || _DEBUG
 inline int getICRateNegDiff(uint32_t absLevel, const int* greaterOneBits, 
const int* levelAbsBits)
 {
 X265_CHECK(absLevel = 2, absLevel check failure\n);
@@ -117,6 +118,7 @@
 rate = greaterOneBits[0];
 return rate;
 }
+#endif
 
 inline int getICRateLessVlc(uint32_t absLevel, int32_t diffLevel, const 
uint32_t absGoRice)
 {
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] fix build error, add definition for getICRateNegDiff

2015-02-04 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekarsanthosh...@multicorewareinc.com
# Date 1423117093 -19800
#  Thu Feb 05 11:48:13 2015 +0530
# Node ID bd4febc33ccc0a51228bc4884c7a5287fea8fea8
# Parent  0e3ce940f2f416ba7252d98bea79fb9b8875b559
fix build error, add definition for getICRateNegDiff

diff -r 0e3ce940f2f4 -r bd4febc33ccc source/common/quant.cpp
--- a/source/common/quant.cpp   Wed Feb 04 18:54:10 2015 -0600
+++ b/source/common/quant.cpp   Thu Feb 05 11:48:13 2015 +0530
@@ -104,6 +104,20 @@
 return rate;
 }
 
+inline int getICRateNegDiff(uint32_t absLevel, const int* greaterOneBits, 
const int* levelAbsBits)
+{
+X265_CHECK(absLevel = 2, absLevel check failure\n);
+
+int rate;
+if (absLevel == 0)
+rate = 0;
+else if (absLevel == 2)
+rate = greaterOneBits[1] + levelAbsBits[0];
+else
+rate = greaterOneBits[0];
+return rate;
+}
+
 inline int getICRateLessVlc(uint32_t absLevel, int32_t diffLevel, const 
uint32_t absGoRice)
 {
 X265_CHECK(absGoRice = 4, absGoRice check failure\n);
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] pixelHarness: add testharness code for estimateCUPropagateCost

2015-01-29 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekarsanthosh...@multicorewareinc.com
# Date 1422440917 -19800
#  Wed Jan 28 15:58:37 2015 +0530
# Node ID 76c6b079e6b363d42073f09144e255d5ad1dc863
# Parent  5e5dc3763f6386da9722903033a2b9dd263a5226
pixelHarness: add testharness code for estimateCUPropagateCost

diff -r 5e5dc3763f63 -r 76c6b079e6b3 source/test/pixelharness.cpp
--- a/source/test/pixelharness.cpp  Thu Jan 29 10:37:54 2015 -0600
+++ b/source/test/pixelharness.cpp  Wed Jan 28 15:58:37 2015 +0530
@@ -1048,6 +1048,34 @@
 return true;
 }
 
+bool PixelHarness::check_cutree_propagate_cost(cutree_propagate_cost ref, 
cutree_propagate_cost opt)
+{
+ALIGN_VAR_16(int, ref_dest[64 * 64]);
+ALIGN_VAR_16(int, opt_dest[64 * 64]);
+
+memset(ref_dest, 0xCD, sizeof(ref_dest));
+memset(opt_dest, 0xCD, sizeof(opt_dest));
+
+double fps = 1.0;
+int width = 16 + rand() % 64;
+int j = 0;
+
+for (int i = 0; i  ITERS; i++)
+{
+int index = i % TEST_CASES;
+checked(opt, opt_dest, ushort_test_buff[index] + j, 
int_test_buff[index] + j, ushort_test_buff[index] + j, int_test_buff[index] + 
j, fps, width);
+ref(ref_dest, ushort_test_buff[index] + j, int_test_buff[index] + j, 
ushort_test_buff[index] + j, int_test_buff[index] + j, fps, width);
+
+if (memcmp(ref_dest, opt_dest, width * sizeof(pixel)))
+return false;
+
+reportfail();
+j += INCR;
+}
+
+return true;
+}
+
 bool PixelHarness::check_psyCost_pp(pixelcmp_t ref, pixelcmp_t opt)
 {
 int j = 0, index1, index2, optres, refres;
@@ -1608,6 +1636,15 @@
 }
 }
 
+if (opt.propagateCost)
+{
+if (!check_cutree_propagate_cost(ref.propagateCost, opt.propagateCost))
+{
+printf(propagateCost failed\n);
+return false;
+}
+}
+
 return true;
 }
 
@@ -1947,4 +1984,10 @@
 HEADER0(planecopy_cp);
 REPORT_SPEEDUP(opt.planecopy_cp, ref.planecopy_cp, uchar_test_buff[0], 
64, pbuf1, 64, 64, 64, 2);
 }
+
+if (opt.propagateCost)
+{
+HEADER0(propagateCost);
+REPORT_SPEEDUP(opt.propagateCost, ref.propagateCost, ibuf1, 
ushort_test_buff[0], int_test_buff[0], ushort_test_buff[0], int_test_buff[0], 
double_test_buff[0], 80);
+}
 }
diff -r 5e5dc3763f63 -r 76c6b079e6b3 source/test/pixelharness.h
--- a/source/test/pixelharness.hThu Jan 29 10:37:54 2015 -0600
+++ b/source/test/pixelharness.hWed Jan 28 15:58:37 2015 +0530
@@ -63,6 +63,7 @@
 int  int_test_buff[TEST_CASES][BUFFSIZE];
 uint16_t ushort_test_buff[TEST_CASES][BUFFSIZE];
 uint8_t  uchar_test_buff[TEST_CASES][BUFFSIZE];
+double  double_test_buff[TEST_CASES][BUFFSIZE];
 
 bool check_pixelcmp(pixelcmp_t ref, pixelcmp_t opt);
 bool check_pixelcmp_ss(pixelcmp_ss_t ref, pixelcmp_ss_t opt);
@@ -99,6 +100,7 @@
 bool check_saoCuOrgB0_t(saoCuOrgB0_t ref, saoCuOrgB0_t opt);
 bool check_planecopy_sp(planecopy_sp_t ref, planecopy_sp_t opt);
 bool check_planecopy_cp(planecopy_cp_t ref, planecopy_cp_t opt);
+bool check_cutree_propagate_cost(cutree_propagate_cost ref, 
cutree_propagate_cost opt);
 bool check_psyCost_pp(pixelcmp_t ref, pixelcmp_t opt);
 bool check_psyCost_ss(pixelcmp_ss_t ref, pixelcmp_ss_t opt);
 bool check_calSign(sign_t ref, sign_t opt);
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH 1 of 2] TComDataCU: replace getZorderIdxInCU() with encodeIdx of CU structure

2014-09-29 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar santhosh...@multicorewareinc.com
# Date 1411972892 -19800
#  Mon Sep 29 12:11:32 2014 +0530
# Node ID ed887d8ae5cd24b0c2317fb83b3c908be27e037a
# Parent  32f50df7fa7672f4c1818ddf3165b4bd243e0b10
TComDataCU: replace getZorderIdxInCU() with encodeIdx of CU structure

diff -r 32f50df7fa76 -r ed887d8ae5cd source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp  Fri Sep 26 17:33:09 2014 -0500
+++ b/source/Lib/TLibCommon/TComDataCU.cpp  Mon Sep 29 12:11:32 2014 +0530
@@ -387,16 +387,15 @@
 }
 
 // initialize Sub partition
-void TComDataCU::initSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth, int qp)
+void TComDataCU::initSubCU(TComDataCU* cu, CU* cuData, uint32_t partUnitIdx, 
uint32_t depth, int qp)
 {
 X265_CHECK(partUnitIdx  4, part unit should be less than 4\n);
 uint8_t log2CUSize = g_maxLog2CUSize - depth;
-uint32_t partOffset = (cu-getTotalNumPart()  2) * partUnitIdx;
 
 m_pic  = cu-m_pic;
 m_slice= cu-m_slice;
 m_cuAddr   = cu-getAddr();
-m_absIdxInLCU  = cu-getZorderIdxInCU() + partOffset;
+m_absIdxInLCU  = cuData-encodeIdx;
 
 m_cuPelX   = cu-getCUPelX() + ((partUnitIdx   1)  log2CUSize);
 m_cuPelY   = cu-getCUPelY() + ((partUnitIdx  1)  log2CUSize);
@@ -453,7 +452,7 @@
 m_cuAboveRight  = cu-getCUAboveRight();
 }
 
-void TComDataCU::copyToSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth)
+void TComDataCU::copyToSubCU(TComDataCU* cu, CU* cuData, uint32_t partUnitIdx, 
uint32_t depth)
 {
 X265_CHECK(partUnitIdx  4, part unit should be less than 4\n);
 
@@ -462,7 +461,7 @@
 m_pic  = cu-m_pic;
 m_slice= cu-m_slice;
 m_cuAddr   = cu-getAddr();
-m_absIdxInLCU  = cu-getZorderIdxInCU() + partOffset;
+m_absIdxInLCU  = cuData-encodeIdx + partOffset;
 
 m_cuPelX   = cu-getCUPelX() + ((partUnitIdx   1)  
(g_maxLog2CUSize - depth));
 m_cuPelY   = cu-getCUPelY() + ((partUnitIdx  1)  
(g_maxLog2CUSize - depth));
@@ -1067,9 +1066,9 @@
 }
 else
 {
-if (getZorderIdxInCU()  0)
+if (m_pic-getCU(m_cuAddr)-m_CULocalData-encodeIdx  0)
 {
-return m_pic-getCU(getAddr())-getLastCodedQP(getZorderIdxInCU());
+return 
m_pic-getCU(getAddr())-getLastCodedQP(m_pic-getCU(m_cuAddr)-m_CULocalData-encodeIdx);
 }
 else if (getAddr()  0  !(m_slice-m_pps-bEntropyCodingSyncEnabled 

 getAddr() % m_pic-getFrameWidthInCU() == 
0))
diff -r 32f50df7fa76 -r ed887d8ae5cd source/Lib/TLibCommon/TComDataCU.h
--- a/source/Lib/TLibCommon/TComDataCU.hFri Sep 26 17:33:09 2014 -0500
+++ b/source/Lib/TLibCommon/TComDataCU.hMon Sep 29 12:11:32 2014 +0530
@@ -273,9 +273,9 @@
 
 void  initCU(Frame* pic, uint32_t cuAddr);
 void  initEstData();
-void  initSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth, int qp);
+void  initSubCU(TComDataCU* cu, CU* cuData, uint32_t partUnitIdx, 
uint32_t depth, int qp);
 
-void  copyToSubCU(TComDataCU* lcu, uint32_t partUnitIdx, uint32_t 
depth);
+void  copyToSubCU(TComDataCU* lcu, CU* cuData, uint32_t 
partUnitIdx, uint32_t depth);
 void  copyPartFrom(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth, bool isRDObasedAnalysis = true);
 
 void  copyToPic(uint32_t depth);
@@ -288,8 +288,6 @@
 
 uint32_t getAddr(){ return m_cuAddr; }
 
-uint32_t getZorderIdxInCU()   { return m_absIdxInLCU; }
-
 uint32_t  getSCUAddr() const   { return (m_cuAddr  
g_maxFullDepth * 2) + m_absIdxInLCU; }
 
 
diff -r 32f50df7fa76 -r ed887d8ae5cd source/Lib/TLibCommon/TComPattern.cpp
--- a/source/Lib/TLibCommon/TComPattern.cpp Fri Sep 26 17:33:09 2014 -0500
+++ b/source/Lib/TLibCommon/TComPattern.cpp Mon Sep 29 12:11:32 2014 +0530
@@ -49,7 +49,7 @@
 // Public member functions (TComPattern)
 // 

 
-void TComPattern::initAdiPattern(TComDataCU* cu, uint32_t zOrderIdxInPart, 
uint32_t partDepth, pixel* adiBuf,
+void TComPattern::initAdiPattern(TComDataCU* cu, CU* cuData, uint32_t 
zOrderIdxInPart, uint32_t partDepth, pixel* adiBuf,
  pixel* refAbove, pixel* refLeft, pixel* 
refAboveFlt, pixel* refLeftFlt, int dirMode)
 {
 IntraNeighbors intraNeighbors;
@@ -58,7 +58,7 @@
 uint32_t tuSize = intraNeighbors.tuSize;
 uint32_t tuSize2 = tuSize  1;
 
-pixel* adiOrigin = cu-m_pic-getPicYuvRec()-getLumaAddr(cu-getAddr(), 
cu-getZorderIdxInCU() + zOrderIdxInPart);
+pixel* adiOrigin = cu-m_pic-getPicYuvRec()-getLumaAddr(cu-getAddr(), 
cuData-encodeIdx + zOrderIdxInPart);
 int picStride = cu-m_pic

Re: [x265] [PATCH] Changes for loadCTUData

2014-09-29 Thread Santhoshini Sekar
As of now offset can be removed from CU structure. We don't have any
planned optimization with it. If needed we can
add it later.

On Mon, Sep 29, 2014 at 4:11 PM, Deepthi Nandakumar 
deep...@multicorewareinc.com wrote:

 Ashok/Santhoshini - pls review. Does removing offsets affect any planned
 optimizations?

 On Sat, Sep 27, 2014 at 7:03 AM, dtyx...@gmail.com wrote:

 # HG changeset patch
 # User David T Yuen dtyx...@gmail.com
 # Date 1411781537 25200
 # Node ID 85098db291ae133981419868685358227b8b1437
 # Parent  4b18a27b52ac69a16805c2b455d4f891cdd4a057
 Changes for loadCTUData

 Replaced getDepthScanIdx() with table g_depthScanIdx
 Moved Analysis::loadCTUData to TComDataCU::loadCTUData since it only
 works with TComDataCU fields
 Replaced CU.offsets[2] with local variables in loadCTUData since that is
 the only place it was set and used
 minor changes to reduce the number of local variables in loadCTUData

 diff -r 4b18a27b52ac -r 85098db291ae source/Lib/TLibCommon/TComDataCU.cpp
 --- a/source/Lib/TLibCommon/TComDataCU.cpp  Fri Sep 26 10:48:07 2014
 +0530
 +++ b/source/Lib/TLibCommon/TComDataCU.cpp  Fri Sep 26 18:32:17 2014
 -0700
 @@ -2407,4 +2407,43 @@
  result.firstSignificanceMapContext = bIsLuma ? 21 : 12;
  }

 +void TComDataCU::loadCTUData(uint32_t maxCUSize)
 +{
 +// Initialize the coding blocks inside the CTB
 +for (uint32_t log2CUSize = g_log2Size[maxCUSize], rangeCUIdx = 0;
 log2CUSize = MIN_LOG2_CU_SIZE; log2CUSize--)
 +{
 +uint32_t blockSize  = 1  log2CUSize;
 +uint32_t sbWidth= 1  (g_log2Size[maxCUSize] - log2CUSize);
 +int32_t last_level_flag = log2CUSize == MIN_LOG2_CU_SIZE;
 +for (uint32_t sb_y = 0; sb_y  sbWidth; sb_y++)
 +{
 +for (uint32_t sb_x = 0; sb_x  sbWidth; sb_x++)
 +{
 +uint32_t depth_idx = g_depthScanIdx[sb_y][sb_x];
 +uint32_t cuIdx = rangeCUIdx + depth_idx;
 +uint32_t child_idx = rangeCUIdx + sbWidth * sbWidth +
 (depth_idx  2);
 +uint32_t px = m_cuPelX + sb_x * blockSize;
 +uint32_t py = m_cuPelY + sb_y * blockSize;
 +int32_t present_flag = px 
 m_pic-m_origPicYuv-m_picWidth  py  m_pic-m_origPicYuv-m_picHeight;
 +int32_t split_mandatory_flag = present_flag 
 !last_level_flag  (px + blockSize  m_pic-m_origPicYuv-m_picWidth || py
 + blockSize  m_pic-m_origPicYuv-m_picHeight);
 +
 +/* Offset of the luma CU in the X, Y direction in terms
 of pixels from the CTU origin */
 +uint32_t xOffset = (sb_x * blockSize)  3;
 +uint32_t yOffset = (sb_y * blockSize)  3;
 +
 +CU *cu = m_CULocalData + cuIdx;
 +cu-log2CUSize = log2CUSize;
 +cu-childIdx = child_idx;
 +cu-encodeIdx = g_depthScanIdx[yOffset][xOffset];
 +cu-flags = 0;
 +
 +CU_SET_FLAG(cu-flags, CU::PRESENT, present_flag);
 +CU_SET_FLAG(cu-flags, CU::SPLIT_MANDATORY | CU::SPLIT,
 split_mandatory_flag);
 +CU_SET_FLAG(cu-flags, CU::LEAF, last_level_flag);
 +}
 +}
 +rangeCUIdx += sbWidth * sbWidth;
 +}
 +}
 +
  //! \}
 diff -r 4b18a27b52ac -r 85098db291ae source/Lib/TLibCommon/TComDataCU.h
 --- a/source/Lib/TLibCommon/TComDataCU.hFri Sep 26 10:48:07 2014
 +0530
 +++ b/source/Lib/TLibCommon/TComDataCU.hFri Sep 26 18:32:17 2014
 -0700
 @@ -114,7 +114,6 @@
  uint32_t log2CUSize; // Log of the CU size.
  uint32_t childIdx;   // Index of the first child CU
  uint32_t encodeIdx;  // Encoding index of this CU in terms of 8x8
 blocks.
 -uint32_t offset[2];  // Offset of the luma CU in the X, Y direction
 in terms of pixels from the CTU origin
  uint32_t flags;  // CU flags.
  };

 @@ -274,6 +273,7 @@
  void  initCU(Frame* pic, uint32_t cuAddr);
  void  initEstData();
  void  initSubCU(TComDataCU* cu, uint32_t partUnitIdx,
 uint32_t depth, int qp);
 +void  loadCTUData(uint32_t maxCUSize);

  void  copyToSubCU(TComDataCU* lcu, uint32_t partUnitIdx,
 uint32_t depth);
  void  copyPartFrom(TComDataCU* cu, uint32_t partUnitIdx,
 uint32_t depth, bool isRDObasedAnalysis = true);
 diff -r 4b18a27b52ac -r 85098db291ae source/Lib/TLibCommon/TComRom.cpp
 --- a/source/Lib/TLibCommon/TComRom.cpp Fri Sep 26 10:48:07 2014 +0530
 +++ b/source/Lib/TLibCommon/TComRom.cpp Fri Sep 26 18:32:17 2014 -0700
 @@ -517,5 +517,18 @@
  {256, 64, 16, 4}
  };

 +/* g_depthScanIdx [y][x] */
 +const uint32_t g_depthScanIdx[8][8] =
 +{
 +{   0,   1,   4,   5,  16,  17,  20,  21,  },
 +{   2,   3,   6,   7,  18,  19,  22,  23,  },
 +{   8,   9,  12,  13,  24,  25,  28,  29,  },
 +{  10,  11,  14,  15,  26,  27,  30,  31,  },
 +{  32,  33,  36,  37,  48,  49,  52,  53,  },
 +{  34,  35,  38,  39,  50,  51,  54,  55,  },
 +{  40

[x265] [PATCH 0 of 2 ] TComDataCU: replace with more CU structure details

2014-09-29 Thread santhoshini

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


[x265] [PATCH 2 of 2] TComDataCU: replace getTotalNumPart() with CU structure details

2014-09-29 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar santhosh...@multicorewareinc.com
# Date 1412047862 -19800
#  Tue Sep 30 09:01:02 2014 +0530
# Node ID ecd15b4dfdeab9ddd16b11b1894aebfc66738c47
# Parent  21b1e8daa7e97e3828dfd948ff776951b939f423
TComDataCU: replace getTotalNumPart() with CU structure details

diff -r 21b1e8daa7e9 -r ecd15b4dfdea source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp  Tue Sep 30 08:52:56 2014 +0530
+++ b/source/Lib/TLibCommon/TComDataCU.cpp  Tue Sep 30 09:01:02 2014 +0530
@@ -409,7 +409,7 @@
 m_mvBits   = 0;
 m_coeffBits= 0;
 
-m_numPartitions= cu-getTotalNumPart()  2;
+m_numPartitions= cuData-numPartitions;
 
 for (int i = 0; i  4; i++)
 {
@@ -456,7 +456,7 @@
 {
 X265_CHECK(partUnitIdx  4, part unit should be less than 4\n);
 
-uint32_t partOffset = (cu-getTotalNumPart()  2) * partUnitIdx;
+uint32_t partOffset = cuData-numPartitions * partUnitIdx;
 
 m_pic  = cu-m_pic;
 m_slice= cu-m_slice;
@@ -474,7 +474,7 @@
 m_totalBits= 0;
 m_mvBits   = 0;
 m_coeffBits= 0;
-m_numPartitions= cu-getTotalNumPart()  2;
+m_numPartitions= cuData-numPartitions;
 
 TComDataCU* otherCU = m_pic-getCU(m_cuAddr);
 int sizeInChar  = sizeof(char) * m_numPartitions;
@@ -496,7 +496,7 @@
 
 // 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)
+void TComDataCU::copyPartFrom(TComDataCU* cu, CU* cuData, uint32_t 
partUnitIdx, uint32_t depth, bool isRDObasedAnalysis)
 {
 X265_CHECK(partUnitIdx  4, part unit should be less than 4\n);
 if (isRDObasedAnalysis)
@@ -511,8 +511,8 @@
 m_mvBits   += cu-m_mvBits;
 m_coeffBits+= cu-m_coeffBits;
 
-uint32_t offset   = cu-getTotalNumPart() * partUnitIdx;
-uint32_t numPartition = cu-getTotalNumPart();
+uint32_t offset   = cuData-numPartitions * partUnitIdx;
+uint32_t numPartition = cuData-numPartitions;
 int sizeInBool  = sizeof(bool) * numPartition;
 int sizeInChar  = sizeof(char) * numPartition;
 memcpy(m_skipFlag  + offset, cu-getSkipFlag(),   sizeof(*m_skipFlag)  
 * numPartition);
@@ -544,8 +544,8 @@
 m_cuAbove  = cu-getCUAbove();
 m_cuLeft   = cu-getCULeft();
 
-m_cuMvField[0].copyFrom(cu-getCUMvField(REF_PIC_LIST_0), 
cu-getTotalNumPart(), offset);
-m_cuMvField[1].copyFrom(cu-getCUMvField(REF_PIC_LIST_1), 
cu-getTotalNumPart(), offset);
+m_cuMvField[0].copyFrom(cu-getCUMvField(REF_PIC_LIST_0), 
cuData-numPartitions, offset);
+m_cuMvField[1].copyFrom(cu-getCUMvField(REF_PIC_LIST_1), 
cuData-numPartitions, offset);
 
 uint32_t tmp  = 1  ((g_maxLog2CUSize - depth) * 2);
 uint32_t tmp2 = partUnitIdx * tmp;
@@ -2435,6 +2435,7 @@
 cu-childIdx = child_idx;
 cu-encodeIdx = g_depthScanIdx[yOffset][xOffset] * 4;
 cu-flags = 0;
+cu-numPartitions = (NUM_CU_PARTITIONS  ((g_maxLog2CUSize - 
cu-log2CUSize) * 2));
 
 CU_SET_FLAG(cu-flags, CU::PRESENT, present_flag);
 CU_SET_FLAG(cu-flags, CU::SPLIT_MANDATORY | CU::SPLIT, 
split_mandatory_flag);
diff -r 21b1e8daa7e9 -r ecd15b4dfdea source/Lib/TLibCommon/TComDataCU.h
--- a/source/Lib/TLibCommon/TComDataCU.hTue Sep 30 08:52:56 2014 +0530
+++ b/source/Lib/TLibCommon/TComDataCU.hTue Sep 30 09:01:02 2014 +0530
@@ -115,6 +115,7 @@
 uint32_t childIdx;   // Index of the first child CU
 uint32_t encodeIdx;  // Encoding index of this CU in terms of 8x8 blocks.
 uint32_t flags;  // CU flags.
+uint32_t numPartitions;// Number of 4x4 blocks in the CU
 };
 
 // Partition count table, index represents partitioning mode.
@@ -276,7 +277,7 @@
 void  loadCTUData(uint32_t maxCUSize);
 
 void  copyToSubCU(TComDataCU* lcu, CU* cuData, uint32_t 
partUnitIdx, uint32_t depth);
-void  copyPartFrom(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth, bool isRDObasedAnalysis = true);
+void  copyPartFrom(TComDataCU* cu, CU* cuData, uint32_t 
partUnitIdx, uint32_t depth, bool isRDObasedAnalysis = true);
 
 void  copyToPic(uint32_t depth);
 void  copyToPic(uint32_t depth, uint32_t partIdx, uint32_t 
partDepth);
@@ -510,8 +511,6 @@
 // member functions for RD cost storage
 // 
---
 
-uint32_t getTotalNumPart() { return m_numPartitions; }
-
 ScanType  getCoefScanIdx(uint32_t absPartIdx, uint32_t log2TrSize, 
bool bIsLuma, bool bIsIntra);
 void  getTUEntropyCodingParameters(TUEntropyCodingParameters 
result, uint32_t absPartIdx, uint32_t log2TrSize, bool bIsLuma

[x265] [PATCH] TComDataCU: replace getTotalNumPart() with CU structure details

2014-09-26 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar santhosh...@multicorewareinc.com
# Date 1411724066 -19800
#  Fri Sep 26 15:04:26 2014 +0530
# Node ID cfa8a52f704e3e56e7327dc90316ad19b405b499
# Parent  76afa140c7ed50065c52d52101c19526aad0acd1
TComDataCU: replace getTotalNumPart() with CU structure details

diff -r 76afa140c7ed -r cfa8a52f704e source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp  Thu Sep 25 15:24:16 2014 +0530
+++ b/source/Lib/TLibCommon/TComDataCU.cpp  Fri Sep 26 15:04:26 2014 +0530
@@ -409,7 +409,7 @@
 m_mvBits   = 0;
 m_coeffBits= 0;
 
-m_numPartitions= cu-getTotalNumPart()  2;
+m_numPartitions= (NUM_CU_PARTITIONS  ((g_log2Size[g_maxCUSize] - 
cuData-log2CUSize) * 2));
 
 for (int i = 0; i  4; i++)
 {
@@ -456,7 +456,7 @@
 {
 X265_CHECK(partUnitIdx  4, part unit should be less than 4\n);
 
-uint32_t partOffset = (cu-getTotalNumPart()  2) * partUnitIdx;
+uint32_t partOffset = ((NUM_CU_PARTITIONS  ((g_log2Size[g_maxCUSize] - 
cuData-log2CUSize) * 2))) * partUnitIdx;
 
 m_pic  = cu-m_pic;
 m_slice= cu-m_slice;
@@ -474,7 +474,7 @@
 m_totalBits= 0;
 m_mvBits   = 0;
 m_coeffBits= 0;
-m_numPartitions= cu-getTotalNumPart()  2;
+m_numPartitions= (NUM_CU_PARTITIONS  ((g_log2Size[g_maxCUSize] - 
cuData-log2CUSize) * 2));
 
 TComDataCU* otherCU = m_pic-getCU(m_cuAddr);
 int sizeInChar  = sizeof(char) * m_numPartitions;
@@ -496,7 +496,7 @@
 
 // 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)
+void TComDataCU::copyPartFrom(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth, CU* cuData, bool isRDObasedAnalysis)
 {
 X265_CHECK(partUnitIdx  4, part unit should be less than 4\n);
 if (isRDObasedAnalysis)
@@ -511,8 +511,8 @@
 m_mvBits   += cu-m_mvBits;
 m_coeffBits+= cu-m_coeffBits;
 
-uint32_t offset   = cu-getTotalNumPart() * partUnitIdx;
-uint32_t numPartition = cu-getTotalNumPart();
+uint32_t offset   = (NUM_CU_PARTITIONS  ((g_log2Size[g_maxCUSize] - 
cuData-log2CUSize) * 2)) * partUnitIdx;
+uint32_t numPartition = (NUM_CU_PARTITIONS  ((g_log2Size[g_maxCUSize] - 
cuData-log2CUSize) * 2));
 int sizeInBool  = sizeof(bool) * numPartition;
 int sizeInChar  = sizeof(char) * numPartition;
 memcpy(m_skipFlag  + offset, cu-getSkipFlag(),   sizeof(*m_skipFlag)  
 * numPartition);
@@ -544,8 +544,8 @@
 m_cuAbove  = cu-getCUAbove();
 m_cuLeft   = cu-getCULeft();
 
-m_cuMvField[0].copyFrom(cu-getCUMvField(REF_PIC_LIST_0), 
cu-getTotalNumPart(), offset);
-m_cuMvField[1].copyFrom(cu-getCUMvField(REF_PIC_LIST_1), 
cu-getTotalNumPart(), offset);
+m_cuMvField[0].copyFrom(cu-getCUMvField(REF_PIC_LIST_0), 
(NUM_CU_PARTITIONS  ((g_log2Size[g_maxCUSize] - cuData-log2CUSize) * 2)), 
offset);
+m_cuMvField[1].copyFrom(cu-getCUMvField(REF_PIC_LIST_1), 
(NUM_CU_PARTITIONS  ((g_log2Size[g_maxCUSize] - cuData-log2CUSize) * 2)), 
offset);
 
 uint32_t tmp  = 1  ((g_maxLog2CUSize - depth) * 2);
 uint32_t tmp2 = partUnitIdx * tmp;
diff -r 76afa140c7ed -r cfa8a52f704e source/Lib/TLibCommon/TComDataCU.h
--- a/source/Lib/TLibCommon/TComDataCU.hThu Sep 25 15:24:16 2014 +0530
+++ b/source/Lib/TLibCommon/TComDataCU.hFri Sep 26 15:04:26 2014 +0530
@@ -276,7 +276,7 @@
 void  initSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth, int qp, CU* cuData);
 
 void  copyToSubCU(TComDataCU* lcu, uint32_t partUnitIdx, uint32_t 
depth, CU* cuData);
-void  copyPartFrom(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth, bool isRDObasedAnalysis = true);
+void  copyPartFrom(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth, CU* cuData, bool isRDObasedAnalysis = true);
 
 void  copyToPic(uint32_t depth);
 void  copyToPic(uint32_t depth, uint32_t partIdx, uint32_t 
partDepth);
@@ -510,8 +510,6 @@
 // member functions for RD cost storage
 // 
---
 
-uint32_t getTotalNumPart() { return m_numPartitions; }
-
 ScanType  getCoefScanIdx(uint32_t absPartIdx, uint32_t log2TrSize, 
bool bIsLuma, bool bIsIntra);
 void  getTUEntropyCodingParameters(TUEntropyCodingParameters 
result, uint32_t absPartIdx, uint32_t log2TrSize, bool bIsLuma);
 
diff -r 76afa140c7ed -r cfa8a52f704e source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp   Thu Sep 25 15:24:16 2014 +0530
+++ b/source/encoder/analysis.cpp   Fri Sep 26 15:04:26 2014 +0530
@@ -310,7 +310,7 @@
 m_tempCU[0]-initCU(pic, cuAddr);
 
 // analysis of CU
-uint32_t numPartition = cu

[x265] [PATCH] remove getNumPartInCU() and replace it with macro

2014-09-25 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar santhosh...@multicorewareinc.com
# Date 1411638856 -19800
#  Thu Sep 25 15:24:16 2014 +0530
# Node ID e26ef0404b0042d9f46c18002197fdbce6b19601
# Parent  cb114b17a30e8dc12eb9a14ce5ae7d155398e1c5
remove getNumPartInCU() and replace it with macro

diff -r cb114b17a30e -r e26ef0404b00 source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp  Thu Sep 25 13:52:58 2014 +0530
+++ b/source/Lib/TLibCommon/TComDataCU.cpp  Thu Sep 25 15:24:16 2014 +0530
@@ -320,7 +320,7 @@
 m_totalBits= 0;
 m_mvBits   = 0;
 m_coeffBits= 0;
-m_numPartitions= pic-getNumPartInCU();
+m_numPartitions= NUM_CU_PARTITIONS;
 char* qp   = pic-getCU(getAddr())-getQP();
 m_baseQp   = pic-getCU(getAddr())-m_baseQp;
 for (int i = 0; i  4; i++)
@@ -771,7 +771,7 @@
 if (planarAtLCUBoundary)
 return NULL;
 
-aPartUnitIdx = g_rasterToZscan[absPartIdx + m_pic-getNumPartInCU() - 
numPartInCUSize];
+aPartUnitIdx = g_rasterToZscan[absPartIdx + NUM_CU_PARTITIONS - 
numPartInCUSize];
 return m_cuAbove;
 }
 
@@ -796,7 +796,7 @@
 return this;
 }
 }
-alPartUnitIdx = g_rasterToZscan[absPartIdx + m_pic-getNumPartInCU() - 
numPartInCUSize - 1];
+alPartUnitIdx = g_rasterToZscan[absPartIdx + NUM_CU_PARTITIONS - 
numPartInCUSize - 1];
 return m_cuAbove;
 }
 
@@ -806,7 +806,7 @@
 return m_cuLeft;
 }
 
-alPartUnitIdx = g_rasterToZscan[m_pic-getNumPartInCU() - 1];
+alPartUnitIdx = g_rasterToZscan[NUM_CU_PARTITIONS - 1];
 return m_cuAboveLeft;
 }
 
@@ -838,7 +838,7 @@
 }
 return NULL;
 }
-arPartUnitIdx = g_rasterToZscan[absPartIdxRT + m_pic-getNumPartInCU() 
- numPartInCUSize + 1];
+arPartUnitIdx = g_rasterToZscan[absPartIdxRT + NUM_CU_PARTITIONS - 
numPartInCUSize + 1];
 return m_cuAbove;
 }
 
@@ -847,7 +847,7 @@
 return NULL;
 }
 
-arPartUnitIdx = g_rasterToZscan[m_pic-getNumPartInCU() - numPartInCUSize];
+arPartUnitIdx = g_rasterToZscan[NUM_CU_PARTITIONS - numPartInCUSize];
 return m_cuAboveRight;
 }
 
@@ -959,7 +959,7 @@
 }
 return NULL;
 }
-arPartUnitIdx = g_rasterToZscan[absPartIdxRT + m_pic-getNumPartInCU() 
- numPartInCUSize + partUnitOffset];
+arPartUnitIdx = g_rasterToZscan[absPartIdxRT + NUM_CU_PARTITIONS - 
numPartInCUSize + partUnitOffset];
 if (m_cuAbove == NULL || m_cuAbove-m_slice == NULL)
 {
 return NULL;
@@ -972,7 +972,7 @@
 return NULL;
 }
 
-arPartUnitIdx = g_rasterToZscan[m_pic-getNumPartInCU() - numPartInCUSize 
+ partUnitOffset - 1];
+arPartUnitIdx = g_rasterToZscan[NUM_CU_PARTITIONS - numPartInCUSize + 
partUnitOffset - 1];
 if ((m_cuAboveRight == NULL || m_cuAboveRight-m_slice == NULL ||
  (m_cuAboveRight-getAddr())  getAddr()))
 {
@@ -1073,7 +1073,7 @@
 else if (getAddr()  0  !(m_slice-m_pps-bEntropyCodingSyncEnabled 

 getAddr() % m_pic-getFrameWidthInCU() == 
0))
 {
-return m_pic-getCU(getAddr() - 
1)-getLastCodedQP(m_pic-getNumPartInCU());
+return m_pic-getCU(getAddr() - 
1)-getLastCodedQP(NUM_CU_PARTITIONS);
 }
 else
 {
@@ -1213,7 +1213,7 @@
 
 void TComDataCU::clearCbf(uint32_t absPartIdx, uint32_t depth)
 {
-uint32_t curPartNum = m_pic-getNumPartInCU()  (depth  1);
+uint32_t curPartNum = NUM_CU_PARTITIONS  (depth  1);
 
 memset(m_cbf[0] + absPartIdx, 0, sizeof(uint8_t) * curPartNum);
 memset(m_cbf[1] + absPartIdx, 0, sizeof(uint8_t) * curPartNum);
@@ -1222,7 +1222,7 @@
 
 void TComDataCU::setCbfSubParts(uint32_t cbf, TextType ttype, uint32_t 
absPartIdx, uint32_t depth)
 {
-uint32_t curPartNum = m_pic-getNumPartInCU()  (depth  1);
+uint32_t curPartNum = NUM_CU_PARTITIONS  (depth  1);
 
 memset(m_cbf[ttype] + absPartIdx, cbf, sizeof(uint8_t) * curPartNum);
 }
@@ -1235,14 +1235,14 @@
 void TComDataCU::setDepthSubParts(uint32_t depth)
 {
 /*All 4x4 partitions in current CU have the CU depth saved*/
-uint32_t curPartNum = m_pic-getNumPartInCU()  (depth  1);
+uint32_t curPartNum = NUM_CU_PARTITIONS  (depth  1);
 
 memset(m_depth, depth, sizeof(uint8_t) * curPartNum);
 }
 
 bool TComDataCU::isFirstAbsZorderIdxInDepth(uint32_t absPartIdx, uint32_t 
depth)
 {
-uint32_t curPartNum = m_pic-getNumPartInCU()  (depth  1);
+uint32_t curPartNum = NUM_CU_PARTITIONS  (depth  1);
 
 return ((m_absIdxInLCU + absPartIdx)  (curPartNum - 1)) == 0;
 }
@@ -1250,29 +1250,29 @@
 void TComDataCU::setPartSizeSubParts(PartSize mode, uint32_t absPartIdx, 
uint32_t depth)
 {
 X265_CHECK(sizeof(*m_partSizes) == 1, size check failure\n);
-memset(m_partSizes + absPartIdx, mode, m_pic-getNumPartInCU()  (depth 
 1));
+memset(m_partSizes + absPartIdx

[x265] [PATCH] TComDataCU: replace getZorderIdxInCU() with encodeIdx of CU structure

2014-09-23 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar santhosh...@multicorewareinc.com
# Date 1411536271 -19800
#  Wed Sep 24 10:54:31 2014 +0530
# Node ID ff25a31de887f76b83bc49814464f036dd80579f
# Parent  e2b577330c9b66ae7a41c62773df95fa0e38cd11
TComDataCU: replace getZorderIdxInCU() with encodeIdx of CU structure

diff -r e2b577330c9b -r ff25a31de887 source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp  Tue Sep 23 18:32:53 2014 +0530
+++ b/source/Lib/TLibCommon/TComDataCU.cpp  Wed Sep 24 10:54:31 2014 +0530
@@ -387,16 +387,15 @@
 }
 
 // initialize Sub partition
-void TComDataCU::initSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth, int qp)
+void TComDataCU::initSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth, int qp, CU* cuData)
 {
 X265_CHECK(partUnitIdx  4, part unit should be less than 4\n);
 uint8_t log2CUSize = g_maxLog2CUSize - depth;
-uint32_t partOffset = (cu-getTotalNumPart()  2) * partUnitIdx;
 
 m_pic  = cu-m_pic;
 m_slice= cu-m_slice;
 m_cuAddr   = cu-getAddr();
-m_absIdxInLCU  = cu-getZorderIdxInCU() + partOffset;
+m_absIdxInLCU  = cuData-encodeIdx * 4;
 
 m_cuPelX   = cu-getCUPelX() + ((partUnitIdx   1)  log2CUSize);
 m_cuPelY   = cu-getCUPelY() + ((partUnitIdx  1)  log2CUSize);
@@ -453,7 +452,7 @@
 m_cuAboveRight  = cu-getCUAboveRight();
 }
 
-void TComDataCU::copyToSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth)
+void TComDataCU::copyToSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth, CU* cuData)
 {
 X265_CHECK(partUnitIdx  4, part unit should be less than 4\n);
 
@@ -462,7 +461,7 @@
 m_pic  = cu-m_pic;
 m_slice= cu-m_slice;
 m_cuAddr   = cu-getAddr();
-m_absIdxInLCU  = cu-getZorderIdxInCU() + partOffset;
+m_absIdxInLCU  = cuData-encodeIdx * 4 + partOffset;
 
 m_cuPelX   = cu-getCUPelX() + ((partUnitIdx   1)  
(g_maxLog2CUSize - depth));
 m_cuPelY   = cu-getCUPelY() + ((partUnitIdx  1)  
(g_maxLog2CUSize - depth));
@@ -1067,9 +1066,9 @@
 }
 else
 {
-if (getZorderIdxInCU()  0)
+if (m_CULocalData-encodeIdx *4  0)
 {
-return m_pic-getCU(getAddr())-getLastCodedQP(getZorderIdxInCU());
+return 
m_pic-getCU(getAddr())-getLastCodedQP(m_CULocalData-encodeIdx *4);
 }
 else if (getAddr()  0  !(m_slice-m_pps-bEntropyCodingSyncEnabled 

 getAddr() % m_pic-getFrameWidthInCU() == 
0))
diff -r e2b577330c9b -r ff25a31de887 source/Lib/TLibCommon/TComDataCU.h
--- a/source/Lib/TLibCommon/TComDataCU.hTue Sep 23 18:32:53 2014 +0530
+++ b/source/Lib/TLibCommon/TComDataCU.hWed Sep 24 10:54:31 2014 +0530
@@ -273,9 +273,9 @@
 
 void  initCU(Frame* pic, uint32_t cuAddr);
 void  initEstData();
-void  initSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth, int qp);
+void  initSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth, int qp, CU* cuData);
 
-void  copyToSubCU(TComDataCU* lcu, uint32_t partUnitIdx, uint32_t 
depth);
+void  copyToSubCU(TComDataCU* lcu, uint32_t partUnitIdx, uint32_t 
depth, CU* cuData);
 void  copyPartFrom(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth, bool isRDObasedAnalysis = true);
 
 void  copyToPic(uint32_t depth);
@@ -288,8 +288,6 @@
 
 uint32_t getAddr(){ return m_cuAddr; }
 
-uint32_t getZorderIdxInCU()   { return m_absIdxInLCU; }
-
 uint32_t  getSCUAddr() const   { return (m_cuAddr  
g_maxFullDepth * 2) + m_absIdxInLCU; }
 
 
diff -r e2b577330c9b -r ff25a31de887 source/Lib/TLibCommon/TComPattern.cpp
--- a/source/Lib/TLibCommon/TComPattern.cpp Tue Sep 23 18:32:53 2014 +0530
+++ b/source/Lib/TLibCommon/TComPattern.cpp Wed Sep 24 10:54:31 2014 +0530
@@ -50,7 +50,7 @@
 // 

 
 void TComPattern::initAdiPattern(TComDataCU* cu, uint32_t zOrderIdxInPart, 
uint32_t partDepth, pixel* adiBuf,
- pixel* refAbove, pixel* refLeft, pixel* 
refAboveFlt, pixel* refLeftFlt, int dirMode)
+ pixel* refAbove, pixel* refLeft, pixel* 
refAboveFlt, pixel* refLeftFlt, int dirMode, CU* cuData)
 {
 IntraNeighbors intraNeighbors;
 
@@ -58,7 +58,7 @@
 uint32_t tuSize = intraNeighbors.tuSize;
 uint32_t tuSize2 = tuSize  1;
 
-pixel* adiOrigin = cu-m_pic-getPicYuvRec()-getLumaAddr(cu-getAddr(), 
cu-getZorderIdxInCU() + zOrderIdxInPart);
+pixel* adiOrigin = cu-m_pic-getPicYuvRec()-getLumaAddr(cu-getAddr(), 
cuData-encodeIdx * 4 + zOrderIdxInPart);
 int picStride = cu-m_pic-getStride();
 
 fillReferenceSamples(adiOrigin

[x265] [PATCH] TComDataCU: replace getTotalNumPart() with CU structure details

2014-09-22 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar santhosh...@multicorewareinc.com
# Date 1411367210 -19800
#  Mon Sep 22 11:56:50 2014 +0530
# Node ID bf25db39d728311be4fd04208aeff907c386e5d5
# Parent  504d00cf9a1f97740e5372ee003a78f89824490c
TComDataCU: replace getTotalNumPart() with CU structure details

diff -r 504d00cf9a1f -r bf25db39d728 source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp  Mon Sep 22 10:52:58 2014 +0530
+++ b/source/Lib/TLibCommon/TComDataCU.cpp  Mon Sep 22 11:56:50 2014 +0530
@@ -391,7 +391,7 @@
 {
 X265_CHECK(partUnitIdx  4, part unit should be less than 4\n);
 uint8_t log2CUSize = g_maxLog2CUSize - depth;
-uint32_t partOffset = (cu-getTotalNumPart()  2) * partUnitIdx;
+uint32_t partOffset = ( (256  ((g_log2Size[g_maxCUSize] - 
cuData-log2CUSize) * 2))  2) * partUnitIdx;
 
 m_pic  = cu-m_pic;
 m_slice= cu-m_slice;
@@ -410,7 +410,7 @@
 m_mvBits   = 0;
 m_coeffBits= 0;
 
-m_numPartitions= cu-getTotalNumPart()  2;
+m_numPartitions= (256  ((g_log2Size[g_maxCUSize] - 
cuData-log2CUSize) * 2))  2;
 
 for (int i = 0; i  4; i++)
 {
@@ -457,7 +457,7 @@
 {
 X265_CHECK(partUnitIdx  4, part unit should be less than 4\n);
 
-uint32_t partOffset = (cu-getTotalNumPart()  2) * partUnitIdx;
+uint32_t partOffset = ((256  ((g_log2Size[g_maxCUSize] - 
cuData-log2CUSize) * 2))  2) * partUnitIdx;
 
 m_pic  = cu-m_pic;
 m_slice= cu-m_slice;
@@ -475,7 +475,7 @@
 m_totalBits= 0;
 m_mvBits   = 0;
 m_coeffBits= 0;
-m_numPartitions= cu-getTotalNumPart()  2;
+m_numPartitions= (256  ((g_log2Size[g_maxCUSize] - 
cuData-log2CUSize) * 2))  2;
 
 TComDataCU* otherCU = m_pic-getCU(m_cuAddr);
 int sizeInChar  = sizeof(char) * m_numPartitions;
@@ -497,7 +497,7 @@
 
 // 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)
+void TComDataCU::copyPartFrom(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth, CU* cuData, bool isRDObasedAnalysis)
 {
 X265_CHECK(partUnitIdx  4, part unit should be less than 4\n);
 if (isRDObasedAnalysis)
@@ -512,8 +512,8 @@
 m_mvBits   += cu-m_mvBits;
 m_coeffBits+= cu-m_coeffBits;
 
-uint32_t offset   = cu-getTotalNumPart() * partUnitIdx;
-uint32_t numPartition = cu-getTotalNumPart();
+uint32_t offset   = (256  ((g_log2Size[g_maxCUSize] - 
cuData-log2CUSize) * 2)) * partUnitIdx;
+uint32_t numPartition = (256  ((g_log2Size[g_maxCUSize] - 
cuData-log2CUSize) * 2));
 int sizeInBool  = sizeof(bool) * numPartition;
 int sizeInChar  = sizeof(char) * numPartition;
 memcpy(m_skipFlag  + offset, cu-getSkipFlag(),   sizeof(*m_skipFlag)  
 * numPartition);
@@ -545,8 +545,8 @@
 m_cuAbove  = cu-getCUAbove();
 m_cuLeft   = cu-getCULeft();
 
-m_cuMvField[0].copyFrom(cu-getCUMvField(REF_PIC_LIST_0), 
cu-getTotalNumPart(), offset);
-m_cuMvField[1].copyFrom(cu-getCUMvField(REF_PIC_LIST_1), 
cu-getTotalNumPart(), offset);
+m_cuMvField[0].copyFrom(cu-getCUMvField(REF_PIC_LIST_0), (256  
((g_log2Size[g_maxCUSize] - cuData-log2CUSize) * 2)), offset);
+m_cuMvField[1].copyFrom(cu-getCUMvField(REF_PIC_LIST_1), (256  
((g_log2Size[g_maxCUSize] - cuData-log2CUSize) * 2)), offset);
 
 uint32_t tmp  = 1  ((g_maxLog2CUSize - depth) * 2);
 uint32_t tmp2 = partUnitIdx * tmp;
diff -r 504d00cf9a1f -r bf25db39d728 source/Lib/TLibCommon/TComDataCU.h
--- a/source/Lib/TLibCommon/TComDataCU.hMon Sep 22 10:52:58 2014 +0530
+++ b/source/Lib/TLibCommon/TComDataCU.hMon Sep 22 11:56:50 2014 +0530
@@ -276,7 +276,7 @@
 void  initSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth, int qp, CU* cuData);
 
 void  copyToSubCU(TComDataCU* lcu, uint32_t partUnitIdx, uint32_t 
depth, CU* cuData);
-void  copyPartFrom(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth, bool isRDObasedAnalysis = true);
+void  copyPartFrom(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth, CU* cuData, bool isRDObasedAnalysis = true);
 
 void  copyToPic(uint32_t depth);
 void  copyToPic(uint32_t depth, uint32_t partIdx, uint32_t 
partDepth);
@@ -510,8 +510,6 @@
 // member functions for RD cost storage
 // 
---
 
-uint32_t getTotalNumPart() { return m_numPartitions; }
-
 ScanType  getCoefScanIdx(uint32_t absPartIdx, uint32_t log2TrSize, 
bool bIsLuma, bool bIsIntra);
 void  getTUEntropyCodingParameters(TUEntropyCodingParameters 
result, uint32_t absPartIdx, uint32_t log2TrSize, bool bIsLuma);
 
diff -r 504d00cf9a1f -r

[x265] [PATCH] TComDataCU: replace getZorderIdxInCU() with encodeIdx of CU structure

2014-09-21 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar santhosh...@multicorewareinc.com
# Date 1411356953 -19800
#  Mon Sep 22 09:05:53 2014 +0530
# Node ID f70fd79cb3e1a0cb60b1c7ea5aac9a52922703c3
# Parent  c8f53398f8ceb9e536c2f1569fe4a2a2756aa014
TComDataCU: replace getZorderIdxInCU() with encodeIdx of CU structure

diff -r c8f53398f8ce -r f70fd79cb3e1 source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp  Sat Sep 20 15:41:08 2014 +0100
+++ b/source/Lib/TLibCommon/TComDataCU.cpp  Mon Sep 22 09:05:53 2014 +0530
@@ -387,7 +387,7 @@
 }
 
 // initialize Sub partition
-void TComDataCU::initSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth, int qp)
+void TComDataCU::initSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth, int qp, CU* cuData)
 {
 X265_CHECK(partUnitIdx  4, part unit should be less than 4\n);
 uint8_t log2CUSize = g_maxLog2CUSize - depth;
@@ -396,7 +396,7 @@
 m_pic  = cu-m_pic;
 m_slice= cu-m_slice;
 m_cuAddr   = cu-getAddr();
-m_absIdxInLCU  = cu-getZorderIdxInCU() + partOffset;
+m_absIdxInLCU  = cuData-encodeIdx * 4 + partOffset;
 
 m_cuPelX   = cu-getCUPelX() + ((partUnitIdx   1)  log2CUSize);
 m_cuPelY   = cu-getCUPelY() + ((partUnitIdx  1)  log2CUSize);
@@ -453,7 +453,7 @@
 m_cuAboveRight  = cu-getCUAboveRight();
 }
 
-void TComDataCU::copyToSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth)
+void TComDataCU::copyToSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth, CU* cuData)
 {
 X265_CHECK(partUnitIdx  4, part unit should be less than 4\n);
 
@@ -462,7 +462,7 @@
 m_pic  = cu-m_pic;
 m_slice= cu-m_slice;
 m_cuAddr   = cu-getAddr();
-m_absIdxInLCU  = cu-getZorderIdxInCU() + partOffset;
+m_absIdxInLCU  = cuData-encodeIdx * 4 + partOffset;
 
 m_cuPelX   = cu-getCUPelX() + ((partUnitIdx   1)  
(g_maxLog2CUSize - depth));
 m_cuPelY   = cu-getCUPelY() + ((partUnitIdx  1)  
(g_maxLog2CUSize - depth));
@@ -1067,9 +1067,9 @@
 }
 else
 {
-if (getZorderIdxInCU()  0)
+if (m_CULocalData-encodeIdx *4  0)
 {
-return m_pic-getCU(getAddr())-getLastCodedQP(getZorderIdxInCU());
+return 
m_pic-getCU(getAddr())-getLastCodedQP(m_CULocalData-encodeIdx *4);
 }
 else if (getAddr()  0  !(m_slice-m_pps-bEntropyCodingSyncEnabled 

 getAddr() % m_pic-getFrameWidthInCU() == 
0))
diff -r c8f53398f8ce -r f70fd79cb3e1 source/Lib/TLibCommon/TComDataCU.h
--- a/source/Lib/TLibCommon/TComDataCU.hSat Sep 20 15:41:08 2014 +0100
+++ b/source/Lib/TLibCommon/TComDataCU.hMon Sep 22 09:05:53 2014 +0530
@@ -273,9 +273,9 @@
 
 void  initCU(Frame* pic, uint32_t cuAddr);
 void  initEstData();
-void  initSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth, int qp);
+void  initSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth, int qp, CU* cuData);
 
-void  copyToSubCU(TComDataCU* lcu, uint32_t partUnitIdx, uint32_t 
depth);
+void  copyToSubCU(TComDataCU* lcu, uint32_t partUnitIdx, uint32_t 
depth, CU* cuData);
 void  copyPartFrom(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth, bool isRDObasedAnalysis = true);
 
 void  copyToPic(uint32_t depth);
@@ -288,8 +288,6 @@
 
 uint32_t getAddr(){ return m_cuAddr; }
 
-uint32_t getZorderIdxInCU()   { return m_absIdxInLCU; }
-
 uint32_t  getSCUAddr() const   { return (m_cuAddr  
g_maxFullDepth * 2) + m_absIdxInLCU; }
 
 
diff -r c8f53398f8ce -r f70fd79cb3e1 source/Lib/TLibCommon/TComPattern.cpp
--- a/source/Lib/TLibCommon/TComPattern.cpp Sat Sep 20 15:41:08 2014 +0100
+++ b/source/Lib/TLibCommon/TComPattern.cpp Mon Sep 22 09:05:53 2014 +0530
@@ -50,7 +50,7 @@
 // 

 
 void TComPattern::initAdiPattern(TComDataCU* cu, uint32_t zOrderIdxInPart, 
uint32_t partDepth, pixel* adiBuf,
- pixel* refAbove, pixel* refLeft, pixel* 
refAboveFlt, pixel* refLeftFlt, int dirMode)
+ pixel* refAbove, pixel* refLeft, pixel* 
refAboveFlt, pixel* refLeftFlt, int dirMode, CU* cuData)
 {
 pixel* roiOrigin;
 pixel* adiTemp;
@@ -63,7 +63,7 @@
 uint32_t tuSize = intraNeighbors.tuSize;
 uint32_t tuSize2 = tuSize  1;
 
-roiOrigin = cu-m_pic-getPicYuvRec()-getLumaAddr(cu-getAddr(), 
cu-getZorderIdxInCU() + zOrderIdxInPart);
+roiOrigin = cu-m_pic-getPicYuvRec()-getLumaAddr(cu-getAddr(), 
cuData-encodeIdx * 4 + zOrderIdxInPart);
 adiTemp   = adiBuf;
 
 fillReferenceSamples(roiOrigin, picStride, adiTemp, intraNeighbors);
@@ -163,7 +163,7

[x265] [PATCH] remove getNumPartInCU() and replace it with macro

2014-09-21 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar santhosh...@multicorewareinc.com
# Date 1411359719 -19800
#  Mon Sep 22 09:51:59 2014 +0530
# Node ID 6e6079ae22ca3ab822fbb424c61b3cc5a0284cea
# Parent  f70fd79cb3e1a0cb60b1c7ea5aac9a52922703c3
remove getNumPartInCU() and replace it with macro

diff -r f70fd79cb3e1 -r 6e6079ae22ca source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp  Mon Sep 22 09:05:53 2014 +0530
+++ b/source/Lib/TLibCommon/TComDataCU.cpp  Mon Sep 22 09:51:59 2014 +0530
@@ -320,7 +320,7 @@
 m_totalBits= 0;
 m_mvBits   = 0;
 m_coeffBits= 0;
-m_numPartitions= pic-getNumPartInCU();
+m_numPartitions= NUM_CU_PARTITIONS;
 char* qp   = pic-getCU(getAddr())-getQP();
 m_baseQp   = pic-getCU(getAddr())-m_baseQp;
 for (int i = 0; i  4; i++)
@@ -772,7 +772,7 @@
 if (planarAtLCUBoundary)
 return NULL;
 
-aPartUnitIdx = g_rasterToZscan[absPartIdx + m_pic-getNumPartInCU() - 
numPartInCUSize];
+aPartUnitIdx = g_rasterToZscan[absPartIdx + NUM_CU_PARTITIONS - 
numPartInCUSize];
 return m_cuAbove;
 }
 
@@ -797,7 +797,7 @@
 return this;
 }
 }
-alPartUnitIdx = g_rasterToZscan[absPartIdx + m_pic-getNumPartInCU() - 
numPartInCUSize - 1];
+alPartUnitIdx = g_rasterToZscan[absPartIdx + NUM_CU_PARTITIONS - 
numPartInCUSize - 1];
 return m_cuAbove;
 }
 
@@ -807,7 +807,7 @@
 return m_cuLeft;
 }
 
-alPartUnitIdx = g_rasterToZscan[m_pic-getNumPartInCU() - 1];
+alPartUnitIdx = g_rasterToZscan[NUM_CU_PARTITIONS - 1];
 return m_cuAboveLeft;
 }
 
@@ -839,7 +839,7 @@
 }
 return NULL;
 }
-arPartUnitIdx = g_rasterToZscan[absPartIdxRT + m_pic-getNumPartInCU() 
- numPartInCUSize + 1];
+arPartUnitIdx = g_rasterToZscan[absPartIdxRT + NUM_CU_PARTITIONS - 
numPartInCUSize + 1];
 return m_cuAbove;
 }
 
@@ -848,7 +848,7 @@
 return NULL;
 }
 
-arPartUnitIdx = g_rasterToZscan[m_pic-getNumPartInCU() - numPartInCUSize];
+arPartUnitIdx = g_rasterToZscan[NUM_CU_PARTITIONS - numPartInCUSize];
 return m_cuAboveRight;
 }
 
@@ -960,7 +960,7 @@
 }
 return NULL;
 }
-arPartUnitIdx = g_rasterToZscan[absPartIdxRT + m_pic-getNumPartInCU() 
- numPartInCUSize + partUnitOffset];
+arPartUnitIdx = g_rasterToZscan[absPartIdxRT + NUM_CU_PARTITIONS - 
numPartInCUSize + partUnitOffset];
 if (m_cuAbove == NULL || m_cuAbove-m_slice == NULL)
 {
 return NULL;
@@ -973,7 +973,7 @@
 return NULL;
 }
 
-arPartUnitIdx = g_rasterToZscan[m_pic-getNumPartInCU() - numPartInCUSize 
+ partUnitOffset - 1];
+arPartUnitIdx = g_rasterToZscan[NUM_CU_PARTITIONS - numPartInCUSize + 
partUnitOffset - 1];
 if ((m_cuAboveRight == NULL || m_cuAboveRight-m_slice == NULL ||
  (m_cuAboveRight-getAddr())  getAddr()))
 {
@@ -1074,7 +1074,7 @@
 else if (getAddr()  0  !(m_slice-m_pps-bEntropyCodingSyncEnabled 

 getAddr() % m_pic-getFrameWidthInCU() == 
0))
 {
-return m_pic-getCU(getAddr() - 
1)-getLastCodedQP(m_pic-getNumPartInCU());
+return m_pic-getCU(getAddr() - 
1)-getLastCodedQP(NUM_CU_PARTITIONS);
 }
 else
 {
@@ -1214,7 +1214,7 @@
 
 void TComDataCU::clearCbf(uint32_t absPartIdx, uint32_t depth)
 {
-uint32_t curPartNum = m_pic-getNumPartInCU()  (depth  1);
+uint32_t curPartNum = NUM_CU_PARTITIONS  (depth  1);
 
 memset(m_cbf[0] + absPartIdx, 0, sizeof(uint8_t) * curPartNum);
 memset(m_cbf[1] + absPartIdx, 0, sizeof(uint8_t) * curPartNum);
@@ -1223,7 +1223,7 @@
 
 void TComDataCU::setCbfSubParts(uint32_t cbf, TextType ttype, uint32_t 
absPartIdx, uint32_t depth)
 {
-uint32_t curPartNum = m_pic-getNumPartInCU()  (depth  1);
+uint32_t curPartNum = NUM_CU_PARTITIONS  (depth  1);
 
 memset(m_cbf[ttype] + absPartIdx, cbf, sizeof(uint8_t) * curPartNum);
 }
@@ -1236,14 +1236,14 @@
 void TComDataCU::setDepthSubParts(uint32_t depth)
 {
 /*All 4x4 partitions in current CU have the CU depth saved*/
-uint32_t curPartNum = m_pic-getNumPartInCU()  (depth  1);
+uint32_t curPartNum = NUM_CU_PARTITIONS  (depth  1);
 
 memset(m_depth, depth, sizeof(uint8_t) * curPartNum);
 }
 
 bool TComDataCU::isFirstAbsZorderIdxInDepth(uint32_t absPartIdx, uint32_t 
depth)
 {
-uint32_t curPartNum = m_pic-getNumPartInCU()  (depth  1);
+uint32_t curPartNum = NUM_CU_PARTITIONS  (depth  1);
 
 return ((m_absIdxInLCU + absPartIdx)  (curPartNum - 1)) == 0;
 }
@@ -1251,29 +1251,29 @@
 void TComDataCU::setPartSizeSubParts(PartSize mode, uint32_t absPartIdx, 
uint32_t depth)
 {
 X265_CHECK(sizeof(*m_partSizes) == 1, size check failure\n);
-memset(m_partSizes + absPartIdx, mode, m_pic-getNumPartInCU()  (depth 
 1));
+memset(m_partSizes + absPartIdx

Re: [x265] [PATCH] remove getNumPartInCU() and replace it with macro

2014-09-21 Thread Santhoshini Sekar
Please ignore this patch




On Mon, Sep 22, 2014 at 9:56 AM, santhosh...@multicorewareinc.com wrote:

 # HG changeset patch
 # User Santhoshini Sekar santhosh...@multicorewareinc.com
 # Date 1411359719 -19800
 #  Mon Sep 22 09:51:59 2014 +0530
 # Node ID 6e6079ae22ca3ab822fbb424c61b3cc5a0284cea
 # Parent  f70fd79cb3e1a0cb60b1c7ea5aac9a52922703c3
 remove getNumPartInCU() and replace it with macro

 diff -r f70fd79cb3e1 -r 6e6079ae22ca source/Lib/TLibCommon/TComDataCU.cpp
 --- a/source/Lib/TLibCommon/TComDataCU.cpp  Mon Sep 22 09:05:53 2014
 +0530
 +++ b/source/Lib/TLibCommon/TComDataCU.cpp  Mon Sep 22 09:51:59 2014
 +0530
 @@ -320,7 +320,7 @@
  m_totalBits= 0;
  m_mvBits   = 0;
  m_coeffBits= 0;
 -m_numPartitions= pic-getNumPartInCU();
 +m_numPartitions= NUM_CU_PARTITIONS;
  char* qp   = pic-getCU(getAddr())-getQP();
  m_baseQp   = pic-getCU(getAddr())-m_baseQp;
  for (int i = 0; i  4; i++)
 @@ -772,7 +772,7 @@
  if (planarAtLCUBoundary)
  return NULL;

 -aPartUnitIdx = g_rasterToZscan[absPartIdx + m_pic-getNumPartInCU() -
 numPartInCUSize];
 +aPartUnitIdx = g_rasterToZscan[absPartIdx + NUM_CU_PARTITIONS -
 numPartInCUSize];
  return m_cuAbove;
  }

 @@ -797,7 +797,7 @@
  return this;
  }
  }
 -alPartUnitIdx = g_rasterToZscan[absPartIdx +
 m_pic-getNumPartInCU() - numPartInCUSize - 1];
 +alPartUnitIdx = g_rasterToZscan[absPartIdx + NUM_CU_PARTITIONS -
 numPartInCUSize - 1];
  return m_cuAbove;
  }

 @@ -807,7 +807,7 @@
  return m_cuLeft;
  }

 -alPartUnitIdx = g_rasterToZscan[m_pic-getNumPartInCU() - 1];
 +alPartUnitIdx = g_rasterToZscan[NUM_CU_PARTITIONS - 1];
  return m_cuAboveLeft;
  }

 @@ -839,7 +839,7 @@
  }
  return NULL;
  }
 -arPartUnitIdx = g_rasterToZscan[absPartIdxRT +
 m_pic-getNumPartInCU() - numPartInCUSize + 1];
 +arPartUnitIdx = g_rasterToZscan[absPartIdxRT + NUM_CU_PARTITIONS
 - numPartInCUSize + 1];
  return m_cuAbove;
  }

 @@ -848,7 +848,7 @@
  return NULL;
  }

 -arPartUnitIdx = g_rasterToZscan[m_pic-getNumPartInCU() -
 numPartInCUSize];
 +arPartUnitIdx = g_rasterToZscan[NUM_CU_PARTITIONS - numPartInCUSize];
  return m_cuAboveRight;
  }

 @@ -960,7 +960,7 @@
  }
  return NULL;
  }
 -arPartUnitIdx = g_rasterToZscan[absPartIdxRT +
 m_pic-getNumPartInCU() - numPartInCUSize + partUnitOffset];
 +arPartUnitIdx = g_rasterToZscan[absPartIdxRT + NUM_CU_PARTITIONS
 - numPartInCUSize + partUnitOffset];
  if (m_cuAbove == NULL || m_cuAbove-m_slice == NULL)
  {
  return NULL;
 @@ -973,7 +973,7 @@
  return NULL;
  }

 -arPartUnitIdx = g_rasterToZscan[m_pic-getNumPartInCU() -
 numPartInCUSize + partUnitOffset - 1];
 +arPartUnitIdx = g_rasterToZscan[NUM_CU_PARTITIONS - numPartInCUSize +
 partUnitOffset - 1];
  if ((m_cuAboveRight == NULL || m_cuAboveRight-m_slice == NULL ||
   (m_cuAboveRight-getAddr())  getAddr()))
  {
 @@ -1074,7 +1074,7 @@
  else if (getAddr()  0 
 !(m_slice-m_pps-bEntropyCodingSyncEnabled 
  getAddr() %
 m_pic-getFrameWidthInCU() == 0))
  {
 -return m_pic-getCU(getAddr() -
 1)-getLastCodedQP(m_pic-getNumPartInCU());
 +return m_pic-getCU(getAddr() -
 1)-getLastCodedQP(NUM_CU_PARTITIONS);
  }
  else
  {
 @@ -1214,7 +1214,7 @@

  void TComDataCU::clearCbf(uint32_t absPartIdx, uint32_t depth)
  {
 -uint32_t curPartNum = m_pic-getNumPartInCU()  (depth  1);
 +uint32_t curPartNum = NUM_CU_PARTITIONS  (depth  1);

  memset(m_cbf[0] + absPartIdx, 0, sizeof(uint8_t) * curPartNum);
  memset(m_cbf[1] + absPartIdx, 0, sizeof(uint8_t) * curPartNum);
 @@ -1223,7 +1223,7 @@

  void TComDataCU::setCbfSubParts(uint32_t cbf, TextType ttype, uint32_t
 absPartIdx, uint32_t depth)
  {
 -uint32_t curPartNum = m_pic-getNumPartInCU()  (depth  1);
 +uint32_t curPartNum = NUM_CU_PARTITIONS  (depth  1);

  memset(m_cbf[ttype] + absPartIdx, cbf, sizeof(uint8_t) * curPartNum);
  }
 @@ -1236,14 +1236,14 @@
  void TComDataCU::setDepthSubParts(uint32_t depth)
  {
  /*All 4x4 partitions in current CU have the CU depth saved*/
 -uint32_t curPartNum = m_pic-getNumPartInCU()  (depth  1);
 +uint32_t curPartNum = NUM_CU_PARTITIONS  (depth  1);

  memset(m_depth, depth, sizeof(uint8_t) * curPartNum);
  }

  bool TComDataCU::isFirstAbsZorderIdxInDepth(uint32_t absPartIdx, uint32_t
 depth)
  {
 -uint32_t curPartNum = m_pic-getNumPartInCU()  (depth  1);
 +uint32_t curPartNum = NUM_CU_PARTITIONS  (depth  1);

  return ((m_absIdxInLCU + absPartIdx)  (curPartNum - 1)) == 0;
  }
 @@ -1251,29 +1251,29 @@
  void TComDataCU::setPartSizeSubParts(PartSize mode, uint32_t absPartIdx

[x265] [PATCH] remove getNumPartInCU() and replace it with macro

2014-09-21 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar santhosh...@multicorewareinc.com
# Date 1411360621 -19800
#  Mon Sep 22 10:07:01 2014 +0530
# Node ID 37343a4ceced834aa89316c5307a6353fb546337
# Parent  817abe294c8b3e60f88093841d208fbb96bf8403
remove getNumPartInCU() and replace it with macro

diff -r 817abe294c8b -r 37343a4ceced source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp  Sun Sep 21 23:18:49 2014 +0530
+++ b/source/Lib/TLibCommon/TComDataCU.cpp  Mon Sep 22 10:07:01 2014 +0530
@@ -320,7 +320,7 @@
 m_totalBits= 0;
 m_mvBits   = 0;
 m_coeffBits= 0;
-m_numPartitions= pic-getNumPartInCU();
+m_numPartitions= NUM_CU_PARTITIONS;
 char* qp   = pic-getCU(getAddr())-getQP();
 m_baseQp   = pic-getCU(getAddr())-m_baseQp;
 for (int i = 0; i  4; i++)
@@ -772,7 +772,7 @@
 if (planarAtLCUBoundary)
 return NULL;
 
-aPartUnitIdx = g_rasterToZscan[absPartIdx + m_pic-getNumPartInCU() - 
numPartInCUSize];
+aPartUnitIdx = g_rasterToZscan[absPartIdx + NUM_CU_PARTITIONS - 
numPartInCUSize];
 return m_cuAbove;
 }
 
@@ -797,7 +797,7 @@
 return this;
 }
 }
-alPartUnitIdx = g_rasterToZscan[absPartIdx + m_pic-getNumPartInCU() - 
numPartInCUSize - 1];
+alPartUnitIdx = g_rasterToZscan[absPartIdx + NUM_CU_PARTITIONS - 
numPartInCUSize - 1];
 return m_cuAbove;
 }
 
@@ -807,7 +807,7 @@
 return m_cuLeft;
 }
 
-alPartUnitIdx = g_rasterToZscan[m_pic-getNumPartInCU() - 1];
+alPartUnitIdx = g_rasterToZscan[NUM_CU_PARTITIONS - 1];
 return m_cuAboveLeft;
 }
 
@@ -839,7 +839,7 @@
 }
 return NULL;
 }
-arPartUnitIdx = g_rasterToZscan[absPartIdxRT + m_pic-getNumPartInCU() 
- numPartInCUSize + 1];
+arPartUnitIdx = g_rasterToZscan[absPartIdxRT + NUM_CU_PARTITIONS - 
numPartInCUSize + 1];
 return m_cuAbove;
 }
 
@@ -848,7 +848,7 @@
 return NULL;
 }
 
-arPartUnitIdx = g_rasterToZscan[m_pic-getNumPartInCU() - numPartInCUSize];
+arPartUnitIdx = g_rasterToZscan[NUM_CU_PARTITIONS - numPartInCUSize];
 return m_cuAboveRight;
 }
 
@@ -960,7 +960,7 @@
 }
 return NULL;
 }
-arPartUnitIdx = g_rasterToZscan[absPartIdxRT + m_pic-getNumPartInCU() 
- numPartInCUSize + partUnitOffset];
+arPartUnitIdx = g_rasterToZscan[absPartIdxRT + NUM_CU_PARTITIONS - 
numPartInCUSize + partUnitOffset];
 if (m_cuAbove == NULL || m_cuAbove-m_slice == NULL)
 {
 return NULL;
@@ -973,7 +973,7 @@
 return NULL;
 }
 
-arPartUnitIdx = g_rasterToZscan[m_pic-getNumPartInCU() - numPartInCUSize 
+ partUnitOffset - 1];
+arPartUnitIdx = g_rasterToZscan[NUM_CU_PARTITIONS - numPartInCUSize + 
partUnitOffset - 1];
 if ((m_cuAboveRight == NULL || m_cuAboveRight-m_slice == NULL ||
  (m_cuAboveRight-getAddr())  getAddr()))
 {
@@ -1074,7 +1074,7 @@
 else if (getAddr()  0  !(m_slice-m_pps-bEntropyCodingSyncEnabled 

 getAddr() % m_pic-getFrameWidthInCU() == 
0))
 {
-return m_pic-getCU(getAddr() - 
1)-getLastCodedQP(m_pic-getNumPartInCU());
+return m_pic-getCU(getAddr() - 
1)-getLastCodedQP(NUM_CU_PARTITIONS);
 }
 else
 {
@@ -1214,7 +1214,7 @@
 
 void TComDataCU::clearCbf(uint32_t absPartIdx, uint32_t depth)
 {
-uint32_t curPartNum = m_pic-getNumPartInCU()  (depth  1);
+uint32_t curPartNum = NUM_CU_PARTITIONS  (depth  1);
 
 memset(m_cbf[0] + absPartIdx, 0, sizeof(uint8_t) * curPartNum);
 memset(m_cbf[1] + absPartIdx, 0, sizeof(uint8_t) * curPartNum);
@@ -1223,7 +1223,7 @@
 
 void TComDataCU::setCbfSubParts(uint32_t cbf, TextType ttype, uint32_t 
absPartIdx, uint32_t depth)
 {
-uint32_t curPartNum = m_pic-getNumPartInCU()  (depth  1);
+uint32_t curPartNum = NUM_CU_PARTITIONS  (depth  1);
 
 memset(m_cbf[ttype] + absPartIdx, cbf, sizeof(uint8_t) * curPartNum);
 }
@@ -1236,14 +1236,14 @@
 void TComDataCU::setDepthSubParts(uint32_t depth)
 {
 /*All 4x4 partitions in current CU have the CU depth saved*/
-uint32_t curPartNum = m_pic-getNumPartInCU()  (depth  1);
+uint32_t curPartNum = NUM_CU_PARTITIONS  (depth  1);
 
 memset(m_depth, depth, sizeof(uint8_t) * curPartNum);
 }
 
 bool TComDataCU::isFirstAbsZorderIdxInDepth(uint32_t absPartIdx, uint32_t 
depth)
 {
-uint32_t curPartNum = m_pic-getNumPartInCU()  (depth  1);
+uint32_t curPartNum = NUM_CU_PARTITIONS  (depth  1);
 
 return ((m_absIdxInLCU + absPartIdx)  (curPartNum - 1)) == 0;
 }
@@ -1251,29 +1251,29 @@
 void TComDataCU::setPartSizeSubParts(PartSize mode, uint32_t absPartIdx, 
uint32_t depth)
 {
 X265_CHECK(sizeof(*m_partSizes) == 1, size check failure\n);
-memset(m_partSizes + absPartIdx, mode, m_pic-getNumPartInCU()  (depth 
 1));
+memset(m_partSizes + absPartIdx

[x265] [PATCH] TComDataCU: replace getZorderIdxInCU() with encodeIdx of CU structure

2014-09-21 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar santhosh...@multicorewareinc.com
# Date 1411363378 -19800
#  Mon Sep 22 10:52:58 2014 +0530
# Node ID 4e2c1f5c77939374a68550333c6791ef4033fff9
# Parent  2c2309bbc7ca84a8e16f7db5fa42b8ba1c252206
TComDataCU: replace getZorderIdxInCU() with encodeIdx of CU structure

diff -r 2c2309bbc7ca -r 4e2c1f5c7793 source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp  Mon Sep 22 10:07:01 2014 +0530
+++ b/source/Lib/TLibCommon/TComDataCU.cpp  Mon Sep 22 10:52:58 2014 +0530
@@ -387,7 +387,7 @@
 }
 
 // initialize Sub partition
-void TComDataCU::initSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth, int qp)
+void TComDataCU::initSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth, int qp, CU* cuData)
 {
 X265_CHECK(partUnitIdx  4, part unit should be less than 4\n);
 uint8_t log2CUSize = g_maxLog2CUSize - depth;
@@ -396,7 +396,7 @@
 m_pic  = cu-m_pic;
 m_slice= cu-m_slice;
 m_cuAddr   = cu-getAddr();
-m_absIdxInLCU  = cu-getZorderIdxInCU() + partOffset;
+m_absIdxInLCU  = cuData-encodeIdx * 4 + partOffset;
 
 m_cuPelX   = cu-getCUPelX() + ((partUnitIdx   1)  log2CUSize);
 m_cuPelY   = cu-getCUPelY() + ((partUnitIdx  1)  log2CUSize);
@@ -453,7 +453,7 @@
 m_cuAboveRight  = cu-getCUAboveRight();
 }
 
-void TComDataCU::copyToSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth)
+void TComDataCU::copyToSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth, CU* cuData)
 {
 X265_CHECK(partUnitIdx  4, part unit should be less than 4\n);
 
@@ -462,7 +462,7 @@
 m_pic  = cu-m_pic;
 m_slice= cu-m_slice;
 m_cuAddr   = cu-getAddr();
-m_absIdxInLCU  = cu-getZorderIdxInCU() + partOffset;
+m_absIdxInLCU  = cuData-encodeIdx * 4 + partOffset;
 
 m_cuPelX   = cu-getCUPelX() + ((partUnitIdx   1)  
(g_maxLog2CUSize - depth));
 m_cuPelY   = cu-getCUPelY() + ((partUnitIdx  1)  
(g_maxLog2CUSize - depth));
@@ -1067,9 +1067,9 @@
 }
 else
 {
-if (getZorderIdxInCU()  0)
+if (m_CULocalData-encodeIdx *4  0)
 {
-return m_pic-getCU(getAddr())-getLastCodedQP(getZorderIdxInCU());
+return 
m_pic-getCU(getAddr())-getLastCodedQP(m_CULocalData-encodeIdx *4);
 }
 else if (getAddr()  0  !(m_slice-m_pps-bEntropyCodingSyncEnabled 

 getAddr() % m_pic-getFrameWidthInCU() == 
0))
diff -r 2c2309bbc7ca -r 4e2c1f5c7793 source/Lib/TLibCommon/TComDataCU.h
--- a/source/Lib/TLibCommon/TComDataCU.hMon Sep 22 10:07:01 2014 +0530
+++ b/source/Lib/TLibCommon/TComDataCU.hMon Sep 22 10:52:58 2014 +0530
@@ -273,9 +273,9 @@
 
 void  initCU(Frame* pic, uint32_t cuAddr);
 void  initEstData();
-void  initSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth, int qp);
+void  initSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth, int qp, CU* cuData);
 
-void  copyToSubCU(TComDataCU* lcu, uint32_t partUnitIdx, uint32_t 
depth);
+void  copyToSubCU(TComDataCU* lcu, uint32_t partUnitIdx, uint32_t 
depth, CU* cuData);
 void  copyPartFrom(TComDataCU* cu, uint32_t partUnitIdx, uint32_t 
depth, bool isRDObasedAnalysis = true);
 
 void  copyToPic(uint32_t depth);
@@ -288,8 +288,6 @@
 
 uint32_t getAddr(){ return m_cuAddr; }
 
-uint32_t getZorderIdxInCU()   { return m_absIdxInLCU; }
-
 uint32_t  getSCUAddr() const   { return (m_cuAddr  
g_maxFullDepth * 2) + m_absIdxInLCU; }
 
 
diff -r 2c2309bbc7ca -r 4e2c1f5c7793 source/Lib/TLibCommon/TComPattern.cpp
--- a/source/Lib/TLibCommon/TComPattern.cpp Mon Sep 22 10:07:01 2014 +0530
+++ b/source/Lib/TLibCommon/TComPattern.cpp Mon Sep 22 10:52:58 2014 +0530
@@ -50,7 +50,7 @@
 // 

 
 void TComPattern::initAdiPattern(TComDataCU* cu, uint32_t zOrderIdxInPart, 
uint32_t partDepth, pixel* adiBuf,
- pixel* refAbove, pixel* refLeft, pixel* 
refAboveFlt, pixel* refLeftFlt, int dirMode)
+ pixel* refAbove, pixel* refLeft, pixel* 
refAboveFlt, pixel* refLeftFlt, int dirMode, CU* cuData)
 {
 pixel* roiOrigin;
 pixel* adiTemp;
@@ -63,7 +63,7 @@
 uint32_t tuSize = intraNeighbors.tuSize;
 uint32_t tuSize2 = tuSize  1;
 
-roiOrigin = cu-m_pic-getPicYuvRec()-getLumaAddr(cu-getAddr(), 
cu-getZorderIdxInCU() + zOrderIdxInPart);
+roiOrigin = cu-m_pic-getPicYuvRec()-getLumaAddr(cu-getAddr(), 
cuData-encodeIdx * 4 + zOrderIdxInPart);
 adiTemp   = adiBuf;
 
 fillReferenceSamples(roiOrigin, picStride, adiTemp, intraNeighbors);
@@ -163,7 +163,7

[x265] [PATCH] analysis: add CU specific details to encodeCU()

2014-09-16 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar santhosh...@multicorewareinc.com
# Date 1410848612 -19800
#  Tue Sep 16 11:53:32 2014 +0530
# Node ID 74b5192133a548c492b8b2cb34dde8242107900e
# Parent  7e29b10982d2eb7fd79f581d6f04184522ba
analysis: add CU specific details to encodeCU()

diff -r 7e29b10982d2 -r 74b5192133a5 source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp   Thu Sep 11 19:24:28 2014 +0530
+++ b/source/encoder/analysis.cpp   Tue Sep 16 11:53:32 2014 +0530
@@ -301,7 +301,6 @@
 {
 if (cu-m_slice-m_pps-bUseDQP)
 m_bEncodeDQP = true;
-loadCTUData(cu);
 
 // initialize CU data
 m_bestCU[0]-initCU(cu-m_pic, cu-getAddr());
diff -r 7e29b10982d2 -r 74b5192133a5 source/encoder/entropy.cpp
--- a/source/encoder/entropy.cppThu Sep 11 19:24:28 2014 +0530
+++ b/source/encoder/entropy.cppTue Sep 16 11:53:32 2014 +0530
@@ -484,11 +484,11 @@
 void Entropy::encodeCTU(TComDataCU* cu)
 {
 bool bEncodeDQP = cu-m_slice-m_pps-bUseDQP;
-encodeCU(cu, 0, 0, false, bEncodeDQP);
+encodeCU(cu, 0, 0, bEncodeDQP, cu-m_CULocalData );
 }
 
 /* encode a CU block recursively */
-void Entropy::encodeCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, 
bool bInsidePicture, bool bEncodeDQP)
+void Entropy::encodeCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, 
bool bEncodeDQP, CU* cuData)
 {
 Frame* pic = cu-m_pic;
 Slice* slice = cu-m_slice;
@@ -496,30 +496,24 @@
 if (depth = slice-m_pps-maxCuDQPDepth  slice-m_pps-bUseDQP)
 bEncodeDQP = true;
 
-if (!bInsidePicture)
+int cuSplitFlag = !(cuData-flags  CU::LEAF);
+int cuUnsplitFlag = !(cuData-flags  CU::SPLIT_MANDATORY);
+
+if (!cuUnsplitFlag)
 {
-uint32_t xmax = slice-m_sps-picWidthInLumaSamples  - cu-getCUPelX();
-uint32_t ymax = slice-m_sps-picHeightInLumaSamples - cu-getCUPelY();
-uint32_t cuSize = g_maxCUSize  depth;
-
-bInsidePicture = (g_zscanToPelX[absPartIdx] + cuSize = xmax 
-  g_zscanToPelY[absPartIdx] + cuSize = ymax);
-
-if (!bInsidePicture)
+uint32_t qNumParts = (pic-getNumPartInCU()  (depth  1))  2;
+for (uint32_t partUnitIdx = 0; partUnitIdx  4; partUnitIdx++, 
absPartIdx += qNumParts)
 {
-uint32_t qNumParts = (pic-getNumPartInCU()  (depth  1))  2;
-for (uint32_t partUnitIdx = 0; partUnitIdx  4; partUnitIdx++, 
absPartIdx += qNumParts)
-{
-if (g_zscanToPelX[absPartIdx]  xmax  
g_zscanToPelY[absPartIdx]  ymax)
-encodeCU(cu, absPartIdx, depth + 1, bInsidePicture, 
bEncodeDQP);
-}
-
-return;
+CU *childCU = cu-m_CULocalData + cuData-childIdx + partUnitIdx;
+int cuPresentFlagChild = !(childCU-flags  CU::PRESENT);
+if (!cuPresentFlagChild)
+encodeCU(cu, absPartIdx, depth + 1, bEncodeDQP, childCU);
 }
+return;
 }
 
 // We need to split, so don't try these modes.
-if (bInsidePicture  depth  g_maxCUDepth)
+if (cuSplitFlag) 
 codeSplitFlag(cu, absPartIdx, depth);
 
 if (depth  cu-getDepth(absPartIdx)  depth  g_maxCUDepth)
@@ -527,7 +521,10 @@
 uint32_t qNumParts = (pic-getNumPartInCU()  (depth  1))  2;
 
 for (uint32_t partUnitIdx = 0; partUnitIdx  4; partUnitIdx++, 
absPartIdx += qNumParts)
-encodeCU(cu, absPartIdx, depth + 1, bInsidePicture, bEncodeDQP);
+{
+CU *childCU = cu-m_CULocalData + cuData-childIdx + partUnitIdx;
+encodeCU(cu, absPartIdx, depth + 1, bEncodeDQP, childCU);
+}
 return;
 }
 
diff -r 7e29b10982d2 -r 74b5192133a5 source/encoder/entropy.h
--- a/source/encoder/entropy.h  Thu Sep 11 19:24:28 2014 +0530
+++ b/source/encoder/entropy.h  Tue Sep 16 11:53:32 2014 +0530
@@ -193,7 +193,7 @@
 void encodeBinsEP(uint32_t binValues, int numBins);
 void encodeBinTrm(uint32_t binValue);
 
-void encodeCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, bool 
bInsidePicture, bool bEncodeDQP);
+void encodeCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, bool 
bEncodeDQP, CU *cuData);
 void finishCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth);
 
 void writeOut();
diff -r 7e29b10982d2 -r 74b5192133a5 source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp   Thu Sep 11 19:24:28 2014 +0530
+++ b/source/encoder/frameencoder.cpp   Tue Sep 16 11:53:32 2014 +0530
@@ -470,6 +470,7 @@
 }
 }
 
+m_tld.cuCoder.loadCTUData(cu);
 // final coding (bitstream generation) for this CU
 m_entropyCoder.encodeCTU(cu);
 
@@ -689,6 +690,7 @@
 // load current best state from go-on entropy coder
 curRow.rdEntropyCoders[0][CI_CURR_BEST].load(rowCoder);
 
+tld.cuCoder.loadCTUData(cu);
 tld.cuCoder.m_quant.setQPforQuant(cu);
 tld.cuCoder.compressCU(cu); // Does all the CU

[x265] [PATCH] analysis: add CU specific details to encodeCU()

2014-09-15 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar santhosh...@multicorewareinc.com
# Date 1410840429 -19800
#  Tue Sep 16 09:37:09 2014 +0530
# Node ID 50505472d3e33b775c70f2f373e1c15d17e47e66
# Parent  7e29b10982d2eb7fd79f581d6f04184522ba
analysis: add CU specific details to encodeCU()

diff -r 7e29b10982d2 -r 50505472d3e3 source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp   Thu Sep 11 19:24:28 2014 +0530
+++ b/source/encoder/analysis.cpp   Tue Sep 16 09:37:09 2014 +0530
@@ -301,7 +301,6 @@
 {
 if (cu-m_slice-m_pps-bUseDQP)
 m_bEncodeDQP = true;
-loadCTUData(cu);
 
 // initialize CU data
 m_bestCU[0]-initCU(cu-m_pic, cu-getAddr());
diff -r 7e29b10982d2 -r 50505472d3e3 source/encoder/entropy.cpp
--- a/source/encoder/entropy.cppThu Sep 11 19:24:28 2014 +0530
+++ b/source/encoder/entropy.cppTue Sep 16 09:37:09 2014 +0530
@@ -481,14 +481,14 @@
 }
 }
 
-void Entropy::encodeCTU(TComDataCU* cu)
+void Entropy::encodeCTU(TComDataCU* cu, CU* cuData)
 {
 bool bEncodeDQP = cu-m_slice-m_pps-bUseDQP;
-encodeCU(cu, 0, 0, false, bEncodeDQP);
+encodeCU(cu, 0, 0, bEncodeDQP, cuData);
 }
 
 /* encode a CU block recursively */
-void Entropy::encodeCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, 
bool bInsidePicture, bool bEncodeDQP)
+void Entropy::encodeCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, 
bool bEncodeDQP, CU* cuData)
 {
 Frame* pic = cu-m_pic;
 Slice* slice = cu-m_slice;
@@ -496,30 +496,24 @@
 if (depth = slice-m_pps-maxCuDQPDepth  slice-m_pps-bUseDQP)
 bEncodeDQP = true;
 
-if (!bInsidePicture)
+int cuSplitFlag = !(cuData-flags  CU::LEAF);
+int cuUnsplitFlag = !(cuData-flags  CU::SPLIT_MANDATORY);
+
+if (!cuUnsplitFlag)
 {
-uint32_t xmax = slice-m_sps-picWidthInLumaSamples  - cu-getCUPelX();
-uint32_t ymax = slice-m_sps-picHeightInLumaSamples - cu-getCUPelY();
-uint32_t cuSize = g_maxCUSize  depth;
-
-bInsidePicture = (g_zscanToPelX[absPartIdx] + cuSize = xmax 
-  g_zscanToPelY[absPartIdx] + cuSize = ymax);
-
-if (!bInsidePicture)
+uint32_t qNumParts = (pic-getNumPartInCU()  (depth  1))  2;
+for (uint32_t partUnitIdx = 0; partUnitIdx  4; partUnitIdx++, 
absPartIdx += qNumParts)
 {
-uint32_t qNumParts = (pic-getNumPartInCU()  (depth  1))  2;
-for (uint32_t partUnitIdx = 0; partUnitIdx  4; partUnitIdx++, 
absPartIdx += qNumParts)
-{
-if (g_zscanToPelX[absPartIdx]  xmax  
g_zscanToPelY[absPartIdx]  ymax)
-encodeCU(cu, absPartIdx, depth + 1, bInsidePicture, 
bEncodeDQP);
-}
-
-return;
+CU *childCU = cu-m_CULocalData + cuData-childIdx + partUnitIdx;
+int cuPresentFlagChild = !(childCU-flags  CU::PRESENT);
+if (!cuPresentFlagChild)
+encodeCU(cu, absPartIdx, depth + 1, bEncodeDQP, childCU);
 }
+return;
 }
 
 // We need to split, so don't try these modes.
-if (bInsidePicture  depth  g_maxCUDepth)
+if (cuSplitFlag) 
 codeSplitFlag(cu, absPartIdx, depth);
 
 if (depth  cu-getDepth(absPartIdx)  depth  g_maxCUDepth)
@@ -527,7 +521,10 @@
 uint32_t qNumParts = (pic-getNumPartInCU()  (depth  1))  2;
 
 for (uint32_t partUnitIdx = 0; partUnitIdx  4; partUnitIdx++, 
absPartIdx += qNumParts)
-encodeCU(cu, absPartIdx, depth + 1, bInsidePicture, bEncodeDQP);
+{
+CU *childCU = cu-m_CULocalData + cuData-childIdx + partUnitIdx;
+encodeCU(cu, absPartIdx, depth + 1, bEncodeDQP, childCU);
+}
 return;
 }
 
diff -r 7e29b10982d2 -r 50505472d3e3 source/encoder/entropy.h
--- a/source/encoder/entropy.h  Thu Sep 11 19:24:28 2014 +0530
+++ b/source/encoder/entropy.h  Tue Sep 16 09:37:09 2014 +0530
@@ -148,7 +148,7 @@
 void codeShortTermRefPicSet(RPS* rps);
 void finishSlice() { encodeBinTrm(1); finish(); 
dynamic_castBitstream*(m_bitIf)-writeByteAlignment(); }
 
-void encodeCTU(TComDataCU* cu);
+void encodeCTU(TComDataCU* cu, CU *cuData);
 void codeSaoOffset(SaoLcuParam* saoLcuParam, uint32_t compIdx);
 void codeSaoUnitInterleaving(int compIdx, bool saoFlag, int rx, int ry, 
SaoLcuParam* saoLcuParam, int cuAddrInSlice, int cuAddrUpInSlice, int 
allowMergeLeft, int allowMergeUp);
 void codeSaoMerge(uint32_t code)   { encodeBin(code, 
m_contextState[OFF_SAO_MERGE_FLAG_CTX]); }
@@ -193,7 +193,7 @@
 void encodeBinsEP(uint32_t binValues, int numBins);
 void encodeBinTrm(uint32_t binValue);
 
-void encodeCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, bool 
bInsidePicture, bool bEncodeDQP);
+void encodeCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, bool 
bEncodeDQP, CU *cuData);
 void finishCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth);
 
 void writeOut();
diff -r

[x265] [PATCH RFC] analysis: add CU specific details to encodeCU()

2014-09-12 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar santhosh...@multicorewareinc.com
# Date 1410525310 -19800
#  Fri Sep 12 18:05:10 2014 +0530
# Node ID bf4ebe5df0cab013e4462597b55bd505b2a6a71a
# Parent  7e29b10982d2eb7fd79f581d6f04184522ba
analysis: add CU specific details to encodeCU()

diff -r 7e29b10982d2 -r bf4ebe5df0ca source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp   Thu Sep 11 19:24:28 2014 +0530
+++ b/source/encoder/analysis.cpp   Fri Sep 12 18:05:10 2014 +0530
@@ -301,7 +301,6 @@
 {
 if (cu-m_slice-m_pps-bUseDQP)
 m_bEncodeDQP = true;
-loadCTUData(cu);
 
 // initialize CU data
 m_bestCU[0]-initCU(cu-m_pic, cu-getAddr());
diff -r 7e29b10982d2 -r bf4ebe5df0ca source/encoder/entropy.cpp
--- a/source/encoder/entropy.cppThu Sep 11 19:24:28 2014 +0530
+++ b/source/encoder/entropy.cppFri Sep 12 18:05:10 2014 +0530
@@ -481,14 +481,14 @@
 }
 }
 
-void Entropy::encodeCTU(TComDataCU* cu)
+void Entropy::encodeCTU(TComDataCU* cu, CU* cuData)
 {
 bool bEncodeDQP = cu-m_slice-m_pps-bUseDQP;
-encodeCU(cu, 0, 0, false, bEncodeDQP);
+encodeCU(cu, 0, 0, bEncodeDQP, cuData);
 }
 
 /* encode a CU block recursively */
-void Entropy::encodeCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, 
bool bInsidePicture, bool bEncodeDQP)
+void Entropy::encodeCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, 
bool bEncodeDQP, CU* cuData)
 {
 Frame* pic = cu-m_pic;
 Slice* slice = cu-m_slice;
@@ -496,30 +496,26 @@
 if (depth = slice-m_pps-maxCuDQPDepth  slice-m_pps-bUseDQP)
 bEncodeDQP = true;
 
-if (!bInsidePicture)
+int cu_split_flag = !(cuData-flags  CU::LEAF);
+int cu_unsplit_flag = !(cuData-flags  CU::SPLIT_MANDATORY);
+
+uint32_t xmax = slice-m_sps-picWidthInLumaSamples  - cu-getCUPelX();
+uint32_t ymax = slice-m_sps-picHeightInLumaSamples - cu-getCUPelY();
+
+if (!cu_unsplit_flag)
 {
-uint32_t xmax = slice-m_sps-picWidthInLumaSamples  - cu-getCUPelX();
-uint32_t ymax = slice-m_sps-picHeightInLumaSamples - cu-getCUPelY();
-uint32_t cuSize = g_maxCUSize  depth;
-
-bInsidePicture = (g_zscanToPelX[absPartIdx] + cuSize = xmax 
-  g_zscanToPelY[absPartIdx] + cuSize = ymax);
-
-if (!bInsidePicture)
+uint32_t qNumParts = (pic-getNumPartInCU()  (depth  1))  2;
+for (uint32_t partUnitIdx = 0; partUnitIdx  4; partUnitIdx++, 
absPartIdx += qNumParts)
 {
-uint32_t qNumParts = (pic-getNumPartInCU()  (depth  1))  2;
-for (uint32_t partUnitIdx = 0; partUnitIdx  4; partUnitIdx++, 
absPartIdx += qNumParts)
-{
-if (g_zscanToPelX[absPartIdx]  xmax  
g_zscanToPelY[absPartIdx]  ymax)
-encodeCU(cu, absPartIdx, depth + 1, bInsidePicture, 
bEncodeDQP);
-}
-
-return;
+CU *childCU = cu-m_CULocalData + cuData-childIdx + partUnitIdx;
+if (g_zscanToPelX[absPartIdx]  xmax  g_zscanToPelY[absPartIdx] 
 ymax)
+encodeCU(cu, absPartIdx, depth + 1, bEncodeDQP, childCU);
 }
+return;
 }
 
 // We need to split, so don't try these modes.
-if (bInsidePicture  depth  g_maxCUDepth)
+if (cu_split_flag)
 codeSplitFlag(cu, absPartIdx, depth);
 
 if (depth  cu-getDepth(absPartIdx)  depth  g_maxCUDepth)
@@ -527,7 +523,10 @@
 uint32_t qNumParts = (pic-getNumPartInCU()  (depth  1))  2;
 
 for (uint32_t partUnitIdx = 0; partUnitIdx  4; partUnitIdx++, 
absPartIdx += qNumParts)
-encodeCU(cu, absPartIdx, depth + 1, bInsidePicture, bEncodeDQP);
+{
+CU *childCU = cu-m_CULocalData + cuData-childIdx + partUnitIdx;
+encodeCU(cu, absPartIdx, depth + 1, bEncodeDQP, childCU);
+}
 return;
 }
 
diff -r 7e29b10982d2 -r bf4ebe5df0ca source/encoder/entropy.h
--- a/source/encoder/entropy.h  Thu Sep 11 19:24:28 2014 +0530
+++ b/source/encoder/entropy.h  Fri Sep 12 18:05:10 2014 +0530
@@ -148,7 +148,7 @@
 void codeShortTermRefPicSet(RPS* rps);
 void finishSlice() { encodeBinTrm(1); finish(); 
dynamic_castBitstream*(m_bitIf)-writeByteAlignment(); }
 
-void encodeCTU(TComDataCU* cu);
+void encodeCTU(TComDataCU* cu, CU *cuData);
 void codeSaoOffset(SaoLcuParam* saoLcuParam, uint32_t compIdx);
 void codeSaoUnitInterleaving(int compIdx, bool saoFlag, int rx, int ry, 
SaoLcuParam* saoLcuParam, int cuAddrInSlice, int cuAddrUpInSlice, int 
allowMergeLeft, int allowMergeUp);
 void codeSaoMerge(uint32_t code)   { encodeBin(code, 
m_contextState[OFF_SAO_MERGE_FLAG_CTX]); }
@@ -193,7 +193,7 @@
 void encodeBinsEP(uint32_t binValues, int numBins);
 void encodeBinTrm(uint32_t binValue);
 
-void encodeCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, bool 
bInsidePicture, bool bEncodeDQP);
+void encodeCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, bool

[x265] [PATCH] cleanup: move m_predYuv and m_predTempYuv from predict to TEncSearch

2014-08-01 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar santhosh...@multicorewareinc.com
# Date 1406885676 -19800
#  Fri Aug 01 15:04:36 2014 +0530
# Node ID ddcc46309023d8e577b25325370503660a0d1c87
# Parent  e85b0aaa64e4aaccdfd37de92e14d91a53a789ea
cleanup:  move m_predYuv and m_predTempYuv from predict to TEncSearch

diff -r e85b0aaa64e4 -r ddcc46309023 source/Lib/TLibEncoder/TEncSearch.cpp
--- a/source/Lib/TLibEncoder/TEncSearch.cpp Thu Jul 31 11:08:02 2014 +0530
+++ b/source/Lib/TLibEncoder/TEncSearch.cpp Fri Aug 01 15:04:36 2014 +0530
@@ -77,6 +77,7 @@
 X265_FREE(m_qtTempTrIdx);
 X265_FREE(m_qtTempCbf[0]);
 X265_FREE(m_qtTempTransformSkipFlag[0]);
+m_predTempYuv.destroy();
 
 delete[] m_qtTempShortYuv;
 }
@@ -92,6 +93,7 @@
 m_numLayers = top.m_quadtreeTULog2MaxSize - 2 + 1;
 
 initTempBuff(m_param-internalCsp);
+m_predTempYuv.create(MAX_CU_SIZE, MAX_CU_SIZE, m_param-internalCsp);
 m_me.setSearchMethod(m_param-searchMethod);
 m_me.setSubpelRefine(m_param-subpelRefine);
 
@@ -1894,6 +1896,7 @@
 int  numPredDir = cu-m_slice-isInterP() ? 1 : 2;
 uint32_t lastMode = 0;
 int  totalmebits = 0;
+TComYuv   m_predYuv[2];
 
 const int* numRefIdx = cu-m_slice-m_numRefIdx;
 
@@ -1901,6 +1904,9 @@
 
 memset(merge, 0, sizeof(merge));
 
+m_predYuv[0].create(MAX_CU_SIZE, MAX_CU_SIZE, m_param-internalCsp);
+m_predYuv[1].create(MAX_CU_SIZE, MAX_CU_SIZE, m_param-internalCsp);
+
 for (int partIdx = 0; partIdx  numPart; partIdx++)
 {
 uint32_t partAddr;
@@ -1936,7 +1942,7 @@
 
cu-getCUMvField(REF_PIC_LIST_1)-setAllMvField(merge.mvField[1], partSize, 
partAddr, 0, partIdx);
 totalmebits += merge.bits;
 
-prepMotionCompensation(cu, partIdx); 
+prepMotionCompensation(cu, partIdx);
 motionCompensation(cu, predYuv, REF_PIC_LIST_X, true, bChroma);
 continue;
 }
@@ -2159,6 +2165,9 @@
 motionCompensation(cu, predYuv, REF_PIC_LIST_X, true, bChroma);
 }
 
+m_predYuv[0].destroy();
+m_predYuv[1].destroy();
+
 x265_emms();
 cu-m_totalBits = totalmebits;
 return true;
diff -r e85b0aaa64e4 -r ddcc46309023 source/Lib/TLibEncoder/TEncSearch.h
--- a/source/Lib/TLibEncoder/TEncSearch.h   Thu Jul 31 11:08:02 2014 +0530
+++ b/source/Lib/TLibEncoder/TEncSearch.h   Fri Aug 01 15:04:36 2014 +0530
@@ -106,6 +106,7 @@
 MotionReference (*m_mref)[MAX_NUM_REF + 1];
 
 ShortYuv*   m_qtTempShortYuv;
+TComYuv m_predTempYuv;
 
 coeff_t*m_qtTempCoeff[3][NUM_LAYERS];
 uint8_t*m_qtTempTrIdx;
diff -r e85b0aaa64e4 -r ddcc46309023 source/encoder/predict.cpp
--- a/source/encoder/predict.cppThu Jul 31 11:08:02 2014 +0530
+++ b/source/encoder/predict.cppFri Aug 01 15:04:36 2014 +0530
@@ -55,11 +55,8 @@
 X265_FREE(m_refLeftFlt);
 X265_FREE(m_immedVals);
 
-m_predYuv[0].destroy();
-m_predYuv[1].destroy();
 m_predShortYuv[0].destroy();
 m_predShortYuv[1].destroy();
-m_predTempYuv.destroy();
 }
 
 void Predict::initTempBuff(int csp)
@@ -77,11 +74,8 @@
 m_refLeft = X265_MALLOC(pixel, 3 * MAX_CU_SIZE);
 m_refLeftFlt = X265_MALLOC(pixel, 3 * MAX_CU_SIZE);
 
-m_predYuv[0].create(MAX_CU_SIZE, MAX_CU_SIZE, csp);
-m_predYuv[1].create(MAX_CU_SIZE, MAX_CU_SIZE, csp);
 m_predShortYuv[0].create(MAX_CU_SIZE, MAX_CU_SIZE, csp);
 m_predShortYuv[1].create(MAX_CU_SIZE, MAX_CU_SIZE, csp);
-m_predTempYuv.create(MAX_CU_SIZE, MAX_CU_SIZE, csp);
 
 m_immedVals = X265_MALLOC(int16_t, 64 * (64 + NTAPS_LUMA - 1));
 }
diff -r e85b0aaa64e4 -r ddcc46309023 source/encoder/predict.h
--- a/source/encoder/predict.h  Thu Jul 31 11:08:02 2014 +0530
+++ b/source/encoder/predict.h  Fri Aug 01 15:04:36 2014 +0530
@@ -39,17 +39,13 @@
 {
 protected:
 
-/* TODO: remove m_predYuv, m_predTempYuv, these should just be temporary 
structs inside predInterSearch */
-TComYuv   m_predYuv[2];
-TComYuv   m_predTempYuv;
-
 ShortYuv  m_predShortYuv[2]; //temporary storage for weighted prediction
 int16_t*  m_immedVals;
 
 /* Slice information */
 Slice*m_slice;
 int   m_csp;
-
+
 /* CU information for prediction */
 int   m_width;
 int   m_height; 
@@ -75,7 +71,7 @@
 void getLLSPrediction(TComPattern* pcPattern, int* src0, int srcstride, 
pixel* dst0, int dststride, uint32_t width, uint32_t height, uint32_t ext0);
 
 bool checkIdenticalMotion();
-
+
 public:
 
 // Intra prediction buffers
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


  1   2   >