Changeset 601 in SHVCSoftware for branches/SHM-5.0-dev/source


Ignore:
Timestamp:
6 Feb 2014, 06:02:59 (11 years ago)
Author:
seregin
Message:

remove global array for SaoMaxOffsetQVal

Location:
branches/SHM-5.0-dev/source/Lib
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-5.0-dev/source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp

    r593 r601  
    4444//! \ingroup TLibCommon
    4545//! \{
     46#if !SVC_EXTENSION
    4647UInt g_saoMaxOffsetQVal[NUM_SAO_COMPONENTS];
     48#endif
    4749
    4850SAOOffset::SAOOffset()
     
    160162    Int bitDepthSample = (compIdx == SAO_Y)?g_bitDepthY:g_bitDepthC;
    161163    m_offsetStepLog2  [compIdx] = max(bitDepthSample - MAX_SAO_TRUNCATED_BITDEPTH, 0);
     164#if SVC_EXTENSION
     165    m_saoMaxOffsetQVal[compIdx] = (1<<(min(bitDepthSample,MAX_SAO_TRUNCATED_BITDEPTH)-5))-1; //Table 9-32, inclusive
     166#else
    162167    g_saoMaxOffsetQVal[compIdx] = (1<<(min(bitDepthSample,MAX_SAO_TRUNCATED_BITDEPTH)-5))-1; //Table 9-32, inclusive
     168#endif
    163169  }
    164170
     
    168174    Int bitDepthSample = (compIdx == SAO_Y)?g_bitDepthY:g_bitDepthC; //exclusive
    169175    Int maxSampleValue = (1<< bitDepthSample); //exclusive
     176#if SVC_EXTENSION
     177    Int maxOffsetValue = (m_saoMaxOffsetQVal[compIdx] << m_offsetStepLog2[compIdx]);
     178#else
    170179    Int maxOffsetValue = (g_saoMaxOffsetQVal[compIdx] << m_offsetStepLog2[compIdx]);
     180#endif
    171181
    172182    m_offsetClipTable[compIdx] = new Int[(maxSampleValue + maxOffsetValue -1)+ (maxOffsetValue)+1 ]; //positive & negative range plus 0
  • branches/SHM-5.0-dev/source/Lib/TLibCommon/TComSampleAdaptiveOffset.h

    r593 r601  
    5353// Class definition
    5454// ====================================================================================================================
     55#if !SVC_EXTENSION
    5556extern UInt g_saoMaxOffsetQVal[NUM_SAO_COMPONENTS];
     57#endif
    5658
    5759class TComSampleAdaptiveOffset
     
    6971  Void reconstructBlkSAOParams(TComPic* pic, SAOBlkParam* saoBlkParams);
    7072  Void PCMLFDisableProcess (TComPic* pcPic);
     73#if SVC_EXTENSION
     74  UInt* getSaoMaxOffsetQVal() { return m_saoMaxOffsetQVal; }
     75#endif
    7176protected:
    7277  Void offsetBlock(Int compIdx, Int typeIdx, Int* offset, Pel* srcBlk, Pel* resBlk, Int srcStride, Int resStride,  Int width, Int height
     
    101106  Int*   m_offsetClipTable[NUM_SAO_COMPONENTS];
    102107  Short* m_signTable;
    103 
     108#if SVC_EXTENSION
     109  UInt m_saoMaxOffsetQVal[NUM_SAO_COMPONENTS];
     110#endif
    104111};
    105112
  • branches/SHM-5.0-dev/source/Lib/TLibDecoder/TDecSbac.cpp

    r593 r601  
    13941394
    13951395Void TDecSbac::parseSAOBlkParam (SAOBlkParam& saoBlkParam
     1396#if SVC_EXTENSION
     1397                                , UInt* saoMaxOffsetQVal
     1398#endif
    13961399                                , Bool* sliceEnabled
    13971400                                , Bool leftMergeAvail
     
    14681471        for(Int i=0; i< 4; i++)
    14691472        {
     1473#if SVC_EXTENSION
     1474          parseSaoMaxUvlc(uiSymbol,  saoMaxOffsetQVal[compIdx] ); //sao_offset_abs
     1475#else
    14701476          parseSaoMaxUvlc(uiSymbol,  g_saoMaxOffsetQVal[compIdx] ); //sao_offset_abs
     1477#endif
    14711478          offset[i] = (Int)uiSymbol;
    14721479        }
  • branches/SHM-5.0-dev/source/Lib/TLibDecoder/TDecSbac.h

    r593 r601  
    9090  Void  parseSaoTypeIdx           ( UInt&  ruiVal  );
    9191  Void  parseSaoUflc              ( UInt uiLength, UInt& ruiVal     );
     92
     93#if SVC_EXTENSION
     94  Void parseSAOBlkParam (SAOBlkParam& saoBlkParam, UInt* saoMaxOffsetQVal, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail );
     95#else
    9296  Void parseSAOBlkParam (SAOBlkParam& saoBlkParam, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail);
     97#endif
    9398  Void parseSaoSign(UInt& val);
    9499private:
  • branches/SHM-5.0-dev/source/Lib/TLibDecoder/TDecSlice.cpp

    r593 r601  
    105105
    106106#if SVC_EXTENSION
    107 Void TDecSlice::init(TDecTop** ppcDecTop,TDecEntropy* pcEntropyDecoder, TDecCu* pcCuDecoder)
     107Void TDecSlice::init(TDecEntropy* pcEntropyDecoder, TDecCu* pcCuDecoder, UInt* saoMaxOffsetQVal)
    108108{
    109109  m_pcEntropyDecoder  = pcEntropyDecoder;
    110110  m_pcCuDecoder       = pcCuDecoder;
    111   m_ppcTDecTop        = ppcDecTop;
     111  m_saoMaxOffsetQVal  = saoMaxOffsetQVal;
    112112}
    113113#else
     
    347347          aboveMergeAvail = rpcPic->getSAOMergeAvailability(iCUAddr, iCUAddr-uiWidthInLCUs);
    348348        }
    349 
     349#if SVC_EXTENSION
     350        pcSbacDecoder->parseSAOBlkParam( saoblkParam, m_saoMaxOffsetQVal, sliceEnabled, leftMergeAvail, aboveMergeAvail);
     351#else
    350352        pcSbacDecoder->parseSAOBlkParam( saoblkParam, sliceEnabled, leftMergeAvail, aboveMergeAvail);
     353#endif
    351354      }
    352355      else
  • branches/SHM-5.0-dev/source/Lib/TLibDecoder/TDecSlice.h

    r593 r601  
    7272  std::vector<TDecSbac*> CTXMem;
    7373#if SVC_EXTENSION
    74   TDecTop**       m_ppcTDecTop;
     74  UInt*           m_saoMaxOffsetQVal;
    7575#endif
    7676 
     
    8080 
    8181#if SVC_EXTENSION 
    82   Void  init              ( TDecTop** ppcDecTop, TDecEntropy* pcEntropyDecoder, TDecCu* pcMbDecoder );
     82  Void  init              ( TDecEntropy* pcEntropyDecoder, TDecCu* pcMbDecoder, UInt* saoMaxOffsetQVal );
    8383#else
    8484  Void  init              ( TDecEntropy* pcEntropyDecoder, TDecCu* pcMbDecoder );
     
    9191  Void      setCtxMem( TDecSbac* sb, Int b )   { CTXMem[b] = sb; }
    9292  Int       getCtxMemSize( )                   { return (Int)CTXMem.size(); }
    93 #if SVC_EXTENSION
    94   TDecTop*  getLayerDec   ( UInt LayerId )  { return m_ppcTDecTop[LayerId]; } 
    95 #endif
    9693};
    9794
  • branches/SHM-5.0-dev/source/Lib/TLibDecoder/TDecTop.cpp

    r593 r601  
    138138#if SVC_EXTENSION
    139139  m_cGopDecoder.init( m_ppcTDecTop, &m_cEntropyDecoder, &m_cSbacDecoder, &m_cBinCABAC, &m_cCavlcDecoder, &m_cSliceDecoder, &m_cLoopFilter, &m_cSAO);
    140   m_cSliceDecoder.init( m_ppcTDecTop, &m_cEntropyDecoder, &m_cCuDecoder );
     140  m_cSliceDecoder.init( &m_cEntropyDecoder, &m_cCuDecoder, m_cSAO.getSaoMaxOffsetQVal() );
    141141#else
    142142  m_cGopDecoder.init( &m_cEntropyDecoder, &m_cSbacDecoder, &m_cBinCABAC, &m_cCavlcDecoder, &m_cSliceDecoder, &m_cLoopFilter, &m_cSAO);
  • branches/SHM-5.0-dev/source/Lib/TLibEncoder/TEncCavlc.h

    r593 r601  
    100100 
    101101  Void codeMVPIdx ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefList );
     102#if SVC_EXTENSION
     103  Void codeSAOBlkParam(SAOBlkParam& saoBlkParam, UInt* saoMaxOffsetQVal, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail, Bool onlyEstMergeInfo = false){printf("only supported in CABAC"); assert(0); exit(-1);}
     104#else
    102105  Void codeSAOBlkParam(SAOBlkParam& saoBlkParam, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail, Bool onlyEstMergeInfo = false){printf("only supported in CABAC"); assert(0); exit(-1);}
     106#endif
    103107  Void codeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx );
    104108  Void codeSkipFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx );
  • branches/SHM-5.0-dev/source/Lib/TLibEncoder/TEncEntropy.h

    r593 r601  
    105105  virtual Void codeCoeffNxN      ( TComDataCU* pcCU, TCoeff* pcCoef, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt uiDepth, TextType eTType ) = 0;
    106106  virtual Void codeTransformSkipFlags ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt width, UInt height, TextType eTType ) = 0;
     107#if SVC_EXTENSION
     108  virtual Void codeSAOBlkParam(SAOBlkParam& saoBlkParam, UInt* saoMaxOffsetQVal, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail, Bool onlyEstMergeInfo = false)    =0;
     109#else
    107110  virtual Void codeSAOBlkParam(SAOBlkParam& saoBlkParam, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail, Bool onlyEstMergeInfo = false)    =0;
     111#endif
    108112  virtual Void estBit               (estBitsSbacStruct* pcEstBitsSbac, Int width, Int height, TextType eTType) = 0;
    109113 
     
    184188 
    185189  Void estimateBit             ( estBitsSbacStruct* pcEstBitsSbac, Int width, Int height, TextType eTType);
     190#if SVC_EXTENSION
     191  Void encodeSAOBlkParam(SAOBlkParam& saoBlkParam, UInt* saoMaxOffsetQVal, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail){m_pcEntropyCoderIf->codeSAOBlkParam(saoBlkParam, saoMaxOffsetQVal, sliceEnabled, leftMergeAvail, aboveMergeAvail, false);}
     192#else
    186193  Void encodeSAOBlkParam(SAOBlkParam& saoBlkParam, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail){m_pcEntropyCoderIf->codeSAOBlkParam(saoBlkParam, sliceEnabled, leftMergeAvail, aboveMergeAvail, false);}
     194#endif
    187195  static Int countNonZeroCoeffs( TCoeff* pcCoef, UInt uiSize );
    188196
  • branches/SHM-5.0-dev/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp

    r593 r601  
    463463  Int bitDepth = (compIdx== SAO_Y) ? g_bitDepthY : g_bitDepthC;
    464464  Int shift = 2 * DISTORTION_PRECISION_ADJUSTMENT(bitDepth-8);
     465#if SVC_EXTENSION
     466  Int offsetTh = getSaoMaxOffsetQVal()[compIdx];  //inclusive
     467#else
    465468  Int offsetTh = g_saoMaxOffsetQVal[compIdx];  //inclusive
     469#endif
    466470
    467471  ::memset(quantOffsets, 0, sizeof(Int)*MAX_NUM_SAO_CLASSES);
     
    582586  modeParam[SAO_Y ].modeIdc = SAO_MODE_OFF;
    583587  m_pcRDGoOnSbacCoder->load(cabacCoderRDO[inCabacLabel]);
     588#if SVC_EXTENSION
     589  m_pcRDGoOnSbacCoder->codeSAOBlkParam(modeParam, getSaoMaxOffsetQVal(), sliceEnabled, (mergeList[SAO_MERGE_LEFT]!= NULL), (mergeList[SAO_MERGE_ABOVE]!= NULL), true);
     590#else
    584591  m_pcRDGoOnSbacCoder->codeSAOBlkParam(modeParam, sliceEnabled, (mergeList[SAO_MERGE_LEFT]!= NULL), (mergeList[SAO_MERGE_ABOVE]!= NULL), true);
     592#endif
    585593  m_pcRDGoOnSbacCoder->store(cabacCoderRDO[SAO_CABACSTATE_BLK_MID]);
    586594
     
    590598  modeParam[compIdx].modeIdc = SAO_MODE_OFF;
    591599  m_pcRDGoOnSbacCoder->resetBits();
     600#if SVC_EXTENSION
     601  m_pcRDGoOnSbacCoder->codeSAOOffsetParam(compIdx, modeParam[compIdx], sliceEnabled[compIdx], getSaoMaxOffsetQVal());
     602#else
    592603  m_pcRDGoOnSbacCoder->codeSAOOffsetParam(compIdx, modeParam[compIdx], sliceEnabled[compIdx]);
     604#endif
    593605  modeDist[compIdx] = 0;
    594606  minCost= m_lambda[compIdx]*((Double)m_pcRDGoOnSbacCoder->getNumberOfWrittenBits());
     
    613625      m_pcRDGoOnSbacCoder->load(cabacCoderRDO[SAO_CABACSTATE_BLK_MID]);
    614626      m_pcRDGoOnSbacCoder->resetBits();
     627#if SVC_EXTENSION
     628      m_pcRDGoOnSbacCoder->codeSAOOffsetParam(compIdx, testOffset[compIdx], sliceEnabled[compIdx], getSaoMaxOffsetQVal());
     629#else
    615630      m_pcRDGoOnSbacCoder->codeSAOOffsetParam(compIdx, testOffset[compIdx], sliceEnabled[compIdx]);
     631#endif
    616632      rate = m_pcRDGoOnSbacCoder->getNumberOfWrittenBits();
    617633      cost = (Double)dist[compIdx] + m_lambda[compIdx]*((Double)rate);
     
    638654    modeDist [component] = 0;
    639655
     656#if SVC_EXTENSION
     657    m_pcRDGoOnSbacCoder->codeSAOOffsetParam(component, modeParam[component], sliceEnabled[component], getSaoMaxOffsetQVal());
     658#else
    640659    m_pcRDGoOnSbacCoder->codeSAOOffsetParam(component, modeParam[component], sliceEnabled[component]);
     660#endif
    641661
    642662    const UInt currentWrittenBits = m_pcRDGoOnSbacCoder->getNumberOfWrittenBits();
     
    672692      dist[compIdx]= getDistortion(ctu, compIdx, typeIdc, testOffset[compIdx].typeAuxInfo, invQuantOffset, blkStats[ctu][compIdx][typeIdc]);
    673693
     694#if SVC_EXTENSION
     695      m_pcRDGoOnSbacCoder->codeSAOOffsetParam(compIdx, testOffset[compIdx], sliceEnabled[compIdx], getSaoMaxOffsetQVal());
     696#else
    674697      m_pcRDGoOnSbacCoder->codeSAOOffsetParam(compIdx, testOffset[compIdx], sliceEnabled[compIdx]);
     698#endif
    675699
    676700      const UInt currentWrittenBits = m_pcRDGoOnSbacCoder->getNumberOfWrittenBits();
     
    699723  m_pcRDGoOnSbacCoder->load(cabacCoderRDO[inCabacLabel]);
    700724  m_pcRDGoOnSbacCoder->resetBits();
     725#if SVC_EXTENSION
     726  m_pcRDGoOnSbacCoder->codeSAOBlkParam(modeParam, getSaoMaxOffsetQVal(), sliceEnabled, (mergeList[SAO_MERGE_LEFT]!= NULL), (mergeList[SAO_MERGE_ABOVE]!= NULL), false);
     727#else
    701728  m_pcRDGoOnSbacCoder->codeSAOBlkParam(modeParam, sliceEnabled, (mergeList[SAO_MERGE_LEFT]!= NULL), (mergeList[SAO_MERGE_ABOVE]!= NULL), false);
     729#endif
    702730  modeNormCost += (Double)m_pcRDGoOnSbacCoder->getNumberOfWrittenBits();
    703731
     
    742770    m_pcRDGoOnSbacCoder->load(cabacCoderRDO[inCabacLabel]);
    743771    m_pcRDGoOnSbacCoder->resetBits();
     772#if SVC_EXTENSION
     773    m_pcRDGoOnSbacCoder->codeSAOBlkParam(testBlkParam, getSaoMaxOffsetQVal(), sliceEnabled, (mergeList[SAO_MERGE_LEFT]!= NULL), (mergeList[SAO_MERGE_ABOVE]!= NULL), false);
     774#else
    744775    m_pcRDGoOnSbacCoder->codeSAOBlkParam(testBlkParam, sliceEnabled, (mergeList[SAO_MERGE_LEFT]!= NULL), (mergeList[SAO_MERGE_ABOVE]!= NULL), false);
     776#endif
    745777    Int rate = m_pcRDGoOnSbacCoder->getNumberOfWrittenBits();
    746778
  • branches/SHM-5.0-dev/source/Lib/TLibEncoder/TEncSbac.cpp

    r593 r601  
    15921592}
    15931593
     1594#if SVC_EXTENSION
     1595Void TEncSbac::codeSAOOffsetParam(Int compIdx, SAOOffset& ctbParam, Bool sliceEnabled, UInt* saoMaxOffsetQVal)
     1596#else
    15941597Void TEncSbac::codeSAOOffsetParam(Int compIdx, SAOOffset& ctbParam, Bool sliceEnabled)
     1598#endif
    15951599{
    15961600  UInt uiSymbol;
     
    16391643    for(Int i=0; i< 4; i++)
    16401644    {
     1645#if SVC_EXTENSION
     1646      codeSaoMaxUvlc((offset[i]<0)?(-offset[i]):(offset[i]),  saoMaxOffsetQVal[compIdx] ); //sao_offset_abs
     1647#else
    16411648      codeSaoMaxUvlc((offset[i]<0)?(-offset[i]):(offset[i]),  g_saoMaxOffsetQVal[compIdx] ); //sao_offset_abs
     1649#endif
    16421650    }
    16431651
     
    16691677
    16701678Void TEncSbac::codeSAOBlkParam(SAOBlkParam& saoBlkParam
     1679#if SVC_EXTENSION
     1680                              , UInt* saoMaxOffsetQVal
     1681#endif
    16711682                              , Bool* sliceEnabled
    16721683                              , Bool leftMergeAvail
     
    17001711    for(Int compIdx=0; compIdx < NUM_SAO_COMPONENTS; compIdx++)
    17011712    {
     1713#if SVC_EXTENSION
     1714      codeSAOOffsetParam(compIdx, saoBlkParam[compIdx], sliceEnabled[compIdx], saoMaxOffsetQVal);
     1715#else
    17021716      codeSAOOffsetParam(compIdx, saoBlkParam[compIdx], sliceEnabled[compIdx]);
     1717#endif
    17031718    }
    17041719  }
  • branches/SHM-5.0-dev/source/Lib/TLibEncoder/TEncSbac.h

    r593 r601  
    104104  Void  codeScalingList      ( TComScalingList* /*scalingList*/     ){ assert (0);  return;};
    105105
     106#if SVC_EXTENSION
     107  Void codeSAOOffsetParam(Int compIdx, SAOOffset& ctbParam, Bool sliceEnabled, UInt* saoMaxOffsetQVal);
     108  Void codeSAOBlkParam(SAOBlkParam& saoBlkParam
     109                    , UInt* saoMaxOffsetQVal
     110                    , Bool* sliceEnabled
     111                    , Bool leftMergeAvail
     112                    , Bool aboveMergeAvail
     113                    , Bool onlyEstMergeInfo = false
     114                    );
     115#else
    106116  Void codeSAOOffsetParam(Int compIdx, SAOOffset& ctbParam, Bool sliceEnabled);
    107117  Void codeSAOBlkParam(SAOBlkParam& saoBlkParam
     
    111121                    , Bool onlyEstMergeInfo = false
    112122                    );
     123#endif 
    113124
    114125private:
  • branches/SHM-5.0-dev/source/Lib/TLibEncoder/TEncSlice.cpp

    r593 r601  
    13561356        }
    13571357
     1358#if SVC_EXTENSION
     1359        m_pcEntropyCoder->encodeSAOBlkParam(saoblkParam, m_ppcTEncTop[pcSlice->getLayerId()]->getSAO()->getSaoMaxOffsetQVal(), sliceEnabled, leftMergeAvail, aboveMergeAvail);
     1360#else
    13581361        m_pcEntropyCoder->encodeSAOBlkParam(saoblkParam,sliceEnabled, leftMergeAvail, aboveMergeAvail);
     1362#endif
    13591363      }
    13601364    }
Note: See TracChangeset for help on using the changeset viewer.