[x265] [PATCH] Enhance VBV lookahead of RADL pictures

Ashok Kumar Mishra ashok at multicorewareinc.com
Mon Jul 30 09:42:46 CEST 2018


On Thu, Jul 26, 2018 at 2:28 PM, <aruna at multicorewareinc.com> wrote:

> # HG changeset patch
> # User Aruna Matheswaran <aruna at multicorewareinc.com>
> # Date 1532078824 -19800
> #      Fri Jul 20 14:57:04 2018 +0530
> # Node ID 29345837cd2057dd2cfca837c1a36cab94e41bc4
> # Parent  79c76e42cb28876d3fa3141f5f1f1a6b3973af0a
> Enhance VBV lookahead of RADL pictures
>
> This patch does the following,
> 1) Modifies the slice type enforcement flow to enhance VBV lookahead of
> RADL frames.
> 2) Update test CLI.
>
> diff -r 79c76e42cb28 -r 29345837cd20 source/encoder/slicetype.cpp
> --- a/source/encoder/slicetype.cpp      Wed Jul 25 14:40:47 2018 +0530
> +++ b/source/encoder/slicetype.cpp      Fri Jul 20 14:57:04 2018 +0530
> @@ -1147,14 +1147,6 @@
>                      bframes--;
>                  }
>              }
> -            if (m_param->radl && !m_param->bOpenGOP && list[bframes + 1])
> -            {
> -                if ((frm.frameNum - m_lastKeyframe) >
> (m_param->keyframeMax - m_param->radl - 1) && (frm.frameNum -
> m_lastKeyframe) < m_param->keyframeMax)
> -                    frm.sliceType = X265_TYPE_B;
> -                if ((frm.frameNum - m_lastKeyframe) ==
> (m_param->keyframeMax - m_param->radl - 1))
> -                    frm.sliceType = X265_TYPE_P;
> -            }
> -
>              if (bframes == m_param->bframes || !list[bframes + 1])
>              {
>                  if (IS_X265_TYPE_B(frm.sliceType))
> @@ -1538,6 +1530,7 @@
>      int numBFrames = 0;
>      int numAnalyzed = numFrames;
>      bool isScenecut = scenecut(frames, 0, 1, true, origNumFrames);
> +
>      /* When scenecut threshold is set, use scenecut detection for I frame
> placements */
>      if (m_param->scenecutThreshold && isScenecut)
>      {
> @@ -1645,14 +1638,28 @@
>              frames[numFrames]->sliceType = X265_TYPE_P;
>          }
>
> -        /* Check scenecut on the first minigop. */
> -        for (int j = 1; j < numBFrames + 1; j++)
> +        bool bForceRADL = m_param->radl && !m_param->bOpenGOP;
> +        bool bLastMiniGop = (framecnt >= m_param->bframes + 1) ? false :
> true;
> +        int preRADL = m_lastKeyframe + m_param->keyframeMax -
> m_param->radl - 1; /*Frame preceeding RADL in POC order*/
> +        if (bForceRADL && (frames[0]->frameNum == preRADL) &&
> !bLastMiniGop)
>          {
> -            if (scenecut(frames, j, j + 1, false, origNumFrames))
> +            int j = 1;
> +            numBFrames = m_param->radl;
> +            for (; j <= m_param->radl; j++)
> +                frames[j]->sliceType = X265_TYPE_B;
> +            frames[j]->sliceType = X265_TYPE_I;
> +        }
> +        else /* Check scenecut and RADL on the first minigop. */
> +        {
> +            for (int j = 1; j < numBFrames + 1; j++)
>              {
> -                frames[j]->sliceType = X265_TYPE_P;
> -                numAnalyzed = j;
> -                break;
> +                if (scenecut(frames, j, j + 1, false, origNumFrames) ||
> +                    (bForceRADL && (frames[j]->frameNum == preRADL)))
> +                {
> +                    frames[j]->sliceType = X265_TYPE_P;
> +                    numAnalyzed = j;
> +                    break;
> +                }
>              }
>          }
>          resetStart = bKeyframe ? 1 : X265_MIN(numBFrames + 2, numAnalyzed
> + 1);
> diff -r 79c76e42cb28 -r 29345837cd20 source/test/regression-tests.txt
> --- a/source/test/regression-tests.txt  Wed Jul 25 14:40:47 2018 +0530
> +++ b/source/test/regression-tests.txt  Fri Jul 20 14:57:04 2018 +0530
> @@ -149,7 +149,7 @@
>  Kimono1_1920x1080_24_400.yuv,--preset veryslow --crf 4 --cu-lossless
> --slices 2 --limit-refs 3 --limit-modes
>  Kimono1_1920x1080_24_400.yuv,--preset placebo --ctu 32 --max-tu-size 8
> --limit-tu 2
>  big_buck_bunny_360p24.y4m, --keyint 60 --min-keyint 40 --gop-lookahead 14
> -BasketballDrive_1920x1080_50.y4m, --preset medium --no-open-gop --keyint
> 50 --min-keyint 50 --radl 2
> +BasketballDrive_1920x1080_50.y4m, --preset medium --no-open-gop --keyint
> 50 --min-keyint 50 --radl 2 --vbv-maxrate 5000 --vbv-bufsize 5000
>
>  # Main12 intraCost overflow bug test
>  720p50_parkrun_ter.y4m,--preset medium
>
> _______________________________________________
> 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/20180730/2eeed9d4/attachment.html>


More information about the x265-devel mailing list