Changeset 1313 in 3DVCSoftware for trunk/source/Lib/TLibRenderer/TRenFilter.cpp
- Timestamp:
- 13 Aug 2015, 17:38:13 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/Lib/TLibRenderer/TRenFilter.cpp
r1179 r1313 36 36 #include "TRenFilter.h" 37 37 #include "TRenInterpFilter.h" 38 #if H_3D38 #if NH_3D 39 39 40 40 ///// COMMON ///// 41 Void TRenFilter::setSubPelShiftLUT( Int iLutPrec, Int** piSubPelShiftLUT, Int iShift ) 41 template<UInt bitDepth> 42 Void TRenFilter<bitDepth>::setSubPelShiftLUT( Int iLutPrec, Int** piSubPelShiftLUT, Int iShift ) 42 43 { 43 44 //ToDo: use same rounding for left and right … … 59 60 } 60 61 } 61 62 Void TRenFilter ::setupZLUT( Bool bBlendUseDistWeight, Int iBlendZThresPerc, Int iRelDistToLeft, Int** ppiBaseShiftLUTLeft, Int** ppiBaseShiftLUTRight, Int& riBlendZThres, Int& riBlendDistWeight, Int* piInvZLUTLeft, Int* piInvZLUTRight )62 template<UInt bitDepth> 63 Void TRenFilter<bitDepth>::setupZLUT( Bool bBlendUseDistWeight, Int iBlendZThresPerc, Int iRelDistToLeft, Int** ppiBaseShiftLUTLeft, Int** ppiBaseShiftLUTRight, Int& riBlendZThres, Int& riBlendDistWeight, Int* piInvZLUTLeft, Int* piInvZLUTRight ) 63 64 { 64 65 AOT( iRelDistToLeft == -1 ); … … 75 76 } 76 77 77 Void TRenFilter::filledToUsedPelMap( PelImage* pcFilledImage, PelImage* pcUsedPelsImage, Int iUsedPelMapMarExt ) 78 template<UInt bitDepth> 79 Void TRenFilter<bitDepth>::filledToUsedPelMap( PelImage* pcFilledImage, PelImage* pcUsedPelsImage, Int iUsedPelMapMarExt ) 78 80 { 79 81 // Convert to binary map … … 156 158 157 159 /////////// Copy ///////////// 158 Void TRenFilter::copy(Pel* pcInputPlaneData, Int iInputStride, Int iWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride ) 160 template<UInt bitDepth> 161 Void TRenFilter<bitDepth>::copy(const Pel* pcInputPlaneData, Int iInputStride, Int iWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride ) 159 162 { 160 163 xDistributeArray(pcInputPlaneData, iInputStride, 1, 1, iWidth, iHeight ,pcOutputPlaneData, iOutputStride, 1 , 1 ); … … 163 166 164 167 /////////// Horizontal Mirror /////////// 165 template <typename T>166 Void TRenFilter ::mirrorHor( TRenImage<T> *pcImage )168 template<UInt bitDepth> template <typename T> 169 Void TRenFilter<bitDepth>::mirrorHor( TRenImage<T> *pcImage ) 167 170 { 168 171 for (UInt uCurPlane = 0 ; uCurPlane < pcImage->getNumberOfPlanes(); uCurPlane++ ) … … 172 175 } 173 176 174 template <typename T>175 Void TRenFilter ::mirrorHor( TRenImagePlane<T> *pcImagePlane )177 template<UInt bitDepth> template <typename T> 178 Void TRenFilter<bitDepth>::mirrorHor( TRenImagePlane<T> *pcImagePlane ) 176 179 { 177 180 T* pcPlaneData = pcImagePlane->getPlaneDataOrg(); … … 194 197 195 198 /////////// Comparison /////////// 196 Int64 TRenFilter::SSE (PelImagePlane* pcInputPlane1, PelImagePlane* pcInputPlane2, Bool bLuma ) 199 template<UInt bitDepth> 200 Int64 TRenFilter<bitDepth>::SSE (PelImagePlane* pcInputPlane1, PelImagePlane* pcInputPlane2, Bool bLuma ) 197 201 { 198 202 UInt uiWidth = pcInputPlane1->getWidth(); … … 208 212 } 209 213 210 Int64 TRenFilter::SSE( Pel* piSrc1, Int iSrcStride1, Int iWidth, Int iHeight, Pel* piSrc2, Int iSrcStride2, Bool bLuma ) 214 template<UInt bitDepth> 215 Int64 TRenFilter<bitDepth>::SSE( Pel* piSrc1, Int iSrcStride1, Int iWidth, Int iHeight, Pel* piSrc2, Int iSrcStride2, Bool bLuma ) 211 216 { 212 217 Int64 iSSE = 0; 213 218 214 219 215 Int iShift = DISTORTION_PRECISION_ADJUSTMENT( ( bLuma ? g_bitDepthY : g_bitDepthC )- 8 ) << 1 ;220 Int iShift = ( bitDepth - 8 ) << 1 ; 216 221 for(Int iPosY = 0; iPosY < iHeight; iPosY++) 217 222 { … … 227 232 } 228 233 229 template <typename T>230 Bool TRenFilter ::compare( TRenImage<T> *pInputImage1, TRenImage<T> *pInputImage2 )234 template<UInt bitDepth> template <typename T> 235 Bool TRenFilter<bitDepth>::compare( TRenImage<T> *pInputImage1, TRenImage<T> *pInputImage2 ) 231 236 { 232 237 Bool bIsEqual = true; … … 238 243 } 239 244 240 template <typename T>241 Bool TRenFilter ::compare (TRenImagePlane<T>* pcInputPlane1 , TRenImagePlane<T>* pcInputPlane2 )245 template<UInt bitDepth> template <typename T> 246 Bool TRenFilter<bitDepth>::compare (TRenImagePlane<T>* pcInputPlane1 , TRenImagePlane<T>* pcInputPlane2 ) 242 247 { 243 248 UInt uiWidth = pcInputPlane1->getWidth(); … … 265 270 266 271 /////////// Sampling /////////// 267 268 inline Void TRenFilter ::sampleUp2Tap13(PelImage* pcInputImage, PelImage* pcOutputImage)272 template<UInt bitDepth> 273 inline Void TRenFilter<bitDepth>::sampleUp2Tap13(PelImage* pcInputImage, PelImage* pcOutputImage) 269 274 { // UpSampling from JSVM Software (DownConvertStatic) ??? 270 275 271 AOF( g_bitDepthC == g_bitDepthY );272 276 UInt uiNumPlanes = pcInputImage->getNumberOfPlanes(); 273 277 … … 400 404 { 401 405 // Scale and copy to image buffer. 402 pcOutputPlaneData[iOffset+i] = Clip Y((Pel) ((piDst[i] + iAddH) / iDivH));406 pcOutputPlaneData[iOffset+i] = ClipBD((Pel) ((piDst[i] + iAddH) / iDivH), bitDepth); 403 407 } 404 408 } … … 410 414 } 411 415 412 413 Void TRenFilter ::sampleDown2Tap13(PelImage* pcInputImage, PelImage* pcOutputImage)416 template<UInt bitDepth> 417 Void TRenFilter<bitDepth>::sampleDown2Tap13(PelImage* pcInputImage, PelImage* pcOutputImage) 414 418 { // DownSampling from JSVM Software (DownConvertStatic) ?? 415 419 … … 422 426 }; 423 427 424 Void TRenFilter::sampleDown2Tap13( Pel* pcInputPlaneData, Int iInputStride, Int iWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride ) 428 template<UInt bitDepth> 429 Void TRenFilter<bitDepth>::sampleDown2Tap13( Pel* pcInputPlaneData, Int iInputStride, Int iWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride ) 425 430 { // DownSampling from JSVM Software (DownConvertStatic) ?? 426 427 AOF( g_bitDepthC == g_bitDepthY );428 431 429 432 Int iOffset, iPosX, iPosY, k; … … 549 552 { 550 553 // Scale and copy back to image buffer. 551 pcOutputPlaneData[iOutputStride*iPosY+iPosX] = Clip Y( ( Pel) ( (piDst[iPosY] + iAddV) / iDivV));554 pcOutputPlaneData[iOutputStride*iPosY+iPosX] = ClipBD( ( Pel) ( (piDst[iPosY] + iAddV) / iDivV), bitDepth ); 552 555 } 553 556 } … … 557 560 } 558 561 559 Void TRenFilter::sampleDown2Tap13(PelImagePlane* pcInputPlane, PelImagePlane* pcOutputPlane) 562 template<UInt bitDepth> 563 Void TRenFilter<bitDepth>::sampleDown2Tap13(PelImagePlane* pcInputPlane, PelImagePlane* pcOutputPlane) 560 564 { // DownSampling from JSVM Software (DownConvertStatic) ?? 561 565 Int iWidth = pcInputPlane->getWidth(); … … 574 578 }; 575 579 576 Void TRenFilter::sampleVerDown2Tap13( PelImagePlane* pcInputPlane, PelImagePlane* pcOutputPlane, Int uiPad) 577 { 578 assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth580 template<UInt bitDepth> 581 Void TRenFilter<bitDepth>::sampleVerDown2Tap13( PelImagePlane* pcInputPlane, PelImagePlane* pcOutputPlane, Int uiPad) 582 { 579 583 // DownSampling from JSVM Software (DownConvertStatic) ?? 580 584 Int iWidth = pcInputPlane->getWidth(); … … 622 626 623 627 Int iSum = iTmp4 + iTmp3 - iTmp2 + ((iTmp0 + iTmp4 + iTmp5 - iTmp2) << 1) + ( ( iTmp3 - iTmp1) << 2) + ( iTmp5 << 3 ) + (( iTmp4 + iTmp5 ) << 4); 624 pcOutputPlaneData[ iXPos ] = (Pel) Clip Y((iSum + 32) >> 6);628 pcOutputPlaneData[ iXPos ] = (Pel) ClipBD((iSum + 32) >> 6, bitDepth); 625 629 pcTmpIn++; 626 630 } … … 630 634 }; 631 635 632 Void TRenFilter::sampleHorDown2Tap13( PelImagePlane* pcInputPlane, PelImagePlane* pcOutputPlane, Int uiPad ) 636 template<UInt bitDepth> 637 Void TRenFilter<bitDepth>::sampleHorDown2Tap13( PelImagePlane* pcInputPlane, PelImagePlane* pcOutputPlane, Int uiPad ) 633 638 { 634 assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth 635 // DownSampling from JSVM Software (DownConvertStatic) ?? 639 // DownSampling from JSVM Software (DownConvertStatic) ?? 636 640 Int iWidth = pcInputPlane->getWidth(); 637 641 Int iHeight = pcInputPlane->getHeight(); … … 663 667 664 668 Int iSum = iTmp4 + iTmp3 - iTmp2 + ((iTmp0 + iTmp4 + iTmp5 - iTmp2) << 1) + ( ( iTmp3 - iTmp1) << 2) + ( iTmp5 << 3 ) + (( iTmp4 + iTmp5 ) << 4); 665 pcOutputPlaneData[ iXPos ] = (Pel) Clip Y((iSum + 32) >> 6);669 pcOutputPlaneData[ iXPos ] = (Pel) ClipBD((iSum + 32) >> 6, bitDepth); 666 670 pcTmpIn += 2; 667 671 } … … 671 675 }; 672 676 673 inline Pel TRenFilter::xMedian3(Pel* pcData) 677 template<UInt bitDepth> 678 inline Pel TRenFilter<bitDepth>::xMedian3(Pel* pcData) 674 679 { 675 680 Bool bGT01 = pcData[0] > pcData[1]; … … 680 685 } 681 686 682 683 Void TRenFilter ::lineMedian3( PelImage* pcImage )687 template<UInt bitDepth> 688 Void TRenFilter<bitDepth>::lineMedian3( PelImage* pcImage ) 684 689 { 685 690 … … 722 727 } 723 728 724 725 Void TRenFilter ::convRect( PelImage* pcImage, UInt uiSize )729 template<UInt bitDepth> 730 Void TRenFilter<bitDepth>::convRect( PelImage* pcImage, UInt uiSize ) 726 731 { 727 732 DoubleImage cKernel(uiSize, uiSize,1,0); … … 730 735 } 731 736 732 Void TRenFilter::binominal( PelImage* pcInputImage, PelImage* pcOutputImage, UInt uiSize ) 737 template<UInt bitDepth> 738 Void TRenFilter<bitDepth>::binominal( PelImage* pcInputImage, PelImage* pcOutputImage, UInt uiSize ) 733 739 { 734 740 assert( pcInputImage->getNumberOfFullPlanes() == pcOutputImage->getNumberOfFullPlanes () ); … … 747 753 } 748 754 749 Void TRenFilter::binominal( PelImagePlane* pcInputPlane, PelImagePlane* pcOutputPlane, UInt uiSize ) 755 template<UInt bitDepth> 756 Void TRenFilter<bitDepth>::binominal( PelImagePlane* pcInputPlane, PelImagePlane* pcOutputPlane, UInt uiSize ) 750 757 { 751 758 Int iWidth = pcInputPlane ->getWidth (); … … 777 784 { 778 785 case 1: 779 fpFilter = &TRenFilter ::xFiltBinom3;786 fpFilter = &TRenFilter<bitDepth>::xFiltBinom3; 780 787 break; 781 788 case 2: 782 fpFilter = &TRenFilter ::xFiltBinom5;789 fpFilter = &TRenFilter<bitDepth>::xFiltBinom5; 783 790 break; 784 791 case 3: 785 fpFilter = &TRenFilter ::xFiltBinom7;792 fpFilter = &TRenFilter<bitDepth>::xFiltBinom7; 786 793 break; 787 794 case 4: 788 fpFilter = &TRenFilter ::xFiltBinom9;795 fpFilter = &TRenFilter<bitDepth>::xFiltBinom9; 789 796 break; 790 797 default: … … 818 825 } 819 826 820 Pel TRenFilter::xFiltBinom3( Pel* pcInputData, Int iStride ) 821 { 822 assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth 823 827 template<UInt bitDepth> 828 Pel TRenFilter<bitDepth>::xFiltBinom3( Pel* pcInputData, Int iStride ) 829 { 824 830 Int iSum = pcInputData[-1 * iStride ] + pcInputData[ 0 ] + (pcInputData[iStride ] << 1 ); 825 return Clip Y( (iSum + 2) >> 2);826 } 827 828 Pel TRenFilter::xFiltBinom5( Pel* pcInputData, Int iStride ) 829 { 830 assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth 831 // { 1,4,6,4,1 }831 return ClipBD( (iSum + 2) >> 2 , bitDepth); 832 } 833 834 template<UInt bitDepth> 835 Pel TRenFilter<bitDepth>::xFiltBinom5( Pel* pcInputData, Int iStride ) 836 { 837 // { 1,4,6,4,1 } 832 838 Int iStride0 = 0; 833 839 Int iStrideM1 = iStride0 - iStride; … … 841 847 842 848 Int iSum = iTmp0 + (iTmp2 << 1) + ((iTmp1 + iTmp2) << 2); 843 return Clip Y( (iSum + 8) >> 4);844 } 845 846 Pel TRenFilter::xFiltBinom7( Pel* pcInputData, Int iStride ) 847 { 848 assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth 849 // { 1,6,15,20,15,6,1 }849 return ClipBD( (iSum + 8) >> 4 , bitDepth); 850 } 851 852 template<UInt bitDepth> 853 Pel TRenFilter<bitDepth>::xFiltBinom7( Pel* pcInputData, Int iStride ) 854 { 855 // { 1,6,15,20,15,6,1 } 850 856 Int iStride0 = 0; 851 857 Int iStrideM1 = iStride0 - iStride; … … 863 869 Int iSum = iTmp0 - iTmp2 + ( iTmp1 << 1) + ( (iTmp1 + iTmp3) << 2) + ((iTmp2 + iTmp3) << 4); 864 870 865 return Clip Y( (iSum + 32) >> 6);866 } 867 868 Pel TRenFilter::xFiltBinom9( Pel* pcInputData, Int iStride ) 869 { 870 assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth871 return ClipBD( (iSum + 32) >> 6 , bitDepth); 872 } 873 874 template<UInt bitDepth> 875 Pel TRenFilter<bitDepth>::xFiltBinom9( Pel* pcInputData, Int iStride ) 876 { 871 877 // { 1 8 28 56 70 56 28 8 1 } 872 878 Int iStride0 = 0; … … 888 894 Int iSum = iTmp0 + ((iTmp4 ) << 1) + ( ( iTmp4 - iTmp2 ) << 2) + ( (iTmp1 - iTmp3) << 3 ) + ((iTmp2 ) << 5) + ((iTmp3+ iTmp4 ) << 6); 889 895 890 return Clip Y( (iSum + 128) >> 8);891 } 892 893 894 Pel TRenFilter ::interpCHSpline(Double dX, Double dS0, Double dS1, Int iQ0, Int iQ1, Int iQ2, Int iQ3)896 return ClipBD( (iSum + 128) >> 8 , bitDepth); 897 } 898 899 template<UInt bitDepth> 900 Pel TRenFilter<bitDepth>::interpCHSpline(Double dX, Double dS0, Double dS1, Int iQ0, Int iQ1, Int iQ2, Int iQ3) 895 901 { 896 902 Double dSq = (dX - dS0) / (dS1 - dS0); … … 916 922 } 917 923 918 Void TRenFilter::diffHorSym(PelImage* pcInputImage, IntImage* pcOutputImage) 924 template<UInt bitDepth> 925 Void TRenFilter<bitDepth>::diffHorSym(PelImage* pcInputImage, IntImage* pcOutputImage) 919 926 { 920 927 for (UInt uiCurPlane = 0; uiCurPlane < pcInputImage->getNumberOfPlanes(); uiCurPlane++) … … 924 931 } 925 932 926 Void TRenFilter::diffHorSym(PelImagePlane* pcInputPlane, IntImagePlane* pcOutputPlane) 933 template<UInt bitDepth> 934 Void TRenFilter<bitDepth>::diffHorSym(PelImagePlane* pcInputPlane, IntImagePlane* pcOutputPlane) 927 935 { 928 936 UInt uiInputStride = pcInputPlane ->getStride(); … … 950 958 } 951 959 952 Void TRenFilter::laplace( DoubleImage* pcInputImage, DoubleImage* pcOutputImage ) 960 template<UInt bitDepth> 961 Void TRenFilter<bitDepth>::laplace( DoubleImage* pcInputImage, DoubleImage* pcOutputImage ) 953 962 { 954 963 for (UInt uiCurPlane = 0; uiCurPlane < pcInputImage->getNumberOfPlanes(); uiCurPlane++) … … 1022 1031 } 1023 1032 1024 1025 Void TRenFilter ::conv( PelImage* pcImage, DoubleImage* pcKernel )1033 template<UInt bitDepth> 1034 Void TRenFilter<bitDepth>::conv( PelImage* pcImage, DoubleImage* pcKernel ) 1026 1035 { 1027 1036 PelImage* pcTemp = pcImage->create(); … … 1096 1105 1097 1106 // Horizontal Up sampling luma 1098 Void TRenFilter::sampleHorUp( Int iLog2HorSampFac, Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride ) 1099 { 1100 TRenInterpFilter cFilter; 1107 template<UInt bitDepth> 1108 Void TRenFilter<bitDepth>::sampleHorUp( Int iLog2HorSampFac, Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride ) 1109 { 1110 TRenInterpFilter<bitDepth> cFilter; 1101 1111 switch ( iLog2HorSampFac ) 1102 1112 { … … 1118 1128 1119 1129 // horizontal up sampling chroma 1120 Void TRenFilter::sampleCHorUp(Int iLog2HorSampFac, Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride ) 1130 template<UInt bitDepth> 1131 Void TRenFilter<bitDepth>::sampleCHorUp(Int iLog2HorSampFac, Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride ) 1121 1132 { 1122 1133 switch ( iLog2HorSampFac ) … … 1127 1138 case 1: 1128 1139 xDistributeArray( pcInputPlaneData, iInputStride , 1, 1, iInputWidth, iHeight , pcOutputPlaneData , iOutputStride, 2 , 1 ); 1129 xInterpHorChroma( pcInputPlaneData , iInputStride , 1, 1, iInputWidth, iHeight , pcOutputPlaneData +1, iOutputStride, 2 , 1, &TRenInterpFilter ::xCTI_Filter_VPS04_C_HAL );1140 xInterpHorChroma( pcInputPlaneData , iInputStride , 1, 1, iInputWidth, iHeight , pcOutputPlaneData +1, iOutputStride, 2 , 1, &TRenInterpFilter<REN_BIT_DEPTH>::xCTI_Filter_VPS04_C_HAL ); 1130 1141 break; 1131 1142 case 2: 1132 1143 xDistributeArray( pcInputPlaneData, iInputStride , 1, 1, iInputWidth, iHeight , pcOutputPlaneData , iOutputStride, 4 , 1 ); 1133 xInterpHorChroma( pcInputPlaneData , iInputStride , 1, 1, iInputWidth, iHeight , pcOutputPlaneData +1, iOutputStride, 4 , 1, &TRenInterpFilter::xCTI_Filter_VP04_C_QUA0 ); 1134 xInterpHorChroma( pcInputPlaneData , iInputStride , 1, 1, iInputWidth, iHeight , pcOutputPlaneData +2, iOutputStride, 4 , 1, &TRenInterpFilter::xCTI_Filter_VPS04_C_HAL ); 1135 xInterpHorChroma( pcInputPlaneData , iInputStride , 1, 1, iInputWidth, iHeight , pcOutputPlaneData +3, iOutputStride, 4 , 1, &TRenInterpFilter::xCTI_Filter_VP04_C_QUA1 ); 1136 break; 1137 } 1138 } 1139 1140 Void TRenFilter::sampleCUpHorUp( Int iLog2HorSampFac, Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride ) 1144 xInterpHorChroma( pcInputPlaneData , iInputStride , 1, 1, iInputWidth, iHeight , pcOutputPlaneData +1, iOutputStride, 4 , 1, &TRenInterpFilter<REN_BIT_DEPTH>::xCTI_Filter_VP04_C_QUA0 ); 1145 xInterpHorChroma( pcInputPlaneData , iInputStride , 1, 1, iInputWidth, iHeight , pcOutputPlaneData +2, iOutputStride, 4 , 1, &TRenInterpFilter<REN_BIT_DEPTH>::xCTI_Filter_VPS04_C_HAL ); 1146 xInterpHorChroma( pcInputPlaneData , iInputStride , 1, 1, iInputWidth, iHeight , pcOutputPlaneData +3, iOutputStride, 4 , 1, &TRenInterpFilter<REN_BIT_DEPTH>::xCTI_Filter_VP04_C_QUA1 ); 1147 break; 1148 } 1149 } 1150 1151 template<UInt bitDepth> 1152 Void TRenFilter<bitDepth>::sampleCUpHorUp( Int iLog2HorSampFac, Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride ) 1141 1153 { 1142 1154 … … 1145 1157 case 0: 1146 1158 xDistributeArray( pcInputPlaneData-1, iInputStride , 1, 1, iInputWidth+3, iHeight , pcOutputPlaneData -2, iOutputStride, 2, 2 ); 1147 xInterpVerChroma( pcInputPlaneData-1, iInputStride , 1, 1, iInputWidth+3, iHeight , pcOutputPlaneData+1*iOutputStride-2, iOutputStride, 2 , 2, &TRenInterpFilter ::xCTI_Filter_VPS04_C_HAL );1148 xInterpHorChroma( pcOutputPlaneData , iOutputStride , 2, 1, iInputWidth, iHeight*2 , pcOutputPlaneData+1 , iOutputStride, 2 , 1, &TRenInterpFilter ::xCTI_Filter_VPS04_C_HAL );1159 xInterpVerChroma( pcInputPlaneData-1, iInputStride , 1, 1, iInputWidth+3, iHeight , pcOutputPlaneData+1*iOutputStride-2, iOutputStride, 2 , 2, &TRenInterpFilter<REN_BIT_DEPTH>::xCTI_Filter_VPS04_C_HAL ); 1160 xInterpHorChroma( pcOutputPlaneData , iOutputStride , 2, 1, iInputWidth, iHeight*2 , pcOutputPlaneData+1 , iOutputStride, 2 , 1, &TRenInterpFilter<REN_BIT_DEPTH>::xCTI_Filter_VPS04_C_HAL ); 1149 1161 break; 1150 1162 case 1: 1151 1163 xDistributeArray( pcInputPlaneData-1, iInputStride , 1, 1, iInputWidth+3, iHeight , pcOutputPlaneData -4, iOutputStride, 4 , 2 ); 1152 xInterpVerChroma( pcInputPlaneData-1, iInputStride , 1, 1, iInputWidth+3, iHeight , pcOutputPlaneData+1*iOutputStride-4, iOutputStride, 4 , 2, &TRenInterpFilter ::xCTI_Filter_VPS04_C_HAL );1153 xInterpHorChroma( pcOutputPlaneData , iOutputStride , 4, 1, iInputWidth, iHeight*2 , pcOutputPlaneData +1, iOutputStride, 4 , 1, &TRenInterpFilter ::xCTI_Filter_VP04_C_QUA0 );1154 xInterpHorChroma( pcOutputPlaneData , iOutputStride , 4, 1, iInputWidth, iHeight*2 , pcOutputPlaneData +2, iOutputStride, 4 , 1, &TRenInterpFilter ::xCTI_Filter_VPS04_C_HAL );1155 xInterpHorChroma( pcOutputPlaneData , iOutputStride , 4, 1, iInputWidth, iHeight*2 , pcOutputPlaneData +3, iOutputStride, 4 , 1, &TRenInterpFilter ::xCTI_Filter_VP04_C_QUA1 );1164 xInterpVerChroma( pcInputPlaneData-1, iInputStride , 1, 1, iInputWidth+3, iHeight , pcOutputPlaneData+1*iOutputStride-4, iOutputStride, 4 , 2, &TRenInterpFilter<REN_BIT_DEPTH>::xCTI_Filter_VPS04_C_HAL ); 1165 xInterpHorChroma( pcOutputPlaneData , iOutputStride , 4, 1, iInputWidth, iHeight*2 , pcOutputPlaneData +1, iOutputStride, 4 , 1, &TRenInterpFilter<REN_BIT_DEPTH>::xCTI_Filter_VP04_C_QUA0 ); 1166 xInterpHorChroma( pcOutputPlaneData , iOutputStride , 4, 1, iInputWidth, iHeight*2 , pcOutputPlaneData +2, iOutputStride, 4 , 1, &TRenInterpFilter<REN_BIT_DEPTH>::xCTI_Filter_VPS04_C_HAL ); 1167 xInterpHorChroma( pcOutputPlaneData , iOutputStride , 4, 1, iInputWidth, iHeight*2 , pcOutputPlaneData +3, iOutputStride, 4 , 1, &TRenInterpFilter<REN_BIT_DEPTH>::xCTI_Filter_VP04_C_QUA1 ); 1156 1168 break; 1157 1169 case 2: 1158 1170 xDistributeArray( pcInputPlaneData-1, iInputStride , 1, 1, iInputWidth+3, iHeight , pcOutputPlaneData -8, iOutputStride, 8 , 2 ); 1159 xInterpVerChroma( pcInputPlaneData-1, iInputStride , 1, 1, iInputWidth+3, iHeight , pcOutputPlaneData+1*iOutputStride-8, iOutputStride, 8 , 2, &TRenInterpFilter ::xCTI_Filter_VPS04_C_HAL );1160 xInterpHorChroma( pcOutputPlaneData , iOutputStride , 8, 1, iInputWidth, iHeight*2 , pcOutputPlaneData +1, iOutputStride, 8 , 1, &TRenInterpFilter ::xCTI_Filter_VP04_C_OCT0 );1161 xInterpHorChroma( pcOutputPlaneData , iOutputStride , 8, 1, iInputWidth, iHeight*2 , pcOutputPlaneData +2, iOutputStride, 8 , 1, &TRenInterpFilter ::xCTI_Filter_VP04_C_QUA0 );1162 xInterpHorChroma( pcOutputPlaneData , iOutputStride , 8, 1, iInputWidth, iHeight*2 , pcOutputPlaneData +3, iOutputStride, 8 , 1, &TRenInterpFilter ::xCTI_Filter_VP04_C_OCT1 );1163 xInterpHorChroma( pcOutputPlaneData , iOutputStride , 8, 1, iInputWidth, iHeight*2 , pcOutputPlaneData +4, iOutputStride, 8 , 1, &TRenInterpFilter ::xCTI_Filter_VPS04_C_HAL );1164 xInterpHorChroma( pcOutputPlaneData , iOutputStride , 8, 1, iInputWidth, iHeight*2 , pcOutputPlaneData +5, iOutputStride, 8 , 1, &TRenInterpFilter ::xCTI_Filter_VP04_C_OCT2 );1165 xInterpHorChroma( pcOutputPlaneData , iOutputStride , 8, 1, iInputWidth, iHeight*2 , pcOutputPlaneData +6, iOutputStride, 8 , 1, &TRenInterpFilter ::xCTI_Filter_VP04_C_QUA1 );1166 xInterpHorChroma( pcOutputPlaneData , iOutputStride , 8, 1, iInputWidth, iHeight*2 , pcOutputPlaneData +7, iOutputStride, 8 , 1, &TRenInterpFilter ::xCTI_Filter_VP04_C_OCT3 );1171 xInterpVerChroma( pcInputPlaneData-1, iInputStride , 1, 1, iInputWidth+3, iHeight , pcOutputPlaneData+1*iOutputStride-8, iOutputStride, 8 , 2, &TRenInterpFilter<REN_BIT_DEPTH>::xCTI_Filter_VPS04_C_HAL ); 1172 xInterpHorChroma( pcOutputPlaneData , iOutputStride , 8, 1, iInputWidth, iHeight*2 , pcOutputPlaneData +1, iOutputStride, 8 , 1, &TRenInterpFilter<REN_BIT_DEPTH>::xCTI_Filter_VP04_C_OCT0 ); 1173 xInterpHorChroma( pcOutputPlaneData , iOutputStride , 8, 1, iInputWidth, iHeight*2 , pcOutputPlaneData +2, iOutputStride, 8 , 1, &TRenInterpFilter<REN_BIT_DEPTH>::xCTI_Filter_VP04_C_QUA0 ); 1174 xInterpHorChroma( pcOutputPlaneData , iOutputStride , 8, 1, iInputWidth, iHeight*2 , pcOutputPlaneData +3, iOutputStride, 8 , 1, &TRenInterpFilter<REN_BIT_DEPTH>::xCTI_Filter_VP04_C_OCT1 ); 1175 xInterpHorChroma( pcOutputPlaneData , iOutputStride , 8, 1, iInputWidth, iHeight*2 , pcOutputPlaneData +4, iOutputStride, 8 , 1, &TRenInterpFilter<REN_BIT_DEPTH>::xCTI_Filter_VPS04_C_HAL ); 1176 xInterpHorChroma( pcOutputPlaneData , iOutputStride , 8, 1, iInputWidth, iHeight*2 , pcOutputPlaneData +5, iOutputStride, 8 , 1, &TRenInterpFilter<REN_BIT_DEPTH>::xCTI_Filter_VP04_C_OCT2 ); 1177 xInterpHorChroma( pcOutputPlaneData , iOutputStride , 8, 1, iInputWidth, iHeight*2 , pcOutputPlaneData +6, iOutputStride, 8 , 1, &TRenInterpFilter<REN_BIT_DEPTH>::xCTI_Filter_VP04_C_QUA1 ); 1178 xInterpHorChroma( pcOutputPlaneData , iOutputStride , 8, 1, iInputWidth, iHeight*2 , pcOutputPlaneData +7, iOutputStride, 8 , 1, &TRenInterpFilter<REN_BIT_DEPTH>::xCTI_Filter_VP04_C_OCT3 ); 1167 1179 break; 1168 1180 } … … 1171 1183 // Down Sampling 1172 1184 // Down sample luma 1173 Void TRenFilter::sampleHorDown(Int iLog2HorSampFac, Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride ) 1185 template<UInt bitDepth> 1186 Void TRenFilter<bitDepth>::sampleHorDown(Int iLog2HorSampFac, Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride ) 1174 1187 { 1175 1188 switch ( iLog2HorSampFac ) … … 1187 1200 } 1188 1201 1189 1190 Void TRenFilter ::sampleCHorDown(Int iLog2HorSampFac, Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride )1202 template<UInt bitDepth> 1203 Void TRenFilter<bitDepth>::sampleCHorDown(Int iLog2HorSampFac, Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride ) 1191 1204 { 1192 1205 //GT: currently the same as for luma … … 1197 1210 1198 1211 // Up sampling chroma 1199 Void TRenFilter::sampleCDownHorDown( Int iLog2HorSampFac, Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iInputHeight, Pel* pcOutputPlaneData, Int iOutputStride ) 1212 template<UInt bitDepth> 1213 Void TRenFilter<bitDepth>::sampleCDownHorDown( Int iLog2HorSampFac, Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iInputHeight, Pel* pcOutputPlaneData, Int iOutputStride ) 1200 1214 { 1201 1215 // create buffer … … 1219 1233 } 1220 1234 1221 Void TRenFilter::xDistributeArray(Pel* pcSrc, Int iSrcStride, Int iSrcStepX, Int iSrcStepY, Int iWidth, Int iHeight, Pel* pcDst, Int iDstStride, Int iDstStepX, Int iDstStepY) 1235 template<UInt bitDepth> 1236 Void TRenFilter<bitDepth>::xDistributeArray(const Pel* pcSrc, Int iSrcStride, Int iSrcStepX, Int iSrcStepY, Int iWidth, Int iHeight, Pel* pcDst, Int iDstStride, Int iDstStepX, Int iDstStepY) 1222 1237 { 1223 1238 iDstStride *= iDstStepY; … … 1226 1241 { 1227 1242 Pel* pcCurDst = pcDst; 1228 Pel* pcCurSrc = pcSrc;1243 const Pel* pcCurSrc = pcSrc; 1229 1244 for (Int iXPos = 0; iXPos < iWidth; iXPos ++) 1230 1245 { … … 1239 1254 } 1240 1255 1241 Void TRenFilter::xInterpHorChroma( Pel* piSrc, Int iSrcStride, Int iSrcStepX, Int iSrcStepY, Int iWidth, Int iHeight, Pel* piDst, Int iDstStride, Int iDstStepX, Int iDstStepY, FpChromaIntFilt fpFilter ) 1242 { 1243 assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth 1256 template<UInt bitDepth> 1257 Void TRenFilter<bitDepth>::xInterpHorChroma( Pel* piSrc, Int iSrcStride, Int iSrcStepX, Int iSrcStepY, Int iWidth, Int iHeight, Pel* piDst, Int iDstStride, Int iDstStepX, Int iDstStepY, FpChromaIntFilt fpFilter ) 1258 { 1244 1259 Int iSum; 1245 1260 Pel* piSrcTmp; 1246 1261 1247 TRenInterpFilter cFilter;1262 TRenInterpFilter<REN_BIT_DEPTH> cFilter; 1248 1263 for ( Int y = iHeight; y != 0; y-- ) 1249 1264 { … … 1252 1267 { 1253 1268 iSum = (cFilter.*fpFilter)( piSrcTmp, iSrcStepX ); 1254 piDst[x * iDstStepX ] = Clip C ((iSum + 32) >> 6);1269 piDst[x * iDstStepX ] = ClipBD ((iSum + 32) >> 6 , bitDepth); 1255 1270 piSrcTmp+= iSrcStepX; 1256 1271 } … … 1260 1275 } 1261 1276 1262 Void TRenFilter::xInterpVerChroma( Pel* piSrc, Int iSrcStride, Int iSrcStepX, Int iSrcStepY, Int iWidth, Int iHeight, Pel* piDst, Int iDstStride, Int iDstStepX, Int iDstStepY, FpChromaIntFilt fpFilter ) 1263 { 1264 assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth1277 template<UInt bitDepth> 1278 Void TRenFilter<bitDepth>::xInterpVerChroma( Pel* piSrc, Int iSrcStride, Int iSrcStepX, Int iSrcStepY, Int iWidth, Int iHeight, Pel* piDst, Int iDstStride, Int iDstStepX, Int iDstStepY, FpChromaIntFilt fpFilter ) 1279 { 1265 1280 Int iSum; 1266 1281 Pel* piSrcTmp; 1267 1282 1268 TRenInterpFilter cFilter;1283 TRenInterpFilter<bitDepth> cFilter; 1269 1284 for ( Int y = iHeight; y != 0; y-- ) 1270 1285 { … … 1273 1288 { 1274 1289 iSum = (cFilter.*fpFilter)( piSrcTmp, iSrcStepY * iSrcStride ); 1275 piDst[x * iDstStepX ] = Clip C ((iSum + 32) >> 6);1290 piDst[x * iDstStepX ] = ClipBD ((iSum + 32) >> 6, bitDepth ); 1276 1291 piSrcTmp += iSrcStepX; 1277 1292 } … … 1281 1296 } 1282 1297 1283 1284 Void TRenFilter::xSampleDownHor2( Pel* piSrc, Int iSrcStride, Int iSrcWidth, Int iHeight, Pel* piDst, Int iDstStride ) 1285 { 1286 1287 assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth 1298 template<UInt bitDepth> 1299 Void TRenFilter<bitDepth>::xSampleDownHor2( Pel* piSrc, Int iSrcStride, Int iSrcWidth, Int iHeight, Pel* piDst, Int iDstStride ) 1300 { 1288 1301 1289 1302 Int iSum; … … 1298 1311 // { 1,2,1 } 1299 1312 iSum = piSrcTmp[0] + piSrcTmp[2] + (piSrcTmp[1] << 1); 1300 piDst[x] = Clip Y( (iSum + 2) >> 2);1313 piDst[x] = ClipBD( (iSum + 2) >> 2 , bitDepth); 1301 1314 piSrcTmp += 2; 1302 1315 } … … 1306 1319 }; 1307 1320 1308 Void TRenFilter::xSampleDownVer2( Pel* piSrc, Int iSrcStride, Int iSrcWidth, Int iSrcHeight, Pel* piDst, Int iDstStride ) 1309 { 1310 assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth 1311 1321 template<UInt bitDepth> 1322 Void TRenFilter<bitDepth>::xSampleDownVer2( Pel* piSrc, Int iSrcStride, Int iSrcWidth, Int iSrcHeight, Pel* piDst, Int iDstStride ) 1323 { 1312 1324 Int iSum; 1313 1325 Pel* piSrcTmp; … … 1320 1332 // { 1,2,1 } 1321 1333 iSum = piSrcTmp[0] + piSrcTmp[ iSrcStride << 1] + (piSrcTmp[ iSrcStride ] << 1); 1322 piDst[x] = Clip Y( (iSum + 2) >> 2);1334 piDst[x] = ClipBD( (iSum + 2) >> 2, bitDepth ); 1323 1335 piSrcTmp += 1; 1324 1336 } … … 1328 1340 }; 1329 1341 1330 Void TRenFilter::xSampleDownHor4( Pel* piSrc, Int iSrcStride, Int iSrcWidth, Int iHeight, Pel* piDst, Int iDstStride ) 1331 { 1332 assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth1342 template<UInt bitDepth> 1343 Void TRenFilter<bitDepth>::xSampleDownHor4( Pel* piSrc, Int iSrcStride, Int iSrcWidth, Int iHeight, Pel* piDst, Int iDstStride ) 1344 { 1333 1345 1334 1346 Int iSum; … … 1348 1360 1349 1361 iSum = iTmp0 + (iTmp2 << 1) + ((iTmp1 + iTmp2) << 2); 1350 piDst[x] = Clip Y( (iSum + 8) >> 4);1362 piDst[x] = ClipBD( (iSum + 8) >> 4, bitDepth ); 1351 1363 piSrcTmp += 4; 1352 1364 } … … 1356 1368 }; 1357 1369 1358 Void TRenFilter::xSampleDownHor8( Pel* piSrc, Int iSrcStride, Int iSrcWidth, Int iHeight, Pel* piDst, Int iDstStride ) 1359 { 1360 assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth 1361 1370 template<UInt bitDepth> 1371 Void TRenFilter<bitDepth>::xSampleDownHor8( Pel* piSrc, Int iSrcStride, Int iSrcWidth, Int iHeight, Pel* piDst, Int iDstStride ) 1372 { 1362 1373 Int iSum; 1363 1374 Pel* piSrcTmp; … … 1377 1388 1378 1389 iSum = iTmp0 - iTmp2 + ( iTmp1 << 1) + ( (iTmp1 + iTmp3) << 2) + ((iTmp2 + iTmp3) << 4); 1379 piDst[x] = Clip Y( (iSum + 32) >> 6);1390 piDst[x] = ClipBD( (iSum + 32) >> 6 , bitDepth); 1380 1391 piSrcTmp += 8; 1381 1392 } … … 1385 1396 }; 1386 1397 1387 Void TRenFilter::xDilate( Pel* piSrc, Int iSrcStride, Int iWidth, Int iHeight, Pel* piDst, Int iDstStride, Int iSize, Bool bVerticalDir, Bool bToTopOrLeft ) 1398 template<UInt bitDepth> 1399 Void TRenFilter<bitDepth>::xDilate( Pel* piSrc, Int iSrcStride, Int iWidth, Int iHeight, Pel* piDst, Int iDstStride, Int iSize, Bool bVerticalDir, Bool bToTopOrLeft ) 1388 1400 { 1389 1401 Int iFDimStart = 0; … … 1452 1464 1453 1465 1454 template Bool TRenFilter::compare (TRenImage<Pel >*, TRenImage<Pel>* ); 1455 template Bool TRenFilter::compare (TRenImagePlane<Pel>*, TRenImagePlane<Pel>* ); 1456 1457 template Void TRenFilter::mirrorHor( TRenImage<Double> *pcImage ); 1458 template Void TRenFilter::mirrorHor( TRenImage<Pel> *pcImage ); 1459 template Void TRenFilter::mirrorHor( TRenImage<Int> *pcImage ); 1460 template Void TRenFilter::mirrorHor( TRenImagePlane<Pel> *pcImagePlane ); 1466 template class TRenFilter<REN_BIT_DEPTH>; 1467 1468 template Bool TRenFilter<REN_BIT_DEPTH>::compare (TRenImage<Pel >*, TRenImage<Pel>* ); 1469 template Bool TRenFilter<REN_BIT_DEPTH>::compare (TRenImagePlane<Pel>*, TRenImagePlane<Pel>* ); 1470 1471 template Void TRenFilter<REN_BIT_DEPTH>::mirrorHor( TRenImage<Double> *pcImage ); 1472 template Void TRenFilter<REN_BIT_DEPTH>::mirrorHor( TRenImage<Pel> *pcImage ); 1473 template Void TRenFilter<REN_BIT_DEPTH>::mirrorHor( TRenImage<Int> *pcImage ); 1474 template Void TRenFilter<REN_BIT_DEPTH>::mirrorHor( TRenImagePlane<Pel> *pcImagePlane ); 1461 1475 1462 1476 #endif
Note: See TracChangeset for help on using the changeset viewer.