Changeset 1298 in SHVCSoftware
- Timestamp:
- 20 Jul 2015, 21:06:06 (9 years ago)
- Location:
- branches/SHM-dev/source
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.cpp
r1290 r1298 1325 1325 ("RDOQ", m_useRDOQ, true) 1326 1326 ("RDOQTS", m_useRDOQTS, true) 1327 #if T0196_SELECTIVE_RDOQ 1328 ("SelectiveRDOQ", m_useSelectiveRDOQ, false, "Enable selective RDOQ") 1329 #endif 1327 1330 ("RDpenalty", m_rdPenalty, 0, "RD-penalty for 32x32 TU for intra in non-intra slices. 0:disabled 1:RD-penalty 2:maximum RD-penalty") 1328 1331 -
branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.h
r1290 r1298 268 268 Bool m_useRDOQ; ///< flag for using RD optimized quantization 269 269 Bool m_useRDOQTS; ///< flag for using RD optimized quantization for transform skip 270 #if T0196_SELECTIVE_RDOQ 271 Bool m_useSelectiveRDOQ; ///< flag for using selective RDOQ 272 #endif 270 273 Int m_rdPenalty; ///< RD-penalty for 32x32 TU for intra in non-intra slices (0: no RD-penalty, 1: RD-penalty, 2: maximum RD-penalty) 271 274 Int m_iFastSearch; ///< ME mode, 0 = full, 1 = diamond, 2 = PMVFAST -
branches/SHM-dev/source/App/TAppEncoder/TAppEncTop.cpp
r1292 r1298 435 435 m_acTEncTop[layer].setUseRDOQ ( m_useRDOQ ); 436 436 m_acTEncTop[layer].setUseRDOQTS ( m_useRDOQTS ); 437 #if T0196_SELECTIVE_RDOQ 438 m_acTEncTop[layer].setUseSelectiveRDOQ ( m_useSelectiveRDOQ ); 439 #endif 437 440 m_acTEncTop[layer].setRDpenalty ( m_rdPenalty ); 438 441 m_acTEncTop[layer].setMaxCUWidth ( m_acLayerCfg[layer].m_uiMaxCUWidth ); … … 867 870 m_cTEncTop.setUseRDOQ ( m_useRDOQ ); 868 871 m_cTEncTop.setUseRDOQTS ( m_useRDOQTS ); 872 #if T0196_SELECTIVE_RDOQ 873 m_cTEncTop.setUseSelectiveRDOQ ( m_useSelectiveRDOQ ); 874 #endif 869 875 m_cTEncTop.setRDpenalty ( m_rdPenalty ); 870 876 m_cTEncTop.setMaxCUWidth ( m_uiMaxCUWidth ); -
branches/SHM-dev/source/Lib/TLibCommon/TComTrQuant.cpp
r1292 r1298 1161 1161 if ( useRDOQ && (isLuma(compID) || RDOQ_CHROMA) ) 1162 1162 { 1163 #if T0196_SELECTIVE_RDOQ 1164 if ( !m_useSelectiveRDOQ || xNeedRDOQ( rTu, piCoef, compID, cQP ) ) 1165 { 1166 #endif 1163 1167 #if ADAPTIVE_QP_SELECTION 1164 xRateDistOptQuant( rTu, piCoef, pDes, pArlDes, uiAbsSum, compID, cQP );1168 xRateDistOptQuant( rTu, piCoef, pDes, pArlDes, uiAbsSum, compID, cQP ); 1165 1169 #else 1166 xRateDistOptQuant( rTu, piCoef, pDes, uiAbsSum, compID, cQP ); 1170 xRateDistOptQuant( rTu, piCoef, pDes, uiAbsSum, compID, cQP ); 1171 #endif 1172 #if T0196_SELECTIVE_RDOQ 1173 } 1174 else 1175 { 1176 memset( pDes, 0, sizeof( TCoeff ) * uiWidth *uiHeight ); 1177 uiAbsSum = 0; 1178 } 1167 1179 #endif 1168 1180 } … … 1249 1261 //return; 1250 1262 } 1263 1264 #if T0196_SELECTIVE_RDOQ 1265 Bool TComTrQuant::xNeedRDOQ( TComTU &rTu, TCoeff * pSrc, const ComponentID compID, const QpParam &cQP ) 1266 { 1267 const TComRectangle &rect = rTu.getRect(compID); 1268 const UInt uiWidth = rect.width; 1269 const UInt uiHeight = rect.height; 1270 TComDataCU* pcCU = rTu.getCU(); 1271 const UInt uiAbsPartIdx = rTu.GetAbsPartIdxTU(); 1272 const Int channelBitDepth = pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)); 1273 1274 TCoeff* piCoef = pSrc; 1275 1276 const Bool useTransformSkip = pcCU->getTransformSkip(uiAbsPartIdx, compID); 1277 const Int maxLog2TrDynamicRange = pcCU->getSlice()->getSPS()->getMaxLog2TrDynamicRange(toChannelType(compID)); 1278 1279 const UInt uiLog2TrSize = rTu.GetEquivalentLog2TrSize(compID); 1280 1281 Int scalingListType = getScalingListType(pcCU->getPredictionMode(uiAbsPartIdx), compID); 1282 assert(scalingListType < SCALING_LIST_NUM); 1283 Int *piQuantCoeff = getQuantCoeff(scalingListType, cQP.rem, uiLog2TrSize-2); 1284 1285 const Bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, (pcCU->getTransformSkip(uiAbsPartIdx, compID) != 0)); 1286 const Int defaultQuantisationCoefficient = g_quantScales[cQP.rem]; 1287 1288 /* for 422 chroma blocks, the effective scaling applied during transformation is not a power of 2, hence it cannot be 1289 * implemented as a bit-shift (the quantised result will be sqrt(2) * larger than required). Alternatively, adjust the 1290 * uiLog2TrSize applied in iTransformShift, such that the result is 1/sqrt(2) the required result (i.e. smaller) 1291 * Then a QP+3 (sqrt(2)) or QP-3 (1/sqrt(2)) method could be used to get the required result 1292 */ 1293 1294 // Represents scaling through forward transform 1295 Int iTransformShift = getTransformShift(channelBitDepth, uiLog2TrSize, maxLog2TrDynamicRange); 1296 if (useTransformSkip && pcCU->getSlice()->getSPS()->getUseExtendedPrecision()) 1297 { 1298 iTransformShift = std::max<Int>(0, iTransformShift); 1299 } 1300 1301 const Int iQBits = QUANT_SHIFT + cQP.per + iTransformShift; 1302 // QBits will be OK for any internal bit depth as the reduction in transform shift is balanced by an increase in Qp_per due to QpBDOffset 1303 1304 // iAdd is different from the iAdd used in normal quantization 1305 const Int iAdd = (compID == COMPONENT_Y ? 171 : 256) << (iQBits-9); 1306 const Int qBits8 = iQBits - 8; 1307 1308 for( Int uiBlockPos = 0; uiBlockPos < uiWidth*uiHeight; uiBlockPos++ ) 1309 { 1310 const TCoeff iLevel = piCoef[uiBlockPos]; 1311 const Int64 tmpLevel = (Int64)abs(iLevel) * (enableScalingLists ? piQuantCoeff[uiBlockPos] : defaultQuantisationCoefficient); 1312 const TCoeff quantisedMagnitude = TCoeff((tmpLevel + iAdd ) >> iQBits); 1313 1314 if ( quantisedMagnitude != 0 ) 1315 { 1316 return true; 1317 } 1318 } // for n 1319 return false; 1320 } 1321 #endif 1251 1322 1252 1323 Void TComTrQuant::xDeQuant( TComTU &rTu, … … 1376 1447 Bool bUseRDOQ, 1377 1448 Bool bUseRDOQTS, 1449 #if T0196_SELECTIVE_RDOQ 1450 Bool useSelectiveRDOQ, 1451 #endif 1378 1452 Bool bEnc, 1379 1453 Bool useTransformSkipFast … … 1387 1461 m_useRDOQ = bUseRDOQ; 1388 1462 m_useRDOQTS = bUseRDOQTS; 1463 #if T0196_SELECTIVE_RDOQ 1464 m_useSelectiveRDOQ = useSelectiveRDOQ; 1465 #endif 1389 1466 #if ADAPTIVE_QP_SELECTION 1390 1467 m_bUseAdaptQpSelect = bUseAdaptQpSelect; -
branches/SHM-dev/source/Lib/TLibCommon/TComTrQuant.h
r1287 r1298 106 106 Bool useRDOQ = false, 107 107 Bool useRDOQTS = false, 108 #if T0196_SELECTIVE_RDOQ 109 Bool useSelectiveRDOQ = false, 110 #endif 108 111 Bool bEnc = false, 109 112 Bool useTransformSkipFast = false … … 216 219 Bool m_useRDOQ; 217 220 Bool m_useRDOQTS; 221 #if T0196_SELECTIVE_RDOQ 222 Bool m_useSelectiveRDOQ; 223 #endif 218 224 #if ADAPTIVE_QP_SELECTION 219 225 Bool m_bUseAdaptQpSelect; … … 247 253 const ComponentID compID, 248 254 const QpParam &cQP ); 255 256 #if T0196_SELECTIVE_RDOQ 257 Bool xNeedRDOQ( TComTU &rTu, 258 TCoeff * pSrc, 259 const ComponentID compID, 260 const QpParam &cQP ); 261 #endif 249 262 250 263 // RDOQ functions -
branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h
r1287 r1298 162 162 // Tool Switches 163 163 // ==================================================================================================================== 164 #define T0196_SELECTIVE_RDOQ 1 ///< selective RDOQ 164 165 165 166 #define HARMONIZE_GOP_FIRST_FIELD_COUPLE 1 -
branches/SHM-dev/source/Lib/TLibEncoder/TEncCfg.h
r1290 r1298 196 196 Bool m_useRDOQ; 197 197 Bool m_useRDOQTS; 198 #if T0196_SELECTIVE_RDOQ 199 Bool m_useSelectiveRDOQ; 200 #endif 198 201 UInt m_rdPenalty; 199 202 Bool m_bUseFastEnc; … … 618 621 Void setUseRDOQ ( Bool b ) { m_useRDOQ = b; } 619 622 Void setUseRDOQTS ( Bool b ) { m_useRDOQTS = b; } 623 #if T0196_SELECTIVE_RDOQ 624 Void setUseSelectiveRDOQ ( Bool b ) { m_useSelectiveRDOQ = b; } 625 #endif 620 626 Void setRDpenalty ( UInt b ) { m_rdPenalty = b; } 621 627 Void setUseFastEnc ( Bool b ) { m_bUseFastEnc = b; } … … 637 643 Bool getUseRDOQ () { return m_useRDOQ; } 638 644 Bool getUseRDOQTS () { return m_useRDOQTS; } 645 #if T0196_SELECTIVE_RDOQ 646 Bool getUseSelectiveRDOQ () { return m_useSelectiveRDOQ; } 647 #endif 639 648 Int getRDpenalty () { return m_rdPenalty; } 640 649 Bool getUseFastEnc () { return m_bUseFastEnc; } -
branches/SHM-dev/source/Lib/TLibEncoder/TEncTop.cpp
r1290 r1298 250 250 m_useRDOQ, 251 251 m_useRDOQTS, 252 #if T0196_SELECTIVE_RDOQ 253 m_useSelectiveRDOQ, 254 #endif 252 255 true 253 256 ,m_useTransformSkipFast
Note: See TracChangeset for help on using the changeset viewer.