source: 3DVCSoftware/trunk/source/Lib/TLibEncoder/SEIwrite.cpp @ 1413

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

Merged HTM-16.2-dev@1412

  • Property svn:eol-style set to native
File size: 68.2 KB
Line 
1/* The copyright in this software is being made available under the BSD
2 * License, included below. This software may be subject to other third party
3 * and contributor rights, including patent rights, and no such rights are
4 * granted under this license.
5 *
6 * Copyright (c) 2010-2017, ITU/ISO/IEC
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are met:
11 *
12 *  * Redistributions of source code must retain the above copyright notice,
13 *    this list of conditions and the following disclaimer.
14 *  * Redistributions in binary form must reproduce the above copyright notice,
15 *    this list of conditions and the following disclaimer in the documentation
16 *    and/or other materials provided with the distribution.
17 *  * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
18 *    be used to endorse or promote products derived from this software without
19 *    specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
31 * THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34#include "TLibCommon/TComBitCounter.h"
35#include "TLibCommon/TComBitStream.h"
36#include "TLibCommon/SEI.h"
37#include "TLibCommon/TComSlice.h"
38#include "TLibCommon/TComPicYuv.h"
39#include "SEIwrite.h"
40
41//! \ingroup TLibEncoder
42//! \{
43
44#if ENC_DEC_TRACE
45Void  xTraceSEIHeader()
46{
47  fprintf( g_hTrace, "=========== SEI message ===========\n");
48}
49
50Void  xTraceSEIMessageType(SEI::PayloadType payloadType)
51{
52  fprintf( g_hTrace, "=========== %s SEI message ===========\n", SEI::getSEIMessageString(payloadType));
53}
54#endif
55
56Void SEIWriter::xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, const TComSPS *sps)
57{
58  switch (sei.payloadType())
59  {
60  case SEI::BUFFERING_PERIOD:
61    xWriteSEIBufferingPeriod(*static_cast<const SEIBufferingPeriod*>(&sei), sps);
62    break;
63  case SEI::PICTURE_TIMING:
64    xWriteSEIPictureTiming(*static_cast<const SEIPictureTiming*>(&sei), sps);
65    break;
66  case SEI::PAN_SCAN_RECT:
67    xWriteSEIPanScanRect(*static_cast<const SEIPanScanRect*>(&sei));
68    break;
69  case SEI::FILLER_PAYLOAD:
70    xWriteSEIFillerPayload(*static_cast<const SEIFillerPayload*>(&sei));
71    break;
72  case SEI::USER_DATA_REGISTERED_ITU_T_T35:
73    xWriteSEIUserDataRegistered(*static_cast<const SEIUserDataRegistered*>(&sei));
74    break;
75  case SEI::USER_DATA_UNREGISTERED:
76    xWriteSEIUserDataUnregistered(*static_cast<const SEIUserDataUnregistered*>(&sei));
77    break;
78  case SEI::RECOVERY_POINT:
79    xWriteSEIRecoveryPoint(*static_cast<const SEIRecoveryPoint*>(&sei));
80    break;
81  case SEI::SCENE_INFO:
82    xWriteSEISceneInfo(*static_cast<const SEISceneInfo*>(&sei));
83    break;
84  case SEI::PICTURE_SNAPSHOT:
85    xWriteSEIPictureSnapshot(*static_cast<const SEIPictureSnapshot*>(&sei));
86    break;
87  case SEI::PROGRESSIVE_REFINEMENT_SEGMENT_START:
88    xWriteSEIProgressiveRefinementSegmentStart(*static_cast<const SEIProgressiveRefinementSegmentStart*>(&sei));
89    break;
90  case SEI::PROGRESSIVE_REFINEMENT_SEGMENT_END:
91    xWriteSEIProgressiveRefinementSegmentEnd(*static_cast<const SEIProgressiveRefinementSegmentEnd*>(&sei));
92    break;
93  case SEI::FILM_GRAIN_CHARACTERISTICS:
94    xWriteSEIFilmGrainCharacteristics(*static_cast<const SEIFilmGrainCharacteristics*>(&sei));
95    break;
96  case SEI::POST_FILTER_HINT:
97    xWriteSEIPostFilterHint(*static_cast<const SEIPostFilterHint*>(&sei), sps);
98    break;
99  case SEI::TONE_MAPPING_INFO:
100    xWriteSEIToneMappingInfo(*static_cast<const SEIToneMappingInfo*>(&sei));
101    break;
102  case SEI::FRAME_PACKING:
103    xWriteSEIFramePacking(*static_cast<const SEIFramePacking*>(&sei));
104    break;
105  case SEI::DISPLAY_ORIENTATION:
106    xWriteSEIDisplayOrientation(*static_cast<const SEIDisplayOrientation*>(&sei));
107    break;
108  case SEI::GREEN_METADATA:
109      xWriteSEIGreenMetadataInfo(*static_cast<const SEIGreenMetadataInfo*>(&sei));
110    break;
111  case SEI::SOP_DESCRIPTION:
112    xWriteSEISOPDescription(*static_cast<const SEISOPDescription*>(&sei));
113    break;
114  case SEI::ACTIVE_PARAMETER_SETS:
115    xWriteSEIActiveParameterSets(*static_cast<const SEIActiveParameterSets*>(& sei));
116    break;
117  case SEI::DECODING_UNIT_INFO:
118    xWriteSEIDecodingUnitInfo(*static_cast<const SEIDecodingUnitInfo*>(& sei), sps);
119    break;
120  case SEI::TEMPORAL_LEVEL0_INDEX:
121    xWriteSEITemporalLevel0Index(*static_cast<const SEITemporalLevel0Index*>(&sei));
122    break;
123  case SEI::DECODED_PICTURE_HASH:
124    xWriteSEIDecodedPictureHash(*static_cast<const SEIDecodedPictureHash*>(&sei));
125    break;
126  case SEI::SCALABLE_NESTING:
127    xWriteSEIScalableNesting(bs, *static_cast<const SEIScalableNesting*>(&sei), sps);
128    break;
129  case SEI::REGION_REFRESH_INFO:
130    xWriteSEIRegionRefreshInfo(*static_cast<const SEIRegionRefreshInfo*>(&sei));
131    break;
132  case SEI::NO_DISPLAY:
133    xWriteSEINoDisplay(*static_cast<const SEINoDisplay*>(&sei));
134    break;
135  case SEI::TIME_CODE:
136    xWriteSEITimeCode(*static_cast<const SEITimeCode*>(&sei));
137    break;
138  case SEI::MASTERING_DISPLAY_COLOUR_VOLUME:
139    xWriteSEIMasteringDisplayColourVolume(*static_cast<const SEIMasteringDisplayColourVolume*>(&sei));
140    break;
141  case SEI::SEGM_RECT_FRAME_PACKING:
142    xWriteSEISegmentedRectFramePacking(*static_cast<const SEISegmentedRectFramePacking*>(&sei));
143    break;
144  case SEI::TEMP_MOTION_CONSTRAINED_TILE_SETS:
145    xWriteSEITempMotionConstrainedTileSets(*static_cast<const SEITempMotionConstrainedTileSets*>(&sei));
146    break;
147  case SEI::CHROMA_RESAMPLING_FILTER_HINT:
148    xWriteSEIChromaResamplingFilterHint(*static_cast<const SEIChromaResamplingFilterHint*>(&sei));
149    break;
150  case SEI::KNEE_FUNCTION_INFO:
151    xWriteSEIKneeFunctionInfo(*static_cast<const SEIKneeFunctionInfo*>(&sei));
152    break;
153  case SEI::COLOUR_REMAPPING_INFO:
154    xWriteSEIColourRemappingInfo(*static_cast<const SEIColourRemappingInfo*>(&sei));
155    break;
156  case SEI::DEINTERLACE_FIELD_IDENTIFICATION:
157    xWriteSEIDeinterlaceFieldIdentification(*static_cast<const SEIDeinterlaceFieldIdentification*>(&sei));
158    break;
159  case SEI::CONTENT_LIGHT_LEVEL_INFO:
160    xWriteSEIContentLightLevelInfo(*static_cast<const SEIContentLightLevelInfo*>(&sei));
161    break;
162  case SEI::DEPENDENT_RAP_INDICATION:
163    xWriteSEIDependentRAPIndication(*static_cast<const SEIDependentRAPIndication*>(&sei));
164    break;
165  case SEI::CODED_REGION_COMPLETION:
166    xWriteSEICodedRegionCompletion(*static_cast<const SEICodedRegionCompletion*>(&sei));
167    break;
168  case SEI::ALTERNATIVE_TRANSFER_CHARACTERISTICS:
169    xWriteSEIAlternativeTransferCharacteristics(*static_cast<const SEIAlternativeTransferCharacteristics*>(&sei));
170    break;
171  case SEI::AMBIENT_VIEWING_ENVIRONMENT:
172    xWriteSEIAmbientViewingEnvironment(*static_cast<const SEIAmbientViewingEnvironment*>(&sei));
173    break;
174
175#if NH_MV
176   case SEI::LAYERS_NOT_PRESENT:
177       xWriteSEILayersNotPresent(*static_cast<const SEILayersNotPresent*>(&sei));
178     break;
179   case SEI::INTER_LAYER_CONSTRAINED_TILE_SETS:
180     xWriteSEIInterLayerConstrainedTileSets(*static_cast<const SEIInterLayerConstrainedTileSets*>(&sei));
181     break;
182#if NH_MV_SEI_TBD
183   case SEI::BSP_NESTING:
184     xWriteSEIBspNesting(*static_cast<const SEIBspNesting*>(&sei));
185     break;
186   case SEI::BSP_INITIAL_ARRIVAL_TIME:
187     xWriteSEIBspInitialArrivalTime(*static_cast<const SEIBspInitialArrivalTime*>(&sei));
188     break;
189#endif
190   case SEI::SUB_BITSTREAM_PROPERTY:
191     xWriteSEISubBitstreamProperty(*static_cast<const SEISubBitstreamProperty*>(&sei));
192     break;
193   case SEI::ALPHA_CHANNEL_INFO:
194     xWriteSEIAlphaChannelInfo(*static_cast<const SEIAlphaChannelInfo*>(&sei));
195     break;
196   case SEI::OVERLAY_INFO:
197     xWriteSEIOverlayInfo(*static_cast<const SEIOverlayInfo*>(&sei));
198     break;
199   case SEI::TEMPORAL_MV_PREDICTION_CONSTRAINTS:
200     xWriteSEITemporalMvPredictionConstraints(*static_cast<const SEITemporalMvPredictionConstraints*>(&sei));
201     break;
202#if NH_MV_SEI_TBD
203   case SEI::FRAME_FIELD_INFO:
204     xWriteSEIFrameFieldInfo(*static_cast<const SEIFrameFieldInfo*>(&sei));
205     break;
206#endif
207   case SEI::THREE_DIMENSIONAL_REFERENCE_DISPLAYS_INFO:
208     xWriteSEIThreeDimensionalReferenceDisplaysInfo(*static_cast<const SEIThreeDimensionalReferenceDisplaysInfo*>(&sei));
209     break;
210   case SEI::DEPTH_REPRESENTATION_INFO:
211       xWriteSEIDepthRepresentationInfo(*static_cast<const SEIDepthRepresentationInfo*>(&sei));
212       break;
213   case SEI::MULTIVIEW_SCENE_INFO:
214     xWriteSEIMultiviewSceneInfo(*static_cast<const SEIMultiviewSceneInfo*>(&sei));
215     break;
216   case SEI::MULTIVIEW_ACQUISITION_INFO:
217     xWriteSEIMultiviewAcquisitionInfo(*static_cast<const SEIMultiviewAcquisitionInfo*>(&sei));
218     break;
219
220   case SEI::MULTIVIEW_VIEW_POSITION:
221     xWriteSEIMultiviewViewPosition(*static_cast<const SEIMultiviewViewPosition*>(&sei));
222     break;
223#if NH_3D
224   case SEI::ALTERNATIVE_DEPTH_INFO:
225     xWriteSEIAlternativeDepthInfo(*static_cast<const SEIAlternativeDepthInfo*>(&sei));
226     break;
227#endif
228#endif
229
230
231  default:
232    assert(!"Trying to write unhandled SEI message");
233    break;
234  }
235  xWriteByteAlign();
236}
237
238/**
239 * marshal all SEI messages in provided list into one bitstream bs
240 */
241Void SEIWriter::writeSEImessages(TComBitIf& bs, const SEIMessages &seiList, const TComSPS *sps, Bool isNested)
242{
243#if ENC_DEC_TRACE
244  if (g_HLSTraceEnable)
245    xTraceSEIHeader();
246#endif
247
248  TComBitCounter bs_count;
249
250  for (SEIMessages::const_iterator sei=seiList.begin(); sei!=seiList.end(); sei++)
251  {
252    // calculate how large the payload data is
253    // TODO: this would be far nicer if it used vectored buffers
254    bs_count.resetBits();
255    setBitstream(&bs_count);
256
257#if ENC_DEC_TRACE
258    Bool traceEnable = g_HLSTraceEnable;
259    g_HLSTraceEnable = false;
260#endif
261    xWriteSEIpayloadData(bs_count, **sei, sps);
262#if ENC_DEC_TRACE
263    g_HLSTraceEnable = traceEnable;
264#endif
265    UInt payload_data_num_bits = bs_count.getNumberOfWrittenBits();
266    assert(0 == payload_data_num_bits % 8);
267
268    setBitstream(&bs);
269    UInt payloadType = (*sei)->payloadType();
270    for (; payloadType >= 0xff; payloadType -= 0xff)
271    {
272      WRITE_CODE(0xff, 8, "payload_type");
273    }
274    WRITE_CODE(payloadType, 8, "payload_type");
275
276    UInt payloadSize = payload_data_num_bits/8;
277    for (; payloadSize >= 0xff; payloadSize -= 0xff)
278    {
279      WRITE_CODE(0xff, 8, "payload_size");
280    }
281    WRITE_CODE(payloadSize, 8, "payload_size");
282
283    /* payloadData */
284#if ENC_DEC_TRACE
285    if (g_HLSTraceEnable)
286      xTraceSEIMessageType((*sei)->payloadType());
287#endif
288
289    xWriteSEIpayloadData(bs, **sei, sps);
290  }
291  if (!isNested)
292  {
293    xWriteRbspTrailingBits();
294  }
295}
296
297
298Void SEIWriter::xWriteSEIBufferingPeriod(const SEIBufferingPeriod& sei, const TComSPS *sps)
299{
300  Int i, nalOrVcl;
301  const TComVUI *vui = sps->getVuiParameters();
302  const TComHRD *hrd = vui->getHrdParameters();
303
304  WRITE_UVLC( sei.m_bpSeqParameterSetId, "bp_seq_parameter_set_id" );
305  if( !hrd->getSubPicCpbParamsPresentFlag() )
306  {
307    WRITE_FLAG( sei.m_rapCpbParamsPresentFlag, "irap_cpb_params_present_flag" );
308  }
309  if( sei.m_rapCpbParamsPresentFlag )
310  {
311    WRITE_CODE( sei.m_cpbDelayOffset, hrd->getCpbRemovalDelayLengthMinus1() + 1, "cpb_delay_offset" );
312    WRITE_CODE( sei.m_dpbDelayOffset, hrd->getDpbOutputDelayLengthMinus1()  + 1, "dpb_delay_offset" );
313  }
314  WRITE_FLAG( sei.m_concatenationFlag, "concatenation_flag");
315  WRITE_CODE( sei.m_auCpbRemovalDelayDelta - 1, ( hrd->getCpbRemovalDelayLengthMinus1() + 1 ), "au_cpb_removal_delay_delta_minus1" );
316  for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ )
317  {
318    if( ( ( nalOrVcl == 0 ) && ( hrd->getNalHrdParametersPresentFlag() ) ) ||
319        ( ( nalOrVcl == 1 ) && ( hrd->getVclHrdParametersPresentFlag() ) ) )
320    {
321      for( i = 0; i < ( hrd->getCpbCntMinus1( 0 ) + 1 ); i ++ )
322      {
323        WRITE_CODE( sei.m_initialCpbRemovalDelay[i][nalOrVcl],( hrd->getInitialCpbRemovalDelayLengthMinus1() + 1 ) ,           "initial_cpb_removal_delay" );
324        WRITE_CODE( sei.m_initialCpbRemovalDelayOffset[i][nalOrVcl],( hrd->getInitialCpbRemovalDelayLengthMinus1() + 1 ),      "initial_cpb_removal_delay_offset" );
325        if( hrd->getSubPicCpbParamsPresentFlag() || sei.m_rapCpbParamsPresentFlag )
326        {
327          WRITE_CODE( sei.m_initialAltCpbRemovalDelay[i][nalOrVcl], ( hrd->getInitialCpbRemovalDelayLengthMinus1() + 1 ) ,     "initial_alt_cpb_removal_delay" );
328          WRITE_CODE( sei.m_initialAltCpbRemovalDelayOffset[i][nalOrVcl], ( hrd->getInitialCpbRemovalDelayLengthMinus1() + 1 ),"initial_alt_cpb_removal_delay_offset" );
329        }
330      }
331    }
332  }
333}
334Void SEIWriter::xWriteSEIPictureTiming(const SEIPictureTiming& sei, const TComSPS *sps)
335{
336  Int i;
337  const TComVUI *vui = sps->getVuiParameters();
338  const TComHRD *hrd = vui->getHrdParameters();
339
340  if( vui->getFrameFieldInfoPresentFlag() )
341  {
342    WRITE_CODE( sei.m_picStruct, 4,              "pic_struct" );
343    WRITE_CODE( sei.m_sourceScanType, 2,         "source_scan_type" );
344    WRITE_FLAG( sei.m_duplicateFlag ? 1 : 0,     "duplicate_flag" );
345  }
346
347  if( hrd->getCpbDpbDelaysPresentFlag() )
348  {
349    WRITE_CODE( sei.m_auCpbRemovalDelay - 1, ( hrd->getCpbRemovalDelayLengthMinus1() + 1 ),                                         "au_cpb_removal_delay_minus1" );
350    WRITE_CODE( sei.m_picDpbOutputDelay, ( hrd->getDpbOutputDelayLengthMinus1() + 1 ),                                          "pic_dpb_output_delay" );
351    if(hrd->getSubPicCpbParamsPresentFlag())
352    {
353      WRITE_CODE(sei.m_picDpbOutputDuDelay, hrd->getDpbOutputDelayDuLengthMinus1()+1, "pic_dpb_output_du_delay" );
354    }
355    if( hrd->getSubPicCpbParamsPresentFlag() && hrd->getSubPicCpbParamsInPicTimingSEIFlag() )
356    {
357      WRITE_UVLC( sei.m_numDecodingUnitsMinus1,     "num_decoding_units_minus1" );
358      WRITE_FLAG( sei.m_duCommonCpbRemovalDelayFlag, "du_common_cpb_removal_delay_flag" );
359      if( sei.m_duCommonCpbRemovalDelayFlag )
360      {
361        WRITE_CODE( sei.m_duCommonCpbRemovalDelayMinus1, ( hrd->getDuCpbRemovalDelayLengthMinus1() + 1 ),                       "du_common_cpb_removal_delay_minus1" );
362      }
363      for( i = 0; i <= sei.m_numDecodingUnitsMinus1; i ++ )
364      {
365        WRITE_UVLC( sei.m_numNalusInDuMinus1[ i ],  "num_nalus_in_du_minus1");
366        if( ( !sei.m_duCommonCpbRemovalDelayFlag ) && ( i < sei.m_numDecodingUnitsMinus1 ) )
367        {
368          WRITE_CODE( sei.m_duCpbRemovalDelayMinus1[ i ], ( hrd->getDuCpbRemovalDelayLengthMinus1() + 1 ),                        "du_cpb_removal_delay_minus1" );
369        }
370      }
371    }
372  }
373}
374
375
376Void SEIWriter::xWriteSEIPanScanRect(const SEIPanScanRect &sei)
377{
378  WRITE_UVLC( sei.m_panScanRectId,         "pan_scan_rect_id" );
379  const UInt numRegions = (UInt) sei.m_panScanRectRegions.size();
380  if ( !sei.m_panScanRectCancelFlag && numRegions>0 )
381  {
382    WRITE_FLAG( sei.m_panScanRectCancelFlag, "pan_scan_rect_cancel_flag" );
383    WRITE_UVLC( numRegions - 1, "pan_scan_cnt_minus1" );
384    for(UInt region=0; region<numRegions; region++)
385    {
386      const SEIPanScanRect::PanScanRect &rect=sei.m_panScanRectRegions[region];
387      WRITE_SVLC( rect.leftOffset,   "pan_scan_rect_left_offset[i]"   );
388      WRITE_SVLC( rect.rightOffset,  "pan_scan_rect_rioht_offset[i]"  );
389      WRITE_SVLC( rect.topOffset,    "pan_scan_rect_top_offset[i]"    );
390      WRITE_SVLC( rect.bottomOffset, "pan_scan_rect_bottom_offset[i]" );
391    }
392    WRITE_FLAG( sei.m_panScanRectPersistenceFlag, "pan_scan_rect_persistence_flag" );
393  }
394}
395
396
397Void SEIWriter::xWriteSEIFillerPayload(const SEIFillerPayload &sei)
398{
399  for(UInt k=0; k<sei.m_numFillerFFBytes; k++)
400  {
401    WRITE_CODE( 0xff, 8, "ff_byte" );
402  }
403}
404
405
406Void SEIWriter::xWriteSEIUserDataRegistered(const SEIUserDataRegistered &sei)
407{
408  WRITE_CODE( (sei.m_ituCountryCode>255) ? 0xff : sei.m_ituCountryCode, 8, "itu_t_t35_country_code" );
409  if (sei.m_ituCountryCode>=255)
410  {
411    assert(sei.m_ituCountryCode < 255+256);
412    WRITE_CODE( sei.m_ituCountryCode-255, 8, "itu_t_t35_country_code_extension_byte" );
413  }
414  for(UInt i=0; i<sei.m_userData.size(); i++)
415  {
416    WRITE_CODE( sei.m_userData[i], 8, "itu_t_t35_payload_byte" );
417  }
418}
419
420
421Void SEIWriter::xWriteSEIUserDataUnregistered(const SEIUserDataUnregistered &sei)
422{
423  for (UInt i = 0; i < ISO_IEC_11578_LEN; i++)
424  {
425    WRITE_CODE(sei.m_uuid_iso_iec_11578[i], 8 , "sei.uuid_iso_iec_11578[i]");
426  }
427
428  for (std::size_t i = 0; i < sei.m_userData.size(); i++)
429  {
430    WRITE_CODE(sei.m_userData[i], 8 , "user_data");
431  }
432}
433
434
435Void SEIWriter::xWriteSEIRecoveryPoint(const SEIRecoveryPoint& sei)
436{
437  WRITE_SVLC( sei.m_recoveryPocCnt,    "recovery_poc_cnt"    );
438  WRITE_FLAG( sei.m_exactMatchingFlag, "exact_matching_flag" );
439  WRITE_FLAG( sei.m_brokenLinkFlag,    "broken_link_flag"    );
440}
441
442
443Void SEIWriter::xWriteSEISceneInfo(const SEISceneInfo &sei)
444  {
445  WRITE_FLAG( sei.m_bSceneInfoPresentFlag, "scene_info_present_flag" );
446  if (sei.m_bSceneInfoPresentFlag)
447  {
448    WRITE_FLAG( sei.m_bPrevSceneIdValidFlag, "prev_scene_id_valid_flag" );
449    WRITE_UVLC( sei.m_sceneId,               "scene_id" );
450    WRITE_UVLC( sei.m_sceneTransitionType,   "scene_transition_type" );
451    if (sei.m_sceneTransitionType > 3)
452    {
453      WRITE_UVLC( sei.m_secondSceneId,       "second_scene_id" );
454    }
455  }
456}
457
458
459Void SEIWriter::xWriteSEIPictureSnapshot(const SEIPictureSnapshot &sei)
460{
461  WRITE_UVLC( sei.m_snapshotId, "snapshot_id" );
462}
463
464Void SEIWriter::xWriteSEIProgressiveRefinementSegmentStart(const SEIProgressiveRefinementSegmentStart &sei)
465
466    {
467  WRITE_UVLC( sei.m_progressiveRefinementId, "progressive_refinement_id" );
468  WRITE_UVLC( sei.m_picOrderCntDelta,        "pic_order_cnt_delta"       );
469    }
470
471
472Void SEIWriter::xWriteSEIProgressiveRefinementSegmentEnd(const SEIProgressiveRefinementSegmentEnd &sei)
473{
474  WRITE_UVLC( sei.m_progressiveRefinementId, "progressive_refinement_id" );
475  }
476
477
478Void SEIWriter::xWriteSEIFilmGrainCharacteristics(const SEIFilmGrainCharacteristics &sei)
479{
480  WRITE_FLAG( sei.m_filmGrainCharacteristicsCancelFlag, "film_grain_characteristics_cancel_flag" );
481  if (!sei.m_filmGrainCharacteristicsCancelFlag)
482  {
483    WRITE_CODE( sei.m_filmGrainModelId, 2,                  "film_grain_model_id" );
484    WRITE_FLAG( sei.m_separateColourDescriptionPresentFlag, "separate_colour_description_present_flag" );
485    if (sei.m_separateColourDescriptionPresentFlag)
486    {
487      WRITE_CODE( sei.m_filmGrainBitDepthLumaMinus8,      3, "film_grain_bit_depth_luma_minus8" );
488      WRITE_CODE( sei.m_filmGrainBitDepthChromaMinus8,    3, "film_grain_bit_depth_chroma_minus8" );
489      WRITE_FLAG( sei.m_filmGrainFullRangeFlag,              "film_grain_full_range_flag" );
490      WRITE_CODE( sei.m_filmGrainColourPrimaries,         8, "film_grain_colour_primaries" );
491      WRITE_CODE( sei.m_filmGrainTransferCharacteristics, 8, "film_grain_transfer_characteristics" );
492      WRITE_CODE( sei.m_filmGrainMatrixCoeffs,            8, "film_grain_matrix_coeffs" );
493    }
494    WRITE_CODE( sei.m_blendingModeId,  2, "blending_mode_id" );
495    WRITE_CODE( sei.m_log2ScaleFactor, 4, "log2_scale_factor" );
496    for(Int c=0; c<3; c++)
497    {
498      const SEIFilmGrainCharacteristics::CompModel &cm=sei.m_compModel[c];
499      const UInt numIntensityIntervals = (UInt) cm.intensityValues.size();
500      const UInt numModelValues        = cm.numModelValues;
501      WRITE_FLAG( sei.m_compModel[c].bPresentFlag && numIntensityIntervals>0 && numModelValues>0, "comp_model_present_flag[c]" );
502    }
503    for(Int c=0; c<3; c++)
504    {
505      const SEIFilmGrainCharacteristics::CompModel &cm=sei.m_compModel[c];
506      const UInt numIntensityIntervals = (UInt) cm.intensityValues.size();
507      const UInt numModelValues        = cm.numModelValues;
508      if (cm.bPresentFlag && numIntensityIntervals>0 && numModelValues>0)
509      {
510        assert(numIntensityIntervals<=256);
511        assert(numModelValues<=256);
512        WRITE_CODE( numIntensityIntervals-1, 8, "num_intensity_intervals_minus1[c]");
513        WRITE_CODE( numModelValues-1,        8, "num_model_values_minus1[c]");
514        for(UInt interval=0; interval<numIntensityIntervals; interval++)
515        {
516          const SEIFilmGrainCharacteristics::CompModelIntensityValues &cmiv=cm.intensityValues[interval];
517          WRITE_CODE( cmiv.intensityIntervalLowerBound, 8, "intensity_interval_lower_bound[c][i]" );
518          WRITE_CODE( cmiv.intensityIntervalUpperBound, 8, "intensity_interval_upper_bound[c][i]" );
519          assert(cmiv.compModelValue.size() == numModelValues);
520          for(UInt j=0; j<cm.numModelValues; j++)
521          {
522            WRITE_SVLC(cmiv.compModelValue[j], "comp_model_value[c][i]" );
523          }
524        }
525      }
526    } // for c
527    WRITE_FLAG( sei.m_filmGrainCharacteristicsPersistenceFlag, "film_grain_characteristics_persistence_flag" );
528  } // cancel flag
529}
530
531Void SEIWriter::xWriteSEIPostFilterHint(const SEIPostFilterHint& sei, const TComSPS *sps)
532{
533  WRITE_UVLC( sei.m_filterHintSizeY,   "filter_hint_size_y" );
534  WRITE_UVLC( sei.m_filterHintSizeX,   "filter_hint_size_x" );
535  WRITE_CODE( sei.m_filterHintType, 2, "filter_hint_type"   );
536  assert( (sps->getChromaFormatIdc() == CHROMA_400) == sei.m_bIsMonochrome );
537  const UInt numChromaChannels = sei.m_bIsMonochrome ? 1:3;
538  assert( sei.m_filterHintValues.size() == numChromaChannels*sei.m_filterHintSizeX*sei.m_filterHintSizeY );
539  for(std::size_t i=0; i<sei.m_filterHintValues.size(); i++)
540  {
541    WRITE_SVLC( sei.m_filterHintValues[i], "filter_hint_value[][][]" );
542  }
543}
544
545Void SEIWriter::xWriteSEIToneMappingInfo(const SEIToneMappingInfo& sei)
546{
547  Int i;
548  WRITE_UVLC( sei.m_toneMapId,                    "tone_map_id" );
549  WRITE_FLAG( sei.m_toneMapCancelFlag,            "tone_map_cancel_flag" );
550  if( !sei.m_toneMapCancelFlag )
551  {
552    WRITE_FLAG( sei.m_toneMapPersistenceFlag,     "tone_map_persistence_flag" );
553    WRITE_CODE( sei.m_codedDataBitDepth,    8,    "coded_data_bit_depth" );
554    WRITE_CODE( sei.m_targetBitDepth,       8,    "target_bit_depth" );
555    WRITE_UVLC( sei.m_modelId,                    "model_id" );
556    switch(sei.m_modelId)
557    {
558    case 0:
559      {
560        WRITE_CODE( sei.m_minValue,  32,        "min_value" );
561        WRITE_CODE( sei.m_maxValue, 32,         "max_value" );
562        break;
563      }
564    case 1:
565      {
566        WRITE_CODE( sei.m_sigmoidMidpoint, 32,  "sigmoid_midpoint" );
567        WRITE_CODE( sei.m_sigmoidWidth,    32,  "sigmoid_width"    );
568        break;
569      }
570    case 2:
571      {
572        UInt num = 1u << sei.m_targetBitDepth;
573        for(i = 0; i < num; i++)
574        {
575          WRITE_CODE( sei.m_startOfCodedInterval[i], (( sei.m_codedDataBitDepth + 7 ) >> 3 ) << 3,  "start_of_coded_interval" );
576        }
577        break;
578      }
579    case 3:
580      {
581        WRITE_CODE( sei.m_numPivots, 16,          "num_pivots" );
582        for(i = 0; i < sei.m_numPivots; i++ )
583        {
584          WRITE_CODE( sei.m_codedPivotValue[i], (( sei.m_codedDataBitDepth + 7 ) >> 3 ) << 3,       "coded_pivot_value" );
585          WRITE_CODE( sei.m_targetPivotValue[i], (( sei.m_targetBitDepth + 7 ) >> 3 ) << 3,         "target_pivot_value");
586        }
587        break;
588      }
589    case 4:
590      {
591        WRITE_CODE( sei.m_cameraIsoSpeedIdc,    8,    "camera_iso_speed_idc" );
592        if( sei.m_cameraIsoSpeedIdc == 255) //Extended_ISO
593        {
594          WRITE_CODE( sei.m_cameraIsoSpeedValue,    32,    "camera_iso_speed_value" );
595        }
596        WRITE_CODE( sei.m_exposureIndexIdc,     8,    "exposure_index_idc" );
597        if( sei.m_exposureIndexIdc == 255) //Extended_ISO
598        {
599          WRITE_CODE( sei.m_exposureIndexValue,     32,    "exposure_index_value" );
600        }
601        WRITE_FLAG( sei.m_exposureCompensationValueSignFlag,           "exposure_compensation_value_sign_flag" );
602        WRITE_CODE( sei.m_exposureCompensationValueNumerator,     16,  "exposure_compensation_value_numerator" );
603        WRITE_CODE( sei.m_exposureCompensationValueDenomIdc,      16,  "exposure_compensation_value_denom_idc" );
604        WRITE_CODE( sei.m_refScreenLuminanceWhite,                32,  "ref_screen_luminance_white" );
605        WRITE_CODE( sei.m_extendedRangeWhiteLevel,                32,  "extended_range_white_level" );
606        WRITE_CODE( sei.m_nominalBlackLevelLumaCodeValue,         16,  "nominal_black_level_luma_code_value" );
607        WRITE_CODE( sei.m_nominalWhiteLevelLumaCodeValue,         16,  "nominal_white_level_luma_code_value" );
608        WRITE_CODE( sei.m_extendedWhiteLevelLumaCodeValue,        16,  "extended_white_level_luma_code_value" );
609        break;
610      }
611    default:
612      {
613        assert(!"Undefined SEIToneMapModelId");
614        break;
615      }
616    }//switch m_modelId
617  }//if(!sei.m_toneMapCancelFlag)
618}
619
620
621Void SEIWriter::xWriteSEIFramePacking(const SEIFramePacking& sei)
622{
623  WRITE_UVLC( sei.m_arrangementId,                  "frame_packing_arrangement_id" );
624  WRITE_FLAG( sei.m_arrangementCancelFlag,          "frame_packing_arrangement_cancel_flag" );
625
626  if( sei.m_arrangementCancelFlag == 0 )
627  {
628    WRITE_CODE( sei.m_arrangementType, 7,           "frame_packing_arrangement_type" );
629
630    WRITE_FLAG( sei.m_quincunxSamplingFlag,         "quincunx_sampling_flag" );
631    WRITE_CODE( sei.m_contentInterpretationType, 6, "content_interpretation_type" );
632    WRITE_FLAG( sei.m_spatialFlippingFlag,          "spatial_flipping_flag" );
633    WRITE_FLAG( sei.m_frame0FlippedFlag,            "frame0_flipped_flag" );
634    WRITE_FLAG( sei.m_fieldViewsFlag,               "field_views_flag" );
635    WRITE_FLAG( sei.m_currentFrameIsFrame0Flag,     "current_frame_is_frame0_flag" );
636
637    WRITE_FLAG( sei.m_frame0SelfContainedFlag,      "frame0_self_contained_flag" );
638    WRITE_FLAG( sei.m_frame1SelfContainedFlag,      "frame1_self_contained_flag" );
639
640    if(sei.m_quincunxSamplingFlag == 0 && sei.m_arrangementType != 5)
641    {
642      WRITE_CODE( sei.m_frame0GridPositionX, 4,     "frame0_grid_position_x" );
643      WRITE_CODE( sei.m_frame0GridPositionY, 4,     "frame0_grid_position_y" );
644      WRITE_CODE( sei.m_frame1GridPositionX, 4,     "frame1_grid_position_x" );
645      WRITE_CODE( sei.m_frame1GridPositionY, 4,     "frame1_grid_position_y" );
646    }
647
648    WRITE_CODE( sei.m_arrangementReservedByte, 8,   "frame_packing_arrangement_reserved_byte" );
649    WRITE_FLAG( sei.m_arrangementPersistenceFlag,   "frame_packing_arrangement_persistence_flag" );
650  }
651
652  WRITE_FLAG( sei.m_upsampledAspectRatio,           "upsampled_aspect_ratio" );
653}
654
655
656Void SEIWriter::xWriteSEIDisplayOrientation(const SEIDisplayOrientation &sei)
657{
658  WRITE_FLAG( sei.cancelFlag,           "display_orientation_cancel_flag" );
659  if( !sei.cancelFlag )
660  {
661    WRITE_FLAG( sei.horFlip,                   "hor_flip" );
662    WRITE_FLAG( sei.verFlip,                   "ver_flip" );
663    WRITE_CODE( sei.anticlockwiseRotation, 16, "anticlockwise_rotation" );
664    WRITE_FLAG( sei.persistenceFlag,          "display_orientation_persistence_flag" );
665  }
666}
667
668
669Void SEIWriter::xWriteSEIGreenMetadataInfo(const SEIGreenMetadataInfo& sei)
670{
671  WRITE_CODE(sei.m_greenMetadataType, 8, "green_metadata_type");
672
673  WRITE_CODE(sei.m_xsdMetricType, 8, "xsd_metric_type");
674  WRITE_CODE(sei.m_xsdMetricValue, 16, "xsd_metric_value");
675}
676
677
678Void SEIWriter::xWriteSEISOPDescription(const SEISOPDescription& sei)
679{
680  WRITE_UVLC( sei.m_sopSeqParameterSetId,           "sop_seq_parameter_set_id"               );
681  WRITE_UVLC( sei.m_numPicsInSopMinus1,             "num_pics_in_sop_minus1"               );
682  for (UInt i = 0; i <= sei.m_numPicsInSopMinus1; i++)
683  {
684    WRITE_CODE( sei.m_sopDescVclNaluType[i], 6, "sop_desc_vcl_nalu_type" );
685    WRITE_CODE( sei.m_sopDescTemporalId[i],  3, "sop_desc_temporal_id" );
686    if (sei.m_sopDescVclNaluType[i] != NAL_UNIT_CODED_SLICE_IDR_W_RADL && sei.m_sopDescVclNaluType[i] != NAL_UNIT_CODED_SLICE_IDR_N_LP)
687    {
688      WRITE_UVLC( sei.m_sopDescStRpsIdx[i],           "sop_desc_st_rps_idx"               );
689    }
690    if (i > 0)
691    {
692      WRITE_SVLC( sei.m_sopDescPocDelta[i],           "sop_desc_poc_delta"               );
693    }
694  }
695}
696
697
698Void SEIWriter::xWriteSEIActiveParameterSets(const SEIActiveParameterSets& sei)
699{
700  WRITE_CODE(sei.activeVPSId,     4,         "active_video_parameter_set_id");
701  WRITE_FLAG(sei.m_selfContainedCvsFlag,     "self_contained_cvs_flag");
702  WRITE_FLAG(sei.m_noParameterSetUpdateFlag, "no_parameter_set_update_flag");
703  WRITE_UVLC(sei.numSpsIdsMinus1,            "num_sps_ids_minus1");
704
705  assert (sei.activeSeqParameterSetId.size() == (sei.numSpsIdsMinus1 + 1));
706
707  for (Int i = 0; i < sei.activeSeqParameterSetId.size(); i++)
708  {
709    WRITE_UVLC(sei.activeSeqParameterSetId[i], "active_seq_parameter_set_id");
710  }
711}
712
713
714Void SEIWriter::xWriteSEIDecodingUnitInfo(const SEIDecodingUnitInfo& sei, const TComSPS *sps)
715{
716  const TComVUI *vui = sps->getVuiParameters();
717  WRITE_UVLC(sei.m_decodingUnitIdx, "decoding_unit_idx");
718  if(vui->getHrdParameters()->getSubPicCpbParamsInPicTimingSEIFlag())
719  {
720    WRITE_CODE( sei.m_duSptCpbRemovalDelay, (vui->getHrdParameters()->getDuCpbRemovalDelayLengthMinus1() + 1), "du_spt_cpb_removal_delay_increment");
721  }
722  WRITE_FLAG( sei.m_dpbOutputDuDelayPresentFlag, "dpb_output_du_delay_present_flag");
723  if(sei.m_dpbOutputDuDelayPresentFlag)
724  {
725    WRITE_CODE(sei.m_picSptDpbOutputDuDelay, vui->getHrdParameters()->getDpbOutputDelayDuLengthMinus1() + 1, "pic_spt_dpb_output_du_delay");
726  }
727}
728
729
730Void SEIWriter::xWriteSEITemporalLevel0Index(const SEITemporalLevel0Index &sei)
731{
732  WRITE_CODE( sei.tl0Idx, 8 , "tl0_idx" );
733  WRITE_CODE( sei.rapIdx, 8 , "rap_idx" );
734}
735
736
737Void SEIWriter::xWriteSEIDecodedPictureHash(const SEIDecodedPictureHash& sei)
738{
739  const TChar *traceString="\0";
740  switch (sei.method)
741  {
742    case HASHTYPE_MD5: traceString="picture_md5"; break;
743    case HASHTYPE_CRC: traceString="picture_crc"; break;
744    case HASHTYPE_CHECKSUM: traceString="picture_checksum"; break;
745    default: assert(false); break;
746  }
747
748  if (traceString != 0) //use of this variable is needed to avoid a compiler error with G++ 4.6.1
749  {
750    WRITE_CODE(sei.method, 8, "hash_type");
751    for(UInt i=0; i<UInt(sei.m_pictureHash.hash.size()); i++)
752    {
753      WRITE_CODE(sei.m_pictureHash.hash[i], 8, traceString);
754    }
755  }
756}
757
758
759Void SEIWriter::xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, const TComSPS *sps)
760{
761  WRITE_FLAG( sei.m_bitStreamSubsetFlag,             "bitstream_subset_flag"         );
762  WRITE_FLAG( sei.m_nestingOpFlag,                   "nesting_op_flag      "         );
763  if (sei.m_nestingOpFlag)
764  {
765    WRITE_FLAG( sei.m_defaultOpFlag,                 "default_op_flag"               );
766    WRITE_UVLC( sei.m_nestingNumOpsMinus1,           "nesting_num_ops_minus1"        );
767    for (UInt i = (sei.m_defaultOpFlag ? 1 : 0); i <= sei.m_nestingNumOpsMinus1; i++)
768    {
769      WRITE_CODE( sei.m_nestingMaxTemporalIdPlus1[i], 3,  "nesting_max_temporal_id_plus1" );
770      WRITE_UVLC( sei.m_nestingOpIdx[i],                  "nesting_op_idx"                );
771    }
772  }
773  else
774  {
775    WRITE_FLAG( sei.m_allLayersFlag,                      "all_layers_flag"               );
776    if (!sei.m_allLayersFlag)
777    {
778      WRITE_CODE( sei.m_nestingNoOpMaxTemporalIdPlus1, 3, "nesting_no_op_max_temporal_id_plus1" );
779      WRITE_UVLC( sei.m_nestingNumLayersMinus1,           "nesting_num_layers"                  );
780      for (UInt i = 0; i <= sei.m_nestingNumLayersMinus1; i++)
781      {
782        WRITE_CODE( sei.m_nestingLayerId[i], 6,           "nesting_layer_id"              );
783      }
784    }
785  }
786
787  // byte alignment
788  while ( m_pcBitIf->getNumberOfWrittenBits() % 8 != 0 )
789  {
790    WRITE_FLAG( 0, "nesting_zero_bit" );
791  }
792
793  // write nested SEI messages
794  writeSEImessages(bs, sei.m_nestedSEIs, sps, true);
795}
796
797Void SEIWriter::xWriteSEIRegionRefreshInfo(const SEIRegionRefreshInfo &sei)
798        {
799  WRITE_FLAG( sei.m_gdrForegroundFlag, "gdr_foreground_flag");
800        }
801
802
803Void SEIWriter::xWriteSEINoDisplay(const SEINoDisplay& /*sei*/)
804        {
805  // intentionally empty
806    }
807
808
809Void SEIWriter::xWriteSEITimeCode(const SEITimeCode& sei)
810{
811  WRITE_CODE(sei.numClockTs, 2, "num_clock_ts");
812  for(Int i = 0; i < sei.numClockTs; i++)
813  {
814    const TComSEITimeSet &currentTimeSet = sei.timeSetArray[i];
815    WRITE_FLAG(currentTimeSet.clockTimeStampFlag, "clock_time_stamp_flag");
816    if(currentTimeSet.clockTimeStampFlag)
817    {
818      WRITE_FLAG(currentTimeSet.numUnitFieldBasedFlag, "units_field_based_flag");
819      WRITE_CODE(currentTimeSet.countingType, 5, "counting_type");
820      WRITE_FLAG(currentTimeSet.fullTimeStampFlag, "full_timestamp_flag");
821      WRITE_FLAG(currentTimeSet.discontinuityFlag, "discontinuity_flag");
822      WRITE_FLAG(currentTimeSet.cntDroppedFlag, "cnt_dropped_flag");
823      WRITE_CODE(currentTimeSet.numberOfFrames, 9, "n_frames");
824      if(currentTimeSet.fullTimeStampFlag)
825      {
826        WRITE_CODE(currentTimeSet.secondsValue, 6, "seconds_value");
827        WRITE_CODE(currentTimeSet.minutesValue, 6, "minutes_value");
828        WRITE_CODE(currentTimeSet.hoursValue, 5, "hours_value");
829      }
830      else
831      {
832        WRITE_FLAG(currentTimeSet.secondsFlag, "seconds_flag");
833        if(currentTimeSet.secondsFlag)
834        {
835          WRITE_CODE(currentTimeSet.secondsValue, 6, "seconds_value");
836          WRITE_FLAG(currentTimeSet.minutesFlag, "minutes_flag");
837          if(currentTimeSet.minutesFlag)
838          {
839            WRITE_CODE(currentTimeSet.minutesValue, 6, "minutes_value");
840            WRITE_FLAG(currentTimeSet.hoursFlag, "hours_flag");
841            if(currentTimeSet.hoursFlag)
842            {
843              WRITE_CODE(currentTimeSet.hoursValue, 5, "hours_value");
844            }
845          }
846        }
847      }
848      WRITE_CODE(currentTimeSet.timeOffsetLength, 5, "time_offset_length");
849      if(currentTimeSet.timeOffsetLength > 0)
850      {
851        if(currentTimeSet.timeOffsetValue >= 0)
852        {
853          WRITE_CODE((UInt)currentTimeSet.timeOffsetValue, currentTimeSet.timeOffsetLength, "time_offset_value");
854        }
855        else
856        {
857          //  Two's complement conversion
858          UInt offsetValue = ~(currentTimeSet.timeOffsetValue) + 1;
859          offsetValue |= (1 << (currentTimeSet.timeOffsetLength-1));
860          WRITE_CODE(offsetValue, currentTimeSet.timeOffsetLength, "time_offset_value");
861        }
862      }
863    }
864  }
865}
866
867
868Void SEIWriter::xWriteSEIMasteringDisplayColourVolume(const SEIMasteringDisplayColourVolume& sei)
869{
870  WRITE_CODE( sei.values.primaries[0][0],  16,  "display_primaries_x[0]" );
871  WRITE_CODE( sei.values.primaries[0][1],  16,  "display_primaries_y[0]" );
872
873  WRITE_CODE( sei.values.primaries[1][0],  16,  "display_primaries_x[1]" );
874  WRITE_CODE( sei.values.primaries[1][1],  16,  "display_primaries_y[1]" );
875
876  WRITE_CODE( sei.values.primaries[2][0],  16,  "display_primaries_x[2]" );
877  WRITE_CODE( sei.values.primaries[2][1],  16,  "display_primaries_y[2]" );
878
879  WRITE_CODE( sei.values.whitePoint[0],    16,  "white_point_x" );
880  WRITE_CODE( sei.values.whitePoint[1],    16,  "white_point_y" );
881
882  WRITE_CODE( sei.values.maxLuminance,     32,  "max_display_mastering_luminance" );
883  WRITE_CODE( sei.values.minLuminance,     32,  "min_display_mastering_luminance" );
884}
885
886
887Void SEIWriter::xWriteSEISegmentedRectFramePacking(const SEISegmentedRectFramePacking& sei)
888{
889  WRITE_FLAG( sei.m_arrangementCancelFlag,          "segmented_rect_frame_packing_arrangement_cancel_flag" );
890  if( sei.m_arrangementCancelFlag == 0 )
891  {
892    WRITE_CODE( sei.m_contentInterpretationType, 2, "segmented_rect_content_interpretation_type" );
893    WRITE_FLAG( sei.m_arrangementPersistenceFlag,   "segmented_rect_frame_packing_arrangement_persistence" );
894  }
895}
896
897
898Void SEIWriter::xWriteSEITempMotionConstrainedTileSets(const SEITempMotionConstrainedTileSets& sei)
899{
900  //UInt code;
901  WRITE_FLAG((sei.m_mc_all_tiles_exact_sample_value_match_flag ? 1 : 0), "mc_all_tiles_exact_sample_value_match_flag");
902  WRITE_FLAG((sei.m_each_tile_one_tile_set_flag                ? 1 : 0), "each_tile_one_tile_set_flag"               );
903
904  if(!sei.m_each_tile_one_tile_set_flag)
905  {
906    WRITE_FLAG((sei.m_limited_tile_set_display_flag ? 1 : 0), "limited_tile_set_display_flag");
907    WRITE_UVLC((sei.getNumberOfTileSets() - 1),               "num_sets_in_message_minus1"   );
908
909    if(sei.getNumberOfTileSets() > 0)
910    {
911      for(Int i = 0; i < sei.getNumberOfTileSets(); i++)
912      {
913        WRITE_UVLC(sei.tileSetData(i).m_mcts_id, "mcts_id");
914
915        if(sei.m_limited_tile_set_display_flag)
916        {
917          WRITE_FLAG((sei.tileSetData(i).m_display_tile_set_flag ? 1 : 0), "display_tile_set_flag");
918        }
919
920        WRITE_UVLC((sei.tileSetData(i).getNumberOfTileRects() - 1), "num_tile_rects_in_set_minus1");
921
922        for(Int j = 0; j < sei.tileSetData(i).getNumberOfTileRects(); j++)
923        {
924          WRITE_UVLC(sei.tileSetData(i).topLeftTileIndex    (j), "top_left_tile_index");
925          WRITE_UVLC(sei.tileSetData(i).bottomRightTileIndex(j), "bottom_right_tile_index");
926        }
927
928        if(!sei.m_mc_all_tiles_exact_sample_value_match_flag)
929        {
930          WRITE_FLAG((sei.tileSetData(i).m_exact_sample_value_match_flag ? 1 : 0), "exact_sample_value_match_flag");
931        }
932
933        WRITE_FLAG((sei.tileSetData(i).m_mcts_tier_level_idc_present_flag ? 1 : 0), "mcts_tier_level_idc_present_flag");
934
935        if(sei.tileSetData(i).m_mcts_tier_level_idc_present_flag)
936        {
937          WRITE_FLAG((sei.tileSetData(i).m_mcts_tier_flag ? 1 : 0), "mcts_tier_flag");
938          WRITE_CODE( sei.tileSetData(i).m_mcts_level_idc, 8,       "mcts_level_idc");
939        }
940      }
941    }
942  }
943  else
944  {
945    WRITE_FLAG((sei.m_max_mcs_tier_level_idc_present_flag ? 1 : 0), "max_mcs_tier_level_idc_present_flag");
946
947    if(sei.m_max_mcs_tier_level_idc_present_flag)
948    {
949      WRITE_FLAG((sei.m_max_mcts_tier_flag ? 1 : 0), "max_mcts_tier_flag");
950      WRITE_CODE( sei.m_max_mcts_level_idc, 8,       "max_mcts_level_idc");
951    }
952  }
953}
954
955
956Void SEIWriter::xWriteSEIChromaResamplingFilterHint(const SEIChromaResamplingFilterHint &sei)
957{
958  WRITE_CODE(sei.m_verChromaFilterIdc, 8, "ver_chroma_filter_idc");
959  WRITE_CODE(sei.m_horChromaFilterIdc, 8, "hor_chroma_filter_idc");
960  WRITE_FLAG(sei.m_verFilteringFieldProcessingFlag, "ver_filtering_field_processing_flag");
961  if(sei.m_verChromaFilterIdc == 1 || sei.m_horChromaFilterIdc == 1)
962  {
963    WRITE_UVLC(sei.m_targetFormatIdc, "target_format_idc");
964    if(sei.m_verChromaFilterIdc == 1)
965    {
966      const Int numVerticalFilter = (Int)sei.m_verFilterCoeff.size();
967      WRITE_UVLC(numVerticalFilter, "num_vertical_filters");
968      if(numVerticalFilter > 0)
969      {
970        for(Int i = 0; i < numVerticalFilter; i ++)
971        {
972          const Int verTapLengthMinus1 = (Int) sei.m_verFilterCoeff[i].size() - 1;
973          WRITE_UVLC(verTapLengthMinus1, "ver_tap_length_minus_1");
974          for(Int j = 0; j < (verTapLengthMinus1 + 1); j ++)
975          {
976            WRITE_SVLC(sei.m_verFilterCoeff[i][j], "ver_filter_coeff");
977          }
978        }
979      }
980    }
981    if(sei.m_horChromaFilterIdc == 1)
982    {
983      const Int numHorizontalFilter = (Int) sei.m_horFilterCoeff.size();
984      WRITE_UVLC(numHorizontalFilter, "num_horizontal_filters");
985      if(numHorizontalFilter > 0)
986      {
987        for(Int i = 0; i < numHorizontalFilter; i ++)
988        {
989          const Int horTapLengthMinus1 = (Int) sei.m_horFilterCoeff[i].size() - 1;
990          WRITE_UVLC(horTapLengthMinus1, "hor_tap_length_minus_1");
991          for(Int j = 0; j < (horTapLengthMinus1 + 1); j ++)
992          {
993            WRITE_SVLC(sei.m_horFilterCoeff[i][j], "hor_filter_coeff");
994          }
995        }
996      }
997    }
998  }
999}
1000
1001Void SEIWriter::xWriteSEIKneeFunctionInfo(const SEIKneeFunctionInfo &sei)
1002{
1003  WRITE_UVLC( sei.m_kneeId, "knee_function_id" );
1004  WRITE_FLAG( sei.m_kneeCancelFlag, "knee_function_cancel_flag" );
1005  if ( !sei.m_kneeCancelFlag )
1006  {
1007    WRITE_FLAG( sei.m_kneePersistenceFlag, "knee_function_persistence_flag" );
1008    WRITE_CODE( (UInt)sei.m_kneeInputDrange , 32,  "input_d_range" );
1009    WRITE_CODE( (UInt)sei.m_kneeInputDispLuminance, 32,  "input_disp_luminance" );
1010    WRITE_CODE( (UInt)sei.m_kneeOutputDrange, 32,  "output_d_range" );
1011    WRITE_CODE( (UInt)sei.m_kneeOutputDispLuminance, 32,  "output_disp_luminance" );
1012    WRITE_UVLC( sei.m_kneeNumKneePointsMinus1, "num_knee_points_minus1" );
1013    for(Int i = 0; i <= sei.m_kneeNumKneePointsMinus1; i++ )
1014    {
1015      WRITE_CODE( (UInt)sei.m_kneeInputKneePoint[i], 10,"input_knee_point" );
1016      WRITE_CODE( (UInt)sei.m_kneeOutputKneePoint[i], 10, "output_knee_point" );
1017    }
1018  }
1019}
1020
1021Void SEIWriter::xWriteSEIColourRemappingInfo(const SEIColourRemappingInfo& sei)
1022{
1023  WRITE_UVLC( sei.m_colourRemapId,                             "colour_remap_id" );
1024  WRITE_FLAG( sei.m_colourRemapCancelFlag,                     "colour_remap_cancel_flag" );
1025  if( !sei.m_colourRemapCancelFlag ) 
1026  {
1027    WRITE_FLAG( sei.m_colourRemapPersistenceFlag,              "colour_remap_persistence_flag" );
1028    WRITE_FLAG( sei.m_colourRemapVideoSignalInfoPresentFlag,   "colour_remap_video_signal_info_present_flag" );
1029    if ( sei.m_colourRemapVideoSignalInfoPresentFlag )
1030    {
1031      WRITE_FLAG( sei.m_colourRemapFullRangeFlag,              "colour_remap_full_range_flag" );
1032      WRITE_CODE( sei.m_colourRemapPrimaries,               8, "colour_remap_primaries" );
1033      WRITE_CODE( sei.m_colourRemapTransferFunction,        8, "colour_remap_transfer_function" );
1034      WRITE_CODE( sei.m_colourRemapMatrixCoefficients,      8, "colour_remap_matrix_coefficients" );
1035    }
1036    WRITE_CODE( sei.m_colourRemapInputBitDepth,             8, "colour_remap_input_bit_depth" );
1037    WRITE_CODE( sei.m_colourRemapBitDepth,                  8, "colour_remap_bit_depth" );
1038    for( Int c=0 ; c<3 ; c++ )
1039    {
1040      WRITE_CODE( sei.m_preLutNumValMinus1[c],              8, "pre_lut_num_val_minus1[c]" );
1041      if( sei.m_preLutNumValMinus1[c]>0 )
1042      {
1043        for( Int i=0 ; i<=sei.m_preLutNumValMinus1[c] ; i++ )
1044        {
1045          WRITE_CODE( sei.m_preLut[c][i].codedValue,  (( sei.m_colourRemapInputBitDepth + 7 ) >> 3 ) << 3, "pre_lut_coded_value[c][i]" );
1046          WRITE_CODE( sei.m_preLut[c][i].targetValue, (( sei.m_colourRemapBitDepth      + 7 ) >> 3 ) << 3, "pre_lut_target_value[c][i]" );
1047        }
1048      }
1049    }
1050    WRITE_FLAG( sei.m_colourRemapMatrixPresentFlag,            "colour_remap_matrix_present_flag" );
1051    if( sei.m_colourRemapMatrixPresentFlag )
1052    {
1053      WRITE_CODE( sei.m_log2MatrixDenom,                    4, "log2_matrix_denom" );
1054      for( Int c=0 ; c<3 ; c++ )
1055      {
1056        for( Int i=0 ; i<3 ; i++ )
1057        {
1058          WRITE_SVLC( sei.m_colourRemapCoeffs[c][i],           "colour_remap_coeffs[c][i]" );
1059        }
1060      }
1061    }
1062
1063    for( Int c=0 ; c<3 ; c++ )
1064    {
1065      WRITE_CODE( sei.m_postLutNumValMinus1[c],             8, "m_postLutNumValMinus1[c]" );
1066      if( sei.m_postLutNumValMinus1[c]>0 )
1067      {
1068        for( Int i=0 ; i<=sei.m_postLutNumValMinus1[c] ; i++ )
1069        {
1070          WRITE_CODE( sei.m_postLut[c][i].codedValue, (( sei.m_colourRemapBitDepth + 7 ) >> 3 ) << 3, "post_lut_coded_value[c][i]" );
1071          WRITE_CODE( sei.m_postLut[c][i].targetValue, (( sei.m_colourRemapBitDepth + 7 ) >> 3 ) << 3, "post_lut_target_value[c][i]" );
1072        }
1073      }
1074    }
1075  }
1076}
1077
1078Void SEIWriter::xWriteSEIDeinterlaceFieldIdentification(const SEIDeinterlaceFieldIdentification& sei)
1079{
1080  WRITE_FLAG( sei.m_deinterlacedPictureSourceParityFlag, "deinterlaced_picture_source_parity_flag" );
1081}
1082
1083
1084Void SEIWriter::xWriteSEIContentLightLevelInfo(const SEIContentLightLevelInfo& sei)
1085{
1086  WRITE_CODE( sei.m_maxContentLightLevel,    16, "max_content_light_level"     );
1087  WRITE_CODE( sei.m_maxPicAverageLightLevel, 16, "max_pic_average_light_level" );
1088}
1089
1090
1091Void SEIWriter::xWriteSEIDependentRAPIndication(const SEIDependentRAPIndication& /*sei*/)
1092{
1093  // intentionally empty
1094}
1095
1096
1097Void SEIWriter::xWriteSEICodedRegionCompletion(const SEICodedRegionCompletion& sei)
1098{
1099  WRITE_UVLC( sei.m_nextSegmentAddress, "next_segment_address" );
1100  if (sei.m_nextSegmentAddress)
1101  {
1102    WRITE_FLAG( sei.m_independentSliceSegmentFlag, "independent_slice_segment_flag" );
1103  }
1104}
1105
1106
1107Void SEIWriter::xWriteSEIAlternativeTransferCharacteristics(const SEIAlternativeTransferCharacteristics& sei)
1108{
1109  WRITE_CODE(sei.m_preferredTransferCharacteristics, 8, "preferred_transfer_characteristics");
1110}
1111
1112
1113Void SEIWriter::xWriteSEIAmbientViewingEnvironment(const SEIAmbientViewingEnvironment& sei)
1114{
1115  WRITE_CODE(sei.m_ambientIlluminance, 32, "ambient_illuminance" );
1116  WRITE_CODE(sei.m_ambientLightX,      16, "ambient_light_x" );
1117  WRITE_CODE(sei.m_ambientLightY,      16, "ambient_light_y" );
1118}
1119
1120
1121Void SEIWriter::xWriteByteAlign()
1122{
1123  if( m_pcBitIf->getNumberOfWrittenBits() % 8 != 0)
1124  {
1125    WRITE_FLAG( 1, "payload_bit_equal_to_one" );
1126    while( m_pcBitIf->getNumberOfWrittenBits() % 8 != 0 )
1127    {
1128      WRITE_FLAG( 0, "payload_bit_equal_to_zero" );
1129    }
1130  }
1131}
1132
1133#if NH_MV
1134Void SEIWriter::xWriteSEILayersNotPresent(const SEILayersNotPresent& sei)
1135{
1136  WRITE_CODE( sei.m_lnpSeiActiveVpsId, 4, "lnp_sei_active_vps_id" );
1137  for( Int i = 0; i  <  sei.m_lnpSeiMaxLayers; i++ )
1138  {
1139    WRITE_FLAG( ( sei.m_layerNotPresentFlag[i] ? 1 : 0 ), "layer_not_present_flag" );
1140  }
1141};
1142
1143Void SEIWriter::xWriteSEIInterLayerConstrainedTileSets( const SEIInterLayerConstrainedTileSets& sei)
1144{
1145  WRITE_FLAG( ( sei.m_ilAllTilesExactSampleValueMatchFlag ? 1 : 0 ), "il_all_tiles_exact_sample_value_match_flag" );
1146  WRITE_FLAG( ( sei.m_ilOneTilePerTileSetFlag ? 1 : 0 ),             "il_one_tile_per_tile_set_flag" );
1147  if( !sei.m_ilOneTilePerTileSetFlag )
1148  {
1149    WRITE_UVLC( sei.m_ilNumSetsInMessageMinus1, "il_num_sets_in_message_minus1" );
1150    if( sei.m_ilNumSetsInMessageMinus1 )
1151    {
1152      WRITE_FLAG( ( sei.m_skippedTileSetPresentFlag ? 1 : 0 ), "skipped_tile_set_present_flag" );
1153    }
1154    Int numSignificantSets = sei.m_ilNumSetsInMessageMinus1 - sei.m_skippedTileSetPresentFlag + 1;
1155    for( Int i = 0; i < numSignificantSets; i++ )
1156    {
1157      WRITE_UVLC( sei.m_ilctsId[i],                   "ilcts_id" );
1158      WRITE_UVLC( sei.m_ilNumTileRectsInSetMinus1[i], "il_num_tile_rects_in_set_minus1" );
1159      for( Int j = 0; j  <= sei.m_ilNumTileRectsInSetMinus1[ i ]; j++ )
1160      {
1161        WRITE_UVLC( sei.m_ilTopLeftTileIndex[i][j],     "il_top_left_tile_index" );
1162        WRITE_UVLC( sei.m_ilBottomRightTileIndex[i][j], "il_bottom_right_tile_index" );
1163      }
1164      WRITE_CODE( sei.m_ilcIdc[i], 2, "ilc_idc" );
1165      if ( !sei.m_ilAllTilesExactSampleValueMatchFlag )
1166      {
1167        WRITE_FLAG( ( sei.m_ilExactSampleValueMatchFlag[i] ? 1 : 0 ), "il_exact_sample_value_match_flag" );
1168      }
1169    }
1170  }
1171  else
1172  {
1173    WRITE_CODE( sei.m_allTilesIlcIdc, 2, "all_tiles_ilc_idc" );
1174  }
1175};
1176
1177#if NH_MV_SEI_TBD
1178Void SEIWriter::xWriteSEIBspNesting( const SEIBspNesting& sei)
1179{
1180  WRITE_UVLC( sei.m_seiOlsIdx, "sei_ols_idx" );
1181  WRITE_UVLC( sei.m_seiPartitioningSchemeIdx, "sei_partitioning_scheme_idx" );
1182  WRITE_UVLC( sei.m_bspIdx, "bsp_idx" );
1183  while( !ByteaLigned(() ) );
1184  {
1185    WRITE_CODE( sei.m_bspNestingZeroBit, *equalto0*/u1, "bsp_nesting_zero_bit" );
1186  }
1187  WRITE_UVLC( sei.m_numSeisInBspMinus1, "num_seis_in_bsp_minus1" );
1188  for( Int i = 0; i  <=  NumSeisInBspMinus1( ); i++ )
1189  {
1190    SeiMessage(() );
1191  }
1192};
1193
1194Void SEIWriter::xWriteSEIBspInitialArrivalTime( const SEIBspInitialArrivalTime& sei)
1195{
1196  psIdx = SeiPartitioningSchemeIdx();
1197  if( nalInitialArrivalDelayPresent )
1198  {
1199    for( Int i = 0; i < BspSchedCnt( SeiOlsIdx(), psIdx, MaxTemporalId( 0 ) ); i++ )
1200    {
1201      WRITE_CODE( sei.m_nalInitialArrivalDelay[i], getNalInitialArrivalDelayLen ), "nal_initial_arrival_delay" );
1202    }
1203  }
1204  if( vclInitialArrivalDelayPresent )
1205  {
1206    for( Int i = 0; i < BspSchedCnt( SeiOlsIdx(), psIdx, MaxTemporalId( 0 ) ); i++ )
1207    {
1208      WRITE_CODE( sei.m_vclInitialArrivalDelay[i], getVclInitialArrivalDelayLen ), "vcl_initial_arrival_delay" );
1209    }
1210  }
1211};
1212#endif
1213Void SEIWriter::xWriteSEISubBitstreamProperty( const SEISubBitstreamProperty& sei)
1214{
1215  WRITE_CODE( sei.m_sbPropertyActiveVpsId, 4,      "sb_property_active_vps_id"         );
1216  WRITE_UVLC( sei.m_numAdditionalSubStreamsMinus1, "num_additional_sub_streams_minus1" );
1217  for( Int i = 0; i  <=  sei.m_numAdditionalSubStreamsMinus1; i++ )
1218  {
1219    WRITE_CODE( sei.m_subBitstreamMode    [i], 2,  "sub_bitstream_mode"       );
1220    WRITE_UVLC( sei.m_olsIdxToVps         [i],     "ols_idx_to_vps"           );
1221    WRITE_CODE( sei.m_highestSublayerId   [i], 3,  "highest_sublayer_id"      );
1222    WRITE_CODE( sei.m_avgSbPropertyBitRate[i], 16, "avg_sb_property_bit_rate" );
1223    WRITE_CODE( sei.m_maxSbPropertyBitRate[i], 16, "max_sb_property_bit_rate" );
1224  }
1225};
1226
1227Void SEIWriter::xWriteSEIAlphaChannelInfo( const SEIAlphaChannelInfo& sei)
1228{
1229  WRITE_FLAG( ( sei.m_alphaChannelCancelFlag ? 1 : 0 ), "alpha_channel_cancel_flag" );
1230  if( !sei.m_alphaChannelCancelFlag )
1231  {
1232    WRITE_CODE( sei.m_alphaChannelUseIdc, 3, "alpha_channel_use_idc" );
1233    WRITE_CODE( sei.m_alphaChannelBitDepthMinus8, 3, "alpha_channel_bit_depth_minus8" );
1234    WRITE_CODE( sei.m_alphaTransparentValue, sei.m_alphaChannelBitDepthMinus8+9, "alpha_transparent_value" );
1235    WRITE_CODE( sei.m_alphaOpaqueValue, sei.m_alphaChannelBitDepthMinus8+9, "alpha_opaque_value" );
1236    WRITE_FLAG( ( sei.m_alphaChannelIncrFlag ? 1 : 0 ), "alpha_channel_incr_flag" );
1237    WRITE_FLAG( ( sei.m_alphaChannelClipFlag ? 1 : 0 ), "alpha_channel_clip_flag" );
1238    if( sei.m_alphaChannelClipFlag )
1239    {
1240      WRITE_FLAG( ( sei.m_alphaChannelClipTypeFlag ? 1 : 0 ), "alpha_channel_clip_type_flag" );
1241    }
1242  }
1243};
1244
1245Void SEIWriter::xWriteSEIOverlayInfo( const SEIOverlayInfo& sei)
1246{
1247  WRITE_FLAG( ( sei.m_overlayInfoCancelFlag ? 1 : 0 ), "overlay_info_cancel_flag" );
1248  if( !sei.m_overlayInfoCancelFlag )
1249  {
1250    WRITE_UVLC( sei.m_overlayContentAuxIdMinus128, "overlay_content_aux_id_minus128" );
1251    WRITE_UVLC( sei.m_overlayLabelAuxIdMinus128, "overlay_label_aux_id_minus128" );
1252    WRITE_UVLC( sei.m_overlayAlphaAuxIdMinus128, "overlay_alpha_aux_id_minus128" );
1253    WRITE_UVLC( sei.m_overlayElementLabelValueLengthMinus8, "overlay_element_label_value_length_minus8" );
1254    WRITE_UVLC( sei.m_numOverlaysMinus1, "num_overlays_minus1" );
1255    for( Int i = 0; i  <=  sei.m_numOverlaysMinus1 ; i++ )
1256    {
1257      WRITE_UVLC( sei.m_overlayIdx[i], "overlay_idx" );
1258      WRITE_FLAG( ( sei.m_languageOverlayPresentFlag[i] ? 1 : 0 ), "language_overlay_present_flag" );
1259      WRITE_CODE( sei.m_overlayContentLayerId[i], 6, "overlay_content_layer_id" );
1260      WRITE_FLAG( ( sei.m_overlayLabelPresentFlag[i] ? 1 : 0 ), "overlay_label_present_flag" );
1261      if( sei.m_overlayLabelPresentFlag[i] )
1262      {
1263        WRITE_CODE( sei.m_overlayLabelLayerId[i], 6, "overlay_label_layer_id" );
1264      }
1265      WRITE_FLAG( ( sei.m_overlayAlphaPresentFlag[i] ? 1 : 0 ), "overlay_alpha_present_flag" );
1266      if( sei.m_overlayAlphaPresentFlag[i] )
1267      {
1268        WRITE_CODE( sei.m_overlayAlphaLayerId[i], 6, "overlay_alpha_layer_id" );
1269      }
1270      if( sei.m_overlayLabelPresentFlag[i] )
1271      {
1272        WRITE_UVLC( sei.m_numOverlayElementsMinus1[i], "num_overlay_elements_minus1" );
1273        for( Int j = 0; j  <=  sei.m_numOverlayElementsMinus1[i]; j++ )
1274        {
1275          WRITE_CODE( sei.m_overlayElementLabelMin[i][j], (sei.m_overlayElementLabelValueLengthMinus8 + 8), "overlay_element_label_min" );
1276          WRITE_CODE( sei.m_overlayElementLabelMax[i][j], (sei.m_overlayElementLabelValueLengthMinus8 + 8), "overlay_element_label_max" );
1277        }
1278      }
1279    }
1280
1281    // byte alignment
1282    while ( m_pcBitIf->getNumberOfWrittenBits() % 8 != 0 )
1283    {
1284      WRITE_FLAG( 0, "overlay_zero_bit" );
1285    }
1286
1287    UChar* stmp;
1288    UInt ilength;
1289    for( Int i = 0; i  <=  sei.m_numOverlaysMinus1; i++ )
1290    {
1291      if( sei.m_languageOverlayPresentFlag[i] )
1292      {
1293        stmp = (UChar*) strdup( sei.m_overlayLanguage[i].c_str() );
1294        ilength = (UInt) sei.m_overlayLanguage[i].size();
1295        WRITE_STRING( stmp, ilength, "overlay_language" );
1296        free(stmp);
1297      }
1298      stmp = (UChar*) strdup( sei.m_overlayName[i].c_str() );
1299      ilength = (UInt) sei.m_overlayName[i].size();
1300      WRITE_STRING( stmp, ilength, "overlay_name" );
1301      free(stmp);
1302      if( sei.m_overlayLabelPresentFlag[i] )
1303      {
1304        for( Int j = 0; j  <=  sei.m_numOverlayElementsMinus1[i]; j++ )
1305        {
1306          stmp = (UChar*) strdup( sei.m_overlayElementName[i][j].c_str() );
1307          ilength = (UInt) sei.m_overlayElementName[i][j].size();
1308          WRITE_STRING( stmp, ilength, "overlay_element_name" );
1309          free(stmp);
1310        }
1311      }
1312    }
1313    WRITE_FLAG( ( sei.m_overlayInfoPersistenceFlag ? 1 : 0 ), "overlay_info_persistence_flag" );
1314  }
1315};
1316
1317
1318Void SEIWriter::xWriteSEITemporalMvPredictionConstraints( const SEITemporalMvPredictionConstraints& sei)
1319{
1320  WRITE_FLAG( ( sei.m_prevPicsNotUsedFlag    ? 1 : 0 ), "prev_pics_not_used_flag"     );
1321  WRITE_FLAG( ( sei.m_noIntraLayerColPicFlag ? 1 : 0 ), "no_intra_layer_col_pic_flag" );
1322};
1323
1324#if NH_MV_SEI_TBD
1325Void SEIWriter::xWriteSEIFrameFieldInfo( const SEIFrameFieldInfo& sei)
1326{
1327  WRITE_CODE( sei.m_ffinfoPicStruct, 4, "ffinfo_pic_struct" );
1328  WRITE_CODE( sei.m_ffinfoSourceScanType, 2, "ffinfo_source_scan_type" );
1329  WRITE_FLAG( ( sei.m_ffinfoDuplicateFlag ? 1 : 0 ), "ffinfo_duplicate_flag" );
1330};
1331#endif
1332
1333Void SEIWriter::xWriteSEIThreeDimensionalReferenceDisplaysInfo( const SEIThreeDimensionalReferenceDisplaysInfo& sei)
1334{
1335  WRITE_UVLC( sei.m_precRefDisplayWidth, "prec_ref_display_width" );
1336  WRITE_FLAG( ( sei.m_refViewingDistanceFlag ? 1 : 0 ), "ref_viewing_distance_flag" );
1337  if( sei.m_refViewingDistanceFlag )
1338  {
1339    WRITE_UVLC( sei.m_precRefViewingDist, "prec_ref_viewing_dist" );
1340  }
1341  WRITE_UVLC( sei.m_numRefDisplaysMinus1, "num_ref_displays_minus1" );
1342  for( Int i = 0; i  <=  sei.getNumRefDisplaysMinus1( ); i++ )
1343  {
1344    WRITE_UVLC( sei.m_leftViewId[i], "left_view_id" );
1345    WRITE_UVLC( sei.m_rightViewId[i], "right_view_id" );
1346    WRITE_CODE( sei.m_exponentRefDisplayWidth[i], 6, "exponent_ref_display_width" );
1347    WRITE_CODE( sei.m_mantissaRefDisplayWidth[i], sei.getMantissaReferenceDisplayWidthLen(i) , "mantissa_ref_display_width" );
1348    if( sei.m_refViewingDistanceFlag )
1349    {
1350      WRITE_CODE( sei.m_exponentRefViewingDistance[i], 6, "exponent_ref_viewing_distance" );
1351      WRITE_CODE( sei.m_mantissaRefViewingDistance[i], sei.getMantissaReferenceViewingDistanceLen(i), "mantissa_ref_viewing_distance" );
1352    }
1353    WRITE_FLAG( ( sei.m_additionalShiftPresentFlag[i] ? 1 : 0 ), "additional_shift_present_flag" );
1354    if( sei.m_additionalShiftPresentFlag[i] )
1355    {
1356      WRITE_CODE( sei.m_numSampleShiftPlus512[i], 10, "num_sample_shift_plus512" );
1357    }
1358  }
1359  WRITE_FLAG( ( sei.m_threeDimensionalReferenceDisplaysExtensionFlag ? 1 : 0 ), "three_dimensional_reference_displays_extension_flag" );
1360};
1361
1362Void SEIWriter::xWriteSEIDepthRepresentationInfo( const SEIDepthRepresentationInfo& sei)
1363{
1364
1365    assert(sei.m_currLayerID>=0);
1366
1367    WRITE_FLAG( ( sei.m_zNearFlag[sei.m_currLayerID] ? 1 : 0 ), "z_near_flag" );
1368    WRITE_FLAG( ( sei.m_zFarFlag[sei.m_currLayerID] ? 1 : 0 ), "z_far_flag" );
1369    WRITE_FLAG( ( sei.m_dMinFlag[sei.m_currLayerID] ? 1 : 0 ), "d_min_flag" );
1370    WRITE_FLAG( ( sei.m_dMaxFlag[sei.m_currLayerID] ? 1 : 0 ), "d_max_flag" );
1371    WRITE_UVLC( sei.m_depthRepresentationType[sei.m_currLayerID][0], "depth_representation_type" );
1372    if( sei.m_dMinFlag[sei.m_currLayerID]  ||  sei.m_dMaxFlag[sei.m_currLayerID] )
1373    {
1374        WRITE_UVLC( sei.m_disparityRefViewId[sei.m_currLayerID][0], "disparity_ref_view_id" );
1375    }
1376    if( sei.m_zNearFlag[sei.m_currLayerID] )
1377    {
1378        xWriteSEIDepthRepInfoElement(sei.m_zNear[sei.m_currLayerID][0]);
1379    }
1380    if( sei.m_zFarFlag[sei.m_currLayerID] )
1381    {
1382        xWriteSEIDepthRepInfoElement(sei.m_zFar[sei.m_currLayerID][0]);
1383    }
1384    if( sei.m_dMinFlag[sei.m_currLayerID] )
1385    {
1386        xWriteSEIDepthRepInfoElement(sei.m_dMin[sei.m_currLayerID][0]);
1387    }
1388    if( sei.m_dMaxFlag[sei.m_currLayerID] )
1389    {
1390        xWriteSEIDepthRepInfoElement(sei.m_dMax[sei.m_currLayerID][0]);
1391    }
1392
1393    if (sei.m_depthRepresentationType[sei.m_currLayerID][0] == 3)
1394    {
1395        WRITE_UVLC( sei.m_depthNonlinearRepresentationNumMinus1[sei.m_currLayerID][0], "depth_nonlinear_representation_num_minus1" );
1396        for( Int i = 1; i  <=  sei.m_depthNonlinearRepresentationNumMinus1[sei.m_currLayerID][0] + 1; i++ )
1397        {
1398            WRITE_UVLC(sei.m_depth_nonlinear_representation_model[sei.m_currLayerID][i-1],"depth_nonlinear_representation_model[ i ]");
1399        }
1400    }
1401}
1402
1403Void SEIWriter::xWriteSEIDepthRepInfoElement( double f)
1404{
1405    UInt x_sign, x_exp, x_mantissa,x_mantissa_len;
1406    if (f < 0)
1407    {
1408        f = f * (-1);
1409        x_sign = 1;
1410    }
1411    else
1412    {
1413        x_sign = 0;
1414    }
1415    int exponent=0;
1416    if(f >= 1)
1417    {
1418        while(f>=2)
1419        {
1420            exponent++;
1421            f = f/2;
1422        }
1423    }
1424    else
1425    {
1426        while (f<1)
1427        {
1428            exponent++;
1429            f = f*2;
1430        }
1431        exponent=-exponent;
1432    }
1433
1434    int i;
1435    f = f -1;
1436    double s = 1;
1437    char s_mantissa[32];
1438    double thr=1.0/(4.0*(1<<30));
1439
1440    if (f>=thr)
1441    {
1442        for(i=0;i<32;i++)
1443        {
1444            s /= 2;
1445            if(f>=s)
1446            {
1447                f = f-s;
1448                s_mantissa[i]=1;
1449
1450                if (f<thr)
1451                    break;
1452            }
1453            else
1454            {
1455                s_mantissa[i]=0;
1456            }
1457        }
1458
1459        if (i<32)
1460            x_mantissa_len=i+1;
1461        else
1462            x_mantissa_len=32;
1463
1464        x_mantissa=0;
1465
1466        for(i=0;i<x_mantissa_len;i++)
1467        {
1468            if (s_mantissa[i]==1)
1469                x_mantissa += (1u)<<(x_mantissa_len-1-i) ;
1470        }
1471
1472    }
1473    else
1474    {
1475        x_mantissa=0;
1476        x_mantissa_len=1;
1477    }
1478
1479    assert(exponent>=-31 && exponent<= (1<<7)-32);
1480    x_exp=exponent+31;
1481
1482    WRITE_FLAG(  x_sign,                         "da_sign_flag" );
1483    WRITE_CODE(  x_exp, 7 ,                      "da_exponent" );
1484    WRITE_CODE( x_mantissa_len-1, 5 ,            "da_mantissa_len_minus1" );
1485    WRITE_CODE( x_mantissa, x_mantissa_len ,     "da_mantissa" );
1486
1487};
1488
1489Void SEIWriter::xWriteSEIMultiviewSceneInfo( const SEIMultiviewSceneInfo& sei)
1490{
1491  WRITE_SVLC( sei.m_minDisparity     , "min_disparity"       );
1492  WRITE_UVLC( sei.m_maxDisparityRange, "max_disparity_range" );
1493};
1494
1495
1496Void SEIWriter::xWriteSEIMultiviewAcquisitionInfo( const SEIMultiviewAcquisitionInfo& sei)
1497{
1498  WRITE_FLAG( ( sei.m_intrinsicParamFlag ? 1 : 0 ), "intrinsic_param_flag" );
1499  WRITE_FLAG( ( sei.m_extrinsicParamFlag ? 1 : 0 ), "extrinsic_param_flag" );
1500  if( sei.m_intrinsicParamFlag )
1501  {
1502    WRITE_FLAG( ( sei.m_intrinsicParamsEqualFlag ? 1 : 0 ), "intrinsic_params_equal_flag" );
1503    WRITE_UVLC(   sei.m_precFocalLength                   , "prec_focal_length"           );
1504    WRITE_UVLC(   sei.m_precPrincipalPoint                , "prec_principal_point"        );
1505    WRITE_UVLC(   sei.m_precSkewFactor                    , "prec_skew_factor"            );
1506
1507    for( Int i = 0; i  <=  ( sei.m_intrinsicParamsEqualFlag ? 0 : sei.getNumViewsMinus1() ); i++ )
1508    {
1509      WRITE_FLAG( ( sei.m_signFocalLengthX       [i] ? 1 : 0 ),                                         "sign_focal_length_x"        );
1510      WRITE_CODE(   sei.m_exponentFocalLengthX   [i]          , 6                                  ,    "exponent_focal_length_x"    );
1511      WRITE_CODE(   sei.m_mantissaFocalLengthX   [i]          , sei.getMantissaFocalLengthXLen( i ),    "mantissa_focal_length_x"    );
1512      WRITE_FLAG( ( sei.m_signFocalLengthY       [i] ? 1 : 0 ),                                         "sign_focal_length_y"        );
1513      WRITE_CODE(   sei.m_exponentFocalLengthY   [i]          , 6                                  ,    "exponent_focal_length_y"    );
1514      WRITE_CODE(   sei.m_mantissaFocalLengthY   [i]          , sei.getMantissaFocalLengthYLen( i ),    "mantissa_focal_length_y"    );
1515      WRITE_FLAG( ( sei.m_signPrincipalPointX    [i] ? 1 : 0 ),                                         "sign_principal_point_x"     );
1516      WRITE_CODE(   sei.m_exponentPrincipalPointX[i]          , 6,                                      "exponent_principal_point_x" );
1517      WRITE_CODE(   sei.m_mantissaPrincipalPointX[i]          , sei.getMantissaPrincipalPointXLen( i ), "mantissa_principal_point_x" );
1518      WRITE_FLAG( ( sei.m_signPrincipalPointY    [i] ? 1 : 0 ),                                         "sign_principal_point_y"     );
1519      WRITE_CODE(   sei.m_exponentPrincipalPointY[i]          , 6,                                      "exponent_principal_point_y" );
1520      WRITE_CODE(   sei.m_mantissaPrincipalPointY[i]          , sei.getMantissaPrincipalPointYLen( i ), "mantissa_principal_point_y" );
1521      WRITE_FLAG( ( sei.m_signSkewFactor         [i] ? 1 : 0 ),                                         "sign_skew_factor"           );
1522      WRITE_CODE(   sei.m_exponentSkewFactor     [i]          , 6,                                      "exponent_skew_factor"       );
1523      WRITE_CODE(   sei.m_mantissaSkewFactor     [i]          , sei.getMantissaSkewFactorLen( i )  ,    "mantissa_skew_factor"       );
1524    }
1525  }
1526  if( sei.m_extrinsicParamFlag )
1527  {
1528    WRITE_UVLC( sei.m_precRotationParam   , "prec_rotation_param"    );
1529    WRITE_UVLC( sei.m_precTranslationParam, "prec_translation_param" );
1530    for( Int i = 0; i  <=  sei.getNumViewsMinus1(); i++ )
1531    {
1532      for( Int j = 0; j  <=  2; j++ )  /* row */
1533      {
1534        for( Int k = 0; k  <=  2; k++ )  /* column */
1535        {
1536          WRITE_FLAG( ( sei.m_signR    [i][j][k] ? 1 : 0 ),                                "sign_r"     );
1537          WRITE_CODE(   sei.m_exponentR[i][j][k]          , 6,                             "exponent_r" );
1538          WRITE_CODE(   sei.m_mantissaR[i][j][k]          , sei.getMantissaRLen( i,j,k ) , "mantissa_r" );
1539        }
1540        WRITE_FLAG( ( sei.m_signT    [i][j] ? 1 : 0 ),                          "sign_t"     );
1541        WRITE_CODE(   sei.m_exponentT[i][j]          , 6,                       "exponent_t" );
1542        WRITE_CODE(   sei.m_mantissaT[i][j]          , sei.getMantissaTLen( i,j ),"mantissa_t" );
1543      }
1544    }
1545  }
1546};
1547
1548Void SEIWriter::xWriteSEIMultiviewViewPosition( const SEIMultiviewViewPosition& sei)
1549{
1550  WRITE_UVLC( sei.m_numViewsMinus1, "num_views_minus1" );
1551  for( Int i = 0; i  <=  sei.m_numViewsMinus1; i++ )
1552  {
1553    WRITE_UVLC( sei.m_viewPosition[i], "view_position" );
1554  }
1555};
1556
1557#if NH_3D
1558Void SEIWriter::xWriteSEIAlternativeDepthInfo( const SEIAlternativeDepthInfo& sei)
1559{
1560  WRITE_FLAG( ( sei.m_alternativeDepthInfoCancelFlag ? 1 : 0 ), "alternative_depth_info_cancel_flag" );
1561  if( sei.m_alternativeDepthInfoCancelFlag  ==  0 )
1562  {
1563    WRITE_CODE( sei.m_depthType, 2, "depth_type" );
1564
1565    if( sei.m_depthType  ==  0 )
1566    {
1567      WRITE_UVLC( sei.m_numConstituentViewsGvdMinus1, "num_constituent_views_gvd_minus1" );
1568      WRITE_FLAG( ( sei.m_depthPresentGvdFlag ? 1 : 0 ), "depth_present_gvd_flag" );
1569      WRITE_FLAG( ( sei.m_zGvdFlag ? 1 : 0 ), "z_gvd_flag" );
1570      WRITE_FLAG( ( sei.m_intrinsicParamGvdFlag ? 1 : 0 ), "intrinsic_param_gvd_flag" );
1571      WRITE_FLAG( ( sei.m_rotationGvdFlag ? 1 : 0 ), "rotation_gvd_flag" );
1572      WRITE_FLAG( ( sei.m_translationGvdFlag ? 1 : 0 ), "translation_gvd_flag" );
1573      if( sei.m_zGvdFlag )
1574      {
1575        for( Int i = 0, j = 0; j  <=  sei.m_numConstituentViewsGvdMinus1 + 1; j++ )
1576        {
1577          WRITE_FLAG( ( sei.m_signGvdZNearFlag[i][j] ? 1 : 0 ), "sign_gvd_z_near_flag" );
1578          WRITE_CODE( sei.m_expGvdZNear[i][j], 7, "exp_gvd_z_near" );
1579          WRITE_CODE( sei.m_manLenGvdZNearMinus1[i][j], 5, "man_len_gvd_z_near_minus1" );
1580          WRITE_CODE( sei.m_manGvdZNear[i][j], sei.m_manLenGvdZNearMinus1[i][j] + 1, "man_gvd_z_near" );
1581          WRITE_FLAG( ( sei.m_signGvdZFarFlag[i][j] ? 1 : 0 ), "sign_gvd_z_far_flag" );
1582          WRITE_CODE( sei.m_expGvdZFar[i][j], 7, "exp_gvd_z_far" );
1583          WRITE_CODE( sei.m_manLenGvdZFarMinus1[i][j], 5, "man_len_gvd_z_far_minus1" );
1584          WRITE_CODE( sei.m_manGvdZFar[i][j], sei.m_manLenGvdZFarMinus1[i][j] + 1, "man_gvd_z_far" );
1585        }
1586      }
1587      if( sei.m_intrinsicParamGvdFlag )
1588      {
1589        WRITE_UVLC( sei.m_precGvdFocalLength, "prec_gvd_focal_length" );
1590        WRITE_UVLC( sei.m_precGvdPrincipalPoint, "prec_gvd_principal_point" );
1591      }
1592      if( sei.m_rotationGvdFlag )
1593      {
1594        WRITE_UVLC( sei.m_precGvdRotationParam, "prec_gvd_rotation_param" );
1595      }
1596      if( sei.m_translationGvdFlag )
1597      {
1598        WRITE_UVLC( sei.m_precGvdTranslationParam, "prec_gvd_translation_param" );
1599      }
1600      for( Int i = 0, j = 0; j  <=  sei.m_numConstituentViewsGvdMinus1 + 1; j++ )
1601      {
1602        if( sei.m_intrinsicParamGvdFlag )
1603        {
1604          WRITE_FLAG( ( sei.m_signGvdFocalLengthX[i][j] ? 1 : 0 ), "sign_gvd_focal_length_x" );
1605          WRITE_CODE( sei.m_expGvdFocalLengthX[i][j], 6, "exp_gvd_focal_length_x" );
1606          WRITE_CODE( sei.m_manGvdFocalLengthX[i][j], sei.getManGvdFocalLengthXLen(i,j), "man_gvd_focal_length_x" );
1607          WRITE_FLAG( ( sei.m_signGvdFocalLengthY[i][j] ? 1 : 0 ), "sign_gvd_focal_length_y" );
1608          WRITE_CODE( sei.m_expGvdFocalLengthY[i][j], 6, "exp_gvd_focal_length_y" );
1609          WRITE_CODE( sei.m_manGvdFocalLengthY[i][j], sei.getManGvdFocalLengthYLen(i,j), "man_gvd_focal_length_y" );
1610          WRITE_FLAG( ( sei.m_signGvdPrincipalPointX[i][j] ? 1 : 0 ), "sign_gvd_principal_point_x" );
1611          WRITE_CODE( sei.m_expGvdPrincipalPointX[i][j], 6, "exp_gvd_principal_point_x" );
1612          WRITE_CODE( sei.m_manGvdPrincipalPointX[i][j], sei.getManGvdPrincipalPointXLen(i,j), "man_gvd_principal_point_x" );
1613          WRITE_FLAG( ( sei.m_signGvdPrincipalPointY[i][j] ? 1 : 0 ), "sign_gvd_principal_point_y" );
1614          WRITE_CODE( sei.m_expGvdPrincipalPointY[i][j], 6, "exp_gvd_principal_point_y" );
1615          WRITE_CODE( sei.m_manGvdPrincipalPointY[i][j], sei.getManGvdPrincipalPointYLen(i,j), "man_gvd_principal_point_y" );
1616        }
1617        if( sei.m_rotationGvdFlag )
1618        {
1619          WRITE_FLAG( ( sei.m_signGvdR00[i][j] ? 1 : 0 ), "sign_gvd_r00" );
1620          WRITE_CODE( sei.m_expGvdR00[i][j], 6, "exp_gvd_r00" );
1621          WRITE_CODE( sei.m_manGvdR00[i][j], sei.m_precGvdRotationParam, "man_gvd_r00" );
1622          WRITE_FLAG( ( sei.m_signGvdR01[i][j] ? 1 : 0 ), "sign_gvd_r01" );
1623          WRITE_CODE( sei.m_expGvdR01[i][j], 6, "exp_gvd_r01" );
1624          WRITE_CODE( sei.m_manGvdR01[i][j], sei.m_precGvdRotationParam, "man_gvd_r01" );
1625          WRITE_FLAG( ( sei.m_signGvdR02[i][j] ? 1 : 0 ), "sign_gvd_r02" );
1626          WRITE_CODE( sei.m_expGvdR02[i][j], 6, "exp_gvd_r02" );
1627          WRITE_CODE( sei.m_manGvdR02[i][j], sei.m_precGvdRotationParam, "man_gvd_r02" );
1628          WRITE_FLAG( ( sei.m_signGvdR10[i][j] ? 1 : 0 ), "sign_gvd_r10" );
1629          WRITE_CODE( sei.m_expGvdR10[i][j], 6, "exp_gvd_r10" );
1630          WRITE_CODE( sei.m_manGvdR10[i][j], sei.m_precGvdRotationParam, "man_gvd_r10" );
1631          WRITE_FLAG( ( sei.m_signGvdR11[i][j] ? 1 : 0 ), "sign_gvd_r11" );
1632          WRITE_CODE( sei.m_expGvdR11[i][j], 6, "exp_gvd_r11" );
1633          WRITE_CODE( sei.m_manGvdR11[i][j], sei.m_precGvdRotationParam, "man_gvd_r11" );
1634          WRITE_FLAG( ( sei.m_signGvdR12[i][j] ? 1 : 0 ), "sign_gvd_r12" );
1635          WRITE_CODE( sei.m_expGvdR12[i][j], 6, "exp_gvd_r12" );
1636          WRITE_CODE( sei.m_manGvdR12[i][j], sei.m_precGvdRotationParam, "man_gvd_r12" );
1637          WRITE_FLAG( ( sei.m_signGvdR20[i][j] ? 1 : 0 ), "sign_gvd_r20" );
1638          WRITE_CODE( sei.m_expGvdR20[i][j], 6, "exp_gvd_r20" );
1639          WRITE_CODE( sei.m_manGvdR20[i][j], sei.m_precGvdRotationParam, "man_gvd_r20" );
1640          WRITE_FLAG( ( sei.m_signGvdR21[i][j] ? 1 : 0 ), "sign_gvd_r21" );
1641          WRITE_CODE( sei.m_expGvdR21[i][j], 6, "exp_gvd_r21" );
1642          WRITE_CODE( sei.m_manGvdR21[i][j], sei.m_precGvdRotationParam, "man_gvd_r21" );
1643          WRITE_FLAG( ( sei.m_signGvdR22[i][j] ? 1 : 0 ), "sign_gvd_r22" );
1644          WRITE_CODE( sei.m_expGvdR22[i][j], 6, "exp_gvd_r22" );
1645          WRITE_CODE( sei.m_manGvdR22[i][j], sei.m_precGvdRotationParam, "man_gvd_r22" );
1646        }
1647        if( sei.m_translationGvdFlag )
1648        {
1649          WRITE_FLAG( ( sei.m_signGvdTX[i][j] ? 1 : 0 ), "sign_gvd_t_x" );
1650          WRITE_CODE( sei.m_expGvdTX[i][j], 6, "exp_gvd_t_x" );
1651          WRITE_CODE( sei.m_manGvdTX[i][j], sei.getManGvdTXLen(i,j), "man_gvd_t_x" );
1652        }
1653      }
1654    }
1655
1656    if( sei.m_depthType  ==  1 )
1657    {
1658      WRITE_SVLC( sei.m_minOffsetXInt, "min_offset_x_int" );
1659      WRITE_CODE( sei.m_minOffsetXFrac, 8, "min_offset_x_frac" );
1660      WRITE_SVLC( sei.m_maxOffsetXInt, "max_offset_x_int" );
1661      WRITE_CODE( sei.m_maxOffsetXFrac, 8, "max_offset_x_frac" );
1662      WRITE_FLAG( ( sei.m_offsetYPresentFlag ? 1 : 0 ), "offset_y_present_flag" );
1663      if( sei.m_offsetYPresentFlag )
1664      {
1665        WRITE_SVLC( sei.m_minOffsetYInt, "min_offset_y_int" );
1666        WRITE_CODE( sei.m_minOffsetYFrac, 8, "min_offset_y_frac" );
1667        WRITE_SVLC( sei.m_maxOffsetYInt, "max_offset_y_int" );
1668        WRITE_CODE( sei.m_maxOffsetYFrac, 8, "max_offset_y_frac" );
1669      }
1670      WRITE_FLAG( ( sei.m_warpMapSizePresentFlag ? 1 : 0 ), "warp_map_size_present_flag" );
1671      if( sei.m_warpMapSizePresentFlag )
1672      {
1673        WRITE_UVLC( sei.m_warpMapWidthMinus2, "warp_map_width_minus2" );
1674        WRITE_UVLC( sei.m_warpMapHeightMinus2, "warp_map_height_minus2" );
1675      }
1676    }
1677  }
1678};
1679#endif
1680#endif
1681
1682//! \}
Note: See TracBrowser for help on using the repository browser.