# HG changeset patch # User Bhavna Hariharan <bha...@multicorewareinc.com> # Date 1481260512 -19800 # Fri Dec 09 10:45:12 2016 +0530 # Node ID b7a07ba5be2551b9f130e805b51eca4f2403264a # Parent c97c64ab8b8eaea8b1de611adc9022815d88b09b fix analysis save/load bug in limitTU
diff -r c97c64ab8b8e -r b7a07ba5be25 doc/reST/cli.rst --- a/doc/reST/cli.rst Thu May 26 17:49:25 2016 +0530 +++ b/doc/reST/cli.rst Fri Dec 09 10:45:12 2016 +0530 @@ -874,10 +874,13 @@ Enables early exit from TU depth recursion, for inter coded blocks. Level 1 - decides to recurse to next higher depth based on cost comparison of full size TU and split TU. + Level 2 - based on first split subTU's depth, limits recursion of other split subTUs. + Level 3 - based on the average depth of the co-located and the neighbor CUs' TU depth, limits recursion of the current CU. + Level 4 - uses the depth of the neighbouring/ co-located CUs TU depth to limit the 1st subTU depth. The 1st subTU depth is taken as the limiting depth for the other subTUs. diff -r c97c64ab8b8e -r b7a07ba5be25 source/encoder/analysis.cpp --- a/source/encoder/analysis.cpp Thu May 26 17:49:25 2016 +0530 +++ b/source/encoder/analysis.cpp Fri Dec 09 10:45:12 2016 +0530 @@ -377,15 +377,6 @@ checkBestMode(md.pred[PRED_INTRA_NxN], depth); } - if ((m_limitTU & X265_TU_LIMIT_NEIGH) && cuGeom.log2CUSize >= 4) - { - CUData* ctu = md.bestMode->cu.m_encData->getPicCTU(parentCTU.m_cuAddr); - int8_t maxTUDepth = -1; - for (uint32_t i = 0; i < cuGeom.numPartitions; i++) - maxTUDepth = X265_MAX(maxTUDepth, md.bestMode->cu.m_tuDepth[i]); - ctu->m_refTuDepth[cuGeom.geomRecurId] = maxTUDepth; - } - if (m_bTryLossless) tryLossless(cuGeom); @@ -454,6 +445,16 @@ cacheCost[cuIdx] = md.bestMode->rdCost; } + /* Save Intra CUs TU depth only when analysis mode is OFF */ + if ((m_limitTU & X265_TU_LIMIT_NEIGH) && cuGeom.log2CUSize >= 4 && !m_param->analysisMode) + { + CUData* ctu = md.bestMode->cu.m_encData->getPicCTU(parentCTU.m_cuAddr); + int8_t maxTUDepth = -1; + for (uint32_t i = 0; i < cuGeom.numPartitions; i++) + maxTUDepth = X265_MAX(maxTUDepth, md.pred[PRED_INTRA].cu.m_tuDepth[i]); + ctu->m_refTuDepth[cuGeom.geomRecurId] = maxTUDepth; + } + /* Copy best data to encData CTU and recon */ md.bestMode->cu.copyToPic(depth); if (md.bestMode != &md.pred[PRED_SPLIT]) diff -r c97c64ab8b8e -r b7a07ba5be25 source/encoder/search.cpp --- a/source/encoder/search.cpp Thu May 26 17:49:25 2016 +0530 +++ b/source/encoder/search.cpp Fri Dec 09 10:45:12 2016 +0530 @@ -2645,12 +2645,6 @@ uint32_t tuDepthRange[2]; cu.getInterTUQtDepthRange(tuDepthRange, 0); - if (m_limitTU & X265_TU_LIMIT_NEIGH) - { - int32_t maxLog2CUSize = g_log2Size[m_param->maxCUSize]; - m_maxTUDepth = x265_clip3(maxLog2CUSize - (int32_t)tuDepthRange[1], maxLog2CUSize - (int32_t)tuDepthRange[0], m_maxTUDepth); - } - m_entropyCoder.load(m_rqt[depth].cur); if ((m_limitTU & X265_TU_LIMIT_DFS) && !(m_limitTU & X265_TU_LIMIT_NEIGH)) @@ -2659,9 +2653,18 @@ memset(&m_cacheTU, 0, sizeof(TUInfoCache)); Cost costs; - if ((m_limitTU & X265_TU_LIMIT_DFS) && (m_limitTU & X265_TU_LIMIT_NEIGH)) + if (m_limitTU & X265_TU_LIMIT_NEIGH) { + /* Save and reload maxTUDepth to avoid changing of maxTUDepth between modes */ int32_t tempDepth = m_maxTUDepth; + if (m_maxTUDepth != -1) + { + uint32_t splitFlag = interMode.cu.m_partSize[0] != SIZE_2Nx2N; + uint32_t minSize = tuDepthRange[0]; + uint32_t maxSize = tuDepthRange[1]; + maxSize = X265_MIN(maxSize, cuGeom.log2CUSize - splitFlag); + m_maxTUDepth = x265_clip3(cuGeom.log2CUSize - maxSize, cuGeom.log2CUSize - minSize, (uint32_t)m_maxTUDepth); + } estimateResidualQT(interMode, cuGeom, 0, 0, *resiYuv, costs, tuDepthRange); m_maxTUDepth = tempDepth; } diff -r c97c64ab8b8e -r b7a07ba5be25 source/test/smoke-tests.txt --- a/source/test/smoke-tests.txt Thu May 26 17:49:25 2016 +0530 +++ b/source/test/smoke-tests.txt Fri Dec 09 10:45:12 2016 +0530 @@ -15,7 +15,7 @@ RaceHorses_416x240_30_10bit.yuv,--preset=veryfast --max-tu-size 8 RaceHorses_416x240_30_10bit.yuv,--preset=slower --bitrate 500 -F4 --rdoq-level 1 CrowdRun_1920x1080_50_10bit_444.yuv,--preset=ultrafast --constrained-intra --min-keyint 5 --keyint 10 -CrowdRun_1920x1080_50_10bit_444.yuv,--preset=medium --max-tu-size 16 +CrowdRun_1920x1080_50_10bit_444.yuv,--preset=medium --max-tu-size 16 --tu-inter-depth 2 --limit-tu 3 DucksAndLegs_1920x1080_60_10bit_422.yuv,--preset=veryfast --min-cu 16 DucksAndLegs_1920x1080_60_10bit_422.yuv,--preset=fast --weightb --interlace bff DucksAndLegs_1920x1080_60_10bit_422.yuv,--preset=veryslow --limit-ref 1 --limit-mode --tskip --limit-tu 1 diff -r c97c64ab8b8e -r b7a07ba5be25 source/x265cli.h --- a/source/x265cli.h Thu May 26 17:49:25 2016 +0530 +++ b/source/x265cli.h Fri Dec 09 10:45:12 2016 +0530 @@ -327,7 +327,7 @@ H0(" --max-tu-size <32|16|8|4> Maximum TU size (WxH). Default %d\n", param->maxTUSize); H0(" --tu-intra-depth <integer> Max TU recursive depth for intra CUs. Default %d\n", param->tuQTMaxIntraDepth); H0(" --tu-inter-depth <integer> Max TU recursive depth for inter CUs. Default %d\n", param->tuQTMaxInterDepth); - H0(" --limit-tu <integer> Enable early exit from TU recursion for inter coded blocks. Default %d\n", param->limitTU); + H0(" --limit-tu <0..4> Enable early exit from TU recursion for inter coded blocks. Default %d\n", param->limitTU); H0("\nAnalysis:\n"); H0(" --rd <1..6> Level of RDO in mode decision 1:least....6:full RDO. Default %d\n", param->rdLevel); H0(" --[no-]psy-rd <0..5.0> Strength of psycho-visual rate distortion optimization, 0 to disable. Default %.1f\n", param->psyRd); _______________________________________________ x265-devel mailing list x265-devel@videolan.org https://mailman.videolan.org/listinfo/x265-devel