[x265] [PATCH] RC: fix VS compile error
Min Chen
chenm003 at 163.com
Wed Aug 14 13:35:57 CEST 2013
# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1376480138 -28800
# Node ID bae5564c3982fe755831af5761f460169ec191cd
# Parent 52a709ce88a85e9f87e16b3df6a0c6bfbc97f212
RC: fix VS compile error
diff -r 52a709ce88a8 -r bae5564c3982 source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp Wed Aug 14 03:32:51 2013 -0500
+++ b/source/encoder/ratecontrol.cpp Wed Aug 14 19:35:38 2013 +0800
@@ -26,6 +26,11 @@
using namespace x265;
+// TODO: Remove this
+#ifdef _MSC_VER
+#pragma warning(disable:4244) // conversion from 'double' to 'float', possible loss of data
+#endif
+
RateControl::RateControl(x265_param_t * param)
{
keyFrameInterval = param->keyframeMax;
@@ -33,9 +38,9 @@
bframes = param->bframes;
rateTolerance = param->rc.rateTolerance;
bitrate = param->rc.bitrate * 1000;
- frameDuration = 1 / param->frameRate;
+ frameDuration = 1.f / param->frameRate;
rateControlMode = param->rc.rateControlMode;
- ncu = (param->sourceHeight * param->sourceWidth) / pow(2, param->maxCUSize);
+ ncu = (param->sourceHeight * param->sourceWidth) / (1 << param->maxCUSize);
lastNonBPictType = -1;
qCompress = param->rc.qCompress;
ipFactor = param->rc.ipFactor;
@@ -66,7 +71,7 @@
cbrDecay = 1.0;
}
-void RateControl::rateControlInit(TComSlice* frame)
+void RateControl::rateControlInit(TComSlice* /*frame*/)
{
curFrame = curFrame;
frameType = curFrame->getSliceType();
@@ -75,7 +80,8 @@
void RateControl::rateControlStart(LookaheadFrame *lFrame)
{
RateControlEntry *rce = new RateControlEntry();
- float q;
+ // TODO: not initialize?
+ float q = 0;
//Always enabling ABR
if (rateControlMode == X265_RC_ABR)
@@ -105,7 +111,7 @@
accumPQp += qpm;
}
-float RateControl::rateEstimateQscale(LookaheadFrame *lframe)
+float RateControl::rateEstimateQscale(LookaheadFrame * /*lframe*/)
{
float q;
// ratecontrol_entry_t rce = UNINIT(rce);
@@ -233,7 +239,7 @@
{
double q;
- q = pow(rce->blurredComplexity, 1 - qCompress);
+ q = pow((double)rce->blurredComplexity, 1 - qCompress);
// avoid NaN's in the rc_eq
if (rce->texBits + rce->mvBits == 0)
diff -r 52a709ce88a8 -r bae5564c3982 source/encoder/ratecontrol.h
--- a/source/encoder/ratecontrol.h Wed Aug 14 03:32:51 2013 -0500
+++ b/source/encoder/ratecontrol.h Wed Aug 14 19:35:38 2013 +0800
@@ -26,6 +26,7 @@
#define __RATECONTROL__
#include <stdint.h>
+#include <math.h>
#include "TLibEncoder/TEncTop.h"
#include "TLibCommon/TComRom.h"
More information about the x265-devel
mailing list