Re: [x265] [PATCH] api: Add option "--fades" to detect and handle fade-in regions
# HG changeset patch # User Pooja Venkatesan # Date 1555911695 -19800 # Mon Apr 22 11:11:35 2019 +0530 # Node ID eb2ecf2d2f7289398bd8c82658752ae75efdf985 # Parent 39b35ea862834f05e7437e1670e55de595c8f875 api: Add option "--fades" to detect and handle fade-in regions Pushed Patch to x265 default branch. Thanks & Regards, Dinesh On Fri, May 17, 2019 at 2:41 PM wrote: > # HG changeset patch > # User Pooja Venkatesan > # Date 1555911695 -19800 > # Mon Apr 22 11:11:35 2019 +0530 > # Node ID eb2ecf2d2f7289398bd8c82658752ae75efdf985 > # Parent 39b35ea862834f05e7437e1670e55de595c8f875 > api: Add option "--fades" to detect and handle fade-in regions > > It does the following: > Force I-slice and > Initialize RC history for the brightest frame after fade-in. > > diff -r 39b35ea86283 -r eb2ecf2d2f72 doc/reST/cli.rst > --- a/doc/reST/cli.rst Tue Mar 26 10:31:41 2019 +0530 > +++ b/doc/reST/cli.rst Mon Apr 22 11:11:35 2019 +0530 > @@ -1520,6 +1520,10 @@ > slicetype decision may change with this option. > 2 - flush the slicetype decided frames only. > > +.. option:: --fades, --no-fades > + > + Detect and handle fade-in regions. Default disabled. > + > Quality, rate control and rate distortion options > = > > diff -r 39b35ea86283 -r eb2ecf2d2f72 source/CMakeLists.txt > --- a/source/CMakeLists.txt Tue Mar 26 10:31:41 2019 +0530 > +++ b/source/CMakeLists.txt Mon Apr 22 11:11:35 2019 +0530 > @@ -29,7 +29,7 @@ > option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF) > mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD) > # X265_BUILD must be incremented each time the public API is changed > -set(X265_BUILD 173) > +set(X265_BUILD 174) > configure_file("${PROJECT_SOURCE_DIR}/x265.def.in" > "${PROJECT_BINARY_DIR}/x265.def") > configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in" > diff -r 39b35ea86283 -r eb2ecf2d2f72 source/common/lowres.cpp > --- a/source/common/lowres.cpp Tue Mar 26 10:31:41 2019 +0530 > +++ b/source/common/lowres.cpp Mon Apr 22 11:11:35 2019 +0530 > @@ -82,7 +82,7 @@ > > if (origPic->m_param->bAQMotion) > CHECKED_MALLOC_ZERO(qpAqMotionOffset, double, cuCountFullRes); > -if (origPic->m_param->bDynamicRefine) > +if (origPic->m_param->bDynamicRefine || > origPic->m_param->bEnableFades) > CHECKED_MALLOC_ZERO(blockVariance, uint32_t, cuCountFullRes); > > if (!!param->rc.hevcAq) > @@ -217,6 +217,7 @@ > { > bLastMiniGopBFrame = false; > bKeyframe = false; // Not a keyframe unless identified by lookahead > +bIsFadeEnd = false; > frameNum = poc; > leadingBframes = 0; > indB = 0; > diff -r 39b35ea86283 -r eb2ecf2d2f72 source/common/lowres.h > --- a/source/common/lowres.hTue Mar 26 10:31:41 2019 +0530 > +++ b/source/common/lowres.hMon Apr 22 11:11:35 2019 +0530 > @@ -160,6 +160,7 @@ > bool bScenecut;// Set to false if the frame cannot possibly > be part of a real scenecut. > bool bKeyframe; > bool bLastMiniGopBFrame; > +bool bIsFadeEnd; > > double ipCostRatio; > > @@ -195,6 +196,7 @@ > uint32_t* blockVariance; > uint64_t wp_ssd[3]; // This is different than SSDY, this is > sum(pixel^2) - sum(pixel)^2 for entire frame > uint64_t wp_sum[3]; > +doubleframeVariance; > > /* cutree intermediate data */ > PicQPAdaptationLayer* pAQLayer; > diff -r 39b35ea86283 -r eb2ecf2d2f72 source/common/param.cpp > --- a/source/common/param.cpp Tue Mar 26 10:31:41 2019 +0530 > +++ b/source/common/param.cpp Mon Apr 22 11:11:35 2019 +0530 > @@ -172,6 +172,7 @@ > param->chunkStart = 0; > param->chunkEnd = 0; > param->bEnableHRDConcatFlag = 0; > +param->bEnableFades = 0; > > /* Intra Coding Tools */ > param->bEnableConstrainedIntra = 0; > @@ -1265,6 +1266,7 @@ > OPT("svt-pred-struct") x265_log(p, X265_LOG_WARNING, "Option %s > is SVT-HEVC Encoder specific; Disabling it here \n", name); > OPT("svt-fps-in-vps") x265_log(p, X265_LOG_WARNING, "Option %s is > SVT-HEVC Encoder specific; Disabling it here \n", name); > #endif > +OPT("fades") p->bEnableFades = atobool(value); > else > return X265_PARAM_BAD_NAME; > } > @@ -2367,6 +2369,7 @@ > dst->bEnableHRDConcatFlag = src->bEnableHRDConcatFlag; > dst->dolbyProfile = src->dolbyProfile; > dst->bEnableSvtHevc = src->bEnableSvtHevc; > +dst->bEnableFades = src->bEnableFades; > > #ifdef SVT_HEVC > memcpy(dst->svtHevcParam, src->svtHevcParam, > sizeof(EB_H265_ENC_CONFIGURATION)); > diff -r 39b35ea86283 -r eb2ecf2d2f72 source/encoder/ratecontrol.cpp > --- a/source/encoder/ratecontrol.cppTue Mar 26 10:31:41 2019 +0530 > +++ b/source/encoder/ratecontrol.cppMon Apr 22 11:11:35 2019 +0530 > @@ -1262,6 +1262,7 @@ > } > rce->isActive = true; > rce->scenecut = false; > +
Re: [x265] [X265 PATCH] Enable cutree for two pass encode
# HG changeset patch # User Akil Ayyappan # Date 1558085430 -19800 # Fri May 17 15:00:30 2019 +0530 # Node ID b218b70740af26fb83ac43b35397c9a3ae795f33 # Parent 39b35ea862834f05e7437e1670e55de595c8f875 Enable cutree for two pass encode Pushed patch to x265 default public repo. Thanks & Regards, Dinesh On Fri, May 17, 2019 at 3:24 PM Akil wrote: > Modified tab to space. > > # HG changeset patch > # User Akil Ayyappan > # Date 1558085430 -19800 > # Fri May 17 15:00:30 2019 +0530 > # Node ID b218b70740af26fb83ac43b35397c9a3ae795f33 > # Parent 39b35ea862834f05e7437e1670e55de595c8f875 > Enable cutree for two pass encode > > diff -r 39b35ea86283 -r b218b70740af source/encoder/slicetype.cpp > --- a/source/encoder/slicetype.cpp Tue Mar 26 10:31:41 2019 +0530 > +++ b/source/encoder/slicetype.cpp Fri May 17 15:00:30 2019 +0530 > @@ -1165,7 +1165,9 @@ > ProfileScopeEvent(prelookahead); > m_lock.release(); > preFrame->m_lowres.init(preFrame->m_fencPic, preFrame->m_poc); > -if (m_lookahead.m_bAdaptiveQuant) > +if (m_lookahead.m_param->rc.bStatRead && > m_lookahead.m_param->rc.cuTree && IS_REFERENCED(preFrame)) > +/* cu-tree offsets were read from stats file */; > +else if (m_lookahead.m_bAdaptiveQuant) > tld.calcAdaptiveQuantFrame(preFrame, m_lookahead.m_param); > tld.lowresIntraEstimate(preFrame->m_lowres, > m_lookahead.m_param->rc.qgSize); > preFrame->m_lowresInit = true; > > On Fri, May 17, 2019 at 3:06 PM Akil wrote: > >> # HG changeset patch >> # User Akil Ayyappan >> # Date 1558085430 -19800 >> # Fri May 17 15:00:30 2019 +0530 >> # Node ID 9f990b56a958a4c58eb1dccf1f66a489976d8865 >> # Parent 39b35ea862834f05e7437e1670e55de595c8f875 >> Enable cutree for two pass encode >> >> diff -r 39b35ea86283 -r 9f990b56a958 source/encoder/slicetype.cpp >> --- a/source/encoder/slicetype.cpp Tue Mar 26 10:31:41 2019 +0530 >> +++ b/source/encoder/slicetype.cpp Fri May 17 15:00:30 2019 +0530 >> @@ -1165,7 +1165,9 @@ >> ProfileScopeEvent(prelookahead); >> m_lock.release(); >> preFrame->m_lowres.init(preFrame->m_fencPic, preFrame->m_poc); >> -if (m_lookahead.m_bAdaptiveQuant) >> + if (m_lookahead.m_param->rc.bStatRead && >> m_lookahead.m_param->rc.cuTree && IS_REFERENCED(preFrame)) >> + /* cu-tree offsets were read from stats file */; >> +else if (m_lookahead.m_bAdaptiveQuant) >> tld.calcAdaptiveQuantFrame(preFrame, m_lookahead.m_param); >> tld.lowresIntraEstimate(preFrame->m_lowres, >> m_lookahead.m_param->rc.qgSize); >> preFrame->m_lowresInit = true; >> >> >> -- >> *Regards,* >> *Akil R* >> > > > -- > *Regards,* > *Akil R* > ___ > x265-devel mailing list > x265-devel@videolan.org > https://mailman.videolan.org/listinfo/x265-devel > ___ x265-devel mailing list x265-devel@videolan.org https://mailman.videolan.org/listinfo/x265-devel
[x265] [PATCH] Reduce QP for the scene changes that is followed by black frames
# HG changeset patch # User Pooja Venkatesan # Date 1552816785 -19800 # Sun Mar 17 15:29:45 2019 +0530 # Node ID ec5de1f484fc53867a23486672290712f34afe4e # Parent 39b35ea862834f05e7437e1670e55de595c8f875 Reduce QP for the scene changes that is followed by black frames During a scenecut, the transition from black frames to a different sequence gives a high QP value. Reducing tune complexity factor for the scene change in ABR reduces QP. diff -r 39b35ea86283 -r ec5de1f484fc source/encoder/ratecontrol.cpp --- a/source/encoder/ratecontrol.cppTue Mar 26 10:31:41 2019 +0530 +++ b/source/encoder/ratecontrol.cppSun Mar 17 15:29:45 2019 +0530 @@ -2113,6 +2113,9 @@ if (underflow < epsilon && !isFrameDone) { init(*m_curSlice->m_sps); +// Reduce tune complexity factor for scenes that follow blank frames +double tuneCplxFactor = (m_ncu > 3600 && m_param->rc.cuTree && !m_param->rc.hevcAq) ? 2.5 : m_param->rc.hevcAq ? 1.5 : m_isGrainEnabled ? 1.9 : 1.0; +m_cplxrSum /= tuneCplxFactor; m_shortTermCplxSum = rce->lastSatd / (CLIP_DURATION(m_frameDuration) / BASE_FRAME_DURATION); m_shortTermCplxCount = 1; m_isAbrReset = true; # HG changeset patch # User Pooja Venkatesan # Date 1552816785 -19800 # Sun Mar 17 15:29:45 2019 +0530 # Node ID ec5de1f484fc53867a23486672290712f34afe4e # Parent 39b35ea862834f05e7437e1670e55de595c8f875 Reduce QP for the scene changes that is followed by black frames During a scenecut, the transition from black frames to a different sequence gives a high QP value. Reducing tune complexity factor for the scene change in ABR reduces QP. diff -r 39b35ea86283 -r ec5de1f484fc source/encoder/ratecontrol.cpp --- a/source/encoder/ratecontrol.cpp Tue Mar 26 10:31:41 2019 +0530 +++ b/source/encoder/ratecontrol.cpp Sun Mar 17 15:29:45 2019 +0530 @@ -2113,6 +2113,9 @@ if (underflow < epsilon && !isFrameDone) { init(*m_curSlice->m_sps); +// Reduce tune complexity factor for scenes that follow blank frames +double tuneCplxFactor = (m_ncu > 3600 && m_param->rc.cuTree && !m_param->rc.hevcAq) ? 2.5 : m_param->rc.hevcAq ? 1.5 : m_isGrainEnabled ? 1.9 : 1.0; +m_cplxrSum /= tuneCplxFactor; m_shortTermCplxSum = rce->lastSatd / (CLIP_DURATION(m_frameDuration) / BASE_FRAME_DURATION); m_shortTermCplxCount = 1; m_isAbrReset = true; ___ x265-devel mailing list x265-devel@videolan.org https://mailman.videolan.org/listinfo/x265-devel