- Timestamp:
- 26 Oct 2012, 12:08:59 (12 years ago)
- Location:
- branches/HTM-4.1-dev2-LG/source
- Files:
-
- 33 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-4.1-dev2-LG/source/App/TAppEncoder/TAppEncCfg.cpp
r146 r152 326 326 ("LoopFilterBetaOffset_div2", m_loopFilterBetaOffsetDiv2, 0 ) 327 327 ("LoopFilterTcOffset_div2", m_loopFilterTcOffsetDiv2, 0 ) 328 #if LGE_ILLUCOMP_B0045 329 ("IlluCompEnable", m_bUseIC , true , "Use illumination compensation for inter-view prediction" ) 330 #endif 328 331 #if DBL_CONTROL 329 332 #if FIX_DBL_CONTROL_DEFAULT … … 1718 1721 printf("SAO:%d ", (m_abUseSAO [0] ? 1 : 0)); 1719 1722 printf("RDQ:%d ", (m_abUseRDOQ[0] ? 1 : 0) ); 1723 #if LGE_ILLUCOMP_B0045 1724 printf("IlluCompEnable: %d ", m_bUseIC); 1725 #endif 1720 1726 printf("\n"); 1721 1727 … … 1730 1736 printf("WVSO:%d ", m_bUseWVSO ); 1731 1737 #endif 1738 1732 1739 #if OL_DEPTHLIMIT_A0044 1733 1740 printf("DPL:%d ", m_bDepthPartitionLimiting); -
branches/HTM-4.1-dev2-LG/source/App/TAppEncoder/TAppEncCfg.h
r120 r152 160 160 #endif 161 161 vector<Bool> m_abUseSAO; 162 #if LGE_ILLUCOMP_B0045 163 Bool m_bUseIC; ///< flag for using illumination compensation for inter-view prediction 164 #endif 162 165 #if SAO_UNIT_INTERLEAVING 163 166 Int m_maxNumOffsetsPerPic; ///< SAO maximun number of offset per picture -
branches/HTM-4.1-dev2-LG/source/App/TAppEncoder/TAppEncTop.cpp
r124 r152 300 300 m_acTEncTopList[iViewIdx]->setLFCrossSliceBoundaryFlag( m_bLFCrossSliceBoundaryFlag ); 301 301 m_acTEncTopList[iViewIdx]->setUseSAO ( m_abUseSAO[0] ); 302 #if LGE_ILLUCOMP_B0045 303 m_acTEncTopList[iViewIdx]->setUseIC ( m_bUseIC ); 304 #endif 302 305 #if SAO_UNIT_INTERLEAVING 303 306 m_acTEncTopList[iViewIdx]->setMaxNumOffsetsPerPic (m_maxNumOffsetsPerPic); … … 579 582 m_acTEncDepthTopList[iViewIdx]->setLFCrossSliceBoundaryFlag( m_bLFCrossSliceBoundaryFlag ); 580 583 m_acTEncDepthTopList[iViewIdx]->setUseSAO ( m_abUseSAO[1] ); 584 #if LGE_ILLUCOMP_B0045 585 m_acTEncDepthTopList[iViewIdx]->setUseIC ( false ); 586 #endif 581 587 #if SAO_UNIT_INTERLEAVING 582 588 m_acTEncDepthTopList[iViewIdx]->setMaxNumOffsetsPerPic (m_maxNumOffsetsPerPic); -
branches/HTM-4.1-dev2-LG/source/App/utils/BitrateTargeting/makefile
r56 r152 42 42 43 43 $(extractBitratesExecutable): $(extractBitratesObjects) 44 44 g++ -o $@ $(extractBitratesObjects) 45 45 $(guessLambdaModifiersExecutable): $(guessLambdaModifiersObjects) 46 46 g++ -o $@ $(guessLambdaModifiersObjects) 47 47 48 48 ExtractBitrates.o: ExtractBitrates.h RuntimeError.h … … 52 52 53 53 clean: 54 54 rm $(extractBitratesExecutable) $(extractBitratesObjects) $(guessLambdaModifiersExecutable) $(guessLambdaModifiersObjects) -
branches/HTM-4.1-dev2-LG/source/Lib/TLibCommon/ContextTables.h
r100 r152 52 52 #define NUM_SKIP_FLAG_CTX 3 ///< number of context models for skip flag 53 53 54 #if LGE_ILLUCOMP_B0045 55 #define NUM_IC_FLAG_CTX 3 ///< number of context models for illumination compensation flag 56 #endif 57 54 58 #define NUM_MERGE_FLAG_EXT_CTX 1 ///< number of context models for merge flag of merge extended 55 59 #if MRG_IDX_CTX_RED … … 180 184 { 197, 185, 201, }, 181 185 }; 186 187 #if LGE_ILLUCOMP_B0045 188 static const UChar 189 INIT_IC_FLAG[3][NUM_IC_FLAG_CTX] = 190 { 191 { CNU, CNU, CNU, }, 192 { 197, 185, 201, }, 193 { 197, 185, 201, }, 194 }; 195 #endif 182 196 183 197 static const UChar -
branches/HTM-4.1-dev2-LG/source/Lib/TLibCommon/TComDataCU.cpp
r124 r152 75 75 m_phQP = NULL; 76 76 m_pbMergeFlag = NULL; 77 #if LGE_ILLUCOMP_B0045 78 m_pbICFlag = NULL; 79 #endif 77 80 m_puhMergeIndex = NULL; 78 81 m_puhLumaIntraDir = NULL; … … 209 212 210 213 m_pbMergeFlag = (Bool* )xMalloc(Bool, uiNumPartition); 214 #if LGE_ILLUCOMP_B0045 215 m_pbICFlag = (Bool* )xMalloc(Bool, uiNumPartition); 216 #endif 211 217 m_puhMergeIndex = (UChar* )xMalloc(UChar, uiNumPartition); 212 218 #if HHI_INTER_VIEW_RESIDUAL_PRED … … 355 361 if ( m_puhInterDir ) { xFree(m_puhInterDir); m_puhInterDir = NULL; } 356 362 if ( m_pbMergeFlag ) { xFree(m_pbMergeFlag); m_pbMergeFlag = NULL; } 363 #if LGE_ILLUCOMP_B0045 364 if ( m_pbICFlag ) { xFree(m_pbICFlag); m_pbICFlag = NULL; } 365 #endif 357 366 if ( m_puhMergeIndex ) { xFree(m_puhMergeIndex); m_puhMergeIndex = NULL; } 358 367 #if HHI_INTER_VIEW_RESIDUAL_PRED … … 548 557 m_puiAlfCtrlFlag[ui]=pcFrom->m_puiAlfCtrlFlag[ui]; 549 558 m_pbMergeFlag[ui]=pcFrom->m_pbMergeFlag[ui]; 559 #if LGE_ILLUCOMP_B0045 560 m_pbICFlag[ui]=pcFrom->m_pbICFlag[ui]; 561 #endif 550 562 m_puhMergeIndex[ui]=pcFrom->m_puhMergeIndex[ui]; 551 563 m_puhLumaIntraDir[ui]=pcFrom->m_puhLumaIntraDir[ui]; … … 580 592 memset( m_puiAlfCtrlFlag + firstElement, false, numElements * sizeof( *m_puiAlfCtrlFlag ) ); 581 593 memset( m_pbMergeFlag + firstElement, false, numElements * sizeof( *m_pbMergeFlag ) ); 594 #if LGE_ILLUCOMP_B0045 595 memset( m_pbICFlag + firstElement, false, numElements * sizeof( *m_pbICFlag ) ); 596 #endif 582 597 memset( m_puhMergeIndex + firstElement, 0, numElements * sizeof( *m_puhMergeIndex ) ); 583 598 memset( m_puhLumaIntraDir + firstElement, 2, numElements * sizeof( *m_puhLumaIntraDir ) ); … … 763 778 m_puiAlfCtrlFlag[ui]= false; 764 779 m_pbMergeFlag[ui] = 0; 780 #if LGE_ILLUCOMP_B0045 781 m_pbICFlag[ui] = false; 782 #endif 765 783 m_puhMergeIndex[ui] = 0; 766 784 #if HHI_INTER_VIEW_RESIDUAL_PRED … … 864 882 memset( m_puiAlfCtrlFlag, 0, iSizeInBool ); 865 883 memset( m_pbMergeFlag, 0, iSizeInBool ); 884 #if LGE_ILLUCOMP_B0045 885 memset( m_pbICFlag, 0, iSizeInBool ); 886 #endif 866 887 #if HHI_INTERVIEW_SKIP 867 888 memset( m_pbRenderable, 0, iSizeInBool ); … … 939 960 m_puiAlfCtrlFlag[ui]=pcCU->m_puiAlfCtrlFlag[uiPartOffset+ui]; 940 961 m_pbMergeFlag[ui]=pcCU->m_pbMergeFlag[uiPartOffset+ui]; 962 #if LGE_ILLUCOMP_B0045 963 m_pbICFlag[ui]=pcCU->m_pbICFlag[uiPartOffset+ui]; 964 #endif 941 965 m_puhMergeIndex[ui]=pcCU->m_puhMergeIndex[uiPartOffset+ui]; 942 966 m_puhLumaIntraDir[ui]=pcCU->m_puhLumaIntraDir[uiPartOffset+ui]; … … 1078 1102 1079 1103 m_pbMergeFlag = pcCU->getMergeFlag() + uiPart; 1104 #if LGE_ILLUCOMP_B0045 1105 m_pbICFlag = pcCU->getICFlag() + uiPart; 1106 #endif 1080 1107 m_puhMergeIndex = pcCU->getMergeIndex() + uiPart; 1081 1108 #if HHI_INTER_VIEW_RESIDUAL_PRED … … 1210 1237 1211 1238 m_pbMergeFlag = pcCU->getMergeFlag() + uiAbsPartIdx; 1239 #if LGE_ILLUCOMP_B0045 1240 m_pbICFlag = pcCU->getICFlag() + uiAbsPartIdx; 1241 #endif 1212 1242 m_puhMergeIndex = pcCU->getMergeIndex() + uiAbsPartIdx; 1213 1243 #if HHI_INTER_VIEW_RESIDUAL_PRED … … 1256 1286 memcpy( m_puiAlfCtrlFlag + uiOffset, pcCU->getAlfCtrlFlag(), iSizeInBool ); 1257 1287 memcpy( m_pbMergeFlag + uiOffset, pcCU->getMergeFlag(), iSizeInBool ); 1288 #if LGE_ILLUCOMP_B0045 1289 memcpy( m_pbICFlag + uiOffset, pcCU->getICFlag(), iSizeInBool ); 1290 #endif 1258 1291 memcpy( m_puhMergeIndex + uiOffset, pcCU->getMergeIndex(), iSizeInUchar ); 1259 1292 #if HHI_INTER_VIEW_RESIDUAL_PRED … … 1382 1415 1383 1416 memcpy( rpcCU->getMergeFlag() + m_uiAbsIdxInLCU, m_pbMergeFlag, iSizeInBool ); 1417 #if LGE_ILLUCOMP_B0045 1418 memcpy( rpcCU->getICFlag() + m_uiAbsIdxInLCU, m_pbICFlag, iSizeInBool ); 1419 #endif 1384 1420 memcpy( rpcCU->getMergeIndex() + m_uiAbsIdxInLCU, m_puhMergeIndex, iSizeInUchar ); 1385 1421 #if HHI_INTER_VIEW_RESIDUAL_PRED … … 1500 1536 memcpy( rpcCU->getAlfCtrlFlag() + uiPartOffset, m_puiAlfCtrlFlag, iSizeInBool ); 1501 1537 memcpy( rpcCU->getMergeFlag() + uiPartOffset, m_pbMergeFlag, iSizeInBool ); 1538 #if LGE_ILLUCOMP_B0045 1539 memcpy( rpcCU->getICFlag() + uiPartOffset, m_pbICFlag, iSizeInBool ); 1540 #endif 1502 1541 memcpy( rpcCU->getMergeIndex() + uiPartOffset, m_puhMergeIndex, iSizeInUchar ); 1503 1542 #if HHI_INTER_VIEW_RESIDUAL_PRED … … 2679 2718 } 2680 2719 2720 #if LGE_ILLUCOMP_B0045 2721 UInt TComDataCU::getCtxICFlag( UInt uiAbsPartIdx ) 2722 { 2723 UInt uiCtx = 0; 2724 2725 return uiCtx; 2726 } 2727 #endif 2728 2681 2729 UInt TComDataCU::getCtxInterDir( UInt uiAbsPartIdx ) 2682 2730 { … … 2936 2984 setSubPart<UChar>( uiDir, m_puhInterDir, uiAbsPartIdx, uiDepth, uiPartIdx ); 2937 2985 } 2986 2987 #if LGE_ILLUCOMP_B0045 2988 Void TComDataCU::setICFlagSubParts( Bool bICFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) 2989 { 2990 memset( m_pbICFlag + uiAbsPartIdx, bICFlag, (m_pcPic->getNumPartInCU() >> ( 2 * uiDepth ))*sizeof(Bool) ); 2991 } 2992 2993 Bool TComDataCU::isICFlagRequired(UInt uiAbsPartIdx) 2994 { 2995 UInt uiPartAddr; 2996 UInt iNumbPart; 2997 Int iWidth, iHeight; 2998 2999 UInt uiPartMode = getPartitionSize(uiAbsPartIdx); 3000 3001 iNumbPart = (uiPartMode == SIZE_2Nx2N ? 1 : (uiPartMode == SIZE_NxN ? 4 : 2) ); 3002 3003 for(UInt i = 0; i < iNumbPart; i++) 3004 { 3005 getPartIndexAndSize(i, uiPartAddr, iWidth, iHeight, uiAbsPartIdx, true); 3006 uiPartAddr += uiAbsPartIdx; 3007 3008 for(UInt uiRefIdx = 0; uiRefIdx < 2; uiRefIdx++) 3009 { 3010 RefPicList eRefList = uiRefIdx ? REF_PIC_LIST_1 : REF_PIC_LIST_0; 3011 Int iBestRefIdx = getCUMvField(eRefList)->getRefIdx(uiPartAddr); 3012 3013 if((getInterDir(uiPartAddr) & (uiRefIdx+1)) && iBestRefIdx >= 0 && getSlice()->getViewId() != getSlice()->getRefViewId(eRefList, iBestRefIdx)) 3014 { 3015 return true; 3016 } 3017 } 3018 } 3019 return false; 3020 } 3021 #endif 2938 3022 2939 3023 Void TComDataCU::setMVPIdxSubParts( Int iMVPIdx, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) -
branches/HTM-4.1-dev2-LG/source/Lib/TLibCommon/TComDataCU.h
r121 r152 195 195 196 196 Bool* m_pbMergeFlag; ///< array of merge flags 197 #if LGE_ILLUCOMP_B0045 198 Bool* m_pbICFlag; ///< array of IC flags 199 #endif 197 200 UChar* m_puhMergeIndex; ///< array of merge candidate indices 198 201 #if AMP_MRG … … 471 474 template <typename T> 472 475 Void setSubPart ( T bParameter, T* pbBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx ); 476 477 #if LGE_ILLUCOMP_B0045 478 Bool* getICFlag () { return m_pbICFlag; } 479 Bool getICFlag ( UInt uiIdx ) { return m_pbICFlag[uiIdx]; } 480 Void setICFlag ( UInt uiIdx, Bool uh ) { m_pbICFlag[uiIdx] = uh; } 481 Void setICFlagSubParts ( Bool bICFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); 482 Bool isICFlagRequired (UInt uiAbsPartIdx); 483 #endif 473 484 474 485 #if AMP_MRG … … 696 707 697 708 UInt getCtxSkipFlag ( UInt uiAbsPartIdx ); 709 #if LGE_ILLUCOMP_B0045 710 UInt getCtxICFlag ( UInt uiAbsPartIdx ); 711 #endif 698 712 UInt getCtxInterDir ( UInt uiAbsPartIdx ); 699 713 -
branches/HTM-4.1-dev2-LG/source/Lib/TLibCommon/TComPattern.h
r56 r152 111 111 TComPatternParam m_cPatternCr; 112 112 113 #if LGE_ILLUCOMP_B0045 114 Bool m_bICFlag; 115 #endif 116 113 117 #if LOGI_INTRA_NAME_3MPM 114 118 static const UChar m_aucIntraFilter[5]; … … 124 128 Int getROIYHeight() { return m_cPatternY.m_iROIHeight; } 125 129 Int getPatternLStride() { return m_cPatternY.m_iPatternStride; } 130 131 #if LGE_ILLUCOMP_B0045 132 Bool getICFlag() { return m_bICFlag; } 133 Void setICFlag(Bool bICFlag) { m_bICFlag = bICFlag; } 134 #endif 126 135 127 136 // access functions of ADI buffers -
branches/HTM-4.1-dev2-LG/source/Lib/TLibCommon/TComPrediction.cpp
r100 r152 628 628 if ( eRefPicList != REF_PIC_LIST_X ) 629 629 { 630 #if LGE_ILLUCOMP_B0045 631 if( pcCU->getSlice()->getPPS()->getUseWP() && !pcCU->getICFlag(uiPartAddr)) 632 #else 630 633 if( pcCU->getSlice()->getPPS()->getUseWP()) 634 #endif 631 635 { 632 636 #if DEPTH_MAP_GENERATION … … 644 648 #endif 645 649 } 650 #if LGE_ILLUCOMP_B0045 651 if( pcCU->getSlice()->getPPS()->getUseWP() && !pcCU->getICFlag(uiPartAddr) ) 652 #else 646 653 if ( pcCU->getSlice()->getPPS()->getUseWP() ) 654 #endif 647 655 { 648 656 xWeightedPredictionUni( pcCU, pcYuvPred, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx ); … … 689 697 if ( eRefPicList != REF_PIC_LIST_X ) 690 698 { 699 #if LGE_ILLUCOMP_B0045 700 if( pcCU->getSlice()->getPPS()->getUseWP() && !pcCU->getICFlag(uiPartAddr)) 701 #else 691 702 if( pcCU->getSlice()->getPPS()->getUseWP()) 703 #endif 692 704 { 693 705 #if DEPTH_MAP_GENERATION … … 710 722 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, false ); 711 723 #endif 724 #if LGE_ILLUCOMP_B0045 725 if( pcCU->getSlice()->getPPS()->getUseWP() && !pcCU->getICFlag(uiPartAddr)) 726 #else 712 727 if ( pcCU->getSlice()->getPPS()->getUseWP() ) 728 #endif 713 729 { 714 730 xWeightedPredictionUni( pcCU, pcYuvPred, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx ); … … 779 795 { 780 796 #endif 797 #if LGE_ILLUCOMP_B0045 798 Bool bICFlag = pcCU->getICFlag(uiPartAddr) && (pcCU->getSlice()->getRefViewId( eRefPicList, iRefIdx ) != pcCU->getSlice()->getViewId()); 799 800 xPredInterLumaBlk ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi, bICFlag); 801 #else 781 802 xPredInterLumaBlk ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi ); 803 #endif 782 804 #if HHI_FULL_PEL_DEPTH_MAP_MV_ACC 783 805 } 784 806 #endif 807 #if LGE_ILLUCOMP_B0045 808 Bool bICFlag = pcCU->getICFlag(uiPartAddr) && (pcCU->getSlice()->getRefViewId( eRefPicList, iRefIdx ) != pcCU->getSlice()->getViewId()); 809 810 xPredInterChromaBlk( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi, bICFlag ); 811 #else 785 812 xPredInterChromaBlk( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi ); 813 #endif 786 814 } 787 815 … … 926 954 * \param bi Flag indicating whether bipred is used 927 955 */ 956 #if LGE_ILLUCOMP_B0045 957 Void TComPrediction::xPredInterLumaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi, Bool bICFlag) 958 #else 928 959 Void TComPrediction::xPredInterLumaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi ) 960 #endif 929 961 { 930 962 Int refStride = refPic->getStride(); … … 961 993 m_if.filterVerLuma(tmp + (halfFilterSize-1)*tmpStride, tmpStride, dst, dstStride, width, height, yFrac, false, !bi); 962 994 } 995 996 #if LGE_ILLUCOMP_B0045 997 if(bICFlag) 998 { 999 Int a, b, iShift, i, j; 1000 1001 xGetLLSICPrediction(cu, mv, refPic, a, b, iShift); 1002 1003 for (i = 0; i < height; i++) 1004 { 1005 for (j = 0; j < width; j++) 1006 { 1007 if(bi) 1008 { 1009 Int iIFshift = IF_INTERNAL_PREC - ( g_uiBitDepth + g_uiBitIncrement ); 1010 dst[j] = ( (a*dst[j]+a*IF_INTERNAL_OFFS) >> iShift ) + b*(1<<iIFshift) - IF_INTERNAL_OFFS; 1011 } 1012 else 1013 dst[j] = Clip( ( (a*dst[j]) >> iShift ) + b ); 1014 } 1015 dst += dstStride; 1016 } 1017 } 1018 #endif 963 1019 } 964 1020 … … 975 1031 * \param bi Flag indicating whether bipred is used 976 1032 */ 1033 #if LGE_ILLUCOMP_B0045 1034 Void TComPrediction::xPredInterChromaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi, Bool bICFlag ) 1035 #else 977 1036 Void TComPrediction::xPredInterChromaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi ) 1037 #endif 978 1038 { 979 1039 Int refStride = refPic->getCStride(); … … 1018 1078 m_if.filterVerChroma(extY + (halfFilterSize-1)*extStride, extStride, dstCr, dstStride, cxWidth, cxHeight , yFrac, false, !bi); 1019 1079 } 1080 #if LGE_ILLUCOMP_B0045 1081 if(bICFlag) 1082 { 1083 Int a, b, iShift, i, j; 1084 xGetLLSICPredictionChroma(cu, mv, refPic, a, b, iShift, 0); // Cb 1085 for (i = 0; i < cxHeight; i++) 1086 { 1087 for (j = 0; j < cxWidth; j++) 1088 { 1089 if(bi) 1090 { 1091 Int iIFshift = IF_INTERNAL_PREC - ( g_uiBitDepth + g_uiBitIncrement ); 1092 dstCb[j] = ( (a*dstCb[j]+a*IF_INTERNAL_OFFS) >> iShift ) + b*(1<<iIFshift) - IF_INTERNAL_OFFS; 1093 } 1094 else 1095 dstCb[j] = Clip3(0, 255, ((a*dstCb[j])>>iShift)+b); 1096 } 1097 dstCb += dstStride; 1098 } 1099 1100 xGetLLSICPredictionChroma(cu, mv, refPic, a, b, iShift, 1); // Cr 1101 for (i = 0; i < cxHeight; i++) 1102 { 1103 for (j = 0; j < cxWidth; j++) 1104 { 1105 if(bi) 1106 { 1107 Int iIFshift = IF_INTERNAL_PREC - ( g_uiBitDepth + g_uiBitIncrement ); 1108 dstCr[j] = ( (a*dstCr[j]+a*IF_INTERNAL_OFFS) >> iShift ) + b*(1<<iIFshift) - IF_INTERNAL_OFFS; 1109 } 1110 else 1111 dstCr[j] = Clip3(0, 255, ((a*dstCr[j])>>iShift)+b); 1112 } 1113 dstCr += dstStride; 1114 } 1115 } 1116 #endif 1020 1117 } 1021 1118 … … 1443 1540 } 1444 1541 1542 1543 #if LGE_ILLUCOMP_B0045 1544 /** Function for deriving LM illumination compensation. 1545 */ 1546 Void TComPrediction::xGetLLSICPrediction(TComDataCU* pcCU, TComMv *pMv, TComPicYuv *pRefPic, Int &a, Int &b, Int &iShift) 1547 { 1548 TComPicYuv *pRecPic = pcCU->getPic()->getPicYuvRec(); 1549 Pel *pRec, *pRef; 1550 UInt uiWidth, uiHeight, uiTmpPartIdx; 1551 Int iRecStride = pRecPic->getStride(), iRefStride = pRefPic->getStride(); 1552 Int iCUPelX, iCUPelY, iRefX, iRefY, iRefOffset; 1553 1554 iCUPelX = pcCU->getCUPelX() + g_auiRasterToPelX[g_auiZscanToRaster[pcCU->getZorderIdxInCU()]]; 1555 iCUPelY = pcCU->getCUPelY() + g_auiRasterToPelY[g_auiZscanToRaster[pcCU->getZorderIdxInCU()]]; 1556 iRefX = iCUPelX + (pMv->getHor() >> 2); 1557 iRefY = iCUPelY + (pMv->getVer() >> 2); 1558 uiWidth = pcCU->getWidth(0); 1559 uiHeight = pcCU->getHeight(0); 1560 1561 Int i, j, iCountShift = 0; 1562 1563 // LLS parameters estimation --> 1564 1565 Int x = 0, y = 0, xx = 0, xy = 0; 1566 1567 if(pcCU->getPUAbove(uiTmpPartIdx, pcCU->getZorderIdxInCU()) && iCUPelY > 0 && iRefY > 0) 1568 { 1569 iRefOffset = ( pMv->getHor() >> 2 ) + ( pMv->getVer() >> 2 ) * iRefStride - iRefStride; 1570 pRef = pRefPic->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) + iRefOffset; 1571 pRec = pRecPic->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) - iRecStride; 1572 1573 for( j = 0; j < uiWidth; j++ ) 1574 { 1575 x += pRef[j]; 1576 y += pRec[j]; 1577 xx += pRef[j] * pRef[j]; 1578 xy += pRef[j] * pRec[j]; 1579 } 1580 iCountShift += g_aucConvertToBit[ uiWidth ] + 2; 1581 } 1582 1583 1584 if(pcCU->getPULeft(uiTmpPartIdx, pcCU->getZorderIdxInCU()) && iCUPelX > 0 && iRefX > 0) 1585 { 1586 iRefOffset = ( pMv->getHor() >> 2 ) + ( pMv->getVer() >> 2 ) * iRefStride - 1; 1587 pRef = pRefPic->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) + iRefOffset; 1588 pRec = pRecPic->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) - 1; 1589 1590 for( i = 0; i < uiHeight; i++ ) 1591 { 1592 x += pRef[0]; 1593 y += pRec[0]; 1594 xx += pRef[0] * pRef[0]; 1595 xy += pRef[0] * pRec[0]; 1596 1597 pRef += iRefStride; 1598 pRec += iRecStride; 1599 } 1600 iCountShift += iCountShift > 0 ? 1 : ( g_aucConvertToBit[ uiWidth ] + 2 ); 1601 } 1602 1603 Int iTempShift = ( g_uiBitDepth + g_uiBitIncrement ) + g_aucConvertToBit[ uiWidth ] + 3 - 15; 1604 1605 if(iTempShift > 0) 1606 { 1607 x = ( x + ( 1 << ( iTempShift - 1 ) ) ) >> iTempShift; 1608 y = ( y + ( 1 << ( iTempShift - 1 ) ) ) >> iTempShift; 1609 xx = ( xx + ( 1 << ( iTempShift - 1 ) ) ) >> iTempShift; 1610 xy = ( xy + ( 1 << ( iTempShift - 1 ) ) ) >> iTempShift; 1611 iCountShift -= iTempShift; 1612 } 1613 1614 iShift = 13; 1615 1616 if( iCountShift == 0 ) 1617 { 1618 a = 1; 1619 b = 0; 1620 iShift = 0; 1621 } 1622 else 1623 { 1624 Int a1 = ( xy << iCountShift ) - y * x; 1625 Int a2 = ( xx << iCountShift ) - x * x; 1626 1627 { 1628 const Int iShiftA2 = 6; 1629 const Int iShiftA1 = 15; 1630 const Int iAccuracyShift = 15; 1631 1632 Int iScaleShiftA2 = 0; 1633 Int iScaleShiftA1 = 0; 1634 Int a1s = a1; 1635 Int a2s = a2; 1636 1637 iScaleShiftA1 = GetMSB( abs( a1 ) ) - iShiftA1; 1638 iScaleShiftA2 = GetMSB( abs( a2 ) ) - iShiftA2; 1639 1640 if( iScaleShiftA1 < 0 ) 1641 { 1642 iScaleShiftA1 = 0; 1643 } 1644 1645 if( iScaleShiftA2 < 0 ) 1646 { 1647 iScaleShiftA2 = 0; 1648 } 1649 1650 Int iScaleShiftA = iScaleShiftA2 + iAccuracyShift - iShift - iScaleShiftA1; 1651 1652 a2s = a2 >> iScaleShiftA2; 1653 1654 a1s = a1 >> iScaleShiftA1; 1655 1656 if (a2s >= 1) 1657 { 1658 a = a1s * m_uiaShift[ a2s - 1]; 1659 } 1660 else 1661 { 1662 a = 0; 1663 } 1664 1665 if( iScaleShiftA < 0 ) 1666 { 1667 a = a << -iScaleShiftA; 1668 } 1669 else 1670 { 1671 a = a >> iScaleShiftA; 1672 } 1673 1674 a = Clip3(-( 1 << 15 ), ( 1 << 15 ) - 1, a); 1675 1676 Int minA = -(1 << (6)); 1677 Int maxA = (1 << 6) - 1; 1678 if( a <= maxA && a >= minA ) 1679 { 1680 // do nothing 1681 } 1682 else 1683 { 1684 Short n = CountLeadingZerosOnes(a); 1685 a = a >> (9-n); 1686 iShift -= (9-n); 1687 } 1688 1689 b = ( y - ( ( a * x ) >> iShift ) + ( 1 << ( iCountShift - 1 ) ) ) >> iCountShift; 1690 } 1691 } 1692 } 1693 1694 Void TComPrediction::xGetLLSICPredictionChroma(TComDataCU* pcCU, TComMv *pMv, TComPicYuv *pRefPic, Int &a, Int &b, Int &iShift, Int iChromaId) 1695 { 1696 TComPicYuv *pRecPic = pcCU->getPic()->getPicYuvRec(); 1697 Pel *pRec = NULL, *pRef = NULL; 1698 UInt uiWidth, uiHeight, uiTmpPartIdx; 1699 Int iRecStride = pRecPic->getCStride(), iRefStride = pRefPic->getCStride(); 1700 Int iCUPelX, iCUPelY, iRefX, iRefY, iRefOffset; 1701 1702 iCUPelX = pcCU->getCUPelX() + g_auiRasterToPelX[g_auiZscanToRaster[pcCU->getZorderIdxInCU()]]; 1703 iCUPelY = pcCU->getCUPelY() + g_auiRasterToPelY[g_auiZscanToRaster[pcCU->getZorderIdxInCU()]]; 1704 iRefX = iCUPelX + (pMv->getHor() >> 3); 1705 iRefY = iCUPelY + (pMv->getVer() >> 3); 1706 uiWidth = pcCU->getWidth(0) >> 1; 1707 uiHeight = pcCU->getHeight(0) >> 1; 1708 1709 Int i, j, iCountShift = 0; 1710 1711 // LLS parameters estimation --> 1712 1713 Int x = 0, y = 0, xx = 0, xy = 0; 1714 1715 if(pcCU->getPUAbove(uiTmpPartIdx, pcCU->getZorderIdxInCU()) && iCUPelY > 0 && iRefY > 0) 1716 { 1717 iRefOffset = ( pMv->getHor() >> 3 ) + ( pMv->getVer() >> 3 ) * iRefStride - iRefStride; 1718 if (iChromaId == 0) // Cb 1719 { 1720 pRef = pRefPic->getCbAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) + iRefOffset; 1721 pRec = pRecPic->getCbAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) - iRecStride; 1722 } 1723 else if (iChromaId == 1) // Cr 1724 { 1725 pRef = pRefPic->getCrAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) + iRefOffset; 1726 pRec = pRecPic->getCrAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) - iRecStride; 1727 } 1728 1729 for( j = 0; j < uiWidth; j++ ) 1730 { 1731 x += pRef[j]; 1732 y += pRec[j]; 1733 xx += pRef[j] * pRef[j]; 1734 xy += pRef[j] * pRec[j]; 1735 } 1736 iCountShift += g_aucConvertToBit[ uiWidth ] + 2; 1737 } 1738 1739 1740 if(pcCU->getPULeft(uiTmpPartIdx, pcCU->getZorderIdxInCU()) && iCUPelX > 0 && iRefX > 0) 1741 { 1742 iRefOffset = ( pMv->getHor() >> 3 ) + ( pMv->getVer() >> 3 ) * iRefStride - 1; 1743 if (iChromaId == 0) // Cb 1744 { 1745 pRef = pRefPic->getCbAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) + iRefOffset; 1746 pRec = pRecPic->getCbAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) - 1; 1747 } 1748 else if (iChromaId == 1) // Cr 1749 { 1750 pRef = pRefPic->getCrAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) + iRefOffset; 1751 pRec = pRecPic->getCrAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) - 1; 1752 } 1753 1754 for( i = 0; i < uiHeight; i++ ) 1755 { 1756 x += pRef[0]; 1757 y += pRec[0]; 1758 xx += pRef[0] * pRef[0]; 1759 xy += pRef[0] * pRec[0]; 1760 1761 pRef += iRefStride; 1762 pRec += iRecStride; 1763 } 1764 iCountShift += iCountShift > 0 ? 1 : ( g_aucConvertToBit[ uiWidth ] + 2 ); 1765 } 1766 1767 Int iTempShift = ( g_uiBitDepth + g_uiBitIncrement ) + g_aucConvertToBit[ uiWidth ] + 3 - 15; 1768 1769 if(iTempShift > 0) 1770 { 1771 x = ( x + ( 1 << ( iTempShift - 1 ) ) ) >> iTempShift; 1772 y = ( y + ( 1 << ( iTempShift - 1 ) ) ) >> iTempShift; 1773 xx = ( xx + ( 1 << ( iTempShift - 1 ) ) ) >> iTempShift; 1774 xy = ( xy + ( 1 << ( iTempShift - 1 ) ) ) >> iTempShift; 1775 iCountShift -= iTempShift; 1776 } 1777 1778 iShift = 13; 1779 1780 if( iCountShift == 0 ) 1781 { 1782 a = 1; 1783 b = 0; 1784 iShift = 0; 1785 } 1786 else 1787 { 1788 Int a1 = ( xy << iCountShift ) - y * x; 1789 Int a2 = ( xx << iCountShift ) - x * x; 1790 1791 { 1792 const Int iShiftA2 = 6; 1793 const Int iShiftA1 = 15; 1794 const Int iAccuracyShift = 15; 1795 1796 Int iScaleShiftA2 = 0; 1797 Int iScaleShiftA1 = 0; 1798 Int a1s = a1; 1799 Int a2s = a2; 1800 1801 iScaleShiftA1 = GetMSB( abs( a1 ) ) - iShiftA1; 1802 iScaleShiftA2 = GetMSB( abs( a2 ) ) - iShiftA2; 1803 1804 if( iScaleShiftA1 < 0 ) 1805 { 1806 iScaleShiftA1 = 0; 1807 } 1808 1809 if( iScaleShiftA2 < 0 ) 1810 { 1811 iScaleShiftA2 = 0; 1812 } 1813 1814 Int iScaleShiftA = iScaleShiftA2 + iAccuracyShift - iShift - iScaleShiftA1; 1815 1816 a2s = a2 >> iScaleShiftA2; 1817 1818 a1s = a1 >> iScaleShiftA1; 1819 1820 if (a2s >= 1) 1821 { 1822 a = a1s * m_uiaShift[ a2s - 1]; 1823 } 1824 else 1825 { 1826 a = 0; 1827 } 1828 1829 if( iScaleShiftA < 0 ) 1830 { 1831 a = a << -iScaleShiftA; 1832 } 1833 else 1834 { 1835 a = a >> iScaleShiftA; 1836 } 1837 1838 a = Clip3(-( 1 << 15 ), ( 1 << 15 ) - 1, a); 1839 1840 Int minA = -(1 << (6)); 1841 Int maxA = (1 << 6) - 1; 1842 if( a <= maxA && a >= minA ) 1843 { 1844 // do nothing 1845 } 1846 else 1847 { 1848 Short n = CountLeadingZerosOnes(a); 1849 a = a >> (9-n); 1850 iShift -= (9-n); 1851 } 1852 1853 b = ( y - ( ( a * x ) >> iShift ) + ( 1 << ( iCountShift - 1 ) ) ) >> iCountShift; 1854 } 1855 } 1856 } 1857 #endif 1445 1858 /** Function for filtering intra DC predictor. 1446 1859 * \param pSrc pointer to reconstructed sample array -
branches/HTM-4.1-dev2-LG/source/Lib/TLibCommon/TComPrediction.h
r100 r152 100 100 #endif 101 101 102 #if LGE_ILLUCOMP_B0045 103 Void xPredInterLumaBlk ( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi, Bool bICFlag = false ); 104 Void xPredInterChromaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi, Bool bICFlag = false ); 105 #else 102 106 Void xPredInterLumaBlk ( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi ); 107 #endif 103 108 Void xPredInterChromaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi ); 104 109 Void xWeightedAverage ( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst ); 105 110 106 111 Void xGetLLSPrediction ( TComPattern* pcPattern, Int* pSrc0, Int iSrcStride, Pel* pDst0, Int iDstStride, UInt uiWidth, UInt uiHeight, UInt uiExt0 ); 107 112 #if LGE_ILLUCOMP_B0045 113 Void xGetLLSICPrediction(TComDataCU* pcCU, TComMv *pMv, TComPicYuv *pRefPic, Int &a, Int &b, Int &iShift); 114 Void xGetLLSICPredictionChroma(TComDataCU* pcCU, TComMv *pMv, TComPicYuv *pRefPic, Int &a, Int &b, Int &iShift, Int iChromaId); 115 #endif 108 116 Void xDCPredFiltering( Int* pSrc, Int iSrcStride, Pel*& rpDst, Int iDstStride, Int iWidth, Int iHeight ); 109 117 Bool xCheckIdenticalMotion ( TComDataCU* pcCU, UInt PartAddr); -
branches/HTM-4.1-dev2-LG/source/Lib/TLibCommon/TComRdCost.cpp
r100 r152 543 543 cDtParam.uiComp = 255; // just for assert: to be sure it was set before use, since only values 0,1 or 2 are allowed. 544 544 #endif 545 #if LGE_ILLUCOMP_B0045 546 cDtParam.bUseIC = false; 547 #endif 545 548 return cDtParam.DistFunc( &cDtParam ); 546 549 } … … 565 568 566 569 #if WEIGHTED_CHROMA_DISTORTION 570 #if LGE_ILLUCOMP_B0045 571 cDtParam.bUseIC = false; 572 #endif 567 573 if (bWeighted) 568 574 { … … 598 604 cDtParam.uiComp = 255; // just for assert: to be sure it was set before use, since only values 0,1 or 2 are allowed. 599 605 606 #if LGE_ILLUCOMP_B0045 607 cDtParam.bUseIC = false; 608 #endif 600 609 return cDtParam.DistFunc( &cDtParam ); 601 610 } 602 611 #endif 603 612 604 605 // ====================================================================================================================606 // Distortion functions607 // ====================================================================================================================608 609 // --------------------------------------------------------------------------------------------------------------------610 // SAD611 // --------------------------------------------------------------------------------------------------------------------612 613 613 UInt TComRdCost::xGetSAD( DistParam* pcDtParam ) 614 614 { … … 617 617 return xGetSADw( pcDtParam ); 618 618 } 619 #if LGE_ILLUCOMP_B0045 620 if(pcDtParam->bUseIC) 621 { 622 return xGetSADic( pcDtParam ); 623 } 624 #endif 619 625 Pel* piOrg = pcDtParam->pOrg; 620 626 Pel* piCur = pcDtParam->pCur; … … 623 629 Int iStrideCur = pcDtParam->iStrideCur; 624 630 Int iStrideOrg = pcDtParam->iStrideOrg; 625 626 UInt uiSum = 0; 627 631 632 UInt uiSum = 0; 633 628 634 for( ; iRows != 0; iRows-- ) 629 635 { … … 635 641 piCur += iStrideCur; 636 642 } 637 643 638 644 return ( uiSum >> g_uiBitIncrement ); 639 645 } … … 645 651 return xGetSADw( pcDtParam ); 646 652 } 653 #if LGE_ILLUCOMP_B0045 654 if(pcDtParam->bUseIC) 655 { 656 return xGetSAD4ic( pcDtParam ); 657 } 658 #endif 647 659 Pel* piOrg = pcDtParam->pOrg; 648 660 Pel* piCur = pcDtParam->pCur; … … 652 664 Int iStrideCur = pcDtParam->iStrideCur*iSubStep; 653 665 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 654 655 UInt uiSum = 0; 656 666 667 UInt uiSum = 0; 668 657 669 for( ; iRows != 0; iRows-=iSubStep ) 658 670 { … … 661 673 uiSum += abs( piOrg[2] - piCur[2] ); 662 674 uiSum += abs( piOrg[3] - piCur[3] ); 663 664 piOrg += iStrideOrg; 665 piCur += iStrideCur; 666 } 667 675 676 piOrg += iStrideOrg; 677 piCur += iStrideCur; 678 } 679 668 680 uiSum <<= iSubShift; 669 681 return ( uiSum >> g_uiBitIncrement ); … … 676 688 return xGetSADw( pcDtParam ); 677 689 } 690 #if LGE_ILLUCOMP_B0045 691 if(pcDtParam->bUseIC) 692 { 693 return xGetSAD8ic( pcDtParam ); 694 } 695 #endif 678 696 Pel* piOrg = pcDtParam->pOrg; 679 697 Pel* piCur = pcDtParam->pCur; … … 683 701 Int iStrideCur = pcDtParam->iStrideCur*iSubStep; 684 702 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 685 686 UInt uiSum = 0; 687 703 704 UInt uiSum = 0; 705 688 706 for( ; iRows != 0; iRows-=iSubStep ) 689 707 { … … 696 714 uiSum += abs( piOrg[6] - piCur[6] ); 697 715 uiSum += abs( piOrg[7] - piCur[7] ); 698 699 piOrg += iStrideOrg; 700 piCur += iStrideCur; 701 } 702 716 717 piOrg += iStrideOrg; 718 piCur += iStrideCur; 719 } 720 703 721 uiSum <<= iSubShift; 704 722 return ( uiSum >> g_uiBitIncrement ); … … 711 729 return xGetSADw( pcDtParam ); 712 730 } 731 #if LGE_ILLUCOMP_B0045 732 if(pcDtParam->bUseIC) 733 { 734 return xGetSAD16ic( pcDtParam ); 735 } 736 #endif 713 737 Pel* piOrg = pcDtParam->pOrg; 714 738 Pel* piCur = pcDtParam->pCur; … … 718 742 Int iStrideCur = pcDtParam->iStrideCur*iSubStep; 719 743 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 720 721 UInt uiSum = 0; 722 744 745 UInt uiSum = 0; 746 723 747 for( ; iRows != 0; iRows-=iSubStep ) 724 748 { … … 739 763 uiSum += abs( piOrg[14] - piCur[14] ); 740 764 uiSum += abs( piOrg[15] - piCur[15] ); 741 742 piOrg += iStrideOrg; 743 piCur += iStrideCur; 744 } 745 765 766 piOrg += iStrideOrg; 767 piCur += iStrideCur; 768 } 769 746 770 uiSum <<= iSubShift; 747 771 return ( uiSum >> g_uiBitIncrement ); … … 755 779 return xGetSADw( pcDtParam ); 756 780 } 781 #if LGE_ILLUCOMP_B0045 782 if(pcDtParam->bUseIC) 783 { 784 return xGetSAD12ic( pcDtParam ); 785 } 786 #endif 757 787 Pel* piOrg = pcDtParam->pOrg; 758 788 Pel* piCur = pcDtParam->pCur; … … 762 792 Int iStrideCur = pcDtParam->iStrideCur*iSubStep; 763 793 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 764 765 UInt uiSum = 0; 766 794 795 UInt uiSum = 0; 796 767 797 for( ; iRows != 0; iRows-=iSubStep ) 768 798 { … … 779 809 uiSum += abs( piOrg[10] - piCur[10] ); 780 810 uiSum += abs( piOrg[11] - piCur[11] ); 781 782 piOrg += iStrideOrg; 783 piCur += iStrideCur; 784 } 785 811 812 piOrg += iStrideOrg; 813 piCur += iStrideCur; 814 } 815 786 816 uiSum <<= iSubShift; 787 817 return ( uiSum >> g_uiBitIncrement ); … … 791 821 UInt TComRdCost::xGetSAD16N( DistParam* pcDtParam ) 792 822 { 823 #if LGE_ILLUCOMP_B0045 824 if(pcDtParam->bUseIC) 825 { 826 return xGetSAD16Nic( pcDtParam ); 827 } 828 #endif 793 829 Pel* piOrg = pcDtParam->pOrg; 794 830 Pel* piCur = pcDtParam->pCur; … … 799 835 Int iStrideCur = pcDtParam->iStrideCur*iSubStep; 800 836 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 801 802 UInt uiSum = 0; 803 837 838 UInt uiSum = 0; 839 804 840 for( ; iRows != 0; iRows-=iSubStep ) 805 841 { … … 826 862 piCur += iStrideCur; 827 863 } 828 864 829 865 uiSum <<= iSubShift; 830 866 return ( uiSum >> g_uiBitIncrement ); … … 837 873 return xGetSADw( pcDtParam ); 838 874 } 875 #if LGE_ILLUCOMP_B0045 876 if(pcDtParam->bUseIC) 877 { 878 return xGetSAD32ic( pcDtParam ); 879 } 880 #endif 839 881 Pel* piOrg = pcDtParam->pOrg; 840 882 Pel* piCur = pcDtParam->pCur; … … 844 886 Int iStrideCur = pcDtParam->iStrideCur*iSubStep; 845 887 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 846 847 UInt uiSum = 0; 848 888 889 UInt uiSum = 0; 890 849 891 for( ; iRows != 0; iRows-=iSubStep ) 850 892 { … … 881 923 uiSum += abs( piOrg[30] - piCur[30] ); 882 924 uiSum += abs( piOrg[31] - piCur[31] ); 883 884 piOrg += iStrideOrg; 885 piCur += iStrideCur; 886 } 887 925 926 piOrg += iStrideOrg; 927 piCur += iStrideCur; 928 } 929 888 930 uiSum <<= iSubShift; 889 931 return ( uiSum >> g_uiBitIncrement ); … … 897 939 return xGetSADw( pcDtParam ); 898 940 } 941 #if LGE_ILLUCOMP_B0045 942 if(pcDtParam->bUseIC) 943 { 944 return xGetSAD24ic( pcDtParam ); 945 } 946 #endif 899 947 Pel* piOrg = pcDtParam->pOrg; 900 948 Pel* piCur = pcDtParam->pCur; … … 904 952 Int iStrideCur = pcDtParam->iStrideCur*iSubStep; 905 953 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 906 907 UInt uiSum = 0; 908 954 955 UInt uiSum = 0; 956 909 957 for( ; iRows != 0; iRows-=iSubStep ) 910 958 { … … 933 981 uiSum += abs( piOrg[22] - piCur[22] ); 934 982 uiSum += abs( piOrg[23] - piCur[23] ); 935 936 piOrg += iStrideOrg; 937 piCur += iStrideCur; 938 } 939 983 984 piOrg += iStrideOrg; 985 piCur += iStrideCur; 986 } 987 940 988 uiSum <<= iSubShift; 941 989 return ( uiSum >> g_uiBitIncrement ); … … 950 998 return xGetSADw( pcDtParam ); 951 999 } 1000 #if LGE_ILLUCOMP_B0045 1001 if(pcDtParam->bUseIC) 1002 { 1003 return xGetSAD64ic( pcDtParam ); 1004 } 1005 #endif 952 1006 Pel* piOrg = pcDtParam->pOrg; 953 1007 Pel* piCur = pcDtParam->pCur; … … 957 1011 Int iStrideCur = pcDtParam->iStrideCur*iSubStep; 958 1012 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 959 960 UInt uiSum = 0; 961 1013 1014 UInt uiSum = 0; 1015 962 1016 for( ; iRows != 0; iRows-=iSubStep ) 963 1017 { … … 1026 1080 uiSum += abs( piOrg[62] - piCur[62] ); 1027 1081 uiSum += abs( piOrg[63] - piCur[63] ); 1028 1029 piOrg += iStrideOrg; 1030 piCur += iStrideCur; 1031 } 1032 1082 1083 piOrg += iStrideOrg; 1084 piCur += iStrideCur; 1085 } 1086 1033 1087 uiSum <<= iSubShift; 1034 1088 return ( uiSum >> g_uiBitIncrement ); … … 1042 1096 return xGetSADw( pcDtParam ); 1043 1097 } 1098 #if LGE_ILLUCOMP_B0045 1099 if(pcDtParam->bUseIC) 1100 { 1101 return xGetSAD48ic( pcDtParam ); 1102 } 1103 #endif 1044 1104 Pel* piOrg = pcDtParam->pOrg; 1045 1105 Pel* piCur = pcDtParam->pCur; … … 1049 1109 Int iStrideCur = pcDtParam->iStrideCur*iSubStep; 1050 1110 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 1051 1052 UInt uiSum = 0; 1053 1111 1112 UInt uiSum = 0; 1113 1054 1114 for( ; iRows != 0; iRows-=iSubStep ) 1055 1115 { … … 1102 1162 uiSum += abs( piOrg[46] - piCur[46] ); 1103 1163 uiSum += abs( piOrg[47] - piCur[47] ); 1104 1105 piOrg += iStrideOrg; 1106 piCur += iStrideCur; 1107 } 1108 1164 1165 piOrg += iStrideOrg; 1166 piCur += iStrideCur; 1167 } 1168 1109 1169 uiSum <<= iSubShift; 1110 1170 return ( uiSum >> g_uiBitIncrement ); 1111 1171 } 1172 #endif 1173 1174 // ==================================================================================================================== 1175 // Distortion functions 1176 // ==================================================================================================================== 1177 1178 // -------------------------------------------------------------------------------------------------------------------- 1179 // SAD 1180 // -------------------------------------------------------------------------------------------------------------------- 1181 #if LGE_ILLUCOMP_B0045 1182 UInt TComRdCost::xGetSADic( DistParam* pcDtParam ) 1183 { 1184 if ( pcDtParam->bApplyWeight ) 1185 { 1186 return xGetSADw( pcDtParam ); 1187 } 1188 Pel* piOrg = pcDtParam->pOrg; 1189 Pel* piCur = pcDtParam->pCur; 1190 Int iRows = pcDtParam->iRows; 1191 Int iCols = pcDtParam->iCols; 1192 Int iStrideCur = pcDtParam->iStrideCur; 1193 Int iStrideOrg = pcDtParam->iStrideOrg; 1194 1195 UInt uiSum = 0; 1196 1197 Int iOrigAvg = 0, iCurAvg = 0; 1198 Int iDeltaC; 1199 1200 for( ; iRows != 0; iRows-- ) 1201 { 1202 for (Int n = 0; n < iCols; n++ ) 1203 { 1204 iOrigAvg += piOrg[n]; 1205 iCurAvg += piCur[n]; 1206 } 1207 piOrg += iStrideOrg; 1208 piCur += iStrideCur; 1209 } 1210 1211 piOrg = pcDtParam->pOrg; 1212 piCur = pcDtParam->pCur; 1213 iRows = pcDtParam->iRows; 1214 1215 iDeltaC = (iOrigAvg - iCurAvg)/iCols/iRows; 1216 1217 for( ; iRows != 0; iRows-- ) 1218 { 1219 for (Int n = 0; n < iCols; n++ ) 1220 { 1221 uiSum += abs( piOrg[n] - piCur[n] - iDeltaC ); 1222 } 1223 piOrg += iStrideOrg; 1224 piCur += iStrideCur; 1225 } 1226 1227 return ( uiSum >> g_uiBitIncrement ); 1228 } 1229 1230 UInt TComRdCost::xGetSAD4ic( DistParam* pcDtParam ) 1231 { 1232 if ( pcDtParam->bApplyWeight ) 1233 { 1234 return xGetSADw( pcDtParam ); 1235 } 1236 Pel* piOrg = pcDtParam->pOrg; 1237 Pel* piCur = pcDtParam->pCur; 1238 Int iRows = pcDtParam->iRows; 1239 Int iSubShift = pcDtParam->iSubShift; 1240 Int iSubStep = ( 1 << iSubShift ); 1241 Int iStrideCur = pcDtParam->iStrideCur*iSubStep; 1242 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 1243 1244 UInt uiSum = 0; 1245 1246 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0; 1247 Int iDeltaC; 1248 1249 for( ; iRows != 0; iRows-=iSubStep ) 1250 { 1251 iOrigAvg += piOrg[0]; 1252 iOrigAvg += piOrg[1]; 1253 iOrigAvg += piOrg[2]; 1254 iOrigAvg += piOrg[3]; 1255 1256 iCurAvg += piCur[0]; 1257 iCurAvg += piCur[1]; 1258 iCurAvg += piCur[2]; 1259 iCurAvg += piCur[3]; 1260 1261 piOrg += iStrideOrg; 1262 piCur += iStrideCur; 1263 uiRowCnt++; 1264 } 1265 1266 piOrg = pcDtParam->pOrg; 1267 piCur = pcDtParam->pCur; 1268 iRows = pcDtParam->iRows; 1269 1270 iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/4) : 0; 1271 1272 for( ; iRows != 0; iRows-=iSubStep ) 1273 { 1274 uiSum += abs( piOrg[0] - piCur[0] - iDeltaC ); 1275 uiSum += abs( piOrg[1] - piCur[1] - iDeltaC ); 1276 uiSum += abs( piOrg[2] - piCur[2] - iDeltaC ); 1277 uiSum += abs( piOrg[3] - piCur[3] - iDeltaC ); 1278 1279 piOrg += iStrideOrg; 1280 piCur += iStrideCur; 1281 } 1282 1283 uiSum <<= iSubShift; 1284 return ( uiSum >> g_uiBitIncrement ); 1285 } 1286 1287 UInt TComRdCost::xGetSAD8ic( DistParam* pcDtParam ) 1288 { 1289 if ( pcDtParam->bApplyWeight ) 1290 { 1291 return xGetSADw( pcDtParam ); 1292 } 1293 Pel* piOrg = pcDtParam->pOrg; 1294 Pel* piCur = pcDtParam->pCur; 1295 Int iRows = pcDtParam->iRows; 1296 Int iSubShift = pcDtParam->iSubShift; 1297 Int iSubStep = ( 1 << iSubShift ); 1298 Int iStrideCur = pcDtParam->iStrideCur*iSubStep; 1299 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 1300 1301 UInt uiSum = 0; 1302 1303 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0; 1304 Int iDeltaC; 1305 1306 for( ; iRows != 0; iRows-=iSubStep ) 1307 { 1308 iOrigAvg += piOrg[0]; 1309 iOrigAvg += piOrg[1]; 1310 iOrigAvg += piOrg[2]; 1311 iOrigAvg += piOrg[3]; 1312 iOrigAvg += piOrg[4]; 1313 iOrigAvg += piOrg[5]; 1314 iOrigAvg += piOrg[6]; 1315 iOrigAvg += piOrg[7]; 1316 1317 iCurAvg += piCur[0]; 1318 iCurAvg += piCur[1]; 1319 iCurAvg += piCur[2]; 1320 iCurAvg += piCur[3]; 1321 iCurAvg += piCur[4]; 1322 iCurAvg += piCur[5]; 1323 iCurAvg += piCur[6]; 1324 iCurAvg += piCur[7]; 1325 1326 piOrg += iStrideOrg; 1327 piCur += iStrideCur; 1328 uiRowCnt++; 1329 } 1330 1331 piOrg = pcDtParam->pOrg; 1332 piCur = pcDtParam->pCur; 1333 iRows = pcDtParam->iRows; 1334 1335 iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/8) : 0; 1336 1337 for( ; iRows != 0; iRows-=iSubStep ) 1338 { 1339 uiSum += abs( piOrg[0] - piCur[0] - iDeltaC ); 1340 uiSum += abs( piOrg[1] - piCur[1] - iDeltaC ); 1341 uiSum += abs( piOrg[2] - piCur[2] - iDeltaC ); 1342 uiSum += abs( piOrg[3] - piCur[3] - iDeltaC ); 1343 uiSum += abs( piOrg[4] - piCur[4] - iDeltaC ); 1344 uiSum += abs( piOrg[5] - piCur[5] - iDeltaC ); 1345 uiSum += abs( piOrg[6] - piCur[6] - iDeltaC ); 1346 uiSum += abs( piOrg[7] - piCur[7] - iDeltaC ); 1347 1348 piOrg += iStrideOrg; 1349 piCur += iStrideCur; 1350 } 1351 1352 uiSum <<= iSubShift; 1353 return ( uiSum >> g_uiBitIncrement ); 1354 } 1355 1356 UInt TComRdCost::xGetSAD16ic( DistParam* pcDtParam ) 1357 { 1358 if ( pcDtParam->bApplyWeight ) 1359 { 1360 return xGetSADw( pcDtParam ); 1361 } 1362 Pel* piOrg = pcDtParam->pOrg; 1363 Pel* piCur = pcDtParam->pCur; 1364 Int iRows = pcDtParam->iRows; 1365 Int iSubShift = pcDtParam->iSubShift; 1366 Int iSubStep = ( 1 << iSubShift ); 1367 Int iStrideCur = pcDtParam->iStrideCur*iSubStep; 1368 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 1369 1370 UInt uiSum = 0; 1371 1372 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0; 1373 Int iDeltaC; 1374 1375 for( ; iRows != 0; iRows-=iSubStep ) 1376 { 1377 iOrigAvg += piOrg[0]; 1378 iOrigAvg += piOrg[1]; 1379 iOrigAvg += piOrg[2]; 1380 iOrigAvg += piOrg[3]; 1381 iOrigAvg += piOrg[4]; 1382 iOrigAvg += piOrg[5]; 1383 iOrigAvg += piOrg[6]; 1384 iOrigAvg += piOrg[7]; 1385 iOrigAvg += piOrg[8]; 1386 iOrigAvg += piOrg[9]; 1387 iOrigAvg += piOrg[10]; 1388 iOrigAvg += piOrg[11]; 1389 iOrigAvg += piOrg[12]; 1390 iOrigAvg += piOrg[13]; 1391 iOrigAvg += piOrg[14]; 1392 iOrigAvg += piOrg[15]; 1393 1394 iCurAvg += piCur[0]; 1395 iCurAvg += piCur[1]; 1396 iCurAvg += piCur[2]; 1397 iCurAvg += piCur[3]; 1398 iCurAvg += piCur[4]; 1399 iCurAvg += piCur[5]; 1400 iCurAvg += piCur[6]; 1401 iCurAvg += piCur[7]; 1402 iCurAvg += piCur[8]; 1403 iCurAvg += piCur[9]; 1404 iCurAvg += piCur[10]; 1405 iCurAvg += piCur[11]; 1406 iCurAvg += piCur[12]; 1407 iCurAvg += piCur[13]; 1408 iCurAvg += piCur[14]; 1409 iCurAvg += piCur[15]; 1410 1411 piOrg += iStrideOrg; 1412 piCur += iStrideCur; 1413 uiRowCnt++; 1414 } 1415 1416 piOrg = pcDtParam->pOrg; 1417 piCur = pcDtParam->pCur; 1418 iRows = pcDtParam->iRows; 1419 1420 iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/16) : 0; 1421 1422 for( ; iRows != 0; iRows-=iSubStep ) 1423 { 1424 uiSum += abs( piOrg[0] - piCur[0] - iDeltaC ); 1425 uiSum += abs( piOrg[1] - piCur[1] - iDeltaC ); 1426 uiSum += abs( piOrg[2] - piCur[2] - iDeltaC ); 1427 uiSum += abs( piOrg[3] - piCur[3] - iDeltaC ); 1428 uiSum += abs( piOrg[4] - piCur[4] - iDeltaC ); 1429 uiSum += abs( piOrg[5] - piCur[5] - iDeltaC ); 1430 uiSum += abs( piOrg[6] - piCur[6] - iDeltaC ); 1431 uiSum += abs( piOrg[7] - piCur[7] - iDeltaC ); 1432 uiSum += abs( piOrg[8] - piCur[8] - iDeltaC ); 1433 uiSum += abs( piOrg[9] - piCur[9] - iDeltaC ); 1434 uiSum += abs( piOrg[10] - piCur[10] - iDeltaC ); 1435 uiSum += abs( piOrg[11] - piCur[11] - iDeltaC ); 1436 uiSum += abs( piOrg[12] - piCur[12] - iDeltaC ); 1437 uiSum += abs( piOrg[13] - piCur[13] - iDeltaC ); 1438 uiSum += abs( piOrg[14] - piCur[14] - iDeltaC ); 1439 uiSum += abs( piOrg[15] - piCur[15] - iDeltaC ); 1440 1441 piOrg += iStrideOrg; 1442 piCur += iStrideCur; 1443 } 1444 1445 uiSum <<= iSubShift; 1446 return ( uiSum >> g_uiBitIncrement ); 1447 } 1448 1449 #if AMP_SAD 1450 UInt TComRdCost::xGetSAD12ic( DistParam* pcDtParam ) 1451 { 1452 if ( pcDtParam->bApplyWeight ) 1453 { 1454 return xGetSADw( pcDtParam ); 1455 } 1456 Pel* piOrg = pcDtParam->pOrg; 1457 Pel* piCur = pcDtParam->pCur; 1458 Int iRows = pcDtParam->iRows; 1459 Int iSubShift = pcDtParam->iSubShift; 1460 Int iSubStep = ( 1 << iSubShift ); 1461 Int iStrideCur = pcDtParam->iStrideCur*iSubStep; 1462 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 1463 1464 UInt uiSum = 0; 1465 1466 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0; 1467 Int iDeltaC; 1468 1469 for( ; iRows != 0; iRows-=iSubStep ) 1470 { 1471 iOrigAvg += piOrg[0]; 1472 iOrigAvg += piOrg[1]; 1473 iOrigAvg += piOrg[2]; 1474 iOrigAvg += piOrg[3]; 1475 iOrigAvg += piOrg[4]; 1476 iOrigAvg += piOrg[5]; 1477 iOrigAvg += piOrg[6]; 1478 iOrigAvg += piOrg[7]; 1479 iOrigAvg += piOrg[8]; 1480 iOrigAvg += piOrg[9]; 1481 iOrigAvg += piOrg[10]; 1482 iOrigAvg += piOrg[11]; 1483 1484 iCurAvg += piCur[0]; 1485 iCurAvg += piCur[1]; 1486 iCurAvg += piCur[2]; 1487 iCurAvg += piCur[3]; 1488 iCurAvg += piCur[4]; 1489 iCurAvg += piCur[5]; 1490 iCurAvg += piCur[6]; 1491 iCurAvg += piCur[7]; 1492 iCurAvg += piCur[8]; 1493 iCurAvg += piCur[9]; 1494 iCurAvg += piCur[10]; 1495 iCurAvg += piCur[11]; 1496 1497 piOrg += iStrideOrg; 1498 piCur += iStrideCur; 1499 uiRowCnt++; 1500 } 1501 1502 piOrg = pcDtParam->pOrg; 1503 piCur = pcDtParam->pCur; 1504 iRows = pcDtParam->iRows; 1505 1506 iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/12) : 0; 1507 1508 for( ; iRows != 0; iRows-=iSubStep ) 1509 { 1510 uiSum += abs( piOrg[0] - piCur[0] - iDeltaC ); 1511 uiSum += abs( piOrg[1] - piCur[1] - iDeltaC ); 1512 uiSum += abs( piOrg[2] - piCur[2] - iDeltaC ); 1513 uiSum += abs( piOrg[3] - piCur[3] - iDeltaC ); 1514 uiSum += abs( piOrg[4] - piCur[4] - iDeltaC ); 1515 uiSum += abs( piOrg[5] - piCur[5] - iDeltaC ); 1516 uiSum += abs( piOrg[6] - piCur[6] - iDeltaC ); 1517 uiSum += abs( piOrg[7] - piCur[7] - iDeltaC ); 1518 uiSum += abs( piOrg[8] - piCur[8] - iDeltaC ); 1519 uiSum += abs( piOrg[9] - piCur[9] - iDeltaC ); 1520 uiSum += abs( piOrg[10] - piCur[10] - iDeltaC ); 1521 uiSum += abs( piOrg[11] - piCur[11] - iDeltaC ); 1522 1523 piOrg += iStrideOrg; 1524 piCur += iStrideCur; 1525 } 1526 1527 uiSum <<= iSubShift; 1528 return ( uiSum >> g_uiBitIncrement ); 1529 } 1530 #endif 1531 1532 UInt TComRdCost::xGetSAD16Nic( DistParam* pcDtParam ) 1533 { 1534 Pel* piOrg = pcDtParam->pOrg; 1535 Pel* piCur = pcDtParam->pCur; 1536 Int iRows = pcDtParam->iRows; 1537 Int iCols = pcDtParam->iCols; 1538 Int iSubShift = pcDtParam->iSubShift; 1539 Int iSubStep = ( 1 << iSubShift ); 1540 Int iStrideCur = pcDtParam->iStrideCur*iSubStep; 1541 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 1542 1543 UInt uiSum = 0; 1544 1545 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0, uiColCnt = (iCols-1)/16 + 1; 1546 Int iDeltaC; 1547 1548 for( ; iRows != 0; iRows-=iSubStep ) 1549 { 1550 for (Int n = 0; n < iCols; n+=16 ) 1551 { 1552 iOrigAvg += piOrg[n + 0]; 1553 iOrigAvg += piOrg[n + 1]; 1554 iOrigAvg += piOrg[n + 2]; 1555 iOrigAvg += piOrg[n + 3]; 1556 iOrigAvg += piOrg[n + 4]; 1557 iOrigAvg += piOrg[n + 5]; 1558 iOrigAvg += piOrg[n + 6]; 1559 iOrigAvg += piOrg[n + 7]; 1560 iOrigAvg += piOrg[n + 8]; 1561 iOrigAvg += piOrg[n + 9]; 1562 iOrigAvg += piOrg[n + 10]; 1563 iOrigAvg += piOrg[n + 11]; 1564 iOrigAvg += piOrg[n + 12]; 1565 iOrigAvg += piOrg[n + 13]; 1566 iOrigAvg += piOrg[n + 14]; 1567 iOrigAvg += piOrg[n + 15]; 1568 1569 iCurAvg += piCur[n + 0]; 1570 iCurAvg += piCur[n + 1]; 1571 iCurAvg += piCur[n + 2]; 1572 iCurAvg += piCur[n + 3]; 1573 iCurAvg += piCur[n + 4]; 1574 iCurAvg += piCur[n + 5]; 1575 iCurAvg += piCur[n + 6]; 1576 iCurAvg += piCur[n + 7]; 1577 iCurAvg += piCur[n + 8]; 1578 iCurAvg += piCur[n + 9]; 1579 iCurAvg += piCur[n + 10]; 1580 iCurAvg += piCur[n + 11]; 1581 iCurAvg += piCur[n + 12]; 1582 iCurAvg += piCur[n + 13]; 1583 iCurAvg += piCur[n + 14]; 1584 iCurAvg += piCur[n + 15]; 1585 } 1586 piOrg += iStrideOrg; 1587 piCur += iStrideCur; 1588 uiRowCnt++; 1589 } 1590 piOrg = pcDtParam->pOrg; 1591 piCur = pcDtParam->pCur; 1592 iRows = pcDtParam->iRows; 1593 1594 iDeltaC = (uiRowCnt && uiColCnt) ? ((iOrigAvg - iCurAvg)/uiRowCnt/uiColCnt/16) : 0; 1595 1596 for( ; iRows != 0; iRows-=iSubStep ) 1597 { 1598 for (Int n = 0; n < iCols; n+=16 ) 1599 { 1600 uiSum += abs( piOrg[n+ 0] - piCur[n+ 0] - iDeltaC ); 1601 uiSum += abs( piOrg[n+ 1] - piCur[n+ 1] - iDeltaC ); 1602 uiSum += abs( piOrg[n+ 2] - piCur[n+ 2] - iDeltaC ); 1603 uiSum += abs( piOrg[n+ 3] - piCur[n+ 3] - iDeltaC ); 1604 uiSum += abs( piOrg[n+ 4] - piCur[n+ 4] - iDeltaC ); 1605 uiSum += abs( piOrg[n+ 5] - piCur[n+ 5] - iDeltaC ); 1606 uiSum += abs( piOrg[n+ 6] - piCur[n+ 6] - iDeltaC ); 1607 uiSum += abs( piOrg[n+ 7] - piCur[n+ 7] - iDeltaC ); 1608 uiSum += abs( piOrg[n+ 8] - piCur[n+ 8] - iDeltaC ); 1609 uiSum += abs( piOrg[n+ 9] - piCur[n+ 9] - iDeltaC ); 1610 uiSum += abs( piOrg[n+10] - piCur[n+10] - iDeltaC ); 1611 uiSum += abs( piOrg[n+11] - piCur[n+11] - iDeltaC ); 1612 uiSum += abs( piOrg[n+12] - piCur[n+12] - iDeltaC ); 1613 uiSum += abs( piOrg[n+13] - piCur[n+13] - iDeltaC ); 1614 uiSum += abs( piOrg[n+14] - piCur[n+14] - iDeltaC ); 1615 uiSum += abs( piOrg[n+15] - piCur[n+15] - iDeltaC ); 1616 } 1617 piOrg += iStrideOrg; 1618 piCur += iStrideCur; 1619 } 1620 1621 uiSum <<= iSubShift; 1622 return ( uiSum >> g_uiBitIncrement ); 1623 } 1624 1625 UInt TComRdCost::xGetSAD32ic( DistParam* pcDtParam ) 1626 { 1627 if ( pcDtParam->bApplyWeight ) 1628 { 1629 return xGetSADw( pcDtParam ); 1630 } 1631 Pel* piOrg = pcDtParam->pOrg; 1632 Pel* piCur = pcDtParam->pCur; 1633 Int iRows = pcDtParam->iRows; 1634 Int iSubShift = pcDtParam->iSubShift; 1635 Int iSubStep = ( 1 << iSubShift ); 1636 Int iStrideCur = pcDtParam->iStrideCur*iSubStep; 1637 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 1638 1639 UInt uiSum = 0; 1640 1641 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0; 1642 Int iDeltaC; 1643 1644 for( ; iRows != 0; iRows-=iSubStep ) 1645 { 1646 iOrigAvg += piOrg[0]; 1647 iOrigAvg += piOrg[1]; 1648 iOrigAvg += piOrg[2]; 1649 iOrigAvg += piOrg[3]; 1650 iOrigAvg += piOrg[4]; 1651 iOrigAvg += piOrg[5]; 1652 iOrigAvg += piOrg[6]; 1653 iOrigAvg += piOrg[7]; 1654 iOrigAvg += piOrg[8]; 1655 iOrigAvg += piOrg[9]; 1656 iOrigAvg += piOrg[10]; 1657 iOrigAvg += piOrg[11]; 1658 iOrigAvg += piOrg[12]; 1659 iOrigAvg += piOrg[13]; 1660 iOrigAvg += piOrg[14]; 1661 iOrigAvg += piOrg[15]; 1662 iOrigAvg += piOrg[16]; 1663 iOrigAvg += piOrg[17]; 1664 iOrigAvg += piOrg[18]; 1665 iOrigAvg += piOrg[19]; 1666 iOrigAvg += piOrg[20]; 1667 iOrigAvg += piOrg[21]; 1668 iOrigAvg += piOrg[22]; 1669 iOrigAvg += piOrg[23]; 1670 iOrigAvg += piOrg[24]; 1671 iOrigAvg += piOrg[25]; 1672 iOrigAvg += piOrg[26]; 1673 iOrigAvg += piOrg[27]; 1674 iOrigAvg += piOrg[28]; 1675 iOrigAvg += piOrg[29]; 1676 iOrigAvg += piOrg[30]; 1677 iOrigAvg += piOrg[31]; 1678 1679 iCurAvg += piCur[0]; 1680 iCurAvg += piCur[1]; 1681 iCurAvg += piCur[2]; 1682 iCurAvg += piCur[3]; 1683 iCurAvg += piCur[4]; 1684 iCurAvg += piCur[5]; 1685 iCurAvg += piCur[6]; 1686 iCurAvg += piCur[7]; 1687 iCurAvg += piCur[8]; 1688 iCurAvg += piCur[9]; 1689 iCurAvg += piCur[10]; 1690 iCurAvg += piCur[11]; 1691 iCurAvg += piCur[12]; 1692 iCurAvg += piCur[13]; 1693 iCurAvg += piCur[14]; 1694 iCurAvg += piCur[15]; 1695 iCurAvg += piCur[16]; 1696 iCurAvg += piCur[17]; 1697 iCurAvg += piCur[18]; 1698 iCurAvg += piCur[19]; 1699 iCurAvg += piCur[20]; 1700 iCurAvg += piCur[21]; 1701 iCurAvg += piCur[22]; 1702 iCurAvg += piCur[23]; 1703 iCurAvg += piCur[24]; 1704 iCurAvg += piCur[25]; 1705 iCurAvg += piCur[26]; 1706 iCurAvg += piCur[27]; 1707 iCurAvg += piCur[28]; 1708 iCurAvg += piCur[29]; 1709 iCurAvg += piCur[30]; 1710 iCurAvg += piCur[31]; 1711 1712 piOrg += iStrideOrg; 1713 piCur += iStrideCur; 1714 uiRowCnt++; 1715 } 1716 1717 piOrg = pcDtParam->pOrg; 1718 piCur = pcDtParam->pCur; 1719 iRows = pcDtParam->iRows; 1720 1721 iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/32) : 0; 1722 1723 for( ; iRows != 0; iRows-=iSubStep ) 1724 { 1725 uiSum += abs( piOrg[0] - piCur[0] - iDeltaC ); 1726 uiSum += abs( piOrg[1] - piCur[1] - iDeltaC ); 1727 uiSum += abs( piOrg[2] - piCur[2] - iDeltaC ); 1728 uiSum += abs( piOrg[3] - piCur[3] - iDeltaC ); 1729 uiSum += abs( piOrg[4] - piCur[4] - iDeltaC ); 1730 uiSum += abs( piOrg[5] - piCur[5] - iDeltaC ); 1731 uiSum += abs( piOrg[6] - piCur[6] - iDeltaC ); 1732 uiSum += abs( piOrg[7] - piCur[7] - iDeltaC ); 1733 uiSum += abs( piOrg[8] - piCur[8] - iDeltaC ); 1734 uiSum += abs( piOrg[9] - piCur[9] - iDeltaC ); 1735 uiSum += abs( piOrg[10] - piCur[10] - iDeltaC ); 1736 uiSum += abs( piOrg[11] - piCur[11] - iDeltaC ); 1737 uiSum += abs( piOrg[12] - piCur[12] - iDeltaC ); 1738 uiSum += abs( piOrg[13] - piCur[13] - iDeltaC ); 1739 uiSum += abs( piOrg[14] - piCur[14] - iDeltaC ); 1740 uiSum += abs( piOrg[15] - piCur[15] - iDeltaC ); 1741 uiSum += abs( piOrg[16] - piCur[16] - iDeltaC ); 1742 uiSum += abs( piOrg[17] - piCur[17] - iDeltaC ); 1743 uiSum += abs( piOrg[18] - piCur[18] - iDeltaC ); 1744 uiSum += abs( piOrg[19] - piCur[19] - iDeltaC ); 1745 uiSum += abs( piOrg[20] - piCur[20] - iDeltaC ); 1746 uiSum += abs( piOrg[21] - piCur[21] - iDeltaC ); 1747 uiSum += abs( piOrg[22] - piCur[22] - iDeltaC ); 1748 uiSum += abs( piOrg[23] - piCur[23] - iDeltaC ); 1749 uiSum += abs( piOrg[24] - piCur[24] - iDeltaC ); 1750 uiSum += abs( piOrg[25] - piCur[25] - iDeltaC ); 1751 uiSum += abs( piOrg[26] - piCur[26] - iDeltaC ); 1752 uiSum += abs( piOrg[27] - piCur[27] - iDeltaC ); 1753 uiSum += abs( piOrg[28] - piCur[28] - iDeltaC ); 1754 uiSum += abs( piOrg[29] - piCur[29] - iDeltaC ); 1755 uiSum += abs( piOrg[30] - piCur[30] - iDeltaC ); 1756 uiSum += abs( piOrg[31] - piCur[31] - iDeltaC ); 1757 1758 piOrg += iStrideOrg; 1759 piCur += iStrideCur; 1760 } 1761 1762 uiSum <<= iSubShift; 1763 return ( uiSum >> g_uiBitIncrement ); 1764 } 1765 1766 #if AMP_SAD 1767 UInt TComRdCost::xGetSAD24ic( DistParam* pcDtParam ) 1768 { 1769 if ( pcDtParam->bApplyWeight ) 1770 { 1771 return xGetSADw( pcDtParam ); 1772 } 1773 Pel* piOrg = pcDtParam->pOrg; 1774 Pel* piCur = pcDtParam->pCur; 1775 Int iRows = pcDtParam->iRows; 1776 Int iSubShift = pcDtParam->iSubShift; 1777 Int iSubStep = ( 1 << iSubShift ); 1778 Int iStrideCur = pcDtParam->iStrideCur*iSubStep; 1779 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 1780 1781 UInt uiSum = 0; 1782 1783 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0; 1784 Int iDeltaC; 1785 1786 for( ; iRows != 0; iRows-=iSubStep ) 1787 { 1788 iOrigAvg += piOrg[0]; 1789 iOrigAvg += piOrg[1]; 1790 iOrigAvg += piOrg[2]; 1791 iOrigAvg += piOrg[3]; 1792 iOrigAvg += piOrg[4]; 1793 iOrigAvg += piOrg[5]; 1794 iOrigAvg += piOrg[6]; 1795 iOrigAvg += piOrg[7]; 1796 iOrigAvg += piOrg[8]; 1797 iOrigAvg += piOrg[9]; 1798 iOrigAvg += piOrg[10]; 1799 iOrigAvg += piOrg[11]; 1800 iOrigAvg += piOrg[12]; 1801 iOrigAvg += piOrg[13]; 1802 iOrigAvg += piOrg[14]; 1803 iOrigAvg += piOrg[15]; 1804 iOrigAvg += piOrg[16]; 1805 iOrigAvg += piOrg[17]; 1806 iOrigAvg += piOrg[18]; 1807 iOrigAvg += piOrg[19]; 1808 iOrigAvg += piOrg[20]; 1809 iOrigAvg += piOrg[21]; 1810 iOrigAvg += piOrg[22]; 1811 iOrigAvg += piOrg[23]; 1812 1813 iCurAvg += piCur[0]; 1814 iCurAvg += piCur[1]; 1815 iCurAvg += piCur[2]; 1816 iCurAvg += piCur[3]; 1817 iCurAvg += piCur[4]; 1818 iCurAvg += piCur[5]; 1819 iCurAvg += piCur[6]; 1820 iCurAvg += piCur[7]; 1821 iCurAvg += piCur[8]; 1822 iCurAvg += piCur[9]; 1823 iCurAvg += piCur[10]; 1824 iCurAvg += piCur[11]; 1825 iCurAvg += piCur[12]; 1826 iCurAvg += piCur[13]; 1827 iCurAvg += piCur[14]; 1828 iCurAvg += piCur[15]; 1829 iCurAvg += piCur[16]; 1830 iCurAvg += piCur[17]; 1831 iCurAvg += piCur[18]; 1832 iCurAvg += piCur[19]; 1833 iCurAvg += piCur[20]; 1834 iCurAvg += piCur[21]; 1835 iCurAvg += piCur[22]; 1836 iCurAvg += piCur[23]; 1837 1838 piOrg += iStrideOrg; 1839 piCur += iStrideCur; 1840 uiRowCnt++; 1841 } 1842 1843 piOrg = pcDtParam->pOrg; 1844 piCur = pcDtParam->pCur; 1845 iRows = pcDtParam->iRows; 1846 1847 iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/24) : 0; 1848 1849 for( ; iRows != 0; iRows-=iSubStep ) 1850 { 1851 uiSum += abs( piOrg[0] - piCur[0] - iDeltaC ); 1852 uiSum += abs( piOrg[1] - piCur[1] - iDeltaC ); 1853 uiSum += abs( piOrg[2] - piCur[2] - iDeltaC ); 1854 uiSum += abs( piOrg[3] - piCur[3] - iDeltaC ); 1855 uiSum += abs( piOrg[4] - piCur[4] - iDeltaC ); 1856 uiSum += abs( piOrg[5] - piCur[5] - iDeltaC ); 1857 uiSum += abs( piOrg[6] - piCur[6] - iDeltaC ); 1858 uiSum += abs( piOrg[7] - piCur[7] - iDeltaC ); 1859 uiSum += abs( piOrg[8] - piCur[8] - iDeltaC ); 1860 uiSum += abs( piOrg[9] - piCur[9] - iDeltaC ); 1861 uiSum += abs( piOrg[10] - piCur[10] - iDeltaC ); 1862 uiSum += abs( piOrg[11] - piCur[11] - iDeltaC ); 1863 uiSum += abs( piOrg[12] - piCur[12] - iDeltaC ); 1864 uiSum += abs( piOrg[13] - piCur[13] - iDeltaC ); 1865 uiSum += abs( piOrg[14] - piCur[14] - iDeltaC ); 1866 uiSum += abs( piOrg[15] - piCur[15] - iDeltaC ); 1867 uiSum += abs( piOrg[16] - piCur[16] - iDeltaC ); 1868 uiSum += abs( piOrg[17] - piCur[17] - iDeltaC ); 1869 uiSum += abs( piOrg[18] - piCur[18] - iDeltaC ); 1870 uiSum += abs( piOrg[19] - piCur[19] - iDeltaC ); 1871 uiSum += abs( piOrg[20] - piCur[20] - iDeltaC ); 1872 uiSum += abs( piOrg[21] - piCur[21] - iDeltaC ); 1873 uiSum += abs( piOrg[22] - piCur[22] - iDeltaC ); 1874 uiSum += abs( piOrg[23] - piCur[23] - iDeltaC ); 1875 1876 piOrg += iStrideOrg; 1877 piCur += iStrideCur; 1878 } 1879 1880 uiSum <<= iSubShift; 1881 return ( uiSum >> g_uiBitIncrement ); 1882 } 1883 #endif 1884 1885 UInt TComRdCost::xGetSAD64ic( DistParam* pcDtParam ) 1886 { 1887 if ( pcDtParam->bApplyWeight ) 1888 { 1889 return xGetSADw( pcDtParam ); 1890 } 1891 Pel* piOrg = pcDtParam->pOrg; 1892 Pel* piCur = pcDtParam->pCur; 1893 Int iRows = pcDtParam->iRows; 1894 Int iSubShift = pcDtParam->iSubShift; 1895 Int iSubStep = ( 1 << iSubShift ); 1896 Int iStrideCur = pcDtParam->iStrideCur*iSubStep; 1897 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 1898 1899 UInt uiSum = 0; 1900 1901 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0; 1902 Int iDeltaC; 1903 1904 for( ; iRows != 0; iRows-=iSubStep ) 1905 { 1906 iOrigAvg += piOrg[0] ; 1907 iOrigAvg += piOrg[1] ; 1908 iOrigAvg += piOrg[2] ; 1909 iOrigAvg += piOrg[3] ; 1910 iOrigAvg += piOrg[4] ; 1911 iOrigAvg += piOrg[5] ; 1912 iOrigAvg += piOrg[6] ; 1913 iOrigAvg += piOrg[7] ; 1914 iOrigAvg += piOrg[8] ; 1915 iOrigAvg += piOrg[9] ; 1916 iOrigAvg += piOrg[10] ; 1917 iOrigAvg += piOrg[11] ; 1918 iOrigAvg += piOrg[12] ; 1919 iOrigAvg += piOrg[13] ; 1920 iOrigAvg += piOrg[14] ; 1921 iOrigAvg += piOrg[15] ; 1922 iOrigAvg += piOrg[16] ; 1923 iOrigAvg += piOrg[17] ; 1924 iOrigAvg += piOrg[18] ; 1925 iOrigAvg += piOrg[19] ; 1926 iOrigAvg += piOrg[20] ; 1927 iOrigAvg += piOrg[21] ; 1928 iOrigAvg += piOrg[22] ; 1929 iOrigAvg += piOrg[23] ; 1930 iOrigAvg += piOrg[24] ; 1931 iOrigAvg += piOrg[25] ; 1932 iOrigAvg += piOrg[26] ; 1933 iOrigAvg += piOrg[27] ; 1934 iOrigAvg += piOrg[28] ; 1935 iOrigAvg += piOrg[29] ; 1936 iOrigAvg += piOrg[30] ; 1937 iOrigAvg += piOrg[31] ; 1938 iOrigAvg += piOrg[32] ; 1939 iOrigAvg += piOrg[33] ; 1940 iOrigAvg += piOrg[34] ; 1941 iOrigAvg += piOrg[35] ; 1942 iOrigAvg += piOrg[36] ; 1943 iOrigAvg += piOrg[37] ; 1944 iOrigAvg += piOrg[38] ; 1945 iOrigAvg += piOrg[39] ; 1946 iOrigAvg += piOrg[40] ; 1947 iOrigAvg += piOrg[41] ; 1948 iOrigAvg += piOrg[42] ; 1949 iOrigAvg += piOrg[43] ; 1950 iOrigAvg += piOrg[44] ; 1951 iOrigAvg += piOrg[45] ; 1952 iOrigAvg += piOrg[46] ; 1953 iOrigAvg += piOrg[47] ; 1954 iOrigAvg += piOrg[48] ; 1955 iOrigAvg += piOrg[49] ; 1956 iOrigAvg += piOrg[50] ; 1957 iOrigAvg += piOrg[51] ; 1958 iOrigAvg += piOrg[52] ; 1959 iOrigAvg += piOrg[53] ; 1960 iOrigAvg += piOrg[54] ; 1961 iOrigAvg += piOrg[55] ; 1962 iOrigAvg += piOrg[56] ; 1963 iOrigAvg += piOrg[57] ; 1964 iOrigAvg += piOrg[58] ; 1965 iOrigAvg += piOrg[59] ; 1966 iOrigAvg += piOrg[60] ; 1967 iOrigAvg += piOrg[61] ; 1968 iOrigAvg += piOrg[62] ; 1969 iOrigAvg += piOrg[63] ; 1970 1971 iCurAvg += piCur[0] ; 1972 iCurAvg += piCur[1] ; 1973 iCurAvg += piCur[2] ; 1974 iCurAvg += piCur[3] ; 1975 iCurAvg += piCur[4] ; 1976 iCurAvg += piCur[5] ; 1977 iCurAvg += piCur[6] ; 1978 iCurAvg += piCur[7] ; 1979 iCurAvg += piCur[8] ; 1980 iCurAvg += piCur[9] ; 1981 iCurAvg += piCur[10] ; 1982 iCurAvg += piCur[11] ; 1983 iCurAvg += piCur[12] ; 1984 iCurAvg += piCur[13] ; 1985 iCurAvg += piCur[14] ; 1986 iCurAvg += piCur[15] ; 1987 iCurAvg += piCur[16] ; 1988 iCurAvg += piCur[17] ; 1989 iCurAvg += piCur[18] ; 1990 iCurAvg += piCur[19] ; 1991 iCurAvg += piCur[20] ; 1992 iCurAvg += piCur[21] ; 1993 iCurAvg += piCur[22] ; 1994 iCurAvg += piCur[23] ; 1995 iCurAvg += piCur[24] ; 1996 iCurAvg += piCur[25] ; 1997 iCurAvg += piCur[26] ; 1998 iCurAvg += piCur[27] ; 1999 iCurAvg += piCur[28] ; 2000 iCurAvg += piCur[29] ; 2001 iCurAvg += piCur[30] ; 2002 iCurAvg += piCur[31] ; 2003 iCurAvg += piCur[32] ; 2004 iCurAvg += piCur[33] ; 2005 iCurAvg += piCur[34] ; 2006 iCurAvg += piCur[35] ; 2007 iCurAvg += piCur[36] ; 2008 iCurAvg += piCur[37] ; 2009 iCurAvg += piCur[38] ; 2010 iCurAvg += piCur[39] ; 2011 iCurAvg += piCur[40] ; 2012 iCurAvg += piCur[41] ; 2013 iCurAvg += piCur[42] ; 2014 iCurAvg += piCur[43] ; 2015 iCurAvg += piCur[44] ; 2016 iCurAvg += piCur[45] ; 2017 iCurAvg += piCur[46] ; 2018 iCurAvg += piCur[47] ; 2019 iCurAvg += piCur[48] ; 2020 iCurAvg += piCur[49] ; 2021 iCurAvg += piCur[50] ; 2022 iCurAvg += piCur[51] ; 2023 iCurAvg += piCur[52] ; 2024 iCurAvg += piCur[53] ; 2025 iCurAvg += piCur[54] ; 2026 iCurAvg += piCur[55] ; 2027 iCurAvg += piCur[56] ; 2028 iCurAvg += piCur[57] ; 2029 iCurAvg += piCur[58] ; 2030 iCurAvg += piCur[59] ; 2031 iCurAvg += piCur[60] ; 2032 iCurAvg += piCur[61] ; 2033 iCurAvg += piCur[62] ; 2034 iCurAvg += piCur[63] ; 2035 2036 piOrg += iStrideOrg; 2037 piCur += iStrideCur; 2038 uiRowCnt++; 2039 } 2040 2041 piOrg = pcDtParam->pOrg; 2042 piCur = pcDtParam->pCur; 2043 iRows = pcDtParam->iRows; 2044 2045 iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/64) : 0; 2046 2047 for( ; iRows != 0; iRows-=iSubStep ) 2048 { 2049 uiSum += abs( piOrg[0] - piCur[0] - iDeltaC ); 2050 uiSum += abs( piOrg[1] - piCur[1] - iDeltaC ); 2051 uiSum += abs( piOrg[2] - piCur[2] - iDeltaC ); 2052 uiSum += abs( piOrg[3] - piCur[3] - iDeltaC ); 2053 uiSum += abs( piOrg[4] - piCur[4] - iDeltaC ); 2054 uiSum += abs( piOrg[5] - piCur[5] - iDeltaC ); 2055 uiSum += abs( piOrg[6] - piCur[6] - iDeltaC ); 2056 uiSum += abs( piOrg[7] - piCur[7] - iDeltaC ); 2057 uiSum += abs( piOrg[8] - piCur[8] - iDeltaC ); 2058 uiSum += abs( piOrg[9] - piCur[9] - iDeltaC ); 2059 uiSum += abs( piOrg[10] - piCur[10] - iDeltaC ); 2060 uiSum += abs( piOrg[11] - piCur[11] - iDeltaC ); 2061 uiSum += abs( piOrg[12] - piCur[12] - iDeltaC ); 2062 uiSum += abs( piOrg[13] - piCur[13] - iDeltaC ); 2063 uiSum += abs( piOrg[14] - piCur[14] - iDeltaC ); 2064 uiSum += abs( piOrg[15] - piCur[15] - iDeltaC ); 2065 uiSum += abs( piOrg[16] - piCur[16] - iDeltaC ); 2066 uiSum += abs( piOrg[17] - piCur[17] - iDeltaC ); 2067 uiSum += abs( piOrg[18] - piCur[18] - iDeltaC ); 2068 uiSum += abs( piOrg[19] - piCur[19] - iDeltaC ); 2069 uiSum += abs( piOrg[20] - piCur[20] - iDeltaC ); 2070 uiSum += abs( piOrg[21] - piCur[21] - iDeltaC ); 2071 uiSum += abs( piOrg[22] - piCur[22] - iDeltaC ); 2072 uiSum += abs( piOrg[23] - piCur[23] - iDeltaC ); 2073 uiSum += abs( piOrg[24] - piCur[24] - iDeltaC ); 2074 uiSum += abs( piOrg[25] - piCur[25] - iDeltaC ); 2075 uiSum += abs( piOrg[26] - piCur[26] - iDeltaC ); 2076 uiSum += abs( piOrg[27] - piCur[27] - iDeltaC ); 2077 uiSum += abs( piOrg[28] - piCur[28] - iDeltaC ); 2078 uiSum += abs( piOrg[29] - piCur[29] - iDeltaC ); 2079 uiSum += abs( piOrg[30] - piCur[30] - iDeltaC ); 2080 uiSum += abs( piOrg[31] - piCur[31] - iDeltaC ); 2081 uiSum += abs( piOrg[32] - piCur[32] - iDeltaC ); 2082 uiSum += abs( piOrg[33] - piCur[33] - iDeltaC ); 2083 uiSum += abs( piOrg[34] - piCur[34] - iDeltaC ); 2084 uiSum += abs( piOrg[35] - piCur[35] - iDeltaC ); 2085 uiSum += abs( piOrg[36] - piCur[36] - iDeltaC ); 2086 uiSum += abs( piOrg[37] - piCur[37] - iDeltaC ); 2087 uiSum += abs( piOrg[38] - piCur[38] - iDeltaC ); 2088 uiSum += abs( piOrg[39] - piCur[39] - iDeltaC ); 2089 uiSum += abs( piOrg[40] - piCur[40] - iDeltaC ); 2090 uiSum += abs( piOrg[41] - piCur[41] - iDeltaC ); 2091 uiSum += abs( piOrg[42] - piCur[42] - iDeltaC ); 2092 uiSum += abs( piOrg[43] - piCur[43] - iDeltaC ); 2093 uiSum += abs( piOrg[44] - piCur[44] - iDeltaC ); 2094 uiSum += abs( piOrg[45] - piCur[45] - iDeltaC ); 2095 uiSum += abs( piOrg[46] - piCur[46] - iDeltaC ); 2096 uiSum += abs( piOrg[47] - piCur[47] - iDeltaC ); 2097 uiSum += abs( piOrg[48] - piCur[48] - iDeltaC ); 2098 uiSum += abs( piOrg[49] - piCur[49] - iDeltaC ); 2099 uiSum += abs( piOrg[50] - piCur[50] - iDeltaC ); 2100 uiSum += abs( piOrg[51] - piCur[51] - iDeltaC ); 2101 uiSum += abs( piOrg[52] - piCur[52] - iDeltaC ); 2102 uiSum += abs( piOrg[53] - piCur[53] - iDeltaC ); 2103 uiSum += abs( piOrg[54] - piCur[54] - iDeltaC ); 2104 uiSum += abs( piOrg[55] - piCur[55] - iDeltaC ); 2105 uiSum += abs( piOrg[56] - piCur[56] - iDeltaC ); 2106 uiSum += abs( piOrg[57] - piCur[57] - iDeltaC ); 2107 uiSum += abs( piOrg[58] - piCur[58] - iDeltaC ); 2108 uiSum += abs( piOrg[59] - piCur[59] - iDeltaC ); 2109 uiSum += abs( piOrg[60] - piCur[60] - iDeltaC ); 2110 uiSum += abs( piOrg[61] - piCur[61] - iDeltaC ); 2111 uiSum += abs( piOrg[62] - piCur[62] - iDeltaC ); 2112 uiSum += abs( piOrg[63] - piCur[63] - iDeltaC ); 2113 2114 piOrg += iStrideOrg; 2115 piCur += iStrideCur; 2116 } 2117 2118 uiSum <<= iSubShift; 2119 return ( uiSum >> g_uiBitIncrement ); 2120 } 2121 2122 #if AMP_SAD 2123 UInt TComRdCost::xGetSAD48ic( DistParam* pcDtParam ) 2124 { 2125 if ( pcDtParam->bApplyWeight ) 2126 { 2127 return xGetSADw( pcDtParam ); 2128 } 2129 Pel* piOrg = pcDtParam->pOrg; 2130 Pel* piCur = pcDtParam->pCur; 2131 Int iRows = pcDtParam->iRows; 2132 Int iSubShift = pcDtParam->iSubShift; 2133 Int iSubStep = ( 1 << iSubShift ); 2134 Int iStrideCur = pcDtParam->iStrideCur*iSubStep; 2135 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 2136 2137 UInt uiSum = 0; 2138 2139 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0; 2140 Int iDeltaC; 2141 2142 for( ; iRows != 0; iRows-=iSubStep ) 2143 { 2144 iOrigAvg += piOrg[0] ; 2145 iOrigAvg += piOrg[1] ; 2146 iOrigAvg += piOrg[2] ; 2147 iOrigAvg += piOrg[3] ; 2148 iOrigAvg += piOrg[4] ; 2149 iOrigAvg += piOrg[5] ; 2150 iOrigAvg += piOrg[6] ; 2151 iOrigAvg += piOrg[7] ; 2152 iOrigAvg += piOrg[8] ; 2153 iOrigAvg += piOrg[9] ; 2154 iOrigAvg += piOrg[10] ; 2155 iOrigAvg += piOrg[11] ; 2156 iOrigAvg += piOrg[12] ; 2157 iOrigAvg += piOrg[13] ; 2158 iOrigAvg += piOrg[14] ; 2159 iOrigAvg += piOrg[15] ; 2160 iOrigAvg += piOrg[16] ; 2161 iOrigAvg += piOrg[17] ; 2162 iOrigAvg += piOrg[18] ; 2163 iOrigAvg += piOrg[19] ; 2164 iOrigAvg += piOrg[20] ; 2165 iOrigAvg += piOrg[21] ; 2166 iOrigAvg += piOrg[22] ; 2167 iOrigAvg += piOrg[23] ; 2168 iOrigAvg += piOrg[24] ; 2169 iOrigAvg += piOrg[25] ; 2170 iOrigAvg += piOrg[26] ; 2171 iOrigAvg += piOrg[27] ; 2172 iOrigAvg += piOrg[28] ; 2173 iOrigAvg += piOrg[29] ; 2174 iOrigAvg += piOrg[30] ; 2175 iOrigAvg += piOrg[31] ; 2176 iOrigAvg += piOrg[32] ; 2177 iOrigAvg += piOrg[33] ; 2178 iOrigAvg += piOrg[34] ; 2179 iOrigAvg += piOrg[35] ; 2180 iOrigAvg += piOrg[36] ; 2181 iOrigAvg += piOrg[37] ; 2182 iOrigAvg += piOrg[38] ; 2183 iOrigAvg += piOrg[39] ; 2184 iOrigAvg += piOrg[40] ; 2185 iOrigAvg += piOrg[41] ; 2186 iOrigAvg += piOrg[42] ; 2187 iOrigAvg += piOrg[43] ; 2188 iOrigAvg += piOrg[44] ; 2189 iOrigAvg += piOrg[45] ; 2190 iOrigAvg += piOrg[46] ; 2191 iOrigAvg += piOrg[47] ; 2192 2193 iCurAvg += piCur[0] ; 2194 iCurAvg += piCur[1] ; 2195 iCurAvg += piCur[2] ; 2196 iCurAvg += piCur[3] ; 2197 iCurAvg += piCur[4] ; 2198 iCurAvg += piCur[5] ; 2199 iCurAvg += piCur[6] ; 2200 iCurAvg += piCur[7] ; 2201 iCurAvg += piCur[8] ; 2202 iCurAvg += piCur[9] ; 2203 iCurAvg += piCur[10] ; 2204 iCurAvg += piCur[11] ; 2205 iCurAvg += piCur[12] ; 2206 iCurAvg += piCur[13] ; 2207 iCurAvg += piCur[14] ; 2208 iCurAvg += piCur[15] ; 2209 iCurAvg += piCur[16] ; 2210 iCurAvg += piCur[17] ; 2211 iCurAvg += piCur[18] ; 2212 iCurAvg += piCur[19] ; 2213 iCurAvg += piCur[20] ; 2214 iCurAvg += piCur[21] ; 2215 iCurAvg += piCur[22] ; 2216 iCurAvg += piCur[23] ; 2217 iCurAvg += piCur[24] ; 2218 iCurAvg += piCur[25] ; 2219 iCurAvg += piCur[26] ; 2220 iCurAvg += piCur[27] ; 2221 iCurAvg += piCur[28] ; 2222 iCurAvg += piCur[29] ; 2223 iCurAvg += piCur[30] ; 2224 iCurAvg += piCur[31] ; 2225 iCurAvg += piCur[32] ; 2226 iCurAvg += piCur[33] ; 2227 iCurAvg += piCur[34] ; 2228 iCurAvg += piCur[35] ; 2229 iCurAvg += piCur[36] ; 2230 iCurAvg += piCur[37] ; 2231 iCurAvg += piCur[38] ; 2232 iCurAvg += piCur[39] ; 2233 iCurAvg += piCur[40] ; 2234 iCurAvg += piCur[41] ; 2235 iCurAvg += piCur[42] ; 2236 iCurAvg += piCur[43] ; 2237 iCurAvg += piCur[44] ; 2238 iCurAvg += piCur[45] ; 2239 iCurAvg += piCur[46] ; 2240 iCurAvg += piCur[47] ; 2241 2242 piOrg += iStrideOrg; 2243 piCur += iStrideCur; 2244 uiRowCnt++; 2245 } 2246 2247 piOrg = pcDtParam->pOrg; 2248 piCur = pcDtParam->pCur; 2249 iRows = pcDtParam->iRows; 2250 2251 iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/48) : 0; 2252 2253 for( ; iRows != 0; iRows-=iSubStep ) 2254 { 2255 uiSum += abs( piOrg[0] - piCur[0] - iDeltaC ); 2256 uiSum += abs( piOrg[1] - piCur[1] - iDeltaC ); 2257 uiSum += abs( piOrg[2] - piCur[2] - iDeltaC ); 2258 uiSum += abs( piOrg[3] - piCur[3] - iDeltaC ); 2259 uiSum += abs( piOrg[4] - piCur[4] - iDeltaC ); 2260 uiSum += abs( piOrg[5] - piCur[5] - iDeltaC ); 2261 uiSum += abs( piOrg[6] - piCur[6] - iDeltaC ); 2262 uiSum += abs( piOrg[7] - piCur[7] - iDeltaC ); 2263 uiSum += abs( piOrg[8] - piCur[8] - iDeltaC ); 2264 uiSum += abs( piOrg[9] - piCur[9] - iDeltaC ); 2265 uiSum += abs( piOrg[10] - piCur[10] - iDeltaC ); 2266 uiSum += abs( piOrg[11] - piCur[11] - iDeltaC ); 2267 uiSum += abs( piOrg[12] - piCur[12] - iDeltaC ); 2268 uiSum += abs( piOrg[13] - piCur[13] - iDeltaC ); 2269 uiSum += abs( piOrg[14] - piCur[14] - iDeltaC ); 2270 uiSum += abs( piOrg[15] - piCur[15] - iDeltaC ); 2271 uiSum += abs( piOrg[16] - piCur[16] - iDeltaC ); 2272 uiSum += abs( piOrg[17] - piCur[17] - iDeltaC ); 2273 uiSum += abs( piOrg[18] - piCur[18] - iDeltaC ); 2274 uiSum += abs( piOrg[19] - piCur[19] - iDeltaC ); 2275 uiSum += abs( piOrg[20] - piCur[20] - iDeltaC ); 2276 uiSum += abs( piOrg[21] - piCur[21] - iDeltaC ); 2277 uiSum += abs( piOrg[22] - piCur[22] - iDeltaC ); 2278 uiSum += abs( piOrg[23] - piCur[23] - iDeltaC ); 2279 uiSum += abs( piOrg[24] - piCur[24] - iDeltaC ); 2280 uiSum += abs( piOrg[25] - piCur[25] - iDeltaC ); 2281 uiSum += abs( piOrg[26] - piCur[26] - iDeltaC ); 2282 uiSum += abs( piOrg[27] - piCur[27] - iDeltaC ); 2283 uiSum += abs( piOrg[28] - piCur[28] - iDeltaC ); 2284 uiSum += abs( piOrg[29] - piCur[29] - iDeltaC ); 2285 uiSum += abs( piOrg[30] - piCur[30] - iDeltaC ); 2286 uiSum += abs( piOrg[31] - piCur[31] - iDeltaC ); 2287 uiSum += abs( piOrg[32] - piCur[32] - iDeltaC ); 2288 uiSum += abs( piOrg[33] - piCur[33] - iDeltaC ); 2289 uiSum += abs( piOrg[34] - piCur[34] - iDeltaC ); 2290 uiSum += abs( piOrg[35] - piCur[35] - iDeltaC ); 2291 uiSum += abs( piOrg[36] - piCur[36] - iDeltaC ); 2292 uiSum += abs( piOrg[37] - piCur[37] - iDeltaC ); 2293 uiSum += abs( piOrg[38] - piCur[38] - iDeltaC ); 2294 uiSum += abs( piOrg[39] - piCur[39] - iDeltaC ); 2295 uiSum += abs( piOrg[40] - piCur[40] - iDeltaC ); 2296 uiSum += abs( piOrg[41] - piCur[41] - iDeltaC ); 2297 uiSum += abs( piOrg[42] - piCur[42] - iDeltaC ); 2298 uiSum += abs( piOrg[43] - piCur[43] - iDeltaC ); 2299 uiSum += abs( piOrg[44] - piCur[44] - iDeltaC ); 2300 uiSum += abs( piOrg[45] - piCur[45] - iDeltaC ); 2301 uiSum += abs( piOrg[46] - piCur[46] - iDeltaC ); 2302 uiSum += abs( piOrg[47] - piCur[47] - iDeltaC ); 2303 2304 piOrg += iStrideOrg; 2305 piCur += iStrideCur; 2306 } 2307 2308 uiSum <<= iSubShift; 2309 return ( uiSum >> g_uiBitIncrement ); 2310 } 2311 #endif 1112 2312 #endif 1113 2313 … … 2826 4026 return xGetHADsw( pcDtParam ); 2827 4027 } 4028 #if LGE_ILLUCOMP_B0045 4029 if(pcDtParam->bUseIC) 4030 { 4031 return xGetHADsic( pcDtParam ); 4032 } 4033 #endif 2828 4034 Pel* piOrg = pcDtParam->pOrg; 2829 4035 Pel* piCur = pcDtParam->pCur; … … 2833 4039 Int iStrideOrg = pcDtParam->iStrideOrg; 2834 4040 Int iStep = pcDtParam->iStep; 2835 4041 2836 4042 Int x, y; 2837 2838 UInt uiSum = 0; 2839 4043 4044 UInt uiSum = 0; 4045 2840 4046 #if NS_HAD 2841 4047 if( ( ( iRows % 8 == 0) && (iCols % 8 == 0) && ( iRows == iCols ) ) || ( ( iRows % 8 == 0 ) && (iCols % 8 == 0) && !pcDtParam->bUseNSHAD ) ) … … 2890 4096 Int iOffsetOrg = iStrideOrg<<2; 2891 4097 Int iOffsetCur = iStrideCur<<2; 2892 4098 2893 4099 for ( y=0; y<iRows; y+= 4 ) 2894 4100 { … … 2919 4125 assert(false); 2920 4126 } 2921 4127 2922 4128 return ( uiSum >> g_uiBitIncrement ); 2923 4129 } 4130 4131 #if LGE_ILLUCOMP_B0045 4132 UInt TComRdCost::xGetHADsic( DistParam* pcDtParam ) 4133 { 4134 if ( pcDtParam->bApplyWeight ) 4135 { 4136 return xGetHADsw( pcDtParam ); 4137 } 4138 Pel* piOrg = pcDtParam->pOrg; 4139 Pel* piCur = pcDtParam->pCur; 4140 Int iRows = pcDtParam->iRows; 4141 Int iCols = pcDtParam->iCols; 4142 Int iStrideCur = pcDtParam->iStrideCur; 4143 Int iStrideOrg = pcDtParam->iStrideOrg; 4144 Int iStep = pcDtParam->iStep; 4145 4146 Int x, y; 4147 4148 UInt uiSum = 0; 4149 4150 Int iOrigAvg = 0, iCurAvg = 0; 4151 Int iDeltaC; 4152 4153 for ( y=0; y<iRows; y++ ) 4154 { 4155 for ( x=0; x<iCols; x++ ) 4156 { 4157 iOrigAvg += piOrg[x]; 4158 iCurAvg += piCur[x]; 4159 } 4160 piOrg += iStrideOrg; 4161 piCur += iStrideCur; 4162 } 4163 4164 piOrg = pcDtParam->pOrg; 4165 piCur = pcDtParam->pCur; 4166 4167 iDeltaC = (iOrigAvg - iCurAvg)/iRows/iCols; 4168 4169 for ( y=0; y<iRows; y++ ) 4170 { 4171 for ( x=0; x<iCols; x++ ) 4172 { 4173 piOrg[x] -= iDeltaC; 4174 } 4175 piOrg += iStrideOrg; 4176 } 4177 4178 piOrg = pcDtParam->pOrg; 4179 4180 #if NS_HAD 4181 if( ( ( iRows % 8 == 0) && (iCols % 8 == 0) && ( iRows == iCols ) ) || ( ( iRows % 8 == 0 ) && (iCols % 8 == 0) && !pcDtParam->bUseNSHAD ) ) 4182 #else 4183 if( ( iRows % 8 == 0) && (iCols % 8 == 0) ) 4184 #endif 4185 { 4186 Int iOffsetOrg = iStrideOrg<<3; 4187 Int iOffsetCur = iStrideCur<<3; 4188 for ( y=0; y<iRows; y+= 8 ) 4189 { 4190 for ( x=0; x<iCols; x+= 8 ) 4191 { 4192 uiSum += xCalcHADs8x8( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); 4193 } 4194 piOrg += iOffsetOrg; 4195 piCur += iOffsetCur; 4196 } 4197 } 4198 #if NS_HAD 4199 else if ( ( iCols > 8 ) && ( iCols > iRows ) && pcDtParam->bUseNSHAD ) 4200 { 4201 Int iOffsetOrg = iStrideOrg<<2; 4202 Int iOffsetCur = iStrideCur<<2; 4203 for ( y=0; y<iRows; y+= 4 ) 4204 { 4205 for ( x=0; x<iCols; x+= 16 ) 4206 { 4207 uiSum += xCalcHADs16x4( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); 4208 } 4209 piOrg += iOffsetOrg; 4210 piCur += iOffsetCur; 4211 } 4212 } 4213 else if ( ( iRows > 8 ) && ( iCols < iRows ) && pcDtParam->bUseNSHAD ) 4214 { 4215 Int iOffsetOrg = iStrideOrg<<4; 4216 Int iOffsetCur = iStrideCur<<4; 4217 for ( y=0; y<iRows; y+= 16 ) 4218 { 4219 for ( x=0; x<iCols; x+= 4 ) 4220 { 4221 uiSum += xCalcHADs4x16( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); 4222 } 4223 piOrg += iOffsetOrg; 4224 piCur += iOffsetCur; 4225 } 4226 } 4227 #endif 4228 else if( ( iRows % 4 == 0) && (iCols % 4 == 0) ) 4229 { 4230 Int iOffsetOrg = iStrideOrg<<2; 4231 Int iOffsetCur = iStrideCur<<2; 4232 4233 for ( y=0; y<iRows; y+= 4 ) 4234 { 4235 for ( x=0; x<iCols; x+= 4 ) 4236 { 4237 uiSum += xCalcHADs4x4( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); 4238 } 4239 piOrg += iOffsetOrg; 4240 piCur += iOffsetCur; 4241 } 4242 } 4243 else if( ( iRows % 2 == 0) && (iCols % 2 == 0) ) 4244 { 4245 Int iOffsetOrg = iStrideOrg<<1; 4246 Int iOffsetCur = iStrideCur<<1; 4247 for ( y=0; y<iRows; y+=2 ) 4248 { 4249 for ( x=0; x<iCols; x+=2 ) 4250 { 4251 uiSum += xCalcHADs2x2( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); 4252 } 4253 piOrg += iOffsetOrg; 4254 piCur += iOffsetCur; 4255 } 4256 } 4257 else 4258 { 4259 assert(false); 4260 } 4261 4262 piOrg = pcDtParam->pOrg; 4263 4264 for ( y=0; y<iRows; y++ ) 4265 { 4266 for ( x=0; x<iCols; x++ ) 4267 { 4268 piOrg[x] += iDeltaC; 4269 } 4270 piOrg += iStrideOrg; 4271 } 4272 4273 return ( uiSum >> g_uiBitIncrement ); 4274 } 4275 #endif 2924 4276 2925 4277 #if HHI_VSO -
branches/HTM-4.1-dev2-LG/source/Lib/TLibCommon/TComRdCost.h
r120 r152 88 88 Int iCols; 89 89 Int iStep; 90 #if LGE_ILLUCOMP_B0045 91 Bool bUseIC; 92 #endif 90 93 FpDistFunc DistFunc; 91 94 … … 302 305 private: 303 306 307 #if LGE_ILLUCOMP_B0045 308 static UInt xGetSADic ( DistParam* pcDtParam ); 309 static UInt xGetSAD4ic ( DistParam* pcDtParam ); 310 static UInt xGetSAD8ic ( DistParam* pcDtParam ); 311 static UInt xGetSAD16ic ( DistParam* pcDtParam ); 312 static UInt xGetSAD32ic ( DistParam* pcDtParam ); 313 static UInt xGetSAD64ic ( DistParam* pcDtParam ); 314 static UInt xGetSAD16Nic ( DistParam* pcDtParam ); 315 #endif 304 316 static UInt xGetSSE ( DistParam* pcDtParam ); 305 317 static UInt xGetSSE4 ( DistParam* pcDtParam ); … … 329 341 330 342 #if AMP_SAD 343 #if LGE_ILLUCOMP_B0045 344 static UInt xGetSAD12ic ( DistParam* pcDtParam ); 345 static UInt xGetSAD24ic ( DistParam* pcDtParam ); 346 static UInt xGetSAD48ic ( DistParam* pcDtParam ); 347 #endif 331 348 static UInt xGetSAD12 ( DistParam* pcDtParam ); 332 349 static UInt xGetSAD24 ( DistParam* pcDtParam ); 333 350 static UInt xGetSAD48 ( DistParam* pcDtParam ); 334 335 #endif 336 351 #endif 352 353 #if LGE_ILLUCOMP_B0045 354 static UInt xGetHADsic ( DistParam* pcDtParam ); 355 #endif 337 356 static UInt xGetHADs4 ( DistParam* pcDtParam ); 338 357 static UInt xGetHADs8 ( DistParam* pcDtParam ); 339 358 static UInt xGetHADs ( DistParam* pcDtParam ); 359 340 360 static UInt xCalcHADs2x2 ( Pel *piOrg, Pel *piCurr, Int iStrideOrg, Int iStrideCur, Int iStep ); 341 361 static UInt xCalcHADs4x4 ( Pel *piOrg, Pel *piCurr, Int iStrideOrg, Int iStrideCur, Int iStep ); -
branches/HTM-4.1-dev2-LG/source/Lib/TLibCommon/TComSlice.cpp
r116 r152 112 112 , m_iViewOrderIdx ( 0 ) 113 113 #endif 114 #if LGE_ILLUCOMP_B0045 115 , m_bApplyIC ( false ) 116 #endif 114 117 { 115 118 m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = m_aiNumRefIdx[2] = 0; … … 1304 1307 } 1305 1308 } 1309 1310 #if LGE_ILLUCOMP_B0045 1311 Void TComSlice::xSetApplyIC() 1312 { 1313 Int iMaxPelValue = (1<<g_uiBitDepth); 1314 Int *aiRefOrgHist; 1315 Int *aiCurrHist; 1316 aiRefOrgHist = new Int; 1317 aiCurrHist = new Int; 1318 aiRefOrgHist = (Int *)xMalloc(Int,iMaxPelValue); 1319 aiCurrHist = (Int *)xMalloc(Int,iMaxPelValue); 1320 memset(aiRefOrgHist, 0, iMaxPelValue*sizeof(Int) ); 1321 memset(aiCurrHist, 0, iMaxPelValue*sizeof(Int) ); 1322 // Reference Idx Number 1323 Int iNumRefIdx = getNumRefIdx( REF_PIC_LIST_0 ); 1324 TComPic* pcCurrPic = NULL; 1325 TComPic* pcRefPic = NULL; 1326 TComPicYuv* pcCurrPicYuv = NULL; 1327 TComPicYuv* pcRefPicYuvOrg = NULL; 1328 pcCurrPic = getPic(); 1329 pcCurrPicYuv = pcCurrPic->getPicYuvOrg(); 1330 Int iWidth = pcCurrPicYuv->getWidth(); 1331 Int iHeight = pcCurrPicYuv->getHeight(); 1332 1333 1334 // Get InterView Reference picture 1335 // !!!!! Assume only one Interview Reference Picture in L0 1336 for (Int i = 0; i < iNumRefIdx; i++) 1337 { 1338 pcRefPic = getRefPic( REF_PIC_LIST_0, i); 1339 if (pcRefPic != NULL) 1340 { 1341 // Current Picture 1342 if (pcCurrPic->getViewId() != pcRefPic->getViewId()) 1343 { 1344 pcRefPicYuvOrg = pcRefPic->getPicYuvOrg(); 1345 } 1346 } 1347 } 1348 if (pcRefPicYuvOrg != NULL) 1349 { 1350 Pel* pCurrY = pcCurrPicYuv ->getLumaAddr(); 1351 Pel* pRefOrgY = pcRefPicYuvOrg ->getLumaAddr(); 1352 Int iCurrStride = pcCurrPicYuv->getStride(); 1353 Int iRefStride = pcRefPicYuvOrg->getStride(); 1354 Int iSumOrgSAD = 0; 1355 double dThresholdOrgSAD = 0.05; 1356 // Histogram building - luminance 1357 for ( Int y = 0; y < iHeight; y++) 1358 { 1359 for ( Int x = 0; x < iWidth; x++) 1360 { 1361 aiCurrHist[pCurrY[x]]++; 1362 aiRefOrgHist[pRefOrgY[x]]++; 1363 } 1364 pCurrY += iCurrStride; 1365 pRefOrgY += iRefStride; 1366 } 1367 // Calc SAD 1368 for (Int i = 0; i < iMaxPelValue; i++) 1369 { 1370 iSumOrgSAD += abs(aiCurrHist[i] - aiRefOrgHist[i]); 1371 } 1372 //printf("iSumOrgSAD : %d\n",iSumOrgSAD); 1373 // Setting 1374 if ( iSumOrgSAD > Int(dThresholdOrgSAD * iWidth * iHeight) ) 1375 { 1376 m_bApplyIC = true; 1377 //printf("ApplyIC\n"); 1378 } 1379 else 1380 { 1381 m_bApplyIC = false; 1382 } 1383 } 1384 xFree(aiCurrHist); 1385 xFree(aiRefOrgHist); 1386 aiCurrHist = NULL; 1387 aiRefOrgHist = NULL; 1388 } 1389 #endif 1306 1390 1307 1391 // ------------------------------------------------------------------------------------------------ -
branches/HTM-4.1-dev2-LG/source/Lib/TLibCommon/TComSlice.h
r116 r152 1280 1280 Int m_iViewOrderIdx; 1281 1281 #endif 1282 #if LGE_ILLUCOMP_B0045 1283 Bool m_bApplyIC; 1284 #endif 1282 1285 1283 1286 public: … … 1574 1577 Int* getInvCodedOffset () { return m_aaiCodedOffset[1]; } 1575 1578 1579 #if LGE_ILLUCOMP_B0045 1580 Void setApplyIC ( Bool b ) { m_bApplyIC = b; } 1581 Bool getApplyIC () { return m_bApplyIC; } 1582 Void xSetApplyIC (); 1583 #endif 1584 1576 1585 protected: 1577 1586 TComPic* xGetRefPic (TComList<TComPic*>& rcListPic, UInt uiPOC); -
branches/HTM-4.1-dev2-LG/source/Lib/TLibCommon/TypeDef.h
r145 r152 101 101 #define SAIT_VSO_EST_A0033 1 // JCT2-A0033 modification 3 102 102 #define LGE_VSO_EARLY_SKIP_A0093 1 // JCT2-A0093 modification 4 103 #define LGE_WVSO_A0119 1 // JCT2-A0119 & JCT3V-B0131 Depth Metric with a weighted depth fidelity term 103 #define LGE_WVSO_A0119 1 // JCT2-A0119 & JCT3V-B0131 Depth Metric with a weighted depth fidelity term 104 #define LGE_ILLUCOMP_B0045 1 // JCT2-B0045 Illumination compensation for Luma and Chroma 105 #if LGE_ILLUCOMP_B0045 106 #define LGE_ILLUCOMP_B0045_ENCSIMP 1 107 #endif 108 #define LG_BUG_FIX 1 104 109 105 110 #define OL_DEPTHLIMIT_A0044 1 //JCT2-A0044 -
branches/HTM-4.1-dev2-LG/source/Lib/TLibDecoder/TDecCAVLC.cpp
r146 r152 1803 1803 UInt address; 1804 1804 UInt innerAddress = 0; 1805 1806 #if LGE_ILLUCOMP_B0045 1807 // IC flag is on only first_slice_in_pic 1808 if (uiCode) 1809 { 1810 UInt uiCodeTmp = 0; 1811 if ( rpcSlice->getSPS()->getViewId() && !rpcSlice->getSPS()->isDepth() ) 1812 { 1813 READ_FLAG (uiCodeTmp, "applying IC flag"); 1814 } 1815 rpcSlice->setApplyIC(uiCodeTmp); 1816 } 1817 #endif 1818 1805 1819 if(!uiCode) 1806 1820 { … … 2601 2615 } 2602 2616 2617 #if LGE_ILLUCOMP_B0045 2618 Void TDecCavlc::parseICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2619 { 2620 assert(0); 2621 } 2622 #endif 2623 2603 2624 #if HHI_INTER_VIEW_MOTION_PRED 2604 2625 Void TDecCavlc::parseMVPIdx( Int& riMVPIdx, Int iAMVPCands ) -
branches/HTM-4.1-dev2-LG/source/Lib/TLibDecoder/TDecCAVLC.h
r77 r152 142 142 143 143 Void parseSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 144 #if LGE_ILLUCOMP_B0045 145 Void parseICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 146 #endif 144 147 Void parseMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ); 145 148 Void parseMergeIndex ( TComDataCU* pcCU, UInt& ruiMergeIndex, UInt uiAbsPartIdx, UInt uiDepth ); -
branches/HTM-4.1-dev2-LG/source/Lib/TLibDecoder/TDecCu.cpp
r100 r152 389 389 } 390 390 } 391 #if LGE_ILLUCOMP_B0045 392 m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth ); 393 #endif 391 394 #if HHI_MPI 392 395 } … … 440 443 m_pcEntropyDecoder->decodePredInfo( pcCU, uiAbsPartIdx, uiDepth, m_ppcCU[uiDepth]); 441 444 445 #if LGE_ILLUCOMP_B0045 446 m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth ); 447 #endif 448 442 449 #if HHI_INTER_VIEW_RESIDUAL_PRED 443 450 if( !pcCU->isIntra( uiAbsPartIdx ) ) -
branches/HTM-4.1-dev2-LG/source/Lib/TLibDecoder/TDecEntropy.cpp
r100 r152 67 67 } 68 68 69 #if LGE_ILLUCOMP_B0045 70 Void TDecEntropy::decodeICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 71 { 72 pcCU->setICFlagSubParts( false , uiAbsPartIdx, 0, uiDepth ); 73 74 if (pcCU->isIntra(uiAbsPartIdx) || (pcCU->getSlice()->getViewId() == 0) || pcCU->getSlice()->getSPS()->isDepth()) 75 { 76 return; 77 } 78 79 if(!pcCU->getSlice()->getApplyIC()) 80 return; 81 82 if(pcCU->isICFlagRequired(uiAbsPartIdx)) 83 m_pcEntropyDecoderIf->parseICFlag( pcCU, uiAbsPartIdx, uiDepth ); 84 } 85 #endif 69 86 /** decode merge index 70 87 * \param pcCU -
branches/HTM-4.1-dev2-LG/source/Lib/TLibDecoder/TDecEntropy.h
r77 r152 103 103 public: 104 104 virtual Void parseSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 105 #if LGE_ILLUCOMP_B0045 106 virtual Void parseICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 107 #endif 105 108 virtual Void parseSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 106 109 virtual Void parseMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ) = 0; … … 196 199 Void decodeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 197 200 Void decodeSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 201 #if LGE_ILLUCOMP_B0045 202 Void decodeICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 203 #endif 198 204 Void decodeMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ); 199 205 Void decodeMergeIndex ( TComDataCU* pcSubCU, UInt uiPartIdx, UInt uiPartAddr, PartSize eCUMode, UChar* puhInterDirNeighbours, TComMvField* pcMvFieldNeighbours, UInt uiDepth ); -
branches/HTM-4.1-dev2-LG/source/Lib/TLibDecoder/TDecSbac.cpp
r100 r152 52 52 , m_cCUSplitFlagSCModel ( 1, 1, NUM_SPLIT_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels ) 53 53 , m_cCUSkipFlagSCModel ( 1, 1, NUM_SKIP_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 54 #if LGE_ILLUCOMP_B0045 55 , m_cCUICFlagSCModel ( 1, 1, NUM_IC_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 56 #endif 54 57 , m_cCUMergeFlagExtSCModel ( 1, 1, NUM_MERGE_FLAG_EXT_CTX , m_contextModels + m_numContextModels, m_numContextModels) 55 58 , m_cCUMergeIdxExtSCModel ( 1, 1, NUM_MERGE_IDX_EXT_CTX , m_contextModels + m_numContextModels, m_numContextModels) … … 146 149 m_cCUSplitFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SPLIT_FLAG ); 147 150 m_cCUSkipFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SKIP_FLAG ); 151 #if LGE_ILLUCOMP_B0045 152 m_cCUICFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_IC_FLAG ); 153 #endif 148 154 m_cCUMergeFlagExtSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_MERGE_FLAG_EXT ); 149 155 m_cCUMergeIdxExtSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_MERGE_IDX_EXT ); … … 230 236 m_cCUSplitFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SPLIT_FLAG ); 231 237 m_cCUSkipFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SKIP_FLAG ); 238 #if LGE_ILLUCOMP_B0045 239 m_cCUICFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_IC_FLAG ); 240 #endif 232 241 m_cCUMergeFlagExtSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MERGE_FLAG_EXT ); 233 242 m_cCUMergeIdxExtSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MERGE_IDX_EXT ); … … 578 587 } 579 588 589 #if LGE_ILLUCOMP_B0045 590 /** parse illumination compensation flag 591 * \param pcCU 592 * \param uiAbsPartIdx 593 * \param uiDepth 594 * \returns Void 595 */ 596 Void TDecSbac::parseICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 597 { 598 UInt uiSymbol = 0; 599 UInt uiCtxIC = pcCU->getCtxICFlag( uiAbsPartIdx ); 600 m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUICFlagSCModel.get( 0, 0, uiCtxIC ) ); 601 DTRACE_CABAC_VL( g_nSymbolCounter++ ); 602 DTRACE_CABAC_T( "\tICFlag" ); 603 DTRACE_CABAC_T( "\tuiCtxIC: "); 604 DTRACE_CABAC_V( uiCtxIC ); 605 DTRACE_CABAC_T( "\tuiSymbol: "); 606 DTRACE_CABAC_V( uiSymbol ); 607 DTRACE_CABAC_T( "\n"); 608 609 pcCU->setICFlagSubParts( uiSymbol ? true : false , uiAbsPartIdx, 0, uiDepth ); 610 } 611 #endif 612 613 580 614 /** parse merge flag 581 615 * \param pcCU -
branches/HTM-4.1-dev2-LG/source/Lib/TLibDecoder/TDecSbac.h
r100 r152 166 166 167 167 Void parseSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 168 #if LGE_ILLUCOMP_B0045 169 Void parseICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 170 #endif 168 171 Void parseSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 169 172 Void parseMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ); … … 207 210 ContextModel3DBuffer m_cCUSplitFlagSCModel; 208 211 ContextModel3DBuffer m_cCUSkipFlagSCModel; 212 #if LGE_ILLUCOMP_B0045 213 ContextModel3DBuffer m_cCUICFlagSCModel; 214 #endif 209 215 ContextModel3DBuffer m_cCUMergeFlagExtSCModel; 210 216 ContextModel3DBuffer m_cCUMergeIdxExtSCModel; -
branches/HTM-4.1-dev2-LG/source/Lib/TLibEncoder/TEncCavlc.cpp
r100 r152 749 749 Int address = (pcSlice->getPic()->getPicSym()->getCUOrderMap(lCUAddress) << reqBitsInner) + innerAddress; 750 750 WRITE_FLAG( address==0, "first_slice_in_pic_flag" ); 751 752 #if LGE_ILLUCOMP_B0045 753 // IC flag is on only first_slice_in_pic 754 if (address==0) 755 { 756 if( pcSlice->getSPS()->getViewId() && !pcSlice->getIsDepth() ) 757 { 758 WRITE_FLAG( pcSlice->getApplyIC() ? 1 : 0, "applying IC flag" ); 759 } 760 } 761 #endif 762 751 763 if(address>0) 752 764 { … … 1427 1439 } 1428 1440 1441 #if LGE_ILLUCOMP_B0045 1442 Void TEncCavlc::codeICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ) 1443 { 1444 assert(0); 1445 } 1446 #endif 1447 1429 1448 Void TEncCavlc::codeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 1430 1449 { -
branches/HTM-4.1-dev2-LG/source/Lib/TLibEncoder/TEncCavlc.h
r77 r152 164 164 165 165 Void codeSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 166 #if LGE_ILLUCOMP_B0045 167 Void codeICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 168 #endif 166 169 Void codeMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 167 170 Void codeMergeIndex ( TComDataCU* pcCU, UInt uiAbsPartIdx ); -
branches/HTM-4.1-dev2-LG/source/Lib/TLibEncoder/TEncCfg.h
r121 r152 167 167 #endif 168 168 Bool m_bUseSAO; 169 #if LGE_ILLUCOMP_B0045 170 Bool m_bUseIC; 171 #endif 169 172 #if SAO_UNIT_INTERLEAVING 170 173 Int m_maxNumOffsetsPerPic; … … 690 693 Void setUseSAO ( Bool bVal ) {m_bUseSAO = bVal;} 691 694 Bool getUseSAO () {return m_bUseSAO;} 695 #if LGE_ILLUCOMP_B0045 696 Void setUseIC ( Bool bVal ) {m_bUseIC = bVal;} 697 Bool getUseIC () {return m_bUseIC;} 698 #endif 692 699 #if SAO_UNIT_INTERLEAVING 693 700 Void setMaxNumOffsetsPerPic (Int iVal) { m_maxNumOffsetsPerPic = iVal; } -
branches/HTM-4.1-dev2-LG/source/Lib/TLibEncoder/TEncCu.cpp
r126 r152 456 456 TComDataCU * pcTextureCU; 457 457 Bool depthMapDetect = false; 458 #if !LG_BUG_FIX 458 459 UInt uiPrevTexPartIndex = 0; 460 #endif 459 461 #if OL_DO_NOT_LIMIT_INTRA_SLICES_PART 460 462 Bool bIntraSliceDetect = false; … … 511 513 UInt uiTPelY = rpcBestCU->getCUPelY(); 512 514 UInt uiBPelY = uiTPelY + rpcBestCU->getHeight(0) - 1; 515 516 #if LGE_ILLUCOMP_B0045 517 Bool bICEnabled = (!rpcTempCU->getSlice()->getIsDepth() && rpcTempCU->getSlice()->getViewId()); 518 519 bICEnabled = bICEnabled && rpcTempCU->getSlice()->getApplyIC(); 520 #endif 513 521 514 522 #if HHI_INTERVIEW_SKIP … … 637 645 bTryNx2N = true; 638 646 bTry2NxN = true; 647 #if !LG_BUG_FIX 639 648 uiPrevTexPartIndex = pcTexture->getTexPartIndex(); 649 #endif 640 650 pcTexture->incrementTexPartIndex(); 641 651 } … … 648 658 //scan ahead till next depth 649 659 uiTexdepth = pcTexture->accessPartInfo(1); 660 #if !LG_BUG_FIX 650 661 uiPrevTexPartIndex = pcTexture->getTexPartIndex(); 662 #endif 651 663 pcTexture->incrementTexPartIndex(); 652 664 temp_uiTexPartIndex = pcTexture->getTexPartIndex(); //store in case to rewind … … 682 694 bTryNx2N = false; 683 695 bTry2NxN = true; 696 #if !LG_BUG_FIX 684 697 uiPrevTexPartIndex = pcTexture->getTexPartIndex(); 698 #endif 685 699 pcTexture->incrementTexPartIndex(); ; 686 700 } … … 690 704 bTryNx2N = true; 691 705 bTry2NxN = false; 706 #if !LG_BUG_FIX 692 707 uiPrevTexPartIndex = pcTexture->getTexPartIndex(); 708 #endif 693 709 pcTexture->incrementTexPartIndex(); ; 694 710 } … … 718 734 { 719 735 Bool bResPredFlag = ( uiResPrdId > 0 ); 736 #if LGE_ILLUCOMP_B0045 737 for(UInt uiICId = 0; uiICId < (bICEnabled ? 2 : 1); uiICId++) 738 { 739 Bool bICFlag = (uiICId ? true : false); 740 rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth); 741 #endif 720 742 #endif 721 743 #if HHI_INTER_VIEW_RESIDUAL_PRED … … 740 762 } 741 763 } 742 764 #if LGE_ILLUCOMP_B0045_ENCSIMP 765 if(bICFlag && rpcBestCU->getMergeFlag(0) && !rpcBestCU->getICFlag(0)) 766 { 767 bICEnabled = false; 768 break; 769 } 770 #endif 743 771 // 2Nx2N, NxN 744 772 if ( !bEarlySkip ) … … 759 787 } 760 788 } 789 #if LGE_ILLUCOMP_B0045 790 } 791 #endif 761 792 #if HHI_INTER_VIEW_RESIDUAL_PRED 762 793 } // uiResPrdId 763 794 #endif 764 795 } // != I_SLICE 796 797 #if LGE_ILLUCOMP_B0045_ENCSIMP 798 bICEnabled = rpcBestCU->getICFlag(0); 799 #endif 765 800 766 801 #if OL_DEPTHLIMIT_A0044 … … 841 876 { 842 877 Bool bResPredFlag = ( uiResPrdId > 0 ); 878 #if LGE_ILLUCOMP_B0045 879 for(UInt uiICId = 0; uiICId < (bICEnabled ? 2 : 1); uiICId++) 880 { 881 Bool bICFlag = (uiICId ? true : false); 882 rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth); 883 #endif 843 884 #endif 844 885 // 2Nx2N, NxN … … 1376 1417 } //! Try AMP (SIZE_2NxnU, SIZE_2NxnD, SIZE_nLx2N, SIZE_nRx2N) 1377 1418 #endif 1419 #if LGE_ILLUCOMP_B0045 1420 } 1421 #endif 1378 1422 #if HHI_INTER_VIEW_RESIDUAL_PRED 1379 1423 } // uiResPrdId … … 1401 1445 #endif 1402 1446 { 1447 #if LGE_ILLUCOMP_B0045 1448 rpcTempCU->setICFlagSubParts(false, 0, 0, uiDepth); 1449 #endif 1403 1450 xCheckRDCostIntra( rpcBestCU, rpcTempCU, SIZE_2Nx2N ); 1404 1451 rpcTempCU->initEstData( uiDepth, iQP ); … … 1418 1465 if( rpcTempCU->getWidth(0) > ( 1 << rpcTempCU->getSlice()->getSPS()->getQuadtreeTULog2MinSize() ) ) 1419 1466 { 1467 #if LGE_ILLUCOMP_B0045 1468 rpcTempCU->setICFlagSubParts(false, 0, 0, uiDepth); 1469 #endif 1420 1470 xCheckRDCostIntra( rpcBestCU, rpcTempCU, SIZE_NxN ); 1421 1471 rpcTempCU->initEstData( uiDepth, iQP ); … … 1451 1501 #endif 1452 1502 { 1503 #if LGE_ILLUCOMP_B0045 1504 rpcTempCU->setICFlagSubParts(false, 0, 0, uiDepth); 1505 #endif 1453 1506 xCheckIntraPCM (rpcBestCU, rpcTempCU); 1454 1507 rpcTempCU->initEstData( uiDepth, iQP ); … … 2094 2147 #endif 2095 2148 m_pcEntropyCoder->encodeMergeIndex( pcCU, uiAbsPartIdx, 0 ); 2149 #if LGE_ILLUCOMP_B0045 2150 m_pcEntropyCoder->encodeICFlag ( pcCU, uiAbsPartIdx ); 2151 #endif 2096 2152 #if HHI_INTER_VIEW_RESIDUAL_PRED 2097 2153 m_pcEntropyCoder->encodeResPredFlag( pcCU, uiAbsPartIdx, 0 ); … … 2122 2178 // prediction Info ( Intra : direction mode, Inter : Mv, reference idx ) 2123 2179 m_pcEntropyCoder->encodePredInfo( pcCU, uiAbsPartIdx ); 2180 #if LGE_ILLUCOMP_B0045 2181 m_pcEntropyCoder->encodeICFlag ( pcCU, uiAbsPartIdx ); 2182 #endif 2124 2183 #if HHI_INTER_VIEW_RESIDUAL_PRED 2125 2184 if( !pcCU->isIntra( uiAbsPartIdx ) ) … … 2165 2224 Bool bResPrdAvail = rpcTempCU->getResPredAvail( 0 ); 2166 2225 Bool bResPrdFlag = rpcTempCU->getResPredFlag ( 0 ); 2226 #endif 2227 #if LGE_ILLUCOMP_B0045 2228 Bool bICFlag = rpcTempCU->getICFlag(0); 2167 2229 #endif 2168 2230 … … 2239 2301 rpcTempCU->setResPredAvailSubParts( bResPrdAvail, 0, 0, uhDepth ); 2240 2302 rpcTempCU->setResPredFlagSubParts ( bResPrdFlag, 0, 0, uhDepth ); 2303 #endif 2304 #if LGE_ILLUCOMP_B0045 2305 rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uhDepth); 2241 2306 #endif 2242 2307 … … 3152 3217 { 3153 3218 m_pcEntropyCoder->encodeMergeIndex( pcCU, 0, 0, true ); 3219 #if LGE_ILLUCOMP_B0045 3220 m_pcEntropyCoder->encodeICFlag( pcCU, 0, true ); 3221 #endif 3154 3222 } 3155 3223 else … … 3159 3227 // prediction Info ( Intra : direction mode, Inter : Mv, reference idx ) 3160 3228 m_pcEntropyCoder->encodePredInfo( pcCU, 0, true ); 3229 #if LGE_ILLUCOMP_B0045 3230 m_pcEntropyCoder->encodeICFlag( pcCU, 0, true ); 3231 #endif 3161 3232 } 3162 3233 xRestoreDepthWidthHeight( pcCU ); -
branches/HTM-4.1-dev2-LG/source/Lib/TLibEncoder/TEncEntropy.cpp
r77 r152 169 169 } 170 170 171 #if LGE_ILLUCOMP_B0045 172 Void TEncEntropy::encodeICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD ) 173 { 174 if (pcCU->isIntra(uiAbsPartIdx) || (pcCU->getSlice()->getViewId() == 0) || pcCU->getSlice()->getSPS()->isDepth()) 175 { 176 return; 177 } 178 179 if(!pcCU->getSlice()->getApplyIC()) 180 return; 181 182 if( bRD ) 183 { 184 uiAbsPartIdx = 0; 185 } 186 187 if(pcCU->isICFlagRequired(uiAbsPartIdx)) 188 m_pcEntropyCoderIf->codeICFlag( pcCU, uiAbsPartIdx ); 189 } 190 #endif 191 171 192 Void TEncEntropy::codeFiltCountBit(ALFParam* pAlfParam, Int64* ruiRate) 172 193 { -
branches/HTM-4.1-dev2-LG/source/Lib/TLibEncoder/TEncEntropy.h
r100 r152 115 115 116 116 virtual Void codeSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 117 #if LGE_ILLUCOMP_B0045 118 virtual Void codeICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 119 #endif 117 120 virtual Void codeMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 118 121 virtual Void codeMergeIndex ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; … … 250 253 251 254 Void encodeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Bool bRD = false ); 255 #if LGE_ILLUCOMP_B0045 256 Void encodeICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); 257 #endif 252 258 Void encodeSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); 253 259 Void encodePUWise ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); -
branches/HTM-4.1-dev2-LG/source/Lib/TLibEncoder/TEncSbac.cpp
r116 r152 60 60 , m_cCUSplitFlagSCModel ( 1, 1, NUM_SPLIT_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels ) 61 61 , m_cCUSkipFlagSCModel ( 1, 1, NUM_SKIP_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 62 #if LGE_ILLUCOMP_B0045 63 , m_cCUICFlagSCModel ( 1, 1, NUM_IC_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 64 #endif 62 65 , m_cCUMergeFlagExtSCModel ( 1, 1, NUM_MERGE_FLAG_EXT_CTX , m_contextModels + m_numContextModels, m_numContextModels) 63 66 , m_cCUMergeIdxExtSCModel ( 1, 1, NUM_MERGE_IDX_EXT_CTX , m_contextModels + m_numContextModels, m_numContextModels) … … 141 144 142 145 m_cCUSkipFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SKIP_FLAG ); 146 #if LGE_ILLUCOMP_B0045 147 m_cCUICFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_IC_FLAG ); 148 #endif 143 149 m_cCUAlfCtrlFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ALF_CTRL_FLAG ); 144 150 m_cCUMergeFlagExtSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MERGE_FLAG_EXT); … … 224 230 curCost = m_cCUSplitFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_SPLIT_FLAG ); 225 231 curCost += m_cCUSkipFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_SKIP_FLAG ); 232 #if LGE_ILLUCOMP_B0045 233 curCost += m_cCUICFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_IC_FLAG ); 234 #endif 226 235 curCost += m_cCUAlfCtrlFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_ALF_CTRL_FLAG ); 227 236 curCost += m_cCUMergeFlagExtSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_MERGE_FLAG_EXT); … … 295 304 296 305 m_cCUSkipFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SKIP_FLAG ); 306 #if LGE_ILLUCOMP_B0045 307 m_cCUICFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_IC_FLAG ); 308 #endif 297 309 m_cCUAlfCtrlFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ALF_CTRL_FLAG ); 298 310 m_cCUMergeFlagExtSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MERGE_FLAG_EXT); … … 786 798 } 787 799 800 #if LGE_ILLUCOMP_B0045 801 /** code Illumination Compensation flag 802 * \param pcCU 803 * \param uiAbsPartIdx 804 * \returns Void 805 */ 806 Void TEncSbac::codeICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ) 807 { 808 // get context function is here 809 UInt uiSymbol = pcCU->getICFlag( uiAbsPartIdx ) ? 1 : 0; 810 UInt uiCtxIC = pcCU->getCtxICFlag( uiAbsPartIdx ) ; 811 m_pcBinIf->encodeBin( uiSymbol, m_cCUICFlagSCModel.get( 0, 0, uiCtxIC ) ); 812 DTRACE_CABAC_VL( g_nSymbolCounter++ ); 813 DTRACE_CABAC_T( "\tICFlag" ); 814 DTRACE_CABAC_T( "\tuiCtxIC: "); 815 DTRACE_CABAC_V( uiCtxIC ); 816 DTRACE_CABAC_T( "\tuiSymbol: "); 817 DTRACE_CABAC_V( uiSymbol ); 818 DTRACE_CABAC_T( "\n"); 819 } 820 #endif 821 788 822 /** code merge flag 789 823 * \param pcCU -
branches/HTM-4.1-dev2-LG/source/Lib/TLibEncoder/TEncSbac.h
r100 r152 202 202 Void codeAlfCtrlFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 203 203 Void codeSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 204 #if LGE_ILLUCOMP_B0045 205 Void codeICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 206 #endif 204 207 Void codeMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 205 208 Void codeMergeIndex ( TComDataCU* pcCU, UInt uiAbsPartIdx ); … … 260 263 ContextModel3DBuffer m_cCUSplitFlagSCModel; 261 264 ContextModel3DBuffer m_cCUSkipFlagSCModel; 265 #if LGE_ILLUCOMP_B0045 266 ContextModel3DBuffer m_cCUICFlagSCModel; 267 #endif 262 268 ContextModel3DBuffer m_cCUMergeFlagExtSCModel; 263 269 ContextModel3DBuffer m_cCUMergeIdxExtSCModel; -
branches/HTM-4.1-dev2-LG/source/Lib/TLibEncoder/TEncSearch.cpp
r145 r152 300 300 301 301 // distortion 302 #if LGE_ILLUCOMP_B0045 303 m_cDistParam.bUseIC = pcPatternKey->getICFlag(); 304 #endif 302 305 uiSad = m_cDistParam.DistFunc( &m_cDistParam ); 303 306 … … 717 720 718 721 m_cDistParam.pCur = piRefPos; 722 #if LGE_ILLUCOMP_B0045 723 m_cDistParam.bUseIC = pcPatternKey->getICFlag(); 724 #endif 719 725 uiDist = m_cDistParam.DistFunc( &m_cDistParam ); 720 726 uiDist += m_pcRdCost->getCost( cMvTest.getHor(), cMvTest.getVer() ); … … 2625 2631 iWidth, iHeight, m_pcEncCfg->getUseHADME() ); 2626 2632 #endif 2633 #if LGE_ILLUCOMP_B0045 2634 cDistParam.bUseIC = false; 2635 #endif 2627 2636 ruiErr = cDistParam.DistFunc( &cDistParam ); 2628 2637 } … … 3877 3886 cMvCand <<= 2; 3878 3887 #endif 3888 3889 #if LGE_ILLUCOMP_B0045 3890 Bool bICFlag = pcCU->getICFlag(uiPartAddr) && (pcCU->getSlice()->getViewId() != pcCU->getSlice()->getRefViewId(eRefPicList, iRefIdx)); 3891 #endif 3879 3892 // prediction pattern 3880 3893 if ( pcCU->getSlice()->getPPS()->getUseWP() && pcCU->getSlice()->getSliceType()==P_SLICE ) … … 3884 3897 else 3885 3898 { 3899 #if LGE_ILLUCOMP_B0045 3900 xPredInterLumaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cMvCand, iSizeX, iSizeY, pcTemplateCand, false, bICFlag ); 3901 #else 3886 3902 xPredInterLumaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cMvCand, iSizeX, iSizeY, pcTemplateCand, false ); 3903 #endif 3887 3904 } 3888 3905 … … 3938 3955 pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iRoiWidth, iRoiHeight ); 3939 3956 3957 #if LGE_ILLUCOMP_B0045 3958 Bool bICFlag = pcCU->getICFlag(uiPartAddr) && (pcCU->getSlice()->getViewId() != pcCU->getSlice()->getRefViewId(eRefPicList, iRefIdxPred)); 3959 pcPatternKey->setICFlag(bICFlag); 3960 #endif 3961 3940 3962 if ( bBi ) 3941 3963 { … … 4101 4123 setDistParamComp(0); 4102 4124 4125 #if LGE_ILLUCOMP_B0045 4126 m_cDistParam.bUseIC = pcPatternKey->getICFlag(); 4127 #endif 4103 4128 uiSad = m_cDistParam.DistFunc( &m_cDistParam ); 4104 4129 … … 4457 4482 m_pcEntropyCoder->encodeSkipFlag(pcCU, 0, true); 4458 4483 m_pcEntropyCoder->encodeMergeIndex( pcCU, 0, 0, true ); 4484 #if LGE_ILLUCOMP_B0045 4485 m_pcEntropyCoder->encodeICFlag(pcCU, 0, true); 4486 #endif 4459 4487 #if HHI_INTER_VIEW_RESIDUAL_PRED 4460 4488 m_pcEntropyCoder->encodeResPredFlag( pcCU, 0, 0, true ); … … 5822 5850 m_pcEntropyCoder->encodeSkipFlag(pcCU, 0, true); 5823 5851 m_pcEntropyCoder->encodeMergeIndex(pcCU, 0, 0, true); 5852 #if LGE_ILLUCOMP_B0045 5853 m_pcEntropyCoder->encodeICFlag(pcCU, 0, true); 5854 #endif 5824 5855 #if HHI_INTER_VIEW_RESIDUAL_PRED 5825 5856 m_pcEntropyCoder->encodeResPredFlag( pcCU, 0, 0, true ); … … 5842 5873 m_pcEntropyCoder->encodePartSize( pcCU, 0, pcCU->getDepth(0), true ); 5843 5874 m_pcEntropyCoder->encodePredInfo( pcCU, 0, true ); 5875 #if LGE_ILLUCOMP_B0045 5876 m_pcEntropyCoder->encodeICFlag(pcCU, 0, true); 5877 #endif 5844 5878 #if HHI_INTER_VIEW_RESIDUAL_PRED 5845 5879 m_pcEntropyCoder->encodeResPredFlag( pcCU, 0, 0, true ); -
branches/HTM-4.1-dev2-LG/source/Lib/TLibEncoder/TEncSlice.cpp
r120 r152 191 191 rpcSlice->setViewOrderIdx(m_pcCfg->getViewOrderIdx()); 192 192 #endif 193 193 #if LGE_ILLUCOMP_B0045 194 rpcSlice->setApplyIC(false); 195 #endif 194 196 // set mutliview parameters 195 197 rpcSlice->initMultiviewSlice( pcPic->getCodedScale(), pcPic->getCodedOffset() ); … … 768 770 Int iNumSubstreams = 1; 769 771 UInt uiTilesAcross = 0; 772 773 #if LGE_ILLUCOMP_B0045 774 if (pcEncTop->getViewId() != 0 && !pcEncTop->isDepthCoder() && pcEncTop->getUseIC()) // DCP of ViewID 0 is not available 775 { 776 pcSlice ->xSetApplyIC(); 777 } 778 #endif 770 779 771 780 if( m_pcCfg->getUseSBACRD() )
Note: See TracChangeset for help on using the changeset viewer.