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-2014, 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 TAppEncTop.cpp |
---|
35 | \brief Encoder application class |
---|
36 | */ |
---|
37 | |
---|
38 | #include <list> |
---|
39 | #include <fstream> |
---|
40 | #include <stdlib.h> |
---|
41 | #include <stdio.h> |
---|
42 | #include <fcntl.h> |
---|
43 | #include <assert.h> |
---|
44 | |
---|
45 | #include "TAppEncTop.h" |
---|
46 | #include "TLibEncoder/AnnexBwrite.h" |
---|
47 | |
---|
48 | using namespace std; |
---|
49 | |
---|
50 | //! \ingroup TAppEncoder |
---|
51 | //! \{ |
---|
52 | |
---|
53 | // ==================================================================================================================== |
---|
54 | // Constructor / destructor / initialization / destroy |
---|
55 | // ==================================================================================================================== |
---|
56 | |
---|
57 | TAppEncTop::TAppEncTop() |
---|
58 | { |
---|
59 | m_iFrameRcvd = 0; |
---|
60 | m_totalBytes = 0; |
---|
61 | m_essentialBytes = 0; |
---|
62 | #if SVC_EXTENSION |
---|
63 | for(UInt layer=0; layer < MAX_LAYERS; layer++) |
---|
64 | { |
---|
65 | m_apcTEncTop[layer] = &m_acTEncTop[layer]; |
---|
66 | } |
---|
67 | #endif |
---|
68 | } |
---|
69 | |
---|
70 | TAppEncTop::~TAppEncTop() |
---|
71 | { |
---|
72 | } |
---|
73 | |
---|
74 | #if SVC_EXTENSION |
---|
75 | Void TAppEncTop::xInitLibCfg() |
---|
76 | { |
---|
77 | TComVPS* vps = m_acTEncTop[0].getVPS(); |
---|
78 | |
---|
79 | #if P0297_VPS_POC_LSB_ALIGNED_FLAG |
---|
80 | vps->setVpsPocLsbAlignedFlag(false); |
---|
81 | #endif |
---|
82 | vps->setMaxTLayers ( m_maxTempLayer ); |
---|
83 | if (m_maxTempLayer == 1) |
---|
84 | { |
---|
85 | vps->setTemporalNestingFlag(true); |
---|
86 | } |
---|
87 | for(Int i = 0; i < MAX_TLAYER; i++) |
---|
88 | { |
---|
89 | vps->setNumReorderPics ( m_numReorderPics[i], i ); |
---|
90 | vps->setMaxDecPicBuffering ( m_maxDecPicBuffering[i], i ); |
---|
91 | } |
---|
92 | |
---|
93 | #if REPN_FORMAT_IN_VPS |
---|
94 | Int maxRepFormatIdx = -1; |
---|
95 | Int formatIdx = -1; |
---|
96 | for(UInt layer=0; layer < m_numLayers; layer++) |
---|
97 | { |
---|
98 | // Auto generation of the format index |
---|
99 | if( m_acLayerCfg[layer].getRepFormatIdx() == -1 ) |
---|
100 | { |
---|
101 | Bool found = false; |
---|
102 | for( UInt idx = 0; idx < layer; idx++ ) |
---|
103 | { |
---|
104 | if( m_acLayerCfg[layer].getSourceWidth() == m_acLayerCfg[idx].getSourceWidth() && m_acLayerCfg[layer].getSourceHeight() == m_acLayerCfg[idx].getSourceHeight() |
---|
105 | #if AUXILIARY_PICTURES |
---|
106 | && m_acLayerCfg[layer].getChromaFormatIDC() == m_acLayerCfg[idx].getChromaFormatIDC() |
---|
107 | #endif |
---|
108 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
109 | && m_acLayerCfg[layer].m_internalBitDepthY == m_acLayerCfg[idx].m_internalBitDepthY && m_acLayerCfg[layer].m_internalBitDepthC == m_acLayerCfg[idx].m_internalBitDepthC |
---|
110 | #endif |
---|
111 | ) |
---|
112 | { |
---|
113 | found = true; |
---|
114 | break; |
---|
115 | } |
---|
116 | } |
---|
117 | if( !found ) |
---|
118 | { |
---|
119 | formatIdx++; |
---|
120 | } |
---|
121 | |
---|
122 | m_acLayerCfg[layer].setRepFormatIdx( formatIdx ); |
---|
123 | } |
---|
124 | |
---|
125 | assert( m_acLayerCfg[layer].getRepFormatIdx() != -1 && "RepFormatIdx not assigned for a layer" ); |
---|
126 | |
---|
127 | vps->setVpsRepFormatIdx( layer, m_acLayerCfg[layer].getRepFormatIdx() ); |
---|
128 | |
---|
129 | maxRepFormatIdx = std::max( m_acLayerCfg[layer].getRepFormatIdx(), maxRepFormatIdx ); |
---|
130 | } |
---|
131 | |
---|
132 | assert( vps->getVpsRepFormatIdx( 0 ) == 0 ); // Base layer should point to the first one. |
---|
133 | |
---|
134 | Int* mapIdxToLayer = new Int[maxRepFormatIdx + 1]; |
---|
135 | |
---|
136 | // Check that all the indices from 0 to maxRepFormatIdx are used in the VPS |
---|
137 | for(Int i = 0; i <= maxRepFormatIdx; i++) |
---|
138 | { |
---|
139 | mapIdxToLayer[i] = -1; |
---|
140 | UInt layer; |
---|
141 | for(layer=0; layer < m_numLayers; layer++) |
---|
142 | { |
---|
143 | if( vps->getVpsRepFormatIdx(layer) == i ) |
---|
144 | { |
---|
145 | mapIdxToLayer[i] = layer; |
---|
146 | break; |
---|
147 | } |
---|
148 | } |
---|
149 | assert( layer != m_numLayers ); // One of the VPS Rep format indices not set |
---|
150 | } |
---|
151 | |
---|
152 | vps->setVpsNumRepFormats( maxRepFormatIdx + 1 ); |
---|
153 | |
---|
154 | #if Q0195_REP_FORMAT_CLEANUP |
---|
155 | // When not present, the value of rep_format_idx_present_flag is inferred to be equal to 0 |
---|
156 | vps->setRepFormatIdxPresentFlag( vps->getVpsNumRepFormats() > 1 ? true : false ); |
---|
157 | #else |
---|
158 | vps->setRepFormatIdxPresentFlag( true ); |
---|
159 | #endif |
---|
160 | |
---|
161 | for(UInt idx=0; idx < vps->getVpsNumRepFormats(); idx++) |
---|
162 | { |
---|
163 | RepFormat *repFormat = vps->getVpsRepFormat( idx ); |
---|
164 | #if REPN_FORMAT_CONTROL_FLAG |
---|
165 | repFormat->setChromaAndBitDepthVpsPresentFlag( true ); |
---|
166 | if (idx==0) |
---|
167 | { |
---|
168 | assert(repFormat->getChromaAndBitDepthVpsPresentFlag() == true); |
---|
169 | } |
---|
170 | #endif |
---|
171 | repFormat->setPicWidthVpsInLumaSamples ( m_acLayerCfg[mapIdxToLayer[idx]].getSourceWidth() ); |
---|
172 | repFormat->setPicHeightVpsInLumaSamples ( m_acLayerCfg[mapIdxToLayer[idx]].getSourceHeight() ); |
---|
173 | #if AUXILIARY_PICTURES |
---|
174 | repFormat->setChromaFormatVpsIdc ( m_acLayerCfg[mapIdxToLayer[idx]].getChromaFormatIDC() ); |
---|
175 | #else |
---|
176 | repFormat->setChromaFormatVpsIdc ( 1 ); // Need modification to change for each layer - corresponds to 420 |
---|
177 | #endif |
---|
178 | repFormat->setSeparateColourPlaneVpsFlag( 0 ); // Need modification to change for each layer |
---|
179 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
180 | repFormat->setBitDepthVpsLuma ( getInternalBitDepthY(mapIdxToLayer[idx]) ); // Need modification to change for each layer |
---|
181 | repFormat->setBitDepthVpsChroma ( getInternalBitDepthC(mapIdxToLayer[idx]) ); // Need modification to change for each layer |
---|
182 | #else |
---|
183 | repFormat->setBitDepthVpsLuma ( getInternalBitDepthY() ); // Need modification to change for each layer |
---|
184 | repFormat->setBitDepthVpsChroma ( getInternalBitDepthC() ); // Need modification to change for each layer |
---|
185 | #endif |
---|
186 | |
---|
187 | #if R0156_CONF_WINDOW_IN_REP_FORMAT |
---|
188 | repFormat->getConformanceWindowVps().setWindow( |
---|
189 | m_acLayerCfg[mapIdxToLayer[idx]].m_confWinLeft, |
---|
190 | m_acLayerCfg[mapIdxToLayer[idx]].m_confWinRight, |
---|
191 | m_acLayerCfg[mapIdxToLayer[idx]].m_confWinTop, |
---|
192 | m_acLayerCfg[mapIdxToLayer[idx]].m_confWinBottom ); |
---|
193 | #endif |
---|
194 | |
---|
195 | #if HIGHER_LAYER_IRAP_SKIP_FLAG |
---|
196 | m_acTEncTop[mapIdxToLayer[idx]].setSkipPictureAtArcSwitch( m_skipPictureAtArcSwitch ); |
---|
197 | #endif |
---|
198 | } |
---|
199 | delete [] mapIdxToLayer; |
---|
200 | #endif |
---|
201 | |
---|
202 | assert( m_numLayers <= MAX_LAYERS ); |
---|
203 | |
---|
204 | for(UInt layer=0; layer<m_numLayers; layer++) |
---|
205 | { |
---|
206 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
207 | //1 |
---|
208 | g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY; |
---|
209 | g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC; |
---|
210 | |
---|
211 | g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY; |
---|
212 | g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC; |
---|
213 | |
---|
214 | // Set this to be used in Upsampling filter in function "TComUpsampleFilter::upsampleBasePic" |
---|
215 | g_bitDepthYLayer[layer] = g_bitDepthY; |
---|
216 | g_bitDepthCLayer[layer] = g_bitDepthC; |
---|
217 | |
---|
218 | #if O0194_WEIGHTED_PREDICTION_CGS |
---|
219 | m_acTEncTop[layer].setInterLayerWeightedPredFlag( m_useInterLayerWeightedPred ); |
---|
220 | #endif |
---|
221 | #endif |
---|
222 | //m_acTEncTop[layer].setVPS(&vps); |
---|
223 | m_acTEncTop[layer].setFrameRate ( m_acLayerCfg[layer].getFrameRate() ); |
---|
224 | m_acTEncTop[layer].setFrameSkip ( m_FrameSkip ); |
---|
225 | m_acTEncTop[layer].setSourceWidth ( m_acLayerCfg[layer].getSourceWidth() ); |
---|
226 | m_acTEncTop[layer].setSourceHeight ( m_acLayerCfg[layer].getSourceHeight() ); |
---|
227 | m_acTEncTop[layer].setConformanceWindow ( m_acLayerCfg[layer].m_confWinLeft, m_acLayerCfg[layer].m_confWinRight, m_acLayerCfg[layer].m_confWinTop, m_acLayerCfg[layer].m_confWinBottom ); |
---|
228 | m_acTEncTop[layer].setFramesToBeEncoded ( m_framesToBeEncoded ); |
---|
229 | |
---|
230 | m_acTEncTop[layer].setProfile(m_profile); |
---|
231 | m_acTEncTop[layer].setLevel(m_levelTier, m_level); |
---|
232 | m_acTEncTop[layer].setProgressiveSourceFlag(m_progressiveSourceFlag); |
---|
233 | m_acTEncTop[layer].setInterlacedSourceFlag(m_interlacedSourceFlag); |
---|
234 | m_acTEncTop[layer].setNonPackedConstraintFlag(m_nonPackedConstraintFlag); |
---|
235 | m_acTEncTop[layer].setFrameOnlyConstraintFlag(m_frameOnlyConstraintFlag); |
---|
236 | |
---|
237 | #if REF_IDX_MFM |
---|
238 | #if AVC_BASE |
---|
239 | #if VPS_AVC_BL_FLAG_REMOVAL |
---|
240 | m_acTEncTop[layer].setMFMEnabledFlag(layer == 0 ? false : ( m_nonHEVCBaseLayerFlag ? false : true ) && m_acLayerCfg[layer].getNumMotionPredRefLayers()); |
---|
241 | #else |
---|
242 | m_acTEncTop[layer].setMFMEnabledFlag(layer == 0 ? false : ( m_avcBaseLayerFlag ? false : true ) && m_acLayerCfg[layer].getNumMotionPredRefLayers()); |
---|
243 | #endif |
---|
244 | #else |
---|
245 | m_acTEncTop[layer].setMFMEnabledFlag(layer == 0 ? false : ( m_acLayerCfg[layer].getNumMotionPredRefLayers() > 0 ) ); |
---|
246 | #endif |
---|
247 | #endif |
---|
248 | // set layer ID |
---|
249 | m_acTEncTop[layer].setLayerId ( layer ); |
---|
250 | m_acTEncTop[layer].setNumLayer ( m_numLayers ); |
---|
251 | m_acTEncTop[layer].setLayerEnc(m_apcTEncTop); |
---|
252 | |
---|
253 | //====== Coding Structure ======== |
---|
254 | m_acTEncTop[layer].setIntraPeriod ( m_acLayerCfg[layer].m_iIntraPeriod ); |
---|
255 | m_acTEncTop[layer].setDecodingRefreshType ( m_iDecodingRefreshType ); |
---|
256 | m_acTEncTop[layer].setGOPSize ( m_iGOPSize ); |
---|
257 | #if Q0108_TSA_STSA |
---|
258 | m_acTEncTop[layer].setGopList ( layer ? m_EhGOPList[layer] : m_GOPList ); |
---|
259 | #else |
---|
260 | m_acTEncTop[layer].setGopList ( m_GOPList ); |
---|
261 | #endif |
---|
262 | |
---|
263 | #if !Q0108_TSA_STSA |
---|
264 | m_acTEncTop[layer].setExtraRPSs ( m_extraRPSs ); |
---|
265 | #else |
---|
266 | m_acTEncTop[layer].setExtraRPSs ( m_extraRPSs[layer] ); |
---|
267 | #endif |
---|
268 | for(Int i = 0; i < MAX_TLAYER; i++) |
---|
269 | { |
---|
270 | m_acTEncTop[layer].setNumReorderPics ( m_numReorderPics[i], i ); |
---|
271 | m_acTEncTop[layer].setMaxDecPicBuffering ( m_maxDecPicBuffering[i], i ); |
---|
272 | } |
---|
273 | for( UInt uiLoop = 0; uiLoop < MAX_TLAYER; ++uiLoop ) |
---|
274 | { |
---|
275 | m_acTEncTop[layer].setLambdaModifier( uiLoop, m_adLambdaModifier[ uiLoop ] ); |
---|
276 | } |
---|
277 | m_acTEncTop[layer].setQP ( m_acLayerCfg[layer].getIntQP() ); |
---|
278 | |
---|
279 | m_acTEncTop[layer].setPad ( m_acLayerCfg[layer].getPad() ); |
---|
280 | #if !Q0108_TSA_STSA |
---|
281 | m_acTEncTop[layer].setMaxTempLayer ( m_maxTempLayer ); |
---|
282 | #else |
---|
283 | if (layer== 0) |
---|
284 | { |
---|
285 | m_acTEncTop[layer].setMaxTempLayer ( m_maxTempLayer ); |
---|
286 | } |
---|
287 | else |
---|
288 | { |
---|
289 | m_acTEncTop[layer].setMaxTempLayer ( m_EhMaxTempLayer[layer] ); |
---|
290 | } |
---|
291 | #endif |
---|
292 | m_acTEncTop[layer].setUseAMP( m_enableAMP ); |
---|
293 | |
---|
294 | if( layer < m_numLayers - 1 ) |
---|
295 | { |
---|
296 | m_acTEncTop[layer].setMaxTidIlRefPicsPlus1 ( m_acLayerCfg[layer].getMaxTidIlRefPicsPlus1()); |
---|
297 | } |
---|
298 | |
---|
299 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
300 | if(layer) |
---|
301 | { |
---|
302 | for(Int i = 0; i < MAX_VPS_LAYER_ID_PLUS1; i++) |
---|
303 | { |
---|
304 | m_acTEncTop[layer].setSamplePredEnabledFlag(i, false); |
---|
305 | m_acTEncTop[layer].setMotionPredEnabledFlag(i, false); |
---|
306 | } |
---|
307 | if(m_acLayerCfg[layer].getNumSamplePredRefLayers() == -1) |
---|
308 | { |
---|
309 | // Not included in the configuration file; assume that each layer depends on previous layer |
---|
310 | m_acTEncTop[layer].setNumSamplePredRefLayers (1); // One sample pred ref. layer |
---|
311 | m_acTEncTop[layer].setSamplePredRefLayerId (0, layer - 1); // Previous layer |
---|
312 | m_acTEncTop[layer].setSamplePredEnabledFlag (layer - 1, true); |
---|
313 | } |
---|
314 | else |
---|
315 | { |
---|
316 | m_acTEncTop[layer].setNumSamplePredRefLayers ( m_acLayerCfg[layer].getNumSamplePredRefLayers() ); |
---|
317 | for(Int i = 0; i < m_acTEncTop[layer].getNumSamplePredRefLayers(); i++) |
---|
318 | { |
---|
319 | m_acTEncTop[layer].setSamplePredRefLayerId ( i, m_acLayerCfg[layer].getSamplePredRefLayerId(i)); |
---|
320 | m_acTEncTop[layer].setSamplePredEnabledFlag (m_acLayerCfg[layer].getSamplePredRefLayerId(i), true); |
---|
321 | } |
---|
322 | } |
---|
323 | if(m_acLayerCfg[layer].getNumMotionPredRefLayers() == -1) |
---|
324 | { |
---|
325 | // Not included in the configuration file; assume that each layer depends on previous layer |
---|
326 | m_acTEncTop[layer].setNumMotionPredRefLayers (1); // One motion pred ref. layer |
---|
327 | m_acTEncTop[layer].setMotionPredRefLayerId (0, layer - 1); // Previous layer |
---|
328 | m_acTEncTop[layer].setMotionPredEnabledFlag (layer - 1, true); |
---|
329 | } |
---|
330 | else |
---|
331 | { |
---|
332 | m_acTEncTop[layer].setNumMotionPredRefLayers ( m_acLayerCfg[layer].getNumMotionPredRefLayers() ); |
---|
333 | for(Int i = 0; i < m_acTEncTop[layer].getNumMotionPredRefLayers(); i++) |
---|
334 | { |
---|
335 | m_acTEncTop[layer].setMotionPredRefLayerId ( i, m_acLayerCfg[layer].getMotionPredRefLayerId(i)); |
---|
336 | m_acTEncTop[layer].setMotionPredEnabledFlag (m_acLayerCfg[layer].getMotionPredRefLayerId(i), true); |
---|
337 | } |
---|
338 | } |
---|
339 | Int numDirectRefLayers = 0; |
---|
340 | |
---|
341 | assert( layer < MAX_LAYERS ); |
---|
342 | |
---|
343 | for (Int i = 0; i < layer; i++) |
---|
344 | { |
---|
345 | if (m_acTEncTop[layer].getSamplePredEnabledFlag(i) || m_acTEncTop[layer].getMotionPredEnabledFlag(i)) |
---|
346 | { |
---|
347 | m_acTEncTop[layer].setRefLayerId(numDirectRefLayers, i); |
---|
348 | numDirectRefLayers++; |
---|
349 | } |
---|
350 | } |
---|
351 | m_acTEncTop[layer].setNumDirectRefLayers(numDirectRefLayers); |
---|
352 | |
---|
353 | if(m_acLayerCfg[layer].getNumActiveRefLayers() == -1) |
---|
354 | { |
---|
355 | m_acTEncTop[layer].setNumActiveRefLayers( m_acTEncTop[layer].getNumDirectRefLayers() ); |
---|
356 | for( Int i = 0; i < m_acTEncTop[layer].getNumActiveRefLayers(); i++ ) |
---|
357 | { |
---|
358 | m_acTEncTop[layer].setPredLayerId(i, i); |
---|
359 | } |
---|
360 | } |
---|
361 | else |
---|
362 | { |
---|
363 | m_acTEncTop[layer].setNumActiveRefLayers ( m_acLayerCfg[layer].getNumActiveRefLayers() ); |
---|
364 | for(Int i = 0; i < m_acTEncTop[layer].getNumActiveRefLayers(); i++) |
---|
365 | { |
---|
366 | m_acTEncTop[layer].setPredLayerId ( i, m_acLayerCfg[layer].getPredLayerId(i)); |
---|
367 | } |
---|
368 | } |
---|
369 | #if REF_REGION_OFFSET |
---|
370 | for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++) |
---|
371 | { |
---|
372 | #if AUXILIARY_PICTURES |
---|
373 | Int cf = m_acLayerCfg[i].m_chromaFormatIDC; |
---|
374 | Int rlSubWidthC = ( cf == CHROMA_420 || cf == CHROMA_422 ) ? 2 : 1; |
---|
375 | Int rlSubHeightC = ( cf == CHROMA_420 ) ? 2 : 1; |
---|
376 | #else |
---|
377 | Int rlSubWidthC = 2; |
---|
378 | Int rlSubHeightC = 2; |
---|
379 | #endif |
---|
380 | m_acTEncTop[layer].setRefRegionOffsetPresentFlag( i, m_acLayerCfg[layer].m_refRegionOffsetPresentFlag ); |
---|
381 | m_acTEncTop[layer].getRefLayerWindow(i).setWindow( rlSubWidthC * m_acLayerCfg[layer].m_refRegionLeftOffset[i], rlSubWidthC * m_acLayerCfg[layer].m_refRegionRightOffset[i], |
---|
382 | rlSubHeightC * m_acLayerCfg[layer].m_refRegionTopOffset[i], rlSubHeightC * m_acLayerCfg[layer].m_refRegionBottomOffset[i]); |
---|
383 | } |
---|
384 | #endif |
---|
385 | } |
---|
386 | else |
---|
387 | { |
---|
388 | assert( layer == 0 ); |
---|
389 | m_acTEncTop[layer].setNumDirectRefLayers(0); |
---|
390 | } |
---|
391 | #endif //VPS_EXTN_DIRECT_REF_LAYERS |
---|
392 | //===== Slice ======== |
---|
393 | |
---|
394 | //====== Loop/Deblock Filter ======== |
---|
395 | m_acTEncTop[layer].setLoopFilterDisable ( m_bLoopFilterDisable ); |
---|
396 | m_acTEncTop[layer].setLoopFilterOffsetInPPS ( m_loopFilterOffsetInPPS ); |
---|
397 | m_acTEncTop[layer].setLoopFilterBetaOffset ( m_loopFilterBetaOffsetDiv2 ); |
---|
398 | m_acTEncTop[layer].setLoopFilterTcOffset ( m_loopFilterTcOffsetDiv2 ); |
---|
399 | m_acTEncTop[layer].setDeblockingFilterControlPresent( m_DeblockingFilterControlPresent); |
---|
400 | m_acTEncTop[layer].setDeblockingFilterMetric ( m_DeblockingFilterMetric ); |
---|
401 | |
---|
402 | //====== Motion search ======== |
---|
403 | m_acTEncTop[layer].setFastSearch ( m_iFastSearch ); |
---|
404 | m_acTEncTop[layer].setSearchRange ( m_iSearchRange ); |
---|
405 | m_acTEncTop[layer].setBipredSearchRange ( m_bipredSearchRange ); |
---|
406 | |
---|
407 | //====== Quality control ======== |
---|
408 | m_acTEncTop[layer].setMaxDeltaQP ( m_iMaxDeltaQP ); |
---|
409 | m_acTEncTop[layer].setMaxCuDQPDepth ( m_iMaxCuDQPDepth ); |
---|
410 | |
---|
411 | m_acTEncTop[layer].setChromaCbQpOffset ( m_cbQpOffset ); |
---|
412 | m_acTEncTop[layer].setChromaCrQpOffset ( m_crQpOffset ); |
---|
413 | |
---|
414 | #if ADAPTIVE_QP_SELECTION |
---|
415 | m_acTEncTop[layer].setUseAdaptQpSelect ( m_bUseAdaptQpSelect ); |
---|
416 | #endif |
---|
417 | |
---|
418 | m_acTEncTop[layer].setUseAdaptiveQP ( m_bUseAdaptiveQP ); |
---|
419 | m_acTEncTop[layer].setQPAdaptationRange ( m_iQPAdaptationRange ); |
---|
420 | |
---|
421 | //====== Tool list ======== |
---|
422 | m_acTEncTop[layer].setDeltaQpRD ( m_uiDeltaQpRD ); |
---|
423 | m_acTEncTop[layer].setUseASR ( m_bUseASR ); |
---|
424 | m_acTEncTop[layer].setUseHADME ( m_bUseHADME ); |
---|
425 | m_acTEncTop[layer].setdQPs ( m_acLayerCfg[layer].getdQPs() ); |
---|
426 | m_acTEncTop[layer].setUseRDOQ ( m_useRDOQ ); |
---|
427 | m_acTEncTop[layer].setUseRDOQTS ( m_useRDOQTS ); |
---|
428 | m_acTEncTop[layer].setRDpenalty ( m_rdPenalty ); |
---|
429 | #if LAYER_CTB |
---|
430 | m_acTEncTop[layer].setQuadtreeTULog2MaxSize ( m_acLayerCfg[layer].m_uiQuadtreeTULog2MaxSize ); |
---|
431 | m_acTEncTop[layer].setQuadtreeTULog2MinSize ( m_acLayerCfg[layer].m_uiQuadtreeTULog2MinSize ); |
---|
432 | m_acTEncTop[layer].setQuadtreeTUMaxDepthInter ( m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthInter ); |
---|
433 | m_acTEncTop[layer].setQuadtreeTUMaxDepthIntra ( m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthIntra ); |
---|
434 | #else |
---|
435 | m_acTEncTop[layer].setQuadtreeTULog2MaxSize ( m_uiQuadtreeTULog2MaxSize ); |
---|
436 | m_acTEncTop[layer].setQuadtreeTULog2MinSize ( m_uiQuadtreeTULog2MinSize ); |
---|
437 | m_acTEncTop[layer].setQuadtreeTUMaxDepthInter ( m_uiQuadtreeTUMaxDepthInter ); |
---|
438 | m_acTEncTop[layer].setQuadtreeTUMaxDepthIntra ( m_uiQuadtreeTUMaxDepthIntra ); |
---|
439 | #endif |
---|
440 | m_acTEncTop[layer].setUseFastEnc ( m_bUseFastEnc ); |
---|
441 | m_acTEncTop[layer].setUseEarlyCU ( m_bUseEarlyCU ); |
---|
442 | m_acTEncTop[layer].setUseFastDecisionForMerge ( m_useFastDecisionForMerge ); |
---|
443 | m_acTEncTop[layer].setUseCbfFastMode ( m_bUseCbfFastMode ); |
---|
444 | m_acTEncTop[layer].setUseEarlySkipDetection ( m_useEarlySkipDetection ); |
---|
445 | #if FAST_INTRA_SHVC |
---|
446 | m_acTEncTop[layer].setUseFastIntraScalable ( m_useFastIntraScalable ); |
---|
447 | #endif |
---|
448 | |
---|
449 | m_acTEncTop[layer].setUseTransformSkip ( m_useTransformSkip ); |
---|
450 | m_acTEncTop[layer].setUseTransformSkipFast ( m_useTransformSkipFast ); |
---|
451 | m_acTEncTop[layer].setUseConstrainedIntraPred ( m_bUseConstrainedIntraPred ); |
---|
452 | m_acTEncTop[layer].setPCMLog2MinSize ( m_uiPCMLog2MinSize); |
---|
453 | m_acTEncTop[layer].setUsePCM ( m_usePCM ); |
---|
454 | m_acTEncTop[layer].setPCMLog2MaxSize ( m_pcmLog2MaxSize); |
---|
455 | m_acTEncTop[layer].setMaxNumMergeCand ( m_maxNumMergeCand ); |
---|
456 | |
---|
457 | |
---|
458 | //====== Weighted Prediction ======== |
---|
459 | m_acTEncTop[layer].setUseWP ( m_useWeightedPred ); |
---|
460 | m_acTEncTop[layer].setWPBiPred ( m_useWeightedBiPred ); |
---|
461 | #if O0194_WEIGHTED_PREDICTION_CGS |
---|
462 | if( layer != 0 && m_useInterLayerWeightedPred ) |
---|
463 | { |
---|
464 | // Enable weighted prediction for enhancement layer |
---|
465 | m_acTEncTop[layer].setUseWP ( true ); |
---|
466 | m_acTEncTop[layer].setWPBiPred ( true ); |
---|
467 | } |
---|
468 | #endif |
---|
469 | //====== Parallel Merge Estimation ======== |
---|
470 | m_acTEncTop[layer].setLog2ParallelMergeLevelMinus2 ( m_log2ParallelMergeLevel - 2 ); |
---|
471 | |
---|
472 | //====== Slice ======== |
---|
473 | m_acTEncTop[layer].setSliceMode ( m_sliceMode ); |
---|
474 | m_acTEncTop[layer].setSliceArgument ( m_sliceArgument ); |
---|
475 | |
---|
476 | //====== Dependent Slice ======== |
---|
477 | m_acTEncTop[layer].setSliceSegmentMode ( m_sliceSegmentMode ); |
---|
478 | m_acTEncTop[layer].setSliceSegmentArgument ( m_sliceSegmentArgument ); |
---|
479 | #if LAYER_CTB |
---|
480 | Int iNumPartInCU = 1<<(m_acLayerCfg[layer].m_uiMaxCUDepth<<1); |
---|
481 | #else |
---|
482 | Int iNumPartInCU = 1<<(m_uiMaxCUDepth<<1); |
---|
483 | #endif |
---|
484 | if(m_sliceSegmentMode==FIXED_NUMBER_OF_LCU) |
---|
485 | { |
---|
486 | m_acTEncTop[layer].setSliceSegmentArgument ( m_sliceSegmentArgument * iNumPartInCU ); |
---|
487 | } |
---|
488 | if(m_sliceMode==FIXED_NUMBER_OF_LCU) |
---|
489 | { |
---|
490 | m_acTEncTop[layer].setSliceArgument ( m_sliceArgument * iNumPartInCU ); |
---|
491 | } |
---|
492 | if(m_sliceMode==FIXED_NUMBER_OF_TILES) |
---|
493 | { |
---|
494 | m_acTEncTop[layer].setSliceArgument ( m_sliceArgument ); |
---|
495 | } |
---|
496 | |
---|
497 | if(m_sliceMode == 0 ) |
---|
498 | { |
---|
499 | m_bLFCrossSliceBoundaryFlag = true; |
---|
500 | } |
---|
501 | m_acTEncTop[layer].setLFCrossSliceBoundaryFlag( m_bLFCrossSliceBoundaryFlag ); |
---|
502 | m_acTEncTop[layer].setUseSAO ( m_bUseSAO ); |
---|
503 | m_acTEncTop[layer].setMaxNumOffsetsPerPic (m_maxNumOffsetsPerPic); |
---|
504 | |
---|
505 | m_acTEncTop[layer].setSaoLcuBoundary (m_saoLcuBoundary); |
---|
506 | m_acTEncTop[layer].setPCMInputBitDepthFlag ( m_bPCMInputBitDepthFlag); |
---|
507 | m_acTEncTop[layer].setPCMFilterDisableFlag ( m_bPCMFilterDisableFlag); |
---|
508 | |
---|
509 | m_acTEncTop[layer].setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled); |
---|
510 | m_acTEncTop[layer].setRecoveryPointSEIEnabled( m_recoveryPointSEIEnabled ); |
---|
511 | m_acTEncTop[layer].setBufferingPeriodSEIEnabled( m_bufferingPeriodSEIEnabled ); |
---|
512 | m_acTEncTop[layer].setPictureTimingSEIEnabled( m_pictureTimingSEIEnabled ); |
---|
513 | m_acTEncTop[layer].setToneMappingInfoSEIEnabled ( m_toneMappingInfoSEIEnabled ); |
---|
514 | m_acTEncTop[layer].setTMISEIToneMapId ( m_toneMapId ); |
---|
515 | m_acTEncTop[layer].setTMISEIToneMapCancelFlag ( m_toneMapCancelFlag ); |
---|
516 | m_acTEncTop[layer].setTMISEIToneMapPersistenceFlag ( m_toneMapPersistenceFlag ); |
---|
517 | m_acTEncTop[layer].setTMISEICodedDataBitDepth ( m_toneMapCodedDataBitDepth ); |
---|
518 | m_acTEncTop[layer].setTMISEITargetBitDepth ( m_toneMapTargetBitDepth ); |
---|
519 | m_acTEncTop[layer].setTMISEIModelID ( m_toneMapModelId ); |
---|
520 | m_acTEncTop[layer].setTMISEIMinValue ( m_toneMapMinValue ); |
---|
521 | m_acTEncTop[layer].setTMISEIMaxValue ( m_toneMapMaxValue ); |
---|
522 | m_acTEncTop[layer].setTMISEISigmoidMidpoint ( m_sigmoidMidpoint ); |
---|
523 | m_acTEncTop[layer].setTMISEISigmoidWidth ( m_sigmoidWidth ); |
---|
524 | m_acTEncTop[layer].setTMISEIStartOfCodedInterva ( m_startOfCodedInterval ); |
---|
525 | m_acTEncTop[layer].setTMISEINumPivots ( m_numPivots ); |
---|
526 | m_acTEncTop[layer].setTMISEICodedPivotValue ( m_codedPivotValue ); |
---|
527 | m_acTEncTop[layer].setTMISEITargetPivotValue ( m_targetPivotValue ); |
---|
528 | m_acTEncTop[layer].setTMISEICameraIsoSpeedIdc ( m_cameraIsoSpeedIdc ); |
---|
529 | m_acTEncTop[layer].setTMISEICameraIsoSpeedValue ( m_cameraIsoSpeedValue ); |
---|
530 | m_acTEncTop[layer].setTMISEIExposureCompensationValueSignFlag ( m_exposureCompensationValueSignFlag ); |
---|
531 | m_acTEncTop[layer].setTMISEIExposureCompensationValueNumerator ( m_exposureCompensationValueNumerator ); |
---|
532 | m_acTEncTop[layer].setTMISEIExposureCompensationValueDenomIdc ( m_exposureCompensationValueDenomIdc ); |
---|
533 | m_acTEncTop[layer].setTMISEIRefScreenLuminanceWhite ( m_refScreenLuminanceWhite ); |
---|
534 | m_acTEncTop[layer].setTMISEIExtendedRangeWhiteLevel ( m_extendedRangeWhiteLevel ); |
---|
535 | m_acTEncTop[layer].setTMISEINominalBlackLevelLumaCodeValue ( m_nominalBlackLevelLumaCodeValue ); |
---|
536 | m_acTEncTop[layer].setTMISEINominalWhiteLevelLumaCodeValue ( m_nominalWhiteLevelLumaCodeValue ); |
---|
537 | m_acTEncTop[layer].setTMISEIExtendedWhiteLevelLumaCodeValue ( m_extendedWhiteLevelLumaCodeValue ); |
---|
538 | #if P0050_KNEE_FUNCTION_SEI |
---|
539 | m_acTEncTop[layer].setKneeSEIEnabled ( m_kneeSEIEnabled ); |
---|
540 | m_acTEncTop[layer].setKneeSEIId ( m_kneeSEIId ); |
---|
541 | m_acTEncTop[layer].setKneeSEICancelFlag ( m_kneeSEICancelFlag ); |
---|
542 | m_acTEncTop[layer].setKneeSEIPersistenceFlag ( m_kneeSEIPersistenceFlag ); |
---|
543 | m_acTEncTop[layer].setKneeSEIMappingFlag ( m_kneeSEIMappingFlag ); |
---|
544 | m_acTEncTop[layer].setKneeSEIInputDrange ( m_kneeSEIInputDrange ); |
---|
545 | m_acTEncTop[layer].setKneeSEIInputDispLuminance ( m_kneeSEIInputDispLuminance ); |
---|
546 | m_acTEncTop[layer].setKneeSEIOutputDrange ( m_kneeSEIOutputDrange ); |
---|
547 | m_acTEncTop[layer].setKneeSEIOutputDispLuminance ( m_kneeSEIOutputDispLuminance ); |
---|
548 | m_acTEncTop[layer].setKneeSEINumKneePointsMinus1 ( m_kneeSEINumKneePointsMinus1 ); |
---|
549 | m_acTEncTop[layer].setKneeSEIInputKneePoint ( m_kneeSEIInputKneePoint ); |
---|
550 | m_acTEncTop[layer].setKneeSEIOutputKneePoint ( m_kneeSEIOutputKneePoint ); |
---|
551 | #endif |
---|
552 | #if Q0096_OVERLAY_SEI |
---|
553 | m_acTEncTop[layer].setOverlaySEIEnabled ( m_overlaySEIEnabled ); |
---|
554 | m_acTEncTop[layer].setOverlaySEICancelFlag ( m_overlayInfoCancelFlag ); |
---|
555 | m_acTEncTop[layer].setOverlaySEIContentAuxIdMinus128 ( m_overlayContentAuxIdMinus128 ); |
---|
556 | m_acTEncTop[layer].setOverlaySEILabelAuxIdMinus128 ( m_overlayLabelAuxIdMinus128 ); |
---|
557 | m_acTEncTop[layer].setOverlaySEIAlphaAuxIdMinus128 ( m_overlayAlphaAuxIdMinus128 ); |
---|
558 | m_acTEncTop[layer].setOverlaySEIElementLabelValueLengthMinus8 ( m_overlayElementLabelValueLengthMinus8 ); |
---|
559 | m_acTEncTop[layer].setOverlaySEINumOverlaysMinus1 ( m_numOverlaysMinus1 ); |
---|
560 | m_acTEncTop[layer].setOverlaySEIIdx ( m_overlayIdx ); |
---|
561 | m_acTEncTop[layer].setOverlaySEILanguagePresentFlag ( m_overlayLanguagePresentFlag ); |
---|
562 | m_acTEncTop[layer].setOverlaySEIContentLayerId ( m_overlayContentLayerId ); |
---|
563 | m_acTEncTop[layer].setOverlaySEILabelPresentFlag ( m_overlayLabelPresentFlag ); |
---|
564 | m_acTEncTop[layer].setOverlaySEILabelLayerId ( m_overlayLabelLayerId ); |
---|
565 | m_acTEncTop[layer].setOverlaySEIAlphaPresentFlag ( m_overlayAlphaPresentFlag ); |
---|
566 | m_acTEncTop[layer].setOverlaySEIAlphaLayerId ( m_overlayAlphaLayerId ); |
---|
567 | m_acTEncTop[layer].setOverlaySEINumElementsMinus1 ( m_numOverlayElementsMinus1 ); |
---|
568 | m_acTEncTop[layer].setOverlaySEIElementLabelMin ( m_overlayElementLabelMin ); |
---|
569 | m_acTEncTop[layer].setOverlaySEIElementLabelMax ( m_overlayElementLabelMax ); |
---|
570 | m_acTEncTop[layer].setOverlaySEILanguage ( m_overlayLanguage ); |
---|
571 | m_acTEncTop[layer].setOverlaySEIName ( m_overlayName ); |
---|
572 | m_acTEncTop[layer].setOverlaySEIElementName ( m_overlayElementName ); |
---|
573 | m_acTEncTop[layer].setOverlaySEIPersistenceFlag ( m_overlayInfoPersistenceFlag ); |
---|
574 | #endif |
---|
575 | #if Q0074_COLOUR_REMAPPING_SEI |
---|
576 | m_acTEncTop[layer].setCRISEIFile ( const_cast<Char*>(m_acLayerCfg[layer].m_colourRemapSEIFile.c_str()) ); |
---|
577 | m_acTEncTop[layer].setCRISEIId ( m_acLayerCfg[layer].m_colourRemapSEIId ); |
---|
578 | m_acTEncTop[layer].setCRISEICancelFlag ( m_acLayerCfg[layer].m_colourRemapSEICancelFlag ); |
---|
579 | m_acTEncTop[layer].setCRISEIPersistenceFlag ( m_acLayerCfg[layer].m_colourRemapSEIPersistenceFlag ); |
---|
580 | m_acTEncTop[layer].setCRISEIVideoSignalInfoPresentFlag ( m_acLayerCfg[layer].m_colourRemapSEIVideoSignalInfoPresentFlag ); |
---|
581 | m_acTEncTop[layer].setCRISEIFullRangeFlag ( m_acLayerCfg[layer].m_colourRemapSEIFullRangeFlag ); |
---|
582 | m_acTEncTop[layer].setCRISEIPrimaries ( m_acLayerCfg[layer].m_colourRemapSEIPrimaries ); |
---|
583 | m_acTEncTop[layer].setCRISEITransferFunction ( m_acLayerCfg[layer].m_colourRemapSEITransferFunction ); |
---|
584 | m_acTEncTop[layer].setCRISEIMatrixCoefficients ( m_acLayerCfg[layer].m_colourRemapSEIMatrixCoefficients ); |
---|
585 | m_acTEncTop[layer].setCRISEIInputBitDepth ( m_acLayerCfg[layer].m_colourRemapSEIInputBitDepth ); |
---|
586 | m_acTEncTop[layer].setCRISEIBitDepth ( m_acLayerCfg[layer].m_colourRemapSEIBitDepth ); |
---|
587 | m_acTEncTop[layer].setCRISEIPreLutNumValMinus1 ( m_acLayerCfg[layer].m_colourRemapSEIPreLutNumValMinus1 ); |
---|
588 | m_acTEncTop[layer].setCRISEIPreLutCodedValue ( m_acLayerCfg[layer].m_colourRemapSEIPreLutCodedValue ); |
---|
589 | m_acTEncTop[layer].setCRISEIPreLutTargetValue ( m_acLayerCfg[layer].m_colourRemapSEIPreLutTargetValue ); |
---|
590 | m_acTEncTop[layer].setCRISEIMatrixPresentFlag ( m_acLayerCfg[layer].m_colourRemapSEIMatrixPresentFlag ); |
---|
591 | m_acTEncTop[layer].setCRISEILog2MatrixDenom ( m_acLayerCfg[layer].m_colourRemapSEILog2MatrixDenom ); |
---|
592 | m_acTEncTop[layer].setCRISEICoeffs ( m_acLayerCfg[layer].m_colourRemapSEICoeffs ); |
---|
593 | m_acTEncTop[layer].setCRISEIPostLutNumValMinus1 ( m_acLayerCfg[layer].m_colourRemapSEIPostLutNumValMinus1 ); |
---|
594 | m_acTEncTop[layer].setCRISEIPostLutCodedValue ( m_acLayerCfg[layer]. m_colourRemapSEIPostLutCodedValue ); |
---|
595 | m_acTEncTop[layer].setCRISEIPostLutTargetValue ( m_acLayerCfg[layer].m_colourRemapSEIPostLutTargetValue ); |
---|
596 | #endif |
---|
597 | m_acTEncTop[layer].setFramePackingArrangementSEIEnabled( m_framePackingSEIEnabled ); |
---|
598 | m_acTEncTop[layer].setFramePackingArrangementSEIType( m_framePackingSEIType ); |
---|
599 | m_acTEncTop[layer].setFramePackingArrangementSEIId( m_framePackingSEIId ); |
---|
600 | m_acTEncTop[layer].setFramePackingArrangementSEIQuincunx( m_framePackingSEIQuincunx ); |
---|
601 | m_acTEncTop[layer].setFramePackingArrangementSEIInterpretation( m_framePackingSEIInterpretation ); |
---|
602 | m_acTEncTop[layer].setDisplayOrientationSEIAngle( m_displayOrientationSEIAngle ); |
---|
603 | m_acTEncTop[layer].setTemporalLevel0IndexSEIEnabled( m_temporalLevel0IndexSEIEnabled ); |
---|
604 | m_acTEncTop[layer].setGradualDecodingRefreshInfoEnabled( m_gradualDecodingRefreshInfoEnabled ); |
---|
605 | m_acTEncTop[layer].setDecodingUnitInfoSEIEnabled( m_decodingUnitInfoSEIEnabled ); |
---|
606 | #if LAYERS_NOT_PRESENT_SEI |
---|
607 | m_acTEncTop[layer].setLayersNotPresentSEIEnabled( m_layersNotPresentSEIEnabled ); |
---|
608 | #endif |
---|
609 | m_acTEncTop[layer].setSOPDescriptionSEIEnabled( m_SOPDescriptionSEIEnabled ); |
---|
610 | m_acTEncTop[layer].setScalableNestingSEIEnabled( m_scalableNestingSEIEnabled ); |
---|
611 | #if Q0189_TMVP_CONSTRAINTS |
---|
612 | m_acTEncTop[layer].setTMVPConstraintsSEIEnabled( m_TMVPConstraintsSEIEnabled); |
---|
613 | #endif |
---|
614 | #if N0383_IL_CONSTRAINED_TILE_SETS_SEI |
---|
615 | m_acTEncTop[layer].setInterLayerConstrainedTileSetsSEIEnabled( m_interLayerConstrainedTileSetsSEIEnabled ); |
---|
616 | m_acTEncTop[layer].setIlNumSetsInMessage( m_ilNumSetsInMessage ); |
---|
617 | m_acTEncTop[layer].setSkippedTileSetPresentFlag( m_skippedTileSetPresentFlag ); |
---|
618 | m_acTEncTop[layer].setTopLeftTileIndex( m_topLeftTileIndex ); |
---|
619 | m_acTEncTop[layer].setBottomRightTileIndex( m_bottomRightTileIndex ); |
---|
620 | m_acTEncTop[layer].setIlcIdc( m_ilcIdc ); |
---|
621 | #endif |
---|
622 | m_acTEncTop[layer].setTileUniformSpacingFlag ( m_tileUniformSpacingFlag ); |
---|
623 | m_acTEncTop[layer].setNumColumnsMinus1 ( m_numTileColumnsMinus1 ); |
---|
624 | m_acTEncTop[layer].setNumRowsMinus1 ( m_numTileRowsMinus1 ); |
---|
625 | if(!m_tileUniformSpacingFlag) |
---|
626 | { |
---|
627 | m_acTEncTop[layer].setColumnWidth ( m_tileColumnWidth ); |
---|
628 | m_acTEncTop[layer].setRowHeight ( m_tileRowHeight ); |
---|
629 | } |
---|
630 | m_acTEncTop[layer].xCheckGSParameters(); |
---|
631 | Int uiTilesCount = (m_numTileRowsMinus1+1) * (m_numTileColumnsMinus1+1); |
---|
632 | if(uiTilesCount == 1) |
---|
633 | { |
---|
634 | m_bLFCrossTileBoundaryFlag = true; |
---|
635 | } |
---|
636 | m_acTEncTop[layer].setLFCrossTileBoundaryFlag( m_bLFCrossTileBoundaryFlag ); |
---|
637 | m_acTEncTop[layer].setWaveFrontSynchro ( m_acLayerCfg[layer].m_waveFrontSynchro ); |
---|
638 | m_acTEncTop[layer].setWaveFrontSubstreams ( m_acLayerCfg[layer].m_iWaveFrontSubstreams ); |
---|
639 | m_acTEncTop[layer].setTMVPModeId ( m_TMVPModeId ); |
---|
640 | m_acTEncTop[layer].setUseScalingListId ( m_useScalingListId ); |
---|
641 | m_acTEncTop[layer].setScalingListFile ( m_scalingListFile ); |
---|
642 | m_acTEncTop[layer].setSignHideFlag(m_signHideFlag); |
---|
643 | #if RC_SHVC_HARMONIZATION |
---|
644 | m_acTEncTop[layer].setUseRateCtrl (m_acLayerCfg[layer].getRCEnableRateControl()); |
---|
645 | m_acTEncTop[layer].setTargetBitrate (m_acLayerCfg[layer].getRCTargetBitrate()); |
---|
646 | m_acTEncTop[layer].setKeepHierBit (m_acLayerCfg[layer].getRCKeepHierarchicalBit()); |
---|
647 | m_acTEncTop[layer].setLCULevelRC (m_acLayerCfg[layer].getRCLCULevelRC()); |
---|
648 | m_acTEncTop[layer].setUseLCUSeparateModel (m_acLayerCfg[layer].getRCUseLCUSeparateModel()); |
---|
649 | m_acTEncTop[layer].setInitialQP (m_acLayerCfg[layer].getRCInitialQP()); |
---|
650 | m_acTEncTop[layer].setForceIntraQP (m_acLayerCfg[layer].getRCForceIntraQP()); |
---|
651 | #else |
---|
652 | m_acTEncTop[layer].setUseRateCtrl ( m_RCEnableRateControl ); |
---|
653 | m_acTEncTop[layer].setTargetBitrate ( m_RCTargetBitrate ); |
---|
654 | m_acTEncTop[layer].setKeepHierBit ( m_RCKeepHierarchicalBit ); |
---|
655 | m_acTEncTop[layer].setLCULevelRC ( m_RCLCULevelRC ); |
---|
656 | m_acTEncTop[layer].setUseLCUSeparateModel ( m_RCUseLCUSeparateModel ); |
---|
657 | m_acTEncTop[layer].setInitialQP ( m_RCInitialQP ); |
---|
658 | m_acTEncTop[layer].setForceIntraQP ( m_RCForceIntraQP ); |
---|
659 | #endif |
---|
660 | m_acTEncTop[layer].setTransquantBypassEnableFlag(m_TransquantBypassEnableFlag); |
---|
661 | m_acTEncTop[layer].setCUTransquantBypassFlagForceValue(m_CUTransquantBypassFlagForce); |
---|
662 | m_acTEncTop[layer].setUseRecalculateQPAccordingToLambda( m_recalculateQPAccordingToLambda ); |
---|
663 | m_acTEncTop[layer].setUseStrongIntraSmoothing( m_useStrongIntraSmoothing ); |
---|
664 | m_acTEncTop[layer].setActiveParameterSetsSEIEnabled ( m_activeParameterSetsSEIEnabled ); |
---|
665 | m_acTEncTop[layer].setVuiParametersPresentFlag( m_vuiParametersPresentFlag ); |
---|
666 | m_acTEncTop[layer].setAspectRatioInfoPresentFlag( m_aspectRatioInfoPresentFlag); |
---|
667 | m_acTEncTop[layer].setAspectRatioIdc( m_aspectRatioIdc ); |
---|
668 | m_acTEncTop[layer].setSarWidth( m_sarWidth ); |
---|
669 | m_acTEncTop[layer].setSarHeight( m_sarHeight ); |
---|
670 | m_acTEncTop[layer].setOverscanInfoPresentFlag( m_overscanInfoPresentFlag ); |
---|
671 | m_acTEncTop[layer].setOverscanAppropriateFlag( m_overscanAppropriateFlag ); |
---|
672 | m_acTEncTop[layer].setVideoSignalTypePresentFlag( m_videoSignalTypePresentFlag ); |
---|
673 | m_acTEncTop[layer].setVideoFormat( m_videoFormat ); |
---|
674 | m_acTEncTop[layer].setVideoFullRangeFlag( m_videoFullRangeFlag ); |
---|
675 | m_acTEncTop[layer].setColourDescriptionPresentFlag( m_colourDescriptionPresentFlag ); |
---|
676 | m_acTEncTop[layer].setColourPrimaries( m_colourPrimaries ); |
---|
677 | m_acTEncTop[layer].setTransferCharacteristics( m_transferCharacteristics ); |
---|
678 | m_acTEncTop[layer].setMatrixCoefficients( m_matrixCoefficients ); |
---|
679 | m_acTEncTop[layer].setChromaLocInfoPresentFlag( m_chromaLocInfoPresentFlag ); |
---|
680 | m_acTEncTop[layer].setChromaSampleLocTypeTopField( m_chromaSampleLocTypeTopField ); |
---|
681 | m_acTEncTop[layer].setChromaSampleLocTypeBottomField( m_chromaSampleLocTypeBottomField ); |
---|
682 | m_acTEncTop[layer].setNeutralChromaIndicationFlag( m_neutralChromaIndicationFlag ); |
---|
683 | m_acTEncTop[layer].setDefaultDisplayWindow( m_defDispWinLeftOffset, m_defDispWinRightOffset, m_defDispWinTopOffset, m_defDispWinBottomOffset ); |
---|
684 | m_acTEncTop[layer].setFrameFieldInfoPresentFlag( m_frameFieldInfoPresentFlag ); |
---|
685 | m_acTEncTop[layer].setPocProportionalToTimingFlag( m_pocProportionalToTimingFlag ); |
---|
686 | m_acTEncTop[layer].setNumTicksPocDiffOneMinus1 ( m_numTicksPocDiffOneMinus1 ); |
---|
687 | m_acTEncTop[layer].setBitstreamRestrictionFlag( m_bitstreamRestrictionFlag ); |
---|
688 | m_acTEncTop[layer].setTilesFixedStructureFlag( m_tilesFixedStructureFlag ); |
---|
689 | m_acTEncTop[layer].setMotionVectorsOverPicBoundariesFlag( m_motionVectorsOverPicBoundariesFlag ); |
---|
690 | m_acTEncTop[layer].setMinSpatialSegmentationIdc( m_minSpatialSegmentationIdc ); |
---|
691 | m_acTEncTop[layer].setMaxBytesPerPicDenom( m_maxBytesPerPicDenom ); |
---|
692 | m_acTEncTop[layer].setMaxBitsPerMinCuDenom( m_maxBitsPerMinCuDenom ); |
---|
693 | m_acTEncTop[layer].setLog2MaxMvLengthHorizontal( m_log2MaxMvLengthHorizontal ); |
---|
694 | m_acTEncTop[layer].setLog2MaxMvLengthVertical( m_log2MaxMvLengthVertical ); |
---|
695 | m_acTEncTop[layer].setElRapSliceTypeB(layer == 0? 0 : m_elRapSliceBEnabled); |
---|
696 | if( layer > 0 ) |
---|
697 | { |
---|
698 | #if REF_REGION_OFFSET |
---|
699 | #if AUXILIARY_PICTURES |
---|
700 | Int cf = m_acLayerCfg[layer].m_chromaFormatIDC; |
---|
701 | Int subWidthC = ( cf == CHROMA_420 || cf == CHROMA_422 ) ? 2 : 1; |
---|
702 | Int subHeightC = ( cf == CHROMA_420 ) ? 2 : 1; |
---|
703 | #else |
---|
704 | Int subWidthC = 2; |
---|
705 | Int subHeightC = 2; |
---|
706 | #endif |
---|
707 | #endif |
---|
708 | m_acTEncTop[layer].setNumScaledRefLayerOffsets( m_acLayerCfg[layer].m_numScaledRefLayerOffsets ); |
---|
709 | for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++) |
---|
710 | { |
---|
711 | #if O0098_SCALED_REF_LAYER_ID |
---|
712 | m_acTEncTop[layer].setScaledRefLayerId(i, m_acLayerCfg[layer].m_scaledRefLayerId[i]); |
---|
713 | #endif |
---|
714 | #if REF_REGION_OFFSET |
---|
715 | m_acTEncTop[layer].setScaledRefLayerOffsetPresentFlag( i, m_acLayerCfg[layer].m_scaledRefLayerOffsetPresentFlag[i] ); |
---|
716 | m_acTEncTop[layer].getScaledRefLayerWindow(i).setWindow( subWidthC * m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i], subWidthC * m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i], |
---|
717 | subHeightC * m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i], subHeightC * m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i]); |
---|
718 | #else |
---|
719 | #if P0312_VERT_PHASE_ADJ |
---|
720 | m_acTEncTop[layer].setVertPhasePositionEnableFlag( i, m_acLayerCfg[layer].m_vertPhasePositionEnableFlag[i] ); |
---|
721 | m_acTEncTop[layer].getScaledRefLayerWindow(i).setWindow( 2*m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i], |
---|
722 | 2*m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i], m_acLayerCfg[layer].m_vertPhasePositionEnableFlag[i] ); |
---|
723 | #else |
---|
724 | m_acTEncTop[layer].getScaledRefLayerWindow(i).setWindow( 2*m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i], |
---|
725 | 2*m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i]); |
---|
726 | #endif |
---|
727 | #endif |
---|
728 | #if R0209_GENERIC_PHASE |
---|
729 | m_acTEncTop[layer].setResamplePhaseSetPresentFlag( i, m_acLayerCfg[layer].m_resamplePhaseSetPresentFlag[i] ); |
---|
730 | m_acTEncTop[layer].setPhaseHorLuma( i, m_acLayerCfg[layer].m_phaseHorLuma[i] ); |
---|
731 | m_acTEncTop[layer].setPhaseVerLuma( i, m_acLayerCfg[layer].m_phaseVerLuma[i] ); |
---|
732 | m_acTEncTop[layer].setPhaseHorChroma( i, m_acLayerCfg[layer].m_phaseHorChroma[i] ); |
---|
733 | m_acTEncTop[layer].setPhaseVerChroma( i, m_acLayerCfg[layer].m_phaseVerChroma[i] ); |
---|
734 | #endif |
---|
735 | } |
---|
736 | } |
---|
737 | #if M0040_ADAPTIVE_RESOLUTION_CHANGE |
---|
738 | m_acTEncTop[layer].setAdaptiveResolutionChange( m_adaptiveResolutionChange ); |
---|
739 | #endif |
---|
740 | #if AUXILIARY_PICTURES |
---|
741 | m_acTEncTop[layer].setChromaFormatIDC( m_acLayerCfg[layer].m_chromaFormatIDC ); |
---|
742 | #endif |
---|
743 | #if O0153_ALT_OUTPUT_LAYER_FLAG |
---|
744 | m_acTEncTop[layer].setAltOuputLayerFlag( m_altOutputLayerFlag ); |
---|
745 | #endif |
---|
746 | #if O0149_CROSS_LAYER_BLA_FLAG |
---|
747 | m_acTEncTop[layer].setCrossLayerBLAFlag( m_crossLayerBLAFlag ); |
---|
748 | #endif |
---|
749 | #if Q0048_CGS_3D_ASYMLUT |
---|
750 | m_acTEncTop[layer].setCGSFlag( layer == 0 ? 0 : m_nCGSFlag ); |
---|
751 | m_acTEncTop[layer].setCGSMaxOctantDepth( m_nCGSMaxOctantDepth ); |
---|
752 | m_acTEncTop[layer].setCGSMaxYPartNumLog2( m_nCGSMaxYPartNumLog2 ); |
---|
753 | m_acTEncTop[layer].setCGSLUTBit( m_nCGSLUTBit ); |
---|
754 | #if R0151_CGS_3D_ASYMLUT_IMPROVE |
---|
755 | m_acTEncTop[layer].setCGSAdaptChroma( m_nCGSAdaptiveChroma ); |
---|
756 | #endif |
---|
757 | #if R0179_ENC_OPT_3DLUT_SIZE |
---|
758 | m_acTEncTop[layer].setCGSLutSizeRDO( m_nCGSLutSizeRDO ); |
---|
759 | #endif |
---|
760 | #endif |
---|
761 | #if Q0078_ADD_LAYER_SETS |
---|
762 | m_acTEncTop[layer].setNumAddLayerSets( m_numAddLayerSets ); |
---|
763 | #endif |
---|
764 | } |
---|
765 | } |
---|
766 | #else //SVC_EXTENSION |
---|
767 | Void TAppEncTop::xInitLibCfg() |
---|
768 | { |
---|
769 | TComVPS vps; |
---|
770 | |
---|
771 | vps.setMaxTLayers ( m_maxTempLayer ); |
---|
772 | if (m_maxTempLayer == 1) |
---|
773 | { |
---|
774 | vps.setTemporalNestingFlag(true); |
---|
775 | } |
---|
776 | vps.setMaxLayers ( 1 ); |
---|
777 | for(Int i = 0; i < MAX_TLAYER; i++) |
---|
778 | { |
---|
779 | vps.setNumReorderPics ( m_numReorderPics[i], i ); |
---|
780 | vps.setMaxDecPicBuffering ( m_maxDecPicBuffering[i], i ); |
---|
781 | } |
---|
782 | m_cTEncTop.setVPS(&vps); |
---|
783 | |
---|
784 | m_cTEncTop.setProfile(m_profile); |
---|
785 | m_cTEncTop.setLevel(m_levelTier, m_level); |
---|
786 | m_cTEncTop.setProgressiveSourceFlag(m_progressiveSourceFlag); |
---|
787 | m_cTEncTop.setInterlacedSourceFlag(m_interlacedSourceFlag); |
---|
788 | m_cTEncTop.setNonPackedConstraintFlag(m_nonPackedConstraintFlag); |
---|
789 | m_cTEncTop.setFrameOnlyConstraintFlag(m_frameOnlyConstraintFlag); |
---|
790 | |
---|
791 | m_cTEncTop.setFrameRate ( m_iFrameRate ); |
---|
792 | m_cTEncTop.setFrameSkip ( m_FrameSkip ); |
---|
793 | m_cTEncTop.setSourceWidth ( m_iSourceWidth ); |
---|
794 | m_cTEncTop.setSourceHeight ( m_iSourceHeight ); |
---|
795 | m_cTEncTop.setConformanceWindow ( m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom ); |
---|
796 | m_cTEncTop.setFramesToBeEncoded ( m_framesToBeEncoded ); |
---|
797 | |
---|
798 | //====== Coding Structure ======== |
---|
799 | m_cTEncTop.setIntraPeriod ( m_iIntraPeriod ); |
---|
800 | m_cTEncTop.setDecodingRefreshType ( m_iDecodingRefreshType ); |
---|
801 | m_cTEncTop.setGOPSize ( m_iGOPSize ); |
---|
802 | m_cTEncTop.setGopList ( m_GOPList ); |
---|
803 | m_cTEncTop.setExtraRPSs ( m_extraRPSs ); |
---|
804 | for(Int i = 0; i < MAX_TLAYER; i++) |
---|
805 | { |
---|
806 | m_cTEncTop.setNumReorderPics ( m_numReorderPics[i], i ); |
---|
807 | m_cTEncTop.setMaxDecPicBuffering ( m_maxDecPicBuffering[i], i ); |
---|
808 | } |
---|
809 | for( UInt uiLoop = 0; uiLoop < MAX_TLAYER; ++uiLoop ) |
---|
810 | { |
---|
811 | m_cTEncTop.setLambdaModifier( uiLoop, m_adLambdaModifier[ uiLoop ] ); |
---|
812 | } |
---|
813 | m_cTEncTop.setQP ( m_iQP ); |
---|
814 | |
---|
815 | m_cTEncTop.setPad ( m_aiPad ); |
---|
816 | |
---|
817 | m_cTEncTop.setMaxTempLayer ( m_maxTempLayer ); |
---|
818 | m_cTEncTop.setUseAMP( m_enableAMP ); |
---|
819 | |
---|
820 | //===== Slice ======== |
---|
821 | |
---|
822 | //====== Loop/Deblock Filter ======== |
---|
823 | m_cTEncTop.setLoopFilterDisable ( m_bLoopFilterDisable ); |
---|
824 | m_cTEncTop.setLoopFilterOffsetInPPS ( m_loopFilterOffsetInPPS ); |
---|
825 | m_cTEncTop.setLoopFilterBetaOffset ( m_loopFilterBetaOffsetDiv2 ); |
---|
826 | m_cTEncTop.setLoopFilterTcOffset ( m_loopFilterTcOffsetDiv2 ); |
---|
827 | m_cTEncTop.setDeblockingFilterControlPresent( m_DeblockingFilterControlPresent); |
---|
828 | m_cTEncTop.setDeblockingFilterMetric ( m_DeblockingFilterMetric ); |
---|
829 | |
---|
830 | //====== Motion search ======== |
---|
831 | m_cTEncTop.setFastSearch ( m_iFastSearch ); |
---|
832 | m_cTEncTop.setSearchRange ( m_iSearchRange ); |
---|
833 | m_cTEncTop.setBipredSearchRange ( m_bipredSearchRange ); |
---|
834 | |
---|
835 | //====== Quality control ======== |
---|
836 | m_cTEncTop.setMaxDeltaQP ( m_iMaxDeltaQP ); |
---|
837 | m_cTEncTop.setMaxCuDQPDepth ( m_iMaxCuDQPDepth ); |
---|
838 | |
---|
839 | m_cTEncTop.setChromaCbQpOffset ( m_cbQpOffset ); |
---|
840 | m_cTEncTop.setChromaCrQpOffset ( m_crQpOffset ); |
---|
841 | |
---|
842 | #if ADAPTIVE_QP_SELECTION |
---|
843 | m_cTEncTop.setUseAdaptQpSelect ( m_bUseAdaptQpSelect ); |
---|
844 | #endif |
---|
845 | |
---|
846 | m_cTEncTop.setUseAdaptiveQP ( m_bUseAdaptiveQP ); |
---|
847 | m_cTEncTop.setQPAdaptationRange ( m_iQPAdaptationRange ); |
---|
848 | |
---|
849 | //====== Tool list ======== |
---|
850 | m_cTEncTop.setDeltaQpRD ( m_uiDeltaQpRD ); |
---|
851 | m_cTEncTop.setUseASR ( m_bUseASR ); |
---|
852 | m_cTEncTop.setUseHADME ( m_bUseHADME ); |
---|
853 | m_cTEncTop.setdQPs ( m_aidQP ); |
---|
854 | m_cTEncTop.setUseRDOQ ( m_useRDOQ ); |
---|
855 | m_cTEncTop.setUseRDOQTS ( m_useRDOQTS ); |
---|
856 | m_cTEncTop.setRDpenalty ( m_rdPenalty ); |
---|
857 | m_cTEncTop.setQuadtreeTULog2MaxSize ( m_uiQuadtreeTULog2MaxSize ); |
---|
858 | m_cTEncTop.setQuadtreeTULog2MinSize ( m_uiQuadtreeTULog2MinSize ); |
---|
859 | m_cTEncTop.setQuadtreeTUMaxDepthInter ( m_uiQuadtreeTUMaxDepthInter ); |
---|
860 | m_cTEncTop.setQuadtreeTUMaxDepthIntra ( m_uiQuadtreeTUMaxDepthIntra ); |
---|
861 | m_cTEncTop.setUseFastEnc ( m_bUseFastEnc ); |
---|
862 | m_cTEncTop.setUseEarlyCU ( m_bUseEarlyCU ); |
---|
863 | m_cTEncTop.setUseFastDecisionForMerge ( m_useFastDecisionForMerge ); |
---|
864 | m_cTEncTop.setUseCbfFastMode ( m_bUseCbfFastMode ); |
---|
865 | m_cTEncTop.setUseEarlySkipDetection ( m_useEarlySkipDetection ); |
---|
866 | #if FAST_INTRA_SHVC |
---|
867 | m_cTEncTop.setUseFastIntraScalable ( m_useFastIntraScalable ); |
---|
868 | #endif |
---|
869 | |
---|
870 | m_cTEncTop.setUseTransformSkip ( m_useTransformSkip ); |
---|
871 | m_cTEncTop.setUseTransformSkipFast ( m_useTransformSkipFast ); |
---|
872 | m_cTEncTop.setUseConstrainedIntraPred ( m_bUseConstrainedIntraPred ); |
---|
873 | m_cTEncTop.setPCMLog2MinSize ( m_uiPCMLog2MinSize); |
---|
874 | m_cTEncTop.setUsePCM ( m_usePCM ); |
---|
875 | m_cTEncTop.setPCMLog2MaxSize ( m_pcmLog2MaxSize); |
---|
876 | m_cTEncTop.setMaxNumMergeCand ( m_maxNumMergeCand ); |
---|
877 | |
---|
878 | |
---|
879 | //====== Weighted Prediction ======== |
---|
880 | m_cTEncTop.setUseWP ( m_useWeightedPred ); |
---|
881 | m_cTEncTop.setWPBiPred ( m_useWeightedBiPred ); |
---|
882 | //====== Parallel Merge Estimation ======== |
---|
883 | m_cTEncTop.setLog2ParallelMergeLevelMinus2 ( m_log2ParallelMergeLevel - 2 ); |
---|
884 | |
---|
885 | //====== Slice ======== |
---|
886 | m_cTEncTop.setSliceMode ( m_sliceMode ); |
---|
887 | m_cTEncTop.setSliceArgument ( m_sliceArgument ); |
---|
888 | |
---|
889 | //====== Dependent Slice ======== |
---|
890 | m_cTEncTop.setSliceSegmentMode ( m_sliceSegmentMode ); |
---|
891 | m_cTEncTop.setSliceSegmentArgument ( m_sliceSegmentArgument ); |
---|
892 | Int iNumPartInCU = 1<<(m_uiMaxCUDepth<<1); |
---|
893 | if(m_sliceSegmentMode==FIXED_NUMBER_OF_LCU) |
---|
894 | { |
---|
895 | m_cTEncTop.setSliceSegmentArgument ( m_sliceSegmentArgument * iNumPartInCU ); |
---|
896 | } |
---|
897 | if(m_sliceMode==FIXED_NUMBER_OF_LCU) |
---|
898 | { |
---|
899 | m_cTEncTop.setSliceArgument ( m_sliceArgument * iNumPartInCU ); |
---|
900 | } |
---|
901 | if(m_sliceMode==FIXED_NUMBER_OF_TILES) |
---|
902 | { |
---|
903 | m_cTEncTop.setSliceArgument ( m_sliceArgument ); |
---|
904 | } |
---|
905 | |
---|
906 | if(m_sliceMode == 0 ) |
---|
907 | { |
---|
908 | m_bLFCrossSliceBoundaryFlag = true; |
---|
909 | } |
---|
910 | m_cTEncTop.setLFCrossSliceBoundaryFlag( m_bLFCrossSliceBoundaryFlag ); |
---|
911 | m_cTEncTop.setUseSAO ( m_bUseSAO ); |
---|
912 | m_cTEncTop.setMaxNumOffsetsPerPic (m_maxNumOffsetsPerPic); |
---|
913 | |
---|
914 | m_cTEncTop.setSaoLcuBoundary (m_saoLcuBoundary); |
---|
915 | m_cTEncTop.setPCMInputBitDepthFlag ( m_bPCMInputBitDepthFlag); |
---|
916 | m_cTEncTop.setPCMFilterDisableFlag ( m_bPCMFilterDisableFlag); |
---|
917 | |
---|
918 | m_cTEncTop.setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled); |
---|
919 | m_cTEncTop.setRecoveryPointSEIEnabled( m_recoveryPointSEIEnabled ); |
---|
920 | m_cTEncTop.setBufferingPeriodSEIEnabled( m_bufferingPeriodSEIEnabled ); |
---|
921 | m_cTEncTop.setPictureTimingSEIEnabled( m_pictureTimingSEIEnabled ); |
---|
922 | m_cTEncTop.setToneMappingInfoSEIEnabled ( m_toneMappingInfoSEIEnabled ); |
---|
923 | m_cTEncTop.setTMISEIToneMapId ( m_toneMapId ); |
---|
924 | m_cTEncTop.setTMISEIToneMapCancelFlag ( m_toneMapCancelFlag ); |
---|
925 | m_cTEncTop.setTMISEIToneMapPersistenceFlag ( m_toneMapPersistenceFlag ); |
---|
926 | m_cTEncTop.setTMISEICodedDataBitDepth ( m_toneMapCodedDataBitDepth ); |
---|
927 | m_cTEncTop.setTMISEITargetBitDepth ( m_toneMapTargetBitDepth ); |
---|
928 | m_cTEncTop.setTMISEIModelID ( m_toneMapModelId ); |
---|
929 | m_cTEncTop.setTMISEIMinValue ( m_toneMapMinValue ); |
---|
930 | m_cTEncTop.setTMISEIMaxValue ( m_toneMapMaxValue ); |
---|
931 | m_cTEncTop.setTMISEISigmoidMidpoint ( m_sigmoidMidpoint ); |
---|
932 | m_cTEncTop.setTMISEISigmoidWidth ( m_sigmoidWidth ); |
---|
933 | m_cTEncTop.setTMISEIStartOfCodedInterva ( m_startOfCodedInterval ); |
---|
934 | m_cTEncTop.setTMISEINumPivots ( m_numPivots ); |
---|
935 | m_cTEncTop.setTMISEICodedPivotValue ( m_codedPivotValue ); |
---|
936 | m_cTEncTop.setTMISEITargetPivotValue ( m_targetPivotValue ); |
---|
937 | m_cTEncTop.setTMISEICameraIsoSpeedIdc ( m_cameraIsoSpeedIdc ); |
---|
938 | m_cTEncTop.setTMISEICameraIsoSpeedValue ( m_cameraIsoSpeedValue ); |
---|
939 | m_cTEncTop.setTMISEIExposureIndexIdc ( m_exposureIndexIdc ); |
---|
940 | m_cTEncTop.setTMISEIExposureIndexValue ( m_exposureIndexValue ); |
---|
941 | m_cTEncTop.setTMISEIExposureCompensationValueSignFlag ( m_exposureCompensationValueSignFlag ); |
---|
942 | m_cTEncTop.setTMISEIExposureCompensationValueNumerator ( m_exposureCompensationValueNumerator ); |
---|
943 | m_cTEncTop.setTMISEIExposureCompensationValueDenomIdc ( m_exposureCompensationValueDenomIdc ); |
---|
944 | m_cTEncTop.setTMISEIRefScreenLuminanceWhite ( m_refScreenLuminanceWhite ); |
---|
945 | m_cTEncTop.setTMISEIExtendedRangeWhiteLevel ( m_extendedRangeWhiteLevel ); |
---|
946 | m_cTEncTop.setTMISEINominalBlackLevelLumaCodeValue ( m_nominalBlackLevelLumaCodeValue ); |
---|
947 | m_cTEncTop.setTMISEINominalWhiteLevelLumaCodeValue ( m_nominalWhiteLevelLumaCodeValue ); |
---|
948 | m_cTEncTop.setTMISEIExtendedWhiteLevelLumaCodeValue ( m_extendedWhiteLevelLumaCodeValue ); |
---|
949 | #if P0050_KNEE_FUNCTION_SEI |
---|
950 | m_cTEncTop.setKneeSEIEnabled ( m_kneeSEIEnabled ); |
---|
951 | m_cTEncTop.setKneeSEIId ( m_kneeSEIId ); |
---|
952 | m_cTEncTop.setKneeSEICancelFlag ( m_kneeSEICancelFlag ); |
---|
953 | m_cTEncTop.setKneeSEIPersistenceFlag ( m_kneeSEIPersistenceFlag ); |
---|
954 | m_cTEncTop.setKneeSEIMappingFlag ( m_kneeSEIMappingFlag ); |
---|
955 | m_cTEncTop.setKneeSEIInputDrange ( m_kneeSEIInputDrange ); |
---|
956 | m_cTEncTop.setKneeSEIInputDispLuminance ( m_kneeSEIInputDispLuminance ); |
---|
957 | m_cTEncTop.setKneeSEIOutputDrange ( m_kneeSEIOutputDrange ); |
---|
958 | m_cTEncTop.setKneeSEIOutputDispLuminance ( m_kneeSEIOutputDispLuminance ); |
---|
959 | m_cTEncTop.setKneeSEINumKneePointsMinus1 ( m_kneeSEINumKneePointsMinus1 ); |
---|
960 | m_cTEncTop.setKneeSEIInputKneePoint ( m_kneeSEIInputKneePoint ); |
---|
961 | m_cTEncTop.setKneeSEIOutputKneePoint ( m_kneeSEIOutputKneePoint ); |
---|
962 | #endif |
---|
963 | #if Q0074_COLOUR_REMAPPING_SEI |
---|
964 | m_cTEncTop.setCRISEIFile ( const_cast<Char*>(m_colourRemapSEIFile.c_str()) ); |
---|
965 | m_cTEncTop.setCRISEIId ( m_colourRemapSEIId ); |
---|
966 | m_cTEncTop.setCRISEICancelFlag ( m_colourRemapSEICancelFlag ); |
---|
967 | m_cTEncTop.setCRISEIPersistenceFlag ( m_colourRemapSEIPersistenceFlag ); |
---|
968 | m_cTEncTop.setCRISEIVideoSignalInfoPresentFlag ( m_colourRemapSEIVideoSignalInfoPresentFlag ); |
---|
969 | m_cTEncTop.setCRISEIFullRangeFlag ( m_colourRemapSEIFullRangeFlag ); |
---|
970 | m_cTEncTop.setCRISEIPrimaries ( m_colourRemapSEIPrimaries ); |
---|
971 | m_cTEncTop.setCRISEITransferFunction ( m_colourRemapSEITransferFunction ); |
---|
972 | m_cTEncTop.setCRISEIMatrixCoefficients ( m_colourRemapSEIMatrixCoefficients ); |
---|
973 | m_cTEncTop.setCRISEIInputBitDepth ( m_colourRemapSEIInputBitDepth ); |
---|
974 | m_cTEncTop.setCRISEIBitDepth ( m_colourRemapSEIBitDepth ); |
---|
975 | m_cTEncTop.setCRISEIPreLutNumValMinus1 ( m_colourRemapSEIPreLutNumValMinus1 ); |
---|
976 | m_cTEncTop.setCRISEIPreLutCodedValue ( m_colourRemapSEIPreLutCodedValue ); |
---|
977 | m_cTEncTop.setCRISEIPreLutTargetValue ( m_colourRemapSEIPreLutTargetValue ); |
---|
978 | m_cTEncTop.setCRISEIMatrixPresentFlag ( m_colourRemapSEIMatrixPresentFlag ); |
---|
979 | m_cTEncTop.setCRISEILog2MatrixDenom ( m_colourRemapSEILog2MatrixDenom ); |
---|
980 | m_cTEncTop.setCRISEICoeffs ( m_colourRemapSEICoeffs ); |
---|
981 | m_cTEncTop.setCRISEIPostLutNumValMinus1 ( m_colourRemapSEIPostLutNumValMinus1 ); |
---|
982 | m_cTEncTop.setCRISEIPostLutCodedValue ( m_colourRemapSEIPostLutCodedValue ); |
---|
983 | m_cTEncTop.setCRISEIPostLutTargetValue ( m_colourRemapSEIPostLutTargetValue ); |
---|
984 | #endif |
---|
985 | m_cTEncTop.setFramePackingArrangementSEIEnabled( m_framePackingSEIEnabled ); |
---|
986 | m_cTEncTop.setFramePackingArrangementSEIType( m_framePackingSEIType ); |
---|
987 | m_cTEncTop.setFramePackingArrangementSEIId( m_framePackingSEIId ); |
---|
988 | m_cTEncTop.setFramePackingArrangementSEIQuincunx( m_framePackingSEIQuincunx ); |
---|
989 | m_cTEncTop.setFramePackingArrangementSEIInterpretation( m_framePackingSEIInterpretation ); |
---|
990 | m_cTEncTop.setDisplayOrientationSEIAngle( m_displayOrientationSEIAngle ); |
---|
991 | m_cTEncTop.setTemporalLevel0IndexSEIEnabled( m_temporalLevel0IndexSEIEnabled ); |
---|
992 | m_cTEncTop.setGradualDecodingRefreshInfoEnabled( m_gradualDecodingRefreshInfoEnabled ); |
---|
993 | m_cTEncTop.setDecodingUnitInfoSEIEnabled( m_decodingUnitInfoSEIEnabled ); |
---|
994 | #if LAYERS_NOT_PRESENT_SEI |
---|
995 | m_cTEncTop.setLayersNotPresentSEIEnabled( m_layersNotPresentSEIEnabled ); |
---|
996 | #endif |
---|
997 | m_cTEncTop.setSOPDescriptionSEIEnabled( m_SOPDescriptionSEIEnabled ); |
---|
998 | m_cTEncTop.setScalableNestingSEIEnabled( m_scalableNestingSEIEnabled ); |
---|
999 | m_cTEncTop.setTileUniformSpacingFlag ( m_tileUniformSpacingFlag ); |
---|
1000 | m_cTEncTop.setNumColumnsMinus1 ( m_numTileColumnsMinus1 ); |
---|
1001 | m_cTEncTop.setNumRowsMinus1 ( m_numTileRowsMinus1 ); |
---|
1002 | if(!m_tileUniformSpacingFlag) |
---|
1003 | { |
---|
1004 | m_cTEncTop.setColumnWidth ( m_tileColumnWidth ); |
---|
1005 | m_cTEncTop.setRowHeight ( m_tileRowHeight ); |
---|
1006 | } |
---|
1007 | m_cTEncTop.xCheckGSParameters(); |
---|
1008 | Int uiTilesCount = (m_numTileRowsMinus1+1) * (m_numTileColumnsMinus1+1); |
---|
1009 | if(uiTilesCount == 1) |
---|
1010 | { |
---|
1011 | m_bLFCrossTileBoundaryFlag = true; |
---|
1012 | } |
---|
1013 | m_cTEncTop.setLFCrossTileBoundaryFlag( m_bLFCrossTileBoundaryFlag ); |
---|
1014 | m_cTEncTop.setWaveFrontSynchro ( m_iWaveFrontSynchro ); |
---|
1015 | m_cTEncTop.setWaveFrontSubstreams ( m_iWaveFrontSubstreams ); |
---|
1016 | m_cTEncTop.setTMVPModeId ( m_TMVPModeId ); |
---|
1017 | m_cTEncTop.setUseScalingListId ( m_useScalingListId ); |
---|
1018 | m_cTEncTop.setScalingListFile ( m_scalingListFile ); |
---|
1019 | m_cTEncTop.setSignHideFlag(m_signHideFlag); |
---|
1020 | m_cTEncTop.setUseRateCtrl ( m_RCEnableRateControl ); |
---|
1021 | m_cTEncTop.setTargetBitrate ( m_RCTargetBitrate ); |
---|
1022 | m_cTEncTop.setKeepHierBit ( m_RCKeepHierarchicalBit ); |
---|
1023 | m_cTEncTop.setLCULevelRC ( m_RCLCULevelRC ); |
---|
1024 | m_cTEncTop.setUseLCUSeparateModel ( m_RCUseLCUSeparateModel ); |
---|
1025 | m_cTEncTop.setInitialQP ( m_RCInitialQP ); |
---|
1026 | m_cTEncTop.setForceIntraQP ( m_RCForceIntraQP ); |
---|
1027 | m_cTEncTop.setTransquantBypassEnableFlag(m_TransquantBypassEnableFlag); |
---|
1028 | m_cTEncTop.setCUTransquantBypassFlagForceValue(m_CUTransquantBypassFlagForce); |
---|
1029 | m_cTEncTop.setUseRecalculateQPAccordingToLambda( m_recalculateQPAccordingToLambda ); |
---|
1030 | m_cTEncTop.setUseStrongIntraSmoothing( m_useStrongIntraSmoothing ); |
---|
1031 | m_cTEncTop.setActiveParameterSetsSEIEnabled ( m_activeParameterSetsSEIEnabled ); |
---|
1032 | m_cTEncTop.setVuiParametersPresentFlag( m_vuiParametersPresentFlag ); |
---|
1033 | m_cTEncTop.setAspectRatioInfoPresentFlag( m_aspectRatioInfoPresentFlag); |
---|
1034 | m_cTEncTop.setAspectRatioIdc( m_aspectRatioIdc ); |
---|
1035 | m_cTEncTop.setSarWidth( m_sarWidth ); |
---|
1036 | m_cTEncTop.setSarHeight( m_sarHeight ); |
---|
1037 | m_cTEncTop.setOverscanInfoPresentFlag( m_overscanInfoPresentFlag ); |
---|
1038 | m_cTEncTop.setOverscanAppropriateFlag( m_overscanAppropriateFlag ); |
---|
1039 | m_cTEncTop.setVideoSignalTypePresentFlag( m_videoSignalTypePresentFlag ); |
---|
1040 | m_cTEncTop.setVideoFormat( m_videoFormat ); |
---|
1041 | m_cTEncTop.setVideoFullRangeFlag( m_videoFullRangeFlag ); |
---|
1042 | m_cTEncTop.setColourDescriptionPresentFlag( m_colourDescriptionPresentFlag ); |
---|
1043 | m_cTEncTop.setColourPrimaries( m_colourPrimaries ); |
---|
1044 | m_cTEncTop.setTransferCharacteristics( m_transferCharacteristics ); |
---|
1045 | m_cTEncTop.setMatrixCoefficients( m_matrixCoefficients ); |
---|
1046 | m_cTEncTop.setChromaLocInfoPresentFlag( m_chromaLocInfoPresentFlag ); |
---|
1047 | m_cTEncTop.setChromaSampleLocTypeTopField( m_chromaSampleLocTypeTopField ); |
---|
1048 | m_cTEncTop.setChromaSampleLocTypeBottomField( m_chromaSampleLocTypeBottomField ); |
---|
1049 | m_cTEncTop.setNeutralChromaIndicationFlag( m_neutralChromaIndicationFlag ); |
---|
1050 | m_cTEncTop.setDefaultDisplayWindow( m_defDispWinLeftOffset, m_defDispWinRightOffset, m_defDispWinTopOffset, m_defDispWinBottomOffset ); |
---|
1051 | m_cTEncTop.setFrameFieldInfoPresentFlag( m_frameFieldInfoPresentFlag ); |
---|
1052 | m_cTEncTop.setPocProportionalToTimingFlag( m_pocProportionalToTimingFlag ); |
---|
1053 | m_cTEncTop.setNumTicksPocDiffOneMinus1 ( m_numTicksPocDiffOneMinus1 ); |
---|
1054 | m_cTEncTop.setBitstreamRestrictionFlag( m_bitstreamRestrictionFlag ); |
---|
1055 | m_cTEncTop.setTilesFixedStructureFlag( m_tilesFixedStructureFlag ); |
---|
1056 | m_cTEncTop.setMotionVectorsOverPicBoundariesFlag( m_motionVectorsOverPicBoundariesFlag ); |
---|
1057 | m_cTEncTop.setMinSpatialSegmentationIdc( m_minSpatialSegmentationIdc ); |
---|
1058 | m_cTEncTop.setMaxBytesPerPicDenom( m_maxBytesPerPicDenom ); |
---|
1059 | m_cTEncTop.setMaxBitsPerMinCuDenom( m_maxBitsPerMinCuDenom ); |
---|
1060 | m_cTEncTop.setLog2MaxMvLengthHorizontal( m_log2MaxMvLengthHorizontal ); |
---|
1061 | m_cTEncTop.setLog2MaxMvLengthVertical( m_log2MaxMvLengthVertical ); |
---|
1062 | } |
---|
1063 | #endif //SVC_EXTENSION |
---|
1064 | |
---|
1065 | Void TAppEncTop::xCreateLib() |
---|
1066 | { |
---|
1067 | // Video I/O |
---|
1068 | #if SVC_EXTENSION |
---|
1069 | // initialize global variables |
---|
1070 | initROM(); |
---|
1071 | |
---|
1072 | for(UInt layer=0; layer<m_numLayers; layer++) |
---|
1073 | { |
---|
1074 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
1075 | //2 |
---|
1076 | g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY; |
---|
1077 | g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC; |
---|
1078 | |
---|
1079 | g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY; |
---|
1080 | g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC; |
---|
1081 | #endif |
---|
1082 | #if LAYER_CTB |
---|
1083 | g_uiMaxCUWidth = g_auiLayerMaxCUWidth[layer]; |
---|
1084 | g_uiMaxCUHeight = g_auiLayerMaxCUHeight[layer]; |
---|
1085 | g_uiMaxCUDepth = g_auiLayerMaxCUDepth[layer]; |
---|
1086 | g_uiAddCUDepth = g_auiLayerAddCUDepth[layer]; |
---|
1087 | #endif |
---|
1088 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
1089 | m_acTVideoIOYuvInputFile[layer].open( (Char *)m_acLayerCfg[layer].getInputFile().c_str(), false, m_acLayerCfg[layer].m_inputBitDepthY, m_acLayerCfg[layer].m_inputBitDepthC, m_acLayerCfg[layer].m_internalBitDepthY, m_acLayerCfg[layer].m_internalBitDepthC ); // read mode |
---|
1090 | #else |
---|
1091 | m_acTVideoIOYuvInputFile[layer].open( (Char *)m_acLayerCfg[layer].getInputFile().c_str(), false, m_inputBitDepthY, m_inputBitDepthC, m_internalBitDepthY, m_internalBitDepthC ); // read mode |
---|
1092 | #endif |
---|
1093 | m_acTVideoIOYuvInputFile[layer].skipFrames(m_FrameSkip, m_acLayerCfg[layer].getSourceWidth() - m_acLayerCfg[layer].getPad()[0], m_acLayerCfg[layer].getSourceHeight() - m_acLayerCfg[layer].getPad()[1]); |
---|
1094 | |
---|
1095 | if (!m_acLayerCfg[layer].getReconFile().empty()) |
---|
1096 | { |
---|
1097 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
1098 | m_acTVideoIOYuvReconFile[layer].open((Char *)m_acLayerCfg[layer].getReconFile().c_str(), true, m_acLayerCfg[layer].m_outputBitDepthY, m_acLayerCfg[layer].m_outputBitDepthC, m_acLayerCfg[layer].m_internalBitDepthY, m_acLayerCfg[layer].m_internalBitDepthC ); // write mode |
---|
1099 | #else |
---|
1100 | m_acTVideoIOYuvReconFile[layer].open((Char *)m_acLayerCfg[layer].getReconFile().c_str(), true, m_outputBitDepthY, m_outputBitDepthC, m_internalBitDepthY, m_internalBitDepthC ); // write mode |
---|
1101 | #endif |
---|
1102 | } |
---|
1103 | |
---|
1104 | m_acTEncTop[layer].create(); |
---|
1105 | } |
---|
1106 | #else //SVC_EXTENSION |
---|
1107 | m_cTVideoIOYuvInputFile.open( m_pchInputFile, false, m_inputBitDepthY, m_inputBitDepthC, m_internalBitDepthY, m_internalBitDepthC ); // read mode |
---|
1108 | m_cTVideoIOYuvInputFile.skipFrames(m_FrameSkip, m_iSourceWidth - m_aiPad[0], m_iSourceHeight - m_aiPad[1]); |
---|
1109 | |
---|
1110 | if (m_pchReconFile) |
---|
1111 | m_cTVideoIOYuvReconFile.open(m_pchReconFile, true, m_outputBitDepthY, m_outputBitDepthC, m_internalBitDepthY, m_internalBitDepthC); // write mode |
---|
1112 | |
---|
1113 | // Neo Decoder |
---|
1114 | m_cTEncTop.create(); |
---|
1115 | #endif //SVC_EXTENSION |
---|
1116 | } |
---|
1117 | |
---|
1118 | Void TAppEncTop::xDestroyLib() |
---|
1119 | { |
---|
1120 | // Video I/O |
---|
1121 | #if SVC_EXTENSION |
---|
1122 | // destroy ROM |
---|
1123 | destroyROM(); |
---|
1124 | |
---|
1125 | for(UInt layer=0; layer<m_numLayers; layer++) |
---|
1126 | { |
---|
1127 | #if LAYER_CTB |
---|
1128 | g_uiMaxCUWidth = g_auiLayerMaxCUWidth[layer]; |
---|
1129 | g_uiMaxCUHeight = g_auiLayerMaxCUHeight[layer]; |
---|
1130 | g_uiMaxCUDepth = g_auiLayerMaxCUDepth[layer]; |
---|
1131 | g_uiAddCUDepth = g_auiLayerAddCUDepth[layer]; |
---|
1132 | #endif |
---|
1133 | |
---|
1134 | m_acTVideoIOYuvInputFile[layer].close(); |
---|
1135 | m_acTVideoIOYuvReconFile[layer].close(); |
---|
1136 | |
---|
1137 | m_acTEncTop[layer].destroy(); |
---|
1138 | } |
---|
1139 | #else //SVC_EXTENSION |
---|
1140 | m_cTVideoIOYuvInputFile.close(); |
---|
1141 | m_cTVideoIOYuvReconFile.close(); |
---|
1142 | |
---|
1143 | // Neo Decoder |
---|
1144 | m_cTEncTop.destroy(); |
---|
1145 | #endif //SVC_EXTENSION |
---|
1146 | } |
---|
1147 | |
---|
1148 | Void TAppEncTop::xInitLib(Bool isFieldCoding) |
---|
1149 | { |
---|
1150 | #if SVC_EXTENSION |
---|
1151 | for(UInt layer=0; layer<m_numLayers; layer++) |
---|
1152 | { |
---|
1153 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
1154 | //3 |
---|
1155 | g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY; |
---|
1156 | g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC; |
---|
1157 | |
---|
1158 | g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY; |
---|
1159 | g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC; |
---|
1160 | #endif |
---|
1161 | #if LAYER_CTB |
---|
1162 | g_uiMaxCUWidth = g_auiLayerMaxCUWidth[layer]; |
---|
1163 | g_uiMaxCUHeight = g_auiLayerMaxCUHeight[layer]; |
---|
1164 | g_uiMaxCUDepth = g_auiLayerMaxCUDepth[layer]; |
---|
1165 | g_uiAddCUDepth = g_auiLayerAddCUDepth[layer]; |
---|
1166 | |
---|
1167 | memcpy( g_auiZscanToRaster, g_auiLayerZscanToRaster[layer], sizeof( g_auiZscanToRaster ) ); |
---|
1168 | memcpy( g_auiRasterToZscan, g_auiLayerRasterToZscan[layer], sizeof( g_auiRasterToZscan ) ); |
---|
1169 | memcpy( g_auiRasterToPelX, g_auiLayerRasterToPelX[layer], sizeof( g_auiRasterToPelX ) ); |
---|
1170 | memcpy( g_auiRasterToPelY, g_auiLayerRasterToPelY[layer], sizeof( g_auiRasterToPelY ) ); |
---|
1171 | #endif |
---|
1172 | m_acTEncTop[layer].init(isFieldCoding); |
---|
1173 | #if P0182_VPS_VUI_PS_FLAG |
---|
1174 | m_acTEncTop[layer].getVPS()->setSPSId(layer, m_acTEncTop[layer].getSPS()->getSPSId()); |
---|
1175 | m_acTEncTop[layer].getVPS()->setPPSId(layer, m_acTEncTop[layer].getPPS()->getPPSId()); |
---|
1176 | #endif |
---|
1177 | } |
---|
1178 | m_acTEncTop[0].getVPS()->setMaxLayers( m_numLayers ); |
---|
1179 | #if VPS_EXTN_OP_LAYER_SETS |
---|
1180 | TComVPS* vps = m_acTEncTop[0].getVPS(); |
---|
1181 | vps->setMaxLayerId(m_numLayers - 1); // Set max-layer ID |
---|
1182 | |
---|
1183 | vps->setVpsExtensionFlag( m_numLayers > 1 ? true : false ); |
---|
1184 | |
---|
1185 | #if Q0078_ADD_LAYER_SETS |
---|
1186 | #if OUTPUT_LAYER_SETS_CONFIG |
---|
1187 | if (m_numLayerSets > 1) |
---|
1188 | { |
---|
1189 | vps->setNumLayerSets(m_numLayerSets); |
---|
1190 | #else |
---|
1191 | if (m_numLayerSets > 0) |
---|
1192 | { |
---|
1193 | vps->setNumLayerSets(m_numLayerSets+1); |
---|
1194 | #endif |
---|
1195 | for (Int setId = 1; setId < vps->getNumLayerSets(); setId++) |
---|
1196 | { |
---|
1197 | for (Int layerId = 0; layerId <= vps->getMaxLayerId(); layerId++) |
---|
1198 | { |
---|
1199 | vps->setLayerIdIncludedFlag(false, setId, layerId); |
---|
1200 | } |
---|
1201 | } |
---|
1202 | for (Int setId = 1; setId < vps->getNumLayerSets(); setId++) |
---|
1203 | { |
---|
1204 | #if OUTPUT_LAYER_SETS_CONFIG |
---|
1205 | for (Int i = 0; i < m_numLayerInIdList[setId]; i++) |
---|
1206 | { |
---|
1207 | Int layerId = m_layerSetLayerIdList[setId][i]; |
---|
1208 | #else |
---|
1209 | for (Int i = 0; i < m_numLayerInIdList[setId-1]; i++) |
---|
1210 | { |
---|
1211 | Int layerId = m_layerSetLayerIdList[setId-1][i]; |
---|
1212 | #endif |
---|
1213 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
1214 | //4 |
---|
1215 | g_bitDepthY = m_acLayerCfg[layerId].m_internalBitDepthY; |
---|
1216 | g_bitDepthC = m_acLayerCfg[layerId].m_internalBitDepthC; |
---|
1217 | |
---|
1218 | g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepthY : m_acLayerCfg[layerId].m_internalBitDepthY; |
---|
1219 | g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepthC : m_acLayerCfg[layerId].m_internalBitDepthC; |
---|
1220 | #endif |
---|
1221 | |
---|
1222 | vps->setLayerIdIncludedFlag(true, setId, layerId); |
---|
1223 | } |
---|
1224 | } |
---|
1225 | } |
---|
1226 | else |
---|
1227 | { |
---|
1228 | // Default layer sets |
---|
1229 | #endif |
---|
1230 | vps->setNumLayerSets(m_numLayers); |
---|
1231 | for (Int setId = 1; setId < vps->getNumLayerSets(); setId++) |
---|
1232 | { |
---|
1233 | for (Int layerId = 0; layerId <= vps->getMaxLayerId(); layerId++) |
---|
1234 | { |
---|
1235 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
1236 | //4 |
---|
1237 | g_bitDepthY = m_acLayerCfg[layerId].m_internalBitDepthY; |
---|
1238 | g_bitDepthC = m_acLayerCfg[layerId].m_internalBitDepthC; |
---|
1239 | |
---|
1240 | g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepthY : m_acLayerCfg[layerId].m_internalBitDepthY; |
---|
1241 | g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepthC : m_acLayerCfg[layerId].m_internalBitDepthC; |
---|
1242 | #endif |
---|
1243 | if (layerId <= setId) |
---|
1244 | { |
---|
1245 | vps->setLayerIdIncludedFlag(true, setId, layerId); |
---|
1246 | } |
---|
1247 | else |
---|
1248 | { |
---|
1249 | vps->setLayerIdIncludedFlag(false, setId, layerId); |
---|
1250 | } |
---|
1251 | } |
---|
1252 | } |
---|
1253 | #if Q0078_ADD_LAYER_SETS |
---|
1254 | } |
---|
1255 | #endif |
---|
1256 | #if Q0078_ADD_LAYER_SETS |
---|
1257 | vps->setVpsNumLayerSetsMinus1(vps->getNumLayerSets() - 1); |
---|
1258 | vps->setNumAddLayerSets(m_numAddLayerSets); |
---|
1259 | vps->setNumLayerSets(vps->getNumLayerSets() + vps->getNumAddLayerSets()); |
---|
1260 | if (m_numAddLayerSets > 0) |
---|
1261 | { |
---|
1262 | for (Int setId = 0; setId < m_numAddLayerSets; setId++) |
---|
1263 | { |
---|
1264 | for (Int j = 0; j < m_numHighestLayerIdx[setId]; j++) |
---|
1265 | { |
---|
1266 | vps->setHighestLayerIdxPlus1(setId, j + 1, m_highestLayerIdx[setId][j] + 1); |
---|
1267 | } |
---|
1268 | } |
---|
1269 | } |
---|
1270 | #endif |
---|
1271 | #if VPS_EXTN_MASK_AND_DIM_INFO |
---|
1272 | UInt i = 0, dimIdLen = 0; |
---|
1273 | #if AVC_BASE |
---|
1274 | #if VPS_AVC_BL_FLAG_REMOVAL |
---|
1275 | vps->setNonHEVCBaseLayerFlag( m_nonHEVCBaseLayerFlag ); |
---|
1276 | if ( m_nonHEVCBaseLayerFlag ) |
---|
1277 | { |
---|
1278 | vps->setBaseLayerInternalFlag (false); |
---|
1279 | } |
---|
1280 | #else |
---|
1281 | vps->setAvcBaseLayerFlag(m_avcBaseLayerFlag); |
---|
1282 | #endif |
---|
1283 | #else |
---|
1284 | vps->setAvcBaseLayerFlag(false); |
---|
1285 | #endif |
---|
1286 | vps->setSplittingFlag(false); |
---|
1287 | for(i = 0; i < MAX_VPS_NUM_SCALABILITY_TYPES; i++) |
---|
1288 | { |
---|
1289 | vps->setScalabilityMask(i, false); |
---|
1290 | } |
---|
1291 | if(m_numLayers > 1) |
---|
1292 | { |
---|
1293 | Int scalabilityTypes = 0; |
---|
1294 | for(i = 0; i < MAX_VPS_NUM_SCALABILITY_TYPES; i++) |
---|
1295 | { |
---|
1296 | vps->setScalabilityMask(i, m_scalabilityMask[i]); |
---|
1297 | scalabilityTypes += m_scalabilityMask[i]; |
---|
1298 | } |
---|
1299 | #if AUXILIARY_PICTURES |
---|
1300 | assert( scalabilityTypes <= 2 ); |
---|
1301 | #else |
---|
1302 | assert( scalabilityTypes == 1 ); |
---|
1303 | #endif |
---|
1304 | vps->setNumScalabilityTypes(scalabilityTypes); |
---|
1305 | } |
---|
1306 | else |
---|
1307 | { |
---|
1308 | vps->setNumScalabilityTypes(0); |
---|
1309 | } |
---|
1310 | while((1 << dimIdLen) < m_numLayers) |
---|
1311 | { |
---|
1312 | dimIdLen++; |
---|
1313 | } |
---|
1314 | vps->setDimensionIdLen(0, dimIdLen); |
---|
1315 | vps->setNuhLayerIdPresentFlag(false); |
---|
1316 | vps->setLayerIdInNuh(0, 0); |
---|
1317 | vps->setLayerIdInVps(0, 0); |
---|
1318 | for(i = 1; i < vps->getMaxLayers(); i++) |
---|
1319 | { |
---|
1320 | vps->setLayerIdInNuh(i, i); |
---|
1321 | vps->setLayerIdInVps(vps->getLayerIdInNuh(i), i); |
---|
1322 | vps->setDimensionId(i, 0, i); |
---|
1323 | } |
---|
1324 | #if AUXILIARY_PICTURES |
---|
1325 | if (m_scalabilityMask[3]) |
---|
1326 | { |
---|
1327 | UInt maxAuxId = 0; |
---|
1328 | UInt auxDimIdLen = 1; |
---|
1329 | for(i = 1; i < vps->getMaxLayers(); i++) |
---|
1330 | { |
---|
1331 | if (m_acLayerCfg[i].getAuxId() > maxAuxId) |
---|
1332 | { |
---|
1333 | maxAuxId = m_acLayerCfg[i].getAuxId(); |
---|
1334 | } |
---|
1335 | } |
---|
1336 | while((1 << auxDimIdLen) < (maxAuxId + 1)) |
---|
1337 | { |
---|
1338 | auxDimIdLen++; |
---|
1339 | } |
---|
1340 | vps->setDimensionIdLen(1, auxDimIdLen); |
---|
1341 | for(i = 1; i < vps->getMaxLayers(); i++) |
---|
1342 | { |
---|
1343 | vps->setDimensionId(i, 1, m_acLayerCfg[i].getAuxId()); |
---|
1344 | } |
---|
1345 | } |
---|
1346 | #endif |
---|
1347 | #endif |
---|
1348 | #if VPS_TSLAYERS |
---|
1349 | vps->setMaxTSLayersPresentFlag(true); |
---|
1350 | |
---|
1351 | for( i = 0; i < vps->getMaxLayers(); i++ ) |
---|
1352 | { |
---|
1353 | vps->setMaxTSLayersMinus1(i, vps->getMaxTLayers()-1); |
---|
1354 | } |
---|
1355 | #endif |
---|
1356 | vps->setMaxTidRefPresentFlag(m_maxTidRefPresentFlag); |
---|
1357 | if (vps->getMaxTidRefPresentFlag()) |
---|
1358 | { |
---|
1359 | for( i = 0; i < vps->getMaxLayers() - 1; i++ ) |
---|
1360 | { |
---|
1361 | #if O0225_MAX_TID_FOR_REF_LAYERS |
---|
1362 | for( Int j = i+1; j < vps->getMaxLayers(); j++) |
---|
1363 | { |
---|
1364 | vps->setMaxTidIlRefPicsPlus1(i, j, m_acTEncTop[i].getMaxTidIlRefPicsPlus1()); |
---|
1365 | } |
---|
1366 | #else |
---|
1367 | vps->setMaxTidIlRefPicsPlus1(i, m_acTEncTop[i].getMaxTidIlRefPicsPlus1()); |
---|
1368 | #endif |
---|
1369 | } |
---|
1370 | } |
---|
1371 | else |
---|
1372 | { |
---|
1373 | for( i = 0; i < vps->getMaxLayers() - 1; i++ ) |
---|
1374 | { |
---|
1375 | #if O0225_MAX_TID_FOR_REF_LAYERS |
---|
1376 | for( Int j = i+1; j < vps->getMaxLayers(); j++) |
---|
1377 | { |
---|
1378 | vps->setMaxTidIlRefPicsPlus1(i, j, 7); |
---|
1379 | } |
---|
1380 | #else |
---|
1381 | vps->setMaxTidIlRefPicsPlus1(i, 7); |
---|
1382 | #endif |
---|
1383 | } |
---|
1384 | } |
---|
1385 | vps->setIlpSshSignalingEnabledFlag(false); |
---|
1386 | #if VPS_EXTN_PROFILE_INFO |
---|
1387 | |
---|
1388 | #if LIST_OF_PTL |
---|
1389 | vps->getPTLForExtnPtr()->resize(1); // Dummy object - unused. |
---|
1390 | for(i = 0; i < vps->getMaxLayers(); i++) |
---|
1391 | { |
---|
1392 | // TODO: The profile tier level have to be given support to be included in the configuration files |
---|
1393 | if(i == 0) |
---|
1394 | { |
---|
1395 | if( vps->getBaseLayerInternalFlag() && vps->getMaxLayers() > 1 ) |
---|
1396 | { |
---|
1397 | vps->setProfilePresentFlag(1, false); |
---|
1398 | vps->getPTLForExtnPtr()->push_back( *(m_acTEncTop[0].getSPS()->getPTL()) ); |
---|
1399 | } |
---|
1400 | } |
---|
1401 | else // i > 0 |
---|
1402 | { |
---|
1403 | vps->setProfilePresentFlag(i, true); |
---|
1404 | // Note - may need to be changed for other layer structures. |
---|
1405 | vps->getPTLForExtnPtr()->push_back( *(m_acTEncTop[0].getSPS()->getPTL()) ); |
---|
1406 | } |
---|
1407 | } |
---|
1408 | #else |
---|
1409 | vps->getPTLForExtnPtr()->resize(vps->getNumLayerSets()); |
---|
1410 | for(Int setId = 1; setId < vps->getNumLayerSets(); setId++) |
---|
1411 | { |
---|
1412 | vps->setProfilePresentFlag(setId, true); |
---|
1413 | // Note - may need to be changed for other layer structures. |
---|
1414 | *(vps->getPTLForExtn(setId)) = *(m_acTEncTop[setId].getSPS()->getPTL()); |
---|
1415 | } |
---|
1416 | #endif |
---|
1417 | #endif |
---|
1418 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
1419 | // Direct reference layers |
---|
1420 | UInt maxDirectRefLayers = 0; |
---|
1421 | #if O0096_DEFAULT_DEPENDENCY_TYPE |
---|
1422 | Bool isDefaultDirectDependencyTypeSet = false; |
---|
1423 | #endif |
---|
1424 | for (UInt layerCtr = 1; layerCtr <= vps->getMaxLayers() - 1; layerCtr++) |
---|
1425 | { |
---|
1426 | vps->setNumDirectRefLayers(layerCtr, m_acTEncTop[layerCtr].getNumDirectRefLayers()); |
---|
1427 | maxDirectRefLayers = max<UInt>(maxDirectRefLayers, vps->getNumDirectRefLayers(layerCtr)); |
---|
1428 | |
---|
1429 | for (i = 0; i < vps->getNumDirectRefLayers(layerCtr); i++) |
---|
1430 | { |
---|
1431 | vps->setRefLayerId(layerCtr, i, m_acTEncTop[layerCtr].getRefLayerId(i)); |
---|
1432 | } |
---|
1433 | // Set direct dependency flag |
---|
1434 | // Initialize flag to 0 |
---|
1435 | for (Int refLayerCtr = 0; refLayerCtr < layerCtr; refLayerCtr++) |
---|
1436 | { |
---|
1437 | vps->setDirectDependencyFlag(layerCtr, refLayerCtr, false); |
---|
1438 | } |
---|
1439 | for (i = 0; i < vps->getNumDirectRefLayers(layerCtr); i++) |
---|
1440 | { |
---|
1441 | vps->setDirectDependencyFlag(layerCtr, vps->getLayerIdInVps(m_acTEncTop[layerCtr].getRefLayerId(i)), true); |
---|
1442 | } |
---|
1443 | // prediction indications |
---|
1444 | vps->setDirectDepTypeLen(2); // sample and motion types are encoded |
---|
1445 | for (Int refLayerCtr = 0; refLayerCtr < layerCtr; refLayerCtr++) |
---|
1446 | { |
---|
1447 | if (vps->getDirectDependencyFlag(layerCtr, refLayerCtr)) |
---|
1448 | { |
---|
1449 | assert(m_acTEncTop[layerCtr].getSamplePredEnabledFlag(refLayerCtr) || m_acTEncTop[layerCtr].getMotionPredEnabledFlag(refLayerCtr)); |
---|
1450 | vps->setDirectDependencyType(layerCtr, refLayerCtr, ((m_acTEncTop[layerCtr].getSamplePredEnabledFlag(refLayerCtr) ? 1 : 0) | |
---|
1451 | (m_acTEncTop[layerCtr].getMotionPredEnabledFlag(refLayerCtr) ? 2 : 0)) - 1); |
---|
1452 | #if O0096_DEFAULT_DEPENDENCY_TYPE |
---|
1453 | if (!isDefaultDirectDependencyTypeSet) |
---|
1454 | { |
---|
1455 | vps->setDefaultDirectDependecyTypeFlag(1); |
---|
1456 | vps->setDefaultDirectDependecyType(vps->getDirectDependencyType(layerCtr, refLayerCtr)); |
---|
1457 | isDefaultDirectDependencyTypeSet = true; |
---|
1458 | } |
---|
1459 | else if (vps->getDirectDependencyType(layerCtr, refLayerCtr) != vps->getDefaultDirectDependencyType()) |
---|
1460 | { |
---|
1461 | vps->setDefaultDirectDependecyTypeFlag(0); |
---|
1462 | } |
---|
1463 | #endif |
---|
1464 | } |
---|
1465 | else |
---|
1466 | { |
---|
1467 | vps->setDirectDependencyType(layerCtr, refLayerCtr, 0); |
---|
1468 | } |
---|
1469 | } |
---|
1470 | } |
---|
1471 | |
---|
1472 | #if O0092_0094_DEPENDENCY_CONSTRAINT |
---|
1473 | vps->setNumRefLayers(); |
---|
1474 | |
---|
1475 | if (vps->getMaxLayers() > MAX_REF_LAYERS) |
---|
1476 | { |
---|
1477 | for (UInt layerCtr = 1; layerCtr <= vps->getMaxLayers() - 1; layerCtr++) |
---|
1478 | { |
---|
1479 | assert(vps->getNumRefLayers(vps->getLayerIdInNuh(layerCtr)) <= MAX_REF_LAYERS); |
---|
1480 | } |
---|
1481 | } |
---|
1482 | #endif |
---|
1483 | #if FIX_LAYER_ID_INIT |
---|
1484 | // The Layer ID List variables should be derived here. |
---|
1485 | #if DERIVE_LAYER_ID_LIST_VARIABLES |
---|
1486 | vps->deriveLayerIdListVariables(); |
---|
1487 | #endif |
---|
1488 | #endif |
---|
1489 | #if Q0078_ADD_LAYER_SETS |
---|
1490 | vps->setPredictedLayerIds(); |
---|
1491 | vps->setTreePartitionLayerIdList(); |
---|
1492 | #if FIX_LAYER_ID_INIT |
---|
1493 | vps->deriveLayerIdListVariablesForAddLayerSets(); |
---|
1494 | #else |
---|
1495 | vps->setLayerIdIncludedFlagsForAddLayerSets(); |
---|
1496 | #endif |
---|
1497 | #endif |
---|
1498 | #endif |
---|
1499 | #if OUTPUT_LAYER_SETS_CONFIG |
---|
1500 | |
---|
1501 | vps->setDefaultTargetOutputLayerIdc( m_defaultTargetOutputLayerIdc ); // As per configuration file |
---|
1502 | |
---|
1503 | if( m_numOutputLayerSets == -1 ) // # of output layer sets not specified in the configuration file |
---|
1504 | { |
---|
1505 | vps->setNumOutputLayerSets(vps->getNumLayerSets()); |
---|
1506 | |
---|
1507 | for(i = 1; i < vps->getNumLayerSets(); i++) |
---|
1508 | { |
---|
1509 | vps->setOutputLayerSetIdx(i, i); |
---|
1510 | } |
---|
1511 | } |
---|
1512 | else |
---|
1513 | { |
---|
1514 | vps->setNumOutputLayerSets( m_numOutputLayerSets ); |
---|
1515 | for( Int olsCtr = 0; olsCtr < vps->getNumLayerSets(); olsCtr ++ ) // Default output layer sets |
---|
1516 | { |
---|
1517 | vps->setOutputLayerSetIdx(olsCtr, olsCtr); |
---|
1518 | } |
---|
1519 | for( Int olsCtr = vps->getNumLayerSets(); olsCtr < vps->getNumOutputLayerSets(); olsCtr ++ ) // Non-default output layer sets |
---|
1520 | { |
---|
1521 | vps->setOutputLayerSetIdx(olsCtr, m_outputLayerSetIdx[olsCtr - vps->getNumLayerSets()]); |
---|
1522 | } |
---|
1523 | } |
---|
1524 | #endif |
---|
1525 | // Target output layer |
---|
1526 | #if LIST_OF_PTL |
---|
1527 | vps->setNumProfileTierLevel( vps->getPTLForExtnPtr()->size() ); // +1 for the base VPS PTL() |
---|
1528 | #else |
---|
1529 | vps->setNumOutputLayerSets(vps->getNumLayerSets()); |
---|
1530 | vps->setNumProfileTierLevel(vps->getNumLayerSets()); |
---|
1531 | #endif |
---|
1532 | #if !OUTPUT_LAYER_SETS_CONFIG // Taken care by configuration file parameter |
---|
1533 | #if P0295_DEFAULT_OUT_LAYER_IDC |
---|
1534 | vps->setDefaultTargetOutputLayerIdc(1); |
---|
1535 | #else |
---|
1536 | #if O0109_DEFAULT_ONE_OUT_LAYER_IDC |
---|
1537 | vps->setDefaultOneTargetOutputLayerIdc(1); |
---|
1538 | #else |
---|
1539 | vps->setDefaultOneTargetOutputLayerFlag(true); |
---|
1540 | #endif |
---|
1541 | #endif |
---|
1542 | #endif |
---|
1543 | #if !PER_LAYER_PTL |
---|
1544 | for(i = 1; i < vps->getNumLayerSets(); i++) |
---|
1545 | { |
---|
1546 | vps->setProfileLevelTierIdx(i, i); |
---|
1547 | #if !OUTPUT_LAYER_SETS_CONFIG |
---|
1548 | vps->setOutputLayerSetIdx(i, i); |
---|
1549 | #endif |
---|
1550 | } |
---|
1551 | #endif |
---|
1552 | #endif |
---|
1553 | #if VPS_DPB_SIZE_TABLE |
---|
1554 | #if !FIX_LAYER_ID_INIT // must be derived earlier to not delete additional layer sets |
---|
1555 | // The Layer ID List variables can be derived here. |
---|
1556 | #if DERIVE_LAYER_ID_LIST_VARIABLES |
---|
1557 | vps->deriveLayerIdListVariables(); |
---|
1558 | #endif |
---|
1559 | #endif |
---|
1560 | #if RESOLUTION_BASED_DPB |
---|
1561 | vps->assignSubDpbIndices(); |
---|
1562 | #else |
---|
1563 | vps->deriveNumberOfSubDpbs(); |
---|
1564 | #endif |
---|
1565 | vps->setOutputLayerFlag( 0, 0, 1 ); |
---|
1566 | // derive OutputLayerFlag[i][j] |
---|
1567 | #if !OUTPUT_LAYER_SETS_CONFIG |
---|
1568 | if( vps->getDefaultTargetOutputLayerIdc() == 1 ) |
---|
1569 | #endif |
---|
1570 | { |
---|
1571 | // default_output_layer_idc equal to 1 specifies that only the layer with the highest value of nuh_layer_id such that nuh_layer_id equal to nuhLayerIdA and |
---|
1572 | // AuxId[ nuhLayerIdA ] equal to 0 in each of the output layer sets with index in the range of 1 to vps_num_layer_sets_minus1, inclusive, is an output layer of its output layer set. |
---|
1573 | |
---|
1574 | // Include the highest layer as output layer for each layer set |
---|
1575 | for(Int lsIdx = 1; lsIdx < vps->getNumLayerSets(); lsIdx++) |
---|
1576 | { |
---|
1577 | for( UInt layer = 0; layer < vps->getNumLayersInIdList(lsIdx); layer++ ) |
---|
1578 | { |
---|
1579 | #if !Q0078_ADD_LAYER_SETS // the following condition is incorrect and is not needed anyway |
---|
1580 | if( vps->getLayerIdIncludedFlag(lsIdx, layer) ) |
---|
1581 | #endif |
---|
1582 | { |
---|
1583 | #if OUTPUT_LAYER_SETS_CONFIG |
---|
1584 | switch(vps->getDefaultTargetOutputLayerIdc()) |
---|
1585 | { |
---|
1586 | case 0: vps->setOutputLayerFlag( lsIdx, layer, 1 ); |
---|
1587 | break; |
---|
1588 | case 1: vps->setOutputLayerFlag( lsIdx, layer, layer == vps->getNumLayersInIdList(lsIdx) - 1 ); |
---|
1589 | break; |
---|
1590 | case 2: |
---|
1591 | case 3: vps->setOutputLayerFlag( lsIdx, layer, std::find( m_listOfOutputLayers[lsIdx].begin(), m_listOfOutputLayers[lsIdx].end(), layer) != m_listOfOutputLayers[lsIdx].end() ); |
---|
1592 | break; |
---|
1593 | } |
---|
1594 | #else |
---|
1595 | vps->setOutputLayerFlag( lsIdx, layer, layer == vps->getNumLayersInIdList(lsIdx) - 1 ); |
---|
1596 | #endif |
---|
1597 | } |
---|
1598 | } |
---|
1599 | } |
---|
1600 | #if OUTPUT_LAYER_SETS_CONFIG |
---|
1601 | for( Int olsIdx = vps->getNumLayerSets(); olsIdx < vps->getNumOutputLayerSets(); olsIdx++ ) |
---|
1602 | { |
---|
1603 | for( UInt layer = 0; layer < vps->getNumLayersInIdList(vps->getOutputLayerSetIdx(olsIdx)); layer++ ) |
---|
1604 | { |
---|
1605 | vps->setOutputLayerFlag( olsIdx, layer, std::find( m_listOfOutputLayers[olsIdx].begin(), m_listOfOutputLayers[olsIdx].end(), layer) != m_listOfOutputLayers[olsIdx].end()); |
---|
1606 | } |
---|
1607 | } |
---|
1608 | #endif |
---|
1609 | } |
---|
1610 | #if !OUTPUT_LAYER_SETS_CONFIG |
---|
1611 | else |
---|
1612 | { |
---|
1613 | // cases when default_output_layer_idc is not equal to 1 |
---|
1614 | assert(!"default_output_layer_idc not equal to 1 is not yet supported"); |
---|
1615 | } |
---|
1616 | #endif |
---|
1617 | #if NECESSARY_LAYER_FLAG |
---|
1618 | vps->deriveNecessaryLayerFlag(); |
---|
1619 | vps->checkNecessaryLayerFlagCondition(); |
---|
1620 | #endif |
---|
1621 | #if PER_LAYER_PTL |
---|
1622 | vps->getProfileLevelTierIdx()->resize(vps->getNumOutputLayerSets()); |
---|
1623 | vps->getProfileLevelTierIdx(0)->push_back( vps->getBaseLayerInternalFlag() && vps->getMaxLayers() > 1 ? 1 : 0 ); // Default 0-th output layer set |
---|
1624 | for(i = 1; i < vps->getNumOutputLayerSets(); i++) |
---|
1625 | { |
---|
1626 | Int layerSetIdxForOutputLayerSet = vps->getOutputLayerSetIdx( i ); |
---|
1627 | Int numLayerInLayerSet = vps->getNumLayersInIdList( layerSetIdxForOutputLayerSet ); |
---|
1628 | for(Int j = 0; j < numLayerInLayerSet; j++) |
---|
1629 | { |
---|
1630 | Int layerIdxInVps = vps->getLayerIdInVps( vps->getLayerSetLayerIdList(layerSetIdxForOutputLayerSet, j) ); |
---|
1631 | if( vps->getNecessaryLayerFlag(i, j) ) |
---|
1632 | { |
---|
1633 | vps->getProfileLevelTierIdx(i)->push_back( vps->getBaseLayerInternalFlag() && vps->getMaxLayers() > 1 ? layerIdxInVps + 1 : layerIdxInVps); |
---|
1634 | } |
---|
1635 | else |
---|
1636 | { |
---|
1637 | vps->getProfileLevelTierIdx(i)->push_back( -1 ); |
---|
1638 | } |
---|
1639 | } |
---|
1640 | } |
---|
1641 | #endif |
---|
1642 | #if SUB_LAYERS_IN_LAYER_SET |
---|
1643 | vps->calculateMaxSLInLayerSets(); |
---|
1644 | #endif |
---|
1645 | // Initialize dpb_size_table() for all ouput layer sets in the VPS extension |
---|
1646 | for(i = 1; i < vps->getNumOutputLayerSets(); i++) |
---|
1647 | { |
---|
1648 | #if CHANGE_NUMSUBDPB_IDX |
---|
1649 | Int layerSetIdxForOutputLayerSet = vps->getOutputLayerSetIdx( i ); |
---|
1650 | #endif |
---|
1651 | Int layerSetId = vps->getOutputLayerSetIdx(i); |
---|
1652 | |
---|
1653 | for(Int j = 0; j < vps->getMaxTLayers(); j++) |
---|
1654 | { |
---|
1655 | |
---|
1656 | Int maxNumReorderPics = -1; |
---|
1657 | #if CHANGE_NUMSUBDPB_IDX |
---|
1658 | #if RESOLUTION_BASED_DPB |
---|
1659 | for(Int k = 0; k < vps->getNumLayersInIdList(layerSetIdxForOutputLayerSet); k++) |
---|
1660 | #else |
---|
1661 | for(Int k = 0; k < vps->getNumSubDpbs(layerSetIdxForOutputLayerSet); k++) |
---|
1662 | #endif |
---|
1663 | #else |
---|
1664 | for(Int k = 0; k < vps->getNumSubDpbs(i); k++) |
---|
1665 | #endif |
---|
1666 | { |
---|
1667 | Int layerId = vps->getLayerSetLayerIdList(layerSetId, k); // k-th layer in the output layer set |
---|
1668 | #if RESOLUTION_BASED_DPB |
---|
1669 | vps->setMaxVpsLayerDecPicBuffMinus1( i, k, j, m_acTEncTop[layerId].getMaxDecPicBuffering(j) - 1 ); |
---|
1670 | // Add sub-DPB sizes of layers belonging to a sub-DPB. If a different sub-DPB size is calculated |
---|
1671 | // at the encoder, modify below |
---|
1672 | Int oldValue = vps->getMaxVpsDecPicBufferingMinus1( i, vps->getSubDpbAssigned( layerSetIdxForOutputLayerSet, k ), j ); |
---|
1673 | oldValue += vps->getMaxVpsLayerDecPicBuffMinus1( i, k, j ) + 1; |
---|
1674 | vps->setMaxVpsDecPicBufferingMinus1( i, vps->getSubDpbAssigned( layerSetIdxForOutputLayerSet, k ), j, oldValue ); |
---|
1675 | #else |
---|
1676 | vps->setMaxVpsDecPicBufferingMinus1( i, k, j, m_acTEncTop[layerId].getMaxDecPicBuffering(j) - 1 ); |
---|
1677 | #endif |
---|
1678 | maxNumReorderPics = std::max( maxNumReorderPics, m_acTEncTop[layerId].getNumReorderPics(j)); |
---|
1679 | } |
---|
1680 | #if RESOLUTION_BASED_DPB |
---|
1681 | for(Int k = 0; k < vps->getNumSubDpbs(i); k++) |
---|
1682 | { |
---|
1683 | // Decrement m_maxVpsDecPicBufferingMinus1 |
---|
1684 | Int oldValue = vps->getMaxVpsDecPicBufferingMinus1( i, vps->getSubDpbAssigned( layerSetIdxForOutputLayerSet, k ), j ); |
---|
1685 | vps->setMaxVpsDecPicBufferingMinus1( i, vps->getSubDpbAssigned( layerSetIdxForOutputLayerSet, k ), j, oldValue - 1 ); |
---|
1686 | } |
---|
1687 | #endif |
---|
1688 | vps->setMaxVpsNumReorderPics(i, j, maxNumReorderPics); |
---|
1689 | vps->determineSubDpbInfoFlags(); |
---|
1690 | } |
---|
1691 | } |
---|
1692 | #endif |
---|
1693 | vps->setMaxOneActiveRefLayerFlag(maxDirectRefLayers > 1 ? false : true); |
---|
1694 | #if O0062_POC_LSB_NOT_PRESENT_FLAG |
---|
1695 | for(i = 1; i< vps->getMaxLayers(); i++) |
---|
1696 | { |
---|
1697 | if( vps->getNumDirectRefLayers( vps->getLayerIdInNuh(i) ) == 0 ) |
---|
1698 | { |
---|
1699 | #if Q0078_ADD_LAYER_SETS |
---|
1700 | vps->setPocLsbNotPresentFlag(i, true); // make independedent layers base-layer compliant |
---|
1701 | #else |
---|
1702 | vps->setPocLsbNotPresentFlag(i, false); |
---|
1703 | #endif |
---|
1704 | } |
---|
1705 | } |
---|
1706 | #endif |
---|
1707 | #if O0223_PICTURE_TYPES_ALIGN_FLAG |
---|
1708 | vps->setCrossLayerPictureTypeAlignFlag( m_crossLayerPictureTypeAlignFlag ); |
---|
1709 | #endif |
---|
1710 | #if P0068_CROSS_LAYER_ALIGNED_IDR_ONLY_FOR_IRAP_FLAG |
---|
1711 | vps->setCrossLayerAlignedIdrOnlyFlag( m_crossLayerAlignedIdrOnlyFlag ); |
---|
1712 | #endif |
---|
1713 | vps->setCrossLayerIrapAlignFlag( m_crossLayerIrapAlignFlag ); |
---|
1714 | for(UInt layerCtr = 1;layerCtr <= vps->getMaxLayers() - 1; layerCtr++) |
---|
1715 | { |
---|
1716 | for(Int refLayerCtr = 0; refLayerCtr < layerCtr; refLayerCtr++) |
---|
1717 | { |
---|
1718 | if (vps->getDirectDependencyFlag( layerCtr, refLayerCtr)) |
---|
1719 | { |
---|
1720 | if(m_acTEncTop[layerCtr].getIntraPeriod() != m_acTEncTop[refLayerCtr].getIntraPeriod()) |
---|
1721 | { |
---|
1722 | vps->setCrossLayerIrapAlignFlag(false); |
---|
1723 | break; |
---|
1724 | } |
---|
1725 | } |
---|
1726 | } |
---|
1727 | } |
---|
1728 | #if M0040_ADAPTIVE_RESOLUTION_CHANGE |
---|
1729 | vps->setSingleLayerForNonIrapFlag(m_adaptiveResolutionChange > 0 ? true : false); |
---|
1730 | #endif |
---|
1731 | #if HIGHER_LAYER_IRAP_SKIP_FLAG |
---|
1732 | vps->setHigherLayerIrapSkipFlag(m_skipPictureAtArcSwitch); |
---|
1733 | #endif |
---|
1734 | #if !P0125_REVERT_VPS_EXTN_OFFSET_TO_RESERVED |
---|
1735 | #if !VPS_EXTN_OFFSET_CALC |
---|
1736 | #if VPS_EXTN_OFFSET |
---|
1737 | // to be updated according to the current semantics |
---|
1738 | vps->setExtensionOffset( 0xffff ); |
---|
1739 | #endif |
---|
1740 | #endif |
---|
1741 | #endif |
---|
1742 | |
---|
1743 | #if O0215_PHASE_ALIGNMENT |
---|
1744 | vps->setPhaseAlignFlag( m_phaseAlignFlag ); |
---|
1745 | #endif |
---|
1746 | |
---|
1747 | #if P0300_ALT_OUTPUT_LAYER_FLAG |
---|
1748 | for (Int k = 0; k < MAX_VPS_LAYER_SETS_PLUS1; k++) |
---|
1749 | { |
---|
1750 | vps->setAltOuputLayerFlag( k, m_altOutputLayerFlag ); |
---|
1751 | } |
---|
1752 | #else |
---|
1753 | #if O0153_ALT_OUTPUT_LAYER_FLAG |
---|
1754 | vps->setAltOuputLayerFlag( m_altOutputLayerFlag ); |
---|
1755 | #endif |
---|
1756 | #endif |
---|
1757 | |
---|
1758 | #if P0312_VERT_PHASE_ADJ |
---|
1759 | Bool vpsVuiVertPhaseInUseFlag = false; |
---|
1760 | for( UInt layerId = 1; layerId < m_numLayers; layerId++ ) |
---|
1761 | { |
---|
1762 | for( i = 0; i < m_acLayerCfg[layerId].m_numScaledRefLayerOffsets; i++ ) |
---|
1763 | { |
---|
1764 | if( m_acTEncTop[layerId].getVertPhasePositionEnableFlag(i) ) |
---|
1765 | { |
---|
1766 | vpsVuiVertPhaseInUseFlag = true; |
---|
1767 | break; |
---|
1768 | } |
---|
1769 | } |
---|
1770 | } |
---|
1771 | vps->setVpsVuiVertPhaseInUseFlag( vpsVuiVertPhaseInUseFlag ); |
---|
1772 | #endif |
---|
1773 | |
---|
1774 | #if VPS_VUI_BSP_HRD_PARAMS |
---|
1775 | vps->setVpsVuiBspHrdPresentFlag(false); |
---|
1776 | TEncTop *pcCfg = &m_acTEncTop[0]; |
---|
1777 | if( pcCfg->getBufferingPeriodSEIEnabled() ) |
---|
1778 | { |
---|
1779 | Int j; |
---|
1780 | vps->setVpsVuiBspHrdPresentFlag(true); |
---|
1781 | vps->setVpsNumAddHrdParams( vps->getMaxLayers() ); |
---|
1782 | vps->createBspHrdParamBuffer(vps->getVpsNumAddHrdParams() + 1); |
---|
1783 | for( i = vps->getNumHrdParameters(), j = 0; i < vps->getNumHrdParameters() + vps->getVpsNumAddHrdParams(); i++, j++ ) |
---|
1784 | { |
---|
1785 | vps->setCprmsAddPresentFlag( j, true ); |
---|
1786 | vps->setNumSubLayerHrdMinus1( j, vps->getMaxTLayers() - 1 ); |
---|
1787 | |
---|
1788 | UInt layerId = j; |
---|
1789 | TEncTop *pcCfgLayer = &m_acTEncTop[layerId]; |
---|
1790 | |
---|
1791 | Int iPicWidth = pcCfgLayer->getSourceWidth(); |
---|
1792 | Int iPicHeight = pcCfgLayer->getSourceHeight(); |
---|
1793 | #if LAYER_CTB |
---|
1794 | UInt uiWidthInCU = ( iPicWidth % m_acLayerCfg[layerId].m_uiMaxCUWidth ) ? iPicWidth / m_acLayerCfg[layerId].m_uiMaxCUWidth + 1 : iPicWidth / m_acLayerCfg[layerId].m_uiMaxCUWidth; |
---|
1795 | UInt uiHeightInCU = ( iPicHeight % m_acLayerCfg[layerId].m_uiMaxCUHeight ) ? iPicHeight / m_acLayerCfg[layerId].m_uiMaxCUHeight + 1 : iPicHeight / m_acLayerCfg[layerId].m_uiMaxCUHeight; |
---|
1796 | UInt maxCU = pcCfgLayer->getSliceArgument() >> ( m_acLayerCfg[layerId].m_uiMaxCUDepth << 1); |
---|
1797 | #else |
---|
1798 | UInt uiWidthInCU = ( iPicWidth %m_uiMaxCUWidth ) ? iPicWidth /m_uiMaxCUWidth + 1 : iPicWidth /m_uiMaxCUWidth; |
---|
1799 | UInt uiHeightInCU = ( iPicHeight%m_uiMaxCUHeight ) ? iPicHeight/m_uiMaxCUHeight + 1 : iPicHeight/m_uiMaxCUHeight; |
---|
1800 | UInt maxCU = pcCfgLayer->getSliceArgument() >> ( m_uiMaxCUDepth << 1); |
---|
1801 | #endif |
---|
1802 | UInt uiNumCUsInFrame = uiWidthInCU * uiHeightInCU; |
---|
1803 | |
---|
1804 | UInt numDU = ( pcCfgLayer->getSliceMode() == 1 ) ? ( uiNumCUsInFrame / maxCU ) : ( 0 ); |
---|
1805 | if( uiNumCUsInFrame % maxCU != 0 || numDU == 0 ) |
---|
1806 | { |
---|
1807 | numDU ++; |
---|
1808 | } |
---|
1809 | vps->getBspHrd(i)->setNumDU( numDU ); |
---|
1810 | vps->setBspHrdParameters( i, pcCfgLayer->getFrameRate(), numDU, pcCfgLayer->getTargetBitrate(), ( pcCfgLayer->getIntraPeriod() > 0 ) ); |
---|
1811 | } |
---|
1812 | |
---|
1813 | // Signalling of additional partitioning schemes |
---|
1814 | for(Int h = 1; h < vps->getNumOutputLayerSets(); h++) |
---|
1815 | { |
---|
1816 | Int lsIdx = vps->getOutputLayerSetIdx( h ); |
---|
1817 | vps->setNumSignalledPartitioningSchemes(h, 1); // Only the default per-layer partitioning scheme |
---|
1818 | for( j = 1; j < vps->getNumSignalledPartitioningSchemes(h); j++ ) |
---|
1819 | { |
---|
1820 | // ToDo: Add code for additional partitioning schemes here |
---|
1821 | // ToDo: Initialize num_partitions_in_scheme_minus1 and layer_included_in_partition_flag |
---|
1822 | } |
---|
1823 | |
---|
1824 | for( i = 0; i < vps->getNumSignalledPartitioningSchemes(h); i++ ) |
---|
1825 | { |
---|
1826 | if( i == 0 ) |
---|
1827 | { |
---|
1828 | for(Int t = 0; t <= vps->getMaxSLayersInLayerSetMinus1( lsIdx ); t++) |
---|
1829 | { |
---|
1830 | vps->setNumBspSchedulesMinus1( h, i, t, 0 ); |
---|
1831 | for( j = 0; j <= vps->getNumBspSchedulesMinus1(h, i, t); j++ ) |
---|
1832 | { |
---|
1833 | for( Int k = 0; k <= vps->getNumPartitionsInSchemeMinus1(h, i); k++ ) |
---|
1834 | { |
---|
1835 | // Only for the default partition |
---|
1836 | Int nuhlayerId = vps->getLayerSetLayerIdList( lsIdx, k); |
---|
1837 | Int layerIdxInVps = vps->getLayerIdInVps( nuhlayerId ); |
---|
1838 | vps->setBspHrdIdx(h, i, t, j, k, layerIdxInVps + vps->getNumHrdParameters()); |
---|
1839 | |
---|
1840 | vps->setBspSchedIdx(h, i, t, j, k, 0); |
---|
1841 | } |
---|
1842 | } |
---|
1843 | } |
---|
1844 | } |
---|
1845 | else |
---|
1846 | { |
---|
1847 | assert(0); // Need to add support for additional partitioning schemes. |
---|
1848 | } |
---|
1849 | } |
---|
1850 | } |
---|
1851 | } |
---|
1852 | #else |
---|
1853 | |
---|
1854 | #if O0164_MULTI_LAYER_HRD |
---|
1855 | vps->setVpsVuiBspHrdPresentFlag(false); |
---|
1856 | TEncTop *pcCfg = &m_acTEncTop[0]; |
---|
1857 | if( pcCfg->getBufferingPeriodSEIEnabled() ) |
---|
1858 | { |
---|
1859 | vps->setVpsVuiBspHrdPresentFlag(true); |
---|
1860 | #if Q0078_ADD_LAYER_SETS |
---|
1861 | vps->setVpsNumBspHrdParametersMinus1(vps->getVpsNumLayerSetsMinus1() - 1); |
---|
1862 | #else |
---|
1863 | vps->setVpsNumBspHrdParametersMinus1(vps->getNumLayerSets() - 2); |
---|
1864 | #endif |
---|
1865 | vps->createBspHrdParamBuffer(vps->getVpsNumBspHrdParametersMinus1() + 1); |
---|
1866 | for ( i = 0; i <= vps->getVpsNumBspHrdParametersMinus1(); i++ ) |
---|
1867 | { |
---|
1868 | vps->setBspCprmsPresentFlag(i, true); |
---|
1869 | |
---|
1870 | UInt layerId = i + 1; |
---|
1871 | TEncTop *pcCfgLayer = &m_acTEncTop[layerId]; |
---|
1872 | |
---|
1873 | Int iPicWidth = pcCfgLayer->getSourceWidth(); |
---|
1874 | Int iPicHeight = pcCfgLayer->getSourceHeight(); |
---|
1875 | #if LAYER_CTB |
---|
1876 | UInt uiWidthInCU = ( iPicWidth % m_acLayerCfg[layerId].m_uiMaxCUWidth ) ? iPicWidth / m_acLayerCfg[layerId].m_uiMaxCUWidth + 1 : iPicWidth / m_acLayerCfg[layerId].m_uiMaxCUWidth; |
---|
1877 | UInt uiHeightInCU = ( iPicHeight % m_acLayerCfg[layerId].m_uiMaxCUHeight ) ? iPicHeight / m_acLayerCfg[layerId].m_uiMaxCUHeight + 1 : iPicHeight / m_acLayerCfg[layerId].m_uiMaxCUHeight; |
---|
1878 | #else |
---|
1879 | UInt uiWidthInCU = ( iPicWidth %m_uiMaxCUWidth ) ? iPicWidth /m_uiMaxCUWidth + 1 : iPicWidth /m_uiMaxCUWidth; |
---|
1880 | UInt uiHeightInCU = ( iPicHeight%m_uiMaxCUHeight ) ? iPicHeight/m_uiMaxCUHeight + 1 : iPicHeight/m_uiMaxCUHeight; |
---|
1881 | #endif |
---|
1882 | UInt uiNumCUsInFrame = uiWidthInCU * uiHeightInCU; |
---|
1883 | |
---|
1884 | #if LAYER_CTB |
---|
1885 | UInt maxCU = pcCfgLayer->getSliceArgument() >> ( m_acLayerCfg[layerId].m_uiMaxCUDepth << 1); |
---|
1886 | #else |
---|
1887 | UInt maxCU = pcCfgLayer->getSliceArgument() >> ( m_uiMaxCUDepth << 1); |
---|
1888 | #endif |
---|
1889 | UInt numDU = ( pcCfgLayer->getSliceMode() == 1 ) ? ( uiNumCUsInFrame / maxCU ) : ( 0 ); |
---|
1890 | if( uiNumCUsInFrame % maxCU != 0 || numDU == 0 ) |
---|
1891 | { |
---|
1892 | numDU ++; |
---|
1893 | } |
---|
1894 | vps->getBspHrd(i)->setNumDU( numDU ); |
---|
1895 | vps->setBspHrdParameters( i, pcCfgLayer->getFrameRate(), numDU, pcCfgLayer->getTargetBitrate(), ( pcCfgLayer->getIntraPeriod() > 0 ) ); |
---|
1896 | } |
---|
1897 | #if Q0078_ADD_LAYER_SETS |
---|
1898 | for (UInt h = 1; h <= vps->getVpsNumLayerSetsMinus1(); h++) |
---|
1899 | #else |
---|
1900 | for(UInt h = 1; h <= (vps->getNumLayerSets()-1); h++) |
---|
1901 | #endif |
---|
1902 | { |
---|
1903 | vps->setNumBitstreamPartitions(h, 1); |
---|
1904 | for( i = 0; i < vps->getNumBitstreamPartitions(h); i++ ) |
---|
1905 | { |
---|
1906 | for( UInt j = 0; j <= (vps->getMaxLayers()-1); j++ ) |
---|
1907 | { |
---|
1908 | if (vps->getLayerIdIncludedFlag(h, j) && h == j) |
---|
1909 | { |
---|
1910 | vps->setLayerInBspFlag(h, i, j, true); |
---|
1911 | } |
---|
1912 | } |
---|
1913 | } |
---|
1914 | vps->setNumBspSchedCombinations(h, 1); |
---|
1915 | for( i = 0; i < vps->getNumBspSchedCombinations(h); i++ ) |
---|
1916 | { |
---|
1917 | for( UInt j = 0; j < vps->getNumBitstreamPartitions(h); j++ ) |
---|
1918 | { |
---|
1919 | vps->setBspCombHrdIdx(h, i, j, 0); |
---|
1920 | vps->setBspCombSchedIdx(h, i, j, 0); |
---|
1921 | } |
---|
1922 | } |
---|
1923 | } |
---|
1924 | } |
---|
1925 | #endif |
---|
1926 | #endif |
---|
1927 | |
---|
1928 | #else //SVC_EXTENSION |
---|
1929 | m_cTEncTop.init(isFieldCoding); |
---|
1930 | #endif //SVC_EXTENSION |
---|
1931 | } |
---|
1932 | |
---|
1933 | // ==================================================================================================================== |
---|
1934 | // Public member functions |
---|
1935 | // ==================================================================================================================== |
---|
1936 | |
---|
1937 | /** |
---|
1938 | - create internal class |
---|
1939 | - initialize internal variable |
---|
1940 | - until the end of input YUV file, call encoding function in TEncTop class |
---|
1941 | - delete allocated buffers |
---|
1942 | - destroy internal class |
---|
1943 | . |
---|
1944 | */ |
---|
1945 | #if SVC_EXTENSION |
---|
1946 | Void TAppEncTop::encode() |
---|
1947 | { |
---|
1948 | fstream bitstreamFile(m_pBitstreamFile, fstream::binary | fstream::out); |
---|
1949 | if (!bitstreamFile) |
---|
1950 | { |
---|
1951 | fprintf(stderr, "\nfailed to open bitstream file `%s' for writing\n", m_pBitstreamFile); |
---|
1952 | exit(EXIT_FAILURE); |
---|
1953 | } |
---|
1954 | |
---|
1955 | TComPicYuv* pcPicYuvOrg [MAX_LAYERS]; |
---|
1956 | TComPicYuv* pcPicYuvRec = NULL; |
---|
1957 | |
---|
1958 | // initialize internal class & member variables |
---|
1959 | xInitLibCfg(); |
---|
1960 | xCreateLib(); |
---|
1961 | xInitLib(m_isField); |
---|
1962 | |
---|
1963 | // main encoder loop |
---|
1964 | Int iNumEncoded = 0, iTotalNumEncoded = 0; |
---|
1965 | Bool bEos = false; |
---|
1966 | |
---|
1967 | list<AccessUnit> outputAccessUnits; ///< list of access units to write out. is populated by the encoding process |
---|
1968 | |
---|
1969 | for(UInt layer=0; layer<m_numLayers; layer++) |
---|
1970 | { |
---|
1971 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
1972 | //5 |
---|
1973 | g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY; |
---|
1974 | g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC; |
---|
1975 | |
---|
1976 | g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY; |
---|
1977 | g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC; |
---|
1978 | #endif |
---|
1979 | // allocate original YUV buffer |
---|
1980 | pcPicYuvOrg[layer] = new TComPicYuv; |
---|
1981 | if( m_isField ) |
---|
1982 | { |
---|
1983 | #if SVC_EXTENSION |
---|
1984 | #if LAYER_CTB |
---|
1985 | #if AUXILIARY_PICTURES |
---|
1986 | pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_acLayerCfg[layer].getChromaFormatIDC(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL ); |
---|
1987 | #else |
---|
1988 | pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL ); |
---|
1989 | #endif |
---|
1990 | #else |
---|
1991 | #if AUXILIARY_PICTURES |
---|
1992 | pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_acLayerCfg[layer].getChromaFormatIDC(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL ); |
---|
1993 | #else |
---|
1994 | pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL ); |
---|
1995 | #endif |
---|
1996 | #endif |
---|
1997 | #else |
---|
1998 | pcPicYuvOrg->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); |
---|
1999 | #endif |
---|
2000 | } |
---|
2001 | else |
---|
2002 | { |
---|
2003 | #if SVC_EXTENSION |
---|
2004 | #if LAYER_CTB |
---|
2005 | #if AUXILIARY_PICTURES |
---|
2006 | pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].getChromaFormatIDC(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL ); |
---|
2007 | #else |
---|
2008 | pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL ); |
---|
2009 | #endif |
---|
2010 | #else |
---|
2011 | #if AUXILIARY_PICTURES |
---|
2012 | pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].getChromaFormatIDC(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL ); |
---|
2013 | #else |
---|
2014 | pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL ); |
---|
2015 | #endif |
---|
2016 | #endif |
---|
2017 | #else |
---|
2018 | pcPicYuvOrg->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); |
---|
2019 | #endif |
---|
2020 | } |
---|
2021 | } |
---|
2022 | |
---|
2023 | Bool bFirstFrame = true; |
---|
2024 | while ( !bEos ) |
---|
2025 | { |
---|
2026 | // Read enough frames |
---|
2027 | Bool bFramesReadyToCode = false; |
---|
2028 | while(!bFramesReadyToCode) |
---|
2029 | { |
---|
2030 | for(UInt layer=0; layer<m_numLayers; layer++) |
---|
2031 | { |
---|
2032 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
2033 | //6 |
---|
2034 | g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY; |
---|
2035 | g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC; |
---|
2036 | |
---|
2037 | g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY; |
---|
2038 | g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC; |
---|
2039 | #endif |
---|
2040 | #if LAYER_CTB |
---|
2041 | g_uiMaxCUWidth = g_auiLayerMaxCUWidth[layer]; |
---|
2042 | g_uiMaxCUHeight = g_auiLayerMaxCUHeight[layer]; |
---|
2043 | g_uiMaxCUDepth = g_auiLayerMaxCUDepth[layer]; |
---|
2044 | g_uiAddCUDepth = g_auiLayerAddCUDepth[layer]; |
---|
2045 | #endif |
---|
2046 | |
---|
2047 | // get buffers |
---|
2048 | xGetBuffer(pcPicYuvRec, layer); |
---|
2049 | |
---|
2050 | // read input YUV file |
---|
2051 | m_acTVideoIOYuvInputFile[layer].read( pcPicYuvOrg[layer], m_acLayerCfg[layer].getPad() ); |
---|
2052 | |
---|
2053 | #if AUXILIARY_PICTURES |
---|
2054 | #if R0062_AUX_PSEUDO_MONOCHROME |
---|
2055 | if ( m_acLayerCfg[layer].getChromaFormatIDC() == CHROMA_400 || |
---|
2056 | (m_apcTEncTop[0]->getVPS()->getScalabilityMask(3) && (m_acLayerCfg[layer].getAuxId() == 1 || m_acLayerCfg[layer].getAuxId() == 2)) ) |
---|
2057 | #else |
---|
2058 | if (m_acLayerCfg[layer].getChromaFormatIDC() == CHROMA_400) |
---|
2059 | #endif |
---|
2060 | { |
---|
2061 | pcPicYuvOrg[layer]->convertToMonochrome(); |
---|
2062 | } |
---|
2063 | #endif |
---|
2064 | |
---|
2065 | if(layer == m_numLayers-1) |
---|
2066 | { |
---|
2067 | // increase number of received frames |
---|
2068 | m_iFrameRcvd++; |
---|
2069 | // check end of file |
---|
2070 | bEos = (m_isField && (m_iFrameRcvd == (m_framesToBeEncoded >> 1) )) || ( !m_isField && (m_iFrameRcvd == m_framesToBeEncoded) ); |
---|
2071 | } |
---|
2072 | |
---|
2073 | if ( m_isField ) |
---|
2074 | { |
---|
2075 | m_acTEncTop[layer].encodePrep( pcPicYuvOrg[layer], m_isTopFieldFirst ); |
---|
2076 | } |
---|
2077 | else |
---|
2078 | { |
---|
2079 | m_acTEncTop[layer].encodePrep( pcPicYuvOrg[layer] ); |
---|
2080 | } |
---|
2081 | } |
---|
2082 | |
---|
2083 | bFramesReadyToCode = !(!bFirstFrame && ( m_acTEncTop[m_numLayers-1].getNumPicRcvd() != m_iGOPSize && m_iGOPSize ) && !bEos ); |
---|
2084 | } |
---|
2085 | Bool flush = 0; |
---|
2086 | // if end of file (which is only detected on a read failure) flush the encoder of any queued pictures |
---|
2087 | if (m_acTVideoIOYuvInputFile[m_numLayers-1].isEof()) |
---|
2088 | { |
---|
2089 | flush = true; |
---|
2090 | bEos = true; |
---|
2091 | m_iFrameRcvd--; |
---|
2092 | m_acTEncTop[m_numLayers-1].setFramesToBeEncoded(m_iFrameRcvd); |
---|
2093 | } |
---|
2094 | |
---|
2095 | #if RC_SHVC_HARMONIZATION |
---|
2096 | for(UInt layer=0; layer<m_numLayers; layer++) |
---|
2097 | { |
---|
2098 | if ( m_acTEncTop[layer].getUseRateCtrl() ) |
---|
2099 | { |
---|
2100 | (m_acTEncTop[layer].getRateCtrl())->initRCGOP(m_acTEncTop[layer].getNumPicRcvd()); |
---|
2101 | } |
---|
2102 | } |
---|
2103 | #endif |
---|
2104 | |
---|
2105 | #if M0040_ADAPTIVE_RESOLUTION_CHANGE |
---|
2106 | if (m_adaptiveResolutionChange) |
---|
2107 | { |
---|
2108 | for(UInt layer = 0; layer < m_numLayers; layer++) |
---|
2109 | { |
---|
2110 | TComList<TComPicYuv*>::iterator iterPicYuvRec; |
---|
2111 | for (iterPicYuvRec = m_acListPicYuvRec[layer].begin(); iterPicYuvRec != m_acListPicYuvRec[layer].end(); iterPicYuvRec++) |
---|
2112 | { |
---|
2113 | TComPicYuv* recPic = *(iterPicYuvRec); |
---|
2114 | recPic->setReconstructed(false); |
---|
2115 | } |
---|
2116 | } |
---|
2117 | } |
---|
2118 | #endif |
---|
2119 | |
---|
2120 | // loop through frames in one GOP |
---|
2121 | for ( UInt iPicIdInGOP=0; iPicIdInGOP < (bFirstFrame? 1:m_iGOPSize); iPicIdInGOP++ ) |
---|
2122 | { |
---|
2123 | // layer by layer for each frame |
---|
2124 | for(UInt layer=0; layer<m_numLayers; layer++) |
---|
2125 | { |
---|
2126 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
2127 | //7 |
---|
2128 | g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY; |
---|
2129 | g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC; |
---|
2130 | |
---|
2131 | g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY; |
---|
2132 | g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC; |
---|
2133 | #endif |
---|
2134 | #if LAYER_CTB |
---|
2135 | g_uiMaxCUWidth = g_auiLayerMaxCUWidth[layer]; |
---|
2136 | g_uiMaxCUHeight = g_auiLayerMaxCUHeight[layer]; |
---|
2137 | g_uiMaxCUDepth = g_auiLayerMaxCUDepth[layer]; |
---|
2138 | g_uiAddCUDepth = g_auiLayerAddCUDepth[layer]; |
---|
2139 | |
---|
2140 | memcpy( g_auiZscanToRaster, g_auiLayerZscanToRaster[layer], sizeof( g_auiZscanToRaster ) ); |
---|
2141 | memcpy( g_auiRasterToZscan, g_auiLayerRasterToZscan[layer], sizeof( g_auiRasterToZscan ) ); |
---|
2142 | memcpy( g_auiRasterToPelX, g_auiLayerRasterToPelX[layer], sizeof( g_auiRasterToPelX ) ); |
---|
2143 | memcpy( g_auiRasterToPelY, g_auiLayerRasterToPelY[layer], sizeof( g_auiRasterToPelY ) ); |
---|
2144 | #endif |
---|
2145 | // call encoding function for one frame |
---|
2146 | if ( m_isField ) |
---|
2147 | { |
---|
2148 | m_acTEncTop[layer].encode( flush ? 0 : pcPicYuvOrg[layer], m_acListPicYuvRec[layer], outputAccessUnits, iPicIdInGOP, m_isTopFieldFirst ); |
---|
2149 | } |
---|
2150 | else |
---|
2151 | { |
---|
2152 | m_acTEncTop[layer].encode( flush ? 0 : pcPicYuvOrg[layer], m_acListPicYuvRec[layer], outputAccessUnits, iPicIdInGOP ); |
---|
2153 | } |
---|
2154 | } |
---|
2155 | } |
---|
2156 | #if R0247_SEI_ACTIVE |
---|
2157 | if(bFirstFrame) |
---|
2158 | { |
---|
2159 | list<AccessUnit>::iterator first_au = outputAccessUnits.begin(); |
---|
2160 | AccessUnit::iterator it_sps; |
---|
2161 | for (it_sps = first_au->begin(); it_sps != first_au->end(); it_sps++) |
---|
2162 | { |
---|
2163 | if( (*it_sps)->m_nalUnitType == NAL_UNIT_SPS ) |
---|
2164 | { |
---|
2165 | break; |
---|
2166 | } |
---|
2167 | } |
---|
2168 | |
---|
2169 | for (list<AccessUnit>::iterator it_au = ++outputAccessUnits.begin(); it_au != outputAccessUnits.end(); it_au++) |
---|
2170 | { |
---|
2171 | for (AccessUnit::iterator it_nalu = it_au->begin(); it_nalu != it_au->end(); it_nalu++) |
---|
2172 | { |
---|
2173 | if( (*it_nalu)->m_nalUnitType == NAL_UNIT_SPS ) |
---|
2174 | { |
---|
2175 | first_au->insert(++it_sps, *it_nalu); |
---|
2176 | it_nalu = it_au->erase(it_nalu); |
---|
2177 | } |
---|
2178 | } |
---|
2179 | } |
---|
2180 | } |
---|
2181 | |
---|
2182 | #endif |
---|
2183 | |
---|
2184 | #if RC_SHVC_HARMONIZATION |
---|
2185 | for(UInt layer=0; layer<m_numLayers; layer++) |
---|
2186 | { |
---|
2187 | if ( m_acTEncTop[layer].getUseRateCtrl() ) |
---|
2188 | { |
---|
2189 | (m_acTEncTop[layer].getRateCtrl())->destroyRCGOP(); |
---|
2190 | } |
---|
2191 | } |
---|
2192 | #endif |
---|
2193 | |
---|
2194 | iTotalNumEncoded = 0; |
---|
2195 | for(UInt layer=0; layer<m_numLayers; layer++) |
---|
2196 | { |
---|
2197 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
2198 | //8 |
---|
2199 | g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY; |
---|
2200 | g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC; |
---|
2201 | |
---|
2202 | g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY; |
---|
2203 | g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC; |
---|
2204 | #endif |
---|
2205 | // write bistream to file if necessary |
---|
2206 | iNumEncoded = m_acTEncTop[layer].getNumPicRcvd(); |
---|
2207 | if ( iNumEncoded > 0 ) |
---|
2208 | { |
---|
2209 | xWriteRecon(layer, iNumEncoded); |
---|
2210 | iTotalNumEncoded += iNumEncoded; |
---|
2211 | } |
---|
2212 | m_acTEncTop[layer].setNumPicRcvd( 0 ); |
---|
2213 | } |
---|
2214 | |
---|
2215 | // write bitstream out |
---|
2216 | if(iTotalNumEncoded) |
---|
2217 | { |
---|
2218 | #if P0130_EOB |
---|
2219 | if( bEos ) |
---|
2220 | { |
---|
2221 | OutputNALUnit nalu(NAL_UNIT_EOB); |
---|
2222 | nalu.m_layerId = 0; |
---|
2223 | |
---|
2224 | AccessUnit& accessUnit = outputAccessUnits.back(); |
---|
2225 | #if T_ID_EOB_BUG_FIX |
---|
2226 | nalu.m_temporalId = 0; |
---|
2227 | #else |
---|
2228 | nalu.m_temporalId = accessUnit.front()->m_temporalId; |
---|
2229 | #endif |
---|
2230 | accessUnit.push_back(new NALUnitEBSP(nalu)); |
---|
2231 | } |
---|
2232 | #endif |
---|
2233 | xWriteStream(bitstreamFile, iTotalNumEncoded, outputAccessUnits); |
---|
2234 | outputAccessUnits.clear(); |
---|
2235 | } |
---|
2236 | |
---|
2237 | // print out summary |
---|
2238 | if (bEos) |
---|
2239 | { |
---|
2240 | printOutSummary(m_isTopFieldFirst); |
---|
2241 | } |
---|
2242 | |
---|
2243 | bFirstFrame = false; |
---|
2244 | } |
---|
2245 | // delete original YUV buffer |
---|
2246 | for(UInt layer=0; layer<m_numLayers; layer++) |
---|
2247 | { |
---|
2248 | pcPicYuvOrg[layer]->destroy(); |
---|
2249 | delete pcPicYuvOrg[layer]; |
---|
2250 | pcPicYuvOrg[layer] = NULL; |
---|
2251 | |
---|
2252 | // delete used buffers in encoder class |
---|
2253 | m_acTEncTop[layer].deletePicBuffer(); |
---|
2254 | } |
---|
2255 | |
---|
2256 | // delete buffers & classes |
---|
2257 | xDeleteBuffer(); |
---|
2258 | xDestroyLib(); |
---|
2259 | |
---|
2260 | printRateSummary(); |
---|
2261 | |
---|
2262 | return; |
---|
2263 | } |
---|
2264 | |
---|
2265 | Void TAppEncTop::printOutSummary(Bool isField) |
---|
2266 | { |
---|
2267 | UInt layer; |
---|
2268 | |
---|
2269 | // set frame rate |
---|
2270 | for(layer = 0; layer < m_numLayers; layer++) |
---|
2271 | { |
---|
2272 | if(isField) |
---|
2273 | { |
---|
2274 | m_gcAnalyzeAll[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() * 2); |
---|
2275 | m_gcAnalyzeI[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() * 2 ); |
---|
2276 | m_gcAnalyzeP[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() * 2 ); |
---|
2277 | m_gcAnalyzeB[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() * 2 ); |
---|
2278 | } |
---|
2279 | else |
---|
2280 | { |
---|
2281 | m_gcAnalyzeAll[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate()); |
---|
2282 | m_gcAnalyzeI[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() ); |
---|
2283 | m_gcAnalyzeP[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() ); |
---|
2284 | m_gcAnalyzeB[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() ); |
---|
2285 | } |
---|
2286 | } |
---|
2287 | |
---|
2288 | //-- all |
---|
2289 | printf( "\n\nSUMMARY --------------------------------------------------------\n" ); |
---|
2290 | printf( "\tTotal Frames | " "Bitrate " "Y-PSNR " "U-PSNR " "V-PSNR \n" ); |
---|
2291 | for(layer = 0; layer < m_numLayers; layer++) |
---|
2292 | { |
---|
2293 | m_gcAnalyzeAll[layer].printOut('a', layer); |
---|
2294 | } |
---|
2295 | |
---|
2296 | printf( "\n\nI Slices--------------------------------------------------------\n" ); |
---|
2297 | printf( "\tTotal Frames | " "Bitrate " "Y-PSNR " "U-PSNR " "V-PSNR \n" ); |
---|
2298 | for(layer = 0; layer < m_numLayers; layer++) |
---|
2299 | { |
---|
2300 | m_gcAnalyzeI[layer].printOut('i', layer); |
---|
2301 | } |
---|
2302 | |
---|
2303 | printf( "\n\nP Slices--------------------------------------------------------\n" ); |
---|
2304 | printf( "\tTotal Frames | " "Bitrate " "Y-PSNR " "U-PSNR " "V-PSNR \n" ); |
---|
2305 | for(layer = 0; layer < m_numLayers; layer++) |
---|
2306 | { |
---|
2307 | m_gcAnalyzeP[layer].printOut('p', layer); |
---|
2308 | } |
---|
2309 | |
---|
2310 | printf( "\n\nB Slices--------------------------------------------------------\n" ); |
---|
2311 | printf( "\tTotal Frames | " "Bitrate " "Y-PSNR " "U-PSNR " "V-PSNR \n" ); |
---|
2312 | for(layer = 0; layer < m_numLayers; layer++) |
---|
2313 | { |
---|
2314 | m_gcAnalyzeB[layer].printOut('b', layer); |
---|
2315 | } |
---|
2316 | |
---|
2317 | if(isField) |
---|
2318 | { |
---|
2319 | for(layer = 0; layer < m_numLayers; layer++) |
---|
2320 | { |
---|
2321 | //-- interlaced summary |
---|
2322 | m_gcAnalyzeAll_in.setFrmRate( m_acLayerCfg[layer].getFrameRate()); |
---|
2323 | printf( "\n\nSUMMARY INTERLACED ---------------------------------------------\n" ); |
---|
2324 | m_gcAnalyzeAll_in.printOutInterlaced('a', m_gcAnalyzeAll[layer].getBits()); |
---|
2325 | |
---|
2326 | #if _SUMMARY_OUT_ |
---|
2327 | m_gcAnalyzeAll_in.printSummaryOutInterlaced(); |
---|
2328 | #endif |
---|
2329 | } |
---|
2330 | } |
---|
2331 | } |
---|
2332 | |
---|
2333 | #else |
---|
2334 | Void TAppEncTop::encode() |
---|
2335 | { |
---|
2336 | fstream bitstreamFile(m_pchBitstreamFile, fstream::binary | fstream::out); |
---|
2337 | if (!bitstreamFile) |
---|
2338 | { |
---|
2339 | fprintf(stderr, "\nfailed to open bitstream file `%s' for writing\n", m_pchBitstreamFile); |
---|
2340 | exit(EXIT_FAILURE); |
---|
2341 | } |
---|
2342 | |
---|
2343 | TComPicYuv* pcPicYuvOrg = new TComPicYuv; |
---|
2344 | TComPicYuv* pcPicYuvRec = NULL; |
---|
2345 | |
---|
2346 | // initialize internal class & member variables |
---|
2347 | xInitLibCfg(); |
---|
2348 | xCreateLib(); |
---|
2349 | xInitLib(m_isField); |
---|
2350 | |
---|
2351 | // main encoder loop |
---|
2352 | Int iNumEncoded = 0; |
---|
2353 | Bool bEos = false; |
---|
2354 | |
---|
2355 | list<AccessUnit> outputAccessUnits; ///< list of access units to write out. is populated by the encoding process |
---|
2356 | |
---|
2357 | // allocate original YUV buffer |
---|
2358 | if( m_isField ) |
---|
2359 | { |
---|
2360 | pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeightOrg, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); |
---|
2361 | } |
---|
2362 | else |
---|
2363 | { |
---|
2364 | pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); |
---|
2365 | } |
---|
2366 | |
---|
2367 | while ( !bEos ) |
---|
2368 | { |
---|
2369 | // get buffers |
---|
2370 | xGetBuffer(pcPicYuvRec); |
---|
2371 | |
---|
2372 | // read input YUV file |
---|
2373 | m_cTVideoIOYuvInputFile.read( pcPicYuvOrg, m_aiPad ); |
---|
2374 | |
---|
2375 | // increase number of received frames |
---|
2376 | m_iFrameRcvd++; |
---|
2377 | |
---|
2378 | bEos = (m_isField && (m_iFrameRcvd == (m_framesToBeEncoded >> 1) )) || ( !m_isField && (m_iFrameRcvd == m_framesToBeEncoded) ); |
---|
2379 | Bool flush = 0; |
---|
2380 | // if end of file (which is only detected on a read failure) flush the encoder of any queued pictures |
---|
2381 | if (m_cTVideoIOYuvInputFile.isEof()) |
---|
2382 | { |
---|
2383 | flush = true; |
---|
2384 | bEos = true; |
---|
2385 | m_iFrameRcvd--; |
---|
2386 | m_cTEncTop.setFramesToBeEncoded(m_iFrameRcvd); |
---|
2387 | } |
---|
2388 | |
---|
2389 | // call encoding function for one frame |
---|
2390 | if ( m_isField ) |
---|
2391 | { |
---|
2392 | m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, m_cListPicYuvRec, outputAccessUnits, iNumEncoded, m_isTopFieldFirst); |
---|
2393 | } |
---|
2394 | else |
---|
2395 | { |
---|
2396 | m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, m_cListPicYuvRec, outputAccessUnits, iNumEncoded ); |
---|
2397 | } |
---|
2398 | |
---|
2399 | // write bistream to file if necessary |
---|
2400 | if ( iNumEncoded > 0 ) |
---|
2401 | { |
---|
2402 | xWriteOutput(bitstreamFile, iNumEncoded, outputAccessUnits); |
---|
2403 | outputAccessUnits.clear(); |
---|
2404 | } |
---|
2405 | } |
---|
2406 | |
---|
2407 | m_cTEncTop.printSummary(m_isField); |
---|
2408 | |
---|
2409 | // delete original YUV buffer |
---|
2410 | pcPicYuvOrg->destroy(); |
---|
2411 | delete pcPicYuvOrg; |
---|
2412 | pcPicYuvOrg = NULL; |
---|
2413 | |
---|
2414 | // delete used buffers in encoder class |
---|
2415 | m_cTEncTop.deletePicBuffer(); |
---|
2416 | |
---|
2417 | // delete buffers & classes |
---|
2418 | xDeleteBuffer(); |
---|
2419 | xDestroyLib(); |
---|
2420 | |
---|
2421 | printRateSummary(); |
---|
2422 | |
---|
2423 | return; |
---|
2424 | } |
---|
2425 | #endif |
---|
2426 | |
---|
2427 | // ==================================================================================================================== |
---|
2428 | // Protected member functions |
---|
2429 | // ==================================================================================================================== |
---|
2430 | |
---|
2431 | /** |
---|
2432 | - application has picture buffer list with size of GOP |
---|
2433 | - picture buffer list acts as ring buffer |
---|
2434 | - end of the list has the latest picture |
---|
2435 | . |
---|
2436 | */ |
---|
2437 | #if SVC_EXTENSION |
---|
2438 | Void TAppEncTop::xGetBuffer( TComPicYuv*& rpcPicYuvRec, UInt layer) |
---|
2439 | { |
---|
2440 | assert( m_iGOPSize > 0 ); |
---|
2441 | |
---|
2442 | // org. buffer |
---|
2443 | if ( m_acListPicYuvRec[layer].size() == (UInt)m_iGOPSize ) |
---|
2444 | { |
---|
2445 | rpcPicYuvRec = m_acListPicYuvRec[layer].popFront(); |
---|
2446 | |
---|
2447 | } |
---|
2448 | else |
---|
2449 | { |
---|
2450 | rpcPicYuvRec = new TComPicYuv; |
---|
2451 | |
---|
2452 | #if LAYER_CTB |
---|
2453 | #if AUXILIARY_PICTURES |
---|
2454 | rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].getChromaFormatIDC(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL ); |
---|
2455 | #else |
---|
2456 | rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL ); |
---|
2457 | #endif |
---|
2458 | #else |
---|
2459 | #if AUXILIARY_PICTURES |
---|
2460 | rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].getChromaFormatIDC(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL ); |
---|
2461 | #else |
---|
2462 | rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL ); |
---|
2463 | #endif |
---|
2464 | #endif |
---|
2465 | |
---|
2466 | } |
---|
2467 | m_acListPicYuvRec[layer].pushBack( rpcPicYuvRec ); |
---|
2468 | } |
---|
2469 | |
---|
2470 | Void TAppEncTop::xDeleteBuffer( ) |
---|
2471 | { |
---|
2472 | for(UInt layer=0; layer<m_numLayers; layer++) |
---|
2473 | { |
---|
2474 | TComList<TComPicYuv*>::iterator iterPicYuvRec = m_acListPicYuvRec[layer].begin(); |
---|
2475 | |
---|
2476 | Int iSize = Int( m_acListPicYuvRec[layer].size() ); |
---|
2477 | |
---|
2478 | for ( Int i = 0; i < iSize; i++ ) |
---|
2479 | { |
---|
2480 | TComPicYuv* pcPicYuvRec = *(iterPicYuvRec++); |
---|
2481 | pcPicYuvRec->destroy(); |
---|
2482 | delete pcPicYuvRec; pcPicYuvRec = NULL; |
---|
2483 | } |
---|
2484 | } |
---|
2485 | } |
---|
2486 | |
---|
2487 | Void TAppEncTop::xWriteRecon(UInt layer, Int iNumEncoded) |
---|
2488 | { |
---|
2489 | #if REPN_FORMAT_IN_VPS |
---|
2490 | ChromaFormat chromaFormatIdc = m_acLayerCfg[layer].getChromaFormatIDC(); |
---|
2491 | Int xScal = TComSPS::getWinUnitX( chromaFormatIdc ); |
---|
2492 | Int yScal = TComSPS::getWinUnitY( chromaFormatIdc ); |
---|
2493 | #endif |
---|
2494 | |
---|
2495 | if (m_isField) |
---|
2496 | { |
---|
2497 | //Reinterlace fields |
---|
2498 | Int i; |
---|
2499 | TComList<TComPicYuv*>::iterator iterPicYuvRec = m_acListPicYuvRec[layer].end(); |
---|
2500 | |
---|
2501 | for ( i = 0; i < iNumEncoded; i++ ) |
---|
2502 | { |
---|
2503 | --iterPicYuvRec; |
---|
2504 | } |
---|
2505 | |
---|
2506 | for ( i = 0; i < iNumEncoded/2; i++ ) |
---|
2507 | { |
---|
2508 | TComPicYuv* pcPicYuvRecTop = *(iterPicYuvRec++); |
---|
2509 | TComPicYuv* pcPicYuvRecBottom = *(iterPicYuvRec++); |
---|
2510 | |
---|
2511 | #if M0040_ADAPTIVE_RESOLUTION_CHANGE |
---|
2512 | if (!m_acLayerCfg[layer].getReconFile().empty() && pcPicYuvRecTop->isReconstructed() && pcPicYuvRecBottom->isReconstructed()) |
---|
2513 | #else |
---|
2514 | if (!m_acLayerCfg[layer].getReconFile().empty()) |
---|
2515 | #endif |
---|
2516 | { |
---|
2517 | #if REPN_FORMAT_IN_VPS |
---|
2518 | m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRecTop, pcPicYuvRecBottom, m_acLayerCfg[layer].getConfWinLeft() * xScal, m_acLayerCfg[layer].getConfWinRight() * xScal, |
---|
2519 | m_acLayerCfg[layer].getConfWinTop() * yScal, m_acLayerCfg[layer].getConfWinBottom() * yScal, m_isTopFieldFirst ); |
---|
2520 | #else |
---|
2521 | m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRecTop, pcPicYuvRecBottom, m_acLayerCfg[layer].getConfWinLeft(), m_acLayerCfg[layer].getConfWinRight(), m_acLayerCfg[layer].getConfWinTop(), m_acLayerCfg[layer].getConfWinBottom(), m_isTopFieldFirst ); |
---|
2522 | #endif |
---|
2523 | } |
---|
2524 | } |
---|
2525 | } |
---|
2526 | else |
---|
2527 | { |
---|
2528 | Int i; |
---|
2529 | |
---|
2530 | TComList<TComPicYuv*>::iterator iterPicYuvRec = m_acListPicYuvRec[layer].end(); |
---|
2531 | |
---|
2532 | for ( i = 0; i < iNumEncoded; i++ ) |
---|
2533 | { |
---|
2534 | --iterPicYuvRec; |
---|
2535 | } |
---|
2536 | |
---|
2537 | for ( i = 0; i < iNumEncoded; i++ ) |
---|
2538 | { |
---|
2539 | TComPicYuv* pcPicYuvRec = *(iterPicYuvRec++); |
---|
2540 | #if M0040_ADAPTIVE_RESOLUTION_CHANGE |
---|
2541 | if (!m_acLayerCfg[layer].getReconFile().empty() && pcPicYuvRec->isReconstructed()) |
---|
2542 | #else |
---|
2543 | if (!m_acLayerCfg[layer].getReconFile().empty()) |
---|
2544 | #endif |
---|
2545 | { |
---|
2546 | #if REPN_FORMAT_IN_VPS |
---|
2547 | m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRec, m_acLayerCfg[layer].getConfWinLeft() * xScal, m_acLayerCfg[layer].getConfWinRight() * xScal, |
---|
2548 | m_acLayerCfg[layer].getConfWinTop() * yScal, m_acLayerCfg[layer].getConfWinBottom() * yScal ); |
---|
2549 | #else |
---|
2550 | m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRec, m_acLayerCfg[layer].getConfWinLeft(), m_acLayerCfg[layer].getConfWinRight(), |
---|
2551 | m_acLayerCfg[layer].getConfWinTop(), m_acLayerCfg[layer].getConfWinBottom() ); |
---|
2552 | #endif |
---|
2553 | } |
---|
2554 | } |
---|
2555 | } |
---|
2556 | } |
---|
2557 | |
---|
2558 | Void TAppEncTop::xWriteStream(std::ostream& bitstreamFile, Int iNumEncoded, const std::list<AccessUnit>& accessUnits) |
---|
2559 | { |
---|
2560 | if (m_isField) |
---|
2561 | { |
---|
2562 | //Reinterlace fields |
---|
2563 | Int i; |
---|
2564 | list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin(); |
---|
2565 | |
---|
2566 | #if M0040_ADAPTIVE_RESOLUTION_CHANGE |
---|
2567 | for ( i = 0; i < iNumEncoded/2 && iterBitstream != accessUnits.end(); i++ ) |
---|
2568 | #else |
---|
2569 | for ( i = 0; i < iNumEncoded/2; i++ ) |
---|
2570 | #endif |
---|
2571 | { |
---|
2572 | const AccessUnit& auTop = *(iterBitstream++); |
---|
2573 | const vector<UInt>& statsTop = writeAnnexB(bitstreamFile, auTop); |
---|
2574 | rateStatsAccum(auTop, statsTop); |
---|
2575 | |
---|
2576 | const AccessUnit& auBottom = *(iterBitstream++); |
---|
2577 | const vector<UInt>& statsBottom = writeAnnexB(bitstreamFile, auBottom); |
---|
2578 | rateStatsAccum(auBottom, statsBottom); |
---|
2579 | } |
---|
2580 | } |
---|
2581 | else |
---|
2582 | { |
---|
2583 | Int i; |
---|
2584 | |
---|
2585 | list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin(); |
---|
2586 | |
---|
2587 | #if M0040_ADAPTIVE_RESOLUTION_CHANGE |
---|
2588 | for ( i = 0; i < iNumEncoded && iterBitstream != accessUnits.end(); i++ ) |
---|
2589 | #else |
---|
2590 | for ( i = 0; i < iNumEncoded; i++ ) |
---|
2591 | #endif |
---|
2592 | { |
---|
2593 | const AccessUnit& au = *(iterBitstream++); |
---|
2594 | const vector<UInt>& stats = writeAnnexB(bitstreamFile, au); |
---|
2595 | rateStatsAccum(au, stats); |
---|
2596 | } |
---|
2597 | } |
---|
2598 | } |
---|
2599 | |
---|
2600 | #else // SVC_EXTENSION |
---|
2601 | Void TAppEncTop::xGetBuffer( TComPicYuv*& rpcPicYuvRec) |
---|
2602 | { |
---|
2603 | assert( m_iGOPSize > 0 ); |
---|
2604 | |
---|
2605 | // org. buffer |
---|
2606 | if ( m_cListPicYuvRec.size() == (UInt)m_iGOPSize ) |
---|
2607 | { |
---|
2608 | rpcPicYuvRec = m_cListPicYuvRec.popFront(); |
---|
2609 | |
---|
2610 | } |
---|
2611 | else |
---|
2612 | { |
---|
2613 | rpcPicYuvRec = new TComPicYuv; |
---|
2614 | |
---|
2615 | rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); |
---|
2616 | |
---|
2617 | } |
---|
2618 | m_cListPicYuvRec.pushBack( rpcPicYuvRec ); |
---|
2619 | } |
---|
2620 | |
---|
2621 | Void TAppEncTop::xDeleteBuffer( ) |
---|
2622 | { |
---|
2623 | TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvRec.begin(); |
---|
2624 | |
---|
2625 | Int iSize = Int( m_cListPicYuvRec.size() ); |
---|
2626 | |
---|
2627 | for ( Int i = 0; i < iSize; i++ ) |
---|
2628 | { |
---|
2629 | TComPicYuv* pcPicYuvRec = *(iterPicYuvRec++); |
---|
2630 | pcPicYuvRec->destroy(); |
---|
2631 | delete pcPicYuvRec; pcPicYuvRec = NULL; |
---|
2632 | } |
---|
2633 | |
---|
2634 | } |
---|
2635 | |
---|
2636 | /** \param iNumEncoded number of encoded frames |
---|
2637 | */ |
---|
2638 | Void TAppEncTop::xWriteOutput(std::ostream& bitstreamFile, Int iNumEncoded, const std::list<AccessUnit>& accessUnits) |
---|
2639 | { |
---|
2640 | if (m_isField) |
---|
2641 | { |
---|
2642 | //Reinterlace fields |
---|
2643 | Int i; |
---|
2644 | TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvRec.end(); |
---|
2645 | list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin(); |
---|
2646 | |
---|
2647 | for ( i = 0; i < iNumEncoded; i++ ) |
---|
2648 | { |
---|
2649 | --iterPicYuvRec; |
---|
2650 | } |
---|
2651 | |
---|
2652 | for ( i = 0; i < iNumEncoded/2; i++ ) |
---|
2653 | { |
---|
2654 | TComPicYuv* pcPicYuvRecTop = *(iterPicYuvRec++); |
---|
2655 | TComPicYuv* pcPicYuvRecBottom = *(iterPicYuvRec++); |
---|
2656 | |
---|
2657 | if (m_pchReconFile) |
---|
2658 | { |
---|
2659 | m_cTVideoIOYuvReconFile.write( pcPicYuvRecTop, pcPicYuvRecBottom, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, m_isTopFieldFirst ); |
---|
2660 | } |
---|
2661 | |
---|
2662 | const AccessUnit& auTop = *(iterBitstream++); |
---|
2663 | const vector<UInt>& statsTop = writeAnnexB(bitstreamFile, auTop); |
---|
2664 | rateStatsAccum(auTop, statsTop); |
---|
2665 | |
---|
2666 | const AccessUnit& auBottom = *(iterBitstream++); |
---|
2667 | const vector<UInt>& statsBottom = writeAnnexB(bitstreamFile, auBottom); |
---|
2668 | rateStatsAccum(auBottom, statsBottom); |
---|
2669 | } |
---|
2670 | } |
---|
2671 | else |
---|
2672 | { |
---|
2673 | Int i; |
---|
2674 | TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvRec.end(); |
---|
2675 | list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin(); |
---|
2676 | |
---|
2677 | for ( i = 0; i < iNumEncoded; i++ ) |
---|
2678 | { |
---|
2679 | --iterPicYuvRec; |
---|
2680 | } |
---|
2681 | |
---|
2682 | for ( i = 0; i < iNumEncoded; i++ ) |
---|
2683 | { |
---|
2684 | TComPicYuv* pcPicYuvRec = *(iterPicYuvRec++); |
---|
2685 | if (m_pchReconFile) |
---|
2686 | { |
---|
2687 | m_cTVideoIOYuvReconFile.write( pcPicYuvRec, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom ); |
---|
2688 | } |
---|
2689 | |
---|
2690 | const AccessUnit& au = *(iterBitstream++); |
---|
2691 | const vector<UInt>& stats = writeAnnexB(bitstreamFile, au); |
---|
2692 | rateStatsAccum(au, stats); |
---|
2693 | } |
---|
2694 | } |
---|
2695 | } |
---|
2696 | #endif |
---|
2697 | |
---|
2698 | /** |
---|
2699 | * |
---|
2700 | */ |
---|
2701 | void TAppEncTop::rateStatsAccum(const AccessUnit& au, const std::vector<UInt>& annexBsizes) |
---|
2702 | { |
---|
2703 | AccessUnit::const_iterator it_au = au.begin(); |
---|
2704 | vector<UInt>::const_iterator it_stats = annexBsizes.begin(); |
---|
2705 | |
---|
2706 | for (; it_au != au.end(); it_au++, it_stats++) |
---|
2707 | { |
---|
2708 | switch ((*it_au)->m_nalUnitType) |
---|
2709 | { |
---|
2710 | case NAL_UNIT_CODED_SLICE_TRAIL_R: |
---|
2711 | case NAL_UNIT_CODED_SLICE_TRAIL_N: |
---|
2712 | case NAL_UNIT_CODED_SLICE_TSA_R: |
---|
2713 | case NAL_UNIT_CODED_SLICE_TSA_N: |
---|
2714 | case NAL_UNIT_CODED_SLICE_STSA_R: |
---|
2715 | case NAL_UNIT_CODED_SLICE_STSA_N: |
---|
2716 | case NAL_UNIT_CODED_SLICE_BLA_W_LP: |
---|
2717 | case NAL_UNIT_CODED_SLICE_BLA_W_RADL: |
---|
2718 | case NAL_UNIT_CODED_SLICE_BLA_N_LP: |
---|
2719 | case NAL_UNIT_CODED_SLICE_IDR_W_RADL: |
---|
2720 | case NAL_UNIT_CODED_SLICE_IDR_N_LP: |
---|
2721 | case NAL_UNIT_CODED_SLICE_CRA: |
---|
2722 | case NAL_UNIT_CODED_SLICE_RADL_N: |
---|
2723 | case NAL_UNIT_CODED_SLICE_RADL_R: |
---|
2724 | case NAL_UNIT_CODED_SLICE_RASL_N: |
---|
2725 | case NAL_UNIT_CODED_SLICE_RASL_R: |
---|
2726 | case NAL_UNIT_VPS: |
---|
2727 | case NAL_UNIT_SPS: |
---|
2728 | case NAL_UNIT_PPS: |
---|
2729 | m_essentialBytes += *it_stats; |
---|
2730 | break; |
---|
2731 | default: |
---|
2732 | break; |
---|
2733 | } |
---|
2734 | |
---|
2735 | m_totalBytes += *it_stats; |
---|
2736 | } |
---|
2737 | } |
---|
2738 | |
---|
2739 | void TAppEncTop::printRateSummary() |
---|
2740 | { |
---|
2741 | #if SVC_EXTENSION |
---|
2742 | Double time = (Double) m_iFrameRcvd / m_acLayerCfg[m_numLayers-1].getFrameRate(); |
---|
2743 | #else |
---|
2744 | Double time = (Double) m_iFrameRcvd / m_iFrameRate; |
---|
2745 | #endif |
---|
2746 | printf("Bytes written to file: %u (%.3f kbps)\n", m_totalBytes, 0.008 * m_totalBytes / time); |
---|
2747 | #if VERBOSE_RATE |
---|
2748 | printf("Bytes for SPS/PPS/Slice (Incl. Annex B): %u (%.3f kbps)\n", m_essentialBytes, 0.008 * m_essentialBytes / time); |
---|
2749 | #endif |
---|
2750 | } |
---|
2751 | |
---|
2752 | //! \} |
---|