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 TComSlice.cpp |
---|
35 | \brief slice header and SPS class |
---|
36 | */ |
---|
37 | |
---|
38 | #include "CommonDef.h" |
---|
39 | #include "TComSlice.h" |
---|
40 | #include "TComPic.h" |
---|
41 | #include "TLibEncoder/TEncSbac.h" |
---|
42 | #include "TLibDecoder/TDecSbac.h" |
---|
43 | |
---|
44 | //! \ingroup TLibCommon |
---|
45 | //! \{ |
---|
46 | |
---|
47 | #if SVC_EXTENSION |
---|
48 | ParameterSetMap<TComVPS> ParameterSetManager::m_vpsMap(MAX_NUM_VPS); |
---|
49 | Int ParameterSetManager::m_activeVPSId = -1; |
---|
50 | #endif |
---|
51 | |
---|
52 | TComSlice::TComSlice() |
---|
53 | : m_iPPSId ( -1 ) |
---|
54 | , m_iPOC ( 0 ) |
---|
55 | , m_iLastIDR ( 0 ) |
---|
56 | , m_eNalUnitType ( NAL_UNIT_CODED_SLICE_IDR_W_RADL ) |
---|
57 | , m_eSliceType ( I_SLICE ) |
---|
58 | , m_iSliceQp ( 0 ) |
---|
59 | , m_dependentSliceSegmentFlag ( false ) |
---|
60 | #if ADAPTIVE_QP_SELECTION |
---|
61 | , m_iSliceQpBase ( 0 ) |
---|
62 | #endif |
---|
63 | , m_deblockingFilterDisable ( false ) |
---|
64 | , m_deblockingFilterOverrideFlag ( false ) |
---|
65 | , m_deblockingFilterBetaOffsetDiv2 ( 0 ) |
---|
66 | , m_deblockingFilterTcOffsetDiv2 ( 0 ) |
---|
67 | , m_bCheckLDC ( false ) |
---|
68 | , m_iSliceQpDelta ( 0 ) |
---|
69 | , m_iSliceQpDeltaCb ( 0 ) |
---|
70 | , m_iSliceQpDeltaCr ( 0 ) |
---|
71 | , m_iDepth ( 0 ) |
---|
72 | , m_bRefenced ( false ) |
---|
73 | , m_pcSPS ( NULL ) |
---|
74 | , m_pcPPS ( NULL ) |
---|
75 | , m_pcPic ( NULL ) |
---|
76 | , m_colFromL0Flag ( 1 ) |
---|
77 | #if SETTING_NO_OUT_PIC_PRIOR |
---|
78 | , m_noOutputPriorPicsFlag ( false ) |
---|
79 | , m_noRaslOutputFlag ( false ) |
---|
80 | , m_handleCraAsBlaFlag ( false ) |
---|
81 | #endif |
---|
82 | , m_colRefIdx ( 0 ) |
---|
83 | , m_uiTLayer ( 0 ) |
---|
84 | , m_bTLayerSwitchingFlag ( false ) |
---|
85 | , m_sliceMode ( 0 ) |
---|
86 | , m_sliceArgument ( 0 ) |
---|
87 | , m_sliceCurStartCUAddr ( 0 ) |
---|
88 | , m_sliceCurEndCUAddr ( 0 ) |
---|
89 | , m_sliceIdx ( 0 ) |
---|
90 | , m_sliceSegmentMode ( 0 ) |
---|
91 | , m_sliceSegmentArgument ( 0 ) |
---|
92 | , m_sliceSegmentCurStartCUAddr ( 0 ) |
---|
93 | , m_sliceSegmentCurEndCUAddr ( 0 ) |
---|
94 | , m_nextSlice ( false ) |
---|
95 | , m_nextSliceSegment ( false ) |
---|
96 | , m_sliceBits ( 0 ) |
---|
97 | , m_sliceSegmentBits ( 0 ) |
---|
98 | , m_bFinalized ( false ) |
---|
99 | , m_uiTileOffstForMultES ( 0 ) |
---|
100 | , m_puiSubstreamSizes ( NULL ) |
---|
101 | , m_cabacInitFlag ( false ) |
---|
102 | , m_bLMvdL1Zero ( false ) |
---|
103 | , m_numEntryPointOffsets ( 0 ) |
---|
104 | , m_temporalLayerNonReferenceFlag ( false ) |
---|
105 | , m_enableTMVPFlag ( true ) |
---|
106 | #if SVC_EXTENSION |
---|
107 | , m_layerId ( 0 ) |
---|
108 | #if REF_IDX_MFM |
---|
109 | , m_bMFMEnabledFlag ( false ) |
---|
110 | #endif |
---|
111 | #if POC_RESET_FLAG |
---|
112 | , m_bPocResetFlag ( false ) |
---|
113 | #endif |
---|
114 | , m_bDiscardableFlag ( false ) |
---|
115 | #if O0149_CROSS_LAYER_BLA_FLAG |
---|
116 | , m_bCrossLayerBLAFlag ( false ) |
---|
117 | #endif |
---|
118 | #if POC_RESET_IDC_SIGNALLING |
---|
119 | , m_pocResetIdc ( 0 ) |
---|
120 | , m_pocResetPeriodId ( 0 ) |
---|
121 | , m_fullPocResetFlag ( false ) |
---|
122 | , m_pocLsbVal ( 0 ) |
---|
123 | , m_pocMsbVal ( 0 ) |
---|
124 | , m_pocMsbValRequiredFlag ( false ) |
---|
125 | , m_pocMsbValPresentFlag ( false ) |
---|
126 | #endif |
---|
127 | #endif //SVC_EXTENSION |
---|
128 | { |
---|
129 | m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = 0; |
---|
130 | |
---|
131 | #if SVC_EXTENSION |
---|
132 | memset( m_pcBaseColPic, 0, sizeof( m_pcBaseColPic ) ); |
---|
133 | m_activeNumILRRefIdx = 0; |
---|
134 | m_interLayerPredEnabledFlag = 0; |
---|
135 | ::memset( m_interLayerPredLayerIdc, 0, sizeof(m_interLayerPredLayerIdc) ); |
---|
136 | #if P0312_VERT_PHASE_ADJ |
---|
137 | ::memset( m_vertPhasePositionFlag, 0, sizeof(m_vertPhasePositionFlag) ); |
---|
138 | #endif |
---|
139 | #endif //SVC_EXTENSION |
---|
140 | |
---|
141 | initEqualRef(); |
---|
142 | |
---|
143 | for (Int component = 0; component < 3; component++) |
---|
144 | { |
---|
145 | m_lambdas[component] = 0.0; |
---|
146 | } |
---|
147 | |
---|
148 | for ( Int idx = 0; idx < MAX_NUM_REF; idx++ ) |
---|
149 | { |
---|
150 | m_list1IdxToList0Idx[idx] = -1; |
---|
151 | } |
---|
152 | for(Int iNumCount = 0; iNumCount < MAX_NUM_REF; iNumCount++) |
---|
153 | { |
---|
154 | m_apcRefPicList [0][iNumCount] = NULL; |
---|
155 | m_apcRefPicList [1][iNumCount] = NULL; |
---|
156 | m_aiRefPOCList [0][iNumCount] = 0; |
---|
157 | m_aiRefPOCList [1][iNumCount] = 0; |
---|
158 | } |
---|
159 | resetWpScaling(); |
---|
160 | initWpAcDcParam(); |
---|
161 | m_saoEnabledFlag = false; |
---|
162 | m_saoEnabledFlagChroma = false; |
---|
163 | } |
---|
164 | |
---|
165 | TComSlice::~TComSlice() |
---|
166 | { |
---|
167 | delete[] m_puiSubstreamSizes; |
---|
168 | m_puiSubstreamSizes = NULL; |
---|
169 | } |
---|
170 | |
---|
171 | |
---|
172 | #if SVC_EXTENSION |
---|
173 | Void TComSlice::initSlice( UInt layerId ) |
---|
174 | #else |
---|
175 | Void TComSlice::initSlice() |
---|
176 | #endif |
---|
177 | { |
---|
178 | #if SVC_EXTENSION |
---|
179 | m_layerId = layerId; |
---|
180 | m_activeNumILRRefIdx = 0; |
---|
181 | m_interLayerPredEnabledFlag = 0; |
---|
182 | #endif |
---|
183 | m_aiNumRefIdx[0] = 0; |
---|
184 | m_aiNumRefIdx[1] = 0; |
---|
185 | |
---|
186 | m_colFromL0Flag = 1; |
---|
187 | |
---|
188 | m_colRefIdx = 0; |
---|
189 | initEqualRef(); |
---|
190 | m_bCheckLDC = false; |
---|
191 | m_iSliceQpDeltaCb = 0; |
---|
192 | m_iSliceQpDeltaCr = 0; |
---|
193 | |
---|
194 | m_maxNumMergeCand = MRG_MAX_NUM_CANDS; |
---|
195 | |
---|
196 | m_bFinalized=false; |
---|
197 | |
---|
198 | m_tileByteLocation.clear(); |
---|
199 | m_cabacInitFlag = false; |
---|
200 | m_numEntryPointOffsets = 0; |
---|
201 | m_enableTMVPFlag = true; |
---|
202 | } |
---|
203 | |
---|
204 | Bool TComSlice::getRapPicFlag() |
---|
205 | { |
---|
206 | return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL |
---|
207 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP |
---|
208 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP |
---|
209 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL |
---|
210 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP |
---|
211 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA; |
---|
212 | } |
---|
213 | #if NO_OUTPUT_OF_PRIOR_PICS |
---|
214 | Bool TComSlice::getBlaPicFlag () |
---|
215 | { |
---|
216 | return getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP |
---|
217 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL |
---|
218 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP; |
---|
219 | } |
---|
220 | Bool TComSlice::getCraPicFlag () |
---|
221 | { |
---|
222 | return getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA; |
---|
223 | } |
---|
224 | #endif |
---|
225 | |
---|
226 | /** |
---|
227 | - allocate table to contain substream sizes to be written to the slice header. |
---|
228 | . |
---|
229 | \param uiNumSubstreams Number of substreams -- the allocation will be this value - 1. |
---|
230 | */ |
---|
231 | Void TComSlice::allocSubstreamSizes(UInt uiNumSubstreams) |
---|
232 | { |
---|
233 | delete[] m_puiSubstreamSizes; |
---|
234 | m_puiSubstreamSizes = new UInt[uiNumSubstreams > 0 ? uiNumSubstreams-1 : 0]; |
---|
235 | } |
---|
236 | |
---|
237 | Void TComSlice::sortPicList(TComList<TComPic*>& rcListPic) |
---|
238 | { |
---|
239 | TComPic* pcPicExtract; |
---|
240 | TComPic* pcPicInsert; |
---|
241 | |
---|
242 | TComList<TComPic*>::iterator iterPicExtract; |
---|
243 | TComList<TComPic*>::iterator iterPicExtract_1; |
---|
244 | TComList<TComPic*>::iterator iterPicInsert; |
---|
245 | |
---|
246 | for (Int i = 1; i < (Int)(rcListPic.size()); i++) |
---|
247 | { |
---|
248 | iterPicExtract = rcListPic.begin(); |
---|
249 | for (Int j = 0; j < i; j++) iterPicExtract++; |
---|
250 | pcPicExtract = *(iterPicExtract); |
---|
251 | pcPicExtract->setCurrSliceIdx(0); |
---|
252 | |
---|
253 | iterPicInsert = rcListPic.begin(); |
---|
254 | while (iterPicInsert != iterPicExtract) |
---|
255 | { |
---|
256 | pcPicInsert = *(iterPicInsert); |
---|
257 | pcPicInsert->setCurrSliceIdx(0); |
---|
258 | if (pcPicInsert->getPOC() >= pcPicExtract->getPOC()) |
---|
259 | { |
---|
260 | break; |
---|
261 | } |
---|
262 | |
---|
263 | iterPicInsert++; |
---|
264 | } |
---|
265 | |
---|
266 | iterPicExtract_1 = iterPicExtract; iterPicExtract_1++; |
---|
267 | |
---|
268 | // swap iterPicExtract and iterPicInsert, iterPicExtract = curr. / iterPicInsert = insertion position |
---|
269 | rcListPic.insert (iterPicInsert, iterPicExtract, iterPicExtract_1); |
---|
270 | rcListPic.erase (iterPicExtract); |
---|
271 | } |
---|
272 | } |
---|
273 | |
---|
274 | TComPic* TComSlice::xGetRefPic (TComList<TComPic*>& rcListPic, |
---|
275 | Int poc) |
---|
276 | { |
---|
277 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
278 | TComPic* pcPic = *(iterPic); |
---|
279 | while ( iterPic != rcListPic.end() ) |
---|
280 | { |
---|
281 | if(pcPic->getPOC() == poc) |
---|
282 | { |
---|
283 | break; |
---|
284 | } |
---|
285 | iterPic++; |
---|
286 | #if SVC_EXTENSION |
---|
287 | // return NULL, if picture with requested POC is not in the list, otherwise iterator goes outside of the list |
---|
288 | if( iterPic == rcListPic.end() ) |
---|
289 | { |
---|
290 | return NULL; |
---|
291 | } |
---|
292 | #endif |
---|
293 | pcPic = *(iterPic); |
---|
294 | } |
---|
295 | #if POC_RESET_FLAG |
---|
296 | assert( pcPic->getSlice(0)->isReferenced() ); |
---|
297 | #endif |
---|
298 | return pcPic; |
---|
299 | } |
---|
300 | |
---|
301 | |
---|
302 | TComPic* TComSlice::xGetLongTermRefPic(TComList<TComPic*>& rcListPic, Int poc, Bool pocHasMsb) |
---|
303 | { |
---|
304 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
305 | TComPic* pcPic = *(iterPic); |
---|
306 | TComPic* pcStPic = pcPic; |
---|
307 | |
---|
308 | Int pocCycle = 1 << getSPS()->getBitsForPOC(); |
---|
309 | if (!pocHasMsb) |
---|
310 | { |
---|
311 | poc = poc & (pocCycle - 1); |
---|
312 | } |
---|
313 | |
---|
314 | while ( iterPic != rcListPic.end() ) |
---|
315 | { |
---|
316 | pcPic = *(iterPic); |
---|
317 | if (pcPic && pcPic->getPOC()!=this->getPOC() && pcPic->getSlice( 0 )->isReferenced()) |
---|
318 | { |
---|
319 | Int picPoc = pcPic->getPOC(); |
---|
320 | if (!pocHasMsb) |
---|
321 | { |
---|
322 | picPoc = picPoc & (pocCycle - 1); |
---|
323 | } |
---|
324 | |
---|
325 | #if POC_RESET_RPS |
---|
326 | if( ((!pocHasMsb) && ((poc & (pocCycle-1)) == picPoc)) || ( pocHasMsb && (poc == picPoc)) ) |
---|
327 | #else |
---|
328 | if (poc == picPoc) |
---|
329 | #endif |
---|
330 | { |
---|
331 | if (pcPic->getIsLongTerm()) |
---|
332 | { |
---|
333 | return pcPic; |
---|
334 | } |
---|
335 | else |
---|
336 | { |
---|
337 | pcStPic = pcPic; |
---|
338 | } |
---|
339 | break; |
---|
340 | } |
---|
341 | } |
---|
342 | |
---|
343 | iterPic++; |
---|
344 | } |
---|
345 | |
---|
346 | return pcStPic; |
---|
347 | } |
---|
348 | |
---|
349 | Void TComSlice::setRefPOCList() |
---|
350 | { |
---|
351 | for (Int iDir = 0; iDir < 2; iDir++) |
---|
352 | { |
---|
353 | for (Int iNumRefIdx = 0; iNumRefIdx < m_aiNumRefIdx[iDir]; iNumRefIdx++) |
---|
354 | { |
---|
355 | m_aiRefPOCList[iDir][iNumRefIdx] = m_apcRefPicList[iDir][iNumRefIdx]->getPOC(); |
---|
356 | } |
---|
357 | } |
---|
358 | |
---|
359 | } |
---|
360 | |
---|
361 | Void TComSlice::setList1IdxToList0Idx() |
---|
362 | { |
---|
363 | Int idxL0, idxL1; |
---|
364 | for ( idxL1 = 0; idxL1 < getNumRefIdx( REF_PIC_LIST_1 ); idxL1++ ) |
---|
365 | { |
---|
366 | m_list1IdxToList0Idx[idxL1] = -1; |
---|
367 | for ( idxL0 = 0; idxL0 < getNumRefIdx( REF_PIC_LIST_0 ); idxL0++ ) |
---|
368 | { |
---|
369 | if ( m_apcRefPicList[REF_PIC_LIST_0][idxL0]->getPOC() == m_apcRefPicList[REF_PIC_LIST_1][idxL1]->getPOC() ) |
---|
370 | { |
---|
371 | m_list1IdxToList0Idx[idxL1] = idxL0; |
---|
372 | break; |
---|
373 | } |
---|
374 | } |
---|
375 | } |
---|
376 | } |
---|
377 | |
---|
378 | #if SVC_EXTENSION |
---|
379 | Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr, TComPic** ilpPic) |
---|
380 | #else |
---|
381 | Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr ) |
---|
382 | #endif |
---|
383 | { |
---|
384 | if (!checkNumPocTotalCurr) |
---|
385 | { |
---|
386 | if (m_eSliceType == I_SLICE) |
---|
387 | { |
---|
388 | ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList)); |
---|
389 | ::memset( m_aiNumRefIdx, 0, sizeof ( m_aiNumRefIdx )); |
---|
390 | |
---|
391 | return; |
---|
392 | } |
---|
393 | |
---|
394 | m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0); |
---|
395 | m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1); |
---|
396 | } |
---|
397 | |
---|
398 | TComPic* pcRefPic= NULL; |
---|
399 | TComPic* RefPicSetStCurr0[16]; |
---|
400 | TComPic* RefPicSetStCurr1[16]; |
---|
401 | TComPic* RefPicSetLtCurr[16]; |
---|
402 | UInt NumPocStCurr0 = 0; |
---|
403 | UInt NumPocStCurr1 = 0; |
---|
404 | UInt NumPocLtCurr = 0; |
---|
405 | Int i; |
---|
406 | |
---|
407 | #if SVC_EXTENSION |
---|
408 | if( m_layerId == 0 || ( m_layerId > 0 && ( m_activeNumILRRefIdx == 0 || !((getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP) && (getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA)) ) ) ) |
---|
409 | { |
---|
410 | #endif |
---|
411 | for(i=0; i < m_pcRPS->getNumberOfNegativePictures(); i++) |
---|
412 | { |
---|
413 | if(m_pcRPS->getUsed(i)) |
---|
414 | { |
---|
415 | pcRefPic = xGetRefPic(rcListPic, getPOC()+m_pcRPS->getDeltaPOC(i)); |
---|
416 | pcRefPic->setIsLongTerm(0); |
---|
417 | pcRefPic->getPicYuvRec()->extendPicBorder(); |
---|
418 | RefPicSetStCurr0[NumPocStCurr0] = pcRefPic; |
---|
419 | NumPocStCurr0++; |
---|
420 | pcRefPic->setCheckLTMSBPresent(false); |
---|
421 | } |
---|
422 | } |
---|
423 | |
---|
424 | for(; i < m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures(); i++) |
---|
425 | { |
---|
426 | if(m_pcRPS->getUsed(i)) |
---|
427 | { |
---|
428 | pcRefPic = xGetRefPic(rcListPic, getPOC()+m_pcRPS->getDeltaPOC(i)); |
---|
429 | pcRefPic->setIsLongTerm(0); |
---|
430 | pcRefPic->getPicYuvRec()->extendPicBorder(); |
---|
431 | RefPicSetStCurr1[NumPocStCurr1] = pcRefPic; |
---|
432 | NumPocStCurr1++; |
---|
433 | pcRefPic->setCheckLTMSBPresent(false); |
---|
434 | } |
---|
435 | } |
---|
436 | |
---|
437 | for(i = m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()+m_pcRPS->getNumberOfLongtermPictures()-1; i > m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()-1 ; i--) |
---|
438 | { |
---|
439 | if(m_pcRPS->getUsed(i)) |
---|
440 | { |
---|
441 | pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i)); |
---|
442 | pcRefPic->setIsLongTerm(1); |
---|
443 | pcRefPic->getPicYuvRec()->extendPicBorder(); |
---|
444 | RefPicSetLtCurr[NumPocLtCurr] = pcRefPic; |
---|
445 | NumPocLtCurr++; |
---|
446 | } |
---|
447 | if(pcRefPic==NULL) |
---|
448 | { |
---|
449 | pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i)); |
---|
450 | } |
---|
451 | pcRefPic->setCheckLTMSBPresent(m_pcRPS->getCheckLTMSBPresent(i)); |
---|
452 | } |
---|
453 | #if SVC_EXTENSION |
---|
454 | } |
---|
455 | #endif |
---|
456 | |
---|
457 | #if SVC_EXTENSION |
---|
458 | for( i = 0; i < m_activeNumILRRefIdx; i++ ) |
---|
459 | { |
---|
460 | UInt refLayerIdc = m_interLayerPredLayerIdc[i]; |
---|
461 | //inter-layer reference picture |
---|
462 | #if O0225_MAX_TID_FOR_REF_LAYERS |
---|
463 | Int maxTidIlRefPicsPlus1 = ( m_layerId > 0 && m_activeNumILRRefIdx > 0)? m_pcVPS->getMaxTidIlRefPicsPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId(),m_layerId) : 0; |
---|
464 | #else |
---|
465 | Int maxTidIlRefPicsPlus1 = ( m_layerId > 0 && m_activeNumILRRefIdx > 0)? m_pcVPS->getMaxTidIlRefPicsPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId()) : 0; |
---|
466 | #endif |
---|
467 | if( m_layerId > 0 && m_activeNumILRRefIdx > 0 && ( ( (Int)(ilpPic[refLayerIdc]->getSlice(0)->getTLayer())<= maxTidIlRefPicsPlus1-1) || (maxTidIlRefPicsPlus1==0 && ilpPic[refLayerIdc]->getSlice(0)->getRapPicFlag()) ) ) |
---|
468 | { |
---|
469 | #if REF_IDX_MFM |
---|
470 | if(!(m_eNalUnitType >= NAL_UNIT_CODED_SLICE_BLA_W_LP && m_eNalUnitType <= NAL_UNIT_CODED_SLICE_CRA) && getMFMEnabledFlag()) |
---|
471 | { |
---|
472 | ilpPic[refLayerIdc]->copyUpsampledMvField( refLayerIdc, m_pcBaseColPic[refLayerIdc] ); |
---|
473 | } |
---|
474 | else |
---|
475 | { |
---|
476 | ilpPic[refLayerIdc]->initUpsampledMvField(); |
---|
477 | } |
---|
478 | #endif |
---|
479 | ilpPic[refLayerIdc]->setIsLongTerm(1); |
---|
480 | } |
---|
481 | } |
---|
482 | #endif |
---|
483 | // ref_pic_list_init |
---|
484 | TComPic* rpsCurrList0[MAX_NUM_REF+1]; |
---|
485 | TComPic* rpsCurrList1[MAX_NUM_REF+1]; |
---|
486 | #if SVC_EXTENSION |
---|
487 | Int numInterLayerRPSPics = 0; |
---|
488 | #if M0040_ADAPTIVE_RESOLUTION_CHANGE |
---|
489 | if( m_layerId > 0 && m_activeNumILRRefIdx > 0 ) |
---|
490 | #else |
---|
491 | if( m_layerId > 0 ) |
---|
492 | #endif |
---|
493 | { |
---|
494 | for( i=0; i < m_pcVPS->getNumDirectRefLayers( m_layerId ); i++ ) |
---|
495 | { |
---|
496 | #if O0225_MAX_TID_FOR_REF_LAYERS |
---|
497 | Int maxTidIlRefPicsPlus1 = getVPS()->getMaxTidIlRefPicsPlus1(ilpPic[i]->getSlice(0)->getLayerId(),m_layerId); |
---|
498 | #else |
---|
499 | Int maxTidIlRefPicsPlus1 = getVPS()->getMaxTidIlRefPicsPlus1(ilpPic[i]->getSlice(0)->getLayerId()); |
---|
500 | #endif |
---|
501 | if( ((Int)(ilpPic[i]->getSlice(0)->getTLayer())<= maxTidIlRefPicsPlus1-1) || (maxTidIlRefPicsPlus1==0 && ilpPic[i]->getSlice(0)->getRapPicFlag() ) ) |
---|
502 | { |
---|
503 | numInterLayerRPSPics++; |
---|
504 | #if DISCARDABLE_PIC_RPS |
---|
505 | assert( ilpPic[i]->getSlice(0)->getDiscardableFlag() == 0 ); // Inter-layer RPS shall not contain picture with discardable_flag = 1. |
---|
506 | #endif |
---|
507 | } |
---|
508 | } |
---|
509 | if (numInterLayerRPSPics < m_activeNumILRRefIdx) |
---|
510 | { |
---|
511 | m_activeNumILRRefIdx = numInterLayerRPSPics; |
---|
512 | } |
---|
513 | #if MAX_ONE_RESAMPLING_DIRECT_LAYERS |
---|
514 | #if SCALABILITY_MASK_E0104 |
---|
515 | if( m_pcVPS->getScalabilityMask(2) ) |
---|
516 | #else |
---|
517 | if( m_pcVPS->getScalabilityMask(1) ) |
---|
518 | #endif |
---|
519 | { |
---|
520 | Int numResampler = 0; |
---|
521 | #if MOTION_RESAMPLING_CONSTRAINT |
---|
522 | Int numMotionResamplers = 0; |
---|
523 | Int refResamplingLayer[MAX_LAYERS]; |
---|
524 | memset( refResamplingLayer, 0, sizeof( refResamplingLayer ) ); |
---|
525 | #endif |
---|
526 | #if !RESAMPLING_CONSTRAINT_BUG_FIX |
---|
527 | const Window &scalEL = getSPS()->getScaledRefLayerWindow(m_interLayerPredLayerIdc[i]); |
---|
528 | Int scalingOffset = ((scalEL.getWindowLeftOffset() == 0 ) && |
---|
529 | (scalEL.getWindowRightOffset() == 0 ) && |
---|
530 | (scalEL.getWindowTopOffset() == 0 ) && |
---|
531 | (scalEL.getWindowBottomOffset() == 0 ) |
---|
532 | ); |
---|
533 | #endif |
---|
534 | |
---|
535 | for( i=0; i < m_activeNumILRRefIdx; i++ ) |
---|
536 | { |
---|
537 | UInt refLayerIdc = m_interLayerPredLayerIdc[i]; |
---|
538 | UInt refLayerId = m_pcVPS->getRefLayerId( m_layerId, refLayerIdc ); |
---|
539 | #if RESAMPLING_CONSTRAINT_BUG_FIX |
---|
540 | #if O0098_SCALED_REF_LAYER_ID |
---|
541 | const Window &scalEL = getSPS()->getScaledRefLayerWindowForLayer(refLayerId); |
---|
542 | #else |
---|
543 | const Window &scalEL = getSPS()->getScaledRefLayerWindow(m_interLayerPredLayerIdc[i]); |
---|
544 | #endif |
---|
545 | Int scalingOffset = ((scalEL.getWindowLeftOffset() == 0 ) && |
---|
546 | (scalEL.getWindowRightOffset() == 0 ) && |
---|
547 | (scalEL.getWindowTopOffset() == 0 ) && |
---|
548 | (scalEL.getWindowBottomOffset() == 0 ) |
---|
549 | ); |
---|
550 | #endif |
---|
551 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
552 | Int sameBitDepth = g_bitDepthYLayer[m_layerId] - g_bitDepthYLayer[refLayerId] + g_bitDepthCLayer[m_layerId] - g_bitDepthCLayer[refLayerId]; |
---|
553 | |
---|
554 | if( !( g_posScalingFactor[refLayerIdc][0] == 65536 && g_posScalingFactor[refLayerIdc][1] == 65536 ) || !scalingOffset || !sameBitDepth ) // ratio 1x |
---|
555 | #else |
---|
556 | if(!( g_posScalingFactor[refLayerIdc][0] == 65536 && g_posScalingFactor[refLayerIdc][1] == 65536 ) || (!scalingOffset)) // ratio 1x |
---|
557 | #endif |
---|
558 | { |
---|
559 | #if MOTION_RESAMPLING_CONSTRAINT |
---|
560 | UInt predType = m_pcVPS->getDirectDependencyType( m_layerId, refLayerId ) + 1; |
---|
561 | |
---|
562 | if( predType & 0x1 ) |
---|
563 | { |
---|
564 | numResampler++; |
---|
565 | refResamplingLayer[i] = refLayerIdc + 1; |
---|
566 | } |
---|
567 | |
---|
568 | if( predType & 0x2 ) |
---|
569 | { |
---|
570 | numMotionResamplers++; |
---|
571 | refResamplingLayer[i] -= refLayerIdc + 1; |
---|
572 | } |
---|
573 | #else |
---|
574 | numResampler++; |
---|
575 | #endif |
---|
576 | } |
---|
577 | } |
---|
578 | |
---|
579 | // When both picture sample values and picture motion field resampling processes are invoked for decoding of a particular picture, they shall be applied to the same reference layer picture. |
---|
580 | if( m_activeNumILRRefIdx > 1 && numResampler > 0 ) |
---|
581 | { |
---|
582 | for( i=0; i < m_activeNumILRRefIdx; i++ ) |
---|
583 | { |
---|
584 | assert( refResamplingLayer[i] >= 0 && "Motion and sample inter-layer prediction shall be from the same layer" ); |
---|
585 | } |
---|
586 | } |
---|
587 | |
---|
588 | // Bitstream constraint for SHVC: The picture resampling process as specified in subclause G.8.1.4.1 shall not be invoked more than once for decoding of each particular picture. |
---|
589 | assert(numResampler <= 1); |
---|
590 | #if MOTION_RESAMPLING_CONSTRAINT |
---|
591 | assert( numMotionResamplers <= 1 && "Up to 1 motion resampling is allowed" ); |
---|
592 | #endif |
---|
593 | } |
---|
594 | #endif |
---|
595 | } |
---|
596 | Int numPocTotalCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr + m_activeNumILRRefIdx; |
---|
597 | #else //SVC_EXTENSION |
---|
598 | Int numPocTotalCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr; |
---|
599 | #endif //SVC_EXTENSION |
---|
600 | |
---|
601 | if (checkNumPocTotalCurr) |
---|
602 | { |
---|
603 | // The variable NumPocTotalCurr is derived as specified in subclause 7.4.7.2. It is a requirement of bitstream conformance that the following applies to the value of NumPocTotalCurr: |
---|
604 | #if SVC_EXTENSION // inter-layer prediction is allowed for BLA, CRA pictures of nuh_layer_id>0 |
---|
605 | // - If the current picture is a BLA or CRA picture with nuh_layer_id equal to 0, the value of NumPocTotalCurr shall be equal to 0. |
---|
606 | // - Otherwise, when the current picture contains a P or B slice, the value of NumPocTotalCurr shall not be equal to 0. |
---|
607 | if (getRapPicFlag() && getLayerId()==0) |
---|
608 | #else |
---|
609 | // - If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0. |
---|
610 | // - Otherwise, when the current picture contains a P or B slice, the value of NumPocTotalCurr shall not be equal to 0. |
---|
611 | if (getRapPicFlag()) |
---|
612 | #endif |
---|
613 | { |
---|
614 | assert(numPocTotalCurr == 0); |
---|
615 | } |
---|
616 | |
---|
617 | if (m_eSliceType == I_SLICE) |
---|
618 | { |
---|
619 | ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList)); |
---|
620 | ::memset( m_aiNumRefIdx, 0, sizeof ( m_aiNumRefIdx )); |
---|
621 | |
---|
622 | return; |
---|
623 | } |
---|
624 | |
---|
625 | assert(numPocTotalCurr > 0); |
---|
626 | |
---|
627 | m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0); |
---|
628 | m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1); |
---|
629 | } |
---|
630 | |
---|
631 | Int cIdx = 0; |
---|
632 | for ( i=0; i<NumPocStCurr0; i++, cIdx++) |
---|
633 | { |
---|
634 | rpsCurrList0[cIdx] = RefPicSetStCurr0[i]; |
---|
635 | } |
---|
636 | #if SVC_EXTENSION |
---|
637 | #if RPL_INIT_N0316_N0082 |
---|
638 | if( m_layerId > 0 ) |
---|
639 | { |
---|
640 | for( i = 0; i < m_activeNumILRRefIdx && cIdx < numPocTotalCurr; cIdx ++, i ++) |
---|
641 | { |
---|
642 | Int refLayerIdc = m_interLayerPredLayerIdc[i]; |
---|
643 | #if O0225_MAX_TID_FOR_REF_LAYERS |
---|
644 | Int maxTidIlRefPicsPlus1 = getVPS()->getMaxTidIlRefPicsPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId(),m_layerId); |
---|
645 | #else |
---|
646 | Int maxTidIlRefPicsPlus1 = getVPS()->getMaxTidIlRefPicsPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId()); |
---|
647 | #endif |
---|
648 | if( ((Int)(ilpPic[refLayerIdc]->getSlice(0)->getTLayer())<=maxTidIlRefPicsPlus1-1) || (maxTidIlRefPicsPlus1==0 && ilpPic[refLayerIdc]->getSlice(0)->getRapPicFlag()) ) |
---|
649 | { |
---|
650 | rpsCurrList0[cIdx] = ilpPic[refLayerIdc]; |
---|
651 | } |
---|
652 | } |
---|
653 | } |
---|
654 | #endif |
---|
655 | #endif //SVC_EXTENSION |
---|
656 | for ( i=0; i<NumPocStCurr1; i++, cIdx++) |
---|
657 | { |
---|
658 | rpsCurrList0[cIdx] = RefPicSetStCurr1[i]; |
---|
659 | } |
---|
660 | for ( i=0; i<NumPocLtCurr; i++, cIdx++) |
---|
661 | { |
---|
662 | rpsCurrList0[cIdx] = RefPicSetLtCurr[i]; |
---|
663 | } |
---|
664 | #if !RPL_INIT_N0316_N0082 |
---|
665 | #if SVC_EXTENSION |
---|
666 | if( m_layerId > 0 ) |
---|
667 | { |
---|
668 | for( i = 0; i < m_activeNumILRRefIdx && cIdx < numPocTotalCurr; cIdx ++, i ++) |
---|
669 | { |
---|
670 | Int refLayerIdc = m_interLayerPredLayerIdc[i]; |
---|
671 | #if O0225_MAX_TID_FOR_REF_LAYERS |
---|
672 | Int maxTidIlRefPicsPlus1 = getVPS()->getMaxTidIlRefPicsPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId(),m_layerId); |
---|
673 | #else |
---|
674 | Int maxTidIlRefPicsPlus1 = getVPS()->getMaxTidIlRefPicsPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId()); |
---|
675 | #endif |
---|
676 | if( ((Int)(ilpPic[refLayerIdc]->getSlice(0)->getTLayer())<=maxTidIlRefPicsPlus1-1) || (maxTidIlRefPicsPlus1==0 && ilpPic[refLayerIdc]->getSlice(0)->getRapPicFlag()) ) |
---|
677 | { |
---|
678 | rpsCurrList0[cIdx] = ilpPic[refLayerIdc]; |
---|
679 | } |
---|
680 | } |
---|
681 | } |
---|
682 | #endif |
---|
683 | #endif |
---|
684 | assert(cIdx == numPocTotalCurr); |
---|
685 | |
---|
686 | if (m_eSliceType==B_SLICE) |
---|
687 | { |
---|
688 | cIdx = 0; |
---|
689 | for ( i=0; i<NumPocStCurr1; i++, cIdx++) |
---|
690 | { |
---|
691 | rpsCurrList1[cIdx] = RefPicSetStCurr1[i]; |
---|
692 | } |
---|
693 | for ( i=0; i<NumPocStCurr0; i++, cIdx++) |
---|
694 | { |
---|
695 | rpsCurrList1[cIdx] = RefPicSetStCurr0[i]; |
---|
696 | } |
---|
697 | for ( i=0; i<NumPocLtCurr; i++, cIdx++) |
---|
698 | { |
---|
699 | rpsCurrList1[cIdx] = RefPicSetLtCurr[i]; |
---|
700 | } |
---|
701 | |
---|
702 | #if SVC_EXTENSION |
---|
703 | if( m_layerId > 0 ) |
---|
704 | { |
---|
705 | for( i = 0; i < m_activeNumILRRefIdx && cIdx < numPocTotalCurr; cIdx ++, i ++) |
---|
706 | { |
---|
707 | Int refLayerIdc = m_interLayerPredLayerIdc[i]; |
---|
708 | #if O0225_MAX_TID_FOR_REF_LAYERS |
---|
709 | Int maxTidIlRefPicsPlus1 = getVPS()->getMaxTidIlRefPicsPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId(),m_layerId); |
---|
710 | #else |
---|
711 | Int maxTidIlRefPicsPlus1 = getVPS()->getMaxTidIlRefPicsPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId()); |
---|
712 | #endif |
---|
713 | if( ((Int)(ilpPic[refLayerIdc]->getSlice(0)->getTLayer())<=maxTidIlRefPicsPlus1-1) || (maxTidIlRefPicsPlus1==0 && ilpPic[refLayerIdc]->getSlice(0)->getRapPicFlag()) ) |
---|
714 | { |
---|
715 | rpsCurrList1[cIdx] = ilpPic[refLayerIdc]; |
---|
716 | } |
---|
717 | } |
---|
718 | } |
---|
719 | #endif //SVC_EXTENSION |
---|
720 | |
---|
721 | assert(cIdx == numPocTotalCurr); |
---|
722 | } |
---|
723 | |
---|
724 | ::memset(m_bIsUsedAsLongTerm, 0, sizeof(m_bIsUsedAsLongTerm)); |
---|
725 | |
---|
726 | for (Int rIdx = 0; rIdx < m_aiNumRefIdx[0]; rIdx ++) |
---|
727 | { |
---|
728 | cIdx = m_RefPicListModification.getRefPicListModificationFlagL0() ? m_RefPicListModification.getRefPicSetIdxL0(rIdx) : rIdx % numPocTotalCurr; |
---|
729 | assert(cIdx >= 0 && cIdx < numPocTotalCurr); |
---|
730 | m_apcRefPicList[0][rIdx] = rpsCurrList0[ cIdx ]; |
---|
731 | #if RPL_INIT_N0316_N0082 |
---|
732 | m_bIsUsedAsLongTerm[0][rIdx] = ( cIdx >= NumPocStCurr0 && cIdx < NumPocStCurr0 + m_activeNumILRRefIdx ) || ( cIdx >= NumPocStCurr0 + NumPocStCurr1 + m_activeNumILRRefIdx ); |
---|
733 | #else |
---|
734 | m_bIsUsedAsLongTerm[0][rIdx] = ( cIdx >= NumPocStCurr0 + NumPocStCurr1 ); |
---|
735 | #endif |
---|
736 | } |
---|
737 | if ( m_eSliceType != B_SLICE ) |
---|
738 | { |
---|
739 | m_aiNumRefIdx[1] = 0; |
---|
740 | ::memset( m_apcRefPicList[1], 0, sizeof(m_apcRefPicList[1])); |
---|
741 | } |
---|
742 | else |
---|
743 | { |
---|
744 | for (Int rIdx = 0; rIdx < m_aiNumRefIdx[1]; rIdx ++) |
---|
745 | { |
---|
746 | cIdx = m_RefPicListModification.getRefPicListModificationFlagL1() ? m_RefPicListModification.getRefPicSetIdxL1(rIdx) : rIdx % numPocTotalCurr; |
---|
747 | assert(cIdx >= 0 && cIdx < numPocTotalCurr); |
---|
748 | m_apcRefPicList[1][rIdx] = rpsCurrList1[ cIdx ]; |
---|
749 | m_bIsUsedAsLongTerm[1][rIdx] = ( cIdx >= NumPocStCurr0 + NumPocStCurr1 ); |
---|
750 | } |
---|
751 | } |
---|
752 | } |
---|
753 | |
---|
754 | #if SVC_EXTENSION |
---|
755 | Void TComSlice::setRefPicListModificationSvc() |
---|
756 | { |
---|
757 | if( !m_pcPPS->getListsModificationPresentFlag()) |
---|
758 | { |
---|
759 | return; |
---|
760 | } |
---|
761 | |
---|
762 | if(m_eNalUnitType >= NAL_UNIT_CODED_SLICE_BLA_W_LP && m_eNalUnitType <= NAL_UNIT_CODED_SLICE_CRA) |
---|
763 | { |
---|
764 | return; |
---|
765 | } |
---|
766 | |
---|
767 | TComRefPicListModification* refPicListModification = &m_RefPicListModification; |
---|
768 | Int numberOfRpsCurrTempList = this->getNumRpsCurrTempList(); // total number of ref pics in listTemp0 including inter-layer ref pics |
---|
769 | #if RPL_INIT_N0316_N0082 |
---|
770 | Int numberOfPocBeforeCurr = this->getNumNegativeRpsCurrTempList(); // number of negative temporal ref pics |
---|
771 | #endif |
---|
772 | |
---|
773 | #if N0147_IRAP_ALIGN_FLAG |
---|
774 | assert(m_aiNumRefIdx[REF_PIC_LIST_0] > 0); |
---|
775 | assert(m_aiNumRefIdx[REF_PIC_LIST_1] > 0); |
---|
776 | #else |
---|
777 | assert(m_aiNumRefIdx[REF_PIC_LIST_0] > 1); |
---|
778 | assert(m_aiNumRefIdx[REF_PIC_LIST_1] > 1); |
---|
779 | #endif |
---|
780 | |
---|
781 | //set L0 inter-layer reference picture modification |
---|
782 | #if RPL_INIT_N0316_N0082 |
---|
783 | Bool hasModification = (m_aiNumRefIdx[REF_PIC_LIST_0] == (numberOfPocBeforeCurr + m_activeNumILRRefIdx)) ? false : true; |
---|
784 | #else |
---|
785 | Bool hasModification = (m_aiNumRefIdx[REF_PIC_LIST_0] == numberOfRpsCurrTempList) ? false : true; |
---|
786 | #endif |
---|
787 | #if N0147_IRAP_ALIGN_FLAG |
---|
788 | hasModification = hasModification && ( m_aiNumRefIdx[REF_PIC_LIST_0] > 1 ); |
---|
789 | #endif |
---|
790 | refPicListModification->setRefPicListModificationFlagL0(hasModification); |
---|
791 | if(hasModification) |
---|
792 | { |
---|
793 | for(Int i = 0; i < min(m_aiNumRefIdx[REF_PIC_LIST_0], numberOfRpsCurrTempList); i++) |
---|
794 | { |
---|
795 | refPicListModification->setRefPicSetIdxL0(i, i); |
---|
796 | } |
---|
797 | if(m_aiNumRefIdx[REF_PIC_LIST_0] > numberOfRpsCurrTempList) |
---|
798 | { |
---|
799 | // repeat last ref pic when the number of active ref idx are more than RPS entries |
---|
800 | for (Int i = numberOfRpsCurrTempList; i < m_aiNumRefIdx[REF_PIC_LIST_0]; i ++) |
---|
801 | { |
---|
802 | refPicListModification->setRefPicSetIdxL0(i, numberOfRpsCurrTempList - 1); |
---|
803 | } |
---|
804 | } |
---|
805 | else |
---|
806 | { |
---|
807 | for(Int i = m_activeNumILRRefIdx; i > 0; i-- ) |
---|
808 | { |
---|
809 | #if RPL_INIT_N0316_N0082 |
---|
810 | if((numberOfPocBeforeCurr) >= m_aiNumRefIdx[REF_PIC_LIST_0]) |
---|
811 | { |
---|
812 | refPicListModification->setRefPicSetIdxL0(m_aiNumRefIdx[REF_PIC_LIST_0] - i, numberOfPocBeforeCurr); |
---|
813 | } |
---|
814 | else |
---|
815 | { |
---|
816 | refPicListModification->setRefPicSetIdxL0(m_aiNumRefIdx[REF_PIC_LIST_0] - i, numberOfPocBeforeCurr); |
---|
817 | for (Int j = numberOfPocBeforeCurr; j < (m_aiNumRefIdx[REF_PIC_LIST_0] - i); j++) |
---|
818 | { |
---|
819 | refPicListModification->setRefPicSetIdxL0(j, j + m_activeNumILRRefIdx); |
---|
820 | } |
---|
821 | } |
---|
822 | #else |
---|
823 | refPicListModification->setRefPicSetIdxL0(m_aiNumRefIdx[REF_PIC_LIST_0] - i, numberOfRpsCurrTempList - i); |
---|
824 | #endif |
---|
825 | } |
---|
826 | } |
---|
827 | } |
---|
828 | |
---|
829 | //set L1 inter-layer reference picture modification |
---|
830 | hasModification = (m_aiNumRefIdx[REF_PIC_LIST_1] == numberOfRpsCurrTempList) ? false : true; |
---|
831 | #if N0147_IRAP_ALIGN_FLAG |
---|
832 | hasModification = hasModification && ( m_aiNumRefIdx[REF_PIC_LIST_1] > 1 ); |
---|
833 | #endif |
---|
834 | |
---|
835 | refPicListModification->setRefPicListModificationFlagL1(hasModification); |
---|
836 | if(hasModification) |
---|
837 | { |
---|
838 | for(Int i = 0; i < min(m_aiNumRefIdx[REF_PIC_LIST_1], numberOfRpsCurrTempList); i++) |
---|
839 | { |
---|
840 | refPicListModification->setRefPicSetIdxL1(i, i); |
---|
841 | } |
---|
842 | if(m_aiNumRefIdx[REF_PIC_LIST_1] > numberOfRpsCurrTempList) |
---|
843 | { |
---|
844 | for (Int i = numberOfRpsCurrTempList; i < m_aiNumRefIdx[REF_PIC_LIST_1]; i ++) |
---|
845 | { |
---|
846 | // repeat last ref pic when the number of active ref idx are more than RPS entries |
---|
847 | refPicListModification->setRefPicSetIdxL1(i, numberOfRpsCurrTempList - 1); |
---|
848 | } |
---|
849 | } |
---|
850 | else |
---|
851 | { |
---|
852 | for(Int i = m_activeNumILRRefIdx; i > 0; i-- ) |
---|
853 | { |
---|
854 | refPicListModification->setRefPicSetIdxL1(m_aiNumRefIdx[REF_PIC_LIST_1] - i, numberOfRpsCurrTempList - i); |
---|
855 | } |
---|
856 | } |
---|
857 | } |
---|
858 | return; |
---|
859 | } |
---|
860 | #endif |
---|
861 | #if RPL_INIT_N0316_N0082 |
---|
862 | Int TComSlice::getNumNegativeRpsCurrTempList() |
---|
863 | { |
---|
864 | if( m_eSliceType == I_SLICE ) |
---|
865 | { |
---|
866 | return 0; |
---|
867 | } |
---|
868 | |
---|
869 | Int numPocBeforeCurr = 0; |
---|
870 | for( UInt i = 0; i < m_pcRPS->getNumberOfNegativePictures(); i++ ) |
---|
871 | { |
---|
872 | if(m_pcRPS->getUsed(i)) |
---|
873 | { |
---|
874 | numPocBeforeCurr++; |
---|
875 | } |
---|
876 | } |
---|
877 | |
---|
878 | return numPocBeforeCurr; |
---|
879 | } |
---|
880 | #endif |
---|
881 | Int TComSlice::getNumRpsCurrTempList() |
---|
882 | { |
---|
883 | Int numRpsCurrTempList = 0; |
---|
884 | |
---|
885 | #if SVC_EXTENSION |
---|
886 | if( m_eSliceType == I_SLICE || ( m_layerId && |
---|
887 | (m_eNalUnitType >= NAL_UNIT_CODED_SLICE_BLA_W_LP) && |
---|
888 | (m_eNalUnitType <= NAL_UNIT_CODED_SLICE_CRA) ) ) |
---|
889 | #else |
---|
890 | if (m_eSliceType == I_SLICE) |
---|
891 | #endif |
---|
892 | { |
---|
893 | #if SVC_EXTENSION |
---|
894 | return m_activeNumILRRefIdx; |
---|
895 | #else |
---|
896 | return 0; |
---|
897 | #endif |
---|
898 | } |
---|
899 | for(UInt i=0; i < m_pcRPS->getNumberOfNegativePictures()+ m_pcRPS->getNumberOfPositivePictures() + m_pcRPS->getNumberOfLongtermPictures(); i++) |
---|
900 | { |
---|
901 | if(m_pcRPS->getUsed(i)) |
---|
902 | { |
---|
903 | numRpsCurrTempList++; |
---|
904 | } |
---|
905 | } |
---|
906 | #if SVC_EXTENSION |
---|
907 | if( m_layerId > 0 ) |
---|
908 | { |
---|
909 | numRpsCurrTempList += m_activeNumILRRefIdx; |
---|
910 | } |
---|
911 | #endif |
---|
912 | |
---|
913 | return numRpsCurrTempList; |
---|
914 | } |
---|
915 | |
---|
916 | Void TComSlice::initEqualRef() |
---|
917 | { |
---|
918 | for (Int iDir = 0; iDir < 2; iDir++) |
---|
919 | { |
---|
920 | for (Int iRefIdx1 = 0; iRefIdx1 < MAX_NUM_REF; iRefIdx1++) |
---|
921 | { |
---|
922 | for (Int iRefIdx2 = iRefIdx1; iRefIdx2 < MAX_NUM_REF; iRefIdx2++) |
---|
923 | { |
---|
924 | m_abEqualRef[iDir][iRefIdx1][iRefIdx2] = m_abEqualRef[iDir][iRefIdx2][iRefIdx1] = (iRefIdx1 == iRefIdx2? true : false); |
---|
925 | } |
---|
926 | } |
---|
927 | } |
---|
928 | } |
---|
929 | |
---|
930 | Void TComSlice::checkColRefIdx(UInt curSliceIdx, TComPic* pic) |
---|
931 | { |
---|
932 | Int i; |
---|
933 | TComSlice* curSlice = pic->getSlice(curSliceIdx); |
---|
934 | Int currColRefPOC = curSlice->getRefPOC( RefPicList(1-curSlice->getColFromL0Flag()), curSlice->getColRefIdx()); |
---|
935 | TComSlice* preSlice; |
---|
936 | Int preColRefPOC; |
---|
937 | for(i=curSliceIdx-1; i>=0; i--) |
---|
938 | { |
---|
939 | preSlice = pic->getSlice(i); |
---|
940 | if(preSlice->getSliceType() != I_SLICE) |
---|
941 | { |
---|
942 | preColRefPOC = preSlice->getRefPOC( RefPicList(1-preSlice->getColFromL0Flag()), preSlice->getColRefIdx()); |
---|
943 | if(currColRefPOC != preColRefPOC) |
---|
944 | { |
---|
945 | printf("Collocated_ref_idx shall always be the same for all slices of a coded picture!\n"); |
---|
946 | exit(EXIT_FAILURE); |
---|
947 | } |
---|
948 | else |
---|
949 | { |
---|
950 | break; |
---|
951 | } |
---|
952 | } |
---|
953 | } |
---|
954 | } |
---|
955 | |
---|
956 | Void TComSlice::checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, NalUnitType& associatedIRAPType, TComList<TComPic *>& rcListPic) |
---|
957 | { |
---|
958 | for(Int i = 0; i < pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures(); i++) |
---|
959 | { |
---|
960 | if(pocCRA < MAX_UINT && getPOC() > pocCRA) |
---|
961 | { |
---|
962 | assert(getPOC()+pReferencePictureSet->getDeltaPOC(i) >= pocCRA); |
---|
963 | } |
---|
964 | } |
---|
965 | for(Int i = pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures(); i < pReferencePictureSet->getNumberOfPictures(); i++) |
---|
966 | { |
---|
967 | if(pocCRA < MAX_UINT && getPOC() > pocCRA) |
---|
968 | { |
---|
969 | if (!pReferencePictureSet->getCheckLTMSBPresent(i)) |
---|
970 | { |
---|
971 | assert(xGetLongTermRefPic(rcListPic, pReferencePictureSet->getPOC(i), false)->getPOC() >= pocCRA); |
---|
972 | } |
---|
973 | else |
---|
974 | { |
---|
975 | assert(pReferencePictureSet->getPOC(i) >= pocCRA); |
---|
976 | } |
---|
977 | } |
---|
978 | } |
---|
979 | if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) // IDR picture found |
---|
980 | { |
---|
981 | pocCRA = getPOC(); |
---|
982 | associatedIRAPType = getNalUnitType(); |
---|
983 | } |
---|
984 | else if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA ) // CRA picture found |
---|
985 | { |
---|
986 | pocCRA = getPOC(); |
---|
987 | associatedIRAPType = getNalUnitType(); |
---|
988 | } |
---|
989 | else if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP |
---|
990 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL |
---|
991 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) // BLA picture found |
---|
992 | { |
---|
993 | pocCRA = getPOC(); |
---|
994 | associatedIRAPType = getNalUnitType(); |
---|
995 | } |
---|
996 | } |
---|
997 | |
---|
998 | /** Function for marking the reference pictures when an IDR/CRA/CRANT/BLA/BLANT is encountered. |
---|
999 | * \param pocCRA POC of the CRA/CRANT/BLA/BLANT picture |
---|
1000 | * \param bRefreshPending flag indicating if a deferred decoding refresh is pending |
---|
1001 | * \param rcListPic reference to the reference picture list |
---|
1002 | * This function marks the reference pictures as "unused for reference" in the following conditions. |
---|
1003 | * If the nal_unit_type is IDR/BLA/BLANT, all pictures in the reference picture list |
---|
1004 | * are marked as "unused for reference" |
---|
1005 | * If the nal_unit_type is BLA/BLANT, set the pocCRA to the temporal reference of the current picture. |
---|
1006 | * Otherwise |
---|
1007 | * If the bRefreshPending flag is true (a deferred decoding refresh is pending) and the current |
---|
1008 | * temporal reference is greater than the temporal reference of the latest CRA/CRANT/BLA/BLANT picture (pocCRA), |
---|
1009 | * mark all reference pictures except the latest CRA/CRANT/BLA/BLANT picture as "unused for reference" and set |
---|
1010 | * the bRefreshPending flag to false. |
---|
1011 | * If the nal_unit_type is CRA/CRANT, set the bRefreshPending flag to true and pocCRA to the temporal |
---|
1012 | * reference of the current picture. |
---|
1013 | * Note that the current picture is already placed in the reference list and its marking is not changed. |
---|
1014 | * If the current picture has a nal_ref_idc that is not 0, it will remain marked as "used for reference". |
---|
1015 | */ |
---|
1016 | #if NO_CLRAS_OUTPUT_FLAG |
---|
1017 | Void TComSlice::decodingRefreshMarking( TComList<TComPic*>& rcListPic, Bool noClrasOutputFlag ) |
---|
1018 | { |
---|
1019 | if( !isIRAP() ) |
---|
1020 | { |
---|
1021 | return; |
---|
1022 | } |
---|
1023 | |
---|
1024 | Int pocCurr = getPOC(); |
---|
1025 | TComPic* rpcPic = NULL; |
---|
1026 | |
---|
1027 | // When the current picture is an IRAP picture with nuh_layer_id equal to 0 and NoClrasOutputFlag is equal to 1, |
---|
1028 | // all reference pictures with any value of nuh_layer_id currently in the DPB (if any) are marked as "unused for reference". |
---|
1029 | if( m_layerId == 0 && noClrasOutputFlag ) |
---|
1030 | { |
---|
1031 | // mark all pictures for all layers as not used for reference |
---|
1032 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
1033 | while( iterPic != rcListPic.end() ) |
---|
1034 | { |
---|
1035 | if( rpcPic->getPOC() != pocCurr ) |
---|
1036 | { |
---|
1037 | rpcPic->getSlice(0)->setReferenced(false); |
---|
1038 | } |
---|
1039 | } |
---|
1040 | } |
---|
1041 | |
---|
1042 | // When the current picture is an IRAP picture with NoRaslOutputFlag equal to 1, |
---|
1043 | // all reference pictures with nuh_layer_id equal to currPicLayerId currently in the DPB (if any) are marked as "unused for reference". |
---|
1044 | if( m_noRaslOutputFlag ) |
---|
1045 | { |
---|
1046 | // mark all pictures of a current layer as not used for reference |
---|
1047 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
1048 | while( iterPic != rcListPic.end() ) |
---|
1049 | { |
---|
1050 | if( rpcPic->getPOC() != pocCurr && rpcPic->getLayerId() == m_layerId ) |
---|
1051 | { |
---|
1052 | rpcPic->getSlice(0)->setReferenced(false); |
---|
1053 | } |
---|
1054 | } |
---|
1055 | } |
---|
1056 | } |
---|
1057 | |
---|
1058 | Void TComSlice::decodingRefreshMarking(Int& pocCRA, Bool& bRefreshPending, TComList<TComPic*>& rcListPic, Bool noClrasOutputFlag) |
---|
1059 | #else |
---|
1060 | Void TComSlice::decodingRefreshMarking(Int& pocCRA, Bool& bRefreshPending, TComList<TComPic*>& rcListPic) |
---|
1061 | #endif |
---|
1062 | { |
---|
1063 | TComPic* rpcPic; |
---|
1064 | #if !FIX1172 |
---|
1065 | setAssociatedIRAPPOC(pocCRA); |
---|
1066 | #endif |
---|
1067 | Int pocCurr = getPOC(); |
---|
1068 | |
---|
1069 | if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP |
---|
1070 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL |
---|
1071 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP |
---|
1072 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL |
---|
1073 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) // IDR or BLA picture |
---|
1074 | { |
---|
1075 | // mark all pictures as not used for reference |
---|
1076 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
1077 | while (iterPic != rcListPic.end()) |
---|
1078 | { |
---|
1079 | rpcPic = *(iterPic); |
---|
1080 | rpcPic->setCurrSliceIdx(0); |
---|
1081 | #if NO_CLRAS_OUTPUT_FLAG |
---|
1082 | if (noClrasOutputFlag) |
---|
1083 | { |
---|
1084 | if (rpcPic->getPOC() != pocCurr) rpcPic->getSlice(0)->setReferenced(false); // all layers |
---|
1085 | } |
---|
1086 | else |
---|
1087 | { |
---|
1088 | if (rpcPic->getPOC() != pocCurr && rpcPic->getLayerId() == m_layerId) rpcPic->getSlice(0)->setReferenced(false); // only current layer |
---|
1089 | } |
---|
1090 | #else |
---|
1091 | if (rpcPic->getPOC() != pocCurr) rpcPic->getSlice(0)->setReferenced(false); |
---|
1092 | #endif |
---|
1093 | iterPic++; |
---|
1094 | } |
---|
1095 | if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP |
---|
1096 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL |
---|
1097 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) |
---|
1098 | { |
---|
1099 | pocCRA = pocCurr; |
---|
1100 | } |
---|
1101 | #if EFFICIENT_FIELD_IRAP |
---|
1102 | bRefreshPending = true; |
---|
1103 | #endif |
---|
1104 | } |
---|
1105 | else // CRA or No DR |
---|
1106 | { |
---|
1107 | #if EFFICIENT_FIELD_IRAP |
---|
1108 | if(getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_IDR_N_LP || getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL) |
---|
1109 | { |
---|
1110 | if (bRefreshPending==true && pocCurr > m_iLastIDR) // IDR reference marking pending |
---|
1111 | { |
---|
1112 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
1113 | while (iterPic != rcListPic.end()) |
---|
1114 | { |
---|
1115 | rpcPic = *(iterPic); |
---|
1116 | if (rpcPic->getPOC() != pocCurr && rpcPic->getPOC() != m_iLastIDR) |
---|
1117 | { |
---|
1118 | rpcPic->getSlice(0)->setReferenced(false); |
---|
1119 | } |
---|
1120 | iterPic++; |
---|
1121 | } |
---|
1122 | bRefreshPending = false; |
---|
1123 | } |
---|
1124 | } |
---|
1125 | else |
---|
1126 | { |
---|
1127 | #endif |
---|
1128 | if (bRefreshPending==true && pocCurr > pocCRA) // CRA reference marking pending |
---|
1129 | { |
---|
1130 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
1131 | while (iterPic != rcListPic.end()) |
---|
1132 | { |
---|
1133 | rpcPic = *(iterPic); |
---|
1134 | if (rpcPic->getPOC() != pocCurr && rpcPic->getPOC() != pocCRA) |
---|
1135 | { |
---|
1136 | rpcPic->getSlice(0)->setReferenced(false); |
---|
1137 | } |
---|
1138 | iterPic++; |
---|
1139 | } |
---|
1140 | bRefreshPending = false; |
---|
1141 | } |
---|
1142 | #if EFFICIENT_FIELD_IRAP |
---|
1143 | } |
---|
1144 | #endif |
---|
1145 | if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA ) // CRA picture found |
---|
1146 | { |
---|
1147 | bRefreshPending = true; |
---|
1148 | pocCRA = pocCurr; |
---|
1149 | } |
---|
1150 | } |
---|
1151 | } |
---|
1152 | |
---|
1153 | Void TComSlice::copySliceInfo(TComSlice *pSrc) |
---|
1154 | { |
---|
1155 | assert( pSrc != NULL ); |
---|
1156 | |
---|
1157 | Int i, j, k; |
---|
1158 | |
---|
1159 | m_iPOC = pSrc->m_iPOC; |
---|
1160 | m_eNalUnitType = pSrc->m_eNalUnitType; |
---|
1161 | m_eSliceType = pSrc->m_eSliceType; |
---|
1162 | m_iSliceQp = pSrc->m_iSliceQp; |
---|
1163 | #if ADAPTIVE_QP_SELECTION |
---|
1164 | m_iSliceQpBase = pSrc->m_iSliceQpBase; |
---|
1165 | #endif |
---|
1166 | m_deblockingFilterDisable = pSrc->m_deblockingFilterDisable; |
---|
1167 | m_deblockingFilterOverrideFlag = pSrc->m_deblockingFilterOverrideFlag; |
---|
1168 | m_deblockingFilterBetaOffsetDiv2 = pSrc->m_deblockingFilterBetaOffsetDiv2; |
---|
1169 | m_deblockingFilterTcOffsetDiv2 = pSrc->m_deblockingFilterTcOffsetDiv2; |
---|
1170 | |
---|
1171 | for (i = 0; i < 2; i++) |
---|
1172 | { |
---|
1173 | m_aiNumRefIdx[i] = pSrc->m_aiNumRefIdx[i]; |
---|
1174 | } |
---|
1175 | |
---|
1176 | for (i = 0; i < MAX_NUM_REF; i++) |
---|
1177 | { |
---|
1178 | m_list1IdxToList0Idx[i] = pSrc->m_list1IdxToList0Idx[i]; |
---|
1179 | } |
---|
1180 | m_bCheckLDC = pSrc->m_bCheckLDC; |
---|
1181 | m_iSliceQpDelta = pSrc->m_iSliceQpDelta; |
---|
1182 | m_iSliceQpDeltaCb = pSrc->m_iSliceQpDeltaCb; |
---|
1183 | m_iSliceQpDeltaCr = pSrc->m_iSliceQpDeltaCr; |
---|
1184 | for (i = 0; i < 2; i++) |
---|
1185 | { |
---|
1186 | for (j = 0; j < MAX_NUM_REF; j++) |
---|
1187 | { |
---|
1188 | m_apcRefPicList[i][j] = pSrc->m_apcRefPicList[i][j]; |
---|
1189 | m_aiRefPOCList[i][j] = pSrc->m_aiRefPOCList[i][j]; |
---|
1190 | } |
---|
1191 | } |
---|
1192 | for (i = 0; i < 2; i++) |
---|
1193 | { |
---|
1194 | for (j = 0; j < MAX_NUM_REF + 1; j++) |
---|
1195 | { |
---|
1196 | m_bIsUsedAsLongTerm[i][j] = pSrc->m_bIsUsedAsLongTerm[i][j]; |
---|
1197 | } |
---|
1198 | } |
---|
1199 | m_iDepth = pSrc->m_iDepth; |
---|
1200 | |
---|
1201 | // referenced slice |
---|
1202 | m_bRefenced = pSrc->m_bRefenced; |
---|
1203 | |
---|
1204 | // access channel |
---|
1205 | #if SVC_EXTENSION |
---|
1206 | m_pcVPS = pSrc->m_pcVPS; |
---|
1207 | m_layerId = pSrc->m_layerId; |
---|
1208 | m_activeNumILRRefIdx = pSrc->m_activeNumILRRefIdx; |
---|
1209 | m_interLayerPredEnabledFlag = pSrc->m_interLayerPredEnabledFlag; |
---|
1210 | memcpy( m_interLayerPredLayerIdc, pSrc->m_interLayerPredLayerIdc, sizeof( m_interLayerPredLayerIdc ) ); |
---|
1211 | #if P0312_VERT_PHASE_ADJ |
---|
1212 | memcpy( m_vertPhasePositionFlag, pSrc->m_vertPhasePositionFlag, sizeof( m_vertPhasePositionFlag ) ); |
---|
1213 | #endif |
---|
1214 | #endif |
---|
1215 | m_pcSPS = pSrc->m_pcSPS; |
---|
1216 | m_pcPPS = pSrc->m_pcPPS; |
---|
1217 | m_pcRPS = pSrc->m_pcRPS; |
---|
1218 | m_iLastIDR = pSrc->m_iLastIDR; |
---|
1219 | |
---|
1220 | m_pcPic = pSrc->m_pcPic; |
---|
1221 | |
---|
1222 | m_colFromL0Flag = pSrc->m_colFromL0Flag; |
---|
1223 | m_colRefIdx = pSrc->m_colRefIdx; |
---|
1224 | setLambdas(pSrc->getLambdas()); |
---|
1225 | for (i = 0; i < 2; i++) |
---|
1226 | { |
---|
1227 | for (j = 0; j < MAX_NUM_REF; j++) |
---|
1228 | { |
---|
1229 | for (k =0; k < MAX_NUM_REF; k++) |
---|
1230 | { |
---|
1231 | m_abEqualRef[i][j][k] = pSrc->m_abEqualRef[i][j][k]; |
---|
1232 | } |
---|
1233 | } |
---|
1234 | } |
---|
1235 | |
---|
1236 | m_uiTLayer = pSrc->m_uiTLayer; |
---|
1237 | m_bTLayerSwitchingFlag = pSrc->m_bTLayerSwitchingFlag; |
---|
1238 | |
---|
1239 | m_sliceMode = pSrc->m_sliceMode; |
---|
1240 | m_sliceArgument = pSrc->m_sliceArgument; |
---|
1241 | m_sliceCurStartCUAddr = pSrc->m_sliceCurStartCUAddr; |
---|
1242 | m_sliceCurEndCUAddr = pSrc->m_sliceCurEndCUAddr; |
---|
1243 | m_sliceIdx = pSrc->m_sliceIdx; |
---|
1244 | m_sliceSegmentMode = pSrc->m_sliceSegmentMode; |
---|
1245 | m_sliceSegmentArgument = pSrc->m_sliceSegmentArgument; |
---|
1246 | m_sliceSegmentCurStartCUAddr = pSrc->m_sliceSegmentCurStartCUAddr; |
---|
1247 | m_sliceSegmentCurEndCUAddr = pSrc->m_sliceSegmentCurEndCUAddr; |
---|
1248 | m_nextSlice = pSrc->m_nextSlice; |
---|
1249 | m_nextSliceSegment = pSrc->m_nextSliceSegment; |
---|
1250 | for ( Int e=0 ; e<2 ; e++ ) |
---|
1251 | { |
---|
1252 | for ( Int n=0 ; n<MAX_NUM_REF ; n++ ) |
---|
1253 | { |
---|
1254 | memcpy(m_weightPredTable[e][n], pSrc->m_weightPredTable[e][n], sizeof(wpScalingParam)*3 ); |
---|
1255 | } |
---|
1256 | } |
---|
1257 | m_saoEnabledFlag = pSrc->m_saoEnabledFlag; |
---|
1258 | m_saoEnabledFlagChroma = pSrc->m_saoEnabledFlagChroma; |
---|
1259 | m_cabacInitFlag = pSrc->m_cabacInitFlag; |
---|
1260 | m_numEntryPointOffsets = pSrc->m_numEntryPointOffsets; |
---|
1261 | |
---|
1262 | m_bLMvdL1Zero = pSrc->m_bLMvdL1Zero; |
---|
1263 | m_LFCrossSliceBoundaryFlag = pSrc->m_LFCrossSliceBoundaryFlag; |
---|
1264 | m_enableTMVPFlag = pSrc->m_enableTMVPFlag; |
---|
1265 | m_maxNumMergeCand = pSrc->m_maxNumMergeCand; |
---|
1266 | } |
---|
1267 | |
---|
1268 | Int TComSlice::m_prevTid0POC = 0; |
---|
1269 | |
---|
1270 | /** Function for setting the slice's temporal layer ID and corresponding temporal_layer_switching_point_flag. |
---|
1271 | * \param uiTLayer Temporal layer ID of the current slice |
---|
1272 | * The decoder calls this function to set temporal_layer_switching_point_flag for each temporal layer based on |
---|
1273 | * the SPS's temporal_id_nesting_flag and the parsed PPS. Then, current slice's temporal layer ID and |
---|
1274 | * temporal_layer_switching_point_flag is set accordingly. |
---|
1275 | */ |
---|
1276 | Void TComSlice::setTLayerInfo( UInt uiTLayer ) |
---|
1277 | { |
---|
1278 | m_uiTLayer = uiTLayer; |
---|
1279 | } |
---|
1280 | |
---|
1281 | /** Function for checking if this is a switching-point |
---|
1282 | */ |
---|
1283 | Bool TComSlice::isTemporalLayerSwitchingPoint( TComList<TComPic*>& rcListPic ) |
---|
1284 | { |
---|
1285 | TComPic* rpcPic; |
---|
1286 | // loop through all pictures in the reference picture buffer |
---|
1287 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
1288 | while ( iterPic != rcListPic.end()) |
---|
1289 | { |
---|
1290 | rpcPic = *(iterPic++); |
---|
1291 | if(rpcPic->getSlice(0)->isReferenced() && rpcPic->getPOC() != getPOC()) |
---|
1292 | { |
---|
1293 | if(rpcPic->getTLayer() >= getTLayer()) |
---|
1294 | { |
---|
1295 | return false; |
---|
1296 | } |
---|
1297 | } |
---|
1298 | } |
---|
1299 | return true; |
---|
1300 | } |
---|
1301 | |
---|
1302 | /** Function for checking if this is a STSA candidate |
---|
1303 | */ |
---|
1304 | Bool TComSlice::isStepwiseTemporalLayerSwitchingPointCandidate( TComList<TComPic*>& rcListPic ) |
---|
1305 | { |
---|
1306 | TComPic* rpcPic; |
---|
1307 | |
---|
1308 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
1309 | while ( iterPic != rcListPic.end()) |
---|
1310 | { |
---|
1311 | rpcPic = *(iterPic++); |
---|
1312 | if(rpcPic->getSlice(0)->isReferenced() && (rpcPic->getUsedByCurr()==true) && rpcPic->getPOC() != getPOC()) |
---|
1313 | { |
---|
1314 | if(rpcPic->getTLayer() >= getTLayer()) |
---|
1315 | { |
---|
1316 | return false; |
---|
1317 | } |
---|
1318 | } |
---|
1319 | } |
---|
1320 | return true; |
---|
1321 | } |
---|
1322 | |
---|
1323 | |
---|
1324 | Void TComSlice::checkLeadingPictureRestrictions(TComList<TComPic*>& rcListPic) |
---|
1325 | { |
---|
1326 | TComPic* rpcPic; |
---|
1327 | |
---|
1328 | Int nalUnitType = this->getNalUnitType(); |
---|
1329 | |
---|
1330 | // When a picture is a leading picture, it shall be a RADL or RASL picture. |
---|
1331 | if(this->getAssociatedIRAPPOC() > this->getPOC()) |
---|
1332 | { |
---|
1333 | // Do not check IRAP pictures since they may get a POC lower than their associated IRAP |
---|
1334 | if(nalUnitType < NAL_UNIT_CODED_SLICE_BLA_W_LP || |
---|
1335 | nalUnitType > NAL_UNIT_RESERVED_IRAP_VCL23) |
---|
1336 | { |
---|
1337 | assert(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || |
---|
1338 | nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R || |
---|
1339 | nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N || |
---|
1340 | nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R); |
---|
1341 | } |
---|
1342 | } |
---|
1343 | |
---|
1344 | // When a picture is a trailing picture, it shall not be a RADL or RASL picture. |
---|
1345 | if(this->getAssociatedIRAPPOC() < this->getPOC()) |
---|
1346 | { |
---|
1347 | assert(nalUnitType != NAL_UNIT_CODED_SLICE_RASL_N && |
---|
1348 | nalUnitType != NAL_UNIT_CODED_SLICE_RASL_R && |
---|
1349 | nalUnitType != NAL_UNIT_CODED_SLICE_RADL_N && |
---|
1350 | nalUnitType != NAL_UNIT_CODED_SLICE_RADL_R); |
---|
1351 | } |
---|
1352 | |
---|
1353 | // No RASL pictures shall be present in the bitstream that are associated |
---|
1354 | // with a BLA picture having nal_unit_type equal to BLA_W_RADL or BLA_N_LP. |
---|
1355 | if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || |
---|
1356 | nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R) |
---|
1357 | { |
---|
1358 | assert(this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_BLA_W_RADL && |
---|
1359 | this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_BLA_N_LP); |
---|
1360 | } |
---|
1361 | |
---|
1362 | // No RASL pictures shall be present in the bitstream that are associated with |
---|
1363 | // an IDR picture. |
---|
1364 | if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || |
---|
1365 | nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R) |
---|
1366 | { |
---|
1367 | assert(this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_IDR_N_LP && |
---|
1368 | this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_IDR_W_RADL); |
---|
1369 | } |
---|
1370 | |
---|
1371 | // No RADL pictures shall be present in the bitstream that are associated with |
---|
1372 | // a BLA picture having nal_unit_type equal to BLA_N_LP or that are associated |
---|
1373 | // with an IDR picture having nal_unit_type equal to IDR_N_LP. |
---|
1374 | if(nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N || |
---|
1375 | nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R) |
---|
1376 | { |
---|
1377 | assert(this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_BLA_N_LP && |
---|
1378 | this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_IDR_N_LP); |
---|
1379 | } |
---|
1380 | |
---|
1381 | // loop through all pictures in the reference picture buffer |
---|
1382 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
1383 | while ( iterPic != rcListPic.end()) |
---|
1384 | { |
---|
1385 | rpcPic = *(iterPic++); |
---|
1386 | #if BUGFIX_INTRAPERIOD |
---|
1387 | if(!rpcPic->getReconMark()) |
---|
1388 | { |
---|
1389 | continue; |
---|
1390 | } |
---|
1391 | #endif |
---|
1392 | if (rpcPic->getPOC() == this->getPOC()) |
---|
1393 | { |
---|
1394 | continue; |
---|
1395 | } |
---|
1396 | |
---|
1397 | // Any picture that has PicOutputFlag equal to 1 that precedes an IRAP picture |
---|
1398 | // in decoding order shall precede the IRAP picture in output order. |
---|
1399 | // (Note that any picture following in output order would be present in the DPB) |
---|
1400 | #if !SETTING_NO_OUT_PIC_PRIOR |
---|
1401 | if(rpcPic->getSlice(0)->getPicOutputFlag() == 1) |
---|
1402 | #else |
---|
1403 | if(rpcPic->getSlice(0)->getPicOutputFlag() == 1 && !this->getNoOutputPriorPicsFlag()) |
---|
1404 | #endif |
---|
1405 | { |
---|
1406 | if(nalUnitType == NAL_UNIT_CODED_SLICE_BLA_N_LP || |
---|
1407 | nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_LP || |
---|
1408 | nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_RADL || |
---|
1409 | nalUnitType == NAL_UNIT_CODED_SLICE_CRA || |
---|
1410 | nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP || |
---|
1411 | nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL) |
---|
1412 | { |
---|
1413 | assert(rpcPic->getPOC() < this->getPOC()); |
---|
1414 | } |
---|
1415 | } |
---|
1416 | |
---|
1417 | // Any picture that has PicOutputFlag equal to 1 that precedes an IRAP picture |
---|
1418 | // in decoding order shall precede any RADL picture associated with the IRAP |
---|
1419 | // picture in output order. |
---|
1420 | if(rpcPic->getSlice(0)->getPicOutputFlag() == 1) |
---|
1421 | { |
---|
1422 | if((nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N || |
---|
1423 | nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R)) |
---|
1424 | { |
---|
1425 | // rpcPic precedes the IRAP in decoding order |
---|
1426 | if(this->getAssociatedIRAPPOC() > rpcPic->getSlice(0)->getAssociatedIRAPPOC()) |
---|
1427 | { |
---|
1428 | // rpcPic must not be the IRAP picture |
---|
1429 | if(this->getAssociatedIRAPPOC() != rpcPic->getPOC()) |
---|
1430 | { |
---|
1431 | assert(rpcPic->getPOC() < this->getPOC()); |
---|
1432 | } |
---|
1433 | } |
---|
1434 | } |
---|
1435 | } |
---|
1436 | |
---|
1437 | // When a picture is a leading picture, it shall precede, in decoding order, |
---|
1438 | // all trailing pictures that are associated with the same IRAP picture. |
---|
1439 | if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || |
---|
1440 | nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R || |
---|
1441 | nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N || |
---|
1442 | nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R) |
---|
1443 | { |
---|
1444 | if(rpcPic->getSlice(0)->getAssociatedIRAPPOC() == this->getAssociatedIRAPPOC()) |
---|
1445 | { |
---|
1446 | // rpcPic is a picture that preceded the leading in decoding order since it exist in the DPB |
---|
1447 | // rpcPic would violate the constraint if it was a trailing picture |
---|
1448 | assert(rpcPic->getPOC() <= this->getAssociatedIRAPPOC()); |
---|
1449 | } |
---|
1450 | } |
---|
1451 | |
---|
1452 | // Any RASL picture associated with a CRA or BLA picture shall precede any |
---|
1453 | // RADL picture associated with the CRA or BLA picture in output order |
---|
1454 | if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || |
---|
1455 | nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R) |
---|
1456 | { |
---|
1457 | if((this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_BLA_N_LP || |
---|
1458 | this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_BLA_W_LP || |
---|
1459 | this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL || |
---|
1460 | this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_CRA) && |
---|
1461 | this->getAssociatedIRAPPOC() == rpcPic->getSlice(0)->getAssociatedIRAPPOC()) |
---|
1462 | { |
---|
1463 | if(rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_N || |
---|
1464 | rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_R) |
---|
1465 | { |
---|
1466 | assert(rpcPic->getPOC() > this->getPOC()); |
---|
1467 | } |
---|
1468 | } |
---|
1469 | } |
---|
1470 | |
---|
1471 | // Any RASL picture associated with a CRA picture shall follow, in output |
---|
1472 | // order, any IRAP picture that precedes the CRA picture in decoding order. |
---|
1473 | if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || |
---|
1474 | nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R) |
---|
1475 | { |
---|
1476 | if(this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_CRA) |
---|
1477 | { |
---|
1478 | if(rpcPic->getSlice(0)->getPOC() < this->getAssociatedIRAPPOC() && |
---|
1479 | (rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP || |
---|
1480 | rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP || |
---|
1481 | rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL || |
---|
1482 | rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP || |
---|
1483 | rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || |
---|
1484 | rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA)) |
---|
1485 | { |
---|
1486 | assert(this->getPOC() > rpcPic->getSlice(0)->getPOC()); |
---|
1487 | } |
---|
1488 | } |
---|
1489 | } |
---|
1490 | } |
---|
1491 | } |
---|
1492 | |
---|
1493 | |
---|
1494 | |
---|
1495 | /** Function for applying picture marking based on the Reference Picture Set in pReferencePictureSet. |
---|
1496 | */ |
---|
1497 | Void TComSlice::applyReferencePictureSet( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet) |
---|
1498 | { |
---|
1499 | TComPic* rpcPic; |
---|
1500 | Int i, isReference; |
---|
1501 | |
---|
1502 | #if !ALIGNED_BUMPING |
---|
1503 | checkLeadingPictureRestrictions(rcListPic); |
---|
1504 | #endif |
---|
1505 | |
---|
1506 | // loop through all pictures in the reference picture buffer |
---|
1507 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
1508 | while ( iterPic != rcListPic.end()) |
---|
1509 | { |
---|
1510 | rpcPic = *(iterPic++); |
---|
1511 | |
---|
1512 | if(!rpcPic->getSlice( 0 )->isReferenced()) |
---|
1513 | { |
---|
1514 | continue; |
---|
1515 | } |
---|
1516 | |
---|
1517 | isReference = 0; |
---|
1518 | // loop through all pictures in the Reference Picture Set |
---|
1519 | // to see if the picture should be kept as reference picture |
---|
1520 | for(i=0;i<pReferencePictureSet->getNumberOfPositivePictures()+pReferencePictureSet->getNumberOfNegativePictures();i++) |
---|
1521 | { |
---|
1522 | if(!rpcPic->getIsLongTerm() && rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getPOC() + pReferencePictureSet->getDeltaPOC(i)) |
---|
1523 | { |
---|
1524 | isReference = 1; |
---|
1525 | rpcPic->setUsedByCurr(pReferencePictureSet->getUsed(i)); |
---|
1526 | rpcPic->setIsLongTerm(0); |
---|
1527 | } |
---|
1528 | } |
---|
1529 | for(;i<pReferencePictureSet->getNumberOfPictures();i++) |
---|
1530 | { |
---|
1531 | if(pReferencePictureSet->getCheckLTMSBPresent(i)==true) |
---|
1532 | { |
---|
1533 | if(rpcPic->getIsLongTerm() && (rpcPic->getPicSym()->getSlice(0)->getPOC()) == pReferencePictureSet->getPOC(i)) |
---|
1534 | { |
---|
1535 | isReference = 1; |
---|
1536 | rpcPic->setUsedByCurr(pReferencePictureSet->getUsed(i)); |
---|
1537 | } |
---|
1538 | } |
---|
1539 | else |
---|
1540 | { |
---|
1541 | Int pocCycle = 1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC(); |
---|
1542 | Int curPoc = rpcPic->getPicSym()->getSlice(0)->getPOC() & (pocCycle-1); |
---|
1543 | Int refPoc = pReferencePictureSet->getPOC(i) & (pocCycle-1); |
---|
1544 | if(rpcPic->getIsLongTerm() && curPoc == refPoc) |
---|
1545 | { |
---|
1546 | isReference = 1; |
---|
1547 | rpcPic->setUsedByCurr(pReferencePictureSet->getUsed(i)); |
---|
1548 | } |
---|
1549 | } |
---|
1550 | |
---|
1551 | } |
---|
1552 | #if DISCARDABLE_PIC_RPS |
---|
1553 | if( isReference ) // Current picture is in the temporal RPS |
---|
1554 | { |
---|
1555 | assert( rpcPic->getSlice(0)->getDiscardableFlag() == 0 ); // Temporal RPS shall not contain picture with discardable_flag equal to 1 |
---|
1556 | } |
---|
1557 | #endif |
---|
1558 | // mark the picture as "unused for reference" if it is not in |
---|
1559 | // the Reference Picture Set |
---|
1560 | if(rpcPic->getPicSym()->getSlice(0)->getPOC() != this->getPOC() && isReference == 0) |
---|
1561 | { |
---|
1562 | rpcPic->getSlice( 0 )->setReferenced( false ); |
---|
1563 | rpcPic->setUsedByCurr(0); |
---|
1564 | rpcPic->setIsLongTerm(0); |
---|
1565 | } |
---|
1566 | //check that pictures of higher temporal layers are not used |
---|
1567 | assert(rpcPic->getSlice( 0 )->isReferenced()==0||rpcPic->getUsedByCurr()==0||rpcPic->getTLayer()<=this->getTLayer()); |
---|
1568 | //check that pictures of higher or equal temporal layer are not in the RPS if the current picture is a TSA picture |
---|
1569 | if(this->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_R || this->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N) |
---|
1570 | { |
---|
1571 | assert(rpcPic->getSlice( 0 )->isReferenced()==0||rpcPic->getTLayer()<this->getTLayer()); |
---|
1572 | } |
---|
1573 | //check that pictures marked as temporal layer non-reference pictures are not used for reference |
---|
1574 | if(rpcPic->getPicSym()->getSlice(0)->getPOC() != this->getPOC() && rpcPic->getTLayer()==this->getTLayer()) |
---|
1575 | { |
---|
1576 | assert(rpcPic->getSlice( 0 )->isReferenced()==0||rpcPic->getUsedByCurr()==0||rpcPic->getSlice( 0 )->getTemporalLayerNonReferenceFlag()==false); |
---|
1577 | } |
---|
1578 | } |
---|
1579 | } |
---|
1580 | |
---|
1581 | /** Function for applying picture marking based on the Reference Picture Set in pReferencePictureSet. |
---|
1582 | */ |
---|
1583 | #if ALLOW_RECOVERY_POINT_AS_RAP |
---|
1584 | Int TComSlice::checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool printErrors, Int pocRandomAccess, Bool bUseRecoveryPoint) |
---|
1585 | #else |
---|
1586 | Int TComSlice::checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool printErrors, Int pocRandomAccess) |
---|
1587 | #endif |
---|
1588 | { |
---|
1589 | #if ALLOW_RECOVERY_POINT_AS_RAP |
---|
1590 | Int atLeastOneUnabledByRecoveryPoint = 0; |
---|
1591 | Int atLeastOneFlushedByPreviousIDR = 0; |
---|
1592 | #endif |
---|
1593 | TComPic* rpcPic; |
---|
1594 | Int i, isAvailable; |
---|
1595 | Int atLeastOneLost = 0; |
---|
1596 | Int atLeastOneRemoved = 0; |
---|
1597 | Int iPocLost = 0; |
---|
1598 | |
---|
1599 | // loop through all long-term pictures in the Reference Picture Set |
---|
1600 | // to see if the picture should be kept as reference picture |
---|
1601 | for(i=pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures();i<pReferencePictureSet->getNumberOfPictures();i++) |
---|
1602 | { |
---|
1603 | isAvailable = 0; |
---|
1604 | // loop through all pictures in the reference picture buffer |
---|
1605 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
1606 | while ( iterPic != rcListPic.end()) |
---|
1607 | { |
---|
1608 | rpcPic = *(iterPic++); |
---|
1609 | if(pReferencePictureSet->getCheckLTMSBPresent(i)==true) |
---|
1610 | { |
---|
1611 | if(rpcPic->getIsLongTerm() && (rpcPic->getPicSym()->getSlice(0)->getPOC()) == pReferencePictureSet->getPOC(i) && rpcPic->getSlice(0)->isReferenced()) |
---|
1612 | { |
---|
1613 | #if ALLOW_RECOVERY_POINT_AS_RAP |
---|
1614 | if(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + pReferencePictureSet->getDeltaPOC(i) < pocRandomAccess) |
---|
1615 | { |
---|
1616 | isAvailable = 0; |
---|
1617 | } |
---|
1618 | else |
---|
1619 | { |
---|
1620 | isAvailable = 1; |
---|
1621 | } |
---|
1622 | #else |
---|
1623 | isAvailable = 1; |
---|
1624 | #endif |
---|
1625 | } |
---|
1626 | } |
---|
1627 | else |
---|
1628 | { |
---|
1629 | Int pocCycle = 1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC(); |
---|
1630 | Int curPoc = rpcPic->getPicSym()->getSlice(0)->getPOC() & (pocCycle-1); |
---|
1631 | Int refPoc = pReferencePictureSet->getPOC(i) & (pocCycle-1); |
---|
1632 | if(rpcPic->getIsLongTerm() && curPoc == refPoc && rpcPic->getSlice(0)->isReferenced()) |
---|
1633 | { |
---|
1634 | #if ALLOW_RECOVERY_POINT_AS_RAP |
---|
1635 | if(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + pReferencePictureSet->getDeltaPOC(i) < pocRandomAccess) |
---|
1636 | { |
---|
1637 | isAvailable = 0; |
---|
1638 | } |
---|
1639 | else |
---|
1640 | { |
---|
1641 | isAvailable = 1; |
---|
1642 | } |
---|
1643 | #else |
---|
1644 | isAvailable = 1; |
---|
1645 | #endif |
---|
1646 | } |
---|
1647 | } |
---|
1648 | } |
---|
1649 | // if there was no such long-term check the short terms |
---|
1650 | if(!isAvailable) |
---|
1651 | { |
---|
1652 | iterPic = rcListPic.begin(); |
---|
1653 | while ( iterPic != rcListPic.end()) |
---|
1654 | { |
---|
1655 | rpcPic = *(iterPic++); |
---|
1656 | |
---|
1657 | Int pocCycle = 1 << rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC(); |
---|
1658 | Int curPoc = rpcPic->getPicSym()->getSlice(0)->getPOC(); |
---|
1659 | Int refPoc = pReferencePictureSet->getPOC(i); |
---|
1660 | if (!pReferencePictureSet->getCheckLTMSBPresent(i)) |
---|
1661 | { |
---|
1662 | curPoc = curPoc & (pocCycle - 1); |
---|
1663 | refPoc = refPoc & (pocCycle - 1); |
---|
1664 | } |
---|
1665 | |
---|
1666 | if (rpcPic->getSlice(0)->isReferenced() && curPoc == refPoc) |
---|
1667 | { |
---|
1668 | #if ALLOW_RECOVERY_POINT_AS_RAP |
---|
1669 | if(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + pReferencePictureSet->getDeltaPOC(i) < pocRandomAccess) |
---|
1670 | { |
---|
1671 | isAvailable = 0; |
---|
1672 | } |
---|
1673 | else |
---|
1674 | { |
---|
1675 | isAvailable = 1; |
---|
1676 | rpcPic->setIsLongTerm(1); |
---|
1677 | break; |
---|
1678 | } |
---|
1679 | #else |
---|
1680 | isAvailable = 1; |
---|
1681 | rpcPic->setIsLongTerm(1); |
---|
1682 | break; |
---|
1683 | #endif |
---|
1684 | } |
---|
1685 | } |
---|
1686 | } |
---|
1687 | // report that a picture is lost if it is in the Reference Picture Set |
---|
1688 | // but not available as reference picture |
---|
1689 | if(isAvailable == 0) |
---|
1690 | { |
---|
1691 | if (this->getPOC() + pReferencePictureSet->getDeltaPOC(i) >= pocRandomAccess) |
---|
1692 | { |
---|
1693 | if(!pReferencePictureSet->getUsed(i) ) |
---|
1694 | { |
---|
1695 | if(printErrors) |
---|
1696 | { |
---|
1697 | printf("\nLong-term reference picture with POC = %3d seems to have been removed or not correctly decoded.", this->getPOC() + pReferencePictureSet->getDeltaPOC(i)); |
---|
1698 | } |
---|
1699 | atLeastOneRemoved = 1; |
---|
1700 | } |
---|
1701 | else |
---|
1702 | { |
---|
1703 | if(printErrors) |
---|
1704 | { |
---|
1705 | printf("\nLong-term reference picture with POC = %3d is lost or not correctly decoded!", this->getPOC() + pReferencePictureSet->getDeltaPOC(i)); |
---|
1706 | } |
---|
1707 | atLeastOneLost = 1; |
---|
1708 | iPocLost=this->getPOC() + pReferencePictureSet->getDeltaPOC(i); |
---|
1709 | } |
---|
1710 | } |
---|
1711 | #if ALLOW_RECOVERY_POINT_AS_RAP |
---|
1712 | else if(bUseRecoveryPoint && this->getPOC() > pocRandomAccess) |
---|
1713 | { |
---|
1714 | atLeastOneUnabledByRecoveryPoint = 1; |
---|
1715 | } |
---|
1716 | else if(bUseRecoveryPoint && (this->getAssociatedIRAPType()==NAL_UNIT_CODED_SLICE_IDR_N_LP || this->getAssociatedIRAPType()==NAL_UNIT_CODED_SLICE_IDR_W_RADL)) |
---|
1717 | { |
---|
1718 | atLeastOneFlushedByPreviousIDR = 1; |
---|
1719 | } |
---|
1720 | #endif |
---|
1721 | } |
---|
1722 | } |
---|
1723 | // loop through all short-term pictures in the Reference Picture Set |
---|
1724 | // to see if the picture should be kept as reference picture |
---|
1725 | for(i=0;i<pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures();i++) |
---|
1726 | { |
---|
1727 | isAvailable = 0; |
---|
1728 | // loop through all pictures in the reference picture buffer |
---|
1729 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
1730 | while ( iterPic != rcListPic.end()) |
---|
1731 | { |
---|
1732 | rpcPic = *(iterPic++); |
---|
1733 | |
---|
1734 | if(!rpcPic->getIsLongTerm() && rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getPOC() + pReferencePictureSet->getDeltaPOC(i) && rpcPic->getSlice(0)->isReferenced()) |
---|
1735 | { |
---|
1736 | #if ALLOW_RECOVERY_POINT_AS_RAP |
---|
1737 | if(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + pReferencePictureSet->getDeltaPOC(i) < pocRandomAccess) |
---|
1738 | { |
---|
1739 | isAvailable = 0; |
---|
1740 | } |
---|
1741 | else |
---|
1742 | { |
---|
1743 | isAvailable = 1; |
---|
1744 | } |
---|
1745 | #else |
---|
1746 | isAvailable = 1; |
---|
1747 | #endif |
---|
1748 | } |
---|
1749 | } |
---|
1750 | // report that a picture is lost if it is in the Reference Picture Set |
---|
1751 | // but not available as reference picture |
---|
1752 | if(isAvailable == 0) |
---|
1753 | { |
---|
1754 | if (this->getPOC() + pReferencePictureSet->getDeltaPOC(i) >= pocRandomAccess) |
---|
1755 | { |
---|
1756 | if(!pReferencePictureSet->getUsed(i) ) |
---|
1757 | { |
---|
1758 | if(printErrors) |
---|
1759 | { |
---|
1760 | printf("\nShort-term reference picture with POC = %3d seems to have been removed or not correctly decoded.", this->getPOC() + pReferencePictureSet->getDeltaPOC(i)); |
---|
1761 | } |
---|
1762 | atLeastOneRemoved = 1; |
---|
1763 | } |
---|
1764 | else |
---|
1765 | { |
---|
1766 | if(printErrors) |
---|
1767 | { |
---|
1768 | printf("\nShort-term reference picture with POC = %3d is lost or not correctly decoded!", this->getPOC() + pReferencePictureSet->getDeltaPOC(i)); |
---|
1769 | } |
---|
1770 | atLeastOneLost = 1; |
---|
1771 | iPocLost=this->getPOC() + pReferencePictureSet->getDeltaPOC(i); |
---|
1772 | } |
---|
1773 | } |
---|
1774 | #if ALLOW_RECOVERY_POINT_AS_RAP |
---|
1775 | else if(bUseRecoveryPoint && this->getPOC() > pocRandomAccess) |
---|
1776 | { |
---|
1777 | atLeastOneUnabledByRecoveryPoint = 1; |
---|
1778 | } |
---|
1779 | else if(bUseRecoveryPoint && (this->getAssociatedIRAPType()==NAL_UNIT_CODED_SLICE_IDR_N_LP || this->getAssociatedIRAPType()==NAL_UNIT_CODED_SLICE_IDR_W_RADL)) |
---|
1780 | { |
---|
1781 | atLeastOneFlushedByPreviousIDR = 1; |
---|
1782 | } |
---|
1783 | #endif |
---|
1784 | } |
---|
1785 | } |
---|
1786 | #if ALLOW_RECOVERY_POINT_AS_RAP |
---|
1787 | if(atLeastOneUnabledByRecoveryPoint || atLeastOneFlushedByPreviousIDR) |
---|
1788 | { |
---|
1789 | return -1; |
---|
1790 | } |
---|
1791 | #endif |
---|
1792 | if(atLeastOneLost) |
---|
1793 | { |
---|
1794 | return iPocLost+1; |
---|
1795 | } |
---|
1796 | if(atLeastOneRemoved) |
---|
1797 | { |
---|
1798 | return -2; |
---|
1799 | } |
---|
1800 | else |
---|
1801 | { |
---|
1802 | return 0; |
---|
1803 | } |
---|
1804 | } |
---|
1805 | |
---|
1806 | /** Function for constructing an explicit Reference Picture Set out of the available pictures in a referenced Reference Picture Set |
---|
1807 | */ |
---|
1808 | #if ALLOW_RECOVERY_POINT_AS_RAP |
---|
1809 | Void TComSlice::createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool isRAP, Int pocRandomAccess, Bool bUseRecoveryPoint) |
---|
1810 | #else |
---|
1811 | Void TComSlice::createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool isRAP) |
---|
1812 | #endif |
---|
1813 | { |
---|
1814 | TComPic* rpcPic; |
---|
1815 | Int i, j; |
---|
1816 | Int k = 0; |
---|
1817 | Int nrOfNegativePictures = 0; |
---|
1818 | Int nrOfPositivePictures = 0; |
---|
1819 | TComReferencePictureSet* pcRPS = this->getLocalRPS(); |
---|
1820 | |
---|
1821 | // loop through all pictures in the Reference Picture Set |
---|
1822 | for(i=0;i<pReferencePictureSet->getNumberOfPictures();i++) |
---|
1823 | { |
---|
1824 | j = 0; |
---|
1825 | // loop through all pictures in the reference picture buffer |
---|
1826 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
1827 | while ( iterPic != rcListPic.end()) |
---|
1828 | { |
---|
1829 | j++; |
---|
1830 | rpcPic = *(iterPic++); |
---|
1831 | |
---|
1832 | if(rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getPOC() + pReferencePictureSet->getDeltaPOC(i) && rpcPic->getSlice(0)->isReferenced()) |
---|
1833 | { |
---|
1834 | // This picture exists as a reference picture |
---|
1835 | // and should be added to the explicit Reference Picture Set |
---|
1836 | pcRPS->setDeltaPOC(k, pReferencePictureSet->getDeltaPOC(i)); |
---|
1837 | pcRPS->setUsed(k, pReferencePictureSet->getUsed(i) && (!isRAP)); |
---|
1838 | #if ALLOW_RECOVERY_POINT_AS_RAP |
---|
1839 | pcRPS->setUsed(k, pcRPS->getUsed(k) && !(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + pReferencePictureSet->getDeltaPOC(i) < pocRandomAccess) ); |
---|
1840 | #endif |
---|
1841 | if(pcRPS->getDeltaPOC(k) < 0) |
---|
1842 | { |
---|
1843 | nrOfNegativePictures++; |
---|
1844 | } |
---|
1845 | else |
---|
1846 | { |
---|
1847 | nrOfPositivePictures++; |
---|
1848 | } |
---|
1849 | k++; |
---|
1850 | } |
---|
1851 | } |
---|
1852 | } |
---|
1853 | #if EFFICIENT_FIELD_IRAP |
---|
1854 | Bool useNewRPS = false; |
---|
1855 | // if current picture is complimentary field associated to IRAP, add the IRAP to its RPS. |
---|
1856 | if(m_pcPic->isField()) |
---|
1857 | { |
---|
1858 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
1859 | while ( iterPic != rcListPic.end()) |
---|
1860 | { |
---|
1861 | rpcPic = *(iterPic++); |
---|
1862 | if(rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getAssociatedIRAPPOC() && this->getAssociatedIRAPPOC() == this->getPOC()+1) |
---|
1863 | { |
---|
1864 | pcRPS->setDeltaPOC(k, 1); |
---|
1865 | pcRPS->setUsed(k, true); |
---|
1866 | nrOfPositivePictures++; |
---|
1867 | k ++; |
---|
1868 | useNewRPS = true; |
---|
1869 | } |
---|
1870 | } |
---|
1871 | } |
---|
1872 | #endif |
---|
1873 | pcRPS->setNumberOfNegativePictures(nrOfNegativePictures); |
---|
1874 | pcRPS->setNumberOfPositivePictures(nrOfPositivePictures); |
---|
1875 | pcRPS->setNumberOfPictures(nrOfNegativePictures+nrOfPositivePictures); |
---|
1876 | // This is a simplistic inter rps example. A smarter encoder will look for a better reference RPS to do the |
---|
1877 | // inter RPS prediction with. Here we just use the reference used by pReferencePictureSet. |
---|
1878 | // If pReferencePictureSet is not inter_RPS_predicted, then inter_RPS_prediction is for the current RPS also disabled. |
---|
1879 | if (!pReferencePictureSet->getInterRPSPrediction() |
---|
1880 | #if EFFICIENT_FIELD_IRAP |
---|
1881 | || useNewRPS |
---|
1882 | #endif |
---|
1883 | ) |
---|
1884 | { |
---|
1885 | pcRPS->setInterRPSPrediction(false); |
---|
1886 | pcRPS->setNumRefIdc(0); |
---|
1887 | } |
---|
1888 | else |
---|
1889 | { |
---|
1890 | Int rIdx = this->getRPSidx() - pReferencePictureSet->getDeltaRIdxMinus1() - 1; |
---|
1891 | Int deltaRPS = pReferencePictureSet->getDeltaRPS(); |
---|
1892 | TComReferencePictureSet* pcRefRPS = this->getSPS()->getRPSList()->getReferencePictureSet(rIdx); |
---|
1893 | Int iRefPics = pcRefRPS->getNumberOfPictures(); |
---|
1894 | Int iNewIdc=0; |
---|
1895 | for(i=0; i<= iRefPics; i++) |
---|
1896 | { |
---|
1897 | Int deltaPOC = ((i != iRefPics)? pcRefRPS->getDeltaPOC(i) : 0); // check if the reference abs POC is >= 0 |
---|
1898 | Int iRefIdc = 0; |
---|
1899 | for (j=0; j < pcRPS->getNumberOfPictures(); j++) // loop through the pictures in the new RPS |
---|
1900 | { |
---|
1901 | if ( (deltaPOC + deltaRPS) == pcRPS->getDeltaPOC(j)) |
---|
1902 | { |
---|
1903 | if (pcRPS->getUsed(j)) |
---|
1904 | { |
---|
1905 | iRefIdc = 1; |
---|
1906 | } |
---|
1907 | else |
---|
1908 | { |
---|
1909 | iRefIdc = 2; |
---|
1910 | } |
---|
1911 | } |
---|
1912 | } |
---|
1913 | pcRPS->setRefIdc(i, iRefIdc); |
---|
1914 | iNewIdc++; |
---|
1915 | } |
---|
1916 | pcRPS->setInterRPSPrediction(true); |
---|
1917 | pcRPS->setNumRefIdc(iNewIdc); |
---|
1918 | pcRPS->setDeltaRPS(deltaRPS); |
---|
1919 | pcRPS->setDeltaRIdxMinus1(pReferencePictureSet->getDeltaRIdxMinus1() + this->getSPS()->getRPSList()->getNumberOfReferencePictureSets() - this->getRPSidx()); |
---|
1920 | } |
---|
1921 | |
---|
1922 | this->setRPS(pcRPS); |
---|
1923 | this->setRPSidx(-1); |
---|
1924 | } |
---|
1925 | |
---|
1926 | /** get AC and DC values for weighted pred |
---|
1927 | * \param *wp |
---|
1928 | * \returns Void |
---|
1929 | */ |
---|
1930 | Void TComSlice::getWpAcDcParam(wpACDCParam *&wp) |
---|
1931 | { |
---|
1932 | wp = m_weightACDCParam; |
---|
1933 | } |
---|
1934 | |
---|
1935 | /** init AC and DC values for weighted pred |
---|
1936 | * \returns Void |
---|
1937 | */ |
---|
1938 | Void TComSlice::initWpAcDcParam() |
---|
1939 | { |
---|
1940 | for(Int iComp = 0; iComp < 3; iComp++ ) |
---|
1941 | { |
---|
1942 | m_weightACDCParam[iComp].iAC = 0; |
---|
1943 | m_weightACDCParam[iComp].iDC = 0; |
---|
1944 | } |
---|
1945 | } |
---|
1946 | |
---|
1947 | /** get WP tables for weighted pred |
---|
1948 | * \param RefPicList |
---|
1949 | * \param iRefIdx |
---|
1950 | * \param *&wpScalingParam |
---|
1951 | * \returns Void |
---|
1952 | */ |
---|
1953 | Void TComSlice::getWpScaling( RefPicList e, Int iRefIdx, wpScalingParam *&wp ) |
---|
1954 | { |
---|
1955 | wp = m_weightPredTable[e][iRefIdx]; |
---|
1956 | } |
---|
1957 | |
---|
1958 | /** reset Default WP tables settings : no weight. |
---|
1959 | * \param wpScalingParam |
---|
1960 | * \returns Void |
---|
1961 | */ |
---|
1962 | Void TComSlice::resetWpScaling() |
---|
1963 | { |
---|
1964 | for ( Int e=0 ; e<2 ; e++ ) |
---|
1965 | { |
---|
1966 | for ( Int i=0 ; i<MAX_NUM_REF ; i++ ) |
---|
1967 | { |
---|
1968 | for ( Int yuv=0 ; yuv<3 ; yuv++ ) |
---|
1969 | { |
---|
1970 | wpScalingParam *pwp = &(m_weightPredTable[e][i][yuv]); |
---|
1971 | pwp->bPresentFlag = false; |
---|
1972 | pwp->uiLog2WeightDenom = 0; |
---|
1973 | pwp->uiLog2WeightDenom = 0; |
---|
1974 | pwp->iWeight = 1; |
---|
1975 | pwp->iOffset = 0; |
---|
1976 | } |
---|
1977 | } |
---|
1978 | } |
---|
1979 | } |
---|
1980 | |
---|
1981 | /** init WP table |
---|
1982 | * \returns Void |
---|
1983 | */ |
---|
1984 | Void TComSlice::initWpScaling() |
---|
1985 | { |
---|
1986 | for ( Int e=0 ; e<2 ; e++ ) |
---|
1987 | { |
---|
1988 | for ( Int i=0 ; i<MAX_NUM_REF ; i++ ) |
---|
1989 | { |
---|
1990 | for ( Int yuv=0 ; yuv<3 ; yuv++ ) |
---|
1991 | { |
---|
1992 | wpScalingParam *pwp = &(m_weightPredTable[e][i][yuv]); |
---|
1993 | if ( !pwp->bPresentFlag ) |
---|
1994 | { |
---|
1995 | // Inferring values not present : |
---|
1996 | pwp->iWeight = (1 << pwp->uiLog2WeightDenom); |
---|
1997 | pwp->iOffset = 0; |
---|
1998 | } |
---|
1999 | |
---|
2000 | pwp->w = pwp->iWeight; |
---|
2001 | Int bitDepth = yuv ? g_bitDepthC : g_bitDepthY; |
---|
2002 | pwp->o = pwp->iOffset << (bitDepth-8); |
---|
2003 | pwp->shift = pwp->uiLog2WeightDenom; |
---|
2004 | pwp->round = (pwp->uiLog2WeightDenom>=1) ? (1 << (pwp->uiLog2WeightDenom-1)) : (0); |
---|
2005 | } |
---|
2006 | } |
---|
2007 | } |
---|
2008 | } |
---|
2009 | |
---|
2010 | #if REPN_FORMAT_IN_VPS |
---|
2011 | UInt TComSlice::getPicWidthInLumaSamples() |
---|
2012 | { |
---|
2013 | TComSPS *sps = getSPS(); |
---|
2014 | TComVPS *vps = getVPS(); |
---|
2015 | UInt retVal, layerId = getLayerId(); |
---|
2016 | #if O0096_REP_FORMAT_INDEX |
---|
2017 | if ( layerId == 0 ) |
---|
2018 | { |
---|
2019 | retVal = sps->getPicWidthInLumaSamples(); |
---|
2020 | } |
---|
2021 | else |
---|
2022 | { |
---|
2023 | retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : layerId) )->getPicWidthVpsInLumaSamples(); |
---|
2024 | } |
---|
2025 | #else |
---|
2026 | if( ( layerId == 0 ) || sps->getUpdateRepFormatFlag() ) |
---|
2027 | { |
---|
2028 | retVal = sps->getPicWidthInLumaSamples(); |
---|
2029 | } |
---|
2030 | else |
---|
2031 | { |
---|
2032 | retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getPicWidthVpsInLumaSamples(); |
---|
2033 | } |
---|
2034 | #endif |
---|
2035 | return retVal; |
---|
2036 | } |
---|
2037 | UInt TComSlice::getPicHeightInLumaSamples() |
---|
2038 | { |
---|
2039 | TComSPS *sps = getSPS(); |
---|
2040 | TComVPS *vps = getVPS(); |
---|
2041 | UInt retVal, layerId = getLayerId(); |
---|
2042 | #if O0096_REP_FORMAT_INDEX |
---|
2043 | if( layerId == 0 ) |
---|
2044 | { |
---|
2045 | retVal = sps->getPicHeightInLumaSamples(); |
---|
2046 | } |
---|
2047 | else |
---|
2048 | { |
---|
2049 | retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : layerId) )->getPicHeightVpsInLumaSamples(); |
---|
2050 | } |
---|
2051 | #else |
---|
2052 | if( ( layerId == 0 ) || sps->getUpdateRepFormatFlag() ) |
---|
2053 | { |
---|
2054 | retVal = sps->getPicHeightInLumaSamples(); |
---|
2055 | } |
---|
2056 | else |
---|
2057 | { |
---|
2058 | retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getPicHeightVpsInLumaSamples(); |
---|
2059 | } |
---|
2060 | #endif |
---|
2061 | return retVal; |
---|
2062 | } |
---|
2063 | #if AUXILIARY_PICTURES |
---|
2064 | ChromaFormat TComSlice::getChromaFormatIdc() |
---|
2065 | #else |
---|
2066 | UInt TComSlice::getChromaFormatIdc() |
---|
2067 | #endif |
---|
2068 | { |
---|
2069 | TComSPS *sps = getSPS(); |
---|
2070 | TComVPS *vps = getVPS(); |
---|
2071 | #if AUXILIARY_PICTURES |
---|
2072 | ChromaFormat retVal; |
---|
2073 | UInt layerId = getLayerId(); |
---|
2074 | #else |
---|
2075 | UInt retVal, layerId = getLayerId(); |
---|
2076 | #endif |
---|
2077 | #if O0096_REP_FORMAT_INDEX |
---|
2078 | if( layerId == 0 ) |
---|
2079 | { |
---|
2080 | retVal = sps->getChromaFormatIdc(); |
---|
2081 | } |
---|
2082 | else |
---|
2083 | { |
---|
2084 | retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : layerId) )->getChromaFormatVpsIdc(); |
---|
2085 | } |
---|
2086 | #else |
---|
2087 | if( ( layerId == 0 ) || sps->getUpdateRepFormatFlag() ) |
---|
2088 | { |
---|
2089 | retVal = sps->getChromaFormatIdc(); |
---|
2090 | } |
---|
2091 | else |
---|
2092 | { |
---|
2093 | retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getChromaFormatVpsIdc(); |
---|
2094 | } |
---|
2095 | #endif |
---|
2096 | return retVal; |
---|
2097 | } |
---|
2098 | UInt TComSlice::getBitDepthY() |
---|
2099 | { |
---|
2100 | TComSPS *sps = getSPS(); |
---|
2101 | TComVPS *vps = getVPS(); |
---|
2102 | UInt retVal, layerId = getLayerId(); |
---|
2103 | #if O0096_REP_FORMAT_INDEX |
---|
2104 | if( layerId == 0 ) |
---|
2105 | { |
---|
2106 | retVal = sps->getBitDepthY(); |
---|
2107 | } |
---|
2108 | else |
---|
2109 | { |
---|
2110 | retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : layerId) )->getBitDepthVpsLuma(); |
---|
2111 | } |
---|
2112 | #else |
---|
2113 | if( ( layerId == 0 ) || sps->getUpdateRepFormatFlag() ) |
---|
2114 | { |
---|
2115 | retVal = sps->getBitDepthY(); |
---|
2116 | } |
---|
2117 | else |
---|
2118 | { |
---|
2119 | retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getBitDepthVpsLuma(); |
---|
2120 | } |
---|
2121 | #endif |
---|
2122 | return retVal; |
---|
2123 | } |
---|
2124 | UInt TComSlice::getBitDepthC() |
---|
2125 | { |
---|
2126 | TComSPS *sps = getSPS(); |
---|
2127 | TComVPS *vps = getVPS(); |
---|
2128 | UInt retVal, layerId = getLayerId(); |
---|
2129 | #if O0096_REP_FORMAT_INDEX |
---|
2130 | if( layerId == 0 ) |
---|
2131 | { |
---|
2132 | retVal = sps->getBitDepthC(); |
---|
2133 | } |
---|
2134 | else |
---|
2135 | { |
---|
2136 | retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : layerId) )->getBitDepthVpsChroma(); |
---|
2137 | } |
---|
2138 | #else |
---|
2139 | if( ( layerId == 0 ) || sps->getUpdateRepFormatFlag() ) |
---|
2140 | { |
---|
2141 | retVal = sps->getBitDepthC(); |
---|
2142 | } |
---|
2143 | else |
---|
2144 | { |
---|
2145 | retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getBitDepthVpsChroma(); |
---|
2146 | } |
---|
2147 | #endif |
---|
2148 | return retVal; |
---|
2149 | } |
---|
2150 | Int TComSlice::getQpBDOffsetY() |
---|
2151 | { |
---|
2152 | return (getBitDepthY() - 8) * 6; |
---|
2153 | } |
---|
2154 | Int TComSlice::getQpBDOffsetC() |
---|
2155 | { |
---|
2156 | return (getBitDepthC() - 8) * 6; |
---|
2157 | } |
---|
2158 | |
---|
2159 | RepFormat::RepFormat() |
---|
2160 | #if AUXILIARY_PICTURES |
---|
2161 | : m_chromaFormatVpsIdc (CHROMA_420) |
---|
2162 | #else |
---|
2163 | : m_chromaFormatVpsIdc (0) |
---|
2164 | #endif |
---|
2165 | , m_separateColourPlaneVpsFlag (false) |
---|
2166 | , m_picWidthVpsInLumaSamples (0) |
---|
2167 | , m_picHeightVpsInLumaSamples (0) |
---|
2168 | , m_bitDepthVpsLuma (0) |
---|
2169 | , m_bitDepthVpsChroma (0) |
---|
2170 | {} |
---|
2171 | #if RESOLUTION_BASED_DPB |
---|
2172 | Void RepFormat::init() |
---|
2173 | { |
---|
2174 | m_chromaFormatVpsIdc = CHROMA_420; |
---|
2175 | m_separateColourPlaneVpsFlag = false; |
---|
2176 | m_picWidthVpsInLumaSamples = 0; |
---|
2177 | m_picHeightVpsInLumaSamples = 0; |
---|
2178 | m_bitDepthVpsLuma = 0; |
---|
2179 | m_bitDepthVpsChroma = 0; |
---|
2180 | } |
---|
2181 | #endif |
---|
2182 | #endif |
---|
2183 | |
---|
2184 | // ------------------------------------------------------------------------------------------------ |
---|
2185 | // Video parameter set (VPS) |
---|
2186 | // ------------------------------------------------------------------------------------------------ |
---|
2187 | #if SVC_EXTENSION |
---|
2188 | TComVPS::TComVPS() |
---|
2189 | : m_VPSId ( 0) |
---|
2190 | , m_uiMaxTLayers ( 1) |
---|
2191 | , m_uiMaxLayers ( 1) |
---|
2192 | , m_bTemporalIdNestingFlag (false) |
---|
2193 | , m_numHrdParameters ( 0) |
---|
2194 | #if !VPS_RENAME |
---|
2195 | , m_maxNuhReservedZeroLayerId ( 0) |
---|
2196 | #endif |
---|
2197 | , m_hrdParameters (NULL) |
---|
2198 | , m_hrdOpSetIdx (NULL) |
---|
2199 | , m_cprmsPresentFlag (NULL) |
---|
2200 | #if VPS_RENAME |
---|
2201 | , m_maxLayerId (0) |
---|
2202 | , m_numLayerSets (0) |
---|
2203 | #endif |
---|
2204 | #if VPS_EXTN_OP_LAYER_SETS |
---|
2205 | , m_numOutputLayerSets (0) |
---|
2206 | #endif |
---|
2207 | , m_numProfileTierLevel (0) |
---|
2208 | #if !VPS_EXTN_UEV_CODING |
---|
2209 | , m_moreOutputLayerSetsThanDefaultFlag (false) |
---|
2210 | #endif |
---|
2211 | , m_numAddOutputLayerSets (0) |
---|
2212 | #if P0295_DEFAULT_OUT_LAYER_IDC |
---|
2213 | , m_defaultTargetOutputLayerIdc (0) |
---|
2214 | #else |
---|
2215 | #if O0109_DEFAULT_ONE_OUT_LAYER_IDC |
---|
2216 | , m_defaultOneTargetOutputLayerIdc (0) |
---|
2217 | #else |
---|
2218 | , m_defaultOneTargetOutputLayerFlag (false) |
---|
2219 | #endif |
---|
2220 | #endif |
---|
2221 | #if VPS_VUI_BITRATE_PICRATE |
---|
2222 | , m_bitRatePresentVpsFlag (false) |
---|
2223 | , m_picRatePresentVpsFlag (false) |
---|
2224 | #endif |
---|
2225 | #if REPN_FORMAT_IN_VPS |
---|
2226 | #if Q0195_REP_FORMAT_CLEANUP |
---|
2227 | , m_repFormatIdxPresentFlag (false) |
---|
2228 | #else |
---|
2229 | , m_repFormatIdxPresentFlag (true) |
---|
2230 | #endif |
---|
2231 | , m_vpsNumRepFormats (1) |
---|
2232 | #endif |
---|
2233 | #if VIEW_ID_RELATED_SIGNALING |
---|
2234 | #if O0109_VIEW_ID_LEN |
---|
2235 | , m_viewIdLen (0) |
---|
2236 | #else |
---|
2237 | , m_viewIdLenMinus1 (0) |
---|
2238 | #endif |
---|
2239 | #endif |
---|
2240 | #if !P0307_REMOVE_VPS_VUI_OFFSET |
---|
2241 | #if VPS_VUI_OFFSET |
---|
2242 | , m_vpsVuiOffset (0) |
---|
2243 | #endif |
---|
2244 | #endif |
---|
2245 | #if P0307_VPS_NON_VUI_EXTENSION |
---|
2246 | , m_vpsNonVuiExtLength (0) |
---|
2247 | #endif |
---|
2248 | { |
---|
2249 | for( Int i = 0; i < MAX_TLAYER; i++) |
---|
2250 | { |
---|
2251 | m_numReorderPics[i] = 0; |
---|
2252 | m_uiMaxDecPicBuffering[i] = 1; |
---|
2253 | m_uiMaxLatencyIncrease[i] = 0; |
---|
2254 | } |
---|
2255 | #if VPS_EXTN_MASK_AND_DIM_INFO |
---|
2256 | m_avcBaseLayerFlag = false; |
---|
2257 | m_splittingFlag = false; |
---|
2258 | ::memset(m_scalabilityMask, 0, sizeof(m_scalabilityMask)); |
---|
2259 | ::memset(m_dimensionIdLen, 0, sizeof(m_dimensionIdLen)); |
---|
2260 | m_nuhLayerIdPresentFlag = false; |
---|
2261 | ::memset(m_layerIdInNuh, 0, sizeof(m_layerIdInNuh)); |
---|
2262 | ::memset(m_dimensionId, 0, sizeof(m_dimensionId)); |
---|
2263 | |
---|
2264 | m_numScalabilityTypes = 0; |
---|
2265 | ::memset(m_layerIdInVps, 0, sizeof(m_layerIdInVps)); |
---|
2266 | #endif |
---|
2267 | #if VPS_EXTN_PROFILE_INFO |
---|
2268 | ::memset(m_profilePresentFlag, 0, sizeof(m_profilePresentFlag)); |
---|
2269 | #if !P0048_REMOVE_PROFILE_REF |
---|
2270 | ::memset(m_profileLayerSetRef, 0, sizeof(m_profileLayerSetRef)); |
---|
2271 | #endif |
---|
2272 | #endif |
---|
2273 | #if VPS_EXTN_OP_LAYER_SETS |
---|
2274 | ::memset(m_layerIdIncludedFlag, 0, sizeof(m_layerIdIncludedFlag)); |
---|
2275 | // Consider dynamic allocation for outputLayerSetIdx and outputLayerFlag |
---|
2276 | ::memset(m_outputLayerSetIdx, 0, sizeof(m_outputLayerSetIdx)); |
---|
2277 | ::memset(m_outputLayerFlag, 0, sizeof(m_outputLayerFlag)); |
---|
2278 | #endif |
---|
2279 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
2280 | ::memset(m_directDependencyFlag, 0, sizeof(m_directDependencyFlag)); |
---|
2281 | ::memset(m_numDirectRefLayers, 0, sizeof(m_numDirectRefLayers )); |
---|
2282 | ::memset(m_refLayerId, 0, sizeof(m_refLayerId )); |
---|
2283 | m_directDepTypeLen = 2; |
---|
2284 | ::memset(m_directDependencyType, 0, sizeof(m_directDependencyType)); |
---|
2285 | #endif |
---|
2286 | #if DERIVE_LAYER_ID_LIST_VARIABLES |
---|
2287 | ::memset(m_layerSetLayerIdList, 0, sizeof(m_layerSetLayerIdList)); |
---|
2288 | ::memset(m_numLayerInIdList, 0, sizeof(m_numLayerInIdList )); |
---|
2289 | #endif |
---|
2290 | ::memset(m_profileLevelTierIdx, 0, sizeof(m_profileLevelTierIdx)); |
---|
2291 | m_maxOneActiveRefLayerFlag = true; |
---|
2292 | #if O0062_POC_LSB_NOT_PRESENT_FLAG |
---|
2293 | ::memset(m_pocLsbNotPresentFlag, 0, sizeof(m_pocLsbNotPresentFlag)); |
---|
2294 | #endif |
---|
2295 | #if O0223_PICTURE_TYPES_ALIGN_FLAG |
---|
2296 | m_crossLayerPictureTypeAlignFlag = true; |
---|
2297 | #endif |
---|
2298 | #if N0147_IRAP_ALIGN_FLAG |
---|
2299 | m_crossLayerIrapAlignFlag = true; |
---|
2300 | #endif |
---|
2301 | #if P0068_CROSS_LAYER_ALIGNED_IDR_ONLY_FOR_IRAP_FLAG |
---|
2302 | m_crossLayerAlignedIdrOnlyFlag = false; |
---|
2303 | #endif |
---|
2304 | #if N0120_MAX_TID_REF_PRESENT_FLAG |
---|
2305 | m_maxTidRefPresentFlag = true; |
---|
2306 | #endif |
---|
2307 | for( Int i = 0; i < MAX_VPS_LAYER_ID_PLUS1 - 1; i++) |
---|
2308 | { |
---|
2309 | #if O0225_MAX_TID_FOR_REF_LAYERS |
---|
2310 | for( Int j = 0; j < MAX_VPS_LAYER_ID_PLUS1; j++) |
---|
2311 | { |
---|
2312 | m_maxTidIlRefPicsPlus1[i][j] = m_uiMaxTLayers + 1; |
---|
2313 | } |
---|
2314 | #else |
---|
2315 | m_maxTidIlRefPicsPlus1[i] = m_uiMaxTLayers + 1; |
---|
2316 | #endif |
---|
2317 | } |
---|
2318 | #if VPS_VUI_TILES_NOT_IN_USE__FLAG |
---|
2319 | m_tilesNotInUseFlag = true; |
---|
2320 | ::memset(m_tilesInUseFlag, 0, sizeof(m_tilesInUseFlag)); |
---|
2321 | ::memset(m_loopFilterNotAcrossTilesFlag, 0, sizeof(m_loopFilterNotAcrossTilesFlag)); |
---|
2322 | #endif |
---|
2323 | #if TILE_BOUNDARY_ALIGNED_FLAG |
---|
2324 | ::memset(m_tileBoundariesAlignedFlag, 0, sizeof(m_tileBoundariesAlignedFlag)); |
---|
2325 | #endif |
---|
2326 | #if VPS_VUI_WPP_NOT_IN_USE__FLAG |
---|
2327 | m_wppNotInUseFlag = true; |
---|
2328 | ::memset(m_wppInUseFlag, 0, sizeof(m_wppInUseFlag)); |
---|
2329 | #endif |
---|
2330 | #if N0160_VUI_EXT_ILP_REF |
---|
2331 | m_ilpRestrictedRefLayersFlag = false; |
---|
2332 | ::memset(m_minSpatialSegmentOffsetPlus1, 0, sizeof(m_minSpatialSegmentOffsetPlus1)); |
---|
2333 | ::memset(m_ctuBasedOffsetEnabledFlag, 0, sizeof(m_ctuBasedOffsetEnabledFlag)); |
---|
2334 | ::memset(m_minHorizontalCtuOffsetPlus1, 0, sizeof(m_minHorizontalCtuOffsetPlus1)); |
---|
2335 | #endif |
---|
2336 | #if VPS_VUI_VIDEO_SIGNAL |
---|
2337 | m_vidSigPresentVpsFlag=true; |
---|
2338 | m_vpsVidSigInfo=1; |
---|
2339 | ::memset( m_vpsVidSigIdx, 0, sizeof(m_vpsVidSigIdx) ); |
---|
2340 | m_vpsVidSigIdx[0]=0; |
---|
2341 | for (Int i=0; i < 16; i++) |
---|
2342 | { |
---|
2343 | m_vpsVidFormat[i] = 5; |
---|
2344 | m_vpsFullRangeFlag[i] = false; |
---|
2345 | m_vpsColorPrimaries[i] = 2; |
---|
2346 | m_vpsTransChar[i] = 2; |
---|
2347 | m_vpsMatCoeff[i] = 2; |
---|
2348 | } |
---|
2349 | #endif |
---|
2350 | #if VPS_VUI_BITRATE_PICRATE |
---|
2351 | ::memset(m_bitRatePresentFlag, 0, sizeof(m_bitRatePresentFlag)); |
---|
2352 | ::memset(m_picRatePresentFlag, 0, sizeof(m_picRatePresentFlag)); |
---|
2353 | ::memset(m_avgBitRate , 0, sizeof(m_avgBitRate) ); |
---|
2354 | ::memset(m_maxBitRate , 0, sizeof(m_maxBitRate) ); |
---|
2355 | ::memset(m_constPicRateIdc , 0, sizeof(m_constPicRateIdc) ); |
---|
2356 | ::memset(m_avgPicRate , 0, sizeof(m_avgPicRate) ); |
---|
2357 | #endif |
---|
2358 | #if REPN_FORMAT_IN_VPS |
---|
2359 | ::memset( m_vpsRepFormatIdx, 0, sizeof(m_vpsRepFormatIdx) ); |
---|
2360 | #endif |
---|
2361 | #if VIEW_ID_RELATED_SIGNALING |
---|
2362 | ::memset(m_viewIdVal, 0, sizeof(m_viewIdVal)); |
---|
2363 | #endif |
---|
2364 | #if O0092_0094_DEPENDENCY_CONSTRAINT |
---|
2365 | for (Int i = 0; i < MAX_NUM_LAYER_IDS; i++) |
---|
2366 | { |
---|
2367 | m_numberRefLayers[i] = 0; |
---|
2368 | for (Int j = 0; j < MAX_NUM_LAYER_IDS; j++) |
---|
2369 | { |
---|
2370 | m_recursiveRefLayerFlag[i][j] = 0; |
---|
2371 | } |
---|
2372 | } |
---|
2373 | #endif |
---|
2374 | #if VPS_DPB_SIZE_TABLE |
---|
2375 | ::memset( m_subLayerFlagInfoPresentFlag, 0, sizeof(m_subLayerFlagInfoPresentFlag ) ); |
---|
2376 | ::memset( m_subLayerDpbInfoPresentFlag, 0, sizeof(m_subLayerDpbInfoPresentFlag ) ); |
---|
2377 | ::memset( m_maxVpsDecPicBufferingMinus1, 0, sizeof(m_maxVpsDecPicBufferingMinus1 ) ); |
---|
2378 | #if RESOLUTION_BASED_DPB |
---|
2379 | ::memset( m_maxVpsLayerDecPicBuffMinus1, 0, sizeof(m_maxVpsLayerDecPicBuffMinus1 ) ); |
---|
2380 | #endif |
---|
2381 | ::memset( m_maxVpsNumReorderPics, 0, sizeof(m_maxVpsNumReorderPics ) ); |
---|
2382 | ::memset( m_maxVpsLatencyIncreasePlus1, 0, sizeof(m_maxVpsLatencyIncreasePlus1 ) ); |
---|
2383 | ::memset( m_numSubDpbs , 0, sizeof(m_numSubDpbs) ); |
---|
2384 | #endif |
---|
2385 | } |
---|
2386 | #else |
---|
2387 | TComVPS::TComVPS() |
---|
2388 | : m_VPSId ( 0) |
---|
2389 | , m_uiMaxTLayers ( 1) |
---|
2390 | , m_uiMaxLayers ( 1) |
---|
2391 | , m_bTemporalIdNestingFlag (false) |
---|
2392 | , m_numHrdParameters ( 0) |
---|
2393 | , m_maxNuhReservedZeroLayerId ( 0) |
---|
2394 | , m_hrdParameters (NULL) |
---|
2395 | , m_hrdOpSetIdx (NULL) |
---|
2396 | , m_cprmsPresentFlag (NULL) |
---|
2397 | { |
---|
2398 | for( Int i = 0; i < MAX_TLAYER; i++) |
---|
2399 | { |
---|
2400 | m_numReorderPics[i] = 0; |
---|
2401 | m_uiMaxDecPicBuffering[i] = 1; |
---|
2402 | m_uiMaxLatencyIncrease[i] = 0; |
---|
2403 | } |
---|
2404 | } |
---|
2405 | #endif //SVC_EXTENSION |
---|
2406 | |
---|
2407 | TComVPS::~TComVPS() |
---|
2408 | { |
---|
2409 | if( m_hrdParameters != NULL ) delete[] m_hrdParameters; |
---|
2410 | if( m_hrdOpSetIdx != NULL ) delete[] m_hrdOpSetIdx; |
---|
2411 | if( m_cprmsPresentFlag != NULL ) delete[] m_cprmsPresentFlag; |
---|
2412 | } |
---|
2413 | #if DERIVE_LAYER_ID_LIST_VARIABLES |
---|
2414 | Void TComVPS::deriveLayerIdListVariables() |
---|
2415 | { |
---|
2416 | // For layer 0 |
---|
2417 | m_numLayerInIdList[0] = 1; |
---|
2418 | m_layerSetLayerIdList[0][0] = 0; |
---|
2419 | |
---|
2420 | // For other layers |
---|
2421 | Int i, m, n; |
---|
2422 | for( i = 1; i < m_numLayerSets; i++ ) |
---|
2423 | { |
---|
2424 | n = 0; |
---|
2425 | for( m = 0; m <= m_maxLayerId; m++) |
---|
2426 | { |
---|
2427 | if( m_layerIdIncludedFlag[i][m] ) |
---|
2428 | { |
---|
2429 | m_layerSetLayerIdList[i][n++] = m; |
---|
2430 | } |
---|
2431 | } |
---|
2432 | m_numLayerInIdList[i] = n; |
---|
2433 | } |
---|
2434 | } |
---|
2435 | #endif |
---|
2436 | #if !RESOLUTION_BASED_DPB |
---|
2437 | #if VPS_DPB_SIZE_TABLE |
---|
2438 | Void TComVPS::deriveNumberOfSubDpbs() |
---|
2439 | { |
---|
2440 | // Derive number of sub-DPBs |
---|
2441 | #if CHANGE_NUMSUBDPB_IDX |
---|
2442 | // For layer set 0 |
---|
2443 | setNumSubDpbs(0, 1); |
---|
2444 | // For other layer sets |
---|
2445 | for( Int i = 1; i < getNumLayerSets(); i++) |
---|
2446 | { |
---|
2447 | setNumSubDpbs( i, getNumLayersInIdList( i ) ); |
---|
2448 | } |
---|
2449 | #else |
---|
2450 | // For output layer set 0 |
---|
2451 | setNumSubDpbs(0, 1); |
---|
2452 | // For other output layer sets |
---|
2453 | for( Int i = 1; i < getNumOutputLayerSets(); i++) |
---|
2454 | { |
---|
2455 | setNumSubDpbs( i, getNumLayersInIdList( getOutputLayerSetIdx(i)) ); |
---|
2456 | } |
---|
2457 | #endif |
---|
2458 | } |
---|
2459 | #endif |
---|
2460 | #endif |
---|
2461 | #if VPS_VUI_TILES_NOT_IN_USE__FLAG |
---|
2462 | Void TComVPS::setTilesNotInUseFlag(Bool x) |
---|
2463 | { |
---|
2464 | m_tilesNotInUseFlag = x; |
---|
2465 | if (m_tilesNotInUseFlag) |
---|
2466 | { |
---|
2467 | for (int i = 0; i < getMaxLayers(); i++) |
---|
2468 | { |
---|
2469 | m_tilesInUseFlag[i] = m_loopFilterNotAcrossTilesFlag[i] = m_tilesNotInUseFlag; |
---|
2470 | } |
---|
2471 | } |
---|
2472 | #if TILE_BOUNDARY_ALIGNED_FLAG |
---|
2473 | if (m_tilesNotInUseFlag) |
---|
2474 | { |
---|
2475 | for (int i = 1; i < getMaxLayers(); i++) |
---|
2476 | { |
---|
2477 | for(int j = 0; j < getNumDirectRefLayers(getLayerIdInNuh(i)); j++) |
---|
2478 | { |
---|
2479 | setTileBoundariesAlignedFlag(i, j, m_tilesNotInUseFlag); |
---|
2480 | } |
---|
2481 | } |
---|
2482 | } |
---|
2483 | #endif |
---|
2484 | } |
---|
2485 | #endif |
---|
2486 | #if VPS_VUI_WPP_NOT_IN_USE__FLAG |
---|
2487 | Void TComVPS::setWppNotInUseFlag(Bool x) |
---|
2488 | { |
---|
2489 | m_wppNotInUseFlag = x; |
---|
2490 | if (m_wppNotInUseFlag) |
---|
2491 | { |
---|
2492 | for (int i = 0; i < getMaxLayers(); i++) |
---|
2493 | { |
---|
2494 | m_wppInUseFlag[i] = m_wppNotInUseFlag; |
---|
2495 | } |
---|
2496 | } |
---|
2497 | } |
---|
2498 | #endif |
---|
2499 | #if O0092_0094_DEPENDENCY_CONSTRAINT |
---|
2500 | Void TComVPS::setRefLayersFlags(Int currLayerId) |
---|
2501 | { |
---|
2502 | for (Int i = 0; i < m_numDirectRefLayers[currLayerId]; i++) |
---|
2503 | { |
---|
2504 | UInt refLayerId = getRefLayerId(currLayerId, i); |
---|
2505 | m_recursiveRefLayerFlag[currLayerId][refLayerId] = true; |
---|
2506 | for (Int k = 0; k < MAX_NUM_LAYER_IDS; k++) |
---|
2507 | { |
---|
2508 | m_recursiveRefLayerFlag[currLayerId][k] = m_recursiveRefLayerFlag[currLayerId][k] | m_recursiveRefLayerFlag[refLayerId][k]; |
---|
2509 | } |
---|
2510 | } |
---|
2511 | } |
---|
2512 | |
---|
2513 | Void TComVPS::setNumRefLayers(Int currLayerId) |
---|
2514 | { |
---|
2515 | for (Int i = 0; i < m_uiMaxLayers; i++) |
---|
2516 | { |
---|
2517 | UInt iNuhLId = m_layerIdInNuh[i]; |
---|
2518 | setRefLayersFlags(iNuhLId); |
---|
2519 | for (UInt j = 0; j < MAX_NUM_LAYER_IDS; j++) |
---|
2520 | { |
---|
2521 | m_numberRefLayers[iNuhLId] += (m_recursiveRefLayerFlag[iNuhLId][j] == true ? 1 : 0); |
---|
2522 | } |
---|
2523 | } |
---|
2524 | } |
---|
2525 | #endif |
---|
2526 | |
---|
2527 | #if VIEW_ID_RELATED_SIGNALING |
---|
2528 | Int TComVPS::getNumViews() |
---|
2529 | { |
---|
2530 | Int numViews = 1; |
---|
2531 | for( Int i = 0; i <= getMaxLayers() - 1; i++ ) |
---|
2532 | { |
---|
2533 | Int lId = getLayerIdInNuh( i ); |
---|
2534 | if ( i > 0 && ( getViewIndex( lId ) != getScalabilityId( i - 1, VIEW_ORDER_INDEX ) ) ) |
---|
2535 | { |
---|
2536 | numViews++; |
---|
2537 | } |
---|
2538 | } |
---|
2539 | |
---|
2540 | return numViews; |
---|
2541 | } |
---|
2542 | Int TComVPS::getScalabilityId( Int layerIdInVps, ScalabilityType scalType ) |
---|
2543 | { |
---|
2544 | return getScalabilityMask( scalType ) ? getDimensionId( layerIdInVps, scalTypeToScalIdx( scalType ) ) : 0; |
---|
2545 | } |
---|
2546 | Int TComVPS::scalTypeToScalIdx( ScalabilityType scalType ) |
---|
2547 | { |
---|
2548 | assert( scalType >= 0 && scalType <= MAX_VPS_NUM_SCALABILITY_TYPES ); |
---|
2549 | assert( scalType == MAX_VPS_NUM_SCALABILITY_TYPES || getScalabilityMask( scalType ) ); |
---|
2550 | Int scalIdx = 0; |
---|
2551 | for( Int curScalType = 0; curScalType < scalType; curScalType++ ) |
---|
2552 | { |
---|
2553 | scalIdx += ( getScalabilityMask( curScalType ) ? 1 : 0 ); |
---|
2554 | |
---|
2555 | } |
---|
2556 | |
---|
2557 | return scalIdx; |
---|
2558 | } |
---|
2559 | #endif |
---|
2560 | #if VPS_DPB_SIZE_TABLE |
---|
2561 | Void TComVPS::determineSubDpbInfoFlags() |
---|
2562 | { |
---|
2563 | for(Int i = 1; i < getNumOutputLayerSets(); i++) |
---|
2564 | { |
---|
2565 | Int layerSetIdxForOutputLayerSet = getOutputLayerSetIdx( i ); |
---|
2566 | // For each output layer set, set the DPB size for each layer and the reorder/latency value the maximum for all layers |
---|
2567 | Bool checkFlagOuter = false; // Used to calculate sub_layer_flag_info_present_flag |
---|
2568 | Bool checkFlagInner[MAX_TLAYER]; // Used to calculate sub_layer_dpb_info_present_flag |
---|
2569 | |
---|
2570 | for(Int j = 0; j < getMaxTLayers(); j++) |
---|
2571 | { |
---|
2572 | // -------------------------------------------------------- |
---|
2573 | // To determine value of m_subLayerDpbInfoPresentFlag |
---|
2574 | // -------------------------------------------------------- |
---|
2575 | if( j == 0 ) // checkFlagInner[0] is always 1 |
---|
2576 | { |
---|
2577 | checkFlagInner[j] = true; // Always signal sub-layer DPB information for the first sub-layer |
---|
2578 | } |
---|
2579 | else |
---|
2580 | { |
---|
2581 | checkFlagInner[j] = false; // Initialize to be false. If the values of the current sub-layers matches with the earlier sub-layer, |
---|
2582 | // then will be continue to be false - i.e. the j-th sub-layer DPB info is not signaled |
---|
2583 | checkFlagInner[j] |= ( getMaxVpsNumReorderPics(i, j) != getMaxVpsNumReorderPics(i, j - 1) ); |
---|
2584 | #if CHANGE_NUMSUBDPB_IDX |
---|
2585 | for(Int subDpbIdx = 0; subDpbIdx < getNumSubDpbs(layerSetIdxForOutputLayerSet) && !checkFlagInner[j]; subDpbIdx++) // If checkFlagInner[j] is true, break and signal the values |
---|
2586 | #else |
---|
2587 | for(Int k = 0; k < getNumSubDpbs(i) && !checkFlagInner[j]; k++) // If checkFlagInner[j] is true, break and signal the values |
---|
2588 | #endif |
---|
2589 | { |
---|
2590 | checkFlagInner[j] |= ( getMaxVpsDecPicBufferingMinus1(i, subDpbIdx, j - 1) != getMaxVpsDecPicBufferingMinus1(i, subDpbIdx, j) ); |
---|
2591 | } |
---|
2592 | #if RESOLUTION_BASED_DPB |
---|
2593 | for(Int layerIdx = 0; layerIdx < this->getNumLayersInIdList(layerSetIdxForOutputLayerSet) && !checkFlagInner[j]; layerIdx++) // If checkFlagInner[j] is true, break and signal the values |
---|
2594 | { |
---|
2595 | checkFlagInner[j] |= ( getMaxVpsLayerDecPicBuffMinus1(i, layerIdx, j - 1) != getMaxVpsLayerDecPicBuffMinus1(i, layerIdx, j) ); |
---|
2596 | } |
---|
2597 | #endif |
---|
2598 | } |
---|
2599 | // If checkFlagInner[j] = true, then some value needs to be signalled for the j-th sub-layer |
---|
2600 | setSubLayerDpbInfoPresentFlag( i, j, checkFlagInner[j] ); |
---|
2601 | } |
---|
2602 | |
---|
2603 | // -------------------------------------------------------- |
---|
2604 | // To determine value of m_subLayerFlagInfoPresentFlag |
---|
2605 | // -------------------------------------------------------- |
---|
2606 | |
---|
2607 | for(Int j = 1; j < getMaxTLayers(); j++) // Check if DPB info of any of non-zero sub-layers is signaled. If so set flag to one |
---|
2608 | { |
---|
2609 | if( getSubLayerDpbInfoPresentFlag(i, j) ) |
---|
2610 | { |
---|
2611 | checkFlagOuter = true; |
---|
2612 | break; |
---|
2613 | } |
---|
2614 | } |
---|
2615 | setSubLayerFlagInfoPresentFlag( i, checkFlagOuter ); |
---|
2616 | } |
---|
2617 | } |
---|
2618 | #endif |
---|
2619 | #if RESOLUTION_BASED_DPB |
---|
2620 | Void TComVPS::assignSubDpbIndices() |
---|
2621 | { |
---|
2622 | RepFormat layerRepFormat [MAX_LAYERS]; |
---|
2623 | RepFormat subDpbRepFormat [MAX_LAYERS]; |
---|
2624 | |
---|
2625 | for(Int lsIdx = 0; lsIdx < this->getNumLayerSets(); lsIdx++) |
---|
2626 | { |
---|
2627 | for(Int j = 0; j < MAX_LAYERS; j++) |
---|
2628 | { |
---|
2629 | layerRepFormat [j].init(); |
---|
2630 | subDpbRepFormat[j].init(); |
---|
2631 | } |
---|
2632 | |
---|
2633 | // Assign resolution, bit-depth, colour format for each layer in the layer set |
---|
2634 | for(Int i = 0; i < this->getNumLayersInIdList( lsIdx ); i++) |
---|
2635 | { |
---|
2636 | Int layerIdxInVps = this->getLayerIdInVps( this->getLayerSetLayerIdList(lsIdx, i) ); |
---|
2637 | Int repFormatIdx = this->getVpsRepFormatIdx( layerIdxInVps ); |
---|
2638 | RepFormat* repFormat = this->getVpsRepFormat( repFormatIdx ); |
---|
2639 | |
---|
2640 | // Assign the rep_format() to the layer |
---|
2641 | layerRepFormat[i] = *repFormat; |
---|
2642 | } |
---|
2643 | |
---|
2644 | // ---------------------------------------- |
---|
2645 | // Sub-DPB assignment |
---|
2646 | // ---------------------------------------- |
---|
2647 | // For the base layer |
---|
2648 | m_subDpbAssigned[lsIdx][0] = 0; |
---|
2649 | subDpbRepFormat[0] = layerRepFormat[0]; |
---|
2650 | |
---|
2651 | // Sub-DPB counter |
---|
2652 | Int subDpbCtr = 1; |
---|
2653 | |
---|
2654 | for(Int i = 1; i < this->getNumLayersInIdList( lsIdx ); i++) |
---|
2655 | { |
---|
2656 | Bool newSubDpbFlag = true; |
---|
2657 | for(Int j = 0; (j < subDpbCtr) && (newSubDpbFlag); j++) |
---|
2658 | { |
---|
2659 | if( RepFormat::checkSameSubDpb( layerRepFormat[i], subDpbRepFormat[j] ) ) |
---|
2660 | { |
---|
2661 | // Belong to i-th sub-DPB |
---|
2662 | m_subDpbAssigned[lsIdx][i] = j; |
---|
2663 | newSubDpbFlag = false; |
---|
2664 | } |
---|
2665 | } |
---|
2666 | if( newSubDpbFlag ) |
---|
2667 | { |
---|
2668 | // New sub-DPB |
---|
2669 | subDpbRepFormat[subDpbCtr] = layerRepFormat[i]; |
---|
2670 | m_subDpbAssigned[lsIdx][i] = subDpbCtr; |
---|
2671 | subDpbCtr++; // Increment # subDpbs |
---|
2672 | } |
---|
2673 | } |
---|
2674 | m_numSubDpbs[lsIdx] = subDpbCtr; |
---|
2675 | } |
---|
2676 | } |
---|
2677 | Int TComVPS::findLayerIdxInLayerSet ( Int lsIdx, Int nuhLayerId ) |
---|
2678 | { |
---|
2679 | for(Int i = 0; i < this->getNumLayersInIdList(lsIdx); i++) |
---|
2680 | { |
---|
2681 | if( this->getLayerSetLayerIdList( lsIdx, i) == nuhLayerId ) |
---|
2682 | { |
---|
2683 | return i; |
---|
2684 | } |
---|
2685 | } |
---|
2686 | return -1; // Layer not found |
---|
2687 | } |
---|
2688 | #if O0164_MULTI_LAYER_HRD |
---|
2689 | Void TComVPS::setBspHrdParameters( UInt hrdIdx, UInt frameRate, UInt numDU, UInt bitRate, Bool randomAccess ) |
---|
2690 | { |
---|
2691 | if( !getVpsVuiBspHrdPresentFlag() ) |
---|
2692 | { |
---|
2693 | return; |
---|
2694 | } |
---|
2695 | |
---|
2696 | TComHRD *hrd = getBspHrd(hrdIdx); |
---|
2697 | |
---|
2698 | Bool rateCnt = ( bitRate > 0 ); |
---|
2699 | hrd->setNalHrdParametersPresentFlag( rateCnt ); |
---|
2700 | hrd->setVclHrdParametersPresentFlag( rateCnt ); |
---|
2701 | |
---|
2702 | hrd->setSubPicCpbParamsPresentFlag( ( numDU > 1 ) ); |
---|
2703 | |
---|
2704 | if( hrd->getSubPicCpbParamsPresentFlag() ) |
---|
2705 | { |
---|
2706 | hrd->setTickDivisorMinus2( 100 - 2 ); // |
---|
2707 | hrd->setDuCpbRemovalDelayLengthMinus1( 7 ); // 8-bit precision ( plus 1 for last DU in AU ) |
---|
2708 | hrd->setSubPicCpbParamsInPicTimingSEIFlag( true ); |
---|
2709 | hrd->setDpbOutputDelayDuLengthMinus1( 5 + 7 ); // With sub-clock tick factor of 100, at least 7 bits to have the same value as AU dpb delay |
---|
2710 | } |
---|
2711 | else |
---|
2712 | { |
---|
2713 | hrd->setSubPicCpbParamsInPicTimingSEIFlag( false ); |
---|
2714 | } |
---|
2715 | |
---|
2716 | hrd->setBitRateScale( 4 ); // in units of 2~( 6 + 4 ) = 1,024 bps |
---|
2717 | hrd->setCpbSizeScale( 6 ); // in units of 2~( 4 + 4 ) = 1,024 bit |
---|
2718 | hrd->setDuCpbSizeScale( 6 ); // in units of 2~( 4 + 4 ) = 1,024 bit |
---|
2719 | |
---|
2720 | hrd->setInitialCpbRemovalDelayLengthMinus1(15); // assuming 0.5 sec, log2( 90,000 * 0.5 ) = 16-bit |
---|
2721 | if( randomAccess ) |
---|
2722 | { |
---|
2723 | hrd->setCpbRemovalDelayLengthMinus1(5); // 32 = 2^5 (plus 1) |
---|
2724 | hrd->setDpbOutputDelayLengthMinus1 (5); // 32 + 3 = 2^6 |
---|
2725 | } |
---|
2726 | else |
---|
2727 | { |
---|
2728 | hrd->setCpbRemovalDelayLengthMinus1(9); // max. 2^10 |
---|
2729 | hrd->setDpbOutputDelayLengthMinus1 (9); // max. 2^10 |
---|
2730 | } |
---|
2731 | |
---|
2732 | /* |
---|
2733 | Note: only the case of "vps_max_temporal_layers_minus1 = 0" is supported. |
---|
2734 | */ |
---|
2735 | Int i, j; |
---|
2736 | UInt birateValue, cpbSizeValue; |
---|
2737 | UInt ducpbSizeValue; |
---|
2738 | UInt duBitRateValue = 0; |
---|
2739 | |
---|
2740 | for( i = 0; i < MAX_TLAYER; i ++ ) |
---|
2741 | { |
---|
2742 | hrd->setFixedPicRateFlag( i, 1 ); |
---|
2743 | hrd->setPicDurationInTcMinus1( i, 0 ); |
---|
2744 | hrd->setLowDelayHrdFlag( i, 0 ); |
---|
2745 | hrd->setCpbCntMinus1( i, 0 ); |
---|
2746 | |
---|
2747 | birateValue = bitRate; |
---|
2748 | cpbSizeValue = bitRate; // 1 second |
---|
2749 | ducpbSizeValue = bitRate/numDU; |
---|
2750 | duBitRateValue = bitRate; |
---|
2751 | for( j = 0; j < ( hrd->getCpbCntMinus1( i ) + 1 ); j ++ ) |
---|
2752 | { |
---|
2753 | hrd->setBitRateValueMinus1( i, j, 0, ( birateValue - 1 ) ); |
---|
2754 | hrd->setCpbSizeValueMinus1( i, j, 0, ( cpbSizeValue - 1 ) ); |
---|
2755 | hrd->setDuCpbSizeValueMinus1( i, j, 0, ( ducpbSizeValue - 1 ) ); |
---|
2756 | hrd->setCbrFlag( i, j, 0, ( j == 0 ) ); |
---|
2757 | |
---|
2758 | hrd->setBitRateValueMinus1( i, j, 1, ( birateValue - 1) ); |
---|
2759 | hrd->setCpbSizeValueMinus1( i, j, 1, ( cpbSizeValue - 1 ) ); |
---|
2760 | hrd->setDuCpbSizeValueMinus1( i, j, 1, ( ducpbSizeValue - 1 ) ); |
---|
2761 | hrd->setDuBitRateValueMinus1( i, j, 1, ( duBitRateValue - 1 ) ); |
---|
2762 | hrd->setCbrFlag( i, j, 1, ( j == 0 ) ); |
---|
2763 | } |
---|
2764 | } |
---|
2765 | } |
---|
2766 | #endif |
---|
2767 | // RepFormat Assignment operator |
---|
2768 | RepFormat& RepFormat::operator= (const RepFormat &other) |
---|
2769 | { |
---|
2770 | if( this != &other) |
---|
2771 | { |
---|
2772 | m_chromaAndBitDepthVpsPresentFlag = other.m_chromaAndBitDepthVpsPresentFlag; |
---|
2773 | m_chromaFormatVpsIdc = other.m_chromaFormatVpsIdc; |
---|
2774 | m_separateColourPlaneVpsFlag = other.m_separateColourPlaneVpsFlag; |
---|
2775 | m_picWidthVpsInLumaSamples = other.m_picWidthVpsInLumaSamples; |
---|
2776 | m_picHeightVpsInLumaSamples = other.m_picHeightVpsInLumaSamples; |
---|
2777 | m_bitDepthVpsLuma = other.m_bitDepthVpsLuma; |
---|
2778 | m_bitDepthVpsChroma = other.m_bitDepthVpsChroma; |
---|
2779 | } |
---|
2780 | return *this; |
---|
2781 | } |
---|
2782 | |
---|
2783 | // Check whether x and y share the same resolution, chroma format and bit-depth. |
---|
2784 | Bool RepFormat::checkSameSubDpb(const RepFormat &x, const RepFormat &y) |
---|
2785 | { |
---|
2786 | return ( (x.m_chromaFormatVpsIdc == y.m_chromaFormatVpsIdc) |
---|
2787 | && (x.m_picWidthVpsInLumaSamples == y.m_picWidthVpsInLumaSamples) |
---|
2788 | && (x.m_picHeightVpsInLumaSamples == y.m_picHeightVpsInLumaSamples) |
---|
2789 | && (x.m_bitDepthVpsLuma == y.m_bitDepthVpsLuma) |
---|
2790 | && (x.m_bitDepthVpsChroma == y.m_bitDepthVpsChroma) |
---|
2791 | ); |
---|
2792 | } |
---|
2793 | #endif |
---|
2794 | // ------------------------------------------------------------------------------------------------ |
---|
2795 | // Sequence parameter set (SPS) |
---|
2796 | // ------------------------------------------------------------------------------------------------ |
---|
2797 | |
---|
2798 | TComSPS::TComSPS() |
---|
2799 | : m_SPSId ( 0) |
---|
2800 | , m_VPSId ( 0) |
---|
2801 | , m_chromaFormatIdc (CHROMA_420) |
---|
2802 | , m_uiMaxTLayers ( 1) |
---|
2803 | // Structure |
---|
2804 | , m_picWidthInLumaSamples (352) |
---|
2805 | , m_picHeightInLumaSamples (288) |
---|
2806 | , m_log2MinCodingBlockSize ( 0) |
---|
2807 | , m_log2DiffMaxMinCodingBlockSize (0) |
---|
2808 | , m_uiMaxCUWidth ( 32) |
---|
2809 | , m_uiMaxCUHeight ( 32) |
---|
2810 | , m_uiMaxCUDepth ( 3) |
---|
2811 | , m_bLongTermRefsPresent (false) |
---|
2812 | , m_uiQuadtreeTULog2MaxSize ( 0) |
---|
2813 | , m_uiQuadtreeTULog2MinSize ( 0) |
---|
2814 | , m_uiQuadtreeTUMaxDepthInter ( 0) |
---|
2815 | , m_uiQuadtreeTUMaxDepthIntra ( 0) |
---|
2816 | // Tool list |
---|
2817 | , m_usePCM (false) |
---|
2818 | , m_pcmLog2MaxSize ( 5) |
---|
2819 | , m_uiPCMLog2MinSize ( 7) |
---|
2820 | , m_bitDepthY ( 8) |
---|
2821 | , m_bitDepthC ( 8) |
---|
2822 | , m_qpBDOffsetY ( 0) |
---|
2823 | , m_qpBDOffsetC ( 0) |
---|
2824 | , m_uiPCMBitDepthLuma ( 8) |
---|
2825 | , m_uiPCMBitDepthChroma ( 8) |
---|
2826 | , m_bPCMFilterDisableFlag (false) |
---|
2827 | , m_uiBitsForPOC ( 8) |
---|
2828 | , m_numLongTermRefPicSPS ( 0) |
---|
2829 | , m_uiMaxTrSize ( 32) |
---|
2830 | , m_bUseSAO (false) |
---|
2831 | , m_bTemporalIdNestingFlag (false) |
---|
2832 | , m_scalingListEnabledFlag (false) |
---|
2833 | , m_useStrongIntraSmoothing (false) |
---|
2834 | , m_vuiParametersPresentFlag (false) |
---|
2835 | , m_vuiParameters () |
---|
2836 | #if SVC_EXTENSION |
---|
2837 | , m_layerId ( 0 ) |
---|
2838 | , m_numScaledRefLayerOffsets ( 0 ) |
---|
2839 | #if REPN_FORMAT_IN_VPS |
---|
2840 | , m_updateRepFormatFlag (false) |
---|
2841 | #if O0096_REP_FORMAT_INDEX |
---|
2842 | , m_updateRepFormatIndex (0) |
---|
2843 | #endif |
---|
2844 | #endif |
---|
2845 | #if SCALINGLIST_INFERRING |
---|
2846 | , m_inferScalingListFlag ( false ) |
---|
2847 | , m_scalingListRefLayerId ( 0 ) |
---|
2848 | #endif |
---|
2849 | #endif //SVC_EXTENSION |
---|
2850 | { |
---|
2851 | for ( Int i = 0; i < MAX_TLAYER; i++ ) |
---|
2852 | { |
---|
2853 | m_uiMaxLatencyIncrease[i] = 0; |
---|
2854 | m_uiMaxDecPicBuffering[i] = 1; |
---|
2855 | m_numReorderPics[i] = 0; |
---|
2856 | } |
---|
2857 | m_scalingList = new TComScalingList; |
---|
2858 | ::memset(m_ltRefPicPocLsbSps, 0, sizeof(m_ltRefPicPocLsbSps)); |
---|
2859 | ::memset(m_usedByCurrPicLtSPSFlag, 0, sizeof(m_usedByCurrPicLtSPSFlag)); |
---|
2860 | |
---|
2861 | #if P0312_VERT_PHASE_ADJ |
---|
2862 | ::memset(m_vertPhasePositionEnableFlag, 0, sizeof(m_vertPhasePositionEnableFlag)); |
---|
2863 | #endif |
---|
2864 | } |
---|
2865 | |
---|
2866 | TComSPS::~TComSPS() |
---|
2867 | { |
---|
2868 | #if SCALINGLIST_INFERRING |
---|
2869 | if( !m_inferScalingListFlag ) |
---|
2870 | #endif |
---|
2871 | delete m_scalingList; |
---|
2872 | m_RPSList.destroy(); |
---|
2873 | } |
---|
2874 | |
---|
2875 | Void TComSPS::createRPSList( Int numRPS ) |
---|
2876 | { |
---|
2877 | m_RPSList.destroy(); |
---|
2878 | m_RPSList.create(numRPS); |
---|
2879 | } |
---|
2880 | |
---|
2881 | Void TComSPS::setHrdParameters( UInt frameRate, UInt numDU, UInt bitRate, Bool randomAccess ) |
---|
2882 | { |
---|
2883 | if( !getVuiParametersPresentFlag() ) |
---|
2884 | { |
---|
2885 | return; |
---|
2886 | } |
---|
2887 | |
---|
2888 | TComVUI *vui = getVuiParameters(); |
---|
2889 | TComHRD *hrd = vui->getHrdParameters(); |
---|
2890 | |
---|
2891 | TimingInfo *timingInfo = vui->getTimingInfo(); |
---|
2892 | #if TIMING_INFO_NONZERO_LAYERID_SPS |
---|
2893 | if( getLayerId() > 0 ) |
---|
2894 | { |
---|
2895 | timingInfo->setTimingInfoPresentFlag( false ); |
---|
2896 | } |
---|
2897 | else |
---|
2898 | { |
---|
2899 | #endif |
---|
2900 | timingInfo->setTimingInfoPresentFlag( true ); |
---|
2901 | switch( frameRate ) |
---|
2902 | { |
---|
2903 | case 24: |
---|
2904 | timingInfo->setNumUnitsInTick( 1125000 ); timingInfo->setTimeScale ( 27000000 ); |
---|
2905 | break; |
---|
2906 | case 25: |
---|
2907 | timingInfo->setNumUnitsInTick( 1080000 ); timingInfo->setTimeScale ( 27000000 ); |
---|
2908 | break; |
---|
2909 | case 30: |
---|
2910 | timingInfo->setNumUnitsInTick( 900900 ); timingInfo->setTimeScale ( 27000000 ); |
---|
2911 | break; |
---|
2912 | case 50: |
---|
2913 | timingInfo->setNumUnitsInTick( 540000 ); timingInfo->setTimeScale ( 27000000 ); |
---|
2914 | break; |
---|
2915 | case 60: |
---|
2916 | timingInfo->setNumUnitsInTick( 450450 ); timingInfo->setTimeScale ( 27000000 ); |
---|
2917 | break; |
---|
2918 | default: |
---|
2919 | timingInfo->setNumUnitsInTick( 1001 ); timingInfo->setTimeScale ( 60000 ); |
---|
2920 | break; |
---|
2921 | } |
---|
2922 | |
---|
2923 | Bool rateCnt = ( bitRate > 0 ); |
---|
2924 | hrd->setNalHrdParametersPresentFlag( rateCnt ); |
---|
2925 | hrd->setVclHrdParametersPresentFlag( rateCnt ); |
---|
2926 | |
---|
2927 | hrd->setSubPicCpbParamsPresentFlag( ( numDU > 1 ) ); |
---|
2928 | |
---|
2929 | if( hrd->getSubPicCpbParamsPresentFlag() ) |
---|
2930 | { |
---|
2931 | hrd->setTickDivisorMinus2( 100 - 2 ); // |
---|
2932 | hrd->setDuCpbRemovalDelayLengthMinus1( 7 ); // 8-bit precision ( plus 1 for last DU in AU ) |
---|
2933 | hrd->setSubPicCpbParamsInPicTimingSEIFlag( true ); |
---|
2934 | hrd->setDpbOutputDelayDuLengthMinus1( 5 + 7 ); // With sub-clock tick factor of 100, at least 7 bits to have the same value as AU dpb delay |
---|
2935 | } |
---|
2936 | else |
---|
2937 | { |
---|
2938 | hrd->setSubPicCpbParamsInPicTimingSEIFlag( false ); |
---|
2939 | } |
---|
2940 | |
---|
2941 | hrd->setBitRateScale( 4 ); // in units of 2~( 6 + 4 ) = 1,024 bps |
---|
2942 | hrd->setCpbSizeScale( 6 ); // in units of 2~( 4 + 4 ) = 1,024 bit |
---|
2943 | hrd->setDuCpbSizeScale( 6 ); // in units of 2~( 4 + 4 ) = 1,024 bit |
---|
2944 | |
---|
2945 | hrd->setInitialCpbRemovalDelayLengthMinus1(15); // assuming 0.5 sec, log2( 90,000 * 0.5 ) = 16-bit |
---|
2946 | if( randomAccess ) |
---|
2947 | { |
---|
2948 | hrd->setCpbRemovalDelayLengthMinus1(5); // 32 = 2^5 (plus 1) |
---|
2949 | hrd->setDpbOutputDelayLengthMinus1 (5); // 32 + 3 = 2^6 |
---|
2950 | } |
---|
2951 | else |
---|
2952 | { |
---|
2953 | hrd->setCpbRemovalDelayLengthMinus1(9); // max. 2^10 |
---|
2954 | hrd->setDpbOutputDelayLengthMinus1 (9); // max. 2^10 |
---|
2955 | } |
---|
2956 | |
---|
2957 | /* |
---|
2958 | Note: only the case of "vps_max_temporal_layers_minus1 = 0" is supported. |
---|
2959 | */ |
---|
2960 | Int i, j; |
---|
2961 | UInt birateValue, cpbSizeValue; |
---|
2962 | UInt ducpbSizeValue; |
---|
2963 | UInt duBitRateValue = 0; |
---|
2964 | |
---|
2965 | for( i = 0; i < MAX_TLAYER; i ++ ) |
---|
2966 | { |
---|
2967 | hrd->setFixedPicRateFlag( i, 1 ); |
---|
2968 | hrd->setPicDurationInTcMinus1( i, 0 ); |
---|
2969 | hrd->setLowDelayHrdFlag( i, 0 ); |
---|
2970 | hrd->setCpbCntMinus1( i, 0 ); |
---|
2971 | |
---|
2972 | birateValue = bitRate; |
---|
2973 | cpbSizeValue = bitRate; // 1 second |
---|
2974 | ducpbSizeValue = bitRate/numDU; |
---|
2975 | duBitRateValue = bitRate; |
---|
2976 | for( j = 0; j < ( hrd->getCpbCntMinus1( i ) + 1 ); j ++ ) |
---|
2977 | { |
---|
2978 | hrd->setBitRateValueMinus1( i, j, 0, ( birateValue - 1 ) ); |
---|
2979 | hrd->setCpbSizeValueMinus1( i, j, 0, ( cpbSizeValue - 1 ) ); |
---|
2980 | hrd->setDuCpbSizeValueMinus1( i, j, 0, ( ducpbSizeValue - 1 ) ); |
---|
2981 | hrd->setCbrFlag( i, j, 0, ( j == 0 ) ); |
---|
2982 | |
---|
2983 | hrd->setBitRateValueMinus1( i, j, 1, ( birateValue - 1) ); |
---|
2984 | hrd->setCpbSizeValueMinus1( i, j, 1, ( cpbSizeValue - 1 ) ); |
---|
2985 | hrd->setDuCpbSizeValueMinus1( i, j, 1, ( ducpbSizeValue - 1 ) ); |
---|
2986 | hrd->setDuBitRateValueMinus1( i, j, 1, ( duBitRateValue - 1 ) ); |
---|
2987 | hrd->setCbrFlag( i, j, 1, ( j == 0 ) ); |
---|
2988 | } |
---|
2989 | } |
---|
2990 | #if TIMING_INFO_NONZERO_LAYERID_SPS |
---|
2991 | } |
---|
2992 | #endif |
---|
2993 | } |
---|
2994 | const Int TComSPS::m_winUnitX[]={1,2,2,1}; |
---|
2995 | const Int TComSPS::m_winUnitY[]={1,2,1,1}; |
---|
2996 | |
---|
2997 | #if O0098_SCALED_REF_LAYER_ID |
---|
2998 | Window& TComSPS::getScaledRefLayerWindowForLayer(Int layerId) |
---|
2999 | { |
---|
3000 | static Window win; |
---|
3001 | |
---|
3002 | for (Int i = 0; i < m_numScaledRefLayerOffsets; i++) |
---|
3003 | { |
---|
3004 | if (layerId == m_scaledRefLayerId[i]) |
---|
3005 | { |
---|
3006 | return m_scaledRefLayerWindow[i]; |
---|
3007 | } |
---|
3008 | } |
---|
3009 | |
---|
3010 | win.resetWindow(); // scaled reference layer offsets are inferred to be zero when not present |
---|
3011 | return win; |
---|
3012 | } |
---|
3013 | #endif |
---|
3014 | |
---|
3015 | TComPPS::TComPPS() |
---|
3016 | : m_PPSId (0) |
---|
3017 | , m_SPSId (0) |
---|
3018 | , m_picInitQPMinus26 (0) |
---|
3019 | , m_useDQP (false) |
---|
3020 | , m_bConstrainedIntraPred (false) |
---|
3021 | , m_bSliceChromaQpFlag (false) |
---|
3022 | , m_pcSPS (NULL) |
---|
3023 | , m_uiMaxCuDQPDepth (0) |
---|
3024 | , m_uiMinCuDQPSize (0) |
---|
3025 | , m_chromaCbQpOffset (0) |
---|
3026 | , m_chromaCrQpOffset (0) |
---|
3027 | , m_numRefIdxL0DefaultActive (1) |
---|
3028 | , m_numRefIdxL1DefaultActive (1) |
---|
3029 | , m_TransquantBypassEnableFlag (false) |
---|
3030 | , m_useTransformSkip (false) |
---|
3031 | , m_dependentSliceSegmentsEnabledFlag (false) |
---|
3032 | , m_tilesEnabledFlag (false) |
---|
3033 | , m_entropyCodingSyncEnabledFlag (false) |
---|
3034 | , m_loopFilterAcrossTilesEnabledFlag (true) |
---|
3035 | , m_uniformSpacingFlag (0) |
---|
3036 | , m_iNumColumnsMinus1 (0) |
---|
3037 | , m_puiColumnWidth (NULL) |
---|
3038 | , m_iNumRowsMinus1 (0) |
---|
3039 | , m_puiRowHeight (NULL) |
---|
3040 | , m_iNumSubstreams (1) |
---|
3041 | , m_signHideFlag(0) |
---|
3042 | , m_cabacInitPresentFlag (false) |
---|
3043 | , m_encCABACTableIdx (I_SLICE) |
---|
3044 | , m_sliceHeaderExtensionPresentFlag (false) |
---|
3045 | , m_loopFilterAcrossSlicesEnabledFlag (false) |
---|
3046 | , m_listsModificationPresentFlag( 0) |
---|
3047 | , m_numExtraSliceHeaderBits(0) |
---|
3048 | #if SCALINGLIST_INFERRING |
---|
3049 | , m_inferScalingListFlag ( false ) |
---|
3050 | , m_scalingListRefLayerId ( 0 ) |
---|
3051 | #endif |
---|
3052 | #if POC_RESET_IDC |
---|
3053 | , m_pocResetInfoPresentFlag (false) |
---|
3054 | #endif |
---|
3055 | { |
---|
3056 | m_scalingList = new TComScalingList; |
---|
3057 | } |
---|
3058 | |
---|
3059 | TComPPS::~TComPPS() |
---|
3060 | { |
---|
3061 | if( m_iNumColumnsMinus1 > 0 && m_uniformSpacingFlag == 0 ) |
---|
3062 | { |
---|
3063 | if (m_puiColumnWidth) delete [] m_puiColumnWidth; |
---|
3064 | m_puiColumnWidth = NULL; |
---|
3065 | } |
---|
3066 | if( m_iNumRowsMinus1 > 0 && m_uniformSpacingFlag == 0 ) |
---|
3067 | { |
---|
3068 | if (m_puiRowHeight) delete [] m_puiRowHeight; |
---|
3069 | m_puiRowHeight = NULL; |
---|
3070 | } |
---|
3071 | |
---|
3072 | #if SCALINGLIST_INFERRING |
---|
3073 | if( !m_inferScalingListFlag ) |
---|
3074 | #endif |
---|
3075 | delete m_scalingList; |
---|
3076 | } |
---|
3077 | |
---|
3078 | TComReferencePictureSet::TComReferencePictureSet() |
---|
3079 | : m_numberOfPictures (0) |
---|
3080 | , m_numberOfNegativePictures (0) |
---|
3081 | , m_numberOfPositivePictures (0) |
---|
3082 | , m_numberOfLongtermPictures (0) |
---|
3083 | , m_interRPSPrediction (0) |
---|
3084 | , m_deltaRIdxMinus1 (0) |
---|
3085 | , m_deltaRPS (0) |
---|
3086 | , m_numRefIdc (0) |
---|
3087 | { |
---|
3088 | ::memset( m_deltaPOC, 0, sizeof(m_deltaPOC) ); |
---|
3089 | ::memset( m_POC, 0, sizeof(m_POC) ); |
---|
3090 | ::memset( m_used, 0, sizeof(m_used) ); |
---|
3091 | ::memset( m_refIdc, 0, sizeof(m_refIdc) ); |
---|
3092 | } |
---|
3093 | |
---|
3094 | TComReferencePictureSet::~TComReferencePictureSet() |
---|
3095 | { |
---|
3096 | } |
---|
3097 | |
---|
3098 | Void TComReferencePictureSet::setUsed(Int bufferNum, Bool used) |
---|
3099 | { |
---|
3100 | m_used[bufferNum] = used; |
---|
3101 | } |
---|
3102 | |
---|
3103 | Void TComReferencePictureSet::setDeltaPOC(Int bufferNum, Int deltaPOC) |
---|
3104 | { |
---|
3105 | m_deltaPOC[bufferNum] = deltaPOC; |
---|
3106 | } |
---|
3107 | |
---|
3108 | Void TComReferencePictureSet::setNumberOfPictures(Int numberOfPictures) |
---|
3109 | { |
---|
3110 | m_numberOfPictures = numberOfPictures; |
---|
3111 | } |
---|
3112 | |
---|
3113 | Int TComReferencePictureSet::getUsed(Int bufferNum) |
---|
3114 | { |
---|
3115 | return m_used[bufferNum]; |
---|
3116 | } |
---|
3117 | |
---|
3118 | Int TComReferencePictureSet::getDeltaPOC(Int bufferNum) |
---|
3119 | { |
---|
3120 | return m_deltaPOC[bufferNum]; |
---|
3121 | } |
---|
3122 | |
---|
3123 | Int TComReferencePictureSet::getNumberOfPictures() |
---|
3124 | { |
---|
3125 | return m_numberOfPictures; |
---|
3126 | } |
---|
3127 | |
---|
3128 | Int TComReferencePictureSet::getPOC(Int bufferNum) |
---|
3129 | { |
---|
3130 | return m_POC[bufferNum]; |
---|
3131 | } |
---|
3132 | |
---|
3133 | Void TComReferencePictureSet::setPOC(Int bufferNum, Int POC) |
---|
3134 | { |
---|
3135 | m_POC[bufferNum] = POC; |
---|
3136 | } |
---|
3137 | |
---|
3138 | Bool TComReferencePictureSet::getCheckLTMSBPresent(Int bufferNum) |
---|
3139 | { |
---|
3140 | return m_bCheckLTMSB[bufferNum]; |
---|
3141 | } |
---|
3142 | |
---|
3143 | Void TComReferencePictureSet::setCheckLTMSBPresent(Int bufferNum, Bool b) |
---|
3144 | { |
---|
3145 | m_bCheckLTMSB[bufferNum] = b; |
---|
3146 | } |
---|
3147 | |
---|
3148 | /** set the reference idc value at uiBufferNum entry to the value of iRefIdc |
---|
3149 | * \param uiBufferNum |
---|
3150 | * \param iRefIdc |
---|
3151 | * \returns Void |
---|
3152 | */ |
---|
3153 | Void TComReferencePictureSet::setRefIdc(Int bufferNum, Int refIdc) |
---|
3154 | { |
---|
3155 | m_refIdc[bufferNum] = refIdc; |
---|
3156 | } |
---|
3157 | |
---|
3158 | /** get the reference idc value at uiBufferNum |
---|
3159 | * \param uiBufferNum |
---|
3160 | * \returns Int |
---|
3161 | */ |
---|
3162 | Int TComReferencePictureSet::getRefIdc(Int bufferNum) |
---|
3163 | { |
---|
3164 | return m_refIdc[bufferNum]; |
---|
3165 | } |
---|
3166 | |
---|
3167 | /** Sorts the deltaPOC and Used by current values in the RPS based on the deltaPOC values. |
---|
3168 | * deltaPOC values are sorted with -ve values before the +ve values. -ve values are in decreasing order. |
---|
3169 | * +ve values are in increasing order. |
---|
3170 | * \returns Void |
---|
3171 | */ |
---|
3172 | Void TComReferencePictureSet::sortDeltaPOC() |
---|
3173 | { |
---|
3174 | // sort in increasing order (smallest first) |
---|
3175 | for(Int j=1; j < getNumberOfPictures(); j++) |
---|
3176 | { |
---|
3177 | Int deltaPOC = getDeltaPOC(j); |
---|
3178 | Bool used = getUsed(j); |
---|
3179 | for (Int k=j-1; k >= 0; k--) |
---|
3180 | { |
---|
3181 | Int temp = getDeltaPOC(k); |
---|
3182 | if (deltaPOC < temp) |
---|
3183 | { |
---|
3184 | setDeltaPOC(k+1, temp); |
---|
3185 | setUsed(k+1, getUsed(k)); |
---|
3186 | setDeltaPOC(k, deltaPOC); |
---|
3187 | setUsed(k, used); |
---|
3188 | } |
---|
3189 | } |
---|
3190 | } |
---|
3191 | // flip the negative values to largest first |
---|
3192 | Int numNegPics = getNumberOfNegativePictures(); |
---|
3193 | for(Int j=0, k=numNegPics-1; j < numNegPics>>1; j++, k--) |
---|
3194 | { |
---|
3195 | Int deltaPOC = getDeltaPOC(j); |
---|
3196 | Bool used = getUsed(j); |
---|
3197 | setDeltaPOC(j, getDeltaPOC(k)); |
---|
3198 | setUsed(j, getUsed(k)); |
---|
3199 | setDeltaPOC(k, deltaPOC); |
---|
3200 | setUsed(k, used); |
---|
3201 | } |
---|
3202 | } |
---|
3203 | |
---|
3204 | /** Prints the deltaPOC and RefIdc (if available) values in the RPS. |
---|
3205 | * A "*" is added to the deltaPOC value if it is Used bu current. |
---|
3206 | * \returns Void |
---|
3207 | */ |
---|
3208 | Void TComReferencePictureSet::printDeltaPOC() |
---|
3209 | { |
---|
3210 | printf("DeltaPOC = { "); |
---|
3211 | for(Int j=0; j < getNumberOfPictures(); j++) |
---|
3212 | { |
---|
3213 | printf("%d%s ", getDeltaPOC(j), (getUsed(j)==1)?"*":""); |
---|
3214 | } |
---|
3215 | if (getInterRPSPrediction()) |
---|
3216 | { |
---|
3217 | printf("}, RefIdc = { "); |
---|
3218 | for(Int j=0; j < getNumRefIdc(); j++) |
---|
3219 | { |
---|
3220 | printf("%d ", getRefIdc(j)); |
---|
3221 | } |
---|
3222 | } |
---|
3223 | printf("}\n"); |
---|
3224 | } |
---|
3225 | |
---|
3226 | TComRPSList::TComRPSList() |
---|
3227 | :m_referencePictureSets (NULL) |
---|
3228 | { |
---|
3229 | } |
---|
3230 | |
---|
3231 | TComRPSList::~TComRPSList() |
---|
3232 | { |
---|
3233 | } |
---|
3234 | |
---|
3235 | Void TComRPSList::create( Int numberOfReferencePictureSets) |
---|
3236 | { |
---|
3237 | m_numberOfReferencePictureSets = numberOfReferencePictureSets; |
---|
3238 | m_referencePictureSets = new TComReferencePictureSet[numberOfReferencePictureSets]; |
---|
3239 | } |
---|
3240 | |
---|
3241 | Void TComRPSList::destroy() |
---|
3242 | { |
---|
3243 | if (m_referencePictureSets) |
---|
3244 | { |
---|
3245 | delete [] m_referencePictureSets; |
---|
3246 | } |
---|
3247 | m_numberOfReferencePictureSets = 0; |
---|
3248 | m_referencePictureSets = NULL; |
---|
3249 | } |
---|
3250 | |
---|
3251 | |
---|
3252 | |
---|
3253 | TComReferencePictureSet* TComRPSList::getReferencePictureSet(Int referencePictureSetNum) |
---|
3254 | { |
---|
3255 | return &m_referencePictureSets[referencePictureSetNum]; |
---|
3256 | } |
---|
3257 | |
---|
3258 | Int TComRPSList::getNumberOfReferencePictureSets() |
---|
3259 | { |
---|
3260 | return m_numberOfReferencePictureSets; |
---|
3261 | } |
---|
3262 | |
---|
3263 | Void TComRPSList::setNumberOfReferencePictureSets(Int numberOfReferencePictureSets) |
---|
3264 | { |
---|
3265 | m_numberOfReferencePictureSets = numberOfReferencePictureSets; |
---|
3266 | } |
---|
3267 | |
---|
3268 | TComRefPicListModification::TComRefPicListModification() |
---|
3269 | : m_bRefPicListModificationFlagL0 (false) |
---|
3270 | , m_bRefPicListModificationFlagL1 (false) |
---|
3271 | { |
---|
3272 | ::memset( m_RefPicSetIdxL0, 0, sizeof(m_RefPicSetIdxL0) ); |
---|
3273 | ::memset( m_RefPicSetIdxL1, 0, sizeof(m_RefPicSetIdxL1) ); |
---|
3274 | } |
---|
3275 | |
---|
3276 | TComRefPicListModification::~TComRefPicListModification() |
---|
3277 | { |
---|
3278 | } |
---|
3279 | |
---|
3280 | TComScalingList::TComScalingList() |
---|
3281 | { |
---|
3282 | init(); |
---|
3283 | } |
---|
3284 | |
---|
3285 | TComScalingList::~TComScalingList() |
---|
3286 | { |
---|
3287 | destroy(); |
---|
3288 | } |
---|
3289 | |
---|
3290 | /** set default quantization matrix to array |
---|
3291 | */ |
---|
3292 | Void TComSlice::setDefaultScalingList() |
---|
3293 | { |
---|
3294 | for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) |
---|
3295 | { |
---|
3296 | for(UInt listId=0;listId<g_scalingListNum[sizeId];listId++) |
---|
3297 | { |
---|
3298 | getScalingList()->processDefaultMatrix(sizeId, listId); |
---|
3299 | } |
---|
3300 | } |
---|
3301 | } |
---|
3302 | /** check if use default quantization matrix |
---|
3303 | * \returns true if use default quantization matrix in all size |
---|
3304 | */ |
---|
3305 | Bool TComSlice::checkDefaultScalingList() |
---|
3306 | { |
---|
3307 | UInt defaultCounter=0; |
---|
3308 | |
---|
3309 | for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) |
---|
3310 | { |
---|
3311 | for(UInt listId=0;listId<g_scalingListNum[sizeId];listId++) |
---|
3312 | { |
---|
3313 | if( !memcmp(getScalingList()->getScalingListAddress(sizeId,listId), getScalingList()->getScalingListDefaultAddress(sizeId, listId),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])) // check value of matrix |
---|
3314 | && ((sizeId < SCALING_LIST_16x16) || (getScalingList()->getScalingListDC(sizeId,listId) == 16))) // check DC value |
---|
3315 | { |
---|
3316 | defaultCounter++; |
---|
3317 | } |
---|
3318 | } |
---|
3319 | } |
---|
3320 | return (defaultCounter == (SCALING_LIST_NUM * SCALING_LIST_SIZE_NUM - 4)) ? false : true; // -4 for 32x32 |
---|
3321 | } |
---|
3322 | |
---|
3323 | /** get scaling matrix from RefMatrixID |
---|
3324 | * \param sizeId size index |
---|
3325 | * \param Index of input matrix |
---|
3326 | * \param Index of reference matrix |
---|
3327 | */ |
---|
3328 | Void TComScalingList::processRefMatrix( UInt sizeId, UInt listId , UInt refListId ) |
---|
3329 | { |
---|
3330 | ::memcpy(getScalingListAddress(sizeId, listId),((listId == refListId)? getScalingListDefaultAddress(sizeId, refListId): getScalingListAddress(sizeId, refListId)),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])); |
---|
3331 | } |
---|
3332 | |
---|
3333 | /** parse syntax infomation |
---|
3334 | * \param pchFile syntax infomation |
---|
3335 | * \returns false if successful |
---|
3336 | */ |
---|
3337 | Bool TComScalingList::xParseScalingList(Char* pchFile) |
---|
3338 | { |
---|
3339 | FILE *fp; |
---|
3340 | Char line[1024]; |
---|
3341 | UInt sizeIdc,listIdc; |
---|
3342 | UInt i,size = 0; |
---|
3343 | Int *src=0,data; |
---|
3344 | Char *ret; |
---|
3345 | UInt retval; |
---|
3346 | |
---|
3347 | if((fp = fopen(pchFile,"r")) == (FILE*)NULL) |
---|
3348 | { |
---|
3349 | printf("can't open file %s :: set Default Matrix\n",pchFile); |
---|
3350 | return true; |
---|
3351 | } |
---|
3352 | |
---|
3353 | for(sizeIdc = 0; sizeIdc < SCALING_LIST_SIZE_NUM; sizeIdc++) |
---|
3354 | { |
---|
3355 | size = min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeIdc]); |
---|
3356 | for(listIdc = 0; listIdc < g_scalingListNum[sizeIdc]; listIdc++) |
---|
3357 | { |
---|
3358 | src = getScalingListAddress(sizeIdc, listIdc); |
---|
3359 | |
---|
3360 | fseek(fp,0,0); |
---|
3361 | do |
---|
3362 | { |
---|
3363 | ret = fgets(line, 1024, fp); |
---|
3364 | if ((ret==NULL)||(strstr(line, MatrixType[sizeIdc][listIdc])==NULL && feof(fp))) |
---|
3365 | { |
---|
3366 | printf("Error: can't read Matrix :: set Default Matrix\n"); |
---|
3367 | return true; |
---|
3368 | } |
---|
3369 | } |
---|
3370 | while (strstr(line, MatrixType[sizeIdc][listIdc]) == NULL); |
---|
3371 | for (i=0; i<size; i++) |
---|
3372 | { |
---|
3373 | retval = fscanf(fp, "%d,", &data); |
---|
3374 | if (retval!=1) |
---|
3375 | { |
---|
3376 | printf("Error: can't read Matrix :: set Default Matrix\n"); |
---|
3377 | return true; |
---|
3378 | } |
---|
3379 | src[i] = data; |
---|
3380 | } |
---|
3381 | //set DC value for default matrix check |
---|
3382 | setScalingListDC(sizeIdc,listIdc,src[0]); |
---|
3383 | |
---|
3384 | if(sizeIdc > SCALING_LIST_8x8) |
---|
3385 | { |
---|
3386 | fseek(fp,0,0); |
---|
3387 | do |
---|
3388 | { |
---|
3389 | ret = fgets(line, 1024, fp); |
---|
3390 | if ((ret==NULL)||(strstr(line, MatrixType_DC[sizeIdc][listIdc])==NULL && feof(fp))) |
---|
3391 | { |
---|
3392 | printf("Error: can't read DC :: set Default Matrix\n"); |
---|
3393 | return true; |
---|
3394 | } |
---|
3395 | } |
---|
3396 | while (strstr(line, MatrixType_DC[sizeIdc][listIdc]) == NULL); |
---|
3397 | retval = fscanf(fp, "%d,", &data); |
---|
3398 | if (retval!=1) |
---|
3399 | { |
---|
3400 | printf("Error: can't read Matrix :: set Default Matrix\n"); |
---|
3401 | return true; |
---|
3402 | } |
---|
3403 | //overwrite DC value when size of matrix is larger than 16x16 |
---|
3404 | setScalingListDC(sizeIdc,listIdc,data); |
---|
3405 | } |
---|
3406 | } |
---|
3407 | } |
---|
3408 | fclose(fp); |
---|
3409 | return false; |
---|
3410 | } |
---|
3411 | |
---|
3412 | /** initialization process of quantization matrix array |
---|
3413 | */ |
---|
3414 | Void TComScalingList::init() |
---|
3415 | { |
---|
3416 | for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) |
---|
3417 | { |
---|
3418 | for(UInt listId = 0; listId < g_scalingListNum[sizeId]; listId++) |
---|
3419 | { |
---|
3420 | m_scalingListCoef[sizeId][listId] = new Int [min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])]; |
---|
3421 | } |
---|
3422 | } |
---|
3423 | m_scalingListCoef[SCALING_LIST_32x32][3] = m_scalingListCoef[SCALING_LIST_32x32][1]; // copy address for 32x32 |
---|
3424 | } |
---|
3425 | |
---|
3426 | /** destroy quantization matrix array |
---|
3427 | */ |
---|
3428 | Void TComScalingList::destroy() |
---|
3429 | { |
---|
3430 | for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) |
---|
3431 | { |
---|
3432 | for(UInt listId = 0; listId < g_scalingListNum[sizeId]; listId++) |
---|
3433 | { |
---|
3434 | if(m_scalingListCoef[sizeId][listId]) delete [] m_scalingListCoef[sizeId][listId]; |
---|
3435 | } |
---|
3436 | } |
---|
3437 | } |
---|
3438 | |
---|
3439 | /** get default address of quantization matrix |
---|
3440 | * \param sizeId size index |
---|
3441 | * \param listId list index |
---|
3442 | * \returns pointer of quantization matrix |
---|
3443 | */ |
---|
3444 | Int* TComScalingList::getScalingListDefaultAddress(UInt sizeId, UInt listId) |
---|
3445 | { |
---|
3446 | Int *src = 0; |
---|
3447 | switch(sizeId) |
---|
3448 | { |
---|
3449 | case SCALING_LIST_4x4: |
---|
3450 | src = g_quantTSDefault4x4; |
---|
3451 | break; |
---|
3452 | case SCALING_LIST_8x8: |
---|
3453 | src = (listId<3) ? g_quantIntraDefault8x8 : g_quantInterDefault8x8; |
---|
3454 | break; |
---|
3455 | case SCALING_LIST_16x16: |
---|
3456 | src = (listId<3) ? g_quantIntraDefault8x8 : g_quantInterDefault8x8; |
---|
3457 | break; |
---|
3458 | case SCALING_LIST_32x32: |
---|
3459 | src = (listId<1) ? g_quantIntraDefault8x8 : g_quantInterDefault8x8; |
---|
3460 | break; |
---|
3461 | default: |
---|
3462 | assert(0); |
---|
3463 | src = NULL; |
---|
3464 | break; |
---|
3465 | } |
---|
3466 | return src; |
---|
3467 | } |
---|
3468 | |
---|
3469 | /** process of default matrix |
---|
3470 | * \param sizeId size index |
---|
3471 | * \param Index of input matrix |
---|
3472 | */ |
---|
3473 | Void TComScalingList::processDefaultMatrix(UInt sizeId, UInt listId) |
---|
3474 | { |
---|
3475 | ::memcpy(getScalingListAddress(sizeId, listId),getScalingListDefaultAddress(sizeId,listId),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])); |
---|
3476 | setScalingListDC(sizeId,listId,SCALING_LIST_DC); |
---|
3477 | } |
---|
3478 | |
---|
3479 | /** check DC value of matrix for default matrix signaling |
---|
3480 | */ |
---|
3481 | Void TComScalingList::checkDcOfMatrix() |
---|
3482 | { |
---|
3483 | for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) |
---|
3484 | { |
---|
3485 | for(UInt listId = 0; listId < g_scalingListNum[sizeId]; listId++) |
---|
3486 | { |
---|
3487 | //check default matrix? |
---|
3488 | if(getScalingListDC(sizeId,listId) == 0) |
---|
3489 | { |
---|
3490 | processDefaultMatrix(sizeId, listId); |
---|
3491 | } |
---|
3492 | } |
---|
3493 | } |
---|
3494 | } |
---|
3495 | |
---|
3496 | ParameterSetManager::ParameterSetManager() |
---|
3497 | #if SVC_EXTENSION |
---|
3498 | : m_spsMap(MAX_NUM_SPS) |
---|
3499 | , m_ppsMap(MAX_NUM_PPS) |
---|
3500 | , m_activeSPSId(-1) |
---|
3501 | , m_activePPSId(-1) |
---|
3502 | #else |
---|
3503 | : m_vpsMap(MAX_NUM_VPS) |
---|
3504 | , m_spsMap(MAX_NUM_SPS) |
---|
3505 | , m_ppsMap(MAX_NUM_PPS) |
---|
3506 | , m_activeVPSId(-1) |
---|
3507 | , m_activeSPSId(-1) |
---|
3508 | , m_activePPSId(-1) |
---|
3509 | #endif |
---|
3510 | { |
---|
3511 | } |
---|
3512 | |
---|
3513 | |
---|
3514 | ParameterSetManager::~ParameterSetManager() |
---|
3515 | { |
---|
3516 | } |
---|
3517 | |
---|
3518 | //! activate a SPS from a active parameter sets SEI message |
---|
3519 | //! \returns true, if activation is successful |
---|
3520 | Bool ParameterSetManager::activateSPSWithSEI(Int spsId) |
---|
3521 | { |
---|
3522 | TComSPS *sps = m_spsMap.getPS(spsId); |
---|
3523 | if (sps) |
---|
3524 | { |
---|
3525 | Int vpsId = sps->getVPSId(); |
---|
3526 | if (m_vpsMap.getPS(vpsId)) |
---|
3527 | { |
---|
3528 | m_activeVPSId = vpsId; |
---|
3529 | m_activeSPSId = spsId; |
---|
3530 | return true; |
---|
3531 | } |
---|
3532 | else |
---|
3533 | { |
---|
3534 | printf("Warning: tried to activate SPS using an Active parameter sets SEI message. Referenced VPS does not exist."); |
---|
3535 | } |
---|
3536 | } |
---|
3537 | else |
---|
3538 | { |
---|
3539 | printf("Warning: tried to activate non-existing SPS using an Active parameter sets SEI message."); |
---|
3540 | } |
---|
3541 | return false; |
---|
3542 | } |
---|
3543 | |
---|
3544 | //! activate a PPS and depending on isIDR parameter also SPS and VPS |
---|
3545 | //! \returns true, if activation is successful |
---|
3546 | Bool ParameterSetManager::activatePPS(Int ppsId, Bool isIRAP) |
---|
3547 | { |
---|
3548 | TComPPS *pps = m_ppsMap.getPS(ppsId); |
---|
3549 | if (pps) |
---|
3550 | { |
---|
3551 | Int spsId = pps->getSPSId(); |
---|
3552 | if (!isIRAP && (spsId != m_activeSPSId)) |
---|
3553 | { |
---|
3554 | printf("Warning: tried to activate PPS referring to a inactive SPS at non-IRAP."); |
---|
3555 | return false; |
---|
3556 | } |
---|
3557 | TComSPS *sps = m_spsMap.getPS(spsId); |
---|
3558 | if (sps) |
---|
3559 | { |
---|
3560 | Int vpsId = sps->getVPSId(); |
---|
3561 | if (!isIRAP && (vpsId != m_activeVPSId)) |
---|
3562 | { |
---|
3563 | printf("Warning: tried to activate PPS referring to a inactive VPS at non-IRAP."); |
---|
3564 | return false; |
---|
3565 | } |
---|
3566 | if (m_vpsMap.getPS(vpsId)) |
---|
3567 | { |
---|
3568 | m_activePPSId = ppsId; |
---|
3569 | m_activeVPSId = vpsId; |
---|
3570 | m_activeSPSId = spsId; |
---|
3571 | |
---|
3572 | return true; |
---|
3573 | } |
---|
3574 | else |
---|
3575 | { |
---|
3576 | printf("Warning: tried to activate PPS that refers to a non-existing VPS."); |
---|
3577 | } |
---|
3578 | } |
---|
3579 | else |
---|
3580 | { |
---|
3581 | printf("Warning: tried to activate a PPS that refers to a non-existing SPS."); |
---|
3582 | } |
---|
3583 | } |
---|
3584 | else |
---|
3585 | { |
---|
3586 | printf("Warning: tried to activate non-existing PPS."); |
---|
3587 | } |
---|
3588 | return false; |
---|
3589 | } |
---|
3590 | |
---|
3591 | ProfileTierLevel::ProfileTierLevel() |
---|
3592 | : m_profileSpace (0) |
---|
3593 | , m_tierFlag (false) |
---|
3594 | , m_profileIdc (0) |
---|
3595 | , m_levelIdc (0) |
---|
3596 | , m_progressiveSourceFlag (false) |
---|
3597 | , m_interlacedSourceFlag (false) |
---|
3598 | , m_nonPackedConstraintFlag(false) |
---|
3599 | , m_frameOnlyConstraintFlag(false) |
---|
3600 | { |
---|
3601 | ::memset(m_profileCompatibilityFlag, 0, sizeof(m_profileCompatibilityFlag)); |
---|
3602 | } |
---|
3603 | #if VPS_EXTN_PROFILE_INFO |
---|
3604 | Void ProfileTierLevel::copyProfileInfo(ProfileTierLevel *ptl) |
---|
3605 | { |
---|
3606 | this->setProfileSpace ( ptl->getProfileSpace() ); |
---|
3607 | this->setTierFlag ( ptl->getTierFlag() ); |
---|
3608 | this->setProfileIdc ( ptl->getProfileIdc() ); |
---|
3609 | for(Int j = 0; j < 32; j++) |
---|
3610 | { |
---|
3611 | this->setProfileCompatibilityFlag(j, ptl->getProfileCompatibilityFlag(j)); |
---|
3612 | } |
---|
3613 | this->setProgressiveSourceFlag ( ptl->getProgressiveSourceFlag() ); |
---|
3614 | this->setInterlacedSourceFlag ( ptl->getInterlacedSourceFlag() ); |
---|
3615 | this->setNonPackedConstraintFlag( ptl->getNonPackedConstraintFlag()); |
---|
3616 | this->setFrameOnlyConstraintFlag( ptl->getFrameOnlyConstraintFlag()); |
---|
3617 | } |
---|
3618 | #endif |
---|
3619 | |
---|
3620 | TComPTL::TComPTL() |
---|
3621 | { |
---|
3622 | ::memset(m_subLayerProfilePresentFlag, 0, sizeof(m_subLayerProfilePresentFlag)); |
---|
3623 | ::memset(m_subLayerLevelPresentFlag, 0, sizeof(m_subLayerLevelPresentFlag )); |
---|
3624 | } |
---|
3625 | #if VPS_EXTN_PROFILE_INFO |
---|
3626 | Void TComPTL::copyProfileInfo(TComPTL *ptl) |
---|
3627 | { |
---|
3628 | // Copy all information related to general profile |
---|
3629 | this->getGeneralPTL()->copyProfileInfo(ptl->getGeneralPTL()); |
---|
3630 | } |
---|
3631 | #endif |
---|
3632 | |
---|
3633 | #if SVC_EXTENSION |
---|
3634 | #if AVC_SYNTAX |
---|
3635 | Void TComSlice::initBaseLayerRPL( TComSlice *pcSlice ) |
---|
3636 | { |
---|
3637 | // Assumed that RPL of the base layer is same to the EL, otherwise this information should be also dumped and read from the metadata file |
---|
3638 | setPOC( pcSlice->getPOC() ); |
---|
3639 | if( pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA ) |
---|
3640 | { |
---|
3641 | setSliceType( I_SLICE ); |
---|
3642 | } |
---|
3643 | else |
---|
3644 | { |
---|
3645 | setSliceType( pcSlice->getSliceType() ); |
---|
3646 | } |
---|
3647 | |
---|
3648 | if( this->isIntra() ) |
---|
3649 | { |
---|
3650 | return; |
---|
3651 | } |
---|
3652 | |
---|
3653 | //initialize reference POC of BL |
---|
3654 | for( Int iRefPicList = 0; iRefPicList < 2; iRefPicList++ ) |
---|
3655 | { |
---|
3656 | RefPicList eRefPicList = RefPicList( iRefPicList ); |
---|
3657 | |
---|
3658 | assert( pcSlice->getNumRefIdx( eRefPicList) >= 0 ); |
---|
3659 | setNumRefIdx( eRefPicList, pcSlice->getNumRefIdx( eRefPicList ) - 1 ); |
---|
3660 | assert( getNumRefIdx( eRefPicList) <= MAX_NUM_REF); |
---|
3661 | |
---|
3662 | for(Int refIdx = 0; refIdx < getNumRefIdx( eRefPicList ); refIdx++) |
---|
3663 | { |
---|
3664 | setRefPOC( pcSlice->getRefPic( eRefPicList, refIdx )->getPOC(), eRefPicList, refIdx ); |
---|
3665 | setRefPic( pcSlice->getRefPic( eRefPicList, refIdx ), eRefPicList, refIdx ); |
---|
3666 | /* |
---|
3667 | // should be set if the base layer has its own instance of the reference picture lists, currently EL RPL is reused. |
---|
3668 | getRefPic( eRefPicList, refIdx )->setLayerId( 0 ); |
---|
3669 | getRefPic( eRefPicList, refIdx )->setIsLongTerm( pcSlice->getRefPic( eRefPicList, refIdx )->getIsLongTerm() ); |
---|
3670 | */ |
---|
3671 | |
---|
3672 | } |
---|
3673 | } |
---|
3674 | return; |
---|
3675 | } |
---|
3676 | #endif |
---|
3677 | |
---|
3678 | Bool TComSlice::setBaseColPic( TComList<TComPic*>& rcListPic, UInt refLayerIdc ) |
---|
3679 | { |
---|
3680 | if(m_layerId == 0) |
---|
3681 | { |
---|
3682 | memset( m_pcBaseColPic, 0, sizeof( m_pcBaseColPic ) ); |
---|
3683 | return false; |
---|
3684 | } |
---|
3685 | #if POC_RESET_FLAG |
---|
3686 | TComPic* pic = xGetRefPic( rcListPic, m_bPocResetFlag ? 0 : m_iPOC ); |
---|
3687 | |
---|
3688 | if( pic ) |
---|
3689 | { |
---|
3690 | setBaseColPic(refLayerIdc, pic ); |
---|
3691 | } |
---|
3692 | else |
---|
3693 | { |
---|
3694 | return false; |
---|
3695 | } |
---|
3696 | |
---|
3697 | return true; |
---|
3698 | #else |
---|
3699 | setBaseColPic(refLayerIdc, xGetRefPic(rcListPic, getPOC())); |
---|
3700 | #endif |
---|
3701 | } |
---|
3702 | |
---|
3703 | #if MFM_ENCCONSTRAINT |
---|
3704 | TComPic* TComSlice::getBaseColPic( TComList<TComPic*>& rcListPic ) |
---|
3705 | { |
---|
3706 | #if POC_RESET_FLAG |
---|
3707 | return xGetRefPic( rcListPic, m_bPocResetFlag ? 0 : m_iPOC ); |
---|
3708 | #else |
---|
3709 | return xGetRefPic( rcListPic, m_iPOC ); |
---|
3710 | #endif |
---|
3711 | } |
---|
3712 | #endif |
---|
3713 | |
---|
3714 | #if REF_IDX_MFM |
---|
3715 | Void TComSlice::setRefPOCListILP( TComPic** ilpPic, TComPic** pcRefPicRL ) |
---|
3716 | { |
---|
3717 | for( UInt i = 0; i < m_activeNumILRRefIdx; i++ ) |
---|
3718 | { |
---|
3719 | UInt refLayerIdc = m_interLayerPredLayerIdc[i]; |
---|
3720 | |
---|
3721 | TComPic* pcRefPicBL = pcRefPicRL[refLayerIdc]; |
---|
3722 | |
---|
3723 | //set reference picture POC of each ILP reference |
---|
3724 | Int thePoc = ilpPic[refLayerIdc]->getPOC(); |
---|
3725 | assert(thePoc == pcRefPicBL->getPOC()); |
---|
3726 | |
---|
3727 | ilpPic[refLayerIdc]->getSlice(0)->setBaseColPic( refLayerIdc, pcRefPicBL ); |
---|
3728 | |
---|
3729 | //copy layer id from the reference layer |
---|
3730 | ilpPic[refLayerIdc]->setLayerId( pcRefPicBL->getLayerId() ); |
---|
3731 | |
---|
3732 | //copy slice type from the reference layer |
---|
3733 | ilpPic[refLayerIdc]->getSlice(0)->setSliceType( pcRefPicBL->getSlice(0)->getSliceType() ); |
---|
3734 | |
---|
3735 | //copy "used for reference" |
---|
3736 | ilpPic[refLayerIdc]->getSlice(0)->setReferenced( pcRefPicBL->getSlice(0)->isReferenced() ); |
---|
3737 | |
---|
3738 | for( Int refList = 0; refList < 2; refList++ ) |
---|
3739 | { |
---|
3740 | RefPicList refPicList = RefPicList( refList ); |
---|
3741 | |
---|
3742 | //set reference POC of ILP |
---|
3743 | ilpPic[refLayerIdc]->getSlice(0)->setNumRefIdx(refPicList, pcRefPicBL->getSlice(0)->getNumRefIdx(refPicList)); |
---|
3744 | assert(ilpPic[refLayerIdc]->getSlice(0)->getNumRefIdx(refPicList) >= 0); |
---|
3745 | assert(ilpPic[refLayerIdc]->getSlice(0)->getNumRefIdx(refPicList) <= MAX_NUM_REF); |
---|
3746 | |
---|
3747 | //initialize reference POC of ILP |
---|
3748 | for(Int refIdx = 0; refIdx < pcRefPicBL->getSlice(0)->getNumRefIdx(refPicList); refIdx++) |
---|
3749 | { |
---|
3750 | ilpPic[refLayerIdc]->getSlice(0)->setRefPOC(pcRefPicBL->getSlice(0)->getRefPOC(refPicList, refIdx), refPicList, refIdx); |
---|
3751 | ilpPic[refLayerIdc]->getSlice(0)->setRefPic(pcRefPicBL->getSlice(0)->getRefPic(refPicList, refIdx), refPicList, refIdx); |
---|
3752 | } |
---|
3753 | |
---|
3754 | for(Int refIdx = pcRefPicBL->getSlice(0)->getNumRefIdx(refPicList); refIdx < MAX_NUM_REF; refIdx++) |
---|
3755 | { |
---|
3756 | ilpPic[refLayerIdc]->getSlice(0)->setRefPOC(0, refPicList, refIdx); |
---|
3757 | ilpPic[refLayerIdc]->getSlice(0)->setRefPic(NULL, refPicList, refIdx); |
---|
3758 | } |
---|
3759 | |
---|
3760 | //copy reference pictures' marking from the reference layer |
---|
3761 | for(Int j = 0; j < MAX_NUM_REF + 1; j++) |
---|
3762 | { |
---|
3763 | ilpPic[refLayerIdc]->getSlice(0)->setIsUsedAsLongTerm(refList, j, pcRefPicBL->getSlice(0)->getIsUsedAsLongTerm(refList, j)); |
---|
3764 | } |
---|
3765 | } |
---|
3766 | } |
---|
3767 | return; |
---|
3768 | } |
---|
3769 | #endif |
---|
3770 | |
---|
3771 | Void TComSlice::setILRPic(TComPic **pcIlpPic) |
---|
3772 | { |
---|
3773 | for( Int i = 0; i < m_activeNumILRRefIdx; i++ ) |
---|
3774 | { |
---|
3775 | Int refLayerIdc = m_interLayerPredLayerIdc[i]; |
---|
3776 | |
---|
3777 | if( pcIlpPic[refLayerIdc] ) |
---|
3778 | { |
---|
3779 | pcIlpPic[refLayerIdc]->copyUpsampledPictureYuv( m_pcPic->getFullPelBaseRec( refLayerIdc ), pcIlpPic[refLayerIdc]->getPicYuvRec() ); |
---|
3780 | pcIlpPic[refLayerIdc]->getSlice(0)->setPOC( m_iPOC ); |
---|
3781 | pcIlpPic[refLayerIdc]->setLayerId( m_pcBaseColPic[refLayerIdc]->getLayerId() ); //set reference layerId |
---|
3782 | pcIlpPic[refLayerIdc]->getPicYuvRec()->setBorderExtension( false ); |
---|
3783 | pcIlpPic[refLayerIdc]->getPicYuvRec()->extendPicBorder(); |
---|
3784 | for (Int j=0; j<pcIlpPic[refLayerIdc]->getPicSym()->getNumberOfCUsInFrame(); j++) // set reference CU layerId |
---|
3785 | { |
---|
3786 | pcIlpPic[refLayerIdc]->getPicSym()->getCU(j)->setLayerId( pcIlpPic[refLayerIdc]->getLayerId() ); |
---|
3787 | } |
---|
3788 | } |
---|
3789 | } |
---|
3790 | } |
---|
3791 | |
---|
3792 | #endif //SVC_EXTENSION |
---|
3793 | |
---|
3794 | //! \} |
---|