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-2012, 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 | |
---|
42 | //! \ingroup TLibCommon |
---|
43 | //! \{ |
---|
44 | |
---|
45 | TComSlice::TComSlice() |
---|
46 | : m_iPPSId ( -1 ) |
---|
47 | , m_iPOC ( 0 ) |
---|
48 | , m_iLastIDR ( 0 ) |
---|
49 | , m_eNalUnitType ( NAL_UNIT_CODED_SLICE_IDR ) |
---|
50 | , m_eNalUnitTypeBaseViewMvc ( NAL_UNIT_INVALID ) |
---|
51 | , m_eSliceType ( I_SLICE ) |
---|
52 | , m_iSliceQp ( 0 ) |
---|
53 | #if ADAPTIVE_QP_SELECTION |
---|
54 | , m_iSliceQpBase ( 0 ) |
---|
55 | #endif |
---|
56 | , m_bLoopFilterDisable ( false ) |
---|
57 | , m_inheritDblParamFromAPS ( true ) |
---|
58 | , m_loopFilterBetaOffsetDiv2 ( 0 ) |
---|
59 | , m_loopFilterTcOffsetDiv2 ( 0 ) |
---|
60 | , m_bRefPicListModificationFlagLC ( false ) |
---|
61 | , m_bRefPicListCombinationFlag ( false ) |
---|
62 | , m_bCheckLDC ( false ) |
---|
63 | , m_iSliceQpDelta ( 0 ) |
---|
64 | , m_pcTexturePic ( NULL ) |
---|
65 | , m_iDepth ( 0 ) |
---|
66 | , m_bRefenced ( false ) |
---|
67 | , m_pcSPS ( NULL ) |
---|
68 | , m_pcPPS ( NULL ) |
---|
69 | , m_pcPic ( NULL ) |
---|
70 | , m_uiColDir ( 0 ) |
---|
71 | #if COLLOCATED_REF_IDX |
---|
72 | , m_colRefIdx ( 0 ) |
---|
73 | #endif |
---|
74 | #if ALF_CHROMA_LAMBDA || SAO_CHROMA_LAMBDA |
---|
75 | , m_dLambdaLuma( 0.0 ) |
---|
76 | , m_dLambdaChroma( 0.0 ) |
---|
77 | #else |
---|
78 | , m_dLambda ( 0.0 ) |
---|
79 | #endif |
---|
80 | , m_bNoBackPredFlag ( false ) |
---|
81 | , m_bRefIdxCombineCoding ( false ) |
---|
82 | , m_uiTLayer ( 0 ) |
---|
83 | , m_bTLayerSwitchingFlag ( false ) |
---|
84 | , m_uiSliceMode ( 0 ) |
---|
85 | , m_uiSliceArgument ( 0 ) |
---|
86 | , m_uiSliceCurStartCUAddr ( 0 ) |
---|
87 | , m_uiSliceCurEndCUAddr ( 0 ) |
---|
88 | , m_uiSliceIdx ( 0 ) |
---|
89 | , m_uiEntropySliceMode ( 0 ) |
---|
90 | , m_uiEntropySliceArgument ( 0 ) |
---|
91 | , m_uiEntropySliceCurStartCUAddr ( 0 ) |
---|
92 | , m_uiEntropySliceCurEndCUAddr ( 0 ) |
---|
93 | , m_bNextSlice ( false ) |
---|
94 | , m_bNextEntropySlice ( false ) |
---|
95 | , m_uiSliceBits ( 0 ) |
---|
96 | , m_uiEntropySliceCounter ( 0 ) |
---|
97 | , m_bFinalized ( false ) |
---|
98 | , m_uiTileByteLocation ( NULL ) |
---|
99 | , m_uiTileCount ( 0 ) |
---|
100 | , m_iTileMarkerFlag ( 0 ) |
---|
101 | , m_uiTileOffstForMultES ( 0 ) |
---|
102 | , m_puiSubstreamSizes ( NULL ) |
---|
103 | #if CABAC_INIT_FLAG |
---|
104 | , m_cabacInitFlag ( false ) |
---|
105 | #else |
---|
106 | , m_cabacInitIdc ( -1 ) |
---|
107 | #endif |
---|
108 | #if TILES_WPP_ENTRY_POINT_SIGNALLING |
---|
109 | , m_numEntryPointOffsets ( 0 ) |
---|
110 | #endif |
---|
111 | #if SONY_COLPIC_AVAILABILITY |
---|
112 | , m_iViewOrderIdx ( 0 ) |
---|
113 | #endif |
---|
114 | { |
---|
115 | m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = m_aiNumRefIdx[2] = 0; |
---|
116 | |
---|
117 | initEqualRef(); |
---|
118 | |
---|
119 | for(Int iNumCount = 0; iNumCount < MAX_NUM_REF_LC; iNumCount++) |
---|
120 | { |
---|
121 | m_iRefIdxOfLC[REF_PIC_LIST_0][iNumCount]=-1; |
---|
122 | m_iRefIdxOfLC[REF_PIC_LIST_1][iNumCount]=-1; |
---|
123 | m_eListIdFromIdxOfLC[iNumCount]=0; |
---|
124 | m_iRefIdxFromIdxOfLC[iNumCount]=0; |
---|
125 | m_iRefIdxOfL0FromRefIdxOfL1[iNumCount] = -1; |
---|
126 | m_iRefIdxOfL1FromRefIdxOfL0[iNumCount] = -1; |
---|
127 | } |
---|
128 | for(Int iNumCount = 0; iNumCount < MAX_NUM_REF+1; iNumCount++) |
---|
129 | { |
---|
130 | m_apcRefPicList [0][iNumCount] = NULL; |
---|
131 | m_apcRefPicList [1][iNumCount] = NULL; |
---|
132 | m_aiRefPOCList [0][iNumCount] = 0; |
---|
133 | m_aiRefPOCList [1][iNumCount] = 0; |
---|
134 | m_aiRefViewIdList[0][iNumCount] = 0; |
---|
135 | m_aiRefViewIdList[1][iNumCount] = 0; |
---|
136 | } |
---|
137 | m_bCombineWithReferenceFlag = 0; |
---|
138 | resetWpScaling(m_weightPredTable); |
---|
139 | resetWpScalingLC(m_weightPredTableLC); |
---|
140 | initWpAcDcParam(); |
---|
141 | } |
---|
142 | |
---|
143 | TComSlice::~TComSlice() |
---|
144 | { |
---|
145 | if (m_uiTileByteLocation) |
---|
146 | { |
---|
147 | delete [] m_uiTileByteLocation; |
---|
148 | m_uiTileByteLocation = NULL; |
---|
149 | } |
---|
150 | delete[] m_puiSubstreamSizes; |
---|
151 | m_puiSubstreamSizes = NULL; |
---|
152 | } |
---|
153 | |
---|
154 | |
---|
155 | Void TComSlice::initSlice() |
---|
156 | { |
---|
157 | m_aiNumRefIdx[0] = 0; |
---|
158 | m_aiNumRefIdx[1] = 0; |
---|
159 | |
---|
160 | m_uiColDir = 0; |
---|
161 | |
---|
162 | #if COLLOCATED_REF_IDX |
---|
163 | m_colRefIdx = 0; |
---|
164 | #endif |
---|
165 | m_pcTexturePic = NULL; |
---|
166 | |
---|
167 | initEqualRef(); |
---|
168 | m_bNoBackPredFlag = false; |
---|
169 | m_bRefIdxCombineCoding = false; |
---|
170 | m_bRefPicListCombinationFlag = false; |
---|
171 | m_bRefPicListModificationFlagLC = false; |
---|
172 | m_bCheckLDC = false; |
---|
173 | |
---|
174 | m_aiNumRefIdx[REF_PIC_LIST_C] = 0; |
---|
175 | |
---|
176 | m_uiMaxNumMergeCand = MRG_MAX_NUM_CANDS_SIGNALED; |
---|
177 | |
---|
178 | m_bFinalized=false; |
---|
179 | |
---|
180 | m_uiTileCount = 0; |
---|
181 | #if CABAC_INIT_FLAG |
---|
182 | m_cabacInitFlag = false; |
---|
183 | #endif |
---|
184 | #if TILES_WPP_ENTRY_POINT_SIGNALLING |
---|
185 | m_numEntryPointOffsets = 0; |
---|
186 | #endif |
---|
187 | } |
---|
188 | |
---|
189 | Void TComSlice::initTiles() |
---|
190 | { |
---|
191 | Int iWidth = m_pcSPS->getPicWidthInLumaSamples(); |
---|
192 | Int iHeight = m_pcSPS->getPicHeightInLumaSamples(); |
---|
193 | UInt uiWidthInCU = ( iWidth %g_uiMaxCUWidth ) ? iWidth /g_uiMaxCUWidth + 1 : iWidth /g_uiMaxCUWidth; |
---|
194 | UInt uiHeightInCU = ( iHeight%g_uiMaxCUHeight ) ? iHeight/g_uiMaxCUHeight + 1 : iHeight/g_uiMaxCUHeight; |
---|
195 | UInt uiNumCUsInFrame = uiWidthInCU * uiHeightInCU; |
---|
196 | |
---|
197 | if (m_uiTileByteLocation==NULL) m_uiTileByteLocation = new UInt[uiNumCUsInFrame]; |
---|
198 | } |
---|
199 | |
---|
200 | |
---|
201 | /** |
---|
202 | - allocate table to contain substream sizes to be written to the slice header. |
---|
203 | . |
---|
204 | \param uiNumSubstreams Number of substreams -- the allocation will be this value - 1. |
---|
205 | */ |
---|
206 | Void TComSlice::allocSubstreamSizes(UInt uiNumSubstreams) |
---|
207 | { |
---|
208 | delete[] m_puiSubstreamSizes; |
---|
209 | m_puiSubstreamSizes = new UInt[uiNumSubstreams > 0 ? uiNumSubstreams-1 : 0]; |
---|
210 | } |
---|
211 | |
---|
212 | Void TComSlice::sortPicList (TComList<TComPic*>& rcListPic) |
---|
213 | { |
---|
214 | TComPic* pcPicExtract; |
---|
215 | TComPic* pcPicInsert; |
---|
216 | |
---|
217 | TComList<TComPic*>::iterator iterPicExtract; |
---|
218 | TComList<TComPic*>::iterator iterPicExtract_1; |
---|
219 | TComList<TComPic*>::iterator iterPicInsert; |
---|
220 | |
---|
221 | for (Int i = 1; i < (Int)(rcListPic.size()); i++) |
---|
222 | { |
---|
223 | iterPicExtract = rcListPic.begin(); |
---|
224 | for (Int j = 0; j < i; j++) iterPicExtract++; |
---|
225 | pcPicExtract = *(iterPicExtract); |
---|
226 | pcPicExtract->setCurrSliceIdx(0); |
---|
227 | |
---|
228 | iterPicInsert = rcListPic.begin(); |
---|
229 | while (iterPicInsert != iterPicExtract) |
---|
230 | { |
---|
231 | pcPicInsert = *(iterPicInsert); |
---|
232 | pcPicInsert->setCurrSliceIdx(0); |
---|
233 | if (pcPicInsert->getPOC() >= pcPicExtract->getPOC()) |
---|
234 | { |
---|
235 | break; |
---|
236 | } |
---|
237 | |
---|
238 | iterPicInsert++; |
---|
239 | } |
---|
240 | |
---|
241 | iterPicExtract_1 = iterPicExtract; iterPicExtract_1++; |
---|
242 | |
---|
243 | // swap iterPicExtract and iterPicInsert, iterPicExtract = curr. / iterPicInsert = insertion position |
---|
244 | rcListPic.insert (iterPicInsert, iterPicExtract, iterPicExtract_1); |
---|
245 | rcListPic.erase (iterPicExtract); |
---|
246 | } |
---|
247 | } |
---|
248 | |
---|
249 | TComPic* TComSlice::xGetRefPic( TComList<TComPic*>& rcListPic, UInt uiPOC ) |
---|
250 | { |
---|
251 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
252 | TComPic* pcPic = *(iterPic); |
---|
253 | while ( iterPic != rcListPic.end() ) |
---|
254 | { |
---|
255 | if(pcPic->getPOC() == uiPOC) |
---|
256 | { |
---|
257 | break; |
---|
258 | } |
---|
259 | iterPic++; |
---|
260 | pcPic = *(iterPic); |
---|
261 | } |
---|
262 | return pcPic; |
---|
263 | } |
---|
264 | |
---|
265 | |
---|
266 | TComPic* TComSlice::xGetLongTermRefPic( TComList<TComPic*>& rcListPic, UInt uiPOC ) |
---|
267 | { |
---|
268 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
269 | TComPic* pcPic = *(iterPic); |
---|
270 | TComPic* pcStPic = pcPic; |
---|
271 | while ( iterPic != rcListPic.end() ) |
---|
272 | { |
---|
273 | pcPic = *(iterPic); |
---|
274 | if(pcPic && (pcPic->getPOC()%(1<<getSPS()->getBitsForPOC())) == (uiPOC%(1<<getSPS()->getBitsForPOC()))) |
---|
275 | { |
---|
276 | if(pcPic->getIsLongTerm()) |
---|
277 | return pcPic; |
---|
278 | else |
---|
279 | pcStPic = pcPic; |
---|
280 | break; |
---|
281 | } |
---|
282 | |
---|
283 | iterPic++; |
---|
284 | } |
---|
285 | return pcStPic; |
---|
286 | } |
---|
287 | |
---|
288 | TComPic* TComSlice::xGetInterViewRefPic( std::vector<TComPic*>& rcListIvPic, UInt uiViewId ) |
---|
289 | { |
---|
290 | TComPic* pcPic = NULL; |
---|
291 | for( Int k = 0; k < rcListIvPic.size(); k++ ) |
---|
292 | { |
---|
293 | if( rcListIvPic[k]->getViewId() == uiViewId ) |
---|
294 | { |
---|
295 | pcPic = rcListIvPic[k]; |
---|
296 | break; |
---|
297 | } |
---|
298 | } |
---|
299 | |
---|
300 | assert( pcPic != NULL ); |
---|
301 | return pcPic; |
---|
302 | } |
---|
303 | |
---|
304 | Int TComSlice::getNumPocTotalCurr() |
---|
305 | { |
---|
306 | if( m_eSliceType == I_SLICE ) |
---|
307 | { |
---|
308 | return 0; |
---|
309 | } |
---|
310 | |
---|
311 | Int numPocTotalCurr = 0; |
---|
312 | for( UInt i = 0; i < m_pcRPS->getNumberOfNegativePictures()+ m_pcRPS->getNumberOfPositivePictures() + m_pcRPS->getNumberOfLongtermPictures(); i++ ) |
---|
313 | { |
---|
314 | if(m_pcRPS->getUsed(i)) |
---|
315 | { |
---|
316 | numPocTotalCurr++; |
---|
317 | } |
---|
318 | } |
---|
319 | |
---|
320 | return numPocTotalCurr; |
---|
321 | } |
---|
322 | |
---|
323 | Int TComSlice::getNumPocTotalCurrMvc() |
---|
324 | { |
---|
325 | if( m_eSliceType == I_SLICE ) |
---|
326 | { |
---|
327 | return 0; |
---|
328 | } |
---|
329 | return getNumPocTotalCurr() + m_pcSPS->getNumberOfUsableInterViewRefs(); |
---|
330 | } |
---|
331 | |
---|
332 | Void TComSlice::setRefPOCnViewListsMvc() |
---|
333 | { |
---|
334 | for(Int iDir = 0; iDir < 2; iDir++) |
---|
335 | { |
---|
336 | for(Int iNumRefIdx = 0; iNumRefIdx < m_aiNumRefIdx[iDir]; iNumRefIdx++) |
---|
337 | { |
---|
338 | m_aiRefPOCList [iDir][iNumRefIdx] = m_apcRefPicList[iDir][iNumRefIdx]->getPOC(); |
---|
339 | m_aiRefViewIdList[iDir][iNumRefIdx] = m_apcRefPicList[iDir][iNumRefIdx]->getViewId(); |
---|
340 | } |
---|
341 | } |
---|
342 | } |
---|
343 | |
---|
344 | Void TComSlice::generateCombinedList() |
---|
345 | { |
---|
346 | if(m_aiNumRefIdx[REF_PIC_LIST_C] > 0) |
---|
347 | { |
---|
348 | m_aiNumRefIdx[REF_PIC_LIST_C]=0; |
---|
349 | for(Int iNumCount = 0; iNumCount < MAX_NUM_REF_LC; iNumCount++) |
---|
350 | { |
---|
351 | m_iRefIdxOfLC[REF_PIC_LIST_0][iNumCount]=-1; |
---|
352 | m_iRefIdxOfLC[REF_PIC_LIST_1][iNumCount]=-1; |
---|
353 | m_eListIdFromIdxOfLC[iNumCount]=0; |
---|
354 | m_iRefIdxFromIdxOfLC[iNumCount]=0; |
---|
355 | m_iRefIdxOfL0FromRefIdxOfL1[iNumCount] = -1; |
---|
356 | m_iRefIdxOfL1FromRefIdxOfL0[iNumCount] = -1; |
---|
357 | } |
---|
358 | |
---|
359 | for (Int iNumRefIdx = 0; iNumRefIdx < MAX_NUM_REF; iNumRefIdx++) |
---|
360 | { |
---|
361 | if(iNumRefIdx < m_aiNumRefIdx[REF_PIC_LIST_0]) |
---|
362 | { |
---|
363 | Bool bTempRefIdxInL2 = true; |
---|
364 | for ( Int iRefIdxLC = 0; iRefIdxLC < m_aiNumRefIdx[REF_PIC_LIST_C]; iRefIdxLC++ ) |
---|
365 | { |
---|
366 | if( (m_apcRefPicList[REF_PIC_LIST_0][iNumRefIdx]->getPOC() == m_apcRefPicList[m_eListIdFromIdxOfLC[iRefIdxLC]][m_iRefIdxFromIdxOfLC[iRefIdxLC]]->getPOC() ) && |
---|
367 | (m_apcRefPicList[REF_PIC_LIST_0][iNumRefIdx]->getViewId() == m_apcRefPicList[m_eListIdFromIdxOfLC[iRefIdxLC]][m_iRefIdxFromIdxOfLC[iRefIdxLC]]->getViewId()) ) |
---|
368 | { |
---|
369 | m_iRefIdxOfL1FromRefIdxOfL0[iNumRefIdx] = m_iRefIdxFromIdxOfLC[iRefIdxLC]; |
---|
370 | m_iRefIdxOfL0FromRefIdxOfL1[m_iRefIdxFromIdxOfLC[iRefIdxLC]] = iNumRefIdx; |
---|
371 | bTempRefIdxInL2 = false; |
---|
372 | break; |
---|
373 | } |
---|
374 | } |
---|
375 | |
---|
376 | if(bTempRefIdxInL2 == true) |
---|
377 | { |
---|
378 | m_eListIdFromIdxOfLC[m_aiNumRefIdx[REF_PIC_LIST_C]] = REF_PIC_LIST_0; |
---|
379 | m_iRefIdxFromIdxOfLC[m_aiNumRefIdx[REF_PIC_LIST_C]] = iNumRefIdx; |
---|
380 | m_iRefIdxOfLC[REF_PIC_LIST_0][iNumRefIdx] = m_aiNumRefIdx[REF_PIC_LIST_C]++; |
---|
381 | } |
---|
382 | } |
---|
383 | |
---|
384 | if(iNumRefIdx < m_aiNumRefIdx[REF_PIC_LIST_1]) |
---|
385 | { |
---|
386 | Bool bTempRefIdxInL2 = true; |
---|
387 | for ( Int iRefIdxLC = 0; iRefIdxLC < m_aiNumRefIdx[REF_PIC_LIST_C]; iRefIdxLC++ ) |
---|
388 | { |
---|
389 | if( (m_apcRefPicList[REF_PIC_LIST_1][iNumRefIdx]->getPOC() == m_apcRefPicList[m_eListIdFromIdxOfLC[iRefIdxLC]][m_iRefIdxFromIdxOfLC[iRefIdxLC]]->getPOC() ) && |
---|
390 | (m_apcRefPicList[REF_PIC_LIST_1][iNumRefIdx]->getViewId() == m_apcRefPicList[m_eListIdFromIdxOfLC[iRefIdxLC]][m_iRefIdxFromIdxOfLC[iRefIdxLC]]->getViewId()) ) |
---|
391 | { |
---|
392 | m_iRefIdxOfL0FromRefIdxOfL1[iNumRefIdx] = m_iRefIdxFromIdxOfLC[iRefIdxLC]; |
---|
393 | m_iRefIdxOfL1FromRefIdxOfL0[m_iRefIdxFromIdxOfLC[iRefIdxLC]] = iNumRefIdx; |
---|
394 | bTempRefIdxInL2 = false; |
---|
395 | break; |
---|
396 | } |
---|
397 | } |
---|
398 | if(bTempRefIdxInL2 == true) |
---|
399 | { |
---|
400 | m_eListIdFromIdxOfLC[m_aiNumRefIdx[REF_PIC_LIST_C]] = REF_PIC_LIST_1; |
---|
401 | m_iRefIdxFromIdxOfLC[m_aiNumRefIdx[REF_PIC_LIST_C]] = iNumRefIdx; |
---|
402 | m_iRefIdxOfLC[REF_PIC_LIST_1][iNumRefIdx] = m_aiNumRefIdx[REF_PIC_LIST_C]++; |
---|
403 | } |
---|
404 | } |
---|
405 | } |
---|
406 | } |
---|
407 | } |
---|
408 | |
---|
409 | Void TComSlice::setRefPicListMvc( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& rapcInterViewRefPics ) |
---|
410 | { |
---|
411 | if( m_eSliceType == I_SLICE ) |
---|
412 | { |
---|
413 | ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList) ); |
---|
414 | ::memset( m_aiNumRefIdx, 0, sizeof ( m_aiNumRefIdx ) ); |
---|
415 | |
---|
416 | return; |
---|
417 | } |
---|
418 | |
---|
419 | TComPic* pcRefPic; |
---|
420 | TComPic* RefPicSetStCurr0[16]; |
---|
421 | TComPic* RefPicSetStCurr1[16]; |
---|
422 | TComPic* RefPicSetLtCurr [16]; |
---|
423 | TComPic* RefPicSetIvCurr [16]; |
---|
424 | |
---|
425 | UInt NumPocStCurr0 = 0; |
---|
426 | UInt NumPocStCurr1 = 0; |
---|
427 | UInt NumPocLtCurr = 0; |
---|
428 | UInt NumPocIvCurr = 0; |
---|
429 | |
---|
430 | Int i; |
---|
431 | // short term negative |
---|
432 | for( i = 0; i < m_pcRPS->getNumberOfNegativePictures(); i++ ) |
---|
433 | { |
---|
434 | if( m_pcRPS->getUsed(i) ) |
---|
435 | { |
---|
436 | pcRefPic = xGetRefPic( rcListPic, getPOC() + m_pcRPS->getDeltaPOC(i) ); |
---|
437 | pcRefPic->setIsLongTerm( 0 ); |
---|
438 | pcRefPic->getPicYuvRec()->extendPicBorder(); |
---|
439 | RefPicSetStCurr0[NumPocStCurr0] = pcRefPic; |
---|
440 | NumPocStCurr0++; |
---|
441 | } |
---|
442 | } |
---|
443 | // short term positive |
---|
444 | for( ; i < m_pcRPS->getNumberOfNegativePictures() + m_pcRPS->getNumberOfPositivePictures(); i++ ) |
---|
445 | { |
---|
446 | if( m_pcRPS->getUsed(i) ) |
---|
447 | { |
---|
448 | pcRefPic = xGetRefPic( rcListPic, getPOC() + m_pcRPS->getDeltaPOC(i) ); |
---|
449 | pcRefPic->setIsLongTerm( 0 ); |
---|
450 | pcRefPic->getPicYuvRec()->extendPicBorder(); |
---|
451 | RefPicSetStCurr1[NumPocStCurr1] = pcRefPic; |
---|
452 | NumPocStCurr1++; |
---|
453 | } |
---|
454 | } |
---|
455 | // long term |
---|
456 | for( i = m_pcRPS->getNumberOfNegativePictures() + m_pcRPS->getNumberOfPositivePictures() + m_pcRPS->getNumberOfLongtermPictures() - 1; i > m_pcRPS->getNumberOfNegativePictures() + m_pcRPS->getNumberOfPositivePictures() - 1 ; i-- ) |
---|
457 | { |
---|
458 | if( m_pcRPS->getUsed(i) ) |
---|
459 | { |
---|
460 | pcRefPic = xGetLongTermRefPic( rcListPic, m_pcRPS->getPOC(i) ); |
---|
461 | pcRefPic->setIsLongTerm( 1 ); |
---|
462 | pcRefPic->getPicYuvRec()->extendPicBorder(); |
---|
463 | RefPicSetLtCurr[NumPocLtCurr] = pcRefPic; |
---|
464 | NumPocLtCurr++; |
---|
465 | } |
---|
466 | } |
---|
467 | // inter-view |
---|
468 | for( i = 0; i < m_pcSPS->getNumberOfUsableInterViewRefs(); i++ ) |
---|
469 | { |
---|
470 | pcRefPic = xGetInterViewRefPic( rapcInterViewRefPics, getViewId() + m_pcSPS->getUsableInterViewRef(i) ); |
---|
471 | pcRefPic->setIsLongTerm( 0 ); |
---|
472 | pcRefPic->getPicYuvRec()->extendPicBorder(); |
---|
473 | RefPicSetIvCurr[NumPocIvCurr] = pcRefPic; |
---|
474 | NumPocIvCurr++; |
---|
475 | } |
---|
476 | |
---|
477 | // ref_pic_list_init |
---|
478 | UInt cIdx = 0; |
---|
479 | UInt num_ref_idx_l0_active_minus1 = m_aiNumRefIdx[0] - 1; |
---|
480 | UInt num_ref_idx_l1_active_minus1 = m_aiNumRefIdx[1] - 1; |
---|
481 | |
---|
482 | assert( (NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr + NumPocIvCurr) == getNumPocTotalCurrMvc() ); |
---|
483 | Int numRpsCurrTempList0 = max( (num_ref_idx_l0_active_minus1 + 1), (NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr + NumPocIvCurr) ); |
---|
484 | Int numRpsCurrTempList1 = max( (num_ref_idx_l1_active_minus1 + 1), (NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr + NumPocIvCurr) ); |
---|
485 | |
---|
486 | assert( numRpsCurrTempList0 <= 16 ); |
---|
487 | TComPic* refPicListTemp0[16]; |
---|
488 | assert( numRpsCurrTempList1 <= 16 ); |
---|
489 | TComPic* refPicListTemp1[16]; |
---|
490 | |
---|
491 | cIdx = 0; |
---|
492 | while( cIdx < numRpsCurrTempList0 ) |
---|
493 | { |
---|
494 | for( i = 0; i < NumPocStCurr0 && cIdx < numRpsCurrTempList0; cIdx++, i++ ) { refPicListTemp0[cIdx] = RefPicSetStCurr0[i]; } |
---|
495 | for( i = 0; i < NumPocStCurr1 && cIdx < numRpsCurrTempList0; cIdx++, i++ ) { refPicListTemp0[cIdx] = RefPicSetStCurr1[i]; } |
---|
496 | for( i = 0; i < NumPocLtCurr && cIdx < numRpsCurrTempList0; cIdx++, i++ ) { refPicListTemp0[cIdx] = RefPicSetLtCurr [i]; } |
---|
497 | for( i = 0; i < NumPocIvCurr && cIdx < numRpsCurrTempList0; cIdx++, i++ ) { refPicListTemp0[cIdx] = RefPicSetIvCurr [i]; } |
---|
498 | } |
---|
499 | |
---|
500 | cIdx = 0; |
---|
501 | while( cIdx < numRpsCurrTempList1 && m_eSliceType == B_SLICE ) |
---|
502 | { |
---|
503 | for( i = 0; i < NumPocStCurr1 && cIdx < numRpsCurrTempList1; cIdx++, i++ ) { refPicListTemp1[cIdx] = RefPicSetStCurr1[i]; } |
---|
504 | for( i = 0; i < NumPocStCurr0 && cIdx < numRpsCurrTempList1; cIdx++, i++ ) { refPicListTemp1[cIdx] = RefPicSetStCurr0[i]; } |
---|
505 | for( i = 0; i < NumPocLtCurr && cIdx < numRpsCurrTempList1; cIdx++, i++ ) { refPicListTemp1[cIdx] = RefPicSetLtCurr [i]; } |
---|
506 | for( i = 0; i < NumPocIvCurr && cIdx < numRpsCurrTempList1; cIdx++, i++ ) { refPicListTemp1[cIdx] = RefPicSetIvCurr [i]; } |
---|
507 | } |
---|
508 | |
---|
509 | for( cIdx = 0; cIdx <= num_ref_idx_l0_active_minus1; cIdx ++ ) |
---|
510 | { |
---|
511 | m_apcRefPicList[0][cIdx] = m_RefPicListModification.getRefPicListModificationFlagL0() ? refPicListTemp0[ m_RefPicListModification.getRefPicSetIdxL0(cIdx) ] : refPicListTemp0[cIdx]; |
---|
512 | } |
---|
513 | if( m_eSliceType == P_SLICE ) |
---|
514 | { |
---|
515 | m_aiNumRefIdx[1] = 0; |
---|
516 | ::memset( m_apcRefPicList[1], 0, sizeof(m_apcRefPicList[1]) ); |
---|
517 | } |
---|
518 | else |
---|
519 | { |
---|
520 | for( cIdx = 0; cIdx <= num_ref_idx_l1_active_minus1; cIdx ++ ) |
---|
521 | { |
---|
522 | m_apcRefPicList[1][cIdx] = m_RefPicListModification.getRefPicListModificationFlagL1() ? refPicListTemp1[ m_RefPicListModification.getRefPicSetIdxL1(cIdx) ] : refPicListTemp1[cIdx]; |
---|
523 | } |
---|
524 | } |
---|
525 | } |
---|
526 | |
---|
527 | Void TComSlice::initEqualRef() |
---|
528 | { |
---|
529 | for (Int iDir = 0; iDir < 2; iDir++) |
---|
530 | { |
---|
531 | for (Int iRefIdx1 = 0; iRefIdx1 < MAX_NUM_REF; iRefIdx1++) |
---|
532 | { |
---|
533 | for (Int iRefIdx2 = iRefIdx1; iRefIdx2 < MAX_NUM_REF; iRefIdx2++) |
---|
534 | { |
---|
535 | m_abEqualRef[iDir][iRefIdx1][iRefIdx2] = m_abEqualRef[iDir][iRefIdx2][iRefIdx1] = (iRefIdx1 == iRefIdx2? true : false); |
---|
536 | } |
---|
537 | } |
---|
538 | } |
---|
539 | } |
---|
540 | |
---|
541 | Void TComSlice::initMultiviewSlice( Int** aaiScale, Int** aaiOffset ) |
---|
542 | { |
---|
543 | if( m_pcSPS->hasCamParInSliceHeader() ) |
---|
544 | { |
---|
545 | UInt uiViewId = m_pcSPS->getViewId(); |
---|
546 | for( UInt uiBaseViewId = 0; uiBaseViewId < uiViewId; uiBaseViewId++ ) |
---|
547 | { |
---|
548 | m_aaiCodedScale [ 0 ][ uiBaseViewId ] = aaiScale [ uiBaseViewId ][ uiViewId ]; |
---|
549 | m_aaiCodedScale [ 1 ][ uiBaseViewId ] = aaiScale [ uiViewId ][ uiBaseViewId ]; |
---|
550 | m_aaiCodedOffset[ 0 ][ uiBaseViewId ] = aaiOffset[ uiBaseViewId ][ uiViewId ]; |
---|
551 | m_aaiCodedOffset[ 1 ][ uiBaseViewId ] = aaiOffset[ uiViewId ][ uiBaseViewId ]; |
---|
552 | } |
---|
553 | } |
---|
554 | } |
---|
555 | |
---|
556 | #if COLLOCATED_REF_IDX |
---|
557 | Void TComSlice::checkColRefIdx(UInt curSliceIdx, TComPic* pic) |
---|
558 | { |
---|
559 | Int i; |
---|
560 | TComSlice* curSlice = pic->getSlice(curSliceIdx); |
---|
561 | Int currColRefPOC = curSlice->getRefPOC( RefPicList(curSlice->getColDir()), curSlice->getColRefIdx()); |
---|
562 | TComSlice* preSlice; |
---|
563 | Int preColRefPOC; |
---|
564 | for(i=curSliceIdx-1; i>=0; i--) |
---|
565 | { |
---|
566 | preSlice = pic->getSlice(i); |
---|
567 | if(preSlice->getSliceType() != I_SLICE) |
---|
568 | { |
---|
569 | preColRefPOC = preSlice->getRefPOC( RefPicList(preSlice->getColDir()), preSlice->getColRefIdx()); |
---|
570 | if(currColRefPOC != preColRefPOC) |
---|
571 | { |
---|
572 | printf("Collocated_ref_idx shall always be the same for all slices of a coded picture!\n"); |
---|
573 | exit(EXIT_FAILURE); |
---|
574 | } |
---|
575 | else |
---|
576 | { |
---|
577 | break; |
---|
578 | } |
---|
579 | } |
---|
580 | } |
---|
581 | } |
---|
582 | #endif |
---|
583 | Void TComSlice::checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, TComList<TComPic*>& rcListPic) |
---|
584 | { |
---|
585 | for(Int i = 0; i < pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures(); i++) |
---|
586 | { |
---|
587 | if(pocCRA < MAX_UINT && getPOC() > pocCRA) |
---|
588 | { |
---|
589 | assert(getPOC()+pReferencePictureSet->getDeltaPOC(i) >= pocCRA); |
---|
590 | } |
---|
591 | } |
---|
592 | for(Int i = pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures(); i < pReferencePictureSet->getNumberOfPictures(); i++) |
---|
593 | { |
---|
594 | if(pocCRA < MAX_UINT && getPOC() > pocCRA) |
---|
595 | { |
---|
596 | assert(pReferencePictureSet->getPOC(i) >= pocCRA); |
---|
597 | } |
---|
598 | } |
---|
599 | #if H0566_TLA |
---|
600 | if( getNalUnitTypeBaseViewMvc() == NAL_UNIT_CODED_SLICE_CRA ) // CRA picture found |
---|
601 | #else |
---|
602 | if( getNalUnitTypeBaseViewMvc() == NAL_UNIT_CODED_SLICE_CDR ) // CDR picture found |
---|
603 | #endif |
---|
604 | { |
---|
605 | pocCRA = getPOC(); |
---|
606 | } |
---|
607 | } |
---|
608 | |
---|
609 | /** Function for marking the reference pictures when an IDR and CRA is encountered. |
---|
610 | * \param pocCRA POC of the CRA picture |
---|
611 | * \param bRefreshPending flag indicating if a deferred decoding refresh is pending |
---|
612 | * \param rcListPic reference to the reference picture list |
---|
613 | * This function marks the reference pictures as "unused for reference" in the following conditions. |
---|
614 | * If the nal_unit_type is IDR all pictures in the reference picture list |
---|
615 | * is marked as "unused for reference" |
---|
616 | * Otherwise do for the CRA case (non CRA case has no effect since both if conditions below will not be true) |
---|
617 | * If the bRefreshPending flag is true (a deferred decoding refresh is pending) and the current |
---|
618 | * temporal reference is greater than the temporal reference of the latest CRA picture (pocCRA), |
---|
619 | * mark all reference pictures except the latest CRA picture as "unused for reference" and set |
---|
620 | * the bRefreshPending flag to false. |
---|
621 | * If the nal_unit_type is CRA, set the bRefreshPending flag to true and pocCRA to the temporal |
---|
622 | * reference of the current picture. |
---|
623 | * Note that the current picture is already placed in the reference list and its marking is not changed. |
---|
624 | * If the current picture has a nal_ref_idc that is not 0, it will remain marked as "used for reference". |
---|
625 | */ |
---|
626 | Void TComSlice::decodingRefreshMarking(Int& pocCRA, Bool& bRefreshPending, TComList<TComPic*>& rcListPic) |
---|
627 | { |
---|
628 | TComPic* rpcPic; |
---|
629 | UInt uiPOCCurr = getPOC(); |
---|
630 | |
---|
631 | if( getNalUnitTypeBaseViewMvc() == NAL_UNIT_CODED_SLICE_IDR ) // IDR |
---|
632 | { |
---|
633 | // mark all pictures as not used for reference |
---|
634 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
635 | while (iterPic != rcListPic.end()) |
---|
636 | { |
---|
637 | rpcPic = *(iterPic); |
---|
638 | rpcPic->setCurrSliceIdx(0); |
---|
639 | if (rpcPic->getPOC() != uiPOCCurr) rpcPic->getSlice(0)->setReferenced(false); |
---|
640 | iterPic++; |
---|
641 | } |
---|
642 | } |
---|
643 | else // CRA or No DR |
---|
644 | { |
---|
645 | if (bRefreshPending==true && uiPOCCurr > pocCRA) // CRA reference marking pending |
---|
646 | { |
---|
647 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
648 | while (iterPic != rcListPic.end()) |
---|
649 | { |
---|
650 | rpcPic = *(iterPic); |
---|
651 | if (rpcPic->getPOC() != uiPOCCurr && rpcPic->getPOC() != pocCRA) rpcPic->getSlice(0)->setReferenced(false); |
---|
652 | iterPic++; |
---|
653 | } |
---|
654 | bRefreshPending = false; |
---|
655 | } |
---|
656 | #if H0566_TLA |
---|
657 | if( getNalUnitTypeBaseViewMvc() == NAL_UNIT_CODED_SLICE_CRA ) // CRA picture found |
---|
658 | #else |
---|
659 | if( getNalUnitTypeBaseViewMvc() == NAL_UNIT_CODED_SLICE_CDR ) // CDR picture found |
---|
660 | #endif |
---|
661 | { |
---|
662 | bRefreshPending = true; |
---|
663 | pocCRA = uiPOCCurr; |
---|
664 | } |
---|
665 | } |
---|
666 | } |
---|
667 | |
---|
668 | Void TComSlice::copySliceInfo(TComSlice *pSrc) |
---|
669 | { |
---|
670 | assert( pSrc != NULL ); |
---|
671 | |
---|
672 | Int i, j, k; |
---|
673 | |
---|
674 | m_iPOC = pSrc->m_iPOC; |
---|
675 | m_viewId = pSrc->m_viewId; |
---|
676 | #if SONY_COLPIC_AVAILABILITY |
---|
677 | m_iViewOrderIdx = pSrc->m_iViewOrderIdx; |
---|
678 | #endif |
---|
679 | m_eNalUnitType = pSrc->m_eNalUnitType; |
---|
680 | m_eNalUnitTypeBaseViewMvc = pSrc->m_eNalUnitTypeBaseViewMvc; |
---|
681 | m_eSliceType = pSrc->m_eSliceType; |
---|
682 | m_iSliceQp = pSrc->m_iSliceQp; |
---|
683 | #if ADAPTIVE_QP_SELECTION |
---|
684 | m_iSliceQpBase = pSrc->m_iSliceQpBase; |
---|
685 | #endif |
---|
686 | m_bLoopFilterDisable = pSrc->m_bLoopFilterDisable; |
---|
687 | m_inheritDblParamFromAPS = pSrc->m_inheritDblParamFromAPS; |
---|
688 | m_loopFilterBetaOffsetDiv2 = pSrc->m_loopFilterBetaOffsetDiv2; |
---|
689 | m_loopFilterTcOffsetDiv2 = pSrc->m_loopFilterTcOffsetDiv2; |
---|
690 | |
---|
691 | for (i = 0; i < 3; i++) |
---|
692 | { |
---|
693 | m_aiNumRefIdx[i] = pSrc->m_aiNumRefIdx[i]; |
---|
694 | } |
---|
695 | |
---|
696 | for (i = 0; i < 2; i++) |
---|
697 | { |
---|
698 | for (j = 0; j < MAX_NUM_REF_LC; j++) |
---|
699 | { |
---|
700 | m_iRefIdxOfLC[i][j] = pSrc->m_iRefIdxOfLC[i][j]; |
---|
701 | } |
---|
702 | } |
---|
703 | for (i = 0; i < MAX_NUM_REF_LC; i++) |
---|
704 | { |
---|
705 | m_eListIdFromIdxOfLC[i] = pSrc->m_eListIdFromIdxOfLC[i]; |
---|
706 | m_iRefIdxFromIdxOfLC[i] = pSrc->m_iRefIdxFromIdxOfLC[i]; |
---|
707 | m_iRefIdxOfL1FromRefIdxOfL0[i] = pSrc->m_iRefIdxOfL1FromRefIdxOfL0[i]; |
---|
708 | m_iRefIdxOfL0FromRefIdxOfL1[i] = pSrc->m_iRefIdxOfL0FromRefIdxOfL1[i]; |
---|
709 | } |
---|
710 | m_bRefPicListModificationFlagLC = pSrc->m_bRefPicListModificationFlagLC; |
---|
711 | m_bRefPicListCombinationFlag = pSrc->m_bRefPicListCombinationFlag; |
---|
712 | m_bCheckLDC = pSrc->m_bCheckLDC; |
---|
713 | m_iSliceQpDelta = pSrc->m_iSliceQpDelta; |
---|
714 | for (i = 0; i < 2; i++) |
---|
715 | { |
---|
716 | for (j = 0; j < MAX_NUM_REF; j++) |
---|
717 | { |
---|
718 | m_apcRefPicList [i][j] = pSrc->m_apcRefPicList [i][j]; |
---|
719 | m_aiRefPOCList [i][j] = pSrc->m_aiRefPOCList [i][j]; |
---|
720 | m_aiRefViewIdList[i][j] = pSrc->m_aiRefViewIdList[i][j]; |
---|
721 | } |
---|
722 | } |
---|
723 | m_iDepth = pSrc->m_iDepth; |
---|
724 | |
---|
725 | // referenced slice |
---|
726 | m_bRefenced = pSrc->m_bRefenced; |
---|
727 | |
---|
728 | // access channel |
---|
729 | m_pcSPS = pSrc->m_pcSPS; |
---|
730 | m_pcPPS = pSrc->m_pcPPS; |
---|
731 | m_pcRPS = pSrc->m_pcRPS; |
---|
732 | m_iLastIDR = pSrc->m_iLastIDR; |
---|
733 | |
---|
734 | m_pcPic = pSrc->m_pcPic; |
---|
735 | m_pcAPS = pSrc->m_pcAPS; |
---|
736 | m_iAPSId = pSrc->m_iAPSId; |
---|
737 | |
---|
738 | m_uiColDir = pSrc->m_uiColDir; |
---|
739 | #if COLLOCATED_REF_IDX |
---|
740 | m_colRefIdx = pSrc->m_colRefIdx; |
---|
741 | #endif |
---|
742 | #if ALF_CHROMA_LAMBDA || SAO_CHROMA_LAMBDA |
---|
743 | m_dLambdaLuma = pSrc->m_dLambdaLuma; |
---|
744 | m_dLambdaChroma = pSrc->m_dLambdaChroma; |
---|
745 | #else |
---|
746 | m_dLambda = pSrc->m_dLambda; |
---|
747 | #endif |
---|
748 | for (i = 0; i < 2; i++) |
---|
749 | { |
---|
750 | for (j = 0; j < MAX_NUM_REF; j++) |
---|
751 | { |
---|
752 | for (k =0; k < MAX_NUM_REF; k++) |
---|
753 | { |
---|
754 | m_abEqualRef[i][j][k] = pSrc->m_abEqualRef[i][j][k]; |
---|
755 | } |
---|
756 | } |
---|
757 | } |
---|
758 | |
---|
759 | m_bNoBackPredFlag = pSrc->m_bNoBackPredFlag; |
---|
760 | m_bRefIdxCombineCoding = pSrc->m_bRefIdxCombineCoding; |
---|
761 | |
---|
762 | m_uiTLayer = pSrc->m_uiTLayer; |
---|
763 | m_bTLayerSwitchingFlag = pSrc->m_bTLayerSwitchingFlag; |
---|
764 | |
---|
765 | m_uiSliceMode = pSrc->m_uiSliceMode; |
---|
766 | m_uiSliceArgument = pSrc->m_uiSliceArgument; |
---|
767 | m_uiSliceCurStartCUAddr = pSrc->m_uiSliceCurStartCUAddr; |
---|
768 | m_uiSliceCurEndCUAddr = pSrc->m_uiSliceCurEndCUAddr; |
---|
769 | m_uiSliceIdx = pSrc->m_uiSliceIdx; |
---|
770 | m_uiEntropySliceMode = pSrc->m_uiEntropySliceMode; |
---|
771 | m_uiEntropySliceArgument = pSrc->m_uiEntropySliceArgument; |
---|
772 | m_uiEntropySliceCurStartCUAddr = pSrc->m_uiEntropySliceCurStartCUAddr; |
---|
773 | m_uiEntropySliceCurEndCUAddr = pSrc->m_uiEntropySliceCurEndCUAddr; |
---|
774 | m_bNextSlice = pSrc->m_bNextSlice; |
---|
775 | m_bNextEntropySlice = pSrc->m_bNextEntropySlice; |
---|
776 | m_iTileMarkerFlag = pSrc->m_iTileMarkerFlag; |
---|
777 | for ( int e=0 ; e<2 ; e++ ) |
---|
778 | for ( int n=0 ; n<MAX_NUM_REF ; n++ ) |
---|
779 | memcpy(m_weightPredTable[e][n], pSrc->m_weightPredTable[e][n], sizeof(wpScalingParam)*3 ); |
---|
780 | |
---|
781 | m_saoEnabledFlag = pSrc->m_saoEnabledFlag; |
---|
782 | #if SAO_UNIT_INTERLEAVING |
---|
783 | m_saoInterleavingFlag = pSrc->m_saoInterleavingFlag; |
---|
784 | m_saoEnabledFlagCb = pSrc->m_saoEnabledFlagCb; |
---|
785 | m_saoEnabledFlagCr = pSrc->m_saoEnabledFlagCr; |
---|
786 | #endif |
---|
787 | #if CABAC_INIT_FLAG |
---|
788 | m_cabacInitFlag = pSrc->m_cabacInitFlag; |
---|
789 | #endif |
---|
790 | #if TILES_WPP_ENTRY_POINT_SIGNALLING |
---|
791 | m_numEntryPointOffsets = pSrc->m_numEntryPointOffsets; |
---|
792 | #endif |
---|
793 | |
---|
794 | #if H0111_MVD_L1_ZERO |
---|
795 | m_bLMvdL1Zero = pSrc->m_bLMvdL1Zero; |
---|
796 | #endif |
---|
797 | } |
---|
798 | |
---|
799 | int TComSlice::m_prevPOC = 0; |
---|
800 | /** Function for setting the slice's temporal layer ID and corresponding temporal_layer_switching_point_flag. |
---|
801 | * \param uiTLayer Temporal layer ID of the current slice |
---|
802 | * The decoder calls this function to set temporal_layer_switching_point_flag for each temporal layer based on |
---|
803 | * the SPS's temporal_id_nesting_flag and the parsed PPS. Then, current slice's temporal layer ID and |
---|
804 | * temporal_layer_switching_point_flag is set accordingly. |
---|
805 | */ |
---|
806 | Void TComSlice::setTLayerInfo( UInt uiTLayer ) |
---|
807 | { |
---|
808 | #if !H0566_TLA |
---|
809 | // If temporal_id_nesting_flag == 1, then num_temporal_layer_switching_point_flags shall be inferred to be 0 and temporal_layer_switching_point_flag shall be inferred to be 1 for all temporal layers |
---|
810 | if ( m_pcSPS->getTemporalIdNestingFlag() ) |
---|
811 | { |
---|
812 | m_pcPPS->setNumTLayerSwitchingFlags( 0 ); |
---|
813 | for ( UInt i = 0; i < MAX_TLAYER; i++ ) |
---|
814 | { |
---|
815 | m_pcPPS->setTLayerSwitchingFlag( i, true ); |
---|
816 | } |
---|
817 | } |
---|
818 | else |
---|
819 | { |
---|
820 | for ( UInt i = m_pcPPS->getNumTLayerSwitchingFlags(); i < MAX_TLAYER; i++ ) |
---|
821 | { |
---|
822 | m_pcPPS->setTLayerSwitchingFlag( i, false ); |
---|
823 | } |
---|
824 | } |
---|
825 | #endif |
---|
826 | |
---|
827 | m_uiTLayer = uiTLayer; |
---|
828 | #if !H0566_TLA |
---|
829 | m_bTLayerSwitchingFlag = m_pcPPS->getTLayerSwitchingFlag( uiTLayer ); |
---|
830 | #endif |
---|
831 | } |
---|
832 | |
---|
833 | #if H0566_TLA && H0566_TLA_SET_FOR_SWITCHING_POINTS |
---|
834 | /** Function for checking if this is a switching-point |
---|
835 | */ |
---|
836 | Bool TComSlice::isTemporalLayerSwitchingPoint( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet) |
---|
837 | { |
---|
838 | TComPic* rpcPic; |
---|
839 | // loop through all pictures in the reference picture buffer |
---|
840 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
841 | while ( iterPic != rcListPic.end()) |
---|
842 | { |
---|
843 | rpcPic = *(iterPic++); |
---|
844 | if(rpcPic->getSlice(0)->isReferenced() && rpcPic->getPOC() != getPOC()) |
---|
845 | { |
---|
846 | if(rpcPic->getTLayer() >= getTLayer()) |
---|
847 | { |
---|
848 | return false; |
---|
849 | } |
---|
850 | } |
---|
851 | } |
---|
852 | return true; |
---|
853 | } |
---|
854 | #endif |
---|
855 | |
---|
856 | /** Function for applying picture marking based on the Reference Picture Set in pReferencePictureSet. |
---|
857 | */ |
---|
858 | Void TComSlice::applyReferencePictureSet( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet) |
---|
859 | { |
---|
860 | TComPic* rpcPic; |
---|
861 | Int i, isReference; |
---|
862 | |
---|
863 | Int j = 0; |
---|
864 | // loop through all pictures in the reference picture buffer |
---|
865 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
866 | while ( iterPic != rcListPic.end()) |
---|
867 | { |
---|
868 | j++; |
---|
869 | rpcPic = *(iterPic++); |
---|
870 | |
---|
871 | isReference = 0; |
---|
872 | // loop through all pictures in the Reference Picture Set to see if the picture should be kept as reference picture |
---|
873 | for(i=0;i<pReferencePictureSet->getNumberOfPositivePictures()+pReferencePictureSet->getNumberOfNegativePictures();i++) |
---|
874 | { |
---|
875 | if(!rpcPic->getIsLongTerm() && rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getPOC() + pReferencePictureSet->getDeltaPOC(i)) |
---|
876 | { |
---|
877 | isReference = 1; |
---|
878 | rpcPic->setUsedByCurr(pReferencePictureSet->getUsed(i)); |
---|
879 | rpcPic->setIsLongTerm(0); |
---|
880 | } |
---|
881 | } |
---|
882 | // long term pictures |
---|
883 | for(;i<pReferencePictureSet->getNumberOfPictures();i++) |
---|
884 | { |
---|
885 | if(rpcPic->getIsLongTerm() && (rpcPic->getPicSym()->getSlice(0)->getPOC()%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC())) == pReferencePictureSet->getPOC(i)%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC())) |
---|
886 | { |
---|
887 | isReference = 1; |
---|
888 | rpcPic->setUsedByCurr(pReferencePictureSet->getUsed(i)); |
---|
889 | } |
---|
890 | } |
---|
891 | // mark the picture as "unused for reference" if it is not in |
---|
892 | // the Reference Picture Set |
---|
893 | if(rpcPic->getPicSym()->getSlice(0)->getPOC() != this->getPOC() && isReference == 0) |
---|
894 | { |
---|
895 | rpcPic->getSlice( 0 )->setReferenced( false ); |
---|
896 | rpcPic->setIsLongTerm(0); |
---|
897 | } |
---|
898 | } |
---|
899 | } |
---|
900 | |
---|
901 | /** Function for applying picture marking based on the Reference Picture Set in pReferencePictureSet. |
---|
902 | */ |
---|
903 | #if START_DECODING_AT_CRA |
---|
904 | Int TComSlice::checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool outputFlag, Int pocRandomAccess) |
---|
905 | #else |
---|
906 | Int TComSlice::checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool outputFlag) |
---|
907 | #endif |
---|
908 | { |
---|
909 | TComPic* rpcPic; |
---|
910 | Int i, isAvailable, j; |
---|
911 | Int atLeastOneLost = 0; |
---|
912 | Int atLeastOneRemoved = 0; |
---|
913 | Int iPocLost = 0; |
---|
914 | |
---|
915 | // loop through all long-term pictures in the Reference Picture Set |
---|
916 | // to see if the picture should be kept as reference picture |
---|
917 | for(i=pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures();i<pReferencePictureSet->getNumberOfPictures();i++) |
---|
918 | { |
---|
919 | j = 0; |
---|
920 | isAvailable = 0; |
---|
921 | // loop through all pictures in the reference picture buffer |
---|
922 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
923 | while ( iterPic != rcListPic.end()) |
---|
924 | { |
---|
925 | j++; |
---|
926 | rpcPic = *(iterPic++); |
---|
927 | if(rpcPic->getIsLongTerm() && (rpcPic->getPicSym()->getSlice(0)->getPOC()%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC())) == pReferencePictureSet->getPOC(i)%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC()) && rpcPic->getSlice(0)->isReferenced()) |
---|
928 | { |
---|
929 | isAvailable = 1; |
---|
930 | } |
---|
931 | } |
---|
932 | // if there was no such long-term check the short terms |
---|
933 | if(!isAvailable) |
---|
934 | { |
---|
935 | iterPic = rcListPic.begin(); |
---|
936 | while ( iterPic != rcListPic.end()) |
---|
937 | { |
---|
938 | j++; |
---|
939 | rpcPic = *(iterPic++); |
---|
940 | |
---|
941 | if((rpcPic->getPicSym()->getSlice(0)->getPOC()%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC())) == (this->getPOC() + pReferencePictureSet->getDeltaPOC(i))%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC()) && rpcPic->getSlice(0)->isReferenced()) |
---|
942 | { |
---|
943 | isAvailable = 1; |
---|
944 | rpcPic->setIsLongTerm(1); |
---|
945 | break; |
---|
946 | } |
---|
947 | } |
---|
948 | } |
---|
949 | // report that a picture is lost if it is in the Reference Picture Set |
---|
950 | // but not available as reference picture |
---|
951 | if(isAvailable == 0) |
---|
952 | { |
---|
953 | #if START_DECODING_AT_CRA |
---|
954 | if (this->getPOC() + pReferencePictureSet->getDeltaPOC(i) >= pocRandomAccess) |
---|
955 | { |
---|
956 | #endif |
---|
957 | if(!pReferencePictureSet->getUsed(i) ) |
---|
958 | { |
---|
959 | if(outputFlag) |
---|
960 | printf("\nLong-term reference picture with POC = %3d seems to have been removed or not correctly decoded.", this->getPOC() + pReferencePictureSet->getDeltaPOC(i)); |
---|
961 | atLeastOneRemoved = 1; |
---|
962 | } |
---|
963 | else |
---|
964 | { |
---|
965 | if(outputFlag) |
---|
966 | printf("\nLong-term reference picture with POC = %3d is lost or not correctly decoded!", this->getPOC() + pReferencePictureSet->getDeltaPOC(i)); |
---|
967 | atLeastOneLost = 1; |
---|
968 | iPocLost=this->getPOC() + pReferencePictureSet->getDeltaPOC(i); |
---|
969 | } |
---|
970 | #if START_DECODING_AT_CRA |
---|
971 | } |
---|
972 | #endif |
---|
973 | } |
---|
974 | } |
---|
975 | // loop through all short-term pictures in the Reference Picture Set |
---|
976 | // to see if the picture should be kept as reference picture |
---|
977 | for(i=0;i<pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures();i++) |
---|
978 | { |
---|
979 | j = 0; |
---|
980 | isAvailable = 0; |
---|
981 | // loop through all pictures in the reference picture buffer |
---|
982 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
983 | while ( iterPic != rcListPic.end()) |
---|
984 | { |
---|
985 | j++; |
---|
986 | rpcPic = *(iterPic++); |
---|
987 | |
---|
988 | if(!rpcPic->getIsLongTerm() && rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getPOC() + pReferencePictureSet->getDeltaPOC(i) && rpcPic->getSlice(0)->isReferenced()) |
---|
989 | { |
---|
990 | isAvailable = 1; |
---|
991 | } |
---|
992 | } |
---|
993 | // report that a picture is lost if it is in the Reference Picture Set |
---|
994 | // but not available as reference picture |
---|
995 | if(isAvailable == 0) |
---|
996 | { |
---|
997 | #if START_DECODING_AT_CRA |
---|
998 | if (this->getPOC() + pReferencePictureSet->getDeltaPOC(i) >= pocRandomAccess) |
---|
999 | { |
---|
1000 | #endif |
---|
1001 | if(!pReferencePictureSet->getUsed(i) ) |
---|
1002 | { |
---|
1003 | if(outputFlag) |
---|
1004 | printf("\nShort-term reference picture with POC = %3d seems to have been removed or not correctly decoded.", this->getPOC() + pReferencePictureSet->getDeltaPOC(i)); |
---|
1005 | atLeastOneRemoved = 1; |
---|
1006 | } |
---|
1007 | else |
---|
1008 | { |
---|
1009 | if(outputFlag) |
---|
1010 | printf("\nShort-term reference picture with POC = %3d is lost or not correctly decoded!", this->getPOC() + pReferencePictureSet->getDeltaPOC(i)); |
---|
1011 | atLeastOneLost = 1; |
---|
1012 | iPocLost=this->getPOC() + pReferencePictureSet->getDeltaPOC(i); |
---|
1013 | } |
---|
1014 | #if START_DECODING_AT_CRA |
---|
1015 | } |
---|
1016 | #endif |
---|
1017 | } |
---|
1018 | } |
---|
1019 | if(atLeastOneLost) |
---|
1020 | { |
---|
1021 | return iPocLost+1; |
---|
1022 | } |
---|
1023 | if(atLeastOneRemoved) |
---|
1024 | { |
---|
1025 | return -2; |
---|
1026 | } |
---|
1027 | else |
---|
1028 | return 0; |
---|
1029 | } |
---|
1030 | |
---|
1031 | /** Function for constructing an explicit Reference Picture Set out of the available pictures in a referenced Reference Picture Set |
---|
1032 | */ |
---|
1033 | Void TComSlice::createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet) |
---|
1034 | { |
---|
1035 | TComPic* rpcPic; |
---|
1036 | Int i, j; |
---|
1037 | Int k = 0; |
---|
1038 | Int nrOfNegativePictures = 0; |
---|
1039 | Int nrOfPositivePictures = 0; |
---|
1040 | TComReferencePictureSet* pcRPS = this->getLocalRPS(); |
---|
1041 | |
---|
1042 | // loop through all pictures in the Reference Picture Set |
---|
1043 | for(i=0;i<pReferencePictureSet->getNumberOfPictures();i++) |
---|
1044 | { |
---|
1045 | j = 0; |
---|
1046 | // loop through all pictures in the reference picture buffer |
---|
1047 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
1048 | while ( iterPic != rcListPic.end()) |
---|
1049 | { |
---|
1050 | j++; |
---|
1051 | rpcPic = *(iterPic++); |
---|
1052 | |
---|
1053 | if(rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getPOC() + pReferencePictureSet->getDeltaPOC(i) && rpcPic->getSlice(0)->isReferenced()) |
---|
1054 | { |
---|
1055 | // This picture exists as a reference picture |
---|
1056 | // and should be added to the explicit Reference Picture Set |
---|
1057 | pcRPS->setDeltaPOC(k, pReferencePictureSet->getDeltaPOC(i)); |
---|
1058 | pcRPS->setUsed(k, pReferencePictureSet->getUsed(i)); |
---|
1059 | if(pcRPS->getDeltaPOC(k) < 0) |
---|
1060 | nrOfNegativePictures++; |
---|
1061 | else |
---|
1062 | nrOfPositivePictures++; |
---|
1063 | k++; |
---|
1064 | } |
---|
1065 | } |
---|
1066 | } |
---|
1067 | pcRPS->setNumberOfNegativePictures(nrOfNegativePictures); |
---|
1068 | pcRPS->setNumberOfPositivePictures(nrOfPositivePictures); |
---|
1069 | pcRPS->setNumberOfPictures(nrOfNegativePictures+nrOfPositivePictures); |
---|
1070 | // This is a simplistic inter rps example. A smarter encoder will look for a better reference RPS to do the |
---|
1071 | // inter RPS prediction with. Here we just use the reference used by pReferencePictureSet. |
---|
1072 | // If pReferencePictureSet is not inter_RPS_predicted, then inter_RPS_prediction is for the current RPS also disabled. |
---|
1073 | if (!pReferencePictureSet->getInterRPSPrediction()) |
---|
1074 | { |
---|
1075 | pcRPS->setInterRPSPrediction(false); |
---|
1076 | pcRPS->setNumRefIdc(0); |
---|
1077 | } |
---|
1078 | else |
---|
1079 | { |
---|
1080 | Int rIdx = this->getRPSidx() - pReferencePictureSet->getDeltaRIdxMinus1() - 1; |
---|
1081 | Int deltaRPS = pReferencePictureSet->getDeltaRPS(); |
---|
1082 | #if RPS_IN_SPS |
---|
1083 | TComReferencePictureSet* pcRefRPS = this->getSPS()->getRPSList()->getReferencePictureSet(rIdx); |
---|
1084 | #else |
---|
1085 | TComReferencePictureSet* pcRefRPS = this->getPPS()->getRPSList()->getReferencePictureSet(rIdx); |
---|
1086 | #endif |
---|
1087 | Int iRefPics = pcRefRPS->getNumberOfPictures(); |
---|
1088 | Int iNewIdc=0; |
---|
1089 | for(i=0; i<= iRefPics; i++) |
---|
1090 | { |
---|
1091 | Int deltaPOC = ((i != iRefPics)? pcRefRPS->getDeltaPOC(i) : 0); // check if the reference abs POC is >= 0 |
---|
1092 | Int iRefIdc = 0; |
---|
1093 | for (j=0; j < pcRPS->getNumberOfPictures(); j++) // loop through the pictures in the new RPS |
---|
1094 | { |
---|
1095 | if ( (deltaPOC + deltaRPS) == pcRPS->getDeltaPOC(j)) |
---|
1096 | { |
---|
1097 | if (pcRPS->getUsed(j)) |
---|
1098 | { |
---|
1099 | iRefIdc = 1; |
---|
1100 | } |
---|
1101 | else |
---|
1102 | { |
---|
1103 | iRefIdc = 2; |
---|
1104 | } |
---|
1105 | } |
---|
1106 | } |
---|
1107 | pcRPS->setRefIdc(i, iRefIdc); |
---|
1108 | iNewIdc++; |
---|
1109 | } |
---|
1110 | pcRPS->setInterRPSPrediction(true); |
---|
1111 | pcRPS->setNumRefIdc(iNewIdc); |
---|
1112 | pcRPS->setDeltaRPS(deltaRPS); |
---|
1113 | #if RPS_IN_SPS |
---|
1114 | pcRPS->setDeltaRIdxMinus1(pReferencePictureSet->getDeltaRIdxMinus1() + this->getSPS()->getRPSList()->getNumberOfReferencePictureSets() - this->getRPSidx()); |
---|
1115 | #else |
---|
1116 | pcRPS->setDeltaRIdxMinus1(pReferencePictureSet->getDeltaRIdxMinus1() + this->getPPS()->getRPSList()->getNumberOfReferencePictureSets() - this->getRPSidx()); |
---|
1117 | #endif |
---|
1118 | } |
---|
1119 | |
---|
1120 | this->setRPS(pcRPS); |
---|
1121 | this->setRPSidx(-1); |
---|
1122 | } |
---|
1123 | |
---|
1124 | Void TComSlice::decodingMarkingForNoTMVP( TComList<TComPic*>& rcListPic, Int currentPOC ) |
---|
1125 | { |
---|
1126 | TComList<TComPic*>::iterator it; |
---|
1127 | for ( it = rcListPic.begin(); it != rcListPic.end(); it++ ) |
---|
1128 | { |
---|
1129 | if ( (*it)->getSlice(0)->getPOC() != currentPOC ) |
---|
1130 | { |
---|
1131 | (*it)->setUsedForTMVP( false ); |
---|
1132 | } |
---|
1133 | } |
---|
1134 | } |
---|
1135 | |
---|
1136 | /** get AC and DC values for weighted pred |
---|
1137 | * \param *wp |
---|
1138 | * \returns Void |
---|
1139 | */ |
---|
1140 | Void TComSlice::getWpAcDcParam(wpACDCParam *&wp) |
---|
1141 | { |
---|
1142 | wp = m_weightACDCParam; |
---|
1143 | } |
---|
1144 | |
---|
1145 | /** init AC and DC values for weighted pred |
---|
1146 | * \returns Void |
---|
1147 | */ |
---|
1148 | Void TComSlice::initWpAcDcParam() |
---|
1149 | { |
---|
1150 | for(Int iComp = 0; iComp < 3; iComp++ ) |
---|
1151 | { |
---|
1152 | m_weightACDCParam[iComp].iAC = 0; |
---|
1153 | m_weightACDCParam[iComp].iDC = 0; |
---|
1154 | } |
---|
1155 | } |
---|
1156 | |
---|
1157 | /** get WP tables for weighted pred |
---|
1158 | * \param RefPicList |
---|
1159 | * \param iRefIdx |
---|
1160 | * \param *&wpScalingParam |
---|
1161 | * \returns Void |
---|
1162 | */ |
---|
1163 | Void TComSlice::getWpScaling( RefPicList e, Int iRefIdx, wpScalingParam *&wp ) |
---|
1164 | { |
---|
1165 | wp = m_weightPredTable[e][iRefIdx]; |
---|
1166 | } |
---|
1167 | |
---|
1168 | /** reset Default WP tables settings : no weight. |
---|
1169 | * \param wpScalingParam |
---|
1170 | * \returns Void |
---|
1171 | */ |
---|
1172 | Void TComSlice::resetWpScaling(wpScalingParam wp[2][MAX_NUM_REF][3]) |
---|
1173 | { |
---|
1174 | for ( int e=0 ; e<2 ; e++ ) |
---|
1175 | { |
---|
1176 | for ( int i=0 ; i<MAX_NUM_REF ; i++ ) |
---|
1177 | { |
---|
1178 | for ( int yuv=0 ; yuv<3 ; yuv++ ) |
---|
1179 | { |
---|
1180 | wpScalingParam *pwp = &(wp[e][i][yuv]); |
---|
1181 | pwp->bPresentFlag = false; |
---|
1182 | pwp->uiLog2WeightDenom = 0; |
---|
1183 | pwp->uiLog2WeightDenom = 0; |
---|
1184 | pwp->iWeight = 1; |
---|
1185 | pwp->iOffset = 0; |
---|
1186 | } |
---|
1187 | } |
---|
1188 | } |
---|
1189 | } |
---|
1190 | |
---|
1191 | /** init WP table |
---|
1192 | * \returns Void |
---|
1193 | */ |
---|
1194 | Void TComSlice::initWpScaling() |
---|
1195 | { |
---|
1196 | initWpScaling(m_weightPredTable); |
---|
1197 | } |
---|
1198 | |
---|
1199 | /** set WP tables |
---|
1200 | * \param wpScalingParam |
---|
1201 | * \returns Void |
---|
1202 | */ |
---|
1203 | Void TComSlice::initWpScaling(wpScalingParam wp[2][MAX_NUM_REF][3]) |
---|
1204 | { |
---|
1205 | for ( int e=0 ; e<2 ; e++ ) |
---|
1206 | { |
---|
1207 | for ( int i=0 ; i<MAX_NUM_REF ; i++ ) |
---|
1208 | { |
---|
1209 | for ( int yuv=0 ; yuv<3 ; yuv++ ) |
---|
1210 | { |
---|
1211 | wpScalingParam *pwp = &(wp[e][i][yuv]); |
---|
1212 | if ( !pwp->bPresentFlag ) { |
---|
1213 | // Inferring values not present : |
---|
1214 | pwp->iWeight = (1 << pwp->uiLog2WeightDenom); |
---|
1215 | pwp->iOffset = 0; |
---|
1216 | } |
---|
1217 | |
---|
1218 | pwp->w = pwp->iWeight; |
---|
1219 | pwp->o = pwp->iOffset * (1 << (g_uiBitDepth-8)); |
---|
1220 | pwp->shift = pwp->uiLog2WeightDenom; |
---|
1221 | pwp->round = (pwp->uiLog2WeightDenom>=1) ? (1 << (pwp->uiLog2WeightDenom-1)) : (0); |
---|
1222 | } |
---|
1223 | } |
---|
1224 | } |
---|
1225 | } |
---|
1226 | |
---|
1227 | /** get WP tables for weighted pred of LC |
---|
1228 | * \param iRefIdxLC |
---|
1229 | * \param *&wpScalingParam |
---|
1230 | * \returns Void |
---|
1231 | */ |
---|
1232 | Void TComSlice::getWpScalingLC( Int iRefIdx, wpScalingParam *&wp ) |
---|
1233 | { |
---|
1234 | wp = m_weightPredTableLC[iRefIdx]; |
---|
1235 | } |
---|
1236 | /** reset Default WP tables settings for LC : no weight. |
---|
1237 | * \param wpScalingParam |
---|
1238 | * \returns Void |
---|
1239 | */ |
---|
1240 | Void TComSlice::resetWpScalingLC(wpScalingParam wp[2*MAX_NUM_REF][3]) |
---|
1241 | { |
---|
1242 | for ( int i=0 ; i<2*MAX_NUM_REF ; i++ ) |
---|
1243 | { |
---|
1244 | for ( int yuv=0 ; yuv<3 ; yuv++ ) |
---|
1245 | { |
---|
1246 | wpScalingParam *pwp = &(wp[i][yuv]); |
---|
1247 | pwp->bPresentFlag = false; |
---|
1248 | pwp->uiLog2WeightDenom = 0; |
---|
1249 | pwp->uiLog2WeightDenom = 0; |
---|
1250 | pwp->iWeight = 1; |
---|
1251 | pwp->iOffset = 0; |
---|
1252 | } |
---|
1253 | } |
---|
1254 | } |
---|
1255 | /** set current WP tables settings for LC |
---|
1256 | * \returns Void |
---|
1257 | */ |
---|
1258 | Void TComSlice::setWpParamforLC() |
---|
1259 | { |
---|
1260 | for ( Int iRefIdx=0 ; iRefIdx<getNumRefIdx(REF_PIC_LIST_C) ; iRefIdx++ ) |
---|
1261 | { |
---|
1262 | RefPicList eRefPicList = (RefPicList)getListIdFromIdxOfLC(iRefIdx); |
---|
1263 | Int iCombRefIdx = getRefIdxFromIdxOfLC(iRefIdx); |
---|
1264 | |
---|
1265 | wpScalingParam *wp_src, *wp_dst; |
---|
1266 | getWpScalingLC(iRefIdx, wp_src); |
---|
1267 | getWpScaling(eRefPicList, iCombRefIdx, wp_dst); |
---|
1268 | copyWPtable(wp_src, wp_dst); |
---|
1269 | |
---|
1270 | if(eRefPicList == REF_PIC_LIST_0) |
---|
1271 | { |
---|
1272 | Int iRefIdxL1 = getRefIdxOfL1FromRefIdxOfL0(iCombRefIdx); |
---|
1273 | if(iRefIdxL1 >= 0) |
---|
1274 | { |
---|
1275 | getWpScaling(REF_PIC_LIST_1, iRefIdxL1, wp_dst); |
---|
1276 | copyWPtable(wp_src, wp_dst); |
---|
1277 | } |
---|
1278 | } |
---|
1279 | if(eRefPicList == REF_PIC_LIST_1) |
---|
1280 | { |
---|
1281 | Int iRefIdxL0 = getRefIdxOfL0FromRefIdxOfL1(iCombRefIdx); |
---|
1282 | if(iRefIdxL0 >= 0) |
---|
1283 | { |
---|
1284 | getWpScaling(REF_PIC_LIST_0, iRefIdxL0, wp_dst); |
---|
1285 | copyWPtable(wp_src, wp_dst); |
---|
1286 | } |
---|
1287 | } |
---|
1288 | } |
---|
1289 | initWpScaling(); |
---|
1290 | } |
---|
1291 | /** copy source WP tables to destination table for LC |
---|
1292 | * \param wpScalingParam *&wp_src : source |
---|
1293 | * \param wpScalingParam *&wp_dst : destination |
---|
1294 | * \returns Void |
---|
1295 | */ |
---|
1296 | Void TComSlice::copyWPtable(wpScalingParam *&wp_src, wpScalingParam *&wp_dst) |
---|
1297 | { |
---|
1298 | for ( Int iComp = 0; iComp < 3; iComp++ ) |
---|
1299 | { |
---|
1300 | wp_dst[iComp].uiLog2WeightDenom = (iComp==0) ? wp_src[0].uiLog2WeightDenom : wp_src[1].uiLog2WeightDenom; |
---|
1301 | wp_dst[iComp].bPresentFlag = wp_src[iComp].bPresentFlag; |
---|
1302 | wp_dst[iComp].iWeight = wp_src[iComp].iWeight; |
---|
1303 | wp_dst[iComp].iOffset = wp_src[iComp].iOffset; |
---|
1304 | } |
---|
1305 | } |
---|
1306 | |
---|
1307 | |
---|
1308 | // ------------------------------------------------------------------------------------------------ |
---|
1309 | // Sequence parameter set (SPS) |
---|
1310 | // ------------------------------------------------------------------------------------------------ |
---|
1311 | |
---|
1312 | TComSPS::TComSPS() |
---|
1313 | : m_SPSId ( 0) |
---|
1314 | , m_ProfileIdc ( 0) |
---|
1315 | , m_LevelIdc ( 0) |
---|
1316 | , m_chromaFormatIdc (CHROMA_420) |
---|
1317 | , m_uiMaxTLayers ( 1) |
---|
1318 | // Structure |
---|
1319 | , m_picWidthInLumaSamples (352) |
---|
1320 | , m_picHeightInLumaSamples (288) |
---|
1321 | #if PIC_CROPPING |
---|
1322 | , m_picCroppingFlag (false) |
---|
1323 | , m_picCropLeftOffset ( 0) |
---|
1324 | , m_picCropRightOffset ( 0) |
---|
1325 | , m_picCropTopOffset ( 0) |
---|
1326 | , m_picCropBottomOffset ( 0) |
---|
1327 | #endif |
---|
1328 | , m_uiMaxCUWidth ( 32) |
---|
1329 | , m_uiMaxCUHeight ( 32) |
---|
1330 | , m_uiMaxCUDepth ( 3) |
---|
1331 | , m_uiMinTrDepth ( 0) |
---|
1332 | , m_uiMaxTrDepth ( 1) |
---|
1333 | #if RPS_IN_SPS |
---|
1334 | , m_bLongTermRefsPresent (false) |
---|
1335 | #endif |
---|
1336 | #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER |
---|
1337 | , m_numReorderFrames ( 0) |
---|
1338 | #endif |
---|
1339 | , m_iNumberOfUsableInterViewRefs( 0 ) |
---|
1340 | , m_uiQuadtreeTULog2MaxSize ( 0) |
---|
1341 | , m_uiQuadtreeTULog2MinSize ( 0) |
---|
1342 | , m_uiQuadtreeTUMaxDepthInter ( 0) |
---|
1343 | , m_uiQuadtreeTUMaxDepthIntra ( 0) |
---|
1344 | // Tool list |
---|
1345 | , m_usePCM (false) |
---|
1346 | , m_pcmLog2MaxSize ( 5) |
---|
1347 | , m_uiPCMLog2MinSize ( 7) |
---|
1348 | , m_bDisInter4x4 ( 1) |
---|
1349 | , m_bUseALF (false) |
---|
1350 | #if LCU_SYNTAX_ALF |
---|
1351 | , m_bALFCoefInSlice (false) |
---|
1352 | #endif |
---|
1353 | #if !PIC_CROPPING |
---|
1354 | , m_bUsePAD (false) |
---|
1355 | #endif |
---|
1356 | , m_bUseLMChroma (false) |
---|
1357 | , m_bUseLComb (false) |
---|
1358 | , m_bLCMod (false) |
---|
1359 | #if H0412_REF_PIC_LIST_RESTRICTION |
---|
1360 | , m_restrictedRefPicListsFlag ( 1) |
---|
1361 | , m_listsModificationPresentFlag( 0) |
---|
1362 | #endif |
---|
1363 | , m_uiBitDepth ( 8) |
---|
1364 | , m_uiBitIncrement ( 0) |
---|
1365 | #if H0736_AVC_STYLE_QP_RANGE |
---|
1366 | , m_qpBDOffsetY ( 0) |
---|
1367 | , m_qpBDOffsetC ( 0) |
---|
1368 | #endif |
---|
1369 | #if LOSSLESS_CODING |
---|
1370 | , m_useLossless (false) |
---|
1371 | #endif |
---|
1372 | , m_uiPCMBitDepthLuma ( 8) |
---|
1373 | , m_uiPCMBitDepthChroma ( 8) |
---|
1374 | , m_bPCMFilterDisableFlag (false) |
---|
1375 | , m_uiBitsForPOC ( 8) |
---|
1376 | , m_uiMaxTrSize ( 32) |
---|
1377 | , m_bLFCrossSliceBoundaryFlag (false) |
---|
1378 | , m_bUseSAO (false) |
---|
1379 | #if HHI_MPI |
---|
1380 | , m_bUseMVI (false) |
---|
1381 | #endif |
---|
1382 | , m_bLFCrossTileBoundaryFlag (false) |
---|
1383 | , m_iUniformSpacingIdr ( 0 ) |
---|
1384 | , m_iTileBoundaryIndependenceIdr ( 0 ) |
---|
1385 | , m_iNumColumnsMinus1 ( 0 ) |
---|
1386 | , m_puiColumnWidth ( NULL ) |
---|
1387 | , m_iNumRowsMinus1 ( 0 ) |
---|
1388 | , m_puiRowHeight ( NULL ) |
---|
1389 | , m_bTemporalIdNestingFlag (false) |
---|
1390 | , m_scalingListEnabledFlag (false) |
---|
1391 | #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER |
---|
1392 | , m_uiMaxDecFrameBuffering ( 0) |
---|
1393 | , m_uiMaxLatencyIncrease ( 0) |
---|
1394 | #endif |
---|
1395 | #if TILES_WPP_ENTRY_POINT_SIGNALLING |
---|
1396 | , m_tilesOrEntropyCodingSyncIdc( 0 ) |
---|
1397 | , m_numSubstreams ( 0 ) |
---|
1398 | #endif |
---|
1399 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
1400 | , m_bUseDMM (false) |
---|
1401 | #endif |
---|
1402 | { |
---|
1403 | // AMVP parameter |
---|
1404 | ::memset( m_aeAMVPMode, 0, sizeof( m_aeAMVPMode ) ); |
---|
1405 | #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER |
---|
1406 | for ( Int i = 0; i < MAX_TLAYER; i++ ) |
---|
1407 | { |
---|
1408 | m_uiMaxLatencyIncrease[i] = 0; |
---|
1409 | m_uiMaxDecPicBuffering[i] = 0; |
---|
1410 | m_numReorderPics[i] = 0; |
---|
1411 | } |
---|
1412 | #endif |
---|
1413 | |
---|
1414 | m_uiViewId = 0; |
---|
1415 | m_iViewOrderIdx = 0; |
---|
1416 | m_bDepth = false; |
---|
1417 | m_uiCamParPrecision = 0; |
---|
1418 | m_bCamParInSliceHeader = false; |
---|
1419 | ::memset( m_aaiCodedScale, 0x00, sizeof( m_aaiCodedScale ) ); |
---|
1420 | ::memset( m_aaiCodedOffset, 0x00, sizeof( m_aaiCodedOffset ) ); |
---|
1421 | |
---|
1422 | #if DEPTH_MAP_GENERATION |
---|
1423 | m_uiPredDepthMapGeneration = 0; |
---|
1424 | m_uiPdmPrecision = 0; |
---|
1425 | ::memset( m_aiPdmScaleNomDelta, 0x00, sizeof( m_aiPdmScaleNomDelta ) ); |
---|
1426 | ::memset( m_aiPdmOffset, 0x00, sizeof( m_aiPdmOffset ) ); |
---|
1427 | #endif |
---|
1428 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
1429 | m_uiMultiviewMvPredMode = 0; |
---|
1430 | #endif |
---|
1431 | |
---|
1432 | ::memset( m_aiUsableInterViewRefs, 0, sizeof( m_aiUsableInterViewRefs ) ); |
---|
1433 | } |
---|
1434 | |
---|
1435 | TComSPS::~TComSPS() |
---|
1436 | { |
---|
1437 | if( m_iNumColumnsMinus1 > 0 && m_iUniformSpacingIdr == 0 ) |
---|
1438 | { |
---|
1439 | delete [] m_puiColumnWidth; |
---|
1440 | m_puiColumnWidth = NULL; |
---|
1441 | } |
---|
1442 | if( m_iNumRowsMinus1 > 0 && m_iUniformSpacingIdr == 0 ) |
---|
1443 | { |
---|
1444 | delete [] m_puiRowHeight; |
---|
1445 | m_puiRowHeight = NULL; |
---|
1446 | } |
---|
1447 | } |
---|
1448 | |
---|
1449 | TComPPS::TComPPS() |
---|
1450 | : m_PPSId (0) |
---|
1451 | , m_SPSId (0) |
---|
1452 | , m_picInitQPMinus26 (0) |
---|
1453 | , m_useDQP (false) |
---|
1454 | , m_bConstrainedIntraPred (false) |
---|
1455 | , m_pcSPS (NULL) |
---|
1456 | , m_uiMaxCuDQPDepth (0) |
---|
1457 | , m_uiMinCuDQPSize (0) |
---|
1458 | , m_iChromaQpOffset (0) |
---|
1459 | , m_iChromaQpOffset2nd (0) |
---|
1460 | #if !RPS_IN_SPS |
---|
1461 | , m_bLongTermRefsPresent (false) |
---|
1462 | #endif |
---|
1463 | #if !H0566_TLA |
---|
1464 | , m_uiNumTlayerSwitchingFlags (0) |
---|
1465 | #endif |
---|
1466 | , m_iSliceGranularity (0) |
---|
1467 | , m_iTileBehaviorControlPresentFlag (0) |
---|
1468 | , m_bLFCrossTileBoundaryFlag (true) |
---|
1469 | , m_iColumnRowInfoPresent (0) |
---|
1470 | , m_iUniformSpacingIdr (0) |
---|
1471 | #if !REMOVE_TILE_DEPENDENCE |
---|
1472 | , m_iTileBoundaryIndependenceIdr (0) |
---|
1473 | #endif |
---|
1474 | , m_iNumColumnsMinus1 (0) |
---|
1475 | , m_puiColumnWidth (NULL) |
---|
1476 | , m_iNumRowsMinus1 (0) |
---|
1477 | , m_puiRowHeight (NULL) |
---|
1478 | #if !WPP_SIMPLIFICATION |
---|
1479 | , m_iEntropyCodingSynchro (0) |
---|
1480 | , m_bCabacIstateReset (false) |
---|
1481 | #endif |
---|
1482 | , m_iNumSubstreams (1) |
---|
1483 | #if MULTIBITS_DATA_HIDING |
---|
1484 | , m_signHideFlag(0) |
---|
1485 | , m_signHidingThreshold(0) |
---|
1486 | #endif |
---|
1487 | #if CABAC_INIT_FLAG |
---|
1488 | , m_cabacInitPresentFlag (false) |
---|
1489 | , m_encCABACTableIdx (0) |
---|
1490 | #endif |
---|
1491 | { |
---|
1492 | #if !H0566_TLA |
---|
1493 | for ( UInt i = 0; i < MAX_TLAYER; i++ ) |
---|
1494 | { |
---|
1495 | m_abTLayerSwitchingFlag[i] = false; |
---|
1496 | } |
---|
1497 | #endif |
---|
1498 | } |
---|
1499 | |
---|
1500 | TComPPS::~TComPPS() |
---|
1501 | { |
---|
1502 | if( m_iNumColumnsMinus1 > 0 && m_iUniformSpacingIdr == 0 ) |
---|
1503 | { |
---|
1504 | if (m_puiColumnWidth) delete [] m_puiColumnWidth; |
---|
1505 | m_puiColumnWidth = NULL; |
---|
1506 | } |
---|
1507 | if( m_iNumRowsMinus1 > 0 && m_iUniformSpacingIdr == 0 ) |
---|
1508 | { |
---|
1509 | if (m_puiRowHeight) delete [] m_puiRowHeight; |
---|
1510 | m_puiRowHeight = NULL; |
---|
1511 | } |
---|
1512 | } |
---|
1513 | |
---|
1514 | Void |
---|
1515 | TComSPS::initMultiviewSPS( UInt uiViewId, Int iViewOrderIdx, UInt uiCamParPrecision, Bool bCamParSlice, Int** aaiScale, Int** aaiOffset ) |
---|
1516 | { |
---|
1517 | AOT( uiViewId == 0 && iViewOrderIdx != 0 ); |
---|
1518 | AOT( uiViewId != 0 && iViewOrderIdx == 0 ); |
---|
1519 | AOT( uiViewId != 0 && !bCamParSlice && ( aaiScale == 0 || aaiOffset == 0 ) ); |
---|
1520 | |
---|
1521 | m_uiViewId = uiViewId; |
---|
1522 | m_iViewOrderIdx = iViewOrderIdx; |
---|
1523 | m_bDepth = false; |
---|
1524 | m_uiCamParPrecision = ( m_uiViewId ? uiCamParPrecision : 0 ); |
---|
1525 | m_bCamParInSliceHeader = ( m_uiViewId ? bCamParSlice : false ); |
---|
1526 | ::memset( m_aaiCodedScale, 0x00, sizeof( m_aaiCodedScale ) ); |
---|
1527 | ::memset( m_aaiCodedOffset, 0x00, sizeof( m_aaiCodedOffset ) ); |
---|
1528 | if( !m_bCamParInSliceHeader ) |
---|
1529 | { |
---|
1530 | for( UInt uiBaseViewId = 0; uiBaseViewId < m_uiViewId; uiBaseViewId++ ) |
---|
1531 | { |
---|
1532 | m_aaiCodedScale [ 0 ][ uiBaseViewId ] = aaiScale [ uiBaseViewId ][ m_uiViewId ]; |
---|
1533 | m_aaiCodedScale [ 1 ][ uiBaseViewId ] = aaiScale [ m_uiViewId ][ uiBaseViewId ]; |
---|
1534 | m_aaiCodedOffset[ 0 ][ uiBaseViewId ] = aaiOffset[ uiBaseViewId ][ m_uiViewId ]; |
---|
1535 | m_aaiCodedOffset[ 1 ][ uiBaseViewId ] = aaiOffset[ m_uiViewId ][ uiBaseViewId ]; |
---|
1536 | } |
---|
1537 | } |
---|
1538 | } |
---|
1539 | |
---|
1540 | Void |
---|
1541 | TComSPS::initMultiviewSPSDepth( UInt uiViewId, Int iViewOrderIdx ) |
---|
1542 | { |
---|
1543 | AOT( uiViewId == 0 && iViewOrderIdx != 0 ); |
---|
1544 | AOT( uiViewId != 0 && iViewOrderIdx == 0 ); |
---|
1545 | |
---|
1546 | m_uiViewId = uiViewId; |
---|
1547 | m_iViewOrderIdx = iViewOrderIdx; |
---|
1548 | m_bDepth = true; |
---|
1549 | m_uiCamParPrecision = 0; |
---|
1550 | m_bCamParInSliceHeader = false; |
---|
1551 | ::memset( m_aaiCodedScale, 0x00, sizeof( m_aaiCodedScale ) ); |
---|
1552 | ::memset( m_aaiCodedOffset, 0x00, sizeof( m_aaiCodedOffset ) ); |
---|
1553 | } |
---|
1554 | |
---|
1555 | #if DEPTH_MAP_GENERATION |
---|
1556 | Void |
---|
1557 | TComSPS::setPredDepthMapGeneration( UInt uiViewId, Bool bIsDepth, UInt uiPdmGenMode, UInt uiPdmMvPredMode, UInt uiPdmPrec, Int** aaiPdmScaleNomDelta, Int** aaiPdmOffset ) |
---|
1558 | { |
---|
1559 | AOF( m_uiViewId == uiViewId ); |
---|
1560 | AOF( m_bDepth == bIsDepth ); |
---|
1561 | AOT( ( uiViewId == 0 || bIsDepth ) && uiPdmGenMode ); |
---|
1562 | AOT( uiPdmGenMode && ( aaiPdmScaleNomDelta == 0 || aaiPdmOffset == 0 ) ); |
---|
1563 | AOT( uiPdmMvPredMode && uiPdmGenMode == 0 ); |
---|
1564 | |
---|
1565 | m_uiPredDepthMapGeneration = uiPdmGenMode; |
---|
1566 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
1567 | m_uiMultiviewMvPredMode = uiPdmMvPredMode; |
---|
1568 | #endif |
---|
1569 | |
---|
1570 | m_uiPdmPrecision = ( m_uiPredDepthMapGeneration ? uiPdmPrec : 0 ); |
---|
1571 | ::memset( m_aiPdmScaleNomDelta, 0x00, sizeof( m_aiPdmScaleNomDelta ) ); |
---|
1572 | ::memset( m_aiPdmOffset, 0x00, sizeof( m_aiPdmOffset ) ); |
---|
1573 | if( m_uiPredDepthMapGeneration ) |
---|
1574 | { |
---|
1575 | for( UInt uiBaseId = 0; uiBaseId < m_uiViewId; uiBaseId++ ) |
---|
1576 | { |
---|
1577 | m_aiPdmScaleNomDelta[ uiBaseId ] = aaiPdmScaleNomDelta[ m_uiViewId ][ uiBaseId ]; |
---|
1578 | m_aiPdmOffset [ uiBaseId ] = aaiPdmOffset [ m_uiViewId ][ uiBaseId ]; |
---|
1579 | } |
---|
1580 | } |
---|
1581 | } |
---|
1582 | #endif |
---|
1583 | |
---|
1584 | TComReferencePictureSet::TComReferencePictureSet() |
---|
1585 | : m_numberOfPictures (0) |
---|
1586 | , m_numberOfNegativePictures (0) |
---|
1587 | , m_numberOfPositivePictures (0) |
---|
1588 | , m_numberOfLongtermPictures (0) |
---|
1589 | , m_interRPSPrediction (0) |
---|
1590 | , m_deltaRIdxMinus1 (0) |
---|
1591 | , m_deltaRPS (0) |
---|
1592 | , m_numRefIdc (0) |
---|
1593 | { |
---|
1594 | ::memset( m_deltaPOC, 0, sizeof(m_deltaPOC) ); |
---|
1595 | ::memset( m_POC, 0, sizeof(m_POC) ); |
---|
1596 | ::memset( m_used, 0, sizeof(m_used) ); |
---|
1597 | ::memset( m_refIdc, 0, sizeof(m_refIdc) ); |
---|
1598 | } |
---|
1599 | |
---|
1600 | TComReferencePictureSet::~TComReferencePictureSet() |
---|
1601 | { |
---|
1602 | } |
---|
1603 | |
---|
1604 | Void TComReferencePictureSet::setUsed(Int bufferNum, Bool used) |
---|
1605 | { |
---|
1606 | m_used[bufferNum] = used; |
---|
1607 | } |
---|
1608 | |
---|
1609 | Void TComReferencePictureSet::setDeltaPOC(Int bufferNum, Int deltaPOC) |
---|
1610 | { |
---|
1611 | m_deltaPOC[bufferNum] = deltaPOC; |
---|
1612 | } |
---|
1613 | |
---|
1614 | Void TComReferencePictureSet::setNumberOfPictures(Int numberOfPictures) |
---|
1615 | { |
---|
1616 | m_numberOfPictures = numberOfPictures; |
---|
1617 | } |
---|
1618 | |
---|
1619 | Int TComReferencePictureSet::getUsed(Int bufferNum) |
---|
1620 | { |
---|
1621 | return m_used[bufferNum]; |
---|
1622 | } |
---|
1623 | |
---|
1624 | Int TComReferencePictureSet::getDeltaPOC(Int bufferNum) |
---|
1625 | { |
---|
1626 | return m_deltaPOC[bufferNum]; |
---|
1627 | } |
---|
1628 | |
---|
1629 | Int TComReferencePictureSet::getNumberOfPictures() |
---|
1630 | { |
---|
1631 | return m_numberOfPictures; |
---|
1632 | } |
---|
1633 | |
---|
1634 | Int TComReferencePictureSet::getPOC(Int bufferNum) |
---|
1635 | { |
---|
1636 | return m_POC[bufferNum]; |
---|
1637 | } |
---|
1638 | Void TComReferencePictureSet::setPOC(Int bufferNum, Int POC) |
---|
1639 | { |
---|
1640 | m_POC[bufferNum] = POC; |
---|
1641 | } |
---|
1642 | |
---|
1643 | /** set the reference idc value at uiBufferNum entry to the value of iRefIdc |
---|
1644 | * \param uiBufferNum |
---|
1645 | * \param iRefIdc |
---|
1646 | * \returns Void |
---|
1647 | */ |
---|
1648 | Void TComReferencePictureSet::setRefIdc(Int bufferNum, Int refIdc) |
---|
1649 | { |
---|
1650 | m_refIdc[bufferNum] = refIdc; |
---|
1651 | } |
---|
1652 | |
---|
1653 | /** get the reference idc value at uiBufferNum |
---|
1654 | * \param uiBufferNum |
---|
1655 | * \returns Int |
---|
1656 | */ |
---|
1657 | Int TComReferencePictureSet::getRefIdc(Int bufferNum) |
---|
1658 | { |
---|
1659 | return m_refIdc[bufferNum]; |
---|
1660 | } |
---|
1661 | |
---|
1662 | /** Sorts the deltaPOC and Used by current values in the RPS based on the deltaPOC values. |
---|
1663 | * deltaPOC values are sorted with -ve values before the +ve values. -ve values are in decreasing order. |
---|
1664 | * +ve values are in increasing order. |
---|
1665 | * \returns Void |
---|
1666 | */ |
---|
1667 | Void TComReferencePictureSet::sortDeltaPOC() |
---|
1668 | { |
---|
1669 | // sort in increasing order (smallest first) |
---|
1670 | for(Int j=1; j < getNumberOfPictures(); j++) |
---|
1671 | { |
---|
1672 | Int deltaPOC = getDeltaPOC(j); |
---|
1673 | Bool used = getUsed(j); |
---|
1674 | for (Int k=j-1; k >= 0; k--) |
---|
1675 | { |
---|
1676 | Int temp = getDeltaPOC(k); |
---|
1677 | if (deltaPOC < temp) |
---|
1678 | { |
---|
1679 | setDeltaPOC(k+1, temp); |
---|
1680 | setUsed(k+1, getUsed(k)); |
---|
1681 | setDeltaPOC(k, deltaPOC); |
---|
1682 | setUsed(k, used); |
---|
1683 | } |
---|
1684 | } |
---|
1685 | } |
---|
1686 | // flip the negative values to largest first |
---|
1687 | Int numNegPics = getNumberOfNegativePictures(); |
---|
1688 | for(Int j=0, k=numNegPics-1; j < numNegPics>>1; j++, k--) |
---|
1689 | { |
---|
1690 | Int deltaPOC = getDeltaPOC(j); |
---|
1691 | Bool used = getUsed(j); |
---|
1692 | setDeltaPOC(j, getDeltaPOC(k)); |
---|
1693 | setUsed(j, getUsed(k)); |
---|
1694 | setDeltaPOC(k, deltaPOC); |
---|
1695 | setUsed(k, used); |
---|
1696 | } |
---|
1697 | } |
---|
1698 | |
---|
1699 | /** Prints the deltaPOC and RefIdc (if available) values in the RPS. |
---|
1700 | * A "*" is added to the deltaPOC value if it is Used bu current. |
---|
1701 | * \returns Void |
---|
1702 | */ |
---|
1703 | Void TComReferencePictureSet::printDeltaPOC() |
---|
1704 | { |
---|
1705 | printf("DeltaPOC = { "); |
---|
1706 | for(Int j=0; j < getNumberOfPictures(); j++) |
---|
1707 | { |
---|
1708 | printf("%d%s ", getDeltaPOC(j), (getUsed(j)==1)?"*":""); |
---|
1709 | } |
---|
1710 | if (getInterRPSPrediction()) |
---|
1711 | { |
---|
1712 | printf("}, RefIdc = { "); |
---|
1713 | for(Int j=0; j < getNumRefIdc(); j++) |
---|
1714 | { |
---|
1715 | printf("%d ", getRefIdc(j)); |
---|
1716 | } |
---|
1717 | } |
---|
1718 | printf("}\n"); |
---|
1719 | } |
---|
1720 | |
---|
1721 | TComRPSList::TComRPSList() |
---|
1722 | { |
---|
1723 | } |
---|
1724 | |
---|
1725 | TComRPSList::~TComRPSList() |
---|
1726 | { |
---|
1727 | } |
---|
1728 | |
---|
1729 | Void TComRPSList::create( Int numberOfReferencePictureSets) |
---|
1730 | { |
---|
1731 | m_numberOfReferencePictureSets = numberOfReferencePictureSets; |
---|
1732 | m_referencePictureSets = new TComReferencePictureSet[numberOfReferencePictureSets]; |
---|
1733 | } |
---|
1734 | |
---|
1735 | Void TComRPSList::destroy() |
---|
1736 | { |
---|
1737 | delete [] m_referencePictureSets; |
---|
1738 | m_numberOfReferencePictureSets = 0; |
---|
1739 | m_referencePictureSets = NULL; |
---|
1740 | } |
---|
1741 | |
---|
1742 | |
---|
1743 | |
---|
1744 | TComReferencePictureSet* TComRPSList::getReferencePictureSet(Int referencePictureSetNum) |
---|
1745 | { |
---|
1746 | return &m_referencePictureSets[referencePictureSetNum]; |
---|
1747 | } |
---|
1748 | |
---|
1749 | Int TComRPSList::getNumberOfReferencePictureSets() |
---|
1750 | { |
---|
1751 | return m_numberOfReferencePictureSets; |
---|
1752 | } |
---|
1753 | |
---|
1754 | Void TComRPSList::setNumberOfReferencePictureSets(Int numberOfReferencePictureSets) |
---|
1755 | { |
---|
1756 | m_numberOfReferencePictureSets = numberOfReferencePictureSets; |
---|
1757 | } |
---|
1758 | |
---|
1759 | TComRefPicListModification::TComRefPicListModification() |
---|
1760 | : m_bRefPicListModificationFlagL0 (false) |
---|
1761 | , m_bRefPicListModificationFlagL1 (false) |
---|
1762 | #if !H0137_0138_LIST_MODIFICATION |
---|
1763 | , m_uiNumberOfRefPicListModificationsL0 (0) |
---|
1764 | , m_uiNumberOfRefPicListModificationsL1 (0) |
---|
1765 | #endif |
---|
1766 | { |
---|
1767 | #if !H0137_0138_LIST_MODIFICATION |
---|
1768 | ::memset( m_ListIdcL0, 0, sizeof(m_ListIdcL0) ); |
---|
1769 | #endif |
---|
1770 | ::memset( m_RefPicSetIdxL0, 0, sizeof(m_RefPicSetIdxL0) ); |
---|
1771 | #if !H0137_0138_LIST_MODIFICATION |
---|
1772 | ::memset( m_ListIdcL1, 0, sizeof(m_ListIdcL1) ); |
---|
1773 | #endif |
---|
1774 | ::memset( m_RefPicSetIdxL1, 0, sizeof(m_RefPicSetIdxL1) ); |
---|
1775 | } |
---|
1776 | |
---|
1777 | TComRefPicListModification::~TComRefPicListModification() |
---|
1778 | { |
---|
1779 | } |
---|
1780 | |
---|
1781 | TComAPS::TComAPS() |
---|
1782 | { |
---|
1783 | m_apsID = 0; |
---|
1784 | m_bAlfEnabled = false; |
---|
1785 | m_bSaoEnabled = false; |
---|
1786 | m_pSaoParam = NULL; |
---|
1787 | #if LCU_SYNTAX_ALF |
---|
1788 | m_alfParamSet = NULL; |
---|
1789 | #else |
---|
1790 | m_pAlfParam = NULL; |
---|
1791 | #endif |
---|
1792 | m_scalingList = NULL; |
---|
1793 | m_scalingListEnabled = false; |
---|
1794 | } |
---|
1795 | |
---|
1796 | TComAPS::~TComAPS() |
---|
1797 | { |
---|
1798 | |
---|
1799 | } |
---|
1800 | |
---|
1801 | TComAPS& TComAPS::operator= (const TComAPS& src) |
---|
1802 | { |
---|
1803 | m_apsID = src.m_apsID; |
---|
1804 | m_loopFilterOffsetInAPS = src.m_loopFilterOffsetInAPS; |
---|
1805 | m_loopFilterDisable = src.m_loopFilterDisable; |
---|
1806 | m_loopFilterBetaOffsetDiv2 = src.m_loopFilterBetaOffsetDiv2; |
---|
1807 | m_loopFilterTcOffsetDiv2 = src.m_loopFilterTcOffsetDiv2; |
---|
1808 | m_bAlfEnabled = src.m_bAlfEnabled; |
---|
1809 | m_bSaoEnabled = src.m_bSaoEnabled; |
---|
1810 | m_pSaoParam = src.m_pSaoParam; |
---|
1811 | #if LCU_SYNTAX_ALF |
---|
1812 | m_alfParamSet = src.m_alfParamSet; |
---|
1813 | #else |
---|
1814 | m_pAlfParam = src.m_pAlfParam; |
---|
1815 | #endif |
---|
1816 | m_scalingList = src.m_scalingList; |
---|
1817 | m_scalingListEnabled = src.m_scalingListEnabled; |
---|
1818 | #if SAO_UNIT_INTERLEAVING |
---|
1819 | m_saoInterleavingFlag = src.m_saoInterleavingFlag; |
---|
1820 | #endif |
---|
1821 | |
---|
1822 | return *this; |
---|
1823 | } |
---|
1824 | |
---|
1825 | Void TComAPS::createSaoParam() |
---|
1826 | { |
---|
1827 | m_pSaoParam = new SAOParam; |
---|
1828 | } |
---|
1829 | |
---|
1830 | Void TComAPS::destroySaoParam() |
---|
1831 | { |
---|
1832 | if(m_pSaoParam != NULL) |
---|
1833 | { |
---|
1834 | delete m_pSaoParam; |
---|
1835 | m_pSaoParam = NULL; |
---|
1836 | } |
---|
1837 | } |
---|
1838 | |
---|
1839 | Void TComAPS::createAlfParam() |
---|
1840 | { |
---|
1841 | #if LCU_SYNTAX_ALF |
---|
1842 | m_alfParamSet = new AlfParamSet; |
---|
1843 | #else |
---|
1844 | m_pAlfParam = new ALFParam; |
---|
1845 | #endif |
---|
1846 | } |
---|
1847 | Void TComAPS::destroyAlfParam() |
---|
1848 | { |
---|
1849 | #if LCU_SYNTAX_ALF |
---|
1850 | if(m_alfParamSet != NULL) |
---|
1851 | { |
---|
1852 | delete m_alfParamSet; |
---|
1853 | m_alfParamSet = NULL; |
---|
1854 | } |
---|
1855 | #else |
---|
1856 | if(m_pAlfParam != NULL) |
---|
1857 | { |
---|
1858 | delete m_pAlfParam; |
---|
1859 | m_pAlfParam = NULL; |
---|
1860 | } |
---|
1861 | #endif |
---|
1862 | } |
---|
1863 | |
---|
1864 | Void TComAPS::createScalingList() |
---|
1865 | { |
---|
1866 | m_scalingList = new TComScalingList; |
---|
1867 | } |
---|
1868 | Void TComAPS::destroyScalingList() |
---|
1869 | { |
---|
1870 | delete m_scalingList; |
---|
1871 | } |
---|
1872 | |
---|
1873 | TComScalingList::TComScalingList() |
---|
1874 | { |
---|
1875 | init(); |
---|
1876 | } |
---|
1877 | TComScalingList::~TComScalingList() |
---|
1878 | { |
---|
1879 | destroy(); |
---|
1880 | } |
---|
1881 | |
---|
1882 | /** set default quantization matrix to array |
---|
1883 | */ |
---|
1884 | Void TComSlice::setDefaultScalingList() |
---|
1885 | { |
---|
1886 | for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) |
---|
1887 | { |
---|
1888 | for(UInt listId=0;listId<g_scalingListNum[sizeId];listId++) |
---|
1889 | { |
---|
1890 | getScalingList()->processDefaultMarix(sizeId, listId); |
---|
1891 | } |
---|
1892 | } |
---|
1893 | } |
---|
1894 | /** check if use default quantization matrix |
---|
1895 | * \returns true if use default quantization matrix in all size |
---|
1896 | */ |
---|
1897 | #if SCALING_LIST |
---|
1898 | Bool TComSlice::checkDefaultScalingList() |
---|
1899 | { |
---|
1900 | UInt defaultCounter=0; |
---|
1901 | |
---|
1902 | for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) |
---|
1903 | { |
---|
1904 | for(UInt listId=0;listId<g_scalingListNum[sizeId];listId++) |
---|
1905 | { |
---|
1906 | if(getScalingList()->getUseDefaultScalingMatrixFlag(sizeId,listId)) |
---|
1907 | { |
---|
1908 | defaultCounter++; |
---|
1909 | } |
---|
1910 | } |
---|
1911 | } |
---|
1912 | return (defaultCounter == (SCALING_LIST_NUM * SCALING_LIST_SIZE_NUM - 4)) ? true : false; // -4 for 32x32 |
---|
1913 | } |
---|
1914 | #else |
---|
1915 | Bool TComSlice::checkDefaultScalingList() |
---|
1916 | { |
---|
1917 | UInt i; |
---|
1918 | Int *dst=0; |
---|
1919 | Int *src=0; |
---|
1920 | UInt defaultCounter=0; |
---|
1921 | |
---|
1922 | //4x4 |
---|
1923 | for(i=0;i<SCALING_LIST_NUM;i++) |
---|
1924 | { |
---|
1925 | src = (i<3) ? g_quantIntraDefault4x4 : g_quantInterDefault4x4; |
---|
1926 | dst = getScalingList()->getScalingListAddress(SCALING_LIST_4x4,i); |
---|
1927 | if(::memcmp(dst,src,sizeof(UInt)*16) == 0) defaultCounter++; |
---|
1928 | } |
---|
1929 | |
---|
1930 | //8x8 |
---|
1931 | for(i=0;i<SCALING_LIST_NUM;i++) |
---|
1932 | { |
---|
1933 | src = (i<3) ? g_quantIntraDefault8x8 : g_quantInterDefault8x8; |
---|
1934 | dst = getScalingList()->getScalingListAddress(SCALING_LIST_8x8,i); |
---|
1935 | if(::memcmp(dst,src,sizeof(UInt)*64) == 0) defaultCounter++; |
---|
1936 | } |
---|
1937 | //16x16 |
---|
1938 | for(i=0;i<SCALING_LIST_NUM;i++) |
---|
1939 | { |
---|
1940 | src = (i<3) ? g_quantIntraDefault16x16 : g_quantInterDefault16x16; |
---|
1941 | dst = getScalingList()->getScalingListAddress(SCALING_LIST_16x16,i); |
---|
1942 | if(::memcmp(dst,src,sizeof(UInt)*256) == 0) defaultCounter++; |
---|
1943 | } |
---|
1944 | //32x32 |
---|
1945 | for(i=0;i<SCALING_LIST_NUM_32x32;i++) |
---|
1946 | { |
---|
1947 | src = (i<1) ? g_quantIntraDefault32x32 : g_quantInterDefault32x32; |
---|
1948 | dst = getScalingList()->getScalingListAddress(SCALING_LIST_32x32,i*3); |
---|
1949 | if(::memcmp(dst,src,sizeof(UInt)*1024) == 0) defaultCounter++; |
---|
1950 | } |
---|
1951 | return (defaultCounter == (SCALING_LIST_NUM * SCALING_LIST_SIZE_NUM - 4)) ? true : false; // -4 for 32x32 |
---|
1952 | } |
---|
1953 | #endif |
---|
1954 | /** get scaling matrix from RefMatrixID |
---|
1955 | * \param sizeId size index |
---|
1956 | * \param Index of input matrix |
---|
1957 | * \param Index of reference matrix |
---|
1958 | */ |
---|
1959 | Void TComScalingList::processRefMatrix( UInt sizeId, UInt listId , UInt refListId ) |
---|
1960 | { |
---|
1961 | #if SCALING_LIST |
---|
1962 | ::memcpy(getScalingListAddress(sizeId, listId),getScalingListAddress(sizeId, refListId),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])); |
---|
1963 | #else |
---|
1964 | ::memcpy(getScalingListAddress(sizeId, listId),getScalingListAddress(sizeId, refListId),sizeof(Int)*g_scalingListSize[sizeId]); |
---|
1965 | #endif |
---|
1966 | } |
---|
1967 | /** parse syntax infomation |
---|
1968 | * \param pchFile syntax infomation |
---|
1969 | * \returns false if successful |
---|
1970 | */ |
---|
1971 | Bool TComScalingList::xParseScalingList(char* pchFile) |
---|
1972 | { |
---|
1973 | FILE *fp; |
---|
1974 | Char line[1024]; |
---|
1975 | UInt sizeIdc,listIdc; |
---|
1976 | UInt i,size = 0; |
---|
1977 | Int *src=0,data; |
---|
1978 | Char *ret; |
---|
1979 | UInt retval; |
---|
1980 | |
---|
1981 | if((fp = fopen(pchFile,"r")) == (FILE*)NULL) |
---|
1982 | { |
---|
1983 | printf("can't open file %s :: set Default Matrix\n",pchFile); |
---|
1984 | return true; |
---|
1985 | } |
---|
1986 | |
---|
1987 | for(sizeIdc = 0; sizeIdc < SCALING_LIST_SIZE_NUM; sizeIdc++) |
---|
1988 | { |
---|
1989 | #if SCALING_LIST |
---|
1990 | size = min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeIdc]); |
---|
1991 | #else |
---|
1992 | size = g_scalingListSize[sizeIdc]; |
---|
1993 | #endif |
---|
1994 | for(listIdc = 0; listIdc < g_scalingListNum[sizeIdc]; listIdc++) |
---|
1995 | { |
---|
1996 | src = getScalingListAddress(sizeIdc, listIdc); |
---|
1997 | |
---|
1998 | fseek(fp,0,0); |
---|
1999 | do |
---|
2000 | { |
---|
2001 | ret = fgets(line, 1024, fp); |
---|
2002 | if ((ret==NULL)||(strstr(line, MatrixType[sizeIdc][listIdc])==NULL && feof(fp))) |
---|
2003 | { |
---|
2004 | printf("Error: can't read Matrix :: set Default Matrix\n"); |
---|
2005 | return true; |
---|
2006 | } |
---|
2007 | } |
---|
2008 | while (strstr(line, MatrixType[sizeIdc][listIdc]) == NULL); |
---|
2009 | for (i=0; i<size; i++) |
---|
2010 | { |
---|
2011 | retval = fscanf(fp, "%d,", &data); |
---|
2012 | if (retval!=1) |
---|
2013 | { |
---|
2014 | printf("Error: can't read Matrix :: set Default Matrix\n"); |
---|
2015 | return true; |
---|
2016 | } |
---|
2017 | src[i] = data; |
---|
2018 | } |
---|
2019 | #if SCALING_LIST |
---|
2020 | //set DC value for default matrix check |
---|
2021 | setScalingListDC(sizeIdc,listIdc,src[0]); |
---|
2022 | |
---|
2023 | if(sizeIdc > SCALING_LIST_8x8) |
---|
2024 | { |
---|
2025 | fseek(fp,0,0); |
---|
2026 | do |
---|
2027 | { |
---|
2028 | ret = fgets(line, 1024, fp); |
---|
2029 | if ((ret==NULL)||(strstr(line, MatrixType_DC[sizeIdc][listIdc])==NULL && feof(fp))) |
---|
2030 | { |
---|
2031 | printf("Error: can't read DC :: set Default Matrix\n"); |
---|
2032 | return true; |
---|
2033 | } |
---|
2034 | } |
---|
2035 | while (strstr(line, MatrixType_DC[sizeIdc][listIdc]) == NULL); |
---|
2036 | retval = fscanf(fp, "%d,", &data); |
---|
2037 | if (retval!=1) |
---|
2038 | { |
---|
2039 | printf("Error: can't read Matrix :: set Default Matrix\n"); |
---|
2040 | return true; |
---|
2041 | } |
---|
2042 | //overwrite DC value when size of matrix is larger than 16x16 |
---|
2043 | setScalingListDC(sizeIdc,listIdc,data); |
---|
2044 | } |
---|
2045 | #endif |
---|
2046 | } |
---|
2047 | } |
---|
2048 | fclose(fp); |
---|
2049 | return false; |
---|
2050 | } |
---|
2051 | |
---|
2052 | /** initialization process of quantization matrix array |
---|
2053 | */ |
---|
2054 | Void TComScalingList::init() |
---|
2055 | { |
---|
2056 | for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) |
---|
2057 | { |
---|
2058 | for(UInt listId = 0; listId < g_scalingListNum[sizeId]; listId++) |
---|
2059 | { |
---|
2060 | #if SCALING_LIST |
---|
2061 | m_scalingListCoef[sizeId][listId] = new Int [min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])]; |
---|
2062 | #else |
---|
2063 | m_scalingListCoef[sizeId][listId] = new Int [g_scalingListSize[sizeId]]; |
---|
2064 | #endif |
---|
2065 | } |
---|
2066 | } |
---|
2067 | m_scalingListCoef[SCALING_LIST_32x32][3] = m_scalingListCoef[SCALING_LIST_32x32][1]; // copy address for 32x32 |
---|
2068 | } |
---|
2069 | /** destroy quantization matrix array |
---|
2070 | */ |
---|
2071 | Void TComScalingList::destroy() |
---|
2072 | { |
---|
2073 | for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) |
---|
2074 | { |
---|
2075 | for(UInt listId = 0; listId < g_scalingListNum[sizeId]; listId++) |
---|
2076 | { |
---|
2077 | if(m_scalingListCoef[sizeId][listId]) delete [] m_scalingListCoef[sizeId][listId]; |
---|
2078 | } |
---|
2079 | } |
---|
2080 | } |
---|
2081 | /** get default address of quantization matrix |
---|
2082 | * \param sizeId size index |
---|
2083 | * \param listId list index |
---|
2084 | * \returns pointer of quantization matrix |
---|
2085 | */ |
---|
2086 | Int* TComScalingList::getScalingListDefaultAddress(UInt sizeId, UInt listId) |
---|
2087 | { |
---|
2088 | Int *src = 0; |
---|
2089 | switch(sizeId) |
---|
2090 | { |
---|
2091 | case SCALING_LIST_4x4: |
---|
2092 | src = (listId<3) ? g_quantIntraDefault4x4 : g_quantInterDefault4x4; |
---|
2093 | break; |
---|
2094 | case SCALING_LIST_8x8: |
---|
2095 | src = (listId<3) ? g_quantIntraDefault8x8 : g_quantInterDefault8x8; |
---|
2096 | break; |
---|
2097 | #if SCALING_LIST |
---|
2098 | case SCALING_LIST_16x16: |
---|
2099 | src = (listId<3) ? g_quantIntraDefault8x8 : g_quantInterDefault8x8; |
---|
2100 | break; |
---|
2101 | case SCALING_LIST_32x32: |
---|
2102 | src = (listId<1) ? g_quantIntraDefault8x8 : g_quantInterDefault8x8; |
---|
2103 | break; |
---|
2104 | #else |
---|
2105 | case SCALING_LIST_16x16: |
---|
2106 | src = (listId<3) ? g_quantIntraDefault16x16 : g_quantInterDefault16x16; |
---|
2107 | break; |
---|
2108 | case SCALING_LIST_32x32: |
---|
2109 | src = (listId<1) ? g_quantIntraDefault32x32 : g_quantInterDefault32x32; |
---|
2110 | break; |
---|
2111 | #endif |
---|
2112 | default: |
---|
2113 | assert(0); |
---|
2114 | src = NULL; |
---|
2115 | break; |
---|
2116 | } |
---|
2117 | return src; |
---|
2118 | } |
---|
2119 | /** process of default matrix |
---|
2120 | * \param sizeId size index |
---|
2121 | * \param Index of input matrix |
---|
2122 | */ |
---|
2123 | Void TComScalingList::processDefaultMarix(UInt sizeId, UInt listId) |
---|
2124 | { |
---|
2125 | #if SCALING_LIST |
---|
2126 | ::memcpy(getScalingListAddress(sizeId, listId),getScalingListDefaultAddress(sizeId,listId),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])); |
---|
2127 | setUseDefaultScalingMatrixFlag(sizeId,listId,true); |
---|
2128 | setScalingListDC(sizeId,listId,SCALING_LIST_DC); |
---|
2129 | #else |
---|
2130 | ::memcpy(getScalingListAddress(sizeId, listId),getScalingListDefaultAddress(sizeId,listId),sizeof(Int)*(Int)g_scalingListSize[sizeId]); |
---|
2131 | #endif |
---|
2132 | } |
---|
2133 | #if SCALING_LIST |
---|
2134 | /** check DC value of matrix for default matrix signaling |
---|
2135 | */ |
---|
2136 | Void TComScalingList::checkDcOfMatrix() |
---|
2137 | { |
---|
2138 | for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) |
---|
2139 | { |
---|
2140 | for(UInt listId = 0; listId < g_scalingListNum[sizeId]; listId++) |
---|
2141 | { |
---|
2142 | setUseDefaultScalingMatrixFlag(sizeId,listId,false); |
---|
2143 | //check default matrix? |
---|
2144 | if(getScalingListDC(sizeId,listId) == 0) |
---|
2145 | { |
---|
2146 | processDefaultMarix(sizeId, listId); |
---|
2147 | } |
---|
2148 | } |
---|
2149 | } |
---|
2150 | } |
---|
2151 | #endif |
---|
2152 | |
---|
2153 | ParameterSetManager::ParameterSetManager() |
---|
2154 | : m_spsMap(MAX_NUM_SPS) |
---|
2155 | , m_ppsMap(MAX_NUM_PPS) |
---|
2156 | , m_apsMap(MAX_NUM_APS) |
---|
2157 | { |
---|
2158 | } |
---|
2159 | |
---|
2160 | |
---|
2161 | ParameterSetManager::~ParameterSetManager() |
---|
2162 | { |
---|
2163 | } |
---|
2164 | |
---|
2165 | //! \} |
---|