[x265] Fwd: [PATCH] rc: Add multi-pass data to x265_rc_stats

Divya Manivannan divya at multicorewareinc.com
Mon Jun 13 08:15:09 CEST 2016


On Mon, Jun 13, 2016 at 11:00 AM, Divya Manivannan <
divya at multicorewareinc.com> wrote:

> # HG changeset patch
> # User Divya Manivannan <divya at multicorewareinc.com>
> # Date 1465554208 -19800
> #      Fri Jun 10 15:53:28 2016 +0530
> # Node ID c898428779dfbfaaf9b1e7eb2d7676d86a2f54c0
> # Parent  0af296185f7ae3e05493ecf164046ddfec085bb3
> rc: Add multi-pass data to x265_rc_stats
> x265_rc_stats is changed into void pointer to avoid the build number change
> whenever new fields are added to it in future.
>
> diff -r 0af296185f7a -r c898428779df source/CMakeLists.txt
> --- a/source/CMakeLists.txt     Tue Jun 07 09:20:11 2016 +0530
> +++ b/source/CMakeLists.txt     Fri Jun 10 15:53:28 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 85)
> +set(X265_BUILD 86)
>  configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
>                 "${PROJECT_BINARY_DIR}/x265.def")
>  configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
> diff -r 0af296185f7a -r c898428779df source/common/frame.cpp
> --- a/source/common/frame.cpp   Tue Jun 07 09:20:11 2016 +0530
> +++ b/source/common/frame.cpp   Fri Jun 10 15:53:28 2016 +0530
> @@ -42,12 +42,14 @@
>      m_prev = NULL;
>      m_param = NULL;
>      memset(&m_lowres, 0, sizeof(m_lowres));
> +    m_rcData = NULL;
>  }
>
>  bool Frame::create(x265_param *param, float* quantOffsets)
>  {
>      m_fencPic = new PicYuv;
>      m_param = param;
> +    CHECKED_MALLOC_ZERO(m_rcData, x265_rc_stats, 1);
>
>      if (m_fencPic->create(param->sourceWidth, param->sourceHeight,
> param->internalCsp) &&
>          m_lowres.create(m_fencPic, param->bframes, !!param->rc.aqMode))
> @@ -64,6 +66,8 @@
>          return true;
>      }
>      return false;
> +fail:
> +    return false;
>  }
>
>  bool Frame::allocEncodeData(x265_param *param, const SPS& sps)
> @@ -140,4 +144,5 @@
>      }
>
>      m_lowres.destroy();
> +    X265_FREE(m_rcData);
>  }
> diff -r 0af296185f7a -r c898428779df source/common/frame.h
> --- a/source/common/frame.h     Tue Jun 07 09:20:11 2016 +0530
> +++ b/source/common/frame.h     Fri Jun 10 15:53:28 2016 +0530
> @@ -72,6 +72,7 @@
>      Frame*                 m_prev;
>      x265_param*            m_param;              // Points to the latest
> param set for the frame.
>      x265_analysis_data     m_analysisData;
> +    x265_rc_stats*         m_rcData;
>      Frame();
>
>      bool create(x265_param *param, float* quantOffsets);
> diff -r 0af296185f7a -r c898428779df source/encoder/encoder.cpp
> --- a/source/encoder/encoder.cpp        Tue Jun 07 09:20:11 2016 +0530
> +++ b/source/encoder/encoder.cpp        Fri Jun 10 15:53:28 2016 +0530
> @@ -779,17 +779,22 @@
>
>              if (pic_out && m_param->rc.bStatWrite)
>              {
> -                pic_out->rcData.qpaRc = outFrame->m_encData->m_avgQpRc;
> -                pic_out->rcData.qRceq = curEncoder->m_rce.qRceq;
> -                pic_out->rcData.qpNoVbv = curEncoder->m_rce.qpNoVbv;
> -                pic_out->rcData.coeffBits =
> outFrame->m_encData->m_frameStats.coeffBits;
> -                pic_out->rcData.miscBits =
> outFrame->m_encData->m_frameStats.miscBits;
> -                pic_out->rcData.mvBits =
> outFrame->m_encData->m_frameStats.mvBits;
> -                pic_out->rcData.newQScale =
> x265_qp2qScale(outFrame->m_encData->m_avgQpRc);
> -                pic_out->rcData.poc = curEncoder->m_rce.poc;
> -                pic_out->rcData.encodeOrder =
> curEncoder->m_rce.encodeOrder;
> -                pic_out->rcData.sliceType = curEncoder->m_rce.sliceType;
> -                pic_out->rcData.keptAsRef = curEncoder->m_rce.sliceType
> == B_SLICE && !IS_REFERENCED(outFrame) ? 0 : 1;
> +                pic_out->rcData = outFrame->m_rcData;
> +                outFrame->m_rcData->qpaRc =
> outFrame->m_encData->m_avgQpRc;
> +                outFrame->m_rcData->qRceq = curEncoder->m_rce.qRceq;
> +                outFrame->m_rcData->qpNoVbv = curEncoder->m_rce.qpNoVbv;
> +                outFrame->m_rcData->coeffBits =
> outFrame->m_encData->m_frameStats.coeffBits;
> +                outFrame->m_rcData->miscBits =
> outFrame->m_encData->m_frameStats.miscBits;
> +                outFrame->m_rcData->mvBits =
> outFrame->m_encData->m_frameStats.mvBits;
> +                outFrame->m_rcData->qScale =
> outFrame->m_rcData->newQScale =
> x265_qp2qScale(outFrame->m_encData->m_avgQpRc);
> +                outFrame->m_rcData->poc = curEncoder->m_rce.poc;
> +                outFrame->m_rcData->encodeOrder =
> curEncoder->m_rce.encodeOrder;
> +                outFrame->m_rcData->sliceType =
> curEncoder->m_rce.sliceType;
> +                outFrame->m_rcData->keptAsRef =
> curEncoder->m_rce.sliceType == B_SLICE && !IS_REFERENCED(outFrame) ? 0 : 1;
> +                outFrame->m_rcData->qpAq = outFrame->m_encData->m_avgQpAq;
> +                outFrame->m_rcData->iCuCount =
> outFrame->m_encData->m_frameStats.percent8x8Intra * m_rateControl->m_ncu;
> +                outFrame->m_rcData->pCuCount =
> outFrame->m_encData->m_frameStats.percent8x8Inter * m_rateControl->m_ncu;
> +                outFrame->m_rcData->skipCuCount =
> outFrame->m_encData->m_frameStats.percent8x8Skip  * m_rateControl->m_ncu;
>              }
>

