Re: [x265] [PATCH] Support for HLG-graded content and pic_struct

2018-04-12 Thread Vittorio Giovara
On Thu, Apr 12, 2018 at 4:49 PM, Vittorio Giovara <
vittorio.giov...@gmail.com> wrote:

>
>
>
> On Thu, Apr 12, 2018 at 1:44 PM,  wrote:
>
>> # HG changeset patch
>> # User Ashok Kumar Mishra 
>> # Date 1523532439 -19800
>> #  Thu Apr 12 16:57:19 2018 +0530
>> # Node ID ace55bce0e3c6e0beb52712fd71e01025bd73a22
>> # Parent  04a337abd70de269cef7d9655365f3a3ebde02aa
>> Support for HLG-graded content and pic_struct
>>
>> diff -r 04a337abd70d -r ace55bce0e3c source/common/param.cpp
>> --- a/source/common/param.cpp   Thu Apr 12 15:10:59 2018 +0530
>> +++ b/source/common/param.cpp   Thu Apr 12 16:57:19 2018 +0530
>> @@ -134,7 +134,8 @@
>>  param->bEmitInfoSEI = 1;
>>  param->bEmitHDRSEI = 0;
>>  param->bEmitIDRRecoverySEI = 0;
>> -/* CU definitions */
>> +
>> +   /* CU definitions */
>>  param->maxCUSize = 64;
>>  param->minCUSize = 8;
>>  param->tuQTMaxInterDepth = 1;
>> @@ -192,7 +193,8 @@
>>  param->bEnableSAO = 1;
>>  param->bSaoNonDeblocked = 0;
>>  param->bLimitSAO = 0;
>> -/* Coding Quality */
>> +
>> +   /* Coding Quality */
>>  param->cbQpOffset = 0;
>>  param->crQpOffset = 0;
>>  param->rdPenalty = 0;
>> @@ -302,6 +304,10 @@
>>  param->bLowPassDct = 0;
>>  param->bMVType = 0;
>>  param->bSingleSeiNal = 0;
>> +
>> +   /* SEI messages */
>> +   param->preferredTransferCharacteristics = -1;
>> +   param->pictureStructure = -1;
>>  }
>>
>>  int x265_param_default_preset(x265_param* param, const char* preset,
>> const char* tune)
>> @@ -1030,6 +1036,8 @@
>>  OPT("max-ausize-factor") p->maxAUSizeFactor = atof(value);
>>  OPT("dynamic-refine") p->bDynamicRefine = atobool(value);
>>  OPT("single-sei") p->bSingleSeiNal = atobool(value);
>> +   OPT("atc-sei") p->preferredTransferCharacteristics =
>> atoi(value);
>> +   OPT("pic-struct") p->pictureStructure = atoi(value);
>>  else
>>  return X265_PARAM_BAD_NAME;
>>  }
>> diff -r 04a337abd70d -r ace55bce0e3c source/encoder/encoder.cpp
>> --- a/source/encoder/encoder.cppThu Apr 12 15:10:59 2018 +0530
>> +++ b/source/encoder/encoder.cppThu Apr 12 16:57:19 2018 +0530
>> @@ -338,10 +338,12 @@
>>
>>  if (m_param->bEmitHRDSEI)
>>  m_rateControl->initHRD(m_sps);
>> +
>>  if (!m_rateControl->init(m_sps))
>>  m_aborted = true;
>>  if (!m_lookahead->create())
>>  m_aborted = true;
>> +
>>  initRefIdx();
>>  if (m_param->analysisSave && m_param->bUseAnalysisFile)
>>  {
>>
>
> For the future, could you please keep cosmetic changes (such as the ones
> above) in a separate patch?
> It gets confusing really fast and makes reading history needlessly fast.
>
>
needlessy hard*
-- 
Vittorio
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


Re: [x265] [PATCH] Support for HLG-graded content and pic_struct

2018-04-12 Thread Vittorio Giovara
On Thu, Apr 12, 2018 at 1:44 PM,  wrote:

> # HG changeset patch
> # User Ashok Kumar Mishra 
> # Date 1523532439 -19800
> #  Thu Apr 12 16:57:19 2018 +0530
> # Node ID ace55bce0e3c6e0beb52712fd71e01025bd73a22
> # Parent  04a337abd70de269cef7d9655365f3a3ebde02aa
> Support for HLG-graded content and pic_struct
>
> diff -r 04a337abd70d -r ace55bce0e3c source/common/param.cpp
> --- a/source/common/param.cpp   Thu Apr 12 15:10:59 2018 +0530
> +++ b/source/common/param.cpp   Thu Apr 12 16:57:19 2018 +0530
> @@ -134,7 +134,8 @@
>  param->bEmitInfoSEI = 1;
>  param->bEmitHDRSEI = 0;
>  param->bEmitIDRRecoverySEI = 0;
> -/* CU definitions */
> +
> +   /* CU definitions */
>  param->maxCUSize = 64;
>  param->minCUSize = 8;
>  param->tuQTMaxInterDepth = 1;
> @@ -192,7 +193,8 @@
>  param->bEnableSAO = 1;
>  param->bSaoNonDeblocked = 0;
>  param->bLimitSAO = 0;
> -/* Coding Quality */
> +
> +   /* Coding Quality */
>  param->cbQpOffset = 0;
>  param->crQpOffset = 0;
>  param->rdPenalty = 0;
> @@ -302,6 +304,10 @@
>  param->bLowPassDct = 0;
>  param->bMVType = 0;
>  param->bSingleSeiNal = 0;
> +
> +   /* SEI messages */
> +   param->preferredTransferCharacteristics = -1;
> +   param->pictureStructure = -1;
>  }
>
>  int x265_param_default_preset(x265_param* param, const char* preset,
> const char* tune)
> @@ -1030,6 +1036,8 @@
>  OPT("max-ausize-factor") p->maxAUSizeFactor = atof(value);
>  OPT("dynamic-refine") p->bDynamicRefine = atobool(value);
>  OPT("single-sei") p->bSingleSeiNal = atobool(value);
> +   OPT("atc-sei") p->preferredTransferCharacteristics =
> atoi(value);
> +   OPT("pic-struct") p->pictureStructure = atoi(value);
>  else
>  return X265_PARAM_BAD_NAME;
>  }
> diff -r 04a337abd70d -r ace55bce0e3c source/encoder/encoder.cpp
> --- a/source/encoder/encoder.cppThu Apr 12 15:10:59 2018 +0530
> +++ b/source/encoder/encoder.cppThu Apr 12 16:57:19 2018 +0530
> @@ -338,10 +338,12 @@
>
>  if (m_param->bEmitHRDSEI)
>  m_rateControl->initHRD(m_sps);
> +
>  if (!m_rateControl->init(m_sps))
>  m_aborted = true;
>  if (!m_lookahead->create())
>  m_aborted = true;
> +
>  initRefIdx();
>  if (m_param->analysisSave && m_param->bUseAnalysisFile)
>  {
>

For the future, could you please keep cosmetic changes (such as the ones
above) in a separate patch?
It gets confusing really fast and makes reading history needlessly fast.
-- 
Vittorio
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


Re: [x265] [PATCH] Support for HLG-graded content and pic_struct

2018-04-12 Thread Mario *LigH* Rohkrämer

Ashok Kumar Mishra schrieb am 12.04.2018 um 14:21:
+       H0("   --pic-struct         Set the picture structure 
and emits it in the picture timing SEI message. Values in the range 
0..12. See D.3.3 of the HEVC spec. for a detailed explanation.");


Missing a new line at the end.

Furthermore, another very very long CLI help output line (190 chars)...
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


Re: [x265] [PATCH] Support for HLG-graded content and pic_struct

2018-04-12 Thread Ashok Kumar Mishra
On Thu, Apr 12, 2018 at 5:44 PM, Ashok Kumar Mishra <
as...@multicorewareinc.com> wrote:

> Adding the patch file.
>
>
> On Thu, Apr 12, 2018 at 5:14 PM,  wrote:
>
>> # HG changeset patch
>> # User Ashok Kumar Mishra 
>> # Date 1523532439 -19800
>> #  Thu Apr 12 16:57:19 2018 +0530
>> # Node ID ace55bce0e3c6e0beb52712fd71e01025bd73a22
>> # Parent  04a337abd70de269cef7d9655365f3a3ebde02aa
>> Support for HLG-graded content and pic_struct
>>
>> diff -r 04a337abd70d -r ace55bce0e3c source/common/param.cpp
>> --- a/source/common/param.cpp   Thu Apr 12 15:10:59 2018 +0530
>> +++ b/source/common/param.cpp   Thu Apr 12 16:57:19 2018 +0530
>> @@ -134,7 +134,8 @@
>>  param->bEmitInfoSEI = 1;
>>  param->bEmitHDRSEI = 0;
>>  param->bEmitIDRRecoverySEI = 0;
>> -/* CU definitions */
>> +
>> +   /* CU definitions */
>>  param->maxCUSize = 64;
>>  param->minCUSize = 8;
>>  param->tuQTMaxInterDepth = 1;
>> @@ -192,7 +193,8 @@
>>  param->bEnableSAO = 1;
>>  param->bSaoNonDeblocked = 0;
>>  param->bLimitSAO = 0;
>> -/* Coding Quality */
>> +
>> +   /* Coding Quality */
>>  param->cbQpOffset = 0;
>>  param->crQpOffset = 0;
>>  param->rdPenalty = 0;
>> @@ -302,6 +304,10 @@
>>  param->bLowPassDct = 0;
>>  param->bMVType = 0;
>>  param->bSingleSeiNal = 0;
>> +
>> +   /* SEI messages */
>> +   param->preferredTransferCharacteristics = -1;
>> +   param->pictureStructure = -1;
>>  }
>>
>>  int x265_param_default_preset(x265_param* param, const char* preset,
>> const char* tune)
>> @@ -1030,6 +1036,8 @@
>>  OPT("max-ausize-factor") p->maxAUSizeFactor = atof(value);
>>  OPT("dynamic-refine") p->bDynamicRefine = atobool(value);
>>  OPT("single-sei") p->bSingleSeiNal = atobool(value);
>> +   OPT("atc-sei") p->preferredTransferCharacteristics =
>> atoi(value);
>> +   OPT("pic-struct") p->pictureStructure = atoi(value);
>>  else
>>  return X265_PARAM_BAD_NAME;
>>  }
>> diff -r 04a337abd70d -r ace55bce0e3c source/encoder/encoder.cpp
>> --- a/source/encoder/encoder.cppThu Apr 12 15:10:59 2018 +0530
>> +++ b/source/encoder/encoder.cppThu Apr 12 16:57:19 2018 +0530
>> @@ -338,10 +338,12 @@
>>
>>  if (m_param->bEmitHRDSEI)
>>  m_rateControl->initHRD(m_sps);
>> +
>>  if (!m_rateControl->init(m_sps))
>>  m_aborted = true;
>>  if (!m_lookahead->create())
>>  m_aborted = true;
>> +
>>  initRefIdx();
>>  if (m_param->analysisSave && m_param->bUseAnalysisFile)
>>  {
>> @@ -2436,7 +2438,7 @@
>>  vui.defaultDisplayWindow.bottomOffset =
>> m_param->vui.defDispWinBottomOffset;
>>  vui.defaultDisplayWindow.leftOffset = m_param->vui.defDispWinLeftOff
>> set;
>>
>> -vui.frameFieldInfoPresentFlag = !!m_param->interlaceMode;
>> +   vui.frameFieldInfoPresentFlag = !!m_param->interlaceMode ||
>> (m_param->pictureStructure >= 0);
>>  vui.fieldSeqFlag = !!m_param->interlaceMode;
>>
>>  vui.hrdParametersPresentFlag = m_param->bEmitHRDSEI;
>> diff -r 04a337abd70d -r ace55bce0e3c source/encoder/frameencoder.cpp
>> --- a/source/encoder/frameencoder.cpp   Thu Apr 12 15:10:59 2018 +0530
>> +++ b/source/encoder/frameencoder.cpp   Thu Apr 12 16:57:19 2018 +0530
>> @@ -674,9 +674,14 @@
>>  sei->m_picStruct = (poc & 1) ? 1 /* top */ : 2 /* bottom
>> */;
>>  else if (m_param->interlaceMode == 1)
>>  sei->m_picStruct = (poc & 1) ? 2 /* bottom */ : 1 /* top
>> */;
>> -else
>> -sei->m_picStruct = 0;
>> -sei->m_sourceScanType = 0;
>> +   else
>> +   sei->m_picStruct =
>> m_param->pictureStructure;
>> +
>> +   if (m_param->interlaceMode)
>> +sei->m_sourceScanType = 0;
>> +   else
>> +sei->m_sourceScanType = 1;
>> +
>>  sei->m_duplicateFlag = false;
>>  }
>>
>> @@ -696,6 +701,18 @@
>>  sei->write(m_bs, *slice->m_sps);
>>  sei->alignAndSerialize(m_bs, false, m_param->bSingleSeiNal,
>> NAL_UNIT_PREFIX_SEI, m_nalList);
>>  }
>> +
>> +   if (m_param->preferredTransferCharacteristics > -1 &&
>> slice->isIRAP())
>> +   {
>> +   SEIAlternativeTC m_seiAlternativeTC;
>> +   m_seiAlternativeTC.m_preferredTransferCharacteristics =
>> m_param->preferredTransferCharacteristics;
>> +   m_bs.resetBits();
>> +   int payloadSize = m_seiAlternativeTC.countPayloa
>> dSize(*slice->m_sps);
>> +   m_seiAlternativeTC.setSize(payloadSize);
>> +   m_seiAlternativeTC.write(m_bs, *slice->m_sps);
>> +   m_seiAlternativeTC.alignAndSerialize(m_bs, false,
>> m_param->bSingleSeiNal, NAL_UNIT_PREFIX_SEI, m_nalList);
>> +   }
>> +
>>  bool isSei = false;
>>  /* Write user SEI */
>>  for (int i =

Re: [x265] [PATCH] Support for HLG-graded content and pic_struct

2018-04-12 Thread Ashok Kumar Mishra
Adding the patch file.

On Thu, Apr 12, 2018 at 5:14 PM,  wrote:

> # HG changeset patch
> # User Ashok Kumar Mishra 
> # Date 1523532439 -19800
> #  Thu Apr 12 16:57:19 2018 +0530
> # Node ID ace55bce0e3c6e0beb52712fd71e01025bd73a22
> # Parent  04a337abd70de269cef7d9655365f3a3ebde02aa
> Support for HLG-graded content and pic_struct
>
> diff -r 04a337abd70d -r ace55bce0e3c source/common/param.cpp
> --- a/source/common/param.cpp   Thu Apr 12 15:10:59 2018 +0530
> +++ b/source/common/param.cpp   Thu Apr 12 16:57:19 2018 +0530
> @@ -134,7 +134,8 @@
>  param->bEmitInfoSEI = 1;
>  param->bEmitHDRSEI = 0;
>  param->bEmitIDRRecoverySEI = 0;
> -/* CU definitions */
> +
> +   /* CU definitions */
>  param->maxCUSize = 64;
>  param->minCUSize = 8;
>  param->tuQTMaxInterDepth = 1;
> @@ -192,7 +193,8 @@
>  param->bEnableSAO = 1;
>  param->bSaoNonDeblocked = 0;
>  param->bLimitSAO = 0;
> -/* Coding Quality */
> +
> +   /* Coding Quality */
>  param->cbQpOffset = 0;
>  param->crQpOffset = 0;
>  param->rdPenalty = 0;
> @@ -302,6 +304,10 @@
>  param->bLowPassDct = 0;
>  param->bMVType = 0;
>  param->bSingleSeiNal = 0;
> +
> +   /* SEI messages */
> +   param->preferredTransferCharacteristics = -1;
> +   param->pictureStructure = -1;
>  }
>
>  int x265_param_default_preset(x265_param* param, const char* preset,
> const char* tune)
> @@ -1030,6 +1036,8 @@
>  OPT("max-ausize-factor") p->maxAUSizeFactor = atof(value);
>  OPT("dynamic-refine") p->bDynamicRefine = atobool(value);
>  OPT("single-sei") p->bSingleSeiNal = atobool(value);
> +   OPT("atc-sei") p->preferredTransferCharacteristics =
> atoi(value);
> +   OPT("pic-struct") p->pictureStructure = atoi(value);
>  else
>  return X265_PARAM_BAD_NAME;
>  }
> diff -r 04a337abd70d -r ace55bce0e3c source/encoder/encoder.cpp
> --- a/source/encoder/encoder.cppThu Apr 12 15:10:59 2018 +0530
> +++ b/source/encoder/encoder.cppThu Apr 12 16:57:19 2018 +0530
> @@ -338,10 +338,12 @@
>
>  if (m_param->bEmitHRDSEI)
>  m_rateControl->initHRD(m_sps);
> +
>  if (!m_rateControl->init(m_sps))
>  m_aborted = true;
>  if (!m_lookahead->create())
>  m_aborted = true;
> +
>  initRefIdx();
>  if (m_param->analysisSave && m_param->bUseAnalysisFile)
>  {
> @@ -2436,7 +2438,7 @@
>  vui.defaultDisplayWindow.bottomOffset =
> m_param->vui.defDispWinBottomOffset;
>  vui.defaultDisplayWindow.leftOffset = m_param->vui.defDispWinLeftOff
> set;
>
> -vui.frameFieldInfoPresentFlag = !!m_param->interlaceMode;
> +   vui.frameFieldInfoPresentFlag = !!m_param->interlaceMode ||
> (m_param->pictureStructure >= 0);
>  vui.fieldSeqFlag = !!m_param->interlaceMode;
>
>  vui.hrdParametersPresentFlag = m_param->bEmitHRDSEI;
> diff -r 04a337abd70d -r ace55bce0e3c source/encoder/frameencoder.cpp
> --- a/source/encoder/frameencoder.cpp   Thu Apr 12 15:10:59 2018 +0530
> +++ b/source/encoder/frameencoder.cpp   Thu Apr 12 16:57:19 2018 +0530
> @@ -674,9 +674,14 @@
>  sei->m_picStruct = (poc & 1) ? 1 /* top */ : 2 /* bottom
> */;
>  else if (m_param->interlaceMode == 1)
>  sei->m_picStruct = (poc & 1) ? 2 /* bottom */ : 1 /* top
> */;
> -else
> -sei->m_picStruct = 0;
> -sei->m_sourceScanType = 0;
> +   else
> +   sei->m_picStruct =
> m_param->pictureStructure;
> +
> +   if (m_param->interlaceMode)
> +sei->m_sourceScanType = 0;
> +   else
> +sei->m_sourceScanType = 1;
> +
>  sei->m_duplicateFlag = false;
>  }
>
> @@ -696,6 +701,18 @@
>  sei->write(m_bs, *slice->m_sps);
>  sei->alignAndSerialize(m_bs, false, m_param->bSingleSeiNal,
> NAL_UNIT_PREFIX_SEI, m_nalList);
>  }
> +
> +   if (m_param->preferredTransferCharacteristics > -1 &&
> slice->isIRAP())
> +   {
> +   SEIAlternativeTC m_seiAlternativeTC;
> +   m_seiAlternativeTC.m_preferredTransferCharacteristics =
> m_param->preferredTransferCharacteristics;
> +   m_bs.resetBits();
> +   int payloadSize = m_seiAlternativeTC.countPayloa
> dSize(*slice->m_sps);
> +   m_seiAlternativeTC.setSize(payloadSize);
> +   m_seiAlternativeTC.write(m_bs, *slice->m_sps);
> +   m_seiAlternativeTC.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++)
> @@ -729,8 +746,9 @@
>  else
>  x265_log(m_param, X265_LOG_ERROR, "Unrecognized SEI type\n");
>  }
> -isSei |= ((m_frame->m_lowres.bKeyframe && m_param->