[x265] [PATCH] slicetype: change the total CU value for averaging of qp_adj

Steve Borho steve at borho.org
Sat Mar 7 08:03:30 CET 2015


On 03/07, Deepthi Nandakumar wrote:
> This is an error introduced when we moved calcAdaptiveQuantFrame from
> ratecontrol to slicetype. ncu in ratecontrol signifies actual number of
> 16x16 blocks, whereas ncu in slicetype leaves out the border blocks (I
> think?)
> 
> slicetype.cpp:481 (m_ncu = m_widthInCU > 2 && m_heightInCU > 2 ?
> (m_widthInCU - 2) * (m_heightInCU - 2) : m_widthInCU * m_heightInCU;)

Yeah, looks that way. In that case, the variable should be renamed in
one of the files to prevent this mistake being made again.

I've queued this one, but holding on to it till Monday

> On Fri, Mar 6, 2015 at 8:38 PM, Steve Borho <steve at borho.org> wrote:
> 
> > On 03/06, sreelakshmy at multicorewareinc.com wrote:
> > > # HG changeset patch
> > > # User Sreelakshmy V G <sreelakshmy at multicorewareinc.com>
> > > # Date 1425636287 -19800
> > > #      Fri Mar 06 15:34:47 2015 +0530
> > > # Node ID 99edf8d0064295633a7c52536600f5b55b9fd060
> > > # Parent  45deb0125890ab0211d0e256c74d91ede78d12d3
> > > slicetype: change the total CU value for averaging of qp_adj
> >
> > I need an explanation why, in the commit message
> >
> > > diff -r 45deb0125890 -r 99edf8d00642 source/encoder/slicetype.cpp
> > > --- a/source/encoder/slicetype.cpp    Thu Mar 05 20:39:08 2015 -0600
> > > +++ b/source/encoder/slicetype.cpp    Fri Mar 06 15:34:47 2015 +0530
> > > @@ -106,6 +106,11 @@
> > >      int maxCol = curFrame->m_fencPic->m_picWidth;
> > >      int maxRow = curFrame->m_fencPic->m_picHeight;
> > >
> > > +    int lowresCuWidth = ((param->sourceWidth / 2) + X265_LOWRES_CU_SIZE
> > - 1) >> X265_LOWRES_CU_BITS;
> > > +    int lowresCuHeight = ((param->sourceHeight / 2) +
> > X265_LOWRES_CU_SIZE - 1) >> X265_LOWRES_CU_BITS;
> > > +    int totalBlocks = lowresCuWidth * lowresCuHeight;
> > > +
> > > +
> >
> > too many blank lines here
> >
> > >      for (int y = 0; y < 3; y++)
> > >      {
> > >          curFrame->m_lowres.wp_ssd[y] = 0;
> > > @@ -141,6 +146,7 @@
> > >      {
> > >          blockXY = 0;
> > >          double avg_adj_pow2 = 0, avg_adj = 0, qp_adj = 0;
> > > +
> > >          if (param->rc.aqMode == X265_AQ_AUTO_VARIANCE)
> > >          {
> > >              double bit_depth_correction = pow(1 << (X265_DEPTH - 8),
> > 0.5);
> > > @@ -157,8 +163,8 @@
> > >                  }
> > >              }
> > >
> > > -            avg_adj /= ncu;
> > > -            avg_adj_pow2 /= ncu;
> > > +            avg_adj /= totalBlocks;
> > > +            avg_adj_pow2 /= totalBlocks;
> > >              strength = param->rc.aqStrength * avg_adj /
> > bit_depth_correction;
> > >              avg_adj = avg_adj - 0.5f * (avg_adj_pow2 - (11.f *
> > bit_depth_correction)) / avg_adj;
> > >          }
> > > _______________________________________________
> > > x265-devel mailing list
> > > x265-devel at videolan.org
> > > https://mailman.videolan.org/listinfo/x265-devel
> >
> > --
> > Steve Borho
> > _______________________________________________
> > x265-devel mailing list
> > x265-devel at videolan.org
> > https://mailman.videolan.org/listinfo/x265-devel
> >

> _______________________________________________
> 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