source: 3DVCSoftware/branches/HTM-15.2-dev/source/Lib/TLibCommon/SEI.cpp @ 1362

Last change on this file since 1362 was 1362, checked in by tech, 9 years ago

Align macros

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