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 TEncTop.cpp |
---|
35 | \brief encoder class |
---|
36 | */ |
---|
37 | |
---|
38 | #include "TLibCommon/CommonDef.h" |
---|
39 | #include "TEncTop.h" |
---|
40 | #include "TEncPic.h" |
---|
41 | #include "TLibCommon/TComChromaFormat.h" |
---|
42 | #if FAST_BIT_EST |
---|
43 | #include "TLibCommon/ContextModel.h" |
---|
44 | #endif |
---|
45 | |
---|
46 | //! \ingroup TLibEncoder |
---|
47 | //! \{ |
---|
48 | #if SVC_EXTENSION |
---|
49 | Int TEncTop::m_iSPSIdCnt = 0; |
---|
50 | Int TEncTop::m_iPPSIdCnt = 0; |
---|
51 | TComVPS TEncCfg::m_cVPS; |
---|
52 | #endif |
---|
53 | |
---|
54 | // ==================================================================================================================== |
---|
55 | // Constructor / destructor / create / destroy |
---|
56 | // ==================================================================================================================== |
---|
57 | |
---|
58 | TEncTop::TEncTop() |
---|
59 | { |
---|
60 | m_iPOCLast = -1; |
---|
61 | m_iNumPicRcvd = 0; |
---|
62 | m_uiNumAllPicCoded = 0; |
---|
63 | m_pppcRDSbacCoder = NULL; |
---|
64 | m_pppcBinCoderCABAC = NULL; |
---|
65 | m_cRDGoOnSbacCoder.init( &m_cRDGoOnBinCoderCABAC ); |
---|
66 | #if ENC_DEC_TRACE |
---|
67 | if (g_hTrace == NULL) |
---|
68 | { |
---|
69 | g_hTrace = fopen( "TraceEnc.txt", "wb" ); |
---|
70 | } |
---|
71 | g_bJustDoIt = g_bEncDecTraceDisable; |
---|
72 | g_nSymbolCounter = 0; |
---|
73 | #endif |
---|
74 | |
---|
75 | m_iMaxRefPicNum = 0; |
---|
76 | |
---|
77 | #if FAST_BIT_EST |
---|
78 | ContextModel::buildNextStateTable(); |
---|
79 | #endif |
---|
80 | |
---|
81 | #if SVC_EXTENSION |
---|
82 | memset(m_cIlpPic, 0, sizeof(m_cIlpPic)); |
---|
83 | #if REF_IDX_MFM |
---|
84 | m_bMFMEnabledFlag = false; |
---|
85 | #endif |
---|
86 | m_numRefLayerLocationOffsets = 0; |
---|
87 | #if POC_RESET_IDC_ENCODER |
---|
88 | m_pocAdjustmentValue = 0; |
---|
89 | #endif |
---|
90 | #if NO_CLRAS_OUTPUT_FLAG |
---|
91 | m_noClrasOutputFlag = false; |
---|
92 | m_layerInitializedFlag = false; |
---|
93 | m_firstPicInLayerDecodedFlag = false; |
---|
94 | m_noOutputOfPriorPicsFlags = false; |
---|
95 | #endif |
---|
96 | #if P0297_VPS_POC_LSB_ALIGNED_FLAG |
---|
97 | m_pocDecrementedInDPBFlag = false; |
---|
98 | #endif |
---|
99 | #endif //SVC_EXTENSION |
---|
100 | } |
---|
101 | |
---|
102 | TEncTop::~TEncTop() |
---|
103 | { |
---|
104 | #if ENC_DEC_TRACE |
---|
105 | if (g_hTrace != stdout) |
---|
106 | { |
---|
107 | fclose( g_hTrace ); |
---|
108 | } |
---|
109 | #endif |
---|
110 | } |
---|
111 | |
---|
112 | Void TEncTop::create () |
---|
113 | { |
---|
114 | #if !SVC_EXTENSION |
---|
115 | // initialize global variables |
---|
116 | initROM(); |
---|
117 | #endif |
---|
118 | |
---|
119 | // create processing unit classes |
---|
120 | #if SVC_EXTENSION |
---|
121 | m_cGOPEncoder. create( m_layerId ); |
---|
122 | #else |
---|
123 | m_cGOPEncoder. create( ); |
---|
124 | #endif |
---|
125 | m_cSliceEncoder. create( getSourceWidth(), getSourceHeight(), m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth ); |
---|
126 | m_cCuEncoder. create( g_uiMaxCUDepth, g_uiMaxCUWidth, g_uiMaxCUHeight, m_chromaFormatIDC ); |
---|
127 | if (m_bUseSAO) |
---|
128 | { |
---|
129 | m_cEncSAO.create( getSourceWidth(), getSourceHeight(), m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, m_saoOffsetBitShift[CHANNEL_TYPE_LUMA], m_saoOffsetBitShift[CHANNEL_TYPE_CHROMA] ); |
---|
130 | #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK |
---|
131 | m_cEncSAO.createEncData(getSaoCtuBoundary()); |
---|
132 | #else |
---|
133 | m_cEncSAO.createEncData(); |
---|
134 | #endif |
---|
135 | } |
---|
136 | #if ADAPTIVE_QP_SELECTION |
---|
137 | if (m_bUseAdaptQpSelect) |
---|
138 | { |
---|
139 | m_cTrQuant.initSliceQpDelta(); |
---|
140 | } |
---|
141 | #endif |
---|
142 | |
---|
143 | m_cLoopFilter.create( g_uiMaxCUDepth ); |
---|
144 | |
---|
145 | if ( m_RCEnableRateControl ) |
---|
146 | { |
---|
147 | m_cRateCtrl.init( m_framesToBeEncoded, m_RCTargetBitrate, m_iFrameRate, m_iGOPSize, m_iSourceWidth, m_iSourceHeight, |
---|
148 | g_uiMaxCUWidth, g_uiMaxCUHeight, m_RCKeepHierarchicalBit, m_RCUseLCUSeparateModel, m_GOPList ); |
---|
149 | } |
---|
150 | |
---|
151 | m_pppcRDSbacCoder = new TEncSbac** [g_uiMaxCUDepth+1]; |
---|
152 | #if FAST_BIT_EST |
---|
153 | m_pppcBinCoderCABAC = new TEncBinCABACCounter** [g_uiMaxCUDepth+1]; |
---|
154 | #else |
---|
155 | m_pppcBinCoderCABAC = new TEncBinCABAC** [g_uiMaxCUDepth+1]; |
---|
156 | #endif |
---|
157 | |
---|
158 | for ( Int iDepth = 0; iDepth < g_uiMaxCUDepth+1; iDepth++ ) |
---|
159 | { |
---|
160 | m_pppcRDSbacCoder[iDepth] = new TEncSbac* [CI_NUM]; |
---|
161 | #if FAST_BIT_EST |
---|
162 | m_pppcBinCoderCABAC[iDepth] = new TEncBinCABACCounter* [CI_NUM]; |
---|
163 | #else |
---|
164 | m_pppcBinCoderCABAC[iDepth] = new TEncBinCABAC* [CI_NUM]; |
---|
165 | #endif |
---|
166 | |
---|
167 | for (Int iCIIdx = 0; iCIIdx < CI_NUM; iCIIdx ++ ) |
---|
168 | { |
---|
169 | m_pppcRDSbacCoder[iDepth][iCIIdx] = new TEncSbac; |
---|
170 | #if FAST_BIT_EST |
---|
171 | m_pppcBinCoderCABAC [iDepth][iCIIdx] = new TEncBinCABACCounter; |
---|
172 | #else |
---|
173 | m_pppcBinCoderCABAC [iDepth][iCIIdx] = new TEncBinCABAC; |
---|
174 | #endif |
---|
175 | m_pppcRDSbacCoder [iDepth][iCIIdx]->init( m_pppcBinCoderCABAC [iDepth][iCIIdx] ); |
---|
176 | } |
---|
177 | } |
---|
178 | |
---|
179 | #if LAYER_CTB |
---|
180 | memcpy(g_auiLayerZscanToRaster[m_layerId], g_auiZscanToRaster, sizeof( g_auiZscanToRaster ) ); |
---|
181 | memcpy(g_auiLayerRasterToZscan[m_layerId], g_auiRasterToZscan, sizeof( g_auiRasterToZscan ) ); |
---|
182 | memcpy(g_auiLayerRasterToPelX[m_layerId], g_auiRasterToPelX, sizeof( g_auiRasterToPelX ) ); |
---|
183 | memcpy(g_auiLayerRasterToPelY[m_layerId], g_auiRasterToPelY, sizeof( g_auiRasterToPelY ) ); |
---|
184 | #endif |
---|
185 | } |
---|
186 | |
---|
187 | Void TEncTop::destroy () |
---|
188 | { |
---|
189 | // destroy processing unit classes |
---|
190 | m_cGOPEncoder. destroy(); |
---|
191 | m_cSliceEncoder. destroy(); |
---|
192 | m_cCuEncoder. destroy(); |
---|
193 | if (m_cSPS.getUseSAO()) |
---|
194 | { |
---|
195 | m_cEncSAO.destroyEncData(); |
---|
196 | m_cEncSAO.destroy(); |
---|
197 | } |
---|
198 | m_cLoopFilter. destroy(); |
---|
199 | m_cRateCtrl. destroy(); |
---|
200 | Int iDepth; |
---|
201 | for ( iDepth = 0; iDepth < g_uiMaxCUDepth+1; iDepth++ ) |
---|
202 | { |
---|
203 | for (Int iCIIdx = 0; iCIIdx < CI_NUM; iCIIdx ++ ) |
---|
204 | { |
---|
205 | delete m_pppcRDSbacCoder[iDepth][iCIIdx]; |
---|
206 | delete m_pppcBinCoderCABAC[iDepth][iCIIdx]; |
---|
207 | } |
---|
208 | } |
---|
209 | |
---|
210 | for ( iDepth = 0; iDepth < g_uiMaxCUDepth+1; iDepth++ ) |
---|
211 | { |
---|
212 | delete [] m_pppcRDSbacCoder[iDepth]; |
---|
213 | delete [] m_pppcBinCoderCABAC[iDepth]; |
---|
214 | } |
---|
215 | |
---|
216 | delete [] m_pppcRDSbacCoder; |
---|
217 | delete [] m_pppcBinCoderCABAC; |
---|
218 | |
---|
219 | #if SVC_EXTENSION |
---|
220 | for(Int i=0; i<MAX_NUM_REF; i++) |
---|
221 | { |
---|
222 | if(m_cIlpPic[i]) |
---|
223 | { |
---|
224 | m_cIlpPic[i]->destroy(); |
---|
225 | delete m_cIlpPic[i]; |
---|
226 | m_cIlpPic[i] = NULL; |
---|
227 | } |
---|
228 | } |
---|
229 | #else |
---|
230 | // destroy ROM |
---|
231 | destroyROM(); |
---|
232 | #endif |
---|
233 | return; |
---|
234 | } |
---|
235 | |
---|
236 | Void TEncTop::init(Bool isFieldCoding) |
---|
237 | { |
---|
238 | // initialize SPS |
---|
239 | xInitSPS(); |
---|
240 | |
---|
241 | // set the VPS profile information |
---|
242 | #if !MULTIPLE_PTL_SUPPORT |
---|
243 | *m_cVPS.getPTL() = *m_cSPS.getPTL(); |
---|
244 | #endif |
---|
245 | #if VPS_VUI_BSP_HRD_PARAMS |
---|
246 | m_cVPS.getTimingInfo()->setTimingInfoPresentFlag ( true ); |
---|
247 | #else |
---|
248 | m_cVPS.getTimingInfo()->setTimingInfoPresentFlag ( false ); |
---|
249 | #endif |
---|
250 | m_cRdCost.setCostMode(m_costMode); |
---|
251 | |
---|
252 | // initialize PPS |
---|
253 | m_cPPS.setSPS(&m_cSPS); |
---|
254 | xInitPPS(); |
---|
255 | xInitRPS(isFieldCoding); |
---|
256 | |
---|
257 | xInitPPSforTiles(); |
---|
258 | |
---|
259 | // initialize processing unit classes |
---|
260 | m_cGOPEncoder. init( this ); |
---|
261 | m_cSliceEncoder.init( this ); |
---|
262 | m_cCuEncoder. init( this ); |
---|
263 | |
---|
264 | // initialize transform & quantization class |
---|
265 | m_pcCavlcCoder = getCavlcCoder(); |
---|
266 | |
---|
267 | m_cTrQuant.init( 1 << m_uiQuadtreeTULog2MaxSize, |
---|
268 | m_useRDOQ, |
---|
269 | m_useRDOQTS, |
---|
270 | true |
---|
271 | ,m_useTransformSkipFast |
---|
272 | #if ADAPTIVE_QP_SELECTION |
---|
273 | ,m_bUseAdaptQpSelect |
---|
274 | #endif |
---|
275 | ); |
---|
276 | |
---|
277 | // initialize encoder search class |
---|
278 | m_cSearch.init( this, &m_cTrQuant, m_iSearchRange, m_bipredSearchRange, m_iFastSearch, 0, &m_cEntropyCoder, &m_cRdCost, getRDSbacCoder(), getRDGoOnSbacCoder() ); |
---|
279 | |
---|
280 | m_iMaxRefPicNum = 0; |
---|
281 | #if SVC_EXTENSION |
---|
282 | m_iSPSIdCnt ++; |
---|
283 | m_iPPSIdCnt ++; |
---|
284 | xInitILRP(); |
---|
285 | #endif |
---|
286 | } |
---|
287 | |
---|
288 | // ==================================================================================================================== |
---|
289 | // Public member functions |
---|
290 | // ==================================================================================================================== |
---|
291 | |
---|
292 | Void TEncTop::deletePicBuffer() |
---|
293 | { |
---|
294 | TComList<TComPic*>::iterator iterPic = m_cListPic.begin(); |
---|
295 | Int iSize = Int( m_cListPic.size() ); |
---|
296 | |
---|
297 | for ( Int i = 0; i < iSize; i++ ) |
---|
298 | { |
---|
299 | TComPic* pcPic = *(iterPic++); |
---|
300 | |
---|
301 | pcPic->destroy(); |
---|
302 | delete pcPic; |
---|
303 | pcPic = NULL; |
---|
304 | } |
---|
305 | } |
---|
306 | |
---|
307 | /** |
---|
308 | - Application has picture buffer list with size of GOP + 1 |
---|
309 | - Picture buffer list acts like as ring buffer |
---|
310 | - End of the list has the latest picture |
---|
311 | . |
---|
312 | \param flush cause encoder to encode a partial GOP |
---|
313 | \param pcPicYuvOrg original YUV picture |
---|
314 | \retval rcListPicYuvRecOut list of reconstruction YUV pictures |
---|
315 | \retval rcListBitstreamOut list of output bitstreams |
---|
316 | \retval iNumEncoded number of encoded pictures |
---|
317 | */ |
---|
318 | #if SVC_EXTENSION |
---|
319 | Void TEncTop::encode( TComPicYuv* pcPicYuvOrg, const InputColourSpaceConversion snrCSC, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int iPicIdInGOP ) |
---|
320 | { |
---|
321 | // compress GOP |
---|
322 | #if !RC_SHVC_HARMONIZATION |
---|
323 | if ( m_RCEnableRateControl ) |
---|
324 | { |
---|
325 | m_cRateCtrl.initRCGOP( m_iNumPicRcvd ); |
---|
326 | } |
---|
327 | #endif |
---|
328 | |
---|
329 | // compress GOP |
---|
330 | m_cGOPEncoder.compressGOP(iPicIdInGOP, m_iPOCLast, m_iNumPicRcvd, m_cListPic, rcListPicYuvRecOut, accessUnitsOut, false, false, snrCSC, m_printFrameMSE); |
---|
331 | |
---|
332 | #if !RC_SHVC_HARMONIZATION |
---|
333 | if ( m_RCEnableRateControl ) |
---|
334 | { |
---|
335 | m_cRateCtrl.destroyRCGOP(); |
---|
336 | } |
---|
337 | #endif |
---|
338 | |
---|
339 | m_uiNumAllPicCoded ++; |
---|
340 | } |
---|
341 | |
---|
342 | Void TEncTop::encodePrep( TComPicYuv* pcPicYuvOrg, TComPicYuv* pcPicYuvTrueOrg ) |
---|
343 | { |
---|
344 | if (pcPicYuvOrg != NULL) |
---|
345 | { |
---|
346 | // get original YUV |
---|
347 | TComPic* pcPicCurr = NULL; |
---|
348 | xGetNewPicBuffer( pcPicCurr ); |
---|
349 | pcPicYuvOrg->copyToPic( pcPicCurr->getPicYuvOrg() ); |
---|
350 | pcPicYuvTrueOrg->copyToPic( pcPicCurr->getPicYuvTrueOrg() ); |
---|
351 | |
---|
352 | // compute image characteristics |
---|
353 | if ( getUseAdaptiveQP() ) |
---|
354 | { |
---|
355 | m_cPreanalyzer.xPreanalyze( dynamic_cast<TEncPic*>( pcPicCurr ) ); |
---|
356 | } |
---|
357 | } |
---|
358 | } |
---|
359 | #else |
---|
360 | Void TEncTop::encode( Bool flush, TComPicYuv* pcPicYuvOrg, TComPicYuv* pcPicYuvTrueOrg, const InputColourSpaceConversion snrCSC, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded ) |
---|
361 | { |
---|
362 | if (pcPicYuvOrg != NULL) |
---|
363 | { |
---|
364 | // get original YUV |
---|
365 | TComPic* pcPicCurr = NULL; |
---|
366 | |
---|
367 | xGetNewPicBuffer( pcPicCurr ); |
---|
368 | pcPicYuvOrg->copyToPic( pcPicCurr->getPicYuvOrg() ); |
---|
369 | pcPicYuvTrueOrg->copyToPic( pcPicCurr->getPicYuvTrueOrg() ); |
---|
370 | |
---|
371 | // compute image characteristics |
---|
372 | if ( getUseAdaptiveQP() ) |
---|
373 | { |
---|
374 | m_cPreanalyzer.xPreanalyze( dynamic_cast<TEncPic*>( pcPicCurr ) ); |
---|
375 | } |
---|
376 | } |
---|
377 | |
---|
378 | if ((m_iNumPicRcvd == 0) || (!flush && (m_iPOCLast != 0) && (m_iNumPicRcvd != m_iGOPSize) && (m_iGOPSize != 0))) |
---|
379 | { |
---|
380 | iNumEncoded = 0; |
---|
381 | return; |
---|
382 | } |
---|
383 | |
---|
384 | if ( m_RCEnableRateControl ) |
---|
385 | { |
---|
386 | m_cRateCtrl.initRCGOP( m_iNumPicRcvd ); |
---|
387 | } |
---|
388 | |
---|
389 | // compress GOP |
---|
390 | m_cGOPEncoder.compressGOP(m_iPOCLast, m_iNumPicRcvd, m_cListPic, rcListPicYuvRecOut, accessUnitsOut, false, false, snrCSC, m_printFrameMSE); |
---|
391 | |
---|
392 | if ( m_RCEnableRateControl ) |
---|
393 | { |
---|
394 | m_cRateCtrl.destroyRCGOP(); |
---|
395 | } |
---|
396 | |
---|
397 | iNumEncoded = m_iNumPicRcvd; |
---|
398 | m_iNumPicRcvd = 0; |
---|
399 | m_uiNumAllPicCoded += iNumEncoded; |
---|
400 | } |
---|
401 | #endif |
---|
402 | |
---|
403 | /**------------------------------------------------ |
---|
404 | Separate interlaced frame into two fields |
---|
405 | -------------------------------------------------**/ |
---|
406 | Void separateFields(Pel* org, Pel* dstField, UInt stride, UInt width, UInt height, Bool isTop) |
---|
407 | { |
---|
408 | if (!isTop) |
---|
409 | { |
---|
410 | org += stride; |
---|
411 | } |
---|
412 | for (Int y = 0; y < height>>1; y++) |
---|
413 | { |
---|
414 | for (Int x = 0; x < width; x++) |
---|
415 | { |
---|
416 | dstField[x] = org[x]; |
---|
417 | } |
---|
418 | |
---|
419 | dstField += stride; |
---|
420 | org += stride*2; |
---|
421 | } |
---|
422 | |
---|
423 | } |
---|
424 | |
---|
425 | #if SVC_EXTENSION |
---|
426 | Void TEncTop::encodePrep( TComPicYuv* pcPicYuvOrg, TComPicYuv* pcPicYuvTrueOrg, Bool isTff ) |
---|
427 | { |
---|
428 | for (Int fieldNum=0; fieldNum<2; fieldNum++) |
---|
429 | { |
---|
430 | if (pcPicYuvOrg) |
---|
431 | { |
---|
432 | /* -- field initialization -- */ |
---|
433 | const Bool isTopField=isTff==(fieldNum==0); |
---|
434 | |
---|
435 | TComPic *pcField; |
---|
436 | xGetNewPicBuffer( pcField ); |
---|
437 | pcField->setReconMark (false); // where is this normally? |
---|
438 | |
---|
439 | pcField->getSlice(0)->setPOC( m_iPOCLast ); // superfluous? |
---|
440 | pcField->getPicYuvRec()->setBorderExtension(false);// where is this normally? |
---|
441 | |
---|
442 | pcField->setTopField(isTopField); // interlaced requirement |
---|
443 | |
---|
444 | for (UInt componentIndex = 0; componentIndex < pcPicYuvOrg->getNumberValidComponents(); componentIndex++) |
---|
445 | { |
---|
446 | const ComponentID component = ComponentID(componentIndex); |
---|
447 | const UInt stride = pcPicYuvOrg->getStride(component); |
---|
448 | |
---|
449 | separateFields((pcPicYuvOrg->getBuf(component) + pcPicYuvOrg->getMarginX(component) + (pcPicYuvOrg->getMarginY(component) * stride)), |
---|
450 | pcField->getPicYuvOrg()->getAddr(component), |
---|
451 | pcPicYuvOrg->getStride(component), |
---|
452 | pcPicYuvOrg->getWidth(component), |
---|
453 | pcPicYuvOrg->getHeight(component), |
---|
454 | isTopField); |
---|
455 | |
---|
456 | separateFields((pcPicYuvTrueOrg->getBuf(component) + pcPicYuvTrueOrg->getMarginX(component) + (pcPicYuvTrueOrg->getMarginY(component) * stride)), |
---|
457 | pcField->getPicYuvTrueOrg()->getAddr(component), |
---|
458 | pcPicYuvTrueOrg->getStride(component), |
---|
459 | pcPicYuvTrueOrg->getWidth(component), |
---|
460 | pcPicYuvTrueOrg->getHeight(component), |
---|
461 | isTopField); |
---|
462 | } |
---|
463 | |
---|
464 | // compute image characteristics |
---|
465 | if ( getUseAdaptiveQP() ) |
---|
466 | { |
---|
467 | m_cPreanalyzer.xPreanalyze( dynamic_cast<TEncPic*>( pcField ) ); |
---|
468 | } |
---|
469 | } |
---|
470 | } |
---|
471 | } |
---|
472 | |
---|
473 | Void TEncTop::encode( TComPicYuv* pcPicYuvOrg, const InputColourSpaceConversion snrCSC, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int iPicIdInGOP, Bool isTff ) |
---|
474 | { |
---|
475 | for (Int fieldNum=0; fieldNum<2; fieldNum++) |
---|
476 | { |
---|
477 | if (pcPicYuvOrg) |
---|
478 | { |
---|
479 | if (fieldNum==1) // where is this normally? |
---|
480 | { |
---|
481 | TComPicYuv* rpcPicYuvRec; |
---|
482 | |
---|
483 | // org. buffer |
---|
484 | if ( rcListPicYuvRecOut.size() >= (UInt)m_iGOPSize+1 ) // need to maintain field 0 in list of RecOuts while processing field 1. Hence +1 on m_iGOPSize. |
---|
485 | { |
---|
486 | rpcPicYuvRec = rcListPicYuvRecOut.popFront(); |
---|
487 | } |
---|
488 | else |
---|
489 | { |
---|
490 | rpcPicYuvRec = new TComPicYuv; |
---|
491 | rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth); |
---|
492 | } |
---|
493 | rcListPicYuvRecOut.pushBack( rpcPicYuvRec ); |
---|
494 | } |
---|
495 | } |
---|
496 | |
---|
497 | // compress GOP |
---|
498 | m_cGOPEncoder.compressGOP(iPicIdInGOP, m_iPOCLast, m_iNumPicRcvd, m_cListPic, rcListPicYuvRecOut, accessUnitsOut, true, isTff, snrCSC, m_printFrameMSE); |
---|
499 | } |
---|
500 | |
---|
501 | m_uiNumAllPicCoded ++; |
---|
502 | } |
---|
503 | #else |
---|
504 | Void TEncTop::encode(Bool flush, TComPicYuv* pcPicYuvOrg, TComPicYuv* pcPicYuvTrueOrg, const InputColourSpaceConversion snrCSC, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded, Bool isTff) |
---|
505 | { |
---|
506 | iNumEncoded = 0; |
---|
507 | |
---|
508 | for (Int fieldNum=0; fieldNum<2; fieldNum++) |
---|
509 | { |
---|
510 | if (pcPicYuvOrg) |
---|
511 | { |
---|
512 | |
---|
513 | /* -- field initialization -- */ |
---|
514 | const Bool isTopField=isTff==(fieldNum==0); |
---|
515 | |
---|
516 | TComPic *pcField; |
---|
517 | xGetNewPicBuffer( pcField ); |
---|
518 | pcField->setReconMark (false); // where is this normally? |
---|
519 | |
---|
520 | if (fieldNum==1) // where is this normally? |
---|
521 | { |
---|
522 | TComPicYuv* rpcPicYuvRec; |
---|
523 | |
---|
524 | // org. buffer |
---|
525 | if ( rcListPicYuvRecOut.size() >= (UInt)m_iGOPSize+1 ) // need to maintain field 0 in list of RecOuts while processing field 1. Hence +1 on m_iGOPSize. |
---|
526 | { |
---|
527 | rpcPicYuvRec = rcListPicYuvRecOut.popFront(); |
---|
528 | } |
---|
529 | else |
---|
530 | { |
---|
531 | rpcPicYuvRec = new TComPicYuv; |
---|
532 | rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth); |
---|
533 | } |
---|
534 | rcListPicYuvRecOut.pushBack( rpcPicYuvRec ); |
---|
535 | } |
---|
536 | |
---|
537 | pcField->getSlice(0)->setPOC( m_iPOCLast ); // superfluous? |
---|
538 | pcField->getPicYuvRec()->setBorderExtension(false);// where is this normally? |
---|
539 | |
---|
540 | pcField->setTopField(isTopField); // interlaced requirement |
---|
541 | |
---|
542 | for (UInt componentIndex = 0; componentIndex < pcPicYuvOrg->getNumberValidComponents(); componentIndex++) |
---|
543 | { |
---|
544 | const ComponentID component = ComponentID(componentIndex); |
---|
545 | const UInt stride = pcPicYuvOrg->getStride(component); |
---|
546 | |
---|
547 | separateFields((pcPicYuvOrg->getBuf(component) + pcPicYuvOrg->getMarginX(component) + (pcPicYuvOrg->getMarginY(component) * stride)), |
---|
548 | pcField->getPicYuvOrg()->getAddr(component), |
---|
549 | pcPicYuvOrg->getStride(component), |
---|
550 | pcPicYuvOrg->getWidth(component), |
---|
551 | pcPicYuvOrg->getHeight(component), |
---|
552 | isTopField); |
---|
553 | |
---|
554 | separateFields((pcPicYuvTrueOrg->getBuf(component) + pcPicYuvTrueOrg->getMarginX(component) + (pcPicYuvTrueOrg->getMarginY(component) * stride)), |
---|
555 | pcField->getPicYuvTrueOrg()->getAddr(component), |
---|
556 | pcPicYuvTrueOrg->getStride(component), |
---|
557 | pcPicYuvTrueOrg->getWidth(component), |
---|
558 | pcPicYuvTrueOrg->getHeight(component), |
---|
559 | isTopField); |
---|
560 | } |
---|
561 | |
---|
562 | // compute image characteristics |
---|
563 | if ( getUseAdaptiveQP() ) |
---|
564 | { |
---|
565 | m_cPreanalyzer.xPreanalyze( dynamic_cast<TEncPic*>( pcField ) ); |
---|
566 | } |
---|
567 | } |
---|
568 | |
---|
569 | if ( m_iNumPicRcvd && ((flush&&fieldNum==1) || (m_iPOCLast/2)==0 || m_iNumPicRcvd==m_iGOPSize ) ) |
---|
570 | { |
---|
571 | // compress GOP |
---|
572 | m_cGOPEncoder.compressGOP(m_iPOCLast, m_iNumPicRcvd, m_cListPic, rcListPicYuvRecOut, accessUnitsOut, true, isTff, snrCSC, m_printFrameMSE); |
---|
573 | |
---|
574 | iNumEncoded += m_iNumPicRcvd; |
---|
575 | m_uiNumAllPicCoded += m_iNumPicRcvd; |
---|
576 | m_iNumPicRcvd = 0; |
---|
577 | } |
---|
578 | } |
---|
579 | } |
---|
580 | #endif |
---|
581 | |
---|
582 | // ==================================================================================================================== |
---|
583 | // Protected member functions |
---|
584 | // ==================================================================================================================== |
---|
585 | |
---|
586 | /** |
---|
587 | - Application has picture buffer list with size of GOP + 1 |
---|
588 | - Picture buffer list acts like as ring buffer |
---|
589 | - End of the list has the latest picture |
---|
590 | . |
---|
591 | \retval rpcPic obtained picture buffer |
---|
592 | */ |
---|
593 | Void TEncTop::xGetNewPicBuffer ( TComPic*& rpcPic ) |
---|
594 | { |
---|
595 | TComSlice::sortPicList(m_cListPic); |
---|
596 | |
---|
597 | if (m_cListPic.size() >= (UInt)(m_iGOPSize + getMaxDecPicBuffering(MAX_TLAYER-1) + 2) ) |
---|
598 | { |
---|
599 | TComList<TComPic*>::iterator iterPic = m_cListPic.begin(); |
---|
600 | Int iSize = Int( m_cListPic.size() ); |
---|
601 | for ( Int i = 0; i < iSize; i++ ) |
---|
602 | { |
---|
603 | rpcPic = *(iterPic++); |
---|
604 | if(rpcPic->getSlice(0)->isReferenced() == false) |
---|
605 | { |
---|
606 | break; |
---|
607 | } |
---|
608 | } |
---|
609 | } |
---|
610 | else |
---|
611 | { |
---|
612 | if ( getUseAdaptiveQP() ) |
---|
613 | { |
---|
614 | TEncPic* pcEPic = new TEncPic; |
---|
615 | |
---|
616 | #if SVC_EXTENSION //Temporal solution, should be modified |
---|
617 | if(m_layerId > 0) |
---|
618 | { |
---|
619 | for(UInt i = 0; i < m_cVPS.getNumDirectRefLayers( m_layerId ); i++ ) |
---|
620 | { |
---|
621 | const Window scalEL = getPPS()->getScaledRefLayerWindowForLayer(m_cVPS.getRefLayerId(m_layerId, i)); |
---|
622 | const Window altRL = getPPS()->getRefLayerWindowForLayer(m_cVPS.getRefLayerId(m_layerId, i)); |
---|
623 | Bool equalOffsets = scalEL.hasEqualOffset(altRL); |
---|
624 | Bool zeroPhase = getPPS()->hasZeroResamplingPhase(m_cVPS.getRefLayerId(m_layerId, i)); |
---|
625 | |
---|
626 | TEncTop *pcEncTopBase = (TEncTop *)getRefLayerEnc( i ); |
---|
627 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
628 | UInt refLayerId = m_cVPS.getRefLayerId(m_layerId, i); |
---|
629 | Bool sameBitDepths = ( g_bitDepthLayer[CHANNEL_TYPE_LUMA][m_layerId] == g_bitDepthLayer[CHANNEL_TYPE_LUMA][refLayerId] ) && ( g_bitDepthLayer[CHANNEL_TYPE_CHROMA][m_layerId] == g_bitDepthLayer[CHANNEL_TYPE_CHROMA][refLayerId] ); |
---|
630 | |
---|
631 | #if REF_IDX_MFM |
---|
632 | if( m_iSourceWidth == pcEncTopBase->getSourceWidth() && m_iSourceHeight == pcEncTopBase->getSourceHeight() && equalOffsets && zeroPhase ) |
---|
633 | { |
---|
634 | pcEPic->setEqualPictureSizeAndOffsetFlag( i, true ); |
---|
635 | } |
---|
636 | |
---|
637 | if( !pcEPic->equalPictureSizeAndOffsetFlag(i) || !sameBitDepths |
---|
638 | #else |
---|
639 | if( m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() || !sameBitDepths |
---|
640 | || !equalOffsets |
---|
641 | || !zeroPhase |
---|
642 | #endif |
---|
643 | #if Q0048_CGS_3D_ASYMLUT |
---|
644 | || m_cPPS.getCGSFlag() > 0 |
---|
645 | #endif |
---|
646 | #if LAYER_CTB |
---|
647 | || pcEncTopBase->getSPS()->getMaxCUWidth() != m_cSPS.getMaxCUWidth() || pcEncTopBase->getSPS()->getMaxCUHeight() != m_cSPS.getMaxCUHeight() || pcEncTopBase->getSPS()->getMaxCUDepth() != m_cSPS.getMaxCUDepth() |
---|
648 | #endif |
---|
649 | ) |
---|
650 | #else |
---|
651 | if(m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() |
---|
652 | || !equalOffsets |
---|
653 | || !zeroPhase |
---|
654 | ) |
---|
655 | #endif |
---|
656 | { |
---|
657 | pcEPic->setSpatialEnhLayerFlag( i, true ); |
---|
658 | |
---|
659 | //only for scalable extension |
---|
660 | assert( m_cVPS.getScalabilityMask( SCALABILITY_ID ) == true ); |
---|
661 | } |
---|
662 | } |
---|
663 | } |
---|
664 | #endif |
---|
665 | |
---|
666 | #if SVC_EXTENSION |
---|
667 | pcEPic->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, m_cPPS.getMaxCuDQPDepth()+1 , |
---|
668 | m_conformanceWindow, m_defaultDisplayWindow, m_numReorderPics, &m_cSPS); |
---|
669 | #else //SVC_EXTENSION |
---|
670 | pcEPic->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, m_cPPS.getMaxCuDQPDepth()+1, m_conformanceWindow, m_defaultDisplayWindow, m_numReorderPics); |
---|
671 | #endif //SVC_EXTENSION |
---|
672 | rpcPic = pcEPic; |
---|
673 | } |
---|
674 | else |
---|
675 | { |
---|
676 | rpcPic = new TComPic; |
---|
677 | |
---|
678 | #if SVC_EXTENSION //Temporal solution, should be modified |
---|
679 | if(m_layerId > 0) |
---|
680 | { |
---|
681 | for(UInt i = 0; i < m_cVPS.getNumDirectRefLayers( m_layerId ); i++ ) |
---|
682 | { |
---|
683 | const Window scalEL = getPPS()->getScaledRefLayerWindowForLayer(m_cVPS.getRefLayerId(m_layerId, i)); |
---|
684 | const Window altRL = getPPS()->getRefLayerWindowForLayer(m_cVPS.getRefLayerId(m_layerId, i)); |
---|
685 | Bool equalOffsets = scalEL.hasEqualOffset(altRL); |
---|
686 | Bool zeroPhase = getPPS()->hasZeroResamplingPhase(m_cVPS.getRefLayerId(m_layerId, i)); |
---|
687 | |
---|
688 | TEncTop *pcEncTopBase = (TEncTop *)getRefLayerEnc( i ); |
---|
689 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
690 | UInt refLayerId = m_cVPS.getRefLayerId(m_layerId, i); |
---|
691 | Bool sameBitDepths = ( g_bitDepthLayer[CHANNEL_TYPE_LUMA][m_layerId] == g_bitDepthLayer[CHANNEL_TYPE_LUMA][refLayerId] ) && ( g_bitDepthLayer[CHANNEL_TYPE_CHROMA][m_layerId] == g_bitDepthLayer[CHANNEL_TYPE_CHROMA][refLayerId] ); |
---|
692 | |
---|
693 | if( m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() || !sameBitDepths |
---|
694 | || !equalOffsets |
---|
695 | || !zeroPhase |
---|
696 | #if Q0048_CGS_3D_ASYMLUT |
---|
697 | || m_cPPS.getCGSFlag() > 0 |
---|
698 | #endif |
---|
699 | #if LAYER_CTB |
---|
700 | || pcEncTopBase->getSPS()->getMaxCUWidth() != m_cSPS.getMaxCUWidth() || pcEncTopBase->getSPS()->getMaxCUHeight() != m_cSPS.getMaxCUHeight() || pcEncTopBase->getSPS()->getMaxCUDepth() != m_cSPS.getMaxCUDepth() |
---|
701 | #endif |
---|
702 | ) |
---|
703 | #else |
---|
704 | if(m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() |
---|
705 | || !equalOffsets |
---|
706 | || !zeroPhase |
---|
707 | ) |
---|
708 | #endif |
---|
709 | { |
---|
710 | rpcPic->setSpatialEnhLayerFlag( i, true ); |
---|
711 | |
---|
712 | //only for scalable extension |
---|
713 | assert( m_cVPS.getScalabilityMask( SCALABILITY_ID ) == true ); |
---|
714 | } |
---|
715 | } |
---|
716 | } |
---|
717 | #endif |
---|
718 | |
---|
719 | #if SVC_EXTENSION |
---|
720 | rpcPic->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, m_conformanceWindow, m_defaultDisplayWindow, m_numReorderPics, &m_cSPS); |
---|
721 | #else //SVC_EXTENSION |
---|
722 | rpcPic->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, m_conformanceWindow, m_defaultDisplayWindow, m_numReorderPics, false ); |
---|
723 | #endif //SVC_EXTENSION |
---|
724 | } |
---|
725 | |
---|
726 | m_cListPic.pushBack( rpcPic ); |
---|
727 | } |
---|
728 | rpcPic->setReconMark (false); |
---|
729 | |
---|
730 | m_iPOCLast++; |
---|
731 | m_iNumPicRcvd++; |
---|
732 | |
---|
733 | rpcPic->getSlice(0)->setPOC( m_iPOCLast ); |
---|
734 | // mark it should be extended |
---|
735 | rpcPic->getPicYuvRec()->setBorderExtension(false); |
---|
736 | } |
---|
737 | |
---|
738 | Void TEncTop::xInitSPS() |
---|
739 | { |
---|
740 | #if SVC_EXTENSION |
---|
741 | m_cSPS.setExtensionFlag( m_layerId > 0 ? true : false ); |
---|
742 | #if R0042_PROFILE_INDICATION |
---|
743 | m_cSPS.setNumDirectRefLayers(m_numDirectRefLayers); |
---|
744 | #endif |
---|
745 | #if Q0078_ADD_LAYER_SETS |
---|
746 | if( !m_numDirectRefLayers && m_numAddLayerSets ) |
---|
747 | { |
---|
748 | m_cSPS.setLayerId(0); // layer ID 0 for independent layers |
---|
749 | } |
---|
750 | else |
---|
751 | { |
---|
752 | m_cSPS.setLayerId(m_layerId); |
---|
753 | } |
---|
754 | #else |
---|
755 | m_cSPS.setLayerId(m_layerId); |
---|
756 | #endif |
---|
757 | #endif //SVC_EXTENSION |
---|
758 | ProfileTierLevel& profileTierLevel = *m_cSPS.getPTL()->getGeneralPTL(); |
---|
759 | profileTierLevel.setLevelIdc(m_level); |
---|
760 | profileTierLevel.setTierFlag(m_levelTier); |
---|
761 | profileTierLevel.setProfileIdc(m_profile); |
---|
762 | profileTierLevel.setProfileCompatibilityFlag(m_profile, 1); |
---|
763 | profileTierLevel.setProgressiveSourceFlag(m_progressiveSourceFlag); |
---|
764 | profileTierLevel.setInterlacedSourceFlag(m_interlacedSourceFlag); |
---|
765 | profileTierLevel.setNonPackedConstraintFlag(m_nonPackedConstraintFlag); |
---|
766 | profileTierLevel.setFrameOnlyConstraintFlag(m_frameOnlyConstraintFlag); |
---|
767 | profileTierLevel.setBitDepthConstraint(m_bitDepthConstraintValue); |
---|
768 | profileTierLevel.setChromaFormatConstraint(m_chromaFormatConstraintValue); |
---|
769 | profileTierLevel.setIntraConstraintFlag(m_intraConstraintFlag); |
---|
770 | profileTierLevel.setLowerBitRateConstraintFlag(m_lowerBitRateConstraintFlag); |
---|
771 | |
---|
772 | if ((m_profile == Profile::MAIN10) && (g_bitDepth[CHANNEL_TYPE_LUMA] == 8) && (g_bitDepth[CHANNEL_TYPE_CHROMA] == 8)) |
---|
773 | { |
---|
774 | /* The above constraint is equal to Profile::MAIN */ |
---|
775 | profileTierLevel.setProfileCompatibilityFlag(Profile::MAIN, 1); |
---|
776 | } |
---|
777 | if (m_profile == Profile::MAIN) |
---|
778 | { |
---|
779 | /* A Profile::MAIN10 decoder can always decode Profile::MAIN */ |
---|
780 | profileTierLevel.setProfileCompatibilityFlag(Profile::MAIN10, 1); |
---|
781 | } |
---|
782 | /* XXX: should Main be marked as compatible with still picture? */ |
---|
783 | /* XXX: may be a good idea to refactor the above into a function |
---|
784 | * that chooses the actual compatibility based upon options */ |
---|
785 | |
---|
786 | m_cSPS.setPicWidthInLumaSamples ( m_iSourceWidth ); |
---|
787 | m_cSPS.setPicHeightInLumaSamples ( m_iSourceHeight ); |
---|
788 | m_cSPS.setConformanceWindow ( m_conformanceWindow ); |
---|
789 | m_cSPS.setMaxCUWidth ( g_uiMaxCUWidth ); |
---|
790 | m_cSPS.setMaxCUHeight ( g_uiMaxCUHeight ); |
---|
791 | m_cSPS.setMaxCUDepth ( g_uiMaxCUDepth ); |
---|
792 | m_cSPS.setChromaFormatIdc( m_chromaFormatIDC); |
---|
793 | |
---|
794 | Int minCUSize = m_cSPS.getMaxCUWidth() >> ( m_cSPS.getMaxCUDepth()-g_uiAddCUDepth ); |
---|
795 | Int log2MinCUSize = 0; |
---|
796 | while(minCUSize > 1) |
---|
797 | { |
---|
798 | minCUSize >>= 1; |
---|
799 | log2MinCUSize++; |
---|
800 | } |
---|
801 | |
---|
802 | m_cSPS.setLog2MinCodingBlockSize(log2MinCUSize); |
---|
803 | m_cSPS.setLog2DiffMaxMinCodingBlockSize(m_cSPS.getMaxCUDepth()-g_uiAddCUDepth-getMaxCUDepthOffset(m_cSPS.getChromaFormatIdc(), m_cSPS.getQuadtreeTULog2MinSize())); |
---|
804 | #if SVC_EXTENSION |
---|
805 | m_cSPS.setSPSId ( m_iSPSIdCnt ); |
---|
806 | #endif |
---|
807 | |
---|
808 | m_cSPS.setPCMLog2MinSize (m_uiPCMLog2MinSize); |
---|
809 | m_cSPS.setUsePCM ( m_usePCM ); |
---|
810 | m_cSPS.setPCMLog2MaxSize( m_pcmLog2MaxSize ); |
---|
811 | |
---|
812 | m_cSPS.setQuadtreeTULog2MaxSize( m_uiQuadtreeTULog2MaxSize ); |
---|
813 | m_cSPS.setQuadtreeTULog2MinSize( m_uiQuadtreeTULog2MinSize ); |
---|
814 | m_cSPS.setQuadtreeTUMaxDepthInter( m_uiQuadtreeTUMaxDepthInter ); |
---|
815 | m_cSPS.setQuadtreeTUMaxDepthIntra( m_uiQuadtreeTUMaxDepthIntra ); |
---|
816 | |
---|
817 | m_cSPS.setTMVPFlagsPresent(false); |
---|
818 | |
---|
819 | m_cSPS.setMaxTrSize ( 1 << m_uiQuadtreeTULog2MaxSize ); |
---|
820 | |
---|
821 | Int i; |
---|
822 | |
---|
823 | for (i = 0; i < g_uiMaxCUDepth-g_uiAddCUDepth; i++ ) |
---|
824 | { |
---|
825 | m_cSPS.setAMPAcc( i, m_useAMP ); |
---|
826 | //m_cSPS.setAMPAcc( i, 1 ); |
---|
827 | } |
---|
828 | |
---|
829 | m_cSPS.setUseAMP ( m_useAMP ); |
---|
830 | |
---|
831 | for (i = g_uiMaxCUDepth-g_uiAddCUDepth; i < g_uiMaxCUDepth; i++ ) |
---|
832 | { |
---|
833 | m_cSPS.setAMPAcc(i, 0); |
---|
834 | } |
---|
835 | |
---|
836 | |
---|
837 | for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++) |
---|
838 | { |
---|
839 | #if REPN_FORMAT_IN_VPS |
---|
840 | m_cSPS.setBitDepth (ChannelType(channelType), m_cVPS.getVpsRepFormat( m_cVPS.getVpsRepFormatIdx( m_cVPS.getLayerIdxInVps( m_layerId ) ) )->getBitDepthVps(ChannelType(channelType)) ); |
---|
841 | m_cSPS.setQpBDOffset (ChannelType(channelType), (6 * (m_cVPS.getVpsRepFormat( m_cVPS.getVpsRepFormatIdx( m_cVPS.getLayerIdxInVps( m_layerId ) ) )->getBitDepthVps(ChannelType(channelType)) - 8))); |
---|
842 | #else |
---|
843 | m_cSPS.setBitDepth (ChannelType(channelType), g_bitDepth[channelType] ); |
---|
844 | m_cSPS.setQpBDOffset (ChannelType(channelType), (6 * (g_bitDepth[channelType] - 8))); |
---|
845 | #endif |
---|
846 | m_cSPS.setPCMBitDepth (ChannelType(channelType), g_PCMBitDepth[channelType] ); |
---|
847 | } |
---|
848 | |
---|
849 | m_cSPS.setUseExtendedPrecision(m_useExtendedPrecision); |
---|
850 | m_cSPS.setUseHighPrecisionPredictionWeighting(m_useHighPrecisionPredictionWeighting); |
---|
851 | |
---|
852 | m_cSPS.setUseSAO( m_bUseSAO ); |
---|
853 | m_cSPS.setUseResidualRotation(m_useResidualRotation); |
---|
854 | m_cSPS.setUseSingleSignificanceMapContext(m_useSingleSignificanceMapContext); |
---|
855 | m_cSPS.setUseGolombRiceParameterAdaptation(m_useGolombRiceParameterAdaptation); |
---|
856 | m_cSPS.setAlignCABACBeforeBypass(m_alignCABACBeforeBypass); |
---|
857 | |
---|
858 | for (UInt signallingModeIndex = 0; signallingModeIndex < NUMBER_OF_RDPCM_SIGNALLING_MODES; signallingModeIndex++) |
---|
859 | { |
---|
860 | m_cSPS.setUseResidualDPCM(RDPCMSignallingMode(signallingModeIndex), m_useResidualDPCM[signallingModeIndex]); |
---|
861 | } |
---|
862 | |
---|
863 | m_cSPS.setMaxTLayers( m_maxTempLayer ); |
---|
864 | m_cSPS.setTemporalIdNestingFlag( ( m_maxTempLayer == 1 ) ? true : false ); |
---|
865 | |
---|
866 | for ( i = 0; i < min(m_cSPS.getMaxTLayers(),(UInt) MAX_TLAYER); i++ ) |
---|
867 | { |
---|
868 | #if SVC_EXTENSION |
---|
869 | assert(i < MAX_TLAYER); |
---|
870 | #endif |
---|
871 | m_cSPS.setMaxDecPicBuffering(m_maxDecPicBuffering[i], i); |
---|
872 | m_cSPS.setNumReorderPics(m_numReorderPics[i], i); |
---|
873 | } |
---|
874 | |
---|
875 | m_cSPS.setPCMFilterDisableFlag ( m_bPCMFilterDisableFlag ); |
---|
876 | m_cSPS.setDisableIntraReferenceSmoothing( m_disableIntraReferenceSmoothing ); |
---|
877 | m_cSPS.setScalingListFlag ( (m_useScalingListId == 0) ? 0 : 1 ); |
---|
878 | m_cSPS.setUseStrongIntraSmoothing( m_useStrongIntraSmoothing ); |
---|
879 | m_cSPS.setVuiParametersPresentFlag(getVuiParametersPresentFlag()); |
---|
880 | |
---|
881 | if (m_cSPS.getVuiParametersPresentFlag()) |
---|
882 | { |
---|
883 | TComVUI* pcVUI = m_cSPS.getVuiParameters(); |
---|
884 | pcVUI->setAspectRatioInfoPresentFlag(getAspectRatioInfoPresentFlag()); |
---|
885 | pcVUI->setAspectRatioIdc(getAspectRatioIdc()); |
---|
886 | pcVUI->setSarWidth(getSarWidth()); |
---|
887 | pcVUI->setSarHeight(getSarHeight()); |
---|
888 | pcVUI->setOverscanInfoPresentFlag(getOverscanInfoPresentFlag()); |
---|
889 | pcVUI->setOverscanAppropriateFlag(getOverscanAppropriateFlag()); |
---|
890 | pcVUI->setVideoSignalTypePresentFlag(getVideoSignalTypePresentFlag()); |
---|
891 | pcVUI->setVideoFormat(getVideoFormat()); |
---|
892 | pcVUI->setVideoFullRangeFlag(getVideoFullRangeFlag()); |
---|
893 | pcVUI->setColourDescriptionPresentFlag(getColourDescriptionPresentFlag()); |
---|
894 | pcVUI->setColourPrimaries(getColourPrimaries()); |
---|
895 | pcVUI->setTransferCharacteristics(getTransferCharacteristics()); |
---|
896 | pcVUI->setMatrixCoefficients(getMatrixCoefficients()); |
---|
897 | pcVUI->setChromaLocInfoPresentFlag(getChromaLocInfoPresentFlag()); |
---|
898 | pcVUI->setChromaSampleLocTypeTopField(getChromaSampleLocTypeTopField()); |
---|
899 | pcVUI->setChromaSampleLocTypeBottomField(getChromaSampleLocTypeBottomField()); |
---|
900 | pcVUI->setNeutralChromaIndicationFlag(getNeutralChromaIndicationFlag()); |
---|
901 | pcVUI->setDefaultDisplayWindow(getDefaultDisplayWindow()); |
---|
902 | pcVUI->setFrameFieldInfoPresentFlag(getFrameFieldInfoPresentFlag()); |
---|
903 | pcVUI->setFieldSeqFlag(false); |
---|
904 | pcVUI->setHrdParametersPresentFlag(false); |
---|
905 | pcVUI->getTimingInfo()->setPocProportionalToTimingFlag(getPocProportionalToTimingFlag()); |
---|
906 | pcVUI->getTimingInfo()->setNumTicksPocDiffOneMinus1 (getNumTicksPocDiffOneMinus1() ); |
---|
907 | pcVUI->setBitstreamRestrictionFlag(getBitstreamRestrictionFlag()); |
---|
908 | pcVUI->setTilesFixedStructureFlag(getTilesFixedStructureFlag()); |
---|
909 | pcVUI->setMotionVectorsOverPicBoundariesFlag(getMotionVectorsOverPicBoundariesFlag()); |
---|
910 | pcVUI->setMinSpatialSegmentationIdc(getMinSpatialSegmentationIdc()); |
---|
911 | pcVUI->setMaxBytesPerPicDenom(getMaxBytesPerPicDenom()); |
---|
912 | pcVUI->setMaxBitsPerMinCuDenom(getMaxBitsPerMinCuDenom()); |
---|
913 | pcVUI->setLog2MaxMvLengthHorizontal(getLog2MaxMvLengthHorizontal()); |
---|
914 | pcVUI->setLog2MaxMvLengthVertical(getLog2MaxMvLengthVertical()); |
---|
915 | } |
---|
916 | } |
---|
917 | |
---|
918 | Void TEncTop::xInitPPS() |
---|
919 | { |
---|
920 | m_cPPS.setConstrainedIntraPred( m_bUseConstrainedIntraPred ); |
---|
921 | Bool bUseDQP = (getMaxCuDQPDepth() > 0)? true : false; |
---|
922 | |
---|
923 | if((getMaxDeltaQP() != 0 )|| getUseAdaptiveQP()) |
---|
924 | { |
---|
925 | bUseDQP = true; |
---|
926 | } |
---|
927 | |
---|
928 | if (m_costMode==COST_SEQUENCE_LEVEL_LOSSLESS || m_costMode==COST_LOSSLESS_CODING) bUseDQP=false; |
---|
929 | |
---|
930 | if(bUseDQP) |
---|
931 | { |
---|
932 | m_cPPS.setUseDQP(true); |
---|
933 | m_cPPS.setMaxCuDQPDepth( m_iMaxCuDQPDepth ); |
---|
934 | m_cPPS.setMinCuDQPSize( m_cPPS.getSPS()->getMaxCUWidth() >> ( m_cPPS.getMaxCuDQPDepth()) ); |
---|
935 | } |
---|
936 | else |
---|
937 | { |
---|
938 | m_cPPS.setUseDQP(false); |
---|
939 | m_cPPS.setMaxCuDQPDepth( 0 ); |
---|
940 | m_cPPS.setMinCuDQPSize( m_cPPS.getSPS()->getMaxCUWidth() >> ( m_cPPS.getMaxCuDQPDepth()) ); |
---|
941 | } |
---|
942 | |
---|
943 | if ( m_maxCUChromaQpAdjustmentDepth >= 0 ) |
---|
944 | { |
---|
945 | m_cPPS.setMaxCuChromaQpAdjDepth(m_maxCUChromaQpAdjustmentDepth); |
---|
946 | m_cPPS.setChromaQpAdjTableAt(1, 6, 6); |
---|
947 | /* todo, insert table entries from command line (NB, 0 should not be touched) */ |
---|
948 | } |
---|
949 | else |
---|
950 | { |
---|
951 | m_cPPS.setMaxCuChromaQpAdjDepth(0); |
---|
952 | m_cPPS.clearChromaQpAdjTable(); |
---|
953 | } |
---|
954 | |
---|
955 | if ( m_RCEnableRateControl ) |
---|
956 | { |
---|
957 | m_cPPS.setUseDQP(true); |
---|
958 | m_cPPS.setMaxCuDQPDepth( 0 ); |
---|
959 | m_cPPS.setMinCuDQPSize( m_cPPS.getSPS()->getMaxCUWidth() >> ( m_cPPS.getMaxCuDQPDepth()) ); |
---|
960 | } |
---|
961 | |
---|
962 | m_cPPS.setMinCuChromaQpAdjSize( m_cPPS.getSPS()->getMaxCUWidth() >> ( m_cPPS.getMaxCuChromaQpAdjDepth()) ); |
---|
963 | |
---|
964 | m_cPPS.setQpOffset(COMPONENT_Cb, m_chromaCbQpOffset ); |
---|
965 | m_cPPS.setQpOffset(COMPONENT_Cr, m_chromaCrQpOffset ); |
---|
966 | |
---|
967 | m_cPPS.setNumSubstreams(m_iWaveFrontSubstreams); |
---|
968 | m_cPPS.setEntropyCodingSyncEnabledFlag( m_iWaveFrontSynchro > 0 ); |
---|
969 | m_cPPS.setTilesEnabledFlag( (m_iNumColumnsMinus1 > 0 || m_iNumRowsMinus1 > 0) ); |
---|
970 | m_cPPS.setUseWP( m_useWeightedPred ); |
---|
971 | m_cPPS.setWPBiPred( m_useWeightedBiPred ); |
---|
972 | m_cPPS.setUseCrossComponentPrediction(m_useCrossComponentPrediction); |
---|
973 | m_cPPS.setSaoOffsetBitShift(CHANNEL_TYPE_LUMA, m_saoOffsetBitShift[CHANNEL_TYPE_LUMA ]); |
---|
974 | m_cPPS.setSaoOffsetBitShift(CHANNEL_TYPE_CHROMA, m_saoOffsetBitShift[CHANNEL_TYPE_CHROMA]); |
---|
975 | m_cPPS.setOutputFlagPresentFlag( false ); |
---|
976 | m_cPPS.setSignHideFlag(getSignHideFlag()); |
---|
977 | if ( getDeblockingFilterMetric() ) |
---|
978 | { |
---|
979 | m_cPPS.setDeblockingFilterControlPresentFlag (true); |
---|
980 | m_cPPS.setDeblockingFilterOverrideEnabledFlag(true); |
---|
981 | m_cPPS.setPicDisableDeblockingFilterFlag(false); |
---|
982 | m_cPPS.setDeblockingFilterBetaOffsetDiv2(0); |
---|
983 | m_cPPS.setDeblockingFilterTcOffsetDiv2(0); |
---|
984 | } |
---|
985 | else |
---|
986 | { |
---|
987 | m_cPPS.setDeblockingFilterControlPresentFlag (m_DeblockingFilterControlPresent ); |
---|
988 | } |
---|
989 | m_cPPS.setLog2ParallelMergeLevelMinus2 (m_log2ParallelMergeLevelMinus2 ); |
---|
990 | m_cPPS.setCabacInitPresentFlag(CABAC_INIT_PRESENT_FLAG); |
---|
991 | m_cPPS.setLoopFilterAcrossSlicesEnabledFlag( m_bLFCrossSliceBoundaryFlag ); |
---|
992 | |
---|
993 | Int histogram[MAX_NUM_REF + 1]; |
---|
994 | for( Int i = 0; i <= MAX_NUM_REF; i++ ) |
---|
995 | { |
---|
996 | histogram[i]=0; |
---|
997 | } |
---|
998 | for( Int i = 0; i < getGOPSize(); i++) |
---|
999 | { |
---|
1000 | assert(getGOPEntry(i).m_numRefPicsActive >= 0 && getGOPEntry(i).m_numRefPicsActive <= MAX_NUM_REF); |
---|
1001 | histogram[getGOPEntry(i).m_numRefPicsActive]++; |
---|
1002 | } |
---|
1003 | |
---|
1004 | Int maxHist=-1; |
---|
1005 | Int bestPos=0; |
---|
1006 | for( Int i = 0; i <= MAX_NUM_REF; i++ ) |
---|
1007 | { |
---|
1008 | if(histogram[i]>maxHist) |
---|
1009 | { |
---|
1010 | maxHist=histogram[i]; |
---|
1011 | bestPos=i; |
---|
1012 | } |
---|
1013 | } |
---|
1014 | assert(bestPos <= 15); |
---|
1015 | m_cPPS.setNumRefIdxL0DefaultActive(bestPos); |
---|
1016 | m_cPPS.setNumRefIdxL1DefaultActive(bestPos); |
---|
1017 | m_cPPS.setTransquantBypassEnableFlag(getTransquantBypassEnableFlag()); |
---|
1018 | m_cPPS.setUseTransformSkip( m_useTransformSkip ); |
---|
1019 | m_cPPS.setTransformSkipLog2MaxSize( m_transformSkipLog2MaxSize ); |
---|
1020 | |
---|
1021 | if (m_sliceSegmentMode != NO_SLICES) |
---|
1022 | { |
---|
1023 | m_cPPS.setDependentSliceSegmentsEnabledFlag( true ); |
---|
1024 | } |
---|
1025 | |
---|
1026 | #if SVC_EXTENSION |
---|
1027 | #if SCALINGLIST_INFERRING |
---|
1028 | m_cPPS.setLayerId( m_layerId ); |
---|
1029 | #endif |
---|
1030 | |
---|
1031 | #if Q0078_ADD_LAYER_SETS |
---|
1032 | if( !m_numDirectRefLayers && m_numAddLayerSets ) |
---|
1033 | { |
---|
1034 | m_cPPS.setLayerId(0); // layer ID 0 for independent layers |
---|
1035 | } |
---|
1036 | #endif |
---|
1037 | |
---|
1038 | if( m_layerId > 0 ) |
---|
1039 | { |
---|
1040 | m_cPPS.setListsModificationPresentFlag(true); |
---|
1041 | m_cPPS.setExtensionFlag(true); |
---|
1042 | } |
---|
1043 | else |
---|
1044 | { |
---|
1045 | m_cPPS.setListsModificationPresentFlag(false); |
---|
1046 | m_cPPS.setExtensionFlag(false); |
---|
1047 | } |
---|
1048 | |
---|
1049 | m_cPPS.setPPSId( m_iPPSIdCnt ); |
---|
1050 | m_cPPS.setSPSId( m_iSPSIdCnt ); |
---|
1051 | |
---|
1052 | if( m_crossLayerBLAFlag ) |
---|
1053 | { |
---|
1054 | m_cPPS.setNumExtraSliceHeaderBits( 3 ); |
---|
1055 | } |
---|
1056 | |
---|
1057 | m_cPPS.setNumRefLayerLocationOffsets(m_numRefLayerLocationOffsets); |
---|
1058 | for(Int i = 0; i < m_cPPS.getNumRefLayerLocationOffsets(); i++) |
---|
1059 | { |
---|
1060 | m_cPPS.setRefLocationOffsetLayerId(i, m_refLocationOffsetLayerId[i]); |
---|
1061 | m_cPPS.getScaledRefLayerWindow(i) = m_scaledRefLayerWindow[i]; |
---|
1062 | m_cPPS.getRefLayerWindow(i) = m_refLayerWindow[i]; |
---|
1063 | m_cPPS.setScaledRefLayerOffsetPresentFlag( i, m_scaledRefLayerOffsetPresentFlag[i] ); |
---|
1064 | m_cPPS.setRefRegionOffsetPresentFlag( i, m_refRegionOffsetPresentFlag[i] ); |
---|
1065 | m_cPPS.setResamplePhaseSetPresentFlag( i, m_resamplePhaseSetPresentFlag[i] ); |
---|
1066 | m_cPPS.setPhaseHorLuma( m_refLocationOffsetLayerId[i], m_phaseHorLuma[i] ); |
---|
1067 | m_cPPS.setPhaseVerLuma( m_refLocationOffsetLayerId[i], m_phaseVerLuma[i] ); |
---|
1068 | m_cPPS.setPhaseHorChroma( m_refLocationOffsetLayerId[i], m_phaseHorChroma[i] ); |
---|
1069 | m_cPPS.setPhaseVerChroma( m_refLocationOffsetLayerId[i], m_phaseVerChroma[i] ); |
---|
1070 | } |
---|
1071 | #if Q0048_CGS_3D_ASYMLUT |
---|
1072 | m_cPPS.setCGSFlag( m_nCGSFlag ); |
---|
1073 | #endif |
---|
1074 | #if POC_RESET_IDC_ENCODER |
---|
1075 | m_cPPS.setPocResetInfoPresentFlag( true ); |
---|
1076 | m_cPPS.setExtensionFlag( true ); |
---|
1077 | m_cPPS.setSliceHeaderExtensionPresentFlag( true ); |
---|
1078 | #endif |
---|
1079 | #endif //SVC_EXTENSION |
---|
1080 | } |
---|
1081 | |
---|
1082 | //Function for initializing m_RPSList, a list of TComReferencePictureSet, based on the GOPEntry objects read from the config file. |
---|
1083 | Void TEncTop::xInitRPS(Bool isFieldCoding) |
---|
1084 | { |
---|
1085 | TComReferencePictureSet* rps; |
---|
1086 | |
---|
1087 | m_cSPS.createRPSList(getGOPSize() + m_extraRPSs + 1); |
---|
1088 | TComRPSList* rpsList = m_cSPS.getRPSList(); |
---|
1089 | |
---|
1090 | for( Int i = 0; i < getGOPSize()+m_extraRPSs; i++) |
---|
1091 | { |
---|
1092 | GOPEntry ge = getGOPEntry(i); |
---|
1093 | rps = rpsList->getReferencePictureSet(i); |
---|
1094 | rps->setNumberOfPictures(ge.m_numRefPics); |
---|
1095 | rps->setNumRefIdc(ge.m_numRefIdc); |
---|
1096 | Int numNeg = 0; |
---|
1097 | Int numPos = 0; |
---|
1098 | for( Int j = 0; j < ge.m_numRefPics; j++) |
---|
1099 | { |
---|
1100 | rps->setDeltaPOC(j,ge.m_referencePics[j]); |
---|
1101 | rps->setUsed(j,ge.m_usedByCurrPic[j]); |
---|
1102 | if(ge.m_referencePics[j]>0) |
---|
1103 | { |
---|
1104 | numPos++; |
---|
1105 | } |
---|
1106 | else |
---|
1107 | { |
---|
1108 | numNeg++; |
---|
1109 | } |
---|
1110 | } |
---|
1111 | rps->setNumberOfNegativePictures(numNeg); |
---|
1112 | rps->setNumberOfPositivePictures(numPos); |
---|
1113 | |
---|
1114 | // handle inter RPS intialization from the config file. |
---|
1115 | #if AUTO_INTER_RPS |
---|
1116 | rps->setInterRPSPrediction(ge.m_interRPSPrediction > 0); // not very clean, converting anything > 0 to true. |
---|
1117 | rps->setDeltaRIdxMinus1(0); // index to the Reference RPS is always the previous one. |
---|
1118 | TComReferencePictureSet* RPSRef = rpsList->getReferencePictureSet(i-1); // get the reference RPS |
---|
1119 | |
---|
1120 | if (ge.m_interRPSPrediction == 2) // Automatic generation of the inter RPS idc based on the RIdx provided. |
---|
1121 | { |
---|
1122 | Int deltaRPS = getGOPEntry(i-1).m_POC - ge.m_POC; // the ref POC - current POC |
---|
1123 | Int numRefDeltaPOC = RPSRef->getNumberOfPictures(); |
---|
1124 | |
---|
1125 | rps->setDeltaRPS(deltaRPS); // set delta RPS |
---|
1126 | rps->setNumRefIdc(numRefDeltaPOC+1); // set the numRefIdc to the number of pictures in the reference RPS + 1. |
---|
1127 | Int count=0; |
---|
1128 | for (Int j = 0; j <= numRefDeltaPOC; j++ ) // cycle through pics in reference RPS. |
---|
1129 | { |
---|
1130 | Int RefDeltaPOC = (j<numRefDeltaPOC)? RPSRef->getDeltaPOC(j): 0; // if it is the last decoded picture, set RefDeltaPOC = 0 |
---|
1131 | rps->setRefIdc(j, 0); |
---|
1132 | for (Int k = 0; k < rps->getNumberOfPictures(); k++ ) // cycle through pics in current RPS. |
---|
1133 | { |
---|
1134 | if (rps->getDeltaPOC(k) == ( RefDeltaPOC + deltaRPS)) // if the current RPS has a same picture as the reference RPS. |
---|
1135 | { |
---|
1136 | rps->setRefIdc(j, (rps->getUsed(k)?1:2)); |
---|
1137 | count++; |
---|
1138 | break; |
---|
1139 | } |
---|
1140 | } |
---|
1141 | } |
---|
1142 | if (count != rps->getNumberOfPictures()) |
---|
1143 | { |
---|
1144 | printf("Warning: Unable fully predict all delta POCs using the reference RPS index given in the config file. Setting Inter RPS to false for this RPS.\n"); |
---|
1145 | rps->setInterRPSPrediction(0); |
---|
1146 | } |
---|
1147 | } |
---|
1148 | else if (ge.m_interRPSPrediction == 1) // inter RPS idc based on the RefIdc values provided in config file. |
---|
1149 | { |
---|
1150 | rps->setDeltaRPS(ge.m_deltaRPS); |
---|
1151 | rps->setNumRefIdc(ge.m_numRefIdc); |
---|
1152 | for (Int j = 0; j < ge.m_numRefIdc; j++ ) |
---|
1153 | { |
---|
1154 | rps->setRefIdc(j, ge.m_refIdc[j]); |
---|
1155 | } |
---|
1156 | #if WRITE_BACK |
---|
1157 | // the folowing code overwrite the deltaPOC and Used by current values read from the config file with the ones |
---|
1158 | // computed from the RefIdc. A warning is printed if they are not identical. |
---|
1159 | numNeg = 0; |
---|
1160 | numPos = 0; |
---|
1161 | TComReferencePictureSet RPSTemp; // temporary variable |
---|
1162 | |
---|
1163 | for (Int j = 0; j < ge.m_numRefIdc; j++ ) |
---|
1164 | { |
---|
1165 | if (ge.m_refIdc[j]) |
---|
1166 | { |
---|
1167 | Int deltaPOC = ge.m_deltaRPS + ((j < RPSRef->getNumberOfPictures())? RPSRef->getDeltaPOC(j) : 0); |
---|
1168 | RPSTemp.setDeltaPOC((numNeg+numPos),deltaPOC); |
---|
1169 | RPSTemp.setUsed((numNeg+numPos),ge.m_refIdc[j]==1?1:0); |
---|
1170 | if (deltaPOC<0) |
---|
1171 | { |
---|
1172 | numNeg++; |
---|
1173 | } |
---|
1174 | else |
---|
1175 | { |
---|
1176 | numPos++; |
---|
1177 | } |
---|
1178 | } |
---|
1179 | } |
---|
1180 | if (numNeg != rps->getNumberOfNegativePictures()) |
---|
1181 | { |
---|
1182 | printf("Warning: number of negative pictures in RPS is different between intra and inter RPS specified in the config file.\n"); |
---|
1183 | rps->setNumberOfNegativePictures(numNeg); |
---|
1184 | rps->setNumberOfPictures(numNeg+numPos); |
---|
1185 | } |
---|
1186 | if (numPos != rps->getNumberOfPositivePictures()) |
---|
1187 | { |
---|
1188 | printf("Warning: number of positive pictures in RPS is different between intra and inter RPS specified in the config file.\n"); |
---|
1189 | rps->setNumberOfPositivePictures(numPos); |
---|
1190 | rps->setNumberOfPictures(numNeg+numPos); |
---|
1191 | } |
---|
1192 | RPSTemp.setNumberOfPictures(numNeg+numPos); |
---|
1193 | RPSTemp.setNumberOfNegativePictures(numNeg); |
---|
1194 | RPSTemp.sortDeltaPOC(); // sort the created delta POC before comparing |
---|
1195 | // check if Delta POC and Used are the same |
---|
1196 | // print warning if they are not. |
---|
1197 | for (Int j = 0; j < ge.m_numRefIdc; j++ ) |
---|
1198 | { |
---|
1199 | if (RPSTemp.getDeltaPOC(j) != rps->getDeltaPOC(j)) |
---|
1200 | { |
---|
1201 | printf("Warning: delta POC is different between intra RPS and inter RPS specified in the config file.\n"); |
---|
1202 | rps->setDeltaPOC(j,RPSTemp.getDeltaPOC(j)); |
---|
1203 | } |
---|
1204 | if (RPSTemp.getUsed(j) != rps->getUsed(j)) |
---|
1205 | { |
---|
1206 | printf("Warning: Used by Current in RPS is different between intra and inter RPS specified in the config file.\n"); |
---|
1207 | rps->setUsed(j,RPSTemp.getUsed(j)); |
---|
1208 | } |
---|
1209 | } |
---|
1210 | #endif |
---|
1211 | } |
---|
1212 | #else |
---|
1213 | rps->setInterRPSPrediction(ge.m_interRPSPrediction); |
---|
1214 | if (ge.m_interRPSPrediction) |
---|
1215 | { |
---|
1216 | rps->setDeltaRIdxMinus1(0); |
---|
1217 | rps->setDeltaRPS(ge.m_deltaRPS); |
---|
1218 | rps->setNumRefIdc(ge.m_numRefIdc); |
---|
1219 | for (Int j = 0; j < ge.m_numRefIdc; j++ ) |
---|
1220 | { |
---|
1221 | rps->setRefIdc(j, ge.m_refIdc[j]); |
---|
1222 | } |
---|
1223 | #if WRITE_BACK |
---|
1224 | // the folowing code overwrite the deltaPOC and Used by current values read from the config file with the ones |
---|
1225 | // computed from the RefIdc. This is not necessary if both are identical. Currently there is no check to see if they are identical. |
---|
1226 | numNeg = 0; |
---|
1227 | numPos = 0; |
---|
1228 | TComReferencePictureSet* RPSRef = m_RPSList.getReferencePictureSet(i-1); |
---|
1229 | |
---|
1230 | for (Int j = 0; j < ge.m_numRefIdc; j++ ) |
---|
1231 | { |
---|
1232 | if (ge.m_refIdc[j]) |
---|
1233 | { |
---|
1234 | Int deltaPOC = ge.m_deltaRPS + ((j < RPSRef->getNumberOfPictures())? RPSRef->getDeltaPOC(j) : 0); |
---|
1235 | rps->setDeltaPOC((numNeg+numPos),deltaPOC); |
---|
1236 | rps->setUsed((numNeg+numPos),ge.m_refIdc[j]==1?1:0); |
---|
1237 | if (deltaPOC<0) |
---|
1238 | { |
---|
1239 | numNeg++; |
---|
1240 | } |
---|
1241 | else |
---|
1242 | { |
---|
1243 | numPos++; |
---|
1244 | } |
---|
1245 | } |
---|
1246 | } |
---|
1247 | rps->setNumberOfNegativePictures(numNeg); |
---|
1248 | rps->setNumberOfPositivePictures(numPos); |
---|
1249 | rps->sortDeltaPOC(); |
---|
1250 | #endif |
---|
1251 | } |
---|
1252 | #endif //INTER_RPS_AUTO |
---|
1253 | } |
---|
1254 | //In case of field coding, we need to set special parameters for the first bottom field of the sequence, since it is not specified in the cfg file. |
---|
1255 | //The position = GOPSize + extraRPSs which is (a priori) unused is reserved for this field in the RPS. |
---|
1256 | if (isFieldCoding) |
---|
1257 | { |
---|
1258 | rps = rpsList->getReferencePictureSet(getGOPSize()+m_extraRPSs); |
---|
1259 | rps->setNumberOfPictures(1); |
---|
1260 | rps->setNumberOfNegativePictures(1); |
---|
1261 | rps->setNumberOfPositivePictures(0); |
---|
1262 | rps->setNumberOfLongtermPictures(0); |
---|
1263 | rps->setDeltaPOC(0,-1); |
---|
1264 | rps->setPOC(0,0); |
---|
1265 | rps->setUsed(0,true); |
---|
1266 | rps->setInterRPSPrediction(false); |
---|
1267 | rps->setDeltaRIdxMinus1(0); |
---|
1268 | rps->setDeltaRPS(0); |
---|
1269 | rps->setNumRefIdc(0); |
---|
1270 | } |
---|
1271 | } |
---|
1272 | |
---|
1273 | // This is a function that |
---|
1274 | // determines what Reference Picture Set to use |
---|
1275 | // for a specific slice (with POC = POCCurr) |
---|
1276 | Void TEncTop::selectReferencePictureSet(TComSlice* slice, Int POCCurr, Int GOPid ) |
---|
1277 | { |
---|
1278 | slice->setRPSidx(GOPid); |
---|
1279 | |
---|
1280 | for(Int extraNum=m_iGOPSize; extraNum<m_extraRPSs+m_iGOPSize; extraNum++) |
---|
1281 | { |
---|
1282 | if(m_uiIntraPeriod > 0 && getDecodingRefreshType() > 0) |
---|
1283 | { |
---|
1284 | Int POCIndex = POCCurr%m_uiIntraPeriod; |
---|
1285 | if(POCIndex == 0) |
---|
1286 | { |
---|
1287 | POCIndex = m_uiIntraPeriod; |
---|
1288 | } |
---|
1289 | if(POCIndex == m_GOPList[extraNum].m_POC) |
---|
1290 | { |
---|
1291 | slice->setRPSidx(extraNum); |
---|
1292 | } |
---|
1293 | } |
---|
1294 | else |
---|
1295 | { |
---|
1296 | if(POCCurr==m_GOPList[extraNum].m_POC) |
---|
1297 | { |
---|
1298 | slice->setRPSidx(extraNum); |
---|
1299 | } |
---|
1300 | } |
---|
1301 | } |
---|
1302 | |
---|
1303 | if(POCCurr == 1 && slice->getPic()->isField()) |
---|
1304 | { |
---|
1305 | slice->setRPSidx(m_iGOPSize+m_extraRPSs); |
---|
1306 | } |
---|
1307 | |
---|
1308 | slice->setRPS(getSPS()->getRPSList()->getReferencePictureSet(slice->getRPSidx())); |
---|
1309 | slice->getRPS()->setNumberOfPictures(slice->getRPS()->getNumberOfNegativePictures()+slice->getRPS()->getNumberOfPositivePictures()); |
---|
1310 | } |
---|
1311 | |
---|
1312 | Int TEncTop::getReferencePictureSetIdxForSOP(TComSlice* slice, Int POCCurr, Int GOPid ) |
---|
1313 | { |
---|
1314 | Int rpsIdx = GOPid; |
---|
1315 | |
---|
1316 | for(Int extraNum=m_iGOPSize; extraNum<m_extraRPSs+m_iGOPSize; extraNum++) |
---|
1317 | { |
---|
1318 | if(m_uiIntraPeriod > 0 && getDecodingRefreshType() > 0) |
---|
1319 | { |
---|
1320 | Int POCIndex = POCCurr%m_uiIntraPeriod; |
---|
1321 | if(POCIndex == 0) |
---|
1322 | { |
---|
1323 | POCIndex = m_uiIntraPeriod; |
---|
1324 | } |
---|
1325 | if(POCIndex == m_GOPList[extraNum].m_POC) |
---|
1326 | { |
---|
1327 | rpsIdx = extraNum; |
---|
1328 | } |
---|
1329 | } |
---|
1330 | else |
---|
1331 | { |
---|
1332 | if(POCCurr==m_GOPList[extraNum].m_POC) |
---|
1333 | { |
---|
1334 | rpsIdx = extraNum; |
---|
1335 | } |
---|
1336 | } |
---|
1337 | } |
---|
1338 | |
---|
1339 | return rpsIdx; |
---|
1340 | } |
---|
1341 | |
---|
1342 | Void TEncTop::xInitPPSforTiles() |
---|
1343 | { |
---|
1344 | m_cPPS.setTileUniformSpacingFlag( m_tileUniformSpacingFlag ); |
---|
1345 | m_cPPS.setNumTileColumnsMinus1( m_iNumColumnsMinus1 ); |
---|
1346 | m_cPPS.setNumTileRowsMinus1( m_iNumRowsMinus1 ); |
---|
1347 | if( !m_tileUniformSpacingFlag ) |
---|
1348 | { |
---|
1349 | m_cPPS.setTileColumnWidth( m_tileColumnWidth ); |
---|
1350 | m_cPPS.setTileRowHeight( m_tileRowHeight ); |
---|
1351 | } |
---|
1352 | m_cPPS.setLoopFilterAcrossTilesEnabledFlag( m_loopFilterAcrossTilesEnabledFlag ); |
---|
1353 | |
---|
1354 | // # substreams is "per tile" when tiles are independent. |
---|
1355 | if (m_iWaveFrontSynchro ) |
---|
1356 | { |
---|
1357 | m_cPPS.setNumSubstreams(m_iWaveFrontSubstreams * (m_iNumColumnsMinus1+1)); |
---|
1358 | } |
---|
1359 | else |
---|
1360 | { |
---|
1361 | m_cPPS.setNumSubstreams((m_iNumRowsMinus1+1) * (m_iNumColumnsMinus1+1)); |
---|
1362 | } |
---|
1363 | } |
---|
1364 | |
---|
1365 | Void TEncCfg::xCheckGSParameters() |
---|
1366 | { |
---|
1367 | Int iWidthInCU = ( m_iSourceWidth%g_uiMaxCUWidth ) ? m_iSourceWidth/g_uiMaxCUWidth + 1 : m_iSourceWidth/g_uiMaxCUWidth; |
---|
1368 | Int iHeightInCU = ( m_iSourceHeight%g_uiMaxCUHeight ) ? m_iSourceHeight/g_uiMaxCUHeight + 1 : m_iSourceHeight/g_uiMaxCUHeight; |
---|
1369 | UInt uiCummulativeColumnWidth = 0; |
---|
1370 | UInt uiCummulativeRowHeight = 0; |
---|
1371 | |
---|
1372 | //check the column relative parameters |
---|
1373 | if( m_iNumColumnsMinus1 >= (1<<(LOG2_MAX_NUM_COLUMNS_MINUS1+1)) ) |
---|
1374 | { |
---|
1375 | printf( "The number of columns is larger than the maximum allowed number of columns.\n" ); |
---|
1376 | exit( EXIT_FAILURE ); |
---|
1377 | } |
---|
1378 | |
---|
1379 | if( m_iNumColumnsMinus1 >= iWidthInCU ) |
---|
1380 | { |
---|
1381 | printf( "The current picture can not have so many columns.\n" ); |
---|
1382 | exit( EXIT_FAILURE ); |
---|
1383 | } |
---|
1384 | |
---|
1385 | if( m_iNumColumnsMinus1 && !m_tileUniformSpacingFlag ) |
---|
1386 | { |
---|
1387 | for(Int i=0; i<m_iNumColumnsMinus1; i++) |
---|
1388 | { |
---|
1389 | uiCummulativeColumnWidth += m_tileColumnWidth[i]; |
---|
1390 | } |
---|
1391 | |
---|
1392 | if( uiCummulativeColumnWidth >= iWidthInCU ) |
---|
1393 | { |
---|
1394 | printf( "The width of the column is too large.\n" ); |
---|
1395 | exit( EXIT_FAILURE ); |
---|
1396 | } |
---|
1397 | } |
---|
1398 | |
---|
1399 | //check the row relative parameters |
---|
1400 | if( m_iNumRowsMinus1 >= (1<<(LOG2_MAX_NUM_ROWS_MINUS1+1)) ) |
---|
1401 | { |
---|
1402 | printf( "The number of rows is larger than the maximum allowed number of rows.\n" ); |
---|
1403 | exit( EXIT_FAILURE ); |
---|
1404 | } |
---|
1405 | |
---|
1406 | if( m_iNumRowsMinus1 >= iHeightInCU ) |
---|
1407 | { |
---|
1408 | printf( "The current picture can not have so many rows.\n" ); |
---|
1409 | exit( EXIT_FAILURE ); |
---|
1410 | } |
---|
1411 | |
---|
1412 | if( m_iNumRowsMinus1 && !m_tileUniformSpacingFlag ) |
---|
1413 | { |
---|
1414 | for(Int i=0; i<m_iNumRowsMinus1; i++) |
---|
1415 | uiCummulativeRowHeight += m_tileRowHeight[i]; |
---|
1416 | |
---|
1417 | if( uiCummulativeRowHeight >= iHeightInCU ) |
---|
1418 | { |
---|
1419 | printf( "The height of the row is too large.\n" ); |
---|
1420 | exit( EXIT_FAILURE ); |
---|
1421 | } |
---|
1422 | } |
---|
1423 | } |
---|
1424 | |
---|
1425 | #if SVC_EXTENSION |
---|
1426 | TEncTop* TEncTop::getRefLayerEnc( UInt refLayerIdx ) |
---|
1427 | { |
---|
1428 | if( m_ppcTEncTop[m_cVPS.getLayerIdxInVps(m_layerId)]->getNumDirectRefLayers() <= 0 ) |
---|
1429 | { |
---|
1430 | return (TEncTop *)getLayerEnc( 0 ); |
---|
1431 | } |
---|
1432 | |
---|
1433 | return (TEncTop *)getLayerEnc( m_cVPS.getLayerIdxInVps(m_cVPS.getRefLayerId( m_layerId, refLayerIdx )) ); |
---|
1434 | } |
---|
1435 | |
---|
1436 | #if !REPN_FORMAT_IN_VPS |
---|
1437 | Void TEncTop::xInitILRP() |
---|
1438 | { |
---|
1439 | if(m_layerId>0) |
---|
1440 | { |
---|
1441 | g_bitDepthY = m_cSPS.getBitDepthY(); |
---|
1442 | g_bitDepthC = m_cSPS.getBitDepthC(); |
---|
1443 | g_uiMaxCUWidth = m_cSPS.getMaxCUWidth(); |
---|
1444 | g_uiMaxCUHeight = m_cSPS.getMaxCUHeight(); |
---|
1445 | g_uiMaxCUDepth = m_cSPS.getMaxCUDepth(); |
---|
1446 | g_uiAddCUDepth = max (0, m_cSPS.getLog2MinCodingBlockSize() - (Int)m_cSPS.getQuadtreeTULog2MinSize() ); |
---|
1447 | |
---|
1448 | Int numReorderPics[MAX_TLAYER]; |
---|
1449 | Window &conformanceWindow = m_cSPS.getConformanceWindow(); |
---|
1450 | Window defaultDisplayWindow = m_cSPS.getVuiParametersPresentFlag() ? m_cSPS.getVuiParameters()->getDefaultDisplayWindow() : Window(); |
---|
1451 | |
---|
1452 | if (m_cIlpPic[0] == NULL) |
---|
1453 | { |
---|
1454 | for (Int j=0; j < m_numLayer; j++) // consider to set to NumDirectRefLayers[LayerIdInVps[nuh_layer_id]] |
---|
1455 | { |
---|
1456 | m_cIlpPic[j] = new TComPic; |
---|
1457 | #if AUXILIARY_PICTURES |
---|
1458 | m_cIlpPic[j]->create(m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, &m_cSPS, true); |
---|
1459 | #else |
---|
1460 | m_cIlpPic[j]->create(m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, &m_cSPS, true); |
---|
1461 | #endif |
---|
1462 | for (Int i=0; i<m_cIlpPic[j]->getPicSym()->getNumberOfCUsInFrame(); i++) |
---|
1463 | { |
---|
1464 | m_cIlpPic[j]->getPicSym()->getCU(i)->initCU(m_cIlpPic[j], i); |
---|
1465 | } |
---|
1466 | } |
---|
1467 | } |
---|
1468 | } |
---|
1469 | } |
---|
1470 | #else |
---|
1471 | Void TEncTop::xInitILRP() |
---|
1472 | { |
---|
1473 | RepFormat *repFormat = m_cVPS.getVpsRepFormat( m_cSPS.getUpdateRepFormatFlag() ? m_cSPS.getUpdateRepFormatIndex() : m_cVPS.getVpsRepFormatIdx( m_cVPS.getLayerIdxInVps(m_layerId) ) ); |
---|
1474 | Int bitDepthY,bitDepthC,picWidth,picHeight; |
---|
1475 | |
---|
1476 | bitDepthY = repFormat->getBitDepthVpsLuma(); |
---|
1477 | bitDepthC = repFormat->getBitDepthVpsChroma(); |
---|
1478 | picWidth = repFormat->getPicWidthVpsInLumaSamples(); |
---|
1479 | picHeight = repFormat->getPicHeightVpsInLumaSamples(); |
---|
1480 | |
---|
1481 | if(m_layerId > 0) |
---|
1482 | { |
---|
1483 | g_bitDepth[CHANNEL_TYPE_LUMA] = bitDepthY; |
---|
1484 | g_bitDepth[CHANNEL_TYPE_CHROMA] = bitDepthC; |
---|
1485 | g_uiMaxCUWidth = m_cSPS.getMaxCUWidth(); |
---|
1486 | g_uiMaxCUHeight = m_cSPS.getMaxCUHeight(); |
---|
1487 | g_uiMaxCUDepth = m_cSPS.getMaxCUDepth(); |
---|
1488 | g_uiAddCUDepth = max (0, m_cSPS.getLog2MinCodingBlockSize() - (Int)m_cSPS.getQuadtreeTULog2MinSize() ); |
---|
1489 | |
---|
1490 | Int numReorderPics[MAX_TLAYER]; |
---|
1491 | Window &conformanceWindow = repFormat->getConformanceWindowVps(); |
---|
1492 | Window defaultDisplayWindow = m_cSPS.getVuiParametersPresentFlag() ? m_cSPS.getVuiParameters()->getDefaultDisplayWindow() : Window(); |
---|
1493 | |
---|
1494 | if (m_cIlpPic[0] == NULL) |
---|
1495 | { |
---|
1496 | for (Int j=0; j < m_numDirectRefLayers; j++) |
---|
1497 | { |
---|
1498 | m_cIlpPic[j] = new TComPic; |
---|
1499 | #if AUXILIARY_PICTURES |
---|
1500 | m_cIlpPic[j]->create(picWidth, picHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, &m_cSPS, true); |
---|
1501 | #else |
---|
1502 | m_cIlpPic[j]->create(picWidth, picHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, &m_cSPS, true); |
---|
1503 | #endif |
---|
1504 | for (Int i=0; i<m_cIlpPic[j]->getPicSym()->getNumberOfCtusInFrame(); i++) |
---|
1505 | { |
---|
1506 | m_cIlpPic[j]->getPicSym()->getCtu(i)->initCtu(m_cIlpPic[j], i); |
---|
1507 | } |
---|
1508 | } |
---|
1509 | } |
---|
1510 | |
---|
1511 | if( m_cVPS.getNumRefLayers( m_layerId ) == 0 ) |
---|
1512 | { |
---|
1513 | UInt layerIdx = m_cVPS.getLayerIdxInVps( m_layerId ); |
---|
1514 | RepFormat* repFmt = m_cVPS.getVpsRepFormat(m_cVPS.getVpsRepFormatIdx(layerIdx)); |
---|
1515 | |
---|
1516 | if( m_cPPS.getLayerId() == 0 && |
---|
1517 | m_cSPS.getLayerId() == 0 && |
---|
1518 | repFmt->getChromaFormatVpsIdc() == m_cSPS.getChromaFormatIdc() && |
---|
1519 | repFmt->getSeparateColourPlaneVpsFlag() == 0 && |
---|
1520 | repFmt->getPicHeightVpsInLumaSamples() == m_cSPS.getPicHeightInLumaSamples() && |
---|
1521 | repFmt->getPicWidthVpsInLumaSamples() == m_cSPS.getPicWidthInLumaSamples() && |
---|
1522 | repFmt->getBitDepthVpsLuma() == m_cSPS.getBitDepth(CHANNEL_TYPE_LUMA) && |
---|
1523 | repFmt->getBitDepthVpsChroma() == m_cSPS.getBitDepth(CHANNEL_TYPE_CHROMA) && |
---|
1524 | repFmt->getConformanceWindowVps().getWindowLeftOffset() == m_cSPS.getConformanceWindow().getWindowLeftOffset() && |
---|
1525 | repFmt->getConformanceWindowVps().getWindowRightOffset() == m_cSPS.getConformanceWindow().getWindowRightOffset() && |
---|
1526 | repFmt->getConformanceWindowVps().getWindowTopOffset() == m_cSPS.getConformanceWindow().getWindowTopOffset() && |
---|
1527 | repFmt->getConformanceWindowVps().getWindowBottomOffset() == m_cSPS.getConformanceWindow().getWindowBottomOffset() ) |
---|
1528 | { |
---|
1529 | m_cVPS.setBaseLayerPSCompatibilityFlag(layerIdx, 1); |
---|
1530 | } |
---|
1531 | else |
---|
1532 | { |
---|
1533 | m_cVPS.setBaseLayerPSCompatibilityFlag(layerIdx, 0); |
---|
1534 | } |
---|
1535 | } |
---|
1536 | } |
---|
1537 | } |
---|
1538 | #endif |
---|
1539 | |
---|
1540 | Window& TEncTop::getScaledRefLayerWindowForLayer(Int layerId) |
---|
1541 | { |
---|
1542 | static Window win; |
---|
1543 | |
---|
1544 | for (Int i = 0; i < m_numRefLayerLocationOffsets; i++) |
---|
1545 | { |
---|
1546 | if (layerId == m_refLocationOffsetLayerId[i]) |
---|
1547 | { |
---|
1548 | return m_scaledRefLayerWindow[i]; |
---|
1549 | } |
---|
1550 | } |
---|
1551 | |
---|
1552 | win.resetWindow(); // scaled reference layer offsets are inferred to be zero when not present |
---|
1553 | return win; |
---|
1554 | } |
---|
1555 | |
---|
1556 | Window& TEncTop::getRefLayerWindowForLayer(Int layerId) |
---|
1557 | { |
---|
1558 | static Window win; |
---|
1559 | |
---|
1560 | for (Int i = 0; i < m_numRefLayerLocationOffsets; i++) |
---|
1561 | { |
---|
1562 | if (layerId == m_refLayerId[i]) |
---|
1563 | { |
---|
1564 | return m_refLayerWindow[i]; |
---|
1565 | } |
---|
1566 | } |
---|
1567 | |
---|
1568 | win.resetWindow(); // reference offsets are inferred to be zero when not present |
---|
1569 | return win; |
---|
1570 | } |
---|
1571 | #endif //SVC_EXTENSION |
---|
1572 | //! \} |
---|