Changeset 713 in SHVCSoftware for trunk/source/Lib/TLibDecoder


Ignore:
Timestamp:
21 Apr 2014, 04:44:16 (11 years ago)
Author:
seregin
Message:

merge with SHM-6-dev

Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/source

  • trunk/source/Lib/TLibDecoder/AnnexBread.h

    r595 r713  
    6565  , m_Input(istream)
    6666  {
    67     istream.exceptions(std::istream::eofbit);
     67    istream.exceptions(std::istream::eofbit | std::istream::badbit);
    6868  }
    6969
  • trunk/source/Lib/TLibDecoder/SEIread.cpp

    r644 r713  
    9393    fprintf( g_hTrace, "===========Tone Mapping Info SEI message ===========\n");
    9494    break;
     95#if Q0074_SEI_COLOR_MAPPING
     96  case SEI::COLOR_MAPPING_INFO:
     97    fprintf( g_hTrace, "===========Color Mapping Info SEI message ===========\n");
     98    break;
     99#endif
    95100  case SEI::SOP_DESCRIPTION:
    96101    fprintf( g_hTrace, "=========== SOP Description SEI message ===========\n");
     
    280285      xParseSEIToneMappingInfo((SEIToneMappingInfo&) *sei, payloadSize);
    281286      break;
     287#if Q0074_SEI_COLOR_MAPPING
     288    case SEI::COLOR_MAPPING_INFO:
     289      sei = new SEIColorMappingInfo;
     290      xParseSEIColorMappingInfo((SEIColorMappingInfo&) *sei, payloadSize);
     291      break;
     292#endif
    282293    case SEI::SOP_DESCRIPTION:
    283294      sei = new SEISOPDescription;
     
    518529{
    519530  UInt val;
    520   READ_CODE(4, val, "active_vps_id");      sei.activeVPSId = val;
    521   READ_FLAG( val, "full_random_access_flag");  sei.m_fullRandomAccessFlag = val ? true : false;
    522   READ_FLAG( val, "no_param_set_update_flag"); sei.m_noParamSetUpdateFlag = val ? true : false;
     531  READ_CODE(4, val, "active_video_parameter_set_id");   sei.activeVPSId = val;
     532  READ_FLAG(   val, "self_contained_cvs_flag");         sei.m_selfContainedCvsFlag = val ? true : false;
     533  READ_FLAG(   val, "no_parameter_set_update_flag");    sei.m_noParameterSetUpdateFlag = val ? true : false;
    523534  READ_UVLC(   val, "num_sps_ids_minus1"); sei.numSpsIdsMinus1 = val;
    524535
    525   sei.activeSeqParamSetId.resize(sei.numSpsIdsMinus1 + 1);
     536  sei.activeSeqParameterSetId.resize(sei.numSpsIdsMinus1 + 1);
    526537  for (Int i=0; i < (sei.numSpsIdsMinus1 + 1); i++)
    527538  {
    528     READ_UVLC(val, "active_seq_param_set_id");  sei.activeSeqParamSetId[i] = val;
    529   }
    530 
    531   UInt uibits = m_pcBitstream->getNumBitsUntilByteAligned();
    532  
    533   while(uibits--)
    534   {
    535     READ_FLAG(val, "alignment_bit");
    536   }
     539    READ_UVLC(val, "active_seq_parameter_set_id");      sei.activeSeqParameterSetId[i] = val;
     540  }
     541
     542  xParseByteAlign();
    537543}
    538544
     
    812818    case 4:
    813819      {
    814         READ_CODE( 8, val, "camera_iso_speed_idc" );                     sei.m_cameraIsoSpeedValue = val;
    815         if( sei.m_cameraIsoSpeedValue == 255) //Extended_ISO
     820        READ_CODE( 8, val, "camera_iso_speed_idc" );                     sei.m_cameraIsoSpeedIdc = val;
     821        if( sei.m_cameraIsoSpeedIdc == 255) //Extended_ISO
    816822        {
    817823          READ_CODE( 32,   val,   "camera_iso_speed_value" );            sei.m_cameraIsoSpeedValue = val;
     824        }
     825        READ_CODE( 8, val, "exposure_index_idc" );                       sei.m_exposureIndexIdc = val;
     826        if( sei.m_exposureIndexIdc == 255) //Extended_ISO
     827        {
     828          READ_CODE( 32,   val,   "exposure_index_value" );              sei.m_exposureIndexValue = val;
    818829        }
    819830        READ_FLAG( val, "exposure_compensation_value_sign_flag" );       sei.m_exposureCompensationValueSignFlag = val;
     
    837848  xParseByteAlign();
    838849}
     850
     851#if Q0074_SEI_COLOR_MAPPING
     852Void SEIReader::xParseSEIColorMappingInfo(SEIColorMappingInfo& sei, UInt /*payloadSize*/)
     853{
     854  UInt  uiVal;
     855  Int   iVal;
     856
     857  READ_UVLC( uiVal, "colour_map_id" );          sei.m_colorMapId = uiVal;
     858  READ_FLAG( uiVal, "colour_map_cancel_flag" ); sei.m_colorMapCancelFlag = uiVal;
     859  if( !sei.m_colorMapCancelFlag )
     860  {
     861    READ_FLAG( uiVal, "colour_map_persistence_flag" );                sei.m_colorMapPersistenceFlag = uiVal;
     862    READ_FLAG( uiVal, "colour_map_video_signal_type_present_flag" );  sei.m_colorMap_video_signal_type_present_flag = uiVal;
     863    if ( sei.m_colorMap_video_signal_type_present_flag ) {
     864      READ_FLAG( uiVal,     "colour_map_video_full_range_flag" );     sei.m_colorMap_video_full_range_flag = uiVal;
     865      READ_CODE( 8, uiVal,  "colour_map_primaries" );                 sei.m_colorMap_primaries = uiVal;
     866      READ_CODE( 8, uiVal,  "colour_map_transfer_characteristics" );  sei.m_colorMap_transfer_characteristics = uiVal;
     867      READ_CODE( 8, uiVal,  "colour_map_matrix_coeffs" );             sei.m_colorMap_matrix_coeffs = uiVal;
     868    }
     869  }
     870
     871  READ_CODE( 5, uiVal,  "colour_map_coded_data_bit_depth" );  sei.m_colour_map_coded_data_bit_depth = uiVal;
     872  READ_CODE( 5, uiVal,  "colour_map_target_bit_depth" );      sei.m_colour_map_target_bit_depth = uiVal;
     873  READ_UVLC( uiVal, "colour_map_model_id" );                  sei.m_colorMapModelId = uiVal;
     874
     875  assert( sei.m_colorMapModelId == 0 );
     876 
     877  for( Int i=0 ; i<3 ; i++ )
     878  {
     879    READ_CODE( 8, uiVal, "num_input_pivots_minus1[i]" ); sei.m_num_input_pivots[i] = (uiVal==0) ? 2 : (uiVal + 1) ;
     880    sei.m_coded_input_pivot_value[i]   = new Int[ sei.m_num_input_pivots[i] ];
     881    sei.m_target_input_pivot_value[i]  = new Int[ sei.m_num_input_pivots[i] ];
     882    if( uiVal > 0 )
     883    {
     884      for ( Int j=0 ; j<sei.m_num_input_pivots[i] ; j++ )
     885      {
     886        READ_CODE( (( sei.m_colour_map_coded_data_bit_depth + 7 ) >> 3 ) << 3, uiVal, "coded_input_pivot_value[i][j]" );  sei.m_coded_input_pivot_value[i][j] = uiVal;
     887        READ_CODE( (( sei.m_colour_map_coded_data_bit_depth + 7 ) >> 3 ) << 3, uiVal, "target_input_pivot_value[i][j]" ); sei.m_target_input_pivot_value[i][j] = uiVal;
     888      }
     889    }
     890    else
     891    {
     892      sei.m_coded_input_pivot_value[i][0]  = 0;
     893      sei.m_target_input_pivot_value[i][0] = 0;
     894      sei.m_coded_input_pivot_value[i][1]  = (1 << sei.m_colour_map_coded_data_bit_depth) - 1 ;
     895      sei.m_target_input_pivot_value[i][1] = (1 << sei.m_colour_map_target_bit_depth) - 1 ;
     896    }
     897  }
     898
     899  READ_FLAG( uiVal,           "matrix_flag" ); sei.m_matrix_flag = uiVal;
     900  if( sei.m_matrix_flag )
     901  {
     902    READ_CODE( 4, uiVal,         "log2_matrix_denom" ); sei.m_log2_matrix_denom = uiVal;
     903    for ( Int i=0 ; i<3 ; i++ )
     904    {
     905      for ( Int j=0 ; j<3 ; j++ )
     906      {
     907        READ_SVLC( iVal,        "matrix_coef[i][j]" ); sei.m_matrix_coef[i][j] = iVal;
     908      }
     909    }
     910  }
     911
     912  for ( Int i=0 ; i<3 ; i++ )
     913  {
     914    READ_CODE( 8, uiVal, "num_output_pivots_minus1[i]" ); sei.m_num_output_pivots[i] = (uiVal==0) ? 2 : (uiVal + 1) ;
     915    sei.m_coded_output_pivot_value[i]   = new Int[ sei.m_num_output_pivots[i] ];
     916    sei.m_target_output_pivot_value[i]  = new Int[ sei.m_num_output_pivots[i] ];
     917    if( uiVal > 0 )
     918    {
     919      for ( Int j=0 ; j<sei.m_num_output_pivots[i] ; j++ )
     920      {
     921        READ_CODE( (( sei.m_colour_map_coded_data_bit_depth + 7 ) >> 3 ) << 3, uiVal, "coded_output_pivot_value[i][j]" );  sei.m_coded_output_pivot_value[i][j] = uiVal;
     922        READ_CODE( (( sei.m_colour_map_coded_data_bit_depth + 7 ) >> 3 ) << 3, uiVal, "target_output_pivot_value[i][j]" ); sei.m_target_output_pivot_value[i][j] = uiVal;
     923      }
     924    }
     925    else
     926    {
     927      sei.m_coded_output_pivot_value[i][0]  = 0;
     928      sei.m_target_output_pivot_value[i][0] = 0;
     929      sei.m_coded_output_pivot_value[i][1]  = (1 << sei.m_colour_map_coded_data_bit_depth) - 1 ;
     930      sei.m_target_output_pivot_value[i][1] = (1 << sei.m_colour_map_target_bit_depth) - 1 ;
     931    }
     932  }
     933
     934  xParseByteAlign();
     935}
     936#endif
    839937
    840938Void SEIReader::xParseSEISOPDescription(SEISOPDescription &sei, UInt payloadSize)
  • trunk/source/Lib/TLibDecoder/SEIread.h

    r644 r713  
    9090  Void xParseSEIGradualDecodingRefreshInfo (SEIGradualDecodingRefreshInfo &sei, UInt payloadSize);
    9191  Void xParseSEIToneMappingInfo       (SEIToneMappingInfo& sei, UInt payloadSize);
     92#if Q0074_SEI_COLOR_MAPPING
     93  Void xParseSEIColorMappingInfo      (SEIColorMappingInfo& sei, UInt payloadSize);
     94#endif
    9295  Void xParseSEISOPDescription        (SEISOPDescription &sei, UInt payloadSize);
    9396#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
  • trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r649 r713  
    3939#include "SEIread.h"
    4040#include "TDecSlice.h"
     41#if Q0048_CGS_3D_ASYMLUT
     42#include "../TLibCommon/TCom3DAsymLUT.h"
     43#endif
    4144
    4245//! \ingroup TLibDecoder
     
    175178}
    176179
    177 Void TDecCavlc::parsePPS(TComPPS* pcPPS)
     180Void TDecCavlc::parsePPS(TComPPS* pcPPS
     181#if Q0048_CGS_3D_ASYMLUT
     182  , TCom3DAsymLUT * pc3DAsymLUT , Int nLayerID
     183#endif
     184  )
    178185{
    179186#if ENC_DEC_TRACE
     
    348355      READ_FLAG( uiCode, "poc_reset_info_present_flag" );
    349356      pcPPS->setPocResetInfoPresentFlag(uiCode ? true : false);
     357#if Q0048_CGS_3D_ASYMLUT
     358      READ_FLAG( uiCode , "colour_mapping_enabled_flag" );
     359      pcPPS->setCGSFlag( uiCode );
     360      if( pcPPS->getCGSFlag() )
     361      {
     362        xParse3DAsymLUT( pc3DAsymLUT );
     363        pcPPS->setCGSOutputBitDepthY( pc3DAsymLUT->getOutputBitDepthY() );
     364        pcPPS->setCGSOutputBitDepthC( pc3DAsymLUT->getOutputBitDepthC() );
     365      }
     366#endif
    350367#endif
    351368    }
     
    599616  else
    600617  {
     618#if REP_FORMAT_FIX
     619    pcSPS->setUpdateRepFormatFlag( false );
     620#else
    601621    pcSPS->setUpdateRepFormatFlag( true );
     622#endif
    602623  }
    603624#if O0096_REP_FORMAT_INDEX
     
    681702    for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++)
    682703    {
    683       READ_UVLC ( uiCode, "sps_max_dec_pic_buffering_minus1");
     704      READ_UVLC ( uiCode, "sps_max_dec_pic_buffering_minus1[i]");
    684705      pcSPS->setMaxDecPicBuffering( uiCode + 1, i);
    685       READ_UVLC ( uiCode, "sps_num_reorder_pics" );
     706      READ_UVLC ( uiCode, "sps_num_reorder_pics[i]" );
    686707      pcSPS->setNumReorderPics(uiCode, i);
    687       READ_UVLC ( uiCode, "sps_max_latency_increase_plus1");
     708      READ_UVLC ( uiCode, "sps_max_latency_increase_plus1[i]");
    688709      pcSPS->setMaxLatencyIncrease( uiCode, i );
    689710
     
    887908  READ_CODE( 6,  uiCode,  "vps_reserved_zero_6bits" );            assert(uiCode == 0);
    888909#endif
    889   READ_CODE( 3,  uiCode,  "vps_max_sub_layers_minus1" );          pcVPS->setMaxTLayers( uiCode + 1 ); assert(uiCode <= 6);
     910  READ_CODE( 3,  uiCode,  "vps_max_sub_layers_minus1" );          pcVPS->setMaxTLayers( uiCode + 1 ); assert(uiCode+1 <= MAX_TLAYER);
    890911  READ_FLAG(     uiCode,  "vps_temporal_id_nesting_flag" );       pcVPS->setTemporalNestingFlag( uiCode ? true:false );
    891912  assert (pcVPS->getMaxTLayers()>1||pcVPS->getTemporalNestingFlag());
     
    973994    }
    974995  }
    975   READ_FLAG( uiCode,  "vps_extension_flag" );
    976   if (uiCode)
    977   {
     996
    978997#if VPS_EXTNS
     998  READ_FLAG( uiCode,  "vps_extension_flag" );      pcVPS->setVpsExtensionFlag( uiCode ? true : false );
     999
     1000  // When MaxLayersMinus1 is greater than 0, vps_extension_flag shall be equal to 1.
     1001  if( pcVPS->getMaxLayers() > 1 )
     1002  {
     1003    assert( pcVPS->getVpsExtensionFlag() == true );
     1004  }
     1005
     1006  if( pcVPS->getVpsExtensionFlag()  )
     1007  {
    9791008    while ( m_pcBitstream->getNumBitsRead() % 8 != 0 )
    9801009    {
     
    9901019      }
    9911020    }
    992 #else
     1021  }
     1022  else
     1023  {
     1024    // set default parameters when syntax elements are not present
     1025    defaultVPSExtension(pcVPS);   
     1026  }
     1027#else
     1028  READ_FLAG( uiCode,  "vps_extension_flag" );
     1029  if (uiCode)
     1030  {
    9931031    while ( xMoreRbspData() )
    9941032    {
    9951033      READ_FLAG( uiCode, "vps_extension_data_flag");
    9961034    }
    997 #endif
    998   }
     1035  }
     1036#endif
    9991037
    10001038  return;
     
    11291167#endif
    11301168#if VPS_TSLAYERS
    1131     READ_FLAG( uiCode, "vps_sub_layers_max_minus1_present_flag"); vps->setMaxTSLayersPresentFlag(uiCode ? true : false);
    1132     if (vps->getMaxTSLayersPresentFlag())
    1133     {
    1134         for(i = 0; i < vps->getMaxLayers(); i++)
    1135         {
    1136             READ_CODE( 3, uiCode, "sub_layers_vps_max_minus1[i]" ); vps->setMaxTSLayersMinus1(i, uiCode);
    1137         }
    1138     }
    1139     else
    1140     {
    1141         for( i = 0; i < vps->getMaxLayers(); i++)
    1142         {
    1143             vps->setMaxTSLayersMinus1(i, vps->getMaxTLayers()-1);
    1144         }
    1145     }
     1169  READ_FLAG( uiCode, "vps_sub_layers_max_minus1_present_flag"); vps->setMaxTSLayersPresentFlag(uiCode ? true : false);
     1170
     1171  if (vps->getMaxTSLayersPresentFlag())
     1172  {
     1173    for(i = 0; i < vps->getMaxLayers(); i++)
     1174    {
     1175      READ_CODE( 3, uiCode, "sub_layers_vps_max_minus1[i]" ); vps->setMaxTSLayersMinus1(i, uiCode);
     1176    }
     1177  }
     1178  else
     1179  {
     1180    for( i = 0; i < vps->getMaxLayers(); i++)
     1181    {
     1182      vps->setMaxTSLayersMinus1(i, vps->getMaxTLayers()-1);
     1183    }
     1184  }
    11461185#endif
    11471186#if N0120_MAX_TID_REF_PRESENT_FLAG
     
    12501289  }
    12511290#else
     1291
     1292#if Q0165_NUM_ADD_OUTPUT_LAYER_SETS
     1293  if( vps->getNumLayerSets() > 1 )
     1294  {
     1295    READ_UVLC( uiCode, "num_add_output_layer_sets" );            vps->setNumAddOutputLayerSets( uiCode );
     1296    READ_CODE( 2, uiCode, "default_target_output_layer_idc" );   vps->setDefaultTargetOutputLayerIdc( uiCode );
     1297  }
     1298  else
     1299  {
     1300    vps->setNumAddOutputLayerSets( 0 );
     1301  }
     1302#else
    12521303  READ_UVLC( uiCode, "num_add_output_layer_sets" );          vps->setNumAddOutputLayerSets( uiCode );
     1304#endif
     1305
     1306  // The value of num_add_output_layer_sets shall be in the range of 0 to 1023, inclusive.
     1307  assert( vps->getNumAddOutputLayerSets() >= 0 && vps->getNumAddOutputLayerSets() < 1024 );
     1308
    12531309  Int numOutputLayerSets = vps->getNumLayerSets() + vps->getNumAddOutputLayerSets();
    12541310#endif
    12551311
    12561312#if P0295_DEFAULT_OUT_LAYER_IDC
     1313#if !Q0165_NUM_ADD_OUTPUT_LAYER_SETS
    12571314  if( numOutputLayerSets > 1 )
    12581315  {
    12591316    READ_CODE( 2, uiCode, "default_target_output_layer_idc" );   vps->setDefaultTargetOutputLayerIdc( uiCode );
    12601317  }
     1318#endif
    12611319  vps->setNumOutputLayerSets( numOutputLayerSets );
    12621320
     
    13301388      vps->setAltOuputLayerFlag(i, uiCode ? true : false);
    13311389    }
     1390#if Q0165_OUTPUT_LAYER_SET
     1391    assert( NumOutputLayersInOutputLayerSet[i]>0 );
     1392#endif
     1393
    13321394#endif
    13331395  }
     
    14311493
    14321494#if REPN_FORMAT_IN_VPS
     1495#if Q0195_REP_FORMAT_CLEANUP
     1496  READ_UVLC( uiCode, "vps_num_rep_formats_minus1" );
     1497  vps->setVpsNumRepFormats( uiCode + 1 );
     1498
     1499  // The value of vps_num_rep_formats_minus1 shall be in the range of 0 to 255, inclusive.
     1500  assert( vps->getVpsNumRepFormats() > 0 && vps->getVpsNumRepFormats() <= 256 );
     1501
     1502  for(i = 0; i < vps->getVpsNumRepFormats(); i++)
     1503  {
     1504    // Read rep_format_structures
     1505    parseRepFormat( vps->getVpsRepFormat(i), i > 0 ? vps->getVpsRepFormat(i-1) : 0 );
     1506  }
     1507
     1508  // Default assignment for layer 0
     1509  vps->setVpsRepFormatIdx( 0, 0 );
     1510
     1511  if( vps->getVpsNumRepFormats() > 1 )
     1512  {
     1513    READ_FLAG( uiCode, "rep_format_idx_present_flag");
     1514    vps->setRepFormatIdxPresentFlag( uiCode ? true : false );
     1515  }
     1516  else
     1517  {
     1518    // When not present, the value of rep_format_idx_present_flag is inferred to be equal to 0
     1519    vps->setRepFormatIdxPresentFlag( false );
     1520  }
     1521
     1522  if( vps->getRepFormatIdxPresentFlag() )
     1523  {
     1524    for(i = 1; i < vps->getMaxLayers(); i++)
     1525    {
     1526      Int numBits = 1;
     1527      while ((1 << numBits) < (vps->getVpsNumRepFormats()))
     1528      {
     1529        numBits++;
     1530      }
     1531      READ_CODE( numBits, uiCode, "vps_rep_format_idx[i]" );
     1532      vps->setVpsRepFormatIdx( i, uiCode );
     1533    }
     1534  }
     1535  else
     1536  {
     1537    // When not present, the value of vps_rep_format_idx[ i ] is inferred to be equal to Min (i, vps_num_rep_formats_minus1)
     1538    for(i = 1; i < vps->getMaxLayers(); i++)
     1539    {
     1540      vps->setVpsRepFormatIdx( i, min( (Int)i, vps->getVpsNumRepFormats()-1 ) );
     1541    }
     1542  }
     1543#else
    14331544  READ_FLAG( uiCode, "rep_format_idx_present_flag");
    14341545  vps->setRepFormatIdxPresentFlag( uiCode ? true : false );
     
    14531564    vps->setVpsNumRepFormats( vps->getMaxLayers() );
    14541565  }
     1566
     1567  // The value of vps_num_rep_formats_minus1 shall be in the range of 0 to 255, inclusive.
     1568  assert( vps->getVpsNumRepFormats() > 0 && vps->getVpsNumRepFormats() <= 256 );
     1569
    14551570  for(i = 0; i < vps->getVpsNumRepFormats(); i++)
    14561571  {
    14571572    // Read rep_format_structures
    1458     parseRepFormat( vps->getVpsRepFormat(i) );
     1573    parseRepFormat( vps->getVpsRepFormat(i), i > 0 ? vps->getVpsRepFormat(i-1) : 0 );
    14591574  }
    14601575
     
    14981613    }
    14991614  }
     1615#endif
    15001616#endif
    15011617#if RESOLUTION_BASED_DPB
     
    15781694#if P0307_VPS_NON_VUI_EXTENSION
    15791695  READ_UVLC( uiCode,           "vps_non_vui_extension_length"); vps->setVpsNonVuiExtLength((Int)uiCode);
     1696
     1697  // The value of vps_non_vui_extension_length shall be in the range of 0 to 4096, inclusive.
     1698  assert( vps->getVpsNonVuiExtLength() >= 0 && vps->getVpsNonVuiExtLength() <= 4096 );
     1699
    15801700#if P0307_VPS_NON_VUI_EXT_UPDATE
    15811701  Int nonVuiExtByte = uiCode;
     
    16201740#endif
    16211741  }
    1622 }
    1623 #endif
     1742  else
     1743  {
     1744    // set default values for VPS VUI
     1745    defaultVPSVUI( vps );
     1746  }
     1747}
     1748
     1749Void TDecCavlc::defaultVPSExtension( TComVPS* vps )
     1750{
     1751  // set default parameters when they are not present
     1752  Int i, j;
     1753
     1754  // When layer_id_in_nuh[ i ] is not present, the value is inferred to be equal to i.
     1755  for(i = 0; i < vps->getMaxLayers(); i++)
     1756  {
     1757    vps->setLayerIdInNuh(i, i);
     1758    vps->setLayerIdInVps(vps->getLayerIdInNuh(i), i);
     1759  }
     1760
     1761  // When not present, sub_layers_vps_max_minus1[ i ] is inferred to be equal to vps_max_sub_layers_minus1.
     1762  for( i = 0; i < vps->getMaxLayers(); i++)
     1763  {
     1764    vps->setMaxTSLayersMinus1(i, vps->getMaxTLayers()-1);
     1765  }
     1766
     1767  // When not present, max_tid_il_ref_pics_plus1[ i ][ j ] is inferred to be equal to 7.
     1768  for( i = 0; i < vps->getMaxLayers() - 1; i++ )
     1769  {
     1770#if O0225_MAX_TID_FOR_REF_LAYERS
     1771    for( j = i + 1; j < vps->getMaxLayers(); j++ )
     1772    {
     1773      vps->setMaxTidIlRefPicsPlus1(i, j, 7);
     1774    }
     1775#else
     1776    vps->setMaxTidIlRefPicsPlus1(i, 7);
     1777#endif
     1778  }
     1779 
     1780  // When not present, the value of num_add_output_layer_sets is inferred to be equal to 0.
     1781  // NumOutputLayerSets = num_add_output_layer_sets + vps_num_layer_sets_minus1 + 1
     1782  vps->setNumOutputLayerSets( vps->getNumLayerSets() );
     1783
     1784  // For i in the range of 0 to NumOutputLayerSets-1, inclusive, the variable LayerSetIdxForOutputLayerSet[ i ] is derived as specified in the following:
     1785  // LayerSetIdxForOutputLayerSet[ i ] = ( i <= vps_number_layer_sets_minus1 ) ? i : output_layer_set_idx_minus1[ i ] + 1
     1786  for( i = 1; i < vps->getNumOutputLayerSets(); i++ )
     1787  {
     1788    vps->setOutputLayerSetIdx( i, i );
     1789    Int lsIdx = vps->getOutputLayerSetIdx(i);
     1790
     1791    for( j = 0; j < vps->getNumLayersInIdList(lsIdx); j++ )
     1792    {
     1793    vps->setOutputLayerFlag(i, j, 1);
     1794    }
     1795  }
     1796
     1797  // The value of sub_layer_dpb_info_present_flag[ i ][ 0 ] for any possible value of i is inferred to be equal to 1
     1798  // When not present, the value of sub_layer_dpb_info_present_flag[ i ][ j ] for j greater than 0 and any possible value of i, is inferred to be equal to be equal to 0.
     1799  for( i = 1; i < vps->getNumOutputLayerSets(); i++ )
     1800  {
     1801    vps->setSubLayerDpbInfoPresentFlag( i, 0, true );
     1802  }
     1803 
     1804  // When not present, the value of vps_num_rep_formats_minus1 is inferred to be equal to MaxLayersMinus1.
     1805  vps->setVpsNumRepFormats( vps->getMaxLayers() );
     1806
     1807  // When not present, the value of rep_format_idx_present_flag is inferred to be equal to 0
     1808  vps->setRepFormatIdxPresentFlag( false );
     1809
     1810  if( !vps->getRepFormatIdxPresentFlag() )
     1811  {
     1812    // When not present, the value of vps_rep_format_idx[ i ] is inferred to be equal to Min(i, vps_num_rep_formats_minus1).
     1813    for(i = 1; i < vps->getMaxLayers(); i++)
     1814    {
     1815      vps->setVpsRepFormatIdx( i, min( (Int)i, vps->getVpsNumRepFormats() - 1 ) );
     1816    }
     1817  }
     1818
     1819  // vps_poc_lsb_aligned_flag
     1820  // When not present, vps_poc_lsb_aligned_flag is inferred to be equal to 0.
     1821 
     1822#if O0062_POC_LSB_NOT_PRESENT_FLAG
     1823  // When not present, poc_lsb_not_present_flag[ i ] is inferred to be equal to 0.
     1824  for(i = 1; i< vps->getMaxLayers(); i++)
     1825  {
     1826    vps->setPocLsbNotPresentFlag(i, 0);
     1827  }
     1828#endif
     1829
     1830  // set default values for VPS VUI
     1831  defaultVPSVUI( vps );
     1832}
     1833
     1834Void TDecCavlc::defaultVPSVUI( TComVPS* vps )
     1835{
     1836#if N0147_IRAP_ALIGN_FLAG
     1837  // When not present, the value of all_layers_idr_aligned_flag is inferred to be equal to 0.
     1838  vps->setCrossLayerIrapAlignFlag( false );
     1839#endif
     1840
     1841#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     1842  // When single_layer_for_non_irap_flag is not present, it is inferred to be equal to 0.
     1843  vps->setSingleLayerForNonIrapFlag( false );
     1844#endif
     1845
     1846#if HIGHER_LAYER_IRAP_SKIP_FLAG
     1847  // When higher_layer_irap_skip_flag is not present it is inferred to be equal to 0
     1848  vps->setHigherLayerIrapSkipFlag( false );
     1849#endif
     1850}
     1851#endif
     1852
    16241853#if REPN_FORMAT_IN_VPS
    1625 Void  TDecCavlc::parseRepFormat      ( RepFormat *repFormat )
     1854Void  TDecCavlc::parseRepFormat( RepFormat *repFormat, RepFormat *repFormatPrev )
    16261855{
    16271856  UInt uiCode;
    1628 #if REPN_FORMAT_CONTROL_FLAG
    1629   READ_FLAG ( uiCode, "chroma_and_bit_depth_vps_present_flag");   repFormat->setChromaAndBitDepthVpsPresentFlag(uiCode ? true : false);
    1630   READ_CODE ( 16, uiCode, "pic_width_in_luma_samples" );          repFormat->setPicWidthVpsInLumaSamples ( uiCode );
    1631   READ_CODE ( 16, uiCode, "pic_height_in_luma_samples" );         repFormat->setPicHeightVpsInLumaSamples( uiCode );
     1857#if REPN_FORMAT_CONTROL_FLAG 
     1858  READ_CODE( 16, uiCode, "pic_width_vps_in_luma_samples" );        repFormat->setPicWidthVpsInLumaSamples ( uiCode );
     1859  READ_CODE( 16, uiCode, "pic_height_vps_in_luma_samples" );       repFormat->setPicHeightVpsInLumaSamples( uiCode );
     1860  READ_FLAG( uiCode, "chroma_and_bit_depth_vps_present_flag" );    repFormat->setChromaAndBitDepthVpsPresentFlag( uiCode ? true : false );
     1861
     1862  if( !repFormatPrev )
     1863  {
     1864    // The value of chroma_and_bit_depth_vps_present_flag of the first rep_format( ) syntax structure in the VPS shall be equal to 1
     1865    assert( repFormat->getChromaAndBitDepthVpsPresentFlag() );
     1866  }
    16321867
    16331868  if( repFormat->getChromaAndBitDepthVpsPresentFlag() )
    16341869  {
     1870    READ_CODE( 2, uiCode, "chroma_format_vps_idc" );
    16351871#if AUXILIARY_PICTURES
    1636     READ_CODE( 2, uiCode, "chroma_format_idc" );               repFormat->setChromaFormatVpsIdc( ChromaFormat(uiCode) );
    1637 #else
    1638     READ_CODE( 2, uiCode, "chroma_format_idc" );               repFormat->setChromaFormatVpsIdc( uiCode );
     1872    repFormat->setChromaFormatVpsIdc( ChromaFormat(uiCode) );
     1873#else
     1874    repFormat->setChromaFormatVpsIdc( uiCode );
    16391875#endif
    16401876
    16411877    if( repFormat->getChromaFormatVpsIdc() == 3 )
    16421878    {
    1643       READ_FLAG( uiCode, "separate_colour_plane_flag");        repFormat->setSeparateColourPlaneVpsFlag(uiCode ? true : false);
    1644     }
    1645 
    1646 
    1647     READ_CODE( 4, uiCode, "bit_depth_luma_minus8" );           repFormat->setBitDepthVpsLuma  ( uiCode + 8 );
    1648     READ_CODE( 4, uiCode, "bit_depth_chroma_minus8" );         repFormat->setBitDepthVpsChroma( uiCode + 8 );
     1879      READ_FLAG( uiCode, "separate_colour_plane_vps_flag" );       repFormat->setSeparateColourPlaneVpsFlag( uiCode ? true : false );
     1880    }
     1881
     1882    READ_CODE( 4, uiCode, "bit_depth_vps_luma_minus8" );           repFormat->setBitDepthVpsLuma  ( uiCode + 8 );
     1883    READ_CODE( 4, uiCode, "bit_depth_vps_chroma_minus8" );         repFormat->setBitDepthVpsChroma( uiCode + 8 );
     1884  }
     1885  else if( repFormatPrev )
     1886  {
     1887    // chroma_and_bit_depth_vps_present_flag equal to 0 specifies that the syntax elements, chroma_format_vps_idc, separate_colour_plane_vps_flag, bit_depth_vps_luma_minus8, and
     1888    // bit_depth_vps_chroma_minus8 are not present and inferred from the previous rep_format( ) syntax structure in the VPS.
     1889
     1890    repFormat->setChromaFormatVpsIdc        ( repFormatPrev->getChromaFormatVpsIdc() );
     1891    repFormat->setSeparateColourPlaneVpsFlag( repFormatPrev->getSeparateColourPlaneVpsFlag() );
     1892    repFormat->setBitDepthVpsLuma           ( repFormatPrev->getBitDepthVpsLuma() );
     1893    repFormat->setBitDepthVpsChroma         ( repFormatPrev->getBitDepthVpsChroma() );
    16491894  }
    16501895#else
     
    17001945    READ_FLAG( uiCode, "sub_layer_flag_info_present_flag[i]");  vps->setSubLayerFlagInfoPresentFlag( i, uiCode ? true : false );
    17011946#if DPB_PARAMS_MAXTLAYERS
    1702       for(Int j = 0; j <= MaxSubLayersInLayerSetMinus1[ i ]; j++)
     1947    for(Int j = 0; j <= MaxSubLayersInLayerSetMinus1[ i ]; j++)
    17031948#else
    17041949    for(Int j = 0; j <= vps->getMaxTLayers(); j++)
     
    18202065        if( parseFlag && vps->getBitRatePresentVpsFlag() )
    18212066        {
    1822           READ_FLAG( uiCode,        "bit_rate_present_vps_flag[i][j]" );  vps->setBitRatePresentFlag( i, j, uiCode ? true : false );
     2067          READ_FLAG( uiCode,        "bit_rate_present_flag[i][j]" );  vps->setBitRatePresentFlag( i, j, uiCode ? true : false );
    18232068        }
    18242069        else
     
    18282073        if( parseFlag && vps->getPicRatePresentVpsFlag() )
    18292074        {
    1830           READ_FLAG( uiCode,        "pic_rate_present_vps_flag[i][j]" );  vps->setPicRatePresentFlag( i, j, uiCode ? true : false );
     2075          READ_FLAG( uiCode,        "pic_rate_present_flag[i][j]" );  vps->setPicRatePresentFlag( i, j, uiCode ? true : false );
    18312076        }
    18322077        else
     
    18682113    vps->setNumVideoSignalInfo(vps->getMaxLayers());
    18692114  }
    1870 
    18712115
    18722116  for(i = 0; i < vps->getNumVideoSignalInfo(); i++)
     
    19542198#if HIGHER_LAYER_IRAP_SKIP_FLAG
    19552199  READ_FLAG(uiCode, "higher_layer_irap_skip_flag" ); vps->setHigherLayerIrapSkipFlag(uiCode == 1 ? true : false);
     2200
     2201  // When single_layer_for_non_irap_flag is equal to 0, higher_layer_irap_skip_flag shall be equal to 0
     2202  if( !vps->getSingleLayerForNonIrapFlag() )
     2203  {
     2204    assert( !vps->getHigherLayerIrapSkipFlag() );
     2205  }
    19562206#endif
    19572207#endif
     
    21022352  if( rpcSlice->getRapPicFlag())
    21032353  {
    2104 #if !NO_OUTPUT_OF_PRIOR_PICS
    2105     READ_FLAG( uiCode, "no_output_of_prior_pics_flag" );  //ignored
    2106 #else
    2107     READ_FLAG( uiCode, "no_output_of_prior_pics_flag" );  rpcSlice->setNoOutputOfPriorPicsFlag( uiCode ? true : false );
     2354    READ_FLAG( uiCode, "no_output_of_prior_pics_flag" );  //ignored -- updated already
     2355#if SETTING_NO_OUT_PIC_PRIOR
     2356    rpcSlice->setNoOutputPriorPicsFlag(uiCode ? true : false);
     2357#else
     2358    rpcSlice->setNoOutputPicPrior( false );
    21082359#endif
    21092360  }
     
    23052556        else
    23062557        {
    2307           uiCode = 0;
     2558          uiCode = 0;       
    23082559        }
    23092560        *rps = *(sps->getRPSList()->getReferencePictureSet(uiCode));
     
    24532704            for( Int i = 0; i < rpcSlice->getNumILRRefIdx(); i++ )
    24542705            {
     2706#if Q0060_MAX_TID_REF_EQUAL_TO_ZERO
     2707              if((rpcSlice->getVPS()->getMaxTidIlRefPicsPlus1(rpcSlice->getVPS()->getLayerIdInVps(i),rpcSlice->getLayerId()) >  rpcSlice->getTLayer() || rpcSlice->getTLayer()==0) &&
     2708                (rpcSlice->getVPS()->getMaxTSLayersMinus1(rpcSlice->getVPS()->getLayerIdInVps(i)) >=  rpcSlice->getTLayer()) )
     2709#else
    24552710              if(rpcSlice->getVPS()->getMaxTidIlRefPicsPlus1(rpcSlice->getVPS()->getLayerIdInVps(i),rpcSlice->getLayerId()) >  rpcSlice->getTLayer() &&
    24562711                (rpcSlice->getVPS()->getMaxTSLayersMinus1(rpcSlice->getVPS()->getLayerIdInVps(i)) >=  rpcSlice->getTLayer()) )
     2712#endif
    24572713              {         
    24582714                rpcSlice->setActiveNumILRRefIdx(1);
     
    24872743        {
    24882744#if O0225_TID_BASED_IL_RPS_DERIV && TSLAYERS_IL_RPS
     2745#if Q0060_MAX_TID_REF_EQUAL_TO_ZERO
     2746          if((rpcSlice->getVPS()->getMaxTidIlRefPicsPlus1(0,rpcSlice->getLayerId()) >  rpcSlice->getTLayer() || rpcSlice->getTLayer()==0) &&
     2747            (rpcSlice->getVPS()->getMaxTSLayersMinus1(0) >=  rpcSlice->getTLayer()) )
     2748#else
    24892749          if( (rpcSlice->getVPS()->getMaxTidIlRefPicsPlus1(0,rpcSlice->getLayerId()) >  rpcSlice->getTLayer()) &&
    24902750             (rpcSlice->getVPS()->getMaxTSLayersMinus1(0) >=  rpcSlice->getTLayer()) )
     2751#endif
    24912752        {
    24922753#endif
     
    25142775      for(i = 0, numRefLayerPics = 0;  i < rpcSlice->getNumILRRefIdx(); i++ )
    25152776      {
     2777#if Q0060_MAX_TID_REF_EQUAL_TO_ZERO
     2778        if((rpcSlice->getVPS()->getMaxTidIlRefPicsPlus1(rpcSlice->getVPS()->getLayerIdInVps(i),rpcSlice->getLayerId()) >  rpcSlice->getTLayer() || rpcSlice->getTLayer()==0) &&
     2779          (rpcSlice->getVPS()->getMaxTSLayersMinus1(rpcSlice->getVPS()->getLayerIdInVps(i)) >=  rpcSlice->getTLayer()) )
     2780#else
    25162781        if(rpcSlice->getVPS()->getMaxTidIlRefPicsPlus1(rpcSlice->getVPS()->getLayerIdInVps(i),rpcSlice->getLayerId()) >  rpcSlice->getTLayer() &&
    25172782           (rpcSlice->getVPS()->getMaxTSLayersMinus1(rpcSlice->getVPS()->getLayerIdInVps(i)) >=  rpcSlice->getTLayer()) )
     2783#endif
    25182784        {         
    25192785          refLayerPicIdc[ numRefLayerPics++ ] = i;
     
    25602826      {
    25612827        format = rpcSlice->getVPS()->getVpsRepFormat( sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : rpcSlice->getVPS()->getVpsRepFormatIdx(sps->getLayerId()) )->getChromaFormatVpsIdc();
     2828#if Q0195_REP_FORMAT_CLEANUP
     2829         assert( (sps->getUpdateRepFormatFlag()==false && rpcSlice->getVPS()->getVpsNumRepFormats()==1) || rpcSlice->getVPS()->getVpsNumRepFormats() > 1 ); //conformance check
     2830#endif
    25622831      }
    25632832#else
     
    34683737}
    34693738
     3739#if Q0048_CGS_3D_ASYMLUT
     3740Void TDecCavlc::xParse3DAsymLUT( TCom3DAsymLUT * pc3DAsymLUT )
     3741{
     3742  UInt uiCurOctantDepth , uiCurPartNumLog2 , uiInputBitDepthM8 , uiOutputBitDepthM8 , uiResQaunBit;
     3743  READ_CODE( 2 , uiCurOctantDepth , "cm_octant_depth" );
     3744  READ_CODE( 2 , uiCurPartNumLog2 , "cm_y_part_num_log2" );     
     3745  READ_CODE( 3 , uiInputBitDepthM8 , "cm_input_bit_depth_minus8" );
     3746  Int iInputBitDepthCDelta;
     3747  READ_SVLC(iInputBitDepthCDelta, "cm_input_bit_depth_chroma delta");
     3748  READ_CODE( 3 , uiOutputBitDepthM8 , "cm_output_bit_depth_minus8" );
     3749  Int iOutputBitDepthCDelta;
     3750  READ_SVLC(iOutputBitDepthCDelta, "cm_output_bit_depth_chroma_delta");
     3751  READ_CODE( 2 , uiResQaunBit , "cm_res_quant_bit" );
     3752  pc3DAsymLUT->destroy();
     3753  pc3DAsymLUT->create( uiCurOctantDepth , uiInputBitDepthM8 + 8 ,  uiInputBitDepthM8 + 8 + iInputBitDepthCDelta, uiOutputBitDepthM8 + 8 , uiOutputBitDepthM8 + 8 + iOutputBitDepthCDelta ,uiCurPartNumLog2 );
     3754  pc3DAsymLUT->setResQuantBit( uiResQaunBit );
     3755
     3756  xParse3DAsymLUTOctant( pc3DAsymLUT , 0 , 0 , 0 , 0 , 1 << pc3DAsymLUT->getCurOctantDepth() );
     3757}
     3758
     3759Void TDecCavlc::xParse3DAsymLUTOctant( TCom3DAsymLUT * pc3DAsymLUT , Int nDepth , Int yIdx , Int uIdx , Int vIdx , Int nLength )
     3760{
     3761  UInt uiOctantSplit = nDepth < pc3DAsymLUT->getCurOctantDepth();
     3762  if( nDepth < pc3DAsymLUT->getCurOctantDepth() )
     3763    READ_FLAG( uiOctantSplit , "split_octant_flag" );
     3764  Int nYPartNum = 1 << pc3DAsymLUT->getCurYPartNumLog2();
     3765  if( uiOctantSplit )
     3766  {
     3767    Int nHalfLength = nLength >> 1;
     3768    for( Int l = 0 ; l < 2 ; l++ )
     3769    {
     3770      for( Int m = 0 ; m < 2 ; m++ )
     3771      {
     3772        for( Int n = 0 ; n < 2 ; n++ )
     3773        {
     3774          xParse3DAsymLUTOctant( pc3DAsymLUT , nDepth + 1 , yIdx + l * nHalfLength * nYPartNum , uIdx + m * nHalfLength , vIdx + n * nHalfLength , nHalfLength );
     3775        }
     3776      }
     3777    }
     3778  }
     3779  else
     3780  {
     3781    for( Int l = 0 ; l < nYPartNum ; l++ )
     3782    {
     3783      for( Int nVertexIdx = 0 ; nVertexIdx < 4 ; nVertexIdx++ )
     3784      {
     3785        UInt uiCodeVertex = 0;
     3786        Int deltaY = 0 , deltaU = 0 , deltaV = 0;
     3787        READ_FLAG( uiCodeVertex , "coded_vertex_flag" );
     3788        if( uiCodeVertex )
     3789        {
     3790          READ_SVLC( deltaY , "resY" );
     3791          READ_SVLC( deltaU , "resU" );
     3792          READ_SVLC( deltaV , "resV" );
     3793        }
     3794        pc3DAsymLUT->setCuboidVertexResTree( yIdx + l , uIdx , vIdx , nVertexIdx , deltaY , deltaU , deltaV );
     3795      }
     3796    }
     3797  }
     3798}
     3799#endif
    34703800//! \}
    34713801
  • trunk/source/Lib/TLibDecoder/TDecCAVLC.h

    r644 r713  
    4646#include "SyntaxElementParser.h"
    4747
     48#if Q0048_CGS_3D_ASYMLUT
     49class TCom3DAsymLUT;
     50#endif
    4851//! \ingroup TLibDecoder
    4952//! \{
     
    7578#if VPS_EXTNS
    7679  Void  parseVPSExtension   ( TComVPS* pcVPS );
     80  Void  defaultVPSExtension ( TComVPS* pcVPS );
    7781#endif
    7882
    7983#if VPS_VUI
    8084  Void  parseVPSVUI   ( TComVPS* pcVPS );
     85  Void  defaultVPSVUI ( TComVPS* pcVPS );
    8186#endif
    8287#if REPN_FORMAT_IN_VPS
    83   Void  parseRepFormat      ( RepFormat *repFormat );
     88  Void  parseRepFormat      ( RepFormat *repFormat, RepFormat *repFormatPrev );
    8489#endif
    8590#if VPS_DPB_SIZE_TABLE
     
    95100  Void  parseSPS            ( TComSPS* pcSPS );
    96101#endif //SVC_EXTENSION
    97   Void  parsePPS            ( TComPPS* pcPPS);
     102  Void  parsePPS            ( TComPPS* pcPPS
     103#if Q0048_CGS_3D_ASYMLUT
     104    , TCom3DAsymLUT * pc3DAsymLUT , Int nLayerID
     105#endif
     106    );
    98107  Void  parseVUI            ( TComVUI* pcVUI, TComSPS* pcSPS );
    99108  Void  parseSEI            ( SEIMessages& );
     
    135144protected:
    136145  Bool  xMoreRbspData();
     146
     147#if Q0048_CGS_3D_ASYMLUT
     148  Void xParse3DAsymLUT( TCom3DAsymLUT * pc3DAsymLUT );
     149  Void xParse3DAsymLUTOctant( TCom3DAsymLUT * pc3DAsymLUT , Int nDepth , Int yIdx , Int uIdx , Int vIdx , Int nLength );
     150#endif
    137151};
    138152
  • trunk/source/Lib/TLibDecoder/TDecCu.cpp

    r595 r713  
    7373    m_ppcCU     [ui]->setLayerId(layerId);
    7474  }
     75 
     76#if LAYER_CTB
     77  memcpy(g_auiLayerZscanToRaster[m_layerId], g_auiZscanToRaster, sizeof( g_auiZscanToRaster ) );
     78  memcpy(g_auiLayerRasterToZscan[m_layerId], g_auiRasterToZscan, sizeof( g_auiRasterToZscan ) );
     79  memcpy(g_auiLayerRasterToPelX[m_layerId],  g_auiRasterToPelX,  sizeof( g_auiRasterToPelX ) );
     80  memcpy(g_auiLayerRasterToPelY[m_layerId],  g_auiRasterToPelY,  sizeof( g_auiRasterToPelY ) );
     81#endif
    7582}
    7683#else
     
    715722{
    716723  UInt  uiInitTrDepth = ( pcCU->getPartitionSize(0) == SIZE_2Nx2N ? 0 : 1 );
    717   UInt  uiNumPart     = pcCU->getNumPartInter();
     724  UInt  uiNumPart     = pcCU->getNumPartitions();
    718725  UInt  uiNumQParts   = pcCU->getTotalNumPart() >> 2;
    719726 
  • trunk/source/Lib/TLibDecoder/TDecEntropy.h

    r644 r713  
    4949class TDecCavlc;
    5050class ParameterSetManagerDecoder;
     51#if Q0048_CGS_3D_ASYMLUT
     52class TCom3DAsymLUT;
     53#endif
    5154
    5255//! \ingroup TLibDecoder
     
    7174  virtual Void  parseSPS                  ( TComSPS* pcSPS )                                      = 0;
    7275#endif
    73   virtual Void  parsePPS                  ( TComPPS* pcPPS )                                      = 0;
     76  virtual Void  parsePPS                  ( TComPPS* pcPPS
     77#if Q0048_CGS_3D_ASYMLUT
     78    , TCom3DAsymLUT * pc3DAsymLUT , Int nLayerID
     79#endif
     80    )                                      = 0;
    7481
    7582  virtual Void parseSliceHeader          ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager)       = 0;
     
    138145  Void    decodeSPS                   ( TComSPS* pcSPS     )    { m_pcEntropyDecoderIf->parseSPS(pcSPS);                    }
    139146#endif
    140   Void    decodePPS                   ( TComPPS* pcPPS )    { m_pcEntropyDecoderIf->parsePPS(pcPPS);                    }
     147
     148#if Q0048_CGS_3D_ASYMLUT
     149  Void    decodePPS                   ( TComPPS* pcPPS, TCom3DAsymLUT * pc3DAsymLUT, Int nLayerID )    { m_pcEntropyDecoderIf->parsePPS(pcPPS, pc3DAsymLUT , nLayerID );                     }
     150#else
     151  Void    decodePPS                   ( TComPPS* pcPPS )    { m_pcEntropyDecoderIf->parsePPS(pcPPS );  }
     152#endif
    141153  Void    decodeSliceHeader           ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager)  { m_pcEntropyDecoderIf->parseSliceHeader(rpcSlice, parameterSetManager);         }
    142154
  • trunk/source/Lib/TLibDecoder/TDecGop.cpp

    r595 r713  
    248248  }
    249249
     250#if SETTING_PIC_OUTPUT_MARK
     251  rpcPic->setOutputMark(rpcPic->getSlice(0)->getPicOutputFlag() ? true : false);
     252#else
    250253  rpcPic->setOutputMark(true);
     254#endif
    251255  rpcPic->setReconMark(true);
    252256}
  • trunk/source/Lib/TLibDecoder/TDecSbac.h

    r644 r713  
    8181  Void  parseSPS                  ( TComSPS* /*pcSPS*/ ) {}
    8282#endif
    83   Void  parsePPS                  ( TComPPS* /*pcPPS*/ ) {}
     83  Void  parsePPS                  ( TComPPS* /*pcPPS*/
     84#if Q0048_CGS_3D_ASYMLUT
     85    , TCom3DAsymLUT * /*pc3DAsymLUT*/ , Int /*nLayerID*/
     86#endif
     87    ) {}
    8488
    8589  Void  parseSliceHeader          ( TComSlice*& /*rpcSlice*/, ParameterSetManagerDecoder* /*parameterSetManager*/) {}
  • trunk/source/Lib/TLibDecoder/TDecTop.cpp

    r644 r713  
    7979  m_prevSliceSkipped = false;
    8080  m_skippedPOC = 0;
     81#if SETTING_NO_OUT_PIC_PRIOR
     82  m_bFirstSliceInBitstream  = true;
     83  m_lastPOCNoOutputPriorPics = -1;
     84  m_craNoRaslOutputFlag = false;
     85  m_isNoOutputPriorPics = false;
     86#endif
    8187#if NO_CLRAS_OUTPUT_FLAG
    8288  m_noClrasOutputFlag          = false;
    8389  m_layerInitializedFlag       = false;
    84   m_firstPicInLayerDecodedFlag = false;
    85   m_noOutputOfPriorPicsFlags   = false;
    86   m_bRefreshPending            = false;
     90  m_firstPicInLayerDecodedFlag = false; 
    8791#endif
    8892#if RESOLUTION_BASED_DPB
    8993  m_subDpbIdx = -1;
    9094#endif
     95#if Q0048_CGS_3D_ASYMLUT
     96  m_pColorMappedPic = NULL;
     97#endif
     98
     99#if Q0074_SEI_COLOR_MAPPING
     100  m_ColorMapping = new TDecColorMapping();
     101#endif
    91102}
    92103
     
    95106#if ENC_DEC_TRACE
    96107  fclose( g_hTrace );
     108#endif
     109#if Q0048_CGS_3D_ASYMLUT
     110  if(m_pColorMappedPic)
     111  {
     112    m_pColorMappedPic->destroy();
     113    delete m_pColorMappedPic;
     114    m_pColorMappedPic = NULL;
     115  }
     116#endif
     117#if Q0074_SEI_COLOR_MAPPING
     118  if ( m_ColorMapping )  delete m_ColorMapping;
    97119#endif
    98120}
     
    353375        Bool sameBitDepths = ( g_bitDepthYLayer[m_layerId] == g_bitDepthYLayer[refLayerId] ) && ( g_bitDepthCLayer[m_layerId] == g_bitDepthCLayer[refLayerId] );
    354376
    355         if( pcPicYuvRecBase->getWidth() != pcSlice->getPicWidthInLumaSamples() || pcPicYuvRecBase->getHeight() != pcSlice->getPicHeightInLumaSamples() || !zeroOffsets || !sameBitDepths )
     377        if( pcPicYuvRecBase->getWidth() != pcSlice->getPicWidthInLumaSamples() || pcPicYuvRecBase->getHeight() != pcSlice->getPicHeightInLumaSamples() || !zeroOffsets || !sameBitDepths
     378#if Q0048_CGS_3D_ASYMLUT
     379          || pcSlice->getPPS()->getCGSFlag() > 0
     380#endif
     381#if LAYER_CTB
     382          || pcTDecTopBase->getActiveSPS()->getMaxCUWidth() != m_ppcTDecTop[m_layerId]->getActiveSPS()->getMaxCUWidth() || pcTDecTopBase->getActiveSPS()->getMaxCUHeight() != m_ppcTDecTop[m_layerId]->getActiveSPS()->getMaxCUHeight() || pcTDecTopBase->getActiveSPS()->getMaxCUDepth() != m_ppcTDecTop[m_layerId]->getActiveSPS()->getMaxCUDepth()
     383#endif
     384          )
    356385#else
    357386        if(pcPicYuvRecBase->getWidth() != pcSlice->getPicWidthInLumaSamples() || pcPicYuvRecBase->getHeight() != pcSlice->getPicHeightInLumaSamples() || !zeroOffsets )
     
    503532
    504533  // Execute Deblock + Cleanup
    505 
    506534  m_cGopDecoder.filterPicture(pcPic);
    507535
     
    517545  return;
    518546}
     547
     548#if SETTING_NO_OUT_PIC_PRIOR
     549Void TDecTop::checkNoOutputPriorPics (TComList<TComPic*>*& rpcListPic)
     550{
     551  if (!rpcListPic || !m_isNoOutputPriorPics) return;
     552
     553  TComList<TComPic*>::iterator  iterPic   = rpcListPic->begin();
     554
     555  while (iterPic != rpcListPic->end())
     556  {
     557    TComPic*& pcPicTmp = *(iterPic++);
     558    if (m_lastPOCNoOutputPriorPics != pcPicTmp->getPOC())
     559    {
     560      pcPicTmp->setOutputMark(false);
     561    }
     562  }
     563}
     564#endif
    519565
    520566#if EARLY_REF_PIC_MARKING
     
    733779#endif
    734780
     781#if AVC_BASE
     782  if( activeVPS->getAvcBaseLayerFlag() )
     783  {
     784    TComPic* pBLPic = (*m_ppcTDecTop[0]->getListPic()->begin());
     785    if( m_layerId == 1 && pBLPic->getPicYuvRec() == NULL )
     786    {
     787      UInt refLayerId = 0;
     788      RepFormat* repFormat = activeVPS->getVpsRepFormat( activeVPS->getVpsRepFormatIdx(refLayerId) );
     789
     790      Int  numReorderPics[MAX_TLAYER];
     791      Window conformanceWindow;
     792      Window defaultDisplayWindow;
     793
     794#if AUXILIARY_PICTURES
     795#if SVC_UPSAMPLING
     796#if AVC_SYNTAX
     797      pBLPic->create( repFormat->getPicWidthVpsInLumaSamples(), repFormat->getPicHeightVpsInLumaSamples(), repFormat->getChromaFormatVpsIdc(), activeSPS->getMaxCUWidth(), activeSPS->getMaxCUHeight(), activeSPS->getMaxCUDepth(), conformanceWindow, defaultDisplayWindow, numReorderPics, activeSPS, true);
     798#else
     799      pBLPic->create( repFormat->getPicWidthVpsInLumaSamples(), repFormat->getPicHeightVpsInLumaSamples(), repFormat->getChromaFormatVpsIdc(), activeSPS->getMaxCUWidth(), activeSPS->getMaxCUHeight(), activeSPS->getMaxCUDepth(), conformanceWindow, defaultDisplayWindow, numReorderPics, NULL, true);
     800#endif
     801#else
     802      pBLPic->create( repFormat->getPicWidthVpsInLumaSamples(), repFormat->getPicHeightVpsInLumaSamples(), repFormat->getChromaFormatVpsIdc(), activeSPS->getMaxCUWidth(), activeSPS->getMaxCUHeight(), activeSPS->getMaxCUDepth(), conformanceWindow, defaultDisplayWindow, numReorderPics, true);
     803#endif
     804#else
     805#if SVC_UPSAMPLING
     806#if AVC_SYNTAX
     807      pBLPic->create( repFormat->getPicWidthVpsInLumaSamples(), repFormat->getPicHeightVpsInLumaSamples(), activeSPS->getMaxCUWidth(), activeSPS->getMaxCUHeight(), activeSPS->getMaxCUDepth(), conformanceWindow, defaultDisplayWindow, numReorderPics, activeSPS, true);
     808#else
     809      pBLPic->create( repFormat->getPicWidthVpsInLumaSamples(), repFormat->getPicHeightVpsInLumaSamples(), activeSPS->getMaxCUWidth(), activeSPS->getMaxCUHeight(), activeSPS->getMaxCUDepth(), conformanceWindow, defaultDisplayWindow, numReorderPics, NULL, true);
     810#endif
     811#else
     812      pBLPic->create( repFormat->getPicWidthVpsInLumaSamples(), repFormat->getPicHeightVpsInLumaSamples(), activeSPS->getMaxCUWidth(), activeSPS->getMaxCUHeight(), activeSPS->getMaxCUDepth(), onformanceWindow, defaultDisplayWindow, numReorderPics, true);
     813#endif
     814#endif
     815      // it is needed where the VPS is accessed through the slice
     816      pBLPic->getSlice(0)->setVPS( activeVPS );
     817
     818#if O0194_DIFFERENT_BITDEPTH_EL_BL
     819      g_bitDepthYLayer[0] = repFormat->getBitDepthVpsLuma();
     820      g_bitDepthCLayer[0] = repFormat->getBitDepthVpsChroma();
     821#endif
     822    }
     823  }
     824#endif
     825
    735826#if P0312_VERT_PHASE_ADJ
    736827  if( activeVPS->getVpsVuiVertPhaseInUseFlag() == 0 )
     
    808899  g_uiAddCUDepth  = max (0, sps->getLog2MinCodingBlockSize() - (Int)sps->getQuadtreeTULog2MinSize() );
    809900
     901#if Q0074_SEI_COLOR_MAPPING
     902  for(Int compID=0; compID<3; compID++)
     903  {
     904    m_ColorMapping->setColorMapping( compID ? g_bitDepthC : g_bitDepthY, compID );
     905  }
     906#endif
     907
    810908  for (Int i = 0; i < sps->getLog2DiffMaxMinCodingBlockSize(); i++)
    811909  {
     
    843941  TComPic*&   pcPic         = m_pcPic;
    844942#if SVC_EXTENSION
    845 #if !NO_OUTPUT_OF_PRIOR_PICS
    846 #if NO_CLRAS_OUTPUT_FLAG
    847   Bool bFirstSliceInSeq;
    848 #endif
    849 #endif
    850943  m_apcSlicePilot->setVPS( m_parameterSetManagerDecoder.getPrefetchedVPS(0) );
    851944#if OUTPUT_LAYER_SET_INDEX
     
    900993  m_apcSlicePilot->setAssociatedIRAPType(m_associatedIRAPType);
    901994
    902 #if NO_OUTPUT_OF_PRIOR_PICS
    903   // Infer the value of NoOutputOfPriorPicsFlag
    904   if( m_apcSlicePilot->getRapPicFlag() )
    905   {
    906     if ( m_apcSlicePilot->getBlaPicFlag() || m_apcSlicePilot->getIdrPicFlag()  ||
    907         (m_apcSlicePilot->getCraPicFlag() && m_bFirstSliceInSequence) ||
    908         (m_apcSlicePilot->getCraPicFlag() && m_apcSlicePilot->getHandleCraAsBlaFlag()))
    909     {
    910       m_apcSlicePilot->setNoRaslOutputFlag( true );
     995#if SETTING_NO_OUT_PIC_PRIOR
     996  //For inference of NoOutputOfPriorPicsFlag
     997  if (m_apcSlicePilot->getRapPicFlag())
     998  {
     999    if ((m_apcSlicePilot->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && m_apcSlicePilot->getNalUnitType() <= NAL_UNIT_CODED_SLICE_IDR_N_LP) ||
     1000        (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA && m_bFirstSliceInSequence) ||
     1001        (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA && m_apcSlicePilot->getHandleCraAsBlaFlag()))
     1002    {
     1003      m_apcSlicePilot->setNoRaslOutputFlag(true);
     1004    }
     1005    //the inference for NoOutputPriorPicsFlag
     1006    if (!m_bFirstSliceInBitstream && m_apcSlicePilot->getRapPicFlag() && m_apcSlicePilot->getNoRaslOutputFlag())
     1007    {
     1008      if (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA)
     1009      {
     1010        m_apcSlicePilot->setNoOutputPriorPicsFlag(true);
     1011      }
    9111012    }
    9121013    else
    9131014    {
    914       m_apcSlicePilot->setNoRaslOutputFlag( false );
    915     }
     1015      m_apcSlicePilot->setNoOutputPriorPicsFlag(false);
     1016    }
     1017
     1018    if(m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA)
     1019    {
     1020      m_craNoRaslOutputFlag = m_apcSlicePilot->getNoRaslOutputFlag();
     1021    }
     1022  }
     1023  if (m_apcSlicePilot->getRapPicFlag() && m_apcSlicePilot->getNoOutputPriorPicsFlag())
     1024  {
     1025    m_lastPOCNoOutputPriorPics = m_apcSlicePilot->getPOC();
     1026    m_isNoOutputPriorPics = true;
     1027  }
     1028  else
     1029  {
     1030    m_isNoOutputPriorPics = false;
     1031  }
     1032
     1033  //For inference of PicOutputFlag
     1034  if (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R)
     1035  {
     1036    if ( m_craNoRaslOutputFlag )
     1037    {
     1038      m_apcSlicePilot->setPicOutputFlag(false);
     1039    }
     1040  }
     1041#endif
     1042
     1043#if FIX_POC_CRA_NORASL_OUTPUT
     1044  if (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA && m_craNoRaslOutputFlag) //Reset POC MSB when CRA has NoRaslOutputFlag equal to 1
     1045  {
     1046    Int iMaxPOClsb = 1 << m_apcSlicePilot->getSPS()->getBitsForPOC();
     1047    m_apcSlicePilot->setPOC( m_apcSlicePilot->getPOC() & (iMaxPOClsb - 1) );
    9161048  }
    9171049#endif
     
    9671099  }
    9681100
    969   m_apcSlicePilot->decodingRefreshMarking(m_pocCRA, m_bRefreshPending, m_cListPic, getNoClrasOutputFlag());
     1101  m_apcSlicePilot->decodingRefreshMarking( m_cListPic, m_noClrasOutputFlag );
    9701102#endif
    9711103
     
    9751107    if( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA && m_apcSlicePilot->getNoRaslOutputFlag() )
    9761108    {
    977       this->setNoOutputOfPriorPicsFlags( true );
     1109      this->setNoOutputPriorPicsFlag( true );
    9781110    }
    9791111    else if( m_apcSlicePilot->getRapPicFlag() && m_apcSlicePilot->getNoRaslOutputFlag() )
    9801112    {
    981       this->setNoOutputOfPriorPicsFlags( m_apcSlicePilot->getNoOutputOfPriorPicsFlag() );
     1113      this->setNoOutputPriorPicsFlag( m_apcSlicePilot->getNoOutputPriorPicsFlag() );
    9821114    }
    9831115    else
     
    9851117      if( this->m_ppcTDecTop[0]->getNoClrasOutputFlag() )
    9861118      {
    987         this->setNoOutputOfPriorPicsFlags( true );
     1119        this->setNoOutputPriorPicsFlag( true );
    9881120      }
    9891121    }
     
    10061138#else
    10071139  //we should only get a different poc for a new picture (with CTU address==0)
    1008   if (m_apcSlicePilot->isNextSlice() && m_apcSlicePilot->getPOC()!=m_prevPOC && !m_bFirstSliceInSequence && (!m_apcSlicePilot->getSliceCurStartCUAddr()==0))
     1140  if (m_apcSlicePilot->isNextSlice() && m_apcSlicePilot->getPOC()!=m_prevPOC && !m_bFirstSliceInSequence && (m_apcSlicePilot->getSliceCurStartCUAddr()!=0))
    10091141  {
    10101142    printf ("Warning, the first slice of a picture might have been lost!\n");
     
    10501182#endif
    10511183  }
    1052 #if !NO_OUTPUT_OF_PRIOR_PICS
    1053 #if NO_CLRAS_OUTPUT_FLAG
    1054   bFirstSliceInSeq = m_bFirstSliceInSequence;
    1055 #endif
    1056 #endif
    10571184  m_bFirstSliceInSequence = false;
     1185#if SETTING_NO_OUT_PIC_PRIOR 
     1186  m_bFirstSliceInBitstream  = false;
     1187#endif
    10581188#if POC_RESET_FLAG
    10591189  // This operation would do the following:
     
    12161346#endif
    12171347
    1218 #if !NO_OUTPUT_OF_PRIOR_PICS
    1219 #if NO_CLRAS_OUTPUT_FLAG
    1220     if (m_layerId == 0 &&
    1221         (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP
    1222       || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL
    1223       || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP
    1224       || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL
    1225       || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP
    1226       || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA))
    1227     {
    1228       if (bFirstSliceInSeq)
    1229       {
    1230         setNoClrasOutputFlag(true);
    1231       }
    1232       else if (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP
    1233             || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL
    1234             || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP)
    1235       {
    1236         setNoClrasOutputFlag(true);
    1237       }
    1238 #if O0149_CROSS_LAYER_BLA_FLAG
    1239       else if ((m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP) &&
    1240                m_apcSlicePilot->getCrossLayerBLAFlag())
    1241       {
    1242         setNoClrasOutputFlag(true);
    1243       }
    1244 #endif
    1245       else
    1246       {
    1247         setNoClrasOutputFlag(false);
    1248       }
    1249       if (getNoClrasOutputFlag())
    1250       {
    1251         for (UInt i = 0; i < m_apcSlicePilot->getVPS()->getMaxLayers(); i++)
    1252         {
    1253           m_ppcTDecTop[i]->setLayerInitializedFlag(false);
    1254           m_ppcTDecTop[i]->setFirstPicInLayerDecodedFlag(false);
    1255         }
    1256       }
    1257     }
    1258 #endif
    1259 
    1260 #if NO_CLRAS_OUTPUT_FLAG
    1261     m_apcSlicePilot->decodingRefreshMarking(m_pocCRA, m_bRefreshPending, m_cListPic, getNoClrasOutputFlag());
    1262 #endif
    1263 #else
     1348#if NO_OUTPUT_OF_PRIOR_PICS
    12641349    if ( m_layerId == 0 && m_apcSlicePilot->getRapPicFlag() && getNoClrasOutputFlag() )
    12651350    {
     
    12731358    // Buffer initialize for prediction.
    12741359    m_cPrediction.initTempBuff();
    1275 #if !ALIGNED_BUMPING
     1360#if ALIGNED_BUMPING
     1361    m_apcSlicePilot->checkLeadingPictureRestrictions(m_cListPic);
     1362#else
    12761363    m_apcSlicePilot->applyReferencePictureSet(m_cListPic, m_apcSlicePilot->getRPS());
    1277 #else
    1278     m_apcSlicePilot->checkLeadingPictureRestrictions(m_cListPic);
    12791364#endif
    12801365    //  Get a new picture buffer
     
    15151600        Int widthBL   = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getWidth();
    15161601        Int heightBL  = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getHeight();
    1517 
     1602#if Q0200_CONFORMANCE_BL_SIZE
     1603        Int chromaFormatIdc = pcSlice->getBaseColPic(refLayerIdc)->getSlice(0)->getChromaFormatIdc();
     1604        const Window &confBL = pcSlice->getBaseColPic(refLayerIdc)->getConformanceWindow();
     1605        widthBL  -= ( confBL.getWindowLeftOffset() + confBL.getWindowRightOffset() ) * TComSPS::getWinUnitX( chromaFormatIdc );
     1606        heightBL -= ( confBL.getWindowTopOffset() + confBL.getWindowBottomOffset() ) * TComSPS::getWinUnitY( chromaFormatIdc );
     1607#endif
    15181608        Int widthEL   = pcPic->getPicYuvRec()->getWidth()  - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset();
    15191609        Int heightEL  = pcPic->getPicYuvRec()->getHeight() - scalEL.getWindowTopOffset()  - scalEL.getWindowBottomOffset();
     
    15251615        g_posScalingFactor[refLayerIdc][1] = ((heightBL << 16) + (heightEL >> 1)) / heightEL;
    15261616
     1617#if Q0048_CGS_3D_ASYMLUT
     1618        TComPicYuv* pBaseColRec = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec();
     1619        if( pcSlice->getPPS()->getCGSFlag() )
     1620        {
     1621          if(!m_pColorMappedPic)
     1622          {
     1623            initAsymLut(pcSlice->getBaseColPic(refLayerIdc)->getSlice(0));
     1624          }
     1625          m_c3DAsymLUTPPS.colorMapping( pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(),  m_pColorMappedPic );
     1626          pBaseColRec = m_pColorMappedPic;
     1627        }
     1628#endif
    15271629#if SVC_UPSAMPLING
    15281630        if( pcPic->isSpatialEnhLayer(refLayerIdc) )
    15291631        {   
    1530 /*#if O0098_SCALED_REF_LAYER_ID
    1531           Window &scalEL = pcSlice->getSPS()->getScaledRefLayerWindowForLayer(pcSlice->getVPS()->getRefLayerId(m_layerId, refLayerIdc));
    1532 #else
    1533           Window &scalEL = pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc);
    1534 #endif*/
    15351632#if O0215_PHASE_ALIGNMENT
    15361633#if O0194_JOINT_US_BITSHIFT
    1537           m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL, pcSlice->getVPS()->getPhaseAlignFlag() );
     1634#if Q0048_CGS_3D_ASYMLUT
     1635          m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), pcSlice->getVPS()->getPhaseAlignFlag() );
     1636#else
     1637          m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getVPS()->getPhaseAlignFlag() );
     1638#endif
     1639#else
     1640#if Q0048_CGS_3D_ASYMLUT
     1641          m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc), pcSlice->getVPS()->getPhaseAlignFlag() );
    15381642#else
    15391643          m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL, pcSlice->getVPS()->getPhaseAlignFlag() );
    15401644#endif
     1645#endif
    15411646#else
    15421647#if O0194_JOINT_US_BITSHIFT
     1648#if Q0048_CGS_3D_ASYMLUT
     1649          m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL );
     1650#else
    15431651          m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL );
     1652#endif
     1653#else
     1654#if Q0048_CGS_3D_ASYMLUT
     1655          m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL );
    15441656#else
    15451657          m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL );
     1658#endif
    15461659#endif
    15471660#endif
     
    17551868}
    17561869
    1757 Void TDecTop::xDecodePPS()
     1870Void TDecTop::xDecodePPS(
     1871#if Q0048_CGS_3D_ASYMLUT
     1872  TCom3DAsymLUT * pc3DAsymLUT
     1873#endif
     1874  )
    17581875{
    17591876  TComPPS* pps = new TComPPS();
     
    17631880#endif
    17641881
    1765   m_cEntropyDecoder.decodePPS( pps );
     1882  m_cEntropyDecoder.decodePPS( pps
     1883#if Q0048_CGS_3D_ASYMLUT
     1884    , pc3DAsymLUT , m_layerId
     1885#endif
     1886    );
    17661887  m_parameterSetManagerDecoder.storePrefetchedPPS( pps );
    17671888
     
    18091930      SEIActiveParameterSets *seiAps = (SEIActiveParameterSets*)(*activeParamSets.begin());
    18101931      m_parameterSetManagerDecoder.applyPrefetchedPS();
    1811       assert(seiAps->activeSeqParamSetId.size()>0);
    1812       if( !m_parameterSetManagerDecoder.activateSPSWithSEI( seiAps->activeSeqParamSetId[0] ) )
     1932      assert(seiAps->activeSeqParameterSetId.size()>0);
     1933      if( !m_parameterSetManagerDecoder.activateSPSWithSEI( seiAps->activeSeqParameterSetId[0] ) )
    18131934      {
    18141935        printf ("Warning SPS activation with Active parameter set SEI failed");
    18151936      }
    18161937    }
     1938#if Q0074_SEI_COLOR_MAPPING
     1939    m_ColorMapping->setColorMapping( m_SEIs );
     1940#endif
    18171941  }
    18181942#else
     
    18371961      SEIActiveParameterSets *seiAps = (SEIActiveParameterSets*)(*activeParamSets.begin());
    18381962      m_parameterSetManagerDecoder.applyPrefetchedPS();
    1839       assert(seiAps->activeSeqParamSetId.size()>0);
    1840       if (! m_parameterSetManagerDecoder.activateSPSWithSEI(seiAps->activeSeqParamSetId[0] ))
     1963      assert(seiAps->activeSeqParameterSetId.size()>0);
     1964      if (! m_parameterSetManagerDecoder.activateSPSWithSEI(seiAps->activeSeqParameterSetId[0] ))
    18411965      {
    18421966        printf ("Warning SPS activation with Active parameter set SEI failed");
     
    18972021    case NAL_UNIT_SPS:
    18982022      xDecodeSPS();
    1899 #if AVC_BASE
    1900       if( m_parameterSetManagerDecoder.getPrefetchedVPS(0)->getAvcBaseLayerFlag() )
    1901       {
    1902         TComPic* pBLPic = (*m_ppcTDecTop[0]->getListPic()->begin());
    1903         if( nalu.m_layerId == 1 && pBLPic->getPicYuvRec() == NULL )
    1904         {
    1905           // using EL SPS with spsId = 1
    1906           TComSPS* sps = m_parameterSetManagerDecoder.getPrefetchedSPS(1);
    1907           Int  numReorderPics[MAX_TLAYER];
    1908           Window &conformanceWindow = sps->getConformanceWindow();
    1909           Window defaultDisplayWindow = sps->getVuiParametersPresentFlag() ? sps->getVuiParameters()->getDefaultDisplayWindow() : Window();
    1910 #if AUXILIARY_PICTURES
    1911 #if SVC_UPSAMPLING
    1912 #if AVC_SYNTAX
    1913           pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), sps->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth(), conformanceWindow, defaultDisplayWindow, numReorderPics, sps, true);
    1914 #else
    1915           pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), sps->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth(), conformanceWindow, defaultDisplayWindow, numReorderPics, NULL, true);
    1916 #endif
    1917 #else
    1918           pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), sps->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth(), onformanceWindow, defaultDisplayWindow, numReorderPics, true);
    1919 #endif
    1920 #else
    1921 #if SVC_UPSAMPLING
    1922 #if AVC_SYNTAX
    1923           pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth(), conformanceWindow, defaultDisplayWindow, numReorderPics, sps, true);
    1924 #else
    1925           pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth(), conformanceWindow, defaultDisplayWindow, numReorderPics, NULL, true);
    1926 #endif
    1927 #else
    1928           pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth(), onformanceWindow, defaultDisplayWindow, numReorderPics, true);
    1929 #endif
    1930 #endif
    1931 
    1932 #if O0194_DIFFERENT_BITDEPTH_EL_BL
    1933           // set AVC BL bit depth, can be an input parameter from the command line
    1934           g_bitDepthYLayer[0] = 8;
    1935           g_bitDepthCLayer[0] = 8;
    1936 #endif
    1937         }
    1938       }
    1939 #endif
    19402023      return false;
    19412024
    19422025    case NAL_UNIT_PPS:
    1943       xDecodePPS();
     2026      xDecodePPS(
     2027#if Q0048_CGS_3D_ASYMLUT
     2028        &m_c3DAsymLUTPPS
     2029#endif
     2030        );
    19442031      return false;
    19452032     
     
    19972084      return false;
    19982085     
     2086    case NAL_UNIT_FILLER_DATA:
     2087      return false;
    19992088     
    20002089    case NAL_UNIT_RESERVED_VCL_N10:
     
    20172106    case NAL_UNIT_RESERVED_VCL31:
    20182107     
    2019     case NAL_UNIT_FILLER_DATA:
    20202108    case NAL_UNIT_RESERVED_NVCL41:
    20212109    case NAL_UNIT_RESERVED_NVCL42:
     
    23042392}
    23052393#endif
     2394
     2395#if Q0048_CGS_3D_ASYMLUT
     2396Void TDecTop::initAsymLut(TComSlice *pcSlice)
     2397{
     2398  if(m_layerId>0)
     2399  {
     2400    if(!m_pColorMappedPic)
     2401    {
     2402      Int picWidth    = pcSlice->getPicWidthInLumaSamples();
     2403      Int picHeight   = pcSlice->getPicHeightInLumaSamples();
     2404      m_pColorMappedPic = new TComPicYuv;
     2405      m_pColorMappedPic->create( picWidth, picHeight, pcSlice->getChromaFormatIdc()/*CHROMA_420*/, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, NULL );
     2406    }
     2407  }
     2408}
     2409#endif
     2410
    23062411#endif //SVC_EXTENSION
     2412
     2413#if Q0074_SEI_COLOR_MAPPING
     2414TDecColorMapping::TDecColorMapping()
     2415{
     2416  m_pcColorMappingPic[0]   = NULL;
     2417  m_pcColorMappingPic[1]   = NULL;
     2418
     2419  m_colorMapCancelFlag  = true;
     2420
     2421  for( Int i=0 ; i<3 ; i++ )
     2422  {
     2423    m_lut1d_computed[i]             = false;
     2424    m_lut1d_input[i]                = NULL;
     2425    m_coded_input_pivot_value[i]    = NULL;
     2426    m_target_input_pivot_value[i]   = NULL;
     2427  }
     2428  for( Int i=0 ; i<3 ; i++ )
     2429  {
     2430    m_lut1d_output[i]               = NULL;
     2431    m_coded_output_pivot_value[i]   = NULL;
     2432    m_target_output_pivot_value[i]  = NULL;
     2433  }
     2434}
     2435
     2436TDecColorMapping::~TDecColorMapping()
     2437{
     2438  if ( m_pcColorMappingPic[0] )  delete m_pcColorMappingPic[0];
     2439  if ( m_pcColorMappingPic[1] )  delete m_pcColorMappingPic[1];
     2440
     2441  for( Int i=0 ; i<3 ; i++ )
     2442  {
     2443    if ( m_lut1d_input[i] )               delete  m_lut1d_input[i];
     2444    if ( m_coded_input_pivot_value[i] )   delete  m_coded_input_pivot_value[i];
     2445    if ( m_target_input_pivot_value[i] )  delete  m_target_input_pivot_value[i];
     2446  }
     2447  for( Int i=0 ; i<3 ; i++ )
     2448  {
     2449    if ( m_lut1d_output[i] )               delete  m_lut1d_output[i];
     2450    if ( m_coded_output_pivot_value[i] )   delete  m_coded_output_pivot_value[i];
     2451    if ( m_target_output_pivot_value[i] )  delete  m_target_output_pivot_value[i];
     2452  }
     2453}
     2454
     2455Void  TDecColorMapping::setColorMapping( SEIMessages m_SEIs )
     2456{
     2457  SEIMessages colorMappingInfo = getSeisByType(m_SEIs, SEI::COLOR_MAPPING_INFO) ;
     2458  SEIColorMappingInfo *seiColorMappingInfo = NULL;
     2459  if (colorMappingInfo.size() !=0)
     2460  {
     2461    seiColorMappingInfo = (SEIColorMappingInfo*)(*colorMappingInfo.begin());
     2462
     2463    m_colorMapId                              = seiColorMappingInfo->m_colorMapId;
     2464    m_colorMapCancelFlag                      = seiColorMappingInfo->m_colorMapCancelFlag;
     2465    if( !m_colorMapCancelFlag )
     2466    {
     2467      m_colorMapPersistenceFlag                 = seiColorMappingInfo->m_colorMapPersistenceFlag;
     2468      m_colorMap_video_signal_type_present_flag = seiColorMappingInfo->m_colorMap_video_signal_type_present_flag;
     2469      m_colorMap_video_full_range_flag          = seiColorMappingInfo->m_colorMap_video_full_range_flag;
     2470      m_colorMap_primaries                      = seiColorMappingInfo->m_colorMap_primaries;
     2471      m_colorMap_transfer_characteristics       = seiColorMappingInfo->m_colorMap_transfer_characteristics;
     2472      m_colorMap_matrix_coeffs                  = seiColorMappingInfo->m_colorMap_matrix_coeffs;
     2473      m_colorMapModelId                         = seiColorMappingInfo->m_colorMapModelId;
     2474
     2475      m_colour_map_coded_data_bit_depth         = seiColorMappingInfo->m_colour_map_coded_data_bit_depth;
     2476      m_colour_map_target_bit_depth             = seiColorMappingInfo->m_colour_map_target_bit_depth;
     2477
     2478      for( Int i=0 ; i<3 ; i++ )
     2479      {
     2480        m_num_input_pivots[i]                 = seiColorMappingInfo->m_num_input_pivots[i];
     2481        if ( m_coded_input_pivot_value[i] )   delete  m_coded_input_pivot_value[i];
     2482        if ( m_target_input_pivot_value[i] )  delete  m_target_input_pivot_value[i];
     2483        m_coded_input_pivot_value[i]          = new Int[ m_num_input_pivots[i] ];
     2484        m_target_input_pivot_value[i]         = new Int[ m_num_input_pivots[i] ];
     2485        for( Int j=0 ; j<m_num_input_pivots[i] ; j++ )
     2486        {
     2487          m_coded_input_pivot_value[i][j]     = seiColorMappingInfo->m_coded_input_pivot_value[i][j];
     2488          m_target_input_pivot_value[i][j]    = seiColorMappingInfo->m_target_input_pivot_value[i][j];
     2489        }
     2490      }
     2491
     2492      m_matrix_flag       = seiColorMappingInfo->m_matrix_flag;
     2493      m_log2_matrix_denom = m_matrix_flag ? (seiColorMappingInfo->m_log2_matrix_denom) : (0) ;
     2494      for( Int i=0 ; i<3 ; i++ )
     2495      {
     2496        for( Int j=0 ; j<3 ; j++ )
     2497        {
     2498          m_matrix_coef[i][j]  = seiColorMappingInfo->m_matrix_coef[i][j];
     2499        }
     2500      }
     2501
     2502      for( Int i=0 ; i<3 ; i++ )
     2503      {
     2504        m_num_output_pivots[i]                 = seiColorMappingInfo->m_num_output_pivots[i];
     2505        if ( m_coded_output_pivot_value[i] )   delete  m_coded_output_pivot_value[i];
     2506        if ( m_target_output_pivot_value[i] )  delete  m_target_output_pivot_value[i];
     2507        m_coded_output_pivot_value[i]          = new Int[ m_num_output_pivots[i] ];
     2508        m_target_output_pivot_value[i]         = new Int[ m_num_output_pivots[i] ];
     2509        for( Int j=0 ; j<m_num_output_pivots[i] ; j++ )
     2510        {
     2511          m_coded_output_pivot_value[i][j]     = seiColorMappingInfo->m_coded_output_pivot_value[i][j];
     2512          m_target_output_pivot_value[i][j]    = seiColorMappingInfo->m_target_output_pivot_value[i][j];
     2513        }
     2514      }
     2515
     2516      memset( m_lut1d_computed, 0, sizeof( m_lut1d_computed ) );
     2517    }
     2518  }
     2519
     2520}
     2521
     2522Void  TDecColorMapping::setColorMapping( Int bitDepth, Int iComp )
     2523{
     2524  if( !m_colorMapCancelFlag && !m_lut1d_computed[iComp] )
     2525  {
     2526
     2527    if ( m_lut1d_input[iComp] )   delete m_lut1d_input[iComp];
     2528    if ( m_lut1d_output[iComp] )  delete m_lut1d_output[iComp];
     2529
     2530    m_lut1d_input[iComp]  = new Int[ 1 << bitDepth ];
     2531    m_lut1d_output[iComp] = new Int[ 1 << bitDepth ];
     2532
     2533    Int iShift      = (m_colour_map_coded_data_bit_depth >= bitDepth) ? (m_colour_map_coded_data_bit_depth - bitDepth) : (0);
     2534    Int iShiftPivot = (m_colour_map_coded_data_bit_depth >= bitDepth) ? (0) : (bitDepth - m_colour_map_coded_data_bit_depth);
     2535
     2536    for( Int k=0 ; k<(1<<bitDepth) ; k++ )
     2537    {
     2538      Int iSample = k << iShift ;
     2539      if( m_num_input_pivots[iComp] > 1 )
     2540      {
     2541        for( Int iPivot=0 ; iPivot<m_num_input_pivots[iComp] ; iPivot++ )
     2542        {
     2543          Int iCodedPrev  = m_coded_input_pivot_value[iComp][iPivot]     << iShiftPivot;
     2544          Int iCodedNext  = m_coded_input_pivot_value[iComp][iPivot+1]   << iShiftPivot;
     2545          Int iTargetPrev = m_target_input_pivot_value[iComp][iPivot]    << iShiftPivot;
     2546          Int iTargetNext = m_target_input_pivot_value[iComp][iPivot+1]  << iShiftPivot;
     2547          if ( iCodedPrev <= iSample && iSample < iCodedNext )
     2548          {
     2549            Float fInterpol = (Float)( (iCodedNext - iSample)*iTargetPrev + (iSample - iCodedPrev)*iTargetNext ) / (Float)(iCodedNext - iCodedPrev) ;
     2550            m_lut1d_input[iComp][k]  = (Int)( 0.5 + fInterpol );
     2551            iPivot = m_num_input_pivots[iComp]; // stop
     2552          }
     2553        }
     2554      }
     2555      else
     2556      {
     2557        m_lut1d_input[iComp][k]  = k;
     2558      }
     2559    }
     2560
     2561    iShift      = ( (m_colour_map_coded_data_bit_depth >= bitDepth) ? (m_colour_map_coded_data_bit_depth - bitDepth) : (0) );
     2562    Int iOffset = iShift ? (1 << (iShift - 1)) : (0) ;
     2563    iShiftPivot = (m_colour_map_target_bit_depth >= bitDepth) ? (0) : (bitDepth - m_colour_map_target_bit_depth) ;
     2564    for( Int k=0 ; k<(1<<bitDepth) ; k++ )
     2565    {
     2566      Int iSample = k << iShift;
     2567      if ( m_num_output_pivots[iComp]>1 )
     2568      {
     2569        for( Int iPivot=0 ; iPivot<m_num_output_pivots[iComp] ; iPivot++ )
     2570        {
     2571          Int iCodedPrev  = m_coded_output_pivot_value[iComp][iPivot]     << iShiftPivot;
     2572          Int iCodedNext  = m_coded_output_pivot_value[iComp][iPivot+1]   << iShiftPivot;
     2573          Int iTargetPrev = m_target_output_pivot_value[iComp][iPivot]    << iShiftPivot;
     2574          Int iTargetNext = m_target_output_pivot_value[iComp][iPivot+1]  << iShiftPivot;
     2575          if ( iCodedPrev <= iSample && iSample < iCodedNext )
     2576          {
     2577            Float fInterpol =  (Float)( (iCodedNext - iSample)*iTargetPrev + (iSample - iCodedPrev)*iTargetNext ) / (Float)(iCodedNext - iCodedPrev) ;
     2578            m_lut1d_output[iComp][k]  = ( (Int)(0.5 + fInterpol) + iOffset ) >> iShift ;
     2579            iPivot = m_num_output_pivots[iComp]; // stop
     2580          }
     2581        }
     2582      }
     2583      else
     2584      {
     2585        m_lut1d_output[iComp][k]  = k;
     2586      }
     2587    }
     2588
     2589    m_lut1d_computed[iComp] = true;
     2590  }
     2591
     2592}
     2593
     2594TComPicYuv* TDecColorMapping::getColorMapping( TComPicYuv* pPicYuvRec, Int iTop, Int curlayerId )
     2595{
     2596  if( !m_colorMapCancelFlag )
     2597  {
     2598    if( !m_pcColorMappingPic[iTop] )
     2599    {
     2600      m_pcColorMappingPic[iTop] = new TComPicYuv;
     2601#if SVC_EXTENSION
     2602      m_pcColorMappingPic[iTop]->create( pPicYuvRec->getWidth(), pPicYuvRec->getHeight(), pPicYuvRec->getChromaFormat(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
     2603#else
     2604      m_pcColorMappingPic[iTop]->create( pPicYuvRec->getWidth(), pPicYuvRec->getHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
     2605#endif
     2606    }
     2607
     2608    Int iHeight   = pPicYuvRec->getHeight();
     2609    Int iWidth    = pPicYuvRec->getWidth();
     2610    Int iStride   = pPicYuvRec->getStride();
     2611    Int iCStride  = pPicYuvRec->getCStride();
     2612
     2613    Pel* Lum0   = pPicYuvRec->getLumaAddr();
     2614    Pel* Cb0    = pPicYuvRec->getCbAddr();
     2615    Pel* Cr0    = pPicYuvRec->getCrAddr();
     2616    Pel* Lum1   = m_pcColorMappingPic[iTop]->getLumaAddr();
     2617    Pel* Cb1    = m_pcColorMappingPic[iTop]->getCbAddr();
     2618    Pel* Cr1    = m_pcColorMappingPic[iTop]->getCrAddr();
     2619
     2620#if SVC_EXTENSION
     2621    Int bitDepthY = g_bitDepthYLayer[curlayerId];
     2622    Int bitDepthC = g_bitDepthCLayer[curlayerId];
     2623
     2624    assert( g_bitDepthY == bitDepthY );
     2625    assert( g_bitDepthC == bitDepthC );
     2626#else
     2627    Int bitDepthY = g_bitDepthY;
     2628    Int bitDepthC = g_bitDepthC;
     2629#endif
     2630
     2631    Int iYShift = (m_colour_map_target_bit_depth >= bitDepthY) ? (m_colour_map_target_bit_depth - bitDepthY) : (0) ;
     2632    Int iCShift = (m_colour_map_target_bit_depth >= bitDepthC) ? (m_colour_map_target_bit_depth - bitDepthC) : (0) ;
     2633    Int offsetY = (1 << (m_log2_matrix_denom+iYShift - 1));
     2634    Int offsetC = (1 << (m_log2_matrix_denom+iCShift - 1));
     2635
     2636    Int   cShift  = 1 ;
     2637
     2638    //Pel*  LumPrev0 = Lum0;
     2639    for( Int y = 0; y < iHeight ; y++ )
     2640    {
     2641      Bool  bDoChroma = (y % 2);
     2642      for( Int x = 0; x < iWidth ; x++ )
     2643      {
     2644        Int s1Y = m_lut1d_input[0][ Lum0[x]   ];
     2645        Int s1U = m_lut1d_input[1][ Cb0[x>>1] ];
     2646        Int s1V = m_lut1d_input[2][ Cr0[x>>1] ];
     2647
     2648        Int s2Y, s2U, s2V;
     2649        if( m_matrix_flag )
     2650        {
     2651          s2Y = ( m_matrix_coef[0][0]*s1Y + m_matrix_coef[0][1]*s1U + m_matrix_coef[0][2]*s1V + offsetY ) >> ( m_log2_matrix_denom + iYShift );
     2652          //s2Y = ClipBD( s2Y , bitDepthY );
     2653          s2Y = ClipY( s2Y );
     2654          Lum1[x]   = m_lut1d_output[0][ s2Y ];
     2655        }
     2656        else
     2657        {
     2658          s1Y       = ( s1Y + offsetY ) >> iYShift ;
     2659          //s1Y = ClipBD( s1Y , bitDepthY );
     2660          s1Y = ClipY( s1Y );
     2661          Lum1[x]   = m_lut1d_output[0][ s1Y ];
     2662        }
     2663
     2664        if( bDoChroma && (x%2) )
     2665        {
     2666          if( m_matrix_flag )
     2667          {
     2668            //s1Y = ( m_lut1d_input[0][ Lum0[x] ] + m_lut1d_input[0][ Lum0[x+1] ] + m_lut1d_input[0][ LumPrev0[x] ] + m_lut1d_input[0][ LumPrev0[x+1] ] + 2 ) >> 2 ;
     2669            //s1Y = m_lut1d_input[0][ (Lum0[x] + Lum0[x+1] + LumPrev0[x] + LumPrev0[x+1] + 2)>>2 ] ;
     2670            s1Y = m_lut1d_input[0][ Lum0[x] ];
     2671
     2672            s2U = ( m_matrix_coef[1][0]*s1Y + m_matrix_coef[1][1]*s1U + m_matrix_coef[1][2]*s1V + offsetC ) >> ( m_log2_matrix_denom + iCShift ) ;
     2673            s2V = ( m_matrix_coef[2][0]*s1Y + m_matrix_coef[2][1]*s1U + m_matrix_coef[2][2]*s1V + offsetC ) >> ( m_log2_matrix_denom + iCShift ) ;
     2674            //s2U = ClipBD( s2U , bitDepthC );
     2675            //s2V = ClipBD( s2V , bitDepthC );
     2676            s2U = ClipC( s2U );
     2677            s2V = ClipC( s2V );
     2678            Cb1[x>>cShift] = m_lut1d_output[1][ s2U ];
     2679            Cr1[x>>cShift] = m_lut1d_output[2][ s2V ];
     2680          }
     2681          else
     2682          {
     2683            s1U       = ( s1U + offsetC ) >> iCShift ;
     2684            s1V       = ( s1V + offsetC ) >> iCShift ;
     2685            //s1U = ClipBD( s1U , bitDepthC );
     2686            //s1V = ClipBD( s1V , bitDepthC );
     2687            s1U = ClipC( s1U );
     2688            s1V = ClipC( s1V );
     2689            Cb1[x>>cShift] = m_lut1d_output[1][ s1U ];
     2690            Cr1[x>>cShift] = m_lut1d_output[2][ s1V ];
     2691          }
     2692        }
     2693
     2694      }
     2695
     2696      //LumPrev0 = Lum0;
     2697      Lum0  += iStride;
     2698      Lum1  += iStride;
     2699      if( bDoChroma )
     2700      {
     2701        Cb0 += iCStride;
     2702        Cr0 += iCStride;
     2703        Cb1 += iCStride;
     2704        Cr1 += iCStride;
     2705      }
     2706    }
     2707
     2708    return m_pcColorMappingPic[iTop];
     2709  }
     2710
     2711  return pPicYuvRec;
     2712}
     2713#endif
     2714
    23072715//! \}
  • trunk/source/Lib/TLibDecoder/TDecTop.h

    r644 r713  
    4545#include "TLibCommon/TComTrQuant.h"
    4646#include "TLibCommon/SEI.h"
     47#if Q0048_CGS_3D_ASYMLUT
     48#include "TLibCommon/TCom3DAsymLUT.h"
     49#endif
    4750
    4851#include "TDecGop.h"
     
    6164// ====================================================================================================================
    6265
     66#if Q0074_SEI_COLOR_MAPPING
     67class TDecColorMapping
     68{
     69  Int   m_colorMapId;
     70  Bool  m_colorMapCancelFlag;
     71  Bool  m_colorMapPersistenceFlag;
     72  Bool  m_colorMap_video_signal_type_present_flag;
     73  Bool  m_colorMap_video_full_range_flag;
     74  Int   m_colorMap_primaries;
     75  Int   m_colorMap_transfer_characteristics;
     76  Int   m_colorMap_matrix_coeffs;
     77  Int   m_colorMapModelId;
     78
     79  Int   m_colour_map_coded_data_bit_depth;
     80  Int   m_colour_map_target_bit_depth;
     81
     82  Int   m_num_input_pivots[3];
     83  Int*  m_coded_input_pivot_value[3];
     84  Int*  m_target_input_pivot_value[3];
     85 
     86  Bool  m_matrix_flag;
     87  Int   m_log2_matrix_denom;
     88  Int   m_matrix_coef[3][3];
     89
     90  Int   m_num_output_pivots[3];
     91  Int*  m_coded_output_pivot_value[3];
     92  Int*  m_target_output_pivot_value[3];
     93
     94  Bool  m_lut1d_computed[3];
     95  Int*  m_lut1d_input[3];
     96  Int*  m_lut1d_output[3];
     97  TComPicYuv* m_pcColorMappingPic[2];
     98
     99public:
     100  TDecColorMapping();
     101  ~TDecColorMapping();
     102
     103  Bool        getColorMappingFlag()                     { return(!m_colorMapCancelFlag);};
     104
     105  Void        setColorMapping( SEIMessages m_SEIs );
     106  Void        setColorMapping( Int bitDepthY, Int bitDepthC );
     107  TComPicYuv* getColorMapping( TComPicYuv* pPicYuvRec, Int iTop=0, Int curlayerId=0 );
     108};// END CLASS DEFINITION TDecColorMapping
     109#endif
     110
    63111/// decoder class
    64112class TDecTop
     
    79127  // functional classes
    80128  TComPrediction          m_cPrediction;
     129#if Q0048_CGS_3D_ASYMLUT
     130  TCom3DAsymLUT           m_c3DAsymLUTPPS;
     131  TComPicYuv*             m_pColorMappedPic;
     132#endif
    81133  TComTrQuant             m_cTrQuant;
    82134  TDecGop                 m_cGopDecoder;
     
    104156  Bool                    m_prevSliceSkipped;
    105157  Int                     m_skippedPOC;
     158#if SETTING_NO_OUT_PIC_PRIOR 
     159  Bool                    m_bFirstSliceInBitstream;
     160  Int                     m_lastPOCNoOutputPriorPics;
     161  Bool                    m_isNoOutputPriorPics;
     162  Bool                    m_craNoRaslOutputFlag;    //value of variable NoRaslOutputFlag of the last CRA pic
     163#endif
    106164
    107165#if SVC_EXTENSION
     
    114172#if AVC_BASE
    115173  fstream*                m_pBLReconFile;
     174#if !REPN_FORMAT_IN_VPS
    116175  Int                     m_iBLSourceWidth;
    117   Int                     m_iBLSourceHeight; 
     176  Int                     m_iBLSourceHeight;
     177#endif
    118178#endif
    119179#if VPS_EXTN_DIRECT_REF_LAYERS
     
    136196#endif
    137197
    138 #if NO_CLRAS_OUTPUT_FLAG
     198#if NO_CLRAS_OUTPUT_FLAG 
    139199  Bool                    m_noClrasOutputFlag;
    140200  Bool                    m_layerInitializedFlag;
    141201  Bool                    m_firstPicInLayerDecodedFlag;
    142   Bool                    m_noOutputOfPriorPicsFlags;
    143 
    144   Bool                   m_bRefreshPending;
    145202#endif
    146203#if RESOLUTION_BASED_DPB
    147   Int                    m_subDpbIdx;     // Index to the sub-DPB that the layer belongs to.
    148                                           // When new VPS is activated, this should be re-initialized to -1
     204  Int                     m_subDpbIdx;     // Index to the sub-DPB that the layer belongs to.
     205                                           // When new VPS is activated, this should be re-initialized to -1
    149206#endif
    150207public:
     208#if Q0074_SEI_COLOR_MAPPING
     209  TDecColorMapping* m_ColorMapping;
     210#endif
     211
    151212  TDecTop();
    152213  virtual ~TDecTop();
     
    166227  Void  deletePicBuffer();
    167228
     229 
     230  TComSPS* getActiveSPS() { return m_parameterSetManagerDecoder.getActiveSPS(); }
     231
     232
    168233  Void executeLoopFilters(Int& poc, TComList<TComPic*>*& rpcListPic);
     234#if SETTING_NO_OUT_PIC_PRIOR 
     235  Void  checkNoOutputPriorPics (TComList<TComPic*>*& rpcListPic);
     236  Bool  getNoOutputPriorPicsFlag ()         { return m_isNoOutputPriorPics; }
     237  Void  setNoOutputPriorPicsFlag (Bool val) { m_isNoOutputPriorPics = val; }
     238#endif
     239
    169240#if SVC_EXTENSION
    170241#if EARLY_REF_PIC_MARKING
     
    212283  Void      setBLReconFile( fstream* pFile ) { m_pBLReconFile = pFile; }
    213284  fstream*  getBLReconFile() { return m_pBLReconFile; }
     285#if !REPN_FORMAT_IN_VPS
    214286  Void      setBLsize( Int iWidth, Int iHeight ) { m_iBLSourceWidth = iWidth; m_iBLSourceHeight = iHeight; }
    215287  Int       getBLWidth() { return  m_iBLSourceWidth; }
    216288  Int       getBLHeight() { return  m_iBLSourceHeight; }
     289#endif
    217290#endif
    218291#if REPN_FORMAT_IN_VPS
     
    238311  Void      setBLSyntaxFile( fstream* pFile ) { m_pBLSyntaxFile = pFile; }
    239312  fstream* getBLSyntaxFile() { return m_pBLSyntaxFile; }
    240 #endif
    241 #if NO_OUTPUT_OF_PRIOR_PICS
    242 #if NO_CLRAS_OUTPUT_FLAG
    243   Bool getNoOutputOfPriorPicsFlags()         { return m_noOutputOfPriorPicsFlags;}
    244   Void setNoOutputOfPriorPicsFlags(Bool x)   { m_noOutputOfPriorPicsFlags = x;   }
    245 #endif
    246313#endif
    247314protected:
     
    261328  Void      xDecodeVPS();
    262329  Void      xDecodeSPS();
    263   Void      xDecodePPS();
     330  Void      xDecodePPS(
     331#if Q0048_CGS_3D_ASYMLUT
     332    TCom3DAsymLUT * pc3DAsymLUT
     333#endif
     334    );
    264335  Void      xDecodeSEI( TComInputBitstream* bs, const NalUnitType nalUnitType );
    265336
     
    271342  Int  getFirstPicInLayerDecodedFlag()       { return m_firstPicInLayerDecodedFlag;}
    272343  Void setFirstPicInLayerDecodedFlag(Bool x) { m_firstPicInLayerDecodedFlag = x;   }
    273 #if !NO_OUTPUT_OF_PRIOR_PICS
    274   Int  getNoOutputOfPriorPicsFlags()         { return m_noOutputOfPriorPicsFlags;}
    275   Void setNoOutputOfPriorPicsFlags(Bool x)   { m_noOutputOfPriorPicsFlags = x;   }
    276 #endif
     344#endif
     345#if Q0048_CGS_3D_ASYMLUT
     346  Void initAsymLut(TComSlice *pcSlice);
    277347#endif
    278348};// END CLASS DEFINITION TDecTop
Note: See TracChangeset for help on using the changeset viewer.