Changeset 1413 in 3DVCSoftware for trunk/source/Lib/TLibDecoder


Ignore:
Timestamp:
11 Jul 2018, 15:19:49 (7 years ago)
Author:
tech
Message:

Merged HTM-16.2-dev@1412

Location:
trunk/source/Lib/TLibDecoder
Files:
2 added
25 edited

Legend:

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

    r1405 r1413  
    44 * granted under this license.
    55 *
    6  * Copyright (c) 2010-2016, ITU/ISO/IEC
     6 * Copyright (c) 2010-2017, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
  • trunk/source/Lib/TLibDecoder/AnnexBread.h

    r1405 r1413  
    44 * granted under this license.
    55 *
    6  * Copyright (c) 2010-2016, ITU/ISO/IEC
     6 * Copyright (c) 2010-2017, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
  • trunk/source/Lib/TLibDecoder/NALread.cpp

    r1405 r1413  
    44 * granted under this license.
    55 *
    6  * Copyright (c) 2010-2016, ITU/ISO/IEC
     6 * Copyright (c) 2010-2017, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
  • trunk/source/Lib/TLibDecoder/NALread.h

    r1405 r1413  
    44 * granted under this license.
    55 *
    6  * Copyright (c) 2010-2016, ITU/ISO/IEC
     6 * Copyright (c) 2010-2017, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
  • trunk/source/Lib/TLibDecoder/SEIread.cpp

    r1405 r1413  
    44 * granted under this license.
    55 *
    6  * Copyright (c) 2010-2016, ITU/ISO/IEC
     6 * Copyright (c) 2010-2017, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    201201    switch (payloadType)
    202202    {
     203    case SEI::BUFFERING_PERIOD:
     204      if (!sps)
     205      {
     206        printf ("Warning: Found Buffering period SEI message, but no active SPS is available. Ignoring.");
     207      }
     208      else
     209      {
     210        sei = new SEIBufferingPeriod;
     211        xParseSEIBufferingPeriod((SEIBufferingPeriod&) *sei, payloadSize, sps, pDecodedMessageOutputStream);
     212      }
     213      break;
     214    case SEI::PICTURE_TIMING:
     215      if (!sps)
     216      {
     217        printf ("Warning: Found Picture timing SEI message, but no active SPS is available. Ignoring.");
     218      }
     219      else
     220      {
     221        sei = new SEIPictureTiming;
     222        xParseSEIPictureTiming((SEIPictureTiming&)*sei, payloadSize, sps, pDecodedMessageOutputStream);
     223      }
     224      break;
     225    case SEI::PAN_SCAN_RECT:
     226      sei = new SEIPanScanRect;
     227      xParseSEIPanScanRect((SEIPanScanRect&) *sei, payloadSize, pDecodedMessageOutputStream);
     228      break;
     229    case SEI::FILLER_PAYLOAD:
     230      sei = new SEIFillerPayload;
     231      xParseSEIFillerPayload((SEIFillerPayload&) *sei, payloadSize, pDecodedMessageOutputStream);
     232      break;
     233    case SEI::USER_DATA_REGISTERED_ITU_T_T35:
     234      sei = new SEIUserDataRegistered;
     235      xParseSEIUserDataRegistered((SEIUserDataRegistered&) *sei, payloadSize, pDecodedMessageOutputStream);
     236      break;
    203237    case SEI::USER_DATA_UNREGISTERED:
    204       sei = new SEIuserDataUnregistered;
    205       xParseSEIuserDataUnregistered((SEIuserDataUnregistered&) *sei, payloadSize, pDecodedMessageOutputStream);
     238      sei = new SEIUserDataUnregistered;
     239      xParseSEIUserDataUnregistered((SEIUserDataUnregistered&) *sei, payloadSize, pDecodedMessageOutputStream);
     240      break;
     241    case SEI::RECOVERY_POINT:
     242      sei = new SEIRecoveryPoint;
     243      xParseSEIRecoveryPoint((SEIRecoveryPoint&) *sei, payloadSize, pDecodedMessageOutputStream);
     244      break;
     245    case SEI::SCENE_INFO:
     246      sei = new SEISceneInfo;
     247      xParseSEISceneInfo((SEISceneInfo&) *sei, payloadSize, pDecodedMessageOutputStream);
     248      break;
     249    case SEI::PICTURE_SNAPSHOT:
     250      sei = new SEIPictureSnapshot;
     251      xParseSEIPictureSnapshot((SEIPictureSnapshot&) *sei, payloadSize, pDecodedMessageOutputStream);
     252      break;
     253    case SEI::PROGRESSIVE_REFINEMENT_SEGMENT_START:
     254      sei = new SEIProgressiveRefinementSegmentStart;
     255      xParseSEIProgressiveRefinementSegmentStart((SEIProgressiveRefinementSegmentStart&) *sei, payloadSize, pDecodedMessageOutputStream);
     256      break;
     257    case SEI::PROGRESSIVE_REFINEMENT_SEGMENT_END:
     258      sei = new SEIProgressiveRefinementSegmentEnd;
     259      xParseSEIProgressiveRefinementSegmentEnd((SEIProgressiveRefinementSegmentEnd&) *sei, payloadSize, pDecodedMessageOutputStream);
     260      break;
     261    case SEI::FILM_GRAIN_CHARACTERISTICS:
     262      sei = new SEIFilmGrainCharacteristics;
     263      xParseSEIFilmGrainCharacteristics((SEIFilmGrainCharacteristics&) *sei, payloadSize, pDecodedMessageOutputStream);
     264      break;
     265    case SEI::POST_FILTER_HINT:
     266      if (!sps)
     267      {
     268        printf ("Warning: post filter hint SEI message, but no active SPS is available. Ignoring.");
     269      }
     270      else
     271      {
     272        sei = new SEIPostFilterHint;
     273        xParseSEIPostFilterHint((SEIPostFilterHint&) *sei, payloadSize, sps, pDecodedMessageOutputStream);
     274      }
     275      break;
     276    case SEI::TONE_MAPPING_INFO:
     277      sei = new SEIToneMappingInfo;
     278      xParseSEIToneMappingInfo((SEIToneMappingInfo&) *sei, payloadSize, pDecodedMessageOutputStream);
     279      break;
     280    case SEI::FRAME_PACKING:
     281      sei = new SEIFramePacking;
     282      xParseSEIFramePacking((SEIFramePacking&) *sei, payloadSize, pDecodedMessageOutputStream);
     283      break;
     284    case SEI::DISPLAY_ORIENTATION:
     285      sei = new SEIDisplayOrientation;
     286      xParseSEIDisplayOrientation((SEIDisplayOrientation&) *sei, payloadSize, pDecodedMessageOutputStream);
     287      break;
     288    case SEI::GREEN_METADATA:
     289      sei = new SEIGreenMetadataInfo;
     290      xParseSEIGreenMetadataInfo((SEIGreenMetadataInfo&) *sei, payloadSize, pDecodedMessageOutputStream);
     291      break;
     292    case SEI::SOP_DESCRIPTION:
     293      sei = new SEISOPDescription;
     294      xParseSEISOPDescription((SEISOPDescription&) *sei, payloadSize, pDecodedMessageOutputStream);
    206295      break;
    207296    case SEI::ACTIVE_PARAMETER_SETS:
     
    220309      }
    221310      break;
    222     case SEI::BUFFERING_PERIOD:
    223       if (!sps)
    224       {
    225         printf ("Warning: Found Buffering period SEI message, but no active SPS is available. Ignoring.");
    226       }
    227       else
    228       {
    229         sei = new SEIBufferingPeriod;
    230         xParseSEIBufferingPeriod((SEIBufferingPeriod&) *sei, payloadSize, sps, pDecodedMessageOutputStream);
    231       }
    232       break;
    233     case SEI::PICTURE_TIMING:
    234       if (!sps)
    235       {
    236         printf ("Warning: Found Picture timing SEI message, but no active SPS is available. Ignoring.");
    237       }
    238       else
    239       {
    240         sei = new SEIPictureTiming;
    241         xParseSEIPictureTiming((SEIPictureTiming&)*sei, payloadSize, sps, pDecodedMessageOutputStream);
    242       }
    243       break;
    244     case SEI::RECOVERY_POINT:
    245       sei = new SEIRecoveryPoint;
    246       xParseSEIRecoveryPoint((SEIRecoveryPoint&) *sei, payloadSize, pDecodedMessageOutputStream);
    247       break;
    248     case SEI::FRAME_PACKING:
    249       sei = new SEIFramePacking;
    250       xParseSEIFramePacking((SEIFramePacking&) *sei, payloadSize, pDecodedMessageOutputStream);
     311    case SEI::TEMPORAL_LEVEL0_INDEX:
     312      sei = new SEITemporalLevel0Index;
     313      xParseSEITemporalLevel0Index((SEITemporalLevel0Index&) *sei, payloadSize, pDecodedMessageOutputStream);
     314      break;
     315#if NH_MV
     316      xParseSEIScalableNesting((SEIScalableNesting&) *sei, nalUnitType, payloadSize, vps, sps, pDecodedMessageOutputStream);
     317#else
     318    case SEI::SCALABLE_NESTING:
     319      sei = new SEIScalableNesting;
     320      xParseSEIScalableNesting((SEIScalableNesting&) *sei, nalUnitType, payloadSize, sps, pDecodedMessageOutputStream);
     321#endif
     322      break;
     323    case SEI::REGION_REFRESH_INFO:
     324      sei = new SEIRegionRefreshInfo;
     325      xParseSEIRegionRefreshInfo((SEIRegionRefreshInfo&) *sei, payloadSize, pDecodedMessageOutputStream);
     326      break;
     327    case SEI::NO_DISPLAY:
     328      sei = new SEINoDisplay;
     329      xParseSEINoDisplay((SEINoDisplay&) *sei, payloadSize, pDecodedMessageOutputStream);
     330      break;
     331    case SEI::TIME_CODE:
     332      sei = new SEITimeCode;
     333      xParseSEITimeCode((SEITimeCode&) *sei, payloadSize, pDecodedMessageOutputStream);
     334      break;
     335    case SEI::MASTERING_DISPLAY_COLOUR_VOLUME:
     336      sei = new SEIMasteringDisplayColourVolume;
     337      xParseSEIMasteringDisplayColourVolume((SEIMasteringDisplayColourVolume&) *sei, payloadSize, pDecodedMessageOutputStream);
    251338      break;
    252339    case SEI::SEGM_RECT_FRAME_PACKING:
     
    254341      xParseSEISegmentedRectFramePacking((SEISegmentedRectFramePacking&) *sei, payloadSize, pDecodedMessageOutputStream);
    255342      break;
    256     case SEI::DISPLAY_ORIENTATION:
    257       sei = new SEIDisplayOrientation;
    258       xParseSEIDisplayOrientation((SEIDisplayOrientation&) *sei, payloadSize, pDecodedMessageOutputStream);
    259       break;
    260     case SEI::TEMPORAL_LEVEL0_INDEX:
    261       sei = new SEITemporalLevel0Index;
    262       xParseSEITemporalLevel0Index((SEITemporalLevel0Index&) *sei, payloadSize, pDecodedMessageOutputStream);
    263       break;
    264     case SEI::REGION_REFRESH_INFO:
    265       sei = new SEIGradualDecodingRefreshInfo;
    266       xParseSEIRegionRefreshInfo((SEIGradualDecodingRefreshInfo&) *sei, payloadSize, pDecodedMessageOutputStream);
    267       break;
    268     case SEI::NO_DISPLAY:
    269       sei = new SEINoDisplay;
    270       xParseSEINoDisplay((SEINoDisplay&) *sei, payloadSize, pDecodedMessageOutputStream);
    271       break;
    272     case SEI::TONE_MAPPING_INFO:
    273       sei = new SEIToneMappingInfo;
    274       xParseSEIToneMappingInfo((SEIToneMappingInfo&) *sei, payloadSize, pDecodedMessageOutputStream);
    275       break;
    276     case SEI::SOP_DESCRIPTION:
    277       sei = new SEISOPDescription;
    278       xParseSEISOPDescription((SEISOPDescription&) *sei, payloadSize, pDecodedMessageOutputStream);
    279       break;
    280     case SEI::SCALABLE_NESTING:
    281       sei = new SEIScalableNesting;
    282 #if NH_MV
    283       xParseSEIScalableNesting((SEIScalableNesting&) *sei, nalUnitType, payloadSize, vps, sps, pDecodedMessageOutputStream);
    284 #else
    285       xParseSEIScalableNesting((SEIScalableNesting&) *sei, nalUnitType, payloadSize, sps, pDecodedMessageOutputStream);
    286 #endif
    287       break;
    288343    case SEI::TEMP_MOTION_CONSTRAINED_TILE_SETS:
    289344      sei = new SEITempMotionConstrainedTileSets;
    290345      xParseSEITempMotionConstraintsTileSets((SEITempMotionConstrainedTileSets&) *sei, payloadSize, pDecodedMessageOutputStream);
    291346      break;
    292     case SEI::TIME_CODE:
    293       sei = new SEITimeCode;
    294       xParseSEITimeCode((SEITimeCode&) *sei, payloadSize, pDecodedMessageOutputStream);
    295       break;
    296347    case SEI::CHROMA_RESAMPLING_FILTER_HINT:
    297348      sei = new SEIChromaResamplingFilterHint;
    298349      xParseSEIChromaResamplingFilterHint((SEIChromaResamplingFilterHint&) *sei, payloadSize, pDecodedMessageOutputStream);
    299       //}
    300350      break;
    301351    case SEI::KNEE_FUNCTION_INFO:
     
    307357      xParseSEIColourRemappingInfo((SEIColourRemappingInfo&) *sei, payloadSize, pDecodedMessageOutputStream);
    308358      break;
    309     case SEI::MASTERING_DISPLAY_COLOUR_VOLUME:
    310       sei = new SEIMasteringDisplayColourVolume;
    311       xParseSEIMasteringDisplayColourVolume((SEIMasteringDisplayColourVolume&) *sei, payloadSize, pDecodedMessageOutputStream);
    312       break;
    313 #if U0033_ALTERNATIVE_TRANSFER_CHARACTERISTICS_SEI
     359    case SEI::DEINTERLACE_FIELD_IDENTIFICATION:
     360      sei = new SEIDeinterlaceFieldIdentification;
     361      xParseSEIDeinterlaceFieldIdentification((SEIDeinterlaceFieldIdentification&) *sei, payloadSize, pDecodedMessageOutputStream);
     362      break;
     363    case SEI::CONTENT_LIGHT_LEVEL_INFO:
     364      sei = new SEIContentLightLevelInfo;
     365      xParseSEIContentLightLevelInfo((SEIContentLightLevelInfo&) *sei, payloadSize, pDecodedMessageOutputStream);
     366      break;
     367    case SEI::DEPENDENT_RAP_INDICATION:
     368      sei = new SEIDependentRAPIndication;
     369      xParseSEIDependentRAPIndication((SEIDependentRAPIndication&) *sei, payloadSize, pDecodedMessageOutputStream);
     370      break;
     371    case SEI::CODED_REGION_COMPLETION:
     372      sei = new SEICodedRegionCompletion;
     373      xParseSEICodedRegionCompletion((SEICodedRegionCompletion&) *sei, payloadSize, pDecodedMessageOutputStream);
     374      break;
    314375    case SEI::ALTERNATIVE_TRANSFER_CHARACTERISTICS:
    315376      sei = new SEIAlternativeTransferCharacteristics;
    316377      xParseSEIAlternativeTransferCharacteristics((SEIAlternativeTransferCharacteristics&) *sei, payloadSize, pDecodedMessageOutputStream);
    317378      break;
    318 #endif
     379    case SEI::AMBIENT_VIEWING_ENVIRONMENT:
     380      sei = new SEIAmbientViewingEnvironment;
     381      xParseSEIAmbientViewingEnvironment((SEIAmbientViewingEnvironment&) *sei, payloadSize, pDecodedMessageOutputStream);
     382      break;
    319383#if NH_MV
    320384    case SEI::LAYERS_NOT_PRESENT:
     
    412476    switch (payloadType)
    413477    {
     478      case SEI::FILLER_PAYLOAD:
     479        sei = new SEIFillerPayload;
     480        xParseSEIFillerPayload((SEIFillerPayload&) *sei, payloadSize, pDecodedMessageOutputStream);
     481        break;
     482      case SEI::USER_DATA_REGISTERED_ITU_T_T35:
     483        sei = new SEIUserDataRegistered;
     484        xParseSEIUserDataRegistered((SEIUserDataRegistered&) *sei, payloadSize, pDecodedMessageOutputStream);
     485        break;
    414486      case SEI::USER_DATA_UNREGISTERED:
    415         sei = new SEIuserDataUnregistered;
    416         xParseSEIuserDataUnregistered((SEIuserDataUnregistered&) *sei, payloadSize, pDecodedMessageOutputStream);
     487        sei = new SEIUserDataUnregistered;
     488        xParseSEIUserDataUnregistered((SEIUserDataUnregistered&) *sei, payloadSize, pDecodedMessageOutputStream);
     489        break;
     490      case SEI::PROGRESSIVE_REFINEMENT_SEGMENT_END:
     491        sei = new SEIProgressiveRefinementSegmentEnd;
     492        xParseSEIProgressiveRefinementSegmentEnd((SEIProgressiveRefinementSegmentEnd&) *sei, payloadSize, pDecodedMessageOutputStream);
     493        break;
     494      case SEI::POST_FILTER_HINT:
     495        if (!sps)
     496        {
     497          printf ("Warning: post filter hint SEI message, but no active SPS is available. Ignoring.");
     498        }
     499        else
     500        {
     501          sei = new SEIPostFilterHint;
     502          xParseSEIPostFilterHint((SEIPostFilterHint&) *sei, payloadSize, sps, pDecodedMessageOutputStream);
     503        }
    417504        break;
    418505      case SEI::DECODED_PICTURE_HASH:
    419506        sei = new SEIDecodedPictureHash;
    420507        xParseSEIDecodedPictureHash((SEIDecodedPictureHash&) *sei, payloadSize, pDecodedMessageOutputStream);
     508        break;
     509      case SEI::CODED_REGION_COMPLETION:
     510        sei = new SEICodedRegionCompletion;
     511        xParseSEICodedRegionCompletion((SEICodedRegionCompletion&) *sei, payloadSize, pDecodedMessageOutputStream);
    421512        break;
    422513      default:
     
    484575}
    485576
    486 /**
    487  * parse bitstream bs and unpack a user_data_unregistered SEI message
    488  * of payloasSize bytes into sei.
    489  */
    490 
    491 Void SEIReader::xParseSEIuserDataUnregistered(SEIuserDataUnregistered &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
    492 {
    493   assert(payloadSize >= ISO_IEC_11578_LEN);
    494   UInt val;
    495   output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
    496 
    497   for (UInt i = 0; i < ISO_IEC_11578_LEN; i++)
    498   {
    499     sei_read_code( pDecodedMessageOutputStream, 8, val, "uuid_iso_iec_11578");
    500     sei.uuid_iso_iec_11578[i] = val;
    501   }
    502 
    503   sei.userDataLength = payloadSize - ISO_IEC_11578_LEN;
    504   if (!sei.userDataLength)
    505   {
    506     sei.userData = 0;
    507     return;
    508   }
    509 
    510   sei.userData = new UChar[sei.userDataLength];
    511   for (UInt i = 0; i < sei.userDataLength; i++)
    512   {
    513     sei_read_code( NULL, 8, val, "user_data_payload_byte" );
    514     sei.userData[i] = val;
    515   }
    516   if (pDecodedMessageOutputStream)
    517   {
    518     (*pDecodedMessageOutputStream) << "  User data payload size: " << sei.userDataLength << "\n";
    519   }
    520 }
    521 
    522 /**
    523  * parse bitstream bs and unpack a decoded picture hash SEI message
    524  * of payloadSize bytes into sei.
    525  */
    526 Void SEIReader::xParseSEIDecodedPictureHash(SEIDecodedPictureHash& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
    527 {
    528   UInt bytesRead = 0;
    529   output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
    530 
    531   UInt val;
    532   sei_read_code( pDecodedMessageOutputStream, 8, val, "hash_type");
    533   sei.method = static_cast<HashType>(val); bytesRead++;
    534 
    535   const TChar *traceString="\0";
    536   switch (sei.method)
    537   {
    538     case HASHTYPE_MD5: traceString="picture_md5"; break;
    539     case HASHTYPE_CRC: traceString="picture_crc"; break;
    540     case HASHTYPE_CHECKSUM: traceString="picture_checksum"; break;
    541     default: assert(false); break;
    542   }
    543 
    544   if (pDecodedMessageOutputStream)
    545   {
    546     (*pDecodedMessageOutputStream) << "  " << std::setw(55) << traceString << ": " << std::hex << std::setfill('0');
    547   }
    548 
    549   sei.m_pictureHash.hash.clear();
    550   for(;bytesRead < payloadSize; bytesRead++)
    551   {
    552     sei_read_code( NULL, 8, val, traceString);
    553     sei.m_pictureHash.hash.push_back((UChar)val);
    554     if (pDecodedMessageOutputStream)
    555     {
    556       (*pDecodedMessageOutputStream) << std::setw(2) << val;
    557     }
    558   }
    559 
    560   if (pDecodedMessageOutputStream)
    561   {
    562     (*pDecodedMessageOutputStream) << std::dec << std::setfill(' ') << "\n";
    563   }
    564 }
    565 
    566 Void SEIReader::xParseSEIActiveParameterSets(SEIActiveParameterSets& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
    567 {
    568   UInt val;
    569   output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
    570 
    571   sei_read_code( pDecodedMessageOutputStream, 4, val, "active_video_parameter_set_id");   sei.activeVPSId = val;
    572   sei_read_flag( pDecodedMessageOutputStream,    val, "self_contained_cvs_flag");         sei.m_selfContainedCvsFlag     = (val != 0);
    573   sei_read_flag( pDecodedMessageOutputStream,    val, "no_parameter_set_update_flag");    sei.m_noParameterSetUpdateFlag = (val != 0);
    574   sei_read_uvlc( pDecodedMessageOutputStream,    val, "num_sps_ids_minus1");              sei.numSpsIdsMinus1 = val;
    575 
    576   sei.activeSeqParameterSetId.resize(sei.numSpsIdsMinus1 + 1);
    577   for (Int i=0; i < (sei.numSpsIdsMinus1 + 1); i++)
    578   {
    579     sei_read_uvlc( pDecodedMessageOutputStream, val, "active_seq_parameter_set_id[i]");    sei.activeSeqParameterSetId[i] = val;
    580   }
    581 }
    582 
    583 Void SEIReader::xParseSEIDecodingUnitInfo(SEIDecodingUnitInfo& sei, UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
    584 {
    585   UInt val;
    586   output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
    587   sei_read_uvlc( pDecodedMessageOutputStream, val, "decoding_unit_idx");
    588   sei.m_decodingUnitIdx = val;
    589 
    590   const TComVUI *vui = sps->getVuiParameters();
    591   if(vui->getHrdParameters()->getSubPicCpbParamsInPicTimingSEIFlag())
    592   {
    593     sei_read_code( pDecodedMessageOutputStream, ( vui->getHrdParameters()->getDuCpbRemovalDelayLengthMinus1() + 1 ), val, "du_spt_cpb_removal_delay_increment");
    594     sei.m_duSptCpbRemovalDelay = val;
    595   }
    596   else
    597   {
    598     sei.m_duSptCpbRemovalDelay = 0;
    599   }
    600   sei_read_flag( pDecodedMessageOutputStream, val, "dpb_output_du_delay_present_flag"); sei.m_dpbOutputDuDelayPresentFlag = (val != 0);
    601   if(sei.m_dpbOutputDuDelayPresentFlag)
    602   {
    603     sei_read_code( pDecodedMessageOutputStream, vui->getHrdParameters()->getDpbOutputDelayDuLengthMinus1() + 1, val, "pic_spt_dpb_output_du_delay");
    604     sei.m_picSptDpbOutputDuDelay = val;
    605   }
    606 }
    607577
    608578Void SEIReader::xParseSEIBufferingPeriod(SEIBufferingPeriod& sei, UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
     
    713683}
    714684
     685Void SEIReader::xParseSEIPanScanRect(SEIPanScanRect& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     686{
     687  UInt code;
     688  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     689  sei_read_uvlc( pDecodedMessageOutputStream, code, "pan_scan_rect_id" );          sei.m_panScanRectId = code;
     690  sei_read_flag( pDecodedMessageOutputStream, code, "pan_scan_rect_cancel_flag" ); sei.m_panScanRectCancelFlag = code!=0;
     691  if (!sei.m_panScanRectCancelFlag)
     692  {
     693    UInt numRegions;
     694    sei_read_uvlc( pDecodedMessageOutputStream, numRegions, "pan_scan_cnt_minus1" ); numRegions++;
     695    sei.m_panScanRectRegions.resize(numRegions);
     696    for(UInt region=0; region<numRegions; region++)
     697    {
     698      SEIPanScanRect::PanScanRect &rect=sei.m_panScanRectRegions[region];
     699      Int  i;
     700      sei_read_svlc( pDecodedMessageOutputStream, i, "pan_scan_rect_left_offset[i]" );   rect.leftOffset   = i;
     701      sei_read_svlc( pDecodedMessageOutputStream, i, "pan_scan_rect_right_offset[i]" );  rect.rightOffset  = i;
     702      sei_read_svlc( pDecodedMessageOutputStream, i, "pan_scan_rect_top_offset[i]" );    rect.topOffset    = i;
     703      sei_read_svlc( pDecodedMessageOutputStream, i, "pan_scan_rect_bottom_offset[i]" ); rect.bottomOffset = i;
     704    }
     705    sei_read_flag( pDecodedMessageOutputStream, code, "pan_scan_rect_persistence_flag" ); sei.m_panScanRectPersistenceFlag = code!=0;
     706  }
     707  else
     708  {
     709    sei.m_panScanRectRegions.clear();
     710    sei.m_panScanRectPersistenceFlag=false;
     711  }
     712}
     713
     714Void SEIReader::xParseSEIFillerPayload(SEIFillerPayload& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     715{
     716  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     717  sei.m_numFillerFFBytes = payloadSize;
     718  Bool allBytesWereFF=true;
     719  for(UInt k=0; k<payloadSize; k++)
     720  {
     721    UInt code;
     722    sei_read_code( NULL, 8, code, "ff_byte" );
     723    if (code!=0xff) allBytesWereFF=false;
     724  }
     725  if (pDecodedMessageOutputStream && !allBytesWereFF)
     726  {
     727    (*pDecodedMessageOutputStream) << "  not all filler payload bytes were 0xff\n";
     728  }
     729}
     730
     731
     732Void SEIReader::xParseSEIUserDataRegistered(SEIUserDataRegistered& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     733  {
     734  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     735
     736  UInt code;
     737  assert(payloadSize>0);
     738  sei_read_code( pDecodedMessageOutputStream, 8, code, "itu_t_t35_country_code" ); payloadSize--;
     739  if (code == 255)
     740  {
     741    assert(payloadSize>0);
     742    sei_read_code( pDecodedMessageOutputStream, 8, code, "itu_t_t35_country_code_extension_byte" ); payloadSize--;
     743    code+=255;
     744  }
     745  sei.m_ituCountryCode = code;
     746  sei.m_userData.resize(payloadSize);
     747  for (UInt i = 0; i < sei.m_userData.size(); i++)
     748  {
     749    sei_read_code( NULL, 8, code, "itu_t_t35_payload_byte" );
     750    sei.m_userData[i] = code;
     751  }
     752  if (pDecodedMessageOutputStream)
     753  {
     754    (*pDecodedMessageOutputStream) << "  itu_t_t35 payload size: " << sei.m_userData.size() << "\n";
     755  }
     756}
     757
     758Void SEIReader::xParseSEIUserDataUnregistered(SEIUserDataUnregistered &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     759    {
     760  assert(payloadSize >= ISO_IEC_11578_LEN);
     761  UInt val;
     762  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     763
     764  for (UInt i = 0; i < ISO_IEC_11578_LEN; i++)
     765  {
     766    sei_read_code( pDecodedMessageOutputStream, 8, val, "uuid_iso_iec_11578");
     767    sei.m_uuid_iso_iec_11578[i] = val;
     768    }
     769  sei.m_userData.resize(payloadSize - ISO_IEC_11578_LEN);
     770  for (UInt i = 0; i < sei.m_userData.size(); i++)
     771  {
     772    sei_read_code( NULL, 8, val, "user_data_payload_byte" );
     773    sei.m_userData[i] = val;
     774  }
     775  if (pDecodedMessageOutputStream)
     776  {
     777    (*pDecodedMessageOutputStream) << "  User data payload size: " << sei.m_userData.size() << "\n";
     778  }
     779}
     780
     781
    715782Void SEIReader::xParseSEIRecoveryPoint(SEIRecoveryPoint& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
    716783{
     
    724791}
    725792
    726 Void SEIReader::xParseSEIFramePacking(SEIFramePacking& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
    727 {
    728   UInt val;
    729   output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
    730 
    731   sei_read_uvlc( pDecodedMessageOutputStream, val, "frame_packing_arrangement_id" );                 sei.m_arrangementId = val;
    732   sei_read_flag( pDecodedMessageOutputStream, val, "frame_packing_arrangement_cancel_flag" );        sei.m_arrangementCancelFlag = val;
    733 
    734   if ( !sei.m_arrangementCancelFlag )
    735   {
    736     sei_read_code( pDecodedMessageOutputStream, 7, val, "frame_packing_arrangement_type" );          sei.m_arrangementType = val;
    737     assert((sei.m_arrangementType > 2) && (sei.m_arrangementType < 6) );
    738 
    739     sei_read_flag( pDecodedMessageOutputStream, val, "quincunx_sampling_flag" );                     sei.m_quincunxSamplingFlag = val;
    740 
    741     sei_read_code( pDecodedMessageOutputStream, 6, val, "content_interpretation_type" );             sei.m_contentInterpretationType = val;
    742     sei_read_flag( pDecodedMessageOutputStream, val, "spatial_flipping_flag" );                      sei.m_spatialFlippingFlag = val;
    743     sei_read_flag( pDecodedMessageOutputStream, val, "frame0_flipped_flag" );                        sei.m_frame0FlippedFlag = val;
    744     sei_read_flag( pDecodedMessageOutputStream, val, "field_views_flag" );                           sei.m_fieldViewsFlag = val;
    745     sei_read_flag( pDecodedMessageOutputStream, val, "current_frame_is_frame0_flag" );               sei.m_currentFrameIsFrame0Flag = val;
    746     sei_read_flag( pDecodedMessageOutputStream, val, "frame0_self_contained_flag" );                 sei.m_frame0SelfContainedFlag = val;
    747     sei_read_flag( pDecodedMessageOutputStream, val, "frame1_self_contained_flag" );                 sei.m_frame1SelfContainedFlag = val;
    748 
    749     if ( sei.m_quincunxSamplingFlag == 0 && sei.m_arrangementType != 5)
    750     {
    751       sei_read_code( pDecodedMessageOutputStream, 4, val, "frame0_grid_position_x" );                sei.m_frame0GridPositionX = val;
    752       sei_read_code( pDecodedMessageOutputStream, 4, val, "frame0_grid_position_y" );                sei.m_frame0GridPositionY = val;
    753       sei_read_code( pDecodedMessageOutputStream, 4, val, "frame1_grid_position_x" );                sei.m_frame1GridPositionX = val;
    754       sei_read_code( pDecodedMessageOutputStream, 4, val, "frame1_grid_position_y" );                sei.m_frame1GridPositionY = val;
    755     }
    756 
    757     sei_read_code( pDecodedMessageOutputStream, 8, val, "frame_packing_arrangement_reserved_byte" );   sei.m_arrangementReservedByte = val;
    758     sei_read_flag( pDecodedMessageOutputStream, val,  "frame_packing_arrangement_persistence_flag" );  sei.m_arrangementPersistenceFlag = (val != 0);
    759   }
    760   sei_read_flag( pDecodedMessageOutputStream, val, "upsampled_aspect_ratio_flag" );                  sei.m_upsampledAspectRatio = val;
    761 }
    762 
    763 Void SEIReader::xParseSEISegmentedRectFramePacking(SEISegmentedRectFramePacking& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
    764 {
    765   UInt val;
    766   output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
    767   sei_read_flag( pDecodedMessageOutputStream, val,       "segmented_rect_frame_packing_arrangement_cancel_flag" );       sei.m_arrangementCancelFlag            = val;
    768   if( !sei.m_arrangementCancelFlag )
    769   {
    770     sei_read_code( pDecodedMessageOutputStream, 2, val, "segmented_rect_content_interpretation_type" );                sei.m_contentInterpretationType = val;
    771     sei_read_flag( pDecodedMessageOutputStream, val,     "segmented_rect_frame_packing_arrangement_persistence" );                              sei.m_arrangementPersistenceFlag               = val;
    772   }
    773 }
    774 
    775 Void SEIReader::xParseSEIDisplayOrientation(SEIDisplayOrientation& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
    776 {
    777   UInt val;
    778   output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
    779   sei_read_flag( pDecodedMessageOutputStream, val,       "display_orientation_cancel_flag" );       sei.cancelFlag            = val;
    780   if( !sei.cancelFlag )
    781   {
    782     sei_read_flag( pDecodedMessageOutputStream, val,     "hor_flip" );                              sei.horFlip               = val;
    783     sei_read_flag( pDecodedMessageOutputStream, val,     "ver_flip" );                              sei.verFlip               = val;
    784     sei_read_code( pDecodedMessageOutputStream, 16, val, "anticlockwise_rotation" );                sei.anticlockwiseRotation = val;
    785     sei_read_flag( pDecodedMessageOutputStream, val,     "display_orientation_persistence_flag" );  sei.persistenceFlag       = val;
    786   }
    787 }
    788 
    789 Void SEIReader::xParseSEITemporalLevel0Index(SEITemporalLevel0Index& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
    790 {
    791   UInt val;
    792   output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
    793   sei_read_code( pDecodedMessageOutputStream, 8, val, "temporal_sub_layer_zero_idx" );  sei.tl0Idx = val;
    794   sei_read_code( pDecodedMessageOutputStream, 8, val, "irap_pic_id" );  sei.rapIdx = val;
    795 }
    796 
    797 Void SEIReader::xParseSEIRegionRefreshInfo(SEIGradualDecodingRefreshInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
    798 {
    799   UInt val;
    800   output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
    801   sei_read_flag( pDecodedMessageOutputStream, val, "refreshed_region_flag" ); sei.m_gdrForegroundFlag = val ? 1 : 0;
    802 }
    803 
    804 Void SEIReader::xParseSEINoDisplay(SEINoDisplay& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
    805 {
    806   output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
    807   sei.m_noDisplay = true;
    808 }
     793
     794Void SEIReader::xParseSEISceneInfo(SEISceneInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     795  {
     796  UInt code;
     797  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     798
     799  sei_read_flag( pDecodedMessageOutputStream, code, "scene_info_present_flag" ); sei.m_bSceneInfoPresentFlag = code!=0;
     800  if (sei.m_bSceneInfoPresentFlag)
     801  {
     802    sei_read_flag( pDecodedMessageOutputStream, code, "prev_scene_id_valid_flag" ); sei.m_bPrevSceneIdValidFlag = code!=0;
     803    sei_read_uvlc( pDecodedMessageOutputStream, code, "scene_id" );                 sei.m_sceneId = code;
     804    sei_read_uvlc( pDecodedMessageOutputStream, code, "scene_transition_type" );    sei.m_sceneTransitionType = code;
     805    if (sei.m_sceneTransitionType > 3)
     806    {
     807      sei_read_uvlc( pDecodedMessageOutputStream, code, "second_scene_id" );        sei.m_secondSceneId = code;
     808    }
     809    else
     810    {
     811      sei.m_secondSceneId = 0; // set to known value.
     812    }
     813  }
     814}
     815
     816Void SEIReader::xParseSEIPictureSnapshot(SEIPictureSnapshot& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     817{
     818  UInt code;
     819  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     820
     821  sei_read_uvlc( pDecodedMessageOutputStream, code, "snapshot_id" ); sei.m_snapshotId = code;
     822  }
     823
     824
     825Void SEIReader::xParseSEIProgressiveRefinementSegmentStart(SEIProgressiveRefinementSegmentStart& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     826{
     827  UInt code;
     828  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     829
     830  sei_read_uvlc( pDecodedMessageOutputStream, code, "progressive_refinement_id" ); sei.m_progressiveRefinementId = code;
     831  sei_read_uvlc( pDecodedMessageOutputStream, code, "pic_order_cnt_delta" );       sei.m_picOrderCntDelta = code;
     832}
     833
     834
     835Void SEIReader::xParseSEIProgressiveRefinementSegmentEnd(SEIProgressiveRefinementSegmentEnd& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     836{
     837  UInt code;
     838  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     839
     840  sei_read_uvlc( pDecodedMessageOutputStream, code, "progressive_refinement_id" ); sei.m_progressiveRefinementId = code;
     841}
     842
     843
     844Void SEIReader::xParseSEIFilmGrainCharacteristics(SEIFilmGrainCharacteristics& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     845{
     846  UInt code;
     847  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     848
     849  sei_read_flag( pDecodedMessageOutputStream, code, "film_grain_characteristics_cancel_flag" );     sei.m_filmGrainCharacteristicsCancelFlag = code!=0;
     850  if (!sei.m_filmGrainCharacteristicsCancelFlag)
     851  {
     852    sei_read_code( pDecodedMessageOutputStream, 2, code, "film_grain_model_id" );                   sei.m_filmGrainModelId = code;
     853    sei_read_flag( pDecodedMessageOutputStream,    code, "separate_colour_description_present_flag" ); sei.m_separateColourDescriptionPresentFlag = code!=0;
     854    if (sei.m_separateColourDescriptionPresentFlag)
     855    {
     856      sei_read_code( pDecodedMessageOutputStream, 3, code, "film_grain_bit_depth_luma_minus8" );    sei.m_filmGrainBitDepthLumaMinus8      = code;
     857      sei_read_code( pDecodedMessageOutputStream, 3, code, "film_grain_bit_depth_chroma_minus8" );  sei.m_filmGrainBitDepthChromaMinus8    = code;
     858      sei_read_flag( pDecodedMessageOutputStream,    code, "film_grain_full_range_flag" );          sei.m_filmGrainFullRangeFlag           = code!=0;
     859      sei_read_code( pDecodedMessageOutputStream, 8, code, "film_grain_colour_primaries" );         sei.m_filmGrainColourPrimaries         = code;
     860      sei_read_code( pDecodedMessageOutputStream, 8, code, "film_grain_transfer_characteristics" ); sei.m_filmGrainTransferCharacteristics = code;
     861      sei_read_code( pDecodedMessageOutputStream, 8, code, "film_grain_matrix_coeffs" );            sei.m_filmGrainMatrixCoeffs            = code;
     862    }
     863    sei_read_code( pDecodedMessageOutputStream, 2, code, "blending_mode_id" );                      sei.m_blendingModeId                   = code;
     864    sei_read_code( pDecodedMessageOutputStream, 4, code, "log2_scale_factor" );                     sei.m_log2ScaleFactor                  = code;
     865    for(Int c=0; c<3; c++)
     866    {
     867      sei_read_flag( pDecodedMessageOutputStream,    code, "comp_model_present_flag[c]" );          sei.m_compModel[c].bPresentFlag        = code!=0;
     868    }
     869    for(Int c=0; c<3; c++)
     870    {
     871      SEIFilmGrainCharacteristics::CompModel &cm=sei.m_compModel[c];
     872      if (cm.bPresentFlag)
     873      {
     874        UInt numIntensityIntervals;
     875        sei_read_code( pDecodedMessageOutputStream, 8, code, "num_intensity_intervals_minus1[c]" ); numIntensityIntervals = code+1;
     876        sei_read_code( pDecodedMessageOutputStream, 3, code, "num_model_values_minus1[c]" );        cm.numModelValues     = code+1;
     877        cm.intensityValues.resize(numIntensityIntervals);
     878        for(UInt interval=0; interval<numIntensityIntervals; interval++)
     879        {
     880          SEIFilmGrainCharacteristics::CompModelIntensityValues &cmiv=cm.intensityValues[interval];
     881          sei_read_code( pDecodedMessageOutputStream, 8, code, "intensity_interval_lower_bound[c][i]" ); cmiv.intensityIntervalLowerBound=code;
     882          sei_read_code( pDecodedMessageOutputStream, 8, code, "intensity_interval_upper_bound[c][i]" ); cmiv.intensityIntervalUpperBound=code;
     883          cmiv.compModelValue.resize(cm.numModelValues);
     884          for(UInt j=0; j<cm.numModelValues; j++)
     885          {
     886            sei_read_svlc( pDecodedMessageOutputStream, cmiv.compModelValue[j], "comp_model_value[c][i]" );
     887          }
     888        }
     889      }
     890    } // for c
     891    sei_read_flag( pDecodedMessageOutputStream, code, "film_grain_characteristics_persistence_flag" ); sei.m_filmGrainCharacteristicsPersistenceFlag = code!=0;
     892  } // cancel flag
     893}
     894
     895Void SEIReader::xParseSEIPostFilterHint(SEIPostFilterHint& sei, UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
     896{
     897  UInt code;
     898  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     899
     900  sei_read_uvlc( pDecodedMessageOutputStream,    code, "filter_hint_size_y" ); sei.m_filterHintSizeY = code;
     901  sei_read_uvlc( pDecodedMessageOutputStream,    code, "filter_hint_size_x" ); sei.m_filterHintSizeX = code;
     902  sei_read_code( pDecodedMessageOutputStream, 2, code, "filter_hint_type"   ); sei.m_filterHintType  = code;
     903
     904  sei.m_bIsMonochrome = (sps->getChromaFormatIdc() == CHROMA_400);
     905  const UInt numChromaChannels = sei.m_bIsMonochrome ? 1:3;
     906
     907  sei.m_filterHintValues.resize(numChromaChannels * sei.m_filterHintSizeX * sei.m_filterHintSizeY);
     908  for(std::size_t i=0; i<sei.m_filterHintValues.size(); i++)
     909  {
     910    Int v;
     911    sei_read_svlc( pDecodedMessageOutputStream, v, "filter_hint_value[][][]" ); sei.m_filterHintValues[i] = code;
     912
     913}
     914}
     915
    809916
    810917Void SEIReader::xParseSEIToneMappingInfo(SEIToneMappingInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     
    8931000}
    8941001
     1002
     1003Void SEIReader::xParseSEIFramePacking(SEIFramePacking& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1004{
     1005  UInt val;
     1006  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1007
     1008  sei_read_uvlc( pDecodedMessageOutputStream, val, "frame_packing_arrangement_id" );                 sei.m_arrangementId = val;
     1009  sei_read_flag( pDecodedMessageOutputStream, val, "frame_packing_arrangement_cancel_flag" );        sei.m_arrangementCancelFlag = val;
     1010
     1011  if ( !sei.m_arrangementCancelFlag )
     1012  {
     1013    sei_read_code( pDecodedMessageOutputStream, 7, val, "frame_packing_arrangement_type" );          sei.m_arrangementType = val;
     1014    assert((sei.m_arrangementType > 2) && (sei.m_arrangementType < 6) );
     1015
     1016    sei_read_flag( pDecodedMessageOutputStream, val, "quincunx_sampling_flag" );                     sei.m_quincunxSamplingFlag = val;
     1017
     1018    sei_read_code( pDecodedMessageOutputStream, 6, val, "content_interpretation_type" );             sei.m_contentInterpretationType = val;
     1019    sei_read_flag( pDecodedMessageOutputStream, val, "spatial_flipping_flag" );                      sei.m_spatialFlippingFlag = val;
     1020    sei_read_flag( pDecodedMessageOutputStream, val, "frame0_flipped_flag" );                        sei.m_frame0FlippedFlag = val;
     1021    sei_read_flag( pDecodedMessageOutputStream, val, "field_views_flag" );                           sei.m_fieldViewsFlag = val;
     1022    sei_read_flag( pDecodedMessageOutputStream, val, "current_frame_is_frame0_flag" );               sei.m_currentFrameIsFrame0Flag = val;
     1023    sei_read_flag( pDecodedMessageOutputStream, val, "frame0_self_contained_flag" );                 sei.m_frame0SelfContainedFlag = val;
     1024    sei_read_flag( pDecodedMessageOutputStream, val, "frame1_self_contained_flag" );                 sei.m_frame1SelfContainedFlag = val;
     1025
     1026    if ( sei.m_quincunxSamplingFlag == 0 && sei.m_arrangementType != 5)
     1027    {
     1028      sei_read_code( pDecodedMessageOutputStream, 4, val, "frame0_grid_position_x" );                sei.m_frame0GridPositionX = val;
     1029      sei_read_code( pDecodedMessageOutputStream, 4, val, "frame0_grid_position_y" );                sei.m_frame0GridPositionY = val;
     1030      sei_read_code( pDecodedMessageOutputStream, 4, val, "frame1_grid_position_x" );                sei.m_frame1GridPositionX = val;
     1031      sei_read_code( pDecodedMessageOutputStream, 4, val, "frame1_grid_position_y" );                sei.m_frame1GridPositionY = val;
     1032    }
     1033
     1034    sei_read_code( pDecodedMessageOutputStream, 8, val, "frame_packing_arrangement_reserved_byte" );   sei.m_arrangementReservedByte = val;
     1035    sei_read_flag( pDecodedMessageOutputStream, val,  "frame_packing_arrangement_persistence_flag" );  sei.m_arrangementPersistenceFlag = (val != 0);
     1036  }
     1037  sei_read_flag( pDecodedMessageOutputStream, val, "upsampled_aspect_ratio_flag" );                  sei.m_upsampledAspectRatio = val;
     1038}
     1039
     1040
     1041Void SEIReader::xParseSEIDisplayOrientation(SEIDisplayOrientation& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1042{
     1043  UInt val;
     1044  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1045  sei_read_flag( pDecodedMessageOutputStream, val,       "display_orientation_cancel_flag" );       sei.cancelFlag            = val;
     1046  if( !sei.cancelFlag )
     1047  {
     1048    sei_read_flag( pDecodedMessageOutputStream, val,     "hor_flip" );                              sei.horFlip               = val;
     1049    sei_read_flag( pDecodedMessageOutputStream, val,     "ver_flip" );                              sei.verFlip               = val;
     1050    sei_read_code( pDecodedMessageOutputStream, 16, val, "anticlockwise_rotation" );                sei.anticlockwiseRotation = val;
     1051    sei_read_flag( pDecodedMessageOutputStream, val,     "display_orientation_persistence_flag" );  sei.persistenceFlag       = val;
     1052  }
     1053}
     1054
     1055
     1056Void SEIReader::xParseSEIGreenMetadataInfo(SEIGreenMetadataInfo& sei, UInt payloadSize, ostream* pDecodedMessageOutputStream)
     1057{
     1058  UInt code;
     1059  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1060
     1061  sei_read_code(pDecodedMessageOutputStream, 8, code, "green_metadata_type");
     1062  sei.m_greenMetadataType = code;
     1063
     1064  sei_read_code(pDecodedMessageOutputStream, 8, code, "xsd_metric_type");
     1065  sei.m_xsdMetricType = code;
     1066
     1067  sei_read_code(pDecodedMessageOutputStream, 16, code, "xsd_metric_value");
     1068  sei.m_xsdMetricValue = code;
     1069}
     1070
     1071
    8951072Void SEIReader::xParseSEISOPDescription(SEISOPDescription &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
    8961073{
     
    9131090      sei_read_svlc( pDecodedMessageOutputStream, iCode,                       "sop_poc_delta[i]"     ); sei.m_sopDescPocDelta[i] = iCode;
    9141091    }
     1092  }
     1093}
     1094
     1095Void SEIReader::xParseSEIActiveParameterSets(SEIActiveParameterSets& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1096{
     1097  UInt val;
     1098  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1099
     1100  sei_read_code( pDecodedMessageOutputStream, 4, val, "active_video_parameter_set_id");   sei.activeVPSId = val;
     1101  sei_read_flag( pDecodedMessageOutputStream,    val, "self_contained_cvs_flag");         sei.m_selfContainedCvsFlag     = (val != 0);
     1102  sei_read_flag( pDecodedMessageOutputStream,    val, "no_parameter_set_update_flag");    sei.m_noParameterSetUpdateFlag = (val != 0);
     1103  sei_read_uvlc( pDecodedMessageOutputStream,    val, "num_sps_ids_minus1");              sei.numSpsIdsMinus1 = val;
     1104
     1105  sei.activeSeqParameterSetId.resize(sei.numSpsIdsMinus1 + 1);
     1106  for (Int i=0; i < (sei.numSpsIdsMinus1 + 1); i++)
     1107  {
     1108    sei_read_uvlc( pDecodedMessageOutputStream, val, "active_seq_parameter_set_id[i]");    sei.activeSeqParameterSetId[i] = val;
     1109  }
     1110}
     1111
     1112
     1113Void SEIReader::xParseSEIDecodingUnitInfo(SEIDecodingUnitInfo& sei, UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
     1114{
     1115  UInt val;
     1116  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1117  sei_read_uvlc( pDecodedMessageOutputStream, val, "decoding_unit_idx");
     1118  sei.m_decodingUnitIdx = val;
     1119
     1120  const TComVUI *vui = sps->getVuiParameters();
     1121  if(vui->getHrdParameters()->getSubPicCpbParamsInPicTimingSEIFlag())
     1122  {
     1123    sei_read_code( pDecodedMessageOutputStream, ( vui->getHrdParameters()->getDuCpbRemovalDelayLengthMinus1() + 1 ), val, "du_spt_cpb_removal_delay_increment");
     1124    sei.m_duSptCpbRemovalDelay = val;
     1125  }
     1126  else
     1127  {
     1128    sei.m_duSptCpbRemovalDelay = 0;
     1129  }
     1130  sei_read_flag( pDecodedMessageOutputStream, val, "dpb_output_du_delay_present_flag"); sei.m_dpbOutputDuDelayPresentFlag = (val != 0);
     1131  if(sei.m_dpbOutputDuDelayPresentFlag)
     1132  {
     1133    sei_read_code( pDecodedMessageOutputStream, vui->getHrdParameters()->getDpbOutputDelayDuLengthMinus1() + 1, val, "pic_spt_dpb_output_du_delay");
     1134    sei.m_picSptDpbOutputDuDelay = val;
     1135  }
     1136}
     1137
     1138
     1139Void SEIReader::xParseSEITemporalLevel0Index(SEITemporalLevel0Index& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1140{
     1141  UInt val;
     1142  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1143  sei_read_code( pDecodedMessageOutputStream, 8, val, "temporal_sub_layer_zero_idx" );  sei.tl0Idx = val;
     1144  sei_read_code( pDecodedMessageOutputStream, 8, val, "irap_pic_id" );  sei.rapIdx = val;
     1145}
     1146
     1147
     1148Void SEIReader::xParseSEIDecodedPictureHash(SEIDecodedPictureHash& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1149{
     1150  UInt bytesRead = 0;
     1151  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1152
     1153  UInt val;
     1154  sei_read_code( pDecodedMessageOutputStream, 8, val, "hash_type");
     1155  sei.method = static_cast<HashType>(val); bytesRead++;
     1156
     1157  const TChar *traceString="\0";
     1158  switch (sei.method)
     1159  {
     1160    case HASHTYPE_MD5: traceString="picture_md5"; break;
     1161    case HASHTYPE_CRC: traceString="picture_crc"; break;
     1162    case HASHTYPE_CHECKSUM: traceString="picture_checksum"; break;
     1163    default: assert(false); break;
     1164  }
     1165
     1166  if (pDecodedMessageOutputStream)
     1167  {
     1168    (*pDecodedMessageOutputStream) << "  " << std::setw(55) << traceString << ": " << std::hex << std::setfill('0');
     1169  }
     1170
     1171  sei.m_pictureHash.hash.clear();
     1172  for(;bytesRead < payloadSize; bytesRead++)
     1173  {
     1174    sei_read_code( NULL, 8, val, traceString);
     1175    sei.m_pictureHash.hash.push_back((UChar)val);
     1176    if (pDecodedMessageOutputStream)
     1177    {
     1178      (*pDecodedMessageOutputStream) << std::setw(2) << val;
     1179    }
     1180  }
     1181
     1182  if (pDecodedMessageOutputStream)
     1183  {
     1184    (*pDecodedMessageOutputStream) << std::dec << std::setfill(' ') << "\n";
    9151185  }
    9161186}
     
    9761246
    9771247
    978 Void SEIReader::xParseSEITempMotionConstraintsTileSets(SEITempMotionConstrainedTileSets& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
    979 {
    980   UInt code;
    981   output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
    982   sei_read_flag( pDecodedMessageOutputStream, code, "mc_all_tiles_exact_sample_value_match_flag");  sei.m_mc_all_tiles_exact_sample_value_match_flag = (code != 0);
    983   sei_read_flag( pDecodedMessageOutputStream, code, "each_tile_one_tile_set_flag");                 sei.m_each_tile_one_tile_set_flag                = (code != 0);
    984 
    985   if(!sei.m_each_tile_one_tile_set_flag)
    986   {
    987     sei_read_flag( pDecodedMessageOutputStream, code, "limited_tile_set_display_flag");  sei.m_limited_tile_set_display_flag = (code != 0);
    988     sei_read_uvlc( pDecodedMessageOutputStream, code, "num_sets_in_message_minus1");     sei.setNumberOfTileSets(code + 1);
    989 
    990     if(sei.getNumberOfTileSets() != 0)
    991     {
    992       for(Int i = 0; i < sei.getNumberOfTileSets(); i++)
    993       {
    994         sei_read_uvlc( pDecodedMessageOutputStream, code, "mcts_id");  sei.tileSetData(i).m_mcts_id = code;
    995 
    996         if(sei.m_limited_tile_set_display_flag)
    997         {
    998           sei_read_flag( pDecodedMessageOutputStream, code, "display_tile_set_flag");  sei.tileSetData(i).m_display_tile_set_flag = (code != 1);
    999         }
    1000 
    1001         sei_read_uvlc( pDecodedMessageOutputStream, code, "num_tile_rects_in_set_minus1");  sei.tileSetData(i).setNumberOfTileRects(code + 1);
    1002 
    1003         for(Int j=0; j<sei.tileSetData(i).getNumberOfTileRects(); j++)
    1004         {
    1005           sei_read_uvlc( pDecodedMessageOutputStream, code, "top_left_tile_index");      sei.tileSetData(i).topLeftTileIndex(j)     = code;
    1006           sei_read_uvlc( pDecodedMessageOutputStream, code, "bottom_right_tile_index");  sei.tileSetData(i).bottomRightTileIndex(j) = code;
    1007         }
    1008 
    1009         if(!sei.m_mc_all_tiles_exact_sample_value_match_flag)
    1010         {
    1011           sei_read_flag( pDecodedMessageOutputStream, code, "exact_sample_value_match_flag");   sei.tileSetData(i).m_exact_sample_value_match_flag    = (code != 0);
    1012         }
    1013         sei_read_flag( pDecodedMessageOutputStream, code, "mcts_tier_level_idc_present_flag");  sei.tileSetData(i).m_mcts_tier_level_idc_present_flag = (code != 0);
    1014 
    1015         if(sei.tileSetData(i).m_mcts_tier_level_idc_present_flag)
    1016         {
    1017           sei_read_flag( pDecodedMessageOutputStream, code,    "mcts_tier_flag"); sei.tileSetData(i).m_mcts_tier_flag = (code != 0);
    1018           sei_read_code( pDecodedMessageOutputStream, 8, code, "mcts_level_idc"); sei.tileSetData(i).m_mcts_level_idc =  code;
    1019         }
    1020       }
    1021     }
    1022   }
    1023   else
    1024   {
    1025     sei_read_flag( pDecodedMessageOutputStream, code, "max_mcs_tier_level_idc_present_flag");  sei.m_max_mcs_tier_level_idc_present_flag = code;
    1026     if(sei.m_max_mcs_tier_level_idc_present_flag)
    1027     {
    1028       sei_read_flag( pDecodedMessageOutputStream, code, "max_mcts_tier_flag");  sei.m_max_mcts_tier_flag = code;
    1029       sei_read_code( pDecodedMessageOutputStream, 8, code, "max_mcts_level_idc"); sei.m_max_mcts_level_idc = code;
    1030     }
    1031   }
    1032 }
     1248Void SEIReader::xParseSEIRegionRefreshInfo(SEIRegionRefreshInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1249{
     1250  UInt val;
     1251  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1252  sei_read_flag( pDecodedMessageOutputStream, val, "refreshed_region_flag" ); sei.m_gdrForegroundFlag = val ? 1 : 0;
     1253        }
     1254
     1255
     1256Void SEIReader::xParseSEINoDisplay(SEINoDisplay& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1257        {
     1258  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1259  sei.m_noDisplay = true;
     1260        }
     1261
    10331262
    10341263Void SEIReader::xParseSEITimeCode(SEITimeCode& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     
    10921321}
    10931322
     1323
     1324Void SEIReader::xParseSEIMasteringDisplayColourVolume(SEIMasteringDisplayColourVolume& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1325{
     1326  UInt code;
     1327  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1328
     1329  sei_read_code( pDecodedMessageOutputStream, 16, code, "display_primaries_x[0]" ); sei.values.primaries[0][0] = code;
     1330  sei_read_code( pDecodedMessageOutputStream, 16, code, "display_primaries_y[0]" ); sei.values.primaries[0][1] = code;
     1331
     1332  sei_read_code( pDecodedMessageOutputStream, 16, code, "display_primaries_x[1]" ); sei.values.primaries[1][0] = code;
     1333  sei_read_code( pDecodedMessageOutputStream, 16, code, "display_primaries_y[1]" ); sei.values.primaries[1][1] = code;
     1334
     1335  sei_read_code( pDecodedMessageOutputStream, 16, code, "display_primaries_x[2]" ); sei.values.primaries[2][0] = code;
     1336  sei_read_code( pDecodedMessageOutputStream, 16, code, "display_primaries_y[2]" ); sei.values.primaries[2][1] = code;
     1337
     1338
     1339  sei_read_code( pDecodedMessageOutputStream, 16, code, "white_point_x" ); sei.values.whitePoint[0] = code;
     1340  sei_read_code( pDecodedMessageOutputStream, 16, code, "white_point_y" ); sei.values.whitePoint[1] = code;
     1341
     1342  sei_read_code( pDecodedMessageOutputStream, 32, code, "max_display_mastering_luminance" ); sei.values.maxLuminance = code;
     1343  sei_read_code( pDecodedMessageOutputStream, 32, code, "min_display_mastering_luminance" ); sei.values.minLuminance = code;
     1344}
     1345
     1346
     1347Void SEIReader::xParseSEISegmentedRectFramePacking(SEISegmentedRectFramePacking& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1348{
     1349  UInt val;
     1350  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1351  sei_read_flag( pDecodedMessageOutputStream, val,       "segmented_rect_frame_packing_arrangement_cancel_flag" );       sei.m_arrangementCancelFlag            = val;
     1352  if( !sei.m_arrangementCancelFlag )
     1353  {
     1354    sei_read_code( pDecodedMessageOutputStream, 2, val, "segmented_rect_content_interpretation_type" );                sei.m_contentInterpretationType = val;
     1355    sei_read_flag( pDecodedMessageOutputStream, val,     "segmented_rect_frame_packing_arrangement_persistence" );                              sei.m_arrangementPersistenceFlag               = val;
     1356  }
     1357}
     1358
     1359
     1360Void SEIReader::xParseSEITempMotionConstraintsTileSets(SEITempMotionConstrainedTileSets& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1361{
     1362  UInt code;
     1363  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1364  sei_read_flag( pDecodedMessageOutputStream, code, "mc_all_tiles_exact_sample_value_match_flag");  sei.m_mc_all_tiles_exact_sample_value_match_flag = (code != 0);
     1365  sei_read_flag( pDecodedMessageOutputStream, code, "each_tile_one_tile_set_flag");                 sei.m_each_tile_one_tile_set_flag                = (code != 0);
     1366
     1367  if(!sei.m_each_tile_one_tile_set_flag)
     1368  {
     1369    sei_read_flag( pDecodedMessageOutputStream, code, "limited_tile_set_display_flag");  sei.m_limited_tile_set_display_flag = (code != 0);
     1370    sei_read_uvlc( pDecodedMessageOutputStream, code, "num_sets_in_message_minus1");     sei.setNumberOfTileSets(code + 1);
     1371
     1372    if(sei.getNumberOfTileSets() != 0)
     1373    {
     1374      for(Int i = 0; i < sei.getNumberOfTileSets(); i++)
     1375      {
     1376        sei_read_uvlc( pDecodedMessageOutputStream, code, "mcts_id");  sei.tileSetData(i).m_mcts_id = code;
     1377
     1378        if(sei.m_limited_tile_set_display_flag)
     1379        {
     1380          sei_read_flag( pDecodedMessageOutputStream, code, "display_tile_set_flag");  sei.tileSetData(i).m_display_tile_set_flag = (code != 1);
     1381        }
     1382
     1383        sei_read_uvlc( pDecodedMessageOutputStream, code, "num_tile_rects_in_set_minus1");  sei.tileSetData(i).setNumberOfTileRects(code + 1);
     1384
     1385        for(Int j=0; j<sei.tileSetData(i).getNumberOfTileRects(); j++)
     1386        {
     1387          sei_read_uvlc( pDecodedMessageOutputStream, code, "top_left_tile_index");      sei.tileSetData(i).topLeftTileIndex(j)     = code;
     1388          sei_read_uvlc( pDecodedMessageOutputStream, code, "bottom_right_tile_index");  sei.tileSetData(i).bottomRightTileIndex(j) = code;
     1389        }
     1390
     1391        if(!sei.m_mc_all_tiles_exact_sample_value_match_flag)
     1392        {
     1393          sei_read_flag( pDecodedMessageOutputStream, code, "exact_sample_value_match_flag");   sei.tileSetData(i).m_exact_sample_value_match_flag    = (code != 0);
     1394        }
     1395        sei_read_flag( pDecodedMessageOutputStream, code, "mcts_tier_level_idc_present_flag");  sei.tileSetData(i).m_mcts_tier_level_idc_present_flag = (code != 0);
     1396
     1397        if(sei.tileSetData(i).m_mcts_tier_level_idc_present_flag)
     1398        {
     1399          sei_read_flag( pDecodedMessageOutputStream, code,    "mcts_tier_flag"); sei.tileSetData(i).m_mcts_tier_flag = (code != 0);
     1400          sei_read_code( pDecodedMessageOutputStream, 8, code, "mcts_level_idc"); sei.tileSetData(i).m_mcts_level_idc =  code;
     1401        }
     1402      }
     1403    }
     1404  }
     1405  else
     1406  {
     1407    sei_read_flag( pDecodedMessageOutputStream, code, "max_mcs_tier_level_idc_present_flag");  sei.m_max_mcs_tier_level_idc_present_flag = code;
     1408    if(sei.m_max_mcs_tier_level_idc_present_flag)
     1409    {
     1410      sei_read_flag( pDecodedMessageOutputStream, code, "max_mcts_tier_flag");  sei.m_max_mcts_tier_flag = code;
     1411      sei_read_code( pDecodedMessageOutputStream, 8, code, "max_mcts_level_idc"); sei.m_max_mcts_level_idc = code;
     1412    }
     1413  }
     1414}
     1415
     1416
    10941417Void SEIReader::xParseSEIChromaResamplingFilterHint(SEIChromaResamplingFilterHint& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
    10951418{
     
    12561579}
    12571580
    1258 
    1259 Void SEIReader::xParseSEIMasteringDisplayColourVolume(SEIMasteringDisplayColourVolume& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
    1260 {
    1261   UInt code;
    1262   output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
    1263 
    1264   sei_read_code( pDecodedMessageOutputStream, 16, code, "display_primaries_x[0]" ); sei.values.primaries[0][0] = code;
    1265   sei_read_code( pDecodedMessageOutputStream, 16, code, "display_primaries_y[0]" ); sei.values.primaries[0][1] = code;
    1266 
    1267   sei_read_code( pDecodedMessageOutputStream, 16, code, "display_primaries_x[1]" ); sei.values.primaries[1][0] = code;
    1268   sei_read_code( pDecodedMessageOutputStream, 16, code, "display_primaries_y[1]" ); sei.values.primaries[1][1] = code;
    1269 
    1270   sei_read_code( pDecodedMessageOutputStream, 16, code, "display_primaries_x[2]" ); sei.values.primaries[2][0] = code;
    1271   sei_read_code( pDecodedMessageOutputStream, 16, code, "display_primaries_y[2]" ); sei.values.primaries[2][1] = code;
    1272 
    1273 
    1274   sei_read_code( pDecodedMessageOutputStream, 16, code, "white_point_x" ); sei.values.whitePoint[0] = code;
    1275   sei_read_code( pDecodedMessageOutputStream, 16, code, "white_point_y" ); sei.values.whitePoint[1] = code;
    1276 
    1277   sei_read_code( pDecodedMessageOutputStream, 32, code, "max_display_mastering_luminance" ); sei.values.maxLuminance = code;
    1278   sei_read_code( pDecodedMessageOutputStream, 32, code, "min_display_mastering_luminance" ); sei.values.minLuminance = code;
    1279 }
    1280 
    1281 #if U0033_ALTERNATIVE_TRANSFER_CHARACTERISTICS_SEI
     1581Void SEIReader::xParseSEIDeinterlaceFieldIdentification( SEIDeinterlaceFieldIdentification& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream )
     1582{
     1583  UInt code;
     1584  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1585
     1586  sei_read_flag(pDecodedMessageOutputStream, code, "deinterlaced_picture_source_parity_flag"); sei.m_deinterlacedPictureSourceParityFlag = code!=0;
     1587}
     1588
     1589
     1590Void SEIReader::xParseSEIContentLightLevelInfo( SEIContentLightLevelInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream )
     1591{
     1592  UInt code;
     1593  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1594
     1595  sei_read_code(pDecodedMessageOutputStream, 16, code, "max_content_light_level");     sei.m_maxContentLightLevel    = code;
     1596  sei_read_code(pDecodedMessageOutputStream, 16, code, "max_pic_average_light_level"); sei.m_maxPicAverageLightLevel = code;
     1597}
     1598
     1599
     1600Void SEIReader::xParseSEIDependentRAPIndication( SEIDependentRAPIndication& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream )
     1601{
     1602  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1603}
     1604
     1605
     1606Void SEIReader::xParseSEICodedRegionCompletion( SEICodedRegionCompletion& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream )
     1607{
     1608  UInt code;
     1609  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1610
     1611  sei_read_uvlc(pDecodedMessageOutputStream, code, "next_segment_address"); sei.m_nextSegmentAddress= code;
     1612  if (code)
     1613  {
     1614    sei_read_flag(pDecodedMessageOutputStream, code, "independent_slice_segment_flag"); sei.m_independentSliceSegmentFlag = code!=0;
     1615  }
     1616  else
     1617  {
     1618    sei.m_independentSliceSegmentFlag=false; // initialise to known value.
     1619  }
     1620}
     1621
     1622
    12821623Void SEIReader::xParseSEIAlternativeTransferCharacteristics(SEIAlternativeTransferCharacteristics& sei, UInt payloadSize, ostream* pDecodedMessageOutputStream)
    12831624{
     
    12871628  sei_read_code(pDecodedMessageOutputStream, 8, code, "preferred_transfer_characteristics"); sei.m_preferredTransferCharacteristics = code;
    12881629}
    1289 #endif
     1630
     1631
     1632Void SEIReader::xParseSEIAmbientViewingEnvironment( SEIAmbientViewingEnvironment& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream )
     1633{
     1634  UInt code;
     1635  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1636
     1637  sei_read_code(pDecodedMessageOutputStream, 32, code, "ambient_illuminance"); sei.m_ambientIlluminance= code;
     1638  sei_read_code(pDecodedMessageOutputStream, 16, code, "ambient_light_x");     sei.m_ambientLightX     = (UShort)code;
     1639  sei_read_code(pDecodedMessageOutputStream, 16, code, "ambient_light_y");     sei.m_ambientLightY     = (UShort)code;
     1640}
     1641
    12901642
    12911643#if NH_MV
  • trunk/source/Lib/TLibDecoder/SEIread.h

    r1405 r1413  
    44 * granted under this license.
    55 *
    6  * Copyright (c) 2010-2016, ITU/ISO/IEC
     6 * Copyright (c) 2010-2017, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    6969  Void xReadSEImessage                        (SEIMessages& seis, const NalUnitType nalUnitType, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
    7070#endif
    71   Void xParseSEIuserDataUnregistered          (SEIuserDataUnregistered &sei,          UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
     71  Void xParseSEIBufferingPeriod               (SEIBufferingPeriod& sei,               UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
     72  Void xParseSEIPictureTiming                 (SEIPictureTiming& sei,                 UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
     73  Void xParseSEIPanScanRect                   (SEIPanScanRect& sei,                   UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
     74  Void xParseSEIFillerPayload                 (SEIFillerPayload& sei,                 UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
     75  Void xParseSEIUserDataRegistered            (SEIUserDataRegistered& sei,            UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
     76  Void xParseSEIUserDataUnregistered          (SEIUserDataUnregistered &sei,          UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
     77  Void xParseSEIRecoveryPoint                 (SEIRecoveryPoint& sei,                 UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
     78  Void xParseSEISceneInfo                     (SEISceneInfo& sei,                     UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
     79  Void xParseSEIPictureSnapshot               (SEIPictureSnapshot& sei,               UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
     80  Void xParseSEIProgressiveRefinementSegmentStart(SEIProgressiveRefinementSegmentStart& sei, UInt payloadSize,              std::ostream *pDecodedMessageOutputStream);
     81  Void xParseSEIProgressiveRefinementSegmentEnd(SEIProgressiveRefinementSegmentEnd& sei, UInt payloadSize,                  std::ostream *pDecodedMessageOutputStream);
     82  Void xParseSEIFilmGrainCharacteristics      (SEIFilmGrainCharacteristics& sei,      UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
     83  Void xParseSEIPostFilterHint                (SEIPostFilterHint& sei,                UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
     84  Void xParseSEIToneMappingInfo               (SEIToneMappingInfo& sei,               UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
     85  Void xParseSEIFramePacking                  (SEIFramePacking& sei,                  UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
     86  Void xParseSEIDisplayOrientation            (SEIDisplayOrientation &sei,            UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
     87  Void xParseSEIGreenMetadataInfo             (SEIGreenMetadataInfo& sei,             UInt payLoadSize,                     std::ostream *pDecodedMessageOutputStream);
     88  Void xParseSEISOPDescription                (SEISOPDescription &sei,                UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    7289  Void xParseSEIActiveParameterSets           (SEIActiveParameterSets  &sei,          UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    7390  Void xParseSEIDecodingUnitInfo              (SEIDecodingUnitInfo& sei,              UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
     91  Void xParseSEITemporalLevel0Index           (SEITemporalLevel0Index &sei,           UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    7492  Void xParseSEIDecodedPictureHash            (SEIDecodedPictureHash& sei,            UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    75   Void xParseSEIBufferingPeriod               (SEIBufferingPeriod& sei,               UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
    76   Void xParseSEIPictureTiming                 (SEIPictureTiming& sei,                 UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
    77   Void xParseSEIRecoveryPoint                 (SEIRecoveryPoint& sei,                 UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    78   Void xParseSEIFramePacking                  (SEIFramePacking& sei,                  UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    79   Void xParseSEISegmentedRectFramePacking     (SEISegmentedRectFramePacking& sei,     UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    80   Void xParseSEIDisplayOrientation            (SEIDisplayOrientation &sei,            UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    81   Void xParseSEITemporalLevel0Index           (SEITemporalLevel0Index &sei,           UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    82   Void xParseSEIRegionRefreshInfo             (SEIGradualDecodingRefreshInfo &sei,    UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    83   Void xParseSEINoDisplay                     (SEINoDisplay &sei,                     UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    84   Void xParseSEIToneMappingInfo               (SEIToneMappingInfo& sei,               UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    85   Void xParseSEISOPDescription                (SEISOPDescription &sei,                UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    8693#if NH_MV
    8794  Void xParseSEIScalableNesting               (SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, const TComVPS *vps, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
     
    8996  Void xParseSEIScalableNesting               (SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
    9097#endif
     98  Void xParseSEIRegionRefreshInfo             (SEIRegionRefreshInfo &sei,             UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
     99  Void xParseSEINoDisplay                     (SEINoDisplay &sei,                     UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
     100  Void xParseSEITimeCode                      (SEITimeCode& sei,                      UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
     101  Void xParseSEIMasteringDisplayColourVolume  (SEIMasteringDisplayColourVolume& sei,  UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
     102  Void xParseSEISegmentedRectFramePacking     (SEISegmentedRectFramePacking& sei,     UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    91103  Void xParseSEITempMotionConstraintsTileSets (SEITempMotionConstrainedTileSets& sei, UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    92   Void xParseSEITimeCode                      (SEITimeCode& sei,                      UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    93104  Void xParseSEIChromaResamplingFilterHint    (SEIChromaResamplingFilterHint& sei,    UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    94105  Void xParseSEIKneeFunctionInfo              (SEIKneeFunctionInfo& sei,              UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    95   Void xParseSEIMasteringDisplayColourVolume  (SEIMasteringDisplayColourVolume& sei,  UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    96106  Void xParseSEIColourRemappingInfo           (SEIColourRemappingInfo& sei,           UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    97 #if U0033_ALTERNATIVE_TRANSFER_CHARACTERISTICS_SEI
    98   Void xParseSEIAlternativeTransferCharacteristics(SEIAlternativeTransferCharacteristics& sei,              UInt payLoadSize,                     std::ostream *pDecodedMessageOutputStream);
    99 #endif
     107  Void xParseSEIDeinterlaceFieldIdentification(SEIDeinterlaceFieldIdentification& sei,UInt payLoadSize,                     std::ostream *pDecodedMessageOutputStream);
     108  Void xParseSEIContentLightLevelInfo         (SEIContentLightLevelInfo& sei,         UInt payLoadSize,                     std::ostream *pDecodedMessageOutputStream);
     109  Void xParseSEIDependentRAPIndication        (SEIDependentRAPIndication& sei,        UInt payLoadSize,                     std::ostream *pDecodedMessageOutputStream);
     110  Void xParseSEICodedRegionCompletion         (SEICodedRegionCompletion& sei,         UInt payLoadSize,                     std::ostream *pDecodedMessageOutputStream);
     111  Void xParseSEIAlternativeTransferCharacteristics(SEIAlternativeTransferCharacteristics& sei, UInt payLoadSize,            std::ostream *pDecodedMessageOutputStream);
     112  Void xParseSEIAmbientViewingEnvironment     (SEIAmbientViewingEnvironment& sei,     UInt payLoadSize,                     std::ostream *pDecodedMessageOutputStream);
    100113#if NH_MV
    101114  Void xParseSEILayersNotPresent              (SEILayersNotPresent &sei, UInt payloadSize, const TComVPS *vps ,std::ostream *pDecodedMessageOutputStream);
  • trunk/source/Lib/TLibDecoder/SyntaxElementParser.cpp

    r1405 r1413  
    44* granted under this license.
    55*
    6 * Copyright (c) 2010-2016, ITU/ISO/IEC
     6* Copyright (c) 2010-2017, ITU/ISO/IEC
    77* All rights reserved.
    88*
     
    4949#if ENC_DEC_TRACE
    5050
     51Void  xTraceAccessUnitDelimiter ()
     52{
     53  fprintf( g_hTrace, "=========== Access Unit Delimiter ===========\n");
     54}
     55
     56Void xTraceFillerData ()
     57{
     58  fprintf( g_hTrace, "=========== Filler Data ===========\n");
     59}
     60
     61#endif
     62
     63#if DECODER_PARTIAL_CONFORMANCE_CHECK!=0
     64Void SyntaxElementParser::xReadCodeChk ( UInt   length, UInt& val, const TChar *pSymbolName, const UInt minValIncl, const UInt maxValIncl )
     65{
     66  READ_CODE(length, val, pSymbolName);
     67  TDecConformanceCheck::checkRange(val, pSymbolName, minValIncl, maxValIncl);
     68}
     69#if NH_MV
     70
    5171Void  SyntaxElementParser::xReadCodeTr           (UInt length, UInt& rValue, const TChar *pSymbolName)
    5272{
     
    175195}
    176196
    177 #endif
    178 
    179197
    180198// ====================================================================================================================
     
    194212}
    195213
    196 #if RExt__DECODER_DEBUG_BIT_STATISTICS
    197 Void SyntaxElementParser::xReadUvlc( UInt& ruiVal, const TChar *pSymbolName)
    198 #else
    199 Void SyntaxElementParser::xReadUvlc( UInt& ruiVal)
     214#else
     215
     216Void SyntaxElementParser::xReadUvlcChk ( UInt&  val, const TChar *pSymbolName, const UInt minValIncl, const UInt maxValIncl )
     217{
     218  READ_UVLC(val, pSymbolName);
     219  TDecConformanceCheck::checkRange(val, pSymbolName, minValIncl, maxValIncl);
     220}
     221
     222Void SyntaxElementParser::xReadSvlcChk ( Int&   val, const TChar *pSymbolName, const Int  minValIncl, const Int  maxValIncl )
     223{
     224  READ_SVLC(val, pSymbolName);
     225  TDecConformanceCheck::checkRange(val, pSymbolName, minValIncl, maxValIncl);
     226}
     227
     228Void SyntaxElementParser::xReadFlagChk ( UInt&  val, const TChar *pSymbolName, const UInt minValIncl, const UInt maxValIncl )
     229{
     230  READ_FLAG(val, pSymbolName);
     231  TDecConformanceCheck::checkRange(val, pSymbolName, minValIncl, maxValIncl);
     232}
     233#endif
     234#endif
     235
     236// ====================================================================================================================
     237// Protected member functions
     238// ====================================================================================================================
     239#if RExt__DECODER_DEBUG_BIT_STATISTICS || ENC_DEC_TRACE
     240Void SyntaxElementParser::xReadCode (UInt uiLength, UInt& rValue, const TChar *pSymbolName)
     241#else
     242Void SyntaxElementParser::xReadCode (UInt uiLength, UInt& rValue)
     243#endif
     244{
     245  assert ( uiLength > 0 );
     246  m_pcBitstream->read (uiLength, rValue);
     247#if RExt__DECODER_DEBUG_BIT_STATISTICS
     248  TComCodingStatistics::IncrementStatisticEP(pSymbolName, uiLength, rValue);
     249#endif
     250#if ENC_DEC_TRACE
     251  fprintf( g_hTrace, "%8lld  ", g_nSymbolCounter++ );
     252  if (uiLength < 10)
     253  {
     254    fprintf( g_hTrace, "%-50s u(%d)  : %u\n", pSymbolName, uiLength, rValue );
     255  }
     256  else
     257  {
     258    fprintf( g_hTrace, "%-50s u(%d) : %u\n", pSymbolName, uiLength, rValue );
     259  }
     260  fflush ( g_hTrace );
     261#endif
     262}
     263
     264
     265#if RExt__DECODER_DEBUG_BIT_STATISTICS || ENC_DEC_TRACE
     266Void SyntaxElementParser::xReadUvlc( UInt& rValue, const TChar *pSymbolName)
     267#else
     268Void SyntaxElementParser::xReadUvlc( UInt& rValue)
    200269#endif
    201270{
     
    226295  }
    227296
    228   ruiVal = uiVal;
    229 #if RExt__DECODER_DEBUG_BIT_STATISTICS
    230   TComCodingStatistics::IncrementStatisticEP(pSymbolName, Int(totalLen), ruiVal);
    231 #endif
    232 }
    233 
    234 #if RExt__DECODER_DEBUG_BIT_STATISTICS
    235 Void SyntaxElementParser::xReadSvlc( Int& riVal, const TChar *pSymbolName)
    236 #else
    237 Void SyntaxElementParser::xReadSvlc( Int& riVal)
     297  rValue = uiVal;
     298#if RExt__DECODER_DEBUG_BIT_STATISTICS
     299  TComCodingStatistics::IncrementStatisticEP(pSymbolName, Int(totalLen), rValue);
     300#endif
     301
     302#if ENC_DEC_TRACE
     303  fprintf( g_hTrace, "%8lld  ", g_nSymbolCounter++ );
     304  fprintf( g_hTrace, "%-50s ue(v) : %u\n", pSymbolName, rValue );
     305  fflush ( g_hTrace );
     306#endif
     307}
     308
     309#if RExt__DECODER_DEBUG_BIT_STATISTICS || ENC_DEC_TRACE
     310Void SyntaxElementParser::xReadSvlc( Int& rValue, const TChar *pSymbolName)
     311#else
     312Void SyntaxElementParser::xReadSvlc( Int& rValue)
    238313#endif
    239314{
     
    256331
    257332    uiBits += (1 << uiLength);
    258     riVal = ( uiBits & 1) ? -(Int)(uiBits>>1) : (Int)(uiBits>>1);
     333    rValue = ( uiBits & 1) ? -(Int)(uiBits>>1) : (Int)(uiBits>>1);
    259334#if RExt__DECODER_DEBUG_BIT_STATISTICS
    260335    totalLen+=uiLength+uiLength;
     
    263338  else
    264339  {
    265     riVal = 0;
    266   }
    267 #if RExt__DECODER_DEBUG_BIT_STATISTICS
    268   TComCodingStatistics::IncrementStatisticEP(pSymbolName, Int(totalLen), riVal);
    269 #endif
    270 }
    271 
    272 #if RExt__DECODER_DEBUG_BIT_STATISTICS
    273 Void SyntaxElementParser::xReadFlag (UInt& ruiCode, const TChar *pSymbolName)
    274 #else
    275 Void SyntaxElementParser::xReadFlag (UInt& ruiCode)
    276 #endif
    277 {
    278   m_pcBitstream->read( 1, ruiCode );
    279 #if RExt__DECODER_DEBUG_BIT_STATISTICS
    280   TComCodingStatistics::IncrementStatisticEP(pSymbolName, 1, Int(ruiCode));
     340    rValue = 0;
     341  }
     342#if RExt__DECODER_DEBUG_BIT_STATISTICS
     343  TComCodingStatistics::IncrementStatisticEP(pSymbolName, Int(totalLen), rValue);
     344#endif
     345
     346#if ENC_DEC_TRACE
     347  fprintf( g_hTrace, "%8lld  ", g_nSymbolCounter++ );
     348  fprintf( g_hTrace, "%-50s se(v) : %d\n", pSymbolName, rValue );
     349  fflush ( g_hTrace );
     350#endif
     351
     352}
     353
     354#if RExt__DECODER_DEBUG_BIT_STATISTICS || ENC_DEC_TRACE
     355Void SyntaxElementParser::xReadFlag (UInt& rValue, const TChar *pSymbolName)
     356#else
     357Void SyntaxElementParser::xReadFlag (UInt& rValue)
     358#endif
     359{
     360  m_pcBitstream->read( 1, rValue );
     361#if RExt__DECODER_DEBUG_BIT_STATISTICS
     362  TComCodingStatistics::IncrementStatisticEP(pSymbolName, 1, Int(rValue));
     363#endif
     364
     365#if ENC_DEC_TRACE
     366  fprintf( g_hTrace, "%8lld  ", g_nSymbolCounter++ );
     367  fprintf( g_hTrace, "%-50s u(1)  : %d\n", pSymbolName, rValue );
     368  fflush ( g_hTrace );
    281369#endif
    282370}
    283371
    284372#if NH_MV
    285 #if RExt__DECODER_DEBUG_BIT_STATISTICS
     373#if RExt__DECODER_DEBUG_BIT_STATISTICS || ENC_DEC_TRACE
    286374Void  SyntaxElementParser::xReadString  (UInt bufSize, UChar *pVal, UInt& rLength, const TChar *pSymbolName)
    287375#else
    288 Void  SyntaxElementParser::xReadString  (UInt bufSize, UChar *pVal, UInt& rLength)
     376Void  SyntaxElementParser::xReadString  (UInt bufSize, UChar *pVal, UInt& rLength )
    289377#endif
    290378{
  • trunk/source/Lib/TLibDecoder/SyntaxElementParser.h

    r1405 r1413  
    44 * granted under this license.
    55 *
    6  * Copyright (c) 2010-2016, ITU/ISO/IEC
     6 * Copyright (c) 2010-2017, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    4343#endif // _MSC_VER > 1000
    4444#include "TLibCommon/TComRom.h"
    45 #if ENC_DEC_TRACE
     45#include "TDecConformance.h"
    4646
    47 #define READ_CODE(length, code, name)     xReadCodeTr ( length, code, name )
    48 #define READ_UVLC(        code, name)     xReadUvlcTr (         code, name )
    49 #define READ_SVLC(        code, name)     xReadSvlcTr (         code, name )
    50 #define READ_FLAG(        code, name)     xReadFlagTr (         code, name )
    51 #if NH_MV
    52 #define READ_STRING(bufSize, code, length, name)   xReadStringTr ( bufSize, code, length, name )
     47#if DECODER_PARTIAL_CONFORMANCE_CHECK!=0
     48#define READ_CODE_CHK(length, code, name, minValIncl, maxValIncl) xReadCodeChk ( length, code, name, minValIncl, maxValIncl )
     49#define READ_UVLC_CHK(        code, name, minValIncl, maxValIncl) xReadUvlcChk (         code, name, minValIncl, maxValIncl )
     50#define READ_SVLC_CHK(        code, name, minValIncl, maxValIncl) xReadSvlcChk (         code, name, minValIncl, maxValIncl )
     51#define READ_FLAG_CHK(        code, name, minValIncl, maxValIncl) xReadFlagChk (         code, name, minValIncl, maxValIncl )
     52#elif RExt__DECODER_DEBUG_BIT_STATISTICS || ENC_DEC_TRACE
     53#define READ_CODE_CHK(length, code, name, minValIncl, maxValIncl) xReadCode ( length, code, name )
     54#define READ_UVLC_CHK(        code, name, minValIncl, maxValIncl) xReadUvlc (         code, name )
     55#define READ_SVLC_CHK(        code, name, minValIncl, maxValIncl) xReadSvlc (         code, name )
     56#define READ_FLAG_CHK(        code, name, minValIncl, maxValIncl) xReadFlag (         code, name )
     57#else
     58#define READ_CODE_CHK(length, code, name, minValIncl, maxValIncl) xReadCode ( length, code )
     59#define READ_UVLC_CHK(        code, name, minValIncl, maxValIncl) xReadUvlc (         code )
     60#define READ_SVLC_CHK(        code, name, minValIncl, maxValIncl) xReadSvlc (         code )
     61#define READ_FLAG_CHK(        code, name, minValIncl, maxValIncl) xReadFlag (         code )
    5362#endif
    54 #else
    55 
    56 #if RExt__DECODER_DEBUG_BIT_STATISTICS
    57 
     63#if RExt__DECODER_DEBUG_BIT_STATISTICS || ENC_DEC_TRACE
    5864#define READ_CODE(length, code, name)     xReadCode ( length, code, name )
    5965#define READ_UVLC(        code, name)     xReadUvlc (         code, name )
     
    6470#endif
    6571#else
    66 
    6772#define READ_CODE(length, code, name)     xReadCode ( length, code )
    6873#define READ_UVLC(        code, name)     xReadUvlc (         code )
     
    7176#if NH_MV
    7277#define READ_STRING(bufSize, code, length, name)   xReadString ( bufSize, code, length )
    73 #endif
    74 
    7578#endif
    7679
     
    9497  virtual ~SyntaxElementParser() {};
    9598
    96 #if RExt__DECODER_DEBUG_BIT_STATISTICS
     99#if DECODER_PARTIAL_CONFORMANCE_CHECK!=0
     100  Void  xReadCodeChk ( UInt   length, UInt& val, const TChar *pSymbolName, const UInt minValIncl, const UInt maxValIncl );
     101  Void  xReadUvlcChk ( UInt&  val, const TChar *pSymbolName, const UInt minValIncl, const UInt maxValIncl );
     102  Void  xReadSvlcChk ( Int&   val, const TChar *pSymbolName, const Int  minValIncl, const Int  maxValIncl );
     103  Void  xReadFlagChk ( UInt&  val, const TChar *pSymbolName, const UInt minValIncl, const UInt maxValIncl );
     104#endif
     105
     106
     107#if RExt__DECODER_DEBUG_BIT_STATISTICS || ENC_DEC_TRACE
    97108  Void  xReadCode    ( UInt   length, UInt& val, const TChar *pSymbolName );
    98109  Void  xReadUvlc    ( UInt&  val, const TChar *pSymbolName );
     
    109120#if NH_MV
    110121  Void  xReadString  ( UInt bufSize, UChar *val, UInt& length);
    111 #endif
    112 #endif
    113 #if ENC_DEC_TRACE
    114   Void  xReadCodeTr  (UInt  length, UInt& rValue, const TChar *pSymbolName);
    115   Void  xReadUvlcTr  (              UInt& rValue, const TChar *pSymbolName);
    116   Void  xReadSvlcTr  (               Int& rValue, const TChar *pSymbolName);
    117   Void  xReadFlagTr  (              UInt& rValue, const TChar *pSymbolName);
    118 #if NH_MV
    119122  Void  xReadStringTr(UInt bufSize, UChar *pValue, UInt& rLength, const TChar *pSymbolName);
    120123#endif
  • trunk/source/Lib/TLibDecoder/TDecBinCoder.h

    r1405 r1413  
    44 * granted under this license.
    55 *
    6  * Copyright (c) 2010-2016, ITU/ISO/IEC
     6 * Copyright (c) 2010-2017, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
  • trunk/source/Lib/TLibDecoder/TDecBinCoderCABAC.cpp

    r1405 r1413  
    44 * granted under this license.
    55 *
    6  * Copyright (c) 2010-2016, ITU/ISO/IEC
     6 * Copyright (c) 2010-2017, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
  • trunk/source/Lib/TLibDecoder/TDecBinCoderCABAC.h

    r1405 r1413  
    44 * granted under this license.
    55 *
    6  * Copyright (c) 2010-2016, ITU/ISO/IEC
     6 * Copyright (c) 2010-2017, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
  • trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r1405 r1413  
    44* granted under this license.
    55*
    6 * Copyright (c) 2010-2016, ITU/ISO/IEC
     6* Copyright (c) 2010-2017, ITU/ISO/IEC
    77* All rights reserved.
    88*
     
    4343#include "TLibCommon/TComCodingStatistics.h"
    4444#endif
     45#include "TDecConformance.h"
     46
    4547#if NH_MV
    4648#include "TDecTop.h"
     
    244246  Int   iCode;
    245247
    246   READ_UVLC( uiCode, "pps_pic_parameter_set_id");
     248  READ_UVLC_CHK( uiCode, "pps_pic_parameter_set_id", 0, 63);
    247249  assert(uiCode <= 63);
    248250  pcPPS->setPPSId (uiCode);
    249251
    250   READ_UVLC( uiCode, "pps_seq_parameter_set_id");
     252  READ_UVLC_CHK( uiCode, "pps_seq_parameter_set_id", 0, 15);
    251253  assert(uiCode <= 15);
    252254  pcPPS->setSPSId (uiCode);
     
    258260  READ_CODE(3, uiCode, "num_extra_slice_header_bits");                pcPPS->setNumExtraSliceHeaderBits(uiCode);
    259261
    260   READ_FLAG ( uiCode, "sign_data_hiding_flag" ); pcPPS->setSignHideFlag( uiCode );
     262  READ_FLAG ( uiCode, "sign_data_hiding_enabled_flag" );              pcPPS->setSignDataHidingEnabledFlag( uiCode );
    261263
    262264  READ_FLAG( uiCode,   "cabac_init_present_flag" );            pcPPS->setCabacInitPresentFlag( uiCode ? true : false );
    263265
    264   READ_UVLC(uiCode, "num_ref_idx_l0_default_active_minus1");
     266  READ_UVLC_CHK(uiCode, "num_ref_idx_l0_default_active_minus1", 0, 14);
    265267  assert(uiCode <= 14);
    266268  pcPPS->setNumRefIdxL0DefaultActive(uiCode+1);
    267269
    268   READ_UVLC(uiCode, "num_ref_idx_l1_default_active_minus1");
     270  READ_UVLC_CHK(uiCode, "num_ref_idx_l1_default_active_minus1", 0, 14);
    269271  assert(uiCode <= 14);
    270272  pcPPS->setNumRefIdxL1DefaultActive(uiCode+1);
    271273
    272   READ_SVLC(iCode, "init_qp_minus26" );                            pcPPS->setPicInitQPMinus26(iCode);
     274  READ_SVLC_CHK(iCode, "init_qp_minus26", std::numeric_limits<Int>::min(), 25 );  pcPPS->setPicInitQPMinus26(iCode);
    273275  READ_FLAG( uiCode, "constrained_intra_pred_flag" );              pcPPS->setConstrainedIntraPred( uiCode ? true : false );
    274276  READ_FLAG( uiCode, "transform_skip_enabled_flag" );
     
    285287    pcPPS->setMaxCuDQPDepth( 0 );
    286288  }
    287   READ_SVLC( iCode, "pps_cb_qp_offset");
     289  READ_SVLC_CHK( iCode, "pps_cb_qp_offset", -12, 12);
    288290  pcPPS->setQpOffset(COMPONENT_Cb, iCode);
    289291  assert( pcPPS->getQpOffset(COMPONENT_Cb) >= -12 );
    290292  assert( pcPPS->getQpOffset(COMPONENT_Cb) <=  12 );
    291293
    292   READ_SVLC( iCode, "pps_cr_qp_offset");
     294  READ_SVLC_CHK( iCode, "pps_cr_qp_offset", -12, 12);
    293295  pcPPS->setQpOffset(COMPONENT_Cr, iCode);
    294296  assert( pcPPS->getQpOffset(COMPONENT_Cr) >= -12 );
     
    305307  pcPPS->setWPBiPred( uiCode==1 );
    306308
    307   READ_FLAG( uiCode, "transquant_bypass_enable_flag");
    308   pcPPS->setTransquantBypassEnableFlag(uiCode ? true : false);
     309  READ_FLAG( uiCode, "transquant_bypass_enabled_flag");
     310  pcPPS->setTransquantBypassEnabledFlag(uiCode ? true : false);
    309311  READ_FLAG( uiCode, "tiles_enabled_flag"               );    pcPPS->setTilesEnabledFlag            ( uiCode == 1 );
    310312  READ_FLAG( uiCode, "entropy_coding_sync_enabled_flag" );    pcPPS->setEntropyCodingSyncEnabledFlag( uiCode == 1 );
     
    344346    }
    345347
    346     if ((tileColumnsMinus1 + tileRowsMinus1) != 0)
    347     {
     348    assert ((tileColumnsMinus1 + tileRowsMinus1) != 0);
    348349      READ_FLAG ( uiCode, "loop_filter_across_tiles_enabled_flag" );   pcPPS->setLoopFilterAcrossTilesEnabledFlag( uiCode ? true : false );
    349350    }
    350   }
    351351  READ_FLAG( uiCode, "pps_loop_filter_across_slices_enabled_flag" );   pcPPS->setLoopFilterAcrossSlicesEnabledFlag( uiCode ? true : false );
    352352  READ_FLAG( uiCode, "deblocking_filter_control_present_flag" );       pcPPS->setDeblockingFilterControlPresentFlag( uiCode ? true : false );
     
    354354  {
    355355    READ_FLAG( uiCode, "deblocking_filter_override_enabled_flag" );    pcPPS->setDeblockingFilterOverrideEnabledFlag( uiCode ? true : false );
    356     READ_FLAG( uiCode, "pps_disable_deblocking_filter_flag" );         pcPPS->setPicDisableDeblockingFilterFlag(uiCode ? true : false );
    357     if(!pcPPS->getPicDisableDeblockingFilterFlag())
     356    READ_FLAG( uiCode, "pps_deblocking_filter_disabled_flag" );        pcPPS->setPPSDeblockingFilterDisabledFlag(uiCode ? true : false );
     357    if(!pcPPS->getPPSDeblockingFilterDisabledFlag())
    358358    {
    359359      READ_SVLC ( iCode, "pps_beta_offset_div2" );                     pcPPS->setDeblockingFilterBetaOffsetDiv2( iCode );
     
    502502                READ_UVLC(uiCode, "diff_cu_chroma_qp_offset_depth"); ppsRangeExtension.setDiffCuChromaQpOffsetDepth(uiCode);
    503503              UInt tableSizeMinus1 = 0;
    504               READ_UVLC(tableSizeMinus1, "chroma_qp_offset_list_len_minus1");
     504                READ_UVLC_CHK(tableSizeMinus1, "chroma_qp_offset_list_len_minus1", 0, MAX_QP_OFFSET_LIST_SIZE-1);
    505505              assert(tableSizeMinus1 < MAX_QP_OFFSET_LIST_SIZE);
    506506
     
    509509                Int cbOffset;
    510510                Int crOffset;
    511                 READ_SVLC(cbOffset, "cb_qp_offset_list[i]");
     511                  READ_SVLC_CHK(cbOffset, "cb_qp_offset_list[i]", -12, 12);
    512512                assert(cbOffset >= -12 && cbOffset <= 12);
    513                 READ_SVLC(crOffset, "cr_qp_offset_list[i]");
     513                  READ_SVLC_CHK(crOffset, "cr_qp_offset_list[i]", -12, 12);
    514514                assert(crOffset >= -12 && crOffset <= 12);
    515515                // table uses +1 for index (see comment inside the function)
     
    546546Void TDecCavlc::parsePps3dExtension( TComPPS* pcPPS )
    547547{
    548 #if NH_3D_DLT
    549548  UInt uiCode = 0;
    550549  //
     
    679678    }
    680679  }
    681 #endif
     680
    682681}
    683682#endif
     
    885884  {
    886885#endif
    887   READ_CODE( 3,  uiCode, "sps_max_sub_layers_minus1" );          pcSPS->setMaxTLayers   ( uiCode+1 );
     886  READ_CODE_CHK( 3,  uiCode, "sps_max_sub_layers_minus1", 0, 6 );   pcSPS->setMaxTLayers   ( uiCode+1 );
    888887  assert(uiCode <= 6);
    889888#if NH_MV
     
    902901  {
    903902    // sps_temporal_id_nesting_flag must be 1 when sps_max_sub_layers_minus1 is 0
     903    TDecConformanceCheck::checkRange(uiCode, "sps_temporal_id_nesting_flag", 1U, 1U);
    904904    assert( uiCode == 1 );
    905905  }
     
    911911  }
    912912#endif
    913   READ_UVLC(     uiCode, "sps_seq_parameter_set_id" );           pcSPS->setSPSId( uiCode );
     913  READ_UVLC_CHK( uiCode, "sps_seq_parameter_set_id", 0, 15 );           pcSPS->setSPSId( uiCode );
    914914  assert(uiCode <= 15);
    915915#if NH_MV
     
    926926#endif
    927927
    928   READ_UVLC(     uiCode, "chroma_format_idc" );                  pcSPS->setChromaFormatIdc( ChromaFormat(uiCode) );
     928  READ_UVLC_CHK(     uiCode, "chroma_format_idc", 0, 3 );               pcSPS->setChromaFormatIdc( ChromaFormat(uiCode) );
    929929  assert(uiCode <= 3);
    930930  if( pcSPS->getChromaFormatIdc() == CHROMA_444 )
    931931  {
    932     READ_FLAG(     uiCode, "separate_colour_plane_flag");        assert(uiCode == 0);
    933   }
    934 
    935   READ_UVLC (    uiCode, "pic_width_in_luma_samples" );          pcSPS->setPicWidthInLumaSamples ( uiCode    );
    936   READ_UVLC (    uiCode, "pic_height_in_luma_samples" );         pcSPS->setPicHeightInLumaSamples( uiCode    );
     932    READ_FLAG_CHK(     uiCode, "separate_colour_plane_flag", 0, 0);
     933    assert(uiCode == 0);
     934  }
     935
     936  // pic_width_in_luma_samples and pic_height_in_luma_samples needs conformance checking - multiples of MinCbSizeY
     937  READ_UVLC_CHK (    uiCode, "pic_width_in_luma_samples", 1, std::numeric_limits<UInt>::max()  );  pcSPS->setPicWidthInLumaSamples ( uiCode    );
     938  READ_UVLC_CHK (    uiCode, "pic_height_in_luma_samples", 1, std::numeric_limits<UInt>::max() );  pcSPS->setPicHeightInLumaSamples( uiCode    );
    937939  READ_FLAG(     uiCode, "conformance_window_flag");
    938940  if (uiCode != 0)
     
    948950  }
    949951#else
    950     READ_UVLC(   uiCode, "conf_win_left_offset" );               conf.setWindowLeftOffset  ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc() ) );
    951     READ_UVLC(   uiCode, "conf_win_right_offset" );              conf.setWindowRightOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc() ) );
    952     READ_UVLC(   uiCode, "conf_win_top_offset" );                conf.setWindowTopOffset   ( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc() ) );
    953     READ_UVLC(   uiCode, "conf_win_bottom_offset" );             conf.setWindowBottomOffset( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc() ) );
     952    const UInt subWidthC  = TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc() );
     953    const UInt subHeightC = TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc() );
     954    READ_UVLC(   uiCode, "conf_win_left_offset" );               conf.setWindowLeftOffset  ( uiCode * subWidthC );
     955    READ_UVLC(   uiCode, "conf_win_right_offset" );              conf.setWindowRightOffset ( uiCode * subWidthC );
     956    READ_UVLC(   uiCode, "conf_win_top_offset" );                conf.setWindowTopOffset   ( uiCode * subHeightC );
     957    READ_UVLC(   uiCode, "conf_win_bottom_offset" );             conf.setWindowBottomOffset( uiCode * subHeightC );
     958    TDecConformanceCheck::checkRange<UInt>(conf.getWindowLeftOffset()+conf.getWindowRightOffset(), "conformance window width in pixels", 0, pcSPS->getPicWidthInLumaSamples()-1);
    954959#endif
    955960  }
     
    960965#endif
    961966
    962   READ_UVLC(     uiCode, "bit_depth_luma_minus8" );
     967  READ_UVLC_CHK(     uiCode, "bit_depth_luma_minus8", 0, 8 );
     968  assert(uiCode <= 8);
    963969#if O0043_BEST_EFFORT_DECODING
    964970  pcSPS->setStreamBitDepth(CHANNEL_TYPE_LUMA, 8 + uiCode);
     
    968974    uiCode = forceDecodeBitDepth - 8;
    969975  }
    970 #endif
    971976  assert(uiCode <= 8);
     977#endif
    972978  pcSPS->setBitDepth(CHANNEL_TYPE_LUMA, 8 + uiCode);
    973979
     
    978984#endif
    979985
    980   READ_UVLC( uiCode,    "bit_depth_chroma_minus8" );
     986  READ_UVLC_CHK( uiCode,    "bit_depth_chroma_minus8", 0, 8 );
     987  assert(uiCode <= 8);
    981988#if O0043_BEST_EFFORT_DECODING
    982989  pcSPS->setStreamBitDepth(CHANNEL_TYPE_CHROMA, 8 + uiCode);
     
    985992    uiCode = forceDecodeBitDepth - 8;
    986993  }
    987 #endif
    988994  assert(uiCode <= 8);
     995#endif
    989996  pcSPS->setBitDepth(CHANNEL_TYPE_CHROMA, 8 + uiCode);
    990997#if O0043_BEST_EFFORT_DECODING
     
    9971004#endif
    9981005
    999   READ_UVLC( uiCode,    "log2_max_pic_order_cnt_lsb_minus4" );   pcSPS->setBitsForPOC( 4 + uiCode );
    1000   assert(uiCode <= 12);
     1006  READ_UVLC_CHK( uiCode,    "log2_max_pic_order_cnt_lsb_minus4", 0, 12 );   pcSPS->setBitsForPOC( 4 + uiCode );
    10011007
    10021008#if NH_MV
     
    10391045#endif
    10401046
    1041   READ_UVLC( uiCode, "log2_min_luma_coding_block_size_minus3" );
    1042   Int log2MinCUSize = uiCode + 3;
    1043   pcSPS->setLog2MinCodingBlockSize(log2MinCUSize);
    1044   READ_UVLC( uiCode, "log2_diff_max_min_luma_coding_block_size" );
     1047  const UInt maxLog2CtbSize = TDecConformanceCheck::getMaxLog2CtbSize(*(pcSPS->getPTL()));
     1048  const UInt minLog2CtbSize = TDecConformanceCheck::getMinLog2CtbSize(*(pcSPS->getPTL()));
     1049  READ_UVLC_CHK( uiCode, "log2_min_luma_coding_block_size_minus3", 0, maxLog2CtbSize-3 );
     1050  assert(uiCode <= maxLog2CtbSize-3);
     1051  Int minCbLog2SizeY = uiCode + 3;
     1052  pcSPS->setLog2MinCodingBlockSize(minCbLog2SizeY);
     1053 
     1054    // Difference + log2MinCUSize must be <= maxLog2CtbSize
     1055  // Difference + log2MinCUSize must be >= minLog2CtbSize
     1056  const UInt minLog2DiffMaxMinLumaCodingBlockSize = minLog2CtbSize < minCbLog2SizeY ? 0 : minLog2CtbSize - minCbLog2SizeY;
     1057  const UInt maxLog2DiffMaxMinLumaCodingBlockSize = maxLog2CtbSize - minCbLog2SizeY;
     1058
     1059  READ_UVLC_CHK( uiCode, "log2_diff_max_min_luma_coding_block_size", minLog2DiffMaxMinLumaCodingBlockSize, maxLog2DiffMaxMinLumaCodingBlockSize);
     1060  assert(uiCode >= minLog2DiffMaxMinLumaCodingBlockSize && uiCode <= maxLog2DiffMaxMinLumaCodingBlockSize);
    10451061  pcSPS->setLog2DiffMaxMinCodingBlockSize(uiCode);
    1046  
    1047   if (pcSPS->getPTL()->getGeneralPTL()->getLevelIdc() >= Level::LEVEL5)
    1048   {
    1049     assert(log2MinCUSize + pcSPS->getLog2DiffMaxMinCodingBlockSize() >= 5);
    1050   }
    1051  
    1052   Int maxCUDepthDelta = uiCode;
    1053   pcSPS->setMaxCUWidth  ( 1<<(log2MinCUSize + maxCUDepthDelta) );
    1054   pcSPS->setMaxCUHeight ( 1<<(log2MinCUSize + maxCUDepthDelta) );
    1055   READ_UVLC( uiCode, "log2_min_luma_transform_block_size_minus2" );   pcSPS->setQuadtreeTULog2MinSize( uiCode + 2 );
    1056 
    1057   READ_UVLC( uiCode, "log2_diff_max_min_luma_transform_block_size" ); pcSPS->setQuadtreeTULog2MaxSize( uiCode + pcSPS->getQuadtreeTULog2MinSize() );
     1062
     1063  const Int maxCUDepthDelta = uiCode;
     1064  const Int ctbLog2SizeY = minCbLog2SizeY + maxCUDepthDelta;
     1065  pcSPS->setMaxCUWidth  ( 1<<ctbLog2SizeY );
     1066  pcSPS->setMaxCUHeight ( 1<<ctbLog2SizeY );
     1067  READ_UVLC_CHK( uiCode, "log2_min_luma_transform_block_size_minus2", 0, minCbLog2SizeY-1-2 );
     1068  const UInt minTbLog2SizeY = uiCode + 2;
     1069  pcSPS->setQuadtreeTULog2MinSize( minTbLog2SizeY );
     1070
     1071  //  log2_diff <= Min(CtbLog2SizeY, 5) - minTbLog2SizeY
     1072  READ_UVLC_CHK( uiCode, "log2_diff_max_min_luma_transform_block_size", 0, min<UInt>(5U, ctbLog2SizeY) - minTbLog2SizeY );
     1073  pcSPS->setQuadtreeTULog2MaxSize( uiCode + pcSPS->getQuadtreeTULog2MinSize() );
    10581074  pcSPS->setMaxTrSize( 1<<(uiCode + pcSPS->getQuadtreeTULog2MinSize()) );
    10591075
    1060   READ_UVLC( uiCode, "max_transform_hierarchy_depth_inter" );    pcSPS->setQuadtreeTUMaxDepthInter( uiCode+1 );
    1061   READ_UVLC( uiCode, "max_transform_hierarchy_depth_intra" );    pcSPS->setQuadtreeTUMaxDepthIntra( uiCode+1 );
    1062 
    1063   Int addCuDepth = max (0, log2MinCUSize - (Int)pcSPS->getQuadtreeTULog2MinSize() );
     1076  READ_UVLC_CHK( uiCode, "max_transform_hierarchy_depth_inter", 0, ctbLog2SizeY - minTbLog2SizeY);    pcSPS->setQuadtreeTUMaxDepthInter( uiCode+1 );
     1077  READ_UVLC_CHK( uiCode, "max_transform_hierarchy_depth_intra", 0, ctbLog2SizeY - minTbLog2SizeY);    pcSPS->setQuadtreeTUMaxDepthIntra( uiCode+1 );
     1078
     1079  Int addCuDepth = max (0, minCbLog2SizeY - (Int)pcSPS->getQuadtreeTULog2MinSize() );
    10641080  pcSPS->setMaxTotalCUDepth( maxCUDepthDelta + addCuDepth  + getMaxCUDepthOffset(pcSPS->getChromaFormatIdc(), pcSPS->getQuadtreeTULog2MinSize()) );
    10651081
     
    10951111  if( pcSPS->getUsePCM() )
    10961112  {
    1097     READ_CODE( 4, uiCode, "pcm_sample_bit_depth_luma_minus1" );          pcSPS->setPCMBitDepth    ( CHANNEL_TYPE_LUMA, 1 + uiCode );
    1098     READ_CODE( 4, uiCode, "pcm_sample_bit_depth_chroma_minus1" );        pcSPS->setPCMBitDepth    ( CHANNEL_TYPE_CHROMA, 1 + uiCode );
    1099     READ_UVLC( uiCode, "log2_min_pcm_luma_coding_block_size_minus3" );   pcSPS->setPCMLog2MinSize (uiCode+3);
    1100     READ_UVLC( uiCode, "log2_diff_max_min_pcm_luma_coding_block_size" ); pcSPS->setPCMLog2MaxSize ( uiCode+pcSPS->getPCMLog2MinSize() );
     1113#if O0043_BEST_EFFORT_DECODING
     1114    READ_CODE_CHK( 4, uiCode, "pcm_sample_bit_depth_luma_minus1",   0, pcSPS->getStreamBitDepth(CHANNEL_TYPE_LUMA) );    pcSPS->setPCMBitDepth    ( CHANNEL_TYPE_LUMA, 1 + uiCode );
     1115    READ_CODE_CHK( 4, uiCode, "pcm_sample_bit_depth_chroma_minus1", 0, pcSPS->getStreamBitDepth(CHANNEL_TYPE_LUMA) );    pcSPS->setPCMBitDepth    ( CHANNEL_TYPE_CHROMA, 1 + uiCode );
     1116#else
     1117    READ_CODE_CHK( 4, uiCode, "pcm_sample_bit_depth_luma_minus1",   0, pcSPS->getBitDepth(CHANNEL_TYPE_LUMA) );          pcSPS->setPCMBitDepth    ( CHANNEL_TYPE_LUMA, 1 + uiCode );
     1118    READ_CODE_CHK( 4, uiCode, "pcm_sample_bit_depth_chroma_minus1", 0, pcSPS->getBitDepth(CHANNEL_TYPE_CHROMA) );        pcSPS->setPCMBitDepth    ( CHANNEL_TYPE_CHROMA, 1 + uiCode );
     1119#endif
     1120    READ_UVLC_CHK( uiCode, "log2_min_pcm_luma_coding_block_size_minus3", std::min<UInt>(minCbLog2SizeY, 5 )-3, std::min<UInt>(ctbLog2SizeY, 5)-3);
     1121    const UInt log2MinIpcmCbSizeY = uiCode+3;
     1122    pcSPS->setPCMLog2MinSize (log2MinIpcmCbSizeY);
     1123    READ_UVLC_CHK( uiCode, "log2_diff_max_min_pcm_luma_coding_block_size", 0, (std::min<UInt>(ctbLog2SizeY,5) - log2MinIpcmCbSizeY) );
     1124    pcSPS->setPCMLog2MaxSize ( uiCode+pcSPS->getPCMLog2MinSize() );
    11011125    READ_FLAG( uiCode, "pcm_loop_filter_disable_flag" );                 pcSPS->setPCMFilterDisableFlag ( uiCode ? true : false );
    11021126  }
    11031127
    1104   READ_UVLC( uiCode, "num_short_term_ref_pic_sets" );
     1128  READ_UVLC_CHK( uiCode, "num_short_term_ref_pic_sets", 0, 64 );
    11051129
    11061130  assert(uiCode <= 64);
     
    11321156#endif
    11331157  {
    1134     READ_UVLC( uiCode, "num_long_term_ref_pics_sps" );
     1158    READ_UVLC_CHK( uiCode, "num_long_term_ref_pics_sps", 0, 32 );
    11351159    pcSPS->setNumLongTermRefPicSPS(uiCode);
    11361160    for (UInt k = 0; k < pcSPS->getNumLongTermRefPicSPS(); k++)
     
    11421166    }
    11431167  }
    1144   READ_FLAG( uiCode, "sps_temporal_mvp_enable_flag" );            pcSPS->setTMVPFlagsPresent(uiCode);
    1145 
    1146   READ_FLAG( uiCode, "sps_strong_intra_smoothing_enable_flag" );  pcSPS->setUseStrongIntraSmoothing(uiCode);
     1168  READ_FLAG( uiCode, "sps_temporal_mvp_enabled_flag" );           pcSPS->setSPSTemporalMVPEnabledFlag(uiCode);
     1169
     1170  READ_FLAG( uiCode, "strong_intra_smoothing_enable_flag" );      pcSPS->setUseStrongIntraSmoothing(uiCode);
    11471171
    11481172  READ_FLAG( uiCode, "vui_parameters_present_flag" );             pcSPS->setVuiParametersPresentFlag(uiCode);
     
    21352159    for( Int j = 0; j  <=  vps->getMaxSubLayersInLayerSetMinus1( currLsIdx ); j++ )
    21362160    { 
    2137 #if NH_3D_FIX_TICKET_114
    21382161      if( j > 0  &&  dpbSize.getSubLayerFlagInfoPresentFlag( i )  ) 
    2139 #else
    2140       if( j > 0  &&  dpbSize.getSubLayerDpbInfoPresentFlag( i, j )  ) 
    2141 #endif
    21422162      {
    21432163        READ_FLAG( uiCode, "sub_layer_dpb_info_present_flag" ); dpbSize.setSubLayerDpbInfoPresentFlag( i, j, uiCode == 1 );
     
    26112631    pcSlice->setRPS(rps);
    26122632  }
    2613   if (sps->getTMVPFlagsPresent())
     2633      if (sps->getSPSTemporalMVPEnabledFlag())
    26142634  {
    26152635    READ_FLAG( uiCode, "slice_temporal_mvp_enabled_flag" );
     
    28812901    }
    28822902
    2883 #if NH_3D_IC
     2903#if NH_3D
    28842904    else if(    pcSlice->getViewIndex() && ( pcSlice->getSliceType() == P_SLICE || pcSlice->getSliceType() == B_SLICE )
    28852905             && !pcSlice->getIsDepth() && vps->getNumRefListLayers( layerId ) > 0
     
    29032923    {
    29042924      READ_UVLC( uiCode, "five_minus_max_num_merge_cand");
    2905 #if NH_3D_IV_MERGE
     2925#if NH_3D
    29062926      pcSlice->setMaxNumMergeCand(( ( pcSlice->getMpiFlag() || pcSlice->getIvMvPredFlag() || pcSlice->getViewSynthesisPredFlag() ) ? MRG_MAX_NUM_CANDS_MEM : MRG_MAX_NUM_CANDS) - uiCode);
    29072927#else
     
    29602980      if(pcSlice->getDeblockingFilterOverrideFlag())
    29612981      {
    2962         READ_FLAG ( uiCode, "slice_disable_deblocking_filter_flag" );   pcSlice->setDeblockingFilterDisable(uiCode ? 1 : 0);
     2982        READ_FLAG ( uiCode, "slice_deblocking_filter_disabled_flag" );   pcSlice->setDeblockingFilterDisable(uiCode ? 1 : 0);
    29632983        if(!pcSlice->getDeblockingFilterDisable())
    29642984        {
     
    29732993      else
    29742994      {
    2975         pcSlice->setDeblockingFilterDisable   ( pps->getPicDisableDeblockingFilterFlag() );
     2995        pcSlice->setDeblockingFilterDisable       ( pps->getPPSDeblockingFilterDisabledFlag() );
    29762996        pcSlice->setDeblockingFilterBetaOffsetDiv2( pps->getDeblockingFilterBetaOffsetDiv2() );
    29772997        pcSlice->setDeblockingFilterTcOffsetDiv2  ( pps->getDeblockingFilterTcOffsetDiv2() );
     
    32983318    ptl->setIntraConstraintFlag(false);
    32993319    ptl->setLowerBitRateConstraintFlag(true);
     3320    if (ptl->getProfileIdc() == Profile::MAIN10           || ptl->getProfileCompatibilityFlag(Profile::MAIN10))
     3321    {
     3322      READ_CODE(7, uiCode, PTL_TRACE_TEXT("reserved_zero_7bits"     ));
     3323      READ_FLAG(    uiCode, PTL_TRACE_TEXT("one_picture_only_constraint_flag")); ptl->setOnePictureOnlyConstraintFlag(uiCode != 0);
     3324      READ_CODE(16, uiCode, PTL_TRACE_TEXT("reserved_zero_35bits[0..15]"     ));
     3325      READ_CODE(16, uiCode, PTL_TRACE_TEXT("reserved_zero_35bits[16..31]"    ));
     3326      READ_CODE(3,  uiCode, PTL_TRACE_TEXT("reserved_zero_35bits[32..34]"    ));
     3327    }
     3328    else
     3329    {
    33003330    READ_CODE(16, uiCode, PTL_TRACE_TEXT("reserved_zero_43bits[0..15]"     ));
    33013331    READ_CODE(16, uiCode, PTL_TRACE_TEXT("reserved_zero_43bits[16..31]"    ));
    33023332    READ_CODE(11, uiCode, PTL_TRACE_TEXT("reserved_zero_43bits[32..42]"    ));
     3333  }
    33033334  }
    33043335
     
    33553386}
    33563387
    3357 #if NH_3D_DIS
     3388#if NH_3D
    33583389Void TDecCavlc::parseDIS( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ )
    33593390{
     
    34393470  Int  iDQp;
    34403471
    3441 #if RExt__DECODER_DEBUG_BIT_STATISTICS
     3472#if RExt__DECODER_DEBUG_BIT_STATISTICS || ENC_DEC_TRACE
    34423473  READ_SVLC(iDQp, "delta_qp");
    34433474#else
     
    34973528}
    34983529
    3499 #if NH_3D_ARP
     3530#if NH_3D
    35003531Void TDecCavlc::parseARPW( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    35013532{
    35023533  assert(0);
    35033534}
    3504 #endif
    3505 #if NH_3D_IC
     3535
    35063536Void TDecCavlc::parseICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    35073537{
    35083538  assert(0);
    35093539}
    3510 #endif
    3511 #if NH_3D_SDC_INTRA || NH_3D_SDC_INTER
     3540
    35123541Void TDecCavlc::parseSDCFlag    ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    35133542{
     
    35153544}
    35163545
    3517 #endif
    3518 #if NH_3D_DBBP
    3519   Void TDecCavlc::parseDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    3520   {
    3521     assert(0);
    3522   }
     3546Void TDecCavlc::parseDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
     3547{
     3548  assert(0);
     3549}
    35233550#endif
    35243551// ====================================================================================================================
  • trunk/source/Lib/TLibDecoder/TDecCAVLC.h

    r1405 r1413  
    44 * granted under this license.
    55 *
    6  * Copyright (c) 2010-2016, ITU/ISO/IEC
     6 * Copyright (c) 2010-2017, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    121121       
    122122  Void  parseSkipFlag        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    123 #if NH_3D_DIS
     123#if NH_3D
    124124  Void  parseDIS             ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    125125#endif
     
    127127  Void parseMergeFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx );
    128128  Void parseMergeIndex      ( TComDataCU* pcCU, UInt& ruiMergeIndex );
    129 #if NH_3D_ARP
     129#if NH_3D
    130130  Void parseARPW            ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    131 #endif
    132 #if NH_3D_IC
    133131  Void  parseICFlag         ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    134 #endif
    135 #if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER
    136132  Void  parseDeltaDC        ( TComDataCU* /*pcCU*/, UInt /*absPartIdx*/, UInt /*depth*/ ) { assert(0); };
    137 #endif
    138 #if NH_3D_SDC_INTRA || NH_3D_SDC_INTER
    139133  Void  parseSDCFlag        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    140 #endif
    141 #if NH_3D_DBBP
    142134  Void  parseDBBPFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    143135#endif
  • trunk/source/Lib/TLibDecoder/TDecCu.cpp

    r1405 r1413  
    44 * granted under this license.
    55 *
    6  * Copyright (c) 2010-2016, ITU/ISO/IEC
     6 * Copyright (c) 2010-2017, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    5252  m_ppcYuvReco = NULL;
    5353  m_ppcCU      = NULL;
    54 #if NH_3D_DBBP
     54#if NH_3D
    5555  m_ppcYuvRecoDBBP = NULL;
    5656#endif
     
    6161}
    6262
     63#if MCTS_ENC_CHECK
     64Void TDecCu::init( TDecEntropy* pcEntropyDecoder, TComTrQuant* pcTrQuant, TComPrediction* pcPrediction, TDecConformanceCheck* pConformanceCheck)
     65#else
    6366Void TDecCu::init( TDecEntropy* pcEntropyDecoder, TComTrQuant* pcTrQuant, TComPrediction* pcPrediction)
     67#endif
    6468{
    6569  m_pcEntropyDecoder  = pcEntropyDecoder;
    6670  m_pcTrQuant         = pcTrQuant;
    6771  m_pcPrediction      = pcPrediction;
     72#if MCTS_ENC_CHECK
     73  m_pConformanceCheck = pConformanceCheck;
     74#endif
    6875}
    6976
     
    8188  m_ppcYuvReco = new TComYuv*[m_uiMaxDepth-1];
    8289  m_ppcCU      = new TComDataCU*[m_uiMaxDepth-1];
    83 #if NH_3D_DBBP
     90#if NH_3D
    8491  m_ppcYuvRecoDBBP = new TComYuv*[m_uiMaxDepth-1];
    8592#endif
     
    102109    m_ppcYuvReco[ui] = new TComYuv;    m_ppcYuvReco[ui]->create( uiWidth, uiHeight, chromaFormatIDC );
    103110    m_ppcCU     [ui] = new TComDataCU; m_ppcCU     [ui]->create( chromaFormatIDC, uiNumPartitions, uiWidth, uiHeight, true, uiMaxWidth >> (m_uiMaxDepth - 1) );
    104 #if NH_3D_DBBP
     111#if NH_3D
    105112    m_ppcYuvRecoDBBP[ui] = new TComYuv;    m_ppcYuvRecoDBBP[ui]->create( uiWidth, uiHeight, chromaFormatIDC );
    106113#endif
     
    126133    m_ppcYuvReco[ui]->destroy(); delete m_ppcYuvReco[ui]; m_ppcYuvReco[ui] = NULL;
    127134    m_ppcCU     [ui]->destroy(); delete m_ppcCU     [ui]; m_ppcCU     [ui] = NULL;
    128 #if NH_3D_DBBP
     135#if NH_3D
    129136    m_ppcYuvRecoDBBP[ui]->destroy(); delete m_ppcYuvRecoDBBP[ui]; m_ppcYuvRecoDBBP[ui] = NULL;
    130137#endif
     
    134141  delete [] m_ppcYuvReco; m_ppcYuvReco = NULL;
    135142  delete [] m_ppcCU     ; m_ppcCU      = NULL;
    136 #if NH_3D_DBBP
     143#if NH_3D
    137144  delete [] m_ppcYuvRecoDBBP; m_ppcYuvRecoDBBP = NULL;
    138145#endif
     
    170177Void TDecCu::decompressCtu( TComDataCU* pCtu )
    171178{
    172 #if !NH_3D_IV_MERGE
     179#if !NH_3D
    173180  xDecompressCU( pCtu, 0,  0 );
    174181#endif
     
    290297    pcCU->setQPSubParts( pcCU->getRefQP(uiAbsPartIdx), uiAbsPartIdx, uiDepth ); // set QP to default QP
    291298  }
    292 #if NH_3D_NBDV
     299#if NH_3D
    293300  DisInfo DvInfo;
    294301  DvInfo.m_acNBDV.setZero();
    295302  DvInfo.m_aVIdxCan = 0;
    296 #if NH_3D_NBDV_REF 
    297303  DvInfo.m_acDoNBDV.setZero();
    298 #endif
    299  
    300 if(!pcCU->getSlice()->isIntra())
    301   {
    302 #if NH_3D_ARP && NH_3D_IV_MERGE && NH_3D_VSP
     304
     305  if(!pcCU->getSlice()->isIntra())
     306  {
    303307    if( pcCU->getSlice()->getIvResPredFlag() || pcCU->getSlice()->getIvMvPredFlag() || pcCU->getSlice()->getViewSynthesisPredFlag() )
    304 #else
    305 #if NH_3D_IV_MERGE && NH_3D_VSP
    306     if( pcCU->getSlice()->getIvMvPredFlag() || pcCU->getSlice()->getViewSynthesisPredFlag() )
    307 #else
    308 #if NH_3D_ARP && NH_3D_VSP
    309     if( pcCU->getSlice()->getIvResPredFlag() || pcCU->getSlice()->getViewSynthesisPredFlag() )
    310 #else
    311 #if NH_3D_VSP
    312     if( pcCU->getSlice()->getViewSynthesisPredFlag() )
    313 #else
    314 #if H_3D_ARP
    315     if( pcCU->getSlice()->getIvResPredFlag( ) )
    316 #else
    317 #if H_3D_IV_MERGE
    318     if( pcCU->getSlice()->getVPS()->getIvMvPredFlag(pcCU->getSlice()->getLayerId()) )
    319 #else
    320 #if NH_3D_DBBP
    321     if( pcCU->getSlice()->getDepthBasedBlkPartFlag() )
    322 #else
    323     if (0)
    324 #endif
    325 #endif
    326 #endif
    327 #endif
    328 #endif
    329 #endif
    330 #endif
    331308    {
    332309      m_ppcCU[uiDepth]->copyInterPredInfoFrom(pcCU, uiAbsPartIdx, REF_PIC_LIST_0, true);
     
    338315      m_ppcCU[uiDepth]->setHeight(0, pcCU->getSlice()->getSPS()->getMaxCUHeight() / (1 << uiDepth));
    339316      m_ppcCU[uiDepth]->setPartSizeSubParts(SIZE_2Nx2N, 0, uiDepth);     
    340 #if NH_3D_IV_MERGE
    341317      if( pcCU->getSlice()->getIsDepth())
    342318      {
     
    345321      else
    346322      {
    347 #endif
    348 #if NH_3D_NBDV_REF
    349       if( pcCU->getSlice()->getDepthBasedBlkPartFlag() )  //Notes from QC: please check the condition for DoNBDV. Remove this comment once it is done.
    350       {
    351         m_ppcCU[uiDepth]->getDisMvpCandNBDV(&DvInfo, true);
    352       }
    353       else
    354 #endif
    355       {
    356         m_ppcCU[uiDepth]->getDisMvpCandNBDV(&DvInfo);
    357       }
    358 #if NH_3D_IV_MERGE
    359       }
    360 #endif
     323        if( pcCU->getSlice()->getDepthBasedBlkPartFlag() )  //Notes from QC: please check the condition for DoNBDV. Remove this comment once it is done.
     324        {
     325          m_ppcCU[uiDepth]->getDisMvpCandNBDV(&DvInfo, true);
     326        }
     327        else
     328        {
     329          m_ppcCU[uiDepth]->getDisMvpCandNBDV(&DvInfo);
     330        }
     331      }
    361332#if ENC_DEC_TRACE && NH_MV_ENC_DEC_TRAC   
    362333      if ( g_decTraceDispDer )
     
    373344      m_ppcCU[uiDepth]->setWidth(0, cWidTemp);
    374345      m_ppcCU[uiDepth]->setHeight(0, cHeightTemp);
    375      }
     346    }
    376347  }
    377348#endif
     
    382353  }
    383354
    384   if (pps.getTransquantBypassEnableFlag())
     355  if (pps.getTransquantBypassEnabledFlag())
    385356  {
    386357    m_pcEntropyDecoder->decodeCUTransquantBypassFlag( pcCU, uiAbsPartIdx, uiDepth );
     
    403374    m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0 );
    404375    m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_1 );
    405 #if NH_3D_IV_MERGE
     376#if NH_3D
    406377    m_ppcCU[uiDepth]->copyDVInfoFrom(pcCU, uiAbsPartIdx);
    407     TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists
    408     UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM];
    409 #else
    410 #if NH_3D_MLC
    411378    TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists
    412379    UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM];
     
    415382    UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS];
    416383#endif
    417 #endif
    418384    Int numValidMergeCand = 0;
    419385    for( UInt ui = 0; ui < m_ppcCU[uiDepth]->getSlice()->getMaxNumMergeCand(); ++ui )
     
    423389    m_pcEntropyDecoder->decodeMergeIndex( pcCU, 0, uiAbsPartIdx, uiDepth );
    424390    UInt uiMergeIndex = pcCU->getMergeIndex(uiAbsPartIdx);
    425 #if NH_3D_ARP
     391#if NH_3D
    426392    m_pcEntropyDecoder->decodeARPW( pcCU , uiAbsPartIdx , uiDepth );
    427 #endif
    428 #if NH_3D_IC
    429393    m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
    430 #endif
    431 
    432 
    433 #if NH_3D_VSP
     394
    434395    Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
    435396    memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
    436 #endif
    437 #if NH_3D_SPIVMP
     397
    438398    Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM];
    439399    memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
     
    442402    pcMvFieldSP = new TComMvField[pcCU->getPic()->getPicSym()->getNumPartitionsInCtu()*2];
    443403    puhInterDirSP = new UChar[pcCU->getPic()->getPicSym()->getNumPartitionsInCtu()];
    444 #endif
    445 
    446 #if NH_3D_MLC
    447404    m_ppcCU[uiDepth]->initAvailableFlags();
    448405#endif
     406#if MCTS_ENC_CHECK
     407    UInt numSpatialMergeCandidates = 0;
     408    m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, numSpatialMergeCandidates, uiMergeIndex );
     409#if MCTS_ENC_CHECK
     410    if ( m_pConformanceCheck->getTMctsCheck() && m_ppcCU[uiDepth]->isLastColumnCTUInTile() && (uiMergeIndex >= numSpatialMergeCandidates) )
     411    {
     412      m_pConformanceCheck->flagTMctsError("Merge Index using non-spatial merge candidate (Skip)");
     413    }
     414#endif
     415#else
    449416    m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
    450 #if NH_3D_MLC
    451     m_ppcCU[uiDepth]->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours
    452 #if NH_3D_SPIVMP
    453       , pcMvFieldSP, puhInterDirSP
    454 #endif
    455       , numValidMergeCand, uiMergeIndex );
    456 
    457     m_ppcCU[uiDepth]->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours
    458 #if NH_3D_VSP
    459       , vspFlag
    460 #endif
    461 #if NH_3D_SPIVMP
    462       , bSPIVMPFlag
    463 #endif
    464       , numValidMergeCand );
    465 #endif
    466 #if NH_3D_VSP
     417#endif
     418#if NH_3D
     419    m_ppcCU[uiDepth]->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, pcMvFieldSP, puhInterDirSP, numValidMergeCand, uiMergeIndex );
     420    m_ppcCU[uiDepth]->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, bSPIVMPFlag, numValidMergeCand );
    467421    pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiAbsPartIdx, 0, uiDepth );
    468422#endif
     
    479433        pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, SIZE_2Nx2N, uiAbsPartIdx, uiDepth );
    480434        pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], SIZE_2Nx2N, uiAbsPartIdx, uiDepth );
    481 #if NH_3D_VSP
     435#if NH_3D
    482436        if( pcCU->getVSPFlag( uiAbsPartIdx ) != 0 )
    483437        {
     
    512466      }
    513467    }
    514 #if NH_3D_SPIVMP
     468#if NH_3D
    515469    pcCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeIndex], uiAbsPartIdx, 0, uiDepth );
    516470    if (bSPIVMPFlag[uiMergeIndex])
     
    570524
    571525    xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, isLastCtuOfSliceSegment );
    572 #if NH_3D_IV_MERGE
     526#if NH_3D
    573527    xDecompressCU(pcCU, uiAbsPartIdx, uiDepth );
    574528#endif
     
    576530    return;
    577531  }
    578 #if NH_3D_DIS
     532#if NH_3D
    579533  m_pcEntropyDecoder->decodeDIS( pcCU, uiAbsPartIdx, uiDepth );
    580534  if(!pcCU->getDISFlag(uiAbsPartIdx))
     
    582536#endif
    583537
    584   m_pcEntropyDecoder->decodePredMode( pcCU, uiAbsPartIdx, uiDepth );
    585   m_pcEntropyDecoder->decodePartSize( pcCU, uiAbsPartIdx, uiDepth );
    586 
    587   if (pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N )
    588   {
    589     m_pcEntropyDecoder->decodeIPCMInfo( pcCU, uiAbsPartIdx, uiDepth );
    590 
    591     if(pcCU->getIPCMFlag(uiAbsPartIdx))
    592     {
    593 #if NH_3D_SDC_INTRA
    594       m_pcEntropyDecoder->decodeSDCFlag( pcCU, uiAbsPartIdx, uiDepth );
    595 #endif
    596       xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, isLastCtuOfSliceSegment );
    597 #if NH_3D_IV_MERGE
    598       xDecompressCU(pcCU, uiAbsPartIdx, uiDepth );
    599 #endif
    600       return;
    601     }
    602   }
    603 
    604   // prediction mode ( Intra : direction mode, Inter : Mv, reference idx )
    605   m_pcEntropyDecoder->decodePredInfo( pcCU, uiAbsPartIdx, uiDepth, m_ppcCU[uiDepth]);
    606 
    607   // Coefficient decoding
    608   Bool bCodeDQP = getdQPFlag();
    609   Bool isChromaQpAdjCoded = getIsChromaQpAdjCoded();
    610   m_pcEntropyDecoder->decodeCoeff( pcCU, uiAbsPartIdx, uiDepth, bCodeDQP, isChromaQpAdjCoded );
    611   setIsChromaQpAdjCoded( isChromaQpAdjCoded );
    612   setdQPFlag( bCodeDQP );
    613 #if NH_3D_DIS
     538    m_pcEntropyDecoder->decodePredMode( pcCU, uiAbsPartIdx, uiDepth );
     539    m_pcEntropyDecoder->decodePartSize( pcCU, uiAbsPartIdx, uiDepth );
     540
     541    if (pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N )
     542    {
     543      m_pcEntropyDecoder->decodeIPCMInfo( pcCU, uiAbsPartIdx, uiDepth );
     544
     545      if(pcCU->getIPCMFlag(uiAbsPartIdx))
     546      {
     547#if NH_3D
     548        m_pcEntropyDecoder->decodeSDCFlag( pcCU, uiAbsPartIdx, uiDepth );
     549#endif
     550        xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, isLastCtuOfSliceSegment );
     551#if NH_3D
     552        xDecompressCU(pcCU, uiAbsPartIdx, uiDepth );
     553#endif
     554        return;
     555      }
     556    }
     557
     558    // prediction mode ( Intra : direction mode, Inter : Mv, reference idx )
     559    m_pcEntropyDecoder->decodePredInfo( pcCU, uiAbsPartIdx, uiDepth, m_ppcCU[uiDepth]);
     560
     561    // Coefficient decoding
     562    Bool bCodeDQP = getdQPFlag();
     563    Bool isChromaQpAdjCoded = getIsChromaQpAdjCoded();
     564    m_pcEntropyDecoder->decodeCoeff( pcCU, uiAbsPartIdx, uiDepth, bCodeDQP, isChromaQpAdjCoded );
     565    setIsChromaQpAdjCoded( isChromaQpAdjCoded );
     566    setdQPFlag( bCodeDQP );
     567#if NH_3D
    614568  }
    615569#endif
    616570  xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, isLastCtuOfSliceSegment );
    617 #if NH_3D_IV_MERGE
     571#if NH_3D
    618572  xDecompressCU(pcCU, uiAbsPartIdx, uiDepth );
    619573#endif
     
    638592{
    639593  TComPic* pcPic = pCtu->getPic();
    640 #if !NH_3D_IV_MERGE
     594#if !NH_3D
    641595  TComSlice * pcSlice = pCtu->getSlice();
    642596  const TComSPS &sps=*(pcSlice->getSPS());
     
    681635  {
    682636    case MODE_INTER:
    683 #if NH_3D_DBBP
     637#if NH_3D
    684638    if( m_ppcCU[uiDepth]->getDBBPFlag(0) )
    685639    {
     
    688642    else
    689643    {
    690 #endif
    691 #if NH_3D_SDC_INTER
    692644      if( m_ppcCU[uiDepth]->getSDCFlag( 0 ) )
    693645      {
     
    698650#endif
    699651      xReconInter( m_ppcCU[uiDepth], uiDepth );
    700 #if NH_3D_SDC_INTER
    701       }
    702 #endif
    703 #if NH_3D_DBBP
     652#if NH_3D
     653      }
    704654    }
    705655#endif
     
    707657    case MODE_INTRA:
    708658#if NH_3D
    709 #if NH_3D_DIS
    710659    if( m_ppcCU[uiDepth]->getDISFlag(0) )
    711660    {
    712661      xReconDIS( m_ppcCU[uiDepth], 0, uiDepth );
    713662    }
    714 #else
    715     if(false )
    716     {
    717      // xReconDIS( m_ppcCU[uiDepth], 0, uiDepth );
    718     }
    719 #endif
    720 #if NH_3D_SDC_INTRA
    721663    else if( m_ppcCU[uiDepth]->getSDCFlag(0) )
    722664    {
    723665      xReconIntraSDC( m_ppcCU[uiDepth], 0, uiDepth );
    724666    }
    725 #endif
    726667    else
    727668#endif
     
    756697
    757698  // inter prediction
     699#if MCTS_ENC_CHECK
     700  if (m_pConformanceCheck->getTMctsCheck()  && !m_pcPrediction->checkTMctsMvp(pcCU))
     701  {
     702    m_pConformanceCheck->flagTMctsError("motion vector across tile boundaries");
     703  }
     704#endif
    758705  m_pcPrediction->motionCompensation( pcCU, m_ppcYuvReco[uiDepth] );
    759706
     
    794741}
    795742
    796 #if NH_3D_DIS
     743#if NH_3D
    797744Void TDecCu::xReconDIS( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    798745{
     
    869816  }
    870817}
    871 #endif
    872 #if NH_3D_SDC_INTER
     818
    873819Void TDecCu::xReconInterSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    874820{
     
    913859  }
    914860}
    915 #endif
    916 
    917 #if NH_3D_DBBP
     861
    918862Void TDecCu::xReconInterDBBP( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    919863{
     
    926870  // get collocated depth block
    927871  UInt uiDepthStride = 0;
    928 #if H_3D_FCO
    929   Pel* pDepthPels = pcCU->getVirtualDepthBlock(pcCU->getZorderIdxInCU(), pcCU->getWidth(0), pcCU->getHeight(0), uiDepthStride);
    930 #else
    931872  Pel* pDepthPels = pcCU->getVirtualDepthBlock(0, pcCU->getWidth(0), pcCU->getHeight(0), uiDepthStride);
    932 #endif
    933873  AOF( pDepthPels != NULL );
    934874  AOF( uiDepthStride != 0 );
     
    956896      pcCU->getMvField(pcCU, uiPartAddr, eRefList, pDBBPTmpData->acMvField[uiSegment][eRefList]);
    957897    }
    958    
    959 #if NH_3D
     898
    960899    AOF( pcCU->getARPW(uiPartAddr) == 0 );
    961900    AOF( pcCU->getICFlag(uiPartAddr) == false );
    962901    AOF( pcCU->getSPIVMPFlag(uiPartAddr) == false );
    963902    AOF( pcCU->getVSPFlag(uiPartAddr) == 0 );
    964 #endif
    965903  }
    966904 
     
    10811019
    10821020  //===== get prediction signal =====
    1083 #if NH_3D_DMM
     1021#if NH_3D
    10841022  if( bIsLuma && isDmmMode( uiChFinalMode ) )
    10851023  {
     
    10901028#endif
    10911029  m_pcPrediction->predIntraAng( compID,   uiChFinalMode, 0 /* Decoder does not have an original image */, 0, piPred, uiStride, rTu, bUseFilteredPredictions );
    1092 #if NH_3D_DMM
     1030#if NH_3D
    10931031  }
    10941032#endif
     
    12551193}
    12561194
    1257 #if NH_3D_SDC_INTRA
     1195#if NH_3D
    12581196Void TDecCu::xReconIntraSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    12591197{
     
    12841222  UInt uiMaskStride = 0;
    12851223
    1286 #if NH_3D_DMM
    12871224  if( isDmmMode( uiLumaPredMode ) )
    12881225  {
     
    13301267  else // regular HEVC intra modes
    13311268  {
    1332 #endif
     1269
    13331270    uiNumSegments = 1;
    13341271
     
    13891326
    13901327    m_pcPrediction->predConstantSDC( piPred, uiStride, uiWidth, apDCPredValues[0] ); apDCPredValues[1] = 0;
    1391 #if NH_3D_DMM
    1392   }
    1393 #endif
    1394  
     1328  }
     1329
    13951330  // reconstruct residual based on mask + DC residuals
    13961331  Pel apDCResiValues[2];
    13971332  for( UInt uiSegment = 0; uiSegment < uiNumSegments; uiSegment++ )
    13981333  {
    1399 #if NH_3D_DLT
    14001334    Pel   pPredIdx    = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] );
    14011335    Pel   pResiIdx    = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);
     
    14031337
    14041338    apDCResiValues[uiSegment]  = pRecoValue - apDCPredValues[uiSegment];
    1405 #else
    1406     apDCResiValues[uiSegment]  = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);
    1407 #endif
    14081339  }
    14091340 
     
    14501381    pRecCr += uiStrideC;
    14511382  }
    1452 #if NH_3D_DMM
    14531383  if( pbMask ) { delete[] pbMask; }
    1454 #endif
    14551384}
    14561385#endif
  • trunk/source/Lib/TLibDecoder/TDecCu.h

    r1405 r1413  
    44 * granted under this license.
    55 *
    6  * Copyright (c) 2010-2016, ITU/ISO/IEC
     6 * Copyright (c) 2010-2017, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    4545#include "TLibCommon/TComTrQuant.h"
    4646#include "TDecEntropy.h"
     47#include "TDecConformance.h"
    4748
    4849//! \ingroup TLibDecoder
     
    6263  TComDataCU**        m_ppcCU;            ///< CU data array
    6364
    64 #if NH_3D_DBBP
     65#if NH_3D
    6566  TComYuv**           m_ppcYuvRecoDBBP;
    6667#endif
     
    7071  TComPrediction*     m_pcPrediction;
    7172  TDecEntropy*        m_pcEntropyDecoder;
     73#if MCTS_ENC_CHECK
     74  TDecConformanceCheck* m_pConformanceCheck;
     75#endif
    7276
    7377  Bool                m_bDecodeDQP;
     
    7983
    8084  /// initialize access channels
     85#if MCTS_ENC_CHECK
     86  Void  init                    (TDecEntropy* pcEntropyDecoder, TComTrQuant* pcTrQuant, TComPrediction* pcPrediction, TDecConformanceCheck* pConformanceCheck);
     87#else
    8188  Void  init                    ( TDecEntropy* pcEntropyDecoder, TComTrQuant* pcTrQuant, TComPrediction* pcPrediction );
     89#endif
    8290
    8391  /// create internal buffers
     
    102110  Void xReconInter              ( TComDataCU* pcCU, UInt uiDepth );
    103111
    104 #if NH_3D_DBBP
     112#if NH_3D
    105113  Void xReconInterDBBP          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    106114#endif
     
    124132  Void xFillPCMBuffer           (TComDataCU* pCU, UInt depth);
    125133
    126 #if NH_3D_DIS
     134#if NH_3D
    127135  Void xReconDIS               ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    128 #endif
    129 #if NH_3D_SDC_INTRA
    130136  Void xReconIntraSDC           ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    131 #endif
    132 #if NH_3D_SDC_INTER
    133137  Void xReconInterSDC           ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    134138#endif
  • trunk/source/Lib/TLibDecoder/TDecEntropy.cpp

    r1405 r1413  
    44 * granted under this license.
    55 *
    6  * Copyright (c) 2010-2016, ITU/ISO/IEC
     6 * Copyright (c) 2010-2017, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    6060  m_pcEntropyDecoderIf->parseSkipFlag( pcCU, uiAbsPartIdx, uiDepth );
    6161}
    62 #if NH_3D_DIS
     62#if NH_3D
    6363Void TDecEntropy::decodeDIS( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    6464{
     
    104104}
    105105
    106 #if NH_3D_ARP
     106#if NH_3D
    107107Void TDecEntropy::decodeARPW( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    108108{
     
    121121  }
    122122}
    123 #endif
    124 
    125 #if NH_3D_IC
     123
    126124Void TDecEntropy::decodeICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    127125{
    128126  pcCU->setICFlagSubParts( false , uiAbsPartIdx, 0, uiDepth );
    129127
    130 #if NH_3D_ARP
    131128  if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) || pcCU->getSlice()->getIsDepth() || pcCU->getARPW( uiAbsPartIdx ) > 0 )
    132 #else
    133   if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) || pcCU->getSlice()->getIsDepth() )
    134 #endif
    135129  {
    136130    return;
     
    165159  {
    166160    decodeIntraDirModeLuma  ( pcCU, uiAbsPartIdx, uiDepth );
    167 #if NH_3D_SDC_INTRA
     161#if NH_3D
    168162    decodeSDCFlag   ( pcCU, uiAbsPartIdx, uiDepth );
    169163#endif
     
    239233  UInt uiPUOffset = ( g_auiPUOffset[UInt( ePartSize )] << ( ( pcCU->getSlice()->getSPS()->getMaxTotalCUDepth() - uiDepth ) << 1 ) ) >> 4;
    240234
    241 #if NH_3D_MLC
    242 //#if H_3D_IV_MERGE
     235#if NH_3D
    243236  TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists
    244237  UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM];
     
    247240  UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS];
    248241#endif
    249 #if NH_3D_SPIVMP
     242#if NH_3D
    250243  Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM];     
    251244  TComMvField*  pcMvFieldSP = new TComMvField[pcCU->getPic()->getPicSym()->getNumPartitionsInCtu()*2];
    252245  UChar* puhInterDirSP = new UChar[pcCU->getPic()->getPicSym()->getNumPartitionsInCtu()];
    253 #endif
    254 #if NH_3D_IV_MERGE
    255246  pcSubCU->copyDVInfoFrom( pcCU, uiAbsPartIdx);
    256247#endif
     
    262253  Bool hasMergedCandList = false;
    263254
     255#if MCTS_ENC_CHECK
     256  UInt numSpatialMergeCandidates = 0;
     257#endif
    264258  pcSubCU->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0 );
    265259  pcSubCU->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_1 );
     
    296290
    297291  ////// Parse CUs extension syntax
    298 #if NH_3D_DBBP
    299292  decodeDBBPFlag( pcCU, uiAbsPartIdx, uiDepth );
    300 #endif
    301 #if NH_3D_SDC_INTER
    302293  decodeSDCFlag ( pcCU, uiAbsPartIdx, uiDepth );
    303 #endif
    304 #if NH_3D_ARP
    305   decodeARPW  ( pcCU, uiAbsPartIdx, uiDepth );
    306 #endif
    307 #if NH_3D_IC
    308   decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
    309 #endif
     294  decodeARPW    ( pcCU, uiAbsPartIdx, uiDepth );
     295  decodeICFlag  ( pcCU, uiAbsPartIdx, uiDepth );
    310296
    311297  ////// Decode motion vectors
     
    323309#endif
    324310
    325 #if NH_3D_DBBP
    326311      if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 && pcCU->getDBBPFlag(uiAbsPartIdx) == false )
    327 #else
    328       if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 )
    329 #endif
    330312      {
    331313        if ( !hasMergedCandList )
    332314        {
    333315          pcSubCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); // temporarily set.
    334 
    335 #if NH_3D_MLC
    336 #if NH_3D_VSP
    337316          Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
    338317          memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
    339 #endif
    340 #if NH_3D_SPIVMP
    341318          memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
    342 #endif
    343319          pcSubCU->initAvailableFlags();
    344 #endif
     320#if MCTS_ENC_CHECK
     321          numSpatialMergeCandidates = 0;
     322          pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, numSpatialMergeCandidates );
     323#else
    345324          pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
    346 #if NH_3D_MLC
    347           pcSubCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours
    348 #if NH_3D_SPIVMP
    349             , pcMvFieldSP, puhInterDirSP
    350 #endif
    351             , numValidMergeCand );
    352           pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours
    353 #if NH_3D_VSP
    354             , vspFlag
    355 #endif
    356 #if NH_3D_SPIVMP
    357             , bSPIVMPFlag
    358 #endif
    359             , numValidMergeCand );
    360 #if NH_3D_VSP
     325#endif
     326
     327          pcSubCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, pcMvFieldSP, puhInterDirSP, numValidMergeCand );
     328          pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, bSPIVMPFlag, numValidMergeCand );
    361329          pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
    362 #endif
    363 #endif
    364330          pcSubCU->setPartSizeSubParts( ePartSize, 0, uiDepth ); // restore.
    365331          hasMergedCandList = true;
     
    368334      else
    369335      {
    370 #if NH_3D_MLC
    371 #if NH_3D_VSP
    372336        Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
    373337        memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
    374 #endif
    375 #if NH_3D_SPIVMP
    376338        memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
    377 #endif
    378339        pcSubCU->initAvailableFlags();
    379 #endif
     340#if MCTS_ENC_CHECK
     341        numSpatialMergeCandidates = 0;
     342        pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, numSpatialMergeCandidates, uiMergeIndex );
     343#else
    380344        pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
    381 #if NH_3D_MLC
    382         pcSubCU->xGetInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours
    383 #if NH_3D_SPIVMP
    384           , pcMvFieldSP, puhInterDirSP
    385 #endif
    386           ,numValidMergeCand, uiMergeIndex );
    387         pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours
    388 #if NH_3D_VSP
    389           , vspFlag
    390 #endif
    391 #if NH_3D_SPIVMP
    392           , bSPIVMPFlag
    393 #endif
    394           ,numValidMergeCand );
    395 #if NH_3D_VSP
     345#endif
     346        pcSubCU->xGetInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, pcMvFieldSP, puhInterDirSP ,numValidMergeCand, uiMergeIndex );
     347        pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours , vspFlag, bSPIVMPFlag ,numValidMergeCand );
    396348        pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
    397 #endif
    398 #endif
    399349      }
    400350      pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
     
    409359          pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, ePartSize, uiSubPartIdx, uiDepth, uiPartIdx );
    410360          pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], ePartSize, uiSubPartIdx, uiDepth, uiPartIdx );
    411 #if NH_3D_VSP
    412 #if NH_3D_DBBP
    413361          if( pcCU->getVSPFlag( uiSubPartIdx ) != 0 && !pcCU->getDBBPFlag( uiAbsPartIdx ) )
    414 #else
    415           if( pcCU->getVSPFlag( uiSubPartIdx ) != 0 )
    416 #endif
    417362          {
    418363            if ( uhInterDirNeighbours[ uiMergeIndex ] & (1<<uiRefListIdx) )
     
    426371            }
    427372          }
    428 #endif
    429         }
    430       }
    431 #if NH_3D_SPIVMP
     373        }
     374      }
    432375      pcCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); 
    433376      if (bSPIVMPFlag[uiMergeIndex] != 0)
     
    451394        }
    452395      }
    453 #endif
    454396    }
    455397    else
     
    481423    }
    482424  }
     425
     426  delete[] pcMvFieldSP;
     427  delete[] puhInterDirSP;
     428
    483429#else
    484430  for ( UInt uiPartIdx = 0, uiSubPartIdx = uiAbsPartIdx; uiPartIdx < uiNumPU; uiPartIdx++, uiSubPartIdx += uiPUOffset )
     
    501447      }
    502448#endif
    503 #if NH_3D_IC
    504       decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
    505 #endif
    506 
    507449      const UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
    508450      if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 )
     
    512454          pcSubCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); // temporarily set.
    513455
    514 #if NH_3D_MLC
    515 #if NH_3D_VSP
    516           Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
    517           memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
    518 #endif
    519 #if NH_3D_SPIVMP
    520           memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
    521 #endif
    522           pcSubCU->initAvailableFlags();
    523 #endif
     456#if MCTS_ENC_CHECK
     457          numSpatialMergeCandidates = 0;
     458          pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, numSpatialMergeCandidates );
     459#else
    524460          pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
    525 #if NH_3D_MLC
    526           pcSubCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours
    527 #if NH_3D_SPIVMP
    528             , pcMvFieldSP, puhInterDirSP
    529 #endif
    530             , numValidMergeCand );
    531           pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours
    532 #if NH_3D_VSP
    533             , vspFlag
    534 #endif
    535 #if NH_3D_SPIVMP
    536             , bSPIVMPFlag
    537 #endif
    538             , numValidMergeCand );
    539 #if NH_3D_VSP
    540           pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
    541 #endif
    542461#endif
    543462          pcSubCU->setPartSizeSubParts( ePartSize, 0, uiDepth ); // restore.
     
    547466      else
    548467      {
    549 
    550 #if NH_3D_MLC
    551 #if NH_3D_VSP
    552         Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
    553         memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
    554 #endif
    555 #if NH_3D_SPIVMP
    556         memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
    557 #endif
    558         pcSubCU->initAvailableFlags();
    559 #endif
     468#if MCTS_ENC_CHECK
     469        numSpatialMergeCandidates = 0;
     470        pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, numSpatialMergeCandidates, uiMergeIndex );
     471#else
     472
    560473        pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
    561 #if NH_3D_MLC
    562         pcSubCU->xGetInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours
    563 #if NH_3D_SPIVMP
    564           , pcMvFieldSP, puhInterDirSP
    565 #endif
    566           ,numValidMergeCand, uiMergeIndex );
    567         pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours
    568 #if NH_3D_VSP
    569           , vspFlag
    570 #endif
    571 #if NH_3D_SPIVMP
    572           , bSPIVMPFlag
    573 #endif
    574           ,numValidMergeCand );
    575 #if NH_3D_VSP
    576         pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
    577 #endif
    578 #endif
    579       }
    580 
     474#endif
     475      }
     476#if MCTS_ENC_CHECK
     477      if (m_pConformanceCheck->getTMctsCheck() &&  pcSubCU->isLastColumnCTUInTile() && (uiMergeIndex >= numSpatialMergeCandidates) )
     478      {
     479        m_pConformanceCheck->flagTMctsError("Merge Index using non-spatial merge candidate (Merge)");
     480      }
     481
     482#endif
    581483      pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
    582484
     
    590492          pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, ePartSize, uiSubPartIdx, uiDepth, uiPartIdx );
    591493          pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], ePartSize, uiSubPartIdx, uiDepth, uiPartIdx );
    592 #if NH_3D_VSP
    593           if( pcCU->getVSPFlag( uiSubPartIdx ) != 0 )
    594           {
    595             if ( uhInterDirNeighbours[ uiMergeIndex ] & (1<<uiRefListIdx) )
    596             {
    597               UInt dummy;
    598               Int vspSize;
    599               Int width, height;
    600               pcCU->getPartIndexAndSize( uiPartIdx, dummy, width, height, uiSubPartIdx, pcCU->getTotalNumPart()==256 );
    601               pcCU->setMvFieldPUForVSP( pcCU, uiSubPartIdx, width, height, RefPicList( uiRefListIdx ), cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getRefIdx(), vspSize );
    602               pcCU->setVSPFlag( uiSubPartIdx, vspSize );
    603             }
    604           }
    605 #endif
    606         }
    607       }
    608 #if NH_3D_SPIVMP
    609       pcCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); 
    610       if (bSPIVMPFlag[uiMergeIndex] != 0)
    611       {
    612         Int iWidth, iHeight;
    613         UInt uiIdx;
    614         pcCU->getPartIndexAndSize( uiPartIdx, uiIdx, iWidth, iHeight, uiSubPartIdx, true );
    615 
    616         UInt uiSPAddr;
    617 
    618         Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;
    619 
    620         pcCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);
    621 
    622         for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++)
    623         {
    624           pcCU->getSPAbsPartIdx(uiSubPartIdx, iSPWidth, iSPHeight, iPartitionIdx, iNumSPInOneLine, uiSPAddr);
    625           pcCU->setInterDirSP(puhInterDirSP[iPartitionIdx], uiSPAddr, iSPWidth, iSPHeight);
    626           pcCU->getCUMvField( REF_PIC_LIST_0 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx], iSPWidth, iSPHeight);
    627           pcCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight);
    628         }
    629       }
    630 #endif
     494        }
     495      }
    631496    }
    632497    else
     
    652517        }
    653518      }
    654 #if NH_3D_IC
    655       decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
    656 #endif
    657519    }
    658520
     
    664526    }
    665527  }
    666 #endif
    667 #if NH_3D_SPIVMP
    668   delete[] pcMvFieldSP;
    669   delete[] puhInterDirSP;
    670528#endif
    671529  return;
     
    812670  }
    813671  pcSubCU->fillMvpCand(uiPartIdx, uiPartAddr, eRefList, iRefIdx, pAMVPInfo);
     672#if MCTS_ENC_CHECK
     673  if ((iRefIdx >= 0) && m_pConformanceCheck->getTMctsCheck() && pcSubCU->isLastColumnCTUInTile() && (iMVPIdx == pAMVPInfo->numSpatialMVPCandidates))
     674  {
     675    m_pConformanceCheck->flagTMctsError("Merge Index using non-spatial merge candidate (AMVP)");
     676  }
     677#endif
     678
    814679  pcSubCU->setMVPNumSubParts(pAMVPInfo->iN, eRefList, uiPartAddr, uiPartIdx, uiDepth);
    815680  pcSubCU->setMVPIdxSubParts( iMVPIdx, eRefList, uiPartAddr, uiPartIdx, uiDepth );
     
    1085950Void TDecEntropy::decodeCoeff( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Bool& bCodeDQP, Bool& isChromaQpAdjCoded )
    1086951{
    1087 #if NH_3D_SDC_INTRA
     952#if NH_3D
    1088953  if( pcCU->getSDCFlag( uiAbsPartIdx ) && pcCU->isIntra( uiAbsPartIdx) )
    1089954  {
     
    1092957    assert( pcCU->getCbf(uiAbsPartIdx, COMPONENT_Y) == 1 );
    1093958}
    1094 #endif
    1095 #if NH_3D_SDC_INTER
    1096959  if( pcCU->getSDCFlag( uiAbsPartIdx ) && !pcCU->isIntra( uiAbsPartIdx) )
    1097960  {
     
    1100963    assert( pcCU->getSlice()->getIsDepth() );
    1101964  }
    1102 #endif
    1103 #if NH_3D
    1104965  if( pcCU->getSlice()->getIsDepth() )
    1105966  {
    1106 #if NH_3D_SDC_INTRA || NH_3D_SDC_INTER
    1107967    if( pcCU->getSDCFlag( uiAbsPartIdx ) )
    1108968    {
     
    1110970      return;
    1111971    }
    1112 #endif
    1113 #if NH_3D_DMM
    1114972    if( pcCU->isIntra( uiAbsPartIdx ) )
    1115973    {
     
    1124982      }
    1125983    }
    1126 #endif
    1127984  }
    1128985#endif
     
    11621019}
    11631020
    1164 #if NH_3D_SDC_INTRA || NH_3D_SDC_INTER
     1021#if NH_3D
    11651022Void TDecEntropy::decodeSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    11661023{
     
    11861043  m_pcEntropyDecoderIf->parseSDCFlag( pcCU, uiAbsPartIdx, uiDepth );
    11871044}
    1188 #endif
    1189 #if NH_3D_DBBP
     1045
    11901046Void TDecEntropy::decodeDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    11911047{
  • trunk/source/Lib/TLibDecoder/TDecEntropy.h

    r1405 r1413  
    44 * granted under this license.
    55 *
    6  * Copyright (c) 2010-2016, ITU/ISO/IEC
     6 * Copyright (c) 2010-2017, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    4444#include "TLibCommon/TComSampleAdaptiveOffset.h"
    4545#include "TLibCommon/TComRectangle.h"
     46#include "TDecConformance.h"
     47
    4648class TDecSbac;
    4749class TDecCavlc;
     
    8183public:
    8284  virtual Void parseSkipFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
    83 #if NH_3D_DIS
     85#if NH_3D
    8486  virtual Void parseDIS           ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
    8587#endif
     
    8890  virtual Void parseMergeFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ) = 0;
    8991  virtual Void parseMergeIndex    ( TComDataCU* pcCU, UInt& ruiMergeIndex ) = 0;
    90 #if NH_3D_ARP
     92#if NH_3D
    9193  virtual Void parseARPW          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
    92 #endif
    93 #if NH_3D_IC
    9494  virtual Void parseICFlag        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
    95 #endif
    96 #if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER
    9795  virtual Void  parseDeltaDC      ( TComDataCU* pcCU, UInt absPartIdx, UInt depth ) = 0;
    98 #endif
    99 #if NH_3D_SDC_INTRA || NH_3D_SDC_INTER
    10096  virtual Void parseSDCFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
    101 #endif
    102 #if NH_3D_DBBP
    10397  virtual Void parseDBBPFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
    10498#endif
     
    139133  TDecEntropyIf*  m_pcEntropyDecoderIf;
    140134  TComPrediction* m_pcPrediction;
     135#if MCTS_ENC_CHECK
     136  TDecConformanceCheck* m_pConformanceCheck;
     137#endif
    141138  //UInt    m_uiBakAbsPartIdx;
    142139  //UInt    m_uiBakChromaOffset;
     
    144141
    145142public:
     143#if MCTS_ENC_CHECK
     144    Void init (TComPrediction* p, TDecConformanceCheck* pConformanceCheck) {m_pcPrediction = p; m_pConformanceCheck=pConformanceCheck;}
     145#else
    146146  Void init (TComPrediction* p) {m_pcPrediction = p;}
     147#endif
    147148  Void decodePUWise       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, TComDataCU* pcSubCU );
    148149  Void decodeInterDirPU   ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPartIdx );
     
    177178  Void decodeSplitFlag         ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    178179  Void decodeSkipFlag          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    179 #if NH_3D_DIS
     180#if NH_3D
    180181  Void decodeDIS               ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) ;
    181182#endif
     
    186187  Void decodePartSize          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    187188
    188 #if NH_3D_ARP
     189#if NH_3D
    189190  Void decodeARPW              ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    190 #endif
    191 #if NH_3D_IC
    192191  Void decodeICFlag            ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    193 #endif
    194 
    195 #if NH_3D_SDC_INTRA || NH_3D_SDC_INTER
    196192  Void decodeSDCFlag           ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    197 #endif
    198 #if NH_3D_DBBP
    199193  Void decodeDBBPFlag          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    200194#endif
  • trunk/source/Lib/TLibDecoder/TDecGop.cpp

    r1405 r1413  
    44 * granted under this license.
    55 *
    6  * Copyright (c) 2010-2016, ITU/ISO/IEC
     6 * Copyright (c) 2010-2017, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    122122  }
    123123
    124 #if NH_3D_NBDV
     124#if NH_3D
    125125  if(pcSlice->getViewIndex() && !pcSlice->getIsDepth()) //Notes from QC: this condition shall be changed once the configuration is completed, e.g. in pcSlice->getSPS()->getMultiviewMvPredMode() || ARP in prev. HTM. Remove this comment once it is done.
    126126  {
  • trunk/source/Lib/TLibDecoder/TDecGop.h

    r1405 r1413  
    44 * granted under this license.
    55 *
    6  * Copyright (c) 2010-2016, ITU/ISO/IEC
     6 * Copyright (c) 2010-2017, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
  • trunk/source/Lib/TLibDecoder/TDecSbac.cpp

    r1405 r1413  
    44 * granted under this license.
    55 *
    6  * Copyright (c) 2010-2016, ITU/ISO/IEC
     6 * Copyright (c) 2010-2017, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    6767, m_cCUSplitFlagSCModel                      ( 1,             1,                      NUM_SPLIT_FLAG_CTX                   , m_contextModels + m_numContextModels, m_numContextModels)
    6868, m_cCUSkipFlagSCModel                       ( 1,             1,                      NUM_SKIP_FLAG_CTX                    , m_contextModels + m_numContextModels, m_numContextModels)
    69 #if NH_3D_DIS
     69#if NH_3D
    7070, m_cCUDISFlagSCModel                        ( 1,             1,                      NUM_DIS_FLAG_CTX                     , m_contextModels + m_numContextModels, m_numContextModels)
    7171, m_cCUDISTypeSCModel                        ( 1,             1,                      NUM_DIS_TYPE_CTX                     , m_contextModels + m_numContextModels, m_numContextModels)
     
    7373, m_cCUMergeFlagExtSCModel                   ( 1,             1,                      NUM_MERGE_FLAG_EXT_CTX               , m_contextModels + m_numContextModels, m_numContextModels)
    7474, m_cCUMergeIdxExtSCModel                    ( 1,             1,                      NUM_MERGE_IDX_EXT_CTX                , m_contextModels + m_numContextModels, m_numContextModels)
    75 #if NH_3D_ARP
     75#if NH_3D
    7676, m_cCUPUARPWSCModel          ( 1,             1,               NUM_ARPW_CTX                  , m_contextModels + m_numContextModels, m_numContextModels)
    77 #endif
    78 #if NH_3D_IC
    7977, m_cCUICFlagSCModel          ( 1,             1,               NUM_IC_FLAG_CTX               , m_contextModels + m_numContextModels, m_numContextModels)
    8078#endif
     
    107105, m_ChromaQpAdjIdcSCModel                    ( 1,             1,                      NUM_CHROMA_QP_ADJ_IDC_CTX            , m_contextModels + m_numContextModels, m_numContextModels)
    108106
    109 #if NH_3D_DMM
     107#if NH_3D
    110108, m_cNotDmmFlagSCModel                       ( 1,             1,                      NUM_NOTDMM_FLAG_CTX                  , m_contextModels + m_numContextModels, m_numContextModels)
    111109, m_cDmmModeSCModel                          ( 1,             1,                      NUM_DMM_MODE_CTX                     , m_contextModels + m_numContextModels, m_numContextModels)
    112 #endif
    113 #if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER
    114110, m_cDdcDataSCModel                          ( 1,             1,                      NUM_DDC_DATA_CTX                     , m_contextModels + m_numContextModels, m_numContextModels)
    115111, m_cSDCFlagSCModel                          ( 1,             1,                     NUM_SDC_FLAG_CTX                      , m_contextModels + m_numContextModels, m_numContextModels)
    116 #endif
    117 #if NH_3D_SDC_INTRA
    118112, m_cSDCResidualFlagSCModel                  ( 1,             1,                     SDC_NUM_RESIDUAL_FLAG_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
    119113, m_cSDCResidualSCModel                      ( 1,             1,                     SDC_NUM_RESIDUAL_CTX                  , m_contextModels + m_numContextModels, m_numContextModels)
    120114, m_cDdcFlagSCModel                          ( 1,             1,                     NUM_DDC_FLAG_CTX                      , m_contextModels + m_numContextModels, m_numContextModels)
    121 #endif
    122 #if NH_3D_DBBP
    123115, m_cDBBPFlagSCModel                         ( 1,             1,                     DBBP_NUM_FLAG_CTX                     , m_contextModels + m_numContextModels, m_numContextModels)
    124116#endif
     
    159151  m_cCUSplitFlagSCModel.initBuffer                ( sliceType, qp, (UChar*)INIT_SPLIT_FLAG );
    160152  m_cCUSkipFlagSCModel.initBuffer                 ( sliceType, qp, (UChar*)INIT_SKIP_FLAG );
    161 #if NH_3D_DIS
     153#if NH_3D
    162154  m_cCUDISFlagSCModel.initBuffer                  ( sliceType, qp, (UChar*)INIT_DIS_FLAG );
    163155  m_cCUDISTypeSCModel.initBuffer                  ( sliceType, qp, (UChar*)INIT_DIS_TYPE );
     
    165157  m_cCUMergeFlagExtSCModel.initBuffer             ( sliceType, qp, (UChar*)INIT_MERGE_FLAG_EXT );
    166158  m_cCUMergeIdxExtSCModel.initBuffer              ( sliceType, qp, (UChar*)INIT_MERGE_IDX_EXT );
    167 #if NH_3D_ARP
     159#if NH_3D
    168160  m_cCUPUARPWSCModel.initBuffer          ( sliceType, qp, (UChar*)INIT_ARPW );
    169 #endif
    170 #if NH_3D_IC
    171161  m_cCUICFlagSCModel.initBuffer          ( sliceType, qp, (UChar*)INIT_IC_FLAG );
    172162#endif
     
    198188  m_ChromaQpAdjFlagSCModel.initBuffer             ( sliceType, qp, (UChar*)INIT_CHROMA_QP_ADJ_FLAG );
    199189  m_ChromaQpAdjIdcSCModel.initBuffer              ( sliceType, qp, (UChar*)INIT_CHROMA_QP_ADJ_IDC );
    200 #if NH_3D_DMM
     190#if NH_3D
    201191  m_cNotDmmFlagSCModel.initBuffer                 ( sliceType, qp, (UChar*)INIT_NOTDMM_FLAG );
    202192  m_cDmmModeSCModel.initBuffer                    ( sliceType, qp, (UChar*)INIT_DMM_MODE );
    203 #endif
    204 #if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER
    205193  m_cDdcDataSCModel.initBuffer                    ( sliceType, qp, (UChar*)INIT_DDC_DATA );
    206194  m_cSDCFlagSCModel.initBuffer                    ( sliceType, qp, (UChar*)INIT_SDC_FLAG );
    207 #endif
    208 #if NH_3D_SDC_INTRA
    209195  m_cSDCResidualFlagSCModel.initBuffer            ( sliceType, qp, (UChar*)INIT_SDC_RESIDUAL_FLAG );
    210196  m_cSDCResidualSCModel.initBuffer                ( sliceType, qp, (UChar*)INIT_SDC_RESIDUAL );
    211197  m_cDdcFlagSCModel.initBuffer                    ( sliceType, qp, (UChar*)INIT_DDC_FLAG );
    212 #endif
    213 #if NH_3D_DBBP
    214198  m_cDBBPFlagSCModel.initBuffer                   ( sliceType, qp, (UChar*)INIT_DBBP_FLAG );
    215199#endif
     
    512496
    513497}
    514 #if NH_3D_DIS
     498#if NH_3D
    515499Void TDecSbac::parseDIS( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    516500{
     
    642626
    643627  UInt uiSymbol;
    644 #if NH_3D_QTLPC
     628#if NH_3D
    645629  Bool bParseSplitFlag    = true;
    646630  Bool    bLimQtPredFlag = pcCU->getPic()->getSlice(0)->getQtPredFlag();
     
    651635  Bool rapPic = (pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA);
    652636
    653 #if H_3D_FCO
    654   if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && bLimQtPredFlag && pcTexture->getReconMark())
    655 #else
    656637  if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && bLimQtPredFlag)
    657 #endif
    658638  {
    659639    TComDataCU *pcTextureCU = pcTexture->getCtu(pcCU->getCtuRsAddr());
     
    672652  DTRACE_CABAC_T( "\tSplitFlag\n" )
    673653#endif
    674 #if NH_3D_QTLPC
     654#if NH_3D
    675655  }
    676656  else
     
    704684  assert ( pcCU->getSlice()->getSPS()->getLog2DiffMaxMinCodingBlockSize() == log2DiffMaxMinCodingBlockSize);
    705685
    706 #if NH_3D_QTLPC
     686#if NH_3D
    707687  Bool bParsePartSize    = true;
    708688
     
    717697  UInt uiTexturePart = uiMode;
    718698
    719 #if H_3D_FCO
    720   if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && bLimQtPredFlag && pcTexture->getReconMark())
    721 #else
    722699  if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && bLimQtPredFlag )
    723 #endif
    724700  {
    725701    TComDataCU *pcTextureCU = pcTexture->getCtu(pcCU->getCtuRsAddr());
     
    740716  if ( pcCU->isIntra( uiAbsPartIdx ) )
    741717  {
    742 #if NH_3D_QTLPC
     718#if NH_3D
    743719    if(bParsePartSize)
    744720    {
    745721#endif
    746     uiSymbol = 1;
    747     if( uiDepth == log2DiffMaxMinCodingBlockSize )
    748     {
    749       m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, 0) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(ctype) );
     722      uiSymbol = 1;
     723      if( uiDepth == log2DiffMaxMinCodingBlockSize )
     724      {
     725        m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, 0) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(ctype) );
    750726#if NH_MV_ENC_DEC_TRAC         
    751727        DTRACE_CU("part_mode", uiSymbol)
    752728#endif       
    753     }
    754     eMode = uiSymbol ? SIZE_2Nx2N : SIZE_NxN;
    755 #if NH_3D_QTLPC
     729      }
     730      eMode = uiSymbol ? SIZE_2Nx2N : SIZE_NxN;
     731#if NH_3D
    756732    }
    757733#endif
     
    771747  else
    772748  {
    773 #if NH_3D_QTLPC
     749#if NH_3D
    774750    if(bParsePartSize)
    775751    {
     
    777753      {
    778754#endif
    779     UInt uiMaxNumBits = 2;
    780 
    781     if( uiDepth == log2DiffMaxMinCodingBlockSize && !( cuWidth == 8 && cuHeight == 8 ) )
    782     {
    783       uiMaxNumBits ++;
    784     }
    785 
    786     for ( UInt ui = 0; ui < uiMaxNumBits; ui++ )
    787     {
    788       m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, ui) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(ctype) );
    789       if ( uiSymbol )
    790       {
    791         break;
    792       }
    793       uiMode++;
    794     }
    795     eMode = (PartSize) uiMode;
    796     if ( pcCU->getSlice()->getSPS()->getUseAMP() && uiDepth < log2DiffMaxMinCodingBlockSize )
    797     {
    798       if (eMode == SIZE_2NxN)
    799       {
    800         m_pcTDecBinIf->decodeBin(uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, 3 ) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(ctype));
    801         if (uiSymbol == 0)
    802         {
    803           m_pcTDecBinIf->decodeBinEP(uiSymbol RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(ctype) );
    804           eMode = (uiSymbol == 0? SIZE_2NxnU : SIZE_2NxnD);
    805         }
    806       }
    807       else if (eMode == SIZE_Nx2N)
    808       {
    809         m_pcTDecBinIf->decodeBin(uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, 3 ) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(ctype) );
    810         if (uiSymbol == 0)
    811         {
    812           m_pcTDecBinIf->decodeBinEP(uiSymbol RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(ctype) );
    813           eMode = (uiSymbol == 0? SIZE_nLx2N : SIZE_nRx2N);
    814         }
    815       }
    816     }
    817 #if NH_3D_QTLPC
    818       }
    819       else if(uiTexturePart == SIZE_2NxN || uiTexturePart == SIZE_2NxnU || uiTexturePart == SIZE_2NxnD)
    820       {
    821         UInt uiMaxNumBits = 1;
    822         if ( ( pcCU->getSlice()->getSPS()->getUseAMP() && uiDepth < log2DiffMaxMinCodingBlockSize ) && uiDepth < log2DiffMaxMinCodingBlockSize )
     755        UInt uiMaxNumBits = 2;
     756
     757        if( uiDepth == log2DiffMaxMinCodingBlockSize && !( cuWidth == 8 && cuHeight == 8 ) )
    823758        {
    824759          uiMaxNumBits ++;
    825760        }
     761
    826762        for ( UInt ui = 0; ui < uiMaxNumBits; ui++ )
    827763        {
     
    834770        }
    835771        eMode = (PartSize) uiMode;
     772        if ( pcCU->getSlice()->getSPS()->getUseAMP() && uiDepth < log2DiffMaxMinCodingBlockSize )
     773        {
     774          if (eMode == SIZE_2NxN)
     775          {
     776            m_pcTDecBinIf->decodeBin(uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, 3 ) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(ctype));
     777            if (uiSymbol == 0)
     778            {
     779              m_pcTDecBinIf->decodeBinEP(uiSymbol RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(ctype) );
     780              eMode = (uiSymbol == 0? SIZE_2NxnU : SIZE_2NxnD);
     781            }
     782          }
     783          else if (eMode == SIZE_Nx2N)
     784          {
     785            m_pcTDecBinIf->decodeBin(uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, 3 ) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(ctype) );
     786            if (uiSymbol == 0)
     787            {
     788              m_pcTDecBinIf->decodeBinEP(uiSymbol RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(ctype) );
     789              eMode = (uiSymbol == 0? SIZE_nLx2N : SIZE_nRx2N);
     790            }
     791          }
     792        }
     793#if NH_3D
     794      }
     795      else if(uiTexturePart == SIZE_2NxN || uiTexturePart == SIZE_2NxnU || uiTexturePart == SIZE_2NxnD)
     796      {
     797        UInt uiMaxNumBits = 1;
     798        if ( ( pcCU->getSlice()->getSPS()->getUseAMP() && uiDepth < log2DiffMaxMinCodingBlockSize ) && uiDepth < log2DiffMaxMinCodingBlockSize )
     799        {
     800          uiMaxNumBits ++;
     801        }
     802        for ( UInt ui = 0; ui < uiMaxNumBits; ui++ )
     803        {
     804          m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, ui) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(ctype) );
     805          if ( uiSymbol )
     806          {
     807            break;
     808          }
     809          uiMode++;
     810        }
     811        eMode = (PartSize) uiMode;
    836812        if(uiMode && ( ( pcCU->getSlice()->getSPS()->getUseAMP() && uiDepth < log2DiffMaxMinCodingBlockSize ) && uiDepth < log2DiffMaxMinCodingBlockSize ) && uiSymbol==1 )
    837813        {
     
    887863      DTRACE_CU("part_mode", eMode )
    888864#endif
    889 #if NH_3D_QTLPC
     865#if NH_3D
    890866    }
    891867#endif
     
    937913  for (j=0;j<partNum;j++)
    938914  {
    939 #if NH_3D_DMM
     915#if NH_3D
    940916    if( pcCU->getSlice()->getIntraSdcWedgeFlag() || pcCU->getSlice()->getIntraContourFlag() )
    941917    {
     
    946922    {
    947923#endif
    948     m_pcTDecBinIf->decodeBin( symbol, m_cCUIntraPredSCModel.get( 0, 0, 0) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(ctype) );
    949     mpmPred[j] = symbol;
     924      m_pcTDecBinIf->decodeBin( symbol, m_cCUIntraPredSCModel.get( 0, 0, 0) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(ctype) );
     925      mpmPred[j] = symbol;
    950926#if NH_MV_ENC_DEC_TRAC         
    951927      DTRACE_CU("prev_intra_luma_pred_flag", symbol)
    952928#endif
    953 #if NH_3D_DMM
     929#if NH_3D
    954930    }
    955931#endif
     
    957933  for (j=0;j<partNum;j++)
    958934  {
    959 #if NH_3D_DMM
     935#if NH_3D
    960936    if( pcCU->getIntraDir( CHANNEL_TYPE_LUMA, absPartIdx+partOffset*j ) < NUM_INTRA_MODE )
    961937    {
    962938#endif
    963     Int preds[NUM_MOST_PROBABLE_MODES] = {-1, -1, -1};
    964     pcCU->getIntraDirPredictor(absPartIdx+partOffset*j, preds, COMPONENT_Y);
    965     if (mpmPred[j])
    966     {
    967       m_pcTDecBinIf->decodeBinEP( symbol RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(ctype) );
    968       if (symbol)
     939      Int preds[NUM_MOST_PROBABLE_MODES] = {-1, -1, -1};
     940      pcCU->getIntraDirPredictor(absPartIdx+partOffset*j, preds, COMPONENT_Y);
     941      if (mpmPred[j])
    969942      {
    970943        m_pcTDecBinIf->decodeBinEP( symbol RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(ctype) );
    971         symbol++;
    972       }
     944        if (symbol)
     945        {
     946          m_pcTDecBinIf->decodeBinEP( symbol RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(ctype) );
     947          symbol++;
     948        }
    973949#if NH_MV_ENC_DEC_TRAC         
    974950        DTRACE_CU("mpm_idx", symbol)
    975951#endif
    976       intraPredMode = preds[symbol];
    977     }
    978     else
    979     {
    980       m_pcTDecBinIf->decodeBinsEP( symbol, 5 RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(ctype) );
    981       intraPredMode = symbol;
     952          intraPredMode = preds[symbol];
     953      }
     954      else
     955      {
     956        m_pcTDecBinIf->decodeBinsEP( symbol, 5 RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(ctype) );
     957        intraPredMode = symbol;
    982958#if NH_MV_ENC_DEC_TRAC         
    983959        DTRACE_CU("rem_intra_luma_pred_mode", symbol)
    984960#endif       
    985961
    986       //postponed sorting of MPMs (only in remaining branch)
    987       if (preds[0] > preds[1])
    988       {
    989         std::swap(preds[0], preds[1]);
    990       }
    991       if (preds[0] > preds[2])
    992       {
    993         std::swap(preds[0], preds[2]);
    994       }
    995       if (preds[1] > preds[2])
    996       {
    997         std::swap(preds[1], preds[2]);
    998       }
    999       for ( UInt i = 0; i < NUM_MOST_PROBABLE_MODES; i++ )
    1000       {
    1001         intraPredMode += ( intraPredMode >= preds[i] );
    1002       }
    1003     }
    1004     pcCU->setIntraDirSubParts(CHANNEL_TYPE_LUMA, (UChar)intraPredMode, absPartIdx+partOffset*j, depth );
    1005 #if NH_3D_DMM
     962          //postponed sorting of MPMs (only in remaining branch)
     963          if (preds[0] > preds[1])
     964          {
     965            std::swap(preds[0], preds[1]);
     966          }
     967          if (preds[0] > preds[2])
     968          {
     969            std::swap(preds[0], preds[2]);
     970          }
     971          if (preds[1] > preds[2])
     972          {
     973            std::swap(preds[1], preds[2]);
     974          }
     975          for ( UInt i = 0; i < NUM_MOST_PROBABLE_MODES; i++ )
     976          {
     977            intraPredMode += ( intraPredMode >= preds[i] );
     978          }
     979      }
     980      pcCU->setIntraDirSubParts(CHANNEL_TYPE_LUMA, (UChar)intraPredMode, absPartIdx+partOffset*j, depth );
     981#if NH_3D
    1006982    }
    1007983#endif
     
    16791655  else
    16801656  {
    1681     beValid = pcCU->getSlice()->getPPS()->getSignHideFlag();
     1657    beValid = pcCU->getSlice()->getPPS()->getSignDataHidingEnabledFlag();
    16821658  }
    16831659
     
    22692245}
    22702246
    2271 #if NH_3D_ARP
     2247#if NH_3D
    22722248Void TDecSbac::parseARPW( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    22732249{
     
    22892265  pcCU->setARPWSubParts( ( UChar )( uiW ) , uiAbsPartIdx, uiDepth ); 
    22902266}
    2291 #endif
    2292 
    2293 #if NH_3D_IC
     2267
    22942268/** parse illumination compensation flag
    22952269 * \param pcCU
     
    23172291  pcCU->setICFlagSubParts( uiSymbol ? true : false , uiAbsPartIdx, 0, uiDepth );
    23182292}
    2319 #endif
    2320 
    2321 #if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER
     2293
    23222294Void TDecSbac::parseDeltaDC( TComDataCU* pcCU, UInt absPartIdx, UInt depth )
    23232295{
    2324 #if NH_3D_SDC_INTRA || NH_3D_SDC_INTER
    23252296  if( !(pcCU->getSDCFlag( absPartIdx )) )
    2326 #endif
    2327 #if NH_3D_DMM
    2328   if( !(pcCU->isIntra( absPartIdx ) && isDmmMode( pcCU->getIntraDir( CHANNEL_TYPE_LUMA, absPartIdx ) )) )
    2329 #endif
    2330     assert( 0 );
     2297    if( !(pcCU->isIntra( absPartIdx ) && isDmmMode( pcCU->getIntraDir( CHANNEL_TYPE_LUMA, absPartIdx ) )) )
     2298      assert( 0 );
    23312299
    23322300  UInt symbol = 1;
    2333 #if NH_3D_SDC_INTRA
    23342301  if( pcCU->isIntra( absPartIdx ) && pcCU->getSDCFlag( absPartIdx ))
    23352302  {
     
    23382305    assert( pcCU->getTransformIdx(absPartIdx) == 0 );
    23392306    assert( pcCU->getCbf(absPartIdx, COMPONENT_Y) == 1 );
    2340     }
    2341 #endif
    2342   UInt uiNumSegments = 1;
    2343 #if NH_3D_DMM
    2344   uiNumSegments = isDmmMode( pcCU->getIntraDir( CHANNEL_TYPE_LUMA, absPartIdx ) ) ? 2 : 1;
    2345 #endif
     2307  }
     2308  UInt uiNumSegments = isDmmMode( pcCU->getIntraDir( CHANNEL_TYPE_LUMA, absPartIdx ) ) ? 2 : 1;
    23462309
    23472310  for( UInt segment = 0; segment < uiNumSegments; segment++ )
     
    23552318    if( pcCU->isIntra( absPartIdx ) )
    23562319    {
    2357 #if NH_3D_SDC_INTRA
    23582320      if( pcCU->getSDCFlag( absPartIdx ) )
    23592321      {
     
    23622324      else
    23632325      {
    2364 #endif
    2365 #if NH_3D_DMM
    23662326        pcCU->setDmmDeltaDC( getDmmType( pcCU->getIntraDir( CHANNEL_TYPE_LUMA, absPartIdx ) ), segment, absPartIdx, valDeltaDC );
    2367 #endif
    2368 #if NH_3D_SDC_INTRA
    2369       }
    2370 #endif
    2371     }
    2372 #if NH_3D_SDC_INTER
     2327      }
     2328    }
    23732329    else
    23742330    {
    23752331      pcCU->setSDCSegmentDCOffset( valDeltaDC, segment, absPartIdx );
    23762332    }
    2377 #endif
    23782333  }
    23792334}
     
    24192374  return;
    24202375}
    2421 #endif
    2422 #if NH_3D_DMM
     2376
    24232377Void TDecSbac::xParseIntraDepthMode( TComDataCU* pcCU, UInt absPartIdx, UInt depth )
    24242378{
     
    24882442  ruiTabIdx = uiIdx;
    24892443}
    2490 #endif
    2491 #if NH_3D_SDC_INTRA || NH_3D_SDC_INTER
     2444
    24922445Void TDecSbac::parseSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    24932446{
     
    25102463}
    25112464
    2512 #endif
    2513 
    2514 #if NH_3D_DBBP
    25152465Void TDecSbac::parseDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    25162466{
  • trunk/source/Lib/TLibDecoder/TDecSbac.h

    r1405 r1413  
    44 * granted under this license.
    55 *
    6  * Copyright (c) 2010-2016, ITU/ISO/IEC
     6 * Copyright (c) 2010-2017, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    108108  Void  xReadCoefRemainExGolomb ( UInt &rSymbol, UInt &rParam, const Bool useLimitedPrefixLength, const Int maxLog2TrDynamicRange );
    109109#endif
    110 #if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER
     110#if NH_3D
    111111  Void  xReadExGolombLevelDdc( UInt& ruiSymbol );
    112112  Void  xParseDeltaDC        ( Pel& rValDeltaDC, UInt uiNumSeg );
    113 #endif
    114 #if NH_3D_DMM
    115113  Void  xParseIntraDepthMode ( TComDataCU* pcCU, UInt absPartIdx, UInt depth );
    116114  Void  xParseDmmData        ( TComDataCU* pcCU, UInt absPartIdx, UInt depth );
    117115  Void  xParseDmm1WedgeIdx   ( UInt& ruiTabIdx, Int iNumBit );
    118 #endif
    119 #if NH_3D_SDC_INTRA
    120116  Void  xParseSDCResidualData     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart );
    121 #endif
    122 #if NH_3D_SDC_INTRA || NH_3D_SDC_INTER
    123117  Void  parseSDCFlag         ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    124 #endif
    125 #if NH_3D_DBBP
    126   Void parseDBBPFlag        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
     118  Void  parseDBBPFlag        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    127119#endif
    128120
     
    134126
    135127  Void parseSkipFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    136 #if NH_3D_DIS
     128#if NH_3D
    137129  Void parseDIS          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    138 #endif
    139 #if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER
    140130  Void  parseDeltaDC      ( TComDataCU* pcCU, UInt absPartIdx, UInt depth );
    141131#endif
     
    144134  Void parseMergeFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx );
    145135  Void parseMergeIndex    ( TComDataCU* pcCU, UInt& ruiMergeIndex );
    146 #if NH_3D_ARP
     136#if NH_3D
    147137  Void parseARPW          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    148 #endif
    149 #if NH_3D_IC
    150138  Void parseICFlag        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    151139#endif
     
    183171  ContextModel3DBuffer m_cCUSplitFlagSCModel;
    184172  ContextModel3DBuffer m_cCUSkipFlagSCModel;
    185 #if NH_3D_DIS
     173#if NH_3D
    186174  ContextModel3DBuffer m_cCUDISFlagSCModel;
    187175  ContextModel3DBuffer m_cCUDISTypeSCModel;
     
    189177  ContextModel3DBuffer m_cCUMergeFlagExtSCModel;
    190178  ContextModel3DBuffer m_cCUMergeIdxExtSCModel;
    191 #if NH_3D_ARP
     179#if NH_3D
    192180  ContextModel3DBuffer m_cCUPUARPWSCModel;
    193 #endif
    194 #if NH_3D_IC
    195181  ContextModel3DBuffer m_cCUICFlagSCModel;
    196182#endif
     
    226212  ContextModel3DBuffer m_ChromaQpAdjFlagSCModel;
    227213  ContextModel3DBuffer m_ChromaQpAdjIdcSCModel;
    228 #if NH_3D_DMM
     214#if NH_3D
    229215  ContextModel3DBuffer m_cNotDmmFlagSCModel;
    230216  ContextModel3DBuffer m_cDmmModeSCModel;
    231 #endif
    232 #if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER
    233217  ContextModel3DBuffer m_cDdcDataSCModel;
    234218  ContextModel3DBuffer m_cSDCFlagSCModel;
    235 #endif
    236 #if NH_3D_SDC_INTRA 
    237219  ContextModel3DBuffer m_cSDCResidualFlagSCModel;
    238220  ContextModel3DBuffer m_cSDCResidualSCModel;
    239221  ContextModel3DBuffer m_cDdcFlagSCModel;
    240 #endif
    241 #if NH_3D_DBBP
    242222  ContextModel3DBuffer m_cDBBPFlagSCModel;
    243223#endif
  • trunk/source/Lib/TLibDecoder/TDecSlice.cpp

    r1405 r1413  
    44 * granted under this license.
    55 *
    6  * Copyright (c) 2010-2016, ITU/ISO/IEC
     6 * Copyright (c) 2010-2017, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    3737
    3838#include "TDecSlice.h"
     39#include "TDecConformance.h"
    3940
    4041//! \ingroup TLibDecoder
     
    6162}
    6263
    63 Void TDecSlice::init(TDecEntropy* pcEntropyDecoder, TDecCu* pcCuDecoder)
     64Void TDecSlice::init(TDecEntropy* pcEntropyDecoder, TDecCu* pcCuDecoder, TDecConformanceCheck *pDecConformanceCheck)
    6465{
    6566  m_pcEntropyDecoder  = pcEntropyDecoder;
    6667  m_pcCuDecoder       = pcCuDecoder;
     68  m_pDecConformanceCheck = pDecConformanceCheck;
    6769}
    6870
     
    130132    }
    131133  }
    132 #if  NH_3D_DLT
     134#if  NH_3D
    133135  if( pcSlice->getPPS()->getDLT() != NULL )
    134136  {
     
    186188#endif
    187189
     190#if DECODER_PARTIAL_CONFORMANCE_CHECK != 0
     191    const UInt numRemainingBitsPriorToCtu=ppcSubstreams[uiSubStrm]->getNumBitsLeft();
     192#endif
     193
    188194    if ( pcSlice->getSPS()->getUseSAO() )
    189195    {
     
    224230
    225231    m_pcCuDecoder->decodeCtu     ( pCtu, isLastCtuOfSliceSegment );
     232
     233#if DECODER_PARTIAL_CONFORMANCE_CHECK != 0
     234    const UInt numRemainingBitsPostCtu=ppcSubstreams[uiSubStrm]->getNumBitsLeft(); // NOTE: Does not account for changes in buffered bits in CABAC decoder, although it's probably good enough.
     235    if (TDecConformanceCheck::doChecking() && m_pDecConformanceCheck)
     236    {
     237      m_pDecConformanceCheck->checkCtuDecoding(numRemainingBitsPriorToCtu-numRemainingBitsPostCtu);
     238    }
     239#endif
     240
    226241    m_pcCuDecoder->decompressCtu ( pCtu );
    227242
  • trunk/source/Lib/TLibDecoder/TDecSlice.h

    r1405 r1413  
    44 * granted under this license.
    55 *
    6  * Copyright (c) 2010-2016, ITU/ISO/IEC
     6 * Copyright (c) 2010-2017, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    5858// ====================================================================================================================
    5959
     60class TDecConformanceCheck;
     61
    6062/// slice decoder class
    6163class TDecSlice
     
    6567  TDecEntropy*    m_pcEntropyDecoder;
    6668  TDecCu*         m_pcCuDecoder;
     69  TDecConformanceCheck *m_pDecConformanceCheck;
    6770
    6871  TDecSbac        m_lastSliceSegmentEndContextState;    ///< context storage for state at the end of the previous slice-segment (used for dependent slices only).
     
    7376  virtual ~TDecSlice();
    7477
    75   Void  init              ( TDecEntropy* pcEntropyDecoder, TDecCu* pcMbDecoder );
     78  Void  init              ( TDecEntropy* pcEntropyDecoder, TDecCu* pcMbDecoder, TDecConformanceCheck *pDecConformanceCheck );
    7679  Void  create            ();
    7780  Void  destroy           ();
  • trunk/source/Lib/TLibDecoder/TDecTop.cpp

    r1405 r1413  
    44 * granted under this license.
    55 *
    6  * Copyright (c) 2010-2016, ITU/ISO/IEC
     6 * Copyright (c) 2010-2017, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    3737#include "NALread.h"
    3838#include "TDecTop.h"
     39#include "TDecConformance.h"
     40
    3941#if NH_MV
    4042ParameterSetManager TDecTop::m_parameterSetManager;
     
    227229  }
    228230
    229 #if !H_3D_FCO
    230231  if ( pcSlice->getIsDepth())
    231232  {
    232233    return;
    233234  }
    234 #endif
    235235
    236236  Int curPoc = pcSlice->getPOC();
     
    376376  , m_warningMessageSkipPicture(false)
    377377#endif
     378#if MCTS_ENC_CHECK
     379  , m_tmctsCheckEnabled(false)
     380#endif
    378381  , m_prefixSEINALUs()
    379382{
     
    471474#endif
    472475  m_cGopDecoder.init( &m_cEntropyDecoder, &m_cSbacDecoder, &m_cBinCABAC, &m_cCavlcDecoder, &m_cSliceDecoder, &m_cLoopFilter, &m_cSAO);
    473   m_cSliceDecoder.init( &m_cEntropyDecoder, &m_cCuDecoder );
     476  m_cSliceDecoder.init( &m_cEntropyDecoder, &m_cCuDecoder, &m_conformanceCheck );
     477#if MCTS_ENC_CHECK
     478  m_cEntropyDecoder.init(&m_cPrediction, &m_conformanceCheck );
     479#else
    474480  m_cEntropyDecoder.init(&m_cPrediction);
     481#endif
    475482}
    476483
     
    506513    rpcPic = new TComPic();
    507514
     515#if REDUCED_ENCODER_MEMORY
     516    rpcPic->create ( sps, pps, false, true);
     517#else
    508518    rpcPic->create ( sps, pps, true);
     519#endif
    509520
    510521    m_cListPic.pushBack( rpcPic );
     
    543554  }
    544555  rpcPic->destroy();
     556#if REDUCED_ENCODER_MEMORY
     557  rpcPic->create ( sps, pps, false, true);
     558#else
    545559  rpcPic->create ( sps, pps, true);
     560#endif
    546561}
    547562
     
    692707
    693708    xParsePrefixSEImessages();
     709#if MCTS_ENC_CHECK
     710    xAnalysePrefixSEImessages();
     711#endif
    694712
    695713#if RExt__HIGH_BIT_DEPTH_SUPPORT==0
     
    726744    sps=pSlice->getSPS();
    727745
    728 #if NH_MV
     746#if NH_MV   
    729747    pSlice->setPic( m_pcPic );
    730748    vps=pSlice->getVPS();
     
    772790    // Recursive structure
    773791    m_cCuDecoder.create ( sps->getMaxTotalCUDepth(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getChromaFormatIdc() );
     792#if MCTS_ENC_CHECK
     793    m_cCuDecoder.init   ( &m_cEntropyDecoder, &m_cTrQuant, &m_cPrediction, &m_conformanceCheck );
     794#else
    774795    m_cCuDecoder.init   ( &m_cEntropyDecoder, &m_cTrQuant, &m_cPrediction );
     796#endif
    775797    m_cTrQuant.init     ( sps->getMaxTrSize() );
    776798
     
    807829    xParsePrefixSEImessages();
    808830
     831#if MCTS_ENC_CHECK
     832    xAnalysePrefixSEImessages();
     833#endif
    809834    // Check if any new SEI has arrived
    810835    if(!m_SEIs.empty())
     
    845870  }
    846871}
     872
     873#if MCTS_ENC_CHECK
     874Void TDecTop::xAnalysePrefixSEImessages()
     875{
     876  if (m_tmctsCheckEnabled)
     877  {
     878    SEIMessages mctsSEIs = getSeisByType(m_SEIs, SEI::TEMP_MOTION_CONSTRAINED_TILE_SETS);
     879    for (SEIMessages::iterator it = mctsSEIs.begin(); it != mctsSEIs.end(); it++)
     880    {
     881      SEITempMotionConstrainedTileSets *mcts = (SEITempMotionConstrainedTileSets*)(*it);
     882      if (!mcts->m_each_tile_one_tile_set_flag)
     883      {
     884        printf("cannot (yet) check Temporal constrained MCTS if each_tile_one_tile_set_flag is not enabled\n");
     885        exit(1);
     886      }
     887      else
     888      {
     889        printf("MCTS check enabled!\n");
     890        m_conformanceCheck.enableTMctsCheck(true);
     891      }
     892    }
     893  }
     894}
     895#endif
     896
    847897
    848898#if !NH_MV
     
    10231073  xActivateParameterSets();
    10241074
     1075
     1076
     1077  TComSlice* pcSlice = m_pcPic->getPicSym()->getSlice(m_uiSliceIdx);
     1078
     1079  if (TDecConformanceCheck::doChecking())
     1080  {
     1081    m_conformanceCheck.checkSliceActivation(*pcSlice, nalu, *m_pcPic, m_bFirstSliceInBitstream, m_bFirstSliceInSequence, m_bFirstSliceInPicture);
     1082  }
     1083
    10251084  m_bFirstSliceInSequence = false;
    10261085  m_bFirstSliceInBitstream  = false;
    1027 
    1028 
    1029   TComSlice* pcSlice = m_pcPic->getPicSym()->getSlice(m_uiSliceIdx);
    10301086
    10311087#endif
     
    11051161        }
    11061162      }
    1107 #if NH_3D_NBDV
     1163#if NH_3D
    11081164      pcSlice->setDefaultRefView();
    1109 #endif
    1110 #if NH_3D_ARP
    11111165      pcSlice->setPocsInCurrRPSs();
    11121166      pcSlice->setARPStepNum(m_dpb);
     
    11551209      //---------------
    11561210      pcSlice->setRefPOCList();
    1157 #if  NH_3D_TMVP
     1211#if  NH_3D
    11581212      if(pcSlice->getLayerId())
    11591213      {
     
    12531307  pps->setLayerId( getLayerId() );
    12541308#endif
    1255 #if NH_3D_DLT
     1309#if NH_3D
    12561310  // create mapping from depth layer indexes to layer ids
    12571311  Int j=0;
     
    18631917    {
    18641918      Int profileIdc = vps->getPTL( vps->getProfileTierLevelIdx( m_targetOlsIdx, lIdx ) )->getGeneralPTL()->getProfileIdc();
    1865       assert( profileIdc == 1 || profileIdc == 6 || profileIdc == 8 );
    1866 
    1867       if (  profileIdc == 6 )
     1919
     1920#if !NH_MV_ALLOW_NON_CONFORMING
     1921      assert( profileIdc == Profile::MAIN || profileIdc == Profile::MULTIVIEWMAIN|| profileIdc == Profile::MAIN3D );
     1922#else
     1923      assert( profileIdc == Profile::MAIN || profileIdc == Profile::MAIN10 || profileIdc == Profile::MULTIVIEWMAIN|| profileIdc == Profile::MAIN3D || profileIdc == Profile::NONE || profileIdc == Profile::MULTIVIEWMAIN_NONCONFORMING || profileIdc == Profile::MAIN3D_NONCONFORMING  );
     1924#endif
     1925
     1926      if (   profileIdc == Profile::MULTIVIEWMAIN
     1927#if NH_MV_ALLOW_NON_CONFORMING
     1928      ||     profileIdc == Profile::MULTIVIEWMAIN_NONCONFORMING
     1929#endif
     1930        )
    18681931      {
    18691932        m_decodingProcess = ANNEX_G;
     
    18731936        m_decodingProcess = ANNEX_H;
    18741937      }
    1875       else if (profileIdc == 8 )
     1938      else if (profileIdc == Profile::MAIN3D
     1939#if NH_MV_ALLOW_NON_CONFORMING
     1940      ||     profileIdc == Profile::MAIN3D_NONCONFORMING
     1941#endif 
     1942        )
    18761943      {
    18771944        m_decodingProcess = ANNEX_I;
  • trunk/source/Lib/TLibDecoder/TDecTop.h

    r1405 r1413  
    44 * granted under this license.
    55 *
    6  * Copyright (c) 2010-2016, ITU/ISO/IEC
     6 * Copyright (c) 2010-2017, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    5252#include "TDecCAVLC.h"
    5353#include "SEIread.h"
     54#include "TDecConformance.h"
    5455
    5556class InputNALUnit;
     
    204205  TComLoopFilter          m_cLoopFilter;
    205206  TComSampleAdaptiveOffset m_cSAO;
     207  TDecConformanceCheck    m_conformanceCheck;
    206208
    207209  Bool isSkipPictureForBLA(Int& iPOCLastDisplay);
     
    236238#endif
    237239
     240#if MCTS_ENC_CHECK
     241  Bool                    m_tmctsCheckEnabled;
     242
     243#endif
     244
    238245#if NH_MV
    239246  // Class interface
     
    286293
    287294  Void setDecodedPictureHashSEIEnabled(Int enabled) { m_cGopDecoder.setDecodedPictureHashSEIEnabled(enabled); }
    288 
     295#if MCTS_ENC_CHECK
     296  Void setTMctsCheckEnabled(Bool enabled) { m_tmctsCheckEnabled = enabled; }
     297#endif
    289298  Void  init();
    290299#if !NH_MV
     
    405414
    406415  Void      xParsePrefixSEImessages();
     416#if MCTS_ENC_CHECK
     417  Void      xAnalysePrefixSEImessages();
     418#endif
    407419  Void      xParsePrefixSEIsForUnknownVCLNal();
    408420
Note: See TracChangeset for help on using the changeset viewer.