[x265] [PATCH] simplify rdoQuant() logic on ctxSet

Steve Borho steve at borho.org
Mon Apr 13 22:50:22 CEST 2015


On 04/13, Min Chen wrote:
> # HG changeset patch
> # User Min Chen <chenm003 at 163.com>
> # Date 1428921578 -28800
> # Node ID aef6e05df317dc217d6339992d729a177ed9e4ec
> # Parent  4cccf22b00ee188a72c8dc3896d7dc1613d855ad
> simplify rdoQuant() logic on ctxSet

queued

> ---
>  source/common/quant.cpp |   15 ++++++---------
>  1 files changed, 6 insertions(+), 9 deletions(-)
> 
> diff -r 4cccf22b00ee -r aef6e05df317 source/common/quant.cpp
> --- a/source/common/quant.cpp	Fri Apr 10 18:15:38 2015 -0500
> +++ b/source/common/quant.cpp	Mon Apr 13 18:39:38 2015 +0800
> @@ -558,7 +558,6 @@
>      int64_t costCoeffGroupSig[MLS_GRP_NUM]; /* lambda * bits of group coding cost */
>      uint64_t sigCoeffGroupFlag64 = 0;
>  
> -    uint32_t ctxSet      = 0;
>      int cgLastScanPos    = -1;
>      int lastScanPos      = -1;
>      const uint32_t cgSize = (1 << MLS_CG_SIZE); /* 4x4 num coef = 16 */
> @@ -582,10 +581,12 @@
>  
>      uint32_t scanPos;
>      coeffGroupRDStats cgRdStats;
> +    uint32_t c1 = 1;
>  
>      /* iterate over coding groups in reverse scan order */
>      for (int cgScanPos = cgNum - 1; cgScanPos >= 0; cgScanPos--)
>      {
> +        uint32_t ctxSet = (cgScanPos && bIsLuma) ? 2 : 0;
>          const uint32_t cgBlkPos = codeParams.scanCG[cgScanPos];
>          const uint32_t cgPosY   = cgBlkPos >> codeParams.log2TrSizeCG;
>          const uint32_t cgPosX   = cgBlkPos - (cgPosY << codeParams.log2TrSizeCG);
> @@ -594,7 +595,10 @@
>  
>          const int patternSigCtx = calcPatternSigCtx(sigCoeffGroupFlag64, cgPosX, cgPosY, cgBlkPos, cgStride);
>  
> -        int    c1            = 1;
> +        if (c1 == 0)
> +            ctxSet++;
> +        c1 = 1;
> +
>          int    c2            = 0;
>          uint32_t goRiceParam = 0;
>          uint32_t c1Idx       = 0;
> @@ -815,13 +819,6 @@
>              }
>          } /* end for (scanPosinCG) */
>  
> -        /* context set update */
> -        {
> -            ctxSet = (cgScanPos == 1 || !bIsLuma) ? 0 : 2;
> -            X265_CHECK(c1 >= 0, "c1 is negative\n");
> -            ctxSet -= ((int32_t)(c1 - 1) >> 31);
> -        }
> -
>          costCoeffGroupSig[cgScanPos] = 0;
>  
>          if (cgLastScanPos < 0)
> 
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel

-- 
Steve Borho


More information about the x265-devel mailing list