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

Last change on this file since 1374 was 1374, checked in by tech, 8 years ago

Macro cleanups.

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