[x265-commits] [x265] cu: fixing int-to-bool compile warnings
Deepthi Nandakumar
deepthi at multicorewareinc.com
Fri Jul 11 23:52:19 CEST 2014
details: http://hg.videolan.org/x265/rev/29ae3f84c3ea
branches:
changeset: 7312:29ae3f84c3ea
user: Deepthi Nandakumar <deepthi at multicorewareinc.com>
date: Fri Jul 11 15:25:10 2014 +0530
description:
cu: fixing int-to-bool compile warnings
Subject: [x265] level: in CRF/CQP encodes, allow user specifed level to increase stream level
details: http://hg.videolan.org/x265/rev/474c45db6a2c
branches:
changeset: 7313:474c45db6a2c
user: Steve Borho <steve at borho.org>
date: Fri Jul 11 14:02:05 2014 -0500
description:
level: in CRF/CQP encodes, allow user specifed level to increase stream level
See the comment
Subject: [x265] common: introduce x265_slurp_file, reads data from file to string buffer.
details: http://hg.videolan.org/x265/rev/b4ee6251307e
branches:
changeset: 7314:b4ee6251307e
user: Aarthi Thirumalai
date: Fri Jul 11 16:06:02 2014 +0530
description:
common: introduce x265_slurp_file, reads data from file to string buffer.
Subject: [x265] param: add more param options to print as string
details: http://hg.videolan.org/x265/rev/f3223737009e
branches:
changeset: 7315:f3223737009e
user: Aarthi Thirumalai
date: Fri Jul 11 16:17:25 2014 +0530
description:
param: add more param options to print as string
Subject: [x265] param: use dashes consistently in param2string
details: http://hg.videolan.org/x265/rev/d1d5b377294e
branches:
changeset: 7316:d1d5b377294e
user: Steve Borho <steve at borho.org>
date: Fri Jul 11 14:32:39 2014 -0500
description:
param: use dashes consistently in param2string
Subject: [x265] rc: store final cu counts in frameStats as a percentage of total # cus
details: http://hg.videolan.org/x265/rev/07654693159b
branches:
changeset: 7317:07654693159b
user: Aarthi Thirumalai
date: Fri Jul 11 16:25:23 2014 +0530
description:
rc: store final cu counts in frameStats as a percentage of total # cus
there exists a mismatch in the total no. of 16x16 blocks calculated between encoder and RC.
rate control counts no. of 16x16 blocks without considering the border extension of source pic.
keeping cu stats as percentage avoid this problem when used later in RC's 2nd pass.
Subject: [x265] param: keep the total frame count of the input video in param.
details: http://hg.videolan.org/x265/rev/aed58d050ff9
branches:
changeset: 7318:aed58d050ff9
user: Aarthi Thirumalai
date: Fri Jul 11 16:32:41 2014 +0530
description:
param: keep the total frame count of the input video in param.
to be used in 2 pass. In case this is not available, the value can remain as 0.
Subject: [x265] rc: init RC data for second pass in a multi pass encode
details: http://hg.videolan.org/x265/rev/03164c7ddcbb
branches:
changeset: 7319:03164c7ddcbb
user: Aarthi Thirumalai
date: Fri Jul 11 16:35:29 2014 +0530
description:
rc: init RC data for second pass in a multi pass encode
Subject: [x265] frameencoder: store reflagrows as a member variable
details: http://hg.videolan.org/x265/rev/a1c553d36746
branches:
changeset: 7320:a1c553d36746
user: Santhoshini Sekar <santhoshini at multicorewareinc.com>
date: Fri Jul 11 15:15:32 2014 +0530
description:
frameencoder: store reflagrows as a member variable
Subject: [x265] cmake: nit - about target arch strings
details: http://hg.videolan.org/x265/rev/a5024bfc0b50
branches:
changeset: 7321:a5024bfc0b50
user: Steve Borho <steve at borho.org>
date: Fri Jul 11 16:47:21 2014 -0500
description:
cmake: nit - about target arch strings
Subject: [x265] rc: nits
details: http://hg.videolan.org/x265/rev/fd87a7e5b1e3
branches:
changeset: 7322:fd87a7e5b1e3
user: Steve Borho <steve at borho.org>
date: Fri Jul 11 16:50:36 2014 -0500
description:
rc: nits
diffstat:
source/CMakeLists.txt | 6 +-
source/Lib/TLibEncoder/TEncCu.cpp | 10 +-
source/common/common.cpp | 48 ++
source/common/common.h | 3 +-
source/common/param.cpp | 12 +-
source/encoder/compress.cpp | 8 +-
source/encoder/encoder.cpp | 2 +-
source/encoder/frameencoder.cpp | 26 +-
source/encoder/frameencoder.h | 3 +-
source/encoder/level.cpp | 14 +-
source/encoder/ratecontrol.cpp | 878 +++++++++++++++++++++++++++++++------
source/encoder/ratecontrol.h | 32 +-
source/x265.cpp | 3 +-
source/x265.h | 6 +
14 files changed, 860 insertions(+), 191 deletions(-)
diffs (truncated from 1546 to 300 lines):
diff -r e171ad8bc8a3 -r fd87a7e5b1e3 source/CMakeLists.txt
--- a/source/CMakeLists.txt Fri Jul 11 01:44:43 2014 -0500
+++ b/source/CMakeLists.txt Fri Jul 11 16:50:36 2014 -0500
@@ -19,7 +19,7 @@ include(CheckSymbolExists)
include(CheckCXXCompilerFlag)
# X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 25)
+set(X265_BUILD 26)
configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
@@ -37,7 +37,7 @@ string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR
set(X86_ALIASES x86 i386 i686 x86_64 amd64)
list(FIND X86_ALIASES "${SYSPROC}" X86MATCH)
if("${SYSPROC}" STREQUAL "" OR X86MATCH GREATER "-1")
- message(STATUS "Detected x86 system processor")
+ message(STATUS "Detected x86 target processor")
set(X86 1)
add_definitions(-DX265_ARCH_X86=1)
if("${CMAKE_SIZEOF_VOID_P}" MATCHES 8)
@@ -45,7 +45,7 @@ if("${SYSPROC}" STREQUAL "" OR X86MATCH
add_definitions(-DX86_64=1)
endif()
elseif(${SYSPROC} STREQUAL "armv6l")
- message(STATUS "Detected ARM system processor")
+ message(STATUS "Detected ARM target processor")
set(ARM 1)
add_definitions(-DX265_ARCH_ARM=1 -DHAVE_ARMV6=1)
else()
diff -r e171ad8bc8a3 -r fd87a7e5b1e3 source/Lib/TLibEncoder/TEncCu.cpp
--- a/source/Lib/TLibEncoder/TEncCu.cpp Fri Jul 11 01:44:43 2014 -0500
+++ b/source/Lib/TLibEncoder/TEncCu.cpp Fri Jul 11 16:50:36 2014 -0500
@@ -1130,7 +1130,7 @@ void TEncCu::xCheckRDCostMerge2Nx2N(TCom
uint8_t depth = outTempCU->getDepth(0);
outTempCU->setPartSizeSubParts(SIZE_2Nx2N, 0, depth); // interprets depth relative to LCU level
- outTempCU->setCUTransquantBypassSubParts(m_param->bLossless, 0, depth);
+ outTempCU->setCUTransquantBypassSubParts(!!m_param->bLossless, 0, depth);
outTempCU->getInterMergeCandidates(0, 0, mvFieldNeighbours, interDirNeighbours, maxNumMergeCand);
int mergeCandBuffer[MRG_MAX_NUM_CANDS];
@@ -1157,7 +1157,7 @@ void TEncCu::xCheckRDCostMerge2Nx2N(TCom
{
// set MC parameters
outTempCU->setPredModeSubParts(MODE_INTER, 0, depth); // interprets depth relative to LCU level
- outTempCU->setCUTransquantBypassSubParts(m_param->bLossless, 0, depth);
+ outTempCU->setCUTransquantBypassSubParts(!!m_param->bLossless, 0, depth);
outTempCU->setPartSizeSubParts(SIZE_2Nx2N, 0, depth); // interprets depth relative to LCU level
outTempCU->setMergeFlag(0, true);
outTempCU->setMergeIndex(0, mergeCand);
@@ -1237,7 +1237,7 @@ void TEncCu::xCheckRDCostInter(TComDataC
outTempCU->setSkipFlagSubParts(false, 0, depth);
outTempCU->setPartSizeSubParts(partSize, 0, depth);
outTempCU->setPredModeSubParts(MODE_INTER, 0, depth);
- outTempCU->setCUTransquantBypassSubParts(m_param->bLossless, 0, depth);
+ outTempCU->setCUTransquantBypassSubParts(!!m_param->bLossless, 0, depth);
if (predInterSearch(outTempCU, m_tmpPredYuv[depth], bUseMRG, true))
{
@@ -1255,7 +1255,7 @@ void TEncCu::xCheckRDCostIntra(TComDataC
outTempCU->setSkipFlagSubParts(false, 0, depth);
outTempCU->setPartSizeSubParts(partSize, 0, depth);
outTempCU->setPredModeSubParts(MODE_INTRA, 0, depth);
- outTempCU->setCUTransquantBypassSubParts(m_param->bLossless, 0, depth);
+ outTempCU->setCUTransquantBypassSubParts(!!m_param->bLossless, 0, depth);
estIntraPredQT(outTempCU, m_origYuv[depth], m_tmpPredYuv[depth], m_tmpResiYuv[depth], m_tmpRecoYuv[depth]);
@@ -1304,7 +1304,7 @@ void TEncCu::xCheckRDCostIntraInInter(TC
outTempCU->setSkipFlagSubParts(false, 0, depth);
outTempCU->setPartSizeSubParts(partSize, 0, depth);
outTempCU->setPredModeSubParts(MODE_INTRA, 0, depth);
- outTempCU->setCUTransquantBypassSubParts(m_param->bLossless, 0, depth);
+ outTempCU->setCUTransquantBypassSubParts(!!m_param->bLossless, 0, depth);
estIntraPredQT(outTempCU, m_origYuv[depth], m_tmpPredYuv[depth], m_tmpResiYuv[depth], m_tmpRecoYuv[depth]);
diff -r e171ad8bc8a3 -r fd87a7e5b1e3 source/common/common.cpp
--- a/source/common/common.cpp Fri Jul 11 01:44:43 2014 -0500
+++ b/source/common/common.cpp Fri Jul 11 16:50:36 2014 -0500
@@ -159,3 +159,51 @@ uint32_t x265_picturePlaneSize(int csp,
return size;
}
+
+char* x265_slurp_file(const char *filename)
+{
+ if (!filename)
+ return NULL;
+
+ int bError = 0;
+ size_t fSize;
+ char *buf = NULL;
+
+ FILE *fh = fopen(filename, "rb");
+ if (!fh)
+ {
+ x265_log(NULL, X265_LOG_ERROR, "unable to open file %s\n", filename);
+ return NULL;
+ }
+
+ bError |= fseek(fh, 0, SEEK_END) < 0;
+ bError |= (fSize = ftell(fh)) <= 0;
+ bError |= fseek(fh, 0, SEEK_SET) < 0;
+ if (bError)
+ goto error;
+
+ buf = X265_MALLOC(char, fSize + 2);
+ if (!buf)
+ {
+ x265_log(NULL, X265_LOG_ERROR, "unable to allocate memory\n");
+ goto error;
+ }
+
+ bError |= fread(buf, 1, fSize, fh) != fSize;
+ if (buf[fSize - 1] != '\n')
+ buf[fSize++] = '\n';
+ buf[fSize] = 0;
+ fclose(fh);
+
+ if (bError)
+ {
+ x265_log(NULL, X265_LOG_ERROR, "unable to read the file\n");
+ X265_FREE(buf);
+ buf = NULL;
+ }
+ return buf;
+
+error:
+ fclose(fh);
+ return NULL;
+}
diff -r e171ad8bc8a3 -r fd87a7e5b1e3 source/common/common.h
--- a/source/common/common.h Fri Jul 11 01:44:43 2014 -0500
+++ b/source/common/common.h Fri Jul 11 16:50:36 2014 -0500
@@ -208,7 +208,6 @@ void x265_free(void *ptr);
double x265_ssim2dB(double ssim);
double x265_qScale2qp(double qScale);
double x265_qp2qScale(double qp);
-
uint32_t x265_picturePlaneSize(int csp, int width, int height, int plane);
-
+char* x265_slurp_file(const char *filename);
#endif // ifndef X265_COMMON_H
diff -r e171ad8bc8a3 -r fd87a7e5b1e3 source/common/param.cpp
--- a/source/common/param.cpp Fri Jul 11 01:44:43 2014 -0500
+++ b/source/common/param.cpp Fri Jul 11 16:50:36 2014 -0500
@@ -1213,8 +1213,10 @@ char *x265_param2string(x265_param *p)
#define BOOL(param, cliopt) \
s += sprintf(s, " %s", (param) ? cliopt : "no-"cliopt);
+ s += sprintf(s, "%dx%d", p->sourceWidth,p->sourceHeight);
+ s += sprintf(s, " fps=%u/%u", p->fpsNum, p->fpsDenom);
+ s += sprintf(s, " bitdepth=%d", p->internalBitDepth);
BOOL(p->bEnableWavefront, "wpp");
- s += sprintf(s, " fps=%d/%d", p->fpsNum, p->fpsDenom);
s += sprintf(s, " ctu=%d", p->maxCUSize);
s += sprintf(s, " tu-intra-depth=%d", p->tuQTMaxIntraDepth);
s += sprintf(s, " tu-inter-depth=%d", p->tuQTMaxInterDepth);
@@ -1274,19 +1276,19 @@ char *x265_param2string(x265_param *p)
p->rc.complexityBlur, p->rc.qblur);
if (p->rc.vbvBufferSize)
{
- s += sprintf(s, " vbv_maxrate=%d vbv_bufsize=%d",
+ s += sprintf(s, " vbv-maxrate=%d vbv-bufsize=%d",
p->rc.vbvMaxBitrate, p->rc.vbvBufferSize);
if (p->rc.rateControlMode == X265_RC_CRF)
- s += sprintf(s, " crf_max=%.1f", p->rc.rfConstantMax);
+ s += sprintf(s, " crfmax=%.1f", p->rc.rfConstantMax);
}
}
else if (p->rc.rateControlMode == X265_RC_CQP)
s += sprintf(s, " qp=%d", p->rc.qp);
if (!(p->rc.rateControlMode == X265_RC_CQP && p->rc.qp == 0))
{
- s += sprintf(s, " ip_ratio=%.2f", p->rc.ipFactor);
+ s += sprintf(s, " ipratio=%.2f", p->rc.ipFactor);
if (p->bframes)
- s += sprintf(s, " pb_ratio=%.2f", p->rc.pbFactor);
+ s += sprintf(s, " pbratio=%.2f", p->rc.pbFactor);
}
#undef BOOL
return buf;
diff -r e171ad8bc8a3 -r fd87a7e5b1e3 source/encoder/compress.cpp
--- a/source/encoder/compress.cpp Fri Jul 11 01:44:43 2014 -0500
+++ b/source/encoder/compress.cpp Fri Jul 11 16:50:36 2014 -0500
@@ -91,7 +91,7 @@ void TEncCu::xComputeCostIntraInInter(TC
cu->setPartSizeSubParts(partSize, 0, depth);
cu->setPredModeSubParts(MODE_INTRA, 0, depth);
- cu->setCUTransquantBypassSubParts(m_param->bLossless, 0, depth);
+ cu->setCUTransquantBypassSubParts(!!m_param->bLossless, 0, depth);
uint32_t initTrDepth = cu->getPartitionSize(0) == SIZE_2Nx2N ? 0 : 1;
uint32_t tuSize = cu->getCUSize(0) >> initTrDepth;
@@ -210,7 +210,7 @@ void TEncCu::xComputeCostInter(TComDataC
outTempCU->setPartSizeSubParts(partSize, 0, depth);
outTempCU->setPredModeSubParts(MODE_INTER, 0, depth);
- outTempCU->setCUTransquantBypassSubParts(m_param->bLossless, 0, depth);
+ outTempCU->setCUTransquantBypassSubParts(!!m_param->bLossless, 0, depth);
// do motion compensation only for Luma since luma cost alone is calculated
outTempCU->m_totalBits = 0;
@@ -238,13 +238,13 @@ void TEncCu::xComputeCostMerge2Nx2N(TCom
uint8_t depth = outTempCU->getDepth(0);
outTempCU->setPartSizeSubParts(SIZE_2Nx2N, 0, depth); // interprets depth relative to LCU level
- outTempCU->setCUTransquantBypassSubParts(m_param->bLossless, 0, depth);
+ outTempCU->setCUTransquantBypassSubParts(!!m_param->bLossless, 0, depth);
outTempCU->getInterMergeCandidates(0, 0, mvFieldNeighbours, interDirNeighbours, maxNumMergeCand);
outTempCU->setPredModeSubParts(MODE_INTER, 0, depth);
outTempCU->setMergeFlag(0, true);
outBestCU->setPartSizeSubParts(SIZE_2Nx2N, 0, depth); // interprets depth relative to LCU level
- outBestCU->setCUTransquantBypassSubParts(m_param->bLossless, 0, depth);
+ outBestCU->setCUTransquantBypassSubParts(!!m_param->bLossless, 0, depth);
outBestCU->setPredModeSubParts(MODE_INTER, 0, depth);
outBestCU->setMergeFlag(0, true);
diff -r e171ad8bc8a3 -r fd87a7e5b1e3 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp Fri Jul 11 01:44:43 2014 -0500
+++ b/source/encoder/encoder.cpp Fri Jul 11 16:50:36 2014 -0500
@@ -1328,7 +1328,7 @@ void Encoder::configure(x265_param *p)
p->rc.aqStrength = 0.0;
}
- if (p->lookaheadDepth == 0 && p->rc.cuTree)
+ if (p->lookaheadDepth == 0 && p->rc.cuTree && !p->rc.bStatRead)
{
x265_log(p, X265_LOG_WARNING, "cuTree disabled, requires lookahead to be enabled\n");
p->rc.cuTree = 0;
diff -r e171ad8bc8a3 -r fd87a7e5b1e3 source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp Fri Jul 11 01:44:43 2014 -0500
+++ b/source/encoder/frameencoder.cpp Fri Jul 11 16:50:36 2014 -0500
@@ -92,6 +92,12 @@ bool FrameEncoder::init(Encoder *top, in
m_rows = new CTURow[m_numRows];
bool ok = !!m_numRows;
+ int range = m_param->searchRange; /* fpel search */
+ range += 1; /* diamond search range check lag */
+ range += 2; /* subpel refine */
+ range += NTAPS_LUMA / 2; /* subpel filter half-length */
+ m_refLagRows = 1 + ((range + g_maxCUSize - 1) / g_maxCUSize);
+
// NOTE: 2 times of numRows because both Encoder and Filter in same queue
if (!WaveFront::init(m_numRows * 2))
{
@@ -490,6 +496,7 @@ void FrameEncoder::compressFrame()
compressCTURows();
if (m_param->rc.bStatWrite)
+ {
// accumulate intra,inter,skip cu count per frame for 2 pass
for (int i = 0; i < m_numRows; i++)
{
@@ -497,7 +504,11 @@ void FrameEncoder::compressFrame()
m_frameStats.cuCount_p += m_rows[i].m_pCuCnt;
m_frameStats.cuCount_skip += m_rows[i].m_skipCuCnt;
}
-
+ double totalCuCount = m_frameStats.cuCount_i + m_frameStats.cuCount_p + m_frameStats.cuCount_skip;
+ m_frameStats.cuCount_i /= totalCuCount;
+ m_frameStats.cuCount_p /= totalCuCount;
+ m_frameStats.cuCount_skip /= totalCuCount;
+ }
if (m_sps.getUseSAO())
{
SAOParam* saoParam = m_frame->getPicSym()->getSaoParam();
@@ -706,11 +717,6 @@ void FrameEncoder::compressCTURows()
bool bUseWeightP = slice->getPPS()->getUseWP() && slice->getSliceType() == P_SLICE;
bool bUseWeightB = slice->getPPS()->getWPBiPred() && slice->getSliceType() == B_SLICE;
- int range = m_param->searchRange; /* fpel search */
- range += 1; /* diamond search range check lag */
- range += 2; /* subpel refine */
- range += NTAPS_LUMA / 2; /* subpel filter half-length */
- int refLagRows = 1 + ((range + g_maxCUSize - 1) / g_maxCUSize);
int numPredDir = slice->isInterP() ? 1 : slice->isInterB() ? 2 : 0;
m_SSDY = m_SSDU = m_SSDV = 0;
@@ -735,14 +741,14 @@ void FrameEncoder::compressCTURows()
Frame *refpic = slice->getRefPic(l, ref);
int reconRowCount = refpic->m_reconRowCount.get();
- while ((reconRowCount != m_numRows) && (reconRowCount < row + refLagRows))
+ while ((reconRowCount != m_numRows) && (reconRowCount < row + m_refLagRows))
{
reconRowCount = refpic->m_reconRowCount.waitForChange(reconRowCount);
}
if ((bUseWeightP || bUseWeightB) && m_mref[l][ref].isWeighted)
{
- m_mref[l][ref].applyWeight(row + refLagRows, m_numRows);
+ m_mref[l][ref].applyWeight(row + m_refLagRows, m_numRows);
}
}
}
@@ -774,14 +780,14 @@ void FrameEncoder::compressCTURows()
More information about the x265-commits
mailing list