Pushed Thanks, Kalyan Goswami, PhD Video Architect @ MulticoreWare http: <http://www.multicorewareinc.com/>//www.multicorewareinc.com <http://www.multicorewareinc.com/> +91 9884989331
On Thu, Dec 20, 2018 at 4:33 PM <bha...@multicorewareinc.com> wrote: > # HG changeset patch > # User Bhavna Hariharan <bha...@multicorewareinc.com> > # Date 1544770049 -19800 > # Fri Dec 14 12:17:29 2018 +0530 > # Node ID 228dd85f3bdbb955481c06a79eddc5cf2fbbeaa1 > # Parent 592b83c9068d7f402c85394fcf113b767b58f08d > zone: reconfigure params for FEs in round robin fashion > > diff -r 592b83c9068d -r 228dd85f3bdb source/encoder/analysis.cpp > --- a/source/encoder/analysis.cpp Fri Dec 14 12:04:35 2018 +0530 > +++ b/source/encoder/analysis.cpp Fri Dec 14 12:17:29 2018 +0530 > @@ -140,6 +140,7 @@ > m_slice = ctu.m_slice; > m_frame = &frame; > m_bChromaSa8d = m_param->rdLevel >= 3; > + m_param = m_frame->m_param; > > #if _DEBUG || CHECKED_BUILD > invalidateContexts(0); > diff -r 592b83c9068d -r 228dd85f3bdb source/encoder/api.cpp > --- a/source/encoder/api.cpp Fri Dec 14 12:04:35 2018 +0530 > +++ b/source/encoder/api.cpp Fri Dec 14 12:17:29 2018 +0530 > @@ -94,6 +94,7 @@ > Encoder* encoder = NULL; > x265_param* param = PARAM_NS::x265_param_alloc(); > x265_param* latestParam = PARAM_NS::x265_param_alloc(); > + x265_param* zoneParam = PARAM_NS::x265_param_alloc(); > if (!param || !latestParam) > goto fail; > > @@ -126,6 +127,13 @@ > } > > encoder->create(); > + > + memcpy(zoneParam, param, sizeof(x265_param)); > + for (int i = 0; i < param->rc.zonefileCount; i++) > + { > + encoder->configureZone(zoneParam, param->rc.zones[i].zoneParam); > + } > + > /* Try to open CSV file handle */ > if (encoder->m_param->csvfn) > { > diff -r 592b83c9068d -r 228dd85f3bdb source/encoder/encoder.cpp > --- a/source/encoder/encoder.cpp Fri Dec 14 12:04:35 2018 +0530 > +++ b/source/encoder/encoder.cpp Fri Dec 14 12:17:29 2018 +0530 > @@ -1000,11 +1000,11 @@ > } > > Frame *inFrame; > + x265_param* p = (m_reconfigure || m_reconfigureRc) ? > m_latestParam : m_param; > if (m_dpb->m_freeList.empty()) > { > inFrame = new Frame; > inFrame->m_encodeStartTime = x265_mdate(); > - x265_param* p = (m_reconfigure || m_reconfigureRc) ? > m_latestParam : m_param; > if (inFrame->create(p, pic_in->quantOffsets)) > { > /* the first PicYuv created is asked to generate the CU > and block unit offset > @@ -1437,6 +1437,12 @@ > readAnalysisFile(&frameEnc->m_analysisData, > frameEnc->m_poc, frameEnc->m_lowres.sliceType); > } > > + for (int i = 0; i < m_param->rc.zonefileCount; i++) > + { > + if (m_param->rc.zones[i].startFrame == frameEnc->m_poc) > + x265_encoder_reconfig(this, > m_param->rc.zones[i].zoneParam); > + } > + > if (frameEnc->m_reconfigureRc && m_reconfigureRc) > { > memcpy(m_param, m_latestParam, sizeof(x265_param)); > @@ -1641,6 +1647,22 @@ > encParam->bIntraInBFrames = param->bIntraInBFrames; > if (param->scalingLists && !encParam->scalingLists) > encParam->scalingLists = strdup(param->scalingLists); > + > + encParam->rc.aqMode = param->rc.aqMode; > + encParam->rc.aqStrength = param->rc.aqStrength; > + encParam->noiseReductionInter = param->noiseReductionInter; > + encParam->noiseReductionIntra = param->noiseReductionIntra; > + > + encParam->limitModes = param->limitModes; > + encParam->bEnableSplitRdSkip = param->bEnableSplitRdSkip; > + encParam->bCULossless = param->bCULossless; > + encParam->bEnableRdRefine = param->bEnableRdRefine; > + encParam->limitTU = param->limitTU; > + encParam->bEnableTSkipFast = param->bEnableTSkipFast; > + encParam->rdPenalty = param->rdPenalty; > + encParam->dynamicRd = param->dynamicRd; > + encParam->bEnableTransformSkip = param->bEnableTransformSkip; > + encParam->bEnableAMP = param->bEnableAMP; > } > encParam->forceFlush = param->forceFlush; > /* To add: Loop Filter/deblocking controls, transform skip, signhide > require PPS to be resent */ > @@ -2584,6 +2606,41 @@ > pps->numRefIdxDefault[1] = 1; > } > > +void Encoder::configureZone(x265_param *p, x265_param *zone) > +{ > + p->maxNumReferences = zone->maxNumReferences; > + p->bEnableFastIntra = zone->bEnableFastIntra; > + p->bEnableEarlySkip = zone->bEnableEarlySkip; > + p->bEnableRecursionSkip = zone->bEnableRecursionSkip; > + p->searchMethod = zone->searchMethod; > + p->searchRange = zone->searchRange; > + p->subpelRefine = zone->subpelRefine; > + p->rdoqLevel = zone->rdoqLevel; > + p->rdLevel = zone->rdLevel; > + p->bEnableRectInter = zone->bEnableRectInter; > + p->maxNumMergeCand = zone->maxNumMergeCand; > + p->bIntraInBFrames = zone->bIntraInBFrames; > + p->scalingLists = strdup(zone->scalingLists); > + > + p->rc.aqMode = zone->rc.aqMode; > + p->rc.aqStrength = zone->rc.aqStrength; > + p->noiseReductionInter = zone->noiseReductionInter; > + p->noiseReductionIntra = zone->noiseReductionIntra; > + > + p->limitModes = zone->limitModes; > + p->bEnableSplitRdSkip = zone->bEnableSplitRdSkip; > + p->bCULossless = zone->bCULossless; > + p->bEnableRdRefine = zone->bEnableRdRefine; > + p->limitTU = zone->limitTU; > + p->bEnableTSkipFast = zone->bEnableTSkipFast; > + p->rdPenalty = zone->rdPenalty; > + p->dynamicRd = zone->dynamicRd; > + p->bEnableTransformSkip = zone->bEnableTransformSkip; > + p->bEnableAMP = zone->bEnableAMP; > + > + memcpy(zone, p, sizeof(x265_param)); > +} > + > void Encoder::configure(x265_param *p) > { > this->m_param = p; > @@ -3226,6 +3283,12 @@ > p->crQpOffset = 4; > } > } > + > + if (m_param->rc.zonefileCount && p->bOpenGOP) > + { > + p->bOpenGOP = 0; > + x265_log(p, X265_LOG_WARNING, "Zone encoding requires closed gop > structure. Enabling closed GOP.\n"); > + } > } > > void Encoder::readAnalysisFile(x265_analysis_data* analysis, int curPoc, > const x265_picture* picIn, int paramBytes) > diff -r 592b83c9068d -r 228dd85f3bdb source/encoder/encoder.h > --- a/source/encoder/encoder.h Fri Dec 14 12:04:35 2018 +0530 > +++ b/source/encoder/encoder.h Fri Dec 14 12:17:29 2018 +0530 > @@ -193,6 +193,7 @@ > bool m_aborted; // fatal error detected > bool m_reconfigure; // Encoder reconfigure in > progress > bool m_reconfigureRc; > + bool m_reconfigureZone; > > int m_saveCtuDistortionLevel; > > @@ -275,6 +276,8 @@ > > void configure(x265_param *param); > > + void configureZone(x265_param *p, x265_param *zone); > + > void updateVbvPlan(RateControl* rc); > > void readAnalysisFile(x265_analysis_data* analysis, int poc, int > sliceType); > diff -r 592b83c9068d -r 228dd85f3bdb source/encoder/slicetype.cpp > --- a/source/encoder/slicetype.cpp Fri Dec 14 12:04:35 2018 +0530 > +++ b/source/encoder/slicetype.cpp Fri Dec 14 12:17:29 2018 +0530 > @@ -1115,6 +1115,11 @@ > frm.sliceType = m_param->bOpenGOP && m_lastKeyframe > >= 0 ? X265_TYPE_I : X265_TYPE_IDR; > } > } > + for (int i = 0; i < m_param->rc.zonefileCount; i++) > + { > + if (m_param->rc.zones[i].startFrame == frm.frameNum) > + frm.sliceType = X265_TYPE_IDR; > + } > if ((frm.sliceType == X265_TYPE_I && frm.frameNum - > m_lastKeyframe >= m_param->keyframeMin) || (frm.frameNum == > (m_param->chunkStart - 1)) || (frm.frameNum == m_param->chunkEnd)) > { > if (m_param->bOpenGOP) > _______________________________________________ > 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