Changeset 1287 in SHVCSoftware for branches/SHM-dev/source/Lib/TLibEncoder
- Timestamp:
- 17 Jul 2015, 05:43:37 (10 years ago)
- Location:
- branches/SHM-dev/source/Lib/TLibEncoder
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
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.