source: 3DVCSoftware/trunk/source/Lib/TLibCommon/SEI.cpp

Last change on this file was 1413, checked in by tech, 7 years ago

Merged HTM-16.2-dev@1412

File size: 84.4 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-2017, 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
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 TChar *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";
127    case SEI::FILLER_PAYLOAD:                       return "Filler payload";
128    case SEI::USER_DATA_REGISTERED_ITU_T_T35:       return "User data registered";
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";
132    case SEI::PICTURE_SNAPSHOT:                     return "Picture snapshot";
133    case SEI::PROGRESSIVE_REFINEMENT_SEGMENT_START: return "Progressive refinement segment start";
134    case SEI::PROGRESSIVE_REFINEMENT_SEGMENT_END:   return "Progressive refinement segment end";
135    case SEI::FILM_GRAIN_CHARACTERISTICS:           return "Film grain characteristics";
136    case SEI::POST_FILTER_HINT:                     return "Post filter hint";
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::GREEN_METADATA:                       return "Green metadata information";
142    case SEI::SOP_DESCRIPTION:                      return "Structure of pictures information";
143    case SEI::ACTIVE_PARAMETER_SETS:                return "Active parameter sets";
144    case SEI::DECODING_UNIT_INFO:                   return "Decoding unit information";
145    case SEI::TEMPORAL_LEVEL0_INDEX:                return "Temporal sub-layer zero index";
146    case SEI::DECODED_PICTURE_HASH:                 return "Decoded picture hash";
147    case SEI::SCALABLE_NESTING:                     return "Scalable nesting";
148    case SEI::REGION_REFRESH_INFO:                  return "Region refresh information";
149    case SEI::NO_DISPLAY:                           return "No display";
150    case SEI::TIME_CODE:                            return "Time code";
151    case SEI::MASTERING_DISPLAY_COLOUR_VOLUME:      return "Mastering display colour volume";
152    case SEI::SEGM_RECT_FRAME_PACKING:              return "Segmented rectangular frame packing arrangement";
153    case SEI::TEMP_MOTION_CONSTRAINED_TILE_SETS:    return "Temporal motion constrained tile sets";
154    case SEI::CHROMA_RESAMPLING_FILTER_HINT:        return "Chroma sampling filter hint";
155    case SEI::COLOUR_REMAPPING_INFO:                return "Colour remapping info";
156    case SEI::DEINTERLACE_FIELD_IDENTIFICATION:     return "Deinterlace field identification";
157    case SEI::CONTENT_LIGHT_LEVEL_INFO:             return "Content light level info";
158    case SEI::DEPENDENT_RAP_INDICATION:             return "Dependent RAP indication";
159    case SEI::CODED_REGION_COMPLETION:              return "Coded region completion";
160    case SEI::ALTERNATIVE_TRANSFER_CHARACTERISTICS: return "Alternative transfer characteristics";
161    case SEI::AMBIENT_VIEWING_ENVIRONMENT:          return "Ambient viewing environment";
162
163#if NH_MV
164    case SEI::LAYERS_NOT_PRESENT:                        return "Layers not present";
165    case SEI::INTER_LAYER_CONSTRAINED_TILE_SETS:         return "Inter-layer constrained tile sets";
166    case SEI::BSP_NESTING:                               return "Bitstream partition nesting";
167    case SEI::BSP_INITIAL_ARRIVAL_TIME:                  return "Bitstream partition initial arrival time";
168    case SEI::SUB_BITSTREAM_PROPERTY:                    return "Sub-bitstream property";
169    case SEI::ALPHA_CHANNEL_INFO:                        return "Alpha channel information";
170    case SEI::OVERLAY_INFO:                              return "Overlay information"  ;
171    case SEI::TEMPORAL_MV_PREDICTION_CONSTRAINTS:        return "Temporal motion vector prediction constraints";
172    case SEI::FRAME_FIELD_INFO:                          return "Frame-field information";
173    case SEI::THREE_DIMENSIONAL_REFERENCE_DISPLAYS_INFO: return "3D reference displays information";
174    case SEI::DEPTH_REPRESENTATION_INFO:                 return "Depth representation information";
175    case SEI::MULTIVIEW_SCENE_INFO:                      return "Multiview scene information";
176    case SEI::MULTIVIEW_ACQUISITION_INFO:                return "Multiview acquisition information";
177    case SEI::MULTIVIEW_VIEW_POSITION:                   return "Multiview view position";
178#if NH_3D
179    case SEI::ALTERNATIVE_DEPTH_INFO:                    return "Alternative depth information";
180#endif
181#endif
182    default:                                        return "Unknown";
183  }
184}
185
186#if NH_MV
187SEI::SEI()
188{
189  m_scalNestSeiContThisSei = NULL;
190}
191
192SEI* SEI::getNewSEIMessage(SEI::PayloadType payloadType)
193{
194  switch (payloadType)
195  {
196#if NH_MV_SEI_TBD
197    //////////////////////////////////////////////////////////////////////////
198    // TBD: Modify version 1 SEIs to use the same interfaces as Annex GFI SEI messages.
199    //////////////////////////////////////////////////////////////////////////
200
201    case SEI::BUFFERING_PERIOD:                     return new SEIBufferingPeriod;
202    case SEI::PICTURE_TIMING:                       return new SEIPictureTiming;
203    case SEI::PAN_SCAN_RECT:                        return new SEIPanScanRectangle;                    // not currently decoded
204    case SEI::FILLER_PAYLOAD:                       return new SEIFillerPaylod;                       // not currently decoded
205    case SEI::USER_DATA_REGISTERED_ITU_T_T35:       return new SEIUserDataRegistered;                 // not currently decoded
206    case SEI::USER_DATA_UNREGISTERED:               return new SEIuserDataUnregistered;
207    case SEI::RECOVERY_POINT:                       return new SEIRecoveryPoint;
208    case SEI::SCENE_INFO:                           return new SEISceneInformation;                    // not currently decoded
209    case SEI::FULL_FRAME_SNAPSHOT:                  return new SEIPictureSnapshot;                     // not currently decoded
210    case SEI::PROGRESSIVE_REFINEMENT_SEGMENT_START: return new SEIProgressiveRefinementSegmentStart;   // not currently decoded
211    case SEI::PROGRESSIVE_REFINEMENT_SEGMENT_END:   return new SEIProgressiveRefinementSegmentEnd;     // not currently decoded
212    case SEI::FILM_GRAIN_CHARACTERISTICS:           return new SEIFilmGrainCharacteristics;            // not currently decoded
213    case SEI::POST_FILTER_HINT:                     return new SEIPostFilterHint;                      // not currently decoded
214    case SEI::TONE_MAPPING_INFO:                    return new SEIToneMappingInfo;
215    case SEI::KNEE_FUNCTION_INFO:                   return new SEIKneeFunctionInfo;
216    case SEI::FRAME_PACKING:                        return new SEIFramePacking;
217    case SEI::DISPLAY_ORIENTATION:                  return new SEIDisplayOrientation;
218    case SEI::SOP_DESCRIPTION:                      return new SEISOPDescription;
219    case SEI::ACTIVE_PARAMETER_SETS:                return new SEIActiveParameterSets;
220    case SEI::DECODING_UNIT_INFO:                   return new SEIDecodingUnitInfo;
221    case SEI::TEMPORAL_LEVEL0_INDEX:                return new SEITemporalLevel0Index
222    case SEI::DECODED_PICTURE_HASH:                 return new SEIDecodedPictureHash;
223    case SEI::SCALABLE_NESTING:                     return new SEIScalableNesting;
224    case SEI::REGION_REFRESH_INFO:                  return new SEIRegionRefreshInfo;
225    case SEI::NO_DISPLAY:                           return new SEINoDisplay;
226    case SEI::TIME_CODE:                            return new SEITimeCode;
227    case SEI::MASTERING_DISPLAY_COLOUR_VOLUME:      return new SEIMasteringDisplayColourVolume;
228    case SEI::SEGM_RECT_FRAME_PACKING:              return new SEISegmentedRectFramePacking;
229    case SEI::TEMP_MOTION_CONSTRAINED_TILE_SETS:    return new SEITempMotionConstrainedTileSets;
230    case SEI::CHROMA_SAMPLING_FILTER_HINT:          return new SEIChromaSamplingFilterHint
231#endif
232  case SEI::LAYERS_NOT_PRESENT                    :               return new SEILayersNotPresent;
233  case SEI::INTER_LAYER_CONSTRAINED_TILE_SETS     :               return new SEIInterLayerConstrainedTileSets;
234#if NH_MV_SEI_TBD
235  case SEI::BSP_NESTING                           :               return new SEIBspNesting;
236  case SEI::BSP_INITIAL_ARRIVAL_TIME              :               return new SEIBspInitialArrivalTime;
237#endif
238  case SEI::SUB_BITSTREAM_PROPERTY                :               return new SEISubBitstreamProperty;
239  case SEI::ALPHA_CHANNEL_INFO                    :               return new SEIAlphaChannelInfo;
240  case SEI::OVERLAY_INFO                          :               return new SEIOverlayInfo;
241  case SEI::TEMPORAL_MV_PREDICTION_CONSTRAINTS    :               return new SEITemporalMvPredictionConstraints;
242#if NH_MV_SEI_TBD
243  case SEI::FRAME_FIELD_INFO                      :               return new SEIFrameFieldInfo;
244#endif
245  case SEI::THREE_DIMENSIONAL_REFERENCE_DISPLAYS_INFO:            return new SEIThreeDimensionalReferenceDisplaysInfo;
246  case SEI::DEPTH_REPRESENTATION_INFO             :               return new SEIDepthRepresentationInfo;
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_3D
251  case SEI::ALTERNATIVE_DEPTH_INFO                :               return new SEIAlternativeDepthInfo;
252#endif
253  default:                                        assert( false ); return NULL;
254  }
255}
256
257Void SEI::setupFromSlice  ( const TComSlice* slice )
258{
259  xPrintCfgErrorIntro();
260  std::cout << getSEIMessageString( payloadType() ) << "Setup by the encoder is currently not possible. Using the default SEI cfg-file." << std::endl;
261}
262
263SEI* SEI::getCopy() const
264{
265  assert( 0 );
266  return NULL;
267}
268
269Void SEI::setupFromCfgFile( const TChar* cfgFile )
270{
271  assert( false );
272}
273
274Bool SEI::insertSei( Int curLayerId, Int curPoc, Int curTid, Int curNaluType ) const
275{
276  Bool insertSeiHere = true;
277  if( !m_applicableLayerIds.empty() )
278  {
279    insertSeiHere = insertSeiHere && ( std::find( m_applicableLayerIds.begin(), m_applicableLayerIds.end(), curLayerId) != m_applicableLayerIds.end() ) ;
280  }
281  if( !m_applicablePocs     .empty() )
282  {
283    insertSeiHere = insertSeiHere && ( std::find( m_applicablePocs    .begin(), m_applicablePocs    .end(), curPoc    ) != m_applicablePocs    .end() ) ;
284  }
285  if( !m_applicableTids     .empty() )
286  {
287    insertSeiHere = insertSeiHere && ( std::find( m_applicableTids    .begin(), m_applicableTids    .end(), curTid    ) != m_applicableTids    .end() ) ;
288  }
289  if( !m_applicableVclNaluTypes.empty() )
290  {
291    insertSeiHere = insertSeiHere && ( std::find( m_applicableVclNaluTypes.begin(), m_applicableVclNaluTypes.end(), curNaluType) != m_applicableVclNaluTypes.end() ) ;
292  }
293  return insertSeiHere;
294}
295
296Bool SEI::checkCfg( const TComSlice* slice )
297{
298  assert( false );
299  return true;
300}
301
302Void SEI::xPrintCfgErrorIntro()
303{
304  std::cout << "Error in configuration of " << getSEIMessageString( payloadType() ) << " SEI: ";
305}
306
307Void SEI::xCheckCfgRange( Bool& wrongConfig, Int val, Int minVal, Int maxVal, const TChar* seName )
308{
309  if ( val < minVal || val > maxVal  )
310  {
311    xPrintCfgErrorIntro();
312    std::cout << "The value of " << seName << "shall be in the range of " << minVal << " to " << maxVal << ", inclusive." << std::endl;
313    wrongConfig = true;
314  }
315}
316
317Void SEI::xAddGeneralOpts(po::Options &opts, IntAry1d defAppLayerIds, IntAry1d deftApplicablePocs,
318                                            IntAry1d defAppTids,     IntAry1d defAppVclNaluTypes,
319                                            Int defSeiNaluId, Int defPositionInSeiNalu, Bool defModifyByEncoder)
320{
321  opts.addOptions()
322    ("PayloadType"            , m_payloadType            , -1                    , "Payload Type"                                                         )
323    ("ApplicableLayerIds"     , m_applicableLayerIds     , defAppLayerIds        , "LayerIds      of layers   to which the SEI is added. (all when empty)")
324    ("ApplicablePocs"         , m_applicablePocs         , deftApplicablePocs    , "POCs          of pictures to which the SEI is added. (all when empty)")
325    ("ApplicableTids"         , m_applicableTids         , defAppTids            , "TIds          of pictures to which the SEI is added. (all when empty)")
326    ("ApplicableVclNaluTypes" , m_applicableVclNaluTypes , defAppVclNaluTypes    , "NaluUnitTypes of picture  to which the SEI is added. (all when empty)")
327    ("SeiNaluId"              , m_seiNaluId              , defSeiNaluId          , "Identifies to which NAL unit  the SEI is added." )
328    ("PositionInSeiNalu"      , m_positionInSeiNalu      , defPositionInSeiNalu  , "Identifies the position within the NAL unit.")
329    ("ModifyByEncoder"        , m_modifyByEncoder        , defModifyByEncoder    , "0: Use payload as specified in cfg file   1: Modify SEI by encoder");
330}
331
332Void SEI::xCheckCfg( Bool& wrongConfig, Bool cond, const TChar* errStr )
333{
334  if ( !cond  )
335  {
336    xPrintCfgErrorIntro();
337    std::cout << errStr << std::endl;
338    wrongConfig = true;
339  }
340}
341
342Void SEILayersNotPresent::setupFromCfgFile(const TChar* cfgFile)
343{
344  // Set default values
345  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes;
346
347  // TBD: Add default values for which layers, POCS, Tids or Nalu types the SEI should be send.
348  // 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.
349  defAppLayerIds    .empty( );
350  defAppPocs        .empty( );
351  defAppTids        .empty( );
352  defAppVclNaluTypes.empty( );
353
354  Int      defSeiNaluId                  = 0;
355  Int      defPositionInSeiNalu          = 0;
356  Bool     defModifyByEncoder            = false;   //0: Use payload as specified in cfg file   1: Modify SEI by encoder
357
358  // Setup config file options
359  po::Options opts;
360  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder );
361
362  opts.addOptions()
363    ("LnpSeiActiveVpsId"              , m_lnpSeiActiveVpsId                , 0                              , "LnpSeiActiveVpsId"                )   //Why?
364    ("LayerNotPresentFlag"            , m_layerNotPresentFlag              , BoolAry1d(1,0)                 , "LayerNotPresentFlag"              )
365    ;
366
367  po::setDefaults(opts);
368
369  // Parse the cfg file
370  po::ErrorReporter err;
371  po::parseConfigFile( opts, cfgFile, err );
372  m_lnpSeiMaxLayers = (UInt) m_layerNotPresentFlag.size();
373};
374
375  Bool SEILayersNotPresent::checkCfg( const TComSlice* slice )
376  {
377  // Check config values
378    Bool wrongConfig = false;
379//
380    const TComVPS* vps = slice->getVPS();
381//  // TBD: Add constraints on presence of SEI here.
382    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." );
383    xCheckCfg     ( wrongConfig, m_lnpSeiMaxLayers == vps->getMaxLayersMinus1(), "The number of LayerNotPresent flags shall be equal to vpsMaxLayersMinus1." );
384
385
386    for (Int i = 0; i < vps->getMaxLayersMinus1(); i++)
387    {
388      if ( m_layerNotPresentFlag[ i ] && i < vps->getMaxLayersMinus1() )
389      {
390        for (Int j = 0; j < vps->getNumPredictedLayers( vps->getLayerIdInNuh( j ) - 1 ); j++ )
391        {
392          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." );
393        }
394      }
395    }
396
397      return wrongConfig;
398  };
399
400
401
402Void SEIInterLayerConstrainedTileSets::setupFromCfgFile(const TChar* cfgFile)
403{
404  // Set default values
405  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes;
406
407  // TBD: Add default values for which layers, POCS, Tids or Nalu types the SEI should be send.
408  defAppLayerIds    .empty( );
409  defAppPocs        .push_back( 0 );
410  defAppTids        .empty( );
411  defAppVclNaluTypes.empty( );
412
413  Int      defSeiNaluId                  = 0;
414  Int      defPositionInSeiNalu          = 0;
415  Bool     defModifyByEncoder            = false;
416
417  // Setup config file options
418  po::Options opts;
419  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder );
420
421  const Int maxNumTileInSet = 100;
422
423  opts.addOptions()
424    ("IlAllTilesExactSampleValueMatchFlag", m_ilAllTilesExactSampleValueMatchFlag, false                    , "IlAllTilesExactSampleValueMatchFlag")
425    ("IlOneTilePerTileSetFlag"        , m_ilOneTilePerTileSetFlag          , false                          , "IlOneTilePerTileSetFlag"          )
426    ("IlNumSetsInMessageMinus1"       , m_ilNumSetsInMessageMinus1         , 0                              , "IlNumSetsInMessageMinus1"         )
427    ("SkippedTileSetPresentFlag"      , m_skippedTileSetPresentFlag        , false                          , "SkippedTileSetPresentFlag"        )
428    ("IlctsId"                        , m_ilctsId                          , IntAry1d (256,0)               , "IlctsId"                          )
429    ("IlNumTileRectsInSetMinus1"      , m_ilNumTileRectsInSetMinus1        , IntAry1d (256,0)               , "IlNumTileRectsInSetMinus1"        )
430    ("IlTopLeftTileIndex_%d"          , m_ilTopLeftTileIndex               , IntAry1d (maxNumTileInSet,0), 256, "IlTopLeftTileIndex"               )
431    ("IlBottomRightTileIndex_%d"      , m_ilBottomRightTileIndex           , IntAry1d (maxNumTileInSet,0), 256, "IlBottomRightTileIndex"           )
432    ("IlcIdc"                         , m_ilcIdc                           , IntAry1d (256,0)               , "IlcIdc"                           )
433    ("IlExactSampleValueMatchFlag"    , m_ilExactSampleValueMatchFlag      , BoolAry1d(256,0)               , "IlExactSampleValueMatchFlag"      )
434    ("AllTilesIlcIdc"                 , m_allTilesIlcIdc                   , 0                              , "AllTilesIlcIdc"                   )
435    ;
436
437  po::setDefaults(opts);
438
439  // Parse the cfg file
440  po::ErrorReporter err;
441  po::parseConfigFile( opts, cfgFile, err );
442};
443
444Bool SEIInterLayerConstrainedTileSets::checkCfg( const TComSlice* slice )
445{
446  // Check config values
447  Bool wrongConfig = false;
448  const TComPPS* pps = slice->getPPS();
449
450  // Currently only the active PPS checked.
451  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." );
452
453  if ( m_ilOneTilePerTileSetFlag )
454  {
455    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."    );
456  }
457  Int numSignificantSets = m_ilNumSetsInMessageMinus1 - m_skippedTileSetPresentFlag + 1;
458
459  for (Int i = 0 ; i < numSignificantSets; i++)
460  {
461    xCheckCfgRange( wrongConfig, m_ilctsId[i]                         , 0 , (1 << 30) - 1, "ilcts_id"                         );
462  }
463
464  return wrongConfig;
465};
466#if NH_MV_SEI_TBD
467
468Void SEIBspNesting::setupFromSlice  ( const TComSlice* slice )
469{
470  sei.m_seiOlsIdx =  TBD ;
471  sei.m_seiPartitioningSchemeIdx =  TBD ;
472  sei.m_bspIdx =  TBD ;
473  while( !ByteaLigned(() ) );
474  {
475    sei.m_bspNestingZeroBit =  TBD ;
476  }
477  sei.m_numSeisInBspMinus1 =  TBD ;
478  for( Int i = 0; i  <=  NumSeisInBspMinus1( ); i++ )
479  {
480    SeiMessage(() );
481  }
482};
483
484Void SEIBspNesting::setupFromCfgFile(const TChar* cfgFile)
485{
486  // Set default values
487  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes;
488
489  // TBD: Add default values for which layers, POCS, Tids or Nalu types the SEI should be send.
490  defAppLayerIds    .push_back( TBD );
491  defAppPocs        .push_back( TBD );
492  defAppTids        .push_back( TBD );
493  defAppVclNaluTypes.push_back( TBD );
494
495  Int      defSeiNaluId                  = 0;
496  Int      defPositionInSeiNalu          = 0;
497  Bool     defModifyByEncoder            = TBD;
498
499  // Setup config file options
500  po::Options opts;
501  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder );
502
503  opts.addOptions()
504    ("SeiOlsIdx"                      , m_seiOlsIdx                        , 0                              , "SeiOlsIdx"                        )
505    ("SeiPartitioningSchemeIdx"       , m_seiPartitioningSchemeIdx         , 0                              , "SeiPartitioningSchemeIdx"         )
506    ("BspIdx"                         , m_bspIdx                           , 0                              , "BspIdx"                           )
507    ("BspNestingZeroBit"              , m_bspNestingZeroBit                , 0                              , "BspNestingZeroBit"                )
508    ("NumSeisInBspMinus1"             , m_numSeisInBspMinus1               , 0                              , "NumSeisInBspMinus1"               )
509    ;
510
511  po::setDefaults(opts);
512
513  // Parse the cfg file
514  po::ErrorReporter err;
515  po::parseConfigFile( opts, cfgFile, err );
516};
517
518Bool SEIBspNesting::checkCfg( const TComSlice* slice )
519{
520  // Check config values
521  Bool wrongConfig = false;
522
523  // TBD: Add constraints on presence of SEI here.
524  xCheckCfg     ( wrongConfig, TBD , "TBD" );
525  xCheckCfg     ( wrongConfig, TBD , "TBD" );
526
527  // TBD: Modify constraints according to the SEI semantics.
528  xCheckCfgRange( wrongConfig, m_seiOlsIdx                      , MINVAL , MAXVAL, "sei_ols_idx"          );
529  xCheckCfgRange( wrongConfig, m_seiPartitioningSchemeIdx       , MINVAL , MAXVAL, "sei_partitioning_scheme_idx"       );
530  xCheckCfgRange( wrongConfig, m_bspIdx                         , MINVAL , MAXVAL, "bsp_idx"              );
531  xCheckCfgRange( wrongConfig, m_bspNestingZeroBit              , MINVAL , MAXVAL, "bsp_nesting_zero_bit ");
532  xCheckCfgRange( wrongConfig, m_numSeisInBspMinus1             , MINVAL , MAXVAL, "num_seis_in_bsp_minus1"           );
533
534  return wrongConfig;
535
536};
537
538Void SEIBspInitialArrivalTime::setupFromSlice  ( const TComSlice* slice )
539{
540  psIdx = SeiPartitioningSchemeIdx();
541  if( nalInitialArrivalDelayPresent )
542  {
543    for( Int i = 0; i < BspSchedCnt( SeiOlsIdx(), psIdx, MaxTemporalId( 0 ) ); i++ )
544    {
545      sei.m_nalInitialArrivalDelay[i] =  TBD ;
546    }
547  }
548  if( vclInitialArrivalDelayPresent )
549  {
550    for( Int i = 0; i < BspSchedCnt( SeiOlsIdx(), psIdx, MaxTemporalId( 0 ) ); i++ )
551    {
552      sei.m_vclInitialArrivalDelay[i] =  TBD ;
553    }
554  }
555};
556
557Void SEIBspInitialArrivalTime::setupFromCfgFile(const TChar* cfgFile)
558{
559  // Set default values
560  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes;
561
562  // TBD: Add default values for which layers, POCS, Tids or Nalu types the SEI should be send.
563  defAppLayerIds    .push_back( TBD );
564  defAppPocs        .push_back( TBD );
565  defAppTids        .push_back( TBD );
566  defAppVclNaluTypes.push_back( TBD );
567
568  Int      defSeiNaluId                  = 0;
569  Int      defPositionInSeiNalu          = 0;
570  Bool     defModifyByEncoder            = TBD;
571
572  // Setup config file options
573  po::Options opts;
574  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder );
575
576  opts.addOptions()
577    ("NalInitialArrivalDelay"         , m_nalInitialArrivalDelay           , IntAry1d (1,0)                 , "NalInitialArrivalDelay"           )
578    ("VclInitialArrivalDelay"         , m_vclInitialArrivalDelay           , IntAry1d (1,0)                 , "VclInitialArrivalDelay"           )
579    ;
580
581  po::setDefaults(opts);
582
583  // Parse the cfg file
584  po::ErrorReporter err;
585  po::parseConfigFile( opts, cfgFile, err );
586};
587
588Bool SEIBspInitialArrivalTime::checkCfg( const TComSlice* slice )
589{
590  // Check config values
591  Bool wrongConfig = false;
592
593  // TBD: Add constraints on presence of SEI here.
594  xCheckCfg     ( wrongConfig, TBD , "TBD" );
595  xCheckCfg     ( wrongConfig, TBD , "TBD" );
596
597  // TBD: Modify constraints according to the SEI semantics.
598  xCheckCfgRange( wrongConfig, m_nalInitialArrivalDelay[i]      , MINVAL , MAXVAL, "nal_initial_arrival_delay"        );
599  xCheckCfgRange( wrongConfig, m_vclInitialArrivalDelay[i]      , MINVAL , MAXVAL, "vcl_initial_arrival_delay"        );
600
601  return wrongConfig;
602
603};
604#endif
605
606Void SEISubBitstreamProperty::setupFromCfgFile(const TChar* cfgFile)
607{
608  // Set default values
609  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes;
610
611  // TBD: Add default values for which layers, POCS, Tids or Nalu types the SEI should be send.
612  defAppLayerIds    .push_back( 0 );
613  defAppPocs        .push_back( 0 );
614  defAppTids        .push_back( 0 );
615  defAppVclNaluTypes = IRAP_NAL_UNIT_TYPES;
616
617  Int      defSeiNaluId                  = 0;
618  Int      defPositionInSeiNalu          = 0;
619  Bool     defModifyByEncoder            = false;
620
621  // Setup config file options
622  po::Options opts;
623  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder );
624
625  opts.addOptions()
626    ("SbPropertyActiveVpsId"          , m_sbPropertyActiveVpsId            , 0                              , "SbPropertyActiveVpsId"            )
627    ("NumAdditionalSubStreamsMinus1"  , m_numAdditionalSubStreamsMinus1    , 0                              , "NumAdditionalSubStreamsMinus1"    )
628    ("SubBitstreamMode"               , m_subBitstreamMode                 , IntAry1d (1,0)                 , "SubBitstreamMode"                 )
629    ("OlsIdxToVps"                    , m_olsIdxToVps                      , IntAry1d (1,0)                 , "OlsIdxToVps"                      )
630    ("HighestSublayerId"              , m_highestSublayerId                , IntAry1d (1,0)                 , "HighestSublayerId"                )
631    ("AvgSbPropertyBitRate"           , m_avgSbPropertyBitRate             , IntAry1d (1,0)                 , "AvgSbPropertyBitRate"             )
632    ("MaxSbPropertyBitRate"           , m_maxSbPropertyBitRate             , IntAry1d (1,0)                 , "MaxSbPropertyBitRate"             )
633    ;
634
635  po::setDefaults(opts);
636
637  // Parse the cfg file
638  po::ErrorReporter err;
639  po::parseConfigFile( opts, cfgFile, err );
640};
641
642Bool SEISubBitstreamProperty::checkCfg( const TComSlice* slice )
643{
644  // Check config values
645  Bool wrongConfig = false;
646
647  // For the current encoder, the initial IRAP access unit has always POC zero.
648  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.");
649
650  Bool sizeNotCorrect =
651    (    ( m_numAdditionalSubStreamsMinus1 + 1 ) != m_subBitstreamMode    .size() )
652    || ( ( m_numAdditionalSubStreamsMinus1 + 1 ) != m_olsIdxToVps         .size() )
653    || ( ( m_numAdditionalSubStreamsMinus1 + 1 ) != m_highestSublayerId   .size() )
654    || ( ( m_numAdditionalSubStreamsMinus1 + 1 ) != m_avgSbPropertyBitRate.size() )
655    || ( ( m_numAdditionalSubStreamsMinus1 + 1 ) != m_maxSbPropertyBitRate.size() );
656
657  xCheckCfg( wrongConfig, !sizeNotCorrect, "Some parameters of some sub-bitstream not provided." );
658  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." );
659
660  xCheckCfgRange( wrongConfig, m_numAdditionalSubStreamsMinus1  , 0 , (1 << 10) - 1 , "num_additional_sub_streams_minus1");
661
662  if ( !sizeNotCorrect )
663  {
664    for (Int i = 0; i <= m_numAdditionalSubStreamsMinus1; i++ )
665    {
666      xCheckCfgRange( wrongConfig, m_subBitstreamMode[i]    , 0 , 1                                          , "sub_bitstream_mode" );
667      xCheckCfgRange( wrongConfig, m_olsIdxToVps[i]         , 0 , slice->getVPS()->getNumOutputLayerSets()-1 , "ols_idx_to_vps"     );
668    }
669  }
670  return wrongConfig;
671};
672
673Void SEISubBitstreamProperty::resizeArrays( )
674{
675  m_subBitstreamMode    .resize( m_numAdditionalSubStreamsMinus1 + 1);
676  m_olsIdxToVps         .resize( m_numAdditionalSubStreamsMinus1 + 1);
677  m_highestSublayerId   .resize( m_numAdditionalSubStreamsMinus1 + 1);
678  m_avgSbPropertyBitRate.resize( m_numAdditionalSubStreamsMinus1 + 1);
679  m_maxSbPropertyBitRate.resize( m_numAdditionalSubStreamsMinus1 + 1);
680}
681
682Void SEIAlphaChannelInfo::setupFromCfgFile(const TChar* cfgFile)
683{
684  // Set default values
685  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes;
686
687  // TBD: Add default values for which layers, POCS, Tids or Nalu types the SEI should be send.
688  defAppLayerIds    .clear();
689  defAppPocs        .push_back( 0 );
690  defAppTids        .push_back( 0 );
691  defAppVclNaluTypes = IDR_NAL_UNIT_TYPES;
692
693  Int      defSeiNaluId                  = 0;
694  Int      defPositionInSeiNalu          = 0;
695  Bool     defModifyByEncoder            = false;
696
697  // Setup config file options
698  po::Options opts;
699  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder );
700
701  opts.addOptions()
702    ("AlphaChannelCancelFlag"         , m_alphaChannelCancelFlag           , false                          , "AlphaChannelCancelFlag"           )
703    ("AlphaChannelUseIdc"             , m_alphaChannelUseIdc               , 0                              , "AlphaChannelUseIdc"               )
704    ("AlphaChannelBitDepthMinus8"     , m_alphaChannelBitDepthMinus8       , 0                              , "AlphaChannelBitDepthMinus8"       )
705    ("AlphaTransparentValue"          , m_alphaTransparentValue            , 0                              , "AlphaTransparentValue"            )
706    ("AlphaOpaqueValue"               , m_alphaOpaqueValue                 , 255                            , "AlphaOpaqueValue"                 )
707    ("AlphaChannelIncrFlag"           , m_alphaChannelIncrFlag             , false                          , "AlphaChannelIncrFlag"             )
708    ("AlphaChannelClipFlag"           , m_alphaChannelClipFlag             , false                          , "AlphaChannelClipFlag"             )
709    ("AlphaChannelClipTypeFlag"       , m_alphaChannelClipTypeFlag         , false                          , "AlphaChannelClipTypeFlag"         )
710    ;
711
712  po::setDefaults(opts);
713
714  // Parse the cfg file
715  po::ErrorReporter err;
716  po::parseConfigFile( opts, cfgFile, err );
717
718};
719
720Bool SEIAlphaChannelInfo::checkCfg( const TComSlice* slice )
721{
722  // Check config values
723  Bool wrongConfig = false;
724
725  int maxInterpretationValue = (1 << (m_alphaChannelBitDepthMinus8+9)) - 1;
726  xCheckCfgRange( wrongConfig, m_alphaChannelCancelFlag         , 0 , 1, "alpha_channel_cancel_flag"        );
727  xCheckCfgRange( wrongConfig, m_alphaChannelUseIdc             , 0 , 7, "alpha_channel_use_idc");
728  xCheckCfgRange( wrongConfig, m_alphaChannelBitDepthMinus8     , 0 , 7, "alpha_channel_bit_depth_minus8"   );
729  xCheckCfgRange( wrongConfig, m_alphaTransparentValue          , 0 , maxInterpretationValue, "alpha_transparent_value"          );
730  xCheckCfgRange( wrongConfig, m_alphaOpaqueValue               , 0 , maxInterpretationValue, "alpha_opaque_value"   );
731  xCheckCfgRange( wrongConfig, m_alphaChannelIncrFlag           , 0 , 1, "alpha_channel_incr_flag"          );
732  xCheckCfgRange( wrongConfig, m_alphaChannelClipFlag           , 0 , 1, "alpha_channel_clip_flag"          );
733  xCheckCfgRange( wrongConfig, m_alphaChannelClipTypeFlag       , 0 , 1, "alpha_channel_clip_type_flag"     );
734
735  return wrongConfig;
736
737};
738
739SEIOverlayInfo::SEIOverlayInfo ( )
740  : m_numOverlaysMax(16)
741  , m_numOverlayElementsMax(256)
742  , m_numStringBytesMax(256) //incl. null termination byte
743{ };
744
745Void SEIOverlayInfo::setupFromCfgFile(const TChar* cfgFile)
746{
747  // Set default values
748  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes;
749
750  // Add default values for which layers, POCS, Tids or Nalu types the SEI should be send.
751  defAppLayerIds    .clear();
752  defAppPocs        .push_back( 0 );
753  defAppTids        .push_back( 0 );
754  defAppVclNaluTypes = IDR_NAL_UNIT_TYPES;
755
756  Int      defSeiNaluId                  = 0;
757  Int      defPositionInSeiNalu          = 0;
758  Bool     defModifyByEncoder            = false;
759
760  // Setup config file options
761  po::Options opts;
762  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder );
763
764  opts.addOptions()
765    ("OverlayInfoCancelFlag"          , m_overlayInfoCancelFlag            , false                           , "OverlayInfoCancelFlag"            )
766    ("OverlayContentAuxIdMinus128"    , m_overlayContentAuxIdMinus128      , 0                               , "OverlayContentAuxIdMinus128"      )
767    ("OverlayLabelAuxIdMinus128"      , m_overlayLabelAuxIdMinus128        , 0                               , "OverlayLabelAuxIdMinus128"        )
768    ("OverlayAlphaAuxIdMinus128"      , m_overlayAlphaAuxIdMinus128        , 0                               , "OverlayAlphaAuxIdMinus128"        )
769    ("OverlayElementLabelValueLengthMinus8", m_overlayElementLabelValueLengthMinus8, 0                       , "OverlayElementLabelValueLengthMinus8")
770    ("NumOverlaysMinus1"              , m_numOverlaysMinus1                , 0                               , "NumOverlaysMinus1"                )
771    ("OverlayIdx"                     , m_overlayIdx                       , IntAry1d (16,0)                 , "OverlayIdx"                       )
772    ("LanguageOverlayPresentFlag"     , m_languageOverlayPresentFlag       , BoolAry1d(16,0)                 , "LanguageOverlayPresentFlag"       )
773    ("OverlayContentLayerId"          , m_overlayContentLayerId            , IntAry1d (16,0)                 , "OverlayContentLayerId"            )
774    ("OverlayLabelPresentFlag"        , m_overlayLabelPresentFlag          , BoolAry1d(16,0)                 , "OverlayLabelPresentFlag"          )
775    ("OverlayLabelLayerId"            , m_overlayLabelLayerId              , IntAry1d (16,0)                 , "OverlayLabelLayerId"              )
776    ("OverlayAlphaPresentFlag"        , m_overlayAlphaPresentFlag          , BoolAry1d(16,0)                 , "OverlayAlphaPresentFlag"          )
777    ("OverlayAlphaLayerId"            , m_overlayAlphaLayerId              , IntAry1d (16,0)                 , "OverlayAlphaLayerId"              )
778    ("NumOverlayElementsMinus1"       , m_numOverlayElementsMinus1         , IntAry1d (16,0)                 , "NumOverlayElementsMinus1"         )
779    ("OverlayElementLabelMin_%d"      , m_overlayElementLabelMin           , IntAry1d (256,0) ,16            , "OverlayElementLabelMin"           )
780    ("OverlayElementLabelMax_%d"      , m_overlayElementLabelMax           , IntAry1d (256,0) ,16            , "OverlayElementLabelMax"           )
781    ("OverlayLanguage_%d"             , m_overlayLanguage                  , std::string(""), 16             , "OverlayLanguage"                  )
782    ("OverlayName_%d"                 , m_overlayName                      , std::string(""), 16             , "OverlayName"                      )
783    ("OverlayElementName_%d_%d"       , m_overlayElementName               , std::string(""), 256 ,16        , "OverlayElementName"               )
784    ("OverlayInfoPersistenceFlag"     , m_overlayInfoPersistenceFlag       , false                           , "OverlayInfoPersistenceFlag"       )
785    ;
786
787  po::setDefaults(opts);
788
789  // Parse the cfg file
790  po::ErrorReporter err;
791  po::parseConfigFile( opts, cfgFile, err );
792};
793
794
795Bool SEIOverlayInfo::checkCfg( const TComSlice* slice )
796{
797  // Check config values
798  Bool wrongConfig = false;
799
800  xCheckCfgRange( wrongConfig, m_overlayInfoCancelFlag          , 0 ,   1, "overlay_info_cancel_flag"         );
801  xCheckCfgRange( wrongConfig, m_overlayContentAuxIdMinus128    , 0 ,  31, "overlay_content_aux_id_minus128"  );
802  xCheckCfgRange( wrongConfig, m_overlayLabelAuxIdMinus128      , 0 ,  31, "overlay_label_aux_id_minus128"    );
803  xCheckCfgRange( wrongConfig, m_overlayAlphaAuxIdMinus128      , 0 ,  31, "overlay_alpha_aux_id_minus128"    );
804  xCheckCfgRange( wrongConfig, m_numOverlaysMinus1              , 0 ,  m_numOverlaysMax-1, "num_overlays_minus1"  );
805  for (Int i=0 ; i<=m_numOverlaysMinus1 ; ++i)
806  {
807    xCheckCfgRange( wrongConfig, m_overlayIdx[i]                  , 0 , 255, "overlay_idx"          );
808    xCheckCfgRange( wrongConfig, m_languageOverlayPresentFlag[i]  , 0 ,   1, "language_overlay_present_flag"    );
809    xCheckCfgRange( wrongConfig, m_overlayLabelPresentFlag[i]     , 0 ,   1, "overlay_label_present_flag"       );
810    xCheckCfgRange( wrongConfig, m_overlayAlphaPresentFlag[i]     , 0 ,   1, "overlay_alpha_present_flag"       );
811    xCheckCfgRange( wrongConfig, m_overlayContentLayerId[i]       , 0 ,   63, "overlay_content_layer_id"    );
812    xCheckCfgRange( wrongConfig, m_overlayLabelLayerId[i]         , 0 ,   63, "overlay_label_layer_id"    );
813    xCheckCfgRange( wrongConfig, m_overlayAlphaLayerId[i]         , 0 ,   63, "overlay_alpha_layer_id"    );
814    xCheckCfgRange( wrongConfig, m_numOverlayElementsMinus1[i]    , 0 , m_numOverlayElementsMax-1, "num_overlay_elements_minus1"       );
815    for (Int j=0 ; j<=m_numOverlayElementsMinus1[i] ; ++j)
816    {
817      Int maxLabelMinMaxValue = ( 1 << ( m_overlayElementLabelValueLengthMinus8 + 8 ) )-1;
818      xCheckCfgRange( wrongConfig, m_overlayElementLabelMin[i][j] , 0 , maxLabelMinMaxValue , "overlay_element_label_min"    );
819      xCheckCfgRange( wrongConfig, m_overlayElementLabelMax[i][j] , 0 , maxLabelMinMaxValue , "overlay_element_label_max"    );
820    }
821  }
822  xCheckCfgRange( wrongConfig, m_overlayInfoPersistenceFlag     , 0 ,   1, "overlay_info_persistence_flag"    );
823
824  return wrongConfig;
825
826};
827
828
829Void SEITemporalMvPredictionConstraints::setupFromCfgFile(const TChar* cfgFile)
830{
831  // Set default values
832  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes;
833
834  // TBD: Add default values for which layers, POCS, Tids or Nalu types the SEI should be send.
835  defAppLayerIds    .clear    (   );
836  defAppPocs        .push_back( 0 );
837  defAppTids        .push_back( 0 );
838  defAppVclNaluTypes.clear    (   );
839
840  Int      defSeiNaluId                  = 0;
841  Int      defPositionInSeiNalu          = 0;
842  Bool     defModifyByEncoder            = false;
843
844  // Setup config file options
845  po::Options opts;
846  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder );
847
848  opts.addOptions()
849    ("PrevPicsNotUsedFlag"   , m_prevPicsNotUsedFlag   , false, "PrevPicsNotUsedFlag"    )
850    ("NoIntraLayerColPicFlag", m_noIntraLayerColPicFlag, false, "NoIntraLayerColPicFlag" )
851    ;
852
853  po::setDefaults(opts);
854
855  // Parse the cfg file
856  po::ErrorReporter err;
857  po::parseConfigFile( opts, cfgFile, err );
858};
859
860Bool SEITemporalMvPredictionConstraints::checkCfg( const TComSlice* slice )
861{
862  // Check config values
863  Bool wrongConfig = false;
864
865  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." );
866
867  return wrongConfig;
868};
869
870#if NH_MV_SEI_TBD
871Void SEIFrameFieldInfo::setupFromCfgFile(const TChar* cfgFile)
872{
873  // Set default values
874  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes;
875
876  // TBD: Add default values for which layers, POCS, Tids or Nalu types the SEI should be send.
877  defAppLayerIds    .push_back( TBD );
878  defAppPocs        .push_back( TBD );
879  defAppTids        .push_back( TBD );
880  defAppVclNaluTypes.push_back( TBD );
881
882  Int      defSeiNaluId                  = 0;
883  Int      defPositionInSeiNalu          = 0;
884  Bool     defModifyByEncoder            = false;
885
886  // Setup config file options
887  po::Options opts;
888  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder );
889
890  opts.addOptions()
891    ("FfinfoPicStruct"     , m_ffinfoPicStruct     , 0     , "FfinfoPicStruct"     )
892    ("FfinfoSourceScanType", m_ffinfoSourceScanType, 0     , "FfinfoSourceScanType")
893    ("FfinfoDuplicateFlag" , m_ffinfoDuplicateFlag , false , "FfinfoDuplicateFlag" )
894    ;
895
896  po::setDefaults(opts);
897
898  // Parse the cfg file
899  po::ErrorReporter err;
900  po::parseConfigFile( opts, cfgFile, err );
901};
902
903
904Bool SEIFrameFieldInfo::checkCfg( const TComSlice* slice )
905{
906  // Check config values
907  Bool wrongConfig = false;
908
909  // TBD: Add constraints on presence of SEI here.
910  xCheckCfg     ( wrongConfig, TBD , "TBD" );
911  xCheckCfg     ( wrongConfig, TBD , "TBD" );
912
913  // TBD: Modify constraints according to the SEI semantics.
914  xCheckCfgRange( wrongConfig, m_ffinfoPicStruct                , MINVAL , MAXVAL, "ffinfo_pic_struct"                );
915  xCheckCfgRange( wrongConfig, m_ffinfoSourceScanType           , MINVAL , MAXVAL, "ffinfo_source_scan_type"          );
916  xCheckCfgRange( wrongConfig, m_ffinfoDuplicateFlag            , MINVAL , MAXVAL, "ffinfo_duplicate_flag"            );
917
918  return wrongConfig;
919
920};
921#endif
922
923Void SEIThreeDimensionalReferenceDisplaysInfo::setupFromCfgFile(const TChar* cfgFile)
924{
925  // Set default values
926  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes;
927
928  // Default values for which layers, POCS, Tids or Nalu types the SEI should be sent.
929  defAppLayerIds      .push_back( 0 );
930  defAppPocs          .push_back( 0 );
931  defAppTids          .push_back( 0 );
932  defAppVclNaluTypes = IRAP_NAL_UNIT_TYPES;
933
934  Int      defSeiNaluId                  = 0;
935  Int      defPositionInSeiNalu          = 0;
936  Bool     defModifyByEncoder            = 0;
937
938  // Setup config file options
939  po::Options opts;
940  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder );
941
942  opts.addOptions()
943    ("PrecRefDisplayWidth"            , m_precRefDisplayWidth              , 0                              , "PrecRefDisplayWidth"              )
944    ("RefViewingDistanceFlag"         , m_refViewingDistanceFlag           , false                          , "RefViewingDistanceFlag"           )
945    ("PrecRefViewingDist"             , m_precRefViewingDist               , 0                              , "PrecRefViewingDist"               )
946    ("NumRefDisplaysMinus1"           , m_numRefDisplaysMinus1             , 0                              , "NumRefDisplaysMinus1"             )
947    ("LeftViewId"                     , m_leftViewId                       , IntAry1d (1,0)                 , "LeftViewId"                       )
948    ("RightViewId"                    , m_rightViewId                      , IntAry1d (1,0)                 , "RightViewId"                      )
949    ("ExponentRefDisplayWidth"        , m_exponentRefDisplayWidth          , IntAry1d (1,0)                 , "ExponentRefDisplayWidth"          )
950    ("MantissaRefDisplayWidth"        , m_mantissaRefDisplayWidth          , IntAry1d (1,0)                 , "MantissaRefDisplayWidth"          )
951    ("ExponentRefViewingDistance"     , m_exponentRefViewingDistance       , IntAry1d (1,0)                 , "ExponentRefViewingDistance"       )
952    ("MantissaRefViewingDistance"     , m_mantissaRefViewingDistance       , IntAry1d (1,0)                 , "MantissaRefViewingDistance"       )
953    ("AdditionalShiftPresentFlag"     , m_additionalShiftPresentFlag       , BoolAry1d(1,0)                 , "AdditionalShiftPresentFlag"       )
954    ("NumSampleShiftPlus512"          , m_numSampleShiftPlus512            , IntAry1d (1,0)                 , "NumSampleShiftPlus512"            )
955    ("ThreeDimensionalReferenceDisplaysExtensionFlag", m_threeDimensionalReferenceDisplaysExtensionFlag, false                          , "ThreeDimensionalReferenceDisplaysExtensionFlag")
956    ;
957
958  po::setDefaults(opts);
959
960  // Parse the cfg file
961  po::ErrorReporter err;
962  po::parseConfigFile( opts, cfgFile, err );
963};
964
965
966UInt SEIThreeDimensionalReferenceDisplaysInfo::getMantissaReferenceDisplayWidthLen( Int i ) const
967{
968  return xGetSyntaxElementLen( m_exponentRefDisplayWidth[i], m_precRefDisplayWidth, m_mantissaRefDisplayWidth[ i ] );
969}
970
971UInt SEIThreeDimensionalReferenceDisplaysInfo::getMantissaReferenceViewingDistanceLen( Int i ) const
972{
973  return xGetSyntaxElementLen( m_exponentRefViewingDistance[i], m_precRefViewingDist, m_mantissaRefViewingDistance[ i ] );
974}
975
976UInt SEIThreeDimensionalReferenceDisplaysInfo::xGetSyntaxElementLen( Int expo, Int prec, Int val ) const
977{
978  UInt len;
979  if( expo == 0 )
980  {
981    len = std::max(0, prec - 30 );
982  }
983  else
984  {
985    len = std::max( 0, expo + prec - 31 );
986  }
987
988  assert( val >= 0 );
989  assert( val <= ( ( 1 << len )- 1) );
990  return len;
991}
992
993Bool SEIThreeDimensionalReferenceDisplaysInfo::checkCfg( const TComSlice* slice )
994{
995  // Check config values
996  Bool wrongConfig = false;
997
998  // 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.
999  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." );
1000
1001  xCheckCfgRange( wrongConfig, m_precRefDisplayWidth            , 0 , 31, "prec_ref_display_width"  );
1002  xCheckCfgRange( wrongConfig, m_refViewingDistanceFlag         , 0 , 1, "ref_viewing_distance_flag");
1003  xCheckCfgRange( wrongConfig, m_precRefViewingDist             , 0 , 31, "prec_ref_viewing_dist"   );
1004  xCheckCfgRange( wrongConfig, m_numRefDisplaysMinus1           , 0 , 31, "num_ref_displays_minus1" );
1005
1006  for (Int i = 0; i <= getNumRefDisplaysMinus1(); i++ )
1007  {
1008    xCheckCfgRange( wrongConfig, m_exponentRefDisplayWidth[i]     , 0 , 62, "exponent_ref_display_width"   );
1009    xCheckCfgRange( wrongConfig, m_exponentRefViewingDistance[i]  , 0 , 62, "exponent_ref_viewing_distance");
1010    xCheckCfgRange( wrongConfig, m_additionalShiftPresentFlag[i]  , 0 , 1, "additional_shift_present_flag" );
1011    xCheckCfgRange( wrongConfig, m_numSampleShiftPlus512[i]       , 0 , 1023, "num_sample_shift_plus512"   );
1012  }
1013  xCheckCfgRange( wrongConfig, m_threeDimensionalReferenceDisplaysExtensionFlag, 0 , 1, "three_dimensional_reference_displays_extension_flag");
1014
1015  return wrongConfig;
1016
1017};
1018
1019Void SEIDepthRepresentationInfo::setupFromSlice  ( const TComSlice* slice )
1020{
1021
1022    m_currLayerID=slice->getLayerIdInVps();
1023};
1024
1025Void SEIDepthRepresentationInfo::setupFromCfgFile(const TChar* cfgFile)
1026{
1027  // Set default values
1028  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes;
1029
1030  // TBD: Add default values for which layers, POCS, Tids or Nalu types the SEI should be send.
1031  //defAppLayerIds    .push_back( TBD );
1032  defAppPocs        .push_back( 0 );
1033  //defAppTids        .push_back( TBD );
1034  //defAppVclNaluTypes.push_back( TBD );
1035
1036  Int      defSeiNaluId                  = 0;
1037  Int      defPositionInSeiNalu          = 0;
1038  Bool     defModifyByEncoder            = true;
1039
1040  // Setup config file options
1041  po::Options opts;
1042
1043  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder );
1044
1045  opts.addOptions()
1046    ("ZNear_%d"                      , m_zNear               , std::vector<double>(0,0)       , MAX_NUM_LAYERS , "ZNear"           )
1047    ("ZFar_%d"                       , m_zFar                , std::vector<double>(0,0)       , MAX_NUM_LAYERS , "ZFar"            )
1048    ("DMin_%d"                       , m_dMin                , std::vector<double>(0,0)       , MAX_NUM_LAYERS , "DMin"            )
1049    ("DMax_%d"                       , m_dMax                , std::vector<double>(0,0)       , MAX_NUM_LAYERS , "DMax"            )
1050    ("DepthRepresentationInfoSeiPresentFlag_%d",  m_depthRepresentationInfoSeiPresentFlag, BoolAry1d(1,0), MAX_NUM_LAYERS, "DepthRepresentationInfoSeiPresentFlag")
1051    ("DepthRepresentationType_%d"        , m_depthRepresentationType          , IntAry1d(0,0), MAX_NUM_LAYERS,  "DepthRepresentationType"        )
1052    ("DisparityRefViewId_%d"             , m_disparityRefViewId               ,  IntAry1d(0,0), MAX_NUM_LAYERS,  "DisparityRefViewId"             )
1053    ("DepthNonlinearRepresentationNumMinus1_%d", m_depthNonlinearRepresentationNumMinus1, IntAry1d(0,0), MAX_NUM_LAYERS, "DepthNonlinearRepresentationNumMinus1")
1054    ("DepthNonlinearRepresentationModel_%d"    , m_depth_nonlinear_representation_model ,   IntAry1d(0,0), MAX_NUM_LAYERS, "DepthNonlinearRepresentationModel") ;
1055
1056
1057  po::setDefaults(opts);
1058
1059  // Parse the cfg file
1060  po::ErrorReporter err;
1061  po::parseConfigFile( opts, cfgFile, err );
1062
1063
1064  for(int i=0;i<MAX_NUM_LAYERS;i++)
1065  {
1066    if (m_zNear[i].size()>0)
1067    {
1068      m_zNearFlag.push_back(true);
1069    }
1070    else
1071    {
1072      m_zNearFlag.push_back(false);
1073    }
1074
1075    if (m_zFar[i].size()>0)
1076    {
1077      m_zFarFlag.push_back(true);
1078    }
1079    else
1080    {
1081      m_zFarFlag.push_back(false);
1082    }
1083
1084    if (m_dMin[i].size()>0)
1085    {
1086      m_dMinFlag.push_back(true);
1087    }
1088    else
1089    {
1090      m_dMinFlag.push_back(false);
1091    }
1092
1093    if (m_dMax[i].size()>0)
1094    {
1095      m_dMaxFlag.push_back(true);
1096    }
1097    else
1098    {
1099      m_dMaxFlag.push_back(false);
1100    }
1101
1102
1103    if (m_depthRepresentationInfoSeiPresentFlag[i][0])
1104    {
1105      if ( m_depthRepresentationType[i].size()<=0 )
1106      {
1107        printf("DepthRepresentationType_%d must be present for layer %d\n",i,i );
1108        return;
1109      }
1110
1111      if (  m_depthRepresentationType[i][0]<0 )
1112      {
1113        printf("DepthRepresentationType_%d must be equal to or greater than 0\n",i );
1114        return;
1115      }
1116
1117      if (m_dMinFlag[i] || m_dMaxFlag[i])
1118      {
1119        if (m_disparityRefViewId[i].size()<=0)
1120        {
1121          printf("DisparityRefViewId_%d must be present for layer %d\n",i,i );
1122          assert(false);
1123          return;
1124        }
1125        if (m_disparityRefViewId[i][0]<0)
1126        {
1127          printf("DisparityRefViewId_%d must be equal to or greater than 0\n",i );
1128          assert(false);
1129          return;
1130        }
1131      }
1132
1133      if (m_depthRepresentationType[i][0]==3)
1134      {
1135        if (m_depthNonlinearRepresentationNumMinus1[i].size()<=0)
1136        {
1137          printf("DepthNonlinearRepresentationNumMinus1_%d must be present for layer %d\n",i,i );
1138          assert(false);
1139          return;
1140        }
1141        if (m_depthNonlinearRepresentationNumMinus1[i][0]<0)
1142        {
1143          printf("DepthNonlinearRepresentationNumMinus1_%d must be equal to or greater than 0\n",i );
1144          assert(false);
1145          return;
1146        }
1147
1148        if (m_depth_nonlinear_representation_model[i].size() != m_depthNonlinearRepresentationNumMinus1[i][0]+1)
1149        {
1150          printf("the number of values in Depth_nonlinear_representation_model must be equal to DepthNonlinearRepresentationNumMinus1+1 in layer %d\n",i );
1151          assert(false);
1152          return;
1153        }
1154      }
1155    }
1156  }
1157
1158  assert(m_zNearFlag.size()==MAX_NUM_LAYERS);
1159  assert(m_zFarFlag.size()==MAX_NUM_LAYERS);
1160  assert(m_dMinFlag.size()==MAX_NUM_LAYERS);
1161  assert(m_dMaxFlag.size()==MAX_NUM_LAYERS);
1162}
1163
1164Bool SEIDepthRepresentationInfo::checkCfg( const TComSlice* slice )
1165{
1166    // Check config values
1167    Bool wrongConfig = false;
1168    assert(m_currLayerID>=0);
1169
1170    if (m_depthRepresentationInfoSeiPresentFlag[m_currLayerID][0]==false)
1171    {
1172        printf("DepthRepresentationInfoSeiPresentFlag_%d should be equal to 1 when  ApplicableLayerIds is empty or ApplicableLayerIds contains  %d\n",m_currLayerID,slice->getLayerId());
1173        assert(false);
1174    }
1175    // TBD: Add constraints on presence of SEI here.
1176    xCheckCfg     ( wrongConfig, m_depthRepresentationType[m_currLayerID][0] >=0 , "depth_representation_type must be equal to or greater than 0" );
1177    if ( m_dMaxFlag[m_currLayerID] || m_dMinFlag[m_currLayerID])
1178    {
1179        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");
1180    }
1181
1182    if (m_depthRepresentationType[m_currLayerID][0]==3)
1183    {
1184        xCheckCfg(wrongConfig , m_depthNonlinearRepresentationNumMinus1[m_currLayerID][0]>=0, "depth_nonlinear_representation_num_minus1 must be greater than or equal to 0");
1185
1186        if (m_depthNonlinearRepresentationNumMinus1[m_currLayerID][0]>=0)
1187        {
1188            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");
1189        }
1190
1191    }
1192
1193    return wrongConfig;
1194}
1195
1196
1197Void SEIMultiviewSceneInfo::setupFromCfgFile(const TChar* cfgFile)
1198{
1199  // Set default values
1200  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes;
1201
1202  // TBD: Add default values for which layers, POCS, Tids or Nalu types the SEI should be send.
1203  defAppLayerIds      .clear();
1204  defAppPocs          .clear();
1205  defAppTids          .push_back( 0 );
1206  defAppVclNaluTypes = IRAP_NAL_UNIT_TYPES;
1207
1208  Int      defSeiNaluId                  = 0;
1209  Int      defPositionInSeiNalu          = 0;
1210  Bool     defModifyByEncoder            = false;
1211
1212  // Setup config file options
1213  po::Options opts;
1214  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder );
1215
1216  opts.addOptions()
1217    ("MinDisparity"                   , m_minDisparity                     , 0                              , "MinDisparity"                     )
1218    ("MaxDisparityRange"              , m_maxDisparityRange                , 0                              , "MaxDisparityRange"                )
1219    ;
1220
1221  po::setDefaults(opts);
1222
1223  // Parse the cfg file
1224  po::ErrorReporter err;
1225  po::parseConfigFile( opts, cfgFile, err );
1226};
1227
1228
1229Bool SEIMultiviewSceneInfo::checkCfg( const TComSlice* slice )
1230{
1231  // Check config values
1232  Bool wrongConfig = false;
1233
1234  xCheckCfg     ( wrongConfig, slice->isIRAP(), "When present, the multiview scene information SEI message shall be associated with an IRAP access unit." );
1235
1236  xCheckCfgRange( wrongConfig, m_minDisparity              , -1024 , 1023, "min_disparity"                    );
1237  xCheckCfgRange( wrongConfig, m_maxDisparityRange         ,     0 , 2047, "max_disparity_range"              );
1238
1239  return wrongConfig;
1240
1241};
1242
1243Void SEIMultiviewAcquisitionInfo::setupFromCfgFile(const TChar* cfgFile)
1244{
1245  // Set default values
1246  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes;
1247
1248  defAppLayerIds    .clear();
1249  defAppPocs        .push_back( 0 );
1250  defAppTids        .push_back( 0 );
1251  defAppVclNaluTypes = IDR_NAL_UNIT_TYPES;
1252
1253
1254  Int      defSeiNaluId                  = 0;
1255  Int      defPositionInSeiNalu          = 0;
1256  Bool     defModifyByEncoder            = false;
1257
1258  // Setup config file options
1259  po::Options opts;
1260  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder );
1261
1262  opts.addOptions()
1263    ("IntrinsicParamFlag"               , m_intrinsicParamFlag               , false                              , "IntrinsicParamFlag"               )
1264    ("ExtrinsicParamFlag"               , m_extrinsicParamFlag               , false                              , "ExtrinsicParamFlag"               )
1265    ("IntrinsicParamsEqualFlag"         , m_intrinsicParamsEqualFlag         , false                              , "IntrinsicParamsEqualFlag"         )
1266    ("PrecFocalLength"                  , m_precFocalLength                  , 0                                  , "PrecFocalLength"                  )
1267    ("PrecPrincipalPoint"               , m_precPrincipalPoint               , 0                                  , "PrecPrincipalPoint"               )
1268    ("PrecSkewFactor"                   , m_precSkewFactor                   , 0                                  , "PrecSkewFactor"                   )
1269    ("SignFocalLengthX"                 , m_signFocalLengthX                 , BoolAry1d(1,0)                     , "SignFocalLengthX"                 )
1270    ("ExponentFocalLengthX"             , m_exponentFocalLengthX             , IntAry1d (1,0)                     , "ExponentFocalLengthX"             )
1271    ("MantissaFocalLengthX"             , m_mantissaFocalLengthX             , IntAry1d (1,0)                     , "MantissaFocalLengthX"             )
1272    ("SignFocalLengthY"                 , m_signFocalLengthY                 , BoolAry1d(1,0)                     , "SignFocalLengthY"                 )
1273    ("ExponentFocalLengthY"             , m_exponentFocalLengthY             , IntAry1d (1,0)                     , "ExponentFocalLengthY"             )
1274    ("MantissaFocalLengthY"             , m_mantissaFocalLengthY             , IntAry1d (1,0)                     , "MantissaFocalLengthY"             )
1275    ("SignPrincipalPointX"              , m_signPrincipalPointX              , BoolAry1d(1,0)                     , "SignPrincipalPointX"              )
1276    ("ExponentPrincipalPointX"          , m_exponentPrincipalPointX          , IntAry1d (1,0)                     , "ExponentPrincipalPointX"          )
1277    ("MantissaPrincipalPointX"          , m_mantissaPrincipalPointX          , IntAry1d (1,0)                     , "MantissaPrincipalPointX"          )
1278    ("SignPrincipalPointY"              , m_signPrincipalPointY              , BoolAry1d(1,0)                     , "SignPrincipalPointY"              )
1279    ("ExponentPrincipalPointY"          , m_exponentPrincipalPointY          , IntAry1d (1,0)                     , "ExponentPrincipalPointY"          )
1280    ("MantissaPrincipalPointY"          , m_mantissaPrincipalPointY          , IntAry1d (1,0)                     , "MantissaPrincipalPointY"          )
1281    ("SignSkewFactor"                   , m_signSkewFactor                   , BoolAry1d(1,0)                     , "SignSkewFactor"                   )
1282    ("ExponentSkewFactor"               , m_exponentSkewFactor               , IntAry1d (1,0)                     , "ExponentSkewFactor"               )
1283    ("MantissaSkewFactor"               , m_mantissaSkewFactor               , IntAry1d (1,0)                     , "MantissaSkewFactor"               )
1284    ("PrecRotationParam"                , m_precRotationParam                , 0                                  , "PrecRotationParam"                )
1285    ("PrecTranslationParam"             , m_precTranslationParam             , 0                                  , "PrecTranslationParam"             )
1286    ("SignR_%d_%d"                      , m_signR                            , BoolAry1d(3,0) ,MAX_NUM_LAYERS ,3  , "SignR"                            )
1287    ("ExponentR_%d_%d"                  , m_exponentR                        , IntAry1d (3,0) ,MAX_NUM_LAYERS ,3  , "ExponentR"                        )
1288    ("MantissaR_%d_%d"                  , m_mantissaR                        , IntAry1d (3,0) ,MAX_NUM_LAYERS ,3  , "MantissaR"                        )
1289    ("SignT_%d"                         , m_signT                            , BoolAry1d(3,0) ,MAX_NUM_LAYERS     , "SignT"                            )
1290    ("ExponentT_%d"                     , m_exponentT                        , IntAry1d (3,0) ,MAX_NUM_LAYERS     , "ExponentT"                        )
1291    ("MantissaT_%d"                     , m_mantissaT                        , IntAry1d (3,0) ,MAX_NUM_LAYERS     , "MantissaT"                        )
1292    ;
1293
1294  po::setDefaults(opts);
1295
1296  // Parse the cfg file
1297  po::ErrorReporter err;
1298  po::parseConfigFile( opts, cfgFile, err );
1299};
1300
1301UInt SEIMultiviewAcquisitionInfo::getMantissaFocalLengthXLen( Int i ) const
1302{
1303  return xGetSyntaxElementLen( m_exponentFocalLengthX[i], m_precFocalLength, m_mantissaFocalLengthX[ i ] );
1304}
1305
1306Bool SEIMultiviewAcquisitionInfo::checkCfg( const TComSlice* slice )
1307{
1308  // Check config values
1309  Bool wrongConfig = false;
1310
1311  // Currently the encoder starts with POC 0 for all layers. The condition on POC 0 should be changed, when this changes.
1312  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." );
1313
1314  xCheckCfgRange( wrongConfig, m_precFocalLength         , 0, 31, "prec_focal_length"         );
1315  xCheckCfgRange( wrongConfig, m_precPrincipalPoint      , 0, 31, "prec_principle_point"      );
1316  xCheckCfgRange( wrongConfig, m_precSkewFactor          , 0, 31, "prec_skew_factor"          );
1317
1318  for (Int i = 0; i <= getNumViewsMinus1(); i++ )
1319  {
1320    xCheckCfgRange( wrongConfig, m_exponentFocalLengthX    [ i ], 0, 62, "exponent_focal_length_x"   );
1321    xCheckCfgRange( wrongConfig, m_exponentFocalLengthY    [ i ], 0, 62, "exponent_focal_length_y"   );
1322    xCheckCfgRange( wrongConfig, m_exponentPrincipalPointX [ i ], 0, 62, "exponent_principal_point_x");
1323    xCheckCfgRange( wrongConfig, m_exponentPrincipalPointY [ i ], 0, 62, "exponent_principal_point_y");
1324    xCheckCfgRange( wrongConfig, m_exponentSkewFactor      [ i ], 0, 62, "exponent_skew_factor"      );
1325  }
1326
1327  xCheckCfgRange( wrongConfig, m_precRotationParam       , 0, 31, "prec_focal_length"         );
1328  xCheckCfgRange( wrongConfig, m_precTranslationParam    , 0, 31, "prec_focal_length"         );
1329
1330  for (Int i = 0; i <= getNumViewsMinus1(); i++ )
1331  {
1332    for (Int j = 0; j <= 2; j++)
1333    {
1334      xCheckCfgRange( wrongConfig, m_exponentT[i][j]     , 0, 62, "exponent_skew_factor"      );
1335      for (Int k = 0; k <= 2; k++ )
1336      {
1337        xCheckCfgRange( wrongConfig, m_exponentR[i][j][k], 0, 62, "exponent_principal_point_y");
1338      }
1339    }
1340  }
1341
1342  return wrongConfig;
1343
1344};
1345
1346UInt SEIMultiviewAcquisitionInfo::getMantissaFocalLengthYLen( Int i ) const
1347{
1348  return xGetSyntaxElementLen( m_exponentFocalLengthY[i], m_precFocalLength, m_mantissaFocalLengthY[ i ]  );
1349}
1350
1351
1352UInt SEIMultiviewAcquisitionInfo::getMantissaPrincipalPointXLen( Int i ) const
1353{
1354  return xGetSyntaxElementLen( m_exponentPrincipalPointX[i], m_precPrincipalPoint, m_mantissaPrincipalPointX[ i ]  );
1355}
1356
1357UInt SEIMultiviewAcquisitionInfo::getMantissaPrincipalPointYLen( Int i ) const
1358{
1359  return xGetSyntaxElementLen( m_exponentPrincipalPointY[i], m_precPrincipalPoint, m_mantissaPrincipalPointY[ i ] );
1360}
1361
1362UInt SEIMultiviewAcquisitionInfo::getMantissaSkewFactorLen( Int i ) const
1363{
1364  return xGetSyntaxElementLen( m_exponentSkewFactor[ i ], m_precSkewFactor, m_mantissaSkewFactor[ i ] );
1365}
1366
1367UInt SEIMultiviewAcquisitionInfo::getMantissaRLen( Int i, Int j, Int k ) const
1368{
1369  return xGetSyntaxElementLen( m_exponentR[ i ][ j ][ k ], m_precRotationParam, m_mantissaR[ i ][ j] [ k ] );
1370}
1371
1372UInt SEIMultiviewAcquisitionInfo::getMantissaTLen( Int i, Int j ) const
1373{
1374  return xGetSyntaxElementLen( m_exponentT[ i ][ j ], m_precTranslationParam, m_mantissaT[ i ][ j ] );
1375}
1376UInt SEIMultiviewAcquisitionInfo::xGetSyntaxElementLen( Int expo, Int prec, Int val ) const
1377{
1378  UInt len;
1379  if( expo == 0 )
1380  {
1381    len = std::max(0, prec - 30 );
1382  }
1383  else
1384  {
1385    len = std::max( 0, expo + prec - 31 );
1386  }
1387
1388  assert( val >= 0 );
1389  assert( val <= ( ( 1 << len )- 1) );
1390  return len;
1391}
1392
1393Void SEIMultiviewViewPosition::setupFromSlice  ( const TComSlice* slice )
1394{
1395  const TComVPS* vps = slice->getVPS();
1396  m_numViewsMinus1 = vps->getNumViews() - 1;
1397  m_viewPosition.resize( m_numViewsMinus1 + 1 );
1398  for (Int i = 0; i <= m_numViewsMinus1; i++ )
1399  {
1400    // Assuming that view ids indicate the position
1401    m_viewPosition[i] = vps->getViewIdVal( i );
1402  }
1403}
1404
1405Void SEIMultiviewViewPosition::setupFromCfgFile(const TChar* cfgFile)
1406{
1407  // Set default values
1408  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes;
1409
1410  defAppLayerIds    .push_back( 0 );
1411  defAppPocs        .push_back( 0 );
1412  defAppTids        .push_back( 0 );
1413  defAppVclNaluTypes = IDR_NAL_UNIT_TYPES;
1414
1415  Int      defSeiNaluId                  = 0;
1416  Int      defPositionInSeiNalu          = 0;
1417  Bool     defModifyByEncoder            = true;
1418
1419  // Setup config file options
1420  po::Options opts;
1421  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder );
1422
1423  opts.addOptions()
1424    ("NumViewsMinus1"         , m_numViewsMinus1                          , 0                       , "NumViewsMinus1")
1425    ("ViewPosition"           , m_viewPosition                            , IntAry1d (1,0)          , "ViewPosition"  );
1426  ;
1427
1428  po::setDefaults(opts);
1429
1430  // Parse the cfg file
1431  po::ErrorReporter err;
1432  po::parseConfigFile( opts, cfgFile, err );
1433};
1434
1435Bool SEIMultiviewViewPosition::checkCfg( const TComSlice* slice )
1436{
1437  // Check config values
1438  Bool wrongConfig = false;
1439
1440  // TBD: Add constraints on presence of SEI here.
1441  xCheckCfg     ( wrongConfig, slice->isIRAP() , "When present, the multiview view position SEI message shall be associated with an IRAP access unit."  );
1442
1443  // TBD: Modify constraints according to the SEI semantics.
1444  xCheckCfgRange( wrongConfig, m_numViewsMinus1                 , 0 , 62, "num_views_minus1");
1445  for(Int i = 0; i <= m_numViewsMinus1; i++)
1446  {
1447    xCheckCfgRange( wrongConfig, m_viewPosition[i]                , 0 , 62, "view_position");
1448  }
1449
1450  return wrongConfig;
1451
1452};
1453
1454
1455#if NH_3D
1456Void SEIAlternativeDepthInfo::setupFromCfgFile(const TChar* cfgFile)
1457{
1458  // Set default values
1459  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes;
1460
1461  defAppLayerIds    .clear();
1462  defAppPocs        .clear();
1463  defAppTids        .clear();
1464  defAppVclNaluTypes.clear();
1465
1466  Int      defSeiNaluId                  = 0;
1467  Int      defPositionInSeiNalu          = 0;
1468  Bool     defModifyByEncoder            = false;
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    ("AlternativeDepthInfoCancelFlag" , m_alternativeDepthInfoCancelFlag  , false               , "AlternativeDepthInfoCancelFlag"  )
1476    ("DepthType"                      , m_depthType                       , 1                   , "DepthType"                       )
1477    ("NumConstituentViewsGvdMinus1"   , m_numConstituentViewsGvdMinus1    , 1                   , "NumConstituentViewsGvdMinus1"    )
1478    ("DepthPresentGvdFlag"            , m_depthPresentGvdFlag             , false               , "DepthPresentGvdFlag"             )
1479    ("ZGvdFlag"                       , m_zGvdFlag                        , false               , "ZGvdFlag"                        )
1480    ("IntrinsicParamGvdFlag"          , m_intrinsicParamGvdFlag           , false               , "IntrinsicParamGvdFlag"           )
1481    ("RotationGvdFlag"                , m_rotationGvdFlag                 , false               , "RotationGvdFlag"                 )
1482    ("TranslationGvdFlag"             , m_translationGvdFlag              , false               , "TranslationGvdFlag"              )
1483    ("SignGvdZNearFlag_%d"            , m_signGvdZNearFlag                , BoolAry1d(3,0), 3   , "SignGvdZNearFlag"                )
1484    ("ExpGvdZNear_%d"                 , m_expGvdZNear                     , IntAry1d (3,0), 3   , "ExpGvdZNear"                     )
1485    ("ManLenGvdZNearMinus1_%d"        , m_manLenGvdZNearMinus1            , IntAry1d (3,0), 3   , "ManLenGvdZNearMinus1"            )
1486    ("ManGvdZNear_%d"                 , m_manGvdZNear                     , IntAry1d (3,0), 3   , "ManGvdZNear"                     )
1487    ("SignGvdZFarFlag_%d"             , m_signGvdZFarFlag                 , BoolAry1d(3,0), 3   , "SignGvdZFarFlag"                 )
1488    ("ExpGvdZFar_%d"                  , m_expGvdZFar                      , IntAry1d (3,0), 3   , "ExpGvdZFar"                      )
1489    ("ManLenGvdZFarMinus1_%d"         , m_manLenGvdZFarMinus1             , IntAry1d (3,0), 3   , "ManLenGvdZFarMinus1"             )
1490    ("ManGvdZFar_%d"                  , m_manGvdZFar                      , IntAry1d (3,0), 3   , "ManGvdZFar"                      )
1491    ("PrecGvdFocalLength"             , m_precGvdFocalLength              , 18                  , "PrecGvdFocalLength"              )
1492    ("PrecGvdPrincipalPoint"          , m_precGvdPrincipalPoint           , 18                  , "PrecGvdPrincipalPoint"           )
1493    ("PrecGvdRotationParam"           , m_precGvdRotationParam            , 18                  , "PrecGvdRotationParam"            )
1494    ("PrecGvdTranslationParam"        , m_precGvdTranslationParam         , 18                  , "PrecGvdTranslationParam"         )
1495    ("SignGvdFocalLengthX_%d"         , m_signGvdFocalLengthX             , BoolAry1d(3,0), 3   ,"SignGvdFocalLengthX"              )
1496    ("ExpGvdFocalLengthX_%d"          , m_expGvdFocalLengthX              , IntAry1d (3,0), 3   ,"ExpGvdFocalLengthX"               )
1497    ("ManGvdFocalLengthX_%d"          , m_manGvdFocalLengthX              , IntAry1d (3,0), 3   ,"ManGvdFocalLengthX"               )
1498    ("SignGvdFocalLengthY_%d"         , m_signGvdFocalLengthY             , BoolAry1d(3,0), 3   ,"SignGvdFocalLengthY"              )
1499    ("ExpGvdFocalLengthY_%d"          , m_expGvdFocalLengthY              , IntAry1d (3,0), 3   ,"ExpGvdFocalLengthY"               )
1500    ("ManGvdFocalLengthY_%d"          , m_manGvdFocalLengthY              , IntAry1d (3,0), 3   ,"ManGvdFocalLengthY"               )
1501    ("SignGvdPrincipalPointX_%d"      , m_signGvdPrincipalPointX          , BoolAry1d(3,0), 3   ,"SignGvdPrincipalPointX"           )
1502    ("ExpGvdPrincipalPointX_%d"       , m_expGvdPrincipalPointX           , IntAry1d (3,0), 3   ,"ExpGvdPrincipalPointX"            )
1503    ("ManGvdPrincipalPointX_%d"       , m_manGvdPrincipalPointX           , IntAry1d (3,0), 3   ,"ManGvdPrincipalPointX"            )
1504    ("SignGvdPrincipalPointY_%d"      , m_signGvdPrincipalPointY          , BoolAry1d(3,0), 3   ,"SignGvdPrincipalPointY"           )
1505    ("ExpGvdPrincipalPointY_%d"       , m_expGvdPrincipalPointY           , IntAry1d (3,0), 3   ,"ExpGvdPrincipalPointY"            )
1506    ("ManGvdPrincipalPointY_%d"       , m_manGvdPrincipalPointY           , IntAry1d (3,0), 3   ,"ManGvdPrincipalPointY"            )
1507    ("SignGvdR00_%d"                  , m_signGvdR00                      , BoolAry1d(3,0), 3   ,"SignGvdR00"                       )
1508    ("ExpGvdR00_%d"                   , m_expGvdR00                       , IntAry1d (3,0), 3   ,"ExpGvdR00"                        )
1509    ("ManGvdR00_%d"                   , m_manGvdR00                       , IntAry1d (3,0), 3   ,"ManGvdR00"                        )
1510    ("SignGvdR01_%d"                  , m_signGvdR01                      , BoolAry1d(3,0), 3   ,"SignGvdR01"                       )
1511    ("ExpGvdR01_%d"                   , m_expGvdR01                       , IntAry1d (3,0), 3   ,"ExpGvdR01"                        )
1512    ("ManGvdR01_%d"                   , m_manGvdR01                       , IntAry1d (3,0), 3   ,"ManGvdR01"                        )
1513    ("SignGvdR02_%d"                  , m_signGvdR02                      , BoolAry1d(3,0), 3   ,"SignGvdR02"                       )
1514    ("ExpGvdR02_%d"                   , m_expGvdR02                       , IntAry1d (3,0), 3   ,"ExpGvdR02"                        )
1515    ("ManGvdR02_%d"                   , m_manGvdR02                       , IntAry1d (3,0), 3   ,"ManGvdR02"                        )
1516    ("SignGvdR10_%d"                  , m_signGvdR10                      , BoolAry1d(3,0), 3   ,"SignGvdR10"                       )
1517    ("ExpGvdR10_%d"                   , m_expGvdR10                       , IntAry1d (3,0), 3   ,"ExpGvdR10"                        )
1518    ("ManGvdR10_%d"                   , m_manGvdR10                       , IntAry1d (3,0), 3   ,"ManGvdR10"                        )
1519    ("SignGvdR11_%d"                  , m_signGvdR11                      , BoolAry1d(3,0), 3   ,"SignGvdR11"                       )
1520    ("ExpGvdR11_%d"                   , m_expGvdR11                       , IntAry1d (3,0), 3   ,"ExpGvdR11"                        )
1521    ("ManGvdR11_%d"                   , m_manGvdR11                       , IntAry1d (3,0), 3   ,"ManGvdR11"                        )
1522    ("SignGvdR12_%d"                  , m_signGvdR12                      , BoolAry1d(3,0), 3   ,"SignGvdR12"                       )
1523    ("ExpGvdR12_%d"                   , m_expGvdR12                       , IntAry1d (3,0), 3   ,"ExpGvdR12"                        )
1524    ("ManGvdR12_%d"                   , m_manGvdR12                       , IntAry1d (3,0), 3   ,"ManGvdR12"                        )
1525    ("SignGvdR20_%d"                  , m_signGvdR20                      , BoolAry1d(3,0), 3   ,"SignGvdR20"                       )
1526    ("ExpGvdR20_%d"                   , m_expGvdR20                       , IntAry1d (3,0), 3   ,"ExpGvdR20"                        )
1527    ("ManGvdR20_%d"                   , m_manGvdR20                       , IntAry1d (3,0), 3   ,"ManGvdR20"                        )
1528    ("SignGvdR21_%d"                  , m_signGvdR21                      , BoolAry1d(3,0), 3   ,"SignGvdR21"                       )
1529    ("ExpGvdR21_%d"                   , m_expGvdR21                       , IntAry1d (3,0), 3   ,"ExpGvdR21"                        )
1530    ("ManGvdR21_%d"                   , m_manGvdR21                       , IntAry1d (3,0), 3   ,"ManGvdR21"                        )
1531    ("SignGvdR22_%d"                  , m_signGvdR22                      , BoolAry1d(3,0), 3   ,"SignGvdR22"                       )
1532    ("ExpGvdR22_%d"                   , m_expGvdR22                       , IntAry1d (3,0), 3   ,"ExpGvdR22"                        )
1533    ("ManGvdR22_%d"                   , m_manGvdR22                       , IntAry1d (3,0), 3   ,"ManGvdR22"                        )
1534    ("SignGvdTX_%d"                   , m_signGvdTX                       , BoolAry1d(3,0), 3   ,"SignGvdTX"                        )
1535    ("ExpGvdTX_%d"                    , m_expGvdTX                        , IntAry1d (3,0), 3   ,"ExpGvdTX"                         )
1536    ("ManGvdTX_%d"                    , m_manGvdTX                        , IntAry1d (3,0), 3   ,"ManGvdTX"                         )
1537    ("MinOffsetXInt"                  , m_minOffsetXInt                   , 0                   , "MinOffsetXInt"                   )
1538    ("MinOffsetXFrac"                 , m_minOffsetXFrac                  , 0                   , "MinOffsetXFrac"                  )
1539    ("MaxOffsetXInt"                  , m_maxOffsetXInt                   , 0                   , "MaxOffsetXInt"                   )
1540    ("MaxOffsetXFrac"                 , m_maxOffsetXFrac                  , 0                   , "MaxOffsetXFrac"                  )
1541    ("OffsetYPresentFlag"             , m_offsetYPresentFlag              , false               , "OffsetYPresentFlag"              )
1542    ("MinOffsetYInt"                  , m_minOffsetYInt                   , 0                   , "MinOffsetYInt"                   )
1543    ("MinOffsetYFrac"                 , m_minOffsetYFrac                  , 0                   , "MinOffsetYFrac"                  )
1544    ("MaxOffsetYInt"                  , m_maxOffsetYInt                   , 0                   , "MaxOffsetYInt"                   )
1545    ("MaxOffsetYFrac"                 , m_maxOffsetYFrac                  , 0                   , "MaxOffsetYFrac"                  )
1546    ("WarpMapSizePresentFlag"         , m_warpMapSizePresentFlag          , false               , "WarpMapSizePresentFlag"          )
1547    ("WarpMapWidthMinus2"             , m_warpMapWidthMinus2              , 0                   , "WarpMapWidthMinus2"              )
1548    ("WarpMapHeightMinus2"            , m_warpMapHeightMinus2             , 0                   , "WarpMapHeightMinus2"             )
1549    ;
1550
1551  po::setDefaults(opts);
1552
1553  // Parse the cfg file
1554  po::ErrorReporter err;
1555  po::parseConfigFile( opts, cfgFile, err );
1556};
1557Bool SEIAlternativeDepthInfo::checkCfg( const TComSlice* slice )
1558{
1559  // Check config values
1560  Bool wrongConfig = false;
1561
1562
1563  xCheckCfgRange( wrongConfig, m_alternativeDepthInfoCancelFlag , 0 , 1, "alternative_depth_info_cancel_flag");
1564  xCheckCfgRange( wrongConfig, m_depthType                      , 0 , 1, "depth_type"                       );
1565
1566  xCheckCfgRange( wrongConfig, m_numConstituentViewsGvdMinus1   , 1 , 1, "num_constituent_views_gvd_minus1 "); // 1: 3 views only, cuurent.
1567  xCheckCfgRange( wrongConfig, m_depthPresentGvdFlag            , 0 , 1, "depth_present_gvd_flag"           );
1568  xCheckCfgRange( wrongConfig, m_zGvdFlag                       , 0 , 1, "z_gvd_flag"                       );
1569  xCheckCfgRange( wrongConfig, m_intrinsicParamGvdFlag          , 0 , 1, "intrinsic_param_gvd_flag"         );
1570  xCheckCfgRange( wrongConfig, m_rotationGvdFlag                , 0 , 1, "rotation_gvd_flag"                );
1571  xCheckCfgRange( wrongConfig, m_translationGvdFlag             , 0 , 1, "translation_gvd_flag"             );
1572
1573  return wrongConfig;
1574
1575};
1576
1577UInt SEIAlternativeDepthInfo::getManGvdFocalLengthXLen       ( Int i, int j ) const
1578{
1579  UInt rval;
1580  rval = xGetSyntaxElementLen( m_expGvdFocalLengthX[i][j], m_precGvdFocalLength, m_manGvdFocalLengthX[i][j]  );
1581  if (rval == 0)
1582    return m_precGvdFocalLength;
1583  else
1584    return rval;
1585};
1586
1587UInt SEIAlternativeDepthInfo::getManGvdFocalLengthYLen       ( Int i, int j ) const
1588{
1589  UInt rval;
1590  rval = xGetSyntaxElementLen( m_expGvdFocalLengthY[i][j], m_precGvdFocalLength, m_manGvdFocalLengthY[i][j]  );
1591  if (rval == 0)
1592    return m_precGvdFocalLength;
1593  else
1594    return rval;
1595};
1596
1597UInt SEIAlternativeDepthInfo::getManGvdPrincipalPointXLen    ( Int i, int j ) const
1598{
1599  UInt rval;
1600  rval = xGetSyntaxElementLen( m_expGvdPrincipalPointX[i][j], m_precGvdPrincipalPoint, m_manGvdPrincipalPointX[i][j]  );
1601  if (rval == 0)
1602    return m_precGvdPrincipalPoint;
1603  else
1604    return rval;
1605};
1606
1607UInt SEIAlternativeDepthInfo::getManGvdPrincipalPointYLen    ( Int i, int j ) const
1608{
1609  UInt rval;
1610  rval = xGetSyntaxElementLen( m_expGvdPrincipalPointY[i][j], m_precGvdPrincipalPoint, m_manGvdPrincipalPointY[i][j]  );
1611  if (rval == 0)
1612    return m_precGvdPrincipalPoint;
1613  else
1614    return rval;
1615};
1616
1617UInt SEIAlternativeDepthInfo::getManGvdTXLen                 ( Int i, int j ) const
1618{
1619  UInt rval;
1620  rval = xGetSyntaxElementLen( m_expGvdTX[i][j], m_precGvdTranslationParam, m_manGvdTX[i][j]  );
1621  if (rval == 0)
1622    return m_precGvdTranslationParam;
1623  else
1624    return rval;
1625};
1626
1627UInt SEIAlternativeDepthInfo::xGetSyntaxElementLen( Int expo, Int prec, Int val ) const
1628{
1629  UInt len;
1630  if( expo == 0 )
1631  {
1632    len = std::max(0, prec - 30 );
1633  }
1634  else
1635  {
1636    len = std::max( 0, expo + prec - 31 );
1637  }
1638
1639  assert( val >= 0 );
1640  assert( val <= ( ( 1 << len )- 1) );
1641  return len;
1642}
1643
1644#endif
1645
1646#endif
Note: See TracBrowser for help on using the repository browser.