On Wed, May 7, 2014 at 1:27 AM, Aarthi Priya Thirumalai <[email protected]> wrote: > > > > On Wed, May 7, 2014 at 1:36 AM, Steve Borho <[email protected]> wrote: >> >> On Tue, May 6, 2014 at 8:07 AM, Aarthi Priya Thirumalai >> <[email protected]> wrote: >> > This is the correct patch. >> > >> > # HG changeset patch >> > # User Aarthi Thirumalai >> > # Date 1399381528 -19800 >> > # Tue May 06 18:35:28 2014 +0530 >> > # Node ID 65cb5558ad4a474114aa95d45a7c155ea16f0008 >> > # Parent a6c7325e6ee60827142c18eaf4141e0eb4d6d98a >> > slicetype: update the lowresCosts and intraCosts when cutree is enabled >> > >> > diff -r a6c7325e6ee6 -r 65cb5558ad4a source/encoder/frameencoder.cpp >> > --- a/source/encoder/frameencoder.cpp Tue May 06 15:31:18 2014 +0530 >> > +++ b/source/encoder/frameencoder.cpp Tue May 06 18:35:28 2014 +0530 >> > @@ -1261,15 +1261,8 @@ >> > qp_offset += qpoffs[idx]; >> > if (bIsVbv) >> > { >> > - uint16_t lowresCuCost = >> > m_pic->m_lowres.lowresCostForRc[idx] & LOWRES_COST_MASK; >> > - uint16_t intraCuCost = m_pic->m_lowres.intraCost[idx]; >> > - if (m_cfg->param->rc.cuTree) >> > - { >> > - lowresCuCost = (lowresCuCost * >> > x265_exp2fix8(qpoffs[idx]) + 128) >> 8; >> > - intraCuCost = (intraCuCost * >> > x265_exp2fix8(qpoffs[idx]) >> > + 128) >> 8; >> > - } >> > - m_pic->m_cuCostsForVbv[cuAddr] += lowresCuCost; >> > - m_pic->m_intraCuCostsForVbv[cuAddr] += intraCuCost; >> > + m_pic->m_cuCostsForVbv[cuAddr] += >> > m_pic->m_lowres.lowresCostForRc[idx]; >> > + m_pic->m_intraCuCostsForVbv[cuAddr] += >> > m_pic->m_lowres.intraCost[idx]; >> > } >> > cnt++; >> > } >> > diff -r a6c7325e6ee6 -r 65cb5558ad4a source/encoder/slicetype.cpp >> > --- a/source/encoder/slicetype.cpp Tue May 06 15:31:18 2014 +0530 >> > +++ b/source/encoder/slicetype.cpp Tue May 06 18:35:28 2014 +0530 >> > @@ -255,6 +255,7 @@ >> > uint32_t lowresRow = 0, lowresCol = 0, lowresCuIdx = 0, sum = >> > 0; >> > uint32_t scale = param->maxCUSize / (2 * X265_LOWRES_CU_SIZE); >> > uint32_t widthInLowresCu = (uint32_t)widthInCU, >> > heightInLowresCu = >> > (uint32_t)heightInCU; >> > + double *qp_offset =frames[b]->sliceType == X265_TYPE_B ? >> > frames[b]->qpAqOffset : frames[b]->qpOffset; >> > >> > for (uint32_t row = 0; row < pic->getFrameHeightInCU(); row++) >> > { >> > @@ -265,9 +266,16 @@ >> > lowresCuIdx = lowresRow * widthInLowresCu; >> > for (lowresCol = 0; lowresCol < widthInLowresCu; >> > lowresCol++, lowresCuIdx++) >> > { >> > - sum += pic->m_lowres.lowresCostForRc[lowresCuIdx] & >> > LOWRES_COST_MASK; >> > + uint16_t lowresCuCost = >> > pic->m_lowres.lowresCostForRc[lowresCuIdx] & LOWRES_COST_MASK; >> > + if (param->rc.cuTree) >> > + { >> > + lowresCuCost = (lowresCuCost * >> > x265_exp2fix8(qp_offset[lowresCuIdx]) + 128) >> 8; >> > + uint16_t intraCuCost = >> > pic->m_lowres.intraCost[lowresCuIdx]; >> > + pic->m_lowres.intraCost[lowresCuIdx] = >> > (intraCuCost >> > * x265_exp2fix8(qp_offset[lowresCuIdx]) + 128) >> 8; >> > + } >> >> shouldn't this adjustment also be performed for AQ w/o cuTree? > > We are already doing this adjustments for aq within estimateCuCost : > if (fenc->invQscaleFactor) // this is available when Aq is > turned on. > costEstAq += (bcost * fenc->invQscaleFactor[cuXY] + 128) >> > 8; > }
but this only uses AQ to adjust the frame costs, it doesn't adjust the per-CU cost at all, so the CTU-row sums would not have the AQ offsets. -- Steve Borho _______________________________________________ x265-devel mailing list [email protected] https://mailman.videolan.org/listinfo/x265-devel
