source: 3DVCSoftware/branches/HTM-15.1-dev0-Nokia/source/Lib/TLibCommon/SEI.cpp @ 1339

Last change on this file since 1339 was 1339, checked in by chen, 9 years ago

Commit the integration of 3D depth representation information SEI on behalf of Nokia.

by Yi-Wen Chen (yiwen.chen@…)

File size: 91.9 KB
Line 
1/* The copyright in this software is being made available under the BSD
2 * License, included below. This software may be subject to other third party
3 * and contributor rights, including patent rights, and no such rights are
4 * granted under this license.
5 *
6 * Copyright (c) 2010-2015, ITU/ISO/IEC
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are met:
11 *
12 *  * Redistributions of source code must retain the above copyright notice,
13 *    this list of conditions and the following disclaimer.
14 *  * Redistributions in binary form must reproduce the above copyright notice,
15 *    this list of conditions and the following disclaimer in the documentation
16 *    and/or other materials provided with the distribution.
17 *  * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
18 *    be used to endorse or promote products derived from this software without
19 *    specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
31 * THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34/** \file     #SEI.cpp
35    \brief    helper functions for SEI handling
36*/
37
38#include "CommonDef.h"
39#include "SEI.h"
40#if NH_MV_SEI
41#include "TComSlice.h"
42#endif
43
44SEIMessages getSeisByType(SEIMessages &seiList, SEI::PayloadType seiType)
45{
46  SEIMessages result;
47
48  for (SEIMessages::iterator it=seiList.begin(); it!=seiList.end(); it++)
49  {
50    if ((*it)->payloadType() == seiType)
51    {
52      result.push_back(*it);
53    }
54  }
55  return result;
56}
57
58SEIMessages extractSeisByType(SEIMessages &seiList, SEI::PayloadType seiType)
59{
60  SEIMessages result;
61
62  SEIMessages::iterator it=seiList.begin();
63  while ( it!=seiList.end() )
64  {
65    if ((*it)->payloadType() == seiType)
66    {
67      result.push_back(*it);
68      it = seiList.erase(it);
69    }
70    else
71    {
72      it++;
73    }
74  }
75  return result;
76}
77
78
79Void deleteSEIs (SEIMessages &seiList)
80{
81  for (SEIMessages::iterator it=seiList.begin(); it!=seiList.end(); it++)
82  {
83    delete (*it);
84  }
85  seiList.clear();
86}
87
88void SEIBufferingPeriod::copyTo (SEIBufferingPeriod& target)
89{
90  target.m_bpSeqParameterSetId = m_bpSeqParameterSetId;
91  target.m_rapCpbParamsPresentFlag = m_rapCpbParamsPresentFlag;
92  target.m_cpbDelayOffset = m_cpbDelayOffset;
93  target.m_dpbDelayOffset = m_dpbDelayOffset;
94  target.m_concatenationFlag = m_concatenationFlag;
95  target.m_auCpbRemovalDelayDelta = m_auCpbRemovalDelayDelta;
96  ::memcpy(target.m_initialCpbRemovalDelay, m_initialCpbRemovalDelay, sizeof(m_initialCpbRemovalDelay));
97  ::memcpy(target.m_initialCpbRemovalDelayOffset, m_initialCpbRemovalDelayOffset, sizeof(m_initialCpbRemovalDelayOffset));
98  ::memcpy(target.m_initialAltCpbRemovalDelay, m_initialAltCpbRemovalDelay, sizeof(m_initialAltCpbRemovalDelay));
99  ::memcpy(target.m_initialAltCpbRemovalDelayOffset, m_initialAltCpbRemovalDelayOffset, sizeof(m_initialAltCpbRemovalDelayOffset));
100}
101
102void SEIPictureTiming::copyTo (SEIPictureTiming& target)
103{
104  target.m_picStruct = m_picStruct;
105  target.m_sourceScanType = m_sourceScanType;
106  target.m_duplicateFlag = m_duplicateFlag;
107
108  target.m_auCpbRemovalDelay = m_auCpbRemovalDelay;
109  target.m_picDpbOutputDelay = m_picDpbOutputDelay;
110  target.m_picDpbOutputDuDelay = m_picDpbOutputDuDelay;
111  target.m_numDecodingUnitsMinus1 = m_numDecodingUnitsMinus1;
112  target.m_duCommonCpbRemovalDelayFlag = m_duCommonCpbRemovalDelayFlag;
113  target.m_duCommonCpbRemovalDelayMinus1 = m_duCommonCpbRemovalDelayMinus1;
114
115  target.m_numNalusInDuMinus1 = m_numNalusInDuMinus1;
116  target.m_duCpbRemovalDelayMinus1 = m_duCpbRemovalDelayMinus1;
117}
118
119// Static member
120const Char *SEI::getSEIMessageString(SEI::PayloadType payloadType)
121{
122  switch (payloadType)
123  {
124    case SEI::BUFFERING_PERIOD:                     return "Buffering period";
125    case SEI::PICTURE_TIMING:                       return "Picture timing";
126    case SEI::PAN_SCAN_RECT:                        return "Pan-scan rectangle";                   // not currently decoded
127    case SEI::FILLER_PAYLOAD:                       return "Filler payload";                       // not currently decoded
128    case SEI::USER_DATA_REGISTERED_ITU_T_T35:       return "User data registered";                 // not currently decoded
129    case SEI::USER_DATA_UNREGISTERED:               return "User data unregistered";
130    case SEI::RECOVERY_POINT:                       return "Recovery point";
131    case SEI::SCENE_INFO:                           return "Scene information";                    // not currently decoded
132    case SEI::FULL_FRAME_SNAPSHOT:                  return "Picture snapshot";                     // not currently decoded
133    case SEI::PROGRESSIVE_REFINEMENT_SEGMENT_START: return "Progressive refinement segment start"; // not currently decoded
134    case SEI::PROGRESSIVE_REFINEMENT_SEGMENT_END:   return "Progressive refinement segment end";   // not currently decoded
135    case SEI::FILM_GRAIN_CHARACTERISTICS:           return "Film grain characteristics";           // not currently decoded
136    case SEI::POST_FILTER_HINT:                     return "Post filter hint";                     // not currently decoded
137    case SEI::TONE_MAPPING_INFO:                    return "Tone mapping information";
138    case SEI::KNEE_FUNCTION_INFO:                   return "Knee function information";
139    case SEI::FRAME_PACKING:                        return "Frame packing arrangement";
140    case SEI::DISPLAY_ORIENTATION:                  return "Display orientation";
141    case SEI::SOP_DESCRIPTION:                      return "Structure of pictures information";
142    case SEI::ACTIVE_PARAMETER_SETS:                return "Active parameter sets";
143    case SEI::DECODING_UNIT_INFO:                   return "Decoding unit information";
144    case SEI::TEMPORAL_LEVEL0_INDEX:                return "Temporal sub-layer zero index";
145    case SEI::DECODED_PICTURE_HASH:                 return "Decoded picture hash";
146    case SEI::SCALABLE_NESTING:                     return "Scalable nesting";
147    case SEI::REGION_REFRESH_INFO:                  return "Region refresh information";
148    case SEI::NO_DISPLAY:                           return "No display";
149    case SEI::TIME_CODE:                            return "Time code";
150    case SEI::MASTERING_DISPLAY_COLOUR_VOLUME:      return "Mastering display colour volume";
151    case SEI::SEGM_RECT_FRAME_PACKING:              return "Segmented rectangular frame packing arrangement";
152    case SEI::TEMP_MOTION_CONSTRAINED_TILE_SETS:    return "Temporal motion constrained tile sets";
153    case SEI::CHROMA_SAMPLING_FILTER_HINT:          return "Chroma sampling filter hint";
154#if NH_MV
155    case SEI::COLOUR_REMAPPING_INFO:                     return "Colour remapping information";
156    case SEI::DEINTERLACED_FIELD_IDENTIFICATION:         return "Deinterlaced field identification";
157    case SEI::LAYERS_NOT_PRESENT:                        return "Layers not present";
158    case SEI::INTER_LAYER_CONSTRAINED_TILE_SETS:         return "Inter-layer constrained tile sets";
159    case SEI::BSP_NESTING:                               return "Bitstream partition nesting";
160    case SEI::BSP_INITIAL_ARRIVAL_TIME:                  return "Bitstream partition initial arrival time";
161    case SEI::SUB_BITSTREAM_PROPERTY:                    return "Sub-bitstream property";
162    case SEI::ALPHA_CHANNEL_INFO:                        return "Alpha channel information";
163    case SEI::OVERLAY_INFO:                              return "Overlay information"  ;
164    case SEI::TEMPORAL_MV_PREDICTION_CONSTRAINTS:        return "Temporal motion vector prediction constraints";
165    case SEI::FRAME_FIELD_INFO:                          return "Frame-field information";
166    case SEI::THREE_DIMENSIONAL_REFERENCE_DISPLAYS_INFO: return "3D reference displays information";
167    case SEI::DEPTH_REPRESENTATION_INFO:                 return "Depth representation information";
168    case SEI::MULTIVIEW_SCENE_INFO:                      return "Multiview scene information";
169    case SEI::MULTIVIEW_ACQUISITION_INFO:                return "Multiview acquisition information";
170    case SEI::MULTIVIEW_VIEW_POSITION:                   return "Multiview view position";
171#if NH_3D
172    case SEI::ALTERNATIVE_DEPTH_INFO:                    return "Alternative depth information";
173#endif
174#endif
175    default:                                        return "Unknown";
176  }
177}
178
179#if NH_MV_SEI
180SEI::SEI()
181{
182  m_scalNestSeiContThisSei = NULL;
183}
184
185SEI* SEI::getNewSEIMessage(SEI::PayloadType payloadType)
186{
187  switch (payloadType)
188  {
189#if NH_MV_SEI_TBD
190    //////////////////////////////////////////////////////////////////////////
191    // TBD: Modify version 1 SEIs to use the same interfaces as Annex GFI SEI messages.
192    //////////////////////////////////////////////////////////////////////////
193
194    case SEI::BUFFERING_PERIOD:                     return new SEIBufferingPeriod; 
195    case SEI::PICTURE_TIMING:                       return new SEIPictureTiming;
196    case SEI::PAN_SCAN_RECT:                        return new SEIPanScanRectangle;                    // not currently decoded
197    case SEI::FILLER_PAYLOAD:                       return new SEIFillerPaylod;                       // not currently decoded
198    case SEI::USER_DATA_REGISTERED_ITU_T_T35:       return new SEIUserDataRegistered;                 // not currently decoded
199    case SEI::USER_DATA_UNREGISTERED:               return new SEIuserDataUnregistered; 
200    case SEI::RECOVERY_POINT:                       return new SEIRecoveryPoint;
201    case SEI::SCENE_INFO:                           return new SEISceneInformation;                    // not currently decoded
202    case SEI::FULL_FRAME_SNAPSHOT:                  return new SEIPictureSnapshot;                     // not currently decoded
203    case SEI::PROGRESSIVE_REFINEMENT_SEGMENT_START: return new SEIProgressiveRefinementSegmentStart;   // not currently decoded
204    case SEI::PROGRESSIVE_REFINEMENT_SEGMENT_END:   return new SEIProgressiveRefinementSegmentEnd;     // not currently decoded
205    case SEI::FILM_GRAIN_CHARACTERISTICS:           return new SEIFilmGrainCharacteristics;            // not currently decoded
206    case SEI::POST_FILTER_HINT:                     return new SEIPostFilterHint;                      // not currently decoded
207    case SEI::TONE_MAPPING_INFO:                    return new SEIToneMappingInfo;
208    case SEI::KNEE_FUNCTION_INFO:                   return new SEIKneeFunctionInfo;
209    case SEI::FRAME_PACKING:                        return new SEIFramePacking;
210    case SEI::DISPLAY_ORIENTATION:                  return new SEIDisplayOrientation;
211    case SEI::SOP_DESCRIPTION:                      return new SEISOPDescription;
212    case SEI::ACTIVE_PARAMETER_SETS:                return new SEIActiveParameterSets;
213    case SEI::DECODING_UNIT_INFO:                   return new SEIDecodingUnitInfo;
214    case SEI::TEMPORAL_LEVEL0_INDEX:                return new SEITemporalLevel0Index
215    case SEI::DECODED_PICTURE_HASH:                 return new SEIDecodedPictureHash;
216    case SEI::SCALABLE_NESTING:                     return new SEIScalableNesting;
217    case SEI::REGION_REFRESH_INFO:                  return new SEIRegionRefreshInfo; 
218    case SEI::NO_DISPLAY:                           return new SEINoDisplay;
219    case SEI::TIME_CODE:                            return new SEITimeCode;
220    case SEI::MASTERING_DISPLAY_COLOUR_VOLUME:      return new SEIMasteringDisplayColourVolume;
221    case SEI::SEGM_RECT_FRAME_PACKING:              return new SEISegmentedRectFramePacking;
222    case SEI::TEMP_MOTION_CONSTRAINED_TILE_SETS:    return new SEITempMotionConstrainedTileSets; 
223    case SEI::CHROMA_SAMPLING_FILTER_HINT:          return new SEIChromaSamplingFilterHint
224#endif
225#if NH_MV_SEI
226#if NH_MV_LAYERS_NOT_PRESENT_SEI
227  case SEI::LAYERS_NOT_PRESENT                    :               return new SEILayersNotPresent;
228#endif
229  case SEI::INTER_LAYER_CONSTRAINED_TILE_SETS     :               return new SEIInterLayerConstrainedTileSets;
230#if NH_MV_SEI_TBD
231  case SEI::BSP_NESTING                           :               return new SEIBspNesting;
232  case SEI::BSP_INITIAL_ARRIVAL_TIME              :               return new SEIBspInitialArrivalTime;
233#endif
234  case SEI::SUB_BITSTREAM_PROPERTY                :               return new SEISubBitstreamProperty;
235  case SEI::ALPHA_CHANNEL_INFO                    :               return new SEIAlphaChannelInfo;
236#if NH_MV_SEI_TBD
237  case SEI::OVERLAY_INFO                          :               return new SEIOverlayInfo;
238#endif
239  case SEI::TEMPORAL_MV_PREDICTION_CONSTRAINTS    :               return new SEITemporalMvPredictionConstraints;
240#if NH_MV_SEI_TBD
241  case SEI::FRAME_FIELD_INFO                      :               return new SEIFrameFieldInfo;
242#endif
243  case SEI::THREE_DIMENSIONAL_REFERENCE_DISPLAYS_INFO:            return new SEIThreeDimensionalReferenceDisplaysInfo;
244#if SEI_DRI_F0169
245  case SEI::DEPTH_REPRESENTATION_INFO             :               return new SEIDepthRepresentationInfo; 
246#endif
247  case SEI::MULTIVIEW_SCENE_INFO                  :               return new SEIMultiviewSceneInfo;
248  case SEI::MULTIVIEW_ACQUISITION_INFO            :               return new SEIMultiviewAcquisitionInfo;
249  case SEI::MULTIVIEW_VIEW_POSITION               :               return new SEIMultiviewViewPosition;
250#if NH_MV_SEI_TBD
251#if NH_3D
252  case SEI::ALTERNATIVE_DEPTH_INFO                :               return new SEIAlternativeDepthInfo;
253#endif
254#endif
255#endif
256  default:                                        assert( false ); return NULL;
257  }
258}
259
260Void SEI::setupFromSlice  ( const TComSlice* slice )
261{
262  xPrintCfgErrorIntro();
263  std::cout << getSEIMessageString( payloadType() ) << "Setup by the encoder is currently not possible. Using the default SEI cfg-file." << std::endl;
264}
265
266SEI* SEI::getCopy() const
267{
268  assert( 0 ); 
269  return NULL;
270}
271
272Void SEI::setupFromCfgFile( const Char* cfgFile )
273{
274  assert( false );
275}
276
277Bool SEI::insertSei( Int curLayerId, Int curPoc, Int curTid, Int curNaluType ) const
278{
279  Bool insertSeiHere = true;     
280  if( !m_applicableLayerIds.empty() )
281  {
282    insertSeiHere = insertSeiHere && ( std::find( m_applicableLayerIds.begin(), m_applicableLayerIds.end(), curLayerId) != m_applicableLayerIds.end() ) ;
283  }
284  if( !m_applicablePocs     .empty() )
285  {
286    insertSeiHere = insertSeiHere && ( std::find( m_applicablePocs    .begin(), m_applicablePocs    .end(), curPoc    ) != m_applicablePocs    .end() ) ;
287  }
288  if( !m_applicableTids     .empty() )
289  {
290    insertSeiHere = insertSeiHere && ( std::find( m_applicableTids    .begin(), m_applicableTids    .end(), curTid    ) != m_applicableTids    .end() ) ;
291  }
292  if( !m_applicableVclNaluTypes.empty() )
293  {
294    insertSeiHere = insertSeiHere && ( std::find( m_applicableVclNaluTypes.begin(), m_applicableVclNaluTypes.end(), curNaluType) != m_applicableVclNaluTypes.end() ) ;
295  }
296  return insertSeiHere;
297}
298
299Bool SEI::checkCfg( const TComSlice* slice )
300{
301  assert( false ); 
302  return true;
303}
304
305Void SEI::xPrintCfgErrorIntro()
306{
307  std::cout << "Error in configuration of " << getSEIMessageString( payloadType() ) << " SEI: ";
308}
309
310Void SEI::xCheckCfgRange( Bool& wrongConfig, Int val, Int minVal, Int maxVal, const Char* seName )
311{
312  if ( val < minVal || val > maxVal  )
313  {
314    xPrintCfgErrorIntro();
315    std::cout << "The value of " << seName << "shall be in the range of " << minVal << " to " << maxVal << ", inclusive." << std::endl;       
316    wrongConfig = true;       
317  }
318}
319
320Void SEI::xAddGeneralOpts(po::Options &opts, IntAry1d defAppLayerIds, IntAry1d deftApplicablePocs, 
321                                            IntAry1d defAppTids,     IntAry1d defAppVclNaluTypes, 
322                                            Int defSeiNaluId, Int defPositionInSeiNalu, Bool defModifyByEncoder)
323{
324  opts.addOptions()
325    ("PayloadType"            , m_payloadType            , -1                    , "Payload Type"                                                         )
326    ("ApplicableLayerIds"     , m_applicableLayerIds     , defAppLayerIds        , "LayerIds      of layers   to which the SEI is added. (all when empty)")
327    ("ApplicablePocs"         , m_applicablePocs         , deftApplicablePocs    , "POCs          of pictures to which the SEI is added. (all when empty)")
328    ("ApplicableTids"         , m_applicableTids         , defAppTids            , "TIds          of pictures to which the SEI is added. (all when empty)")
329    ("ApplicableVclNaluTypes" , m_applicableVclNaluTypes , defAppVclNaluTypes    , "NaluUnitTypes of picture  to which the SEI is added. (all when empty)")
330    ("SeiNaluId"              , m_seiNaluId              , defSeiNaluId          , "Identifies to which NAL unit  the SEI is added." )
331    ("PositionInSeiNalu"      , m_positionInSeiNalu      , defPositionInSeiNalu  , "Identifies the position within the NAL unit.")
332    ("ModifyByEncoder"        , m_modifyByEncoder        , defModifyByEncoder    , "0: Use payload as specified in cfg file   1: Modify SEI by encoder");
333}
334
335Void SEI::xCheckCfg( Bool& wrongConfig, Bool cond, const Char* errStr )
336{
337  if ( !cond  )
338  {
339    xPrintCfgErrorIntro();
340    std::cout << errStr << std::endl;       
341    wrongConfig = true;       
342  }
343}
344
345
346#if NH_MV_LAYERS_NOT_PRESENT_SEI
347Void SEILayersNotPresent::setupFromCfgFile(const Char* cfgFile)
348{ 
349  // Set default values
350  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes; 
351
352  // TBD: Add default values for which layers, POCS, Tids or Nalu types the SEI should be send.
353  // This SEI message doesn't need to be added by default to any Layer / POC / NAL Unit / T Layer. Not sure if empty is right.
354  defAppLayerIds    .empty( );
355  defAppPocs        .empty( );
356  defAppTids        .empty( );
357  defAppVclNaluTypes.empty( );
358
359  Int      defSeiNaluId                  = 0;
360  Int      defPositionInSeiNalu          = 0; 
361  Bool     defModifyByEncoder            = false;   //0: Use payload as specified in cfg file   1: Modify SEI by encoder
362
363  // Setup config file options
364  po::Options opts;     
365  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder ); 
366
367  opts.addOptions()
368    ("LnpSeiActiveVpsId"              , m_lnpSeiActiveVpsId                , 0                              , "LnpSeiActiveVpsId"                )   //Why?
369    ("LayerNotPresentFlag"            , m_layerNotPresentFlag              , BoolAry1d(1,0)                 , "LayerNotPresentFlag"              )
370    ;
371
372  po::setDefaults(opts);
373
374  // Parse the cfg file
375  po::ErrorReporter err;
376  po::parseConfigFile( opts, cfgFile, err );
377  m_lnpSeiMaxLayers = m_layerNotPresentFlag.size();
378};
379
380  Bool SEILayersNotPresent::checkCfg( const TComSlice* slice )
381  { 
382  // Check config values
383    Bool wrongConfig = false; 
384//
385    const TComVPS* vps = slice->getVPS(); 
386//  // TBD: Add constraints on presence of SEI here.
387    xCheckCfg     ( wrongConfig, m_lnpSeiActiveVpsId == vps->getVPSId(), "The value of lnp_sei_active_vps_id shall be equal to the value of vps_video_parameter_set_id of the active VPS for the VCL NAL units of the access unit containing the SEI message." );
388
389
390    for (Int i = 0; i < vps->getMaxLayersMinus1(); i++)
391    {
392      if ( m_layerNotPresentFlag[ i ] && i < vps->getMaxLayersMinus1() )
393      {
394        for (Int j = 0; j < vps->getNumPredictedLayers( vps->getLayerIdInNuh( j ) - 1 ); j++ )
395        {
396          xCheckCfg     ( wrongConfig, m_layerNotPresentFlag[ vps->getLayerIdInVps( vps->getIdPredictedLayer( vps->getLayerIdInNuh(i),j) )], "When layer_not_present_flag[ i ] is equal to 1 and i is less than MaxLayersMinus1, layer_not_present_flag[ LayerIdxInVps[ IdPredictedLayer[ layer_id_in_nuh[ i ] ][ j ] ] ] shall be equal to 1 for all values of j in the range of 0 to NumPredictedLayers[ layer_id_in_nuh[ i ] ] - 1, inclusive." );
397        }
398      }
399    }
400
401      return wrongConfig; 
402  };
403#endif
404
405
406Void SEIInterLayerConstrainedTileSets::setupFromCfgFile(const Char* cfgFile)
407{ 
408  // Set default values
409  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes; 
410
411  // TBD: Add default values for which layers, POCS, Tids or Nalu types the SEI should be send.
412  defAppLayerIds    .empty( ); 
413  defAppPocs        .push_back( 0 ); 
414  defAppTids        .empty( ); 
415  defAppVclNaluTypes.empty( ); 
416
417  Int      defSeiNaluId                  = 0; 
418  Int      defPositionInSeiNalu          = 0; 
419  Bool     defModifyByEncoder            = false; 
420
421  // Setup config file options
422  po::Options opts;     
423  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder ); 
424
425  const Int maxNumTileInSet = 100; 
426
427  opts.addOptions()
428    ("IlAllTilesExactSampleValueMatchFlag", m_ilAllTilesExactSampleValueMatchFlag, false                    , "IlAllTilesExactSampleValueMatchFlag")
429    ("IlOneTilePerTileSetFlag"        , m_ilOneTilePerTileSetFlag          , false                          , "IlOneTilePerTileSetFlag"          )
430    ("IlNumSetsInMessageMinus1"       , m_ilNumSetsInMessageMinus1         , 0                              , "IlNumSetsInMessageMinus1"         )
431    ("SkippedTileSetPresentFlag"      , m_skippedTileSetPresentFlag        , false                          , "SkippedTileSetPresentFlag"        )
432    ("IlctsId"                        , m_ilctsId                          , IntAry1d (256,0)               , "IlctsId"                          )
433    ("IlNumTileRectsInSetMinus1"      , m_ilNumTileRectsInSetMinus1        , IntAry1d (256,0)               , "IlNumTileRectsInSetMinus1"        )
434    ("IlTopLeftTileIndex_%d"          , m_ilTopLeftTileIndex               , IntAry1d (maxNumTileInSet,0), 256, "IlTopLeftTileIndex"               )
435    ("IlBottomRightTileIndex_%d"      , m_ilBottomRightTileIndex           , IntAry1d (maxNumTileInSet,0), 256, "IlBottomRightTileIndex"           )
436    ("IlcIdc"                         , m_ilcIdc                           , IntAry1d (256,0)               , "IlcIdc"                           )
437    ("IlExactSampleValueMatchFlag"    , m_ilExactSampleValueMatchFlag      , BoolAry1d(256,0)               , "IlExactSampleValueMatchFlag"      )
438    ("AllTilesIlcIdc"                 , m_allTilesIlcIdc                   , 0                              , "AllTilesIlcIdc"                   )
439    ;
440
441  po::setDefaults(opts);
442
443  // Parse the cfg file
444  po::ErrorReporter err;
445  po::parseConfigFile( opts, cfgFile, err );
446};
447
448Bool SEIInterLayerConstrainedTileSets::checkCfg( const TComSlice* slice )
449{ 
450  // Check config values
451  Bool wrongConfig = false; 
452  const TComPPS* pps = slice->getPPS(); 
453
454  // Currently only the active PPS checked.
455  xCheckCfg     ( wrongConfig, pps->getTilesEnabledFlag() , "The inter-layer constrained tile sets SEI message shall not be present for the layer with nuh_layer_id equal to targetLayerId when tiles_enabled_flag is equal to 0 for any PPS that is active for the pictures of the CLVS of the layer with nuh_layer_id equal to targetLayerId." );
456   
457  if ( m_ilOneTilePerTileSetFlag )
458  {
459    xCheckCfg( wrongConfig, ( pps->getNumTileColumnsMinus1() + 1 ) *  ( pps->getNumTileRowsMinus1() + 1 ) <= 256, "It is a requirement of bitstream conformance that when il_one_tile_per_tile_set_flag is equal to 1, the value of ( num_tile_columns_minus1 + 1 ) * ( num_tile_rows_minus1 + 1 ) shall be less than or equal to 256."    );
460  }
461  Int numSignificantSets = m_ilNumSetsInMessageMinus1 - m_skippedTileSetPresentFlag + 1; 
462
463  for (Int i = 0 ; i < numSignificantSets; i++)
464  {
465    xCheckCfgRange( wrongConfig, m_ilctsId[i]                         , 0 , (1 << 30) - 1, "ilcts_id"                         );
466  } 
467 
468  return wrongConfig; 
469};
470#if NH_MV_SEI_TBD
471
472Void SEIBspNesting::setupFromSlice  ( const TComSlice* slice )
473{
474  sei.m_seiOlsIdx =  TBD ;
475  sei.m_seiPartitioningSchemeIdx =  TBD ;
476  sei.m_bspIdx =  TBD ;
477  while( !ByteaLigned(() ) );
478  {
479    sei.m_bspNestingZeroBit =  TBD ;
480  }
481  sei.m_numSeisInBspMinus1 =  TBD ;
482  for( Int i = 0; i  <=  NumSeisInBspMinus1( ); i++ )
483  {
484    SeiMessage(() );
485  }
486};
487
488Void SEIBspNesting::setupFromCfgFile(const Char* cfgFile)
489{ 
490  // Set default values
491  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes; 
492
493  // TBD: Add default values for which layers, POCS, Tids or Nalu types the SEI should be send.
494  defAppLayerIds    .push_back( TBD );
495  defAppPocs        .push_back( TBD );
496  defAppTids        .push_back( TBD );
497  defAppVclNaluTypes.push_back( TBD );
498
499  Int      defSeiNaluId                  = 0; 
500  Int      defPositionInSeiNalu          = 0; 
501  Bool     defModifyByEncoder            = TBD; 
502
503  // Setup config file options
504  po::Options opts;     
505  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder ); 
506
507  opts.addOptions()
508    ("SeiOlsIdx"                      , m_seiOlsIdx                        , 0                              , "SeiOlsIdx"                        )
509    ("SeiPartitioningSchemeIdx"       , m_seiPartitioningSchemeIdx         , 0                              , "SeiPartitioningSchemeIdx"         )
510    ("BspIdx"                         , m_bspIdx                           , 0                              , "BspIdx"                           )
511    ("BspNestingZeroBit"              , m_bspNestingZeroBit                , 0                              , "BspNestingZeroBit"                )
512    ("NumSeisInBspMinus1"             , m_numSeisInBspMinus1               , 0                              , "NumSeisInBspMinus1"               )
513    ;
514
515  po::setDefaults(opts);
516
517  // Parse the cfg file
518  po::ErrorReporter err;
519  po::parseConfigFile( opts, cfgFile, err );
520};
521
522Bool SEIBspNesting::checkCfg( const TComSlice* slice )
523{ 
524  // Check config values
525  Bool wrongConfig = false; 
526
527  // TBD: Add constraints on presence of SEI here.
528  xCheckCfg     ( wrongConfig, TBD , "TBD" );
529  xCheckCfg     ( wrongConfig, TBD , "TBD" );
530
531  // TBD: Modify constraints according to the SEI semantics.   
532  xCheckCfgRange( wrongConfig, m_seiOlsIdx                      , MINVAL , MAXVAL, "sei_ols_idx"          );
533  xCheckCfgRange( wrongConfig, m_seiPartitioningSchemeIdx       , MINVAL , MAXVAL, "sei_partitioning_scheme_idx"       );
534  xCheckCfgRange( wrongConfig, m_bspIdx                         , MINVAL , MAXVAL, "bsp_idx"              );
535  xCheckCfgRange( wrongConfig, m_bspNestingZeroBit              , MINVAL , MAXVAL, "bsp_nesting_zero_bit ");
536  xCheckCfgRange( wrongConfig, m_numSeisInBspMinus1             , MINVAL , MAXVAL, "num_seis_in_bsp_minus1"           );
537
538  return wrongConfig; 
539
540};
541
542Void SEIBspInitialArrivalTime::setupFromSlice  ( const TComSlice* slice )
543{
544  psIdx = SeiPartitioningSchemeIdx();
545  if( nalInitialArrivalDelayPresent )
546  {
547    for( Int i = 0; i < BspSchedCnt( SeiOlsIdx(), psIdx, MaxTemporalId( 0 ) ); i++ )
548    {
549      sei.m_nalInitialArrivalDelay[i] =  TBD ;
550    }
551  }
552  if( vclInitialArrivalDelayPresent )
553  {
554    for( Int i = 0; i < BspSchedCnt( SeiOlsIdx(), psIdx, MaxTemporalId( 0 ) ); i++ )
555    {
556      sei.m_vclInitialArrivalDelay[i] =  TBD ;
557    }
558  }
559};
560
561Void SEIBspInitialArrivalTime::setupFromCfgFile(const Char* cfgFile)
562{ 
563  // Set default values
564  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes; 
565
566  // TBD: Add default values for which layers, POCS, Tids or Nalu types the SEI should be send.
567  defAppLayerIds    .push_back( TBD );
568  defAppPocs        .push_back( TBD );
569  defAppTids        .push_back( TBD );
570  defAppVclNaluTypes.push_back( TBD );
571
572  Int      defSeiNaluId                  = 0; 
573  Int      defPositionInSeiNalu          = 0; 
574  Bool     defModifyByEncoder            = TBD; 
575
576  // Setup config file options
577  po::Options opts;     
578  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder ); 
579
580  opts.addOptions()
581    ("NalInitialArrivalDelay"         , m_nalInitialArrivalDelay           , IntAry1d (1,0)                 , "NalInitialArrivalDelay"           )
582    ("VclInitialArrivalDelay"         , m_vclInitialArrivalDelay           , IntAry1d (1,0)                 , "VclInitialArrivalDelay"           )
583    ;
584
585  po::setDefaults(opts);
586
587  // Parse the cfg file
588  po::ErrorReporter err;
589  po::parseConfigFile( opts, cfgFile, err );
590};
591
592Bool SEIBspInitialArrivalTime::checkCfg( const TComSlice* slice )
593{ 
594  // Check config values
595  Bool wrongConfig = false; 
596
597  // TBD: Add constraints on presence of SEI here.
598  xCheckCfg     ( wrongConfig, TBD , "TBD" );
599  xCheckCfg     ( wrongConfig, TBD , "TBD" );
600
601  // TBD: Modify constraints according to the SEI semantics.   
602  xCheckCfgRange( wrongConfig, m_nalInitialArrivalDelay[i]      , MINVAL , MAXVAL, "nal_initial_arrival_delay"        );
603  xCheckCfgRange( wrongConfig, m_vclInitialArrivalDelay[i]      , MINVAL , MAXVAL, "vcl_initial_arrival_delay"        );
604
605  return wrongConfig; 
606
607};
608#endif
609
610Void SEISubBitstreamProperty::setupFromCfgFile(const Char* cfgFile)
611{ 
612  // Set default values
613  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes; 
614
615  // TBD: Add default values for which layers, POCS, Tids or Nalu types the SEI should be send.
616  defAppLayerIds    .push_back( 0 );
617  defAppPocs        .push_back( 0 );
618  defAppTids        .push_back( 0 );
619  defAppVclNaluTypes = IRAP_NAL_UNIT_TYPES;
620
621  Int      defSeiNaluId                  = 0; 
622  Int      defPositionInSeiNalu          = 0; 
623  Bool     defModifyByEncoder            = false; 
624
625  // Setup config file options
626  po::Options opts;     
627  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder ); 
628
629  opts.addOptions()
630    ("SbPropertyActiveVpsId"          , m_sbPropertyActiveVpsId            , 0                              , "SbPropertyActiveVpsId"            )
631    ("NumAdditionalSubStreamsMinus1"  , m_numAdditionalSubStreamsMinus1    , 0                              , "NumAdditionalSubStreamsMinus1"    )
632    ("SubBitstreamMode"               , m_subBitstreamMode                 , IntAry1d (1,0)                 , "SubBitstreamMode"                 )
633    ("OlsIdxToVps"                    , m_olsIdxToVps                      , IntAry1d (1,0)                 , "OlsIdxToVps"                      )
634    ("HighestSublayerId"              , m_highestSublayerId                , IntAry1d (1,0)                 , "HighestSublayerId"                )
635    ("AvgSbPropertyBitRate"           , m_avgSbPropertyBitRate             , IntAry1d (1,0)                 , "AvgSbPropertyBitRate"             )
636    ("MaxSbPropertyBitRate"           , m_maxSbPropertyBitRate             , IntAry1d (1,0)                 , "MaxSbPropertyBitRate"             )
637    ;
638
639  po::setDefaults(opts);
640
641  // Parse the cfg file
642  po::ErrorReporter err;
643  po::parseConfigFile( opts, cfgFile, err );
644};
645
646Bool SEISubBitstreamProperty::checkCfg( const TComSlice* slice )
647{ 
648  // Check config values
649  Bool wrongConfig = false;
650
651  // For the current encoder, the initial IRAP access unit has always POC zero.   
652  xCheckCfg     ( wrongConfig, slice->isIRAP() && (slice->getPOC() == 0), "When present, the sub-bitstream property SEI message shall be associated with an initial IRAP access unit and the information provided by the SEI messages applies to the bitstream corresponding to the CVS containing the associated initial IRAP access unit.");
653
654  Bool sizeNotCorrect = 
655    (    ( m_numAdditionalSubStreamsMinus1 + 1 ) != m_subBitstreamMode    .size() )
656    || ( ( m_numAdditionalSubStreamsMinus1 + 1 ) != m_olsIdxToVps         .size() )
657    || ( ( m_numAdditionalSubStreamsMinus1 + 1 ) != m_highestSublayerId   .size() )
658    || ( ( m_numAdditionalSubStreamsMinus1 + 1 ) != m_avgSbPropertyBitRate.size() )
659    || ( ( m_numAdditionalSubStreamsMinus1 + 1 ) != m_maxSbPropertyBitRate.size() );
660
661  xCheckCfg( wrongConfig, !sizeNotCorrect, "Some parameters of some sub-bitstream not provided." );
662  xCheckCfg( wrongConfig, slice->getVPS()->getVPSId() == m_sbPropertyActiveVpsId, "The value of sb_property_active_vps_id shall be equal to the value of vps_video_parameter_set_id of the active VPS referred to by the VCL NAL units of the associated access unit." );
663
664  xCheckCfgRange( wrongConfig, m_numAdditionalSubStreamsMinus1  , 0 , (1 << 10) - 1 , "num_additional_sub_streams_minus1");
665 
666  if ( !sizeNotCorrect )
667  {
668    for (Int i = 0; i <= m_numAdditionalSubStreamsMinus1; i++ )
669    {
670      xCheckCfgRange( wrongConfig, m_subBitstreamMode[i]    , 0 , 1                                          , "sub_bitstream_mode" );
671      xCheckCfgRange( wrongConfig, m_olsIdxToVps[i]         , 0 , slice->getVPS()->getNumOutputLayerSets()-1 , "ols_idx_to_vps"     );
672    }
673  }
674  return wrongConfig; 
675};
676
677Void SEISubBitstreamProperty::resizeArrays( )
678{
679  m_subBitstreamMode    .resize( m_numAdditionalSubStreamsMinus1 + 1); 
680  m_olsIdxToVps         .resize( m_numAdditionalSubStreamsMinus1 + 1); 
681  m_highestSublayerId   .resize( m_numAdditionalSubStreamsMinus1 + 1); 
682  m_avgSbPropertyBitRate.resize( m_numAdditionalSubStreamsMinus1 + 1); 
683  m_maxSbPropertyBitRate.resize( m_numAdditionalSubStreamsMinus1 + 1); 
684}
685
686Void SEIAlphaChannelInfo::setupFromCfgFile(const Char* cfgFile)
687{ 
688  // Set default values
689  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes; 
690
691  // TBD: Add default values for which layers, POCS, Tids or Nalu types the SEI should be send.
692  defAppLayerIds    .clear();
693  defAppPocs        .push_back( 0 );
694  defAppTids        .push_back( 0 );
695  defAppVclNaluTypes = IDR_NAL_UNIT_TYPES;
696
697  Int      defSeiNaluId                  = 0; 
698  Int      defPositionInSeiNalu          = 0; 
699  Bool     defModifyByEncoder            = false;
700
701  // Setup config file options
702  po::Options opts;     
703  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder ); 
704
705  opts.addOptions()
706    ("AlphaChannelCancelFlag"         , m_alphaChannelCancelFlag           , false                          , "AlphaChannelCancelFlag"           )
707    ("AlphaChannelUseIdc"             , m_alphaChannelUseIdc               , 0                              , "AlphaChannelUseIdc"               )
708    ("AlphaChannelBitDepthMinus8"     , m_alphaChannelBitDepthMinus8       , 0                              , "AlphaChannelBitDepthMinus8"       )
709    ("AlphaTransparentValue"          , m_alphaTransparentValue            , 0                              , "AlphaTransparentValue"            )
710    ("AlphaOpaqueValue"               , m_alphaOpaqueValue                 , 255                            , "AlphaOpaqueValue"                 )
711    ("AlphaChannelIncrFlag"           , m_alphaChannelIncrFlag             , false                          , "AlphaChannelIncrFlag"             )
712    ("AlphaChannelClipFlag"           , m_alphaChannelClipFlag             , false                          , "AlphaChannelClipFlag"             )
713    ("AlphaChannelClipTypeFlag"       , m_alphaChannelClipTypeFlag         , false                          , "AlphaChannelClipTypeFlag"         )
714    ;
715
716  po::setDefaults(opts);
717
718  // Parse the cfg file
719  po::ErrorReporter err;
720  po::parseConfigFile( opts, cfgFile, err );
721
722};
723
724Bool SEIAlphaChannelInfo::checkCfg( const TComSlice* slice )
725{ 
726  // Check config values
727  Bool wrongConfig = false; 
728
729  int maxInterpretationValue = (1 << (m_alphaChannelBitDepthMinus8+9)) - 1;
730  xCheckCfgRange( wrongConfig, m_alphaChannelCancelFlag         , 0 , 1, "alpha_channel_cancel_flag"        );
731  xCheckCfgRange( wrongConfig, m_alphaChannelUseIdc             , 0 , 7, "alpha_channel_use_idc");
732  xCheckCfgRange( wrongConfig, m_alphaChannelBitDepthMinus8     , 0 , 7, "alpha_channel_bit_depth_minus8"   );
733  xCheckCfgRange( wrongConfig, m_alphaTransparentValue          , 0 , maxInterpretationValue, "alpha_transparent_value"          );
734  xCheckCfgRange( wrongConfig, m_alphaOpaqueValue               , 0 , maxInterpretationValue, "alpha_opaque_value"   );
735  xCheckCfgRange( wrongConfig, m_alphaChannelIncrFlag           , 0 , 1, "alpha_channel_incr_flag"          );
736  xCheckCfgRange( wrongConfig, m_alphaChannelClipFlag           , 0 , 1, "alpha_channel_clip_flag"          );
737  xCheckCfgRange( wrongConfig, m_alphaChannelClipTypeFlag       , 0 , 1, "alpha_channel_clip_type_flag"     );
738
739  return wrongConfig; 
740
741};
742#if NH_MV_SEI_TBD
743Void SEIOverlayInfo::setupFromSlice  ( const TComSlice* slice )
744{
745  sei.m_overlayInfoCancelFlag =  TBD ;
746  if( !sei.m_overlayInfoCancelFlag )
747  {
748    sei.m_overlayContentAuxIdMinus128 =  TBD ;
749    sei.m_overlayLabelAuxIdMinus128 =  TBD ;
750    sei.m_overlayAlphaAuxIdMinus128 =  TBD ;
751    sei.m_overlayElementLabelValueLengthMinus8 =  TBD ;
752    sei.m_numOverlaysMinus1 =  TBD ;
753    for( Int i = 0; i  <=  NumOverlaysMinus1( ); i++ )
754    {
755      sei.m_overlayIdx[i] =  TBD ;
756      sei.m_languageOverlayPresentFlag[i] =  TBD ;
757      sei.m_overlayContentLayerId[i] =  TBD ;
758      sei.m_overlayLabelPresentFlag[i] =  TBD ;
759      if( sei.m_overlayLabelPresentFlag( i ) )
760      {
761        sei.m_overlayLabelLayerId[i] =  TBD ;
762      }
763      sei.m_overlayAlphaPresentFlag[i] =  TBD ;
764      if( sei.m_overlayAlphaPresentFlag( i ) )
765      {
766        sei.m_overlayAlphaLayerId[i] =  TBD ;
767      }
768      if( sei.m_overlayLabelPresentFlag( i ) )
769      {
770        sei.m_numOverlayElementsMinus1[i] =  TBD ;
771        for( Int j = 0; j  <=  sei.m_numOverlayElementsMinus1( i ); j++ )
772        {
773          sei.m_overlayElementLabelMin[i][j] =  TBD ;
774          sei.m_overlayElementLabelMax[i][j] =  TBD ;
775        }
776      }
777    }
778    while( !ByteaLigned(() ) );
779    {
780      sei.m_overlayZeroBit =  TBD ;
781    }
782    for( Int i = 0; i  <=  NumOverlaysMinus1( ); i++ )
783    {
784      if( sei.m_languageOverlayPresentFlag( i ) )
785      {
786        sei.m_overlayLanguage[i] =  TBD ;
787      }
788      sei.m_overlayName[i] =  TBD ;
789      if( sei.m_overlayLabelPresentFlag( i ) )
790      {
791        for( Int j = 0; j  <=  sei.m_numOverlayElementsMinus1( i ); j++ )
792        {
793          sei.m_overlayElementName[i][j] =  TBD ;
794        }
795      }
796    }
797    sei.m_overlayInfoPersistenceFlag =  TBD ;
798  }
799};
800
801Void SEIOverlayInfo::setupFromCfgFile(const Char* cfgFile)
802{ 
803  // Set default values
804  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes; 
805
806  // TBD: Add default values for which layers, POCS, Tids or Nalu types the SEI should be send.
807  defAppLayerIds    .push_back( TBD );
808  defAppPocs        .push_back( TBD );
809  defAppTids        .push_back( TBD );
810  defAppVclNaluTypes.push_back( TBD );
811
812  Int      defSeiNaluId                  = 0; 
813  Int      defPositionInSeiNalu          = 0; 
814  Bool     defModifyByEncoder            = TBD; 
815
816  // Setup config file options
817  po::Options opts;     
818  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder ); 
819
820  opts.addOptions()
821    ("OverlayInfoCancelFlag"          , m_overlayInfoCancelFlag            , false                          , "OverlayInfoCancelFlag"            )
822    ("OverlayContentAuxIdMinus128"    , m_overlayContentAuxIdMinus128      , 0                              , "OverlayContentAuxIdMinus128"      )
823    ("OverlayLabelAuxIdMinus128"      , m_overlayLabelAuxIdMinus128        , 0                              , "OverlayLabelAuxIdMinus128"        )
824    ("OverlayAlphaAuxIdMinus128"      , m_overlayAlphaAuxIdMinus128        , 0                              , "OverlayAlphaAuxIdMinus128"        )
825    ("OverlayElementLabelValueLengthMinus8", m_overlayElementLabelValueLengthMinus8, 0                              , "OverlayElementLabelValueLengthMinus8")
826    ("NumOverlaysMinus1"              , m_numOverlaysMinus1                , 0                              , "NumOverlaysMinus1"                )
827    ("OverlayIdx"                     , m_overlayIdx                       , IntAry1d (1,0)                 , "OverlayIdx"                       )
828    ("LanguageOverlayPresentFlag"     , m_languageOverlayPresentFlag       , BoolAry1d(1,0)                 , "LanguageOverlayPresentFlag"       )
829    ("OverlayContentLayerId"          , m_overlayContentLayerId            , IntAry1d (1,0)                 , "OverlayContentLayerId"            )
830    ("OverlayLabelPresentFlag"        , m_overlayLabelPresentFlag          , BoolAry1d(1,0)                 , "OverlayLabelPresentFlag"          )
831    ("OverlayLabelLayerId"            , m_overlayLabelLayerId              , IntAry1d (1,0)                 , "OverlayLabelLayerId"              )
832    ("OverlayAlphaPresentFlag"        , m_overlayAlphaPresentFlag          , BoolAry1d(1,0)                 , "OverlayAlphaPresentFlag"          )
833    ("OverlayAlphaLayerId"            , m_overlayAlphaLayerId              , IntAry1d (1,0)                 , "OverlayAlphaLayerId"              )
834    ("NumOverlayElementsMinus1"       , m_numOverlayElementsMinus1         , IntAry1d (1,0)                 , "NumOverlayElementsMinus1"         )
835    ("OverlayElementLabelMin_%d"      , m_overlayElementLabelMin           , IntAry1d (1,0) ,ADDNUM         , "OverlayElementLabelMin"           )
836    ("OverlayElementLabelMax_%d"      , m_overlayElementLabelMax           , IntAry1d (1,0) ,ADDNUM         , "OverlayElementLabelMax"           )
837    ("OverlayZeroBit"                 , m_overlayZeroBit                   , 0                              , "OverlayZeroBit"                   )
838    ("OverlayLanguage"                , m_overlayLanguage                  , IntAry1d (1,0)                 , "OverlayLanguage"                  )
839    ("OverlayName"                    , m_overlayName                      , IntAry1d (1,0)                 , "OverlayName"                      )
840    ("OverlayElementName_%d"          , m_overlayElementName               , IntAry1d (1,0) ,ADDNUM         , "OverlayElementName"               )
841    ("OverlayInfoPersistenceFlag"     , m_overlayInfoPersistenceFlag       , false                          , "OverlayInfoPersistenceFlag"       )
842    ;
843
844  po::setDefaults(opts);
845
846  // Parse the cfg file
847  po::ErrorReporter err;
848  po::parseConfigFile( opts, cfgFile, err );
849};
850
851Bool SEIOverlayInfo::checkCfg( const TComSlice* slice )
852{ 
853  // Check config values
854  Bool wrongConfig = false; 
855
856  // TBD: Add constraints on presence of SEI here.
857  xCheckCfg     ( wrongConfig, TBD , "TBD" );
858  xCheckCfg     ( wrongConfig, TBD , "TBD" );
859
860  // TBD: Modify constraints according to the SEI semantics.   
861  xCheckCfgRange( wrongConfig, m_overlayInfoCancelFlag          , MINVAL , MAXVAL, "overlay_info_cancel_flag"         );
862  xCheckCfgRange( wrongConfig, m_overlayContentAuxIdMinus128    , MINVAL , MAXVAL, "overlay_content_aux_id_minus128"  );
863  xCheckCfgRange( wrongConfig, m_overlayLabelAuxIdMinus128      , MINVAL , MAXVAL, "overlay_label_aux_id_minus128"    );
864  xCheckCfgRange( wrongConfig, m_overlayAlphaAuxIdMinus128      , MINVAL , MAXVAL, "overlay_alpha_aux_id_minus128"    );
865  xCheckCfgRange( wrongConfig, m_overlayElementLabelValueLengthMinus8, MINVAL , MAXVAL, "overlay_element_label_value_length_minus8");
866  xCheckCfgRange( wrongConfig, m_numOverlaysMinus1              , MINVAL , MAXVAL, "num_overlays_minus1"  );
867  xCheckCfgRange( wrongConfig, m_overlayIdx[i]                  , MINVAL , MAXVAL, "overlay_idx"          );
868  xCheckCfgRange( wrongConfig, m_languageOverlayPresentFlag[i]  , MINVAL , MAXVAL, "language_overlay_present_flag"    );
869  xCheckCfgRange( wrongConfig, m_overlayContentLayerId[i]       , MINVAL , MAXVAL, "overlay_content_layer_id"         );
870  xCheckCfgRange( wrongConfig, m_overlayLabelPresentFlag[i]     , MINVAL , MAXVAL, "overlay_label_present_flag"       );
871  xCheckCfgRange( wrongConfig, m_overlayLabelLayerId[i]         , MINVAL , MAXVAL, "overlay_label_layer_id"           );
872  xCheckCfgRange( wrongConfig, m_overlayAlphaPresentFlag[i]     , MINVAL , MAXVAL, "overlay_alpha_present_flag"       );
873  xCheckCfgRange( wrongConfig, m_overlayAlphaLayerId[i]         , MINVAL , MAXVAL, "overlay_alpha_layer_id"           );
874  xCheckCfgRange( wrongConfig, m_numOverlayElementsMinus1[i]    , MINVAL , MAXVAL, "num_overlay_elements_minus1"       );
875  xCheckCfgRange( wrongConfig, m_overlayElementLabelMin[i][j]   , MINVAL , MAXVAL, "overlay_element_label_min"        );
876  xCheckCfgRange( wrongConfig, m_overlayElementLabelMax[i][j]   , MINVAL , MAXVAL, "overlay_element_label_max"        );
877  xCheckCfgRange( wrongConfig, m_overlayZeroBit                 , MINVAL , MAXVAL, "overlay_zero_bit"                 );
878  xCheckCfgRange( wrongConfig, m_overlayLanguage[i]             , MINVAL , MAXVAL, "overlay_language"                 );
879  xCheckCfgRange( wrongConfig, m_overlayName[i]                 , MINVAL , MAXVAL, "overlay_name"                     );
880  xCheckCfgRange( wrongConfig, m_overlayElementName[i][j]       , MINVAL , MAXVAL, "overlay_element_name"             );
881  xCheckCfgRange( wrongConfig, m_overlayInfoPersistenceFlag     , MINVAL , MAXVAL, "overlay_info_persistence_flag"    );
882
883  return wrongConfig; 
884
885};
886#endif
887
888Void SEITemporalMvPredictionConstraints::setupFromCfgFile(const Char* cfgFile)
889{ 
890  // Set default values
891  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes; 
892
893  // TBD: Add default values for which layers, POCS, Tids or Nalu types the SEI should be send.
894  defAppLayerIds    .clear    (   ); 
895  defAppPocs        .push_back( 0 );
896  defAppTids        .push_back( 0 );
897  defAppVclNaluTypes.clear    (   );
898
899  Int      defSeiNaluId                  = 0; 
900  Int      defPositionInSeiNalu          = 0; 
901  Bool     defModifyByEncoder            = false; 
902
903  // Setup config file options
904  po::Options opts;     
905  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder ); 
906
907  opts.addOptions()
908    ("PrevPicsNotUsedFlag"   , m_prevPicsNotUsedFlag   , false, "PrevPicsNotUsedFlag"    )
909    ("NoIntraLayerColPicFlag", m_noIntraLayerColPicFlag, false, "NoIntraLayerColPicFlag" )
910    ;
911
912  po::setDefaults(opts);
913
914  // Parse the cfg file
915  po::ErrorReporter err;
916  po::parseConfigFile( opts, cfgFile, err );
917};
918
919Bool SEITemporalMvPredictionConstraints::checkCfg( const TComSlice* slice )
920{ 
921  // Check config values
922  Bool wrongConfig = false; 
923
924  xCheckCfg     ( wrongConfig, slice->getTemporalId() == 0 , "The temporal motion vector prediction constraints SEI message may be present in an access unit with TemporalId equal to 0 and shall not be present in an access unit with TemporalId greater than 0." );
925
926  return wrongConfig; 
927};
928
929#if NH_MV_SEI_TBD
930Void SEIFrameFieldInfo::setupFromCfgFile(const Char* cfgFile)
931{ 
932  // Set default values
933  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes; 
934
935  // TBD: Add default values for which layers, POCS, Tids or Nalu types the SEI should be send.
936  defAppLayerIds    .push_back( TBD );
937  defAppPocs        .push_back( TBD );
938  defAppTids        .push_back( TBD );
939  defAppVclNaluTypes.push_back( TBD );
940
941  Int      defSeiNaluId                  = 0;
942  Int      defPositionInSeiNalu          = 0;
943  Bool     defModifyByEncoder            = false;
944
945  // Setup config file options
946  po::Options opts;     
947  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder ); 
948
949  opts.addOptions()
950    ("FfinfoPicStruct"     , m_ffinfoPicStruct     , 0     , "FfinfoPicStruct"     )
951    ("FfinfoSourceScanType", m_ffinfoSourceScanType, 0     , "FfinfoSourceScanType")
952    ("FfinfoDuplicateFlag" , m_ffinfoDuplicateFlag , false , "FfinfoDuplicateFlag" )
953    ;
954
955  po::setDefaults(opts);
956
957  // Parse the cfg file
958  po::ErrorReporter err;
959  po::parseConfigFile( opts, cfgFile, err );
960};
961
962
963Bool SEIFrameFieldInfo::checkCfg( const TComSlice* slice )
964{ 
965  // Check config values
966  Bool wrongConfig = false; 
967
968  // TBD: Add constraints on presence of SEI here.
969  xCheckCfg     ( wrongConfig, TBD , "TBD" );
970  xCheckCfg     ( wrongConfig, TBD , "TBD" );
971
972  // TBD: Modify constraints according to the SEI semantics.   
973  xCheckCfgRange( wrongConfig, m_ffinfoPicStruct                , MINVAL , MAXVAL, "ffinfo_pic_struct"                );
974  xCheckCfgRange( wrongConfig, m_ffinfoSourceScanType           , MINVAL , MAXVAL, "ffinfo_source_scan_type"          );
975  xCheckCfgRange( wrongConfig, m_ffinfoDuplicateFlag            , MINVAL , MAXVAL, "ffinfo_duplicate_flag"            );
976
977  return wrongConfig; 
978
979};
980#endif
981
982Void SEIThreeDimensionalReferenceDisplaysInfo::setupFromCfgFile(const Char* cfgFile)
983{ 
984  // Set default values
985  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes; 
986
987  // Default values for which layers, POCS, Tids or Nalu types the SEI should be sent.
988  defAppLayerIds      .push_back( 0 ); 
989  defAppPocs          .push_back( 0 );
990  defAppTids          .push_back( 0 );
991  defAppVclNaluTypes = IRAP_NAL_UNIT_TYPES;
992
993  Int      defSeiNaluId                  = 0; 
994  Int      defPositionInSeiNalu          = 0; 
995  Bool     defModifyByEncoder            = 0; 
996
997  // Setup config file options
998  po::Options opts;     
999  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder ); 
1000
1001  opts.addOptions()
1002    ("PrecRefDisplayWidth"            , m_precRefDisplayWidth              , 0                              , "PrecRefDisplayWidth"              )
1003    ("RefViewingDistanceFlag"         , m_refViewingDistanceFlag           , false                          , "RefViewingDistanceFlag"           )
1004    ("PrecRefViewingDist"             , m_precRefViewingDist               , 0                              , "PrecRefViewingDist"               )
1005    ("NumRefDisplaysMinus1"           , m_numRefDisplaysMinus1             , 0                              , "NumRefDisplaysMinus1"             )
1006    ("LeftViewId"                     , m_leftViewId                       , IntAry1d (1,0)                 , "LeftViewId"                       )
1007    ("RightViewId"                    , m_rightViewId                      , IntAry1d (1,0)                 , "RightViewId"                      )
1008    ("ExponentRefDisplayWidth"        , m_exponentRefDisplayWidth          , IntAry1d (1,0)                 , "ExponentRefDisplayWidth"          )
1009    ("MantissaRefDisplayWidth"        , m_mantissaRefDisplayWidth          , IntAry1d (1,0)                 , "MantissaRefDisplayWidth"          )
1010    ("ExponentRefViewingDistance"     , m_exponentRefViewingDistance       , IntAry1d (1,0)                 , "ExponentRefViewingDistance"       )
1011    ("MantissaRefViewingDistance"     , m_mantissaRefViewingDistance       , IntAry1d (1,0)                 , "MantissaRefViewingDistance"       )
1012    ("AdditionalShiftPresentFlag"     , m_additionalShiftPresentFlag       , BoolAry1d(1,0)                 , "AdditionalShiftPresentFlag"       )
1013    ("NumSampleShiftPlus512"          , m_numSampleShiftPlus512            , IntAry1d (1,0)                 , "NumSampleShiftPlus512"            )
1014    ("ThreeDimensionalReferenceDisplaysExtensionFlag", m_threeDimensionalReferenceDisplaysExtensionFlag, false                          , "ThreeDimensionalReferenceDisplaysExtensionFlag")
1015    ;
1016
1017  po::setDefaults(opts);
1018
1019  // Parse the cfg file
1020  po::ErrorReporter err;
1021  po::parseConfigFile( opts, cfgFile, err );
1022};
1023
1024
1025UInt SEIThreeDimensionalReferenceDisplaysInfo::getMantissaReferenceDisplayWidthLen( Int i ) const
1026{
1027  return xGetSyntaxElementLen( m_exponentRefDisplayWidth[i], m_precRefDisplayWidth, m_mantissaRefDisplayWidth[ i ] );
1028}
1029
1030UInt SEIThreeDimensionalReferenceDisplaysInfo::getMantissaReferenceViewingDistanceLen( Int i ) const
1031{
1032  return xGetSyntaxElementLen( m_exponentRefViewingDistance[i], m_precRefViewingDist, m_mantissaRefViewingDistance[ i ] );
1033}
1034
1035UInt SEIThreeDimensionalReferenceDisplaysInfo::xGetSyntaxElementLen( Int expo, Int prec, Int val ) const
1036{
1037  UInt len; 
1038  if( expo == 0 )
1039  {
1040    len = std::max(0, prec - 30 );
1041  }
1042  else
1043  {
1044    len = std::max( 0, expo + prec - 31 );
1045  }
1046
1047  assert( val >= 0 ); 
1048  assert( val <= ( ( 1 << len )- 1) );
1049  return len; 
1050}
1051
1052Bool SEIThreeDimensionalReferenceDisplaysInfo::checkCfg( const TComSlice* slice )
1053{ 
1054  // Check config values
1055  Bool wrongConfig = false; 
1056
1057  // The 3D reference display SEI should preferably be sent along with the multiview acquisition SEI. For now the multiview acquisition SEI is restricted to POC = 0, so 3D reference displays SEI is restricted to POC = 0 as well.
1058  xCheckCfg     ( wrongConfig, slice->isIRAP() && (slice->getPOC() == 0)  , "The 3D reference displays SEI message currently is associated with an access unit that contains an IRAP picture." ); 
1059
1060  xCheckCfgRange( wrongConfig, m_precRefDisplayWidth            , 0 , 31, "prec_ref_display_width"  );
1061  xCheckCfgRange( wrongConfig, m_refViewingDistanceFlag         , 0 , 1, "ref_viewing_distance_flag");
1062  xCheckCfgRange( wrongConfig, m_precRefViewingDist             , 0 , 31, "prec_ref_viewing_dist"   );
1063  xCheckCfgRange( wrongConfig, m_numRefDisplaysMinus1           , 0 , 31, "num_ref_displays_minus1" );
1064
1065  for (Int i = 0; i <= getNumRefDisplaysMinus1(); i++ )
1066  { 
1067    xCheckCfgRange( wrongConfig, m_exponentRefDisplayWidth[i]     , 0 , 62, "exponent_ref_display_width"   );
1068    xCheckCfgRange( wrongConfig, m_exponentRefViewingDistance[i]  , 0 , 62, "exponent_ref_viewing_distance");
1069    xCheckCfgRange( wrongConfig, m_additionalShiftPresentFlag[i]  , 0 , 1, "additional_shift_present_flag" );
1070    xCheckCfgRange( wrongConfig, m_numSampleShiftPlus512[i]       , 0 , 1023, "num_sample_shift_plus512"   );
1071  }
1072  xCheckCfgRange( wrongConfig, m_threeDimensionalReferenceDisplaysExtensionFlag, 0 , 1, "three_dimensional_reference_displays_extension_flag");
1073
1074  return wrongConfig; 
1075
1076};
1077
1078#if SEI_DRI_F0169
1079Void SEIDepthRepresentationInfo::setupFromSlice  ( const TComSlice* slice )
1080{
1081
1082    m_currLayerID=slice->getLayerIdInVps();
1083};
1084
1085Void SEIDepthRepresentationInfo::setupFromCfgFile(const Char* cfgFile)
1086{ 
1087    // Set default values
1088    IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes; 
1089
1090    // TBD: Add default values for which layers, POCS, Tids or Nalu types the SEI should be send.
1091    //defAppLayerIds    .push_back( TBD );
1092    defAppPocs        .push_back( 0 );
1093    //defAppTids        .push_back( TBD );
1094    //defAppVclNaluTypes.push_back( TBD );
1095
1096    Int      defSeiNaluId                  = 0; 
1097    Int      defPositionInSeiNalu          = 0; 
1098    Bool     defModifyByEncoder            = true; 
1099
1100    // Setup config file options
1101    po::Options opts; 
1102
1103    xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder ); 
1104
1105    opts.addOptions()
1106        ("ZNear_%d"                      , m_zNear               , std::vector<double>(0,0)       , MAX_NUM_LAYERS , "ZNear"           )
1107        ("ZFar_%d"                       , m_zFar                , std::vector<double>(0,0)       , MAX_NUM_LAYERS , "ZFar"            )
1108        ("DMin_%d"                       , m_dMin                , std::vector<double>(0,0)       , MAX_NUM_LAYERS , "DMin"            )
1109        ("DMax_%d"                       , m_dMax                , std::vector<double>(0,0)       , MAX_NUM_LAYERS , "DMax"            )
1110        ("DepthRepresentationInfoSeiPresentFlag_%d",  m_depthRepresentationInfoSeiPresentFlag, BoolAry1d(1,0), MAX_NUM_LAYERS, "DepthRepresentationInfoSeiPresentFlag")
1111        ("DepthRepresentationType_%d"        , m_depthRepresentationType          , IntAry1d(0,0), MAX_NUM_LAYERS,  "DepthRepresentationType"        )
1112        ("DisparityRefViewId_%d"             , m_disparityRefViewId               ,  IntAry1d(0,0), MAX_NUM_LAYERS,  "DisparityRefViewId"             )
1113        ("DepthNonlinearRepresentationNumMinus1_%d", m_depthNonlinearRepresentationNumMinus1, IntAry1d(0,0), MAX_NUM_LAYERS, "DepthNonlinearRepresentationNumMinus1")
1114        ("DepthNonlinearRepresentationModel_%d"    , m_depth_nonlinear_representation_model ,   IntAry1d(0,0), MAX_NUM_LAYERS, "DepthNonlinearRepresentationModel") ;
1115
1116
1117    po::setDefaults(opts);
1118
1119    // Parse the cfg file
1120    po::ErrorReporter err;
1121    po::parseConfigFile( opts, cfgFile, err );
1122
1123    Bool wrongConfig = false; 
1124
1125    for(int i=0;i<MAX_NUM_LAYERS;i++)
1126    {
1127        if (m_zNear[i].size()>0)
1128            m_zNearFlag.push_back(true);
1129        else
1130            m_zNearFlag.push_back(false);
1131
1132        if (m_zFar[i].size()>0)
1133            m_zFarFlag.push_back(true);
1134        else
1135            m_zFarFlag.push_back(false);
1136
1137        if (m_dMin[i].size()>0)
1138            m_dMinFlag.push_back(true);
1139        else
1140            m_dMinFlag.push_back(false);
1141
1142        if (m_dMax[i].size()>0)
1143            m_dMaxFlag.push_back(true);
1144        else
1145            m_dMaxFlag.push_back(false);
1146
1147
1148        if (m_depthRepresentationInfoSeiPresentFlag[i][0])
1149        {
1150            if ( m_depthRepresentationType[i].size()<=0 )
1151            {
1152                printf("DepthRepresentationType_%d must be present for layer %d\n",i,i );
1153                return;
1154            }
1155
1156            if (  m_depthRepresentationType[i][0]<0 )
1157            {
1158                printf("DepthRepresentationType_%d must be equal to or greater than 0\n",i );
1159                return;
1160            }
1161
1162            if (m_dMinFlag[i] || m_dMaxFlag[i])
1163            {
1164                if (m_disparityRefViewId[i].size()<=0)
1165                {
1166                    printf("DisparityRefViewId_%d must be present for layer %d\n",i,i );
1167                    assert(false);
1168                    return;
1169                }
1170                if (m_disparityRefViewId[i][0]<0)
1171                {
1172                    printf("DisparityRefViewId_%d must be equal to or greater than 0\n",i );
1173                    assert(false);
1174                    return;
1175                }
1176            }
1177
1178            if (m_depthRepresentationType[i][0]==3)
1179            {
1180                if (m_depthNonlinearRepresentationNumMinus1[i].size()<=0)
1181                {
1182                    printf("DepthNonlinearRepresentationNumMinus1_%d must be present for layer %d\n",i,i );
1183                    assert(false);
1184                    return;
1185                }
1186                if (m_depthNonlinearRepresentationNumMinus1[i][0]<0)
1187                {
1188                    printf("DepthNonlinearRepresentationNumMinus1_%d must be equal to or greater than 0\n",i );
1189                    assert(false);
1190                    return;
1191                }
1192
1193                if (m_depth_nonlinear_representation_model[i].size() != m_depthNonlinearRepresentationNumMinus1[i][0]+1)
1194                {
1195                    printf("the number of values in Depth_nonlinear_representation_model must be equal to DepthNonlinearRepresentationNumMinus1+1 in layer %d\n",i );
1196                    assert(false);
1197                    return;
1198                }
1199
1200
1201            }
1202
1203
1204        }
1205
1206
1207   }
1208
1209    assert(m_zNearFlag.size()==MAX_NUM_LAYERS);
1210    assert(m_zFarFlag.size()==MAX_NUM_LAYERS);
1211    assert(m_dMinFlag.size()==MAX_NUM_LAYERS);
1212    assert(m_dMaxFlag.size()==MAX_NUM_LAYERS);
1213}
1214
1215Bool SEIDepthRepresentationInfo::checkCfg( const TComSlice* slice )
1216{ 
1217    // Check config values
1218    Bool wrongConfig = false; 
1219    assert(m_currLayerID>=0);
1220
1221    if (m_depthRepresentationInfoSeiPresentFlag[m_currLayerID][0]==false)
1222    {
1223        printf("DepthRepresentationInfoSeiPresentFlag_%d should be equal to 1 when  ApplicableLayerIds is empty or ApplicableLayerIds contains  %d\n",m_currLayerID,slice->getLayerId());
1224        assert(false);
1225    }
1226    // TBD: Add constraints on presence of SEI here.
1227    xCheckCfg     ( wrongConfig, m_depthRepresentationType[m_currLayerID][0] >=0 , "depth_representation_type must be equal to or greater than 0" );
1228    if ( m_dMaxFlag[m_currLayerID] || m_dMinFlag[m_currLayerID])
1229    {
1230        xCheckCfg( wrongConfig , m_disparityRefViewId[m_currLayerID][0]>=0, "disparity_ref_view_id must be equal to or greater than 0 when d_min or d_max are present"); 
1231    }
1232
1233    if (m_depthRepresentationType[m_currLayerID][0]==3)         
1234    {
1235        xCheckCfg(wrongConfig , m_depthNonlinearRepresentationNumMinus1[m_currLayerID][0]>=0, "depth_nonlinear_representation_num_minus1 must be greater than or equal to 0");
1236
1237        if (m_depthNonlinearRepresentationNumMinus1[m_currLayerID][0]>=0)
1238        {
1239            xCheckCfg( wrongConfig , m_depthNonlinearRepresentationNumMinus1[m_currLayerID][0]+1 == m_depth_nonlinear_representation_model[m_currLayerID].size() ,"the number of values in depth_nonlinear_representation_model must be equal to depth_nonlinear_representation_num_minus1+1");
1240        }
1241
1242    }
1243
1244    return wrongConfig; 
1245}
1246#endif
1247
1248Void SEIMultiviewSceneInfo::setupFromCfgFile(const Char* cfgFile)
1249{ 
1250  // Set default values
1251  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes; 
1252
1253  // TBD: Add default values for which layers, POCS, Tids or Nalu types the SEI should be send.
1254  defAppLayerIds      .clear(); 
1255  defAppPocs          .clear(); 
1256  defAppTids          .push_back( 0 );
1257  defAppVclNaluTypes = IRAP_NAL_UNIT_TYPES;
1258
1259  Int      defSeiNaluId                  = 0; 
1260  Int      defPositionInSeiNalu          = 0; 
1261  Bool     defModifyByEncoder            = false; 
1262
1263  // Setup config file options
1264  po::Options opts;     
1265  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder ); 
1266
1267  opts.addOptions()
1268    ("MinDisparity"                   , m_minDisparity                     , 0                              , "MinDisparity"                     )
1269    ("MaxDisparityRange"              , m_maxDisparityRange                , 0                              , "MaxDisparityRange"                )
1270    ;
1271
1272  po::setDefaults(opts);
1273
1274  // Parse the cfg file
1275  po::ErrorReporter err;
1276  po::parseConfigFile( opts, cfgFile, err ); 
1277};
1278
1279
1280Bool SEIMultiviewSceneInfo::checkCfg( const TComSlice* slice )
1281{ 
1282  // Check config values
1283  Bool wrongConfig = false; 
1284   
1285  xCheckCfg     ( wrongConfig, slice->isIRAP(), "When present, the multiview scene information SEI message shall be associated with an IRAP access unit." );
1286     
1287  xCheckCfgRange( wrongConfig, m_minDisparity              , -1024 , 1023, "min_disparity"                    );
1288  xCheckCfgRange( wrongConfig, m_maxDisparityRange         ,     0 , 2047, "max_disparity_range"              );
1289
1290  return wrongConfig; 
1291
1292};
1293
1294Void SEIMultiviewAcquisitionInfo::setupFromCfgFile(const Char* cfgFile)
1295{ 
1296  // Set default values
1297  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes; 
1298
1299  defAppLayerIds    .clear(); 
1300  defAppPocs        .push_back( 0 );
1301  defAppTids        .push_back( 0 );
1302  defAppVclNaluTypes = IDR_NAL_UNIT_TYPES;
1303 
1304
1305  Int      defSeiNaluId                  = 0; 
1306  Int      defPositionInSeiNalu          = 0; 
1307  Bool     defModifyByEncoder            = false; 
1308
1309  // Setup config file options
1310  po::Options opts;     
1311  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder ); 
1312
1313  opts.addOptions()
1314    ("IntrinsicParamFlag"               , m_intrinsicParamFlag               , false                              , "IntrinsicParamFlag"               )
1315    ("ExtrinsicParamFlag"               , m_extrinsicParamFlag               , false                              , "ExtrinsicParamFlag"               )
1316    ("IntrinsicParamsEqualFlag"         , m_intrinsicParamsEqualFlag         , false                              , "IntrinsicParamsEqualFlag"         )
1317    ("PrecFocalLength"                  , m_precFocalLength                  , 0                                  , "PrecFocalLength"                  )
1318    ("PrecPrincipalPoint"               , m_precPrincipalPoint               , 0                                  , "PrecPrincipalPoint"               )
1319    ("PrecSkewFactor"                   , m_precSkewFactor                   , 0                                  , "PrecSkewFactor"                   )
1320    ("SignFocalLengthX"                 , m_signFocalLengthX                 , BoolAry1d(1,0)                     , "SignFocalLengthX"                 )
1321    ("ExponentFocalLengthX"             , m_exponentFocalLengthX             , IntAry1d (1,0)                     , "ExponentFocalLengthX"             )
1322    ("MantissaFocalLengthX"             , m_mantissaFocalLengthX             , IntAry1d (1,0)                     , "MantissaFocalLengthX"             )
1323    ("SignFocalLengthY"                 , m_signFocalLengthY                 , BoolAry1d(1,0)                     , "SignFocalLengthY"                 )
1324    ("ExponentFocalLengthY"             , m_exponentFocalLengthY             , IntAry1d (1,0)                     , "ExponentFocalLengthY"             )
1325    ("MantissaFocalLengthY"             , m_mantissaFocalLengthY             , IntAry1d (1,0)                     , "MantissaFocalLengthY"             )
1326    ("SignPrincipalPointX"              , m_signPrincipalPointX              , BoolAry1d(1,0)                     , "SignPrincipalPointX"              )
1327    ("ExponentPrincipalPointX"          , m_exponentPrincipalPointX          , IntAry1d (1,0)                     , "ExponentPrincipalPointX"          )
1328    ("MantissaPrincipalPointX"          , m_mantissaPrincipalPointX          , IntAry1d (1,0)                     , "MantissaPrincipalPointX"          )
1329    ("SignPrincipalPointY"              , m_signPrincipalPointY              , BoolAry1d(1,0)                     , "SignPrincipalPointY"              )
1330    ("ExponentPrincipalPointY"          , m_exponentPrincipalPointY          , IntAry1d (1,0)                     , "ExponentPrincipalPointY"          )
1331    ("MantissaPrincipalPointY"          , m_mantissaPrincipalPointY          , IntAry1d (1,0)                     , "MantissaPrincipalPointY"          )
1332    ("SignSkewFactor"                   , m_signSkewFactor                   , BoolAry1d(1,0)                     , "SignSkewFactor"                   )
1333    ("ExponentSkewFactor"               , m_exponentSkewFactor               , IntAry1d (1,0)                     , "ExponentSkewFactor"               )
1334    ("MantissaSkewFactor"               , m_mantissaSkewFactor               , IntAry1d (1,0)                     , "MantissaSkewFactor"               )
1335    ("PrecRotationParam"                , m_precRotationParam                , 0                                  , "PrecRotationParam"                )
1336    ("PrecTranslationParam"             , m_precTranslationParam             , 0                                  , "PrecTranslationParam"             )
1337    ("SignR_%d_%d"                      , m_signR                            , BoolAry1d(3,0) ,MAX_NUM_LAYERS ,3  , "SignR"                            )
1338    ("ExponentR_%d_%d"                  , m_exponentR                        , IntAry1d (3,0) ,MAX_NUM_LAYERS ,3  , "ExponentR"                        )
1339    ("MantissaR_%d_%d"                  , m_mantissaR                        , IntAry1d (3,0) ,MAX_NUM_LAYERS ,3  , "MantissaR"                        )
1340    ("SignT_%d"                         , m_signT                            , BoolAry1d(3,0) ,MAX_NUM_LAYERS     , "SignT"                            )
1341    ("ExponentT_%d"                     , m_exponentT                        , IntAry1d (3,0) ,MAX_NUM_LAYERS     , "ExponentT"                        )
1342    ("MantissaT_%d"                     , m_mantissaT                        , IntAry1d (3,0) ,MAX_NUM_LAYERS     , "MantissaT"                        )
1343    ;
1344
1345  po::setDefaults(opts);
1346
1347  // Parse the cfg file
1348  po::ErrorReporter err;
1349  po::parseConfigFile( opts, cfgFile, err ); 
1350};
1351
1352UInt SEIMultiviewAcquisitionInfo::getMantissaFocalLengthXLen( Int i ) const
1353{
1354  return xGetSyntaxElementLen( m_exponentFocalLengthX[i], m_precFocalLength, m_mantissaFocalLengthX[ i ] );
1355}
1356
1357Bool SEIMultiviewAcquisitionInfo::checkCfg( const TComSlice* slice )
1358{ 
1359  // Check config values
1360  Bool wrongConfig = false; 
1361
1362  // Currently the encoder starts with POC 0 for all layers. The condition on POC 0 should be changed, when this changes.   
1363  xCheckCfg     ( wrongConfig, slice->isIRAP() && (slice->getPOC() == 0)  , "When present, the multiview acquisition information SEI message that applies to the current layer shall be included in an access unit that contains an IRAP picture that is the first picture of a CLVS of the current layer." ); 
1364
1365  xCheckCfgRange( wrongConfig, m_precFocalLength         , 0, 31, "prec_focal_length"         );
1366  xCheckCfgRange( wrongConfig, m_precPrincipalPoint      , 0, 31, "prec_principle_point"      );
1367  xCheckCfgRange( wrongConfig, m_precSkewFactor          , 0, 31, "prec_skew_factor"          );
1368
1369  for (Int i = 0; i <= getNumViewsMinus1(); i++ )
1370  { 
1371    xCheckCfgRange( wrongConfig, m_exponentFocalLengthX    [ i ], 0, 62, "exponent_focal_length_x"   );
1372    xCheckCfgRange( wrongConfig, m_exponentFocalLengthY    [ i ], 0, 62, "exponent_focal_length_y"   );
1373    xCheckCfgRange( wrongConfig, m_exponentPrincipalPointX [ i ], 0, 62, "exponent_principal_point_x");
1374    xCheckCfgRange( wrongConfig, m_exponentPrincipalPointY [ i ], 0, 62, "exponent_principal_point_y");
1375    xCheckCfgRange( wrongConfig, m_exponentSkewFactor      [ i ], 0, 62, "exponent_skew_factor"      );
1376  }
1377
1378  xCheckCfgRange( wrongConfig, m_precRotationParam       , 0, 31, "prec_focal_length"         );
1379  xCheckCfgRange( wrongConfig, m_precTranslationParam    , 0, 31, "prec_focal_length"         );
1380
1381  for (Int i = 0; i <= getNumViewsMinus1(); i++ )
1382  { 
1383    for (Int j = 0; j <= 2; j++)
1384    {
1385      xCheckCfgRange( wrongConfig, m_exponentT[i][j]     , 0, 62, "exponent_skew_factor"      );
1386      for (Int k = 0; k <= 2; k++ )
1387      {       
1388        xCheckCfgRange( wrongConfig, m_exponentR[i][j][k], 0, 62, "exponent_principal_point_y");         
1389      }
1390    }
1391  } 
1392
1393  return wrongConfig; 
1394
1395};
1396
1397UInt SEIMultiviewAcquisitionInfo::getMantissaFocalLengthYLen( Int i ) const
1398{
1399  return xGetSyntaxElementLen( m_exponentFocalLengthY[i], m_precFocalLength, m_mantissaFocalLengthY[ i ]  );
1400}
1401
1402
1403UInt SEIMultiviewAcquisitionInfo::getMantissaPrincipalPointXLen( Int i ) const
1404{
1405  return xGetSyntaxElementLen( m_exponentPrincipalPointX[i], m_precPrincipalPoint, m_mantissaPrincipalPointX[ i ]  );
1406}
1407
1408UInt SEIMultiviewAcquisitionInfo::getMantissaPrincipalPointYLen( Int i ) const
1409{
1410  return xGetSyntaxElementLen( m_exponentPrincipalPointY[i], m_precPrincipalPoint, m_mantissaPrincipalPointY[ i ] );
1411}
1412
1413UInt SEIMultiviewAcquisitionInfo::getMantissaSkewFactorLen( Int i ) const
1414{
1415  return xGetSyntaxElementLen( m_exponentSkewFactor[ i ], m_precSkewFactor, m_mantissaSkewFactor[ i ] );
1416}
1417
1418UInt SEIMultiviewAcquisitionInfo::getMantissaRLen( Int i, Int j, Int k ) const
1419{
1420  return xGetSyntaxElementLen( m_exponentR[ i ][ j ][ k ], m_precRotationParam, m_mantissaR[ i ][ j] [ k ] );
1421}
1422
1423UInt SEIMultiviewAcquisitionInfo::getMantissaTLen( Int i, Int j ) const
1424{
1425  return xGetSyntaxElementLen( m_exponentT[ i ][ j ], m_precTranslationParam, m_mantissaT[ i ][ j ] );
1426}
1427UInt SEIMultiviewAcquisitionInfo::xGetSyntaxElementLen( Int expo, Int prec, Int val ) const
1428{
1429  UInt len; 
1430  if( expo == 0 )
1431  {
1432    len = std::max(0, prec - 30 );
1433  }
1434  else
1435  {
1436    len = std::max( 0, expo + prec - 31 );
1437  }
1438
1439  assert( val >= 0 ); 
1440  assert( val <= ( ( 1 << len )- 1) );
1441  return len; 
1442}
1443
1444Void SEIMultiviewViewPosition::setupFromSlice  ( const TComSlice* slice )
1445{
1446  const TComVPS* vps = slice->getVPS(); 
1447  m_numViewsMinus1 = vps->getNumViews() - 1; 
1448  m_viewPosition.resize( m_numViewsMinus1 + 1 ); 
1449  for (Int i = 0; i <= m_numViewsMinus1; i++ )
1450  {
1451    // Assuming that view ids indicate the position
1452    m_viewPosition[i] = vps->getViewIdVal( i );
1453  }
1454}
1455
1456Void SEIMultiviewViewPosition::setupFromCfgFile(const Char* cfgFile)
1457{ 
1458  // Set default values
1459  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes; 
1460
1461  defAppLayerIds    .push_back( 0 );
1462  defAppPocs        .push_back( 0 );
1463  defAppTids        .push_back( 0 );
1464  defAppVclNaluTypes = IDR_NAL_UNIT_TYPES; 
1465
1466  Int      defSeiNaluId                  = 0; 
1467  Int      defPositionInSeiNalu          = 0; 
1468  Bool     defModifyByEncoder            = true; 
1469
1470  // Setup config file options
1471  po::Options opts;     
1472  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder ); 
1473
1474  opts.addOptions()
1475    ("NumViewsMinus1"         , m_numViewsMinus1                          , 0                       , "NumViewsMinus1")
1476    ("ViewPosition"           , m_viewPosition                            , IntAry1d (1,0)          , "ViewPosition"  ); 
1477  ;
1478
1479  po::setDefaults(opts);
1480
1481  // Parse the cfg file
1482  po::ErrorReporter err;
1483  po::parseConfigFile( opts, cfgFile, err );
1484};
1485
1486Bool SEIMultiviewViewPosition::checkCfg( const TComSlice* slice )
1487{ 
1488  // Check config values
1489  Bool wrongConfig = false; 
1490
1491  // TBD: Add constraints on presence of SEI here.
1492  xCheckCfg     ( wrongConfig, slice->isIRAP() , "When present, the multiview view position SEI message shall be associated with an IRAP access unit."  );
1493
1494  // TBD: Modify constraints according to the SEI semantics.
1495  xCheckCfgRange( wrongConfig, m_numViewsMinus1                 , 0 , 62, "num_views_minus1");
1496  for(Int i = 0; i <= m_numViewsMinus1; i++)
1497  {
1498    xCheckCfgRange( wrongConfig, m_viewPosition[i]                , 0 , 62, "view_position");
1499  }
1500
1501  return wrongConfig; 
1502
1503};
1504
1505#if NH_MV_SEI_TBD
1506Void SEIAlternativeDepthInfo::setupFromSlice  ( const TComSlice* slice )
1507{
1508  sei.m_alternativeDepthInfoCancelFlag =  TBD ;
1509  if( sei.m_alternativeDepthInfoCancelFlag  = =  0 )
1510  {
1511    sei.m_depthType =  TBD ;
1512    if( sei.m_depthType  = =  0 )
1513    {
1514      sei.m_numConstituentViewsGvdMinus1 =  TBD ;
1515      sei.m_depthPresentGvdFlag =  TBD ;
1516      sei.m_zGvdFlag =  TBD ;
1517      sei.m_intrinsicParamGvdFlag =  TBD ;
1518      sei.m_rotationGvdFlag =  TBD ;
1519      sei.m_translationGvdFlag =  TBD ;
1520      if( sei.m_zGvdFlag )
1521      {
1522        for( Int i = 0; i  <=  sei.m_numConstituentViewsGvdMinus1 + 1; i++ )
1523        {
1524          sei.m_signGvdZNearFlag[i] =  TBD ;
1525          sei.m_expGvdZNear[i] =  TBD ;
1526          sei.m_manLenGvdZNearMinus1[i] =  TBD ;
1527          sei.m_manGvdZNear[i] =  TBD ;
1528          sei.m_signGvdZFarFlag[i] =  TBD ;
1529          sei.m_expGvdZFar[i] =  TBD ;
1530          sei.m_manLenGvdZFarMinus1[i] =  TBD ;
1531          sei.m_manGvdZFar[i] =  TBD ;
1532        }
1533      }
1534      if( sei.m_intrinsicParamGvdFlag )
1535      {
1536        sei.m_precGvdFocalLength =  TBD ;
1537        sei.m_precGvdPrincipalPoint =  TBD ;
1538      }
1539      if( sei.m_rotationGvdFlag )
1540      {
1541        sei.m_precGvdRotationParam =  TBD ;
1542      }
1543      if( sei.m_translationGvdFlag )
1544      {
1545        sei.m_precGvdTranslationParam =  TBD ;
1546      }
1547      for( Int i = 0; i  <=  sei.m_numConstituentViewsGvdMinus1 + 1; i++ )
1548      {
1549        if( sei.m_intrinsicParamGvdFlag )
1550        {
1551          sei.m_signGvdFocalLengthX[i] =  TBD ;
1552          sei.m_expGvdFocalLengthX[i] =  TBD ;
1553          sei.m_manGvdFocalLengthX[i] =  TBD ;
1554          sei.m_signGvdFocalLengthY[i] =  TBD ;
1555          sei.m_expGvdFocalLengthY[i] =  TBD ;
1556          sei.m_manGvdFocalLengthY[i] =  TBD ;
1557          sei.m_signGvdPrincipalPointX[i] =  TBD ;
1558          sei.m_expGvdPrincipalPointX[i] =  TBD ;
1559          sei.m_manGvdPrincipalPointX[i] =  TBD ;
1560          sei.m_signGvdPrincipalPointY[i] =  TBD ;
1561          sei.m_expGvdPrincipalPointY[i] =  TBD ;
1562          sei.m_manGvdPrincipalPointY[i] =  TBD ;
1563        }
1564        if( sei.m_rotationGvdFlag )
1565        {
1566          for( Int j = 10; j  <=  3; j++ ) /* row */
1567          {
1568            for( Int k = 10; k  <=  3; k++ )  /* column */
1569            {
1570              sei.m_signGvdR[i][j][k] =  TBD ;
1571              sei.m_expGvdR[i][j][k] =  TBD ;
1572              sei.m_manGvdR[i][j][k] =  TBD ;
1573            }
1574          }
1575        }
1576        if( sei.m_translationGvdFlag )
1577        {
1578          sei.m_signGvdTX[i] =  TBD ;
1579          sei.m_expGvdTX[i] =  TBD ;
1580          sei.m_manGvdTX[i] =  TBD ;
1581        }
1582      }
1583    }
1584    if( sei.m_depthType  = =  1 )
1585    {
1586      sei.m_minOffsetXInt =  TBD ;
1587      sei.m_minOffsetXFrac =  TBD ;
1588      sei.m_maxOffsetXInt =  TBD ;
1589      sei.m_maxOffsetXFrac =  TBD ;
1590      sei.m_offsetYPresentFlag =  TBD ;
1591      if( sei.m_offsetYPresentFlag )
1592      {
1593        sei.m_minOffsetYInt =  TBD ;
1594        sei.m_minOffsetYFrac =  TBD ;
1595        sei.m_maxOffsetYInt =  TBD ;
1596        sei.m_maxOffsetYFrac =  TBD ;
1597      }
1598      sei.m_warpMapSizePresentFlag =  TBD ;
1599      if( sei.m_warpMapSizePresentFlag )
1600      {
1601        sei.m_warpMapWidthMinus2 =  TBD ;
1602        sei.m_warpMapHeightMinus2 =  TBD ;
1603      }
1604    }
1605  }
1606};
1607Void SEIAlternativeDepthInfo::setupFromCfgFile(const Char* cfgFile)
1608{ 
1609  // Set default values
1610  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes; 
1611
1612  defAppLayerIds    .push_back( TBD );
1613  defAppPocs        .push_back( TBD );
1614  defAppTids        .push_back( TBD );
1615  defAppVclNaluTypes.push_back( TBD );
1616
1617  Int      defSeiNaluId                  = 0; 
1618  Int      defPositionInSeiNalu          = 0; 
1619  Bool     defModifyByEncoder            = TBD; 
1620
1621  // Setup config file options
1622  po::Options opts;     
1623  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder ); 
1624
1625  opts.addOptions()
1626    ("AlternativeDepthInfoCancelFlag"   , m_alternativeDepthInfoCancelFlag   , false                            , "AlternativeDepthInfoCancelFlag"   )
1627    ("DepthType"                        , m_depthType                        , 0                                , "DepthType"                        )
1628    ("NumConstituentViewsGvdMinus1"     , m_numConstituentViewsGvdMinus1     , 0                                , "NumConstituentViewsGvdMinus1"     )
1629    ("DepthPresentGvdFlag"              , m_depthPresentGvdFlag              , false                            , "DepthPresentGvdFlag"              )
1630    ("ZGvdFlag"                         , m_zGvdFlag                         , false                            , "ZGvdFlag"                         )
1631    ("IntrinsicParamGvdFlag"            , m_intrinsicParamGvdFlag            , false                            , "IntrinsicParamGvdFlag"            )
1632    ("RotationGvdFlag"                  , m_rotationGvdFlag                  , false                            , "RotationGvdFlag"                  )
1633    ("TranslationGvdFlag"               , m_translationGvdFlag               , false                            , "TranslationGvdFlag"               )
1634    ("SignGvdZNearFlag"                 , m_signGvdZNearFlag                 , BoolAry1d(1,0)                   , "SignGvdZNearFlag"                 )
1635    ("ExpGvdZNear"                      , m_expGvdZNear                      , IntAry1d (1,0)                   , "ExpGvdZNear"                      )
1636    ("ManLenGvdZNearMinus1"             , m_manLenGvdZNearMinus1             , IntAry1d (1,0)                   , "ManLenGvdZNearMinus1"             )
1637    ("ManGvdZNear"                      , m_manGvdZNear                      , IntAry1d (1,0)                   , "ManGvdZNear"                      )
1638    ("SignGvdZFarFlag"                  , m_signGvdZFarFlag                  , BoolAry1d(1,0)                   , "SignGvdZFarFlag"                  )
1639    ("ExpGvdZFar"                       , m_expGvdZFar                       , IntAry1d (1,0)                   , "ExpGvdZFar"                       )
1640    ("ManLenGvdZFarMinus1"              , m_manLenGvdZFarMinus1              , IntAry1d (1,0)                   , "ManLenGvdZFarMinus1"              )
1641    ("ManGvdZFar"                       , m_manGvdZFar                       , IntAry1d (1,0)                   , "ManGvdZFar"                       )
1642    ("PrecGvdFocalLength"               , m_precGvdFocalLength               , 0                                , "PrecGvdFocalLength"               )
1643    ("PrecGvdPrincipalPoint"            , m_precGvdPrincipalPoint            , 0                                , "PrecGvdPrincipalPoint"            )
1644    ("PrecGvdRotationParam"             , m_precGvdRotationParam             , 0                                , "PrecGvdRotationParam"             )
1645    ("PrecGvdTranslationParam"          , m_precGvdTranslationParam          , 0                                , "PrecGvdTranslationParam"          )
1646    ("SignGvdFocalLengthX"              , m_signGvdFocalLengthX              , BoolAry1d(1,0)                   , "SignGvdFocalLengthX"              )
1647    ("ExpGvdFocalLengthX"               , m_expGvdFocalLengthX               , IntAry1d (1,0)                   , "ExpGvdFocalLengthX"               )
1648    ("ManGvdFocalLengthX"               , m_manGvdFocalLengthX               , IntAry1d (1,0)                   , "ManGvdFocalLengthX"               )
1649    ("SignGvdFocalLengthY"              , m_signGvdFocalLengthY              , BoolAry1d(1,0)                   , "SignGvdFocalLengthY"              )
1650    ("ExpGvdFocalLengthY"               , m_expGvdFocalLengthY               , IntAry1d (1,0)                   , "ExpGvdFocalLengthY"               )
1651    ("ManGvdFocalLengthY"               , m_manGvdFocalLengthY               , IntAry1d (1,0)                   , "ManGvdFocalLengthY"               )
1652    ("SignGvdPrincipalPointX"           , m_signGvdPrincipalPointX           , BoolAry1d(1,0)                   , "SignGvdPrincipalPointX"           )
1653    ("ExpGvdPrincipalPointX"            , m_expGvdPrincipalPointX            , IntAry1d (1,0)                   , "ExpGvdPrincipalPointX"            )
1654    ("ManGvdPrincipalPointX"            , m_manGvdPrincipalPointX            , IntAry1d (1,0)                   , "ManGvdPrincipalPointX"            )
1655    ("SignGvdPrincipalPointY"           , m_signGvdPrincipalPointY           , BoolAry1d(1,0)                   , "SignGvdPrincipalPointY"           )
1656    ("ExpGvdPrincipalPointY"            , m_expGvdPrincipalPointY            , IntAry1d (1,0)                   , "ExpGvdPrincipalPointY"            )
1657    ("ManGvdPrincipalPointY"            , m_manGvdPrincipalPointY            , IntAry1d (1,0)                   , "ManGvdPrincipalPointY"            )
1658    ("SignGvdR"                         , m_signGvdR                         , BoolAry1d(1,0)   ,ADDNUM ,ADDNUM , "SignGvdR"                         )
1659    ("ExpGvdR"                          , m_expGvdR                          , IntAry1d (1,0)   ,ADDNUM ,ADDNUM , "ExpGvdR"                          )
1660    ("ManGvdR"                          , m_manGvdR                          , IntAry1d (1,0)   ,ADDNUM ,ADDNUM , "ManGvdR"                          )
1661    ("SignGvdTX"                        , m_signGvdTX                        , BoolAry1d(1,0)                   , "SignGvdTX"                        )
1662    ("ExpGvdTX"                         , m_expGvdTX                         , IntAry1d (1,0)                   , "ExpGvdTX"                         )
1663    ("ManGvdTX"                         , m_manGvdTX                         , IntAry1d (1,0)                   , "ManGvdTX"                         )
1664    ("MinOffsetXInt"                    , m_minOffsetXInt                    , 0                                , "MinOffsetXInt"                    )
1665    ("MinOffsetXFrac"                   , m_minOffsetXFrac                   , 0                                , "MinOffsetXFrac"                   )
1666    ("MaxOffsetXInt"                    , m_maxOffsetXInt                    , 0                                , "MaxOffsetXInt"                    )
1667    ("MaxOffsetXFrac"                   , m_maxOffsetXFrac                   , 0                                , "MaxOffsetXFrac"                   )
1668    ("OffsetYPresentFlag"               , m_offsetYPresentFlag               , false                            , "OffsetYPresentFlag"               )
1669    ("MinOffsetYInt"                    , m_minOffsetYInt                    , 0                                , "MinOffsetYInt"                    )
1670    ("MinOffsetYFrac"                   , m_minOffsetYFrac                   , 0                                , "MinOffsetYFrac"                   )
1671    ("MaxOffsetYInt"                    , m_maxOffsetYInt                    , 0                                , "MaxOffsetYInt"                    )
1672    ("MaxOffsetYFrac"                   , m_maxOffsetYFrac                   , 0                                , "MaxOffsetYFrac"                   )
1673    ("WarpMapSizePresentFlag"           , m_warpMapSizePresentFlag           , false                            , "WarpMapSizePresentFlag"           )
1674    ("WarpMapWidthMinus2"               , m_warpMapWidthMinus2               , 0                                , "WarpMapWidthMinus2"               )
1675    ("WarpMapHeightMinus2"              , m_warpMapHeightMinus2              , 0                                , "WarpMapHeightMinus2"              )
1676    ;
1677
1678  po::setDefaults(opts);
1679
1680  // Parse the cfg file
1681  po::ErrorReporter err;
1682  po::parseConfigFile( opts, cfgFile, err );
1683};
1684
1685Bool SEIAlternativeDepthInfo::checkCfg( const TComSlice* slice )
1686{ 
1687  // Check config values
1688  Bool wrongConfig = false; 
1689
1690  // TBD: Add constraints on presence of SEI here.
1691  xCheckCfg     ( wrongConfig, TBD , "TBD" );
1692  xCheckCfg     ( wrongConfig, TBD , "TBD" );
1693
1694  // TBD: Modify constraints according to the SEI semantics.   
1695  xCheckCfgRange( wrongConfig, m_alternativeDepthInfoCancelFlag , MINVAL , MAXVAL, "alternative_depth_info_cancel_flag");
1696  xCheckCfgRange( wrongConfig, m_depthType                      , MINVAL , MAXVAL, "depth_type"                       );
1697  xCheckCfgRange( wrongConfig, m_numConstituentViewsGvdMinus1   , MINVAL , MAXVAL, "num_constituent_views_gvd_minus1 ");
1698  xCheckCfgRange( wrongConfig, m_depthPresentGvdFlag            , MINVAL , MAXVAL, "depth_present_gvd_flag"           );
1699  xCheckCfgRange( wrongConfig, m_zGvdFlag                       , MINVAL , MAXVAL, "z_gvd_flag"                       );
1700  xCheckCfgRange( wrongConfig, m_intrinsicParamGvdFlag          , MINVAL , MAXVAL, "intrinsic_param_gvd_flag"         );
1701  xCheckCfgRange( wrongConfig, m_rotationGvdFlag                , MINVAL , MAXVAL, "rotation_gvd_flag"                );
1702  xCheckCfgRange( wrongConfig, m_translationGvdFlag             , MINVAL , MAXVAL, "translation_gvd_flag"             );
1703  xCheckCfgRange( wrongConfig, m_signGvdZNearFlag[i]            , MINVAL , MAXVAL, "sign_gvd_z_near_flag"             );
1704  xCheckCfgRange( wrongConfig, m_expGvdZNear[i]                 , MINVAL , MAXVAL, "exp_gvd_z_near"                   );
1705  xCheckCfgRange( wrongConfig, m_manLenGvdZNearMinus1[i]        , MINVAL , MAXVAL, "man_len_gvd_z_near_minus1"        );
1706  xCheckCfgRange( wrongConfig, m_manGvdZNear[i]                 , MINVAL , MAXVAL, "man_gvd_z_near"                   );
1707  xCheckCfgRange( wrongConfig, m_signGvdZFarFlag[i]             , MINVAL , MAXVAL, "sign_gvd_z_far_flag"              );
1708  xCheckCfgRange( wrongConfig, m_expGvdZFar[i]                  , MINVAL , MAXVAL, "exp_gvd_z_far"                    );
1709  xCheckCfgRange( wrongConfig, m_manLenGvdZFarMinus1[i]         , MINVAL , MAXVAL, "man_len_gvd_z_far_minus1"         );
1710  xCheckCfgRange( wrongConfig, m_manGvdZFar[i]                  , MINVAL , MAXVAL, "man_gvd_z_far"                    );
1711  xCheckCfgRange( wrongConfig, m_precGvdFocalLength             , MINVAL , MAXVAL, "prec_gvd_focal_length"            );
1712  xCheckCfgRange( wrongConfig, m_precGvdPrincipalPoint          , MINVAL , MAXVAL, "prec_gvd_principal_point"         );
1713  xCheckCfgRange( wrongConfig, m_precGvdRotationParam           , MINVAL , MAXVAL, "prec_gvd_rotation_param"          );
1714  xCheckCfgRange( wrongConfig, m_precGvdTranslationParam        , MINVAL , MAXVAL, "prec_gvd_translation_param"       );
1715  xCheckCfgRange( wrongConfig, m_signGvdFocalLengthX[i]         , MINVAL , MAXVAL, "sign_gvd_focal_length_x"          );
1716  xCheckCfgRange( wrongConfig, m_expGvdFocalLengthX[i]          , MINVAL , MAXVAL, "exp_gvd_focal_length_x"           );
1717  xCheckCfgRange( wrongConfig, m_manGvdFocalLengthX[i]          , MINVAL , MAXVAL, "man_gvd_focal_length_x"           );
1718  xCheckCfgRange( wrongConfig, m_signGvdFocalLengthY[i]         , MINVAL , MAXVAL, "sign_gvd_focal_length_y"          );
1719  xCheckCfgRange( wrongConfig, m_expGvdFocalLengthY[i]          , MINVAL , MAXVAL, "exp_gvd_focal_length_y"           );
1720  xCheckCfgRange( wrongConfig, m_manGvdFocalLengthY[i]          , MINVAL , MAXVAL, "man_gvd_focal_length_y"           );
1721  xCheckCfgRange( wrongConfig, m_signGvdPrincipalPointX[i]      , MINVAL , MAXVAL, "sign_gvd_principal_point_x"       );
1722  xCheckCfgRange( wrongConfig, m_expGvdPrincipalPointX[i]       , MINVAL , MAXVAL, "exp_gvd_principal_point_x"        );
1723  xCheckCfgRange( wrongConfig, m_manGvdPrincipalPointX[i]       , MINVAL , MAXVAL, "man_gvd_principal_point_x"        );
1724  xCheckCfgRange( wrongConfig, m_signGvdPrincipalPointY[i]      , MINVAL , MAXVAL, "sign_gvd_principal_point_y"       );
1725  xCheckCfgRange( wrongConfig, m_expGvdPrincipalPointY[i]       , MINVAL , MAXVAL, "exp_gvd_principal_point_y"        );
1726  xCheckCfgRange( wrongConfig, m_manGvdPrincipalPointY[i]       , MINVAL , MAXVAL, "man_gvd_principal_point_y"        );
1727  xCheckCfgRange( wrongConfig, m_signGvdR[i][j][k]              , MINVAL , MAXVAL, "sign_gvd_r"                       );
1728  xCheckCfgRange( wrongConfig, m_expGvdR[i][j][k]               , MINVAL , MAXVAL, "exp_gvd_r"                        );
1729  xCheckCfgRange( wrongConfig, m_manGvdR[i][j][k]               , MINVAL , MAXVAL, "man_gvd_r"                        );
1730  xCheckCfgRange( wrongConfig, m_signGvdTX[i]                   , MINVAL , MAXVAL, "sign_gvd_t_x"                     );
1731  xCheckCfgRange( wrongConfig, m_expGvdTX[i]                    , MINVAL , MAXVAL, "exp_gvd_t_x"                      );
1732  xCheckCfgRange( wrongConfig, m_manGvdTX[i]                    , MINVAL , MAXVAL, "man_gvd_t_x"                      );
1733  xCheckCfgRange( wrongConfig, m_minOffsetXInt                  , MINVAL , MAXVAL, "min_offset_x_int"                 );
1734  xCheckCfgRange( wrongConfig, m_minOffsetXFrac                 , MINVAL , MAXVAL, "min_offset_x_frac"                );
1735  xCheckCfgRange( wrongConfig, m_maxOffsetXInt                  , MINVAL , MAXVAL, "max_offset_x_int"                 );
1736  xCheckCfgRange( wrongConfig, m_maxOffsetXFrac                 , MINVAL , MAXVAL, "max_offset_x_frac"                );
1737  xCheckCfgRange( wrongConfig, m_offsetYPresentFlag             , MINVAL , MAXVAL, "offset_y_present_flag"            );
1738  xCheckCfgRange( wrongConfig, m_minOffsetYInt                  , MINVAL , MAXVAL, "min_offset_y_int"                 );
1739  xCheckCfgRange( wrongConfig, m_minOffsetYFrac                 , MINVAL , MAXVAL, "min_offset_y_frac"                );
1740  xCheckCfgRange( wrongConfig, m_maxOffsetYInt                  , MINVAL , MAXVAL, "max_offset_y_int"                 );
1741  xCheckCfgRange( wrongConfig, m_maxOffsetYFrac                 , MINVAL , MAXVAL, "max_offset_y_frac"                );
1742  xCheckCfgRange( wrongConfig, m_warpMapSizePresentFlag         , MINVAL , MAXVAL, "warp_map_size_present_flag"       );
1743  xCheckCfgRange( wrongConfig, m_warpMapWidthMinus2             , MINVAL , MAXVAL, "warp_map_width_minus2"            );
1744  xCheckCfgRange( wrongConfig, m_warpMapHeightMinus2            , MINVAL , MAXVAL, "warp_map_height_minus2"           );
1745
1746  return wrongConfig; 
1747
1748};
1749#endif
1750
1751#endif
Note: See TracBrowser for help on using the repository browser.