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

2013-09-19 Thread Deepthi Nandakumar
FrameEncoder and compressFrame needs to be refactored for mallocs and
failures to be handled correctly.


On Thu, Sep 19, 2013 at 1:31 PM, Gopu Govindaswamy 
g...@multicorewareinc.com wrote:

 # HG changeset patch
 # User Gopu Govindaswamy g...@multicorewareinc.com
 # Date 1379577682 -19800
 # Node ID 92e1ac03b081eccd8bc797142cc22033c87d475d
 # Parent  26d6f155f8df69147f40f4945d99c29a52988c56
 do not use std;:list for the class AccessUnit

 Removed std::list from encoder and nalunits

 diff -r 26d6f155f8df -r 92e1ac03b081 source/Lib/TLibCommon/NAL.h
 --- a/source/Lib/TLibCommon/NAL.h   Wed Sep 18 16:13:33 2013 -0500
 +++ b/source/Lib/TLibCommon/NAL.h   Thu Sep 19 13:31:22 2013 +0530
 @@ -114,6 +114,7 @@
   * emulation_prevention_three_byte symbols.
   */
  NALUnitEBSP(OutputNALUnit nalu);
 +void init(OutputNALUnit nalu);
  };
  }
  //! \}
 diff -r 26d6f155f8df -r 92e1ac03b081 source/Lib/TLibEncoder/NALwrite.h
 --- a/source/Lib/TLibEncoder/NALwrite.h Wed Sep 18 16:13:33 2013 -0500
 +++ b/source/Lib/TLibEncoder/NALwrite.h Thu Sep 19 13:31:22 2013 +0530
 @@ -83,6 +83,14 @@
  write(m_nalUnitData, nalu, m_packetSize);
  }

 +inline void NALUnitEBSP::init(OutputNALUnit nalu)
 +{
 +m_nalUnitType = nalu.m_nalUnitType;
 +m_temporalId = nalu.m_temporalId;
 +m_reservedZero6Bits = nalu.m_reservedZero6Bits;
 +write(m_nalUnitData, nalu, m_packetSize);
 +}
 +
  void copyNaluData(OutputNALUnit naluDest, const OutputNALUnit naluSrc);
  }

 diff -r 26d6f155f8df -r 92e1ac03b081 source/Lib/TLibEncoder/TEncTop.cpp
 --- a/source/Lib/TLibEncoder/TEncTop.cppWed Sep 18 16:13:33 2013
 -0500
 +++ b/source/Lib/TLibEncoder/TEncTop.cppThu Sep 19 13:31:22 2013
 +0530
 @@ -114,7 +114,7 @@
  for (int i = 0; i  param.frameNumThreads; i++)
  {
  // Ensure frame encoder is idle before destroying it
 -AccessUnit tmp;
 +NALUnitEBSP **tmp = NULL;
  m_frameEncoder[i].getEncodedPicture(tmp);
  m_frameEncoder[i].destroy();
  }
 @@ -155,19 +155,19 @@
  }
  }

 -int TEncTop::getStreamHeaders(AccessUnit accessUnit)
 +int TEncTop::getStreamHeaders(NALUnitEBSP **nalunits)
  {
 -return m_frameEncoder-getStreamHeaders(accessUnit);
 +return m_frameEncoder-getStreamHeaders(nalunits);
  }

  /**
   \param   flush   force encoder to encode a frame
   \param   pic_in  input original YUV picture or NULL
   \param   pic_out pointer to reconstructed picture struct
 - \param   accessUnitsOut  output bitstream
 + \param   nalunitsoutput bitstream
   \retval  number of encoded pictures
   */
 -int TEncTop::encode(bool flush, const x265_picture_t* pic_in,
 x265_picture_t *pic_out, AccessUnit accessUnitOut)
 +int TEncTop::encode(bool flush, const x265_picture_t* pic_in,
 x265_picture_t *pic_out, NALUnitEBSP **nalunits)
  {
  if (pic_in)
  {
 @@ -207,7 +207,7 @@
  // getEncodedPicture() should block until the FrameEncoder has
 completed
  // encoding the frame.  This is how back-pressure through the API is
  // accomplished when the encoder is full.
 -TComPic *out = curEncoder-getEncodedPicture(accessUnitOut);
 +TComPic *out = curEncoder-getEncodedPicture(nalunits);

  if (!out  flush)
  {
 @@ -221,7 +221,7 @@
  {
  curEncoder = m_frameEncoder[m_curEncoder];
  m_curEncoder = (m_curEncoder + 1) % param.frameNumThreads;
 -out = curEncoder-getEncodedPicture(accessUnitOut);
 +out = curEncoder-getEncodedPicture(nalunits);
  }
  while (!out  flushed != m_curEncoder);
  }
 @@ -253,7 +253,7 @@
  pic_out-stride[2] = recpic-getCStride();
  }

 -double bits = calculateHashAndPSNR(out, accessUnitOut);
 +double bits = calculateHashAndPSNR(out, nalunits);
  // Allow this frame to be recycled if no frame encoders are using
 it for reference
  ATOMIC_DEC(out-m_countRefEncoders);

 @@ -481,7 +481,7 @@

  /* Returns Number of bits in current encoded pic */

 -double TEncTop::calculateHashAndPSNR(TComPic* pic, AccessUnit accessUnit)
 +double TEncTop::calculateHashAndPSNR(TComPic* pic, NALUnitEBSP **nalunits)
  {
  TComPicYuv* recon = pic-getPicYuvRec();
  TComPicYuv* orig  = pic-getPicYuvOrg();
 @@ -537,8 +537,12 @@
  OutputNALUnit onalu(NAL_UNIT_SUFFIX_SEI, 0);
  m_frameEncoder-m_seiWriter.writeSEImessage(onalu.m_Bitstream,
 sei_recon_picture_digest, pic-getSlice()-getSPS());
  writeRBSPTrailingBits(onalu.m_Bitstream);
 -
 -accessUnit.insert(accessUnit.end(), new NALUnitEBSP(onalu));
 +
 +int count = 0;
 +while(nalunits[count] != NULL)
 +count++;
 +nalunits[count] = (NALUnitEBSP *)X265_MALLOC(NALUnitEBSP, 1);
 +nalunits[count]-init(onalu);
  }

  /* calculate the size of the access unit, excluding:
 @@ -546,13 

Re: [x265] [PATCH 5 of 5] cli: report errors from registering signal handler

2013-09-19 Thread SF Markus Elfring



+cliopt.log(X265_LOG_ERROR, Unable to register CTRL+C handler, error 
%d\n, errno);


How do you think about to retrieve a message text for the passed error code?
Would you like to call the function strerror there (and similar source 
code places)?

http://pubs.opengroup.org/onlinepubs/9699919799/functions/strerror.html

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


Re: [x265] [PATCH] lookahead: fix crash for I frame cost estimation

2013-09-19 Thread Deepthi Nandakumar
Can you try sending this as a fresh patch to the mailing list? Does not
apply cleanly to the parent node.


On Thu, Sep 19, 2013 at 2:46 PM, Deepthi Devaki Akkoorath 
deepthidev...@multicorewareinc.com wrote:

 # HG changeset patch
 # User Deepthi Devaki deepthidev...@multicorewareinc.com
 # Date 1379582068 -19800
 # Node ID d52de033d7dde00255e9d55ece138c33fd61
 # Parent  26d6f155f8df69147f40f4945d99c29a52988c56
 lookahead: fix crash for I frame cost estimation

 diff -r 26d6f155f8df -r d52de033d7dd source/encoder/slicetype.cpp
 --- a/source/encoder/slicetype.cpp Wed Sep 18 16:13:33 2013 -0500
 +++ b/source/encoder/slicetype.cpp Thu Sep 19 14:44:28 2013 +0530
 @@ -360,44 +360,46 @@
  mvmax.x = (uint16_t)((widthInCU - cux - 1) * cuSize + 8);
  mvmax.y = (uint16_t)((heightInCU - cuy - 1) * cuSize + 8);

 -for (int i = 0; i  1 + bBidir; i++)
 +if (p0 != p1)
  {
 -if (!bDoSearch[i])
 +for (int i = 0; i  1 + bBidir; i++)
  {
 -/* Use previously calculated cost */
 +if (!bDoSearch[i])
 +{
 +/* Use previously calculated cost */
 +COPY2_IF_LT(bcost, *fenc_costs[i], listused, i + 1);
 +continue;
 +}
 +int numc = 0;
 +MV mvc[4], mvp;
 +MV *fenc_mv = fenc_mvs[i];
 +
 +/* Reverse-order MV prediction. */
 +mvc[0] = 0;
 +mvc[2] = 0;
 +#define MVC(mv) mvc[numc++] = mv;
 +if (cux  widthInCU - 1)
 +MVC(fenc_mv[1]);
 +if (cuy  heightInCU - 1)
 +{
 +MVC(fenc_mv[widthInCU]);
 +if (cux  0)
 +MVC(fenc_mv[widthInCU - 1]);
 +if (cux  widthInCU - 1)
 +MVC(fenc_mv[widthInCU + 1]);
 +}
 +#undef MVC
 +if (numc = 1)
 +mvp = mvc[0];
 +else
 +{
 +x265_median_mv(mvp, mvc[0], mvc[1], mvc[2]);
 +}
 +
 +*fenc_costs[i] = me.motionEstimate(i ? fref1 : fref0, mvmin,
 mvmax, mvp, numc, mvc, merange, *fenc_mvs[i]);
  COPY2_IF_LT(bcost, *fenc_costs[i], listused, i + 1);
 -continue;
  }
 -int numc = 0;
 -MV mvc[4], mvp;
 -MV *fenc_mv = fenc_mvs[i];
 -
 -/* Reverse-order MV prediction. */
 -mvc[0] = 0;
 -mvc[2] = 0;
 -#define MVC(mv) mvc[numc++] = mv;
 -if (cux  widthInCU - 1)
 -MVC(fenc_mv[1]);
 -if (cuy  heightInCU - 1)
 -{
 -MVC(fenc_mv[widthInCU]);
 -if (cux  0)
 -MVC(fenc_mv[widthInCU - 1]);
 -if (cux  widthInCU - 1)
 -MVC(fenc_mv[widthInCU + 1]);
 -}
 -#undef MVC
 -if (numc = 1)
 -mvp = mvc[0];
 -else
 -{
 -x265_median_mv(mvp, mvc[0], mvc[1], mvc[2]);
 -}
 -
 -*fenc_costs[i] = me.motionEstimate(i ? fref1 : fref0, mvmin,
 mvmax, mvp, numc, mvc, merange, *fenc_mvs[i]);
 -COPY2_IF_LT(bcost, *fenc_costs[i], listused, i + 1);
  }
 -
  if (!fenc-bIntraCalculated)
  {
  int nLog2SizeMinus2 = g_convertToBit[cuSize]; // partition size


 ___
 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


Re: [x265] [PATCH] types: use stdint.h data types for UChar, UShort, UInt64, Pel, TCoeff

2013-09-19 Thread Derek Buitenhuis
On 9/19/2013 5:18 AM, Steve Borho wrote:
 +typedef uint8_t  UChar;
 +typedef uint16_t UShort;
 +typedef unsigned int UInt;
 +typedef int64_t  Int64;
 +typedef uint64_t UInt64;

This seems quite wrong, since they're not necessarily analogous on
all platforms... like short.

Why not replace them properly?

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


Re: [x265] [PATCH 1 of 2] Always active sao-lcu-opt because we broken it after Frame Parallelism

2013-09-19 Thread Derek Buitenhuis
On 9/19/2013 10:16 AM, Min Chen wrote:
 +// Disabled because Frame Parallelism call processRowPost early, it is 
 broken data.
 +// OPT(sao-lcu-opt, param-saoLcuBasedOptimization,required_argument, 
 0, 0: SAO picture-based optimization, 1: SAO LCU-based optimization )

