[x265] [x265 PATCH]Fix SBRC to not reset ABR at GOP beginning
Kirithika Kalirathnam
kirithika at multicorewareinc.com
Wed Nov 22 05:20:46 UTC 2023
>From 27da9a553bc0fad5309b9bf946630d94a4e5c1d4 Mon Sep 17 00:00:00 2001
From: Kirithika <kirithika at multicorewareinc.com>
Date: Mon, 12 Jun 2023 12:04:31 +0530
Subject: [PATCH] Fix SBRC to not reset ABR at GOP beginning
---
source/encoder/ratecontrol.cpp | 20 ++++----------------
1 file changed, 4 insertions(+), 16 deletions(-)
diff --git a/source/encoder/ratecontrol.cpp b/source/encoder/ratecontrol.cpp
index 42eaa673a..80f4ac3e9 100644
--- a/source/encoder/ratecontrol.cpp
+++ b/source/encoder/ratecontrol.cpp
@@ -2392,27 +2392,15 @@ void
RateControl::rateControlUpdateStats(RateControlEntry* rce)
}
}
-
-void RateControl::checkAndResetCRF(RateControlEntry* rce)
-{
- if(rce->poc % m_param->keyframeMax == 0)
- {
- init(*m_curSlice->m_sps);
- m_shortTermCplxSum = rce->lastSatd /
(CLIP_DURATION(m_frameDuration) / BASE_FRAME_DURATION);
- m_shortTermCplxCount = 1;
- rce->blurredComplexity = m_shortTermCplxSum / m_shortTermCplxCount;
- }
-}
-
void RateControl::checkAndResetABR(RateControlEntry* rce, bool isFrameDone)
{
double abrBuffer = 2 * m_rateTolerance * m_bitrate;
// Check if current Slice is a scene cut that follows low
detailed/blank frames
- if (rce->lastSatd > 4 * rce->movingAvgSum || rce->scenecut ||
rce->isFadeEnd || (m_param->bEnableSBRC && (rce->poc % m_param->keyframeMax
== 0)))
+ if (rce->lastSatd > 4 * rce->movingAvgSum || rce->scenecut ||
rce->isFadeEnd)
{
if (!m_isAbrReset && rce->movingAvgSum > 0
- && (m_isPatternPresent || !m_param->bframes
||(m_param->bEnableSBRC && (rce->poc % m_param->keyframeMax == 0))))
+ && (m_isPatternPresent || !m_param->bframes))
{
int pos = X265_MAX(m_sliderPos - m_param->frameNumThreads, 0);
int64_t shrtTermWantedBits = (int64_t) (X265_MIN(pos,
s_slidingWindowFrames) * m_bitrate * m_frameDuration);
@@ -2422,7 +2410,7 @@ void RateControl::checkAndResetABR(RateControlEntry*
rce, bool isFrameDone)
shrtTermTotalBitsSum += m_encodedBitsWindow[i];
double underflow = (shrtTermTotalBitsSum - shrtTermWantedBits)
/ abrBuffer;
const double epsilon = 0.0001f;
- if ((underflow < epsilon || rce->isFadeEnd ||
(m_param->bEnableSBRC && (rce->poc % m_param->keyframeMax == 0))) &&
!isFrameDone)
+ if ((underflow < epsilon || rce->isFadeEnd) && !isFrameDone)
{
init(*m_curSlice->m_sps);
// Reduce tune complexity factor for scenes that follow
blank frames
@@ -2508,7 +2496,7 @@ double RateControl::clipQscale(Frame* curFrame,
RateControlEntry* rce, double q)
for (int j = 0; bufferFillCur >= 0 && iter ; j++)
{
int type = curFrame->m_lowres.plannedType[j];
- if (type == X265_TYPE_AUTO || totalDuration >= 1.0 ||
(m_param->bEnableSBRC && type == X265_TYPE_IDR))
+ if (type == X265_TYPE_AUTO || totalDuration >= 1.0)
break;
totalDuration += m_frameDuration;
double wantedFrameSize = m_vbvMaxRate *
m_frameDuration;
--
2.28.0.windows.1
*Thanks,*
*Kirithika*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20231122/fee1ce03/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch1-sbrc.diff
Type: application/octet-stream
Size: 3204 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20231122/fee1ce03/attachment.obj>
More information about the x265-devel
mailing list