1 | /* The copyright in this software is being made available under the BSD |
---|
2 | * License, included below. This software may be subject to other third party |
---|
3 | * and contributor rights, including patent rights, and no such rights are |
---|
4 | * granted under this license. |
---|
5 | * |
---|
6 | * Copyright (c) 2010-2015, ITU/ISO/IEC |
---|
7 | * All rights reserved. |
---|
8 | * |
---|
9 | * Redistribution and use in source and binary forms, with or without |
---|
10 | * modification, are permitted provided that the following conditions are met: |
---|
11 | * |
---|
12 | * * Redistributions of source code must retain the above copyright notice, |
---|
13 | * this list of conditions and the following disclaimer. |
---|
14 | * * Redistributions in binary form must reproduce the above copyright notice, |
---|
15 | * this list of conditions and the following disclaimer in the documentation |
---|
16 | * and/or other materials provided with the distribution. |
---|
17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
---|
18 | * be used to endorse or promote products derived from this software without |
---|
19 | * specific prior written permission. |
---|
20 | * |
---|
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS |
---|
25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
---|
31 | * THE POSSIBILITY OF SUCH DAMAGE. |
---|
32 | */ |
---|
33 | |
---|
34 | /** \file TComPic.cpp |
---|
35 | \brief picture class |
---|
36 | */ |
---|
37 | |
---|
38 | #include "TComPic.h" |
---|
39 | #include "SEI.h" |
---|
40 | |
---|
41 | //! \ingroup TLibCommon |
---|
42 | //! \{ |
---|
43 | |
---|
44 | // ==================================================================================================================== |
---|
45 | // Constructor / destructor / create / destroy |
---|
46 | // ==================================================================================================================== |
---|
47 | |
---|
48 | TComPic::TComPic() |
---|
49 | : m_uiTLayer (0) |
---|
50 | , m_bUsedByCurr (false) |
---|
51 | , m_bIsLongTerm (false) |
---|
52 | , m_pcPicYuvPred (NULL) |
---|
53 | , m_pcPicYuvResi (NULL) |
---|
54 | , m_bReconstructed (false) |
---|
55 | , m_bNeededForOutput (false) |
---|
56 | , m_uiCurrSliceIdx (0) |
---|
57 | , m_bCheckLTMSB (false) |
---|
58 | #if SVC_EXTENSION |
---|
59 | , m_layerId( 0 ) |
---|
60 | #endif |
---|
61 | { |
---|
62 | #if SVC_EXTENSION |
---|
63 | memset( m_pcFullPelBaseRec, 0, sizeof( m_pcFullPelBaseRec ) ); |
---|
64 | memset( m_bSpatialEnhLayer, false, sizeof( m_bSpatialEnhLayer ) ); |
---|
65 | memset( m_equalPictureSizeAndOffsetFlag, false, sizeof( m_equalPictureSizeAndOffsetFlag ) ); |
---|
66 | memset( m_mvScalingFactor, 0, sizeof( m_mvScalingFactor ) ); |
---|
67 | memset( m_posScalingFactor, 0, sizeof( m_posScalingFactor ) ); |
---|
68 | #endif |
---|
69 | for(UInt i=0; i<NUM_PIC_YUV; i++) |
---|
70 | { |
---|
71 | m_apcPicYuv[i] = NULL; |
---|
72 | } |
---|
73 | } |
---|
74 | |
---|
75 | TComPic::~TComPic() |
---|
76 | { |
---|
77 | } |
---|
78 | #if SVC_EXTENSION |
---|
79 | Void TComPic::create( const TComVPS &vps, const TComSPS &sps, const TComPPS &pps, const Bool bIsVirtual, const UInt layerId ) |
---|
80 | { |
---|
81 | const ChromaFormat chromaFormatIDC = vps.getChromaFormatIdc(&sps, layerId); |
---|
82 | const Int iWidth = vps.getPicWidthInLumaSamples(&sps, layerId); |
---|
83 | const Int iHeight = vps.getPicHeightInLumaSamples(&sps, layerId); |
---|
84 | const UInt uiMaxCuWidth = sps.getMaxCUWidth(); |
---|
85 | const UInt uiMaxCuHeight = sps.getMaxCUHeight(); |
---|
86 | const UInt uiMaxDepth = sps.getMaxTotalCUDepth(); |
---|
87 | |
---|
88 | const Window& conformanceWindow = vps.getConformanceWindow( &sps, layerId ); |
---|
89 | |
---|
90 | m_picSym.create( vps, sps, pps, uiMaxDepth, layerId ); |
---|
91 | |
---|
92 | if (!bIsVirtual) |
---|
93 | { |
---|
94 | m_apcPicYuv[PIC_YUV_ORG] = new TComPicYuv; m_apcPicYuv[PIC_YUV_ORG]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true, &conformanceWindow ); |
---|
95 | m_apcPicYuv[PIC_YUV_TRUE_ORG] = new TComPicYuv; m_apcPicYuv[PIC_YUV_TRUE_ORG]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true, &conformanceWindow ); |
---|
96 | } |
---|
97 | m_apcPicYuv[PIC_YUV_REC] = new TComPicYuv; m_apcPicYuv[PIC_YUV_REC]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true, &conformanceWindow ); |
---|
98 | |
---|
99 | for( Int i = 0; i < MAX_LAYERS; i++ ) |
---|
100 | { |
---|
101 | if( m_bSpatialEnhLayer[i] ) |
---|
102 | { |
---|
103 | m_pcFullPelBaseRec[i] = new TComPicYuv; m_pcFullPelBaseRec[i]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true, &conformanceWindow ); |
---|
104 | } |
---|
105 | } |
---|
106 | |
---|
107 | // there are no SEI messages associated with this picture initially |
---|
108 | if (m_SEIs.size() > 0) |
---|
109 | { |
---|
110 | deleteSEIs (m_SEIs); |
---|
111 | } |
---|
112 | m_bUsedByCurr = false; |
---|
113 | } |
---|
114 | #else |
---|
115 | Void TComPic::create( const TComSPS &sps, const TComPPS &pps, const Bool bIsVirtual) |
---|
116 | { |
---|
117 | const ChromaFormat chromaFormatIDC = sps.getChromaFormatIdc(); |
---|
118 | const Int iWidth = sps.getPicWidthInLumaSamples(); |
---|
119 | const Int iHeight = sps.getPicHeightInLumaSamples(); |
---|
120 | const UInt uiMaxCuWidth = sps.getMaxCUWidth(); |
---|
121 | const UInt uiMaxCuHeight = sps.getMaxCUHeight(); |
---|
122 | const UInt uiMaxDepth = sps.getMaxTotalCUDepth(); |
---|
123 | |
---|
124 | m_picSym.create( sps, pps, uiMaxDepth ); |
---|
125 | if (!bIsVirtual) |
---|
126 | { |
---|
127 | m_apcPicYuv[PIC_YUV_ORG ] = new TComPicYuv; m_apcPicYuv[PIC_YUV_ORG ]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true ); |
---|
128 | m_apcPicYuv[PIC_YUV_TRUE_ORG] = new TComPicYuv; m_apcPicYuv[PIC_YUV_TRUE_ORG]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true ); |
---|
129 | } |
---|
130 | m_apcPicYuv[PIC_YUV_REC] = new TComPicYuv; m_apcPicYuv[PIC_YUV_REC]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true ); |
---|
131 | |
---|
132 | // there are no SEI messages associated with this picture initially |
---|
133 | if (m_SEIs.size() > 0) |
---|
134 | { |
---|
135 | deleteSEIs (m_SEIs); |
---|
136 | } |
---|
137 | m_bUsedByCurr = false; |
---|
138 | } |
---|
139 | #endif |
---|
140 | |
---|
141 | Void TComPic::destroy() |
---|
142 | { |
---|
143 | m_picSym.destroy(); |
---|
144 | |
---|
145 | for(UInt i=0; i<NUM_PIC_YUV; i++) |
---|
146 | { |
---|
147 | if (m_apcPicYuv[i]) |
---|
148 | { |
---|
149 | m_apcPicYuv[i]->destroy(); |
---|
150 | delete m_apcPicYuv[i]; |
---|
151 | m_apcPicYuv[i] = NULL; |
---|
152 | } |
---|
153 | } |
---|
154 | |
---|
155 | deleteSEIs(m_SEIs); |
---|
156 | #if SVC_EXTENSION |
---|
157 | for( Int i = 0; i < MAX_LAYERS; i++ ) |
---|
158 | { |
---|
159 | if( m_bSpatialEnhLayer[i] && m_pcFullPelBaseRec[i] ) |
---|
160 | { |
---|
161 | m_pcFullPelBaseRec[i]->destroy(); |
---|
162 | delete m_pcFullPelBaseRec[i]; |
---|
163 | m_pcFullPelBaseRec[i] = NULL; |
---|
164 | } |
---|
165 | } |
---|
166 | |
---|
167 | for( Int comp = 0; comp < 2; comp++ ) |
---|
168 | { |
---|
169 | if( m_mvScalingFactor[comp] ) |
---|
170 | { |
---|
171 | delete [] m_mvScalingFactor[comp]; |
---|
172 | m_mvScalingFactor[comp] = NULL; |
---|
173 | } |
---|
174 | |
---|
175 | if( m_posScalingFactor[comp] ) |
---|
176 | { |
---|
177 | delete [] m_posScalingFactor[comp]; |
---|
178 | m_posScalingFactor[comp] = NULL; |
---|
179 | } |
---|
180 | } |
---|
181 | #endif |
---|
182 | } |
---|
183 | |
---|
184 | Void TComPic::compressMotion() |
---|
185 | { |
---|
186 | TComPicSym* pPicSym = getPicSym(); |
---|
187 | for ( UInt uiCUAddr = 0; uiCUAddr < pPicSym->getNumberOfCtusInFrame(); uiCUAddr++ ) |
---|
188 | { |
---|
189 | TComDataCU* pCtu = pPicSym->getCtu(uiCUAddr); |
---|
190 | pCtu->compressMV(); |
---|
191 | } |
---|
192 | } |
---|
193 | |
---|
194 | Bool TComPic::getSAOMergeAvailability(Int currAddr, Int mergeAddr) |
---|
195 | { |
---|
196 | Bool mergeCtbInSliceSeg = (mergeAddr >= getPicSym()->getCtuTsToRsAddrMap(getCtu(currAddr)->getSlice()->getSliceCurStartCtuTsAddr())); |
---|
197 | Bool mergeCtbInTile = (getPicSym()->getTileIdxMap(mergeAddr) == getPicSym()->getTileIdxMap(currAddr)); |
---|
198 | return (mergeCtbInSliceSeg && mergeCtbInTile); |
---|
199 | } |
---|
200 | |
---|
201 | UInt TComPic::getSubstreamForCtuAddr(const UInt ctuAddr, const Bool bAddressInRaster, TComSlice *pcSlice) |
---|
202 | { |
---|
203 | UInt subStrm; |
---|
204 | const bool bWPPEnabled=pcSlice->getPPS()->getEntropyCodingSyncEnabledFlag(); |
---|
205 | const TComPicSym &picSym = *(getPicSym()); |
---|
206 | |
---|
207 | if ((bWPPEnabled && picSym.getFrameHeightInCtus()>1) || (picSym.getNumTiles()>1)) // wavefronts, and possibly tiles being used. |
---|
208 | { |
---|
209 | if (bWPPEnabled) |
---|
210 | { |
---|
211 | const UInt ctuRsAddr = bAddressInRaster?ctuAddr : picSym.getCtuTsToRsAddrMap(ctuAddr); |
---|
212 | const UInt frameWidthInCtus = picSym.getFrameWidthInCtus(); |
---|
213 | const UInt tileIndex = picSym.getTileIdxMap(ctuRsAddr); |
---|
214 | const UInt numTileColumns = (picSym.getNumTileColumnsMinus1()+1); |
---|
215 | const TComTile *pTile = picSym.getTComTile(tileIndex); |
---|
216 | const UInt firstCtuRsAddrOfTile = pTile->getFirstCtuRsAddr(); |
---|
217 | const UInt tileYInCtus = firstCtuRsAddrOfTile / frameWidthInCtus; |
---|
218 | // independent tiles => substreams are "per tile" |
---|
219 | const UInt ctuLine = ctuRsAddr / frameWidthInCtus; |
---|
220 | const UInt startingSubstreamForTile =(tileYInCtus*numTileColumns) + (pTile->getTileHeightInCtus()*(tileIndex%numTileColumns)); |
---|
221 | subStrm = startingSubstreamForTile + (ctuLine - tileYInCtus); |
---|
222 | } |
---|
223 | else |
---|
224 | { |
---|
225 | const UInt ctuRsAddr = bAddressInRaster?ctuAddr : picSym.getCtuTsToRsAddrMap(ctuAddr); |
---|
226 | const UInt tileIndex = picSym.getTileIdxMap(ctuRsAddr); |
---|
227 | subStrm=tileIndex; |
---|
228 | } |
---|
229 | } |
---|
230 | else |
---|
231 | { |
---|
232 | // dependent tiles => substreams are "per frame". |
---|
233 | subStrm = 0; |
---|
234 | } |
---|
235 | return subStrm; |
---|
236 | } |
---|
237 | |
---|
238 | #if SVC_EXTENSION |
---|
239 | Void TComPic::createMvScalingFactor(UInt numOfILRPs) |
---|
240 | { |
---|
241 | assert(m_mvScalingFactor[0] == NULL); |
---|
242 | m_mvScalingFactor[0] = new Int[numOfILRPs]; |
---|
243 | |
---|
244 | assert(m_mvScalingFactor[1] == NULL); |
---|
245 | m_mvScalingFactor[1] = new Int[numOfILRPs]; |
---|
246 | } |
---|
247 | |
---|
248 | Void TComPic::createPosScalingFactor(UInt numOfILRPs) |
---|
249 | { |
---|
250 | assert(m_posScalingFactor[0] == NULL); |
---|
251 | m_posScalingFactor[0] = new Int[numOfILRPs]; |
---|
252 | |
---|
253 | assert(m_posScalingFactor[1] == NULL); |
---|
254 | m_posScalingFactor[1] = new Int[numOfILRPs]; |
---|
255 | } |
---|
256 | |
---|
257 | Void copyOnetoOnePicture( // SVC_NONCOLL |
---|
258 | Pel *in, |
---|
259 | Pel *out, |
---|
260 | Int nCols, |
---|
261 | Int nRows, |
---|
262 | Int fullRowWidth) |
---|
263 | { |
---|
264 | Int rX; |
---|
265 | |
---|
266 | for (rX = 0; rX < nRows; rX++) |
---|
267 | { |
---|
268 | memcpy( out, in, sizeof(Pel) * nCols ); |
---|
269 | in = in + fullRowWidth; |
---|
270 | out = out + fullRowWidth; |
---|
271 | } |
---|
272 | } |
---|
273 | |
---|
274 | Void TComPic::copyUpsampledPictureYuv(TComPicYuv* pcPicYuvIn, TComPicYuv* pcPicYuvOut) |
---|
275 | { |
---|
276 | Int upsampledRowWidthLuma = pcPicYuvOut->getStride(COMPONENT_Y); // 2 * pcPicYuvOut->getLumaMargin() + pcPicYuvOut->getWidth(); |
---|
277 | Int upsampledRowWidthCroma = pcPicYuvOut->getStride(COMPONENT_Cb); //2 * pcPicYuvOut->getChromaMargin() + (pcPicYuvOut->getWidth()>>1); |
---|
278 | |
---|
279 | copyOnetoOnePicture( |
---|
280 | pcPicYuvIn->getAddr(COMPONENT_Y), |
---|
281 | pcPicYuvOut->getAddr(COMPONENT_Y), |
---|
282 | pcPicYuvOut->getWidth(COMPONENT_Y), |
---|
283 | pcPicYuvOut->getHeight(COMPONENT_Y), |
---|
284 | upsampledRowWidthLuma); |
---|
285 | copyOnetoOnePicture( |
---|
286 | pcPicYuvIn->getAddr(COMPONENT_Cr), |
---|
287 | pcPicYuvOut->getAddr(COMPONENT_Cr), |
---|
288 | pcPicYuvOut->getWidth(COMPONENT_Y)>>1, |
---|
289 | pcPicYuvOut->getHeight(COMPONENT_Y)>>1, |
---|
290 | upsampledRowWidthCroma); |
---|
291 | copyOnetoOnePicture( |
---|
292 | pcPicYuvIn->getAddr(COMPONENT_Cb), |
---|
293 | pcPicYuvOut->getAddr(COMPONENT_Cb), |
---|
294 | pcPicYuvOut->getWidth(COMPONENT_Y)>>1, |
---|
295 | pcPicYuvOut->getHeight(COMPONENT_Y)>>1, |
---|
296 | upsampledRowWidthCroma); |
---|
297 | } |
---|
298 | |
---|
299 | Void TComPic::copyUpsampledMvField(UInt refLayerIdc, Int** mvScalingFactor, Int** posScalingFactor) |
---|
300 | { |
---|
301 | const TComSPS *sps = getSlice(0)->getSPS(); |
---|
302 | const UInt uiMaxDepth = sps->getMaxTotalCUDepth(); |
---|
303 | const UInt numPartitions = 1<<(uiMaxDepth<<1); |
---|
304 | const UInt widthMinPU = sps->getMaxCUWidth() / (1<<uiMaxDepth); |
---|
305 | const UInt heightMinPU = sps->getMaxCUHeight() / (1<<uiMaxDepth); |
---|
306 | const Int unitNum = max( 1, (Int)((16/widthMinPU)*(16/heightMinPU)) ); |
---|
307 | |
---|
308 | for(UInt cuIdx = 0; cuIdx < getPicSym()->getNumberOfCtusInFrame(); cuIdx++) //each LCU |
---|
309 | { |
---|
310 | TComDataCU* pcCUDes = getCtu(cuIdx); |
---|
311 | |
---|
312 | for(UInt absPartIdx = 0; absPartIdx < numPartitions; absPartIdx+=unitNum ) //each 16x16 unit |
---|
313 | { |
---|
314 | //pixel position of each unit in up-sampled layer |
---|
315 | UInt pelX = pcCUDes->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[absPartIdx] ]; |
---|
316 | UInt pelY = pcCUDes->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[absPartIdx] ]; |
---|
317 | UInt baseCUAddr, baseAbsPartIdx; |
---|
318 | |
---|
319 | TComDataCU *pcColCU = 0; |
---|
320 | pcColCU = pcCUDes->getBaseColCU(refLayerIdc, pelX, pelY, baseCUAddr, baseAbsPartIdx, posScalingFactor, true); |
---|
321 | |
---|
322 | if( pcColCU && pcColCU->getPredictionMode(baseAbsPartIdx) == MODE_INTER ) //base layer unit not skip and invalid mode |
---|
323 | { |
---|
324 | for(UInt refPicList = 0; refPicList < 2; refPicList++) //for each reference list |
---|
325 | { |
---|
326 | TComMvField sMvFieldBase, sMvField; |
---|
327 | pcColCU->getMvField( pcColCU, baseAbsPartIdx, (RefPicList)refPicList, sMvFieldBase); |
---|
328 | pcCUDes->scaleBaseMV( refLayerIdc, sMvField, sMvFieldBase, mvScalingFactor ); |
---|
329 | |
---|
330 | pcCUDes->getCUMvField((RefPicList)refPicList)->setMvField(sMvField, absPartIdx); |
---|
331 | pcCUDes->setPredictionMode(absPartIdx, MODE_INTER); |
---|
332 | } |
---|
333 | } |
---|
334 | else |
---|
335 | { |
---|
336 | TComMvField zeroMvField; //zero MV and invalid reference index |
---|
337 | pcCUDes->getCUMvField(REF_PIC_LIST_0)->setMvField(zeroMvField, absPartIdx); |
---|
338 | pcCUDes->getCUMvField(REF_PIC_LIST_1)->setMvField(zeroMvField, absPartIdx); |
---|
339 | pcCUDes->setPredictionMode(absPartIdx, MODE_INTRA); |
---|
340 | } |
---|
341 | |
---|
342 | for(UInt i = 1; i < unitNum; i++ ) |
---|
343 | { |
---|
344 | pcCUDes->getCUMvField(REF_PIC_LIST_0)->setMvField(pcCUDes->getCUMvField(REF_PIC_LIST_0)->getMv(absPartIdx), pcCUDes->getCUMvField(REF_PIC_LIST_0)->getRefIdx(absPartIdx), absPartIdx + i); |
---|
345 | pcCUDes->getCUMvField(REF_PIC_LIST_1)->setMvField(pcCUDes->getCUMvField(REF_PIC_LIST_1)->getMv(absPartIdx), pcCUDes->getCUMvField(REF_PIC_LIST_1)->getRefIdx(absPartIdx), absPartIdx + i); |
---|
346 | pcCUDes->setPredictionMode(absPartIdx+i, pcCUDes->getPredictionMode(absPartIdx)); |
---|
347 | } |
---|
348 | } |
---|
349 | memset( pcCUDes->getPartitionSize(), SIZE_2Nx2N, sizeof(Char)*numPartitions ); |
---|
350 | } |
---|
351 | } |
---|
352 | |
---|
353 | Void TComPic::initUpsampledMvField() |
---|
354 | { |
---|
355 | const TComSPS *sps = getSlice(0)->getSPS(); |
---|
356 | const UInt uiMaxDepth = sps->getMaxTotalCUDepth(); |
---|
357 | const UInt uiNumPartitions = 1<<(uiMaxDepth<<1); |
---|
358 | |
---|
359 | for(UInt cuIdx = 0; cuIdx < getPicSym()->getNumberOfCtusInFrame(); cuIdx++) //each LCU |
---|
360 | { |
---|
361 | TComDataCU* pcCUDes = getCtu(cuIdx); |
---|
362 | TComMvField zeroMvField; |
---|
363 | for(UInt list = 0; list < 2; list++) //each reference list |
---|
364 | { |
---|
365 | for(UInt i = 0; i < uiNumPartitions; i++ ) |
---|
366 | { |
---|
367 | pcCUDes->getCUMvField(REF_PIC_LIST_0)->setMvField(zeroMvField, i); |
---|
368 | pcCUDes->getCUMvField(REF_PIC_LIST_1)->setMvField(zeroMvField, i); |
---|
369 | pcCUDes->setPredictionMode(i, MODE_INTRA); |
---|
370 | pcCUDes->setPartitionSize(i, SIZE_2Nx2N); |
---|
371 | } |
---|
372 | } |
---|
373 | } |
---|
374 | return; |
---|
375 | } |
---|
376 | |
---|
377 | Bool TComPic::checkSameRefInfo() |
---|
378 | { |
---|
379 | Bool bSameRefInfo = true; |
---|
380 | TComSlice * pSlice0 = getSlice( 0 ); |
---|
381 | for( UInt uSliceID = getNumAllocatedSlice() - 1 ; bSameRefInfo && uSliceID > 0 ; uSliceID-- ) |
---|
382 | { |
---|
383 | TComSlice * pSliceN = getSlice( uSliceID ); |
---|
384 | if( pSlice0->getSliceType() != pSliceN->getSliceType() ) |
---|
385 | { |
---|
386 | bSameRefInfo = false; |
---|
387 | } |
---|
388 | else if( pSlice0->getSliceType() != I_SLICE ) |
---|
389 | { |
---|
390 | Int nListNum = pSlice0->getSliceType() == B_SLICE ? 2 : 1; |
---|
391 | for( Int nList = 0 ; nList < nListNum ; nList++ ) |
---|
392 | { |
---|
393 | RefPicList eRefList = ( RefPicList )nList; |
---|
394 | if( pSlice0->getNumRefIdx( eRefList ) == pSliceN->getNumRefIdx( eRefList ) ) |
---|
395 | { |
---|
396 | for( Int refIdx = pSlice0->getNumRefIdx( eRefList ) - 1 ; refIdx >= 0 ; refIdx-- ) |
---|
397 | { |
---|
398 | if( pSlice0->getRefPic( eRefList , refIdx ) != pSliceN->getRefPic( eRefList , refIdx ) ) |
---|
399 | { |
---|
400 | bSameRefInfo = false; |
---|
401 | break; |
---|
402 | } |
---|
403 | } |
---|
404 | } |
---|
405 | else |
---|
406 | { |
---|
407 | bSameRefInfo = false; |
---|
408 | break; |
---|
409 | } |
---|
410 | } |
---|
411 | } |
---|
412 | } |
---|
413 | |
---|
414 | return( bSameRefInfo ); |
---|
415 | } |
---|
416 | #endif //SVC_EXTENSION |
---|
417 | |
---|
418 | //! \} |
---|