[x265] [PATCH][master] Fix crash for main10 and main12 build when source resolution is not multiple of minCuSize for hist-scenecut

Srikanth Kurapati srikanth.kurapati at multicorewareinc.com
Thu Jun 23 08:11:01 UTC 2022


looks good to be pushed to master branch.

On Wed, Jun 22, 2022 at 4:32 PM Mahesh Pittala <mahesh at multicorewareinc.com>
wrote:

> From 041f00b36f4313b969463f4801e989f72486255d Mon Sep 17 00:00:00 2001
> From: Mahesh Pittala <mahesh at multicorewareinc.com>
> Date: Mon, 20 Jun 2022 11:57:00 +0530
> Subject: [PATCH] Fix crash for main10 and main12 build when source
> resolution
>  is not multiple of minCuSize
>
> ---
>  source/encoder/encoder.cpp | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
> index f33a6d053..a54b0e197 100644
> --- a/source/encoder/encoder.cpp
> +++ b/source/encoder/encoder.cpp
> @@ -252,9 +252,9 @@ void Encoder::create()
>
>      if (m_param->bHistBasedSceneCut)
>      {
> -        m_planeSizes[0] = (m_param->sourceWidth >>
> x265_cli_csps[p->internalCsp].width[0]) * (m_param->sourceHeight >>
> x265_cli_csps[m_param->internalCsp].height[0]);
> +        uint32_t planeSize = (m_param->sourceWidth >>
> x265_cli_csps[p->internalCsp].width[0]) * (m_param->sourceHeight >>
> x265_cli_csps[m_param->internalCsp].height[0]);
>          uint32_t pixelbytes = m_param->internalBitDepth > 8 ? 2 : 1;
> -        m_edgePic = X265_MALLOC(pixel, m_planeSizes[0] * pixelbytes);
> +        m_edgePic = X265_MALLOC(pixel, planeSize * pixelbytes);
>          m_edgeHistThreshold = m_param->edgeTransitionThreshold;
>          m_chromaHistThreshold = x265_min(m_edgeHistThreshold * 10.0,
> MAX_SCENECUT_THRESHOLD);
>          m_scaledEdgeThreshold = x265_min(m_edgeHistThreshold *
> SCENECUT_STRENGTH_FACTOR, MAX_SCENECUT_THRESHOLD);
> @@ -1664,7 +1664,7 @@ int Encoder::encode(const x265_picture* pic_in,
> x265_picture* pic_out)
>              if (pic->poc == 0)
>              {
>                  /* for entire encode compute the chroma plane sizes only
> once */
> -                for (int i = 1; i <
> x265_cli_csps[m_param->internalCsp].planes; i++)
> +                for (int i = 0; i <
> x265_cli_csps[m_param->internalCsp].planes; i++)
>                      m_planeSizes[i] = (pic->width >>
> x265_cli_csps[m_param->internalCsp].width[i]) * (pic->height >>
> x265_cli_csps[m_param->internalCsp].height[i]);
>              }
>
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>


-- 
*Yours sincerely,*
*Senior Software Engineer.*
*Srikanth Kurapati.*
*Multicoreware Inc.*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20220623/633db9ad/attachment.html>


More information about the x265-devel mailing list