[x265] [PATCH] remove unnecessary sqrt from MVTHRESHOLD checking

Ashok Kumar Mishra ashok at multicorewareinc.com
Mon Dec 11 09:12:11 CET 2017


LGTM. Pushed.

On Thu, Dec 7, 2017 at 1:52 PM, Ma0 <mateuszb at poczta.onet.pl> wrote:

> # HG changeset patch
> # User Ma0 <mateuszb at poczta.onet.pl>
> # Date 1512634751 -3600
> #      Thu Dec 07 09:19:11 2017 +0100
> # Node ID c9ee52a7b14458abd01ae7540d8d8ba34d0393ef
> # Parent  7bd8751a81830815cdc8e4dfc88cad2c8ca15ca7
> remove unnecessary sqrt from MVTHRESHOLD checking
>
> Thanks MonoS Diablo for pointing this.
>
> diff -r 7bd8751a8183 -r c9ee52a7b144 source/encoder/encoder.cpp
> --- a/source/encoder/encoder.cpp        Wed Dec 06 13:33:00 2017 +0530
> +++ b/source/encoder/encoder.cpp        Thu Dec 07 09:19:11 2017 +0100
> @@ -51,7 +51,7 @@
>  /* Threshold for motion vection, based on expermental result.
>   * TODO: come up an algorithm for adoptive threshold */
>
> -#define MVTHRESHOLD 10
> +#define MVTHRESHOLD (10*10)
>  #define PU_2Nx2N 1
>
>  static const char* defaultAnalysisFileName = "x265_analysis.dat";
> @@ -571,12 +571,12 @@
>                              (interData)->mvpIdx[k][cuPos + cuOffset] =
> (srcInterData)->mvpIdx[k][(mbIndex * 16) + cuOffset];
>                              (interData)->refIdx[k][cuPos + cuOffset] =
> (srcInterData)->refIdx[k][(mbIndex * 16) + cuOffset];
>                              memcpy(&(interData)->mv[k][cuPos +
> cuOffset], &(srcInterData)->mv[k][(mbIndex * 16) + cuOffset], sizeof(MV));
> -                            if (m_param->analysisReuseLevel == 7)
> +                            if (m_param->analysisReuseLevel == 7 && numPU
> == PU_2Nx2N &&
> +                                ((srcInterData)->depth[cuPos + cuOffset]
> == (m_param->maxCUSize >> 5)))
>                              {
>                                  int mv_x = ((analysis_inter_data
> *)curFrame->m_analysisData.interData)->mv[k][(mbIndex * 16) + cuOffset].x;
>                                  int mv_y = ((analysis_inter_data
> *)curFrame->m_analysisData.interData)->mv[k][(mbIndex * 16) + cuOffset].y;
> -                                double mv = sqrt((double)(mv_x*mv_x +
> mv_y*mv_y));
> -                                if (numPU == PU_2Nx2N &&
> ((srcInterData)->depth[cuPos + cuOffset] == (m_param->maxCUSize >> 5)) &&
> mv <= MVTHRESHOLD)
> +                                if ((mv_x*mv_x + mv_y*mv_y) <=
> MVTHRESHOLD)
>                                      memset(&curFrame->m_analysisData.modeFlag[k][cuPos
> + cuOffset], 1, bytes);
>                              }
>                          }
> @@ -654,12 +654,11 @@
>                                      (currInterData)->mvpIdx[i][count +
> pu] = (interData)->mvpIdx[i][d];
>                                      (currInterData)->refIdx[i][count +
> pu] = (interData)->refIdx[i][d];
>                                      memcpy(&(currInterData)->mv[i][count
> + pu], &(interData)->mv[i][d], sizeof(MV));
> -                                    if (m_param->analysisReuseLevel == 7)
> +                                    if (m_param->analysisReuseLevel == 7
> && numPU == PU_2Nx2N && m_param->num4x4Partitions <= 16)
>                                      {
>                                          int mv_x = ((analysis_inter_data
> *)curFrame->m_analysisData.interData)->mv[i][count + pu].x;
>                                          int mv_y = ((analysis_inter_data
> *)curFrame->m_analysisData.interData)->mv[i][count + pu].y;
> -                                        double mv =
> sqrt((double)(mv_x*mv_x + mv_y*mv_y));
> -                                        if (numPU == PU_2Nx2N &&
> m_param->num4x4Partitions <= 16 && mv <= MVTHRESHOLD)
> +                                        if ((mv_x*mv_x + mv_y*mv_y) <=
> MVTHRESHOLD)
>                                              memset(&curFrame->m_analysisData.modeFlag[i][count
> + pu], 1, bytes);
>                                      }
>                                  }
> _______________________________________________
> 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/20171211/4345da3f/attachment.html>


More information about the x265-devel mailing list