This still needs to be copied into x265_picture.....

It is copied into x265_picture in the above code: pic_out->rcData =
outFrame->m_rcData;

>
>              /* Allow this frame to be recycled if no frame encoders are
> using it for reference */
> diff -r 0af296185f7a -r c898428779df source/x265.h
> --- a/source/x265.h     Tue Jun 07 09:20:11 2016 +0530
> +++ b/source/x265.h     Fri Jun 10 15:53:28 2016 +0530
> @@ -153,17 +153,22 @@
>  /* Ratecontrol statistics */
>  typedef struct x265_rc_stats
>  {
> -    double  qpaRc;
> -    double  qRceq;
> -    double  qpNoVbv;
> -    double  newQScale;
> -    int     mvBits;
> -    int     miscBits;
> -    int     coeffBits;
> -    int     poc;
> -    int     encodeOrder;
> -    int     sliceType;
> -    int     keptAsRef;
> +    double   qpaRc;
> +    double   qpAq;
> +    double   qRceq;
> +    double   qpNoVbv;
> +    double   newQScale;
> +    double   iCuCount;
> +    double   pCuCount;
> +    double   skipCuCount;
> +    double   qScale;
> +    int      mvBits;
> +    int      miscBits;
> +    int      coeffBits;
> +    int      poc;
> +    int      encodeOrder;
> +    int      sliceType;
> +    int      keptAsRef;
>  } x265_rc_stats;
>
>
This definition can now be moved inside into frame.h.

I will move this definition and send the patch again.


>  /* Used to pass pictures into the encoder, and to get picture data back
> out of
> @@ -240,7 +245,7 @@
>      /* Ratecontrol statistics for collecting the ratecontrol information.
>       * It is not used for collecting the last pass ratecontrol data in
>       * multi pass ratecontrol mode. */
> -    x265_rc_stats rcData;
> +    void*  rcData;
>
>      uint64_t framesize;
>
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>



-- 
Deepthi Nandakumar
Engineering Manager, x265
Multicoreware, Inc

_______________________________________________
x265-devel mailing list
x265-devel at videolan.org
https://mailman.videolan.org/listinfo/x265-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20160613/0eb849cd/attachment.html>


More information about the x265-devel mailing list