... Why not fix it instead of commenting stuff out?

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


Re: [x265] [PATCH 2 of 2] Control SAO and Deblock independence

2013-09-19 Thread chen
I check code again, no more reduce checks
 
the SAO split into three parts, one run before deblock and another after, if we 
disable ao-lcu-opt, we have to bypass all of SAO operators on row level, we 
process sao after frame finished.

At 2013-09-19 20:05:11,Derek Buitenhuis derek.buitenh...@gmail.com wrote:
On 9/19/2013 10:16 AM, Min Chen wrote:
 # HG changeset patch
 # User Min Chen chenm...@163.com
 # Date 1379582154 -28800
 # Node ID 9860ced6859d0779769c1e9369869dcb41bcd5b5
 # Parent  434dc0ee509734c1ee57a7650b2ba02b62c5d8c6
 Control SAO and Deblock independence

s/independence/independently/

Moreover, is there perhaps a better / core flexible way to do
this, other than littering the codebase with a bunch of checks
over and over again? Perhaps properly splitting them up, if it
is possible?

- Derek
___
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


Re: [x265] [PATCH 1 of 2] Always active sao-lcu-opt because we broken it after Frame Parallelism

2013-09-19 Thread chen
my 2 reasons:
1. turn it on may not get  improvement quality or bitrate, but we need disable 
other acceleration feature
2. Maintain a rarely used features to be increase the workload

At 2013-09-19 20:02:07,Derek Buitenhuis derek.buitenh...@gmail.com wrote:
On 9/19/2013 10:16 AM, Min Chen wrote:
 +// Disabled because Frame Parallelism call processRowPost early, it is 
 broken data.
 +// OPT(sao-lcu-opt, param-saoLcuBasedOptimization,required_argument, 
 0, 0: SAO picture-based optimization, 1: SAO LCU-based optimization )

... Why not fix it instead of commenting stuff out?

- Derek
___
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