[x265] [PATCH 4 of 4] rc: fix warnings in ratecontrol
aarthi at multicorewareinc.com
aarthi at multicorewareinc.com
Mon Jul 21 09:32:49 CEST 2014
# HG changeset patch
# User Aarthi Thirumalai
# Date 1405925049 -19800
# Mon Jul 21 12:14:09 2014 +0530
# Node ID 5a60e203133709d1a0e7438ae3a4d030d08f5476
# Parent cc4d25a063853f2a79fffa2757f3d606011ee0c9
rc: fix warnings in ratecontrol
diff -r cc4d25a06385 -r 5a60e2031337 source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp Fri Jul 18 11:01:33 2014 +0530
+++ b/source/encoder/ratecontrol.cpp Mon Jul 21 12:14:09 2014 +0530
@@ -354,6 +354,7 @@
m_lastAbrResetPoc = -1;
m_statFileOut = NULL;
m_cutreeStatFileOut = m_cutreeStatFileIn = NULL;
+ m_rce2Pass = NULL;
// vbv initialization
m_param->rc.vbvBufferSize = Clip3(0, 2000000, m_param->rc.vbvBufferSize);
@@ -785,23 +786,21 @@
for (int j = 1; j < cplxBlur * 2 && j < m_numEntries - i; j++)
{
RateControlEntry *rcj = &m_rce2Pass[i + j];
- double frameDuration = CLIP_DURATION(rcj->frameDuration)/ BASE_FRAME_DURATION;
weight *= 1 - pow(rcj->iCuCount / m_ncu, 2);
if (weight < 0.0001)
break;
gaussianWeight = weight * exp(-j * j / 200.0);
weightSum += gaussianWeight;
- cplxSum += gaussianWeight * (qScale2bits(rcj, 1) - rcj->miscBits) / frameDuration;
+ cplxSum += gaussianWeight * (qScale2bits(rcj, 1) - rcj->miscBits) / rcj->clippedDuration;
}
/* weighted average of cplx of past frames */
weight = 1.0;
for (int j = 0; j <= cplxBlur * 2 && j <= i; j++)
{
RateControlEntry *rcj = &m_rce2Pass[i - j];
- double frameDuration = CLIP_DURATION(rcj->frameDuration) / BASE_FRAME_DURATION;
gaussianWeight = weight * exp(-j * j / 200.0);
weightSum += gaussianWeight;
- cplxSum += gaussianWeight * (qScale2bits(rcj, 1) - rcj->miscBits) / frameDuration;
+ cplxSum += gaussianWeight * (qScale2bits(rcj, 1) - rcj->miscBits) / rcj->clippedDuration;
weight *= 1 - pow(rcj->iCuCount / m_ncu, 2);
if (weight < .0001)
break;
@@ -1274,7 +1273,7 @@
bool RateControl::cuTreeReadFor2Pass(Frame* frame)
{
- uint8_t sliceTypeActual = m_rce2Pass[frame->m_POC].sliceType;
+ uint8_t sliceTypeActual = (uint8_t)m_rce2Pass[frame->m_POC].sliceType;
if (m_rce2Pass[frame->m_POC].keptAsRef)
{
@@ -1287,7 +1286,7 @@
if (!fread(&type, 1, 1, m_cutreeStatFileIn))
goto fail;
- if (fread(m_cuTreeStats.qpBuffer[m_cuTreeStats.qpBufPos], sizeof(uint16_t), m_ncu, m_cutreeStatFileIn) != m_ncu)
+ if (fread(m_cuTreeStats.qpBuffer[m_cuTreeStats.qpBufPos], sizeof(uint16_t), m_ncu, m_cutreeStatFileIn) != sizeof(m_ncu))
goto fail;
if (type != sliceTypeActual && m_cuTreeStats.qpBufPos == 1)
diff -r cc4d25a06385 -r 5a60e2031337 source/encoder/ratecontrol.h
--- a/source/encoder/ratecontrol.h Fri Jul 18 11:01:33 2014 +0530
+++ b/source/encoder/ratecontrol.h Mon Jul 21 12:14:09 2014 +0530
@@ -80,6 +80,7 @@
double qpNoVbv;
double bufferFill;
double frameDuration;
+ double clippedDuration;
Predictor rowPreds[3][2];
Predictor* rowPred[2];
double frameSizeEstimated; /* hold frameSize, updated from cu level vbv rc */
More information about the x265-devel
mailing list