Changeset 1287 in SHVCSoftware
- Timestamp:
- 17 Jul 2015, 05:43:37 (10 years ago)
- Location:
- branches/SHM-dev/source
- Files:
-
- 62 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/App/TAppDecoder/TAppDecTop.cpp
r1273 r1287 57 57 58 58 #if Q0074_COLOUR_REMAPPING_SEI 59 static Void applyColourRemapping(TComPicYuv& pic, const SEIColourRemappingInfo* colourRemappingInfoSEI, UInt layerId=0 );59 static Void applyColourRemapping(TComPicYuv& pic, const SEIColourRemappingInfo* colourRemappingInfoSEI, const BitDepths& bitDpeths, UInt layerId=0 ); 60 60 static std::vector<SEIColourRemappingInfo> storeCriSEI; //Persistent Colour Remapping Information SEI 61 61 static SEIColourRemappingInfo *seiColourRemappingInfoPrevious=NULL ; … … 290 290 #endif 291 291 { 292 // Set bitdepth for each layer when doing DBF293 g_bitDepth[CHANNEL_TYPE_LUMA] = g_bitDepthLayer[CHANNEL_TYPE_LUMA][curLayerId];294 g_bitDepth[CHANNEL_TYPE_CHROMA] = g_bitDepthLayer[CHANNEL_TYPE_CHROMA][curLayerId];295 296 292 if (!loopFiltered[curLayerId] || bitstreamFile) 297 293 { … … 322 318 if ( m_pchReconFile[curLayerId] && !openedReconFile[curLayerId] ) 323 319 { 320 const BitDepths &bitDepths=pcListPic->front()->getSlice(0)->getBitDepths(); // use bit depths of first reconstructed picture. 324 321 for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++) 325 322 { 326 323 if (m_outputBitDepth[channelType] == 0) 327 324 { 328 m_outputBitDepth[channelType] = g_bitDepth[channelType];325 m_outputBitDepth[channelType] = bitDepths.recon[channelType]; 329 326 } 330 327 } 331 m_acTVideoIOYuvReconFile[curLayerId].open( m_pchReconFile[curLayerId], true, m_outputBitDepth, m_outputBitDepth, g_bitDepth); // write mode328 m_acTVideoIOYuvReconFile[curLayerId].open( m_pchReconFile[curLayerId], true, m_outputBitDepth, m_outputBitDepth, bitDepths.recon ); // write mode 332 329 333 330 openedReconFile[curLayerId] = true; … … 541 538 if ( m_pchReconFile && !openedReconFile ) 542 539 { 540 const BitDepths &bitDepths=pcListPic->front()->getPicSym()->getSPS().getBitDepths(); // use bit depths of first reconstructed picture. 543 541 for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++) 544 542 { 545 543 if (m_outputBitDepth[channelType] == 0) 546 544 { 547 m_outputBitDepth[channelType] = g_bitDepth[channelType];545 m_outputBitDepth[channelType] = bitDepths.recon[channelType]; 548 546 } 549 547 } 550 548 551 m_cTVideoIOYuvReconFile.open( m_pchReconFile, true, m_outputBitDepth, m_outputBitDepth, g_bitDepth); // write mode549 m_cTVideoIOYuvReconFile.open( m_pchReconFile, true, m_outputBitDepth, m_outputBitDepth, bitDepths.recon ); // write mode 552 550 openedReconFile = true; 553 551 } … … 1298 1296 { 1299 1297 //printf ("\n\nColour Remapping is applied to POC : %d and LayerId : %d ",pic->getPOC(), pic->getLayerId()); 1300 applyColourRemapping(*pic->getPicYuvRec(), seiColourRemappingInfo1301 1298 #if SVC_EXTENSION 1302 , pic->getLayerId() 1303 #endif 1304 ); 1299 applyColourRemapping(*pic->getPicYuvRec(), seiColourRemappingInfo, pic->getSlice(0)->getBitDepths(), pic->getLayerId()); 1300 #else 1301 applyColourRemapping(*pic->getPicYuvRec(), seiColourRemappingInfo, pic->getSlice(0)->getBitDepths()); 1302 #endif 1305 1303 } 1306 1304 else // using the last CRI SEI received … … 1308 1306 const SEIColourRemappingInfo *seiColourRemappingInfoCopy; 1309 1307 seiColourRemappingInfoCopy = seiColourRemappingInfoPrevious; 1310 applyColourRemapping(*pic->getPicYuvRec(), seiColourRemappingInfoCopy1311 1308 #if SVC_EXTENSION 1312 , pic->getLayerId() 1313 #endif 1314 ); 1309 applyColourRemapping(*pic->getPicYuvRec(), seiColourRemappingInfoCopy, pic->getSlice(0)->getBitDepths(), pic->getLayerId()); 1310 #else 1311 applyColourRemapping(*pic->getPicYuvRec(), seiColourRemappingInfoCopy, pic->getSlice(0)->getBitDepths()); 1312 #endif 1315 1313 } 1316 1314 … … 1545 1543 1546 1544 TComPictureHash recon_digest; 1547 Int numChar = calcMD5(*pic->getPicYuvRec(), recon_digest );1545 Int numChar = calcMD5(*pic->getPicYuvRec(), recon_digest, pic->getSlice(0)->getBitDepths()); 1548 1546 fprintf(fptr, "%8d%9d MD5:%s\n", pic->getLayerId(), pic->getSlice(0)->getPOC(), hashToString(recon_digest, numChar).c_str()); 1549 1547 fclose(fptr); … … 1570 1568 if( this->getDecodedYuvLayerRefresh(layerId) ) 1571 1569 { 1572 m_outputBitDepth[CHANNEL_TYPE_LUMA] = g_bitDepth[CHANNEL_TYPE_LUMA] = g_bitDepthLayer[CHANNEL_TYPE_LUMA][layerId];1573 m_outputBitDepth[CHANNEL_TYPE_CHROMA] = g_bitDepth[CHANNEL_TYPE_CHROMA] = g_bitDepthLayer[CHANNEL_TYPE_CHROMA][layerId];1574 1575 1570 char tempFileName[256]; 1576 1571 strcpy(tempFileName, this->getDecodedYuvLayerFileName( layerId ).c_str()); 1577 m_confReconFile[layerId].open(tempFileName, true, m_outputBitDepth, m_outputBitDepth, g_bitDepth ); // write mode 1572 1573 const TComVPS *vps = m_acTDecTop->getLayerDec(layerId)->getParameterSetManager()->getActiveVPS(); 1574 const TComSPS *sps = m_acTDecTop->getLayerDec(layerId)->getParameterSetManager()->getActiveSPS(); 1575 const BitDepths &bitDpeths = vps->getBitDepths(sps, layerId); 1576 Int bitDepth[] = {bitDpeths.recon[CHANNEL_TYPE_LUMA], bitDpeths.recon[CHANNEL_TYPE_CHROMA]}; 1577 1578 m_confReconFile[layerId].open(tempFileName, true, m_outputBitDepth, m_outputBitDepth, bitDepth ); // write mode 1578 1579 this->setDecodedYuvLayerRefresh( layerId, false ); 1579 1580 } … … 1845 1846 1846 1847 #if Q0074_COLOUR_REMAPPING_SEI 1847 Void xInitColourRemappingLut( const Int bitDepthY, const Int bitDepthC, std::vector<Int>(&preLut)[3], std::vector<Int>(&postLut)[3], const SEIColourRemappingInfo* const pCriSEI )1848 Void xInitColourRemappingLut( const BitDepths &bitDepths, std::vector<Int>(&preLut)[3], std::vector<Int>(&postLut)[3], const SEIColourRemappingInfo* const pCriSEI ) 1848 1849 { 1849 1850 for ( Int c=0 ; c<3 ; c++ ) 1850 1851 { 1851 Int bitDepth = c ? bitDepthC : bitDepthY;1852 Int bitDepth = bitDepths.recon[toChannelType(ComponentID(c))]; 1852 1853 preLut[c].resize(1 << bitDepth); 1853 1854 postLut[c].resize(1 << pCriSEI->m_colourRemapBitDepth); … … 1902 1903 } 1903 1904 1904 static void applyColourRemapping(TComPicYuv& pic, const SEIColourRemappingInfo* pCriSEI, UInt layerId )1905 static Void applyColourRemapping(TComPicYuv& pic, const SEIColourRemappingInfo* pCriSEI, const BitDepths& bitDpeths, UInt layerId ) 1905 1906 { 1906 1907 if( !storeCriSEI.size() ) … … 1940 1941 YUVOut[2] = picColourRemapped.getAddr(COMPONENT_Cr); 1941 1942 1942 #if SVC_EXTENSION1943 Int bitDepthY = g_bitDepthLayer[CHANNEL_TYPE_LUMA][layerId];1944 Int bitDepthC = g_bitDepthLayer[CHANNEL_TYPE_CHROMA][layerId];1945 1946 #else1947 Int bitDepthY = g_bitDepth[CHANNEL_TYPE_LUMA];1948 Int bitDepthC = g_bitDepth[CHANNEL_TYPE_CHROMA];1949 #endif1950 1951 1943 std::vector<Int> preLut[3]; 1952 1944 std::vector<Int> postLut[3]; 1953 xInitColourRemappingLut( bitD epthY, bitDepthC, preLut, postLut, &storeCriSEI[layerId] );1945 xInitColourRemappingLut( bitDpeths, preLut, postLut, &storeCriSEI[layerId] ); 1954 1946 1955 1947 Int roundingOffset = (storeCriSEI[layerId].m_log2MatrixDenom==0) ? 0 : (1 << (storeCriSEI[layerId].m_log2MatrixDenom - 1)); -
branches/SHM-dev/source/App/TAppDecoder/TAppDecTop.h
r1259 r1287 96 96 Void xInitDecLib (); ///< initialize decoder class 97 97 98 #if Q0074_COLOUR_REMAPPING_SEI 99 Void xInitColourRemappingLut( const BitDepths &bitDepths, std::vector<Int>(&preLut)[3], std::vector<Int>(&postLut)[3], const SEIColourRemappingInfo* const pCriSEI ); 100 #endif 98 101 #if SVC_EXTENSION 99 102 Void xWriteOutput ( TComList<TComPic*>* pcListPic, UInt layerId, UInt tId ); ///< write YUV to file -
branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.cpp
r1286 r1287 4308 4308 g_uiMaxCUDepth = m_uiMaxCUDepth; 4309 4309 #endif 4310 4311 // set internal bit-depth and constants4312 for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++)4313 {4314 #if O0043_BEST_EFFORT_DECODING4315 g_bitDepthInStream[channelType] = g_bitDepth[channelType] = m_internalBitDepth[channelType];4316 #else4317 g_bitDepth [channelType] = m_internalBitDepth[channelType];4318 #endif4319 }4320 4310 } 4321 4311 #endif … … 4489 4479 printf("TOOL CFG: "); 4490 4480 #if !SVC_EXTENSION 4491 printf("IBD:%d ", (( g_bitDepth[CHANNEL_TYPE_LUMA] > m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA]) || (g_bitDepth[CHANNEL_TYPE_CHROMA] > m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA])));4481 printf("IBD:%d ", ((m_internalBitDepth[CHANNEL_TYPE_LUMA] > m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA]) || (m_internalBitDepth[CHANNEL_TYPE_CHROMA] > m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA]))); 4492 4482 #endif 4493 4483 printf("HAD:%d ", m_bUseHADME ); -
branches/SHM-dev/source/App/TAppEncoder/TAppEncTop.cpp
r1285 r1287 217 217 { 218 218 //1 219 g_bitDepth[CHANNEL_TYPE_LUMA] = m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_LUMA];220 g_bitDepth[CHANNEL_TYPE_CHROMA] = m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_CHROMA];221 222 // Set this to be used in Upsampling filter in function "TComUpsampleFilter::upsampleBasePic"223 g_bitDepthLayer[CHANNEL_TYPE_LUMA][m_acLayerCfg[layer].m_layerId] = g_bitDepth[CHANNEL_TYPE_LUMA];224 g_bitDepthLayer[CHANNEL_TYPE_CHROMA][m_acLayerCfg[layer].m_layerId] = g_bitDepth[CHANNEL_TYPE_CHROMA];225 226 219 m_acTEncTop[layer].setInterLayerWeightedPredFlag ( m_useInterLayerWeightedPred ); 227 220 … … 475 468 for( UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++ ) 476 469 { 477 m_acTEncTop[layer].setPCMBitDepth ((ChannelType)channelType, m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_MSBExtendedBitDepth[channelType] : m_acLayerCfg[layer].m_internalBitDepth[channelType]); 470 m_acTEncTop[layer].setBitDepth ((ChannelType)channelType, m_acLayerCfg[layer].m_internalBitDepth[channelType]); 471 m_acTEncTop[layer].setPCMBitDepth ((ChannelType)channelType, m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_MSBExtendedBitDepth[channelType] : m_acLayerCfg[layer].m_internalBitDepth[channelType]); 478 472 } 479 473 m_acTEncTop[layer].setPCMLog2MaxSize ( m_pcmLog2MaxSize); … … 904 898 for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++) 905 899 { 906 //#if O0043_BEST_EFFORT_DECODING 907 //g_bitDepthInStream[channelType] = g_bitDepth[channelType] = m_internalBitDepth[channelType]; 908 //#else 909 //g_bitDepth [channelType] = m_internalBitDepth[channelType]; 910 //#endif 900 m_cTEncTop.setBitDepth((ChannelType)channelType, m_internalBitDepth[channelType]); 911 901 m_cTEncTop.setPCMBitDepth((ChannelType)channelType, m_bPCMInputBitDepthFlag ? m_MSBExtendedBitDepth[channelType] : m_internalBitDepth[channelType]); 912 902 } … … 1094 1084 { 1095 1085 //2 1096 for( UInt channelTypeIndex = 0; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++)1097 {1098 g_bitDepth[channelTypeIndex] = m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];1099 }1100 1101 1086 #if LAYER_CTB 1102 1087 g_uiMaxCUWidth = g_auiLayerMaxCUWidth[layer]; … … 1193 1178 { 1194 1179 //3 1195 for (UInt channelTypeIndex = 0; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++)1196 {1197 g_bitDepth[channelTypeIndex] = m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];1198 }1199 1180 #if LAYER_CTB 1200 1181 g_uiMaxCUWidth = g_auiLayerMaxCUWidth[layer]; … … 1233 1214 Int layerIdx = vps->getLayerIdxInVps(m_layerSetLayerIdList[setId][i]); 1234 1215 //4 1235 g_bitDepth[CHANNEL_TYPE_LUMA] = m_acLayerCfg[layerIdx].m_internalBitDepth[CHANNEL_TYPE_LUMA];1236 g_bitDepth[CHANNEL_TYPE_CHROMA] = m_acLayerCfg[layerIdx].m_internalBitDepth[CHANNEL_TYPE_CHROMA];1237 1238 1216 vps->setLayerIdIncludedFlag(true, setId, layerId); 1239 1217 } … … 1250 1228 //4 1251 1229 UInt layerId = vps->getLayerIdInNuh(layerIdx); 1252 g_bitDepth[CHANNEL_TYPE_LUMA] = m_acLayerCfg[layerIdx].m_internalBitDepth[CHANNEL_TYPE_LUMA];1253 g_bitDepth[CHANNEL_TYPE_CHROMA] = m_acLayerCfg[layerIdx].m_internalBitDepth[CHANNEL_TYPE_CHROMA];1254 1230 1255 1231 if (layerId <= setId) … … 1702 1678 { 1703 1679 //5 1704 g_bitDepth[CHANNEL_TYPE_LUMA] = m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_LUMA];1705 g_bitDepth[CHANNEL_TYPE_CHROMA] = m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_CHROMA];1706 1707 1680 // allocate original YUV buffer 1708 1681 pcPicYuvOrg[layer] = new TComPicYuv; … … 1739 1712 { 1740 1713 //6 1741 for (UInt channelTypeIndex = 0; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++)1742 {1743 g_bitDepth[channelTypeIndex] = m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];1744 }1745 1714 #if LAYER_CTB 1746 1715 g_uiMaxCUWidth = g_auiLayerMaxCUWidth[layer]; … … 1759 1728 if( m_acLayerCfg[layer].getChromaFormatIDC() == CHROMA_400 || (m_apcTEncTop[0]->getVPS()->getScalabilityMask(AUX_ID) && (m_acLayerCfg[layer].getAuxId() == AUX_ALPHA || m_acLayerCfg[layer].getAuxId() == AUX_DEPTH)) ) 1760 1729 { 1761 pcPicYuvOrg[layer]->convertToMonochrome( );1730 pcPicYuvOrg[layer]->convertToMonochrome(m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_CHROMA]); 1762 1731 } 1763 1732 #endif … … 1823 1792 { 1824 1793 //7 1825 for( UInt channelTypeIndex = 0; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++ )1826 {1827 g_bitDepth[channelTypeIndex] = m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];1828 }1829 1794 #if LAYER_CTB 1830 1795 g_uiMaxCUWidth = g_auiLayerMaxCUWidth[layer]; … … 1895 1860 { 1896 1861 //8 1897 for( UInt channelTypeIndex = 0; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++ )1898 {1899 g_bitDepth[channelTypeIndex] = m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];1900 }1901 1902 1862 // write bistream to file if necessary 1903 1863 iNumEncoded = m_acTEncTop[layer].getNumPicRcvd(); … … 1983 1943 for(layer = 0; layer < m_numLayers; layer++) 1984 1944 { 1985 m_gcAnalyzeAll[layer].printOut('a', m_acLayerCfg[layer].getChromaFormatIDC(), printMSEBasedSNR, printSequenceMSE, layer); 1945 const BitDepths bitDepths(m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_LUMA], m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_CHROMA]); 1946 1947 m_gcAnalyzeAll[layer].printOut('a', m_acLayerCfg[layer].getChromaFormatIDC(), printMSEBasedSNR, printSequenceMSE, bitDepths, layer); 1986 1948 } 1987 1949 … … 1989 1951 for(layer = 0; layer < m_numLayers; layer++) 1990 1952 { 1991 m_gcAnalyzeI[layer].printOut('i', m_acLayerCfg[layer].getChromaFormatIDC(), printMSEBasedSNR, printSequenceMSE, layer); 1953 const BitDepths bitDepths(m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_LUMA], m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_CHROMA]); 1954 1955 m_gcAnalyzeI[layer].printOut('i', m_acLayerCfg[layer].getChromaFormatIDC(), printMSEBasedSNR, printSequenceMSE, bitDepths, layer); 1992 1956 } 1993 1957 … … 1995 1959 for(layer = 0; layer < m_numLayers; layer++) 1996 1960 { 1997 m_gcAnalyzeP[layer].printOut('p', m_acLayerCfg[layer].getChromaFormatIDC(), printMSEBasedSNR, printSequenceMSE, layer); 1961 const BitDepths bitDepths(m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_LUMA], m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_CHROMA]); 1962 1963 m_gcAnalyzeP[layer].printOut('p', m_acLayerCfg[layer].getChromaFormatIDC(), printMSEBasedSNR, printSequenceMSE, bitDepths, layer); 1998 1964 } 1999 1965 … … 2001 1967 for(layer = 0; layer < m_numLayers; layer++) 2002 1968 { 2003 m_gcAnalyzeB[layer].printOut('b', m_acLayerCfg[layer].getChromaFormatIDC(), printMSEBasedSNR, printSequenceMSE, layer); 1969 const BitDepths bitDepths(m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_LUMA], m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_CHROMA]); 1970 1971 m_gcAnalyzeB[layer].printOut('b', m_acLayerCfg[layer].getChromaFormatIDC(), printMSEBasedSNR, printSequenceMSE, bitDepths, layer); 2004 1972 } 2005 1973 … … 2008 1976 for(layer = 0; layer < m_numLayers; layer++) 2009 1977 { 1978 const BitDepths bitDepths(m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_LUMA], m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_CHROMA]); 1979 2010 1980 //-- interlaced summary 2011 1981 m_gcAnalyzeAll_in.setFrmRate( m_acLayerCfg[layer].getFrameRate()); … … 2014 1984 2015 1985 printf( "\n\nSUMMARY INTERLACED ---------------------------------------------\n" ); 2016 m_gcAnalyzeAll_in.printOut('a', m_acLayerCfg[layer].getChromaFormatIDC(), printMSEBasedSNR, printSequenceMSE, layer);1986 m_gcAnalyzeAll_in.printOut('a', m_acLayerCfg[layer].getChromaFormatIDC(), printMSEBasedSNR, printSequenceMSE, bitDepths, layer); 2017 1987 2018 1988 #if _SUMMARY_OUT_ -
branches/SHM-dev/source/Lib/TLibCommon/CommonDef.h
r1283 r1287 144 144 // ==================================================================================================================== 145 145 146 extern Int g_bitDepth[MAX_NUM_CHANNEL_TYPE];147 148 #if SVC_EXTENSION149 extern Int g_bitDepthLayer[MAX_NUM_CHANNEL_TYPE][MAX_LAYERS];150 extern void* g_refWeightACDCParam; //type:wpACDCParam151 #endif152 153 146 template <typename T> inline T Clip3 (const T minVal, const T maxVal, const T a) { return std::min<T> (std::max<T> (minVal, a) , maxVal); } ///< general min/max clip 154 147 template <typename T> inline T ClipBD(const T x, const Int bitDepth) { return Clip3(T(0), T((1 << bitDepth)-1), x); } 155 template <typename T> inline T Clip (const T x, const ChannelType type) { return ClipBD(x, g_bitDepth[type]); }156 148 157 149 template <typename T> inline Void Check3( T minVal, T maxVal, T a) -
branches/SHM-dev/source/Lib/TLibCommon/TComChromaFormat.h
r1285 r1287 163 163 //------------------------------------------------ 164 164 165 static inline Int getTransformShift(const ChannelType type, const UInt uiLog2TrSize, const Int maxLog2TrDynamicRange) 166 { 167 #if O0043_BEST_EFFORT_DECODING 168 return maxLog2TrDynamicRange - g_bitDepthInStream[type] - uiLog2TrSize; 169 #else 170 return maxLog2TrDynamicRange - g_bitDepth[type] - uiLog2TrSize; 171 #endif 165 static inline Int getTransformShift(const Int channelBitDepth, const UInt uiLog2TrSize, const Int maxLog2TrDynamicRange) 166 { 167 return maxLog2TrDynamicRange - channelBitDepth - uiLog2TrSize; 172 168 } 173 169 -
branches/SHM-dev/source/Lib/TLibCommon/TComInterpolationFilter.cpp
r1260 r1287 338 338 * \param fmt Chroma format 339 339 */ 340 Void TComInterpolationFilter::filterHor(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast, const ChromaFormat fmt )340 Void TComInterpolationFilter::filterHor(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast, const ChromaFormat fmt, const Int bitDepth ) 341 341 { 342 342 if ( frac == 0 ) 343 343 { 344 filterCopy( g_bitDepth[toChannelType(compID)], src, srcStride, dst, dstStride, width, height, true, isLast );344 filterCopy(bitDepth, src, srcStride, dst, dstStride, width, height, true, isLast ); 345 345 } 346 346 else if (isLuma(compID)) 347 347 { 348 348 assert(frac >= 0 && frac < LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS); 349 filterHor<NTAPS_LUMA>( g_bitDepth[toChannelType(compID)], src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilter[frac]);349 filterHor<NTAPS_LUMA>(bitDepth, src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilter[frac]); 350 350 } 351 351 else … … 353 353 const UInt csx = getComponentScaleX(compID, fmt); 354 354 assert(frac >=0 && csx<2 && (frac<<(1-csx)) < CHROMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS); 355 filterHor<NTAPS_CHROMA>( g_bitDepth[toChannelType(compID)], src, srcStride, dst, dstStride, width, height, isLast, m_chromaFilter[frac<<(1-csx)]);355 filterHor<NTAPS_CHROMA>(bitDepth, src, srcStride, dst, dstStride, width, height, isLast, m_chromaFilter[frac<<(1-csx)]); 356 356 } 357 357 } … … 373 373 * \param fmt Chroma format 374 374 */ 375 Void TComInterpolationFilter::filterVer(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast, const ChromaFormat fmt )375 Void TComInterpolationFilter::filterVer(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast, const ChromaFormat fmt, const Int bitDepth ) 376 376 { 377 377 if ( frac == 0 ) 378 378 { 379 filterCopy( g_bitDepth[toChannelType(compID)], src, srcStride, dst, dstStride, width, height, isFirst, isLast );379 filterCopy(bitDepth, src, srcStride, dst, dstStride, width, height, isFirst, isLast ); 380 380 } 381 381 else if (isLuma(compID)) 382 382 { 383 383 assert(frac >= 0 && frac < LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS); 384 filterVer<NTAPS_LUMA>( g_bitDepth[toChannelType(compID)], src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaFilter[frac]);384 filterVer<NTAPS_LUMA>(bitDepth, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaFilter[frac]); 385 385 } 386 386 else … … 388 388 const UInt csy = getComponentScaleY(compID, fmt); 389 389 assert(frac >=0 && csy<2 && (frac<<(1-csy)) < CHROMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS); 390 filterVer<NTAPS_CHROMA>( g_bitDepth[toChannelType(compID)], src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_chromaFilter[frac<<(1-csy)]);390 filterVer<NTAPS_CHROMA>(bitDepth, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_chromaFilter[frac<<(1-csy)]); 391 391 } 392 392 } -
branches/SHM-dev/source/Lib/TLibCommon/TComInterpolationFilter.h
r1259 r1287 73 73 ~TComInterpolationFilter() {} 74 74 75 Void filterHor(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast, const ChromaFormat fmt );76 Void filterVer(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast, const ChromaFormat fmt );75 Void filterHor(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast, const ChromaFormat fmt, const Int bitDepth ); 76 Void filterVer(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast, const ChromaFormat fmt, const Int bitDepth ); 77 77 }; 78 78 -
branches/SHM-dev/source/Lib/TLibCommon/TComLoopFilter.cpp
r1260 r1287 564 564 Pel* piSrc = pcPicYuvRec->getAddr(COMPONENT_Y, pcCU->getCtuRsAddr(), uiAbsZorderIdx ); 565 565 Pel* piTmpSrc = piSrc; 566 #if SVC_EXTENSION 567 const Int bitDepthLuma = pcCU->getSlice()->getBitDepth(CHANNEL_TYPE_LUMA); 568 #else 569 const Int bitDepthLuma = pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA); 570 #endif 566 571 567 572 const Bool lfCrossSliceBoundaryFlag=pcCU->getSlice()->getLFCrossSliceBoundaryFlag(); … … 600 605 } 601 606 607 const Int iBitdepthScale = 1 << (bitDepthLuma-8); 608 602 609 for ( UInt iIdx = 0; iIdx < uiNumParts; iIdx++ ) 603 610 { … … 620 627 iQP_P = pcCUP->getQP(uiPartPIdx); 621 628 iQP = (iQP_P + iQP_Q + 1) >> 1; 622 Int iBitdepthScale = 1 << (g_bitDepth[CHANNEL_TYPE_LUMA]-8);623 629 624 630 Int iIndexTC = Clip3(0, MAX_QP+DEFAULT_INTRA_TC_OFFSET, Int(iQP + DEFAULT_INTRA_TC_OFFSET*(uiBs-1) + (tcOffsetDiv2 << 1))); … … 666 672 for ( Int i = 0; i < DEBLOCK_SMALLEST_BLOCK/2; i++) 667 673 { 668 xPelFilterLuma( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*4+i), iOffset, iTc, sw, bPartPNoFilter, bPartQNoFilter, iThrCut, bFilterP, bFilterQ );674 xPelFilterLuma( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*4+i), iOffset, iTc, sw, bPartPNoFilter, bPartQNoFilter, iThrCut, bFilterP, bFilterQ, bitDepthLuma); 669 675 } 670 676 } … … 681 687 Pel* piSrcCb = pcPicYuvRec->getAddr( COMPONENT_Cb, pcCU->getCtuRsAddr(), uiAbsZorderIdx ); 682 688 Pel* piSrcCr = pcPicYuvRec->getAddr( COMPONENT_Cr, pcCU->getCtuRsAddr(), uiAbsZorderIdx ); 689 #if SVC_EXTENSION 690 const Int bitDepthChroma = pcCU->getSlice()->getBitDepth(CHANNEL_TYPE_CHROMA); 691 #else 692 const Int bitDepthChroma = pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_CHROMA); 693 #endif 683 694 Int iQP = 0; 684 695 Int iQP_P = 0; … … 740 751 uiLoopLength=uiPelsInPartChromaH; 741 752 } 753 754 #if SVC_EXTENSION 755 const Int iBitdepthScale = 1 << (pcCU->getSlice()->getBitDepth(CHANNEL_TYPE_CHROMA)-8); 756 #else 757 const Int iBitdepthScale = 1 << (pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_CHROMA)-8); 758 #endif 742 759 743 760 for ( UInt iIdx = 0; iIdx < uiNumParts; iIdx++ ) … … 798 815 } 799 816 800 Int iBitdepthScale = 1 << (g_bitDepth[CHANNEL_TYPE_CHROMA]-8);801 802 817 Int iIndexTC = Clip3(0, MAX_QP+DEFAULT_INTRA_TC_OFFSET, iQP + DEFAULT_INTRA_TC_OFFSET*(ucBs - 1) + (tcOffsetDiv2 << 1)); 803 818 Int iTc = sm_tcTable[iIndexTC]*iBitdepthScale; … … 805 820 for ( UInt uiStep = 0; uiStep < uiLoopLength; uiStep++ ) 806 821 { 807 xPelFilterChroma( piTmpSrcChroma + iSrcStep*(uiStep+iIdx*uiLoopLength), iOffset, iTc , bPartPNoFilter, bPartQNoFilter );822 xPelFilterChroma( piTmpSrcChroma + iSrcStep*(uiStep+iIdx*uiLoopLength), iOffset, iTc , bPartPNoFilter, bPartQNoFilter, bitDepthChroma); 808 823 } 809 824 } … … 825 840 \param bFilterSecondQ decision weak filter/no filter for partQ 826 841 */ 827 __inline Void TComLoopFilter::xPelFilterLuma( Pel* piSrc, Int iOffset, Int tc, Bool sw, Bool bPartPNoFilter, Bool bPartQNoFilter, Int iThrCut, Bool bFilterSecondP, Bool bFilterSecondQ )842 __inline Void TComLoopFilter::xPelFilterLuma( Pel* piSrc, Int iOffset, Int tc, Bool sw, Bool bPartPNoFilter, Bool bPartQNoFilter, Int iThrCut, Bool bFilterSecondP, Bool bFilterSecondQ, const Int bitDepthLuma) 828 843 { 829 844 Int delta; … … 855 870 { 856 871 delta = Clip3(-tc, tc, delta); 857 piSrc[-iOffset] = Clip ((m3+delta), CHANNEL_TYPE_LUMA);858 piSrc[0] = Clip ((m4-delta), CHANNEL_TYPE_LUMA);872 piSrc[-iOffset] = ClipBD((m3+delta), bitDepthLuma); 873 piSrc[0] = ClipBD((m4-delta), bitDepthLuma); 859 874 860 875 Int tc2 = tc>>1; … … 862 877 { 863 878 Int delta1 = Clip3(-tc2, tc2, (( ((m1+m3+1)>>1)- m2+delta)>>1)); 864 piSrc[-iOffset*2] = Clip ((m2+delta1), CHANNEL_TYPE_LUMA);879 piSrc[-iOffset*2] = ClipBD((m2+delta1), bitDepthLuma); 865 880 } 866 881 if(bFilterSecondQ) 867 882 { 868 883 Int delta2 = Clip3(-tc2, tc2, (( ((m6+m4+1)>>1)- m5-delta)>>1)); 869 piSrc[ iOffset] = Clip ((m5+delta2), CHANNEL_TYPE_LUMA);884 piSrc[ iOffset] = ClipBD((m5+delta2), bitDepthLuma); 870 885 } 871 886 } … … 895 910 \param bPartQNoFilter indicator to disable filtering on partQ 896 911 */ 897 __inline Void TComLoopFilter::xPelFilterChroma( Pel* piSrc, Int iOffset, Int tc, Bool bPartPNoFilter, Bool bPartQNoFilter )912 __inline Void TComLoopFilter::xPelFilterChroma( Pel* piSrc, Int iOffset, Int tc, Bool bPartPNoFilter, Bool bPartQNoFilter, const Int bitDepthChroma) 898 913 { 899 914 Int delta; … … 905 920 906 921 delta = Clip3(-tc,tc, (((( m4 - m3 ) << 2 ) + m2 - m5 + 4 ) >> 3) ); 907 piSrc[-iOffset] = Clip ((m3+delta), CHANNEL_TYPE_CHROMA);908 piSrc[0] = Clip ((m4-delta), CHANNEL_TYPE_CHROMA);922 piSrc[-iOffset] = ClipBD((m3+delta), bitDepthChroma); 923 piSrc[0] = ClipBD((m4-delta), bitDepthChroma); 909 924 910 925 if(bPartPNoFilter) -
branches/SHM-dev/source/Lib/TLibCommon/TComLoopFilter.h
r1259 r1287 108 108 Void xEdgeFilterChroma ( TComDataCU* pcCU, UInt uiAbsZorderIdx, UInt uiDepth, DeblockEdgeDir edgeDir, Int iEdge ); 109 109 110 __inline Void xPelFilterLuma( Pel* piSrc, Int iOffset, Int tc, Bool sw, Bool bPartPNoFilter, Bool bPartQNoFilter, Int iThrCut, Bool bFilterSecondP, Bool bFilterSecondQ );111 __inline Void xPelFilterChroma( Pel* piSrc, Int iOffset, Int tc, Bool bPartPNoFilter, Bool bPartQNoFilter );110 __inline Void xPelFilterLuma( Pel* piSrc, Int iOffset, Int tc, Bool sw, Bool bPartPNoFilter, Bool bPartQNoFilter, Int iThrCut, Bool bFilterSecondP, Bool bFilterSecondQ, const Int bitDepthLuma); 111 __inline Void xPelFilterChroma( Pel* piSrc, Int iOffset, Int tc, Bool bPartPNoFilter, Bool bPartQNoFilter, const Int bitDepthChroma); 112 112 113 113 -
branches/SHM-dev/source/Lib/TLibCommon/TComPattern.cpp
r1260 r1287 79 79 Int iRoiWidth, 80 80 Int iRoiHeight, 81 Int iStride 81 Int iStride, 82 Int bitDepth 82 83 ) 83 84 { 84 85 m_piROIOrigin = piTexture; 85 m_iROIWidth = iRoiWidth; 86 m_iROIHeight = iRoiHeight; 87 m_iPatternStride = iStride; 86 m_iROIWidth = iRoiWidth; 87 m_iROIHeight = iRoiHeight; 88 m_iPatternStride = iStride; 89 m_bitDepth = bitDepth; 88 90 } 89 91 … … 95 97 Int iRoiWidth, 96 98 Int iRoiHeight, 97 Int iStride) 98 { 99 m_cPatternY. setPatternParamPel( piY, iRoiWidth, iRoiHeight, iStride); 99 Int iStride, 100 Int bitDepthLuma) 101 { 102 m_cPatternY. setPatternParamPel( piY, iRoiWidth, iRoiHeight, iStride, bitDepthLuma); 100 103 } 101 104 … … 120 123 const Int iAboveUnits = iTUWidthInUnits << 1; 121 124 const Int iLeftUnits = iTUHeightInUnits << 1; 125 #if SVC_EXTENSION 126 const Int bitDepthForChannel = pcCU->getSlice()->getBitDepth(chType); 127 #else 128 const Int bitDepthForChannel = pcCU->getSlice()->getSPS()->getBitDepth(chType); 129 #endif 122 130 123 131 assert(iTUHeightInUnits > 0 && iTUWidthInUnits > 0); … … 156 164 Pel *piRoiOrigin = pcCU->getPic()->getPicYuvRec()->getAddr(compID, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu()+uiZorderIdxInPart); 157 165 #if O0043_BEST_EFFORT_DECODING 158 fillReferenceSamples (g_bitDepthInStream[chType], g_bitDepthInStream[chType] - g_bitDepth[chType], pcCU, piRoiOrigin, piAdiTemp, bNeighborFlags, iNumIntraNeighbor, iUnitWidth, iUnitHeight, iAboveUnits, iLeftUnits, 159 #else 160 fillReferenceSamples (g_bitDepth[chType], pcCU, piRoiOrigin, piAdiTemp, bNeighborFlags, iNumIntraNeighbor, iUnitWidth, iUnitHeight, iAboveUnits, iLeftUnits, 166 const Int bitDepthForChannelInStream = pcCU->getSlice()->getSPS()->getStreamBitDepth(chType); 167 fillReferenceSamples (bitDepthForChannelInStream, bitDepthForChannelInStream - bitDepthForChannel, pcCU, piRoiOrigin, piAdiTemp, bNeighborFlags, iNumIntraNeighbor, iUnitWidth, iUnitHeight, iAboveUnits, iLeftUnits, 168 #else 169 fillReferenceSamples (bitDepthForChannel, pcCU, piRoiOrigin, piAdiTemp, bNeighborFlags, iNumIntraNeighbor, iUnitWidth, iUnitHeight, iAboveUnits, iLeftUnits, 161 170 #endif 162 171 uiTuWidth, uiTuHeight, uiROIWidth, uiROIHeight, iPicStride, toChannelType(compID), chFmt); … … 202 211 { 203 212 #if O0043_BEST_EFFORT_DECODING 204 const Int threshold = 1 << ( g_bitDepthInStream[chType]- 5);205 #else 206 const Int threshold = 1 << ( g_bitDepth[chType]- 5);213 const Int threshold = 1 << (bitDepthForChannelInStream - 5); 214 #else 215 const Int threshold = 1 << (bitDepthForChannel - 5); 207 216 #endif 208 217 const Bool bilinearLeft = abs((bottomLeft + topLeft ) - (2 * piAdiTemp[stride * uiTuHeight])) < threshold; //difference between the -
branches/SHM-dev/source/Lib/TLibCommon/TComPattern.h
r1262 r1287 62 62 Int m_iROIHeight; 63 63 Int m_iPatternStride; 64 Int m_bitDepth; 64 65 65 66 /// return starting position of ROI (ROI = &pattern[AboveOffset][LeftOffset]) … … 70 71 71 72 /// set parameters from Pel buffer for accessing neighbouring pixels 72 Void setPatternParamPel (Pel* piTexture, 73 Int iRoiWidth, 74 Int iRoiHeight, 75 Int iStride 76 ); 73 Void setPatternParamPel( Pel* piTexture, Int iRoiWidth, Int iRoiHeight, Int iStride, Int bitDepth ); 77 74 }; 78 75 … … 92 89 Int getROIYHeight() { return m_cPatternY.m_iROIHeight; } 93 90 Int getPatternLStride() { return m_cPatternY.m_iPatternStride; } 91 Int getBitDepthY() { return m_cPatternY.m_bitDepth; } 94 92 95 93 // ------------------------------------------------------------------------------------------------------------------- … … 98 96 99 97 /// set parameters from Pel buffers for accessing neighbouring pixels 100 Void initPattern (Pel* piY, 101 Int iRoiWidth, 102 Int iRoiHeight, 103 Int iStride ); 104 105 106 107 98 Void initPattern( Pel* piY, Int iRoiWidth, Int iRoiHeight, Int iStride, Int bitDepthLuma ); 108 99 }; 109 100 -
branches/SHM-dev/source/Lib/TLibCommon/TComPicYuv.cpp
r1259 r1287 256 256 257 257 // NOTE: This function is never called, but may be useful for developers. 258 Void TComPicYuv::dump (const Char* pFileName, Bool bAdd) const258 Void TComPicYuv::dump (const Char* pFileName, const BitDepths &bitDepths, Bool bAdd) const 259 259 { 260 260 FILE* pFile; … … 272 272 { 273 273 const ComponentID ch = ComponentID(chan); 274 const Int shift = g_bitDepth[toChannelType(ch)] - 8;274 const Int shift = bitDepths.recon[toChannelType(ch)] - 8; 275 275 const Int offset = (shift>0)?(1<<(shift-1)):0; 276 276 const Pel *pi = getAddr(ch); … … 307 307 if( bitDepth == 8 ) 308 308 { 309 dump( pFileName, b Add );309 dump( pFileName, bitDepth, bAdd ); 310 310 return; 311 311 } … … 338 338 339 339 #if AUXILIARY_PICTURES 340 Void TComPicYuv::convertToMonochrome( )341 { 342 Pel grayVal = (1 << ( g_bitDepth[CHANNEL_TYPE_CHROMA]- 1));340 Void TComPicYuv::convertToMonochrome(Int bitDepthChroma) 341 { 342 Pel grayVal = (1 << (bitDepthChroma - 1)); 343 343 344 344 for( UInt comp = 1; comp < getNumberValidComponents(); comp++ ) -
branches/SHM-dev/source/Lib/TLibCommon/TComPicYuv.h
r1273 r1287 160 160 161 161 // Dump picture 162 Void dump (const Char* pFileName, Bool bAdd = false) const ;162 Void dump (const Char* pFileName, const BitDepths &bitDepths, Bool bAdd = false) const ; 163 163 164 164 // Set border extension flag … … 172 172 Bool isReconstructed() { return m_isReconstructed; } 173 173 #if AUXILIARY_PICTURES 174 Void convertToMonochrome( );174 Void convertToMonochrome(Int bitDepthChroma); 175 175 #endif 176 176 #endif … … 182 182 183 183 // These functions now return the length of the digest strings. 184 UInt calcChecksum(const TComPicYuv& pic, TComPictureHash &digest );185 UInt calcCRC (const TComPicYuv& pic, TComPictureHash &digest );186 UInt calcMD5 (const TComPicYuv& pic, TComPictureHash &digest );184 UInt calcChecksum(const TComPicYuv& pic, TComPictureHash &digest, const BitDepths &bitDepths); 185 UInt calcCRC (const TComPicYuv& pic, TComPictureHash &digest, const BitDepths &bitDepths); 186 UInt calcMD5 (const TComPicYuv& pic, TComPictureHash &digest, const BitDepths &bitDepths); 187 187 std::string hashToString(const TComPictureHash &digest, Int numChar); 188 188 //! \} -
branches/SHM-dev/source/Lib/TLibCommon/TComPicYuvMD5.cpp
r1273 r1287 127 127 } 128 128 129 UInt calcCRC(const TComPicYuv& pic, TComPictureHash &digest )129 UInt calcCRC(const TComPicYuv& pic, TComPictureHash &digest, const BitDepths &bitDepths) 130 130 { 131 131 UInt digestLen=0; … … 134 134 { 135 135 const ComponentID compID=ComponentID(chan); 136 digestLen=compCRC( g_bitDepth[toChannelType(compID)], pic.getAddr(compID), pic.getWidth(compID), pic.getHeight(compID), pic.getStride(compID), digest);136 digestLen=compCRC(bitDepths.recon[toChannelType(compID)], pic.getAddr(compID), pic.getWidth(compID), pic.getHeight(compID), pic.getStride(compID), digest); 137 137 } 138 138 return digestLen; 139 139 } 140 140 141 UInt compChecksum(Int bitdepth, const Pel* plane, UInt width, UInt height, UInt stride, TComPictureHash &digest )141 UInt compChecksum(Int bitdepth, const Pel* plane, UInt width, UInt height, UInt stride, TComPictureHash &digest, const BitDepths &/*bitDepths*/) 142 142 { 143 143 UInt checksum = 0; … … 165 165 } 166 166 167 UInt calcChecksum(const TComPicYuv& pic, TComPictureHash &digest )167 UInt calcChecksum(const TComPicYuv& pic, TComPictureHash &digest, const BitDepths &bitDepths) 168 168 { 169 169 UInt digestLen=0; … … 172 172 { 173 173 const ComponentID compID=ComponentID(chan); 174 digestLen=compChecksum( g_bitDepth[toChannelType(compID)], pic.getAddr(compID), pic.getWidth(compID), pic.getHeight(compID), pic.getStride(compID), digest);174 digestLen=compChecksum(bitDepths.recon[toChannelType(compID)], pic.getAddr(compID), pic.getWidth(compID), pic.getHeight(compID), pic.getStride(compID), digest, bitDepths); 175 175 } 176 176 return digestLen; … … 183 183 * uses little-endian two byte words; 8bit data uses single byte words. 184 184 */ 185 UInt calcMD5(const TComPicYuv& pic, TComPictureHash &digest )185 UInt calcMD5(const TComPicYuv& pic, TComPictureHash &digest, const BitDepths &bitDepths) 186 186 { 187 187 /* choose an md5_plane packing function based on the system bitdepth */ … … 195 195 { 196 196 const ComponentID compID=ComponentID(chan); 197 md5_plane_func = g_bitDepth[toChannelType(compID)] <= 8 ? (MD5PlaneFunc)md5_plane<1> : (MD5PlaneFunc)md5_plane<2>;197 md5_plane_func = bitDepths.recon[toChannelType(compID)] <= 8 ? (MD5PlaneFunc)md5_plane<1> : (MD5PlaneFunc)md5_plane<2>; 198 198 UChar tmp_digest[MD5_DIGEST_STRING_LENGTH]; 199 199 md5_plane_func(md5[compID], pic.getAddr(compID), pic.getWidth(compID), pic.getHeight(compID), pic.getStride(compID)); -
branches/SHM-dev/source/Lib/TLibCommon/TComPrediction.cpp
r1262 r1287 480 480 const UInt uiAbsPartIdx = rTu.GetAbsPartIdxTU(); 481 481 const Bool enableEdgeFilters = !(pcCU->isRDPCMEnabled(uiAbsPartIdx) && pcCU->getCUTransquantBypass(uiAbsPartIdx)); 482 483 482 #if O0043_BEST_EFFORT_DECODING 484 xPredIntraAng( g_bitDepthInStream[channelType], ptrSrc+sw+1, sw, pDst, uiStride, iWidth, iHeight, channelType, format, uiDirMode, bAbove, bLeft, enableEdgeFilters);483 const Int channelsBitDepthForPrediction = rTu.getCU()->getSlice()->getSPS()->getStreamBitDepth(channelType); 485 484 #else 486 xPredIntraAng( g_bitDepth[channelType], ptrSrc+sw+1, sw, pDst, uiStride, iWidth, iHeight, channelType, format, uiDirMode, bAbove, bLeft, enableEdgeFilters ); 485 #if SVC_EXTENSION 486 const Int channelsBitDepthForPrediction = rTu.getCU()->getSlice()->getBitDepth(channelType); 487 #else 488 const Int channelsBitDepthForPrediction = rTu.getCU()->getSlice()->getSPS()->getBitDepth(channelType); 487 489 #endif 490 #endif 491 xPredIntraAng( channelsBitDepthForPrediction, ptrSrc+sw+1, sw, pDst, uiStride, iWidth, iHeight, channelType, format, uiDirMode, bAbove, bLeft, enableEdgeFilters ); 488 492 489 493 if(( uiDirMode == DC_IDX ) && bAbove && bLeft ) … … 614 618 #endif 615 619 616 for (UInt ch=COMPONENT_Y; ch<pcYuvPred->getNumberValidComponents(); ch++) 617 { 618 xPredInterBlk (ComponentID(ch), pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, pcYuvPred, bi ); 620 for (UInt comp=COMPONENT_Y; comp<pcYuvPred->getNumberValidComponents(); comp++) 621 { 622 const ComponentID compID=ComponentID(comp); 623 #if SVC_EXTENSION 624 xPredInterBlk (compID, pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, pcYuvPred, bi, pcCU->getSlice()->getBitDepth(toChannelType(compID)) ); 625 #else 626 xPredInterBlk (compID, pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, pcYuvPred, bi, pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)) ); 627 #endif 619 628 } 620 629 } … … 666 675 else 667 676 { 668 xWeightedAverage( &m_acYuvPred[REF_PIC_LIST_0], &m_acYuvPred[REF_PIC_LIST_1], iRefIdx[REF_PIC_LIST_0], iRefIdx[REF_PIC_LIST_1], uiPartAddr, iWidth, iHeight, pcYuvPred ); 677 #if SVC_EXTENSION 678 xWeightedAverage( &m_acYuvPred[REF_PIC_LIST_0], &m_acYuvPred[REF_PIC_LIST_1], iRefIdx[REF_PIC_LIST_0], iRefIdx[REF_PIC_LIST_1], uiPartAddr, iWidth, iHeight, pcYuvPred, pcCU->getSlice()->getBitDepths() ); 679 #else 680 xWeightedAverage( &m_acYuvPred[REF_PIC_LIST_0], &m_acYuvPred[REF_PIC_LIST_1], iRefIdx[REF_PIC_LIST_0], iRefIdx[REF_PIC_LIST_1], uiPartAddr, iWidth, iHeight, pcYuvPred, pcCU->getSlice()->getSPS()->getBitDepths() ); 681 #endif 669 682 } 670 683 } … … 685 698 686 699 687 Void TComPrediction::xPredInterBlk(const ComponentID compID, TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *dstPic, Bool bi )700 Void TComPrediction::xPredInterBlk(const ComponentID compID, TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *dstPic, Bool bi, const Int bitDepth ) 688 701 { 689 702 Int refStride = refPic->getStride(compID); … … 707 720 if ( yFrac == 0 ) 708 721 { 709 m_if.filterHor(compID, ref, refStride, dst, dstStride, cxWidth, cxHeight, xFrac, !bi, chFmt );722 m_if.filterHor(compID, ref, refStride, dst, dstStride, cxWidth, cxHeight, xFrac, !bi, chFmt, bitDepth); 710 723 } 711 724 else if ( xFrac == 0 ) 712 725 { 713 m_if.filterVer(compID, ref, refStride, dst, dstStride, cxWidth, cxHeight, yFrac, true, !bi, chFmt );726 m_if.filterVer(compID, ref, refStride, dst, dstStride, cxWidth, cxHeight, yFrac, true, !bi, chFmt, bitDepth); 714 727 } 715 728 else … … 720 733 const Int vFilterSize = isLuma(compID) ? NTAPS_LUMA : NTAPS_CHROMA; 721 734 722 m_if.filterHor(compID, ref - ((vFilterSize>>1) -1)*refStride, refStride, tmp, tmpStride, cxWidth, cxHeight+vFilterSize-1, xFrac, false, chFmt );723 m_if.filterVer(compID, tmp + ((vFilterSize>>1) -1)*tmpStride, tmpStride, dst, dstStride, cxWidth, cxHeight, yFrac, false, !bi, chFmt );724 } 725 } 726 727 Void TComPrediction::xWeightedAverage( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iWidth, Int iHeight, TComYuv* pcYuvDst )735 m_if.filterHor(compID, ref - ((vFilterSize>>1) -1)*refStride, refStride, tmp, tmpStride, cxWidth, cxHeight+vFilterSize-1, xFrac, false, chFmt, bitDepth); 736 m_if.filterVer(compID, tmp + ((vFilterSize>>1) -1)*tmpStride, tmpStride, dst, dstStride, cxWidth, cxHeight, yFrac, false, !bi, chFmt, bitDepth); 737 } 738 } 739 740 Void TComPrediction::xWeightedAverage( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iWidth, Int iHeight, TComYuv* pcYuvDst, const BitDepths &clipBitDepths ) 728 741 { 729 742 if( iRefIdx0 >= 0 && iRefIdx1 >= 0 ) 730 743 { 731 pcYuvDst->addAvg( pcYuvSrc0, pcYuvSrc1, uiPartIdx, iWidth, iHeight );744 pcYuvDst->addAvg( pcYuvSrc0, pcYuvSrc1, uiPartIdx, iWidth, iHeight, clipBitDepths ); 732 745 } 733 746 else if ( iRefIdx0 >= 0 && iRefIdx1 < 0 ) … … 870 883 871 884 #if SVC_EXTENSION 872 Void TComPrediction::upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic )873 { 874 m_cUsf.upsampleBasePic( currSlice, refLayerIdc, pcUsPic, pcBasePic, pcTempPic );885 Void TComPrediction::upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Int refBitDepthLuma, const Int refBitDepthChroma ) 886 { 887 m_cUsf.upsampleBasePic( currSlice, refLayerIdc, pcUsPic, pcBasePic, pcTempPic, refBitDepthLuma, refBitDepthChroma ); 875 888 } 876 889 #endif //SVC_EXTENSION -
branches/SHM-dev/source/Lib/TLibCommon/TComPrediction.h
r1262 r1287 94 94 Void xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv* pcYuvPred, Bool bi=false ); 95 95 Void xPredInterBi ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv* pcYuvPred ); 96 Void xPredInterBlk(const ComponentID compID, TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *dstPic, Bool bi );97 Void xWeightedAverage ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv* pcYuvDst );96 Void xPredInterBlk(const ComponentID compID, TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *dstPic, Bool bi, const Int bitDepth ); 97 Void xWeightedAverage ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv* pcYuvDst, const BitDepths &clipBitDepths ); 98 98 99 99 Void xGetLLSPrediction ( const Pel* pSrc0, Int iSrcStride, Pel* pDst0, Int iDstStride, UInt uiWidth, UInt uiHeight, UInt uiExt0, const ChromaFormat chFmt DEBUG_STRING_FN_DECLARE(sDebug) ); … … 145 145 146 146 #if SVC_EXTENSION 147 Void upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic);148 #endif //SVC_EXTENSION147 Void upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Int refBitDepthLuma, const Int refBitDepthChroma ); 148 #endif 149 149 }; 150 150 -
branches/SHM-dev/source/Lib/TLibCommon/TComRdCost.cpp
r1259 r1287 192 192 } 193 193 194 Void TComRdCost::setLambda( Double dLambda )194 Void TComRdCost::setLambda( Double dLambda, const BitDepths &bitDepths ) 195 195 { 196 196 m_dLambda = dLambda; … … 202 202 dLambda = 0.57 * pow(2.0, ((LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP_PRIME - 12) / 3.0)); 203 203 #else 204 dLambda = 0.57 * pow(2.0, ((LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP_PRIME - 12 - 6 * ( g_bitDepth[CHANNEL_TYPE_LUMA] - 8)) / 3.0));204 dLambda = 0.57 * pow(2.0, ((LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP_PRIME - 12 - 6 * (bitDepths.recon[CHANNEL_TYPE_LUMA] - 8)) / 3.0)); 205 205 #endif 206 206 m_dLambdaMotionSAD[1] = 65536.0 * sqrt(dLambda); … … 212 212 dLambda = 0.57 * pow(2.0, ((LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP_PRIME - 12) / 3.0)); 213 213 #else 214 dLambda = 0.57 * pow(2.0, ((LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP_PRIME - 12 - 6 * ( g_bitDepth[CHANNEL_TYPE_LUMA] - 8)) / 3.0));214 dLambda = 0.57 * pow(2.0, ((LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP_PRIME - 12 - 6 * (bitDepths.recon[CHANNEL_TYPE_LUMA] - 8)) / 3.0)); 215 215 #endif 216 216 m_uiLambdaMotionSAD[1] = (UInt)floor(65536.0 * sqrt(dLambda)); … … 340 340 Void TComRdCost::setDistParam( TComPattern* pcPatternKey, Pel* piRefY, Int iRefStride, Int iStep, DistParam& rcDistParam, Bool bHADME ) 341 341 { 342 #if SVC_EXTENSION343 // Set bit depth for weighted cost calculation344 rcDistParam.bitDepth = g_bitDepth[CHANNEL_TYPE_LUMA];345 #endif346 342 // set Original & Curr Pointer / Stride 347 343 rcDistParam.pOrg = pcPatternKey->getROIY(); -
branches/SHM-dev/source/Lib/TLibCommon/TComRdCost.h
r1259 r1287 138 138 139 139 Void setDistortionWeight ( const ComponentID compID, const Double distortionWeight ) { m_distortionWeight[compID] = distortionWeight; } 140 Void setLambda ( Double dLambda );140 Void setLambda ( Double dLambda, const BitDepths &bitDepths ); 141 141 Void setFrameLambda ( Double dLambda ) { m_dFrameLambda = dLambda; } 142 142 -
branches/SHM-dev/source/Lib/TLibCommon/TComRom.cpp
r1285 r1287 541 541 542 542 // ==================================================================================================================== 543 // Bit-depth544 // ====================================================================================================================545 546 Int g_bitDepth [MAX_NUM_CHANNEL_TYPE] = {8, 8};547 #if O0043_BEST_EFFORT_DECODING548 Int g_bitDepthInStream [MAX_NUM_CHANNEL_TYPE] = {8, 8}; // In the encoder, this is the same as g_bitDepth. In the decoder, this can vary from g_bitDepth if the decoder is forced to use 'best-effort decoding' at a particular bit-depth.549 #endif550 551 // ====================================================================================================================552 543 // Misc. 553 544 // ==================================================================================================================== … … 681 672 UInt g_predefSetIntraModes[NUM_INTRA_MODE-1] = {26,10,18,34,2,22,14,30,6,24,12,28,8,20,16,32,4,17,19,15,21,13,23,11,25,9,27,7,29,5,31,3,33,0,2}; 682 673 #endif 683 Int g_bitDepthLayer[MAX_NUM_CHANNEL_TYPE][MAX_LAYERS];684 void * g_refWeightACDCParam; // type=wpACDCParam685 674 Int g_mvScalingFactor [MAX_LAYERS][2] = {{0,0}, {0,0}}; 686 675 Int g_posScalingFactor [MAX_LAYERS][2] = {{0,0}, {0,0}}; -
branches/SHM-dev/source/Lib/TLibCommon/TComRom.h
r1285 r1287 153 153 154 154 // ==================================================================================================================== 155 // Bit-depth156 // ====================================================================================================================157 158 extern Int g_bitDepth [MAX_NUM_CHANNEL_TYPE];159 #if O0043_BEST_EFFORT_DECODING160 extern Int g_bitDepthInStream [MAX_NUM_CHANNEL_TYPE]; // In the encoder, this is the same as g_bitDepth. In the decoder, this can vary from g_bitDepth if the decoder is forced to use 'best-effort decoding' at a particular bit-depth.161 #endif162 163 // ====================================================================================================================164 155 // Mode-Dependent DST Matrices 165 156 // ==================================================================================================================== -
branches/SHM-dev/source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp
r1260 r1287 44 44 //! \ingroup TLibCommon 45 45 //! \{ 46 #if !SVC_EXTENSION47 UInt g_saoMaxOffsetQVal[MAX_NUM_COMPONENT];48 #endif49 46 50 47 SAOOffset::SAOOffset() … … 154 151 for(Int compIdx = 0; compIdx < MAX_NUM_COMPONENT; compIdx++) 155 152 { 156 Int bitDepthSample = g_bitDepth[toChannelType(ComponentID(compIdx))];157 153 m_offsetStepLog2 [compIdx] = isLuma(ComponentID(compIdx))? lumaBitShift : chromaBitShift; 158 #if SVC_EXTENSION159 m_saoMaxOffsetQVal[compIdx] = (1<<(min(bitDepthSample,MAX_SAO_TRUNCATED_BITDEPTH)-5))-1; //Table 9-32, inclusive160 #else161 g_saoMaxOffsetQVal[compIdx] = (1<<(min(bitDepthSample,MAX_SAO_TRUNCATED_BITDEPTH)-5))-1; //Table 9-32, inclusive162 #endif163 154 } 164 155 } … … 320 311 321 312 322 Void TComSampleAdaptiveOffset::offsetBlock( ComponentID compIdx, Int typeIdx, Int* offset313 Void TComSampleAdaptiveOffset::offsetBlock(const Int channelBitDepth, Int typeIdx, Int* offset 323 314 , Pel* srcBlk, Pel* resBlk, Int srcStride, Int resStride, Int width, Int height 324 315 , Bool isLeftAvail, Bool isRightAvail, Bool isAboveAvail, Bool isBelowAvail, Bool isAboveLeftAvail, Bool isAboveRightAvail, Bool isBelowLeftAvail, Bool isBelowRightAvail) … … 343 334 } 344 335 345 const Int maxSampleValueIncl = (1<< g_bitDepth[toChannelType(compIdx)])-1;336 const Int maxSampleValueIncl = (1<< channelBitDepth )-1; 346 337 347 338 Int x,y, startX, startY, endX, endY, edgeType; … … 540 531 case SAO_TYPE_BO: 541 532 { 542 const Int shiftBits = g_bitDepth[toChannelType(compIdx)]- NUM_SAO_BO_CLASSES_LOG2;533 const Int shiftBits = channelBitDepth - NUM_SAO_BO_CLASSES_LOG2; 543 534 for (y=0; y< height; y++) 544 535 { … … 608 599 Pel* resBlk = resYuv->getAddr(component) + blkYPos*resStride + blkXPos; 609 600 610 offsetBlock( component, ctbOffset.typeIdc, ctbOffset.offset 601 #if SVC_EXTENSION 602 offsetBlock( pPic->getSlice(0)->getBitDepth(toChannelType(component)), ctbOffset.typeIdc, ctbOffset.offset 603 #else 604 offsetBlock( pPic->getPicSym()->getSPS().getBitDepth(toChannelType(component)), ctbOffset.typeIdc, ctbOffset.offset 605 #endif 611 606 , srcBlk, resBlk, srcStride, resStride, blkWidth, blkHeight 612 607 , isLeftAvail, isRightAvail … … 743 738 else 744 739 { 745 uiPcmLeftShiftBit = g_bitDepth[toChannelType(compID)] - pcCU->getSlice()->getSPS()->getPCMBitDepth(toChannelType(compID)); 740 #if SVC_EXTENSION 741 uiPcmLeftShiftBit = pcCU->getSlice()->getBitDepth(toChannelType(compID)) - pcCU->getSlice()->getSPS()->getPCMBitDepth(toChannelType(compID)); 742 #else 743 uiPcmLeftShiftBit = pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)) - pcCU->getSlice()->getSPS()->getPCMBitDepth(toChannelType(compID)); 744 #endif 746 745 } 747 746 -
branches/SHM-dev/source/Lib/TLibCommon/TComSampleAdaptiveOffset.h
r1260 r1287 55 55 // Class definition 56 56 // ==================================================================================================================== 57 #if !SVC_EXTENSION58 extern UInt g_saoMaxOffsetQVal[MAX_NUM_COMPONENT];59 #endif60 57 61 58 template <typename T> Int sgn(T val) … … 74 71 Void reconstructBlkSAOParams(TComPic* pic, SAOBlkParam* saoBlkParams); 75 72 Void PCMLFDisableProcess (TComPic* pcPic); 76 #if SVC_EXTENSION 77 UInt* getSaoMaxOffsetQVal() { return m_saoMaxOffsetQVal; } 78 #endif 73 static Int getMaxOffsetQVal(const Int channelBitDepth) { return (1<<(std::min<Int>(channelBitDepth,MAX_SAO_TRUNCATED_BITDEPTH)-5))-1; } //Table 9-32, inclusive 74 79 75 protected: 80 Void offsetBlock( ComponentID compIdx, Int typeIdx, Int* offset, Pel* srcBlk, Pel* resBlk, Int srcStride, Int resStride, Int width, Int height76 Void offsetBlock(const Int channelBitDepth, Int typeIdx, Int* offset, Pel* srcBlk, Pel* resBlk, Int srcStride, Int resStride, Int width, Int height 81 77 , Bool isLeftAvail, Bool isRightAvail, Bool isAboveAvail, Bool isBelowAvail, Bool isAboveLeftAvail, Bool isAboveRightAvail, Bool isBelowLeftAvail, Bool isBelowRightAvail); 82 78 Void invertQuantOffsets(ComponentID compIdx, Int typeIdc, Int typeAuxInfo, Int* dstOffsets, Int* srcOffsets); … … 105 101 private: 106 102 Bool m_picSAOEnabled[MAX_NUM_COMPONENT]; 107 108 #if SVC_EXTENSION109 UInt m_saoMaxOffsetQVal[MAX_NUM_COMPONENT];110 #endif111 103 }; 112 104 -
branches/SHM-dev/source/Lib/TLibCommon/TComSlice.cpp
r1273 r1287 512 512 ); 513 513 514 Bool sameBitDepths = ( g _bitDepthLayer[CHANNEL_TYPE_LUMA][m_layerId] == g_bitDepthLayer[CHANNEL_TYPE_LUMA][refLayerId] ) && ( g_bitDepthLayer[CHANNEL_TYPE_CHROMA][m_layerId] == g_bitDepthLayer[CHANNEL_TYPE_CHROMA][refLayerId]);514 Bool sameBitDepths = ( getBitDepth(CHANNEL_TYPE_LUMA) == ilpPic[refLayerIdc]->getSlice(0)->getBitDepth(CHANNEL_TYPE_LUMA) ) && ( getBitDepth(CHANNEL_TYPE_CHROMA) == ilpPic[refLayerIdc]->getSlice(0)->getBitDepth(CHANNEL_TYPE_CHROMA) ); 515 515 516 516 // motion resampling constraint … … 1821 1821 } 1822 1822 1823 //! get AC and DC values for weighted pred1824 Void TComSlice::getWpAcDcParam(WPACDCParam *&wp)1825 {1826 wp = m_weightACDCParam;1827 }1828 1829 1823 //! init AC and DC values for weighted pred 1830 1824 Void TComSlice::initWpAcDcParam() … … 1882 1876 } 1883 1877 1884 const Int offsetScalingFactor = bUseHighPrecisionPredictionWeighting ? 1 : (1 << (g_bitDepth[toChannelType(ComponentID(yuv))]-8)); 1878 #if SVC_EXTENSION 1879 const Int offsetScalingFactor = bUseHighPrecisionPredictionWeighting ? 1 : (1 << (getBitDepth(toChannelType(ComponentID(yuv)))-8)); 1880 #else 1881 const Int offsetScalingFactor = bUseHighPrecisionPredictionWeighting ? 1 : (1 << (sps->getBitDepth(toChannelType(ComponentID(yuv)))-8)); 1882 #endif 1885 1883 1886 1884 pwp->w = pwp->iWeight; … … 2098 2096 for(Int ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++) 2099 2097 { 2100 m_uiBitDepth [ch] = 8; 2101 m_uiPCMBitDepth[ch] = 8; 2098 m_bitDepths.recon[ch] = 8; 2099 #if O0043_BEST_EFFORT_DECODING 2100 m_bitDepths.stream[ch] = 8; 2101 #endif 2102 m_pcmBitDepths[ch] = 8; 2102 2103 m_qpBDOffset [ch] = 0; 2103 2104 } … … 3560 3561 } 3561 3562 3562 UInt TComSlice::getBitDepthY() 3563 BitDepths& TComSlice::getBitDepths() 3564 { 3565 static BitDepths bitDepths; 3566 3567 bitDepths.recon[CHANNEL_TYPE_LUMA] = getBitDepth(CHANNEL_TYPE_LUMA); 3568 bitDepths.recon[CHANNEL_TYPE_CHROMA] = getBitDepth(CHANNEL_TYPE_CHROMA); 3569 3570 return bitDepths; 3571 } 3572 3573 UInt TComSlice::getBitDepth(ChannelType type) const 3563 3574 { 3564 3575 UInt retVal, layerId = getLayerId(); … … 3568 3579 if( layerId == 0 && m_pcVPS->getNonHEVCBaseLayerFlag() ) 3569 3580 { 3570 retVal = m_pcVPS->getVpsRepFormat(layerId)->getBitDepthVps Luma();3581 retVal = m_pcVPS->getVpsRepFormat(layerId)->getBitDepthVps(type); 3571 3582 } 3572 3583 else 3573 3584 { 3574 retVal = m_pcSPS->getBitDepth( CHANNEL_TYPE_LUMA);3585 retVal = m_pcSPS->getBitDepth(type); 3575 3586 } 3576 3587 } 3577 3588 else 3578 3589 { 3579 retVal = m_pcVPS->getVpsRepFormat(m_pcSPS->getUpdateRepFormatFlag() ? m_pcSPS->getUpdateRepFormatIndex() : m_pcVPS->getVpsRepFormatIdx(m_pcVPS->getLayerIdxInVps(layerId)))->getBitDepthVps Luma();3590 retVal = m_pcVPS->getVpsRepFormat(m_pcSPS->getUpdateRepFormatFlag() ? m_pcSPS->getUpdateRepFormatIndex() : m_pcVPS->getVpsRepFormatIdx(m_pcVPS->getLayerIdxInVps(layerId)))->getBitDepthVps(type); 3580 3591 } 3581 3592 … … 3583 3594 } 3584 3595 3585 UInt TComVPS::getBitDepth Y(const TComSPS* sps, const UInt layerId ) const3596 UInt TComVPS::getBitDepth( ChannelType type, const TComSPS* sps, const UInt layerId ) const 3586 3597 { 3587 3598 UInt retVal; … … 3591 3602 if( layerId == 0 && m_nonHEVCBaseLayerFlag ) 3592 3603 { 3593 retVal = m_vpsRepFormat[layerId].getBitDepthVps Luma();3604 retVal = m_vpsRepFormat[layerId].getBitDepthVps(type); 3594 3605 } 3595 3606 else 3596 3607 { 3597 retVal = sps->getBitDepth( CHANNEL_TYPE_LUMA);3608 retVal = sps->getBitDepth(type); 3598 3609 } 3599 3610 } 3600 3611 else 3601 3612 { 3602 retVal = m_vpsRepFormat[sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : m_vpsRepFormatIdx[m_layerIdxInVps[layerId]]].getBitDepthVps Luma();3613 retVal = m_vpsRepFormat[sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : m_vpsRepFormatIdx[m_layerIdxInVps[layerId]]].getBitDepthVps(type); 3603 3614 } 3604 3615 … … 3606 3617 } 3607 3618 3608 UInt TComSlice::getBitDepthC() 3609 { 3610 UInt retVal, layerId = getLayerId(); 3611 3612 if( layerId == 0 || m_pcSPS->getV1CompatibleSPSFlag() == 1 ) 3613 { 3614 if( layerId == 0 && m_pcVPS->getNonHEVCBaseLayerFlag() ) 3615 { 3616 retVal = m_pcVPS->getVpsRepFormat(layerId)->getBitDepthVpsChroma(); 3617 } 3618 else 3619 { 3620 retVal = m_pcSPS->getBitDepth(CHANNEL_TYPE_CHROMA); 3621 } 3622 } 3623 else 3624 { 3625 retVal = m_pcVPS->getVpsRepFormat(m_pcSPS->getUpdateRepFormatFlag() ? m_pcSPS->getUpdateRepFormatIndex() : m_pcVPS->getVpsRepFormatIdx(m_pcVPS->getLayerIdxInVps(layerId)))->getBitDepthVpsChroma(); 3626 } 3627 3628 return retVal; 3629 } 3630 3631 UInt TComVPS::getBitDepthC( const TComSPS* sps, const UInt layerId ) const 3632 { 3633 UInt retVal; 3634 3635 if( layerId == 0 || sps->getV1CompatibleSPSFlag() == 1 ) 3636 { 3637 if( layerId == 0 && m_nonHEVCBaseLayerFlag ) 3638 { 3639 retVal = m_vpsRepFormat[layerId].getBitDepthVpsChroma(); 3640 } 3641 else 3642 { 3643 retVal = sps->getBitDepth(CHANNEL_TYPE_CHROMA); 3644 } 3645 } 3646 else 3647 { 3648 retVal = m_vpsRepFormat[sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : m_vpsRepFormatIdx[m_layerIdxInVps[layerId]]].getBitDepthVpsChroma(); 3649 } 3650 3651 return retVal; 3652 } 3653 3654 Int TComSlice::getQpBDOffsetY() 3655 { 3656 return (getBitDepthY() - 8) * 6; 3657 } 3658 3659 Int TComSlice::getQpBDOffsetC() 3660 { 3661 return (getBitDepthC() - 8) * 6; 3619 const BitDepths& TComVPS::getBitDepths( const TComSPS* sps, const UInt layerId ) const 3620 { 3621 static const BitDepths bitDepths( getBitDepth(CHANNEL_TYPE_LUMA, sps, layerId), getBitDepth(CHANNEL_TYPE_CHROMA, sps, layerId) ); 3622 return bitDepths; 3662 3623 } 3663 3624 … … 3783 3744 pcIlpPic[refLayerIdc]->getSlice(0)->setPPS( m_pcPic->getSlice(0)->getPPS() ); 3784 3745 3746 // assign SPS to ILRP to be used for obtaining bit depth 3747 pcIlpPic[refLayerIdc]->getSlice(0)->setSPS( m_pcPic->getSlice(0)->getSPS() ); 3748 3785 3749 // assing VPS to ILRP to be used for deriving layerIdx 3786 3750 pcIlpPic[refLayerIdc]->getSlice(0)->setVPS( m_pcPic->getSlice(0)->getVPS() ); -
branches/SHM-dev/source/Lib/TLibCommon/TComSlice.h
r1285 r1287 563 563 Void setBitDepthVpsChroma(Int x) { m_bitDepthVpsChroma = x; } 564 564 565 Int getBitDepthVps(ChannelType type) 565 Int getBitDepthVps(ChannelType type) const { return isLuma(type) ? m_bitDepthVpsLuma : m_bitDepthVpsChroma; } 566 566 567 567 Window& getConformanceWindowVps() { return m_conformanceWindowVps; } … … 1129 1129 UInt getPicHeightInLumaSamples( const TComSPS* sps, const UInt layerId ) const; 1130 1130 UInt getPicWidthInLumaSamples( const TComSPS* sps, const UInt layerId ) const; 1131 UInt getBitDepth Y(const TComSPS* sps, const UInt layerId ) const;1132 UInt getBitDepthC( const TComSPS* sps, const UInt layerId ) const;1131 UInt getBitDepth( ChannelType type, const TComSPS* sps, const UInt layerId ) const; 1132 const BitDepths& getBitDepths( const TComSPS* sps, const UInt layerId ) const; 1133 1133 const Window& getConformanceWindow( const TComSPS* sps, const UInt layerId ) const; 1134 1134 #endif //SVC_EXTENSION … … 1304 1304 }; 1305 1305 1306 1306 1307 /// SPS class 1307 1308 class TComSPS … … 1342 1343 1343 1344 // Parameter 1344 Int m_uiBitDepth[MAX_NUM_CHANNEL_TYPE];1345 BitDepths m_bitDepths; 1345 1346 Int m_qpBDOffset[MAX_NUM_CHANNEL_TYPE]; 1346 1347 Bool m_useExtendedPrecision; … … 1351 1352 Bool m_alignCABACBeforeBypass; 1352 1353 Bool m_useResidualDPCM[NUMBER_OF_RDPCM_SIGNALLING_MODES]; 1353 UInt m_uiPCMBitDepth[MAX_NUM_CHANNEL_TYPE];1354 Int m_pcmBitDepths[MAX_NUM_CHANNEL_TYPE]; 1354 1355 Bool m_bPCMFilterDisableFlag; 1355 1356 Bool m_disableIntraReferenceSmoothing; … … 1478 1479 1479 1480 // Bit-depth 1480 Int getBitDepth(ChannelType type) const { return m_uiBitDepth[type]; } 1481 Void setBitDepth(ChannelType type, Int u ) { m_uiBitDepth[type] = u; } 1482 Int getMaxLog2TrDynamicRange(ChannelType channelType) const { return getUseExtendedPrecision() ? std::max<Int>(15, Int(m_uiBitDepth[channelType] + 6)) : 15; } 1483 1484 Int getDifferentialLumaChromaBitDepth() const { return Int(m_uiBitDepth[CHANNEL_TYPE_LUMA]) - Int(m_uiBitDepth[CHANNEL_TYPE_CHROMA]); } 1481 Int getBitDepth(ChannelType type) const { return m_bitDepths.recon[type]; } 1482 Void setBitDepth(ChannelType type, Int u ) { m_bitDepths.recon[type] = u; } 1483 #if O0043_BEST_EFFORT_DECODING 1484 Int getStreamBitDepth(ChannelType type) const { return m_bitDepths.stream[type]; } 1485 Void setStreamBitDepth(ChannelType type, Int u ) { m_bitDepths.stream[type] = u; } 1486 #endif 1487 const BitDepths& getBitDepths() const { return m_bitDepths; } 1488 Int getMaxLog2TrDynamicRange(ChannelType channelType) const { return getUseExtendedPrecision() ? std::max<Int>(15, Int(m_bitDepths.recon[channelType] + 6)) : 15; } 1489 1490 Int getDifferentialLumaChromaBitDepth() const { return Int(m_bitDepths.recon[CHANNEL_TYPE_LUMA]) - Int(m_bitDepths.recon[CHANNEL_TYPE_CHROMA]); } 1485 1491 Int getQpBDOffset(ChannelType type) const { return m_qpBDOffset[type]; } 1486 1492 Void setQpBDOffset(ChannelType type, Int i) { m_qpBDOffset[type] = i; } … … 1513 1519 Bool getTemporalIdNestingFlag() const { return m_bTemporalIdNestingFlag; } 1514 1520 Void setTemporalIdNestingFlag( Bool bValue ) { m_bTemporalIdNestingFlag = bValue; } 1515 UInt getPCMBitDepth(ChannelType type) const { return m_ uiPCMBitDepth[type];}1516 Void setPCMBitDepth(ChannelType type, UInt u) { m_ uiPCMBitDepth[type] = u;}1521 UInt getPCMBitDepth(ChannelType type) const { return m_pcmBitDepths[type]; } 1522 Void setPCMBitDepth(ChannelType type, UInt u) { m_pcmBitDepths[type] = u; } 1517 1523 Void setPCMFilterDisableFlag( Bool bValue ) { m_bPCMFilterDisableFlag = bValue; } 1518 1524 Bool getPCMFilterDisableFlag() const { return m_bPCMFilterDisableFlag; } … … 2260 2266 } 2261 2267 2262 Void getWpAcDcParam( WPACDCParam *&wp ); 2268 WPACDCParam* getWpAcDcParam() { return &m_weightACDCParam[0]; } 2269 2263 2270 Void initWpAcDcParam(); 2264 2271 … … 2293 2300 2294 2301 Void setLayerId(UInt layerId) { m_layerId = layerId; } 2295 UInt getLayerId() 2302 UInt getLayerId() const { return m_layerId; } 2296 2303 UInt getLayerIdx() { return m_pcVPS->getLayerIdxInVps(m_layerId); } 2297 2304 … … 2347 2354 UInt getPicHeightInLumaSamples(); 2348 2355 ChromaFormat getChromaFormatIdc(); 2349 UInt getBitDepthY(); 2350 UInt getBitDepthC(); 2351 Int getQpBDOffsetY(); 2352 Int getQpBDOffsetC(); 2356 UInt getBitDepth(ChannelType type) const; 2357 BitDepths& getBitDepths(); 2358 Int getQpBDOffset(ChannelType type) const { return (getBitDepth(type) - 8) * 6; } 2353 2359 2354 2360 const Window& getConformanceWindow() const; -
branches/SHM-dev/source/Lib/TLibCommon/TComTrQuant.cpp
r1285 r1287 119 119 toChannelType(compID), 120 120 #if SVC_EXTENSION 121 isLuma(compID) ? slice->getQpBDOffsetY() : slice->getQpBDOffsetC(),121 cu.getSlice()->getQpBDOffset(toChannelType(compID)), 122 122 #else 123 123 cu.getSlice()->getSPS()->getQpBDOffset(toChannelType(compID)), … … 1147 1147 TComDataCU* pcCU = rTu.getCU(); 1148 1148 const UInt uiAbsPartIdx = rTu.GetAbsPartIdxTU(); 1149 #if SVC_EXTENSION 1150 const Int channelBitDepth = pcCU->getSlice()->getBitDepth(toChannelType(compID)); 1151 #else 1152 const Int channelBitDepth = pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)); 1153 #endif 1149 1154 1150 1155 TCoeff* piCoef = pSrc; … … 1192 1197 1193 1198 // Represents scaling through forward transform 1194 Int iTransformShift = getTransformShift( toChannelType(compID), uiLog2TrSize, maxLog2TrDynamicRange);1199 Int iTransformShift = getTransformShift(channelBitDepth, uiLog2TrSize, maxLog2TrDynamicRange); 1195 1200 if (useTransformSkip && pcCU->getSlice()->getSPS()->getUseExtendedPrecision()) 1196 1201 { … … 1271 1276 const Bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, (pcCU->getTransformSkip(uiAbsPartIdx, compID) != 0)); 1272 1277 const Int scalingListType = getScalingListType(pcCU->getPredictionMode(uiAbsPartIdx), compID); 1278 #if O0043_BEST_EFFORT_DECODING 1279 const Int channelBitDepth = pcCU->getSlice()->getSPS()->getStreamBitDepth(toChannelType(compID)); 1280 #else 1281 #if SVC_EXTENSION 1282 const Int channelBitDepth = pcCU->getSlice()->getBitDepth(toChannelType(compID)); 1283 #else 1284 const Int channelBitDepth = pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)); 1285 #endif 1286 #endif 1273 1287 1274 1288 assert (scalingListType < SCALING_LIST_NUM); … … 1277 1291 // Represents scaling through forward transform 1278 1292 const Bool bClipTransformShiftTo0 = (pcCU->getTransformSkip(uiAbsPartIdx, compID) != 0) && pcCU->getSlice()->getSPS()->getUseExtendedPrecision(); 1279 const Int originalTransformShift = getTransformShift( toChannelType(compID), uiLog2TrSize, maxLog2TrDynamicRange);1293 const Int originalTransformShift = getTransformShift(channelBitDepth, uiLog2TrSize, maxLog2TrDynamicRange); 1280 1294 const Int iTransformShift = bClipTransformShiftTo0 ? std::max<Int>(0, originalTransformShift) : originalTransformShift; 1281 1295 … … 1443 1457 else 1444 1458 { 1445 xT( compID, rTu.useDST(compID), pcResidual, uiStride, m_plTempCoeff, uiWidth, uiHeight, pcCU->getSlice()->getSPS()->getMaxLog2TrDynamicRange(toChannelType(compID)) ); 1459 #if SVC_EXTENSION 1460 const Int channelBitDepth=pcCU->getSlice()->getBitDepth(toChannelType(compID)); 1461 #else 1462 const Int channelBitDepth=pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)); 1463 #endif 1464 xT( channelBitDepth, rTu.useDST(compID), pcResidual, uiStride, m_plTempCoeff, uiWidth, uiHeight, pcCU->getSlice()->getSPS()->getMaxLog2TrDynamicRange(toChannelType(compID)) ); 1446 1465 } 1447 1466 … … 1573 1592 else 1574 1593 { 1575 xIT( compID, rTu.useDST(compID), m_plTempCoeff, pcResidual, uiStride, uiWidth, uiHeight, pcCU->getSlice()->getSPS()->getMaxLog2TrDynamicRange(toChannelType(compID)) ); 1594 #if O0043_BEST_EFFORT_DECODING 1595 const Int channelBitDepth = pcCU->getSlice()->getSPS()->getStreamBitDepth(toChannelType(compID)); 1596 #else 1597 #if SVC_EXTENSION 1598 const Int channelBitDepth = pcCU->getSlice()->getBitDepth(toChannelType(compID)); 1599 #else 1600 const Int channelBitDepth = pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)); 1601 #endif 1602 #endif 1603 xIT( channelBitDepth, rTu.useDST(compID), m_plTempCoeff, pcResidual, uiStride, uiWidth, uiHeight, pcCU->getSlice()->getSPS()->getMaxLog2TrDynamicRange(toChannelType(compID)) ); 1576 1604 1577 1605 #if defined DEBUG_STRING … … 1865 1893 * \param iHeight transform height 1866 1894 */ 1867 Void TComTrQuant::xT( const ComponentID compID, Bool useDST, Pel* piBlkResi, UInt uiStride, TCoeff* psCoeff, Int iWidth, Int iHeight, const Int maxLog2TrDynamicRange )1895 Void TComTrQuant::xT( const Int channelBitDepth, Bool useDST, Pel* piBlkResi, UInt uiStride, TCoeff* psCoeff, Int iWidth, Int iHeight, const Int maxLog2TrDynamicRange ) 1868 1896 { 1869 1897 #if MATRIX_MULT 1870 1898 if( iWidth == iHeight) 1871 1899 { 1872 xTr( g_bitDepth[toChannelType(compID)], piBlkResi, psCoeff, uiStride, (UInt)iWidth, useDST, maxLog2TrDynamicRange);1900 xTr(channelBitDepth, piBlkResi, psCoeff, uiStride, (UInt)iWidth, useDST, maxLog2TrDynamicRange); 1873 1901 return; 1874 1902 } … … 1886 1914 } 1887 1915 1888 xTrMxN( g_bitDepth[toChannelType(compID)], block, coeff, iWidth, iHeight, useDST, maxLog2TrDynamicRange );1916 xTrMxN( channelBitDepth, block, coeff, iWidth, iHeight, useDST, maxLog2TrDynamicRange ); 1889 1917 1890 1918 memcpy(psCoeff, coeff, (iWidth * iHeight * sizeof(TCoeff))); … … 1900 1928 * \param iHeight transform height 1901 1929 */ 1902 Void TComTrQuant::xIT( const ComponentID compID, Bool useDST, TCoeff* plCoef, Pel* pResidual, UInt uiStride, Int iWidth, Int iHeight, const Int maxLog2TrDynamicRange )1930 Void TComTrQuant::xIT( const Int channelBitDepth, Bool useDST, TCoeff* plCoef, Pel* pResidual, UInt uiStride, Int iWidth, Int iHeight, const Int maxLog2TrDynamicRange ) 1903 1931 { 1904 1932 #if MATRIX_MULT 1905 1933 if( iWidth == iHeight ) 1906 1934 { 1907 #if O0043_BEST_EFFORT_DECODING 1908 xITr(g_bitDepthInStream[toChannelType(compID)], plCoef, pResidual, uiStride, (UInt)iWidth, useDST, maxLog2TrDynamicRange); 1909 #else 1910 xITr(g_bitDepth[toChannelType(compID)], plCoef, pResidual, uiStride, (UInt)iWidth, useDST, maxLog2TrDynamicRange); 1911 #endif 1935 xITr(channelBitDepth, plCoef, pResidual, uiStride, (UInt)iWidth, useDST, maxLog2TrDynamicRange); 1912 1936 return; 1913 1937 } … … 1919 1943 memcpy(coeff, plCoef, (iWidth * iHeight * sizeof(TCoeff))); 1920 1944 1921 #if O0043_BEST_EFFORT_DECODING 1922 xITrMxN( g_bitDepthInStream[toChannelType(compID)], coeff, block, iWidth, iHeight, useDST, maxLog2TrDynamicRange ); 1923 #else 1924 xITrMxN( g_bitDepth[toChannelType(compID)], coeff, block, iWidth, iHeight, useDST, maxLog2TrDynamicRange ); 1925 #endif 1945 xITrMxN( channelBitDepth, coeff, block, iWidth, iHeight, useDST, maxLog2TrDynamicRange ); 1926 1946 1927 1947 for (Int y = 0; y < iHeight; y++) … … 1947 1967 const Int height = rect.height; 1948 1968 const Int maxLog2TrDynamicRange = rTu.getCU()->getSlice()->getSPS()->getMaxLog2TrDynamicRange(toChannelType(component)); 1949 1950 Int iTransformShift = getTransformShift(toChannelType(component), rTu.GetEquivalentLog2TrSize(component), maxLog2TrDynamicRange); 1969 #if SVC_EXTENSION 1970 const Int channelBitDepth = rTu.getCU()->getSlice()->getBitDepth(toChannelType(component)); 1971 #else 1972 const Int channelBitDepth = rTu.getCU()->getSlice()->getSPS()->getBitDepth(toChannelType(component)); 1973 #endif 1974 1975 Int iTransformShift = getTransformShift(channelBitDepth, rTu.GetEquivalentLog2TrSize(component), maxLog2TrDynamicRange); 1951 1976 if (rTu.getCU()->getSlice()->getSPS()->getUseExtendedPrecision()) 1952 1977 { … … 1995 2020 const Int height = rect.height; 1996 2021 const Int maxLog2TrDynamicRange = rTu.getCU()->getSlice()->getSPS()->getMaxLog2TrDynamicRange(toChannelType(component)); 1997 1998 Int iTransformShift = getTransformShift(toChannelType(component), rTu.GetEquivalentLog2TrSize(component), maxLog2TrDynamicRange); 2022 #if O0043_BEST_EFFORT_DECODING 2023 const Int channelBitDepth = rTu.getCU()->getSlice()->getSPS()->getStreamBitDepth(toChannelType(component)); 2024 #else 2025 #if SVC_EXTENSION 2026 const Int channelBitDepth = rTu.getCU()->getSlice()->getBitDepth(toChannelType(component)); 2027 #else 2028 const Int channelBitDepth = rTu.getCU()->getSlice()->getSPS()->getBitDepth(toChannelType(component)); 2029 #endif 2030 #endif 2031 2032 Int iTransformShift = getTransformShift(channelBitDepth, rTu.GetEquivalentLog2TrSize(component), maxLog2TrDynamicRange); 1999 2033 if (rTu.getCU()->getSlice()->getSPS()->getUseExtendedPrecision()) 2000 2034 { … … 2063 2097 const Bool extendedPrecision = pcCU->getSlice()->getSPS()->getUseExtendedPrecision(); 2064 2098 const Int maxLog2TrDynamicRange = pcCU->getSlice()->getSPS()->getMaxLog2TrDynamicRange(toChannelType(compID)); 2099 #if SVC_EXTENSION 2100 const Int channelBitDepth = rTu.getCU()->getSlice()->getBitDepth(channelType); 2101 #else 2102 const Int channelBitDepth = rTu.getCU()->getSlice()->getSPS()->getBitDepth(channelType); 2103 #endif 2065 2104 2066 2105 /* for 422 chroma blocks, the effective scaling applied during transformation is not a power of 2, hence it cannot be … … 2071 2110 2072 2111 // Represents scaling through forward transform 2073 Int iTransformShift = getTransformShift(channelType, uiLog2TrSize, maxLog2TrDynamicRange);2112 Int iTransformShift = getTransformShift(channelBitDepth, uiLog2TrSize, maxLog2TrDynamicRange); 2074 2113 if ((pcCU->getTransformSkip(uiAbsPartIdx, compID) != 0) && pcCU->getSlice()->getSPS()->getUseExtendedPrecision()) 2075 2114 { … … 2457 2496 const Double inverseQuantScale = Double(g_invQuantScales[cQP.rem]); 2458 2497 Int64 rdFactor = (Int64)(inverseQuantScale * inverseQuantScale * (1 << (2 * cQP.per)) 2459 / m_dLambda / 16 / (1 << (2 * DISTORTION_PRECISION_ADJUSTMENT( g_bitDepth[channelType]- 8)))2498 / m_dLambda / 16 / (1 << (2 * DISTORTION_PRECISION_ADJUSTMENT(channelBitDepth - 8))) 2460 2499 + 0.5); 2461 2500 … … 2986 3025 * \param format chroma format 2987 3026 */ 2988 Void TComTrQuant::setScalingList(TComScalingList *scalingList, const ChromaFormat format, const Int maxLog2TrDynamicRange[MAX_NUM_CHANNEL_TYPE] )3027 Void TComTrQuant::setScalingList(TComScalingList *scalingList, const ChromaFormat format, const Int maxLog2TrDynamicRange[MAX_NUM_CHANNEL_TYPE], const BitDepths &bitDepths) 2989 3028 { 2990 3029 const Int minimumQp = 0; … … 2999 3038 xSetScalingListEnc(scalingList,list,size,qp,format); 3000 3039 xSetScalingListDec(*scalingList,list,size,qp,format); 3001 setErrScaleCoeff(list,size,qp,maxLog2TrDynamicRange );3040 setErrScaleCoeff(list,size,qp,maxLog2TrDynamicRange, bitDepths); 3002 3041 } 3003 3042 } … … 3029 3068 * \param qp Quantization parameter 3030 3069 */ 3031 Void TComTrQuant::setErrScaleCoeff(UInt list, UInt size, Int qp, const Int maxLog2TrDynamicRange[MAX_NUM_CHANNEL_TYPE] )3070 Void TComTrQuant::setErrScaleCoeff(UInt list, UInt size, Int qp, const Int maxLog2TrDynamicRange[MAX_NUM_CHANNEL_TYPE], const BitDepths &bitDepths) 3032 3071 { 3033 3072 const UInt uiLog2TrSize = g_aucConvertToBit[ g_scalingListSizeX[size] ] + 2; 3034 3073 const ChannelType channelType = ((list == 0) || (list == MAX_NUM_COMPONENT)) ? CHANNEL_TYPE_LUMA : CHANNEL_TYPE_CHROMA; 3035 3074 3036 const Int iTransformShift = getTransformShift(channelType, uiLog2TrSize, maxLog2TrDynamicRange[channelType]); // Represents scaling through forward transform 3075 const Int channelBitDepth = bitDepths.recon[channelType]; 3076 const Int iTransformShift = getTransformShift(channelBitDepth, uiLog2TrSize, maxLog2TrDynamicRange[channelType]); // Represents scaling through forward transform 3037 3077 3038 3078 UInt i,uiMaxNumCoeff = g_scalingListSize[size]; … … 3047 3087 for(i=0;i<uiMaxNumCoeff;i++) 3048 3088 { 3049 pdErrScale[i] = dErrScale / piQuantcoeff[i] / piQuantcoeff[i] / (1 << DISTORTION_PRECISION_ADJUSTMENT(2 * ( g_bitDepth[channelType] - 8)));3050 } 3051 3052 getErrScaleCoeffNoScalingList(list, size, qp) = dErrScale / g_quantScales[qp] / g_quantScales[qp] / (1 << DISTORTION_PRECISION_ADJUSTMENT(2 * ( g_bitDepth[channelType] - 8)));3089 pdErrScale[i] = dErrScale / piQuantcoeff[i] / piQuantcoeff[i] / (1 << DISTORTION_PRECISION_ADJUSTMENT(2 * (bitDepths.recon[channelType] - 8))); 3090 } 3091 3092 getErrScaleCoeffNoScalingList(list, size, qp) = dErrScale / g_quantScales[qp] / g_quantScales[qp] / (1 << DISTORTION_PRECISION_ADJUSTMENT(2 * (bitDepths.recon[channelType] - 8))); 3053 3093 } 3054 3094 … … 3108 3148 /** set flat matrix value to quantized coefficient 3109 3149 */ 3110 Void TComTrQuant::setFlatScalingList(const ChromaFormat format, const Int maxLog2TrDynamicRange[MAX_NUM_CHANNEL_TYPE] )3150 Void TComTrQuant::setFlatScalingList(const ChromaFormat format, const Int maxLog2TrDynamicRange[MAX_NUM_CHANNEL_TYPE], const BitDepths &bitDepths) 3111 3151 { 3112 3152 const Int minimumQp = 0; … … 3120 3160 { 3121 3161 xsetFlatScalingList(list,size,qp,format); 3122 setErrScaleCoeff(list,size,qp,maxLog2TrDynamicRange );3162 setErrScaleCoeff(list,size,qp,maxLog2TrDynamicRange, bitDepths); 3123 3163 } 3124 3164 } … … 3256 3296 const UInt uiHeight = rect.height; 3257 3297 const Int maxLog2TrDynamicRange = pcCU->getSlice()->getSPS()->getMaxLog2TrDynamicRange(toChannelType(compID)); 3258 const Int iTransformShift = getTransformShift(toChannelType(compID), rTu.GetEquivalentLog2TrSize(compID), maxLog2TrDynamicRange); 3298 #if SVC_EXTENSION 3299 const Int channelBitDepth = pcCU->getSlice()->getBitDepth(toChannelType(compID)); 3300 #else 3301 const Int channelBitDepth = pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)); 3302 #endif 3303 const Int iTransformShift = getTransformShift(channelBitDepth, rTu.GetEquivalentLog2TrSize(compID), maxLog2TrDynamicRange); 3259 3304 const Int scalingListType = getScalingListType(pcCU->getPredictionMode(uiAbsPartIdx), compID); 3260 3305 const Bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, true); … … 3315 3360 const Int QP_rem = cQP.rem; 3316 3361 const Int maxLog2TrDynamicRange = pcCU->getSlice()->getSPS()->getMaxLog2TrDynamicRange(toChannelType(compID)); 3317 const Int iTransformShift = getTransformShift(toChannelType(compID), rTu.GetEquivalentLog2TrSize(compID), maxLog2TrDynamicRange); 3362 #if O0043_BEST_EFFORT_DECODING 3363 const Int channelBitDepth = pcCU->getSlice()->getSPS()->getStreamBitDepth(toChannelType(compID)); 3364 #else 3365 #if SVC_EXTENSION 3366 const Int channelBitDepth = pcCU->getSlice()->getBitDepth(toChannelType(compID)); 3367 #else 3368 const Int channelBitDepth = pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)); 3369 #endif 3370 #endif 3371 const Int iTransformShift = getTransformShift(channelBitDepth, rTu.GetEquivalentLog2TrSize(compID), maxLog2TrDynamicRange); 3318 3372 const Int scalingListType = getScalingListType(pcCU->getPredictionMode(uiAbsPartIdx), compID); 3319 3373 const Bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, true); -
branches/SHM-dev/source/Lib/TLibCommon/TComTrQuant.h
r1285 r1287 172 172 Void initScalingList (); 173 173 Void destroyScalingList (); 174 Void setErrScaleCoeff ( UInt list, UInt size, Int qp, const Int maxLog2TrDynamicRange[MAX_NUM_CHANNEL_TYPE] );174 Void setErrScaleCoeff ( UInt list, UInt size, Int qp, const Int maxLog2TrDynamicRange[MAX_NUM_CHANNEL_TYPE], const BitDepths &bitDepths ); 175 175 Double* getErrScaleCoeff ( UInt list, UInt size, Int qp ) { return m_errScale [size][list][qp]; }; //!< get Error Scale Coefficent 176 176 Double& getErrScaleCoeffNoScalingList ( UInt list, UInt size, Int qp ) { return m_errScaleNoScalingList[size][list][qp]; }; //!< get Error Scale Coefficent … … 179 179 Void setUseScalingList ( Bool bUseScalingList){ m_scalingListEnabledFlag = bUseScalingList; }; 180 180 Bool getUseScalingList (const UInt width, const UInt height, const Bool isTransformSkip){ return m_scalingListEnabledFlag && (!isTransformSkip || ((width == 4) && (height == 4))); }; 181 Void setFlatScalingList (const ChromaFormat format, const Int maxLog2TrDynamicRange[MAX_NUM_CHANNEL_TYPE] );181 Void setFlatScalingList (const ChromaFormat format, const Int maxLog2TrDynamicRange[MAX_NUM_CHANNEL_TYPE], const BitDepths &bitDepths); 182 182 Void xsetFlatScalingList ( UInt list, UInt size, Int qp, const ChromaFormat format); 183 183 Void xSetScalingListEnc ( TComScalingList *scalingList, UInt list, UInt size, Int qp, const ChromaFormat format); 184 184 Void xSetScalingListDec ( const TComScalingList &scalingList, UInt list, UInt size, Int qp, const ChromaFormat format); 185 Void setScalingList ( TComScalingList *scalingList, const ChromaFormat format, const Int maxLog2TrDynamicRange[MAX_NUM_CHANNEL_TYPE] );185 Void setScalingList ( TComScalingList *scalingList, const ChromaFormat format, const Int maxLog2TrDynamicRange[MAX_NUM_CHANNEL_TYPE], const BitDepths &bitDepths); 186 186 Void setScalingListDec ( const TComScalingList &scalingList, const ChromaFormat format); 187 187 Void processScalingListEnc( Int *coeff, Int *quantcoeff, Int quantScales, UInt height, UInt width, UInt ratio, Int sizuNum, UInt dc); … … 230 230 private: 231 231 // forward Transform 232 Void xT ( const ComponentID compID, Bool useDST, Pel* piBlkResi, UInt uiStride, TCoeff* psCoeff, Int iWidth, Int iHeight, const Int maxLog2TrDynamicRange );232 Void xT ( const Int channelBitDepth, Bool useDST, Pel* piBlkResi, UInt uiStride, TCoeff* psCoeff, Int iWidth, Int iHeight, const Int maxLog2TrDynamicRange ); 233 233 234 234 // skipping Transform … … 304 304 305 305 // inverse transform 306 Void xIT ( const ComponentID compID, Bool useDST, TCoeff* plCoef, Pel* pResidual, UInt uiStride, Int iWidth, Int iHeight, const Int maxLog2TrDynamicRange );306 Void xIT ( const Int channelBitDepth, Bool useDST, TCoeff* plCoef, Pel* pResidual, UInt uiStride, Int iWidth, Int iHeight, const Int maxLog2TrDynamicRange ); 307 307 308 308 // inverse skipping transform -
branches/SHM-dev/source/Lib/TLibCommon/TComUpsampleFilter.cpp
r1235 r1287 51 51 } 52 52 53 Void TComUpsampleFilter::upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic )53 Void TComUpsampleFilter::upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Int refBitDepthLuma, const Int refBitDepthChroma ) 54 54 { 55 55 assert ( NTAPS_US_LUMA == 8 ); … … 63 63 const Window &scalEL = currSlice->getPPS()->getScaledRefLayerWindowForLayer(refLayerId); 64 64 const Window &windowRL = currSlice->getPPS()->getRefLayerWindowForLayer(refLayerId); 65 66 Int bitDepthLuma = currSlice->getBitDepth(CHANNEL_TYPE_LUMA); 67 Int bitDepthChroma = currSlice->getBitDepth(CHANNEL_TYPE_CHROMA); 65 68 66 69 //========== Y component upsampling =========== … … 115 118 piDstY = piDstBufY + scalEL.getWindowLeftOffset() + scalEL.getWindowTopOffset() * strideEL; 116 119 117 Int shift = g_bitDepthLayer[CHANNEL_TYPE_LUMA][currLayerId] - g_bitDepthLayer[CHANNEL_TYPE_LUMA][refLayerId];120 Int shift = bitDepthLuma - refBitDepthLuma; 118 121 119 122 #if CGS_3D_ASYMLUT 120 123 if( currSlice->getPPS()->getCGSFlag() ) 121 124 { 122 shift = g_bitDepthLayer[CHANNEL_TYPE_LUMA][currLayerId]- currSlice->getPPS()->getCGSOutputBitDepthY();125 shift = bitDepthLuma - currSlice->getPPS()->getCGSOutputBitDepthY(); 123 126 } 124 127 assert( shift >= 0 ); … … 151 154 piDstV = piDstBufV + ( scalEL.getWindowLeftOffset() >> 1 ) + ( scalEL.getWindowTopOffset() >> 1 ) * strideEL; 152 155 153 shift = g_bitDepthLayer[CHANNEL_TYPE_CHROMA][currLayerId] - g_bitDepthLayer[CHANNEL_TYPE_CHROMA][refLayerId];156 shift = bitDepthChroma - refBitDepthChroma; 154 157 155 158 #if CGS_3D_ASYMLUT 156 159 if( currSlice->getPPS()->getCGSFlag() ) 157 160 { 158 shift = g_bitDepthLayer[CHANNEL_TYPE_CHROMA][currLayerId]- currSlice->getPPS()->getCGSOutputBitDepthC();161 shift = currSlice->getBitDepth(CHANNEL_TYPE_CHROMA) - currSlice->getPPS()->getCGSOutputBitDepthC(); 159 162 } 160 163 #endif … … 218 221 219 222 // g_bitDepthY was set to EL bit-depth, but shift1 should be calculated using BL bit-depth 220 Int shift1 = g_bitDepthLayer[CHANNEL_TYPE_LUMA][refLayerId]- 8;223 Int shift1 = refBitDepthLuma - 8; 221 224 222 225 #if CGS_3D_ASYMLUT … … 254 257 pcTempPic->setHeight(heightEL); 255 258 256 Int nShift = 20 - g_bitDepthLayer[CHANNEL_TYPE_LUMA][currLayerId];259 Int nShift = 20 - bitDepthLuma; 257 260 Int iOffset = 1 << (nShift - 1); 258 261 … … 273 276 for( i = pcTempPic->getWidth(COMPONENT_Y); i > 0; i-- ) 274 277 { 275 *piDstY = Clip ( (sumLumaVer(piSrcY, coeff, strideEL) + iOffset) >> (nShift), CHANNEL_TYPE_LUMA);278 *piDstY = ClipBD( (sumLumaVer(piSrcY, coeff, strideEL) + iOffset) >> (nShift), bitDepthLuma ); 276 279 piSrcY++; 277 280 piDstY++; … … 318 321 319 322 // g_bitDepthC was set to EL bit-depth, but shift1 should be calculated using BL bit-depth 320 shift1 = g_bitDepthLayer[CHANNEL_TYPE_CHROMA][refLayerId]- 8;323 shift1 = refBitDepthChroma - 8; 321 324 322 325 #if CGS_3D_ASYMLUT … … 360 363 pcTempPic->setHeight(heightEL << 1); 361 364 362 nShift = 20 - g_bitDepthLayer[CHANNEL_TYPE_CHROMA][currLayerId];365 nShift = 20 - bitDepthChroma; 363 366 364 367 iOffset = 1 << (nShift - 1); … … 384 387 for( i = pcTempPic->getWidth(COMPONENT_Y) >> 1; i > 0; i-- ) 385 388 { 386 *piDstU = Clip ( (sumChromaVer(piSrcU, coeff, strideEL) + iOffset) >> (nShift), CHANNEL_TYPE_CHROMA);387 *piDstV = Clip ( (sumChromaVer(piSrcV, coeff, strideEL) + iOffset) >> (nShift), CHANNEL_TYPE_CHROMA);389 *piDstU = ClipBD( (sumChromaVer(piSrcU, coeff, strideEL) + iOffset) >> (nShift), bitDepthChroma ); 390 *piDstV = ClipBD( (sumChromaVer(piSrcV, coeff, strideEL) + iOffset) >> (nShift), bitDepthChroma ); 388 391 piSrcU++; 389 392 piSrcV++; -
branches/SHM-dev/source/Lib/TLibCommon/TComUpsampleFilter.h
r1090 r1287 42 42 TComUpsampleFilter(void); 43 43 ~TComUpsampleFilter(void); 44 Void upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic );44 Void upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Int refBitDepthLuma, const Int refBitDepthChroma ); 45 45 46 46 }; -
branches/SHM-dev/source/Lib/TLibCommon/TComWeightPrediction.cpp
r1262 r1287 67 67 Void TComWeightPrediction::addWeightBi( const TComYuv *pcYuvSrc0, 68 68 const TComYuv *pcYuvSrc1, 69 const BitDepths &bitDepths, 69 70 const UInt iPartUnitIdx, 70 71 const UInt uiWidth, … … 73 74 const WPScalingParam *const wp1, 74 75 TComYuv *const rpcYuvDst, 75 const Bool bRoundLuma 76 const Bool bRoundLuma) 76 77 { 77 78 … … 91 92 const Int w0 = wp0[compID].w; 92 93 const Int offset = wp0[compID].offset; 93 const Int clipBD = g_bitDepth[toChannelType(compID)];94 const Int clipBD = bitDepths.recon[toChannelType(compID)]; 94 95 const Int shiftNum = std::max<Int>(2, (IF_INTERNAL_PREC - clipBD)); 95 96 const Int shift = wp0[compID].shift + shiftNum; … … 131 132 //! weighted averaging for uni-pred 132 133 Void TComWeightPrediction::addWeightUni( const TComYuv *const pcYuvSrc0, 134 const BitDepths &bitDepths, 133 135 const UInt iPartUnitIdx, 134 136 const UInt uiWidth, … … 149 151 const Int w0 = wp0[compID].w; 150 152 const Int offset = wp0[compID].offset; 151 const Int clipBD = g_bitDepth[toChannelType(compID)];153 const Int clipBD = bitDepths.recon[toChannelType(compID)]; 152 154 const Int shiftNum = std::max<Int>(2, (IF_INTERNAL_PREC - clipBD)); 153 155 const Int shift = wp0[compID].shift + shiftNum; … … 230 232 for ( Int yuv=0 ; yuv<numValidComponent ; yuv++ ) 231 233 { 232 const Int bitDepth = g_bitDepth[toChannelType(ComponentID(yuv))]; 234 #if SVC_EXTENSION 235 const Int bitDepth = pcSlice->getBitDepth(toChannelType(ComponentID(yuv))); 236 #else 237 const Int bitDepth = pcSlice->getSPS()->getBitDepth(toChannelType(ComponentID(yuv))); 238 #endif 233 239 const Int offsetScalingFactor = bUseHighPrecisionPredictionWeighting ? 1 : (1 << (bitDepth-8)); 234 240 … … 251 257 for ( Int yuv=0 ; yuv<numValidComponent ; yuv++ ) 252 258 { 253 const Int bitDepth = g_bitDepth[toChannelType(ComponentID(yuv))]; 259 #if SVC_EXTENSION 260 const Int bitDepth = pcSlice->getBitDepth(toChannelType(ComponentID(yuv))); 261 #else 262 const Int bitDepth = pcSlice->getSPS()->getBitDepth(toChannelType(ComponentID(yuv))); 263 #endif 254 264 const Int offsetScalingFactor = bUseHighPrecisionPredictionWeighting ? 1 : (1 << (bitDepth-8)); 255 265 … … 283 293 if( iRefIdx0 >= 0 && iRefIdx1 >= 0 ) 284 294 { 285 addWeightBi(pcYuvSrc0, pcYuvSrc1, uiPartIdx, iWidth, iHeight, pwp0, pwp1, rpcYuvDst ); 295 #if SVC_EXTENSION 296 addWeightBi(pcYuvSrc0, pcYuvSrc1, pcCU->getSlice()->getBitDepths(), uiPartIdx, iWidth, iHeight, pwp0, pwp1, rpcYuvDst ); 297 #else 298 addWeightBi(pcYuvSrc0, pcYuvSrc1, pcCU->getSlice()->getSPS()->getBitDepths(), uiPartIdx, iWidth, iHeight, pwp0, pwp1, rpcYuvDst ); 299 #endif 286 300 } 287 301 else if ( iRefIdx0 >= 0 && iRefIdx1 < 0 ) 288 302 { 289 addWeightUni( pcYuvSrc0, uiPartIdx, iWidth, iHeight, pwp0, rpcYuvDst ); 303 #if SVC_EXTENSION 304 addWeightUni( pcYuvSrc0, pcCU->getSlice()->getBitDepths(), uiPartIdx, iWidth, iHeight, pwp0, rpcYuvDst ); 305 #else 306 addWeightUni( pcYuvSrc0, pcCU->getSlice()->getSPS()->getBitDepths(), uiPartIdx, iWidth, iHeight, pwp0, rpcYuvDst ); 307 #endif 290 308 } 291 309 else if ( iRefIdx0 < 0 && iRefIdx1 >= 0 ) 292 310 { 293 addWeightUni( pcYuvSrc1, uiPartIdx, iWidth, iHeight, pwp1, rpcYuvDst ); 311 #if SVC_EXTENSION 312 addWeightUni( pcYuvSrc1, pcCU->getSlice()->getBitDepths(), uiPartIdx, iWidth, iHeight, pwp1, rpcYuvDst ); 313 #else 314 addWeightUni( pcYuvSrc1, pcCU->getSlice()->getSPS()->getBitDepths(), uiPartIdx, iWidth, iHeight, pwp1, rpcYuvDst ); 315 #endif 294 316 } 295 317 else … … 327 349 getWpScaling(pcCU, -1, iRefIdx, pwpTmp, pwp); 328 350 } 329 addWeightUni( pcYuvSrc, uiPartAddr, iWidth, iHeight, pwp, pcYuvPred ); 330 } 351 #if SVC_EXTENSION 352 addWeightUni( pcYuvSrc, pcCU->getSlice()->getBitDepths(), uiPartAddr, iWidth, iHeight, pwp, pcYuvPred ); 353 #else 354 addWeightUni( pcYuvSrc, pcCU->getSlice()->getSPS()->getBitDepths(), uiPartAddr, iWidth, iHeight, pwp, pcYuvPred ); 355 #endif 356 } -
branches/SHM-dev/source/Lib/TLibCommon/TComWeightPrediction.h
r1262 r1287 63 63 Void addWeightBi( const TComYuv *pcYuvSrc0, 64 64 const TComYuv *pcYuvSrc1, 65 const BitDepths &bitDepths, 65 66 const UInt iPartUnitIdx, 66 67 const UInt uiWidth, … … 72 73 73 74 Void addWeightUni( const TComYuv *const pcYuvSrc0, 75 const BitDepths &bitDepths, 74 76 const UInt iPartUnitIdx, 75 77 const UInt uiWidth, -
branches/SHM-dev/source/Lib/TLibCommon/TComYuv.cpp
r1259 r1287 278 278 279 279 280 Void TComYuv::addClip( const TComYuv* pcYuvSrc0, const TComYuv* pcYuvSrc1, const UInt uiTrUnitIdx, const UInt uiPartSize )280 Void TComYuv::addClip( const TComYuv* pcYuvSrc0, const TComYuv* pcYuvSrc1, const UInt uiTrUnitIdx, const UInt uiPartSize, const BitDepths &clipBitDepths ) 281 281 { 282 282 for(Int chan=0; chan<getNumberValidComponents(); chan++) … … 293 293 const UInt iSrc1Stride = pcYuvSrc1->getStride(ch); 294 294 const UInt iDstStride = getStride(ch); 295 const Int clipbd = g_bitDepth[toChannelType(ch)];295 const Int clipbd = clipBitDepths.recon[toChannelType(ch)]; 296 296 #if O0043_BEST_EFFORT_DECODING 297 const Int bitDepthDelta = g_bitDepthInStream[toChannelType(ch)] - g_bitDepth[toChannelType(ch)];297 const Int bitDepthDelta = clipBitDepths.stream[toChannelType(ch)] - clipbd; 298 298 #endif 299 299 … … 350 350 351 351 352 Void TComYuv::addAvg( const TComYuv* pcYuvSrc0, const TComYuv* pcYuvSrc1, const UInt iPartUnitIdx, const UInt uiWidth, const UInt uiHeight )352 Void TComYuv::addAvg( const TComYuv* pcYuvSrc0, const TComYuv* pcYuvSrc1, const UInt iPartUnitIdx, const UInt uiWidth, const UInt uiHeight, const BitDepths &clipBitDepths ) 353 353 { 354 354 for(Int chan=0; chan<getNumberValidComponents(); chan++) … … 362 362 const UInt iSrc1Stride = pcYuvSrc1->getStride(ch); 363 363 const UInt iDstStride = getStride(ch); 364 const Int clipbd = g_bitDepth[toChannelType(ch)];364 const Int clipbd = clipBitDepths.recon[toChannelType(ch)]; 365 365 const Int shiftNum = std::max<Int>(2, (IF_INTERNAL_PREC - clipbd)) + 1; 366 366 const Int offset = ( 1 << ( shiftNum - 1 ) ) + 2 * IF_INTERNAL_OFFS; -
branches/SHM-dev/source/Lib/TLibCommon/TComYuv.h
r1262 r1287 131 131 132 132 // Clip(pcYuvSrc0 + pcYuvSrc1) -> m_apiBuf 133 Void addClip ( const TComYuv* pcYuvSrc0, const TComYuv* pcYuvSrc1, const UInt uiTrUnitIdx, const UInt uiPartSize );133 Void addClip ( const TComYuv* pcYuvSrc0, const TComYuv* pcYuvSrc1, const UInt uiTrUnitIdx, const UInt uiPartSize, const BitDepths &clipBitDepths ); 134 134 135 135 // pcYuvSrc0 - pcYuvSrc1 -> m_apiBuf … … 137 137 138 138 // (pcYuvSrc0 + pcYuvSrc1)/2 for YUV partition 139 Void addAvg ( const TComYuv* pcYuvSrc0, const TComYuv* pcYuvSrc1, const UInt iPartUnitIdx, const UInt iWidth, const UInt iHeight );139 Void addAvg ( const TComYuv* pcYuvSrc0, const TComYuv* pcYuvSrc1, const UInt iPartUnitIdx, const UInt iWidth, const UInt iHeight, const BitDepths &clipBitDepths ); 140 140 141 141 Void removeHighFreq ( const TComYuv* pcYuvSrc, const UInt uiPartIdx, const UInt uiWidth, const UInt uiHeight ); -
branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h
r1273 r1287 842 842 843 843 844 struct BitDepths 845 { 846 #if O0043_BEST_EFFORT_DECODING 847 Int recon[MAX_NUM_CHANNEL_TYPE]; ///< the bit depth used for reconstructing the video 848 Int stream[MAX_NUM_CHANNEL_TYPE];///< the bit depth used indicated in the SPS 849 #else 850 Int recon[MAX_NUM_CHANNEL_TYPE]; ///< the bit depth as indicated in the SPS 851 #endif 852 853 #if SVC_EXTENSION 854 BitDepths() 855 { 856 } 857 BitDepths(Int bitDepthY, Int bitDepthC) 858 { 859 recon[CHANNEL_TYPE_LUMA] = bitDepthY; 860 recon[CHANNEL_TYPE_CHROMA] = bitDepthC; 861 } 862 #endif 863 }; 864 844 865 /// parameters for deblocking filter 845 866 typedef struct _LFCUParam -
branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
r1275 r1287 766 766 READ_UVLC( uiCode, "bit_depth_luma_minus8" ); 767 767 #if O0043_BEST_EFFORT_DECODING 768 pcSPS->setStreamBitDepth(CHANNEL_TYPE_LUMA, 8 + uiCode); 768 769 const UInt forceDecodeBitDepth = pcSPS->getForceDecodeBitDepth(); 769 g_bitDepthInStream[CHANNEL_TYPE_LUMA] = 8 + uiCode;770 770 if (forceDecodeBitDepth != 0) 771 771 { … … 774 774 #endif 775 775 assert(uiCode <= 8); 776 777 776 pcSPS->setBitDepth(CHANNEL_TYPE_LUMA, 8 + uiCode); 777 778 778 #if O0043_BEST_EFFORT_DECODING 779 pcSPS->setQpBDOffset(CHANNEL_TYPE_LUMA, (Int) (6*( g_bitDepthInStream[CHANNEL_TYPE_LUMA]-8)) );779 pcSPS->setQpBDOffset(CHANNEL_TYPE_LUMA, (Int) (6*(pcSPS->getStreamBitDepth(CHANNEL_TYPE_LUMA)-8)) ); 780 780 #else 781 781 pcSPS->setQpBDOffset(CHANNEL_TYPE_LUMA, (Int) (6*uiCode) ); … … 784 784 READ_UVLC( uiCode, "bit_depth_chroma_minus8" ); 785 785 #if O0043_BEST_EFFORT_DECODING 786 g_bitDepthInStream[CHANNEL_TYPE_CHROMA] = 8 + uiCode;786 pcSPS->setStreamBitDepth(CHANNEL_TYPE_CHROMA, 8 + uiCode); 787 787 if (forceDecodeBitDepth != 0) 788 788 { … … 793 793 pcSPS->setBitDepth(CHANNEL_TYPE_CHROMA, 8 + uiCode); 794 794 #if O0043_BEST_EFFORT_DECODING 795 pcSPS->setQpBDOffset(CHANNEL_TYPE_CHROMA, (Int) (6*( g_bitDepthInStream[CHANNEL_TYPE_CHROMA]-8)) );795 pcSPS->setQpBDOffset(CHANNEL_TYPE_CHROMA, (Int) (6*(pcSPS->getStreamBitDepth(CHANNEL_TYPE_CHROMA)-8)) ); 796 796 #else 797 797 pcSPS->setQpBDOffset(CHANNEL_TYPE_CHROMA, (Int) (6*uiCode) ); … … 1821 1821 1822 1822 #if SVC_EXTENSION 1823 g_bitDepthLayer[CHANNEL_TYPE_LUMA][pcSlice->getLayerId()] = pcSlice->getBitDepthY(); 1824 g_bitDepthLayer[CHANNEL_TYPE_CHROMA][pcSlice->getLayerId()] = pcSlice->getBitDepthC(); 1825 1826 assert( pcSlice->getSliceQp() >= -pcSlice->getQpBDOffsetY() ); 1823 assert( pcSlice->getSliceQp() >= -pcSlice->getQpBDOffset(CHANNEL_TYPE_LUMA) ); 1827 1824 #else 1828 1825 assert( pcSlice->getSliceQp() >= -sps->getQpBDOffset(CHANNEL_TYPE_LUMA) ); … … 2360 2357 2361 2358 #if SVC_EXTENSION 2362 Int qpBdOffsetY = pcCU->getSlice()->getQpBDOffset Y();2359 Int qpBdOffsetY = pcCU->getSlice()->getQpBDOffset(CHANNEL_TYPE_LUMA); 2363 2360 #else 2364 2361 Int qpBdOffsetY = pcCU->getSlice()->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA); … … 2483 2480 wp[COMPONENT_Y].iWeight = (iDeltaWeight + (1<<wp[COMPONENT_Y].uiLog2WeightDenom)); 2484 2481 READ_SVLC( wp[COMPONENT_Y].iOffset, iNumRef==0?"luma_offset_l0[i]":"luma_offset_l1[i]" ); 2485 Int range=sps->getUseHighPrecisionPredictionWeighting() ? (1<<g_bitDepth[CHANNEL_TYPE_LUMA])/2 : 128; 2482 #if SVC_EXTENSION 2483 Int range=sps->getUseHighPrecisionPredictionWeighting() ? (1<<pcSlice->getBitDepth(CHANNEL_TYPE_LUMA))/2 : 128; 2484 #else 2485 Int range=sps->getUseHighPrecisionPredictionWeighting() ? (1<<sps->getBitDepth(CHANNEL_TYPE_LUMA))/2 : 128; 2486 #endif 2486 2487 assert( wp[0].iOffset >= -range ); 2487 2488 assert( wp[0].iOffset < range ); … … 2496 2497 if ( wp[COMPONENT_Cb].bPresentFlag ) 2497 2498 { 2498 Int range=sps->getUseHighPrecisionPredictionWeighting() ? (1<<g_bitDepth[CHANNEL_TYPE_CHROMA])/2 : 128; 2499 #if SVC_EXTENSION 2500 Int range=sps->getUseHighPrecisionPredictionWeighting() ? (1<<pcSlice->getBitDepth(CHANNEL_TYPE_CHROMA))/2 : 128; 2501 #else 2502 Int range=sps->getUseHighPrecisionPredictionWeighting() ? (1<<sps->getBitDepth(CHANNEL_TYPE_CHROMA))/2 : 128; 2503 #endif 2499 2504 for ( Int j=1 ; j<numValidComp ; j++ ) 2500 2505 { -
branches/SHM-dev/source/Lib/TLibDecoder/TDecCu.cpp
r1263 r1287 499 499 if ( pcCU->getQtRootCbf( 0) ) 500 500 { 501 m_ppcYuvReco[uiDepth]->addClip( m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], 0, pcCU->getWidth( 0 ) ); 501 #if SVC_EXTENSION 502 m_ppcYuvReco[uiDepth]->addClip( m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], 0, pcCU->getWidth( 0 ), pcCU->getSlice()->getBitDepths() ); 503 #else 504 m_ppcYuvReco[uiDepth]->addClip( m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], 0, pcCU->getWidth( 0 ), pcCU->getSlice()->getSPS()->getBitDepths() ); 505 #endif 502 506 } 503 507 else … … 642 646 #endif 643 647 648 #if SVC_EXTENSION 649 const Int clipbd = pcCU->getSlice()->getBitDepth(toChannelType(compID)); 650 #else 651 const Int clipbd = pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)); 652 #endif 644 653 #if O0043_BEST_EFFORT_DECODING 645 const Int bitDepthDelta = g_bitDepthInStream[toChannelType(compID)] - g_bitDepth[toChannelType(compID)]; 646 #endif 647 const Int clipbd = g_bitDepth[toChannelType(compID)]; 654 const Int bitDepthDelta = pcCU->getSlice()->getSPS()->getStreamBitDepth(toChannelType(compID)) - clipbd; 655 #endif 648 656 649 657 if( useCrossComponentPrediction ) … … 825 833 Pel* piPicReco = pcCU->getPic()->getPicYuvRec()->getAddr(compID, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu()+uiPartIdx); 826 834 const UInt uiPicStride = pcCU->getPic()->getPicYuvRec()->getStride(compID); 827 const UInt uiPcmLeftShiftBit = g_bitDepth[toChannelType(compID)] - pcCU->getSlice()->getSPS()->getPCMBitDepth(toChannelType(compID)); 835 #if SVC_EXTENSION 836 const UInt uiPcmLeftShiftBit = pcCU->getSlice()->getBitDepth(toChannelType(compID)) - pcCU->getSlice()->getSPS()->getPCMBitDepth(toChannelType(compID)); 837 #else 838 const UInt uiPcmLeftShiftBit = pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)) - pcCU->getSlice()->getSPS()->getPCMBitDepth(toChannelType(compID)); 839 #endif 828 840 829 841 for(UInt uiY = 0; uiY < uiHeight; uiY++ ) -
branches/SHM-dev/source/Lib/TLibDecoder/TDecGop.cpp
r1273 r1287 63 63 //! \ingroup TLibDecoder 64 64 //! \{ 65 static Void calcAndPrintHashStatus(TComPicYuv& pic, const SEIDecodedPictureHash* pictureHashSEI );65 static Void calcAndPrintHashStatus(TComPicYuv& pic, const SEIDecodedPictureHash* pictureHashSEI, const BitDepths &bitDepths); 66 66 // ==================================================================================================================== 67 67 // Constructor / destructor / initialization / destroy … … 246 246 printf ("Warning: Got multiple decoded picture hash SEI messages. Using first."); 247 247 } 248 calcAndPrintHashStatus(*(pcPic->getPicYuvRec()), hash); 248 #if SVC_EXTENSION 249 calcAndPrintHashStatus(*(pcPic->getPicYuvRec()), hash, pcSlice->getBitDepths()); 250 #else 251 calcAndPrintHashStatus(*(pcPic->getPicYuvRec()), hash, pcSlice->getSPS()->getBitDepths()); 252 #endif 249 253 } 250 254 #if CONFORMANCE_BITSTREAM_MODE … … 275 279 * unk - no SEI message was available for comparison 276 280 */ 277 static Void calcAndPrintHashStatus(TComPicYuv& pic, const SEIDecodedPictureHash* pictureHashSEI )281 static Void calcAndPrintHashStatus(TComPicYuv& pic, const SEIDecodedPictureHash* pictureHashSEI, const BitDepths &bitDepths) 278 282 { 279 283 /* calculate MD5sum for entire reconstructed picture */ … … 289 293 { 290 294 hashType = "MD5"; 291 numChar = calcMD5(pic, recon_digest );295 numChar = calcMD5(pic, recon_digest, bitDepths); 292 296 break; 293 297 } … … 295 299 { 296 300 hashType = "CRC"; 297 numChar = calcCRC(pic, recon_digest );301 numChar = calcCRC(pic, recon_digest, bitDepths); 298 302 break; 299 303 } … … 301 305 { 302 306 hashType = "Checksum"; 303 numChar = calcChecksum(pic, recon_digest );307 numChar = calcChecksum(pic, recon_digest, bitDepths); 304 308 break; 305 309 } -
branches/SHM-dev/source/Lib/TLibDecoder/TDecSbac.cpp
r1285 r1287 947 947 UInt uiSign; 948 948 #if SVC_EXTENSION 949 Int qpBdOffsetY = pcCU->getSlice()->getQpBDOffset Y();949 Int qpBdOffsetY = pcCU->getSlice()->getQpBDOffset(CHANNEL_TYPE_LUMA); 950 950 #else 951 951 Int qpBdOffsetY = pcCU->getSlice()->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA); … … 1687 1687 1688 1688 Void TDecSbac::parseSAOBlkParam (SAOBlkParam& saoBlkParam 1689 #if SVC_EXTENSION1690 , UInt* saoMaxOffsetQVal1691 #endif1692 1689 , Bool* sliceEnabled 1693 1690 , Bool leftMergeAvail 1694 1691 , Bool aboveMergeAvail 1692 , const BitDepths &bitDepths 1695 1693 ) 1696 1694 { … … 1727 1725 const ComponentID firstCompOfChType = getFirstComponentOfChannel(toChannelType(compIdx)); 1728 1726 SAOOffset& ctbParam = saoBlkParam[compIdx]; 1729 1727 #if O0043_BEST_EFFORT_DECODING 1728 const Int bitDepthOrig = bitDepths.stream[toChannelType(compIdx)]; 1729 const Int forceBitDepthAdjust = bitDepthOrig - bitDepths.recon[toChannelType(compIdx)]; 1730 #else 1731 const Int bitDepthOrig = bitDepths.recon[toChannelType(compIdx)]; 1732 #endif 1733 const Int maxOffsetQVal=TComSampleAdaptiveOffset::getMaxOffsetQVal(bitDepthOrig); 1730 1734 if(!sliceEnabled[compIdx]) 1731 1735 { … … 1766 1770 if(ctbParam.modeIdc == SAO_MODE_NEW) 1767 1771 { 1768 #if O0043_BEST_EFFORT_DECODING1769 Int bitDepthOrig = g_bitDepthInStream[toChannelType(compIdx)];1770 Int forceBitDepthAdjust = bitDepthOrig - g_bitDepth[toChannelType(compIdx)];1771 #endif1772 1772 Int offset[4]; 1773 1773 for(Int i=0; i< 4; i++) 1774 1774 { 1775 #if O0043_BEST_EFFORT_DECODING 1776 Int saoMaxOffsetQVal = (1<<(min(bitDepthOrig, MAX_SAO_TRUNCATED_BITDEPTH)-5))-1; 1777 parseSaoMaxUvlc(uiSymbol, saoMaxOffsetQVal); //sao_offset_abs 1778 #else 1779 #if SVC_EXTENSION 1780 parseSaoMaxUvlc(uiSymbol, saoMaxOffsetQVal[compIdx] ); //sao_offset_abs 1781 #else 1782 parseSaoMaxUvlc(uiSymbol, g_saoMaxOffsetQVal[compIdx] ); //sao_offset_abs 1783 #endif 1784 #endif 1775 parseSaoMaxUvlc(uiSymbol, maxOffsetQVal ); //sao_offset_abs 1785 1776 offset[i] = (Int)uiSymbol; 1786 1777 } -
branches/SHM-dev/source/Lib/TLibDecoder/TDecSbac.h
r1285 r1287 93 93 Void parseSaoTypeIdx ( UInt& ruiVal ); 94 94 Void parseSaoUflc ( UInt uiLength, UInt& ruiVal ); 95 96 #if SVC_EXTENSION 97 Void parseSAOBlkParam (SAOBlkParam& saoBlkParam, UInt* saoMaxOffsetQVal, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail ); 98 #else 99 Void parseSAOBlkParam (SAOBlkParam& saoBlkParam, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail); 100 #endif 95 Void parseSAOBlkParam (SAOBlkParam& saoBlkParam, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail, const BitDepths &bitDepths); 101 96 Void parseSaoSign (UInt& val); 102 97 -
branches/SHM-dev/source/Lib/TLibDecoder/TDecSlice.cpp
r1259 r1287 61 61 } 62 62 63 #if SVC_EXTENSION 64 Void TDecSlice::init(TDecEntropy* pcEntropyDecoder, TDecCu* pcCuDecoder, UInt* saoMaxOffsetQVal) 63 Void TDecSlice::init(TDecEntropy* pcEntropyDecoder, TDecCu* pcCuDecoder) 65 64 { 66 65 m_pcEntropyDecoder = pcEntropyDecoder; 67 66 m_pcCuDecoder = pcCuDecoder; 68 m_saoMaxOffsetQVal = saoMaxOffsetQVal; 69 } 70 #else 71 Void TDecSlice::init(TDecEntropy* pcEntropyDecoder, TDecCu* pcCuDecoder) 72 { 73 m_pcEntropyDecoder = pcEntropyDecoder; 74 m_pcCuDecoder = pcCuDecoder; 75 } 76 #endif 67 } 77 68 78 69 Void TDecSlice::decompressSlice(TComInputBitstream** ppcSubstreams, TComPic* pcPic, TDecSbac* pcSbacDecoder) … … 211 202 } 212 203 #if SVC_EXTENSION 213 pcSbacDecoder->parseSAOBlkParam( saoblkParam, m_saoMaxOffsetQVal, sliceEnabled, leftMergeAvail, aboveMergeAvail);204 pcSbacDecoder->parseSAOBlkParam( saoblkParam, sliceEnabled, leftMergeAvail, aboveMergeAvail, pcSlice->getBitDepths()); 214 205 #else 215 pcSbacDecoder->parseSAOBlkParam( saoblkParam, sliceEnabled, leftMergeAvail, aboveMergeAvail );216 #endif 206 pcSbacDecoder->parseSAOBlkParam( saoblkParam, sliceEnabled, leftMergeAvail, aboveMergeAvail, pcSlice->getSPS()->getBitDepths()); 207 #endif 217 208 } 218 209 } -
branches/SHM-dev/source/Lib/TLibDecoder/TDecSlice.h
r1259 r1287 77 77 virtual ~TDecSlice(); 78 78 79 #if SVC_EXTENSION80 Void init ( TDecEntropy* pcEntropyDecoder, TDecCu* pcMbDecoder, UInt* saoMaxOffsetQVal );81 #else82 79 Void init ( TDecEntropy* pcEntropyDecoder, TDecCu* pcMbDecoder ); 83 #endif84 80 Void create (); 85 81 Void destroy (); -
branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.cpp
r1285 r1287 181 181 #if SVC_EXTENSION 182 182 m_cGopDecoder.init( m_ppcTDecTop, &m_cEntropyDecoder, &m_cSbacDecoder, &m_cBinCABAC, &m_cCavlcDecoder, &m_cSliceDecoder, &m_cLoopFilter, &m_cSAO); 183 m_cSliceDecoder.init( &m_cEntropyDecoder, &m_cCuDecoder, m_cSAO.getSaoMaxOffsetQVal() );184 183 #else 185 184 m_cGopDecoder.init( &m_cEntropyDecoder, &m_cSbacDecoder, &m_cBinCABAC, &m_cCavlcDecoder, &m_cSliceDecoder, &m_cLoopFilter, &m_cSAO); 185 #endif 186 186 m_cSliceDecoder.init( &m_cEntropyDecoder, &m_cCuDecoder ); 187 #endif188 187 m_cEntropyDecoder.init(&m_cPrediction); 189 188 } … … 499 498 // it is needed where the VPS is accessed through the slice 500 499 pBLPic->getSlice(0)->setVPS( vps ); 501 502 g_bitDepthLayer[CHANNEL_TYPE_LUMA][0] = repFormat->getBitDepthVpsLuma();503 g_bitDepthLayer[CHANNEL_TYPE_CHROMA][0] = repFormat->getBitDepthVpsChroma();504 500 } 505 501 } … … 577 573 578 574 // TODO: remove the use of the following globals: 579 for (UInt channel = 0; channel < MAX_NUM_CHANNEL_TYPE; channel++)580 {581 #if SVC_EXTENSION582 g_bitDepth[channel] = isLuma(ChannelType(channel)) ? vps->getBitDepthY(sps, m_apcSlicePilot->getLayerId()) : vps->getBitDepthC(sps, m_apcSlicePilot->getLayerId());583 #else584 g_bitDepth[channel] = sps->getBitDepth(ChannelType(channel));585 #endif586 }587 575 g_uiMaxCUWidth = sps->getMaxCUWidth(); 588 576 g_uiMaxCUHeight = sps->getMaxCUHeight(); … … 1310 1298 if( pFile->good() ) 1311 1299 { 1312 Bool is16bit = g_bitDepthLayer[CHANNEL_TYPE_LUMA][0] > 8 || g_bitDepthLayer[CHANNEL_TYPE_CHROMA][0]> 8;1300 Bool is16bit = pBLPic->getSlice(0)->getBitDepth(CHANNEL_TYPE_LUMA) > 8 || pBLPic->getSlice(0)->getBitDepth(CHANNEL_TYPE_CHROMA) > 8; 1313 1301 UInt uiWidth = pBLPic->getPicYuvRec()->getWidth(COMPONENT_Y); 1314 1302 UInt uiHeight = pBLPic->getPicYuvRec()->getHeight(COMPONENT_Y); … … 1604 1592 if( pcSlice->getPPS()->getCGSFlag() && m_c3DAsymLUTPPS.isRefLayer( pcSlice->getVPS()->getRefLayerId(m_layerId, refLayerIdc) ) ) 1605 1593 { 1606 assert( pcSlice->getBaseColPic( refLayerIdc )->getSlice( 0 )->getBitDepth Y() == m_c3DAsymLUTPPS.getInputBitDepthY() );1607 assert( pcSlice->getBaseColPic( refLayerIdc )->getSlice( 0 )->getBitDepth C() == m_c3DAsymLUTPPS.getInputBitDepthC() );1608 assert( pcSlice->getBitDepth Y() >= m_c3DAsymLUTPPS.getOutputBitDepthY() );1609 assert( pcSlice->getBitDepth Y() >= m_c3DAsymLUTPPS.getOutputBitDepthC() );1594 assert( pcSlice->getBaseColPic( refLayerIdc )->getSlice( 0 )->getBitDepth(CHANNEL_TYPE_LUMA) == m_c3DAsymLUTPPS.getInputBitDepthY() ); 1595 assert( pcSlice->getBaseColPic( refLayerIdc )->getSlice( 0 )->getBitDepth(CHANNEL_TYPE_CHROMA) == m_c3DAsymLUTPPS.getInputBitDepthC() ); 1596 assert( pcSlice->getBitDepth(CHANNEL_TYPE_LUMA) >= m_c3DAsymLUTPPS.getOutputBitDepthY() ); 1597 assert( pcSlice->getBitDepth(CHANNEL_TYPE_LUMA) >= m_c3DAsymLUTPPS.getOutputBitDepthC() ); 1610 1598 1611 1599 if( !m_pColorMappedPic ) … … 1614 1602 } 1615 1603 1616 m_c3DAsymLUTPPS.colorMapping( pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), 1604 m_c3DAsymLUTPPS.colorMapping( pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), m_pColorMappedPic ); 1617 1605 pBaseColRec = m_pColorMappedPic; 1618 1606 } … … 1624 1612 if( pcSlice->getVPS()->isSamplePredictionType( pcSlice->getVPS()->getLayerIdxInVps(m_layerId), pcSlice->getVPS()->getLayerIdxInVps(refLayerId) ) ) 1625 1613 { 1626 m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, m_pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, m_pcPic->getPicYuvRec() );1614 m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, m_pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, m_pcPic->getPicYuvRec(), pcSlice->getBaseColPic( refLayerIdc )->getSlice( 0 )->getBitDepth(CHANNEL_TYPE_LUMA), pcSlice->getBaseColPic( refLayerIdc )->getSlice( 0 )->getBitDepth(CHANNEL_TYPE_CHROMA)); 1627 1615 } 1628 1616 } … … 1804 1792 }; 1805 1793 #if SVC_EXTENSION 1806 m_cTrQuant.setFlatScalingList(pcSlice->getChromaFormatIdc(), maxLog2TrDynamicRange );1794 m_cTrQuant.setFlatScalingList(pcSlice->getChromaFormatIdc(), maxLog2TrDynamicRange, pcSlice->getBitDepths()); 1807 1795 #else 1808 m_cTrQuant.setFlatScalingList(pcSlice->getSPS()->getChromaFormatIdc(), maxLog2TrDynamicRange );1796 m_cTrQuant.setFlatScalingList(pcSlice->getSPS()->getChromaFormatIdc(), maxLog2TrDynamicRange, pcSlice->getSPS()->getBitDepths()); 1809 1797 #endif 1810 1798 m_cTrQuant.setUseScalingList(false); … … 2210 2198 const TComSPS* sps = slice->getSPS(); 2211 2199 2212 Int bitDepthY = slice->getBitDepthY();2213 Int bitDepthC = slice->getBitDepthC();2214 2215 2200 if( m_layerId > 0 ) 2216 2201 { 2217 2218 g_bitDepth[CHANNEL_TYPE_LUMA] = bitDepthY;2219 g_bitDepth[CHANNEL_TYPE_CHROMA] = bitDepthC;2220 2202 g_uiMaxCUWidth = sps->getMaxCUWidth(); 2221 2203 g_uiMaxCUHeight = sps->getMaxCUHeight(); … … 2559 2541 2560 2542 TDecTop *pcTDecTopBase = (TDecTop *)getRefLayerDec( i ); 2561 TComPicYuv* pcPicYuvRecBase = (*(pcTDecTopBase->getListPic()->begin()))->getPicYuvRec(); 2562 2563 UInt refLayerId = vps.getRefLayerId(m_layerId, i); 2564 Bool sameBitDepths = ( g_bitDepthLayer[CHANNEL_TYPE_LUMA][m_layerId] == g_bitDepthLayer[CHANNEL_TYPE_LUMA][refLayerId] ) && ( g_bitDepthLayer[CHANNEL_TYPE_CHROMA][m_layerId] == g_bitDepthLayer[CHANNEL_TYPE_CHROMA][refLayerId] ); 2543 TComPicYuv* pcPicYuvRecBase = (*(pcTDecTopBase->getListPic()->begin()))->getPicYuvRec(); 2544 2545 const Int bitDepthLuma = vps.getBitDepth(CHANNEL_TYPE_LUMA, &sps, m_layerId); 2546 const Int bitDepthChroma = vps.getBitDepth(CHANNEL_TYPE_CHROMA, &sps, m_layerId); 2547 const Int refBitDepthLuma = (*(pcTDecTopBase->getListPic()->begin()))->getSlice(0)->getBitDepth(CHANNEL_TYPE_LUMA); 2548 const Int refBitDepthChroma = (*(pcTDecTopBase->getListPic()->begin()))->getSlice(0)->getBitDepth(CHANNEL_TYPE_CHROMA); 2549 2550 Bool sameBitDepths = ( bitDepthLuma == refBitDepthLuma ) && ( bitDepthChroma == refBitDepthChroma ); 2565 2551 2566 2552 if( pcPicYuvRecBase->getWidth(COMPONENT_Y) == vps.getPicWidthInLumaSamples(&sps, m_layerId) && pcPicYuvRecBase->getHeight(COMPONENT_Y) == vps.getPicHeightInLumaSamples(&sps, m_layerId) && equalOffsets && zeroPhase ) -
branches/SHM-dev/source/Lib/TLibEncoder/SEIEncoder.cpp
r1273 r1287 304 304 305 305 //! calculate hashes for entire reconstructed picture 306 Void SEIEncoder::initDecodedPictureHashSEI(SEIDecodedPictureHash *decodedPictureHashSEI, TComPic *pcPic, std::string &rHashString )306 Void SEIEncoder::initDecodedPictureHashSEI(SEIDecodedPictureHash *decodedPictureHashSEI, TComPic *pcPic, std::string &rHashString, const BitDepths &bitDepths) 307 307 { 308 308 assert (m_isInitialized); … … 313 313 { 314 314 decodedPictureHashSEI->method = SEIDecodedPictureHash::MD5; 315 UInt numChar=calcMD5(*pcPic->getPicYuvRec(), decodedPictureHashSEI->m_pictureHash );315 UInt numChar=calcMD5(*pcPic->getPicYuvRec(), decodedPictureHashSEI->m_pictureHash, bitDepths); 316 316 rHashString = hashToString(decodedPictureHashSEI->m_pictureHash, numChar); 317 317 } … … 319 319 { 320 320 decodedPictureHashSEI->method = SEIDecodedPictureHash::CRC; 321 UInt numChar=calcCRC(*pcPic->getPicYuvRec(), decodedPictureHashSEI->m_pictureHash );321 UInt numChar=calcCRC(*pcPic->getPicYuvRec(), decodedPictureHashSEI->m_pictureHash, bitDepths); 322 322 rHashString = hashToString(decodedPictureHashSEI->m_pictureHash, numChar); 323 323 } … … 325 325 { 326 326 decodedPictureHashSEI->method = SEIDecodedPictureHash::CHECKSUM; 327 UInt numChar=calcChecksum(*pcPic->getPicYuvRec(), decodedPictureHashSEI->m_pictureHash );327 UInt numChar=calcChecksum(*pcPic->getPicYuvRec(), decodedPictureHashSEI->m_pictureHash, bitDepths); 328 328 rHashString = hashToString(decodedPictureHashSEI->m_pictureHash, numChar); 329 329 } -
branches/SHM-dev/source/Lib/TLibEncoder/SEIEncoder.h
r1273 r1287 102 102 103 103 // trailing SEIs 104 Void initDecodedPictureHashSEI(SEIDecodedPictureHash *sei, TComPic *pcPic, std::string &rHashString );104 Void initDecodedPictureHashSEI(SEIDecodedPictureHash *sei, TComPic *pcPic, std::string &rHashString, const BitDepths &bitDepths); 105 105 Void initTemporalLevel0IndexSEI(SEITemporalLevel0Index *sei, TComSlice *slice); 106 106 -
branches/SHM-dev/source/Lib/TLibEncoder/TEncAnalyze.h
r1259 r1287 101 101 102 102 103 Void calculateCombinedValues(const ChromaFormat chFmt, Double &PSNRyuv, Double &MSEyuv )103 Void calculateCombinedValues(const ChromaFormat chFmt, Double &PSNRyuv, Double &MSEyuv, const BitDepths &bitDepths) 104 104 { 105 105 MSEyuv = 0; 106 106 Int scale = 0; 107 107 108 Int maximumBitDepth = g_bitDepth[0];108 Int maximumBitDepth = bitDepths.recon[CHANNEL_TYPE_LUMA]; 109 109 for (UInt channelTypeIndex = 1; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++) 110 110 { 111 if ( g_bitDepth[channelTypeIndex] > maximumBitDepth)111 if (bitDepths.recon[channelTypeIndex] > maximumBitDepth) 112 112 { 113 maximumBitDepth = g_bitDepth[channelTypeIndex];113 maximumBitDepth = bitDepths.recon[channelTypeIndex]; 114 114 } 115 115 } … … 124 124 const UInt csy = getComponentScaleY(compID, chFmt); 125 125 const Int scaleChan = (4>>(csx+csy)); 126 const UInt bitDepthShift = 2 * (maximumBitDepth - g_bitDepth[toChannelType(compID)]); //*2 because this is a squared number126 const UInt bitDepthShift = 2 * (maximumBitDepth - bitDepths.recon[toChannelType(compID)]); //*2 because this is a squared number 127 127 128 128 const Double channelMSE = (m_MSEyuvframe[compID] * Double(1 << bitDepthShift)) / Double(getNumPic()); … … 137 137 138 138 #if SVC_EXTENSION 139 Void printOut ( Char cDelim, const ChromaFormat chFmt, const Bool printMSEBasedSNR, const Bool printSequenceMSE, UInt layer )140 #else 141 Void printOut ( Char cDelim, const ChromaFormat chFmt, const Bool printMSEBasedSNR, const Bool printSequenceMSE )139 Void printOut ( Char cDelim, const ChromaFormat chFmt, const Bool printMSEBasedSNR, const Bool printSequenceMSE, const BitDepths &bitDepths, UInt layer ) 140 #else 141 Void printOut ( Char cDelim, const ChromaFormat chFmt, const Bool printMSEBasedSNR, const Bool printSequenceMSE, const BitDepths &bitDepths ) 142 142 #endif 143 143 { … … 159 159 { 160 160 //NOTE: this is not the true maximum value for any bitDepth other than 8. It comes from the original HM PSNR calculation 161 const UInt maxval = 255 << ( g_bitDepth[toChannelType(compID)] - 8);161 const UInt maxval = 255 << (bitDepths.recon[toChannelType(compID)] - 8); 162 162 const Double MSE = m_MSEyuvframe[compID]; 163 163 … … 261 261 Double MSEyuv = MAX_DOUBLE; 262 262 263 calculateCombinedValues(chFmt, PSNRyuv, MSEyuv );263 calculateCombinedValues(chFmt, PSNRyuv, MSEyuv, bitDepths); 264 264 265 265 if (printMSEBasedSNR) … … 376 376 377 377 378 Void printSummary(const ChromaFormat chFmt, const Bool printSequenceMSE, Char ch='T')378 Void printSummary(const ChromaFormat chFmt, const Bool printSequenceMSE, const BitDepths &bitDepths, Char ch='T') 379 379 { 380 380 FILE* pFile = NULL; … … 416 416 Double MSEyuv = MAX_DOUBLE; 417 417 418 calculateCombinedValues(chFmt, PSNRyuv, MSEyuv );418 calculateCombinedValues(chFmt, PSNRyuv, MSEyuv, bitDepths); 419 419 420 420 fprintf(pFile, "%f\t %f\t %f\t %f\t %f", -
branches/SHM-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
r1275 r1287 1624 1624 1625 1625 #if SVC_EXTENSION 1626 Int qpBdOffsetY = pcCU->getSlice()->getQpBDOffset Y();1626 Int qpBdOffsetY = pcCU->getSlice()->getQpBDOffset(CHANNEL_TYPE_LUMA); 1627 1627 #else 1628 1628 Int qpBdOffsetY = pcCU->getSlice()->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA); … … 1724 1724 WRITE_SVLC( iDeltaWeight, iNumRef==0?"delta_chroma_weight_l0[i]":"delta_chroma_weight_l1[i]" ); 1725 1725 1726 Int range=pcSlice->getSPS()->getUseHighPrecisionPredictionWeighting() ? (1<<g_bitDepth[CHANNEL_TYPE_CHROMA])/2 : 128; 1726 #if SVC_EXTENSION 1727 Int range=pcSlice->getSPS()->getUseHighPrecisionPredictionWeighting() ? (1<<pcSlice->getBitDepth(CHANNEL_TYPE_CHROMA))/2 : 128; 1728 #else 1729 Int range=pcSlice->getSPS()->getUseHighPrecisionPredictionWeighting() ? (1<<pcSlice->getSPS()->getBitDepth(CHANNEL_TYPE_CHROMA))/2 : 128; 1730 #endif 1727 1731 Int pred = ( range - ( ( range*wp[j].iWeight)>>(wp[j].uiLog2WeightDenom) ) ); 1728 1732 Int iDeltaChroma = (wp[j].iOffset - pred); -
branches/SHM-dev/source/Lib/TLibEncoder/TEncCavlc.h
r1259 r1287 104 104 105 105 Void codeMVPIdx ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefList ); 106 #if SVC_EXTENSION 107 Void codeSAOBlkParam(SAOBlkParam& saoBlkParam, UInt* saoMaxOffsetQVal, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail, Bool onlyEstMergeInfo = false){printf("only supported in CABAC"); assert(0); exit(-1);} 108 #else 109 Void codeSAOBlkParam(SAOBlkParam& saoBlkParam, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail, Bool onlyEstMergeInfo = false){printf("only supported in CABAC"); assert(0); exit(-1);} 110 #endif 106 Void codeSAOBlkParam(SAOBlkParam& saoBlkParam, const BitDepths &bitDepths, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail, Bool onlyEstMergeInfo = false){printf("only supported in CABAC"); assert(0); exit(-1);} 111 107 Void codeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ); 112 108 Void codeSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); -
branches/SHM-dev/source/Lib/TLibEncoder/TEncCfg.h
r1284 r1287 186 186 187 187 //====== Tool list ======== 188 Int m_bitDepth[MAX_NUM_CHANNEL_TYPE]; 188 189 Bool m_bUseASR; 189 190 Bool m_bUseHADME; … … 602 603 603 604 //==== Tool list ======== 605 Void setBitDepth( const ChannelType chType, Int internalBitDepthForChannel ) { m_bitDepth[chType] = internalBitDepthForChannel; } 604 606 Void setUseASR ( Bool b ) { m_bUseASR = b; } 605 607 Void setUseHADME ( Bool b ) { m_bUseHADME = b; } -
branches/SHM-dev/source/Lib/TLibEncoder/TEncCu.cpp
r1260 r1287 400 400 Int idQP = m_pcEncCfg->getMaxDeltaQP(); 401 401 #if SVC_EXTENSION 402 iMinQP = Clip3( -rpcTempCU->getSlice()->getQpBDOffset Y(), MAX_QP, iBaseQP-idQP );403 iMaxQP = Clip3( -rpcTempCU->getSlice()->getQpBDOffset Y(), MAX_QP, iBaseQP+idQP );402 iMinQP = Clip3( -rpcTempCU->getSlice()->getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, iBaseQP-idQP ); 403 iMaxQP = Clip3( -rpcTempCU->getSlice()->getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, iBaseQP+idQP ); 404 404 #else 405 405 iMinQP = Clip3( -rpcTempCU->getSlice()->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, iBaseQP-idQP ); … … 735 735 && rpcTempCU->getWidth(0) >= (1<<pcPic->getSlice(0)->getSPS()->getPCMLog2MinSize()) ) 736 736 { 737 UInt uiRawBits = getTotalBits(rpcBestCU->getWidth(0), rpcBestCU->getHeight(0), rpcBestCU->getPic()->getChromaFormat(), g_bitDepth); 737 #if SVC_EXTENSION 738 UInt uiRawBits = getTotalBits(rpcBestCU->getWidth(0), rpcBestCU->getHeight(0), rpcBestCU->getPic()->getChromaFormat(), pcPic->getSlice(0)->getBitDepths().recon); 739 #else 740 UInt uiRawBits = getTotalBits(rpcBestCU->getWidth(0), rpcBestCU->getHeight(0), rpcBestCU->getPic()->getChromaFormat(), pcPic->getSlice(0)->getSPS()->getBitDepths().recon); 741 #endif 738 742 UInt uiBestBits = rpcBestCU->getTotalBits(); 739 743 if((uiBestBits > uiRawBits) || (rpcBestCU->getTotalCost() > m_pcRdCost->calcRdCost(uiRawBits, 0))) … … 799 803 Int idQP = m_pcEncCfg->getMaxDeltaQP(); 800 804 #if SVC_EXTENSION 801 iMinQP = Clip3( -rpcTempCU->getSlice()->getQpBDOffset Y(), MAX_QP, iBaseQP-idQP );802 iMaxQP = Clip3( -rpcTempCU->getSlice()->getQpBDOffset Y(), MAX_QP, iBaseQP+idQP );805 iMinQP = Clip3( -rpcTempCU->getSlice()->getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, iBaseQP-idQP ); 806 iMaxQP = Clip3( -rpcTempCU->getSlice()->getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, iBaseQP+idQP ); 803 807 #else 804 808 iMinQP = Clip3( -rpcTempCU->getSlice()->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, iBaseQP-idQP ); … … 1027 1031 } 1028 1032 #if SVC_EXTENSION 1029 return Clip3(-pcCU->getSlice()->getQpBDOffset Y(), MAX_QP, iBaseQp+iQpOffset );1033 return Clip3(-pcCU->getSlice()->getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, iBaseQp+iQpOffset ); 1030 1034 #else 1031 1035 return Clip3(-pcCU->getSlice()->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, iBaseQp+iQpOffset ); -
branches/SHM-dev/source/Lib/TLibEncoder/TEncEntropy.h
r1259 r1287 114 114 virtual Void codeCoeffNxN ( TComTU &rTu, TCoeff* pcCoef, const ComponentID compID ) = 0; 115 115 virtual Void codeTransformSkipFlags ( TComTU &rTu, ComponentID component ) = 0; 116 virtual Void codeSAOBlkParam (SAOBlkParam& saoBlkParam, const BitDepths &bitDepths, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail, Bool onlyEstMergeInfo = false) =0; 117 virtual Void estBit (estBitsSbacStruct* pcEstBitsSbac, Int width, Int height, ChannelType chType) = 0; 118 119 virtual Void codeDFFlag (UInt uiCode, const Char *pSymbolName) = 0; 120 virtual Void codeDFSvlc (Int iCode, const Char *pSymbolName) = 0; 121 122 virtual Void codeExplicitRdpcmMode ( TComTU &rTu, const ComponentID compID ) = 0; 123 124 virtual ~TEncEntropyIf() {} 125 116 126 #if SVC_EXTENSION 117 127 virtual Void codeSliceHeaderExtn( TComSlice* pSlice, Int shBitsWrittenTillNow ) = 0; 118 virtual Void codeSAOBlkParam (SAOBlkParam& saoBlkParam, UInt* saoMaxOffsetQVal, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail, Bool onlyEstMergeInfo = false) =0; 119 #else 120 virtual Void codeSAOBlkParam (SAOBlkParam& saoBlkParam, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail, Bool onlyEstMergeInfo = false) =0; 121 #endif 122 virtual Void estBit (estBitsSbacStruct* pcEstBitsSbac, Int width, Int height, ChannelType chType) = 0; 123 124 virtual Void codeDFFlag (UInt uiCode, const Char *pSymbolName) = 0; 125 virtual Void codeDFSvlc (Int iCode, const Char *pSymbolName) = 0; 126 127 virtual Void codeExplicitRdpcmMode ( TComTU &rTu, const ComponentID compID ) = 0; 128 129 virtual ~TEncEntropyIf() {} 128 #endif 130 129 }; 131 130 … … 194 193 195 194 Void estimateBit ( estBitsSbacStruct* pcEstBitsSbac, Int width, Int height, ChannelType chType ); 195 196 Void encodeSAOBlkParam(SAOBlkParam& saoBlkParam, const BitDepths &bitDepths, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail){m_pcEntropyCoderIf->codeSAOBlkParam(saoBlkParam, bitDepths, sliceEnabled, leftMergeAvail, aboveMergeAvail, false);} 197 198 static Int countNonZeroCoeffs( TCoeff* pcCoef, UInt uiSize ); 199 196 200 #if SVC_EXTENSION 197 201 Void encodeSliceHeaderExtn( TComSlice* pSlice, Int shBitsWrittenTillNow ); 198 Void encodeSAOBlkParam(SAOBlkParam& saoBlkParam, UInt* saoMaxOffsetQVal, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail){m_pcEntropyCoderIf->codeSAOBlkParam(saoBlkParam, saoMaxOffsetQVal, sliceEnabled, leftMergeAvail, aboveMergeAvail, false);} 199 #else 200 Void encodeSAOBlkParam(SAOBlkParam& saoBlkParam, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail){m_pcEntropyCoderIf->codeSAOBlkParam(saoBlkParam, sliceEnabled, leftMergeAvail, aboveMergeAvail, false);} 201 #endif 202 static Int countNonZeroCoeffs( TCoeff* pcCoef, UInt uiSize ); 203 202 #endif 204 203 };// END CLASS DEFINITION TEncEntropy 205 204 -
branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp
r1286 r1287 198 198 { 199 199 prevLayerIdx = pcTEncTop->getPredLayerIdx( pcTEncTop->getNumActiveRefLayers() - 1); 200 prevLayerId = pcTEncTop->getRefLayerId(prevLayerIdx); 201 } 202 m_Enc3DAsymLUTPicUpdate.create( m_pcCfg->getCGSMaxOctantDepth() , g_bitDepthLayer[CHANNEL_TYPE_LUMA][prevLayerId] , g_bitDepthLayer[CHANNEL_TYPE_CHROMA][prevLayerId] , g_bitDepthLayer[CHANNEL_TYPE_LUMA][pcTEncTop->getLayerId()] , g_bitDepthLayer[CHANNEL_TYPE_CHROMA][pcTEncTop->getLayerId()] , m_pcCfg->getCGSMaxYPartNumLog2() /*, m_pcCfg->getCGSPhaseAlignment()*/ ); 203 m_Enc3DAsymLUTPPS.create( m_pcCfg->getCGSMaxOctantDepth() , g_bitDepthLayer[CHANNEL_TYPE_LUMA][prevLayerId] , g_bitDepthLayer[CHANNEL_TYPE_CHROMA][prevLayerId] , g_bitDepthLayer[CHANNEL_TYPE_LUMA][pcTEncTop->getLayerId()] , g_bitDepthLayer[CHANNEL_TYPE_CHROMA][pcTEncTop->getLayerId()] , m_pcCfg->getCGSMaxYPartNumLog2() /*, m_pcCfg->getCGSPhaseAlignment()*/ ); 200 prevLayerId = pcTEncTop->getRefLayerId(prevLayerIdx); 201 } 202 203 const TComVPS *vps = pcTEncTop->getVPS(); 204 205 const Int bitDepthLuma = vps->getBitDepth(CHANNEL_TYPE_LUMA, pcTEncTop->getSPS(), pcTEncTop->getLayerId()); 206 const Int bitDepthChroma = vps->getBitDepth(CHANNEL_TYPE_CHROMA, pcTEncTop->getSPS(), pcTEncTop->getLayerId()); 207 const Int prevBitDepthLuma = vps->getBitDepth(CHANNEL_TYPE_LUMA, m_ppcTEncTop[prevLayerIdx]->getSPS(), prevLayerId); 208 const Int prevBitDepthChroma = vps->getBitDepth(CHANNEL_TYPE_CHROMA, m_ppcTEncTop[prevLayerIdx]->getSPS(), prevLayerId); 209 210 m_Enc3DAsymLUTPicUpdate.create( m_pcCfg->getCGSMaxOctantDepth() , prevBitDepthLuma, prevBitDepthChroma, bitDepthLuma, bitDepthChroma , m_pcCfg->getCGSMaxYPartNumLog2() ); 211 m_Enc3DAsymLUTPPS.create( m_pcCfg->getCGSMaxOctantDepth(), prevBitDepthLuma, prevBitDepthChroma, bitDepthLuma, prevBitDepthChroma , m_pcCfg->getCGSMaxYPartNumLog2() ); 204 212 if(!m_pColorMappedPic) 205 213 { … … 1483 1491 #if SVC_EXTENSION 1484 1492 pcPic->setLayerId( m_layerId ); 1493 #endif 1485 1494 m_pcSliceEncoder->initEncSlice ( pcPic, iPOCLast, pocCurr, iNumPicRcvd, iGOPid, pcSlice, isField ); 1486 #else1487 m_pcSliceEncoder->initEncSlice ( pcPic, iPOCLast, pocCurr, iNumPicRcvd, iGOPid, pcSlice, &(pcPic->getPicSym()->getSPS()), &(pcPic->getPicSym()->getPPS()), isField );1488 #endif1489 1495 1490 1496 //Set Frame/Field coding … … 1678 1684 { 1679 1685 //downsampling 1680 downScalePic(pcPic->getPicYuvOrg(), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvOrg() );1686 downScalePic(pcPic->getPicYuvOrg(), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvOrg(), pcSlice->getBitDepths()); 1681 1687 1682 1688 m_Enc3DAsymLUTPPS.setDsOrigPic(pcSlice->getBaseColPic(refLayerIdc)->getPicYuvOrg()); … … 1709 1715 if( pcSlice->getVPS()->isSamplePredictionType( pcSlice->getVPS()->getLayerIdxInVps(m_layerId), pcSlice->getVPS()->getLayerIdxInVps(refLayerId) ) ) 1710 1716 { 1711 m_pcPredSearch->upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec() );1717 m_pcPredSearch->upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), pcSlice->getBaseColPic(refLayerIdc)->getSlice(0 )->getBitDepth(CHANNEL_TYPE_LUMA), pcSlice->getBaseColPic(refLayerIdc)->getSlice(0)->getBitDepth(CHANNEL_TYPE_CHROMA) ); 1712 1718 } 1713 1719 } … … 2364 2370 2365 2371 #if SVC_EXTENSION 2366 sliceQP = Clip3( -pcSlice->getQpBDOffset Y(), MAX_QP, sliceQP );2372 sliceQP = Clip3( -pcSlice->getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, sliceQP ); 2367 2373 #else 2368 2374 sliceQP = Clip3( -pcSlice->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, sliceQP ); … … 2668 2674 // cabac_zero_words processing 2669 2675 { 2676 #if !SVC_EXTENSION 2677 const TComSPS &sps=*(pcSlice->getSPS()); 2678 #endif 2670 2679 const Int log2subWidthCxsubHeightC = (pcPic->getComponentScaleX(COMPONENT_Cb)+pcPic->getComponentScaleY(COMPONENT_Cb)); 2671 2680 const Int minCuWidth = pcPic->getMinCUWidth(); … … 2674 2683 const Int paddedWidth = ((pcSlice->getPicWidthInLumaSamples() + minCuWidth - 1) / minCuWidth) * minCuWidth; 2675 2684 const Int paddedHeight= ((pcSlice->getPicHeightInLumaSamples() + minCuHeight - 1) / minCuHeight) * minCuHeight; 2685 const Int rawBits = paddedWidth * paddedHeight * 2686 (pcSlice->getBitDepth(CHANNEL_TYPE_LUMA) + 2*(pcSlice->getBitDepth(CHANNEL_TYPE_CHROMA)>>log2subWidthCxsubHeightC)); 2676 2687 #else 2677 2688 const Int paddedWidth = ((pcSlice->getSPS()->getPicWidthInLumaSamples() + minCuWidth - 1) / minCuWidth) * minCuWidth; 2678 2689 const Int paddedHeight= ((pcSlice->getSPS()->getPicHeightInLumaSamples() + minCuHeight - 1) / minCuHeight) * minCuHeight; 2679 #endif2680 2690 const Int rawBits = paddedWidth * paddedHeight * 2681 (g_bitDepth[CHANNEL_TYPE_LUMA] + 2*(g_bitDepth[CHANNEL_TYPE_CHROMA]>>log2subWidthCxsubHeightC)); 2691 (sps.getBitDepth(CHANNEL_TYPE_LUMA) + 2*(sps.getBitDepth(CHANNEL_TYPE_CHROMA)>>log2subWidthCxsubHeightC)); 2692 #endif 2682 2693 const std::size_t threshold = (32/3)*numBytesInVclNalUnits + (rawBits/32); 2683 2694 if (binCountsInNalUnits >= threshold) … … 2718 2729 { 2719 2730 SEIDecodedPictureHash *decodedPictureHashSei = new SEIDecodedPictureHash(); 2720 m_seiEncoder.initDecodedPictureHashSEI(decodedPictureHashSei, pcPic, digestStr); 2731 #if SVC_EXTENSION 2732 m_seiEncoder.initDecodedPictureHashSEI(decodedPictureHashSei, pcPic, digestStr, pcSlice->getBitDepths()); 2733 #else 2734 m_seiEncoder.initDecodedPictureHashSEI(decodedPictureHashSei, pcPic, digestStr, pcSlice->getSPS()->getBitDepths()); 2735 #endif 2721 2736 trailingSeiMessages.push_back(decodedPictureHashSei); 2722 2737 } … … 2933 2948 2934 2949 #if !SVC_EXTENSION 2935 Void TEncGOP::printOutSummary(UInt uiNumAllPicCoded, Bool isField, const Bool printMSEBasedSNR, const Bool printSequenceMSE )2950 Void TEncGOP::printOutSummary(UInt uiNumAllPicCoded, Bool isField, const Bool printMSEBasedSNR, const Bool printSequenceMSE, const BitDepths &bitDepths) 2936 2951 { 2937 2952 assert (uiNumAllPicCoded == m_gcAnalyzeAll.getNumPic()); … … 2948 2963 //-- all 2949 2964 printf( "\n\nSUMMARY --------------------------------------------------------\n" ); 2950 m_gcAnalyzeAll.printOut('a', chFmt, printMSEBasedSNR, printSequenceMSE );2965 m_gcAnalyzeAll.printOut('a', chFmt, printMSEBasedSNR, printSequenceMSE, bitDepths); 2951 2966 2952 2967 printf( "\n\nI Slices--------------------------------------------------------\n" ); 2953 m_gcAnalyzeI.printOut('i', chFmt, printMSEBasedSNR, printSequenceMSE );2968 m_gcAnalyzeI.printOut('i', chFmt, printMSEBasedSNR, printSequenceMSE, bitDepths); 2954 2969 2955 2970 printf( "\n\nP Slices--------------------------------------------------------\n" ); 2956 m_gcAnalyzeP.printOut('p', chFmt, printMSEBasedSNR, printSequenceMSE );2971 m_gcAnalyzeP.printOut('p', chFmt, printMSEBasedSNR, printSequenceMSE, bitDepths); 2957 2972 2958 2973 printf( "\n\nB Slices--------------------------------------------------------\n" ); 2959 m_gcAnalyzeB.printOut('b', chFmt, printMSEBasedSNR, printSequenceMSE );2974 m_gcAnalyzeB.printOut('b', chFmt, printMSEBasedSNR, printSequenceMSE, bitDepths); 2960 2975 2961 2976 #if _SUMMARY_OUT_ … … 2976 2991 2977 2992 printf( "\n\nSUMMARY INTERLACED ---------------------------------------------\n" ); 2978 m_gcAnalyzeAll_in.printOut('a', chFmt, printMSEBasedSNR, printSequenceMSE );2993 m_gcAnalyzeAll_in.printOut('a', chFmt, printMSEBasedSNR, printSequenceMSE, bitDepths); 2979 2994 2980 2995 #if _SUMMARY_OUT_ … … 2995 3010 if (!bCalcDist) 2996 3011 { 2997 ruiDist = xFindDistortionFrame(pcPic->getPicYuvOrg(), pcPic->getPicYuvRec()); 3012 #if SVC_EXTENSION 3013 ruiDist = xFindDistortionFrame(pcPic->getPicYuvOrg(), pcPic->getPicYuvRec(), pcPic->getSlice(0)->getBitDepths()); 3014 #else 3015 ruiDist = xFindDistortionFrame(pcPic->getPicYuvOrg(), pcPic->getPicYuvRec(), pcPic->getPicSym()->getSPS().getBitDepths()); 3016 #endif 2998 3017 } 2999 3018 } … … 3066 3085 } 3067 3086 3068 UInt64 TEncGOP::xFindDistortionFrame (TComPicYuv* pcPic0, TComPicYuv* pcPic1 )3087 UInt64 TEncGOP::xFindDistortionFrame (TComPicYuv* pcPic0, TComPicYuv* pcPic1, const BitDepths &bitDepths) 3069 3088 { 3070 3089 UInt64 uiTotalDiff = 0; … … 3075 3094 Pel* pSrc0 = pcPic0 ->getAddr(ch); 3076 3095 Pel* pSrc1 = pcPic1 ->getAddr(ch); 3077 UInt uiShift = 2 * DISTORTION_PRECISION_ADJUSTMENT( g_bitDepth[toChannelType(ch)]-8);3096 UInt uiShift = 2 * DISTORTION_PRECISION_ADJUSTMENT(bitDepths.recon[toChannelType(ch)]-8); 3078 3097 3079 3098 const Int iStride = pcPic0->getStride(ch); … … 3144 3163 { 3145 3164 cscd.create(pcPicD->getWidth(COMPONENT_Y), pcPicD->getHeight(COMPONENT_Y), pcPicD->getChromaFormat(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth); 3146 TVideoIOYuv::ColourSpaceConvert(*pcPicD, cscd, conversion, g_bitDepth, false); 3165 #if SVC_EXTENSION 3166 TVideoIOYuv::ColourSpaceConvert(*pcPicD, cscd, conversion, pcPic->getSlice(0)->getBitDepths().recon, false); 3167 #else 3168 TVideoIOYuv::ColourSpaceConvert(*pcPicD, cscd, conversion, pcPic->getPicSym()->getSPS().getBitDepths().recon, false); 3169 #endif 3147 3170 } 3148 3171 TComPicYuv &picd=(conversion==IPCOLOURSPACE_UNCHANGED)?*pcPicD : cscd; … … 3174 3197 pRec += iStride; 3175 3198 } 3176 const Int maxval = 255 << (g_bitDepth[toChannelType(ch)] - 8); 3199 #if SVC_EXTENSION 3200 const Int maxval = 255 << (pcPic->getSlice(0)->getBitDepth(toChannelType(ch)) - 8); 3201 #else 3202 const Int maxval = 255 << (pcPic->getPicSym()->getSPS().getBitDepth(toChannelType(ch)) - 8); 3203 #endif 3177 3204 const Double fRefValue = (Double) maxval * maxval * iSize; 3178 3205 dPSNR[ch] = ( uiSSDtemp ? 10.0 * log10( fRefValue / (Double)uiSSDtemp ) : 999.99 ); … … 3340 3367 const AccessUnit& accessUnit, Double dEncTime, const InputColourSpaceConversion conversion, const Bool printFrameMSE ) 3341 3368 { 3369 #if !SVC_EXTENSION 3370 const TComSPS &sps=pcPicOrgFirstField->getPicSym()->getSPS(); 3371 #endif 3342 3372 Double dPSNR[MAX_NUM_COMPONENT]; 3343 3373 TComPic *apcPicOrgFields[2]={pcPicOrgFirstField, pcPicOrgSecondField}; … … 3356 3386 TComPicYuv &reconField=*(apcPicRecFields[fieldNum]); 3357 3387 cscd[fieldNum].create(reconField.getWidth(COMPONENT_Y), reconField.getHeight(COMPONENT_Y), reconField.getChromaFormat(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth); 3358 TVideoIOYuv::ColourSpaceConvert(reconField, cscd[fieldNum], conversion, g_bitDepth, false); 3388 #if SVC_EXTENSION 3389 TVideoIOYuv::ColourSpaceConvert(reconField, cscd[fieldNum], conversion, pcPicOrgFirstField->getSlice(0)->getBitDepths().recon, false); 3390 #else 3391 TVideoIOYuv::ColourSpaceConvert(reconField, cscd[fieldNum], conversion, sps.getBitDepths().recon, false); 3392 #endif 3359 3393 apcPicRecFields[fieldNum]=cscd+fieldNum; 3360 3394 } … … 3400 3434 } 3401 3435 } 3402 const Int maxval = 255 << (g_bitDepth[toChannelType(ch)] - 8); 3436 #if SVC_EXTENSION 3437 const Int maxval = 255 << (pcPicOrgFirstField->getSlice(0)->getBitDepth(toChannelType(ch)) - 8); 3438 #else 3439 const Int maxval = 255 << (sps.getBitDepth(toChannelType(ch)) - 8); 3440 #endif 3403 3441 const Double fRefValue = (Double) maxval * maxval * iSize*2; 3404 3442 dPSNR[ch] = ( uiSSDtemp ? 10.0 * log10( fRefValue / (Double)uiSSDtemp ) : 999.99 ); … … 3684 3722 3685 3723 Int qp = pcPic->getSlice(0)->getSliceQp(); 3686 Int bitdepthScale = 1 << (g_bitDepth[CHANNEL_TYPE_LUMA]-8); 3724 #if SVC_EXTENSION 3725 const Int bitDepthLuma=pcPic->getSlice(0)->getBitDepth(CHANNEL_TYPE_LUMA); 3726 #else 3727 const Int bitDepthLuma=pcPic->getSlice(0)->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA); 3728 #endif 3729 Int bitdepthScale = 1 << (bitDepthLuma-8); 3687 3730 Int beta = TComLoopFilter::getBeta( qp ) * bitdepthScale; 3688 3731 const Int thr2 = (beta>>2); … … 3757 3800 3758 3801 UInt64 avgSAD = ((colSADsum + rowSADsum)>>1); 3759 avgSAD >>= ( g_bitDepth[CHANNEL_TYPE_LUMA]-8);3802 avgSAD >>= (bitDepthLuma-8); 3760 3803 3761 3804 if ( avgSAD > 2048 ) … … 4168 4211 } 4169 4212 4170 Void TEncGOP::downScalePic( TComPicYuv* pcYuvSrc, TComPicYuv* pcYuvDest) 4171 { 4172 Int inputBitDepth = g_bitDepthLayer[CHANNEL_TYPE_LUMA][m_layerId]; 4173 Int outputBitDepth = g_bitDepthLayer[CHANNEL_TYPE_CHROMA][m_layerId]; 4174 { 4175 pcYuvSrc->setBorderExtension(false); 4176 pcYuvSrc->extendPicBorder (); // extend the border. 4177 pcYuvSrc->setBorderExtension(false); 4178 4179 Int iWidth = pcYuvSrc->getWidth(COMPONENT_Y); 4180 Int iHeight = pcYuvSrc->getHeight(COMPONENT_Y); 4181 4182 if(!m_temp) 4183 { 4184 initDs(iWidth, iHeight, m_pcCfg->getIntraPeriod()>1); 4185 } 4186 4187 filterImg(pcYuvSrc->getAddr(COMPONENT_Y), pcYuvSrc->getStride(COMPONENT_Y), pcYuvDest->getAddr(COMPONENT_Y), pcYuvDest->getStride(COMPONENT_Y), iHeight, iWidth, inputBitDepth-outputBitDepth, 0); 4188 filterImg(pcYuvSrc->getAddr(COMPONENT_Cb), pcYuvSrc->getStride(COMPONENT_Cb), pcYuvDest->getAddr(COMPONENT_Cb), pcYuvDest->getStride(COMPONENT_Cb), iHeight>>1, iWidth>>1, inputBitDepth-outputBitDepth, 1); 4189 filterImg(pcYuvSrc->getAddr(COMPONENT_Cr), pcYuvSrc->getStride(COMPONENT_Cr), pcYuvDest->getAddr(COMPONENT_Cr), pcYuvDest->getStride(COMPONENT_Cr), iHeight>>1, iWidth>>1, inputBitDepth-outputBitDepth, 2); 4190 } 4213 Void TEncGOP::downScalePic( TComPicYuv* pcYuvSrc, TComPicYuv* pcYuvDest, BitDepths& bitDepth) 4214 { 4215 pcYuvSrc->setBorderExtension(false); 4216 pcYuvSrc->extendPicBorder (); // extend the border. 4217 pcYuvSrc->setBorderExtension(false); 4218 4219 Int iWidth = pcYuvSrc->getWidth(COMPONENT_Y); 4220 Int iHeight = pcYuvSrc->getHeight(COMPONENT_Y); 4221 4222 if(!m_temp) 4223 { 4224 initDs(iWidth, iHeight, m_pcCfg->getIntraPeriod()>1); 4225 } 4226 4227 filterImg(pcYuvSrc->getAddr(COMPONENT_Y), pcYuvSrc->getStride(COMPONENT_Y), pcYuvDest->getAddr(COMPONENT_Y), pcYuvDest->getStride(COMPONENT_Y), iHeight, iWidth, bitDepth, 0); 4228 filterImg(pcYuvSrc->getAddr(COMPONENT_Cb), pcYuvSrc->getStride(COMPONENT_Cb), pcYuvDest->getAddr(COMPONENT_Cb), pcYuvDest->getStride(COMPONENT_Cb), iHeight>>1, iWidth>>1, bitDepth, 1); 4229 filterImg(pcYuvSrc->getAddr(COMPONENT_Cr), pcYuvSrc->getStride(COMPONENT_Cr), pcYuvDest->getAddr(COMPONENT_Cr), pcYuvDest->getStride(COMPONENT_Cr), iHeight>>1, iWidth>>1, bitDepth, 2); 4191 4230 } 4192 4231 const Int TEncGOP::m_phase_filter_0_t0[4][13]={ … … 4229 4268 #endif 4230 4269 #endif 4231 Void TEncGOP::filterImg( 4232 Pel *src, 4233 Int iSrcStride, 4234 Pel *dst, 4235 Int iDstStride, 4236 Int height1, 4237 Int width1, 4238 Int shift, 4239 Int plane) 4270 Void TEncGOP::filterImg( Pel *src, Int iSrcStride, Pel *dst, Int iDstStride, Int height1, Int width1, BitDepths& bitDepth, Int plane ) 4240 4271 { 4241 4272 Int length = m_iTap; … … 4248 4279 Pel *p_src_line, *p_dst_line; 4249 4280 Int **p_temp, *p_tmp; 4281 Int shift = bitDepth.recon[CHANNEL_TYPE_LUMA] - bitDepth.recon[CHANNEL_TYPE_CHROMA]; 4250 4282 Int shift2 = 2*7+shift; 4251 4283 Int shift_round = (1 << (shift2 - 1)); 4252 Int iMax = (1<<( g_bitDepth[CHANNEL_TYPE_LUMA]-shift))-1;4284 Int iMax = (1<<(bitDepth.recon[CHANNEL_TYPE_LUMA]-shift))-1; 4253 4285 height2 = (height1 * m_iM) / m_iN; 4254 4286 width2 = (width1 * m_iM) / m_iN; -
branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.h
r1277 r1287 224 224 const AccessUnit& accessUnit, Double dEncTime, const InputColourSpaceConversion snr_conversion, const Bool printFrameMSE ); 225 225 226 UInt64 xFindDistortionFrame (TComPicYuv* pcPic0, TComPicYuv* pcPic1 );226 UInt64 xFindDistortionFrame (TComPicYuv* pcPic0, TComPicYuv* pcPic1, const BitDepths &bitDepths); 227 227 228 228 Double xCalculateRVM(); … … 288 288 #if CGS_3D_ASYMLUT 289 289 Void xDetermin3DAsymLUT( TComSlice * pSlice , TComPic * pCurPic , UInt refLayerIdc , TEncCfg * pCfg , Bool bSignalPPS ); 290 Void downScalePic( TComPicYuv* pcYuvSrc, TComPicYuv* pcYuvDest );290 Void downScalePic( TComPicYuv* pcYuvSrc, TComPicYuv* pcYuvDest, BitDepths& bitDepth); 291 291 Void downScaleComponent2x2( const Pel* pSrc, Pel* pDest, const Int iSrcStride, const Int iDestStride, const Int iSrcWidth, const Int iSrcHeight, const Int inputBitDepth, const Int outputBitDepth ); 292 292 inline Short xClip( Short x , Int bitdepth ); 293 293 Void initDs(Int iWidth, Int iHeight, Int iType); 294 Void filterImg( Pel *src, Int iSrcStride, Pel *dst, Int iDstStride, Int height1, Int width1, Int shift, Int plane);294 Void filterImg( Pel *src, Int iSrcStride, Pel *dst, Int iDstStride, Int height1, Int width1, BitDepths& bitDepth, Int plane ); 295 295 296 296 Int get_mem2DintWithPad(Int ***array2D, Int dim0, Int dim1, Int iPadY, Int iPadX); -
branches/SHM-dev/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp
r1260 r1287 349 349 Pel* orgBlk = orgYuv->getAddr(component) + ((yPos >> componentScaleY) * orgStride) + (xPos >> componentScaleX); 350 350 351 getBlkStats(component, blkStats[ctuRsAddr][component] 351 #if SVC_EXTENSION 352 getBlkStats(component, pPic->getSlice(0)->getBitDepth(toChannelType(component)), blkStats[ctuRsAddr][component] 353 #else 354 getBlkStats(component, pPic->getPicSym()->getSPS().getBitDepth(toChannelType(component)), blkStats[ctuRsAddr][component] 355 #endif 352 356 , srcBlk, orgBlk, srcStride, orgStride, (width >> componentScaleX), (height >> componentScaleY) 353 357 , isLeftAvail, isRightAvail, isAboveAvail, isBelowAvail, isAboveLeftAvail, isAboveRightAvail, isBelowLeftAvail, isBelowRightAvail … … 395 399 } 396 400 397 Int64 TEncSampleAdaptiveOffset::getDistortion( ComponentID compIdx, Int typeIdc, Int typeAuxInfo, Int* invQuantOffset, SAOStatData& statData)401 Int64 TEncSampleAdaptiveOffset::getDistortion(const Int channelBitDepth, Int typeIdc, Int typeAuxInfo, Int* invQuantOffset, SAOStatData& statData) 398 402 { 399 403 Int64 dist = 0; 400 Int shift = 2 * DISTORTION_PRECISION_ADJUSTMENT( g_bitDepth[toChannelType(compIdx)]- 8);404 Int shift = 2 * DISTORTION_PRECISION_ADJUSTMENT(channelBitDepth - 8); 401 405 402 406 switch(typeIdc) … … 472 476 } 473 477 474 Void TEncSampleAdaptiveOffset::deriveOffsets(ComponentID compIdx, Int typeIdc, SAOStatData& statData, Int* quantOffsets, Int& typeAuxInfo)475 { 476 Int bitDepth = g_bitDepth[toChannelType(compIdx)];478 Void TEncSampleAdaptiveOffset::deriveOffsets(ComponentID compIdx, const Int channelBitDepth, Int typeIdc, SAOStatData& statData, Int* quantOffsets, Int& typeAuxInfo) 479 { 480 Int bitDepth = channelBitDepth; 477 481 Int shift = 2 * DISTORTION_PRECISION_ADJUSTMENT(bitDepth-8); 478 #if SVC_EXTENSION 479 Int offsetTh = getSaoMaxOffsetQVal()[compIdx]; //inclusive 480 #else 481 Int offsetTh = g_saoMaxOffsetQVal[compIdx]; //inclusive 482 #endif 482 Int offsetTh = TComSampleAdaptiveOffset::getMaxOffsetQVal(channelBitDepth); //inclusive 483 483 484 484 ::memset(quantOffsets, 0, sizeof(Int)*MAX_NUM_SAO_CLASSES); … … 595 595 } 596 596 597 Void TEncSampleAdaptiveOffset::deriveModeNewRDO( Int ctuRsAddr, SAOBlkParam* mergeList[NUM_SAO_MERGE_TYPES], Bool* sliceEnabled, SAOStatData*** blkStats, SAOBlkParam& modeParam, Double& modeNormCost, TEncSbac** cabacCoderRDO, Int inCabacLabel)597 Void TEncSampleAdaptiveOffset::deriveModeNewRDO(const BitDepths &bitDepths, Int ctuRsAddr, SAOBlkParam* mergeList[NUM_SAO_MERGE_TYPES], Bool* sliceEnabled, SAOStatData*** blkStats, SAOBlkParam& modeParam, Double& modeNormCost, TEncSbac** cabacCoderRDO, Int inCabacLabel) 598 598 { 599 599 Double minCost, cost; … … 612 612 modeParam[COMPONENT_Y].modeIdc = SAO_MODE_OFF; 613 613 m_pcRDGoOnSbacCoder->load(cabacCoderRDO[inCabacLabel]); 614 #if SVC_EXTENSION 615 m_pcRDGoOnSbacCoder->codeSAOBlkParam(modeParam, getSaoMaxOffsetQVal(), sliceEnabled, (mergeList[SAO_MERGE_LEFT]!= NULL), (mergeList[SAO_MERGE_ABOVE]!= NULL), true); 616 #else 617 m_pcRDGoOnSbacCoder->codeSAOBlkParam(modeParam, sliceEnabled, (mergeList[SAO_MERGE_LEFT]!= NULL), (mergeList[SAO_MERGE_ABOVE]!= NULL), true); 618 #endif 614 m_pcRDGoOnSbacCoder->codeSAOBlkParam(modeParam, bitDepths, sliceEnabled, (mergeList[SAO_MERGE_LEFT]!= NULL), (mergeList[SAO_MERGE_ABOVE]!= NULL), true); 619 615 m_pcRDGoOnSbacCoder->store(cabacCoderRDO[SAO_CABACSTATE_BLK_MID]); 620 616 621 617 //------ luma --------// 622 618 { 623 ComponentID compIdx = COMPONENT_Y;619 const ComponentID compIdx = COMPONENT_Y; 624 620 //"off" case as initial cost 625 621 modeParam[compIdx].modeIdc = SAO_MODE_OFF; 626 622 m_pcRDGoOnSbacCoder->resetBits(); 627 #if SVC_EXTENSION 628 m_pcRDGoOnSbacCoder->codeSAOOffsetParam(compIdx, modeParam[compIdx], sliceEnabled[compIdx], getSaoMaxOffsetQVal()); 629 #else 630 m_pcRDGoOnSbacCoder->codeSAOOffsetParam(compIdx, modeParam[compIdx], sliceEnabled[compIdx]); 631 #endif 623 m_pcRDGoOnSbacCoder->codeSAOOffsetParam(compIdx, modeParam[compIdx], sliceEnabled[compIdx], bitDepths.recon[CHANNEL_TYPE_LUMA]); 632 624 modeDist[compIdx] = 0; 633 625 minCost= m_lambda[compIdx]*((Double)m_pcRDGoOnSbacCoder->getNumberOfWrittenBits()); … … 641 633 642 634 //derive coded offset 643 deriveOffsets(compIdx, typeIdc, blkStats[ctuRsAddr][compIdx][typeIdc], testOffset[compIdx].offset, testOffset[compIdx].typeAuxInfo);635 deriveOffsets(compIdx, bitDepths.recon[CHANNEL_TYPE_LUMA], typeIdc, blkStats[ctuRsAddr][compIdx][typeIdc], testOffset[compIdx].offset, testOffset[compIdx].typeAuxInfo); 644 636 645 637 //inversed quantized offsets … … 647 639 648 640 //get distortion 649 dist[compIdx] = getDistortion( compIdx, testOffset[compIdx].typeIdc, testOffset[compIdx].typeAuxInfo, invQuantOffset, blkStats[ctuRsAddr][compIdx][typeIdc]);641 dist[compIdx] = getDistortion(bitDepths.recon[CHANNEL_TYPE_LUMA], testOffset[compIdx].typeIdc, testOffset[compIdx].typeAuxInfo, invQuantOffset, blkStats[ctuRsAddr][compIdx][typeIdc]); 650 642 651 643 //get rate 652 644 m_pcRDGoOnSbacCoder->load(cabacCoderRDO[SAO_CABACSTATE_BLK_MID]); 653 645 m_pcRDGoOnSbacCoder->resetBits(); 654 #if SVC_EXTENSION 655 m_pcRDGoOnSbacCoder->codeSAOOffsetParam(compIdx, testOffset[compIdx], sliceEnabled[compIdx], getSaoMaxOffsetQVal()); 656 #else 657 m_pcRDGoOnSbacCoder->codeSAOOffsetParam(compIdx, testOffset[compIdx], sliceEnabled[compIdx]); 658 #endif 646 m_pcRDGoOnSbacCoder->codeSAOOffsetParam(compIdx, testOffset[compIdx], sliceEnabled[compIdx], bitDepths.recon[CHANNEL_TYPE_LUMA]); 659 647 Int rate = m_pcRDGoOnSbacCoder->getNumberOfWrittenBits(); 660 648 cost = (Double)dist[compIdx] + m_lambda[compIdx]*((Double)rate); … … 683 671 modeParam[component].modeIdc = SAO_MODE_OFF; 684 672 modeDist [component] = 0; 685 686 #if SVC_EXTENSION 687 m_pcRDGoOnSbacCoder->codeSAOOffsetParam(component, modeParam[component], sliceEnabled[component], getSaoMaxOffsetQVal()); 688 #else 689 m_pcRDGoOnSbacCoder->codeSAOOffsetParam(component, modeParam[component], sliceEnabled[component]); 690 #endif 691 673 m_pcRDGoOnSbacCoder->codeSAOOffsetParam(component, modeParam[component], sliceEnabled[component], bitDepths.recon[CHANNEL_TYPE_CHROMA]); 674 692 675 const UInt currentWrittenBits = m_pcRDGoOnSbacCoder->getNumberOfWrittenBits(); 693 676 cost += m_lambda[component] * (currentWrittenBits - previousWrittenBits); … … 719 702 720 703 //derive offset & get distortion 721 deriveOffsets(component, typeIdc, blkStats[ctuRsAddr][component][typeIdc], testOffset[component].offset, testOffset[component].typeAuxInfo);704 deriveOffsets(component, bitDepths.recon[CHANNEL_TYPE_CHROMA], typeIdc, blkStats[ctuRsAddr][component][typeIdc], testOffset[component].offset, testOffset[component].typeAuxInfo); 722 705 invertQuantOffsets(component, typeIdc, testOffset[component].typeAuxInfo, invQuantOffset, testOffset[component].offset); 723 dist[component] = getDistortion(component, typeIdc, testOffset[component].typeAuxInfo, invQuantOffset, blkStats[ctuRsAddr][component][typeIdc]); 724 725 #if SVC_EXTENSION 726 m_pcRDGoOnSbacCoder->codeSAOOffsetParam(component, testOffset[component], sliceEnabled[component], getSaoMaxOffsetQVal()); 727 #else 728 m_pcRDGoOnSbacCoder->codeSAOOffsetParam(component, testOffset[component], sliceEnabled[component]); 729 #endif 706 dist[component] = getDistortion(bitDepths.recon[CHANNEL_TYPE_CHROMA], typeIdc, testOffset[component].typeAuxInfo, invQuantOffset, blkStats[ctuRsAddr][component][typeIdc]); 707 708 m_pcRDGoOnSbacCoder->codeSAOOffsetParam(component, testOffset[component], sliceEnabled[component], bitDepths.recon[CHANNEL_TYPE_CHROMA]); 730 709 731 710 const UInt currentWrittenBits = m_pcRDGoOnSbacCoder->getNumberOfWrittenBits(); … … 755 734 m_pcRDGoOnSbacCoder->load(cabacCoderRDO[inCabacLabel]); 756 735 m_pcRDGoOnSbacCoder->resetBits(); 757 #if SVC_EXTENSION 758 m_pcRDGoOnSbacCoder->codeSAOBlkParam(modeParam, getSaoMaxOffsetQVal(), sliceEnabled, (mergeList[SAO_MERGE_LEFT]!= NULL), (mergeList[SAO_MERGE_ABOVE]!= NULL), false); 759 #else 760 m_pcRDGoOnSbacCoder->codeSAOBlkParam(modeParam, sliceEnabled, (mergeList[SAO_MERGE_LEFT]!= NULL), (mergeList[SAO_MERGE_ABOVE]!= NULL), false); 761 #endif 736 m_pcRDGoOnSbacCoder->codeSAOBlkParam(modeParam, bitDepths, sliceEnabled, (mergeList[SAO_MERGE_LEFT]!= NULL), (mergeList[SAO_MERGE_ABOVE]!= NULL), false); 762 737 modeNormCost += (Double)m_pcRDGoOnSbacCoder->getNumberOfWrittenBits(); 763 738 } 764 739 765 Void TEncSampleAdaptiveOffset::deriveModeMergeRDO( Int ctuRsAddr, SAOBlkParam* mergeList[NUM_SAO_MERGE_TYPES], Bool* sliceEnabled, SAOStatData*** blkStats, SAOBlkParam& modeParam, Double& modeNormCost, TEncSbac** cabacCoderRDO, Int inCabacLabel)740 Void TEncSampleAdaptiveOffset::deriveModeMergeRDO(const BitDepths &bitDepths, Int ctuRsAddr, SAOBlkParam* mergeList[NUM_SAO_MERGE_TYPES], Bool* sliceEnabled, SAOStatData*** blkStats, SAOBlkParam& modeParam, Double& modeNormCost, TEncSbac** cabacCoderRDO, Int inCabacLabel) 766 741 { 767 742 modeNormCost = MAX_DOUBLE; … … 791 766 { 792 767 //offsets have been reconstructed. Don't call inversed quantization function. 793 normDist += (((Double)getDistortion( ComponentID(compIdx), mergedOffsetParam.typeIdc, mergedOffsetParam.typeAuxInfo, mergedOffsetParam.offset, blkStats[ctuRsAddr][compIdx][mergedOffsetParam.typeIdc]))768 normDist += (((Double)getDistortion(bitDepths.recon[toChannelType(ComponentID(compIdx))], mergedOffsetParam.typeIdc, mergedOffsetParam.typeAuxInfo, mergedOffsetParam.offset, blkStats[ctuRsAddr][compIdx][mergedOffsetParam.typeIdc])) 794 769 /m_lambda[compIdx] 795 770 ); … … 801 776 m_pcRDGoOnSbacCoder->load(cabacCoderRDO[inCabacLabel]); 802 777 m_pcRDGoOnSbacCoder->resetBits(); 803 #if SVC_EXTENSION 804 m_pcRDGoOnSbacCoder->codeSAOBlkParam(testBlkParam, getSaoMaxOffsetQVal(), sliceEnabled, (mergeList[SAO_MERGE_LEFT]!= NULL), (mergeList[SAO_MERGE_ABOVE]!= NULL), false); 805 #else 806 m_pcRDGoOnSbacCoder->codeSAOBlkParam(testBlkParam, sliceEnabled, (mergeList[SAO_MERGE_LEFT]!= NULL), (mergeList[SAO_MERGE_ABOVE]!= NULL), false); 807 #endif 778 m_pcRDGoOnSbacCoder->codeSAOBlkParam(testBlkParam, bitDepths, sliceEnabled, (mergeList[SAO_MERGE_LEFT]!= NULL), (mergeList[SAO_MERGE_ABOVE]!= NULL), false); 808 779 Int rate = m_pcRDGoOnSbacCoder->getNumberOfWrittenBits(); 809 780 … … 869 840 case SAO_MODE_NEW: 870 841 { 871 deriveModeNewRDO(ctuRsAddr, mergeList, sliceEnabled, blkStats, modeParam, modeCost, m_pppcRDSbacCoder, SAO_CABACSTATE_BLK_CUR); 842 #if SVC_EXTENSION 843 deriveModeNewRDO(pic->getSlice(0)->getBitDepths(), ctuRsAddr, mergeList, sliceEnabled, blkStats, modeParam, modeCost, m_pppcRDSbacCoder, SAO_CABACSTATE_BLK_CUR); 844 #else 845 deriveModeNewRDO(pic->getPicSym()->getSPS().getBitDepths(), ctuRsAddr, mergeList, sliceEnabled, blkStats, modeParam, modeCost, m_pppcRDSbacCoder, SAO_CABACSTATE_BLK_CUR); 846 #endif 872 847 873 848 } … … 875 850 case SAO_MODE_MERGE: 876 851 { 877 deriveModeMergeRDO(ctuRsAddr, mergeList, sliceEnabled, blkStats , modeParam, modeCost, m_pppcRDSbacCoder, SAO_CABACSTATE_BLK_CUR); 852 #if SVC_EXTENSION 853 deriveModeMergeRDO(pic->getSlice(0)->getBitDepths(), ctuRsAddr, mergeList, sliceEnabled, blkStats , modeParam, modeCost, m_pppcRDSbacCoder, SAO_CABACSTATE_BLK_CUR); 854 #else 855 deriveModeMergeRDO(pic->getPicSym()->getSPS().getBitDepths(), ctuRsAddr, mergeList, sliceEnabled, blkStats , modeParam, modeCost, m_pppcRDSbacCoder, SAO_CABACSTATE_BLK_CUR); 856 #endif 878 857 } 879 858 break; … … 953 932 954 933 955 Void TEncSampleAdaptiveOffset::getBlkStats( ComponentID compIdx, SAOStatData* statsDataTypes934 Void TEncSampleAdaptiveOffset::getBlkStats(const ComponentID compIdx, const Int channelBitDepth, SAOStatData* statsDataTypes 956 935 , Pel* srcBlk, Pel* orgBlk, Int srcStride, Int orgStride, Int width, Int height 957 936 , Bool isLeftAvail, Bool isRightAvail, Bool isAboveAvail, Bool isBelowAvail, Bool isAboveLeftAvail, Bool isAboveRightAvail, Bool isBelowLeftAvail, Bool isBelowRightAvail … … 1359 1338 #endif 1360 1339 endY = isBelowAvail ? (height- skipLinesB[typeIdx]) : height; 1361 Int shiftBits = g_bitDepth[toChannelType(compIdx)]- NUM_SAO_BO_CLASSES_LOG2;1340 Int shiftBits = channelBitDepth - NUM_SAO_BO_CLASSES_LOG2; 1362 1341 for (y=0; y< endY; y++) 1363 1342 { -
branches/SHM-dev/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.h
r1259 r1287 126 126 Void decidePicParams(Bool* sliceEnabled, Int picTempLayer); 127 127 Void decideBlkParams(TComPic* pic, Bool* sliceEnabled, SAOStatData*** blkStats, TComPicYuv* srcYuv, TComPicYuv* resYuv, SAOBlkParam* reconParams, SAOBlkParam* codedParams); 128 Void getBlkStats( ComponentID compIdx, SAOStatData* statsDataTypes, Pel* srcBlk, Pel* orgBlk, Int srcStride, Int orgStride, Int width, Int height, Bool isLeftAvail, Bool isRightAvail, Bool isAboveAvail, Bool isBelowAvail, Bool isAboveLeftAvail, Bool isAboveRightAvail, Bool isBelowLeftAvail, Bool isBelowRightAvail128 Void getBlkStats(const ComponentID compIdx, const Int channelBitDepth, SAOStatData* statsDataTypes, Pel* srcBlk, Pel* orgBlk, Int srcStride, Int orgStride, Int width, Int height, Bool isLeftAvail, Bool isRightAvail, Bool isAboveAvail, Bool isBelowAvail, Bool isAboveLeftAvail, Bool isAboveRightAvail, Bool isBelowLeftAvail, Bool isBelowRightAvail 129 129 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK 130 130 , Bool isCalculatePreDeblockSamples 131 131 #endif 132 132 ); 133 Void deriveModeNewRDO( Int ctuRsAddr, SAOBlkParam* mergeList[NUM_SAO_MERGE_TYPES], Bool* sliceEnabled, SAOStatData*** blkStats, SAOBlkParam& modeParam, Double& modeNormCost, TEncSbac** cabacCoderRDO, Int inCabacLabel);134 Void deriveModeMergeRDO( Int ctuRsAddr, SAOBlkParam* mergeList[NUM_SAO_MERGE_TYPES], Bool* sliceEnabled, SAOStatData*** blkStats, SAOBlkParam& modeParam, Double& modeNormCost, TEncSbac** cabacCoderRDO, Int inCabacLabel);135 Int64 getDistortion( ComponentID compIdx, Int typeIdc, Int typeAuxInfo, Int* offsetVal, SAOStatData& statData);136 Void deriveOffsets(ComponentID compIdx, Int typeIdc, SAOStatData& statData, Int* quantOffsets, Int& typeAuxInfo);133 Void deriveModeNewRDO(const BitDepths &bitDepths, Int ctuRsAddr, SAOBlkParam* mergeList[NUM_SAO_MERGE_TYPES], Bool* sliceEnabled, SAOStatData*** blkStats, SAOBlkParam& modeParam, Double& modeNormCost, TEncSbac** cabacCoderRDO, Int inCabacLabel); 134 Void deriveModeMergeRDO(const BitDepths &bitDepths, Int ctuRsAddr, SAOBlkParam* mergeList[NUM_SAO_MERGE_TYPES], Bool* sliceEnabled, SAOStatData*** blkStats, SAOBlkParam& modeParam, Double& modeNormCost, TEncSbac** cabacCoderRDO, Int inCabacLabel); 135 Int64 getDistortion(const Int channelBitDepth, Int typeIdc, Int typeAuxInfo, Int* offsetVal, SAOStatData& statData); 136 Void deriveOffsets(ComponentID compIdx, const Int channelBitDepth, Int typeIdc, SAOStatData& statData, Int* quantOffsets, Int& typeAuxInfo); 137 137 inline Int64 estSaoDist(Int64 count, Int64 offset, Int64 diffSum, Int shift); 138 138 inline Int estIterOffset(Int typeIdx, Int classIdx, Double lambda, Int offsetInput, Int64 count, Int64 diffSum, Int shift, Int bitIncrease, Int64& bestDist, Double& bestCost, Int offsetTh ); -
branches/SHM-dev/source/Lib/TLibEncoder/TEncSbac.cpp
r1286 r1287 886 886 887 887 #if SVC_EXTENSION 888 Int qpBdOffsetY = pcCU->getSlice()->getQpBDOffset Y();888 Int qpBdOffsetY = pcCU->getSlice()->getQpBDOffset(CHANNEL_TYPE_LUMA); 889 889 #else 890 890 Int qpBdOffsetY = pcCU->getSlice()->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA); … … 1608 1608 } 1609 1609 } 1610 #if SVC_EXTENSION 1611 Void TEncSbac::codeSAOOffsetParam(ComponentID compIdx, SAOOffset& ctbParam, Bool sliceEnabled, UInt* saoMaxOffsetQVal) 1612 #else 1613 Void TEncSbac::codeSAOOffsetParam(ComponentID compIdx, SAOOffset& ctbParam, Bool sliceEnabled) 1614 #endif 1610 1611 Void TEncSbac::codeSAOOffsetParam(ComponentID compIdx, SAOOffset& ctbParam, Bool sliceEnabled, const Int channelBitDepth) 1615 1612 { 1616 1613 UInt uiSymbol; … … 1658 1655 } 1659 1656 1657 const Int maxOffsetQVal = TComSampleAdaptiveOffset::getMaxOffsetQVal(channelBitDepth); 1660 1658 for(Int i=0; i< 4; i++) 1661 1659 { 1662 #if SVC_EXTENSION 1663 codeSaoMaxUvlc((offset[i]<0)?(-offset[i]):(offset[i]), saoMaxOffsetQVal[compIdx] ); //sao_offset_abs 1664 #else 1665 codeSaoMaxUvlc((offset[i]<0)?(-offset[i]):(offset[i]), g_saoMaxOffsetQVal[compIdx] ); //sao_offset_abs 1666 #endif 1660 codeSaoMaxUvlc((offset[i]<0)?(-offset[i]):(offset[i]), maxOffsetQVal ); //sao_offset_abs 1667 1661 } 1668 1662 … … 1693 1687 1694 1688 1695 Void TEncSbac::codeSAOBlkParam(SAOBlkParam& saoBlkParam 1696 #if SVC_EXTENSION 1697 , UInt* saoMaxOffsetQVal 1698 #endif 1689 Void TEncSbac::codeSAOBlkParam(SAOBlkParam& saoBlkParam, const BitDepths &bitDepths 1699 1690 , Bool* sliceEnabled 1700 1691 , Bool leftMergeAvail … … 1728 1719 for(Int compIdx=0; compIdx < MAX_NUM_COMPONENT; compIdx++) 1729 1720 { 1730 #if SVC_EXTENSION 1731 codeSAOOffsetParam(ComponentID(compIdx), saoBlkParam[compIdx], sliceEnabled[compIdx], saoMaxOffsetQVal); 1732 #else 1733 codeSAOOffsetParam(ComponentID(compIdx), saoBlkParam[compIdx], sliceEnabled[compIdx]); 1734 #endif 1721 codeSAOOffsetParam(ComponentID(compIdx), saoBlkParam[compIdx], sliceEnabled[compIdx], bitDepths.recon[toChannelType(ComponentID(compIdx))]); 1735 1722 } 1736 1723 } -
branches/SHM-dev/source/Lib/TLibEncoder/TEncSbac.h
r1285 r1287 104 104 Void codeSAOSign ( UInt uiCode); //<! code SAO offset sign 105 105 106 #if SVC_EXTENSION 107 Void codeSliceHeaderExtn ( TComSlice* pSlice, Int shBitsWrittenTillNow ); 108 Void codeSAOOffsetParam(ComponentID compIdx, SAOOffset& ctbParam, Bool sliceEnabled, UInt* saoMaxOffsetQVal); 109 Void codeSAOBlkParam(SAOBlkParam& saoBlkParam 110 , UInt* saoMaxOffsetQVal 106 Void codeSAOOffsetParam(ComponentID compIdx, SAOOffset& ctbParam, Bool sliceEnabled, const Int channelBitDepth); 107 Void codeSAOBlkParam(SAOBlkParam& saoBlkParam, const BitDepths &bitDepths 111 108 , Bool* sliceEnabled 112 109 , Bool leftMergeAvail … … 114 111 , Bool onlyEstMergeInfo = false 115 112 ); 116 #else 117 Void codeSAOOffsetParam(ComponentID compIdx, SAOOffset& ctbParam, Bool sliceEnabled); 118 Void codeSAOBlkParam(SAOBlkParam& saoBlkParam 119 , Bool* sliceEnabled 120 , Bool leftMergeAvail 121 , Bool aboveMergeAvail 122 , Bool onlyEstMergeInfo = false 123 ); 113 114 #if SVC_EXTENSION 115 Void codeSliceHeaderExtn ( TComSlice* pSlice, Int shBitsWrittenTillNow ); 124 116 #endif 125 117 -
branches/SHM-dev/source/Lib/TLibEncoder/TEncSearch.cpp
r1283 r1287 359 359 360 360 // distortion 361 m_cDistParam.bitDepth = g_bitDepth[CHANNEL_TYPE_LUMA];361 m_cDistParam.bitDepth = pcPatternKey->getBitDepthY(); 362 362 if(m_pcEncCfg->getFastSearch() == SELECTIVE) 363 363 { … … 848 848 849 849 m_cDistParam.pCur = piRefPos; 850 m_cDistParam.bitDepth = g_bitDepth[CHANNEL_TYPE_LUMA];850 m_cDistParam.bitDepth = pcPatternKey->getBitDepthY(); 851 851 uiDist = m_cDistParam.DistFunc( &m_cDistParam ); 852 852 uiDist += m_pcRdCost->getCost( cMvTest.getHor(), cMvTest.getVer() ); … … 1115 1115 const ChromaFormat chFmt = pcOrgYuv->getChromaFormat(); 1116 1116 const ChannelType chType = toChannelType(compID); 1117 #if SVC_EXTENSION 1118 const Int bitDepth = pcCU->getSlice()->getBitDepth(chType); 1119 #else 1120 const Int bitDepth = pcCU->getSlice()->getSPS()->getBitDepth(chType); 1121 #endif 1117 1122 1118 1123 const UInt uiWidth = rect.width; … … 1296 1301 Pel* pRecQt = piRecQt; 1297 1302 Pel* pRecIPred = piRecIPred; 1298 const UInt clipbd=g_bitDepth[chType];1299 1303 1300 1304 if (pcCU->getSlice()->getPPS()->getUseCrossComponentPrediction()) … … 1340 1344 ss << pResi[ uiX ] << ", "; 1341 1345 } 1342 pReco [ uiX ] = Pel(ClipBD<Int>( Int(pPred[uiX]) + Int(pResi[uiX]), clipbd));1346 pReco [ uiX ] = Pel(ClipBD<Int>( Int(pPred[uiX]) + Int(pResi[uiX]), bitDepth )); 1343 1347 pRecQt [ uiX ] = pReco[ uiX ]; 1344 1348 pRecIPred[ uiX ] = pReco[ uiX ]; … … 1369 1373 for( UInt uiX = 0; uiX < uiWidth; uiX++ ) 1370 1374 { 1371 pReco [ uiX ] = Pel(ClipBD<Int>( Int(pPred[uiX]) + Int(pResi[uiX]), clipbd));1375 pReco [ uiX ] = Pel(ClipBD<Int>( Int(pPred[uiX]) + Int(pResi[uiX]), bitDepth )); 1372 1376 pRecQt [ uiX ] = pReco[ uiX ]; 1373 1377 pRecIPred[ uiX ] = pReco[ uiX ]; … … 1383 1387 1384 1388 //===== update distortion ===== 1385 ruiDist += m_pcRdCost->getDistPart( g_bitDepth[chType], piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight, compID );1389 ruiDist += m_pcRdCost->getDistPart( bitDepth, piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight, compID ); 1386 1390 } 1387 1391 … … 2190 2194 const ChromaFormat chFmt = pcCU->getPic()->getChromaFormat(); 2191 2195 const UInt numberValidComponents = getNumberValidComponents(chFmt); 2196 const TComSPS &sps = *(pcCU->getSlice()->getSPS()); 2197 const TComPPS &pps = *(pcCU->getSlice()->getPPS()); 2192 2198 Distortion uiOverallDistY = 0; 2193 2199 UInt CandNum; … … 2210 2216 #else 2211 2217 const Double sqrtLambdaForFirstPass= (m_pcEncCfg->getCostMode()==COST_MIXED_LOSSLESS_LOSSY_CODING && pcCU->getCUTransquantBypass(0)) ? 2212 sqrt(0.57 * pow(2.0, ((LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP_PRIME - 12 - 6 * (g_bitDepth[CHANNEL_TYPE_LUMA] - 8)) / 3.0))) 2218 #if SVC_EXTENSION 2219 sqrt(0.57 * pow(2.0, ((LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP_PRIME - 12 - 6 * (pcCU->getSlice()->getBitDepth(CHANNEL_TYPE_LUMA) - 8)) / 3.0))) 2220 #else 2221 sqrt(0.57 * pow(2.0, ((LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP_PRIME - 12 - 6 * (sps.getBitDepth(CHANNEL_TYPE_LUMA) - 8)) / 3.0))) 2222 #endif 2213 2223 : m_pcRdCost->getSqrtLambda(); 2214 2224 #endif 2215 2225 2216 2226 //===== set QP and clear Cbf ===== 2217 if ( p cCU->getSlice()->getPPS()->getUseDQP() == true)2227 if ( pps.getUseDQP() == true) 2218 2228 { 2219 2229 pcCU->setQPSubParts( pcCU->getQP(0), 0, uiDepth ); … … 2287 2297 DistParam distParam; 2288 2298 const Bool bUseHadamard=pcCU->getCUTransquantBypass(0) == 0; 2289 m_pcRdCost->setDistParam(distParam, g_bitDepth[CHANNEL_TYPE_LUMA], piOrg, uiStride, piPred, uiStride, puRect.width, puRect.height, bUseHadamard); 2299 #if SVC_EXTENSION 2300 m_pcRdCost->setDistParam(distParam, pcCU->getSlice()->getBitDepth(CHANNEL_TYPE_LUMA), piOrg, uiStride, piPred, uiStride, puRect.width, puRect.height, bUseHadamard); 2301 #else 2302 m_pcRdCost->setDistParam(distParam, sps.getBitDepth(CHANNEL_TYPE_LUMA), piOrg, uiStride, piPred, uiStride, puRect.width, puRect.height, bUseHadamard); 2303 #endif 2290 2304 distParam.bApplyWeight = false; 2291 2305 for( Int modeIdx = 0; modeIdx < numModesAvailable; modeIdx++ ) … … 2304 2318 #endif 2305 2319 2306 const Bool bUseFilter=TComPrediction::filteringIntraReferenceSamples(COMPONENT_Y, uiMode, puRect.width, puRect.height, chFmt, pcCU->getSlice()->getSPS()->getDisableIntraReferenceSmoothing());2320 const Bool bUseFilter=TComPrediction::filteringIntraReferenceSamples(COMPONENT_Y, uiMode, puRect.width, puRect.height, chFmt, sps.getDisableIntraReferenceSmoothing()); 2307 2321 2308 2322 predIntraAng( COMPONENT_Y, uiMode, piOrg, uiStride, piPred, uiStride, tuRecurseWithPU, bAboveAvail, bLeftAvail, bUseFilter, TComPrediction::UseDPCMForFirstPassIntraEstimation(tuRecurseWithPU, uiMode) ); … … 2416 2430 xSetIntraResultLumaQT( pcRecoYuv, tuRecurseWithPU ); 2417 2431 2418 if (p cCU->getSlice()->getPPS()->getUseCrossComponentPrediction())2432 if (pps.getUseCrossComponentPrediction()) 2419 2433 { 2420 2434 const Int xOffset = tuRecurseWithPU.getRect( COMPONENT_Y ).x0; … … 2492 2506 xSetIntraResultLumaQT( pcRecoYuv, tuRecurseWithPU ); 2493 2507 2494 if (p cCU->getSlice()->getPPS()->getUseCrossComponentPrediction())2508 if (pps.getUseCrossComponentPrediction()) 2495 2509 { 2496 2510 const Int xOffset = tuRecurseWithPU.getRect( COMPONENT_Y ).x0; … … 2760 2774 Void TEncSearch::xEncPCM (TComDataCU* pcCU, UInt uiAbsPartIdx, Pel* pOrg, Pel* pPCM, Pel* pPred, Pel* pResi, Pel* pReco, UInt uiStride, UInt uiWidth, UInt uiHeight, const ComponentID compID ) 2761 2775 { 2762 const UInt uiReconStride = pcCU->getPic()->getPicYuvRec()->getStride(compID); 2763 const UInt uiPCMBitDepth = pcCU->getSlice()->getSPS()->getPCMBitDepth(toChannelType(compID)); 2776 const UInt uiReconStride = pcCU->getPic()->getPicYuvRec()->getStride(compID); 2777 const UInt uiPCMBitDepth = pcCU->getSlice()->getSPS()->getPCMBitDepth(toChannelType(compID)); 2778 #if SVC_EXTENSION 2779 const Int channelBitDepth = pcCU->getSlice()->getBitDepth(toChannelType(compID)); 2780 #else 2781 const Int channelBitDepth = pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)); 2782 #endif 2764 2783 Pel* pRecoPic = pcCU->getPic()->getPicYuvRec()->getAddr(compID, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu()+uiAbsPartIdx); 2765 2784 2766 const Int pcmShiftRight=( g_bitDepth[toChannelType(compID)]- Int(uiPCMBitDepth));2785 const Int pcmShiftRight=(channelBitDepth - Int(uiPCMBitDepth)); 2767 2786 2768 2787 assert(pcmShiftRight >= 0); … … 2849 2868 2850 2869 2851 m_pcRdCost->setDistParam( cDistParam, g_bitDepth[CHANNEL_TYPE_LUMA], 2870 #if SVC_EXTENSION 2871 m_pcRdCost->setDistParam( cDistParam, pcCU->getSlice()->getBitDepth(CHANNEL_TYPE_LUMA), 2872 #else 2873 m_pcRdCost->setDistParam( cDistParam, pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA), 2874 #endif 2852 2875 pcYuvOrg->getAddr( COMPONENT_Y, uiAbsPartIdx ), pcYuvOrg->getStride(COMPONENT_Y), 2853 2876 m_tmpYuvPred .getAddr( COMPONENT_Y, uiAbsPartIdx ), m_tmpYuvPred.getStride(COMPONENT_Y), … … 3797 3820 #endif 3798 3821 { 3799 xPredInterBlk( COMPONENT_Y, pcCU, pcPicYuvRef, uiPartAddr, &cMvCand, iSizeX, iSizeY, pcTemplateCand, true ); 3822 #if SVC_EXTENSION 3823 xPredInterBlk( COMPONENT_Y, pcCU, pcPicYuvRef, uiPartAddr, &cMvCand, iSizeX, iSizeY, pcTemplateCand, true, pcCU->getSlice()->getBitDepth(CHANNEL_TYPE_LUMA) ); 3824 #else 3825 xPredInterBlk( COMPONENT_Y, pcCU, pcPicYuvRef, uiPartAddr, &cMvCand, iSizeX, iSizeY, pcTemplateCand, true, pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) ); 3826 #endif 3800 3827 } 3801 3828 else 3802 3829 { 3803 xPredInterBlk( COMPONENT_Y, pcCU, pcPicYuvRef, uiPartAddr, &cMvCand, iSizeX, iSizeY, pcTemplateCand, false ); 3830 #if SVC_EXTENSION 3831 xPredInterBlk( COMPONENT_Y, pcCU, pcPicYuvRef, uiPartAddr, &cMvCand, iSizeX, iSizeY, pcTemplateCand, false, pcCU->getSlice()->getBitDepth(CHANNEL_TYPE_LUMA) ); 3832 #else 3833 xPredInterBlk( COMPONENT_Y, pcCU, pcPicYuvRef, uiPartAddr, &cMvCand, iSizeX, iSizeY, pcTemplateCand, false, pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) ); 3834 #endif 3804 3835 } 3805 3836 … … 3815 3846 3816 3847 // calc distortion 3817 3818 uiCost = m_pcRdCost->getDistPart( g_bitDepth[CHANNEL_TYPE_LUMA], pcTemplateCand->getAddr(COMPONENT_Y, uiPartAddr), pcTemplateCand->getStride(COMPONENT_Y), pcOrgYuv->getAddr(COMPONENT_Y, uiPartAddr), pcOrgYuv->getStride(COMPONENT_Y), iSizeX, iSizeY, COMPONENT_Y, DF_SAD ); 3848 #if SVC_EXTENSION 3849 uiCost = m_pcRdCost->getDistPart( pcCU->getSlice()->getBitDepth(CHANNEL_TYPE_LUMA), pcTemplateCand->getAddr(COMPONENT_Y, uiPartAddr), pcTemplateCand->getStride(COMPONENT_Y), pcOrgYuv->getAddr(COMPONENT_Y, uiPartAddr), pcOrgYuv->getStride(COMPONENT_Y), iSizeX, iSizeY, COMPONENT_Y, DF_SAD ); 3850 #else 3851 uiCost = m_pcRdCost->getDistPart( pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA), pcTemplateCand->getAddr(COMPONENT_Y, uiPartAddr), pcTemplateCand->getStride(COMPONENT_Y), pcOrgYuv->getAddr(COMPONENT_Y, uiPartAddr), pcOrgYuv->getStride(COMPONENT_Y), iSizeX, iSizeY, COMPONENT_Y, DF_SAD ); 3852 #endif 3819 3853 uiCost = (UInt) m_pcRdCost->calcRdCost( m_auiMVPIdxCost[iMVPIdx][iMVPNum], uiCost, false, DF_SAD ); 3820 3854 return uiCost; … … 3863 3897 iRoiWidth, 3864 3898 iRoiHeight, 3865 pcYuv->getStride(COMPONENT_Y) ); 3899 pcYuv->getStride(COMPONENT_Y), 3900 #if SVC_EXTENSION 3901 pcCU->getSlice()->getBitDepth(CHANNEL_TYPE_LUMA) ); 3902 #else 3903 pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) ); 3904 #endif 3866 3905 3867 3906 Pel* piRefY = pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxPred )->getPicYuvRec()->getAddr( COMPONENT_Y, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu() + uiPartAddr ); … … 4003 4042 setDistParamComp(COMPONENT_Y); 4004 4043 4005 m_cDistParam.bitDepth = g_bitDepth[CHANNEL_TYPE_LUMA];4044 m_cDistParam.bitDepth = pcPatternKey->getBitDepthY(); 4006 4045 uiSad = m_cDistParam.DistFunc( &m_cDistParam ); 4007 4046 … … 4438 4477 pcPatternKey->getROIYWidth(), 4439 4478 pcPatternKey->getROIYHeight(), 4440 iRefStride ); 4479 iRefStride, 4480 pcPatternKey->getBitDepthY()); 4441 4481 4442 4482 // Half-pel refinement … … 4469 4509 const UInt cuHeightPixels = pcCU->getHeight( 0 ); 4470 4510 const Int numValidComponents = pcCU->getPic()->getNumberValidComponents(); 4511 #if !SVC_EXTENSION 4512 const TComSPS &sps=*(pcCU->getSlice()->getSPS()); 4513 #endif 4471 4514 4472 4515 // The pcCU is not marked as skip-mode at this point, and its m_pcTrCoeff, m_pcArlCoeff, m_puhCbf, m_puhTrIdx will all be 0. … … 4487 4530 const UInt csx=pcYuvOrg->getComponentScaleX(compID); 4488 4531 const UInt csy=pcYuvOrg->getComponentScaleY(compID); 4489 distortion += m_pcRdCost->getDistPart( g_bitDepth[toChannelType(compID)], pcYuvRec->getAddr(compID), pcYuvRec->getStride(compID), pcYuvOrg->getAddr(compID), 4532 #if SVC_EXTENSION 4533 distortion += m_pcRdCost->getDistPart( pcCU->getSlice()->getBitDepth(toChannelType(compID)), pcYuvRec->getAddr(compID), pcYuvRec->getStride(compID), pcYuvOrg->getAddr(compID), 4534 #else 4535 distortion += m_pcRdCost->getDistPart( sps.getBitDepth(toChannelType(compID)), pcYuvRec->getAddr(compID), pcYuvRec->getStride(compID), pcYuvOrg->getAddr(compID), 4536 #endif 4490 4537 pcYuvOrg->getStride(compID), cuWidthPixels >> csx, cuHeightPixels >> csy, compID); 4491 4538 } … … 4587 4634 m_pcRDGoOnSbacCoder->store( m_pppcRDSbacCoder[ pcCU->getDepth( 0 ) ][ CI_TEMP_BEST ] ); 4588 4635 4589 pcYuvRec->addClip ( pcYuvPred, pcYuvResiBest, 0, cuWidthPixels ); 4636 #if SVC_EXTENSION 4637 pcYuvRec->addClip ( pcYuvPred, pcYuvResiBest, 0, cuWidthPixels, pcCU->getSlice()->getBitDepths() ); 4638 #else 4639 pcYuvRec->addClip ( pcYuvPred, pcYuvResiBest, 0, cuWidthPixels, sps.getBitDepths() ); 4640 #endif 4590 4641 4591 4642 // update with clipped distortion and cost (previously unclipped reconstruction values were used) … … 4595 4646 { 4596 4647 const ComponentID compID=ComponentID(comp); 4597 finalDistortion += m_pcRdCost->getDistPart( g_bitDepth[toChannelType(compID)], pcYuvRec->getAddr(compID ), pcYuvRec->getStride(compID ), pcYuvOrg->getAddr(compID ), pcYuvOrg->getStride(compID), cuWidthPixels >> pcYuvOrg->getComponentScaleX(compID), cuHeightPixels >> pcYuvOrg->getComponentScaleY(compID), compID); 4648 #if SVC_EXTENSION 4649 finalDistortion += m_pcRdCost->getDistPart( pcCU->getSlice()->getBitDepth(toChannelType(compID)), pcYuvRec->getAddr(compID ), pcYuvRec->getStride(compID ), pcYuvOrg->getAddr(compID ), pcYuvOrg->getStride(compID), cuWidthPixels >> pcYuvOrg->getComponentScaleX(compID), cuHeightPixels >> pcYuvOrg->getComponentScaleY(compID), compID); 4650 #else 4651 finalDistortion += m_pcRdCost->getDistPart( sps.getBitDepth(toChannelType(compID)), pcYuvRec->getAddr(compID ), pcYuvRec->getStride(compID ), pcYuvOrg->getAddr(compID ), pcYuvOrg->getStride(compID), cuWidthPixels >> pcYuvOrg->getComponentScaleX(compID), cuHeightPixels >> pcYuvOrg->getComponentScaleY(compID), compID); 4652 #endif 4598 4653 } 4599 4654 … … 4685 4740 checkTransformSkip[i]=false; 4686 4741 const ComponentID compID=ComponentID(i); 4742 #if SVC_EXTENSION 4743 const Int channelBitDepth=pcCU->getSlice()->getBitDepth(toChannelType(compID)); 4744 #else 4745 const Int channelBitDepth=pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)); 4746 #endif 4687 4747 pcCoeffCurr[compID] = m_ppcQTTempCoeff[compID][uiQTTempAccessLayer] + rTu.getCoefficientOffset(compID); 4688 4748 #if ADAPTIVE_QP_SELECTION … … 4841 4901 true); 4842 4902 4843 nonCoeffDist = m_pcRdCost->getDistPart( g_bitDepth[toChannelType(compID)], m_pcQTTempTComYuv[uiQTTempAccessLayer].getAddrPix( compID, tuCompRect.x0, tuCompRect.y0 ),4844 4845 4903 nonCoeffDist = m_pcRdCost->getDistPart( channelBitDepth, m_pcQTTempTComYuv[uiQTTempAccessLayer].getAddrPix( compID, tuCompRect.x0, tuCompRect.y0 ), 4904 m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride( compID ), pcResi->getAddrPix( compID, tuCompRect.x0, tuCompRect.y0 ), 4905 pcResi->getStride(compID), tuCompRect.width, tuCompRect.height, compID); // initialized with zero residual destortion 4846 4906 } 4847 4907 else 4848 4908 { 4849 nonCoeffDist = m_pcRdCost->getDistPart( g_bitDepth[toChannelType(compID)], m_pTempPel, tuCompRect.width, pcResi->getAddrPix( compID, tuCompRect.x0, tuCompRect.y0 ),4850 4909 nonCoeffDist = m_pcRdCost->getDistPart( channelBitDepth, m_pTempPel, tuCompRect.width, pcResi->getAddrPix( compID, tuCompRect.x0, tuCompRect.y0 ), 4910 pcResi->getStride(compID), tuCompRect.width, tuCompRect.height, compID); // initialized with zero residual destortion 4851 4911 } 4852 4912 … … 4906 4966 } 4907 4967 4908 currCompDist = m_pcRdCost->getDistPart( g_bitDepth[toChannelType(compID)], m_pcQTTempTComYuv[uiQTTempAccessLayer].getAddrPix( compID, tuCompRect.x0, tuCompRect.y0 ),4968 currCompDist = m_pcRdCost->getDistPart( channelBitDepth, m_pcQTTempTComYuv[uiQTTempAccessLayer].getAddrPix( compID, tuCompRect.x0, tuCompRect.y0 ), 4909 4969 m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(compID), 4910 4970 pcResi->getAddrPix( compID, tuCompRect.x0, tuCompRect.y0 ), … … 5525 5585 const ChromaFormat chFmt = m_filteredBlock[0][0].getChromaFormat(); 5526 5586 5527 m_if.filterHor(COMPONENT_Y, srcPtr, srcStride, m_filteredBlockTmp[0].getAddr(COMPONENT_Y), intStride, width+1, height+filterSize, 0, false, chFmt );5528 m_if.filterHor(COMPONENT_Y, srcPtr, srcStride, m_filteredBlockTmp[2].getAddr(COMPONENT_Y), intStride, width+1, height+filterSize, 2, false, chFmt );5587 m_if.filterHor(COMPONENT_Y, srcPtr, srcStride, m_filteredBlockTmp[0].getAddr(COMPONENT_Y), intStride, width+1, height+filterSize, 0, false, chFmt, pattern->getBitDepthY()); 5588 m_if.filterHor(COMPONENT_Y, srcPtr, srcStride, m_filteredBlockTmp[2].getAddr(COMPONENT_Y), intStride, width+1, height+filterSize, 2, false, chFmt, pattern->getBitDepthY()); 5529 5589 5530 5590 intPtr = m_filteredBlockTmp[0].getAddr(COMPONENT_Y) + halfFilterSize * intStride + 1; 5531 5591 dstPtr = m_filteredBlock[0][0].getAddr(COMPONENT_Y); 5532 m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width+0, height+0, 0, false, true, chFmt );5592 m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width+0, height+0, 0, false, true, chFmt, pattern->getBitDepthY()); 5533 5593 5534 5594 intPtr = m_filteredBlockTmp[0].getAddr(COMPONENT_Y) + (halfFilterSize-1) * intStride + 1; 5535 5595 dstPtr = m_filteredBlock[2][0].getAddr(COMPONENT_Y); 5536 m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width+0, height+1, 2, false, true, chFmt );5596 m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width+0, height+1, 2, false, true, chFmt, pattern->getBitDepthY()); 5537 5597 5538 5598 intPtr = m_filteredBlockTmp[2].getAddr(COMPONENT_Y) + halfFilterSize * intStride; 5539 5599 dstPtr = m_filteredBlock[0][2].getAddr(COMPONENT_Y); 5540 m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width+1, height+0, 0, false, true, chFmt );5600 m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width+1, height+0, 0, false, true, chFmt, pattern->getBitDepthY()); 5541 5601 5542 5602 intPtr = m_filteredBlockTmp[2].getAddr(COMPONENT_Y) + (halfFilterSize-1) * intStride; 5543 5603 dstPtr = m_filteredBlock[2][2].getAddr(COMPONENT_Y); 5544 m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width+1, height+1, 2, false, true, chFmt );5604 m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width+1, height+1, 2, false, true, chFmt, pattern->getBitDepthY()); 5545 5605 } 5546 5606 … … 5586 5646 srcPtr += 1; 5587 5647 } 5588 m_if.filterHor(COMPONENT_Y, srcPtr, srcStride, intPtr, intStride, width, extHeight, 1, false, chFmt );5648 m_if.filterHor(COMPONENT_Y, srcPtr, srcStride, intPtr, intStride, width, extHeight, 1, false, chFmt, pattern->getBitDepthY()); 5589 5649 5590 5650 // Horizontal filter 3/4 … … 5599 5659 srcPtr += 1; 5600 5660 } 5601 m_if.filterHor(COMPONENT_Y, srcPtr, srcStride, intPtr, intStride, width, extHeight, 3, false, chFmt );5661 m_if.filterHor(COMPONENT_Y, srcPtr, srcStride, intPtr, intStride, width, extHeight, 3, false, chFmt, pattern->getBitDepthY()); 5602 5662 5603 5663 // Generate @ 1,1 … … 5608 5668 intPtr += intStride; 5609 5669 } 5610 m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width, height, 1, false, true, chFmt );5670 m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width, height, 1, false, true, chFmt, pattern->getBitDepthY()); 5611 5671 5612 5672 // Generate @ 3,1 5613 5673 intPtr = m_filteredBlockTmp[1].getAddr(COMPONENT_Y) + (halfFilterSize-1) * intStride; 5614 5674 dstPtr = m_filteredBlock[3][1].getAddr(COMPONENT_Y); 5615 m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width, height, 3, false, true, chFmt );5675 m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width, height, 3, false, true, chFmt, pattern->getBitDepthY()); 5616 5676 5617 5677 if (halfPelRef.getVer() != 0) … … 5624 5684 intPtr += intStride; 5625 5685 } 5626 m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width, height, 2, false, true, chFmt );5686 m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width, height, 2, false, true, chFmt, pattern->getBitDepthY()); 5627 5687 5628 5688 // Generate @ 2,3 … … 5633 5693 intPtr += intStride; 5634 5694 } 5635 m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width, height, 2, false, true, chFmt );5695 m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width, height, 2, false, true, chFmt, pattern->getBitDepthY()); 5636 5696 } 5637 5697 else … … 5640 5700 intPtr = m_filteredBlockTmp[1].getAddr(COMPONENT_Y) + halfFilterSize * intStride; 5641 5701 dstPtr = m_filteredBlock[0][1].getAddr(COMPONENT_Y); 5642 m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width, height, 0, false, true, chFmt );5702 m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width, height, 0, false, true, chFmt, pattern->getBitDepthY()); 5643 5703 5644 5704 // Generate @ 0,3 5645 5705 intPtr = m_filteredBlockTmp[3].getAddr(COMPONENT_Y) + halfFilterSize * intStride; 5646 5706 dstPtr = m_filteredBlock[0][3].getAddr(COMPONENT_Y); 5647 m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width, height, 0, false, true, chFmt );5707 m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width, height, 0, false, true, chFmt, pattern->getBitDepthY()); 5648 5708 } 5649 5709 … … 5661 5721 intPtr += intStride; 5662 5722 } 5663 m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width, height, 1, false, true, chFmt );5723 m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width, height, 1, false, true, chFmt, pattern->getBitDepthY()); 5664 5724 5665 5725 // Generate @ 3,2 … … 5674 5734 intPtr += intStride; 5675 5735 } 5676 m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width, height, 3, false, true, chFmt );5736 m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width, height, 3, false, true, chFmt, pattern->getBitDepthY()); 5677 5737 } 5678 5738 else … … 5685 5745 intPtr += intStride; 5686 5746 } 5687 m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width, height, 1, false, true, chFmt );5747 m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width, height, 1, false, true, chFmt, pattern->getBitDepthY()); 5688 5748 5689 5749 // Generate @ 3,0 … … 5694 5754 intPtr += intStride; 5695 5755 } 5696 m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width, height, 3, false, true, chFmt );5756 m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width, height, 3, false, true, chFmt, pattern->getBitDepthY()); 5697 5757 } 5698 5758 … … 5704 5764 intPtr += intStride; 5705 5765 } 5706 m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width, height, 1, false, true, chFmt );5766 m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width, height, 1, false, true, chFmt, pattern->getBitDepthY()); 5707 5767 5708 5768 // Generate @ 3,3 5709 5769 intPtr = m_filteredBlockTmp[3].getAddr(COMPONENT_Y) + (halfFilterSize-1) * intStride; 5710 5770 dstPtr = m_filteredBlock[3][3].getAddr(COMPONENT_Y); 5711 m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width, height, 3, false, true, chFmt );5771 m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width, height, 3, false, true, chFmt, pattern->getBitDepthY()); 5712 5772 } 5713 5773 -
branches/SHM-dev/source/Lib/TLibEncoder/TEncSlice.cpp
r1260 r1287 171 171 172 172 // store lambda 173 m_pcRdCost ->setLambda( dLambda ); 173 #if SVC_EXTENSION 174 m_pcRdCost ->setLambda( dLambda, slice->getBitDepths() ); 175 #else 176 m_pcRdCost ->setLambda( dLambda, slice->getSPS()->getBitDepths() ); 177 #endif 174 178 175 179 // for RDO … … 187 191 { 188 192 dLambdas[0] = dLambda * 1.1; 189 m_pcRdCost->setLambda( dLambdas[0] );193 m_pcRdCost->setLambda( dLambdas[0], slice->getBitDepths() ); 190 194 191 195 m_pcRdCost->setDistortionWeight(compID, tmpWeight * 1.15); … … 227 231 \param iGOPid POC offset for hierarchical structure 228 232 \param rpcSlice slice header class 229 \param pSPS SPS associated with the slice230 \param pPPS PPS associated with the slice231 233 \param isField true for field coding 232 234 */ 233 #if SVC_EXTENSION 235 234 236 Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, Bool isField ) 235 #else236 Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, const TComSPS* pSPS, const TComPPS *pPPS, Bool isField )237 #endif238 237 { 239 238 Double dQP; … … 351 350 { 352 351 #if SVC_EXTENSION 353 if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getQpBDOffset Y() ) && (rpcSlice->getPPS()->getTransquantBypassEnableFlag())))352 if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getQpBDOffset(CHANNEL_TYPE_LUMA) ) && (rpcSlice->getPPS()->getTransquantBypassEnableFlag()))) 354 353 #else 355 354 if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA) ) && (rpcSlice->getPPS()->getTransquantBypassEnableFlag()))) … … 393 392 394 393 #if FULL_NBIT 395 Int bitdepth_luma_qp_scale = 6 * (g_bitDepth[CHANNEL_TYPE_LUMA] - 8); 394 #if SVC_EXTENSION 395 Int bitdepth_luma_qp_scale = 6 * (rpcSlice->getBitDepth(CHANNEL_TYPE_LUMA) - 8); 396 #else 397 Int bitdepth_luma_qp_scale = 6 * (rpcSlice->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) - 8); 398 #endif 396 399 #else 397 400 Int bitdepth_luma_qp_scale = 0; … … 425 428 426 429 #if SVC_EXTENSION 427 iQP = max( -rpcSlice->getQpBDOffset Y(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );428 #else 429 iQP = max( - pSPS->getQpBDOffset(CHANNEL_TYPE_LUMA), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );430 iQP = max( -rpcSlice->getQpBDOffset(CHANNEL_TYPE_LUMA), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) ); 431 #else 432 iQP = max( -rpcSlice->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) ); 430 433 #endif 431 434 … … 486 489 dQP = xGetQPValueAccordingToLambda( dLambda ); 487 490 #if SVC_EXTENSION 488 iQP = max( -rpcSlice->getQpBDOffset Y(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );489 #else 490 iQP = max( - pSPS->getQpBDOffset(CHANNEL_TYPE_LUMA), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );491 iQP = max( -rpcSlice->getQpBDOffset(CHANNEL_TYPE_LUMA), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) ); 492 #else 493 iQP = max( -rpcSlice->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) ); 491 494 #endif 492 495 } … … 499 502 rpcSlice->setSliceChromaQpDelta( COMPONENT_Cb, 0 ); 500 503 rpcSlice->setSliceChromaQpDelta( COMPONENT_Cr, 0 ); 501 rpcSlice->setUseChromaQpAdj( pPPS->getChromaQpAdjTableSize() > 0 );504 rpcSlice->setUseChromaQpAdj( rpcSlice->getPPS()->getChromaQpAdjTableSize() > 0 ); 502 505 rpcSlice->setNumRefIdx(REF_PIC_LIST_0,m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive); 503 506 rpcSlice->setNumRefIdx(REF_PIC_LIST_1,m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive); … … 644 647 Double dFrameLambda; 645 648 #if FULL_NBIT 646 Int SHIFT_QP = 12 + 6 * (g_bitDepth[CHANNEL_TYPE_LUMA] - 8); 649 #if SVC_EXTENSION 650 Int SHIFT_QP = 12 + 6 * (pcSlice->getBitDepth(CHANNEL_TYPE_LUMA) - 8); 651 #else 652 Int SHIFT_QP = 12 + 6 * (pcSlice->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) - 8); 653 #endif 647 654 #else 648 655 Int SHIFT_QP = 12; … … 706 713 Void TEncSlice::calCostSliceI(TComPic* pcPic) 707 714 { 708 UInt ctuRsAddr; 709 UInt startCtuTsAddr; 710 UInt boundingCtuTsAddr; 711 Int iSumHad, shift = g_bitDepth[CHANNEL_TYPE_LUMA]-8, offset = (shift>0)?(1<<(shift-1)):0;; 712 Double iSumHadSlice = 0; 713 714 pcPic->getSlice(getSliceIdx())->setSliceSegmentBits(0); 715 TComSlice* pcSlice = pcPic->getSlice(getSliceIdx()); 715 Double iSumHadSlice = 0; 716 TComSlice * const pcSlice = pcPic->getSlice(getSliceIdx()); 717 const TComSPS &sps = *(pcSlice->getSPS()); 718 #if SVC_EXTENSION 719 const Int shift = pcSlice->getBitDepth(CHANNEL_TYPE_LUMA)-8; 720 #else 721 const Int shift = sps.getBitDepth(CHANNEL_TYPE_LUMA)-8; 722 #endif 723 const Int offset = (shift>0)?(1<<(shift-1)):0; 724 725 pcSlice->setSliceSegmentBits(0); 726 727 UInt startCtuTsAddr, boundingCtuTsAddr; 716 728 xDetermineStartAndBoundingCtuTsAddr ( startCtuTsAddr, boundingCtuTsAddr, pcPic, false ); 717 729 718 UInt ctuTsAddr;719 ctuRsAddr = pcPic->getPicSym()->getCtuTsToRsAddrMap( startCtuTsAddr);720 for( ctuTsAddr = startCtuTsAddr; ctuTsAddr < boundingCtuTsAddr;ctuRsAddr = pcPic->getPicSym()->getCtuTsToRsAddrMap(++ctuTsAddr) )730 for( UInt ctuTsAddr = startCtuTsAddr, ctuRsAddr = pcPic->getPicSym()->getCtuTsToRsAddrMap( startCtuTsAddr); 731 ctuTsAddr < boundingCtuTsAddr; 732 ctuRsAddr = pcPic->getPicSym()->getCtuTsToRsAddrMap(++ctuTsAddr) ) 721 733 { 722 734 // initialize CU encoder … … 725 737 726 738 #if SVC_EXTENSION 727 Int height = min( pcSlice->getSPS()->getMaxCUHeight(),pcSlice->getPicHeightInLumaSamples() - ctuRsAddr / pcPic->getFrameWidthInCtus() * pcSlice->getSPS()->getMaxCUHeight() );728 Int width = min( pcSlice->getSPS()->getMaxCUWidth(),pcSlice->getPicWidthInLumaSamples() - ctuRsAddr % pcPic->getFrameWidthInCtus() * pcSlice->getSPS()->getMaxCUWidth() );729 #else 730 Int height = min( pcSlice->getSPS()->getMaxCUHeight(),pcSlice->getSPS()->getPicHeightInLumaSamples() - ctuRsAddr / pcPic->getFrameWidthInCtus() * pcSlice->getSPS()->getMaxCUHeight() );731 Int width = min( pcSlice->getSPS()->getMaxCUWidth(),pcSlice->getSPS()->getPicWidthInLumaSamples() - ctuRsAddr % pcPic->getFrameWidthInCtus() * pcSlice->getSPS()->getMaxCUWidth() );732 #endif 733 734 iSumHad = m_pcCuEncoder->updateCtuDataISlice(pCtu, width, height);739 Int height = min( sps.getMaxCUHeight(),pcSlice->getPicHeightInLumaSamples() - ctuRsAddr / pcPic->getFrameWidthInCtus() * sps.getMaxCUHeight() ); 740 Int width = min( sps.getMaxCUWidth(),pcSlice->getPicWidthInLumaSamples() - ctuRsAddr % pcPic->getFrameWidthInCtus() * sps.getMaxCUWidth() ); 741 #else 742 Int height = min( sps.getMaxCUHeight(),sps.getPicHeightInLumaSamples() - ctuRsAddr / pcPic->getFrameWidthInCtus() * sps.getMaxCUHeight() ); 743 Int width = min( sps.getMaxCUWidth(), sps.getPicWidthInLumaSamples() - ctuRsAddr % pcPic->getFrameWidthInCtus() * sps.getMaxCUWidth() ); 744 #endif 745 746 Int iSumHad = m_pcCuEncoder->updateCtuDataISlice(pCtu, width, height); 735 747 736 748 (m_pcRateCtrl->getRCPic()->getLCU(ctuRsAddr)).m_costIntra=(iSumHad+offset)>>shift; … … 901 913 902 914 #if SVC_EXTENSION 903 estQP = Clip3( -pcSlice->getQpBDOffsetY(), MAX_QP, estQP ); 915 estQP = Clip3( -pcSlice->getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, estQP ); 916 917 m_pcRdCost->setLambda(estLambda, pcSlice->getBitDepths()); 904 918 #else 905 919 estQP = Clip3( -pcSlice->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, estQP ); 906 #endif 907 908 m_pcRdCost->setLambda(estLambda); 920 921 m_pcRdCost->setLambda(estLambda, pcSlice->getSPS()->getBitDepths()); 922 #endif 909 923 910 924 #if RDOQ_CHROMA_LAMBDA … … 1000 1014 actualQP = pCtu->getQP( 0 ); 1001 1015 } 1002 m_pcRdCost->setLambda(oldLambda); 1016 #if SVC_EXTENSION 1017 m_pcRdCost->setLambda(oldLambda, pcSlice->getBitDepths()); 1018 #else 1019 m_pcRdCost->setLambda(oldLambda, pcSlice->getSPS()->getBitDepths()); 1020 #endif 1003 1021 m_pcRateCtrl->getRCPic()->updateAfterCTU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, 1004 1022 pCtu->getSlice()->getSliceType() == I_SLICE ? 0 : m_pcCfg->getLCULevelRC() ); … … 1158 1176 1159 1177 #if SVC_EXTENSION 1160 m_pcEntropyCoder->encodeSAOBlkParam(saoblkParam, m_ppcTEncTop[pcSlice->getLayerIdx()]->getSAO()->getSaoMaxOffsetQVal(), sliceEnabled, leftMergeAvail, aboveMergeAvail);1161 #else 1162 m_pcEntropyCoder->encodeSAOBlkParam(saoblkParam, sliceEnabled, leftMergeAvail, aboveMergeAvail);1178 m_pcEntropyCoder->encodeSAOBlkParam(saoblkParam, pcPic->getPicSym()->getSlice(0)->getBitDepths(), sliceEnabled, leftMergeAvail, aboveMergeAvail); 1179 #else 1180 m_pcEntropyCoder->encodeSAOBlkParam(saoblkParam, pcPic->getPicSym()->getSPS().getBitDepths(), sliceEnabled, leftMergeAvail, aboveMergeAvail); 1163 1181 #endif 1164 1182 } … … 1364 1382 { 1365 1383 xCalcACDCParamSlice(pcSlice); 1366 WPACDCParam * temp_weightACDCParam;1367 1368 pcSlice->getWpAcDcParam(temp_weightACDCParam);1369 g_refWeightACDCParam = (void *) temp_weightACDCParam;1370 1384 } 1371 1385 #endif //SVC_EXTENSION -
branches/SHM-dev/source/Lib/TLibEncoder/TEncSlice.h
r1259 r1287 120 120 121 121 /// preparation of slice encoding (reference marking, QP and lambda) 122 #if SVC_EXTENSION123 Void initEncSlice ( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, Bool isField );124 Void estimateILWpParam ( TComSlice* pcSlice );125 #else126 122 Void initEncSlice ( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, 127 Int iGOPid, TComSlice*& rpcSlice, const TComSPS* pSPS, const TComPPS *pPPS, Bool isField ); 128 #endif 129 123 Int iGOPid, TComSlice*& rpcSlice, Bool isField ); 130 124 Void resetQP ( TComPic* pic, Int sliceQP, Double lambda ); 131 125 // compress and encode slice … … 145 139 SliceType getEncCABACTableIdx() const { return m_encCABACTableIdx; } 146 140 141 #if SVC_EXTENSION 142 Void estimateILWpParam ( TComSlice* pcSlice ); 143 #endif 144 147 145 private: 148 146 Double xGetQPValueAccordingToLambda ( Double lambda ); -
branches/SHM-dev/source/Lib/TLibEncoder/TEncTop.cpp
r1285 r1287 283 283 { 284 284 #if SVC_EXTENSION 285 getTrQuant()->setFlatScalingList( m_cVPS.getChromaFormatIdc(&m_cSPS, m_layerId), maxLog2TrDynamicRange);285 getTrQuant()->setFlatScalingList( m_cVPS.getChromaFormatIdc(&m_cSPS, m_layerId), maxLog2TrDynamicRange, m_cVPS.getBitDepths(&m_cSPS, m_layerId) ); 286 286 #else 287 getTrQuant()->setFlatScalingList(m_cSPS.getChromaFormatIdc(), maxLog2TrDynamicRange );287 getTrQuant()->setFlatScalingList(m_cSPS.getChromaFormatIdc(), maxLog2TrDynamicRange, m_cSPS.getBitDepths()); 288 288 #endif 289 289 getTrQuant()->setUseScalingList(false); … … 305 305 306 306 // infer the scaling list from the reference layer 307 getTrQuant()->setScalingList( &m_ppcTEncTop[m_cVPS.getLayerIdxInVps(refLayerId)]->getSPS()->getScalingList(), m_cSPS.getChromaFormatIdc(), maxLog2TrDynamicRange );307 getTrQuant()->setScalingList( &m_ppcTEncTop[m_cVPS.getLayerIdxInVps(refLayerId)]->getSPS()->getScalingList(), m_cSPS.getChromaFormatIdc(), maxLog2TrDynamicRange, m_cVPS.getBitDepths(&m_cSPS, m_layerId) ); 308 308 } 309 309 else … … 314 314 m_cPPS.setScalingListPresentFlag(false); 315 315 316 getTrQuant()->setScalingList(&(m_cSPS.getScalingList()), m_cSPS.getChromaFormatIdc(), maxLog2TrDynamicRange );316 getTrQuant()->setScalingList(&(m_cSPS.getScalingList()), m_cSPS.getChromaFormatIdc(), maxLog2TrDynamicRange, m_cSPS.getBitDepths()); 317 317 #if SVC_EXTENSION 318 318 } … … 334 334 335 335 // infer the scaling list from the reference layer 336 getTrQuant()->setScalingList( &m_ppcTEncTop[m_cVPS.getLayerIdxInVps(refLayerId)]->getSPS()->getScalingList(), m_cSPS.getChromaFormatIdc(), maxLog2TrDynamicRange );336 getTrQuant()->setScalingList( &m_ppcTEncTop[m_cVPS.getLayerIdxInVps(refLayerId)]->getSPS()->getScalingList(), m_cSPS.getChromaFormatIdc(), maxLog2TrDynamicRange, m_cVPS.getBitDepths(&m_cSPS, m_layerId) ); 337 337 } 338 338 else … … 349 349 m_cSPS.setScalingListPresentFlag(m_cSPS.getScalingList().checkDefaultScalingList()); 350 350 m_cPPS.setScalingListPresentFlag(false); 351 getTrQuant()->setScalingList(&(m_cSPS.getScalingList()), m_cSPS.getChromaFormatIdc(), maxLog2TrDynamicRange );351 getTrQuant()->setScalingList(&(m_cSPS.getScalingList()), m_cSPS.getChromaFormatIdc(), maxLog2TrDynamicRange, m_cSPS.getBitDepths()); 352 352 #if SVC_EXTENSION 353 353 } … … 720 720 721 721 UInt refLayerId = m_cVPS.getRefLayerId(m_layerId, i); 722 Bool sameBitDepths = ( g_bitDepthLayer[CHANNEL_TYPE_LUMA][m_layerId] == g_bitDepthLayer[CHANNEL_TYPE_LUMA][refLayerId] ) && ( g_bitDepthLayer[CHANNEL_TYPE_CHROMA][m_layerId] == g_bitDepthLayer[CHANNEL_TYPE_CHROMA][refLayerId] ); 722 723 const Int bitDepthLuma = m_cVPS.getBitDepth(CHANNEL_TYPE_LUMA, &m_cSPS, m_layerId); 724 const Int bitDepthChroma = m_cVPS.getBitDepth(CHANNEL_TYPE_CHROMA, &m_cSPS, m_layerId); 725 const Int refBitDepthLuma = m_cVPS.getBitDepth(CHANNEL_TYPE_LUMA, pcEncTopBase->getSPS(), refLayerId); 726 const Int refBitDepthChroma = m_cVPS.getBitDepth(CHANNEL_TYPE_CHROMA, pcEncTopBase->getSPS(), refLayerId); 727 728 Bool sameBitDepths = ( bitDepthLuma == refBitDepthLuma ) && ( bitDepthChroma == refBitDepthChroma ); 723 729 724 730 if( m_iSourceWidth == pcEncTopBase->getSourceWidth() && m_iSourceHeight == pcEncTopBase->getSourceHeight() && equalOffsets && zeroPhase ) … … 767 773 768 774 UInt refLayerId = m_cVPS.getRefLayerId(m_layerId, i); 769 Bool sameBitDepths = ( g_bitDepthLayer[CHANNEL_TYPE_LUMA][m_layerId] == g_bitDepthLayer[CHANNEL_TYPE_LUMA][refLayerId] ) && ( g_bitDepthLayer[CHANNEL_TYPE_CHROMA][m_layerId] == g_bitDepthLayer[CHANNEL_TYPE_CHROMA][refLayerId] ); 775 776 const Int bitDepthLuma = m_cVPS.getBitDepth(CHANNEL_TYPE_LUMA, &m_cSPS, m_layerId); 777 const Int bitDepthChroma = m_cVPS.getBitDepth(CHANNEL_TYPE_CHROMA, &m_cSPS, m_layerId); 778 const Int refBitDepthLuma = m_cVPS.getBitDepth(CHANNEL_TYPE_LUMA, pcEncTopBase->getSPS(), refLayerId); 779 const Int refBitDepthChroma = m_cVPS.getBitDepth(CHANNEL_TYPE_CHROMA, pcEncTopBase->getSPS(), refLayerId); 780 781 Bool sameBitDepths = ( bitDepthLuma == refBitDepthLuma ) && ( bitDepthChroma == refBitDepthChroma ); 770 782 771 783 if( m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() || !sameBitDepths … … 858 870 profileTierLevel.setLowerBitRateConstraintFlag(m_lowerBitRateConstraintFlag); 859 871 860 if ((m_profile == Profile::MAIN10) && ( g_bitDepth[CHANNEL_TYPE_LUMA] == 8) && (g_bitDepth[CHANNEL_TYPE_CHROMA] == 8))872 if ((m_profile == Profile::MAIN10) && (m_bitDepth[CHANNEL_TYPE_LUMA] == 8) && (m_bitDepth[CHANNEL_TYPE_CHROMA] == 8)) 861 873 { 862 874 /* The above constraint is equal to Profile::MAIN */ … … 914 926 m_cSPS.setBitDepth (ChannelType(channelType), m_cVPS.getVpsRepFormat( m_cVPS.getVpsRepFormatIdx( m_cVPS.getLayerIdxInVps( m_layerId ) ) )->getBitDepthVps(ChannelType(channelType)) ); 915 927 m_cSPS.setQpBDOffset (ChannelType(channelType), (6 * (m_cVPS.getVpsRepFormat( m_cVPS.getVpsRepFormatIdx( m_cVPS.getLayerIdxInVps( m_layerId ) ) )->getBitDepthVps(ChannelType(channelType)) - 8))); 928 #if O0043_BEST_EFFORT_DECODING 929 m_cSPS.setStreamBitDepth(ChannelType(channelType), m_cVPS.getVpsRepFormat( m_cVPS.getVpsRepFormatIdx( m_cVPS.getLayerIdxInVps( m_layerId ) ) )->getBitDepthVps(ChannelType(channelType)) ); 930 #endif 916 931 #else 917 m_cSPS.setBitDepth (ChannelType(channelType), g_bitDepth[channelType] ); 918 m_cSPS.setQpBDOffset (ChannelType(channelType), (6 * (g_bitDepth[channelType] - 8))); 932 #if O0043_BEST_EFFORT_DECODING 933 m_cSPS.setStreamBitDepth(ChannelType(channelType), m_bitDepth[channelType] ); 934 #endif 935 m_cSPS.setQpBDOffset (ChannelType(channelType), (6 * (m_bitDepth[channelType] - 8))); 919 936 #endif 920 937 m_cSPS.setPCMBitDepth (ChannelType(channelType), m_PCMBitDepth[channelType] ); … … 940 957 for (Int i = 0; i < min(m_cSPS.getMaxTLayers(),(UInt) MAX_TLAYER); i++ ) 941 958 { 942 #if SVC_EXTENSION943 assert(i < MAX_TLAYER);944 #endif945 959 m_cSPS.setMaxDecPicBuffering(m_maxDecPicBuffering[i], i); 946 960 m_cSPS.setNumReorderPics(m_numReorderPics[i], i); … … 1487 1501 { 1488 1502 RepFormat *repFormat = m_cVPS.getVpsRepFormat( m_cSPS.getUpdateRepFormatFlag() ? m_cSPS.getUpdateRepFormatIndex() : m_cVPS.getVpsRepFormatIdx( m_cVPS.getLayerIdxInVps(m_layerId) ) ); 1489 Int bitDepthY,bitDepthC;1490 1491 bitDepthY = repFormat->getBitDepthVpsLuma();1492 bitDepthC = repFormat->getBitDepthVpsChroma();1493 1503 1494 1504 if( m_layerId > 0 ) 1495 1505 { 1496 g_bitDepth[CHANNEL_TYPE_LUMA] = bitDepthY;1497 g_bitDepth[CHANNEL_TYPE_CHROMA] = bitDepthC;1498 1506 g_uiMaxCUWidth = m_cSPS.getMaxCUWidth(); 1499 1507 g_uiMaxCUHeight = m_cSPS.getMaxCUHeight(); -
branches/SHM-dev/source/Lib/TLibEncoder/TEncTop.h
r1259 r1287 116 116 static Int m_iPPSIdCnt; ///< next Id number for PPS 117 117 TEncTop** m_ppcTEncTop; 118 TEncTop* getLayerEnc(UInt layerIdx) 118 TEncTop* getLayerEnc(UInt layerIdx) { return m_ppcTEncTop[layerIdx]; } 119 119 TComPic* m_cIlpPic[MAX_NUM_REF]; ///< Inter layer Prediction picture = upsampled picture 120 120 Bool m_bMFMEnabledFlag; … … 276 276 std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded, Bool isTff); 277 277 278 Void printSummary(Bool isField) { m_cGOPEncoder.printOutSummary (m_uiNumAllPicCoded, isField, m_printMSEBasedSequencePSNR, m_printSequenceMSE ); }278 Void printSummary(Bool isField) { m_cGOPEncoder.printOutSummary (m_uiNumAllPicCoded, isField, m_printMSEBasedSequencePSNR, m_printSequenceMSE, m_cSPS.getBitDepths()); } 279 279 #endif //#if SVC_EXTENSION 280 280 }; -
branches/SHM-dev/source/Lib/TLibEncoder/WeightPredAnalysis.cpp
r1260 r1287 215 215 for ( Int refIdxTemp = 0; refIdxTemp < slice->getNumRefIdx(eRefPicList); refIdxTemp++ ) 216 216 { 217 WPACDCParam *currWeightACDCParam, *refWeightACDCParam; 218 slice->getWpAcDcParam(currWeightACDCParam); 219 slice->getRefPic(eRefPicList, refIdxTemp)->getSlice(0)->getWpAcDcParam(refWeightACDCParam); 217 WPACDCParam *currWeightACDCParam = slice->getWpAcDcParam(); 218 WPACDCParam *refWeightACDCParam = slice->getRefPic(eRefPicList, refIdxTemp)->getSlice(0)->getWpAcDcParam(); 220 219 221 220 #if SVC_EXTENSION … … 226 225 if( validILRPic ) 227 226 { 228 refWeightACDCParam = (WPACDCParam *)g_refWeightACDCParam;227 refWeightACDCParam = slice->getWpAcDcParam(); 229 228 } 230 229 #endif … … 233 232 { 234 233 const ComponentID compID = ComponentID(comp); 235 const Int range = bUseHighPrecisionWeighting ? (1<<g_bitDepth[toChannelType(compID)])/2 : 128; 236 const Int realLog2Denom = log2Denom + (bUseHighPrecisionWeighting ? RExt__PREDICTION_WEIGHTING_ANALYSIS_DC_PRECISION : (g_bitDepth[toChannelType(compID)] - 8)); 234 #if SVC_EXTENSION 235 const Int bitDepth = slice->getBitDepth(toChannelType(compID)); 236 #else 237 const Int bitDepth = slice->getSPS()->getBitDepth(toChannelType(compID)); 238 #endif 239 const Int range = bUseHighPrecisionWeighting ? (1<<bitDepth)/2 : 128; 240 const Int realLog2Denom = log2Denom + (bUseHighPrecisionWeighting ? RExt__PREDICTION_WEIGHTING_ANALYSIS_DC_PRECISION : (bitDepth - 8)); 237 241 const Int realOffset = ((Int)1<<(realLog2Denom-1)); 238 242 … … 249 253 refAC = ( refAC * currWeightACDCParam[comp].iSamples ) /refWeightACDCParam[comp].iSamples; 250 254 255 const Int bitDepthLuma = slice->getBitDepth(CHANNEL_TYPE_LUMA); 256 const Int refBitDepthLuma = slice->getRefPic(eRefPicList, refIdxTemp)->getSlice(0)->getBitDepth(CHANNEL_TYPE_LUMA); 257 const Int delta = bitDepthLuma - refBitDepthLuma; 258 251 259 // jonint upsampling bitshift 252 refAC <<= (g_bitDepthLayer[CHANNEL_TYPE_LUMA][currLayerId] - g_bitDepthLayer[CHANNEL_TYPE_LUMA][refLayerId]);253 refDC <<= (g_bitDepthLayer[CHANNEL_TYPE_LUMA][currLayerId] - g_bitDepthLayer[CHANNEL_TYPE_LUMA][refLayerId]);260 refAC <<= delta; 261 refDC <<= delta; 254 262 } 255 263 #else … … 345 353 const Int iWidth = pPic->getWidth(compID); 346 354 const Int iHeight = pPic->getHeight(compID); 347 const Int bitDepth = g_bitDepth[toChannelType(compID)]; 355 #if SVC_EXTENSION 356 const Int bitDepth = slice->getBitDepth(toChannelType(compID)); 357 #else 358 const Int bitDepth = slice->getSPS()->getBitDepth(toChannelType(compID)); 359 #endif 348 360 349 361 // calculate SAD costs with/without wp for luma
Note: See TracChangeset for help on using the changeset viewer.