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