Changeset 1287 in SHVCSoftware for branches/SHM-dev/source/Lib/TLibEncoder


Ignore:
Timestamp:
17 Jul 2015, 05:43:37 (10 years ago)
Author:
seregin
Message:

port rev 4322 (g_bitDepth)

Location:
branches/SHM-dev/source/Lib/TLibEncoder
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-dev/source/Lib/TLibEncoder/SEIEncoder.cpp

    r1273 r1287  
    304304
    305305//! calculate hashes for entire reconstructed picture
    306 Void SEIEncoder::initDecodedPictureHashSEI(SEIDecodedPictureHash *decodedPictureHashSEI, TComPic *pcPic, std::string &rHashString)
     306Void SEIEncoder::initDecodedPictureHashSEI(SEIDecodedPictureHash *decodedPictureHashSEI, TComPic *pcPic, std::string &rHashString, const BitDepths &bitDepths)
    307307{
    308308  assert (m_isInitialized);
     
    313313  {
    314314    decodedPictureHashSEI->method = SEIDecodedPictureHash::MD5;
    315     UInt numChar=calcMD5(*pcPic->getPicYuvRec(), decodedPictureHashSEI->m_pictureHash);
     315    UInt numChar=calcMD5(*pcPic->getPicYuvRec(), decodedPictureHashSEI->m_pictureHash, bitDepths);
    316316    rHashString = hashToString(decodedPictureHashSEI->m_pictureHash, numChar);
    317317  }
     
    319319  {
    320320    decodedPictureHashSEI->method = SEIDecodedPictureHash::CRC;
    321     UInt numChar=calcCRC(*pcPic->getPicYuvRec(), decodedPictureHashSEI->m_pictureHash);
     321    UInt numChar=calcCRC(*pcPic->getPicYuvRec(), decodedPictureHashSEI->m_pictureHash, bitDepths);
    322322    rHashString = hashToString(decodedPictureHashSEI->m_pictureHash, numChar);
    323323  }
     
    325325  {
    326326    decodedPictureHashSEI->method = SEIDecodedPictureHash::CHECKSUM;
    327     UInt numChar=calcChecksum(*pcPic->getPicYuvRec(), decodedPictureHashSEI->m_pictureHash);
     327    UInt numChar=calcChecksum(*pcPic->getPicYuvRec(), decodedPictureHashSEI->m_pictureHash, bitDepths);
    328328    rHashString = hashToString(decodedPictureHashSEI->m_pictureHash, numChar);
    329329  }
  • branches/SHM-dev/source/Lib/TLibEncoder/SEIEncoder.h

    r1273 r1287  
    102102
    103103  // 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);
    105105  Void initTemporalLevel0IndexSEI(SEITemporalLevel0Index *sei, TComSlice *slice);
    106106
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncAnalyze.h

    r1259 r1287  
    101101
    102102
    103   Void calculateCombinedValues(const ChromaFormat chFmt, Double &PSNRyuv, Double &MSEyuv)
     103  Void calculateCombinedValues(const ChromaFormat chFmt, Double &PSNRyuv, Double &MSEyuv, const BitDepths &bitDepths)
    104104  {
    105105    MSEyuv    = 0;
    106106    Int scale = 0;
    107107
    108     Int maximumBitDepth = g_bitDepth[0];
     108    Int maximumBitDepth = bitDepths.recon[CHANNEL_TYPE_LUMA];
    109109    for (UInt channelTypeIndex = 1; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++)
    110110    {
    111       if (g_bitDepth[channelTypeIndex] > maximumBitDepth)
     111      if (bitDepths.recon[channelTypeIndex] > maximumBitDepth)
    112112      {
    113         maximumBitDepth = g_bitDepth[channelTypeIndex];
     113        maximumBitDepth = bitDepths.recon[channelTypeIndex];
    114114      }
    115115    }
     
    124124      const UInt        csy           = getComponentScaleY(compID, chFmt);
    125125      const Int         scaleChan     = (4>>(csx+csy));
    126       const UInt        bitDepthShift = 2 * (maximumBitDepth - g_bitDepth[toChannelType(compID)]); //*2 because this is a squared number
     126      const UInt        bitDepthShift = 2 * (maximumBitDepth - bitDepths.recon[toChannelType(compID)]); //*2 because this is a squared number
    127127
    128128      const Double      channelMSE    = (m_MSEyuvframe[compID] * Double(1 << bitDepthShift)) / Double(getNumPic());
     
    137137
    138138#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 )
    142142#endif
    143143  {
     
    159159        {
    160160          //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);
    162162          const Double MSE = m_MSEyuvframe[compID];
    163163
     
    261261          Double MSEyuv  = MAX_DOUBLE;
    262262         
    263           calculateCombinedValues(chFmt, PSNRyuv, MSEyuv);
     263          calculateCombinedValues(chFmt, PSNRyuv, MSEyuv, bitDepths);
    264264
    265265          if (printMSEBasedSNR)
     
    376376
    377377
    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')
    379379  {
    380380    FILE* pFile = NULL;
     
    416416          Double MSEyuv  = MAX_DOUBLE;
    417417         
    418           calculateCombinedValues(chFmt, PSNRyuv, MSEyuv);
     418          calculateCombinedValues(chFmt, PSNRyuv, MSEyuv, bitDepths);
    419419
    420420          fprintf(pFile, "%f\t %f\t %f\t %f\t %f",
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncCavlc.cpp

    r1275 r1287  
    16241624
    16251625#if SVC_EXTENSION
    1626   Int qpBdOffsetY =  pcCU->getSlice()->getQpBDOffsetY();
     1626  Int qpBdOffsetY =  pcCU->getSlice()->getQpBDOffset(CHANNEL_TYPE_LUMA);
    16271627#else
    16281628  Int qpBdOffsetY =  pcCU->getSlice()->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA);
     
    17241724              WRITE_SVLC( iDeltaWeight, iNumRef==0?"delta_chroma_weight_l0[i]":"delta_chroma_weight_l1[i]" );
    17251725
    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
    17271731              Int pred = ( range - ( ( range*wp[j].iWeight)>>(wp[j].uiLog2WeightDenom) ) );
    17281732              Int iDeltaChroma = (wp[j].iOffset - pred);
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncCavlc.h

    r1259 r1287  
    104104
    105105  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);}
    111107  Void codeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx );
    112108  Void codeSkipFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx );
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncCfg.h

    r1284 r1287  
    186186
    187187  //====== Tool list ========
     188  Int       m_bitDepth[MAX_NUM_CHANNEL_TYPE];
    188189  Bool      m_bUseASR;
    189190  Bool      m_bUseHADME;
     
    602603
    603604  //==== Tool list ========
     605  Void      setBitDepth( const ChannelType chType, Int internalBitDepthForChannel ) { m_bitDepth[chType] = internalBitDepthForChannel; }
    604606  Void      setUseASR                       ( Bool  b )     { m_bUseASR     = b; }
    605607  Void      setUseHADME                     ( Bool  b )     { m_bUseHADME   = b; }
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncCu.cpp

    r1260 r1287  
    400400    Int idQP = m_pcEncCfg->getMaxDeltaQP();
    401401#if SVC_EXTENSION
    402     iMinQP = Clip3( -rpcTempCU->getSlice()->getQpBDOffsetY(), MAX_QP, iBaseQP-idQP );
    403     iMaxQP = Clip3( -rpcTempCU->getSlice()->getQpBDOffsetY(), 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 );
    404404#else
    405405    iMinQP = Clip3( -rpcTempCU->getSlice()->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, iBaseQP-idQP );
     
    735735          && rpcTempCU->getWidth(0) >= (1<<pcPic->getSlice(0)->getSPS()->getPCMLog2MinSize()) )
    736736        {
    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
    738742          UInt uiBestBits = rpcBestCU->getTotalBits();
    739743          if((uiBestBits > uiRawBits) || (rpcBestCU->getTotalCost() > m_pcRdCost->calcRdCost(uiRawBits, 0)))
     
    799803    Int idQP = m_pcEncCfg->getMaxDeltaQP();
    800804#if SVC_EXTENSION
    801     iMinQP = Clip3( -rpcTempCU->getSlice()->getQpBDOffsetY(), MAX_QP, iBaseQP-idQP );
    802     iMaxQP = Clip3( -rpcTempCU->getSlice()->getQpBDOffsetY(), 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 );
    803807#else
    804808    iMinQP = Clip3( -rpcTempCU->getSlice()->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, iBaseQP-idQP );
     
    10271031  }
    10281032#if SVC_EXTENSION
    1029   return Clip3(-pcCU->getSlice()->getQpBDOffsetY(), MAX_QP, iBaseQp+iQpOffset );
     1033  return Clip3(-pcCU->getSlice()->getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, iBaseQp+iQpOffset );
    10301034#else
    10311035  return Clip3(-pcCU->getSlice()->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, iBaseQp+iQpOffset );
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncEntropy.h

    r1259 r1287  
    114114  virtual Void codeCoeffNxN      ( TComTU &rTu, TCoeff* pcCoef, const ComponentID compID ) = 0;
    115115  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
    116126#if SVC_EXTENSION
    117127  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
    130129};
    131130
     
    194193
    195194  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
    196200#if SVC_EXTENSION
    197201  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
    204203};// END CLASS DEFINITION TEncEntropy
    205204
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp

    r1286 r1287  
    198198    {
    199199      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() );
    204212    if(!m_pColorMappedPic)
    205213    {
     
    14831491#if SVC_EXTENSION
    14841492    pcPic->setLayerId( m_layerId );
     1493#endif
    14851494    m_pcSliceEncoder->initEncSlice ( pcPic, iPOCLast, pocCurr, iNumPicRcvd, iGOPid, pcSlice, isField );
    1486 #else
    1487     m_pcSliceEncoder->initEncSlice ( pcPic, iPOCLast, pocCurr, iNumPicRcvd, iGOPid, pcSlice, &(pcPic->getPicSym()->getSPS()), &(pcPic->getPicSym()->getPPS()), isField );
    1488 #endif
    14891495
    14901496    //Set Frame/Field coding
     
    16781684          {
    16791685            //downsampling
    1680             downScalePic(pcPic->getPicYuvOrg(), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvOrg());
     1686            downScalePic(pcPic->getPicYuvOrg(), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvOrg(), pcSlice->getBitDepths());
    16811687           
    16821688            m_Enc3DAsymLUTPPS.setDsOrigPic(pcSlice->getBaseColPic(refLayerIdc)->getPicYuvOrg());
     
    17091715          if( pcSlice->getVPS()->isSamplePredictionType( pcSlice->getVPS()->getLayerIdxInVps(m_layerId), pcSlice->getVPS()->getLayerIdxInVps(refLayerId) ) )
    17101716          {
    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) );
    17121718          }
    17131719        }
     
    23642370
    23652371#if SVC_EXTENSION
    2366       sliceQP = Clip3( -pcSlice->getQpBDOffsetY(), MAX_QP, sliceQP );
     2372      sliceQP = Clip3( -pcSlice->getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, sliceQP );
    23672373#else
    23682374      sliceQP = Clip3( -pcSlice->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, sliceQP );
     
    26682674    // cabac_zero_words processing
    26692675    {
     2676#if !SVC_EXTENSION
     2677      const TComSPS &sps=*(pcSlice->getSPS());
     2678#endif
    26702679      const Int log2subWidthCxsubHeightC = (pcPic->getComponentScaleX(COMPONENT_Cb)+pcPic->getComponentScaleY(COMPONENT_Cb));
    26712680      const Int minCuWidth  = pcPic->getMinCUWidth();
     
    26742683      const Int paddedWidth = ((pcSlice->getPicWidthInLumaSamples()  + minCuWidth  - 1) / minCuWidth) * minCuWidth;
    26752684      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));
    26762687#else
    26772688      const Int paddedWidth = ((pcSlice->getSPS()->getPicWidthInLumaSamples()  + minCuWidth  - 1) / minCuWidth) * minCuWidth;
    26782689      const Int paddedHeight= ((pcSlice->getSPS()->getPicHeightInLumaSamples() + minCuHeight - 1) / minCuHeight) * minCuHeight;
    2679 #endif
    26802690      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
    26822693      const std::size_t threshold = (32/3)*numBytesInVclNalUnits + (rawBits/32);
    26832694      if (binCountsInNalUnits >= threshold)
     
    27182729    {
    27192730      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
    27212736      trailingSeiMessages.push_back(decodedPictureHashSei);
    27222737    }
     
    29332948
    29342949#if !SVC_EXTENSION
    2935 Void TEncGOP::printOutSummary(UInt uiNumAllPicCoded, Bool isField, const Bool printMSEBasedSNR, const Bool printSequenceMSE)
     2950Void TEncGOP::printOutSummary(UInt uiNumAllPicCoded, Bool isField, const Bool printMSEBasedSNR, const Bool printSequenceMSE, const BitDepths &bitDepths)
    29362951{
    29372952  assert (uiNumAllPicCoded == m_gcAnalyzeAll.getNumPic());
     
    29482963  //-- all
    29492964  printf( "\n\nSUMMARY --------------------------------------------------------\n" );
    2950   m_gcAnalyzeAll.printOut('a', chFmt, printMSEBasedSNR, printSequenceMSE);
     2965  m_gcAnalyzeAll.printOut('a', chFmt, printMSEBasedSNR, printSequenceMSE, bitDepths);
    29512966
    29522967  printf( "\n\nI Slices--------------------------------------------------------\n" );
    2953   m_gcAnalyzeI.printOut('i', chFmt, printMSEBasedSNR, printSequenceMSE);
     2968  m_gcAnalyzeI.printOut('i', chFmt, printMSEBasedSNR, printSequenceMSE, bitDepths);
    29542969
    29552970  printf( "\n\nP Slices--------------------------------------------------------\n" );
    2956   m_gcAnalyzeP.printOut('p', chFmt, printMSEBasedSNR, printSequenceMSE);
     2971  m_gcAnalyzeP.printOut('p', chFmt, printMSEBasedSNR, printSequenceMSE, bitDepths);
    29572972
    29582973  printf( "\n\nB Slices--------------------------------------------------------\n" );
    2959   m_gcAnalyzeB.printOut('b', chFmt, printMSEBasedSNR, printSequenceMSE);
     2974  m_gcAnalyzeB.printOut('b', chFmt, printMSEBasedSNR, printSequenceMSE, bitDepths);
    29602975
    29612976#if _SUMMARY_OUT_
     
    29762991
    29772992    printf( "\n\nSUMMARY INTERLACED ---------------------------------------------\n" );
    2978     m_gcAnalyzeAll_in.printOut('a', chFmt, printMSEBasedSNR, printSequenceMSE);
     2993    m_gcAnalyzeAll_in.printOut('a', chFmt, printMSEBasedSNR, printSequenceMSE, bitDepths);
    29792994
    29802995#if _SUMMARY_OUT_
     
    29953010  if (!bCalcDist)
    29963011  {
    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
    29983017  }
    29993018}
     
    30663085}
    30673086
    3068 UInt64 TEncGOP::xFindDistortionFrame (TComPicYuv* pcPic0, TComPicYuv* pcPic1)
     3087UInt64 TEncGOP::xFindDistortionFrame (TComPicYuv* pcPic0, TComPicYuv* pcPic1, const BitDepths &bitDepths)
    30693088{
    30703089  UInt64  uiTotalDiff = 0;
     
    30753094    Pel*  pSrc0   = pcPic0 ->getAddr(ch);
    30763095    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);
    30783097
    30793098    const Int   iStride = pcPic0->getStride(ch);
     
    31443163  {
    31453164    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
    31473170  }
    31483171  TComPicYuv &picd=(conversion==IPCOLOURSPACE_UNCHANGED)?*pcPicD : cscd;
     
    31743197      pRec += iStride;
    31753198    }
    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
    31773204    const Double fRefValue = (Double) maxval * maxval * iSize;
    31783205    dPSNR[ch]         = ( uiSSDtemp ? 10.0 * log10( fRefValue / (Double)uiSSDtemp ) : 999.99 );
     
    33403367                                           const AccessUnit& accessUnit, Double dEncTime, const InputColourSpaceConversion conversion, const Bool printFrameMSE )
    33413368{
     3369#if !SVC_EXTENSION
     3370  const TComSPS &sps=pcPicOrgFirstField->getPicSym()->getSPS();
     3371#endif
    33423372  Double  dPSNR[MAX_NUM_COMPONENT];
    33433373  TComPic    *apcPicOrgFields[2]={pcPicOrgFirstField, pcPicOrgSecondField};
     
    33563386      TComPicYuv &reconField=*(apcPicRecFields[fieldNum]);
    33573387      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
    33593393      apcPicRecFields[fieldNum]=cscd+fieldNum;
    33603394    }
     
    34003434      }
    34013435    }
    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
    34033441    const Double fRefValue = (Double) maxval * maxval * iSize*2;
    34043442    dPSNR[ch]         = ( uiSSDtemp ? 10.0 * log10( fRefValue / (Double)uiSSDtemp ) : 999.99 );
     
    36843722
    36853723  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);
    36873730  Int beta = TComLoopFilter::getBeta( qp ) * bitdepthScale;
    36883731  const Int thr2 = (beta>>2);
     
    37573800
    37583801  UInt64 avgSAD = ((colSADsum + rowSADsum)>>1);
    3759   avgSAD >>= (g_bitDepth[CHANNEL_TYPE_LUMA]-8);
     3802  avgSAD >>= (bitDepthLuma-8);
    37603803
    37613804  if ( avgSAD > 2048 )
     
    41684211}
    41694212
    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   }
     4213Void 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); 
    41914230}
    41924231const Int TEncGOP::m_phase_filter_0_t0[4][13]={
     
    42294268#endif
    42304269#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)
     4270Void TEncGOP::filterImg( Pel *src, Int iSrcStride, Pel *dst, Int iDstStride, Int height1, Int width1, BitDepths& bitDepth, Int plane )
    42404271{
    42414272  Int length = m_iTap;
     
    42484279  Pel *p_src_line, *p_dst_line;
    42494280  Int **p_temp, *p_tmp;
     4281  Int shift = bitDepth.recon[CHANNEL_TYPE_LUMA] - bitDepth.recon[CHANNEL_TYPE_CHROMA];
    42504282  Int shift2 = 2*7+shift;
    42514283  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;
    42534285  height2 = (height1 * m_iM) / m_iN;
    42544286  width2  = (width1  * m_iM) / m_iN;
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.h

    r1277 r1287  
    224224                                     const AccessUnit& accessUnit, Double dEncTime, const InputColourSpaceConversion snr_conversion, const Bool printFrameMSE );
    225225
    226   UInt64 xFindDistortionFrame (TComPicYuv* pcPic0, TComPicYuv* pcPic1);
     226  UInt64 xFindDistortionFrame (TComPicYuv* pcPic0, TComPicYuv* pcPic1, const BitDepths &bitDepths);
    227227
    228228  Double xCalculateRVM();
     
    288288#if CGS_3D_ASYMLUT
    289289  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);
    291291  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 );
    292292  inline Short xClip( Short x , Int bitdepth );
    293293  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 );
    295295
    296296  Int get_mem2DintWithPad(Int ***array2D, Int dim0, Int dim1, Int iPadY, Int iPadX);
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp

    r1260 r1287  
    349349      Pel* orgBlk     = orgYuv->getAddr(component) + ((yPos >> componentScaleY) * orgStride) + (xPos >> componentScaleX);
    350350
    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
    352356                , srcBlk, orgBlk, srcStride, orgStride, (width  >> componentScaleX), (height >> componentScaleY)
    353357                , isLeftAvail,  isRightAvail, isAboveAvail, isBelowAvail, isAboveLeftAvail, isAboveRightAvail, isBelowLeftAvail, isBelowRightAvail
     
    395399}
    396400
    397 Int64 TEncSampleAdaptiveOffset::getDistortion(ComponentID compIdx, Int typeIdc, Int typeAuxInfo, Int* invQuantOffset, SAOStatData& statData)
     401Int64 TEncSampleAdaptiveOffset::getDistortion(const Int channelBitDepth, Int typeIdc, Int typeAuxInfo, Int* invQuantOffset, SAOStatData& statData)
    398402{
    399403  Int64 dist        = 0;
    400   Int shift         = 2 * DISTORTION_PRECISION_ADJUSTMENT(g_bitDepth[toChannelType(compIdx)] - 8);
     404  Int shift         = 2 * DISTORTION_PRECISION_ADJUSTMENT(channelBitDepth - 8);
    401405
    402406  switch(typeIdc)
     
    472476}
    473477
    474 Void TEncSampleAdaptiveOffset::deriveOffsets(ComponentID compIdx, Int typeIdc, SAOStatData& statData, Int* quantOffsets, Int& typeAuxInfo)
    475 {
    476   Int bitDepth = g_bitDepth[toChannelType(compIdx)];
     478Void TEncSampleAdaptiveOffset::deriveOffsets(ComponentID compIdx, const Int channelBitDepth, Int typeIdc, SAOStatData& statData, Int* quantOffsets, Int& typeAuxInfo)
     479{
     480  Int bitDepth = channelBitDepth;
    477481  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
    483483
    484484  ::memset(quantOffsets, 0, sizeof(Int)*MAX_NUM_SAO_CLASSES);
     
    595595}
    596596
    597 Void TEncSampleAdaptiveOffset::deriveModeNewRDO(Int ctuRsAddr, SAOBlkParam* mergeList[NUM_SAO_MERGE_TYPES], Bool* sliceEnabled, SAOStatData*** blkStats, SAOBlkParam& modeParam, Double& modeNormCost, TEncSbac** cabacCoderRDO, Int inCabacLabel)
     597Void 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)
    598598{
    599599  Double minCost, cost;
     
    612612  modeParam[COMPONENT_Y].modeIdc = SAO_MODE_OFF;
    613613  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);
    619615  m_pcRDGoOnSbacCoder->store(cabacCoderRDO[SAO_CABACSTATE_BLK_MID]);
    620616
    621617    //------ luma --------//
    622618  {
    623     ComponentID compIdx = COMPONENT_Y;
     619    const ComponentID compIdx = COMPONENT_Y;
    624620    //"off" case as initial cost
    625621    modeParam[compIdx].modeIdc = SAO_MODE_OFF;
    626622    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]);
    632624    modeDist[compIdx] = 0;
    633625    minCost= m_lambda[compIdx]*((Double)m_pcRDGoOnSbacCoder->getNumberOfWrittenBits());
     
    641633
    642634        //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);
    644636
    645637        //inversed quantized offsets
     
    647639
    648640        //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]);
    650642
    651643        //get rate
    652644        m_pcRDGoOnSbacCoder->load(cabacCoderRDO[SAO_CABACSTATE_BLK_MID]);
    653645        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]);
    659647        Int rate = m_pcRDGoOnSbacCoder->getNumberOfWrittenBits();
    660648        cost = (Double)dist[compIdx] + m_lambda[compIdx]*((Double)rate);
     
    683671    modeParam[component].modeIdc = SAO_MODE_OFF;
    684672    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   
    692675    const UInt currentWrittenBits = m_pcRDGoOnSbacCoder->getNumberOfWrittenBits();
    693676    cost += m_lambda[component] * (currentWrittenBits - previousWrittenBits);
     
    719702
    720703      //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);
    722705      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]);
    730709
    731710      const UInt currentWrittenBits = m_pcRDGoOnSbacCoder->getNumberOfWrittenBits();
     
    755734  m_pcRDGoOnSbacCoder->load(cabacCoderRDO[inCabacLabel]);
    756735  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);
    762737  modeNormCost += (Double)m_pcRDGoOnSbacCoder->getNumberOfWrittenBits();
    763738}
    764739
    765 Void TEncSampleAdaptiveOffset::deriveModeMergeRDO(Int ctuRsAddr, SAOBlkParam* mergeList[NUM_SAO_MERGE_TYPES], Bool* sliceEnabled, SAOStatData*** blkStats, SAOBlkParam& modeParam, Double& modeNormCost, TEncSbac** cabacCoderRDO, Int inCabacLabel)
     740Void 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)
    766741{
    767742  modeNormCost = MAX_DOUBLE;
     
    791766      {
    792767        //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]))
    794769                       /m_lambda[compIdx]
    795770                    );
     
    801776    m_pcRDGoOnSbacCoder->load(cabacCoderRDO[inCabacLabel]);
    802777    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);
    808779    Int rate = m_pcRDGoOnSbacCoder->getNumberOfWrittenBits();
    809780
     
    869840      case SAO_MODE_NEW:
    870841        {
    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
    872847
    873848        }
     
    875850      case SAO_MODE_MERGE:
    876851        {
    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
    878857        }
    879858        break;
     
    953932
    954933
    955 Void TEncSampleAdaptiveOffset::getBlkStats(ComponentID compIdx, SAOStatData* statsDataTypes
     934Void TEncSampleAdaptiveOffset::getBlkStats(const ComponentID compIdx, const Int channelBitDepth, SAOStatData* statsDataTypes
    956935                        , Pel* srcBlk, Pel* orgBlk, Int srcStride, Int orgStride, Int width, Int height
    957936                        , Bool isLeftAvail,  Bool isRightAvail, Bool isAboveAvail, Bool isBelowAvail, Bool isAboveLeftAvail, Bool isAboveRightAvail, Bool isBelowLeftAvail, Bool isBelowRightAvail
     
    13591338#endif
    13601339        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;
    13621341        for (y=0; y< endY; y++)
    13631342        {
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.h

    r1259 r1287  
    126126  Void decidePicParams(Bool* sliceEnabled, Int picTempLayer);
    127127  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 isBelowRightAvail
     128  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
    129129#if SAO_ENCODE_ALLOW_USE_PREDEBLOCK
    130130                  , Bool isCalculatePreDeblockSamples
    131131#endif
    132132                  );
    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);
    137137  inline Int64 estSaoDist(Int64 count, Int64 offset, Int64 diffSum, Int shift);
    138138  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  
    886886 
    887887#if SVC_EXTENSION 
    888   Int qpBdOffsetY =  pcCU->getSlice()->getQpBDOffsetY();
     888  Int qpBdOffsetY =  pcCU->getSlice()->getQpBDOffset(CHANNEL_TYPE_LUMA);
    889889#else
    890890  Int qpBdOffsetY =  pcCU->getSlice()->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA);
     
    16081608  }
    16091609}
    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
     1611Void TEncSbac::codeSAOOffsetParam(ComponentID compIdx, SAOOffset& ctbParam, Bool sliceEnabled, const Int channelBitDepth)
    16151612{
    16161613  UInt uiSymbol;
     
    16581655    }
    16591656
     1657    const Int  maxOffsetQVal = TComSampleAdaptiveOffset::getMaxOffsetQVal(channelBitDepth);
    16601658    for(Int i=0; i< 4; i++)
    16611659    {
    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
    16671661    }
    16681662
     
    16931687
    16941688
    1695 Void TEncSbac::codeSAOBlkParam(SAOBlkParam& saoBlkParam
    1696 #if SVC_EXTENSION
    1697                               , UInt* saoMaxOffsetQVal
    1698 #endif
     1689Void TEncSbac::codeSAOBlkParam(SAOBlkParam& saoBlkParam, const BitDepths &bitDepths
    16991690                              , Bool* sliceEnabled
    17001691                              , Bool leftMergeAvail
     
    17281719    for(Int compIdx=0; compIdx < MAX_NUM_COMPONENT; compIdx++)
    17291720    {
    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))]);
    17351722    }
    17361723  }
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncSbac.h

    r1285 r1287  
    104104  Void  codeSAOSign          ( UInt  uiCode);  //<! code SAO offset sign
    105105
    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
    111108                    , Bool* sliceEnabled
    112109                    , Bool leftMergeAvail
     
    114111                    , Bool onlyEstMergeInfo = false
    115112                    );
    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 );
    124116#endif 
    125117
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncSearch.cpp

    r1283 r1287  
    359359
    360360  // distortion
    361   m_cDistParam.bitDepth = g_bitDepth[CHANNEL_TYPE_LUMA];
     361  m_cDistParam.bitDepth = pcPatternKey->getBitDepthY();
    362362  if(m_pcEncCfg->getFastSearch() == SELECTIVE)
    363363  {
     
    848848
    849849    m_cDistParam.pCur = piRefPos;
    850     m_cDistParam.bitDepth = g_bitDepth[CHANNEL_TYPE_LUMA];
     850    m_cDistParam.bitDepth = pcPatternKey->getBitDepthY();
    851851    uiDist = m_cDistParam.DistFunc( &m_cDistParam );
    852852    uiDist += m_pcRdCost->getCost( cMvTest.getHor(), cMvTest.getVer() );
     
    11151115  const ChromaFormat chFmt = pcOrgYuv->getChromaFormat();
    11161116  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
    11171122
    11181123  const UInt    uiWidth           = rect.width;
     
    12961301    Pel* pRecQt     = piRecQt;
    12971302    Pel* pRecIPred  = piRecIPred;
    1298     const UInt clipbd=g_bitDepth[chType];
    12991303
    13001304    if (pcCU->getSlice()->getPPS()->getUseCrossComponentPrediction())
     
    13401344            ss << pResi[ uiX ] << ", ";
    13411345          }
    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 ));
    13431347          pRecQt   [ uiX ] = pReco[ uiX ];
    13441348          pRecIPred[ uiX ] = pReco[ uiX ];
     
    13691373        for( UInt uiX = 0; uiX < uiWidth; uiX++ )
    13701374        {
    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 ));
    13721376          pRecQt   [ uiX ] = pReco[ uiX ];
    13731377          pRecIPred[ uiX ] = pReco[ uiX ];
     
    13831387
    13841388  //===== 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 );
    13861390}
    13871391
     
    21902194  const ChromaFormat chFmt                 = pcCU->getPic()->getChromaFormat();
    21912195  const UInt         numberValidComponents = getNumberValidComponents(chFmt);
     2196  const TComSPS     &sps                   = *(pcCU->getSlice()->getSPS());
     2197  const TComPPS     &pps                   = *(pcCU->getSlice()->getPPS());
    21922198        Distortion   uiOverallDistY        = 0;
    21932199        UInt         CandNum;
     
    22102216#else
    22112217  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
    22132223              : m_pcRdCost->getSqrtLambda();
    22142224#endif
    22152225
    22162226  //===== set QP and clear Cbf =====
    2217   if ( pcCU->getSlice()->getPPS()->getUseDQP() == true)
     2227  if ( pps.getUseDQP() == true)
    22182228  {
    22192229    pcCU->setQPSubParts( pcCU->getQP(0), 0, uiDepth );
     
    22872297      DistParam distParam;
    22882298      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
    22902304      distParam.bApplyWeight = false;
    22912305      for( Int modeIdx = 0; modeIdx < numModesAvailable; modeIdx++ )
     
    23042318#endif
    23052319
    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());
    23072321
    23082322        predIntraAng( COMPONENT_Y, uiMode, piOrg, uiStride, piPred, uiStride, tuRecurseWithPU, bAboveAvail, bLeftAvail, bUseFilter, TComPrediction::UseDPCMForFirstPassIntraEstimation(tuRecurseWithPU, uiMode) );
     
    24162430        xSetIntraResultLumaQT( pcRecoYuv, tuRecurseWithPU );
    24172431
    2418         if (pcCU->getSlice()->getPPS()->getUseCrossComponentPrediction())
     2432        if (pps.getUseCrossComponentPrediction())
    24192433        {
    24202434          const Int xOffset = tuRecurseWithPU.getRect( COMPONENT_Y ).x0;
     
    24922506        xSetIntraResultLumaQT( pcRecoYuv, tuRecurseWithPU );
    24932507
    2494         if (pcCU->getSlice()->getPPS()->getUseCrossComponentPrediction())
     2508        if (pps.getUseCrossComponentPrediction())
    24952509        {
    24962510          const Int xOffset = tuRecurseWithPU.getRect( COMPONENT_Y ).x0;
     
    27602774Void 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 )
    27612775{
    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
    27642783  Pel* pRecoPic = pcCU->getPic()->getPicYuvRec()->getAddr(compID, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu()+uiAbsPartIdx);
    27652784
    2766   const Int pcmShiftRight=(g_bitDepth[toChannelType(compID)] - Int(uiPCMBitDepth));
     2785  const Int pcmShiftRight=(channelBitDepth - Int(uiPCMBitDepth));
    27672786
    27682787  assert(pcmShiftRight >= 0);
     
    28492868
    28502869
    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
    28522875                            pcYuvOrg->getAddr( COMPONENT_Y, uiAbsPartIdx ), pcYuvOrg->getStride(COMPONENT_Y),
    28532876                            m_tmpYuvPred .getAddr( COMPONENT_Y, uiAbsPartIdx ), m_tmpYuvPred.getStride(COMPONENT_Y),
     
    37973820#endif
    37983821  {
    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
    38003827  }
    38013828  else
    38023829  {
    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
    38043835  }
    38053836
     
    38153846
    38163847  // 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
    38193853  uiCost = (UInt) m_pcRdCost->calcRdCost( m_auiMVPIdxCost[iMVPIdx][iMVPNum], uiCost, false, DF_SAD );
    38203854  return uiCost;
     
    38633897                             iRoiWidth,
    38643898                             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
    38663905
    38673906  Pel*        piRefY      = pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxPred )->getPicYuvRec()->getAddr( COMPONENT_Y, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu() + uiPartAddr );
     
    40034042      setDistParamComp(COMPONENT_Y);
    40044043
    4005       m_cDistParam.bitDepth = g_bitDepth[CHANNEL_TYPE_LUMA];
     4044      m_cDistParam.bitDepth = pcPatternKey->getBitDepthY();
    40064045      uiSad = m_cDistParam.DistFunc( &m_cDistParam );
    40074046
     
    44384477                          pcPatternKey->getROIYWidth(),
    44394478                          pcPatternKey->getROIYHeight(),
    4440                           iRefStride );
     4479                          iRefStride,
     4480                          pcPatternKey->getBitDepthY());
    44414481
    44424482  //  Half-pel refinement
     
    44694509  const UInt cuHeightPixels     = pcCU->getHeight( 0 );
    44704510  const Int  numValidComponents = pcCU->getPic()->getNumberValidComponents();
     4511#if !SVC_EXTENSION
     4512  const TComSPS &sps=*(pcCU->getSlice()->getSPS());
     4513#endif
    44714514
    44724515  // 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.
     
    44874530      const UInt csx=pcYuvOrg->getComponentScaleX(compID);
    44884531      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
    44904537                                               pcYuvOrg->getStride(compID), cuWidthPixels >> csx, cuHeightPixels >> csy, compID);
    44914538    }
     
    45874634  m_pcRDGoOnSbacCoder->store( m_pppcRDSbacCoder[ pcCU->getDepth( 0 ) ][ CI_TEMP_BEST ] );
    45884635
    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
    45904641
    45914642  // update with clipped distortion and cost (previously unclipped reconstruction values were used)
     
    45954646  {
    45964647    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
    45984653  }
    45994654
     
    46854740      checkTransformSkip[i]=false;
    46864741      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
    46874747      pcCoeffCurr[compID]    = m_ppcQTTempCoeff[compID][uiQTTempAccessLayer] + rTu.getCoefficientOffset(compID);
    46884748#if ADAPTIVE_QP_SELECTION
     
    48414901                                                        true);
    48424902
    4843                   nonCoeffDist = m_pcRdCost->getDistPart( g_bitDepth[toChannelType(compID)], m_pcQTTempTComYuv[uiQTTempAccessLayer].getAddrPix( compID, tuCompRect.x0, tuCompRect.y0 ),
    4844                                                                                               m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride( compID ), pcResi->getAddrPix( compID, tuCompRect.x0, tuCompRect.y0 ),
    4845                                                                                               pcResi->getStride(compID), tuCompRect.width, tuCompRect.height, compID); // initialized with zero residual destortion
     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
    48464906                }
    48474907                else
    48484908                {
    4849                   nonCoeffDist = m_pcRdCost->getDistPart( g_bitDepth[toChannelType(compID)], m_pTempPel, tuCompRect.width, pcResi->getAddrPix( compID, tuCompRect.x0, tuCompRect.y0 ),
    4850                                                                                               pcResi->getStride(compID), tuCompRect.width, tuCompRect.height, compID); // initialized with zero residual destortion
     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
    48514911                }
    48524912
     
    49064966                }
    49074967
    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 ),
    49094969                                                        m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(compID),
    49104970                                                        pcResi->getAddrPix( compID, tuCompRect.x0, tuCompRect.y0 ),
     
    55255585  const ChromaFormat chFmt = m_filteredBlock[0][0].getChromaFormat();
    55265586
    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());
    55295589
    55305590  intPtr = m_filteredBlockTmp[0].getAddr(COMPONENT_Y) + halfFilterSize * intStride + 1;
    55315591  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());
    55335593
    55345594  intPtr = m_filteredBlockTmp[0].getAddr(COMPONENT_Y) + (halfFilterSize-1) * intStride + 1;
    55355595  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());
    55375597
    55385598  intPtr = m_filteredBlockTmp[2].getAddr(COMPONENT_Y) + halfFilterSize * intStride;
    55395599  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());
    55415601
    55425602  intPtr = m_filteredBlockTmp[2].getAddr(COMPONENT_Y) + (halfFilterSize-1) * intStride;
    55435603  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());
    55455605}
    55465606
     
    55865646    srcPtr += 1;
    55875647  }
    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());
    55895649
    55905650  // Horizontal filter 3/4
     
    55995659    srcPtr += 1;
    56005660  }
    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());
    56025662
    56035663  // Generate @ 1,1
     
    56085668    intPtr += intStride;
    56095669  }
    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());
    56115671
    56125672  // Generate @ 3,1
    56135673  intPtr = m_filteredBlockTmp[1].getAddr(COMPONENT_Y) + (halfFilterSize-1) * intStride;
    56145674  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());
    56165676
    56175677  if (halfPelRef.getVer() != 0)
     
    56245684      intPtr += intStride;
    56255685    }
    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());
    56275687
    56285688    // Generate @ 2,3
     
    56335693      intPtr += intStride;
    56345694    }
    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());
    56365696  }
    56375697  else
     
    56405700    intPtr = m_filteredBlockTmp[1].getAddr(COMPONENT_Y) + halfFilterSize * intStride;
    56415701    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());
    56435703
    56445704    // Generate @ 0,3
    56455705    intPtr = m_filteredBlockTmp[3].getAddr(COMPONENT_Y) + halfFilterSize * intStride;
    56465706    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());
    56485708  }
    56495709
     
    56615721      intPtr += intStride;
    56625722    }
    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());
    56645724
    56655725    // Generate @ 3,2
     
    56745734      intPtr += intStride;
    56755735    }
    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());
    56775737  }
    56785738  else
     
    56855745      intPtr += intStride;
    56865746    }
    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());
    56885748
    56895749    // Generate @ 3,0
     
    56945754      intPtr += intStride;
    56955755    }
    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());
    56975757  }
    56985758
     
    57045764    intPtr += intStride;
    57055765  }
    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());
    57075767
    57085768  // Generate @ 3,3
    57095769  intPtr = m_filteredBlockTmp[3].getAddr(COMPONENT_Y) + (halfFilterSize-1) * intStride;
    57105770  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());
    57125772}
    57135773
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncSlice.cpp

    r1260 r1287  
    171171
    172172  // 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
    174178
    175179  // for RDO
     
    187191    {
    188192      dLambdas[0] = dLambda * 1.1;
    189       m_pcRdCost->setLambda( dLambdas[0] );
     193      m_pcRdCost->setLambda( dLambdas[0], slice->getBitDepths() );
    190194
    191195      m_pcRdCost->setDistortionWeight(compID, tmpWeight * 1.15);
     
    227231 \param iGOPid        POC offset for hierarchical structure
    228232 \param rpcSlice      slice header class
    229  \param pSPS          SPS associated with the slice
    230  \param pPPS          PPS associated with the slice
    231233 \param isField       true for field coding
    232234 */
    233 #if SVC_EXTENSION
     235
    234236Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, Bool isField )
    235 #else
    236 Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, const TComSPS* pSPS, const TComPPS *pPPS, Bool isField )
    237 #endif
    238237{
    239238  Double dQP;
     
    351350  {
    352351#if SVC_EXTENSION
    353     if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getQpBDOffsetY() ) && (rpcSlice->getPPS()->getTransquantBypassEnableFlag())))
     352    if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getQpBDOffset(CHANNEL_TYPE_LUMA) ) && (rpcSlice->getPPS()->getTransquantBypassEnableFlag())))
    354353#else
    355354    if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA) ) && (rpcSlice->getPPS()->getTransquantBypassEnableFlag())))
     
    393392
    394393#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
    396399#else
    397400    Int    bitdepth_luma_qp_scale = 0;
     
    425428
    426429#if SVC_EXTENSION
    427     iQP = max( -rpcSlice->getQpBDOffsetY(), 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 ) ) );
    430433#endif
    431434
     
    486489    dQP = xGetQPValueAccordingToLambda( dLambda );
    487490#if SVC_EXTENSION
    488     iQP = max( -rpcSlice->getQpBDOffsetY(), 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 ) ) );
    491494#endif
    492495  }
     
    499502  rpcSlice->setSliceChromaQpDelta( COMPONENT_Cb, 0 );
    500503  rpcSlice->setSliceChromaQpDelta( COMPONENT_Cr, 0 );
    501   rpcSlice->setUseChromaQpAdj( pPPS->getChromaQpAdjTableSize() > 0 );
     504  rpcSlice->setUseChromaQpAdj( rpcSlice->getPPS()->getChromaQpAdjTableSize() > 0 );
    502505  rpcSlice->setNumRefIdx(REF_PIC_LIST_0,m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive);
    503506  rpcSlice->setNumRefIdx(REF_PIC_LIST_1,m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive);
     
    644647  Double dFrameLambda;
    645648#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
    647654#else
    648655  Int    SHIFT_QP = 12;
     
    706713Void TEncSlice::calCostSliceI(TComPic* pcPic)
    707714{
    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;
    716728  xDetermineStartAndBoundingCtuTsAddr ( startCtuTsAddr, boundingCtuTsAddr, pcPic, false );
    717729
    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) )
    721733  {
    722734    // initialize CU encoder
     
    725737
    726738#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);
    735747
    736748    (m_pcRateCtrl->getRCPic()->getLCU(ctuRsAddr)).m_costIntra=(iSumHad+offset)>>shift;
     
    901913
    902914#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());
    904918#else
    905919        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       
    909923
    910924#if RDOQ_CHROMA_LAMBDA
     
    10001014        actualQP = pCtu->getQP( 0 );
    10011015      }
    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
    10031021      m_pcRateCtrl->getRCPic()->updateAfterCTU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda,
    10041022                                                pCtu->getSlice()->getSliceType() == I_SLICE ? 0 : m_pcCfg->getLCULevelRC() );
     
    11581176
    11591177#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);
    11631181#endif
    11641182      }
     
    13641382{
    13651383  xCalcACDCParamSlice(pcSlice);
    1366   WPACDCParam * temp_weightACDCParam;
    1367 
    1368   pcSlice->getWpAcDcParam(temp_weightACDCParam);
    1369   g_refWeightACDCParam = (void *) temp_weightACDCParam;
    13701384}
    13711385#endif //SVC_EXTENSION
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncSlice.h

    r1259 r1287  
    120120
    121121  /// preparation of slice encoding (reference marking, QP and lambda)
    122 #if SVC_EXTENSION
    123   Void    initEncSlice        ( TComPic*  pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, Bool isField );
    124   Void    estimateILWpParam   ( TComSlice* pcSlice );
    125 #else
    126122  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 );
    130124  Void    resetQP             ( TComPic* pic, Int sliceQP, Double lambda );
    131125  // compress and encode slice
     
    145139  SliceType getEncCABACTableIdx() const           { return m_encCABACTableIdx;        }
    146140
     141#if SVC_EXTENSION
     142  Void    estimateILWpParam   ( TComSlice* pcSlice );
     143#endif
     144
    147145private:
    148146  Double  xGetQPValueAccordingToLambda ( Double lambda );
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncTop.cpp

    r1285 r1287  
    283283  {
    284284#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) );
    286286#else
    287     getTrQuant()->setFlatScalingList(m_cSPS.getChromaFormatIdc(), maxLog2TrDynamicRange);
     287    getTrQuant()->setFlatScalingList(m_cSPS.getChromaFormatIdc(), maxLog2TrDynamicRange, m_cSPS.getBitDepths());
    288288#endif
    289289    getTrQuant()->setUseScalingList(false);
     
    305305
    306306      // 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) );
    308308    }
    309309    else
     
    314314    m_cPPS.setScalingListPresentFlag(false);
    315315
    316     getTrQuant()->setScalingList(&(m_cSPS.getScalingList()), m_cSPS.getChromaFormatIdc(), maxLog2TrDynamicRange);
     316    getTrQuant()->setScalingList(&(m_cSPS.getScalingList()), m_cSPS.getChromaFormatIdc(), maxLog2TrDynamicRange, m_cSPS.getBitDepths());
    317317#if SVC_EXTENSION
    318318    }
     
    334334
    335335      // 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) );
    337337    }
    338338    else
     
    349349    m_cSPS.setScalingListPresentFlag(m_cSPS.getScalingList().checkDefaultScalingList());
    350350    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());
    352352#if SVC_EXTENSION
    353353    }
     
    720720
    721721          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 );
    723729
    724730          if( m_iSourceWidth == pcEncTopBase->getSourceWidth() && m_iSourceHeight == pcEncTopBase->getSourceHeight() && equalOffsets && zeroPhase )
     
    767773
    768774          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 );
    770782
    771783          if( m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() || !sameBitDepths
     
    858870  profileTierLevel.setLowerBitRateConstraintFlag(m_lowerBitRateConstraintFlag);
    859871
    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))
    861873  {
    862874    /* The above constraint is equal to Profile::MAIN */
     
    914926    m_cSPS.setBitDepth    (ChannelType(channelType), m_cVPS.getVpsRepFormat( m_cVPS.getVpsRepFormatIdx( m_cVPS.getLayerIdxInVps( m_layerId ) ) )->getBitDepthVps(ChannelType(channelType))            );
    915927    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
    916931#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)));
    919936#endif
    920937    m_cSPS.setPCMBitDepth (ChannelType(channelType), m_PCMBitDepth[channelType]         );
     
    940957  for (Int i = 0; i < min(m_cSPS.getMaxTLayers(),(UInt) MAX_TLAYER); i++ )
    941958  {
    942 #if SVC_EXTENSION
    943     assert(i < MAX_TLAYER);
    944 #endif
    945959    m_cSPS.setMaxDecPicBuffering(m_maxDecPicBuffering[i], i);
    946960    m_cSPS.setNumReorderPics(m_numReorderPics[i], i);
     
    14871501{
    14881502  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();
    14931503 
    14941504  if( m_layerId > 0 )
    14951505  {
    1496     g_bitDepth[CHANNEL_TYPE_LUMA]   = bitDepthY;
    1497     g_bitDepth[CHANNEL_TYPE_CHROMA] = bitDepthC;
    14981506    g_uiMaxCUWidth  = m_cSPS.getMaxCUWidth();
    14991507    g_uiMaxCUHeight = m_cSPS.getMaxCUHeight();
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncTop.h

    r1259 r1287  
    116116  static Int              m_iPPSIdCnt;                    ///< next Id number for PPS   
    117117  TEncTop**               m_ppcTEncTop;
    118   TEncTop*                getLayerEnc(UInt layerIdx)       { return m_ppcTEncTop[layerIdx]; }
     118  TEncTop*                getLayerEnc(UInt layerIdx)      { return m_ppcTEncTop[layerIdx]; }
    119119  TComPic*                m_cIlpPic[MAX_NUM_REF];                    ///<  Inter layer Prediction picture =  upsampled picture
    120120  Bool                    m_bMFMEnabledFlag;
     
    276276               std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded, Bool isTff);
    277277
    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()); }
    279279#endif //#if SVC_EXTENSION
    280280};
  • branches/SHM-dev/source/Lib/TLibEncoder/WeightPredAnalysis.cpp

    r1260 r1287  
    215215    for ( Int refIdxTemp = 0; refIdxTemp < slice->getNumRefIdx(eRefPicList); refIdxTemp++ )
    216216    {
    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();
    220219
    221220#if SVC_EXTENSION
     
    226225      if( validILRPic )
    227226      {
    228         refWeightACDCParam = (WPACDCParam *)g_refWeightACDCParam;
     227        refWeightACDCParam = slice->getWpAcDcParam();
    229228      }
    230229#endif
     
    233232      {
    234233        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));
    237241        const Int         realOffset    = ((Int)1<<(realLog2Denom-1));
    238242
     
    249253          refAC = ( refAC * currWeightACDCParam[comp].iSamples ) /refWeightACDCParam[comp].iSamples;
    250254
     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
    251259          // 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;
    254262        }
    255263#else
     
    345353        const Int          iWidth     = pPic->getWidth(compID);
    346354        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
    348360
    349361        // calculate SAD costs with/without wp for luma
Note: See TracChangeset for help on using the changeset viewer.