Changeset 758 in 3DVCSoftware for trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp


Ignore:
Timestamp:
3 Jan 2014, 17:43:40 (10 years ago)
Author:
tech
Message:

Merged HTM-9.1-dev0-MediaTek@757. (3D-HEVC HLS)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r738 r758  
    215215}
    216216
     217#if DLT_DIFF_CODING_IN_PPS
     218Void TDecCavlc::parsePPS(TComPPS* pcPPS, TComVPS* pcVPS )
     219#else
    217220Void TDecCavlc::parsePPS(TComPPS* pcPPS)
     221#endif
    218222{
    219223#if ENC_DEC_TRACE 
     
    364368  if (uiCode)
    365369  {
    366     while ( xMoreRbspData() )
    367     {
    368       READ_FLAG( uiCode, "pps_extension_data_flag");
    369     }
    370   }
    371 }
     370#if DLT_DIFF_CODING_IN_PPS
     371    parsePPSExtension( pcPPS, pcVPS );
     372    READ_FLAG( uiCode, "pps_extension2_flag");
     373    if ( uiCode )
     374    {
     375#endif
     376      while ( xMoreRbspData() )
     377      {
     378        READ_FLAG( uiCode, "pps_extension_data_flag");
     379      }
     380#if DLT_DIFF_CODING_IN_PPS
     381    }
     382#endif
     383  }
     384}
     385
     386#if DLT_DIFF_CODING_IN_PPS
     387Void TDecCavlc::parsePPSExtension( TComPPS* pcPPS, TComVPS* pcVPS )
     388{
     389  UInt uiCode = 0;
     390  TComDLT* pcDLT = new TComDLT;
     391
     392  READ_FLAG(uiCode, "dlt_present_flag");
     393  pcDLT->setDltPresentFlag( (uiCode == 1) ? true : false );
     394
     395  if ( pcDLT->getDltPresentFlag() )
     396  {
     397    READ_CODE(6, uiCode, "pps_depth_layers_minus1");
     398    pcDLT->setNumDepthViews( uiCode );
     399
     400    READ_CODE(4, uiCode, "pps_bit_depth_for_depth_views_minus8");
     401    pcDLT->setDepthViewBitDepth( (uiCode+8) );
     402
     403    for( Int i = 0; i <= pcVPS->getMaxLayersMinus1(); i++ )
     404    {
     405      if ( i != 0 )
     406      {
     407        if( pcVPS->getDepthId( i ) == 1 )
     408        {
     409          READ_FLAG(uiCode, "dlt_flag[i]");
     410          pcDLT->setUseDLTFlag(i, (uiCode == 1) ? true : false);
     411
     412          if ( pcDLT->getUseDLTFlag( i ) )
     413          {
     414            Bool bDltBitMapRepFlag    = false;
     415            UInt uiMaxDiff            = 0xffffffff;
     416            UInt uiMinDiff            = 0;
     417            UInt uiCodeLength         = 0;
     418
     419            READ_FLAG(uiCode, "inter_view_dlt_pred_enable_flag[ i ]");
     420            pcDLT->setInterViewDltPredEnableFlag( i, (uiCode == 1) ? true : false );
     421
     422            if ( pcDLT->getInterViewDltPredEnableFlag( i ) == false )
     423            {
     424              READ_FLAG(uiCode, "dlt_bit_map_rep_flag[ layerId ]");
     425              bDltBitMapRepFlag = (uiCode == 1) ? true : false;
     426            }
     427            else
     428            {
     429              bDltBitMapRepFlag = false;
     430            }
     431           
     432            UInt uiNumDepthValues = 0;
     433            Int  aiIdx2DepthValue[256];
     434
     435            // Bit map
     436            if ( bDltBitMapRepFlag )
     437            {
     438              for (UInt d=0; d<256; d++)
     439              {
     440                READ_FLAG(uiCode, "dlt_bit_map_flag[ layerId ][ j ]");
     441                if (uiCode == 1)
     442                {
     443                  aiIdx2DepthValue[uiNumDepthValues] = d;
     444                  uiNumDepthValues++;
     445                }
     446              }
     447            }
     448            // Diff Coding
     449            else
     450            {
     451              READ_CODE(8, uiNumDepthValues, "num_depth_values_in_dlt[i]");   // num_entry
     452
     453#if !H_3D_DELTA_DLT
     454              if ( pcDLT->getInterViewDltPredEnableFlag( i ) == false )       // Single-view DLT Diff Coding
     455#endif
     456              {
     457                // The condition if( pcVPS->getNumDepthValues(i) > 0 ) is always true since for Single-view Diff Coding, there is at least one depth value in depth component.
     458
     459                if (uiNumDepthValues > 1)
     460                {
     461                  READ_CODE(8, uiCode, "max_diff[ layerId ]");
     462                  uiMaxDiff = uiCode;
     463                }
     464                else
     465                {
     466                  uiMaxDiff = 0;           // when there is only one value in DLT
     467                }
     468
     469                if (uiNumDepthValues > 2)
     470                {
     471                  uiCodeLength = (UInt) ceil(Log2(uiMaxDiff + 1));
     472                  READ_CODE(uiCodeLength, uiCode, "min_diff_minus1[ layerId ]");
     473                  uiMinDiff = uiCode + 1;
     474                }
     475                else
     476                {
     477                  uiMinDiff = uiMaxDiff;   // when there are only one or two values in DLT
     478                }
     479
     480                READ_CODE(8, uiCode, "dlt_depth_value0[layerId]");   // entry0
     481                aiIdx2DepthValue[0] = uiCode;
     482
     483                if (uiMaxDiff == uiMinDiff)
     484                {
     485                  for (UInt d=1; d<uiNumDepthValues; d++)
     486                  {
     487                    aiIdx2DepthValue[d] = aiIdx2DepthValue[d-1] + uiMinDiff + 0;
     488                  }
     489                }
     490                else
     491                {
     492                  uiCodeLength = (UInt) ceil(Log2(uiMaxDiff - uiMinDiff + 1));
     493                  for (UInt d=1; d<uiNumDepthValues; d++)
     494                  {
     495                    READ_CODE(uiCodeLength, uiCode, "dlt_depth_value_diff_minus_min[ layerId ][ j ]");
     496                    aiIdx2DepthValue[d] = aiIdx2DepthValue[d-1] + uiMinDiff + uiCode;
     497                  }
     498                }
     499
     500              }
     501            }
     502           
     503#if H_3D_DELTA_DLT
     504            if( pcDLT->getInterViewDltPredEnableFlag( i ) )
     505            {
     506              // interpret decoded values as delta DLT
     507              AOF( pcVPS->getDepthId( 1 ) == 1 );
     508              AOF( i > 1 );
     509              // assumes ref layer id to be 1
     510              Int* piRefDLT = pcDLT->idx2DepthValue( 1 );
     511              UInt uiRefNum = pcDLT->getNumDepthValues( 1 );
     512              pcDLT->setDeltaDLT(i, piRefDLT, uiRefNum, aiIdx2DepthValue, uiNumDepthValues);
     513            }
     514            else
     515            {
     516              // store final DLT
     517              pcDLT->setDepthLUTs(i, aiIdx2DepthValue, uiNumDepthValues);
     518            }
     519#else
     520            // store final DLT
     521            pcDLT->setDepthLUTs(i, aiIdx2DepthValue, uiNumDepthValues);
     522#endif
     523          }
     524        }
     525      }
     526    }
     527  }
     528
     529  pcPPS->setDLT( pcDLT );
     530}
     531#endif
    372532
    373533Void  TDecCavlc::parseVUI(TComVUI* pcVUI, TComSPS *pcSPS)
     
    8891049#endif
    8901050
     1051#if !CAM_HLS_F0136_F0045_F0082
    8911052  UInt uiCamParPrecision = 0;
    8921053  Bool bCamParSlice      = false;
     
    9081069  }
    9091070  pcSPS->initCamParaSPS( viewIndex, uiCamParPrecision, bCamParSlice, m_aaiTempScale, m_aaiTempOffset );
     1071#endif
    9101072}
    9111073#endif
     
    10191181#if H_3D
    10201182      m_pcBitstream->readOutTrailingBits();
     1183#if CAM_HLS_F0136_F0045_F0082
     1184      pcVPS->createCamPars(pcVPS->getNumViews());
     1185#endif
    10211186      parseVPSExtension2( pcVPS );   
    10221187      READ_FLAG( uiCode,  "vps_extension3_flag" );
     
    17381903        //          READ_FLAG( uiCode, "lim_qt_pred_flag[i]");                  pcVPS->setLimQtPreFlag     ( i, uiCode == 1 ? true : false );
    17391904#if H_3D_DIM_DLT
     1905#if !DLT_DIFF_CODING_IN_PPS
    17401906        if( pcVPS->getVpsDepthModesFlag( i ) )
    17411907        {
     
    17631929        }
    17641930#endif
     1931#endif
    17651932#if H_3D_INTER_SDC
    17661933            READ_FLAG( uiCode, "depth_inter_SDC_flag" );              pcVPS->setInterSDCFlag( i, uiCode ? true : false );
     
    17691936    }
    17701937  }
     1938#if CAM_HLS_F0136_F0045_F0082
     1939  UInt uiCamParPrecision = 0;
     1940  Bool bCamParSlice      = false;
     1941  Bool bCamParPresentFlag = false;
     1942
     1943  READ_UVLC( uiCamParPrecision, "cp_precision" );
     1944  for (UInt viewIndex=0; viewIndex<pcVPS->getNumViews(); viewIndex++)
     1945  {
     1946    READ_FLAG( uiCode, "cp_present_flag[i]" );                  bCamParPresentFlag = ( uiCode == 1);
     1947    if ( bCamParPresentFlag )
     1948    {
     1949      READ_FLAG( uiCode, "cp_in_slice_segment_header_flag[i]" );          bCamParSlice = ( uiCode == 1);
     1950      if ( !bCamParSlice )
     1951      {
     1952        for( UInt uiBaseIndex = 0; uiBaseIndex < viewIndex; uiBaseIndex++ )
     1953        {
     1954          Int iCode;
     1955          READ_SVLC( iCode, "vps_cp_scale" );                m_aaiTempScale  [ uiBaseIndex ][ viewIndex ]   = iCode;
     1956          READ_SVLC( iCode, "vps_cp_off" );                  m_aaiTempOffset [ uiBaseIndex ][ viewIndex ]   = iCode;
     1957          READ_SVLC( iCode, "vps_cp_inv_scale_plus_scale" ); m_aaiTempScale  [ viewIndex   ][ uiBaseIndex ] = iCode - m_aaiTempScale [ uiBaseIndex ][ viewIndex ];
     1958          READ_SVLC( iCode, "vps_cp_inv_off_plus_off" );     m_aaiTempOffset [ viewIndex   ][ uiBaseIndex ] = iCode - m_aaiTempOffset[ uiBaseIndex ][ viewIndex ];
     1959        }
     1960      }
     1961      pcVPS->initCamParaVPS( viewIndex, bCamParPresentFlag, uiCamParPrecision, bCamParSlice, m_aaiTempScale, m_aaiTempOffset );
     1962    }
     1963  }
     1964#endif
    17711965  READ_FLAG( uiCode, "iv_mv_scaling_flag");                       pcVPS->setIvMvScalingFlag( uiCode == 1 ? true : false );
    17721966}
     
    24952689  }
    24962690
     2691#if CAM_HLS_F0044
     2692#if CAM_HLS_F0136_F0045_F0082
     2693  if( rpcSlice->getVPS()->hasCamParInSliceHeader( rpcSlice->getViewIndex() )  && !rpcSlice->getIsDepth() )
     2694#else
     2695  if( rpcSlice->getSPS()->hasCamParInSliceHeader() )
     2696#endif
     2697  {
     2698    UInt uiViewIndex = rpcSlice->getViewIndex();
     2699    for( UInt uiBaseIndex = 0; uiBaseIndex < uiViewIndex; uiBaseIndex++ )
     2700    {
     2701      READ_SVLC( iCode, "cp_scale" );                m_aaiTempScale [ uiBaseIndex ][ uiViewIndex ] = iCode;
     2702      READ_SVLC( iCode, "cp_off" );                  m_aaiTempOffset[ uiBaseIndex ][ uiViewIndex ] = iCode;
     2703      READ_SVLC( iCode, "cp_inv_scale_plus_scale" ); m_aaiTempScale [ uiViewIndex ][ uiBaseIndex ] = iCode - m_aaiTempScale [ uiBaseIndex ][ uiViewIndex ];
     2704      READ_SVLC( iCode, "cp_inv_off_plus_off" );     m_aaiTempOffset[ uiViewIndex ][ uiBaseIndex ] = iCode - m_aaiTempOffset[ uiBaseIndex ][ uiViewIndex ];
     2705    }
     2706    rpcSlice->setCamparaSlice( m_aaiTempScale, m_aaiTempOffset );
     2707  }
     2708
     2709#endif
     2710
    24972711  if(pps->getSliceHeaderExtensionPresentFlag())
    24982712  {
    24992713    READ_UVLC(uiCode,"slice_header_extension_length");
    2500 #if H_3D
     2714#if H_3D && !CAM_HLS_F0044
     2715#if CAM_HLS_F0136_F0045_F0082
     2716    if( rpcSlice->getVPS()->hasCamParInSliceHeader( rpcSlice->getViewIndex() )  && !rpcSlice->getIsDepth() )
     2717#else
    25012718    if( rpcSlice->getSPS()->hasCamParInSliceHeader() )
     2719#endif
    25022720    {
    25032721      UInt uiViewIndex = rpcSlice->getViewIndex();
Note: See TracChangeset for help on using the changeset viewer.