[x265] [PATCH 4 of 4] slicetype: calculate weighted frame costs for Aq

Steve Borho steve at borho.org
Tue Oct 22 05:16:41 CEST 2013


On Mon, Oct 21, 2013 at 12:35 PM, <aarthi at multicorewareinc.com> wrote:

> # HG changeset patch
> # User Aarthi Thirumalai<aarthi at multicorewareinc.com>
> # Date 1382376878 -19800
> #      Mon Oct 21 23:04:38 2013 +0530
> # Node ID 8bee2e580fd438b3fbf631c71cbdbbf8e3eef2ff
> # Parent  40c3771b3b15a68cda4f59f7f9a36f41d0733520
> slicetype: calculate weighted frame costs for Aq
>

I've queued the first three patches, but not this one.  I have one comment


>
> diff -r 40c3771b3b15 -r 8bee2e580fd4 source/encoder/slicetype.cpp
> --- a/source/encoder/slicetype.cpp      Mon Oct 21 22:48:35 2013 +0530
> +++ b/source/encoder/slicetype.cpp      Mon Oct 21 23:04:38 2013 +0530
> @@ -197,7 +197,7 @@
>          if (bDoSearch[1]) fenc->lowresMvs[1][p1 - b - 1][0].x = 0;
>
>          fenc->costEst[b - p0][p1 - b] = 0;
> -
> +        fenc->costEstAq[b - p0][p1 - b] = 0;
>          // TODO: use lowres MVs as motion candidates in full-res search
>
>          for (int i = 0; i < heightInCU; i++)
> @@ -233,6 +233,11 @@
>          {
>              score += lhrows[row].costEst;
>              fenc->costEst[0][0] += lhrows[row].costIntra;
> +            if (cfg->param.rc.aqMode)
> +            {
> +                fenc->costEstAq[0][0] += lhrows[row].costIntraAq;
> +                fenc->costEst[b - p0][p1 - b] += lhrows[row].costEstAq;
> +            }
>              fenc->intraMbs[b - p0] += lhrows[row].intraMbs;
>          }
>
> @@ -250,6 +255,11 @@
>          int ncu = NUM_CUS;
>          score += (uint64_t)score * fenc->intraMbs[b - p0] / (ncu * 8);
>      }
> +
> +    if (cfg->param.rc.aqMode)
> +        fenc->satdCost = fenc->costEstAq[b - p0][p1 - b];
> +    else
> +        fenc->satdCost = score;
>

The check for param.rc.aqMode belongs in getEstimatedPictureCost(), or if
you know this function was being called from getEstimatedPictureCost.
 Because this function is called many times and there is only one satdCost
variable for the frame.  Ping me if you have further questions about this.


>      x265_emms();
>      return score;
>  }
> @@ -459,7 +469,12 @@
>          // TOOD: i_icost += intra_penalty + lowres_penalty;
>          fenc->intraCost[cuXY] = icost;
>          fenc->rowSatds[0][0][cuy] += icost;
> -        if (bFrameScoreCU) costIntra += icost;
> +        if (bFrameScoreCU)
> +        {
> +            costIntra += icost;
> +            if (fenc->m_qpAqOffset[cuXY])
> +                costIntraAq += (icost *
> x265_exp2fix8(fenc->m_qpAqOffset[cuXY]) + 128) >> 8;
> +        }
>      }
>
>      if (!bBidir)
> @@ -476,7 +491,12 @@
>      if (p0 != p1)
>      {
>          fenc->rowSatds[b - p0][p1 - b][cuy] += bcost;
> -        if (bFrameScoreCU) costEst += bcost;
> +        if (bFrameScoreCU)
> +        {
> +            costEst += bcost;
> +            if (fenc->m_qpAqOffset[cuXY])
> +                costEstAq += (bcost *
> x265_exp2fix8(fenc->m_qpAqOffset[cuXY]) + 128) >> 8;
> +        }
>      }
>      fenc->lowresCosts[b - p0][p1 - b][cuXY] = (uint16_t)(X265_MIN(bcost,
> LOWRES_COST_MASK) | (listused << LOWRES_COST_SHIFT));
>  }
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>



-- 
Steve Borho
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20131021/6b0528fd/attachment.html>


More information about the x265-devel mailing list