[x265] [PATCH] Set IDR's NAL type to NAL_UNIT_CODED_SLICE_IDR_N_LP if it does not have

Ashok Kumar Mishra ashok at multicorewareinc.com
Fri Mar 16 13:28:03 CET 2018


On Thu, Mar 15, 2018 at 11:37 AM, <aruna at multicorewareinc.com> wrote:

> # HG changeset patch
> # User Aruna Matheswaran <aruna at multicorewareinc.com>
> # Date 1521091372 -19800
> #      Thu Mar 15 10:52:52 2018 +0530
> # Node ID 634b57c329d4d960c098fc7f01feb77ed95ea3a7
> # Parent  d7c26df32fae052b7e895fee9bda1c22b24cc44b
> Set IDR's NAL type to NAL_UNIT_CODED_SLICE_IDR_N_LP if it does not have
> associated leading pictures
>
> diff -r d7c26df32fae -r 634b57c329d4 source/common/slice.h
> --- a/source/common/slice.h     Tue Mar 13 13:40:13 2018 +0530
> +++ b/source/common/slice.h     Thu Mar 15 10:52:52 2018 +0530
> @@ -385,12 +385,14 @@
>      bool getRapPicFlag() const
>      {
>          return m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL
> +            || m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP
>              || m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA;
>      }
>
>      bool getIdrPicFlag() const
>      {
> -        return m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL;
> +        return m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL
> +            || m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP;
>      }
>
>      bool isIRAP() const   { return m_nalUnitType >= 16 && m_nalUnitType
> <= 23; }
> diff -r d7c26df32fae -r 634b57c329d4 source/encoder/dpb.cpp
> --- a/source/encoder/dpb.cpp    Tue Mar 13 13:40:13 2018 +0530
> +++ b/source/encoder/dpb.cpp    Thu Mar 15 10:52:52 2018 +0530
> @@ -133,7 +133,7 @@
>      bool bIsKeyFrame = newFrame->m_lowres.bKeyframe;
>
>      slice->m_nalUnitType = getNalUnitType(pocCurr, bIsKeyFrame);
> -    if (slice->m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL)
> +    if (slice->m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL ||
> slice->m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP)
>          m_lastIDR = pocCurr;
>      slice->m_lastIDR = m_lastIDR;
>      slice->m_sliceType = IS_X265_TYPE_B(type) ? B_SLICE : (type ==
> X265_TYPE_P) ? P_SLICE : I_SLICE;
> @@ -250,7 +250,7 @@
>  /* Marking reference pictures when an IDR/CRA is encountered. */
>  void DPB::decodingRefreshMarking(int pocCurr, NalUnitType nalUnitType)
>  {
> -    if (nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL)
> +    if (nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL || nalUnitType ==
> NAL_UNIT_CODED_SLICE_IDR_N_LP)
>      {
>          /* If the nal_unit_type is IDR, all pictures in the reference
> picture
>           * list are marked as "unused for reference" */
> @@ -326,10 +326,10 @@
>  NalUnitType DPB::getNalUnitType(int curPOC, bool bIsKeyFrame)
>  {
>      if (!curPOC)
> -        return NAL_UNIT_CODED_SLICE_IDR_W_RADL;
> +        return NAL_UNIT_CODED_SLICE_IDR_N_LP;
>
>      if (bIsKeyFrame)
> -        return m_bOpenGOP ? NAL_UNIT_CODED_SLICE_CRA :
> NAL_UNIT_CODED_SLICE_IDR_W_RADL;
> +        return m_bOpenGOP ? NAL_UNIT_CODED_SLICE_CRA :
> m_bhasLeadingPicture ? NAL_UNIT_CODED_SLICE_IDR_W_RADL :
> NAL_UNIT_CODED_SLICE_IDR_N_LP;
>
>      if (m_pocCRA && curPOC < m_pocCRA)
>          // All leading pictures are being marked as TFD pictures here
> since
> diff -r d7c26df32fae -r 634b57c329d4 source/encoder/dpb.h
> --- a/source/encoder/dpb.h      Tue Mar 13 13:40:13 2018 +0530
> +++ b/source/encoder/dpb.h      Thu Mar 15 10:52:52 2018 +0530
> @@ -40,6 +40,7 @@
>      int                m_lastIDR;
>      int                m_pocCRA;
>      int                m_bOpenGOP;
> +    int                m_bhasLeadingPicture;
>      bool               m_bRefreshPending;
>      bool               m_bTemporalSublayer;
>      PicList            m_picList;
> @@ -50,6 +51,7 @@
>      {
>          m_lastIDR = 0;
>          m_pocCRA = 0;
> +        m_bhasLeadingPicture = param->radl;
>          m_bRefreshPending = false;
>          m_frameDataFreeList = NULL;
>          m_bOpenGOP = param->bOpenGOP;
>
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>
>

Pushed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20180316/9a1df0c3/attachment-0001.html>


More information about the x265-devel mailing list