Changeset 1246 in SHVCSoftware for branches/SHM-dev/source/Lib/TLibEncoder
- Timestamp:
- 14 Jul 2015, 00:26:07 (10 years ago)
- Location:
- branches/SHM-dev/source/Lib/TLibEncoder
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/Lib/TLibEncoder/NALwrite.cpp
r1237 r1246 99 99 zeroCount=0; 100 100 } 101 if (v==0) zeroCount++; else zeroCount=0; 101 102 if (v==0) 103 { 104 zeroCount++; 105 } 106 else 107 { 108 zeroCount=0; 109 } 102 110 outputBuffer[outputAmount++]=v; 103 111 } … … 108 116 * to 0x03 is appended to the end of the data. 109 117 */ 110 if (zeroCount>0) outputBuffer[outputAmount++]=emulation_prevention_three_byte[0]; 118 if (zeroCount>0) 119 { 120 outputBuffer[outputAmount++]=emulation_prevention_three_byte[0]; 121 } 111 122 out.write((Char*)&(*outputBuffer.begin()), outputAmount); 112 123 } -
branches/SHM-dev/source/Lib/TLibEncoder/SEIwrite.cpp
r1235 r1246 247 247 #if ENC_DEC_TRACE 248 248 if (g_HLSTraceEnable) 249 xTraceSEIHeader(); 249 { 250 xTraceSEIHeader(); 251 } 250 252 #endif 251 253 … … 267 269 #if ENC_DEC_TRACE 268 270 if (g_HLSTraceEnable) 269 xTraceSEIMessageType(sei.payloadType()); 271 { 272 xTraceSEIMessageType(sei.payloadType()); 273 } 270 274 #endif 271 275 … … 592 596 WRITE_FLAG( sei.m_arrangementCancelFlag, "frame_packing_arrangement_cancel_flag" ); 593 597 594 if( sei.m_arrangementCancelFlag == 0 ) { 598 if( sei.m_arrangementCancelFlag == 0 ) 599 { 595 600 WRITE_CODE( sei.m_arrangementType, 7, "frame_packing_arrangement_type" ); 596 601 … … 890 895 WRITE_FLAG(currentTimeSet.hoursFlag, "hours_flag"); 891 896 if(currentTimeSet.hoursFlag) 897 { 892 898 WRITE_CODE(currentTimeSet.hoursValue, 5, "hours_value"); 899 } 893 900 } 894 901 } -
branches/SHM-dev/source/Lib/TLibEncoder/TEncAnalyze.h
r1029 r1246 108 108 Int maximumBitDepth = g_bitDepth[0]; 109 109 for (UInt channelTypeIndex = 1; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++) 110 { 110 111 if (g_bitDepth[channelTypeIndex] > maximumBitDepth) 112 { 111 113 maximumBitDepth = g_bitDepth[channelTypeIndex]; 114 } 115 } 112 116 113 117 const UInt maxval = 255 << (maximumBitDepth - 8); … … 148 152 const ComponentID compID = ComponentID(componentIndex); 149 153 150 if (getNumPic() == 0) MSEBasedSNR[compID] = 0 * dScale; // this is the same calculation that will be evaluated for any other statistic when there are no frames (it should result in NaN). We use it here so all the output is consistent. 154 if (getNumPic() == 0) 155 { 156 MSEBasedSNR[compID] = 0 * dScale; // this is the same calculation that will be evaluated for any other statistic when there are no frames (it should result in NaN). We use it here so all the output is consistent. 157 } 151 158 else 152 159 { … … 171 178 printf( " \tTotal Frames | " "Bitrate " "Y-PSNR" ); 172 179 173 if (printSequenceMSE) printf( " Y-MSE\n" ); 174 else printf("\n"); 180 if (printSequenceMSE) 181 { 182 printf( " Y-MSE\n" ); 183 } 184 else 185 { 186 printf("\n"); 187 } 175 188 176 189 //printf( "\t------------ " " ----------" " -------- " " -------- " " --------\n" ); … … 192 205 printf( " %8.4lf\n", m_MSEyuvframe[COMPONENT_Y ] / (Double)getNumPic() ); 193 206 } 194 else printf("\n"); 207 else 208 { 209 printf("\n"); 210 } 195 211 196 212 #if SVC_EXTENSION … … 208 224 printf( "\tTotal Frames | " "Bitrate " "Y-PSNR" ); 209 225 210 if (printSequenceMSE) printf( " Y-MSE\n" ); 211 else printf("\n"); 226 if (printSequenceMSE) 227 { 228 printf( " Y-MSE\n" ); 229 } 230 else 231 { 232 printf("\n"); 233 } 212 234 213 235 //printf( "\t------------ " " ----------" " -------- " " -------- " " --------\n" ); … … 226 248 printf( " %8.4lf\n", m_MSEyuvframe[COMPONENT_Y ] / (Double)getNumPic() ); 227 249 } 228 else printf("\n"); 250 else 251 { 252 printf("\n"); 253 } 229 254 } 230 255 break; … … 246 271 printf( " \tTotal Frames | " "Bitrate " "Y-PSNR " "U-PSNR " "V-PSNR " "YUV-PSNR " ); 247 272 248 if (printSequenceMSE) printf( " Y-MSE " "U-MSE " "V-MSE " "YUV-MSE \n" ); 249 else printf("\n"); 273 if (printSequenceMSE) 274 { 275 printf( " Y-MSE " "U-MSE " "V-MSE " "YUV-MSE \n" ); 276 } 277 else 278 { 279 printf("\n"); 280 } 250 281 251 282 //printf( "\t------------ " " ----------" " -------- " " -------- " " --------\n" ); … … 272 303 MSEyuv ); 273 304 } 274 else printf("\n"); 305 else 306 { 307 printf("\n"); 308 } 275 309 276 310 #if SVC_EXTENSION … … 295 329 printf( "\tTotal Frames | " "Bitrate " "Y-PSNR " "U-PSNR " "V-PSNR " "YUV-PSNR " ); 296 330 297 if (printSequenceMSE) printf( " Y-MSE " "U-MSE " "V-MSE " "YUV-MSE \n" ); 298 else printf("\n"); 331 if (printSequenceMSE) 332 { 333 printf( " Y-MSE " "U-MSE " "V-MSE " "YUV-MSE \n" ); 334 } 335 else 336 { 337 printf("\n"); 338 } 299 339 300 340 //printf( "\t------------ " " ----------" " -------- " " -------- " " --------\n" ); … … 321 361 MSEyuv ); 322 362 } 323 else printf("\n"); 363 else 364 { 365 printf("\n"); 366 } 324 367 } 325 368 } … … 390 433 MSEyuv ); 391 434 } 392 else fprintf(pFile, "\n"); 435 else 436 { 437 fprintf(pFile, "\n"); 438 } 393 439 394 440 break; -
branches/SHM-dev/source/Lib/TLibEncoder/TEncBinCoderCABAC.cpp
r1029 r1246 230 230 #ifdef DEBUG_CABAC_BINS 231 231 if ((g_debugCounter + debugCabacBinWindow) >= debugCabacBinTargetLine) 232 { 232 233 std::cout << g_debugCounter << ": coding bin value " << binValue << ", range = [" << startingRange << "->" << m_uiRange << "]\n"; 234 } 233 235 234 236 if (g_debugCounter >= debugCabacBinTargetLine) … … 237 239 breakPointThis = 7; 238 240 } 239 if (g_debugCounter >= (debugCabacBinTargetLine + debugCabacBinWindow)) exit(0); 241 if (g_debugCounter >= (debugCabacBinTargetLine + debugCabacBinWindow)) 242 { 243 exit(0); 244 } 245 240 246 g_debugCounter++; 241 247 #endif -
branches/SHM-dev/source/Lib/TLibEncoder/TEncBinCoderCABACCounter.cpp
r1029 r1246 84 84 #ifdef DEBUG_ENCODER_SEARCH_BINS 85 85 if ((g_debugCounter + debugEncoderSearchBinWindow) >= debugEncoderSearchBinTargetLine) 86 { 86 87 std::cout << g_debugCounter << ": coding bin value " << binValue << ", fracBits = [" << startingFracBits << "->" << m_fracBits << "]\n"; 88 } 87 89 88 90 if (g_debugCounter >= debugEncoderSearchBinTargetLine) … … 91 93 breakPointThis = 7; 92 94 } 93 if (g_debugCounter >= (debugEncoderSearchBinTargetLine + debugEncoderSearchBinWindow)) exit(0); 95 if (g_debugCounter >= (debugEncoderSearchBinTargetLine + debugEncoderSearchBinWindow)) 96 { 97 exit(0); 98 } 94 99 g_debugCounter++; 95 100 #endif -
branches/SHM-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
r1237 r1246 1155 1155 { 1156 1156 WRITE_FLAG( pcSlice->getSaoEnabledFlag(CHANNEL_TYPE_LUMA), "slice_sao_luma_flag" ); 1157 if (chromaEnabled) WRITE_FLAG( pcSlice->getSaoEnabledFlag(CHANNEL_TYPE_CHROMA), "slice_sao_chroma_flag" ); 1157 if (chromaEnabled) 1158 { 1159 WRITE_FLAG( pcSlice->getSaoEnabledFlag(CHANNEL_TYPE_CHROMA), "slice_sao_chroma_flag" ); 1160 } 1158 1161 } 1159 1162 … … 1274 1277 if (pcSlice->getPPS()->getSliceChromaQpFlag()) 1275 1278 { 1276 if (numberValidComponents > COMPONENT_Cb) { WRITE_SVLC( pcSlice->getSliceChromaQpDelta(COMPONENT_Cb), "slice_qp_delta_cb" ); } 1277 if (numberValidComponents > COMPONENT_Cr) { WRITE_SVLC( pcSlice->getSliceChromaQpDelta(COMPONENT_Cr), "slice_qp_delta_cr" ); } 1279 if (numberValidComponents > COMPONENT_Cb) 1280 { 1281 WRITE_SVLC( pcSlice->getSliceChromaQpDelta(COMPONENT_Cb), "slice_qp_delta_cb" ); 1282 } 1283 if (numberValidComponents > COMPONENT_Cr) 1284 { 1285 WRITE_SVLC( pcSlice->getSliceChromaQpDelta(COMPONENT_Cr), "slice_qp_delta_cr" ); 1286 } 1278 1287 assert(numberValidComponents <= COMPONENT_Cr+1); 1279 1288 } -
branches/SHM-dev/source/Lib/TLibEncoder/TEncCfg.h
r1235 r1246 239 239 240 240 Int m_iWaveFrontSynchro; 241 Int m_iWaveFrontSubstreams;242 241 243 242 Int m_decodedPictureHashSEIEnabled; ///< Checksum(3)/CRC(2)/MD5(1)/disable(0) acting on decoded picture hash SEI message -
branches/SHM-dev/source/Lib/TLibEncoder/TEncCu.cpp
r1243 r1246 955 955 { 956 956 if (m_pcEncCfg->getCostMode()==COST_MIXED_LOSSLESS_LOSSY_CODING) 957 { 957 958 rpcBestCU->getTotalCost()=rpcTempCU->getTotalCost() + (1.0 / m_pcRdCost->getLambda()); 959 } 958 960 else 961 { 959 962 rpcBestCU->getTotalCost()=rpcTempCU->getTotalCost()+1; 963 } 960 964 } 961 965 -
branches/SHM-dev/source/Lib/TLibEncoder/TEncEntropy.cpp
r1235 r1246 240 240 const Bool bDebugRQT=g_bFinalEncode && DebugOptionList::DebugRQT.getInt()!=0; 241 241 if (bDebugRQT) 242 { 242 243 printf("x..codeTransform: offsetLuma=%d offsetChroma=%d absPartIdx=%d, uiDepth=%d\n width=%d, height=%d, uiTrIdx=%d, uiInnerQuadIdx=%d\n", 243 244 rTu.getCoefficientOffset(COMPONENT_Y), rTu.getCoefficientOffset(COMPONENT_Cb), uiAbsPartIdx, uiDepth, rTu.getRect(COMPONENT_Y).width, rTu.getRect(COMPONENT_Y).height, rTu.GetTransformDepthRel(), rTu.GetSectionNumber()); 245 } 244 246 #endif 245 247 const UInt uiSubdiv = pcCU->getTransformIdx( uiAbsPartIdx ) > uiTrIdx;// + pcCU->getDepth( uiAbsPartIdx ) > uiDepth; … … 260 262 { 261 263 bHaveACodedBlock = true; 262 if (isChroma(compID)) bHaveACodedChromaBlock = true; 264 if (isChroma(compID)) 265 { 266 bHaveACodedChromaBlock = true; 267 } 263 268 } 264 269 } … … 322 327 { 323 328 xEncodeTransform( bCodeDQP, codeChromaQpAdj, tuRecurseChild ); 324 } 325 while (tuRecurseChild.nextSection(rTu)); 329 } while (tuRecurseChild.nextSection(rTu)); 326 330 } 327 331 else … … 378 382 { 379 383 #if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST 380 if (bDebugRQT) printf("Call NxN for chan %d width=%d height=%d cbf=%d\n", compID, rTu.getRect(compID).width, rTu.getRect(compID).height, 1); 384 if (bDebugRQT) 385 { 386 printf("Call NxN for chan %d width=%d height=%d cbf=%d\n", compID, rTu.getRect(compID).width, rTu.getRect(compID).height, 1); 387 } 381 388 #endif 382 389 … … 393 400 { 394 401 #if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST 395 if (bDebugRQT) printf("Call NxN for chan %d width=%d height=%d cbf=%d\n", compID, subTUIterator.getRect(compID).width, subTUIterator.getRect(compID).height, 1); 402 if (bDebugRQT) 403 { 404 printf("Call NxN for chan %d width=%d height=%d cbf=%d\n", compID, subTUIterator.getRect(compID).width, subTUIterator.getRect(compID).height, 1); 405 } 396 406 #endif 397 407 m_pcEntropyCoderIf->codeCoeffNxN( subTUIterator, (pcCU->getCoeff(compID) + subTUIterator.getCoefficientOffset(compID)), compID ); … … 435 445 { 436 446 UInt cdir=pcCU->getIntraDir(CHANNEL_TYPE_CHROMA, uiAbsPartIdx); 437 if (cdir==36) cdir=pcCU->getIntraDir(CHANNEL_TYPE_LUMA, uiAbsPartIdx); 447 if (cdir==36) 448 { 449 cdir=pcCU->getIntraDir(CHANNEL_TYPE_LUMA, uiAbsPartIdx); 450 } 438 451 printf("coding chroma Intra dir: %d, uiAbsPartIdx: %d, luma dir: %d\n", cdir, uiAbsPartIdx, pcCU->getIntraDir(CHANNEL_TYPE_LUMA, uiAbsPartIdx)); 439 452 } … … 683 696 TComTURecurse tuRecurse(pcCU, uiAbsPartIdx, uiDepth); 684 697 #if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST 685 if (bDebugRQT) printf("..codeCoeff: uiAbsPartIdx=%d, PU format=%d, 2Nx2N=%d, NxN=%d\n", uiAbsPartIdx, pcCU->getPartitionSize(uiAbsPartIdx), SIZE_2Nx2N, SIZE_NxN); 698 if (bDebugRQT) 699 { 700 printf("..codeCoeff: uiAbsPartIdx=%d, PU format=%d, 2Nx2N=%d, NxN=%d\n", uiAbsPartIdx, pcCU->getPartitionSize(uiAbsPartIdx), SIZE_2Nx2N, SIZE_NxN); 701 } 686 702 #endif 687 703 -
branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp
r1237 r1246 598 598 sei_time_code.numClockTs = m_pcCfg->getNumberOfTimesets(); 599 599 for(Int i = 0; i < sei_time_code.numClockTs; i++) 600 { 600 601 sei_time_code.timeSetArray[i] = m_pcCfg->getTimeSet(i); 602 } 601 603 602 604 nalu = NALUnit(NAL_UNIT_PREFIX_SEI); … … 1542 1544 { 1543 1545 if(m_pcCfg->getGOPEntry(kk).m_POC==tPoc) 1546 { 1544 1547 break; 1548 } 1545 1549 } 1546 1550 Int tTid=m_pcCfg->getGOPEntry(kk).m_temporalId; … … 3040 3044 flag = 1; 3041 3045 } 3042 else ui64Tmp = maxDiff - tmp + 1; 3046 else 3047 { 3048 ui64Tmp = maxDiff - tmp + 1; 3049 } 3043 3050 } 3044 3051 pCRD[ i ] = (UInt)ui64Tmp - uiPrev - 1; … … 3245 3252 delete pcBitstreamRedirect; 3246 3253 3247 if( accumBitsDU != NULL) delete accumBitsDU; 3248 if( accumNalsDU != NULL) delete accumNalsDU; 3254 if( accumBitsDU != NULL) 3255 { 3256 delete accumBitsDU; 3257 } 3258 if( accumNalsDU != NULL) 3259 { 3260 delete accumNalsDU; 3261 } 3249 3262 3250 3263 #if SVC_EXTENSION … … 3317 3330 3318 3331 if (!bCalcDist) 3332 { 3319 3333 ruiDist = xFindDistortionFrame(pcPic->getPicYuvOrg(), pcPic->getPicYuvRec()); 3334 } 3320 3335 } 3321 3336 … … 3556 3571 3557 3572 Char c = (pcSlice->isIntra() ? 'I' : pcSlice->isInterP() ? 'P' : 'B'); 3558 if (!pcSlice->isReferenced()) c += 32; 3573 if (!pcSlice->isReferenced()) 3574 { 3575 c += 32; 3576 } 3559 3577 3560 3578 #if SVC_EXTENSION … … 3824 3842 vRL[i] = 0; 3825 3843 for( Int j = i - RVM_VCEGAM10_M ; j <= i + RVM_VCEGAM10_M - 1 ; j++ ) 3844 { 3826 3845 vRL[i] += m_vRVM_RP[j]; 3846 } 3827 3847 vRL[i] /= ( 2 * RVM_VCEGAM10_M ); 3828 3848 vB[i] = vB[i-1] + m_vRVM_RP[i] - vRL[i]; -
branches/SHM-dev/source/Lib/TLibEncoder/TEncPreanalyzer.h
r595 r1246 2 2 * License, included below. This software may be subject to other third party 3 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 4 * granted under this license. 5 5 * 6 6 * Copyright (c) 2010-2014, ITU/ISO/IEC -
branches/SHM-dev/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp
r1029 r1246 519 519 for(Int classIdx=0; classIdx<NUM_SAO_EO_CLASSES; classIdx++) 520 520 { 521 if(classIdx==SAO_CLASS_EO_FULL_VALLEY && quantOffsets[classIdx] < 0) quantOffsets[classIdx] =0; 522 if(classIdx==SAO_CLASS_EO_HALF_VALLEY && quantOffsets[classIdx] < 0) quantOffsets[classIdx] =0; 523 if(classIdx==SAO_CLASS_EO_HALF_PEAK && quantOffsets[classIdx] > 0) quantOffsets[classIdx] =0; 524 if(classIdx==SAO_CLASS_EO_FULL_PEAK && quantOffsets[classIdx] > 0) quantOffsets[classIdx] =0; 521 if(classIdx==SAO_CLASS_EO_FULL_VALLEY && quantOffsets[classIdx] < 0) 522 { 523 quantOffsets[classIdx] =0; 524 } 525 if(classIdx==SAO_CLASS_EO_HALF_VALLEY && quantOffsets[classIdx] < 0) 526 { 527 quantOffsets[classIdx] =0; 528 } 529 if(classIdx==SAO_CLASS_EO_HALF_PEAK && quantOffsets[classIdx] > 0) 530 { 531 quantOffsets[classIdx] =0; 532 } 533 if(classIdx==SAO_CLASS_EO_FULL_PEAK && quantOffsets[classIdx] > 0) 534 { 535 quantOffsets[classIdx] =0; 536 } 525 537 526 538 if( quantOffsets[classIdx] != 0 ) //iterative adjustment only when derived offset is not zero … … 818 830 { 819 831 if (sliceEnabled[compId]) 832 { 820 833 allBlksDisabled = false; 834 } 821 835 } 822 836 … … 953 967 m_lineBufWidth = m_maxCUWidth; 954 968 955 if (m_signLineBuf1) delete[] m_signLineBuf1; m_signLineBuf1 = NULL; 969 if (m_signLineBuf1) 970 { 971 delete[] m_signLineBuf1; 972 m_signLineBuf1 = NULL; 973 } 956 974 m_signLineBuf1 = new Char[m_lineBufWidth+1]; 957 975 958 if (m_signLineBuf2) delete[] m_signLineBuf2; m_signLineBuf2 = NULL; 976 if (m_signLineBuf2) 977 { 978 delete[] m_signLineBuf2; 979 m_signLineBuf2 = NULL; 980 } 959 981 m_signLineBuf2 = new Char[m_lineBufWidth+1]; 960 982 } -
branches/SHM-dev/source/Lib/TLibEncoder/TEncSbac.cpp
r1244 r1246 109 109 SliceType eSliceType = m_pcSlice->getSliceType(); 110 110 111 SliceType encCABACTableIdx = m_pcSlice->getEncCABACTableIdx(); ;111 SliceType encCABACTableIdx = m_pcSlice->getEncCABACTableIdx(); 112 112 if (!m_pcSlice->isIntra() && (encCABACTableIdx==B_SLICE || encCABACTableIdx==P_SLICE) && m_pcSlice->getPPS()->getCabacInitPresentFlag()) 113 113 { … … 407 407 m_pcBinIf->copyState( pSrc->m_pcBinIf ); 408 408 if (isLuma(chType)) 409 { 409 410 this->m_cCUIntraPredSCModel .copyFrom( &pSrc->m_cCUIntraPredSCModel ); 411 } 410 412 else 413 { 411 414 this->m_cCUChromaPredSCModel .copyFrom( &pSrc->m_cCUChromaPredSCModel ); 415 } 412 416 } 413 417 … … 613 617 { 614 618 if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth ) 619 { 615 620 return; 621 } 616 622 617 623 UInt uiCtx = pcCU->getCtxSplitFlag( uiAbsPartIdx, uiDepth ); … … 832 838 TComDataCU *pcCU = rTu.getCU(); 833 839 834 if( isLuma(compID) || !pcCU->getSlice()->getPPS()->getUseCrossComponentPrediction() ) return; 840 if( isLuma(compID) || !pcCU->getSlice()->getPPS()->getUseCrossComponentPrediction() ) 841 { 842 return; 843 } 835 844 836 845 const UInt uiAbsPartIdx = rTu.GetAbsPartIdxTU(); … … 1266 1275 beValid = false; 1267 1276 if ( (!pcCU->isIntra(uiAbsPartIdx)) && pcCU->isRDPCMEnabled(uiAbsPartIdx)) 1277 { 1268 1278 codeExplicitRdpcmMode( rTu, compID); 1279 } 1269 1280 } 1270 1281 else … … 1326 1337 uiNumSig--; 1327 1338 } 1328 } 1329 while ( uiNumSig > 0 ); 1339 } while ( uiNumSig > 0 ); 1330 1340 1331 1341 // Code position of last coefficient -
branches/SHM-dev/source/Lib/TLibEncoder/TEncSearch.cpp
r1244 r1246 239 239 { 240 240 if (iIdx < iNum) 241 { 241 242 m_auiMVPIdxCost[iIdx][iNum] = xGetMvpIdxBits(iIdx, iNum); 243 } 242 244 else 245 { 243 246 m_auiMVPIdxCost[iIdx][iNum] = MAX_INT; 247 } 244 248 } 245 249 } … … 365 369 366 370 if ( m_cDistParam.iRows > 32 ) 371 { 367 372 m_cDistParam.iSubShift = 4; 373 } 368 374 else if ( m_cDistParam.iRows > 16 ) 375 { 369 376 m_cDistParam.iSubShift = 3; 377 } 370 378 else if ( m_cDistParam.iRows > 8 ) 379 { 371 380 m_cDistParam.iSubShift = 2; 381 } 372 382 else 383 { 373 384 m_cDistParam.iSubShift = 1; 385 } 374 386 375 387 Distortion uiTempSad = m_cDistParam.DistFunc( &m_cDistParam ); … … 385 397 uiSad += uiTempSad >> m_cDistParam.iSubShift; 386 398 if(((uiSad << isubShift) + uiBitCost) > rcStruct.uiBestSad) 399 { 387 400 break; 401 } 388 402 389 403 m_cDistParam.iSubShift--; … … 898 912 const ComponentID compID=ComponentID(ch); 899 913 if( rTu.ProcessingAllQuadrants(compID) && (uiTrDepth==0 || pcCU->getCbf( uiAbsPartIdx, compID, uiTrDepth-1 ) )) 914 { 900 915 m_pcEntropyCoder->encodeQtCbf(rTu, compID, (uiSubdiv == 0)); 916 } 901 917 } 902 918 } … … 1007 1023 { 1008 1024 UInt uiQNumParts = pcCU->getTotalNumPart() >> 2; 1009 if (uiTrDepth>0 && (uiAbsPartIdx%uiQNumParts)==0) m_pcEntropyCoder->encodeIntraDirModeLuma ( pcCU, uiAbsPartIdx ); 1025 if (uiTrDepth>0 && (uiAbsPartIdx%uiQNumParts)==0) 1026 { 1027 m_pcEntropyCoder->encodeIntraDirModeLuma ( pcCU, uiAbsPartIdx ); 1028 } 1010 1029 } 1011 1030 } … … 1084 1103 ) 1085 1104 { 1086 if (!rTu.ProcessComponentSection(compID)) return; 1105 if (!rTu.ProcessComponentSection(compID)) 1106 { 1107 return; 1108 } 1087 1109 const Bool bIsLuma = isLuma(compID); 1088 1110 const TComRectangle &rect= rTu.getRect(compID); … … 1208 1230 if (bUseCrossCPrediction) 1209 1231 { 1210 if (xCalcCrossComponentPredictionAlpha( rTu, compID, lumaResidualForEstimate, piResi, uiWidth, uiHeight, MAX_CU_SIZE, uiStride ) == 0) return; 1232 if (xCalcCrossComponentPredictionAlpha( rTu, compID, lumaResidualForEstimate, piResi, uiWidth, uiHeight, MAX_CU_SIZE, uiStride ) == 0) 1233 { 1234 return; 1235 } 1211 1236 TComTrQuant::crossComponentPrediction ( rTu, compID, reconstructedLumaResidual, piResi, piResi, uiWidth, uiHeight, MAX_CU_SIZE, uiStride, uiStride, false ); 1212 1237 } … … 1307 1332 } 1308 1333 } 1309 if (bDebugResi) ss << " - resi: "; 1334 if (bDebugResi) 1335 { 1336 ss << " - resi: "; 1337 } 1310 1338 for( UInt uiX = 0; uiX < uiWidth; uiX++ ) 1311 1339 { 1312 if (bDebugResi) ss << pResi[ uiX ] << ", "; 1340 if (bDebugResi) 1341 { 1342 ss << pResi[ uiX ] << ", "; 1343 } 1313 1344 pReco [ uiX ] = Pel(ClipBD<Int>( Int(pPred[uiX]) + Int(pResi[uiX]), clipbd )); 1314 1345 pRecQt [ uiX ] = pReco[ uiX ]; … … 1527 1558 xLoadIntraResultQT(COMPONENT_Y, rTu ); 1528 1559 if (rTu.ProcessComponentSection(COMPONENT_Y)) 1560 { 1529 1561 pcCU->setCbfSubParts ( uiSingleCbfLuma << uiTrDepth, COMPONENT_Y, uiAbsPartIdx, rTu.GetTransformDepthTotalAdj(COMPONENT_Y) ); 1562 } 1530 1563 1531 1564 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[ uiFullDepth ][ CI_TEMP_BEST ] ); … … 1902 1935 if( uiTrMode == uiTrDepth ) 1903 1936 { 1904 if (!rTu.ProcessChannelSection(CHANNEL_TYPE_CHROMA)) return; 1937 if (!rTu.ProcessChannelSection(CHANNEL_TYPE_CHROMA)) 1938 { 1939 return; 1940 } 1905 1941 1906 1942 const UInt uiFullDepth = rTu.GetTransformDepthTotal(); … … 2041 2077 pcCU ->setCrossComponentPredictionAlphaPartRange( bestCrossCPredictionAlpha, compID, subTUAbsPartIdx, partIdxesPerSubTU ); 2042 2078 ruiDist += singleDistC; 2043 } 2044 while (TUIterator.nextSection(rTu)); 2045 2046 if (splitIntoSubTUs) offsetSubTUCBFs(rTu, compID); 2079 } while (TUIterator.nextSection(rTu)); 2080 2081 if (splitIntoSubTUs) 2082 { 2083 offsetSubTUCBFs(rTu, compID); 2084 } 2047 2085 } 2048 2086 } … … 2092 2130 TEncSearch::xSetIntraResultChromaQT(TComYuv* pcRecoYuv, TComTU &rTu) 2093 2131 { 2094 if (!rTu.ProcessChannelSection(CHANNEL_TYPE_CHROMA)) return; 2132 if (!rTu.ProcessChannelSection(CHANNEL_TYPE_CHROMA)) 2133 { 2134 return; 2135 } 2095 2136 TComDataCU *pcCU=rTu.getCU(); 2096 2137 const UInt uiAbsPartIdx = rTu.GetAbsPartIdxTU(); … … 2208 2249 2209 2250 if (tuRecurseWithPU.ProcessComponentSection(COMPONENT_Y)) 2251 { 2210 2252 initAdiPatternChType( tuRecurseWithPU, bAboveAvail, bLeftAvail, COMPONENT_Y, true DEBUG_STRING_PASS_INTO(sTemp2) ); 2253 } 2211 2254 2212 2255 Bool doFastSearch = (numModesForFullRD != numModesAvailable); … … 2333 2376 UInt max=numModesForFullRD; 2334 2377 2335 if (DebugOptionList::ForceLumaMode.isSet()) max=0; // we are forcing a direction, so don't bother with mode check 2378 if (DebugOptionList::ForceLumaMode.isSet()) 2379 { 2380 max=0; // we are forcing a direction, so don't bother with mode check 2381 } 2336 2382 for ( UInt uiMode = 0; uiMode < max; uiMode++) 2337 2383 #else … … 2424 2470 #if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST 2425 2471 if (DebugOptionList::ForceLumaMode.isSet()) 2472 { 2426 2473 uiOrgMode = DebugOptionList::ForceLumaMode.getInt(); 2474 } 2427 2475 #endif 2428 2476 … … 2587 2635 { 2588 2636 uiMinMode=DebugOptionList::ForceChromaMode.getInt(); 2589 if (uiModeList[uiMinMode]==34) uiMinMode=4; // if the fixed mode has been renumbered because DM_CHROMA covers it, use DM_CHROMA. 2637 if (uiModeList[uiMinMode]==34) 2638 { 2639 uiMinMode=4; // if the fixed mode has been renumbered because DM_CHROMA covers it, use DM_CHROMA. 2640 } 2590 2641 uiMaxMode=uiMinMode+1; 2591 2642 } … … 3083 3134 { 3084 3135 uiBitsTemp += iRefIdxTemp+1; 3085 if ( iRefIdxTemp == pcCU->getSlice()->getNumRefIdx(eRefPicList)-1 ) uiBitsTemp--; 3136 if ( iRefIdxTemp == pcCU->getSlice()->getNumRefIdx(eRefPicList)-1 ) 3137 { 3138 uiBitsTemp--; 3139 } 3086 3140 } 3087 3141 … … 3209 3263 { 3210 3264 uiMotBits[1] += bestBiPRefIdxL1+1; 3211 if ( bestBiPRefIdxL1 == pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_1)-1 ) uiMotBits[1]--; 3265 if ( bestBiPRefIdxL1 == pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_1)-1 ) 3266 { 3267 uiMotBits[1]--; 3268 } 3212 3269 } 3213 3270 … … 3319 3376 { 3320 3377 uiBitsTemp += iRefIdxTemp+1; 3321 if ( iRefIdxTemp == pcCU->getSlice()->getNumRefIdx(eRefPicList)-1 ) uiBitsTemp--; 3378 if ( iRefIdxTemp == pcCU->getSlice()->getNumRefIdx(eRefPicList)-1 ) 3379 { 3380 uiBitsTemp--; 3381 } 3322 3382 } 3323 3383 uiBitsTemp += m_auiMVPIdxCost[aaiMvpIdxBi[iRefList][iRefIdxTemp]][AMVP_MAX_NUM_CANDS]; … … 3698 3758 assert(pcAMVPInfo->m_acMvCand[riMVPIdx] == rcMvPred); 3699 3759 3700 if (pcAMVPInfo->iN < 2) return; 3760 if (pcAMVPInfo->iN < 2) 3761 { 3762 return; 3763 } 3701 3764 3702 3765 m_pcRdCost->getMotionCost( true, 0, pcCU->getCUTransquantBypass(0) ); … … 3712 3775 for (Int iMVPIdx = 0; iMVPIdx < pcAMVPInfo->iN; iMVPIdx++) 3713 3776 { 3714 if (iMVPIdx == riMVPIdx) continue; 3777 if (iMVPIdx == riMVPIdx) 3778 { 3779 continue; 3780 } 3715 3781 3716 3782 m_pcRdCost->setPredictor( pcAMVPInfo->m_acMvCand[iMVPIdx] ); … … 3839 3905 TComMv cMvPred = *pcMvPred; 3840 3906 3841 if ( bBi ) xSetSearchRange ( pcCU, rcMv , iSrchRng, cMvSrchRngLT, cMvSrchRngRB ); 3842 else xSetSearchRange ( pcCU, cMvPred, iSrchRng, cMvSrchRngLT, cMvSrchRngRB ); 3907 if ( bBi ) 3908 { 3909 xSetSearchRange ( pcCU, rcMv , iSrchRng, cMvSrchRngLT, cMvSrchRngRB ); 3910 } 3911 else 3912 { 3913 xSetSearchRange ( pcCU, cMvPred, iSrchRng, cMvSrchRngLT, cMvSrchRngRB ); 3914 } 3843 3915 3844 3916 m_pcRdCost->getMotionCost( true, 0, pcCU->getCUTransquantBypass(uiPartAddr) ); … … 4509 4581 if( (pcCU->getWidth(0) > pcCU->getSlice()->getSPS()->getMaxTrSize()) ) 4510 4582 { 4511 while( pcCU->getWidth(0) > (pcCU->getSlice()->getSPS()->getMaxTrSize()<<uiTrLevel) ) uiTrLevel++; 4583 while( pcCU->getWidth(0) > (pcCU->getSlice()->getSPS()->getMaxTrSize()<<uiTrLevel) ) 4584 { 4585 uiTrLevel++; 4586 } 4512 4587 } 4513 4588 … … 4991 5066 currCompCost = m_pcRdCost->calcRdCost(currCompBits, currCompDist); 4992 5067 4993 if (pcCU->isLosslessCoded(0)) nonCoeffCost = MAX_DOUBLE; 5068 if (pcCU->isLosslessCoded(0)) 5069 { 5070 nonCoeffCost = MAX_DOUBLE; 5071 } 4994 5072 } 4995 5073 else if ((transformSkipModeId == 1) && !bUseCrossCPrediction) … … 5086 5164 pcCU->setCbfPartRange ((((uiAbsSum [compID][subTUIndex] > 0) ? 1 : 0) << uiTrMode), compID, subTUAbsPartIdx, partIdxesPerSubTU ); 5087 5165 pcCU->setCrossComponentPredictionAlphaPartRange( bestCrossCPredictionAlpha [compID][subTUIndex], compID, subTUAbsPartIdx, partIdxesPerSubTU ); 5088 } //end of sub-TU loop 5089 while (TUIterator.nextSection(rTu)); 5166 } while (TUIterator.nextSection(rTu)); //end of sub-TU loop 5090 5167 } // processing section 5091 5168 } // component loop … … 5129 5206 5130 5207 m_pcEntropyCoder->encodeCoeffNxN( rTu, pcCoeffCurr[compID], compID ); 5131 for (UInt subTUIndex = 0; subTUIndex < 2; subTUIndex++) uiSingleDist += uiSingleDistComp[compID][subTUIndex]; 5208 for (UInt subTUIndex = 0; subTUIndex < 2; subTUIndex++) 5209 { 5210 uiSingleDist += uiSingleDistComp[compID][subTUIndex]; 5211 } 5132 5212 } 5133 5213 } … … 5168 5248 5169 5249 for (UInt subTU = 0; subTU < 2; subTU++) 5250 { 5170 5251 bestsubTUCBF[compID][subTU] = pcCU->getCbf ((uiAbsPartIdx + (subTU * partIdxesPerSubTU)), compID, subTUDepth); 5252 } 5171 5253 } 5172 5254 } … … 5189 5271 for(UInt ch = 0; ch < numValidComp; ch++) 5190 5272 { 5191 if (lastPos!=std::string::npos && childString.find(debug_reorder_data_inter_token[ch], lastPos)==lastPos) lastPos+=strlen(debug_reorder_data_inter_token[ch]); // skip leading string 5273 if (lastPos!=std::string::npos && childString.find(debug_reorder_data_inter_token[ch], lastPos)==lastPos) 5274 { 5275 lastPos+=strlen(debug_reorder_data_inter_token[ch]); // skip leading string 5276 } 5192 5277 std::size_t pos=childString.find(debug_reorder_data_inter_token[ch+1], lastPos); 5193 if (pos!=std::string::npos && pos>endStrng) lastPos=endStrng; 5278 if (pos!=std::string::npos && pos>endStrng) 5279 { 5280 lastPos=endStrng; 5281 } 5194 5282 sSplitString[ch]+=childString.substr(lastPos, (pos==std::string::npos)? std::string::npos : (pos-lastPos) ); 5195 5283 lastPos=pos; 5196 5284 } 5197 5285 #endif 5198 } 5199 while ( tuRecurseChild.nextSection(rTu) ) ; 5286 } while ( tuRecurseChild.nextSection(rTu) ) ; 5200 5287 5201 5288 UInt uiCbfAny=0; … … 5474 5561 m_pcEntropyCoder->resetBits(); 5475 5562 if (isLuma(chType)) 5563 { 5476 5564 m_pcEntropyCoder->encodeIntraDirModeLuma ( pcCU, uiPartOffset); 5565 } 5477 5566 else 5567 { 5478 5568 m_pcEntropyCoder->encodeIntraDirModeChroma ( pcCU, uiPartOffset); 5569 } 5479 5570 5480 5571 rIntraDirVal = origVal; // restore … … 5491 5582 UInt shift=0; 5492 5583 5493 while ( shift<uiFastCandNum && uiCost<CandCostList[ uiFastCandNum-1-shift ] ) shift++; 5584 while ( shift<uiFastCandNum && uiCost<CandCostList[ uiFastCandNum-1-shift ] ) 5585 { 5586 shift++; 5587 } 5494 5588 5495 5589 if( shift!=0 ) … … 5793 5887 m_cDistParam.bApplyWeight = ( pcSlice->getSliceType()==P_SLICE && pcSlice->testWeightPred() ) || ( pcSlice->getSliceType()==B_SLICE && pcSlice->testWeightBiPred() ) ; 5794 5888 5795 if ( !m_cDistParam.bApplyWeight ) return; 5889 if ( !m_cDistParam.bApplyWeight ) 5890 { 5891 return; 5892 } 5796 5893 5797 5894 Int iRefIdx0 = ( eRefPicListCur == REF_PIC_LIST_0 ) ? iRefIdx : (-1); … … 5800 5897 getWpScaling( pcCU, iRefIdx0, iRefIdx1, wp0 , wp1 ); 5801 5898 5802 if ( iRefIdx0 < 0 ) wp0 = NULL; 5803 if ( iRefIdx1 < 0 ) wp1 = NULL; 5899 if ( iRefIdx0 < 0 ) 5900 { 5901 wp0 = NULL; 5902 } 5903 if ( iRefIdx1 < 0 ) 5904 { 5905 wp1 = NULL; 5906 } 5804 5907 5805 5908 m_cDistParam.wpCur = NULL; -
branches/SHM-dev/source/Lib/TLibEncoder/TEncSlice.cpp
r1235 r1246 98 98 99 99 // free lambda and QP arrays 100 if ( m_pdRdPicLambda ) { xFree( m_pdRdPicLambda ); m_pdRdPicLambda = NULL; } 101 if ( m_pdRdPicQp ) { xFree( m_pdRdPicQp ); m_pdRdPicQp = NULL; } 102 if ( m_piRdPicQp ) { xFree( m_piRdPicQp ); m_piRdPicQp = NULL; } 100 if ( m_pdRdPicLambda ) 101 { 102 xFree( m_pdRdPicLambda ); 103 m_pdRdPicLambda = NULL; 104 } 105 if ( m_pdRdPicQp ) 106 { 107 xFree( m_pdRdPicQp ); 108 m_pdRdPicQp = NULL; 109 } 110 if ( m_piRdPicQp ) 111 { 112 xFree( m_piRdPicQp ); 113 m_piRdPicQp = NULL; 114 } 103 115 } 104 116 … … 952 964 953 965 if (boundingCtuTsAddr <= ctuTsAddr) 966 { 954 967 break; 968 } 955 969 956 970 pcSlice->setSliceBits( (UInt)(pcSlice->getSliceBits() + numberOfWrittenBits) ); … … 1123 1137 ComponentID compId=ComponentID(comp); 1124 1138 sliceEnabled[compId] = pcSlice->getSaoEnabledFlag(toChannelType(compId)) && (comp < pcPic->getNumberValidComponents()); 1125 if (sliceEnabled[compId]) bIsSAOSliceEnabled=true; 1139 if (sliceEnabled[compId]) 1140 { 1141 bIsSAOSliceEnabled=true; 1142 } 1126 1143 } 1127 1144 if (bIsSAOSliceEnabled) … … 1228 1245 break; 1229 1246 case FIXED_NUMBER_OF_BYTES: 1230 if (encodingSlice) 1231 boundingCtuTSAddrSlice = sliceCurEndCtuTSAddr; 1232 else 1233 boundingCtuTSAddrSlice = numberOfCtusInFrame; 1247 boundingCtuTSAddrSlice = (encodingSlice) ? sliceCurEndCtuTSAddr : numberOfCtusInFrame; 1234 1248 break; 1235 1249 case FIXED_NUMBER_OF_TILES: … … 1302 1316 * \returns Updates startCtuTsAddr, boundingCtuTsAddr with appropriate CTU address 1303 1317 */ 1304 Void TEncSlice::xDetermineStartAndBoundingCtuTsAddr ( UInt& startCtuTsAddr, UInt& boundingCtuTsAddr, TComPic* pcPic, const Bool encodingSlice ) 1318 Void TEncSlice::xDetermineStartAndBoundingCtuTsAddr ( UInt& startCtuTsAddr, UInt& boundingCtuTsAddr, TComPic* pcPic, const Bool encodingSlice ) // TODO: this is now only ever called with encodingSlice=false 1305 1319 { 1306 1320 TComSlice* pcSlice = pcPic->getSlice(getSliceIdx()); -
branches/SHM-dev/source/Lib/TLibEncoder/TEncTop.cpp
r1235 r1246 1516 1516 { 1517 1517 for(Int i=0; i<m_iNumRowsMinus1; i++) 1518 { 1518 1519 uiCummulativeRowHeight += m_tileRowHeight[i]; 1520 } 1519 1521 1520 1522 if( uiCummulativeRowHeight >= iHeightInCU ) -
branches/SHM-dev/source/Lib/TLibEncoder/WeightPredAnalysis.cpp
r1235 r1246 92 92 93 93 for(Int y = 0; y < iHeight; y++, pPel+=iStride ) 94 { 94 95 for(Int x = 0; x < iWidth; x++ ) 96 { 95 97 iOrgDC += (Int)( pPel[x] ); 98 } 99 } 96 100 } 97 101 … … 103 107 104 108 for(Int y = 0; y < iHeight; y++, pPel += iStride ) 109 { 105 110 for(Int x = 0; x < iWidth; x++ ) 111 { 106 112 iOrgAC += abs( (Int)pPel[x] - (Int)iOrgNormDC ); 113 } 114 } 107 115 } 108 116 … … 117 125 slice->setWpAcDcParam(weightACDCParam); 118 126 } 127 119 128 120 129 /** check weighted pred or non-weighted pred … … 296 305 297 306 if(deltaWeight >= range || deltaWeight < -range) 307 { 298 308 return false; 309 } 299 310 300 311 #if SVC_EXTENSION
Note: See TracChangeset for help on using the changeset viewer.