Ignore:
Timestamp:
5 Feb 2014, 20:06:56 (10 years ago)
Author:
tech
Message:

Merged 9.3-dev3-Fix@824

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-9.3-dev0/source/Lib/TLibDecoder/TDecSbac.cpp

    r826 r827  
    8787, m_cDdcFlagSCModel           ( 1,             1,               NUM_DDC_FLAG_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
    8888, m_cDdcDataSCModel           ( 1,             1,               NUM_DDC_DATA_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
     89#if QC_GENERIC_SDC_G0122
     90, m_cAngleFlagSCModel         ( 1,             1,               NUM_ANGLE_FLAG_CTX            , m_contextModels + m_numContextModels, m_numContextModels)
     91#if !QC_SDC_UNIFY_G0130
     92, m_cIntraSdcFlagSCModel      ( 1,             1,               NUM_INTRASDC_FLAG_CTX         , m_contextModels + m_numContextModels, m_numContextModels)
     93#endif
     94#endif
    8995#if H_3D_DIM_DMM
    9096, m_cDmm1DataSCModel          ( 1,             1,               NUM_DMM1_DATA_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
     
    95101#endif
    96102#endif
    97 #if H_3D_INTER_SDC
     103#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    98104, m_cInterSDCFlagSCModel             ( 1,             1,  NUM_INTER_SDC_FLAG_CTX           , m_contextModels + m_numContextModels, m_numContextModels)
    99105, m_cInterSDCResidualSCModel         ( 1,             1,  NUM_INTER_SDC_RESIDUAL_CTX       , m_contextModels + m_numContextModels, m_numContextModels)
    100106, m_cInterSDCResidualSignFlagSCModel ( 1,             1,  NUM_INTER_SDC_SIGN_FLAG_CTX      , m_contextModels + m_numContextModels, m_numContextModels)
     107#endif
     108#if QC_SDC_UNIFY_G0130
     109, m_cSDCFlagSCModel                  ( 1,             1,  NUM_SDC_FLAG_CTX                 , m_contextModels + m_numContextModels, m_numContextModels)
    101110#endif
    102111#if H_3D_DBBP
     
    173182  m_cDdcFlagSCModel.initBuffer           ( sliceType, qp, (UChar*)INIT_DDC_FLAG );
    174183  m_cDdcDataSCModel.initBuffer           ( sliceType, qp, (UChar*)INIT_DDC_DATA );
     184#if QC_GENERIC_SDC_G0122
     185  m_cAngleFlagSCModel.initBuffer         ( sliceType, qp, (UChar*)INIT_ANGLE_FLAG );
     186#if !QC_SDC_UNIFY_G0130
     187  m_cIntraSdcFlagSCModel.initBuffer      ( sliceType, qp, (UChar*)INIT_INTRASDC_FLAG );
     188#endif
     189#endif
    175190#if H_3D_DIM_DMM
    176191  m_cDmm1DataSCModel.initBuffer          ( sliceType, qp, (UChar*)INIT_DMM1_DATA );
     
    181196#endif
    182197#endif
    183 #if H_3D_INTER_SDC
     198#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    184199  m_cInterSDCFlagSCModel.initBuffer       ( sliceType, qp, (UChar*)INIT_INTER_SDC_FLAG );
    185200  m_cInterSDCResidualSCModel.initBuffer   ( sliceType, qp, (UChar*)INIT_INTER_SDC_RESIDUAL );
    186201  m_cInterSDCResidualSignFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_INTER_SDC_SIGN_FLAG );
     202#endif
     203#if QC_SDC_UNIFY_G0130
     204  m_cSDCFlagSCModel.initBuffer            ( sliceType, qp, (UChar*)INIT_SDC_FLAG );
    187205#endif
    188206#if H_3D_DBBP
     
    245263  m_cDdcFlagSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_DDC_FLAG );
    246264  m_cDdcDataSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_DDC_DATA );
     265#if QC_GENERIC_SDC_G0122
     266  m_cAngleFlagSCModel.initBuffer         ( eSliceType, iQp, (UChar*)INIT_ANGLE_FLAG );
     267#if !QC_SDC_UNIFY_G0130
     268  m_cIntraSdcFlagSCModel.initBuffer      ( eSliceType, iQp, (UChar*)INIT_INTRASDC_FLAG );
     269#endif
     270#endif
    247271#if H_3D_DIM_DMM
    248272  m_cDmm1DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM1_DATA );
     
    253277#endif
    254278#endif
    255 #if H_3D_INTER_SDC
     279#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    256280  m_cInterSDCFlagSCModel.initBuffer       ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_FLAG );
    257281  m_cInterSDCResidualSCModel.initBuffer   ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_RESIDUAL );
    258282  m_cInterSDCResidualSignFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_SIGN_FLAG );
     283#endif
     284#if QC_SDC_UNIFY_G0130
     285  m_cSDCFlagSCModel.initBuffer            ( eSliceType, iQp, (UChar*)INIT_SDC_FLAG );
    259286#endif
    260287#if H_3D_DBBP
     
    10181045    if( pcCU->getLumaIntraDir( absPartIdx+partOffset*j ) < NUM_INTRA_MODE )
    10191046#if H_3D_DIM_SDC
     1047#if QC_GENERIC_SDC_G0122
     1048      if( 1 ) // This should be cleaned up.
     1049#else
    10201050      if( !pcCU->getSDCFlag( absPartIdx+partOffset*j ) )
     1051#endif
    10211052#endif
    10221053    {
     
    10361067    if( pcCU->getLumaIntraDir( absPartIdx+partOffset*j ) < NUM_INTRA_MODE )
    10371068#if H_3D_DIM_SDC
     1069#if QC_GENERIC_SDC_G0122
     1070      if( 1 )  // This should be cleaned up.
     1071#else
    10381072      if( !pcCU->getSDCFlag( absPartIdx+partOffset*j ) )
     1073#endif
    10391074#endif
    10401075    {
     
    11391174  }
    11401175
     1176#if !QC_SDC_UNIFY_G0130
    11411177  if( dimType < DIM_NUM_TYPE || pcCU->getSDCFlag( absPartIdx ) )
    11421178  {
    11431179    UInt symbol;
     1180#if QC_GENERIC_SDC_G0122
     1181    UInt uiNumSegments = isDimMode( dir ) ? 2 : 1;
     1182#else
    11441183    UInt uiNumSegments = ( dir == PLANAR_IDX ) ? 1 : 2;
     1184#endif
    11451185
    11461186    if( pcCU->getSDCFlag( absPartIdx ) )
     
    11781218    }
    11791219  }
    1180 
     1220#endif
    11811221  pcCU->setLumaIntraDirSubParts( (UChar)dir, absPartIdx, depth );
    11821222}
    11831223
     1224#if QC_GENERIC_SDC_G0122
     1225Void TDecSbac::parseIntraDepthMode( TComDataCU* pcCU, UInt absPartIdx, UInt depth )
     1226{
     1227  UInt uiSymbol, uiIsDimMode;
     1228
     1229  if( ( pcCU->getSlice()->getSPS()->getMaxCUWidth() >> pcCU->getDepth( absPartIdx ) ) < 64 ) //DMM and HEVC intra modes are both allowed
     1230  {
     1231    m_pcTDecBinIf->decodeBin( uiSymbol, m_cAngleFlagSCModel.get( 0, 0, pcCU->getCtxAngleFlag( absPartIdx ) ) );
     1232  }
     1233  else
     1234  {
     1235    uiSymbol = 1;
     1236  }
     1237  uiIsDimMode = uiSymbol ? 0 : 1;
     1238  pcCU->setLumaIntraDirSubParts( 0, absPartIdx, depth );
     1239#if !QC_SDC_UNIFY_G0130
     1240  if( pcCU->getPartitionSize( absPartIdx ) == SIZE_2Nx2N ) //SDC is allowed only in this case
     1241  {
     1242    m_pcTDecBinIf->decodeBin( uiSymbol, m_cIntraSdcFlagSCModel.get( 0, 0, pcCU->getCtxSDCFlag( absPartIdx ) ) );
     1243  }
     1244  else
     1245  {
     1246    uiSymbol = 0;
     1247  }
     1248
     1249  pcCU->setSDCFlagSubParts( uiSymbol, absPartIdx, depth );
     1250#endif
     1251  //decode DMM index
     1252  if( uiIsDimMode )
     1253  {
     1254    m_pcTDecBinIf->decodeBin( uiSymbol, m_cDepthIntraModeSCModel.get( 0, 0, 0 ) );
     1255    if( !uiSymbol )
     1256    {
     1257      pcCU->setLumaIntraDirSubParts( ( 2 * DMM1_IDX + DIM_OFFSET ), absPartIdx, depth );
     1258    }
     1259    else
     1260    {
     1261      pcCU->setLumaIntraDirSubParts( ( 2 * DMM4_IDX + DIM_OFFSET ), absPartIdx, depth );
     1262    }
     1263  }
     1264}
     1265#else
    11841266Void TDecSbac::parseIntraDepthMode( TComDataCU* pcCU, UInt absPartIdx, UInt depth )
    11851267{
     
    12441326#endif
    12451327}
     1328#endif
    12461329#endif
    12471330
     
    21982281
    21992282#if H_3D_INTER_SDC
     2283#if QC_SDC_UNIFY_G0130
     2284Void TDecSbac::parseDeltaDC( TComDataCU* pcCU, UInt absPartIdx, UInt depth )
     2285{
     2286  if( ! ( pcCU->getSDCFlag( absPartIdx ) || ( pcCU->isIntra( absPartIdx ) && getDimType( pcCU->getLumaIntraDir( absPartIdx ) ) < DIM_NUM_TYPE ) ) )
     2287  {
     2288    assert( 0 );
     2289  }
     2290
     2291  UInt symbol = 0;
     2292  UInt uiNumSegments = 0;
     2293
     2294  if( pcCU->isIntra( absPartIdx ) )
     2295  {
     2296    UInt dir     = pcCU->getLumaIntraDir( absPartIdx );
     2297    uiNumSegments = isDimMode( dir ) ? 2 : 1;
     2298
     2299    m_pcTDecBinIf->decodeBin( symbol, m_cDdcFlagSCModel.get( 0, 0, uiNumSegments-1 ) );
     2300
     2301    if( pcCU->getSDCFlag( absPartIdx ) )
     2302    {
     2303      assert( pcCU->getPartitionSize( absPartIdx ) == SIZE_2Nx2N );
     2304      pcCU->setTrIdxSubParts( 0, absPartIdx, depth );
     2305      pcCU->setCbfSubParts( 1, 1, 1, absPartIdx, depth );
     2306    }
     2307    else
     2308    {
     2309      pcCU->setLumaIntraDirSubParts( dir + symbol, absPartIdx, depth );
     2310    }
     2311  }
     2312  else
     2313  {
     2314#if SEC_INTER_SDC_G0101
     2315    uiNumSegments = 1;
     2316#else
     2317    PartSize cPartSize = pcCU->getPartitionSize( absPartIdx );
     2318    uiNumSegments = ( cPartSize == SIZE_2Nx2N ) ? 1 : ( cPartSize == SIZE_NxN ? 4 : 2 );
     2319#endif
     2320    symbol = 1;
     2321  }
     2322
     2323
     2324  for( UInt segment = 0; segment < uiNumSegments; segment++ )
     2325  {
     2326    Pel valDeltaDC = 0;
     2327    if( symbol )
     2328    {
     2329      xParseDimDeltaDC( valDeltaDC, uiNumSegments );
     2330    }
     2331
     2332    if( pcCU->isIntra( absPartIdx ) )
     2333    {
     2334      UInt dir     = pcCU->getLumaIntraDir( absPartIdx );
     2335
     2336      if( pcCU->getSDCFlag( absPartIdx ) )
     2337      {
     2338        pcCU->setSDCSegmentDCOffset( valDeltaDC, segment, absPartIdx );
     2339      }
     2340      else
     2341      {
     2342        pcCU->setDimDeltaDC( getDimType( dir ), segment, absPartIdx, valDeltaDC );
     2343      }
     2344    }
     2345    else
     2346    {
     2347      pcCU->setSDCSegmentDCOffset( valDeltaDC, segment, absPartIdx );
     2348    }
     2349  }
     2350}
     2351
     2352Void TDecSbac::parseSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
     2353{
     2354  UInt uiSymbol = 0;
     2355  UInt uiCtxSDCFlag = pcCU->getCtxSDCFlag( uiAbsPartIdx );
     2356
     2357  m_pcTDecBinIf->decodeBin( uiSymbol, m_cSDCFlagSCModel.get( 0, 0, uiCtxSDCFlag ) );
     2358
     2359  if( uiSymbol )
     2360  {
     2361    pcCU->setSDCFlagSubParts( true, uiAbsPartIdx, uiDepth );
     2362    pcCU->setTrIdxSubParts( 0, uiAbsPartIdx, uiDepth );
     2363    pcCU->setCbfSubParts( 1, 1, 1, uiAbsPartIdx, uiDepth );
     2364  }
     2365  else
     2366  {
     2367    pcCU->setSDCFlagSubParts( false, uiAbsPartIdx, uiDepth );
     2368  }
     2369}
     2370#else
    22002371Void TDecSbac::parseInterSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    22012372{
     
    22312402  pcCU->setInterSDCSegmentDCOffset( iIdx, uiSegment, uiAbsPartIdx );
    22322403}
     2404#endif
    22332405#endif
    22342406
Note: See TracChangeset for help on using the changeset viewer.