1 | /* The copyright in this software is being made available under the BSD |
---|
2 | * License, included below. This software may be subject to other third party |
---|
3 | * and contributor rights, including patent rights, and no such rights are |
---|
4 | * granted under this license. |
---|
5 | * |
---|
6 | * Copyright (c) 2010-2014, ITU/ISO/IEC |
---|
7 | * All rights reserved. |
---|
8 | * |
---|
9 | * Redistribution and use in source and binary forms, with or without |
---|
10 | * modification, are permitted provided that the following conditions are met: |
---|
11 | * |
---|
12 | * * Redistributions of source code must retain the above copyright notice, |
---|
13 | * this list of conditions and the following disclaimer. |
---|
14 | * * Redistributions in binary form must reproduce the above copyright notice, |
---|
15 | * this list of conditions and the following disclaimer in the documentation |
---|
16 | * and/or other materials provided with the distribution. |
---|
17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
---|
18 | * be used to endorse or promote products derived from this software without |
---|
19 | * specific prior written permission. |
---|
20 | * |
---|
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS |
---|
25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
---|
31 | * THE POSSIBILITY OF SUCH DAMAGE. |
---|
32 | */ |
---|
33 | |
---|
34 | /** \file TComDataCU.cpp |
---|
35 | \brief CU data structure |
---|
36 | \todo not all entities are documented |
---|
37 | */ |
---|
38 | |
---|
39 | #include "TComDataCU.h" |
---|
40 | #include "TComPic.h" |
---|
41 | |
---|
42 | //! \ingroup TLibCommon |
---|
43 | //! \{ |
---|
44 | |
---|
45 | #if ADAPTIVE_QP_SELECTION |
---|
46 | Int * TComDataCU::m_pcGlbArlCoeffY = NULL; |
---|
47 | Int * TComDataCU::m_pcGlbArlCoeffCb = NULL; |
---|
48 | Int * TComDataCU::m_pcGlbArlCoeffCr = NULL; |
---|
49 | #endif |
---|
50 | |
---|
51 | // ==================================================================================================================== |
---|
52 | // Constructor / destructor / create / destroy |
---|
53 | // ==================================================================================================================== |
---|
54 | |
---|
55 | TComDataCU::TComDataCU() |
---|
56 | { |
---|
57 | m_pcPic = NULL; |
---|
58 | m_pcSlice = NULL; |
---|
59 | m_puhDepth = NULL; |
---|
60 | |
---|
61 | m_skipFlag = NULL; |
---|
62 | |
---|
63 | m_pePartSize = NULL; |
---|
64 | m_pePredMode = NULL; |
---|
65 | m_CUTransquantBypass = NULL; |
---|
66 | m_puhWidth = NULL; |
---|
67 | m_puhHeight = NULL; |
---|
68 | m_phQP = NULL; |
---|
69 | m_pbMergeFlag = NULL; |
---|
70 | m_puhMergeIndex = NULL; |
---|
71 | m_puhLumaIntraDir = NULL; |
---|
72 | m_puhChromaIntraDir = NULL; |
---|
73 | m_puhInterDir = NULL; |
---|
74 | m_puhTrIdx = NULL; |
---|
75 | m_puhTransformSkip[0] = NULL; |
---|
76 | m_puhTransformSkip[1] = NULL; |
---|
77 | m_puhTransformSkip[2] = NULL; |
---|
78 | m_puhCbf[0] = NULL; |
---|
79 | m_puhCbf[1] = NULL; |
---|
80 | m_puhCbf[2] = NULL; |
---|
81 | m_pcTrCoeffY = NULL; |
---|
82 | m_pcTrCoeffCb = NULL; |
---|
83 | m_pcTrCoeffCr = NULL; |
---|
84 | #if ADAPTIVE_QP_SELECTION |
---|
85 | m_ArlCoeffIsAliasedAllocation = false; |
---|
86 | m_pcArlCoeffY = NULL; |
---|
87 | m_pcArlCoeffCb = NULL; |
---|
88 | m_pcArlCoeffCr = NULL; |
---|
89 | #endif |
---|
90 | |
---|
91 | m_pbIPCMFlag = NULL; |
---|
92 | m_pcIPCMSampleY = NULL; |
---|
93 | m_pcIPCMSampleCb = NULL; |
---|
94 | m_pcIPCMSampleCr = NULL; |
---|
95 | |
---|
96 | m_pcPattern = NULL; |
---|
97 | |
---|
98 | m_pcCUAboveLeft = NULL; |
---|
99 | m_pcCUAboveRight = NULL; |
---|
100 | m_pcCUAbove = NULL; |
---|
101 | m_pcCULeft = NULL; |
---|
102 | |
---|
103 | m_apcCUColocated[0] = NULL; |
---|
104 | m_apcCUColocated[1] = NULL; |
---|
105 | |
---|
106 | m_apiMVPIdx[0] = NULL; |
---|
107 | m_apiMVPIdx[1] = NULL; |
---|
108 | m_apiMVPNum[0] = NULL; |
---|
109 | m_apiMVPNum[1] = NULL; |
---|
110 | |
---|
111 | #if H_3D_DIM |
---|
112 | for( Int i = 0; i < DIM_NUM_TYPE; i++ ) |
---|
113 | { |
---|
114 | m_dimDeltaDC[i][0] = NULL; |
---|
115 | m_dimDeltaDC[i][1] = NULL; |
---|
116 | } |
---|
117 | #if H_3D_DIM_DMM |
---|
118 | for( Int i = 0; i < DMM_NUM_TYPE; i++ ) |
---|
119 | { |
---|
120 | m_dmmWedgeTabIdx[i] = NULL; |
---|
121 | } |
---|
122 | #endif |
---|
123 | #if H_3D_DIM_SDC |
---|
124 | m_pbSDCFlag = NULL; |
---|
125 | m_apSegmentDCOffset[0] = NULL; |
---|
126 | m_apSegmentDCOffset[1] = NULL; |
---|
127 | #endif |
---|
128 | #endif |
---|
129 | m_bDecSubCu = false; |
---|
130 | m_sliceStartCU = 0; |
---|
131 | m_sliceSegmentStartCU = 0; |
---|
132 | #if H_3D_NBDV |
---|
133 | m_pDvInfo = NULL; |
---|
134 | #endif |
---|
135 | #if H_3D_VSP |
---|
136 | m_piVSPFlag = NULL; |
---|
137 | #endif |
---|
138 | #if H_3D_SPIVMP |
---|
139 | m_pbSPIVMPFlag = NULL; |
---|
140 | #endif |
---|
141 | #if H_3D_ARP |
---|
142 | m_puhARPW = NULL; |
---|
143 | #endif |
---|
144 | #if H_3D_IC |
---|
145 | m_pbICFlag = NULL; |
---|
146 | #endif |
---|
147 | #if H_3D_INTER_SDC |
---|
148 | #endif |
---|
149 | #if H_3D_DBBP |
---|
150 | m_pbDBBPFlag = NULL; |
---|
151 | #endif |
---|
152 | |
---|
153 | #if H_3D_DDD |
---|
154 | m_pucDisparityDerivedDepth = NULL; |
---|
155 | m_pbUseDDD = NULL; |
---|
156 | #endif |
---|
157 | } |
---|
158 | |
---|
159 | TComDataCU::~TComDataCU() |
---|
160 | { |
---|
161 | } |
---|
162 | |
---|
163 | Void TComDataCU::create(UInt uiNumPartition, UInt uiWidth, UInt uiHeight, Bool bDecSubCu, Int unitSize |
---|
164 | #if ADAPTIVE_QP_SELECTION |
---|
165 | , Bool bGlobalRMARLBuffer |
---|
166 | #endif |
---|
167 | ) |
---|
168 | { |
---|
169 | m_bDecSubCu = bDecSubCu; |
---|
170 | |
---|
171 | m_pcPic = NULL; |
---|
172 | m_pcSlice = NULL; |
---|
173 | m_uiNumPartition = uiNumPartition; |
---|
174 | m_unitSize = unitSize; |
---|
175 | |
---|
176 | if ( !bDecSubCu ) |
---|
177 | { |
---|
178 | m_phQP = (Char* )xMalloc(Char, uiNumPartition); |
---|
179 | m_puhDepth = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
180 | m_puhWidth = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
181 | m_puhHeight = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
182 | |
---|
183 | m_skipFlag = new Bool[ uiNumPartition ]; |
---|
184 | |
---|
185 | m_pePartSize = new Char[ uiNumPartition ]; |
---|
186 | memset( m_pePartSize, SIZE_NONE,uiNumPartition * sizeof( *m_pePartSize ) ); |
---|
187 | m_pePredMode = new Char[ uiNumPartition ]; |
---|
188 | m_CUTransquantBypass = new Bool[ uiNumPartition ]; |
---|
189 | m_pbMergeFlag = (Bool* )xMalloc(Bool, uiNumPartition); |
---|
190 | m_puhMergeIndex = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
191 | #if H_3D_VSP |
---|
192 | m_piVSPFlag = (Char* )xMalloc(Char, uiNumPartition); |
---|
193 | #endif |
---|
194 | #if H_3D_SPIVMP |
---|
195 | m_pbSPIVMPFlag = (Bool* )xMalloc(Bool, uiNumPartition); |
---|
196 | #endif |
---|
197 | m_puhLumaIntraDir = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
198 | m_puhChromaIntraDir = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
199 | m_puhInterDir = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
200 | |
---|
201 | m_puhTrIdx = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
202 | m_puhTransformSkip[0] = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
203 | m_puhTransformSkip[1] = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
204 | m_puhTransformSkip[2] = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
205 | |
---|
206 | m_puhCbf[0] = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
207 | m_puhCbf[1] = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
208 | m_puhCbf[2] = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
209 | |
---|
210 | m_apiMVPIdx[0] = new Char[ uiNumPartition ]; |
---|
211 | m_apiMVPIdx[1] = new Char[ uiNumPartition ]; |
---|
212 | m_apiMVPNum[0] = new Char[ uiNumPartition ]; |
---|
213 | m_apiMVPNum[1] = new Char[ uiNumPartition ]; |
---|
214 | memset( m_apiMVPIdx[0], -1,uiNumPartition * sizeof( Char ) ); |
---|
215 | memset( m_apiMVPIdx[1], -1,uiNumPartition * sizeof( Char ) ); |
---|
216 | |
---|
217 | m_pcTrCoeffY = (TCoeff*)xMalloc(TCoeff, uiWidth*uiHeight); |
---|
218 | m_pcTrCoeffCb = (TCoeff*)xMalloc(TCoeff, uiWidth*uiHeight/4); |
---|
219 | m_pcTrCoeffCr = (TCoeff*)xMalloc(TCoeff, uiWidth*uiHeight/4); |
---|
220 | #if H_3D_NBDV |
---|
221 | m_pDvInfo = (DisInfo* )xMalloc(DisInfo, uiNumPartition); |
---|
222 | #endif |
---|
223 | memset( m_pcTrCoeffY, 0,uiWidth*uiHeight * sizeof( TCoeff ) ); |
---|
224 | memset( m_pcTrCoeffCb, 0,uiWidth*uiHeight/4 * sizeof( TCoeff ) ); |
---|
225 | memset( m_pcTrCoeffCr, 0,uiWidth*uiHeight/4 * sizeof( TCoeff ) ); |
---|
226 | #if ADAPTIVE_QP_SELECTION |
---|
227 | if( bGlobalRMARLBuffer ) |
---|
228 | { |
---|
229 | if( m_pcGlbArlCoeffY == NULL ) |
---|
230 | { |
---|
231 | m_pcGlbArlCoeffY = (Int*)xMalloc(Int, uiWidth*uiHeight); |
---|
232 | m_pcGlbArlCoeffCb = (Int*)xMalloc(Int, uiWidth*uiHeight/4); |
---|
233 | m_pcGlbArlCoeffCr = (Int*)xMalloc(Int, uiWidth*uiHeight/4); |
---|
234 | } |
---|
235 | m_pcArlCoeffY = m_pcGlbArlCoeffY; |
---|
236 | m_pcArlCoeffCb = m_pcGlbArlCoeffCb; |
---|
237 | m_pcArlCoeffCr = m_pcGlbArlCoeffCr; |
---|
238 | m_ArlCoeffIsAliasedAllocation = true; |
---|
239 | } |
---|
240 | else |
---|
241 | { |
---|
242 | m_pcArlCoeffY = (Int*)xMalloc(Int, uiWidth*uiHeight); |
---|
243 | m_pcArlCoeffCb = (Int*)xMalloc(Int, uiWidth*uiHeight/4); |
---|
244 | m_pcArlCoeffCr = (Int*)xMalloc(Int, uiWidth*uiHeight/4); |
---|
245 | } |
---|
246 | #endif |
---|
247 | |
---|
248 | m_pbIPCMFlag = (Bool* )xMalloc(Bool, uiNumPartition); |
---|
249 | m_pcIPCMSampleY = (Pel* )xMalloc(Pel , uiWidth*uiHeight); |
---|
250 | m_pcIPCMSampleCb = (Pel* )xMalloc(Pel , uiWidth*uiHeight/4); |
---|
251 | m_pcIPCMSampleCr = (Pel* )xMalloc(Pel , uiWidth*uiHeight/4); |
---|
252 | |
---|
253 | m_acCUMvField[0].create( uiNumPartition ); |
---|
254 | m_acCUMvField[1].create( uiNumPartition ); |
---|
255 | |
---|
256 | #if H_3D_ARP |
---|
257 | m_puhARPW = new UChar[ uiNumPartition]; |
---|
258 | #endif |
---|
259 | #if H_3D_IC |
---|
260 | m_pbICFlag = (Bool* )xMalloc(Bool, uiNumPartition); |
---|
261 | #endif |
---|
262 | #if H_3D_DIM |
---|
263 | for( Int i = 0; i < DIM_NUM_TYPE; i++ ) |
---|
264 | { |
---|
265 | m_dimDeltaDC[i][0] = (Pel* )xMalloc(Pel, uiNumPartition); |
---|
266 | m_dimDeltaDC[i][1] = (Pel* )xMalloc(Pel, uiNumPartition); |
---|
267 | } |
---|
268 | #if H_3D_DIM_DMM |
---|
269 | for( Int i = 0; i < DMM_NUM_TYPE; i++ ) |
---|
270 | { |
---|
271 | m_dmmWedgeTabIdx[i] = (UInt*)xMalloc(UInt, uiNumPartition); |
---|
272 | } |
---|
273 | #endif |
---|
274 | #if H_3D_DIM_SDC |
---|
275 | m_pbSDCFlag = (Bool*)xMalloc(Bool, uiNumPartition); |
---|
276 | m_apSegmentDCOffset[0] = (Pel*)xMalloc(Pel, uiNumPartition); |
---|
277 | m_apSegmentDCOffset[1] = (Pel*)xMalloc(Pel, uiNumPartition); |
---|
278 | #endif |
---|
279 | #endif |
---|
280 | #if H_3D_DBBP |
---|
281 | m_pbDBBPFlag = (Bool* )xMalloc(Bool, uiNumPartition); |
---|
282 | #endif |
---|
283 | } |
---|
284 | else |
---|
285 | { |
---|
286 | m_acCUMvField[0].setNumPartition(uiNumPartition ); |
---|
287 | m_acCUMvField[1].setNumPartition(uiNumPartition ); |
---|
288 | } |
---|
289 | m_sliceStartCU = (UInt* )xMalloc(UInt, uiNumPartition); |
---|
290 | m_sliceSegmentStartCU = (UInt* )xMalloc(UInt, uiNumPartition); |
---|
291 | |
---|
292 | // create pattern memory |
---|
293 | m_pcPattern = (TComPattern*)xMalloc(TComPattern, 1); |
---|
294 | |
---|
295 | #if H_3D_DDD |
---|
296 | m_pucDisparityDerivedDepth = (UChar* )xMalloc( UChar, uiNumPartition); |
---|
297 | m_pbUseDDD = (Bool* ) xMalloc( Bool, uiNumPartition); |
---|
298 | #endif |
---|
299 | |
---|
300 | // create motion vector fields |
---|
301 | |
---|
302 | m_pcCUAboveLeft = NULL; |
---|
303 | m_pcCUAboveRight = NULL; |
---|
304 | m_pcCUAbove = NULL; |
---|
305 | m_pcCULeft = NULL; |
---|
306 | |
---|
307 | m_apcCUColocated[0] = NULL; |
---|
308 | m_apcCUColocated[1] = NULL; |
---|
309 | } |
---|
310 | |
---|
311 | Void TComDataCU::destroy() |
---|
312 | { |
---|
313 | m_pcPic = NULL; |
---|
314 | m_pcSlice = NULL; |
---|
315 | |
---|
316 | if ( m_pcPattern ) |
---|
317 | { |
---|
318 | xFree(m_pcPattern); |
---|
319 | m_pcPattern = NULL; |
---|
320 | } |
---|
321 | |
---|
322 | // encoder-side buffer free |
---|
323 | if ( !m_bDecSubCu ) |
---|
324 | { |
---|
325 | if ( m_phQP ) { xFree(m_phQP); m_phQP = NULL; } |
---|
326 | if ( m_puhDepth ) { xFree(m_puhDepth); m_puhDepth = NULL; } |
---|
327 | if ( m_puhWidth ) { xFree(m_puhWidth); m_puhWidth = NULL; } |
---|
328 | if ( m_puhHeight ) { xFree(m_puhHeight); m_puhHeight = NULL; } |
---|
329 | |
---|
330 | if ( m_skipFlag ) { delete[] m_skipFlag; m_skipFlag = NULL; } |
---|
331 | |
---|
332 | if ( m_pePartSize ) { delete[] m_pePartSize; m_pePartSize = NULL; } |
---|
333 | if ( m_pePredMode ) { delete[] m_pePredMode; m_pePredMode = NULL; } |
---|
334 | if ( m_CUTransquantBypass ) { delete[] m_CUTransquantBypass;m_CUTransquantBypass = NULL; } |
---|
335 | if ( m_puhCbf[0] ) { xFree(m_puhCbf[0]); m_puhCbf[0] = NULL; } |
---|
336 | if ( m_puhCbf[1] ) { xFree(m_puhCbf[1]); m_puhCbf[1] = NULL; } |
---|
337 | if ( m_puhCbf[2] ) { xFree(m_puhCbf[2]); m_puhCbf[2] = NULL; } |
---|
338 | if ( m_puhInterDir ) { xFree(m_puhInterDir); m_puhInterDir = NULL; } |
---|
339 | if ( m_pbMergeFlag ) { xFree(m_pbMergeFlag); m_pbMergeFlag = NULL; } |
---|
340 | if ( m_puhMergeIndex ) { xFree(m_puhMergeIndex); m_puhMergeIndex = NULL; } |
---|
341 | #if H_3D_VSP |
---|
342 | if ( m_piVSPFlag ) { xFree(m_piVSPFlag); m_piVSPFlag = NULL; } |
---|
343 | #endif |
---|
344 | #if H_3D_SPIVMP |
---|
345 | if ( m_pbSPIVMPFlag ) { xFree(m_pbSPIVMPFlag); m_pbSPIVMPFlag = NULL; } |
---|
346 | #endif |
---|
347 | if ( m_puhLumaIntraDir ) { xFree(m_puhLumaIntraDir); m_puhLumaIntraDir = NULL; } |
---|
348 | if ( m_puhChromaIntraDir ) { xFree(m_puhChromaIntraDir); m_puhChromaIntraDir = NULL; } |
---|
349 | if ( m_puhTrIdx ) { xFree(m_puhTrIdx); m_puhTrIdx = NULL; } |
---|
350 | if ( m_puhTransformSkip[0]) { xFree(m_puhTransformSkip[0]); m_puhTransformSkip[0] = NULL; } |
---|
351 | if ( m_puhTransformSkip[1]) { xFree(m_puhTransformSkip[1]); m_puhTransformSkip[1] = NULL; } |
---|
352 | if ( m_puhTransformSkip[2]) { xFree(m_puhTransformSkip[2]); m_puhTransformSkip[2] = NULL; } |
---|
353 | if ( m_pcTrCoeffY ) { xFree(m_pcTrCoeffY); m_pcTrCoeffY = NULL; } |
---|
354 | if ( m_pcTrCoeffCb ) { xFree(m_pcTrCoeffCb); m_pcTrCoeffCb = NULL; } |
---|
355 | if ( m_pcTrCoeffCr ) { xFree(m_pcTrCoeffCr); m_pcTrCoeffCr = NULL; } |
---|
356 | #if ADAPTIVE_QP_SELECTION |
---|
357 | if (!m_ArlCoeffIsAliasedAllocation) |
---|
358 | { |
---|
359 | xFree(m_pcArlCoeffY); m_pcArlCoeffY = 0; |
---|
360 | xFree(m_pcArlCoeffCb); m_pcArlCoeffCb = 0; |
---|
361 | xFree(m_pcArlCoeffCr); m_pcArlCoeffCr = 0; |
---|
362 | } |
---|
363 | if ( m_pcGlbArlCoeffY ) { xFree(m_pcGlbArlCoeffY); m_pcGlbArlCoeffY = NULL; } |
---|
364 | if ( m_pcGlbArlCoeffCb ) { xFree(m_pcGlbArlCoeffCb); m_pcGlbArlCoeffCb = NULL; } |
---|
365 | if ( m_pcGlbArlCoeffCr ) { xFree(m_pcGlbArlCoeffCr); m_pcGlbArlCoeffCr = NULL; } |
---|
366 | #endif |
---|
367 | if ( m_pbIPCMFlag ) { xFree(m_pbIPCMFlag ); m_pbIPCMFlag = NULL; } |
---|
368 | if ( m_pcIPCMSampleY ) { xFree(m_pcIPCMSampleY); m_pcIPCMSampleY = NULL; } |
---|
369 | if ( m_pcIPCMSampleCb ) { xFree(m_pcIPCMSampleCb); m_pcIPCMSampleCb = NULL; } |
---|
370 | if ( m_pcIPCMSampleCr ) { xFree(m_pcIPCMSampleCr); m_pcIPCMSampleCr = NULL; } |
---|
371 | if ( m_apiMVPIdx[0] ) { delete[] m_apiMVPIdx[0]; m_apiMVPIdx[0] = NULL; } |
---|
372 | if ( m_apiMVPIdx[1] ) { delete[] m_apiMVPIdx[1]; m_apiMVPIdx[1] = NULL; } |
---|
373 | if ( m_apiMVPNum[0] ) { delete[] m_apiMVPNum[0]; m_apiMVPNum[0] = NULL; } |
---|
374 | if ( m_apiMVPNum[1] ) { delete[] m_apiMVPNum[1]; m_apiMVPNum[1] = NULL; } |
---|
375 | #if H_3D_NBDV |
---|
376 | if ( m_pDvInfo ) { xFree(m_pDvInfo); m_pDvInfo = NULL; } |
---|
377 | #endif |
---|
378 | |
---|
379 | #if H_3D_DDD |
---|
380 | if ( m_pucDisparityDerivedDepth ) { xFree(m_pucDisparityDerivedDepth); m_pucDisparityDerivedDepth = NULL; } |
---|
381 | if ( m_pbUseDDD ) { xFree(m_pbUseDDD); m_pbUseDDD = NULL; } |
---|
382 | #endif |
---|
383 | |
---|
384 | #if H_3D_ARP |
---|
385 | if ( m_puhARPW ) { delete[] m_puhARPW; m_puhARPW = NULL; } |
---|
386 | #endif |
---|
387 | #if H_3D_IC |
---|
388 | if ( m_pbICFlag ) { xFree(m_pbICFlag); m_pbICFlag = NULL; } |
---|
389 | #endif |
---|
390 | m_acCUMvField[0].destroy(); |
---|
391 | m_acCUMvField[1].destroy(); |
---|
392 | |
---|
393 | #if H_3D_DIM |
---|
394 | for( Int i = 0; i < DIM_NUM_TYPE; i++ ) |
---|
395 | { |
---|
396 | if ( m_dimDeltaDC[i][0] ) { xFree( m_dimDeltaDC[i][0] ); m_dimDeltaDC[i][0] = NULL; } |
---|
397 | if ( m_dimDeltaDC[i][1] ) { xFree( m_dimDeltaDC[i][1] ); m_dimDeltaDC[i][1] = NULL; } |
---|
398 | } |
---|
399 | #if H_3D_DIM_DMM |
---|
400 | for( Int i = 0; i < DMM_NUM_TYPE; i++ ) |
---|
401 | { |
---|
402 | if ( m_dmmWedgeTabIdx[i] ) { xFree( m_dmmWedgeTabIdx[i] ); m_dmmWedgeTabIdx[i] = NULL; } |
---|
403 | } |
---|
404 | #endif |
---|
405 | #if H_3D_DIM_SDC |
---|
406 | if ( m_pbSDCFlag ) { xFree(m_pbSDCFlag); m_pbSDCFlag = NULL; } |
---|
407 | if ( m_apSegmentDCOffset[0] ) { xFree(m_apSegmentDCOffset[0]); m_apSegmentDCOffset[0] = NULL; } |
---|
408 | if ( m_apSegmentDCOffset[1] ) { xFree(m_apSegmentDCOffset[1]); m_apSegmentDCOffset[1] = NULL; } |
---|
409 | #endif |
---|
410 | #endif |
---|
411 | #if H_3D_DBBP |
---|
412 | if ( m_pbDBBPFlag ) { xFree(m_pbDBBPFlag); m_pbDBBPFlag = NULL; } |
---|
413 | #endif |
---|
414 | } |
---|
415 | m_pcCUAboveLeft = NULL; |
---|
416 | m_pcCUAboveRight = NULL; |
---|
417 | m_pcCUAbove = NULL; |
---|
418 | m_pcCULeft = NULL; |
---|
419 | |
---|
420 | m_apcCUColocated[0] = NULL; |
---|
421 | m_apcCUColocated[1] = NULL; |
---|
422 | |
---|
423 | if( m_sliceStartCU ) |
---|
424 | { |
---|
425 | xFree(m_sliceStartCU); |
---|
426 | m_sliceStartCU=NULL; |
---|
427 | } |
---|
428 | if(m_sliceSegmentStartCU ) |
---|
429 | { |
---|
430 | xFree(m_sliceSegmentStartCU); |
---|
431 | m_sliceSegmentStartCU=NULL; |
---|
432 | } |
---|
433 | } |
---|
434 | |
---|
435 | // ==================================================================================================================== |
---|
436 | // Public member functions |
---|
437 | // ==================================================================================================================== |
---|
438 | |
---|
439 | // -------------------------------------------------------------------------------------------------------------------- |
---|
440 | // Initialization |
---|
441 | // -------------------------------------------------------------------------------------------------------------------- |
---|
442 | |
---|
443 | /** |
---|
444 | - initialize top-level CU |
---|
445 | - internal buffers are already created |
---|
446 | - set values before encoding a CU |
---|
447 | . |
---|
448 | \param pcPic picture (TComPic) class pointer |
---|
449 | \param iCUAddr CU address |
---|
450 | */ |
---|
451 | Void TComDataCU::initCU( TComPic* pcPic, UInt iCUAddr ) |
---|
452 | { |
---|
453 | |
---|
454 | m_pcPic = pcPic; |
---|
455 | m_pcSlice = pcPic->getSlice(pcPic->getCurrSliceIdx()); |
---|
456 | m_uiCUAddr = iCUAddr; |
---|
457 | m_uiCUPelX = ( iCUAddr % pcPic->getFrameWidthInCU() ) * g_uiMaxCUWidth; |
---|
458 | m_uiCUPelY = ( iCUAddr / pcPic->getFrameWidthInCU() ) * g_uiMaxCUHeight; |
---|
459 | m_uiAbsIdxInLCU = 0; |
---|
460 | m_dTotalCost = MAX_DOUBLE; |
---|
461 | m_uiTotalDistortion = 0; |
---|
462 | m_uiTotalBits = 0; |
---|
463 | m_uiTotalBins = 0; |
---|
464 | m_uiNumPartition = pcPic->getNumPartInCU(); |
---|
465 | |
---|
466 | for(Int i=0; i<pcPic->getNumPartInCU(); i++) |
---|
467 | { |
---|
468 | if(pcPic->getPicSym()->getInverseCUOrderMap(iCUAddr)*pcPic->getNumPartInCU()+i>=getSlice()->getSliceCurStartCUAddr()) |
---|
469 | { |
---|
470 | m_sliceStartCU[i]=getSlice()->getSliceCurStartCUAddr(); |
---|
471 | } |
---|
472 | else |
---|
473 | { |
---|
474 | m_sliceStartCU[i]=pcPic->getCU(getAddr())->m_sliceStartCU[i]; |
---|
475 | } |
---|
476 | } |
---|
477 | for(Int i=0; i<pcPic->getNumPartInCU(); i++) |
---|
478 | { |
---|
479 | if(pcPic->getPicSym()->getInverseCUOrderMap(iCUAddr)*pcPic->getNumPartInCU()+i>=getSlice()->getSliceSegmentCurStartCUAddr()) |
---|
480 | { |
---|
481 | m_sliceSegmentStartCU[i]=getSlice()->getSliceSegmentCurStartCUAddr(); |
---|
482 | } |
---|
483 | else |
---|
484 | { |
---|
485 | m_sliceSegmentStartCU[i]=pcPic->getCU(getAddr())->m_sliceSegmentStartCU[i]; |
---|
486 | } |
---|
487 | } |
---|
488 | |
---|
489 | Int partStartIdx = getSlice()->getSliceSegmentCurStartCUAddr() - pcPic->getPicSym()->getInverseCUOrderMap(iCUAddr) * pcPic->getNumPartInCU(); |
---|
490 | |
---|
491 | Int numElements = min<Int>( partStartIdx, m_uiNumPartition ); |
---|
492 | for ( Int ui = 0; ui < numElements; ui++ ) |
---|
493 | { |
---|
494 | TComDataCU * pcFrom = pcPic->getCU(getAddr()); |
---|
495 | m_skipFlag[ui] = pcFrom->getSkipFlag(ui); |
---|
496 | m_pePartSize[ui] = pcFrom->getPartitionSize(ui); |
---|
497 | m_pePredMode[ui] = pcFrom->getPredictionMode(ui); |
---|
498 | m_CUTransquantBypass[ui] = pcFrom->getCUTransquantBypass(ui); |
---|
499 | m_puhDepth[ui] = pcFrom->getDepth(ui); |
---|
500 | #if H_3D_ARP |
---|
501 | m_puhARPW [ui] = pcFrom->getARPW( ui ); |
---|
502 | #endif |
---|
503 | #if H_3D_IC |
---|
504 | m_pbICFlag[ui] = pcFrom->m_pbICFlag[ui]; |
---|
505 | #endif |
---|
506 | |
---|
507 | #if H_3D_DDD |
---|
508 | m_pucDisparityDerivedDepth[ui] = pcFrom->m_pucDisparityDerivedDepth[ui]; |
---|
509 | m_pbUseDDD[ui] = pcFrom->m_pbUseDDD[ui]; |
---|
510 | #endif |
---|
511 | |
---|
512 | m_puhWidth [ui] = pcFrom->getWidth(ui); |
---|
513 | m_puhHeight [ui] = pcFrom->getHeight(ui); |
---|
514 | m_puhTrIdx [ui] = pcFrom->getTransformIdx(ui); |
---|
515 | m_puhTransformSkip[0][ui] = pcFrom->getTransformSkip(ui,TEXT_LUMA); |
---|
516 | m_puhTransformSkip[1][ui] = pcFrom->getTransformSkip(ui,TEXT_CHROMA_U); |
---|
517 | m_puhTransformSkip[2][ui] = pcFrom->getTransformSkip(ui,TEXT_CHROMA_V); |
---|
518 | m_apiMVPIdx[0][ui] = pcFrom->m_apiMVPIdx[0][ui];; |
---|
519 | m_apiMVPIdx[1][ui] = pcFrom->m_apiMVPIdx[1][ui]; |
---|
520 | m_apiMVPNum[0][ui] = pcFrom->m_apiMVPNum[0][ui]; |
---|
521 | m_apiMVPNum[1][ui] = pcFrom->m_apiMVPNum[1][ui]; |
---|
522 | m_phQP[ui]=pcFrom->m_phQP[ui]; |
---|
523 | m_pbMergeFlag[ui]=pcFrom->m_pbMergeFlag[ui]; |
---|
524 | m_puhMergeIndex[ui]=pcFrom->m_puhMergeIndex[ui]; |
---|
525 | #if H_3D_VSP |
---|
526 | m_piVSPFlag[ui] = pcFrom->m_piVSPFlag[ui]; |
---|
527 | #endif |
---|
528 | #if H_3D_SPIVMP |
---|
529 | m_pbSPIVMPFlag[ui] = pcFrom->m_pbSPIVMPFlag[ui]; |
---|
530 | #endif |
---|
531 | m_puhLumaIntraDir[ui]=pcFrom->m_puhLumaIntraDir[ui]; |
---|
532 | m_puhChromaIntraDir[ui]=pcFrom->m_puhChromaIntraDir[ui]; |
---|
533 | m_puhInterDir[ui]=pcFrom->m_puhInterDir[ui]; |
---|
534 | m_puhCbf[0][ui]=pcFrom->m_puhCbf[0][ui]; |
---|
535 | m_puhCbf[1][ui]=pcFrom->m_puhCbf[1][ui]; |
---|
536 | m_puhCbf[2][ui]=pcFrom->m_puhCbf[2][ui]; |
---|
537 | m_pbIPCMFlag[ui] = pcFrom->m_pbIPCMFlag[ui]; |
---|
538 | #if H_3D_DIM_SDC |
---|
539 | m_pbSDCFlag[ui] = pcFrom->m_pbSDCFlag[ui]; |
---|
540 | #endif |
---|
541 | #if H_3D_DBBP |
---|
542 | m_pbDBBPFlag[ui] = pcFrom->m_pbDBBPFlag[ui]; |
---|
543 | #endif |
---|
544 | } |
---|
545 | |
---|
546 | Int firstElement = max<Int>( partStartIdx, 0 ); |
---|
547 | numElements = m_uiNumPartition - firstElement; |
---|
548 | |
---|
549 | if ( numElements > 0 ) |
---|
550 | { |
---|
551 | memset( m_skipFlag + firstElement, false, numElements * sizeof( *m_skipFlag ) ); |
---|
552 | |
---|
553 | memset( m_pePartSize + firstElement, SIZE_NONE, numElements * sizeof( *m_pePartSize ) ); |
---|
554 | memset( m_pePredMode + firstElement, MODE_NONE, numElements * sizeof( *m_pePredMode ) ); |
---|
555 | memset( m_CUTransquantBypass+ firstElement, false, numElements * sizeof( *m_CUTransquantBypass) ); |
---|
556 | memset( m_puhDepth + firstElement, 0, numElements * sizeof( *m_puhDepth ) ); |
---|
557 | memset( m_puhTrIdx + firstElement, 0, numElements * sizeof( *m_puhTrIdx ) ); |
---|
558 | memset( m_puhTransformSkip[0] + firstElement, 0, numElements * sizeof( *m_puhTransformSkip[0]) ); |
---|
559 | memset( m_puhTransformSkip[1] + firstElement, 0, numElements * sizeof( *m_puhTransformSkip[1]) ); |
---|
560 | memset( m_puhTransformSkip[2] + firstElement, 0, numElements * sizeof( *m_puhTransformSkip[2]) ); |
---|
561 | memset( m_puhWidth + firstElement, g_uiMaxCUWidth, numElements * sizeof( *m_puhWidth ) ); |
---|
562 | memset( m_puhHeight + firstElement, g_uiMaxCUHeight, numElements * sizeof( *m_puhHeight ) ); |
---|
563 | memset( m_apiMVPIdx[0] + firstElement, -1, numElements * sizeof( *m_apiMVPIdx[0] ) ); |
---|
564 | memset( m_apiMVPIdx[1] + firstElement, -1, numElements * sizeof( *m_apiMVPIdx[1] ) ); |
---|
565 | memset( m_apiMVPNum[0] + firstElement, -1, numElements * sizeof( *m_apiMVPNum[0] ) ); |
---|
566 | memset( m_apiMVPNum[1] + firstElement, -1, numElements * sizeof( *m_apiMVPNum[1] ) ); |
---|
567 | memset( m_phQP + firstElement, getSlice()->getSliceQp(), numElements * sizeof( *m_phQP ) ); |
---|
568 | memset( m_pbMergeFlag + firstElement, false, numElements * sizeof( *m_pbMergeFlag ) ); |
---|
569 | memset( m_puhMergeIndex + firstElement, 0, numElements * sizeof( *m_puhMergeIndex ) ); |
---|
570 | #if H_3D_VSP |
---|
571 | memset( m_piVSPFlag + firstElement, 0, numElements * sizeof( *m_piVSPFlag ) ); |
---|
572 | #endif |
---|
573 | #if H_3D_SPIVMP |
---|
574 | memset( m_pbSPIVMPFlag + firstElement, 0, numElements * sizeof( *m_pbSPIVMPFlag ) ); |
---|
575 | #endif |
---|
576 | memset( m_puhLumaIntraDir + firstElement, DC_IDX, numElements * sizeof( *m_puhLumaIntraDir ) ); |
---|
577 | memset( m_puhChromaIntraDir + firstElement, 0, numElements * sizeof( *m_puhChromaIntraDir ) ); |
---|
578 | memset( m_puhInterDir + firstElement, 0, numElements * sizeof( *m_puhInterDir ) ); |
---|
579 | memset( m_puhCbf[0] + firstElement, 0, numElements * sizeof( *m_puhCbf[0] ) ); |
---|
580 | memset( m_puhCbf[1] + firstElement, 0, numElements * sizeof( *m_puhCbf[1] ) ); |
---|
581 | memset( m_puhCbf[2] + firstElement, 0, numElements * sizeof( *m_puhCbf[2] ) ); |
---|
582 | memset( m_pbIPCMFlag + firstElement, false, numElements * sizeof( *m_pbIPCMFlag ) ); |
---|
583 | #if H_3D_ARP |
---|
584 | memset( m_puhARPW + firstElement, 0, numElements * sizeof( UChar ) ); |
---|
585 | #endif |
---|
586 | #if H_3D_IC |
---|
587 | memset( m_pbICFlag + firstElement, false, numElements * sizeof( *m_pbICFlag ) ); |
---|
588 | #endif |
---|
589 | |
---|
590 | #if H_3D_DDD |
---|
591 | memset( m_pucDisparityDerivedDepth + firstElement, 0, numElements * sizeof( *m_pucDisparityDerivedDepth ) ); |
---|
592 | memset( m_pbUseDDD + firstElement, 0, numElements * sizeof( *m_pbUseDDD ) ); |
---|
593 | #endif |
---|
594 | |
---|
595 | #if H_3D_DIM |
---|
596 | for( Int i = 0; i < DIM_NUM_TYPE; i++ ) |
---|
597 | { |
---|
598 | memset( m_dimDeltaDC[i][0] + firstElement, 0, numElements * sizeof( *m_dimDeltaDC[i][0] ) ); |
---|
599 | memset( m_dimDeltaDC[i][1] + firstElement, 0, numElements * sizeof( *m_dimDeltaDC[i][1] ) ); |
---|
600 | } |
---|
601 | #if H_3D_DIM_DMM |
---|
602 | for( Int i = 0; i < DMM_NUM_TYPE; i++ ) |
---|
603 | { |
---|
604 | memset( m_dmmWedgeTabIdx[i] + firstElement, 0, numElements * sizeof( *m_dmmWedgeTabIdx[i] ) ); |
---|
605 | } |
---|
606 | #endif |
---|
607 | #if H_3D_DIM_SDC |
---|
608 | memset( m_pbSDCFlag + firstElement, 0, numElements * sizeof( *m_pbSDCFlag ) ); |
---|
609 | memset( m_apSegmentDCOffset[0] + firstElement, 0, numElements * sizeof( *m_apSegmentDCOffset[0] ) ); |
---|
610 | memset( m_apSegmentDCOffset[1] + firstElement, 0, numElements * sizeof( *m_apSegmentDCOffset[1] ) ); |
---|
611 | #endif |
---|
612 | #endif |
---|
613 | #if H_3D_DBBP |
---|
614 | memset( m_pbDBBPFlag + firstElement, false, numElements * sizeof( *m_pbDBBPFlag ) ); |
---|
615 | #endif |
---|
616 | } |
---|
617 | |
---|
618 | UInt uiTmp = g_uiMaxCUWidth*g_uiMaxCUHeight; |
---|
619 | if ( 0 >= partStartIdx ) |
---|
620 | { |
---|
621 | m_acCUMvField[0].clearMvField(); |
---|
622 | m_acCUMvField[1].clearMvField(); |
---|
623 | memset( m_pcTrCoeffY , 0, sizeof( TCoeff ) * uiTmp ); |
---|
624 | #if ADAPTIVE_QP_SELECTION |
---|
625 | memset( m_pcArlCoeffY , 0, sizeof( Int ) * uiTmp ); |
---|
626 | #endif |
---|
627 | memset( m_pcIPCMSampleY , 0, sizeof( Pel ) * uiTmp ); |
---|
628 | uiTmp >>= 2; |
---|
629 | memset( m_pcTrCoeffCb, 0, sizeof( TCoeff ) * uiTmp ); |
---|
630 | memset( m_pcTrCoeffCr, 0, sizeof( TCoeff ) * uiTmp ); |
---|
631 | #if ADAPTIVE_QP_SELECTION |
---|
632 | memset( m_pcArlCoeffCb, 0, sizeof( Int ) * uiTmp ); |
---|
633 | memset( m_pcArlCoeffCr, 0, sizeof( Int ) * uiTmp ); |
---|
634 | #endif |
---|
635 | memset( m_pcIPCMSampleCb , 0, sizeof( Pel ) * uiTmp ); |
---|
636 | memset( m_pcIPCMSampleCr , 0, sizeof( Pel ) * uiTmp ); |
---|
637 | } |
---|
638 | else |
---|
639 | { |
---|
640 | TComDataCU * pcFrom = pcPic->getCU(getAddr()); |
---|
641 | m_acCUMvField[0].copyFrom(&pcFrom->m_acCUMvField[0],m_uiNumPartition,0); |
---|
642 | m_acCUMvField[1].copyFrom(&pcFrom->m_acCUMvField[1],m_uiNumPartition,0); |
---|
643 | for(Int i=0; i<uiTmp; i++) |
---|
644 | { |
---|
645 | m_pcTrCoeffY[i]=pcFrom->m_pcTrCoeffY[i]; |
---|
646 | #if ADAPTIVE_QP_SELECTION |
---|
647 | m_pcArlCoeffY[i]=pcFrom->m_pcArlCoeffY[i]; |
---|
648 | #endif |
---|
649 | m_pcIPCMSampleY[i]=pcFrom->m_pcIPCMSampleY[i]; |
---|
650 | } |
---|
651 | for(Int i=0; i<(uiTmp>>2); i++) |
---|
652 | { |
---|
653 | m_pcTrCoeffCb[i]=pcFrom->m_pcTrCoeffCb[i]; |
---|
654 | m_pcTrCoeffCr[i]=pcFrom->m_pcTrCoeffCr[i]; |
---|
655 | #if ADAPTIVE_QP_SELECTION |
---|
656 | m_pcArlCoeffCb[i]=pcFrom->m_pcArlCoeffCb[i]; |
---|
657 | m_pcArlCoeffCr[i]=pcFrom->m_pcArlCoeffCr[i]; |
---|
658 | #endif |
---|
659 | m_pcIPCMSampleCb[i]=pcFrom->m_pcIPCMSampleCb[i]; |
---|
660 | m_pcIPCMSampleCr[i]=pcFrom->m_pcIPCMSampleCr[i]; |
---|
661 | } |
---|
662 | } |
---|
663 | |
---|
664 | // Setting neighbor CU |
---|
665 | m_pcCULeft = NULL; |
---|
666 | m_pcCUAbove = NULL; |
---|
667 | m_pcCUAboveLeft = NULL; |
---|
668 | m_pcCUAboveRight = NULL; |
---|
669 | |
---|
670 | m_apcCUColocated[0] = NULL; |
---|
671 | m_apcCUColocated[1] = NULL; |
---|
672 | |
---|
673 | UInt uiWidthInCU = pcPic->getFrameWidthInCU(); |
---|
674 | if ( m_uiCUAddr % uiWidthInCU ) |
---|
675 | { |
---|
676 | m_pcCULeft = pcPic->getCU( m_uiCUAddr - 1 ); |
---|
677 | } |
---|
678 | |
---|
679 | if ( m_uiCUAddr / uiWidthInCU ) |
---|
680 | { |
---|
681 | m_pcCUAbove = pcPic->getCU( m_uiCUAddr - uiWidthInCU ); |
---|
682 | } |
---|
683 | |
---|
684 | if ( m_pcCULeft && m_pcCUAbove ) |
---|
685 | { |
---|
686 | m_pcCUAboveLeft = pcPic->getCU( m_uiCUAddr - uiWidthInCU - 1 ); |
---|
687 | } |
---|
688 | |
---|
689 | if ( m_pcCUAbove && ( (m_uiCUAddr%uiWidthInCU) < (uiWidthInCU-1) ) ) |
---|
690 | { |
---|
691 | m_pcCUAboveRight = pcPic->getCU( m_uiCUAddr - uiWidthInCU + 1 ); |
---|
692 | } |
---|
693 | |
---|
694 | if ( getSlice()->getNumRefIdx( REF_PIC_LIST_0 ) > 0 ) |
---|
695 | { |
---|
696 | m_apcCUColocated[0] = getSlice()->getRefPic( REF_PIC_LIST_0, 0)->getCU( m_uiCUAddr ); |
---|
697 | } |
---|
698 | |
---|
699 | if ( getSlice()->getNumRefIdx( REF_PIC_LIST_1 ) > 0 ) |
---|
700 | { |
---|
701 | m_apcCUColocated[1] = getSlice()->getRefPic( REF_PIC_LIST_1, 0)->getCU( m_uiCUAddr ); |
---|
702 | } |
---|
703 | } |
---|
704 | |
---|
705 | /** initialize prediction data with enabling sub-LCU-level delta QP |
---|
706 | *\param uiDepth depth of the current CU |
---|
707 | *\param qp qp for the current CU |
---|
708 | *- set CU width and CU height according to depth |
---|
709 | *- set qp value according to input qp |
---|
710 | *- set last-coded qp value according to input last-coded qp |
---|
711 | */ |
---|
712 | Void TComDataCU::initEstData( UInt uiDepth, Int qp, Bool bTransquantBypass ) |
---|
713 | { |
---|
714 | m_dTotalCost = MAX_DOUBLE; |
---|
715 | m_uiTotalDistortion = 0; |
---|
716 | m_uiTotalBits = 0; |
---|
717 | m_uiTotalBins = 0; |
---|
718 | |
---|
719 | UChar uhWidth = g_uiMaxCUWidth >> uiDepth; |
---|
720 | UChar uhHeight = g_uiMaxCUHeight >> uiDepth; |
---|
721 | |
---|
722 | for (UInt ui = 0; ui < m_uiNumPartition; ui++) |
---|
723 | { |
---|
724 | if(getPic()->getPicSym()->getInverseCUOrderMap(getAddr())*m_pcPic->getNumPartInCU()+m_uiAbsIdxInLCU+ui >= getSlice()->getSliceSegmentCurStartCUAddr()) |
---|
725 | { |
---|
726 | m_apiMVPIdx[0][ui] = -1; |
---|
727 | m_apiMVPIdx[1][ui] = -1; |
---|
728 | m_apiMVPNum[0][ui] = -1; |
---|
729 | m_apiMVPNum[1][ui] = -1; |
---|
730 | m_puhDepth [ui] = uiDepth; |
---|
731 | m_puhWidth [ui] = uhWidth; |
---|
732 | m_puhHeight [ui] = uhHeight; |
---|
733 | m_puhTrIdx [ui] = 0; |
---|
734 | m_puhTransformSkip[0][ui] = 0; |
---|
735 | m_puhTransformSkip[1][ui] = 0; |
---|
736 | m_puhTransformSkip[2][ui] = 0; |
---|
737 | m_skipFlag[ui] = false; |
---|
738 | m_pePartSize[ui] = SIZE_NONE; |
---|
739 | m_pePredMode[ui] = MODE_NONE; |
---|
740 | m_CUTransquantBypass[ui] = bTransquantBypass; |
---|
741 | m_pbIPCMFlag[ui] = 0; |
---|
742 | m_phQP[ui] = qp; |
---|
743 | m_pbMergeFlag[ui] = 0; |
---|
744 | m_puhMergeIndex[ui] = 0; |
---|
745 | #if H_3D_VSP |
---|
746 | m_piVSPFlag[ui] = 0; |
---|
747 | #endif |
---|
748 | #if H_3D_SPIVMP |
---|
749 | m_pbSPIVMPFlag[ui] = 0; |
---|
750 | #endif |
---|
751 | m_puhLumaIntraDir[ui] = DC_IDX; |
---|
752 | m_puhChromaIntraDir[ui] = 0; |
---|
753 | m_puhInterDir[ui] = 0; |
---|
754 | m_puhCbf[0][ui] = 0; |
---|
755 | m_puhCbf[1][ui] = 0; |
---|
756 | m_puhCbf[2][ui] = 0; |
---|
757 | #if H_3D_ARP |
---|
758 | m_puhARPW[ui] = 0; |
---|
759 | #endif |
---|
760 | #if H_3D_IC |
---|
761 | m_pbICFlag[ui] = false; |
---|
762 | #endif |
---|
763 | |
---|
764 | #if H_3D_DDD |
---|
765 | m_pucDisparityDerivedDepth[ui] = 0; |
---|
766 | m_pbUseDDD[ui] = 0; |
---|
767 | #endif |
---|
768 | |
---|
769 | #if H_3D_DIM |
---|
770 | for( Int i = 0; i < DIM_NUM_TYPE; i++ ) |
---|
771 | { |
---|
772 | m_dimDeltaDC[i][0] [ui] = 0; |
---|
773 | m_dimDeltaDC[i][1] [ui] = 0; |
---|
774 | } |
---|
775 | #if H_3D_DIM_DMM |
---|
776 | for( Int i = 0; i < DMM_NUM_TYPE; i++ ) |
---|
777 | { |
---|
778 | m_dmmWedgeTabIdx[i] [ui] = 0; |
---|
779 | } |
---|
780 | #endif |
---|
781 | #if H_3D_DIM_SDC |
---|
782 | m_pbSDCFlag [ui] = false; |
---|
783 | m_apSegmentDCOffset[0][ui] = 0; |
---|
784 | m_apSegmentDCOffset[1][ui] = 0; |
---|
785 | #endif |
---|
786 | #endif |
---|
787 | #if H_3D_DBBP |
---|
788 | m_pbDBBPFlag[ui] = false; |
---|
789 | #endif |
---|
790 | } |
---|
791 | } |
---|
792 | |
---|
793 | if(getPic()->getPicSym()->getInverseCUOrderMap(getAddr())*m_pcPic->getNumPartInCU()+m_uiAbsIdxInLCU >= getSlice()->getSliceSegmentCurStartCUAddr()) |
---|
794 | { |
---|
795 | m_acCUMvField[0].clearMvField(); |
---|
796 | m_acCUMvField[1].clearMvField(); |
---|
797 | UInt uiTmp = uhWidth*uhHeight; |
---|
798 | |
---|
799 | memset( m_pcTrCoeffY, 0, uiTmp * sizeof( *m_pcTrCoeffY ) ); |
---|
800 | #if ADAPTIVE_QP_SELECTION |
---|
801 | memset( m_pcArlCoeffY , 0, uiTmp * sizeof( *m_pcArlCoeffY ) ); |
---|
802 | #endif |
---|
803 | memset( m_pcIPCMSampleY, 0, uiTmp * sizeof( *m_pcIPCMSampleY ) ); |
---|
804 | |
---|
805 | uiTmp>>=2; |
---|
806 | memset( m_pcTrCoeffCb, 0, uiTmp * sizeof( *m_pcTrCoeffCb ) ); |
---|
807 | memset( m_pcTrCoeffCr, 0, uiTmp * sizeof( *m_pcTrCoeffCr ) ); |
---|
808 | #if ADAPTIVE_QP_SELECTION |
---|
809 | memset( m_pcArlCoeffCb, 0, uiTmp * sizeof( *m_pcArlCoeffCb ) ); |
---|
810 | memset( m_pcArlCoeffCr, 0, uiTmp * sizeof( *m_pcArlCoeffCr ) ); |
---|
811 | #endif |
---|
812 | memset( m_pcIPCMSampleCb, 0, uiTmp * sizeof( *m_pcIPCMSampleCb ) ); |
---|
813 | memset( m_pcIPCMSampleCr, 0, uiTmp * sizeof( *m_pcIPCMSampleCr ) ); |
---|
814 | } |
---|
815 | } |
---|
816 | |
---|
817 | |
---|
818 | // initialize Sub partition |
---|
819 | Void TComDataCU::initSubCU( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, Int qp ) |
---|
820 | { |
---|
821 | assert( uiPartUnitIdx<4 ); |
---|
822 | |
---|
823 | UInt uiPartOffset = ( pcCU->getTotalNumPart()>>2 )*uiPartUnitIdx; |
---|
824 | |
---|
825 | m_pcPic = pcCU->getPic(); |
---|
826 | m_pcSlice = m_pcPic->getSlice(m_pcPic->getCurrSliceIdx()); |
---|
827 | m_uiCUAddr = pcCU->getAddr(); |
---|
828 | m_uiAbsIdxInLCU = pcCU->getZorderIdxInCU() + uiPartOffset; |
---|
829 | |
---|
830 | m_uiCUPelX = pcCU->getCUPelX() + ( g_uiMaxCUWidth>>uiDepth )*( uiPartUnitIdx & 1 ); |
---|
831 | m_uiCUPelY = pcCU->getCUPelY() + ( g_uiMaxCUHeight>>uiDepth )*( uiPartUnitIdx >> 1 ); |
---|
832 | |
---|
833 | m_dTotalCost = MAX_DOUBLE; |
---|
834 | m_uiTotalDistortion = 0; |
---|
835 | m_uiTotalBits = 0; |
---|
836 | m_uiTotalBins = 0; |
---|
837 | m_uiNumPartition = pcCU->getTotalNumPart() >> 2; |
---|
838 | |
---|
839 | Int iSizeInUchar = sizeof( UChar ) * m_uiNumPartition; |
---|
840 | Int iSizeInBool = sizeof( Bool ) * m_uiNumPartition; |
---|
841 | |
---|
842 | Int sizeInChar = sizeof( Char ) * m_uiNumPartition; |
---|
843 | memset( m_phQP, qp, sizeInChar ); |
---|
844 | |
---|
845 | memset( m_pbMergeFlag, 0, iSizeInBool ); |
---|
846 | memset( m_puhMergeIndex, 0, iSizeInUchar ); |
---|
847 | #if H_3D_VSP |
---|
848 | memset( m_piVSPFlag, 0, sizeof( Char ) * m_uiNumPartition ); |
---|
849 | #endif |
---|
850 | #if H_3D_SPIVMP |
---|
851 | memset( m_pbSPIVMPFlag, 0, sizeof( Bool ) * m_uiNumPartition ); |
---|
852 | #endif |
---|
853 | memset( m_puhLumaIntraDir, DC_IDX, iSizeInUchar ); |
---|
854 | memset( m_puhChromaIntraDir, 0, iSizeInUchar ); |
---|
855 | memset( m_puhInterDir, 0, iSizeInUchar ); |
---|
856 | memset( m_puhTrIdx, 0, iSizeInUchar ); |
---|
857 | memset( m_puhTransformSkip[0], 0, iSizeInUchar ); |
---|
858 | memset( m_puhTransformSkip[1], 0, iSizeInUchar ); |
---|
859 | memset( m_puhTransformSkip[2], 0, iSizeInUchar ); |
---|
860 | memset( m_puhCbf[0], 0, iSizeInUchar ); |
---|
861 | memset( m_puhCbf[1], 0, iSizeInUchar ); |
---|
862 | memset( m_puhCbf[2], 0, iSizeInUchar ); |
---|
863 | memset( m_puhDepth, uiDepth, iSizeInUchar ); |
---|
864 | #if H_3D_NBDV |
---|
865 | m_pDvInfo->bDV = false; |
---|
866 | #endif |
---|
867 | #if H_3D_ARP |
---|
868 | memset( m_puhARPW, 0, iSizeInUchar ); |
---|
869 | #endif |
---|
870 | |
---|
871 | #if H_3D_DDD |
---|
872 | memset( m_pucDisparityDerivedDepth, 0, iSizeInUchar ); |
---|
873 | memset( m_pbUseDDD, 0, iSizeInBool ); |
---|
874 | #endif |
---|
875 | |
---|
876 | UChar uhWidth = g_uiMaxCUWidth >> uiDepth; |
---|
877 | UChar uhHeight = g_uiMaxCUHeight >> uiDepth; |
---|
878 | memset( m_puhWidth, uhWidth, iSizeInUchar ); |
---|
879 | memset( m_puhHeight, uhHeight, iSizeInUchar ); |
---|
880 | memset( m_pbIPCMFlag, 0, iSizeInBool ); |
---|
881 | #if H_3D_IC |
---|
882 | memset( m_pbICFlag, 0, iSizeInBool ); |
---|
883 | #endif |
---|
884 | #if H_3D_DIM |
---|
885 | for( Int i = 0; i < DIM_NUM_TYPE; i++ ) |
---|
886 | { |
---|
887 | memset( m_dimDeltaDC[i][0], 0, sizeof(Pel ) * m_uiNumPartition ); |
---|
888 | memset( m_dimDeltaDC[i][1], 0, sizeof(Pel ) * m_uiNumPartition ); |
---|
889 | } |
---|
890 | #if H_3D_DIM_DMM |
---|
891 | for( Int i = 0; i < DMM_NUM_TYPE; i++ ) |
---|
892 | { |
---|
893 | memset( m_dmmWedgeTabIdx[i], 0, sizeof(UInt) * m_uiNumPartition ); |
---|
894 | } |
---|
895 | #endif |
---|
896 | #if H_3D_DIM_SDC |
---|
897 | memset( m_pbSDCFlag, 0, sizeof(Bool) * m_uiNumPartition ); |
---|
898 | memset( m_apSegmentDCOffset[0], 0, sizeof(Pel) * m_uiNumPartition ); |
---|
899 | memset( m_apSegmentDCOffset[1], 0, sizeof(Pel) * m_uiNumPartition ); |
---|
900 | #endif |
---|
901 | #endif |
---|
902 | #if H_3D_DBBP |
---|
903 | memset( m_pbDBBPFlag, 0, iSizeInBool ); |
---|
904 | #endif |
---|
905 | |
---|
906 | for (UInt ui = 0; ui < m_uiNumPartition; ui++) |
---|
907 | { |
---|
908 | m_skipFlag[ui] = false; |
---|
909 | m_pePartSize[ui] = SIZE_NONE; |
---|
910 | m_pePredMode[ui] = MODE_NONE; |
---|
911 | m_CUTransquantBypass[ui] = false; |
---|
912 | m_apiMVPIdx[0][ui] = -1; |
---|
913 | m_apiMVPIdx[1][ui] = -1; |
---|
914 | m_apiMVPNum[0][ui] = -1; |
---|
915 | m_apiMVPNum[1][ui] = -1; |
---|
916 | if(m_pcPic->getPicSym()->getInverseCUOrderMap(getAddr())*m_pcPic->getNumPartInCU()+m_uiAbsIdxInLCU+ui<getSlice()->getSliceSegmentCurStartCUAddr()) |
---|
917 | { |
---|
918 | m_apiMVPIdx[0][ui] = pcCU->m_apiMVPIdx[0][uiPartOffset+ui]; |
---|
919 | m_apiMVPIdx[1][ui] = pcCU->m_apiMVPIdx[1][uiPartOffset+ui];; |
---|
920 | m_apiMVPNum[0][ui] = pcCU->m_apiMVPNum[0][uiPartOffset+ui];; |
---|
921 | m_apiMVPNum[1][ui] = pcCU->m_apiMVPNum[1][uiPartOffset+ui];; |
---|
922 | m_puhDepth [ui] = pcCU->getDepth(uiPartOffset+ui); |
---|
923 | m_puhWidth [ui] = pcCU->getWidth(uiPartOffset+ui); |
---|
924 | m_puhHeight [ui] = pcCU->getHeight(uiPartOffset+ui); |
---|
925 | m_puhTrIdx [ui] = pcCU->getTransformIdx(uiPartOffset+ui); |
---|
926 | m_puhTransformSkip[0][ui] = pcCU->getTransformSkip(uiPartOffset+ui,TEXT_LUMA); |
---|
927 | m_puhTransformSkip[1][ui] = pcCU->getTransformSkip(uiPartOffset+ui,TEXT_CHROMA_U); |
---|
928 | m_puhTransformSkip[2][ui] = pcCU->getTransformSkip(uiPartOffset+ui,TEXT_CHROMA_V); |
---|
929 | m_skipFlag[ui] = pcCU->getSkipFlag(uiPartOffset+ui); |
---|
930 | m_pePartSize[ui] = pcCU->getPartitionSize(uiPartOffset+ui); |
---|
931 | m_pePredMode[ui] = pcCU->getPredictionMode(uiPartOffset+ui); |
---|
932 | m_CUTransquantBypass[ui] = pcCU->getCUTransquantBypass(uiPartOffset+ui); |
---|
933 | m_pbIPCMFlag[ui]=pcCU->m_pbIPCMFlag[uiPartOffset+ui]; |
---|
934 | m_phQP[ui] = pcCU->m_phQP[uiPartOffset+ui]; |
---|
935 | m_pbMergeFlag[ui]=pcCU->m_pbMergeFlag[uiPartOffset+ui]; |
---|
936 | m_puhMergeIndex[ui]=pcCU->m_puhMergeIndex[uiPartOffset+ui]; |
---|
937 | #if H_3D_VSP |
---|
938 | m_piVSPFlag[ui]=pcCU->m_piVSPFlag[uiPartOffset+ui]; |
---|
939 | m_pDvInfo[ ui ] = pcCU->m_pDvInfo[uiPartOffset+ui]; |
---|
940 | #endif |
---|
941 | #if H_3D_SPIVMP |
---|
942 | m_pbSPIVMPFlag[ui]=pcCU->m_pbSPIVMPFlag[uiPartOffset+ui]; |
---|
943 | #endif |
---|
944 | m_puhLumaIntraDir[ui]=pcCU->m_puhLumaIntraDir[uiPartOffset+ui]; |
---|
945 | m_puhChromaIntraDir[ui]=pcCU->m_puhChromaIntraDir[uiPartOffset+ui]; |
---|
946 | m_puhInterDir[ui]=pcCU->m_puhInterDir[uiPartOffset+ui]; |
---|
947 | m_puhCbf[0][ui]=pcCU->m_puhCbf[0][uiPartOffset+ui]; |
---|
948 | m_puhCbf[1][ui]=pcCU->m_puhCbf[1][uiPartOffset+ui]; |
---|
949 | m_puhCbf[2][ui]=pcCU->m_puhCbf[2][uiPartOffset+ui]; |
---|
950 | |
---|
951 | #if H_3D_ARP |
---|
952 | m_puhARPW [ui] = pcCU->getARPW( uiPartOffset+ui ); |
---|
953 | #endif |
---|
954 | #if H_3D_IC |
---|
955 | m_pbICFlag [ui] = pcCU->m_pbICFlag[uiPartOffset+ui]; |
---|
956 | #endif |
---|
957 | |
---|
958 | #if H_3D_DDD |
---|
959 | m_pucDisparityDerivedDepth[ui] = pcCU->m_pucDisparityDerivedDepth[uiPartOffset+ui]; |
---|
960 | m_pbUseDDD[ui] = pcCU->m_pbUseDDD[uiPartOffset+ui]; |
---|
961 | #endif |
---|
962 | |
---|
963 | #if H_3D_DIM |
---|
964 | for( Int i = 0; i < DIM_NUM_TYPE; i++ ) |
---|
965 | { |
---|
966 | m_dimDeltaDC[i][0] [ui] = pcCU->m_dimDeltaDC[i][0] [uiPartOffset+ui]; |
---|
967 | m_dimDeltaDC[i][1] [ui] = pcCU->m_dimDeltaDC[i][1] [uiPartOffset+ui]; |
---|
968 | } |
---|
969 | #if H_3D_DIM_DMM |
---|
970 | for( Int i = 0; i < DMM_NUM_TYPE; i++ ) |
---|
971 | { |
---|
972 | m_dmmWedgeTabIdx[i] [ui] = pcCU->m_dmmWedgeTabIdx[i] [uiPartOffset+ui]; |
---|
973 | } |
---|
974 | #endif |
---|
975 | #if H_3D_DIM_SDC |
---|
976 | m_pbSDCFlag [ui] = pcCU->m_pbSDCFlag [ uiPartOffset + ui ]; |
---|
977 | m_apSegmentDCOffset[0][ui] = pcCU->m_apSegmentDCOffset[0] [ uiPartOffset + ui ]; |
---|
978 | m_apSegmentDCOffset[1][ui] = pcCU->m_apSegmentDCOffset[1] [ uiPartOffset + ui ]; |
---|
979 | #endif |
---|
980 | #endif |
---|
981 | #if H_3D_DBBP |
---|
982 | m_pbDBBPFlag[ui]=pcCU->m_pbDBBPFlag[uiPartOffset+ui]; |
---|
983 | #endif |
---|
984 | } |
---|
985 | } |
---|
986 | UInt uiTmp = uhWidth*uhHeight; |
---|
987 | memset( m_pcTrCoeffY , 0, sizeof(TCoeff)*uiTmp ); |
---|
988 | #if ADAPTIVE_QP_SELECTION |
---|
989 | memset( m_pcArlCoeffY , 0, sizeof(Int)*uiTmp ); |
---|
990 | #endif |
---|
991 | memset( m_pcIPCMSampleY , 0, sizeof( Pel ) * uiTmp ); |
---|
992 | uiTmp >>= 2; |
---|
993 | memset( m_pcTrCoeffCb, 0, sizeof(TCoeff)*uiTmp ); |
---|
994 | memset( m_pcTrCoeffCr, 0, sizeof(TCoeff)*uiTmp ); |
---|
995 | #if ADAPTIVE_QP_SELECTION |
---|
996 | memset( m_pcArlCoeffCb, 0, sizeof(Int)*uiTmp ); |
---|
997 | memset( m_pcArlCoeffCr, 0, sizeof(Int)*uiTmp ); |
---|
998 | #endif |
---|
999 | memset( m_pcIPCMSampleCb , 0, sizeof( Pel ) * uiTmp ); |
---|
1000 | memset( m_pcIPCMSampleCr , 0, sizeof( Pel ) * uiTmp ); |
---|
1001 | m_acCUMvField[0].clearMvField(); |
---|
1002 | m_acCUMvField[1].clearMvField(); |
---|
1003 | |
---|
1004 | if(m_pcPic->getPicSym()->getInverseCUOrderMap(getAddr())*m_pcPic->getNumPartInCU()+m_uiAbsIdxInLCU<getSlice()->getSliceSegmentCurStartCUAddr()) |
---|
1005 | { |
---|
1006 | // Part of this CU contains data from an older slice. Now copy in that data. |
---|
1007 | UInt uiMaxCuWidth=pcCU->getSlice()->getSPS()->getMaxCUWidth(); |
---|
1008 | UInt uiMaxCuHeight=pcCU->getSlice()->getSPS()->getMaxCUHeight(); |
---|
1009 | TComDataCU * bigCU = getPic()->getCU(getAddr()); |
---|
1010 | Int minui = uiPartOffset; |
---|
1011 | minui = -minui; |
---|
1012 | pcCU->m_acCUMvField[0].copyTo(&m_acCUMvField[0],minui,uiPartOffset,m_uiNumPartition); |
---|
1013 | pcCU->m_acCUMvField[1].copyTo(&m_acCUMvField[1],minui,uiPartOffset,m_uiNumPartition); |
---|
1014 | UInt uiCoffOffset = uiMaxCuWidth*uiMaxCuHeight*m_uiAbsIdxInLCU/pcCU->getPic()->getNumPartInCU(); |
---|
1015 | uiTmp = uhWidth*uhHeight; |
---|
1016 | for(Int i=0; i<uiTmp; i++) |
---|
1017 | { |
---|
1018 | m_pcTrCoeffY[i]=bigCU->m_pcTrCoeffY[uiCoffOffset+i]; |
---|
1019 | #if ADAPTIVE_QP_SELECTION |
---|
1020 | m_pcArlCoeffY[i]=bigCU->m_pcArlCoeffY[uiCoffOffset+i]; |
---|
1021 | #endif |
---|
1022 | m_pcIPCMSampleY[i]=bigCU->m_pcIPCMSampleY[uiCoffOffset+i]; |
---|
1023 | } |
---|
1024 | uiTmp>>=2; |
---|
1025 | uiCoffOffset>>=2; |
---|
1026 | for(Int i=0; i<uiTmp; i++) |
---|
1027 | { |
---|
1028 | m_pcTrCoeffCr[i]=bigCU->m_pcTrCoeffCr[uiCoffOffset+i]; |
---|
1029 | m_pcTrCoeffCb[i]=bigCU->m_pcTrCoeffCb[uiCoffOffset+i]; |
---|
1030 | #if ADAPTIVE_QP_SELECTION |
---|
1031 | m_pcArlCoeffCr[i]=bigCU->m_pcArlCoeffCr[uiCoffOffset+i]; |
---|
1032 | m_pcArlCoeffCb[i]=bigCU->m_pcArlCoeffCb[uiCoffOffset+i]; |
---|
1033 | #endif |
---|
1034 | m_pcIPCMSampleCb[i]=bigCU->m_pcIPCMSampleCb[uiCoffOffset+i]; |
---|
1035 | m_pcIPCMSampleCr[i]=bigCU->m_pcIPCMSampleCr[uiCoffOffset+i]; |
---|
1036 | } |
---|
1037 | } |
---|
1038 | |
---|
1039 | m_pcCULeft = pcCU->getCULeft(); |
---|
1040 | m_pcCUAbove = pcCU->getCUAbove(); |
---|
1041 | m_pcCUAboveLeft = pcCU->getCUAboveLeft(); |
---|
1042 | m_pcCUAboveRight = pcCU->getCUAboveRight(); |
---|
1043 | |
---|
1044 | m_apcCUColocated[0] = pcCU->getCUColocated(REF_PIC_LIST_0); |
---|
1045 | m_apcCUColocated[1] = pcCU->getCUColocated(REF_PIC_LIST_1); |
---|
1046 | memcpy(m_sliceStartCU,pcCU->m_sliceStartCU+uiPartOffset,sizeof(UInt)*m_uiNumPartition); |
---|
1047 | memcpy(m_sliceSegmentStartCU,pcCU->m_sliceSegmentStartCU+uiPartOffset,sizeof(UInt)*m_uiNumPartition); |
---|
1048 | } |
---|
1049 | |
---|
1050 | Void TComDataCU::setOutsideCUPart( UInt uiAbsPartIdx, UInt uiDepth ) |
---|
1051 | { |
---|
1052 | UInt uiNumPartition = m_uiNumPartition >> (uiDepth << 1); |
---|
1053 | UInt uiSizeInUchar = sizeof( UChar ) * uiNumPartition; |
---|
1054 | |
---|
1055 | UChar uhWidth = g_uiMaxCUWidth >> uiDepth; |
---|
1056 | UChar uhHeight = g_uiMaxCUHeight >> uiDepth; |
---|
1057 | memset( m_puhDepth + uiAbsPartIdx, uiDepth, uiSizeInUchar ); |
---|
1058 | memset( m_puhWidth + uiAbsPartIdx, uhWidth, uiSizeInUchar ); |
---|
1059 | memset( m_puhHeight + uiAbsPartIdx, uhHeight, uiSizeInUchar ); |
---|
1060 | } |
---|
1061 | |
---|
1062 | // -------------------------------------------------------------------------------------------------------------------- |
---|
1063 | // Copy |
---|
1064 | // -------------------------------------------------------------------------------------------------------------------- |
---|
1065 | |
---|
1066 | Void TComDataCU::copySubCU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
1067 | { |
---|
1068 | UInt uiPart = uiAbsPartIdx; |
---|
1069 | |
---|
1070 | m_pcPic = pcCU->getPic(); |
---|
1071 | m_pcSlice = pcCU->getSlice(); |
---|
1072 | m_uiCUAddr = pcCU->getAddr(); |
---|
1073 | m_uiAbsIdxInLCU = uiAbsPartIdx; |
---|
1074 | |
---|
1075 | m_uiCUPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ]; |
---|
1076 | m_uiCUPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ]; |
---|
1077 | |
---|
1078 | m_skipFlag=pcCU->getSkipFlag() + uiPart; |
---|
1079 | |
---|
1080 | m_phQP=pcCU->getQP() + uiPart; |
---|
1081 | m_pePartSize = pcCU->getPartitionSize() + uiPart; |
---|
1082 | m_pePredMode=pcCU->getPredictionMode() + uiPart; |
---|
1083 | m_CUTransquantBypass = pcCU->getCUTransquantBypass()+uiPart; |
---|
1084 | |
---|
1085 | #if H_3D_NBDV |
---|
1086 | m_pDvInfo = pcCU->getDvInfo() + uiPart; |
---|
1087 | #endif |
---|
1088 | m_pbMergeFlag = pcCU->getMergeFlag() + uiPart; |
---|
1089 | m_puhMergeIndex = pcCU->getMergeIndex() + uiPart; |
---|
1090 | #if H_3D_VSP |
---|
1091 | m_piVSPFlag = pcCU->getVSPFlag() + uiPart; |
---|
1092 | #endif |
---|
1093 | #if H_3D_SPIVMP |
---|
1094 | m_pbSPIVMPFlag = pcCU->getSPIVMPFlag() + uiPart; |
---|
1095 | #endif |
---|
1096 | |
---|
1097 | #if H_3D_ARP |
---|
1098 | m_puhARPW = pcCU->getARPW() + uiPart; |
---|
1099 | #endif |
---|
1100 | #if H_3D_IC |
---|
1101 | m_pbICFlag = pcCU->getICFlag() + uiPart; |
---|
1102 | #endif |
---|
1103 | |
---|
1104 | #if H_3D_DDD |
---|
1105 | m_pucDisparityDerivedDepth = pcCU->getDDDepth() + uiPart; |
---|
1106 | m_pbUseDDD = pcCU->getUseDDD() + uiPart; |
---|
1107 | #endif |
---|
1108 | |
---|
1109 | m_puhLumaIntraDir = pcCU->getLumaIntraDir() + uiPart; |
---|
1110 | m_puhChromaIntraDir = pcCU->getChromaIntraDir() + uiPart; |
---|
1111 | m_puhInterDir = pcCU->getInterDir() + uiPart; |
---|
1112 | m_puhTrIdx = pcCU->getTransformIdx() + uiPart; |
---|
1113 | m_puhTransformSkip[0] = pcCU->getTransformSkip(TEXT_LUMA) + uiPart; |
---|
1114 | m_puhTransformSkip[1] = pcCU->getTransformSkip(TEXT_CHROMA_U) + uiPart; |
---|
1115 | m_puhTransformSkip[2] = pcCU->getTransformSkip(TEXT_CHROMA_V) + uiPart; |
---|
1116 | |
---|
1117 | m_puhCbf[0]= pcCU->getCbf(TEXT_LUMA) + uiPart; |
---|
1118 | m_puhCbf[1]= pcCU->getCbf(TEXT_CHROMA_U) + uiPart; |
---|
1119 | m_puhCbf[2]= pcCU->getCbf(TEXT_CHROMA_V) + uiPart; |
---|
1120 | #if H_3D_DIM |
---|
1121 | for( Int i = 0; i < DIM_NUM_TYPE; i++ ) |
---|
1122 | { |
---|
1123 | m_dimDeltaDC[i][0] = pcCU->getDimDeltaDC( i, 0 ) + uiPart; |
---|
1124 | m_dimDeltaDC[i][1] = pcCU->getDimDeltaDC( i, 1 ) + uiPart; |
---|
1125 | } |
---|
1126 | #if H_3D_DIM_DMM |
---|
1127 | for( Int i = 0; i < DMM_NUM_TYPE; i++ ) |
---|
1128 | { |
---|
1129 | m_dmmWedgeTabIdx[i] = pcCU->getDmmWedgeTabIdx( i ) + uiPart; |
---|
1130 | } |
---|
1131 | #endif |
---|
1132 | #if H_3D_DIM_SDC |
---|
1133 | m_pbSDCFlag = pcCU->getSDCFlag() + uiPart; |
---|
1134 | m_apSegmentDCOffset[0] = pcCU->getSDCSegmentDCOffset(0) + uiPart; |
---|
1135 | m_apSegmentDCOffset[1] = pcCU->getSDCSegmentDCOffset(1) + uiPart; |
---|
1136 | #endif |
---|
1137 | #endif |
---|
1138 | #if H_3D_DBBP |
---|
1139 | m_pbDBBPFlag = pcCU->getDBBPFlag() + uiPart; |
---|
1140 | #endif |
---|
1141 | m_puhDepth=pcCU->getDepth() + uiPart; |
---|
1142 | m_puhWidth=pcCU->getWidth() + uiPart; |
---|
1143 | m_puhHeight=pcCU->getHeight() + uiPart; |
---|
1144 | |
---|
1145 | m_apiMVPIdx[0]=pcCU->getMVPIdx(REF_PIC_LIST_0) + uiPart; |
---|
1146 | m_apiMVPIdx[1]=pcCU->getMVPIdx(REF_PIC_LIST_1) + uiPart; |
---|
1147 | m_apiMVPNum[0]=pcCU->getMVPNum(REF_PIC_LIST_0) + uiPart; |
---|
1148 | m_apiMVPNum[1]=pcCU->getMVPNum(REF_PIC_LIST_1) + uiPart; |
---|
1149 | |
---|
1150 | m_pbIPCMFlag = pcCU->getIPCMFlag() + uiPart; |
---|
1151 | |
---|
1152 | m_pcCUAboveLeft = pcCU->getCUAboveLeft(); |
---|
1153 | m_pcCUAboveRight = pcCU->getCUAboveRight(); |
---|
1154 | m_pcCUAbove = pcCU->getCUAbove(); |
---|
1155 | m_pcCULeft = pcCU->getCULeft(); |
---|
1156 | |
---|
1157 | m_apcCUColocated[0] = pcCU->getCUColocated(REF_PIC_LIST_0); |
---|
1158 | m_apcCUColocated[1] = pcCU->getCUColocated(REF_PIC_LIST_1); |
---|
1159 | |
---|
1160 | UInt uiMaxCuWidth=pcCU->getSlice()->getSPS()->getMaxCUWidth(); |
---|
1161 | UInt uiMaxCuHeight=pcCU->getSlice()->getSPS()->getMaxCUHeight(); |
---|
1162 | |
---|
1163 | UInt uiCoffOffset = uiMaxCuWidth*uiMaxCuHeight*uiAbsPartIdx/pcCU->getPic()->getNumPartInCU(); |
---|
1164 | |
---|
1165 | m_pcTrCoeffY = pcCU->getCoeffY() + uiCoffOffset; |
---|
1166 | #if ADAPTIVE_QP_SELECTION |
---|
1167 | m_pcArlCoeffY= pcCU->getArlCoeffY() + uiCoffOffset; |
---|
1168 | #endif |
---|
1169 | m_pcIPCMSampleY = pcCU->getPCMSampleY() + uiCoffOffset; |
---|
1170 | |
---|
1171 | uiCoffOffset >>=2; |
---|
1172 | m_pcTrCoeffCb=pcCU->getCoeffCb() + uiCoffOffset; |
---|
1173 | m_pcTrCoeffCr=pcCU->getCoeffCr() + uiCoffOffset; |
---|
1174 | #if ADAPTIVE_QP_SELECTION |
---|
1175 | m_pcArlCoeffCb=pcCU->getArlCoeffCb() + uiCoffOffset; |
---|
1176 | m_pcArlCoeffCr=pcCU->getArlCoeffCr() + uiCoffOffset; |
---|
1177 | #endif |
---|
1178 | m_pcIPCMSampleCb = pcCU->getPCMSampleCb() + uiCoffOffset; |
---|
1179 | m_pcIPCMSampleCr = pcCU->getPCMSampleCr() + uiCoffOffset; |
---|
1180 | |
---|
1181 | m_acCUMvField[0].linkToWithOffset( pcCU->getCUMvField(REF_PIC_LIST_0), uiPart ); |
---|
1182 | m_acCUMvField[1].linkToWithOffset( pcCU->getCUMvField(REF_PIC_LIST_1), uiPart ); |
---|
1183 | memcpy(m_sliceStartCU,pcCU->m_sliceStartCU+uiPart,sizeof(UInt)*m_uiNumPartition); |
---|
1184 | memcpy(m_sliceSegmentStartCU,pcCU->m_sliceSegmentStartCU+uiPart,sizeof(UInt)*m_uiNumPartition); |
---|
1185 | } |
---|
1186 | #if H_3D_NBDV |
---|
1187 | Void TComDataCU::copyDVInfoFrom (TComDataCU* pcCU, UInt uiAbsPartIdx) |
---|
1188 | { |
---|
1189 | m_pDvInfo = pcCU->getDvInfo() + uiAbsPartIdx; |
---|
1190 | } |
---|
1191 | #endif |
---|
1192 | // Copy inter prediction info from the biggest CU |
---|
1193 | Void TComDataCU::copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList |
---|
1194 | #if H_3D_NBDV |
---|
1195 | , Bool bNBDV |
---|
1196 | #endif |
---|
1197 | ) |
---|
1198 | { |
---|
1199 | m_pcPic = pcCU->getPic(); |
---|
1200 | m_pcSlice = pcCU->getSlice(); |
---|
1201 | m_uiCUAddr = pcCU->getAddr(); |
---|
1202 | m_uiAbsIdxInLCU = uiAbsPartIdx; |
---|
1203 | |
---|
1204 | Int iRastPartIdx = g_auiZscanToRaster[uiAbsPartIdx]; |
---|
1205 | m_uiCUPelX = pcCU->getCUPelX() + m_pcPic->getMinCUWidth ()*( iRastPartIdx % m_pcPic->getNumPartInWidth() ); |
---|
1206 | m_uiCUPelY = pcCU->getCUPelY() + m_pcPic->getMinCUHeight()*( iRastPartIdx / m_pcPic->getNumPartInWidth() ); |
---|
1207 | |
---|
1208 | m_pcCUAboveLeft = pcCU->getCUAboveLeft(); |
---|
1209 | m_pcCUAboveRight = pcCU->getCUAboveRight(); |
---|
1210 | m_pcCUAbove = pcCU->getCUAbove(); |
---|
1211 | m_pcCULeft = pcCU->getCULeft(); |
---|
1212 | |
---|
1213 | m_apcCUColocated[0] = pcCU->getCUColocated(REF_PIC_LIST_0); |
---|
1214 | m_apcCUColocated[1] = pcCU->getCUColocated(REF_PIC_LIST_1); |
---|
1215 | |
---|
1216 | m_skipFlag = pcCU->getSkipFlag () + uiAbsPartIdx; |
---|
1217 | |
---|
1218 | m_pePartSize = pcCU->getPartitionSize () + uiAbsPartIdx; |
---|
1219 | #if H_3D_NBDV |
---|
1220 | if(bNBDV == true) |
---|
1221 | { |
---|
1222 | m_puhWidth = pcCU->getWidth () + uiAbsPartIdx; |
---|
1223 | m_puhHeight = pcCU->getHeight() + uiAbsPartIdx; |
---|
1224 | m_puhDepth = pcCU->getDepth () + uiAbsPartIdx; |
---|
1225 | } |
---|
1226 | else |
---|
1227 | { |
---|
1228 | #endif |
---|
1229 | m_pePredMode = pcCU->getPredictionMode() + uiAbsPartIdx; |
---|
1230 | m_CUTransquantBypass = pcCU->getCUTransquantBypass() + uiAbsPartIdx; |
---|
1231 | m_puhInterDir = pcCU->getInterDir () + uiAbsPartIdx; |
---|
1232 | |
---|
1233 | m_puhDepth = pcCU->getDepth () + uiAbsPartIdx; |
---|
1234 | m_puhWidth = pcCU->getWidth () + uiAbsPartIdx; |
---|
1235 | m_puhHeight = pcCU->getHeight() + uiAbsPartIdx; |
---|
1236 | |
---|
1237 | m_pbMergeFlag = pcCU->getMergeFlag() + uiAbsPartIdx; |
---|
1238 | m_puhMergeIndex = pcCU->getMergeIndex() + uiAbsPartIdx; |
---|
1239 | #if H_3D_VSP |
---|
1240 | m_piVSPFlag = pcCU->getVSPFlag() + uiAbsPartIdx; |
---|
1241 | m_pDvInfo = pcCU->getDvInfo() + uiAbsPartIdx; |
---|
1242 | #endif |
---|
1243 | #if H_3D_SPIVMP |
---|
1244 | m_pbSPIVMPFlag = pcCU->getSPIVMPFlag() + uiAbsPartIdx; |
---|
1245 | #endif |
---|
1246 | |
---|
1247 | m_apiMVPIdx[eRefPicList] = pcCU->getMVPIdx(eRefPicList) + uiAbsPartIdx; |
---|
1248 | m_apiMVPNum[eRefPicList] = pcCU->getMVPNum(eRefPicList) + uiAbsPartIdx; |
---|
1249 | |
---|
1250 | #if H_3D_ARP |
---|
1251 | m_puhARPW = pcCU->getARPW() + uiAbsPartIdx; |
---|
1252 | #endif |
---|
1253 | |
---|
1254 | #if H_3D_DDD |
---|
1255 | m_pucDisparityDerivedDepth = pcCU->getDDDepth() + uiAbsPartIdx; |
---|
1256 | m_pbUseDDD = pcCU->getUseDDD() + uiAbsPartIdx; |
---|
1257 | #endif |
---|
1258 | |
---|
1259 | #if H_3D_DBBP |
---|
1260 | m_pbDBBPFlag = pcCU->getDBBPFlag() + uiAbsPartIdx; |
---|
1261 | #endif |
---|
1262 | |
---|
1263 | m_acCUMvField[ eRefPicList ].linkToWithOffset( pcCU->getCUMvField(eRefPicList), uiAbsPartIdx ); |
---|
1264 | |
---|
1265 | memcpy(m_sliceStartCU,pcCU->m_sliceStartCU+uiAbsPartIdx,sizeof(UInt)*m_uiNumPartition); |
---|
1266 | memcpy(m_sliceSegmentStartCU,pcCU->m_sliceSegmentStartCU+uiAbsPartIdx,sizeof(UInt)*m_uiNumPartition); |
---|
1267 | #if H_3D_NBDV |
---|
1268 | } |
---|
1269 | #endif |
---|
1270 | #if H_3D_IC |
---|
1271 | m_pbICFlag = pcCU->getICFlag() + uiAbsPartIdx; |
---|
1272 | #endif |
---|
1273 | } |
---|
1274 | |
---|
1275 | // Copy small CU to bigger CU. |
---|
1276 | // One of quarter parts overwritten by predicted sub part. |
---|
1277 | Void TComDataCU::copyPartFrom( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth ) |
---|
1278 | { |
---|
1279 | assert( uiPartUnitIdx<4 ); |
---|
1280 | |
---|
1281 | m_dTotalCost += pcCU->getTotalCost(); |
---|
1282 | m_uiTotalDistortion += pcCU->getTotalDistortion(); |
---|
1283 | m_uiTotalBits += pcCU->getTotalBits(); |
---|
1284 | |
---|
1285 | UInt uiOffset = pcCU->getTotalNumPart()*uiPartUnitIdx; |
---|
1286 | |
---|
1287 | UInt uiNumPartition = pcCU->getTotalNumPart(); |
---|
1288 | Int iSizeInUchar = sizeof( UChar ) * uiNumPartition; |
---|
1289 | Int iSizeInBool = sizeof( Bool ) * uiNumPartition; |
---|
1290 | |
---|
1291 | Int sizeInChar = sizeof( Char ) * uiNumPartition; |
---|
1292 | memcpy( m_skipFlag + uiOffset, pcCU->getSkipFlag(), sizeof( *m_skipFlag ) * uiNumPartition ); |
---|
1293 | memcpy( m_phQP + uiOffset, pcCU->getQP(), sizeInChar ); |
---|
1294 | memcpy( m_pePartSize + uiOffset, pcCU->getPartitionSize(), sizeof( *m_pePartSize ) * uiNumPartition ); |
---|
1295 | memcpy( m_pePredMode + uiOffset, pcCU->getPredictionMode(), sizeof( *m_pePredMode ) * uiNumPartition ); |
---|
1296 | memcpy( m_CUTransquantBypass + uiOffset, pcCU->getCUTransquantBypass(), sizeof( *m_CUTransquantBypass ) * uiNumPartition ); |
---|
1297 | memcpy( m_pbMergeFlag + uiOffset, pcCU->getMergeFlag(), iSizeInBool ); |
---|
1298 | memcpy( m_puhMergeIndex + uiOffset, pcCU->getMergeIndex(), iSizeInUchar ); |
---|
1299 | #if H_3D_VSP |
---|
1300 | memcpy( m_piVSPFlag + uiOffset, pcCU->getVSPFlag(), sizeof( Char ) * uiNumPartition ); |
---|
1301 | memcpy( m_pDvInfo + uiOffset, pcCU->getDvInfo(), sizeof( *m_pDvInfo ) * uiNumPartition ); |
---|
1302 | |
---|
1303 | #endif |
---|
1304 | #if H_3D_SPIVMP |
---|
1305 | memcpy( m_pbSPIVMPFlag + uiOffset, pcCU->getSPIVMPFlag(), sizeof( Bool ) * uiNumPartition ); |
---|
1306 | #endif |
---|
1307 | memcpy( m_puhLumaIntraDir + uiOffset, pcCU->getLumaIntraDir(), iSizeInUchar ); |
---|
1308 | memcpy( m_puhChromaIntraDir + uiOffset, pcCU->getChromaIntraDir(), iSizeInUchar ); |
---|
1309 | memcpy( m_puhInterDir + uiOffset, pcCU->getInterDir(), iSizeInUchar ); |
---|
1310 | memcpy( m_puhTrIdx + uiOffset, pcCU->getTransformIdx(), iSizeInUchar ); |
---|
1311 | memcpy( m_puhTransformSkip[0] + uiOffset, pcCU->getTransformSkip(TEXT_LUMA), iSizeInUchar ); |
---|
1312 | memcpy( m_puhTransformSkip[1] + uiOffset, pcCU->getTransformSkip(TEXT_CHROMA_U), iSizeInUchar ); |
---|
1313 | memcpy( m_puhTransformSkip[2] + uiOffset, pcCU->getTransformSkip(TEXT_CHROMA_V), iSizeInUchar ); |
---|
1314 | |
---|
1315 | memcpy( m_puhCbf[0] + uiOffset, pcCU->getCbf(TEXT_LUMA) , iSizeInUchar ); |
---|
1316 | memcpy( m_puhCbf[1] + uiOffset, pcCU->getCbf(TEXT_CHROMA_U), iSizeInUchar ); |
---|
1317 | memcpy( m_puhCbf[2] + uiOffset, pcCU->getCbf(TEXT_CHROMA_V), iSizeInUchar ); |
---|
1318 | |
---|
1319 | #if H_3D_DDD |
---|
1320 | memcpy( m_pucDisparityDerivedDepth + uiOffset, pcCU->getDDDepth(), iSizeInUchar ); |
---|
1321 | memcpy( m_pbUseDDD + uiOffset, pcCU->getUseDDD(), iSizeInBool ); |
---|
1322 | #endif |
---|
1323 | |
---|
1324 | |
---|
1325 | #if H_3D_DIM |
---|
1326 | for( Int i = 0; i < DIM_NUM_TYPE; i++ ) |
---|
1327 | { |
---|
1328 | memcpy( m_dimDeltaDC[i][0] + uiOffset, pcCU->getDimDeltaDC( i, 0 ), sizeof(Pel ) * uiNumPartition ); |
---|
1329 | memcpy( m_dimDeltaDC[i][1] + uiOffset, pcCU->getDimDeltaDC( i, 1 ), sizeof(Pel ) * uiNumPartition ); |
---|
1330 | } |
---|
1331 | #if H_3D_DIM_DMM |
---|
1332 | for( Int i = 0; i < DMM_NUM_TYPE; i++ ) |
---|
1333 | { |
---|
1334 | memcpy( m_dmmWedgeTabIdx[i] + uiOffset, pcCU->getDmmWedgeTabIdx( i ), sizeof(UInt) * uiNumPartition ); |
---|
1335 | } |
---|
1336 | #endif |
---|
1337 | #if H_3D_DIM_SDC |
---|
1338 | memcpy( m_pbSDCFlag + uiOffset, pcCU->getSDCFlag(), iSizeInBool ); |
---|
1339 | memcpy( m_apSegmentDCOffset[0] + uiOffset, pcCU->getSDCSegmentDCOffset(0), sizeof( Pel ) * uiNumPartition); |
---|
1340 | memcpy( m_apSegmentDCOffset[1] + uiOffset, pcCU->getSDCSegmentDCOffset(1), sizeof( Pel ) * uiNumPartition); |
---|
1341 | #endif |
---|
1342 | #endif |
---|
1343 | #if H_3D_DBBP |
---|
1344 | memcpy( m_pbDBBPFlag + uiOffset, pcCU->getDBBPFlag(), iSizeInBool ); |
---|
1345 | #endif |
---|
1346 | |
---|
1347 | memcpy( m_puhDepth + uiOffset, pcCU->getDepth(), iSizeInUchar ); |
---|
1348 | memcpy( m_puhWidth + uiOffset, pcCU->getWidth(), iSizeInUchar ); |
---|
1349 | memcpy( m_puhHeight + uiOffset, pcCU->getHeight(), iSizeInUchar ); |
---|
1350 | |
---|
1351 | memcpy( m_apiMVPIdx[0] + uiOffset, pcCU->getMVPIdx(REF_PIC_LIST_0), iSizeInUchar ); |
---|
1352 | memcpy( m_apiMVPIdx[1] + uiOffset, pcCU->getMVPIdx(REF_PIC_LIST_1), iSizeInUchar ); |
---|
1353 | memcpy( m_apiMVPNum[0] + uiOffset, pcCU->getMVPNum(REF_PIC_LIST_0), iSizeInUchar ); |
---|
1354 | memcpy( m_apiMVPNum[1] + uiOffset, pcCU->getMVPNum(REF_PIC_LIST_1), iSizeInUchar ); |
---|
1355 | |
---|
1356 | memcpy( m_pbIPCMFlag + uiOffset, pcCU->getIPCMFlag(), iSizeInBool ); |
---|
1357 | |
---|
1358 | m_pcCUAboveLeft = pcCU->getCUAboveLeft(); |
---|
1359 | m_pcCUAboveRight = pcCU->getCUAboveRight(); |
---|
1360 | m_pcCUAbove = pcCU->getCUAbove(); |
---|
1361 | m_pcCULeft = pcCU->getCULeft(); |
---|
1362 | |
---|
1363 | m_apcCUColocated[0] = pcCU->getCUColocated(REF_PIC_LIST_0); |
---|
1364 | m_apcCUColocated[1] = pcCU->getCUColocated(REF_PIC_LIST_1); |
---|
1365 | |
---|
1366 | m_acCUMvField[0].copyFrom( pcCU->getCUMvField( REF_PIC_LIST_0 ), pcCU->getTotalNumPart(), uiOffset ); |
---|
1367 | m_acCUMvField[1].copyFrom( pcCU->getCUMvField( REF_PIC_LIST_1 ), pcCU->getTotalNumPart(), uiOffset ); |
---|
1368 | |
---|
1369 | UInt uiTmp = g_uiMaxCUWidth*g_uiMaxCUHeight >> (uiDepth<<1); |
---|
1370 | UInt uiTmp2 = uiPartUnitIdx*uiTmp; |
---|
1371 | memcpy( m_pcTrCoeffY + uiTmp2, pcCU->getCoeffY(), sizeof(TCoeff)*uiTmp ); |
---|
1372 | #if ADAPTIVE_QP_SELECTION |
---|
1373 | memcpy( m_pcArlCoeffY + uiTmp2, pcCU->getArlCoeffY(), sizeof(Int)*uiTmp ); |
---|
1374 | #endif |
---|
1375 | memcpy( m_pcIPCMSampleY + uiTmp2 , pcCU->getPCMSampleY(), sizeof(Pel) * uiTmp ); |
---|
1376 | |
---|
1377 | uiTmp >>= 2; uiTmp2>>= 2; |
---|
1378 | memcpy( m_pcTrCoeffCb + uiTmp2, pcCU->getCoeffCb(), sizeof(TCoeff)*uiTmp ); |
---|
1379 | memcpy( m_pcTrCoeffCr + uiTmp2, pcCU->getCoeffCr(), sizeof(TCoeff)*uiTmp ); |
---|
1380 | #if ADAPTIVE_QP_SELECTION |
---|
1381 | memcpy( m_pcArlCoeffCb + uiTmp2, pcCU->getArlCoeffCb(), sizeof(Int)*uiTmp ); |
---|
1382 | memcpy( m_pcArlCoeffCr + uiTmp2, pcCU->getArlCoeffCr(), sizeof(Int)*uiTmp ); |
---|
1383 | #endif |
---|
1384 | memcpy( m_pcIPCMSampleCb + uiTmp2 , pcCU->getPCMSampleCb(), sizeof(Pel) * uiTmp ); |
---|
1385 | memcpy( m_pcIPCMSampleCr + uiTmp2 , pcCU->getPCMSampleCr(), sizeof(Pel) * uiTmp ); |
---|
1386 | m_uiTotalBins += pcCU->getTotalBins(); |
---|
1387 | memcpy( m_sliceStartCU + uiOffset, pcCU->m_sliceStartCU, sizeof( UInt ) * uiNumPartition ); |
---|
1388 | memcpy( m_sliceSegmentStartCU + uiOffset, pcCU->m_sliceSegmentStartCU, sizeof( UInt ) * uiNumPartition ); |
---|
1389 | #if H_3D_ARP |
---|
1390 | memcpy( m_puhARPW + uiOffset, pcCU->getARPW(), iSizeInUchar ); |
---|
1391 | #endif |
---|
1392 | #if H_3D_IC |
---|
1393 | memcpy( m_pbICFlag + uiOffset, pcCU->getICFlag(), iSizeInBool ); |
---|
1394 | #endif |
---|
1395 | } |
---|
1396 | |
---|
1397 | // Copy current predicted part to a CU in picture. |
---|
1398 | // It is used to predict for next part |
---|
1399 | Void TComDataCU::copyToPic( UChar uhDepth ) |
---|
1400 | { |
---|
1401 | TComDataCU*& rpcCU = m_pcPic->getCU( m_uiCUAddr ); |
---|
1402 | |
---|
1403 | rpcCU->getTotalCost() = m_dTotalCost; |
---|
1404 | rpcCU->getTotalDistortion() = m_uiTotalDistortion; |
---|
1405 | rpcCU->getTotalBits() = m_uiTotalBits; |
---|
1406 | |
---|
1407 | Int iSizeInUchar = sizeof( UChar ) * m_uiNumPartition; |
---|
1408 | Int iSizeInBool = sizeof( Bool ) * m_uiNumPartition; |
---|
1409 | |
---|
1410 | Int sizeInChar = sizeof( Char ) * m_uiNumPartition; |
---|
1411 | |
---|
1412 | memcpy( rpcCU->getSkipFlag() + m_uiAbsIdxInLCU, m_skipFlag, sizeof( *m_skipFlag ) * m_uiNumPartition ); |
---|
1413 | |
---|
1414 | memcpy( rpcCU->getQP() + m_uiAbsIdxInLCU, m_phQP, sizeInChar ); |
---|
1415 | #if H_3D_NBDV |
---|
1416 | memcpy( rpcCU->getDvInfo() + m_uiAbsIdxInLCU, m_pDvInfo, sizeof(* m_pDvInfo) * m_uiNumPartition ); |
---|
1417 | #endif |
---|
1418 | |
---|
1419 | #if H_3D_DDD |
---|
1420 | memcpy( rpcCU->getDDDepth() + m_uiAbsIdxInLCU, m_pucDisparityDerivedDepth, iSizeInUchar ); |
---|
1421 | memcpy( rpcCU->getUseDDD() + m_uiAbsIdxInLCU, m_pbUseDDD, iSizeInBool ); |
---|
1422 | #endif |
---|
1423 | |
---|
1424 | memcpy( rpcCU->getPartitionSize() + m_uiAbsIdxInLCU, m_pePartSize, sizeof( *m_pePartSize ) * m_uiNumPartition ); |
---|
1425 | memcpy( rpcCU->getPredictionMode() + m_uiAbsIdxInLCU, m_pePredMode, sizeof( *m_pePredMode ) * m_uiNumPartition ); |
---|
1426 | memcpy( rpcCU->getCUTransquantBypass()+ m_uiAbsIdxInLCU, m_CUTransquantBypass, sizeof( *m_CUTransquantBypass ) * m_uiNumPartition ); |
---|
1427 | memcpy( rpcCU->getMergeFlag() + m_uiAbsIdxInLCU, m_pbMergeFlag, iSizeInBool ); |
---|
1428 | memcpy( rpcCU->getMergeIndex() + m_uiAbsIdxInLCU, m_puhMergeIndex, iSizeInUchar ); |
---|
1429 | #if H_3D_VSP |
---|
1430 | memcpy( rpcCU->getVSPFlag() + m_uiAbsIdxInLCU, m_piVSPFlag, sizeof( Char ) * m_uiNumPartition ); |
---|
1431 | memcpy( rpcCU->getDvInfo() + m_uiAbsIdxInLCU, m_pDvInfo, sizeof( *m_pDvInfo ) * m_uiNumPartition ); |
---|
1432 | #endif |
---|
1433 | #if H_3D_SPIVMP |
---|
1434 | memcpy( rpcCU->getSPIVMPFlag() + m_uiAbsIdxInLCU, m_pbSPIVMPFlag, sizeof( Bool ) * m_uiNumPartition ); |
---|
1435 | #endif |
---|
1436 | memcpy( rpcCU->getLumaIntraDir() + m_uiAbsIdxInLCU, m_puhLumaIntraDir, iSizeInUchar ); |
---|
1437 | memcpy( rpcCU->getChromaIntraDir() + m_uiAbsIdxInLCU, m_puhChromaIntraDir, iSizeInUchar ); |
---|
1438 | memcpy( rpcCU->getInterDir() + m_uiAbsIdxInLCU, m_puhInterDir, iSizeInUchar ); |
---|
1439 | memcpy( rpcCU->getTransformIdx() + m_uiAbsIdxInLCU, m_puhTrIdx, iSizeInUchar ); |
---|
1440 | memcpy( rpcCU->getTransformSkip(TEXT_LUMA) + m_uiAbsIdxInLCU, m_puhTransformSkip[0], iSizeInUchar ); |
---|
1441 | memcpy( rpcCU->getTransformSkip(TEXT_CHROMA_U) + m_uiAbsIdxInLCU, m_puhTransformSkip[1], iSizeInUchar ); |
---|
1442 | memcpy( rpcCU->getTransformSkip(TEXT_CHROMA_V) + m_uiAbsIdxInLCU, m_puhTransformSkip[2], iSizeInUchar ); |
---|
1443 | |
---|
1444 | memcpy( rpcCU->getCbf(TEXT_LUMA) + m_uiAbsIdxInLCU, m_puhCbf[0], iSizeInUchar ); |
---|
1445 | memcpy( rpcCU->getCbf(TEXT_CHROMA_U) + m_uiAbsIdxInLCU, m_puhCbf[1], iSizeInUchar ); |
---|
1446 | memcpy( rpcCU->getCbf(TEXT_CHROMA_V) + m_uiAbsIdxInLCU, m_puhCbf[2], iSizeInUchar ); |
---|
1447 | |
---|
1448 | #if H_3D_DIM |
---|
1449 | for( Int i = 0; i < DIM_NUM_TYPE; i++ ) |
---|
1450 | { |
---|
1451 | memcpy( rpcCU->getDimDeltaDC( i, 0 ) + m_uiAbsIdxInLCU, m_dimDeltaDC[i][0], sizeof(Pel ) * m_uiNumPartition ); |
---|
1452 | memcpy( rpcCU->getDimDeltaDC( i, 1 ) + m_uiAbsIdxInLCU, m_dimDeltaDC[i][1], sizeof(Pel ) * m_uiNumPartition ); |
---|
1453 | } |
---|
1454 | #if H_3D_DIM_DMM |
---|
1455 | for( Int i = 0; i < DMM_NUM_TYPE; i++ ) |
---|
1456 | { |
---|
1457 | memcpy( rpcCU->getDmmWedgeTabIdx( i ) + m_uiAbsIdxInLCU, m_dmmWedgeTabIdx[i], sizeof(UInt) * m_uiNumPartition ); |
---|
1458 | } |
---|
1459 | #endif |
---|
1460 | #if H_3D_DIM_SDC |
---|
1461 | memcpy( rpcCU->getSDCFlag() + m_uiAbsIdxInLCU, m_pbSDCFlag, iSizeInBool ); |
---|
1462 | memcpy( rpcCU->getSDCSegmentDCOffset(0) + m_uiAbsIdxInLCU, m_apSegmentDCOffset[0], sizeof( Pel ) * m_uiNumPartition); |
---|
1463 | memcpy( rpcCU->getSDCSegmentDCOffset(1) + m_uiAbsIdxInLCU, m_apSegmentDCOffset[1], sizeof( Pel ) * m_uiNumPartition); |
---|
1464 | #endif |
---|
1465 | #endif |
---|
1466 | #if H_3D_DBBP |
---|
1467 | memcpy( rpcCU->getDBBPFlag() + m_uiAbsIdxInLCU, m_pbDBBPFlag, iSizeInBool ); |
---|
1468 | #endif |
---|
1469 | |
---|
1470 | memcpy( rpcCU->getDepth() + m_uiAbsIdxInLCU, m_puhDepth, iSizeInUchar ); |
---|
1471 | memcpy( rpcCU->getWidth() + m_uiAbsIdxInLCU, m_puhWidth, iSizeInUchar ); |
---|
1472 | memcpy( rpcCU->getHeight() + m_uiAbsIdxInLCU, m_puhHeight, iSizeInUchar ); |
---|
1473 | |
---|
1474 | memcpy( rpcCU->getMVPIdx(REF_PIC_LIST_0) + m_uiAbsIdxInLCU, m_apiMVPIdx[0], iSizeInUchar ); |
---|
1475 | memcpy( rpcCU->getMVPIdx(REF_PIC_LIST_1) + m_uiAbsIdxInLCU, m_apiMVPIdx[1], iSizeInUchar ); |
---|
1476 | memcpy( rpcCU->getMVPNum(REF_PIC_LIST_0) + m_uiAbsIdxInLCU, m_apiMVPNum[0], iSizeInUchar ); |
---|
1477 | memcpy( rpcCU->getMVPNum(REF_PIC_LIST_1) + m_uiAbsIdxInLCU, m_apiMVPNum[1], iSizeInUchar ); |
---|
1478 | |
---|
1479 | m_acCUMvField[0].copyTo( rpcCU->getCUMvField( REF_PIC_LIST_0 ), m_uiAbsIdxInLCU ); |
---|
1480 | m_acCUMvField[1].copyTo( rpcCU->getCUMvField( REF_PIC_LIST_1 ), m_uiAbsIdxInLCU ); |
---|
1481 | |
---|
1482 | memcpy( rpcCU->getIPCMFlag() + m_uiAbsIdxInLCU, m_pbIPCMFlag, iSizeInBool ); |
---|
1483 | |
---|
1484 | UInt uiTmp = (g_uiMaxCUWidth*g_uiMaxCUHeight)>>(uhDepth<<1); |
---|
1485 | UInt uiTmp2 = m_uiAbsIdxInLCU*m_pcPic->getMinCUWidth()*m_pcPic->getMinCUHeight(); |
---|
1486 | memcpy( rpcCU->getCoeffY() + uiTmp2, m_pcTrCoeffY, sizeof(TCoeff)*uiTmp ); |
---|
1487 | #if ADAPTIVE_QP_SELECTION |
---|
1488 | memcpy( rpcCU->getArlCoeffY() + uiTmp2, m_pcArlCoeffY, sizeof(Int)*uiTmp ); |
---|
1489 | #endif |
---|
1490 | memcpy( rpcCU->getPCMSampleY() + uiTmp2 , m_pcIPCMSampleY, sizeof(Pel)*uiTmp ); |
---|
1491 | |
---|
1492 | uiTmp >>= 2; uiTmp2 >>= 2; |
---|
1493 | memcpy( rpcCU->getCoeffCb() + uiTmp2, m_pcTrCoeffCb, sizeof(TCoeff)*uiTmp ); |
---|
1494 | memcpy( rpcCU->getCoeffCr() + uiTmp2, m_pcTrCoeffCr, sizeof(TCoeff)*uiTmp ); |
---|
1495 | #if ADAPTIVE_QP_SELECTION |
---|
1496 | memcpy( rpcCU->getArlCoeffCb() + uiTmp2, m_pcArlCoeffCb, sizeof(Int)*uiTmp ); |
---|
1497 | memcpy( rpcCU->getArlCoeffCr() + uiTmp2, m_pcArlCoeffCr, sizeof(Int)*uiTmp ); |
---|
1498 | #endif |
---|
1499 | memcpy( rpcCU->getPCMSampleCb() + uiTmp2 , m_pcIPCMSampleCb, sizeof( Pel ) * uiTmp ); |
---|
1500 | memcpy( rpcCU->getPCMSampleCr() + uiTmp2 , m_pcIPCMSampleCr, sizeof( Pel ) * uiTmp ); |
---|
1501 | rpcCU->getTotalBins() = m_uiTotalBins; |
---|
1502 | memcpy( rpcCU->m_sliceStartCU + m_uiAbsIdxInLCU, m_sliceStartCU, sizeof( UInt ) * m_uiNumPartition ); |
---|
1503 | memcpy( rpcCU->m_sliceSegmentStartCU + m_uiAbsIdxInLCU, m_sliceSegmentStartCU, sizeof( UInt ) * m_uiNumPartition ); |
---|
1504 | #if H_3D_ARP |
---|
1505 | memcpy( rpcCU->getARPW() + m_uiAbsIdxInLCU, m_puhARPW, iSizeInUchar ); |
---|
1506 | #endif |
---|
1507 | #if H_3D_IC |
---|
1508 | memcpy( rpcCU->getICFlag() + m_uiAbsIdxInLCU, m_pbICFlag, iSizeInBool ); |
---|
1509 | #endif |
---|
1510 | } |
---|
1511 | |
---|
1512 | Void TComDataCU::copyToPic( UChar uhDepth, UInt uiPartIdx, UInt uiPartDepth ) |
---|
1513 | { |
---|
1514 | TComDataCU*& rpcCU = m_pcPic->getCU( m_uiCUAddr ); |
---|
1515 | UInt uiQNumPart = m_uiNumPartition>>(uiPartDepth<<1); |
---|
1516 | |
---|
1517 | UInt uiPartStart = uiPartIdx*uiQNumPart; |
---|
1518 | UInt uiPartOffset = m_uiAbsIdxInLCU + uiPartStart; |
---|
1519 | |
---|
1520 | rpcCU->getTotalCost() = m_dTotalCost; |
---|
1521 | rpcCU->getTotalDistortion() = m_uiTotalDistortion; |
---|
1522 | rpcCU->getTotalBits() = m_uiTotalBits; |
---|
1523 | |
---|
1524 | Int iSizeInUchar = sizeof( UChar ) * uiQNumPart; |
---|
1525 | Int iSizeInBool = sizeof( Bool ) * uiQNumPart; |
---|
1526 | |
---|
1527 | Int sizeInChar = sizeof( Char ) * uiQNumPart; |
---|
1528 | memcpy( rpcCU->getSkipFlag() + uiPartOffset, m_skipFlag, sizeof( *m_skipFlag ) * uiQNumPart ); |
---|
1529 | |
---|
1530 | memcpy( rpcCU->getQP() + uiPartOffset, m_phQP, sizeInChar ); |
---|
1531 | memcpy( rpcCU->getPartitionSize() + uiPartOffset, m_pePartSize, sizeof( *m_pePartSize ) * uiQNumPart ); |
---|
1532 | memcpy( rpcCU->getPredictionMode() + uiPartOffset, m_pePredMode, sizeof( *m_pePredMode ) * uiQNumPart ); |
---|
1533 | memcpy( rpcCU->getCUTransquantBypass()+ uiPartOffset, m_CUTransquantBypass, sizeof( *m_CUTransquantBypass ) * uiQNumPart ); |
---|
1534 | memcpy( rpcCU->getMergeFlag() + uiPartOffset, m_pbMergeFlag, iSizeInBool ); |
---|
1535 | memcpy( rpcCU->getMergeIndex() + uiPartOffset, m_puhMergeIndex, iSizeInUchar ); |
---|
1536 | #if H_3D_VSP |
---|
1537 | memcpy( rpcCU->getVSPFlag() + uiPartOffset, m_piVSPFlag, sizeof(Char) * uiQNumPart ); |
---|
1538 | #endif |
---|
1539 | #if H_3D_SPIVMP |
---|
1540 | memcpy( rpcCU->getSPIVMPFlag() + uiPartOffset, m_pbSPIVMPFlag, sizeof(Bool) * uiQNumPart ); |
---|
1541 | #endif |
---|
1542 | memcpy( rpcCU->getLumaIntraDir() + uiPartOffset, m_puhLumaIntraDir, iSizeInUchar ); |
---|
1543 | memcpy( rpcCU->getChromaIntraDir() + uiPartOffset, m_puhChromaIntraDir, iSizeInUchar ); |
---|
1544 | memcpy( rpcCU->getInterDir() + uiPartOffset, m_puhInterDir, iSizeInUchar ); |
---|
1545 | memcpy( rpcCU->getTransformIdx() + uiPartOffset, m_puhTrIdx, iSizeInUchar ); |
---|
1546 | memcpy( rpcCU->getTransformSkip(TEXT_LUMA) + uiPartOffset, m_puhTransformSkip[0], iSizeInUchar ); |
---|
1547 | memcpy( rpcCU->getTransformSkip(TEXT_CHROMA_U) + uiPartOffset, m_puhTransformSkip[1], iSizeInUchar ); |
---|
1548 | memcpy( rpcCU->getTransformSkip(TEXT_CHROMA_V) + uiPartOffset, m_puhTransformSkip[2], iSizeInUchar ); |
---|
1549 | memcpy( rpcCU->getCbf(TEXT_LUMA) + uiPartOffset, m_puhCbf[0], iSizeInUchar ); |
---|
1550 | memcpy( rpcCU->getCbf(TEXT_CHROMA_U) + uiPartOffset, m_puhCbf[1], iSizeInUchar ); |
---|
1551 | memcpy( rpcCU->getCbf(TEXT_CHROMA_V) + uiPartOffset, m_puhCbf[2], iSizeInUchar ); |
---|
1552 | |
---|
1553 | #if H_3D_DDD |
---|
1554 | memcpy( rpcCU->getDDDepth() + uiPartOffset, m_pucDisparityDerivedDepth, iSizeInUchar ); |
---|
1555 | memcpy( rpcCU->getUseDDD() + uiPartOffset, m_pbUseDDD, iSizeInBool ); |
---|
1556 | #endif |
---|
1557 | |
---|
1558 | #if H_3D_DIM |
---|
1559 | for( Int i = 0; i < DMM_NUM_TYPE; i++ ) |
---|
1560 | { |
---|
1561 | memcpy( rpcCU->getDimDeltaDC( i, 0 ) + uiPartOffset, m_dimDeltaDC[i][0], sizeof(Pel ) * uiQNumPart ); |
---|
1562 | memcpy( rpcCU->getDimDeltaDC( i, 1 ) + uiPartOffset, m_dimDeltaDC[i][1], sizeof(Pel ) * uiQNumPart ); |
---|
1563 | } |
---|
1564 | #if H_3D_DIM_DMM |
---|
1565 | for( Int i = 0; i < DMM_NUM_TYPE; i++ ) |
---|
1566 | { |
---|
1567 | memcpy( rpcCU->getDmmWedgeTabIdx( i ) + uiPartOffset, m_dmmWedgeTabIdx[i], sizeof(UInt) * uiQNumPart ); |
---|
1568 | } |
---|
1569 | #endif |
---|
1570 | #if H_3D_DIM_SDC |
---|
1571 | memcpy( rpcCU->getSDCFlag() + uiPartOffset, m_pbSDCFlag, iSizeInBool ); |
---|
1572 | memcpy( rpcCU->getSDCSegmentDCOffset(0) + uiPartOffset, m_apSegmentDCOffset[0], sizeof( Pel ) * uiQNumPart); |
---|
1573 | memcpy( rpcCU->getSDCSegmentDCOffset(1) + uiPartOffset, m_apSegmentDCOffset[1], sizeof( Pel ) * uiQNumPart); |
---|
1574 | #endif |
---|
1575 | #endif |
---|
1576 | #if H_3D_DBBP |
---|
1577 | memcpy( rpcCU->getDBBPFlag() + uiPartOffset, m_pbDBBPFlag, iSizeInBool ); |
---|
1578 | #endif |
---|
1579 | |
---|
1580 | memcpy( rpcCU->getDepth() + uiPartOffset, m_puhDepth, iSizeInUchar ); |
---|
1581 | memcpy( rpcCU->getWidth() + uiPartOffset, m_puhWidth, iSizeInUchar ); |
---|
1582 | memcpy( rpcCU->getHeight() + uiPartOffset, m_puhHeight, iSizeInUchar ); |
---|
1583 | |
---|
1584 | memcpy( rpcCU->getMVPIdx(REF_PIC_LIST_0) + uiPartOffset, m_apiMVPIdx[0], iSizeInUchar ); |
---|
1585 | memcpy( rpcCU->getMVPIdx(REF_PIC_LIST_1) + uiPartOffset, m_apiMVPIdx[1], iSizeInUchar ); |
---|
1586 | memcpy( rpcCU->getMVPNum(REF_PIC_LIST_0) + uiPartOffset, m_apiMVPNum[0], iSizeInUchar ); |
---|
1587 | memcpy( rpcCU->getMVPNum(REF_PIC_LIST_1) + uiPartOffset, m_apiMVPNum[1], iSizeInUchar ); |
---|
1588 | m_acCUMvField[0].copyTo( rpcCU->getCUMvField( REF_PIC_LIST_0 ), m_uiAbsIdxInLCU, uiPartStart, uiQNumPart ); |
---|
1589 | m_acCUMvField[1].copyTo( rpcCU->getCUMvField( REF_PIC_LIST_1 ), m_uiAbsIdxInLCU, uiPartStart, uiQNumPart ); |
---|
1590 | |
---|
1591 | memcpy( rpcCU->getIPCMFlag() + uiPartOffset, m_pbIPCMFlag, iSizeInBool ); |
---|
1592 | |
---|
1593 | UInt uiTmp = (g_uiMaxCUWidth*g_uiMaxCUHeight)>>((uhDepth+uiPartDepth)<<1); |
---|
1594 | UInt uiTmp2 = uiPartOffset*m_pcPic->getMinCUWidth()*m_pcPic->getMinCUHeight(); |
---|
1595 | memcpy( rpcCU->getCoeffY() + uiTmp2, m_pcTrCoeffY, sizeof(TCoeff)*uiTmp ); |
---|
1596 | #if ADAPTIVE_QP_SELECTION |
---|
1597 | memcpy( rpcCU->getArlCoeffY() + uiTmp2, m_pcArlCoeffY, sizeof(Int)*uiTmp ); |
---|
1598 | #endif |
---|
1599 | |
---|
1600 | memcpy( rpcCU->getPCMSampleY() + uiTmp2 , m_pcIPCMSampleY, sizeof( Pel ) * uiTmp ); |
---|
1601 | |
---|
1602 | uiTmp >>= 2; uiTmp2 >>= 2; |
---|
1603 | memcpy( rpcCU->getCoeffCb() + uiTmp2, m_pcTrCoeffCb, sizeof(TCoeff)*uiTmp ); |
---|
1604 | memcpy( rpcCU->getCoeffCr() + uiTmp2, m_pcTrCoeffCr, sizeof(TCoeff)*uiTmp ); |
---|
1605 | #if ADAPTIVE_QP_SELECTION |
---|
1606 | memcpy( rpcCU->getArlCoeffCb() + uiTmp2, m_pcArlCoeffCb, sizeof(Int)*uiTmp ); |
---|
1607 | memcpy( rpcCU->getArlCoeffCr() + uiTmp2, m_pcArlCoeffCr, sizeof(Int)*uiTmp ); |
---|
1608 | #endif |
---|
1609 | |
---|
1610 | memcpy( rpcCU->getPCMSampleCb() + uiTmp2 , m_pcIPCMSampleCb, sizeof( Pel ) * uiTmp ); |
---|
1611 | memcpy( rpcCU->getPCMSampleCr() + uiTmp2 , m_pcIPCMSampleCr, sizeof( Pel ) * uiTmp ); |
---|
1612 | rpcCU->getTotalBins() = m_uiTotalBins; |
---|
1613 | memcpy( rpcCU->m_sliceStartCU + uiPartOffset, m_sliceStartCU, sizeof( UInt ) * uiQNumPart ); |
---|
1614 | memcpy( rpcCU->m_sliceSegmentStartCU + uiPartOffset, m_sliceSegmentStartCU, sizeof( UInt ) * uiQNumPart ); |
---|
1615 | #if H_3D_ARP |
---|
1616 | memcpy( rpcCU->getARPW() + uiPartOffset, m_puhARPW, iSizeInUchar ); |
---|
1617 | #endif |
---|
1618 | #if H_3D_IC |
---|
1619 | memcpy( rpcCU->getICFlag() + uiPartOffset, m_pbICFlag, iSizeInBool ); |
---|
1620 | #endif |
---|
1621 | } |
---|
1622 | |
---|
1623 | #if H_3D_DDD |
---|
1624 | Void TComDataCU::setDDDepthSubParts ( UChar ucDDD, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) |
---|
1625 | { |
---|
1626 | setSubPart<UChar>( ucDDD, m_pucDisparityDerivedDepth, uiAbsPartIdx, uiDepth, uiPartIdx ); |
---|
1627 | } |
---|
1628 | |
---|
1629 | Void TComDataCU::setUseDDD ( Bool bUseDDD, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) |
---|
1630 | { |
---|
1631 | setSubPart<Bool>( bUseDDD, m_pbUseDDD, uiAbsPartIdx, uiDepth, uiPartIdx ); |
---|
1632 | } |
---|
1633 | |
---|
1634 | Void TComDataCU::setUseDDD( Bool bUseDDD, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
1635 | { |
---|
1636 | memset( m_pbUseDDD + uiAbsPartIdx, bUseDDD, (m_pcPic->getNumPartInCU() >> ( 2 * uiDepth ))*sizeof(Bool) ); |
---|
1637 | } |
---|
1638 | |
---|
1639 | #endif |
---|
1640 | |
---|
1641 | // -------------------------------------------------------------------------------------------------------------------- |
---|
1642 | // Other public functions |
---|
1643 | // -------------------------------------------------------------------------------------------------------------------- |
---|
1644 | |
---|
1645 | TComDataCU* TComDataCU::getPULeft( UInt& uiLPartUnitIdx, |
---|
1646 | UInt uiCurrPartUnitIdx, |
---|
1647 | Bool bEnforceSliceRestriction, |
---|
1648 | Bool bEnforceTileRestriction ) |
---|
1649 | { |
---|
1650 | UInt uiAbsPartIdx = g_auiZscanToRaster[uiCurrPartUnitIdx]; |
---|
1651 | UInt uiAbsZorderCUIdx = g_auiZscanToRaster[m_uiAbsIdxInLCU]; |
---|
1652 | UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); |
---|
1653 | |
---|
1654 | if ( !RasterAddress::isZeroCol( uiAbsPartIdx, uiNumPartInCUWidth ) ) |
---|
1655 | { |
---|
1656 | uiLPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdx - 1 ]; |
---|
1657 | if ( RasterAddress::isEqualCol( uiAbsPartIdx, uiAbsZorderCUIdx, uiNumPartInCUWidth ) ) |
---|
1658 | { |
---|
1659 | return m_pcPic->getCU( getAddr() ); |
---|
1660 | } |
---|
1661 | else |
---|
1662 | { |
---|
1663 | uiLPartUnitIdx -= m_uiAbsIdxInLCU; |
---|
1664 | return this; |
---|
1665 | } |
---|
1666 | } |
---|
1667 | |
---|
1668 | uiLPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdx + uiNumPartInCUWidth - 1 ]; |
---|
1669 | |
---|
1670 | |
---|
1671 | if ( (bEnforceSliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || m_pcCULeft->getSCUAddr()+uiLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx))) |
---|
1672 | || |
---|
1673 | (bEnforceTileRestriction && ( m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) ) ) |
---|
1674 | ) |
---|
1675 | { |
---|
1676 | return NULL; |
---|
1677 | } |
---|
1678 | return m_pcCULeft; |
---|
1679 | } |
---|
1680 | |
---|
1681 | TComDataCU* TComDataCU::getPUAbove( UInt& uiAPartUnitIdx, |
---|
1682 | UInt uiCurrPartUnitIdx, |
---|
1683 | Bool bEnforceSliceRestriction, |
---|
1684 | Bool planarAtLCUBoundary , |
---|
1685 | Bool bEnforceTileRestriction ) |
---|
1686 | { |
---|
1687 | UInt uiAbsPartIdx = g_auiZscanToRaster[uiCurrPartUnitIdx]; |
---|
1688 | UInt uiAbsZorderCUIdx = g_auiZscanToRaster[m_uiAbsIdxInLCU]; |
---|
1689 | UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); |
---|
1690 | |
---|
1691 | if ( !RasterAddress::isZeroRow( uiAbsPartIdx, uiNumPartInCUWidth ) ) |
---|
1692 | { |
---|
1693 | uiAPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdx - uiNumPartInCUWidth ]; |
---|
1694 | if ( RasterAddress::isEqualRow( uiAbsPartIdx, uiAbsZorderCUIdx, uiNumPartInCUWidth ) ) |
---|
1695 | { |
---|
1696 | return m_pcPic->getCU( getAddr() ); |
---|
1697 | } |
---|
1698 | else |
---|
1699 | { |
---|
1700 | uiAPartUnitIdx -= m_uiAbsIdxInLCU; |
---|
1701 | return this; |
---|
1702 | } |
---|
1703 | } |
---|
1704 | |
---|
1705 | if(planarAtLCUBoundary) |
---|
1706 | { |
---|
1707 | return NULL; |
---|
1708 | } |
---|
1709 | |
---|
1710 | uiAPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdx + m_pcPic->getNumPartInCU() - uiNumPartInCUWidth ]; |
---|
1711 | |
---|
1712 | if ( (bEnforceSliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || m_pcCUAbove->getSCUAddr()+uiAPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx))) |
---|
1713 | || |
---|
1714 | (bEnforceTileRestriction &&(m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())))) |
---|
1715 | ) |
---|
1716 | { |
---|
1717 | return NULL; |
---|
1718 | } |
---|
1719 | return m_pcCUAbove; |
---|
1720 | } |
---|
1721 | |
---|
1722 | TComDataCU* TComDataCU::getPUAboveLeft( UInt& uiALPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction ) |
---|
1723 | { |
---|
1724 | UInt uiAbsPartIdx = g_auiZscanToRaster[uiCurrPartUnitIdx]; |
---|
1725 | UInt uiAbsZorderCUIdx = g_auiZscanToRaster[m_uiAbsIdxInLCU]; |
---|
1726 | UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); |
---|
1727 | |
---|
1728 | if ( !RasterAddress::isZeroCol( uiAbsPartIdx, uiNumPartInCUWidth ) ) |
---|
1729 | { |
---|
1730 | if ( !RasterAddress::isZeroRow( uiAbsPartIdx, uiNumPartInCUWidth ) ) |
---|
1731 | { |
---|
1732 | uiALPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdx - uiNumPartInCUWidth - 1 ]; |
---|
1733 | if ( RasterAddress::isEqualRowOrCol( uiAbsPartIdx, uiAbsZorderCUIdx, uiNumPartInCUWidth ) ) |
---|
1734 | { |
---|
1735 | return m_pcPic->getCU( getAddr() ); |
---|
1736 | } |
---|
1737 | else |
---|
1738 | { |
---|
1739 | uiALPartUnitIdx -= m_uiAbsIdxInLCU; |
---|
1740 | return this; |
---|
1741 | } |
---|
1742 | } |
---|
1743 | uiALPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdx + getPic()->getNumPartInCU() - uiNumPartInCUWidth - 1 ]; |
---|
1744 | if ( (bEnforceSliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || |
---|
1745 | m_pcCUAbove->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)|| |
---|
1746 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
1747 | )) |
---|
1748 | ) |
---|
1749 | { |
---|
1750 | return NULL; |
---|
1751 | } |
---|
1752 | return m_pcCUAbove; |
---|
1753 | } |
---|
1754 | |
---|
1755 | if ( !RasterAddress::isZeroRow( uiAbsPartIdx, uiNumPartInCUWidth ) ) |
---|
1756 | { |
---|
1757 | uiALPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdx - 1 ]; |
---|
1758 | if ( (bEnforceSliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || |
---|
1759 | m_pcCULeft->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)|| |
---|
1760 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
1761 | )) |
---|
1762 | ) |
---|
1763 | { |
---|
1764 | return NULL; |
---|
1765 | } |
---|
1766 | return m_pcCULeft; |
---|
1767 | } |
---|
1768 | |
---|
1769 | uiALPartUnitIdx = g_auiRasterToZscan[ m_pcPic->getNumPartInCU() - 1 ]; |
---|
1770 | if ( (bEnforceSliceRestriction && (m_pcCUAboveLeft==NULL || m_pcCUAboveLeft->getSlice()==NULL || |
---|
1771 | m_pcCUAboveLeft->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)|| |
---|
1772 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveLeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
1773 | )) |
---|
1774 | ) |
---|
1775 | { |
---|
1776 | return NULL; |
---|
1777 | } |
---|
1778 | return m_pcCUAboveLeft; |
---|
1779 | } |
---|
1780 | |
---|
1781 | TComDataCU* TComDataCU::getPUAboveRight( UInt& uiARPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction ) |
---|
1782 | { |
---|
1783 | UInt uiAbsPartIdxRT = g_auiZscanToRaster[uiCurrPartUnitIdx]; |
---|
1784 | UInt uiAbsZorderCUIdx = g_auiZscanToRaster[ m_uiAbsIdxInLCU ] + m_puhWidth[0] / m_pcPic->getMinCUWidth() - 1; |
---|
1785 | UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); |
---|
1786 | |
---|
1787 | if( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxRT] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) |
---|
1788 | { |
---|
1789 | uiARPartUnitIdx = MAX_UINT; |
---|
1790 | return NULL; |
---|
1791 | } |
---|
1792 | |
---|
1793 | if ( RasterAddress::lessThanCol( uiAbsPartIdxRT, uiNumPartInCUWidth - 1, uiNumPartInCUWidth ) ) |
---|
1794 | { |
---|
1795 | if ( !RasterAddress::isZeroRow( uiAbsPartIdxRT, uiNumPartInCUWidth ) ) |
---|
1796 | { |
---|
1797 | if ( uiCurrPartUnitIdx > g_auiRasterToZscan[ uiAbsPartIdxRT - uiNumPartInCUWidth + 1 ] ) |
---|
1798 | { |
---|
1799 | uiARPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdxRT - uiNumPartInCUWidth + 1 ]; |
---|
1800 | if ( RasterAddress::isEqualRowOrCol( uiAbsPartIdxRT, uiAbsZorderCUIdx, uiNumPartInCUWidth ) ) |
---|
1801 | { |
---|
1802 | return m_pcPic->getCU( getAddr() ); |
---|
1803 | } |
---|
1804 | else |
---|
1805 | { |
---|
1806 | uiARPartUnitIdx -= m_uiAbsIdxInLCU; |
---|
1807 | return this; |
---|
1808 | } |
---|
1809 | } |
---|
1810 | uiARPartUnitIdx = MAX_UINT; |
---|
1811 | return NULL; |
---|
1812 | } |
---|
1813 | uiARPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdxRT + m_pcPic->getNumPartInCU() - uiNumPartInCUWidth + 1 ]; |
---|
1814 | if ( (bEnforceSliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || |
---|
1815 | m_pcCUAbove->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)|| |
---|
1816 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
1817 | )) |
---|
1818 | ) |
---|
1819 | { |
---|
1820 | return NULL; |
---|
1821 | } |
---|
1822 | return m_pcCUAbove; |
---|
1823 | } |
---|
1824 | |
---|
1825 | if ( !RasterAddress::isZeroRow( uiAbsPartIdxRT, uiNumPartInCUWidth ) ) |
---|
1826 | { |
---|
1827 | uiARPartUnitIdx = MAX_UINT; |
---|
1828 | return NULL; |
---|
1829 | } |
---|
1830 | |
---|
1831 | uiARPartUnitIdx = g_auiRasterToZscan[ m_pcPic->getNumPartInCU() - uiNumPartInCUWidth ]; |
---|
1832 | if ( (bEnforceSliceRestriction && (m_pcCUAboveRight==NULL || m_pcCUAboveRight->getSlice()==NULL || |
---|
1833 | m_pcPic->getPicSym()->getInverseCUOrderMap( m_pcCUAboveRight->getAddr()) > m_pcPic->getPicSym()->getInverseCUOrderMap( getAddr()) || |
---|
1834 | m_pcCUAboveRight->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)|| |
---|
1835 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
1836 | )) |
---|
1837 | ) |
---|
1838 | { |
---|
1839 | return NULL; |
---|
1840 | } |
---|
1841 | return m_pcCUAboveRight; |
---|
1842 | } |
---|
1843 | |
---|
1844 | TComDataCU* TComDataCU::getPUBelowLeft( UInt& uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction ) |
---|
1845 | { |
---|
1846 | UInt uiAbsPartIdxLB = g_auiZscanToRaster[uiCurrPartUnitIdx]; |
---|
1847 | UInt uiAbsZorderCUIdxLB = g_auiZscanToRaster[ m_uiAbsIdxInLCU ] + (m_puhHeight[0] / m_pcPic->getMinCUHeight() - 1)*m_pcPic->getNumPartInWidth(); |
---|
1848 | UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); |
---|
1849 | |
---|
1850 | if( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxLB] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples() ) |
---|
1851 | { |
---|
1852 | uiBLPartUnitIdx = MAX_UINT; |
---|
1853 | return NULL; |
---|
1854 | } |
---|
1855 | |
---|
1856 | if ( RasterAddress::lessThanRow( uiAbsPartIdxLB, m_pcPic->getNumPartInHeight() - 1, uiNumPartInCUWidth ) ) |
---|
1857 | { |
---|
1858 | if ( !RasterAddress::isZeroCol( uiAbsPartIdxLB, uiNumPartInCUWidth ) ) |
---|
1859 | { |
---|
1860 | if ( uiCurrPartUnitIdx > g_auiRasterToZscan[ uiAbsPartIdxLB + uiNumPartInCUWidth - 1 ] ) |
---|
1861 | { |
---|
1862 | uiBLPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdxLB + uiNumPartInCUWidth - 1 ]; |
---|
1863 | if ( RasterAddress::isEqualRowOrCol( uiAbsPartIdxLB, uiAbsZorderCUIdxLB, uiNumPartInCUWidth ) ) |
---|
1864 | { |
---|
1865 | return m_pcPic->getCU( getAddr() ); |
---|
1866 | } |
---|
1867 | else |
---|
1868 | { |
---|
1869 | uiBLPartUnitIdx -= m_uiAbsIdxInLCU; |
---|
1870 | return this; |
---|
1871 | } |
---|
1872 | } |
---|
1873 | uiBLPartUnitIdx = MAX_UINT; |
---|
1874 | return NULL; |
---|
1875 | } |
---|
1876 | uiBLPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdxLB + uiNumPartInCUWidth*2 - 1 ]; |
---|
1877 | if ( (bEnforceSliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || |
---|
1878 | m_pcCULeft->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)|| |
---|
1879 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
1880 | )) |
---|
1881 | ) |
---|
1882 | { |
---|
1883 | return NULL; |
---|
1884 | } |
---|
1885 | return m_pcCULeft; |
---|
1886 | } |
---|
1887 | |
---|
1888 | uiBLPartUnitIdx = MAX_UINT; |
---|
1889 | return NULL; |
---|
1890 | } |
---|
1891 | |
---|
1892 | TComDataCU* TComDataCU::getPUBelowLeftAdi(UInt& uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset, Bool bEnforceSliceRestriction ) |
---|
1893 | { |
---|
1894 | UInt uiAbsPartIdxLB = g_auiZscanToRaster[uiCurrPartUnitIdx]; |
---|
1895 | UInt uiAbsZorderCUIdxLB = g_auiZscanToRaster[ m_uiAbsIdxInLCU ] + ((m_puhHeight[0] / m_pcPic->getMinCUHeight()) - 1)*m_pcPic->getNumPartInWidth(); |
---|
1896 | UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); |
---|
1897 | |
---|
1898 | if( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxLB] + (m_pcPic->getPicSym()->getMinCUHeight() * uiPartUnitOffset)) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples()) |
---|
1899 | { |
---|
1900 | uiBLPartUnitIdx = MAX_UINT; |
---|
1901 | return NULL; |
---|
1902 | } |
---|
1903 | |
---|
1904 | if ( RasterAddress::lessThanRow( uiAbsPartIdxLB, m_pcPic->getNumPartInHeight() - uiPartUnitOffset, uiNumPartInCUWidth ) ) |
---|
1905 | { |
---|
1906 | if ( !RasterAddress::isZeroCol( uiAbsPartIdxLB, uiNumPartInCUWidth ) ) |
---|
1907 | { |
---|
1908 | if ( uiCurrPartUnitIdx > g_auiRasterToZscan[ uiAbsPartIdxLB + uiPartUnitOffset * uiNumPartInCUWidth - 1 ] ) |
---|
1909 | { |
---|
1910 | uiBLPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdxLB + uiPartUnitOffset * uiNumPartInCUWidth - 1 ]; |
---|
1911 | if ( RasterAddress::isEqualRowOrCol( uiAbsPartIdxLB, uiAbsZorderCUIdxLB, uiNumPartInCUWidth ) ) |
---|
1912 | { |
---|
1913 | return m_pcPic->getCU( getAddr() ); |
---|
1914 | } |
---|
1915 | else |
---|
1916 | { |
---|
1917 | uiBLPartUnitIdx -= m_uiAbsIdxInLCU; |
---|
1918 | return this; |
---|
1919 | } |
---|
1920 | } |
---|
1921 | uiBLPartUnitIdx = MAX_UINT; |
---|
1922 | return NULL; |
---|
1923 | } |
---|
1924 | uiBLPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdxLB + (1+uiPartUnitOffset) * uiNumPartInCUWidth - 1 ]; |
---|
1925 | if ( (bEnforceSliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || |
---|
1926 | m_pcCULeft->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)|| |
---|
1927 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
1928 | )) |
---|
1929 | ) |
---|
1930 | { |
---|
1931 | return NULL; |
---|
1932 | } |
---|
1933 | return m_pcCULeft; |
---|
1934 | } |
---|
1935 | |
---|
1936 | uiBLPartUnitIdx = MAX_UINT; |
---|
1937 | return NULL; |
---|
1938 | } |
---|
1939 | |
---|
1940 | TComDataCU* TComDataCU::getPUAboveRightAdi(UInt& uiARPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset, Bool bEnforceSliceRestriction ) |
---|
1941 | { |
---|
1942 | UInt uiAbsPartIdxRT = g_auiZscanToRaster[uiCurrPartUnitIdx]; |
---|
1943 | UInt uiAbsZorderCUIdx = g_auiZscanToRaster[ m_uiAbsIdxInLCU ] + (m_puhWidth[0] / m_pcPic->getMinCUWidth()) - 1; |
---|
1944 | UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); |
---|
1945 | |
---|
1946 | if( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxRT] + (m_pcPic->getPicSym()->getMinCUHeight() * uiPartUnitOffset)) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) |
---|
1947 | { |
---|
1948 | uiARPartUnitIdx = MAX_UINT; |
---|
1949 | return NULL; |
---|
1950 | } |
---|
1951 | |
---|
1952 | if ( RasterAddress::lessThanCol( uiAbsPartIdxRT, uiNumPartInCUWidth - uiPartUnitOffset, uiNumPartInCUWidth ) ) |
---|
1953 | { |
---|
1954 | if ( !RasterAddress::isZeroRow( uiAbsPartIdxRT, uiNumPartInCUWidth ) ) |
---|
1955 | { |
---|
1956 | if ( uiCurrPartUnitIdx > g_auiRasterToZscan[ uiAbsPartIdxRT - uiNumPartInCUWidth + uiPartUnitOffset ] ) |
---|
1957 | { |
---|
1958 | uiARPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdxRT - uiNumPartInCUWidth + uiPartUnitOffset ]; |
---|
1959 | if ( RasterAddress::isEqualRowOrCol( uiAbsPartIdxRT, uiAbsZorderCUIdx, uiNumPartInCUWidth ) ) |
---|
1960 | { |
---|
1961 | return m_pcPic->getCU( getAddr() ); |
---|
1962 | } |
---|
1963 | else |
---|
1964 | { |
---|
1965 | uiARPartUnitIdx -= m_uiAbsIdxInLCU; |
---|
1966 | return this; |
---|
1967 | } |
---|
1968 | } |
---|
1969 | uiARPartUnitIdx = MAX_UINT; |
---|
1970 | return NULL; |
---|
1971 | } |
---|
1972 | uiARPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdxRT + m_pcPic->getNumPartInCU() - uiNumPartInCUWidth + uiPartUnitOffset ]; |
---|
1973 | if ( (bEnforceSliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || |
---|
1974 | m_pcCUAbove->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)|| |
---|
1975 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
1976 | )) |
---|
1977 | ) |
---|
1978 | { |
---|
1979 | return NULL; |
---|
1980 | } |
---|
1981 | return m_pcCUAbove; |
---|
1982 | } |
---|
1983 | |
---|
1984 | if ( !RasterAddress::isZeroRow( uiAbsPartIdxRT, uiNumPartInCUWidth ) ) |
---|
1985 | { |
---|
1986 | uiARPartUnitIdx = MAX_UINT; |
---|
1987 | return NULL; |
---|
1988 | } |
---|
1989 | |
---|
1990 | uiARPartUnitIdx = g_auiRasterToZscan[ m_pcPic->getNumPartInCU() - uiNumPartInCUWidth + uiPartUnitOffset-1 ]; |
---|
1991 | if ( (bEnforceSliceRestriction && (m_pcCUAboveRight==NULL || m_pcCUAboveRight->getSlice()==NULL || |
---|
1992 | m_pcPic->getPicSym()->getInverseCUOrderMap( m_pcCUAboveRight->getAddr()) > m_pcPic->getPicSym()->getInverseCUOrderMap( getAddr()) || |
---|
1993 | m_pcCUAboveRight->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)|| |
---|
1994 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
1995 | )) |
---|
1996 | ) |
---|
1997 | { |
---|
1998 | return NULL; |
---|
1999 | } |
---|
2000 | return m_pcCUAboveRight; |
---|
2001 | } |
---|
2002 | |
---|
2003 | /** Get left QpMinCu |
---|
2004 | *\param uiLPartUnitIdx |
---|
2005 | *\param uiCurrAbsIdxInLCU |
---|
2006 | *\returns TComDataCU* point of TComDataCU of left QpMinCu |
---|
2007 | */ |
---|
2008 | TComDataCU* TComDataCU::getQpMinCuLeft( UInt& uiLPartUnitIdx, UInt uiCurrAbsIdxInLCU) |
---|
2009 | { |
---|
2010 | UInt numPartInCUWidth = m_pcPic->getNumPartInWidth(); |
---|
2011 | UInt absZorderQpMinCUIdx = (uiCurrAbsIdxInLCU>>((g_uiMaxCUDepth - getSlice()->getPPS()->getMaxCuDQPDepth())<<1))<<((g_uiMaxCUDepth -getSlice()->getPPS()->getMaxCuDQPDepth())<<1); |
---|
2012 | UInt absRorderQpMinCUIdx = g_auiZscanToRaster[absZorderQpMinCUIdx]; |
---|
2013 | |
---|
2014 | // check for left LCU boundary |
---|
2015 | if ( RasterAddress::isZeroCol(absRorderQpMinCUIdx, numPartInCUWidth) ) |
---|
2016 | { |
---|
2017 | return NULL; |
---|
2018 | } |
---|
2019 | |
---|
2020 | // get index of left-CU relative to top-left corner of current quantization group |
---|
2021 | uiLPartUnitIdx = g_auiRasterToZscan[absRorderQpMinCUIdx - 1]; |
---|
2022 | |
---|
2023 | // return pointer to current LCU |
---|
2024 | return m_pcPic->getCU( getAddr() ); |
---|
2025 | } |
---|
2026 | |
---|
2027 | /** Get Above QpMinCu |
---|
2028 | *\param aPartUnitIdx |
---|
2029 | *\param currAbsIdxInLCU |
---|
2030 | *\returns TComDataCU* point of TComDataCU of above QpMinCu |
---|
2031 | */ |
---|
2032 | TComDataCU* TComDataCU::getQpMinCuAbove( UInt& aPartUnitIdx, UInt currAbsIdxInLCU ) |
---|
2033 | { |
---|
2034 | UInt numPartInCUWidth = m_pcPic->getNumPartInWidth(); |
---|
2035 | UInt absZorderQpMinCUIdx = (currAbsIdxInLCU>>((g_uiMaxCUDepth - getSlice()->getPPS()->getMaxCuDQPDepth())<<1))<<((g_uiMaxCUDepth - getSlice()->getPPS()->getMaxCuDQPDepth())<<1); |
---|
2036 | UInt absRorderQpMinCUIdx = g_auiZscanToRaster[absZorderQpMinCUIdx]; |
---|
2037 | |
---|
2038 | // check for top LCU boundary |
---|
2039 | if ( RasterAddress::isZeroRow( absRorderQpMinCUIdx, numPartInCUWidth) ) |
---|
2040 | { |
---|
2041 | return NULL; |
---|
2042 | } |
---|
2043 | |
---|
2044 | // get index of top-CU relative to top-left corner of current quantization group |
---|
2045 | aPartUnitIdx = g_auiRasterToZscan[absRorderQpMinCUIdx - numPartInCUWidth]; |
---|
2046 | |
---|
2047 | // return pointer to current LCU |
---|
2048 | return m_pcPic->getCU( getAddr() ); |
---|
2049 | } |
---|
2050 | |
---|
2051 | /** Get reference QP from left QpMinCu or latest coded QP |
---|
2052 | *\param uiCurrAbsIdxInLCU |
---|
2053 | *\returns Char reference QP value |
---|
2054 | */ |
---|
2055 | Char TComDataCU::getRefQP( UInt uiCurrAbsIdxInLCU ) |
---|
2056 | { |
---|
2057 | UInt lPartIdx = 0, aPartIdx = 0; |
---|
2058 | TComDataCU* cULeft = getQpMinCuLeft ( lPartIdx, m_uiAbsIdxInLCU + uiCurrAbsIdxInLCU ); |
---|
2059 | TComDataCU* cUAbove = getQpMinCuAbove( aPartIdx, m_uiAbsIdxInLCU + uiCurrAbsIdxInLCU ); |
---|
2060 | return (((cULeft? cULeft->getQP( lPartIdx ): getLastCodedQP( uiCurrAbsIdxInLCU )) + (cUAbove? cUAbove->getQP( aPartIdx ): getLastCodedQP( uiCurrAbsIdxInLCU )) + 1) >> 1); |
---|
2061 | } |
---|
2062 | |
---|
2063 | Int TComDataCU::getLastValidPartIdx( Int iAbsPartIdx ) |
---|
2064 | { |
---|
2065 | Int iLastValidPartIdx = iAbsPartIdx-1; |
---|
2066 | while ( iLastValidPartIdx >= 0 |
---|
2067 | && getPredictionMode( iLastValidPartIdx ) == MODE_NONE ) |
---|
2068 | { |
---|
2069 | UInt uiDepth = getDepth( iLastValidPartIdx ); |
---|
2070 | iLastValidPartIdx -= m_uiNumPartition>>(uiDepth<<1); |
---|
2071 | } |
---|
2072 | return iLastValidPartIdx; |
---|
2073 | } |
---|
2074 | |
---|
2075 | Char TComDataCU::getLastCodedQP( UInt uiAbsPartIdx ) |
---|
2076 | { |
---|
2077 | UInt uiQUPartIdxMask = ~((1<<((g_uiMaxCUDepth - getSlice()->getPPS()->getMaxCuDQPDepth())<<1))-1); |
---|
2078 | Int iLastValidPartIdx = getLastValidPartIdx( uiAbsPartIdx&uiQUPartIdxMask ); |
---|
2079 | if ( uiAbsPartIdx < m_uiNumPartition |
---|
2080 | && (getSCUAddr()+iLastValidPartIdx < getSliceStartCU(m_uiAbsIdxInLCU+uiAbsPartIdx))) |
---|
2081 | { |
---|
2082 | return getSlice()->getSliceQp(); |
---|
2083 | } |
---|
2084 | else if ( iLastValidPartIdx >= 0 ) |
---|
2085 | { |
---|
2086 | return getQP( iLastValidPartIdx ); |
---|
2087 | } |
---|
2088 | else |
---|
2089 | { |
---|
2090 | if ( getZorderIdxInCU() > 0 ) |
---|
2091 | { |
---|
2092 | return getPic()->getCU( getAddr() )->getLastCodedQP( getZorderIdxInCU() ); |
---|
2093 | } |
---|
2094 | else if ( getPic()->getPicSym()->getInverseCUOrderMap(getAddr()) > 0 |
---|
2095 | && getPic()->getPicSym()->getTileIdxMap(getAddr()) == getPic()->getPicSym()->getTileIdxMap(getPic()->getPicSym()->getCUOrderMap(getPic()->getPicSym()->getInverseCUOrderMap(getAddr())-1)) |
---|
2096 | && !( getSlice()->getPPS()->getEntropyCodingSyncEnabledFlag() && getAddr() % getPic()->getFrameWidthInCU() == 0 ) ) |
---|
2097 | { |
---|
2098 | return getPic()->getCU( getPic()->getPicSym()->getCUOrderMap(getPic()->getPicSym()->getInverseCUOrderMap(getAddr())-1) )->getLastCodedQP( getPic()->getNumPartInCU() ); |
---|
2099 | } |
---|
2100 | else |
---|
2101 | { |
---|
2102 | return getSlice()->getSliceQp(); |
---|
2103 | } |
---|
2104 | } |
---|
2105 | } |
---|
2106 | /** Check whether the CU is coded in lossless coding mode |
---|
2107 | * \param uiAbsPartIdx |
---|
2108 | * \returns true if the CU is coded in lossless coding mode; false if otherwise |
---|
2109 | */ |
---|
2110 | Bool TComDataCU::isLosslessCoded(UInt absPartIdx) |
---|
2111 | { |
---|
2112 | return (getSlice()->getPPS()->getTransquantBypassEnableFlag() && getCUTransquantBypass (absPartIdx)); |
---|
2113 | } |
---|
2114 | |
---|
2115 | /** Get allowed chroma intra modes |
---|
2116 | *\param uiAbsPartIdx |
---|
2117 | *\param uiModeList pointer to chroma intra modes array |
---|
2118 | *\returns |
---|
2119 | *- fill uiModeList with chroma intra modes |
---|
2120 | */ |
---|
2121 | Void TComDataCU::getAllowedChromaDir( UInt uiAbsPartIdx, UInt* uiModeList ) |
---|
2122 | { |
---|
2123 | uiModeList[0] = PLANAR_IDX; |
---|
2124 | uiModeList[1] = VER_IDX; |
---|
2125 | uiModeList[2] = HOR_IDX; |
---|
2126 | uiModeList[3] = DC_IDX; |
---|
2127 | uiModeList[4] = DM_CHROMA_IDX; |
---|
2128 | |
---|
2129 | UInt uiLumaMode = getLumaIntraDir( uiAbsPartIdx ); |
---|
2130 | |
---|
2131 | for( Int i = 0; i < NUM_CHROMA_MODE - 1; i++ ) |
---|
2132 | { |
---|
2133 | if( uiLumaMode == uiModeList[i] ) |
---|
2134 | { |
---|
2135 | uiModeList[i] = 34; // VER+8 mode |
---|
2136 | break; |
---|
2137 | } |
---|
2138 | } |
---|
2139 | } |
---|
2140 | |
---|
2141 | /** Get most probable intra modes |
---|
2142 | *\param uiAbsPartIdx |
---|
2143 | *\param uiIntraDirPred pointer to the array for MPM storage |
---|
2144 | *\param piMode it is set with MPM mode in case both MPM are equal. It is used to restrict RD search at encode side. |
---|
2145 | *\returns Number of MPM |
---|
2146 | */ |
---|
2147 | Int TComDataCU::getIntraDirLumaPredictor( UInt uiAbsPartIdx, Int* uiIntraDirPred, Int* piMode ) |
---|
2148 | { |
---|
2149 | TComDataCU* pcTempCU; |
---|
2150 | UInt uiTempPartIdx; |
---|
2151 | Int iLeftIntraDir, iAboveIntraDir; |
---|
2152 | Int uiPredNum = 0; |
---|
2153 | |
---|
2154 | // Get intra direction of left PU |
---|
2155 | pcTempCU = getPULeft( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx ); |
---|
2156 | |
---|
2157 | iLeftIntraDir = pcTempCU ? ( pcTempCU->isIntra( uiTempPartIdx ) ? pcTempCU->getLumaIntraDir( uiTempPartIdx ) : DC_IDX ) : DC_IDX; |
---|
2158 | #if H_3D_DIM |
---|
2159 | mapDepthModeToIntraDir( iLeftIntraDir ); |
---|
2160 | #endif |
---|
2161 | |
---|
2162 | // Get intra direction of above PU |
---|
2163 | pcTempCU = getPUAbove( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx, true, true ); |
---|
2164 | |
---|
2165 | iAboveIntraDir = pcTempCU ? ( pcTempCU->isIntra( uiTempPartIdx ) ? pcTempCU->getLumaIntraDir( uiTempPartIdx ) : DC_IDX ) : DC_IDX; |
---|
2166 | #if H_3D_DIM |
---|
2167 | mapDepthModeToIntraDir( iAboveIntraDir ); |
---|
2168 | #endif |
---|
2169 | |
---|
2170 | uiPredNum = 3; |
---|
2171 | if(iLeftIntraDir == iAboveIntraDir) |
---|
2172 | { |
---|
2173 | if( piMode ) |
---|
2174 | { |
---|
2175 | *piMode = 1; |
---|
2176 | } |
---|
2177 | |
---|
2178 | if (iLeftIntraDir > 1) // angular modes |
---|
2179 | { |
---|
2180 | uiIntraDirPred[0] = iLeftIntraDir; |
---|
2181 | uiIntraDirPred[1] = ((iLeftIntraDir + 29) % 32) + 2; |
---|
2182 | uiIntraDirPred[2] = ((iLeftIntraDir - 1 ) % 32) + 2; |
---|
2183 | } |
---|
2184 | else //non-angular |
---|
2185 | { |
---|
2186 | uiIntraDirPred[0] = PLANAR_IDX; |
---|
2187 | uiIntraDirPred[1] = DC_IDX; |
---|
2188 | uiIntraDirPred[2] = VER_IDX; |
---|
2189 | } |
---|
2190 | } |
---|
2191 | else |
---|
2192 | { |
---|
2193 | if( piMode ) |
---|
2194 | { |
---|
2195 | *piMode = 2; |
---|
2196 | } |
---|
2197 | uiIntraDirPred[0] = iLeftIntraDir; |
---|
2198 | uiIntraDirPred[1] = iAboveIntraDir; |
---|
2199 | |
---|
2200 | if (iLeftIntraDir && iAboveIntraDir ) //both modes are non-planar |
---|
2201 | { |
---|
2202 | uiIntraDirPred[2] = PLANAR_IDX; |
---|
2203 | } |
---|
2204 | else |
---|
2205 | { |
---|
2206 | uiIntraDirPred[2] = (iLeftIntraDir+iAboveIntraDir)<2? VER_IDX : DC_IDX; |
---|
2207 | } |
---|
2208 | } |
---|
2209 | |
---|
2210 | return uiPredNum; |
---|
2211 | } |
---|
2212 | |
---|
2213 | UInt TComDataCU::getCtxSplitFlag( UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2214 | { |
---|
2215 | TComDataCU* pcTempCU; |
---|
2216 | UInt uiTempPartIdx; |
---|
2217 | UInt uiCtx; |
---|
2218 | // Get left split flag |
---|
2219 | pcTempCU = getPULeft( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx ); |
---|
2220 | uiCtx = ( pcTempCU ) ? ( ( pcTempCU->getDepth( uiTempPartIdx ) > uiDepth ) ? 1 : 0 ) : 0; |
---|
2221 | |
---|
2222 | // Get above split flag |
---|
2223 | pcTempCU = getPUAbove( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx ); |
---|
2224 | uiCtx += ( pcTempCU ) ? ( ( pcTempCU->getDepth( uiTempPartIdx ) > uiDepth ) ? 1 : 0 ) : 0; |
---|
2225 | |
---|
2226 | return uiCtx; |
---|
2227 | } |
---|
2228 | |
---|
2229 | UInt TComDataCU::getCtxQtCbf( TextType eType, UInt uiTrDepth ) |
---|
2230 | { |
---|
2231 | if( eType ) |
---|
2232 | { |
---|
2233 | return uiTrDepth; |
---|
2234 | } |
---|
2235 | else |
---|
2236 | { |
---|
2237 | const UInt uiCtx = ( uiTrDepth == 0 ? 1 : 0 ); |
---|
2238 | return uiCtx; |
---|
2239 | } |
---|
2240 | } |
---|
2241 | |
---|
2242 | UInt TComDataCU::getQuadtreeTULog2MinSizeInCU( UInt absPartIdx ) |
---|
2243 | { |
---|
2244 | UInt log2CbSize = g_aucConvertToBit[getWidth( absPartIdx )] + 2; |
---|
2245 | PartSize partSize = getPartitionSize( absPartIdx ); |
---|
2246 | UInt quadtreeTUMaxDepth = getPredictionMode( absPartIdx ) == MODE_INTRA ? m_pcSlice->getSPS()->getQuadtreeTUMaxDepthIntra() : m_pcSlice->getSPS()->getQuadtreeTUMaxDepthInter(); |
---|
2247 | Int intraSplitFlag = ( getPredictionMode( absPartIdx ) == MODE_INTRA && partSize == SIZE_NxN ) ? 1 : 0; |
---|
2248 | Int interSplitFlag = ((quadtreeTUMaxDepth == 1) && (getPredictionMode( absPartIdx ) == MODE_INTER) && (partSize != SIZE_2Nx2N) ); |
---|
2249 | |
---|
2250 | UInt log2MinTUSizeInCU = 0; |
---|
2251 | if (log2CbSize < (m_pcSlice->getSPS()->getQuadtreeTULog2MinSize() + quadtreeTUMaxDepth - 1 + interSplitFlag + intraSplitFlag) ) |
---|
2252 | { |
---|
2253 | // when fully making use of signaled TUMaxDepth + inter/intraSplitFlag, resulting luma TB size is < QuadtreeTULog2MinSize |
---|
2254 | log2MinTUSizeInCU = m_pcSlice->getSPS()->getQuadtreeTULog2MinSize(); |
---|
2255 | } |
---|
2256 | else |
---|
2257 | { |
---|
2258 | // when fully making use of signaled TUMaxDepth + inter/intraSplitFlag, resulting luma TB size is still >= QuadtreeTULog2MinSize |
---|
2259 | log2MinTUSizeInCU = log2CbSize - ( quadtreeTUMaxDepth - 1 + interSplitFlag + intraSplitFlag); // stop when trafoDepth == hierarchy_depth = splitFlag |
---|
2260 | if ( log2MinTUSizeInCU > m_pcSlice->getSPS()->getQuadtreeTULog2MaxSize()) |
---|
2261 | { |
---|
2262 | // when fully making use of signaled TUMaxDepth + inter/intraSplitFlag, resulting luma TB size is still > QuadtreeTULog2MaxSize |
---|
2263 | log2MinTUSizeInCU = m_pcSlice->getSPS()->getQuadtreeTULog2MaxSize(); |
---|
2264 | } |
---|
2265 | } |
---|
2266 | return log2MinTUSizeInCU; |
---|
2267 | } |
---|
2268 | |
---|
2269 | UInt TComDataCU::getCtxSkipFlag( UInt uiAbsPartIdx ) |
---|
2270 | { |
---|
2271 | TComDataCU* pcTempCU; |
---|
2272 | UInt uiTempPartIdx; |
---|
2273 | UInt uiCtx = 0; |
---|
2274 | |
---|
2275 | // Get BCBP of left PU |
---|
2276 | pcTempCU = getPULeft( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx ); |
---|
2277 | uiCtx = ( pcTempCU ) ? pcTempCU->isSkipped( uiTempPartIdx ) : 0; |
---|
2278 | |
---|
2279 | // Get BCBP of above PU |
---|
2280 | pcTempCU = getPUAbove( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx ); |
---|
2281 | uiCtx += ( pcTempCU ) ? pcTempCU->isSkipped( uiTempPartIdx ) : 0; |
---|
2282 | |
---|
2283 | return uiCtx; |
---|
2284 | } |
---|
2285 | |
---|
2286 | #if H_3D_ARP |
---|
2287 | UInt TComDataCU::getCTXARPWFlag( UInt uiAbsPartIdx ) |
---|
2288 | { |
---|
2289 | TComDataCU* pcTempCU; |
---|
2290 | UInt uiTempPartIdx; |
---|
2291 | UInt uiCtx = 0; |
---|
2292 | |
---|
2293 | pcTempCU = getPULeft( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx ); |
---|
2294 | uiCtx = ( pcTempCU ) ? ((pcTempCU->getARPW( uiTempPartIdx )==0)?0:1) : 0; |
---|
2295 | return uiCtx; |
---|
2296 | } |
---|
2297 | #endif |
---|
2298 | #if H_3D_DBBP |
---|
2299 | Pel* TComDataCU::getVirtualDepthBlock(UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt& uiDepthStride) |
---|
2300 | { |
---|
2301 | // get coded and reconstructed depth view |
---|
2302 | TComPicYuv* depthPicYuv = NULL; |
---|
2303 | Pel* pDepthPels = NULL; |
---|
2304 | |
---|
2305 | // DBBP is a texture coding tool |
---|
2306 | if( getSlice()->getIsDepth() ) |
---|
2307 | { |
---|
2308 | return NULL; |
---|
2309 | } |
---|
2310 | |
---|
2311 | #if H_3D_FCO |
---|
2312 | TComPic* depthPic = getSlice()->getIvPic(true, getSlice()->getViewIndex() ); |
---|
2313 | |
---|
2314 | if( depthPic && depthPic->getPicYuvRec() != NULL && depthPic->getIsDepth() ) // depth first |
---|
2315 | { |
---|
2316 | depthPicYuv = depthPic->getPicYuvRec(); |
---|
2317 | depthPicYuv->extendPicBorder(); |
---|
2318 | |
---|
2319 | // get collocated depth block for current CU |
---|
2320 | uiDepthStride = depthPicYuv->getStride(); |
---|
2321 | pDepthPels = depthPicYuv->getLumaAddr( getAddr(), uiAbsPartIdx ); |
---|
2322 | } |
---|
2323 | else // texture first |
---|
2324 | #else |
---|
2325 | { |
---|
2326 | DisInfo DvInfo = getDvInfo(uiAbsPartIdx); |
---|
2327 | |
---|
2328 | TComPic* baseDepthPic = getSlice()->getIvPic (true, DvInfo.m_aVIdxCan); |
---|
2329 | |
---|
2330 | if( baseDepthPic == NULL || baseDepthPic->getPicYuvRec() == NULL ) |
---|
2331 | { |
---|
2332 | return NULL; |
---|
2333 | } |
---|
2334 | |
---|
2335 | depthPicYuv = baseDepthPic->getPicYuvRec(); |
---|
2336 | depthPicYuv->extendPicBorder(); |
---|
2337 | uiDepthStride = depthPicYuv->getStride(); |
---|
2338 | |
---|
2339 | Int iBlkX = ( getAddr() % baseDepthPic->getFrameWidthInCU() ) * g_uiMaxCUWidth + g_auiRasterToPelX[ g_auiZscanToRaster[ getZorderIdxInCU()+uiAbsPartIdx ] ]; |
---|
2340 | Int iBlkY = ( getAddr() / baseDepthPic->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ getZorderIdxInCU()+uiAbsPartIdx ] ]; |
---|
2341 | |
---|
2342 | Int iPictureWidth = depthPicYuv->getWidth(); |
---|
2343 | Int iPictureHeight = depthPicYuv->getHeight(); |
---|
2344 | |
---|
2345 | Int iWidth = uiWidth; |
---|
2346 | Int iHeight = uiHeight; |
---|
2347 | |
---|
2348 | Bool depthRefineFlag = false; |
---|
2349 | #if H_3D_NBDV_REF |
---|
2350 | depthRefineFlag = m_pcSlice->getVPS()->getDepthRefinementFlag( m_pcSlice->getLayerIdInVps() ); |
---|
2351 | #endif // H_3D_NBDV_REF |
---|
2352 | |
---|
2353 | TComMv cDv = depthRefineFlag ? DvInfo.m_acDoNBDV : DvInfo.m_acNBDV; |
---|
2354 | |
---|
2355 | Int depthPosX = Clip3(0, iPictureWidth - iWidth, iBlkX + ((cDv.getHor()+2)>>2)); |
---|
2356 | Int depthPosY = Clip3(0, iPictureHeight- iHeight, iBlkY + ((cDv.getVer()+2)>>2)); |
---|
2357 | |
---|
2358 | pDepthPels = depthPicYuv->getLumaAddr() + depthPosX + depthPosY * uiDepthStride; |
---|
2359 | } |
---|
2360 | #endif |
---|
2361 | |
---|
2362 | AOF( depthPicYuv != NULL ); |
---|
2363 | AOF( pDepthPels != NULL ); |
---|
2364 | AOF( uiDepthStride != 0 ); |
---|
2365 | |
---|
2366 | return pDepthPels; |
---|
2367 | } |
---|
2368 | #endif |
---|
2369 | |
---|
2370 | #if H_3D_DBBP |
---|
2371 | Void TComDataCU::setDBBPFlagSubParts ( Bool bDBBPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) |
---|
2372 | { |
---|
2373 | setSubPart( bDBBPFlag, m_pbDBBPFlag, uiAbsPartIdx, uiDepth, uiPartIdx ); |
---|
2374 | } |
---|
2375 | #endif |
---|
2376 | |
---|
2377 | #if H_3D_DIM_SDC |
---|
2378 | UInt TComDataCU::getCtxSDCFlag( UInt uiAbsPartIdx ) |
---|
2379 | { |
---|
2380 | return 0; |
---|
2381 | } |
---|
2382 | |
---|
2383 | UInt TComDataCU::getCtxAngleFlag( UInt uiAbsPartIdx ) |
---|
2384 | { |
---|
2385 | #if LGE_SIMP_DIM_NOT_PRESENT_FLAG_CODING_H0119_H0135 |
---|
2386 | return 0; |
---|
2387 | #else |
---|
2388 | TComDataCU* pcTempCU; |
---|
2389 | UInt uiTempPartIdx; |
---|
2390 | UInt uiCtx = 0; |
---|
2391 | |
---|
2392 | // Get BCBP of left PU |
---|
2393 | pcTempCU = getPULeft( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx ); |
---|
2394 | uiCtx = ( pcTempCU && pcTempCU->isIntra( uiTempPartIdx ) ) ? ( pcTempCU->getLumaIntraDir( uiTempPartIdx ) < NUM_INTRA_MODE ? 1 : 0 ) : 0; |
---|
2395 | |
---|
2396 | // Get BCBP of above PU |
---|
2397 | pcTempCU = getPUAbove( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx ); |
---|
2398 | uiCtx += ( pcTempCU && pcTempCU->isIntra( uiTempPartIdx ) ) ? ( pcTempCU->getLumaIntraDir( uiTempPartIdx ) < NUM_INTRA_MODE ? 1 : 0 ) : 0; |
---|
2399 | |
---|
2400 | return uiCtx; |
---|
2401 | #endif |
---|
2402 | } |
---|
2403 | #endif |
---|
2404 | |
---|
2405 | UInt TComDataCU::getCtxInterDir( UInt uiAbsPartIdx ) |
---|
2406 | { |
---|
2407 | return getDepth( uiAbsPartIdx ); |
---|
2408 | } |
---|
2409 | |
---|
2410 | Void TComDataCU::setCbfSubParts( UInt uiCbfY, UInt uiCbfU, UInt uiCbfV, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2411 | { |
---|
2412 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
2413 | memset( m_puhCbf[0] + uiAbsPartIdx, uiCbfY, sizeof( UChar ) * uiCurrPartNumb ); |
---|
2414 | memset( m_puhCbf[1] + uiAbsPartIdx, uiCbfU, sizeof( UChar ) * uiCurrPartNumb ); |
---|
2415 | memset( m_puhCbf[2] + uiAbsPartIdx, uiCbfV, sizeof( UChar ) * uiCurrPartNumb ); |
---|
2416 | } |
---|
2417 | |
---|
2418 | Void TComDataCU::setCbfSubParts( UInt uiCbf, TextType eTType, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2419 | { |
---|
2420 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
2421 | memset( m_puhCbf[g_aucConvertTxtTypeToIdx[eTType]] + uiAbsPartIdx, uiCbf, sizeof( UChar ) * uiCurrPartNumb ); |
---|
2422 | } |
---|
2423 | |
---|
2424 | /** Sets a coded block flag for all sub-partitions of a partition |
---|
2425 | * \param uiCbf The value of the coded block flag to be set |
---|
2426 | * \param eTType |
---|
2427 | * \param uiAbsPartIdx |
---|
2428 | * \param uiPartIdx |
---|
2429 | * \param uiDepth |
---|
2430 | * \returns Void |
---|
2431 | */ |
---|
2432 | Void TComDataCU::setCbfSubParts ( UInt uiCbf, TextType eTType, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) |
---|
2433 | { |
---|
2434 | setSubPart<UChar>( uiCbf, m_puhCbf[g_aucConvertTxtTypeToIdx[eTType]], uiAbsPartIdx, uiDepth, uiPartIdx ); |
---|
2435 | } |
---|
2436 | |
---|
2437 | Void TComDataCU::setDepthSubParts( UInt uiDepth, UInt uiAbsPartIdx ) |
---|
2438 | { |
---|
2439 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
2440 | memset( m_puhDepth + uiAbsPartIdx, uiDepth, sizeof(UChar)*uiCurrPartNumb ); |
---|
2441 | } |
---|
2442 | |
---|
2443 | Bool TComDataCU::isFirstAbsZorderIdxInDepth (UInt uiAbsPartIdx, UInt uiDepth) |
---|
2444 | { |
---|
2445 | UInt uiPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
2446 | return (((m_uiAbsIdxInLCU + uiAbsPartIdx)% uiPartNumb) == 0); |
---|
2447 | } |
---|
2448 | |
---|
2449 | Void TComDataCU::setPartSizeSubParts( PartSize eMode, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2450 | { |
---|
2451 | assert( sizeof( *m_pePartSize) == 1 ); |
---|
2452 | memset( m_pePartSize + uiAbsPartIdx, eMode, m_pcPic->getNumPartInCU() >> ( 2 * uiDepth ) ); |
---|
2453 | } |
---|
2454 | |
---|
2455 | Void TComDataCU::setCUTransquantBypassSubParts( Bool flag, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2456 | { |
---|
2457 | memset( m_CUTransquantBypass + uiAbsPartIdx, flag, m_pcPic->getNumPartInCU() >> ( 2 * uiDepth ) ); |
---|
2458 | } |
---|
2459 | |
---|
2460 | Void TComDataCU::setSkipFlagSubParts( Bool skip, UInt absPartIdx, UInt depth ) |
---|
2461 | { |
---|
2462 | assert( sizeof( *m_skipFlag) == 1 ); |
---|
2463 | memset( m_skipFlag + absPartIdx, skip, m_pcPic->getNumPartInCU() >> ( 2 * depth ) ); |
---|
2464 | } |
---|
2465 | |
---|
2466 | Void TComDataCU::setPredModeSubParts( PredMode eMode, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2467 | { |
---|
2468 | assert( sizeof( *m_pePredMode) == 1 ); |
---|
2469 | memset( m_pePredMode + uiAbsPartIdx, eMode, m_pcPic->getNumPartInCU() >> ( 2 * uiDepth ) ); |
---|
2470 | } |
---|
2471 | |
---|
2472 | Void TComDataCU::setQPSubCUs( Int qp, TComDataCU* pcCU, UInt absPartIdx, UInt depth, Bool &foundNonZeroCbf ) |
---|
2473 | { |
---|
2474 | UInt currPartNumb = m_pcPic->getNumPartInCU() >> (depth << 1); |
---|
2475 | UInt currPartNumQ = currPartNumb >> 2; |
---|
2476 | |
---|
2477 | if(!foundNonZeroCbf) |
---|
2478 | { |
---|
2479 | if(pcCU->getDepth(absPartIdx) > depth) |
---|
2480 | { |
---|
2481 | for ( UInt partUnitIdx = 0; partUnitIdx < 4; partUnitIdx++ ) |
---|
2482 | { |
---|
2483 | pcCU->setQPSubCUs( qp, pcCU, absPartIdx+partUnitIdx*currPartNumQ, depth+1, foundNonZeroCbf ); |
---|
2484 | } |
---|
2485 | } |
---|
2486 | else |
---|
2487 | { |
---|
2488 | if(pcCU->getCbf( absPartIdx, TEXT_LUMA ) || pcCU->getCbf( absPartIdx, TEXT_CHROMA_U ) || pcCU->getCbf( absPartIdx, TEXT_CHROMA_V ) ) |
---|
2489 | { |
---|
2490 | foundNonZeroCbf = true; |
---|
2491 | } |
---|
2492 | else |
---|
2493 | { |
---|
2494 | setQPSubParts(qp, absPartIdx, depth); |
---|
2495 | } |
---|
2496 | } |
---|
2497 | } |
---|
2498 | } |
---|
2499 | |
---|
2500 | Void TComDataCU::setQPSubParts( Int qp, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2501 | { |
---|
2502 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
2503 | TComSlice * pcSlice = getPic()->getSlice(getPic()->getCurrSliceIdx()); |
---|
2504 | |
---|
2505 | for(UInt uiSCUIdx = uiAbsPartIdx; uiSCUIdx < uiAbsPartIdx+uiCurrPartNumb; uiSCUIdx++) |
---|
2506 | { |
---|
2507 | if( m_pcPic->getCU( getAddr() )->getSliceSegmentStartCU(uiSCUIdx+getZorderIdxInCU()) == pcSlice->getSliceSegmentCurStartCUAddr() ) |
---|
2508 | { |
---|
2509 | m_phQP[uiSCUIdx] = qp; |
---|
2510 | } |
---|
2511 | } |
---|
2512 | } |
---|
2513 | |
---|
2514 | Void TComDataCU::setLumaIntraDirSubParts( UInt uiDir, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2515 | { |
---|
2516 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
2517 | |
---|
2518 | memset( m_puhLumaIntraDir + uiAbsPartIdx, uiDir, sizeof(UChar)*uiCurrPartNumb ); |
---|
2519 | } |
---|
2520 | |
---|
2521 | template<typename T> |
---|
2522 | Void TComDataCU::setSubPart( T uiParameter, T* puhBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx ) |
---|
2523 | { |
---|
2524 | assert( sizeof(T) == 1 ); // Using memset() works only for types of size 1 |
---|
2525 | |
---|
2526 | UInt uiCurrPartNumQ = (m_pcPic->getNumPartInCU() >> (2 * uiCUDepth)) >> 2; |
---|
2527 | switch ( m_pePartSize[ uiCUAddr ] ) |
---|
2528 | { |
---|
2529 | case SIZE_2Nx2N: |
---|
2530 | memset( puhBaseLCU + uiCUAddr, uiParameter, 4 * uiCurrPartNumQ ); |
---|
2531 | break; |
---|
2532 | case SIZE_2NxN: |
---|
2533 | memset( puhBaseLCU + uiCUAddr, uiParameter, 2 * uiCurrPartNumQ ); |
---|
2534 | break; |
---|
2535 | case SIZE_Nx2N: |
---|
2536 | memset( puhBaseLCU + uiCUAddr, uiParameter, uiCurrPartNumQ ); |
---|
2537 | memset( puhBaseLCU + uiCUAddr + 2 * uiCurrPartNumQ, uiParameter, uiCurrPartNumQ ); |
---|
2538 | break; |
---|
2539 | case SIZE_NxN: |
---|
2540 | memset( puhBaseLCU + uiCUAddr, uiParameter, uiCurrPartNumQ ); |
---|
2541 | break; |
---|
2542 | case SIZE_2NxnU: |
---|
2543 | if ( uiPUIdx == 0 ) |
---|
2544 | { |
---|
2545 | memset( puhBaseLCU + uiCUAddr, uiParameter, (uiCurrPartNumQ >> 1) ); |
---|
2546 | memset( puhBaseLCU + uiCUAddr + uiCurrPartNumQ, uiParameter, (uiCurrPartNumQ >> 1) ); |
---|
2547 | } |
---|
2548 | else if ( uiPUIdx == 1 ) |
---|
2549 | { |
---|
2550 | memset( puhBaseLCU + uiCUAddr, uiParameter, (uiCurrPartNumQ >> 1) ); |
---|
2551 | memset( puhBaseLCU + uiCUAddr + uiCurrPartNumQ, uiParameter, ((uiCurrPartNumQ >> 1) + (uiCurrPartNumQ << 1)) ); |
---|
2552 | } |
---|
2553 | else |
---|
2554 | { |
---|
2555 | assert(0); |
---|
2556 | } |
---|
2557 | break; |
---|
2558 | case SIZE_2NxnD: |
---|
2559 | if ( uiPUIdx == 0 ) |
---|
2560 | { |
---|
2561 | memset( puhBaseLCU + uiCUAddr, uiParameter, ((uiCurrPartNumQ << 1) + (uiCurrPartNumQ >> 1)) ); |
---|
2562 | memset( puhBaseLCU + uiCUAddr + (uiCurrPartNumQ << 1) + uiCurrPartNumQ, uiParameter, (uiCurrPartNumQ >> 1) ); |
---|
2563 | } |
---|
2564 | else if ( uiPUIdx == 1 ) |
---|
2565 | { |
---|
2566 | memset( puhBaseLCU + uiCUAddr, uiParameter, (uiCurrPartNumQ >> 1) ); |
---|
2567 | memset( puhBaseLCU + uiCUAddr + uiCurrPartNumQ, uiParameter, (uiCurrPartNumQ >> 1) ); |
---|
2568 | } |
---|
2569 | else |
---|
2570 | { |
---|
2571 | assert(0); |
---|
2572 | } |
---|
2573 | break; |
---|
2574 | case SIZE_nLx2N: |
---|
2575 | if ( uiPUIdx == 0 ) |
---|
2576 | { |
---|
2577 | memset( puhBaseLCU + uiCUAddr, uiParameter, (uiCurrPartNumQ >> 2) ); |
---|
2578 | memset( puhBaseLCU + uiCUAddr + (uiCurrPartNumQ >> 1), uiParameter, (uiCurrPartNumQ >> 2) ); |
---|
2579 | memset( puhBaseLCU + uiCUAddr + (uiCurrPartNumQ << 1), uiParameter, (uiCurrPartNumQ >> 2) ); |
---|
2580 | memset( puhBaseLCU + uiCUAddr + (uiCurrPartNumQ << 1) + (uiCurrPartNumQ >> 1), uiParameter, (uiCurrPartNumQ >> 2) ); |
---|
2581 | } |
---|
2582 | else if ( uiPUIdx == 1 ) |
---|
2583 | { |
---|
2584 | memset( puhBaseLCU + uiCUAddr, uiParameter, (uiCurrPartNumQ >> 2) ); |
---|
2585 | memset( puhBaseLCU + uiCUAddr + (uiCurrPartNumQ >> 1), uiParameter, (uiCurrPartNumQ + (uiCurrPartNumQ >> 2)) ); |
---|
2586 | memset( puhBaseLCU + uiCUAddr + (uiCurrPartNumQ << 1), uiParameter, (uiCurrPartNumQ >> 2) ); |
---|
2587 | memset( puhBaseLCU + uiCUAddr + (uiCurrPartNumQ << 1) + (uiCurrPartNumQ >> 1), uiParameter, (uiCurrPartNumQ + (uiCurrPartNumQ >> 2)) ); |
---|
2588 | } |
---|
2589 | else |
---|
2590 | { |
---|
2591 | assert(0); |
---|
2592 | } |
---|
2593 | break; |
---|
2594 | case SIZE_nRx2N: |
---|
2595 | if ( uiPUIdx == 0 ) |
---|
2596 | { |
---|
2597 | memset( puhBaseLCU + uiCUAddr, uiParameter, (uiCurrPartNumQ + (uiCurrPartNumQ >> 2)) ); |
---|
2598 | memset( puhBaseLCU + uiCUAddr + uiCurrPartNumQ + (uiCurrPartNumQ >> 1), uiParameter, (uiCurrPartNumQ >> 2) ); |
---|
2599 | memset( puhBaseLCU + uiCUAddr + (uiCurrPartNumQ << 1), uiParameter, (uiCurrPartNumQ + (uiCurrPartNumQ >> 2)) ); |
---|
2600 | memset( puhBaseLCU + uiCUAddr + (uiCurrPartNumQ << 1) + uiCurrPartNumQ + (uiCurrPartNumQ >> 1), uiParameter, (uiCurrPartNumQ >> 2) ); |
---|
2601 | } |
---|
2602 | else if ( uiPUIdx == 1 ) |
---|
2603 | { |
---|
2604 | memset( puhBaseLCU + uiCUAddr, uiParameter, (uiCurrPartNumQ >> 2) ); |
---|
2605 | memset( puhBaseLCU + uiCUAddr + (uiCurrPartNumQ >> 1), uiParameter, (uiCurrPartNumQ >> 2) ); |
---|
2606 | memset( puhBaseLCU + uiCUAddr + (uiCurrPartNumQ << 1), uiParameter, (uiCurrPartNumQ >> 2) ); |
---|
2607 | memset( puhBaseLCU + uiCUAddr + (uiCurrPartNumQ << 1) + (uiCurrPartNumQ >> 1), uiParameter, (uiCurrPartNumQ >> 2) ); |
---|
2608 | } |
---|
2609 | else |
---|
2610 | { |
---|
2611 | assert(0); |
---|
2612 | } |
---|
2613 | break; |
---|
2614 | default: |
---|
2615 | assert( 0 ); |
---|
2616 | } |
---|
2617 | } |
---|
2618 | |
---|
2619 | #if H_3D_DIM_SDC |
---|
2620 | Void TComDataCU::setSDCFlagSubParts ( Bool bSDCFlag, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2621 | { |
---|
2622 | assert( sizeof( *m_pbSDCFlag) == 1 ); |
---|
2623 | memset( m_pbSDCFlag + uiAbsPartIdx, bSDCFlag, m_pcPic->getNumPartInCU() >> ( 2 * uiDepth ) ); |
---|
2624 | } |
---|
2625 | |
---|
2626 | Bool TComDataCU::getSDCAvailable( UInt uiAbsPartIdx ) |
---|
2627 | { |
---|
2628 | // check general CU information |
---|
2629 | if( !getSlice()->getIsDepth() || !isIntra(uiAbsPartIdx) || getPartitionSize(uiAbsPartIdx) != SIZE_2Nx2N ) |
---|
2630 | { |
---|
2631 | return false; |
---|
2632 | } |
---|
2633 | |
---|
2634 | if( isDimMode( getLumaIntraDir( uiAbsPartIdx ) ) && !isDimDeltaDC( getLumaIntraDir( uiAbsPartIdx ) ) ) |
---|
2635 | { |
---|
2636 | return true; |
---|
2637 | } |
---|
2638 | |
---|
2639 | if( getLumaIntraDir( uiAbsPartIdx ) < NUM_INTRA_MODE ) |
---|
2640 | { |
---|
2641 | return true; |
---|
2642 | } |
---|
2643 | |
---|
2644 | return false; |
---|
2645 | // check prediction mode |
---|
2646 | UInt uiLumaPredMode = getLumaIntraDir( uiAbsPartIdx ); |
---|
2647 | if( uiLumaPredMode == PLANAR_IDX || ( getDimType( uiLumaPredMode ) == DMM1_IDX && !isDimDeltaDC( uiLumaPredMode ) ) ) |
---|
2648 | return true; |
---|
2649 | |
---|
2650 | // else |
---|
2651 | return false; |
---|
2652 | } |
---|
2653 | #endif |
---|
2654 | Void TComDataCU::setMergeFlagSubParts ( Bool bMergeFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) |
---|
2655 | { |
---|
2656 | setSubPart( bMergeFlag, m_pbMergeFlag, uiAbsPartIdx, uiDepth, uiPartIdx ); |
---|
2657 | } |
---|
2658 | |
---|
2659 | Void TComDataCU::setMergeIndexSubParts ( UInt uiMergeIndex, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) |
---|
2660 | { |
---|
2661 | setSubPart<UChar>( uiMergeIndex, m_puhMergeIndex, uiAbsPartIdx, uiDepth, uiPartIdx ); |
---|
2662 | } |
---|
2663 | |
---|
2664 | #if H_3D_SPIVMP |
---|
2665 | Void TComDataCU::setSPIVMPFlagSubParts( Bool bSPIVMPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) |
---|
2666 | { |
---|
2667 | setSubPart<Bool>( bSPIVMPFlag, m_pbSPIVMPFlag, uiAbsPartIdx, uiDepth, uiPartIdx ); |
---|
2668 | } |
---|
2669 | #endif |
---|
2670 | |
---|
2671 | #if H_3D_VSP |
---|
2672 | Void TComDataCU::setVSPFlagSubParts( Char iVSPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) |
---|
2673 | { |
---|
2674 | setSubPart<Char>( iVSPFlag, m_piVSPFlag, uiAbsPartIdx, uiDepth, uiPartIdx ); |
---|
2675 | } |
---|
2676 | #if H_3D_VSP |
---|
2677 | template<typename T> |
---|
2678 | Void TComDataCU::setSubPartT( T uiParameter, T* puhBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx ) |
---|
2679 | { |
---|
2680 | UInt uiCurrPartNumQ = (m_pcPic->getNumPartInCU() >> (2 * uiCUDepth)) >> 2; |
---|
2681 | switch ( m_pePartSize[ uiCUAddr ] ) |
---|
2682 | { |
---|
2683 | case SIZE_2Nx2N: |
---|
2684 | for (UInt ui = 0; ui < 4 * uiCurrPartNumQ; ui++) |
---|
2685 | puhBaseLCU[uiCUAddr + ui] = uiParameter; |
---|
2686 | |
---|
2687 | break; |
---|
2688 | case SIZE_2NxN: |
---|
2689 | for (UInt ui = 0; ui < 2 * uiCurrPartNumQ; ui++) |
---|
2690 | puhBaseLCU[uiCUAddr + ui] = uiParameter; |
---|
2691 | break; |
---|
2692 | case SIZE_Nx2N: |
---|
2693 | for (UInt ui = 0; ui < uiCurrPartNumQ; ui++) |
---|
2694 | puhBaseLCU[uiCUAddr + ui] = uiParameter; |
---|
2695 | for (UInt ui = 0; ui < uiCurrPartNumQ; ui++) |
---|
2696 | puhBaseLCU[uiCUAddr + 2 * uiCurrPartNumQ + ui] = uiParameter; |
---|
2697 | break; |
---|
2698 | case SIZE_NxN: |
---|
2699 | for (UInt ui = 0; ui < uiCurrPartNumQ; ui++) |
---|
2700 | puhBaseLCU[uiCUAddr + ui] = uiParameter; |
---|
2701 | break; |
---|
2702 | case SIZE_2NxnU: |
---|
2703 | if ( uiPUIdx == 0 ) |
---|
2704 | { |
---|
2705 | for (UInt ui = 0; ui < (uiCurrPartNumQ >> 1); ui++) |
---|
2706 | puhBaseLCU[uiCUAddr + ui] = uiParameter; |
---|
2707 | for (UInt ui = 0; ui < (uiCurrPartNumQ >> 1); ui++) |
---|
2708 | puhBaseLCU[uiCUAddr + uiCurrPartNumQ + ui] = uiParameter; |
---|
2709 | |
---|
2710 | } |
---|
2711 | else if ( uiPUIdx == 1 ) |
---|
2712 | { |
---|
2713 | for (UInt ui = 0; ui < (uiCurrPartNumQ >> 1); ui++) |
---|
2714 | puhBaseLCU[uiCUAddr + ui] = uiParameter; |
---|
2715 | for (UInt ui = 0; ui < (uiCurrPartNumQ >> 1) + (uiCurrPartNumQ << 1); ui++) |
---|
2716 | puhBaseLCU[uiCUAddr + uiCurrPartNumQ + ui] = uiParameter; |
---|
2717 | |
---|
2718 | } |
---|
2719 | else |
---|
2720 | { |
---|
2721 | assert(0); |
---|
2722 | } |
---|
2723 | break; |
---|
2724 | case SIZE_2NxnD: |
---|
2725 | if ( uiPUIdx == 0 ) |
---|
2726 | { |
---|
2727 | for (UInt ui = 0; ui < ((uiCurrPartNumQ << 1) + (uiCurrPartNumQ >> 1)); ui++) |
---|
2728 | puhBaseLCU[uiCUAddr + ui] = uiParameter; |
---|
2729 | for (UInt ui = 0; ui < (uiCurrPartNumQ >> 1); ui++) |
---|
2730 | puhBaseLCU[uiCUAddr + (uiCurrPartNumQ << 1) + uiCurrPartNumQ + ui] = uiParameter; |
---|
2731 | |
---|
2732 | } |
---|
2733 | else if ( uiPUIdx == 1 ) |
---|
2734 | { |
---|
2735 | for (UInt ui = 0; ui < (uiCurrPartNumQ >> 1); ui++) |
---|
2736 | puhBaseLCU[uiCUAddr + ui] = uiParameter; |
---|
2737 | for (UInt ui = 0; ui < (uiCurrPartNumQ >> 1); ui++) |
---|
2738 | puhBaseLCU[uiCUAddr + uiCurrPartNumQ + ui] = uiParameter; |
---|
2739 | |
---|
2740 | } |
---|
2741 | else |
---|
2742 | { |
---|
2743 | assert(0); |
---|
2744 | } |
---|
2745 | break; |
---|
2746 | case SIZE_nLx2N: |
---|
2747 | if ( uiPUIdx == 0 ) |
---|
2748 | { |
---|
2749 | for (UInt ui = 0; ui < (uiCurrPartNumQ >> 2); ui++) |
---|
2750 | puhBaseLCU[uiCUAddr + ui] = uiParameter; |
---|
2751 | for (UInt ui = 0; ui < (uiCurrPartNumQ >> 2); ui++) |
---|
2752 | puhBaseLCU[uiCUAddr + (uiCurrPartNumQ >> 1) + ui] = uiParameter; |
---|
2753 | for (UInt ui = 0; ui < (uiCurrPartNumQ >> 2); ui++) |
---|
2754 | puhBaseLCU[uiCUAddr + (uiCurrPartNumQ << 1) + ui] = uiParameter; |
---|
2755 | for (UInt ui = 0; ui < (uiCurrPartNumQ >> 2); ui++) |
---|
2756 | puhBaseLCU[uiCUAddr + (uiCurrPartNumQ << 1) + (uiCurrPartNumQ >> 1) + ui] = uiParameter; |
---|
2757 | |
---|
2758 | } |
---|
2759 | else if ( uiPUIdx == 1 ) |
---|
2760 | { |
---|
2761 | for (UInt ui = 0; ui < (uiCurrPartNumQ >> 2); ui++) |
---|
2762 | puhBaseLCU[uiCUAddr + ui] = uiParameter; |
---|
2763 | for (UInt ui = 0; ui < (uiCurrPartNumQ + (uiCurrPartNumQ >> 2)); ui++) |
---|
2764 | puhBaseLCU[uiCUAddr + (uiCurrPartNumQ >> 1) + ui] = uiParameter; |
---|
2765 | for (UInt ui = 0; ui < (uiCurrPartNumQ >> 2); ui++) |
---|
2766 | puhBaseLCU[uiCUAddr + (uiCurrPartNumQ << 1) + ui] = uiParameter; |
---|
2767 | for (UInt ui = 0; ui < (uiCurrPartNumQ + (uiCurrPartNumQ >> 2)); ui++) |
---|
2768 | puhBaseLCU[uiCUAddr + (uiCurrPartNumQ << 1) + (uiCurrPartNumQ >> 1) + ui] = uiParameter; |
---|
2769 | |
---|
2770 | } |
---|
2771 | else |
---|
2772 | { |
---|
2773 | assert(0); |
---|
2774 | } |
---|
2775 | break; |
---|
2776 | case SIZE_nRx2N: |
---|
2777 | if ( uiPUIdx == 0 ) |
---|
2778 | { |
---|
2779 | for (UInt ui = 0; ui < (uiCurrPartNumQ + (uiCurrPartNumQ >> 2)); ui++) |
---|
2780 | puhBaseLCU[uiCUAddr + ui] = uiParameter; |
---|
2781 | for (UInt ui = 0; ui < (uiCurrPartNumQ >> 2); ui++) |
---|
2782 | puhBaseLCU[uiCUAddr + uiCurrPartNumQ + (uiCurrPartNumQ >> 1) + ui] = uiParameter; |
---|
2783 | for (UInt ui = 0; ui < (uiCurrPartNumQ + (uiCurrPartNumQ >> 2)); ui++) |
---|
2784 | puhBaseLCU[uiCUAddr + (uiCurrPartNumQ << 1) + ui] = uiParameter; |
---|
2785 | for (UInt ui = 0; ui < (uiCurrPartNumQ >> 2); ui++) |
---|
2786 | puhBaseLCU[uiCUAddr + (uiCurrPartNumQ << 1) + uiCurrPartNumQ + (uiCurrPartNumQ >> 1) + ui] = uiParameter; |
---|
2787 | |
---|
2788 | } |
---|
2789 | else if ( uiPUIdx == 1 ) |
---|
2790 | { |
---|
2791 | for (UInt ui = 0; ui < (uiCurrPartNumQ >> 2); ui++) |
---|
2792 | puhBaseLCU[uiCUAddr + ui] = uiParameter; |
---|
2793 | for (UInt ui = 0; ui < (uiCurrPartNumQ >> 2); ui++) |
---|
2794 | puhBaseLCU[uiCUAddr + (uiCurrPartNumQ >> 1) + ui] = uiParameter; |
---|
2795 | for (UInt ui = 0; ui < (uiCurrPartNumQ >> 2); ui++) |
---|
2796 | puhBaseLCU[uiCUAddr + (uiCurrPartNumQ << 1) + ui] = uiParameter; |
---|
2797 | for (UInt ui = 0; ui < (uiCurrPartNumQ >> 2); ui++) |
---|
2798 | puhBaseLCU[uiCUAddr + (uiCurrPartNumQ << 1) + (uiCurrPartNumQ >> 1) + ui] = uiParameter; |
---|
2799 | |
---|
2800 | } |
---|
2801 | else |
---|
2802 | { |
---|
2803 | assert(0); |
---|
2804 | } |
---|
2805 | break; |
---|
2806 | default: |
---|
2807 | assert( 0 ); |
---|
2808 | } |
---|
2809 | |
---|
2810 | } |
---|
2811 | #endif |
---|
2812 | #endif |
---|
2813 | Void TComDataCU::setChromIntraDirSubParts( UInt uiDir, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2814 | { |
---|
2815 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
2816 | |
---|
2817 | memset( m_puhChromaIntraDir + uiAbsPartIdx, uiDir, sizeof(UChar)*uiCurrPartNumb ); |
---|
2818 | } |
---|
2819 | |
---|
2820 | Void TComDataCU::setInterDirSubParts( UInt uiDir, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) |
---|
2821 | { |
---|
2822 | setSubPart<UChar>( uiDir, m_puhInterDir, uiAbsPartIdx, uiDepth, uiPartIdx ); |
---|
2823 | } |
---|
2824 | |
---|
2825 | Void TComDataCU::setMVPIdxSubParts( Int iMVPIdx, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) |
---|
2826 | { |
---|
2827 | setSubPart<Char>( iMVPIdx, m_apiMVPIdx[eRefPicList], uiAbsPartIdx, uiDepth, uiPartIdx ); |
---|
2828 | } |
---|
2829 | |
---|
2830 | Void TComDataCU::setMVPNumSubParts( Int iMVPNum, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) |
---|
2831 | { |
---|
2832 | setSubPart<Char>( iMVPNum, m_apiMVPNum[eRefPicList], uiAbsPartIdx, uiDepth, uiPartIdx ); |
---|
2833 | } |
---|
2834 | |
---|
2835 | |
---|
2836 | Void TComDataCU::setTrIdxSubParts( UInt uiTrIdx, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2837 | { |
---|
2838 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
2839 | |
---|
2840 | memset( m_puhTrIdx + uiAbsPartIdx, uiTrIdx, sizeof(UChar)*uiCurrPartNumb ); |
---|
2841 | } |
---|
2842 | |
---|
2843 | Void TComDataCU::setTransformSkipSubParts( UInt useTransformSkipY, UInt useTransformSkipU, UInt useTransformSkipV, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2844 | { |
---|
2845 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
2846 | |
---|
2847 | memset( m_puhTransformSkip[0] + uiAbsPartIdx, useTransformSkipY, sizeof( UChar ) * uiCurrPartNumb ); |
---|
2848 | memset( m_puhTransformSkip[1] + uiAbsPartIdx, useTransformSkipU, sizeof( UChar ) * uiCurrPartNumb ); |
---|
2849 | memset( m_puhTransformSkip[2] + uiAbsPartIdx, useTransformSkipV, sizeof( UChar ) * uiCurrPartNumb ); |
---|
2850 | } |
---|
2851 | |
---|
2852 | Void TComDataCU::setTransformSkipSubParts( UInt useTransformSkip, TextType eType, UInt uiAbsPartIdx, UInt uiDepth) |
---|
2853 | { |
---|
2854 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
2855 | |
---|
2856 | memset( m_puhTransformSkip[g_aucConvertTxtTypeToIdx[eType]] + uiAbsPartIdx, useTransformSkip, sizeof( UChar ) * uiCurrPartNumb ); |
---|
2857 | } |
---|
2858 | |
---|
2859 | Void TComDataCU::setSizeSubParts( UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2860 | { |
---|
2861 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
2862 | |
---|
2863 | memset( m_puhWidth + uiAbsPartIdx, uiWidth, sizeof(UChar)*uiCurrPartNumb ); |
---|
2864 | memset( m_puhHeight + uiAbsPartIdx, uiHeight, sizeof(UChar)*uiCurrPartNumb ); |
---|
2865 | } |
---|
2866 | |
---|
2867 | UChar TComDataCU::getNumPartInter() |
---|
2868 | { |
---|
2869 | UChar iNumPart = 0; |
---|
2870 | |
---|
2871 | switch ( m_pePartSize[0] ) |
---|
2872 | { |
---|
2873 | case SIZE_2Nx2N: iNumPart = 1; break; |
---|
2874 | case SIZE_2NxN: iNumPart = 2; break; |
---|
2875 | case SIZE_Nx2N: iNumPart = 2; break; |
---|
2876 | case SIZE_NxN: iNumPart = 4; break; |
---|
2877 | case SIZE_2NxnU: iNumPart = 2; break; |
---|
2878 | case SIZE_2NxnD: iNumPart = 2; break; |
---|
2879 | case SIZE_nLx2N: iNumPart = 2; break; |
---|
2880 | case SIZE_nRx2N: iNumPart = 2; break; |
---|
2881 | default: assert (0); break; |
---|
2882 | } |
---|
2883 | |
---|
2884 | return iNumPart; |
---|
2885 | } |
---|
2886 | |
---|
2887 | #if H_3D_IC |
---|
2888 | Void TComDataCU::getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx, Bool bLCU) |
---|
2889 | { |
---|
2890 | UInt uiNumPartition = bLCU ? (getWidth(uiAbsPartIdx)*getHeight(uiAbsPartIdx) >> 4) : m_uiNumPartition; |
---|
2891 | UInt uiTmpAbsPartIdx = bLCU ? uiAbsPartIdx : 0; |
---|
2892 | |
---|
2893 | switch ( m_pePartSize[uiTmpAbsPartIdx] ) |
---|
2894 | { |
---|
2895 | case SIZE_2NxN: |
---|
2896 | riWidth = getWidth( uiTmpAbsPartIdx ); riHeight = getHeight( uiTmpAbsPartIdx ) >> 1; ruiPartAddr = ( uiPartIdx == 0 )? 0 : uiNumPartition >> 1; |
---|
2897 | break; |
---|
2898 | case SIZE_Nx2N: |
---|
2899 | riWidth = getWidth( uiTmpAbsPartIdx ) >> 1; riHeight = getHeight( uiTmpAbsPartIdx ); ruiPartAddr = ( uiPartIdx == 0 )? 0 : uiNumPartition >> 2; |
---|
2900 | break; |
---|
2901 | case SIZE_NxN: |
---|
2902 | riWidth = getWidth( uiTmpAbsPartIdx ) >> 1; riHeight = getHeight( uiTmpAbsPartIdx ) >> 1; ruiPartAddr = ( uiNumPartition >> 2 ) * uiPartIdx; |
---|
2903 | break; |
---|
2904 | case SIZE_2NxnU: |
---|
2905 | riWidth = getWidth( uiTmpAbsPartIdx ); |
---|
2906 | riHeight = ( uiPartIdx == 0 ) ? getHeight( uiTmpAbsPartIdx ) >> 2 : ( getHeight( uiTmpAbsPartIdx ) >> 2 ) + ( getHeight( uiTmpAbsPartIdx ) >> 1 ); |
---|
2907 | ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : uiNumPartition >> 3; |
---|
2908 | break; |
---|
2909 | case SIZE_2NxnD: |
---|
2910 | riWidth = getWidth( uiTmpAbsPartIdx ); |
---|
2911 | riHeight = ( uiPartIdx == 0 ) ? ( getHeight( uiTmpAbsPartIdx ) >> 2 ) + ( getHeight( uiTmpAbsPartIdx ) >> 1 ) : getHeight( uiTmpAbsPartIdx ) >> 2; |
---|
2912 | ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : (uiNumPartition >> 1) + (uiNumPartition >> 3); |
---|
2913 | break; |
---|
2914 | case SIZE_nLx2N: |
---|
2915 | riWidth = ( uiPartIdx == 0 ) ? getWidth( uiTmpAbsPartIdx ) >> 2 : ( getWidth( uiTmpAbsPartIdx ) >> 2 ) + ( getWidth( uiTmpAbsPartIdx ) >> 1 ); |
---|
2916 | riHeight = getHeight( uiTmpAbsPartIdx ); |
---|
2917 | ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : uiNumPartition >> 4; |
---|
2918 | break; |
---|
2919 | case SIZE_nRx2N: |
---|
2920 | riWidth = ( uiPartIdx == 0 ) ? ( getWidth( uiTmpAbsPartIdx ) >> 2 ) + ( getWidth( uiTmpAbsPartIdx ) >> 1 ) : getWidth( uiTmpAbsPartIdx ) >> 2; |
---|
2921 | riHeight = getHeight( uiTmpAbsPartIdx ); |
---|
2922 | ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : (uiNumPartition >> 2) + (uiNumPartition >> 4); |
---|
2923 | break; |
---|
2924 | default: |
---|
2925 | assert ( m_pePartSize[uiTmpAbsPartIdx] == SIZE_2Nx2N ); |
---|
2926 | riWidth = getWidth( uiTmpAbsPartIdx ); riHeight = getHeight( uiTmpAbsPartIdx ); ruiPartAddr = 0; |
---|
2927 | break; |
---|
2928 | } |
---|
2929 | } |
---|
2930 | #else |
---|
2931 | Void TComDataCU::getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight ) |
---|
2932 | { |
---|
2933 | switch ( m_pePartSize[0] ) |
---|
2934 | { |
---|
2935 | case SIZE_2NxN: |
---|
2936 | riWidth = getWidth(0); riHeight = getHeight(0) >> 1; ruiPartAddr = ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 1; |
---|
2937 | break; |
---|
2938 | case SIZE_Nx2N: |
---|
2939 | riWidth = getWidth(0) >> 1; riHeight = getHeight(0); ruiPartAddr = ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 2; |
---|
2940 | break; |
---|
2941 | case SIZE_NxN: |
---|
2942 | riWidth = getWidth(0) >> 1; riHeight = getHeight(0) >> 1; ruiPartAddr = ( m_uiNumPartition >> 2 ) * uiPartIdx; |
---|
2943 | break; |
---|
2944 | case SIZE_2NxnU: |
---|
2945 | riWidth = getWidth(0); |
---|
2946 | riHeight = ( uiPartIdx == 0 ) ? getHeight(0) >> 2 : ( getHeight(0) >> 2 ) + ( getHeight(0) >> 1 ); |
---|
2947 | ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : m_uiNumPartition >> 3; |
---|
2948 | break; |
---|
2949 | case SIZE_2NxnD: |
---|
2950 | riWidth = getWidth(0); |
---|
2951 | riHeight = ( uiPartIdx == 0 ) ? ( getHeight(0) >> 2 ) + ( getHeight(0) >> 1 ) : getHeight(0) >> 2; |
---|
2952 | ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : (m_uiNumPartition >> 1) + (m_uiNumPartition >> 3); |
---|
2953 | break; |
---|
2954 | case SIZE_nLx2N: |
---|
2955 | riWidth = ( uiPartIdx == 0 ) ? getWidth(0) >> 2 : ( getWidth(0) >> 2 ) + ( getWidth(0) >> 1 ); |
---|
2956 | riHeight = getHeight(0); |
---|
2957 | ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : m_uiNumPartition >> 4; |
---|
2958 | break; |
---|
2959 | case SIZE_nRx2N: |
---|
2960 | riWidth = ( uiPartIdx == 0 ) ? ( getWidth(0) >> 2 ) + ( getWidth(0) >> 1 ) : getWidth(0) >> 2; |
---|
2961 | riHeight = getHeight(0); |
---|
2962 | ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : (m_uiNumPartition >> 2) + (m_uiNumPartition >> 4); |
---|
2963 | break; |
---|
2964 | default: |
---|
2965 | assert ( m_pePartSize[0] == SIZE_2Nx2N ); |
---|
2966 | riWidth = getWidth(0); riHeight = getHeight(0); ruiPartAddr = 0; |
---|
2967 | break; |
---|
2968 | } |
---|
2969 | } |
---|
2970 | #endif |
---|
2971 | |
---|
2972 | |
---|
2973 | Void TComDataCU::getMvField ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, TComMvField& rcMvField ) |
---|
2974 | { |
---|
2975 | if ( pcCU == NULL ) // OUT OF BOUNDARY |
---|
2976 | { |
---|
2977 | TComMv cZeroMv; |
---|
2978 | rcMvField.setMvField( cZeroMv, NOT_VALID ); |
---|
2979 | return; |
---|
2980 | } |
---|
2981 | |
---|
2982 | TComCUMvField* pcCUMvField = pcCU->getCUMvField( eRefPicList ); |
---|
2983 | rcMvField.setMvField( pcCUMvField->getMv( uiAbsPartIdx ), pcCUMvField->getRefIdx( uiAbsPartIdx ) ); |
---|
2984 | } |
---|
2985 | |
---|
2986 | Void TComDataCU::deriveLeftRightTopIdxGeneral ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ) |
---|
2987 | { |
---|
2988 | ruiPartIdxLT = m_uiAbsIdxInLCU + uiAbsPartIdx; |
---|
2989 | UInt uiPUWidth = 0; |
---|
2990 | |
---|
2991 | switch ( m_pePartSize[uiAbsPartIdx] ) |
---|
2992 | { |
---|
2993 | case SIZE_2Nx2N: uiPUWidth = m_puhWidth[uiAbsPartIdx]; break; |
---|
2994 | case SIZE_2NxN: uiPUWidth = m_puhWidth[uiAbsPartIdx]; break; |
---|
2995 | case SIZE_Nx2N: uiPUWidth = m_puhWidth[uiAbsPartIdx] >> 1; break; |
---|
2996 | case SIZE_NxN: uiPUWidth = m_puhWidth[uiAbsPartIdx] >> 1; break; |
---|
2997 | case SIZE_2NxnU: uiPUWidth = m_puhWidth[uiAbsPartIdx]; break; |
---|
2998 | case SIZE_2NxnD: uiPUWidth = m_puhWidth[uiAbsPartIdx]; break; |
---|
2999 | case SIZE_nLx2N: |
---|
3000 | if ( uiPartIdx == 0 ) |
---|
3001 | { |
---|
3002 | uiPUWidth = m_puhWidth[uiAbsPartIdx] >> 2; |
---|
3003 | } |
---|
3004 | else if ( uiPartIdx == 1 ) |
---|
3005 | { |
---|
3006 | uiPUWidth = (m_puhWidth[uiAbsPartIdx] >> 1) + (m_puhWidth[uiAbsPartIdx] >> 2); |
---|
3007 | } |
---|
3008 | else |
---|
3009 | { |
---|
3010 | assert(0); |
---|
3011 | } |
---|
3012 | break; |
---|
3013 | case SIZE_nRx2N: |
---|
3014 | if ( uiPartIdx == 0 ) |
---|
3015 | { |
---|
3016 | uiPUWidth = (m_puhWidth[uiAbsPartIdx] >> 1) + (m_puhWidth[uiAbsPartIdx] >> 2); |
---|
3017 | } |
---|
3018 | else if ( uiPartIdx == 1 ) |
---|
3019 | { |
---|
3020 | uiPUWidth = m_puhWidth[uiAbsPartIdx] >> 2; |
---|
3021 | } |
---|
3022 | else |
---|
3023 | { |
---|
3024 | assert(0); |
---|
3025 | } |
---|
3026 | break; |
---|
3027 | default: |
---|
3028 | assert (0); |
---|
3029 | break; |
---|
3030 | } |
---|
3031 | |
---|
3032 | ruiPartIdxRT = g_auiRasterToZscan [g_auiZscanToRaster[ ruiPartIdxLT ] + uiPUWidth / m_pcPic->getMinCUWidth() - 1 ]; |
---|
3033 | } |
---|
3034 | |
---|
3035 | Void TComDataCU::deriveLeftBottomIdxGeneral( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB ) |
---|
3036 | { |
---|
3037 | UInt uiPUHeight = 0; |
---|
3038 | switch ( m_pePartSize[uiAbsPartIdx] ) |
---|
3039 | { |
---|
3040 | case SIZE_2Nx2N: uiPUHeight = m_puhHeight[uiAbsPartIdx]; break; |
---|
3041 | case SIZE_2NxN: uiPUHeight = m_puhHeight[uiAbsPartIdx] >> 1; break; |
---|
3042 | case SIZE_Nx2N: uiPUHeight = m_puhHeight[uiAbsPartIdx]; break; |
---|
3043 | case SIZE_NxN: uiPUHeight = m_puhHeight[uiAbsPartIdx] >> 1; break; |
---|
3044 | case SIZE_2NxnU: |
---|
3045 | if ( uiPartIdx == 0 ) |
---|
3046 | { |
---|
3047 | uiPUHeight = m_puhHeight[uiAbsPartIdx] >> 2; |
---|
3048 | } |
---|
3049 | else if ( uiPartIdx == 1 ) |
---|
3050 | { |
---|
3051 | uiPUHeight = (m_puhHeight[uiAbsPartIdx] >> 1) + (m_puhHeight[uiAbsPartIdx] >> 2); |
---|
3052 | } |
---|
3053 | else |
---|
3054 | { |
---|
3055 | assert(0); |
---|
3056 | } |
---|
3057 | break; |
---|
3058 | case SIZE_2NxnD: |
---|
3059 | if ( uiPartIdx == 0 ) |
---|
3060 | { |
---|
3061 | uiPUHeight = (m_puhHeight[uiAbsPartIdx] >> 1) + (m_puhHeight[uiAbsPartIdx] >> 2); |
---|
3062 | } |
---|
3063 | else if ( uiPartIdx == 1 ) |
---|
3064 | { |
---|
3065 | uiPUHeight = m_puhHeight[uiAbsPartIdx] >> 2; |
---|
3066 | } |
---|
3067 | else |
---|
3068 | { |
---|
3069 | assert(0); |
---|
3070 | } |
---|
3071 | break; |
---|
3072 | case SIZE_nLx2N: uiPUHeight = m_puhHeight[uiAbsPartIdx]; break; |
---|
3073 | case SIZE_nRx2N: uiPUHeight = m_puhHeight[uiAbsPartIdx]; break; |
---|
3074 | default: |
---|
3075 | assert (0); |
---|
3076 | break; |
---|
3077 | } |
---|
3078 | |
---|
3079 | ruiPartIdxLB = g_auiRasterToZscan [g_auiZscanToRaster[ m_uiAbsIdxInLCU + uiAbsPartIdx ] + ((uiPUHeight / m_pcPic->getMinCUHeight()) - 1)*m_pcPic->getNumPartInWidth()]; |
---|
3080 | } |
---|
3081 | |
---|
3082 | Void TComDataCU::deriveLeftRightTopIdx ( UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ) |
---|
3083 | { |
---|
3084 | ruiPartIdxLT = m_uiAbsIdxInLCU; |
---|
3085 | ruiPartIdxRT = g_auiRasterToZscan [g_auiZscanToRaster[ ruiPartIdxLT ] + m_puhWidth[0] / m_pcPic->getMinCUWidth() - 1 ]; |
---|
3086 | |
---|
3087 | switch ( m_pePartSize[0] ) |
---|
3088 | { |
---|
3089 | case SIZE_2Nx2N: break; |
---|
3090 | case SIZE_2NxN: |
---|
3091 | ruiPartIdxLT += ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 1; ruiPartIdxRT += ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 1; |
---|
3092 | break; |
---|
3093 | case SIZE_Nx2N: |
---|
3094 | ruiPartIdxLT += ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 2; ruiPartIdxRT -= ( uiPartIdx == 1 )? 0 : m_uiNumPartition >> 2; |
---|
3095 | break; |
---|
3096 | case SIZE_NxN: |
---|
3097 | ruiPartIdxLT += ( m_uiNumPartition >> 2 ) * uiPartIdx; ruiPartIdxRT += ( m_uiNumPartition >> 2 ) * ( uiPartIdx - 1 ); |
---|
3098 | break; |
---|
3099 | case SIZE_2NxnU: |
---|
3100 | ruiPartIdxLT += ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 3; |
---|
3101 | ruiPartIdxRT += ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 3; |
---|
3102 | break; |
---|
3103 | case SIZE_2NxnD: |
---|
3104 | ruiPartIdxLT += ( uiPartIdx == 0 )? 0 : ( m_uiNumPartition >> 1 ) + ( m_uiNumPartition >> 3 ); |
---|
3105 | ruiPartIdxRT += ( uiPartIdx == 0 )? 0 : ( m_uiNumPartition >> 1 ) + ( m_uiNumPartition >> 3 ); |
---|
3106 | break; |
---|
3107 | case SIZE_nLx2N: |
---|
3108 | ruiPartIdxLT += ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 4; |
---|
3109 | ruiPartIdxRT -= ( uiPartIdx == 1 )? 0 : ( m_uiNumPartition >> 2 ) + ( m_uiNumPartition >> 4 ); |
---|
3110 | break; |
---|
3111 | case SIZE_nRx2N: |
---|
3112 | ruiPartIdxLT += ( uiPartIdx == 0 )? 0 : ( m_uiNumPartition >> 2 ) + ( m_uiNumPartition >> 4 ); |
---|
3113 | ruiPartIdxRT -= ( uiPartIdx == 1 )? 0 : m_uiNumPartition >> 4; |
---|
3114 | break; |
---|
3115 | default: |
---|
3116 | assert (0); |
---|
3117 | break; |
---|
3118 | } |
---|
3119 | |
---|
3120 | } |
---|
3121 | |
---|
3122 | Void TComDataCU::deriveLeftBottomIdx( UInt uiPartIdx, UInt& ruiPartIdxLB ) |
---|
3123 | { |
---|
3124 | ruiPartIdxLB = g_auiRasterToZscan [g_auiZscanToRaster[ m_uiAbsIdxInLCU ] + ( ((m_puhHeight[0] / m_pcPic->getMinCUHeight())>>1) - 1)*m_pcPic->getNumPartInWidth()]; |
---|
3125 | |
---|
3126 | switch ( m_pePartSize[0] ) |
---|
3127 | { |
---|
3128 | case SIZE_2Nx2N: |
---|
3129 | ruiPartIdxLB += m_uiNumPartition >> 1; |
---|
3130 | break; |
---|
3131 | case SIZE_2NxN: |
---|
3132 | ruiPartIdxLB += ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 1; |
---|
3133 | break; |
---|
3134 | case SIZE_Nx2N: |
---|
3135 | ruiPartIdxLB += ( uiPartIdx == 0 )? m_uiNumPartition >> 1 : (m_uiNumPartition >> 2)*3; |
---|
3136 | break; |
---|
3137 | case SIZE_NxN: |
---|
3138 | ruiPartIdxLB += ( m_uiNumPartition >> 2 ) * uiPartIdx; |
---|
3139 | break; |
---|
3140 | case SIZE_2NxnU: |
---|
3141 | ruiPartIdxLB += ( uiPartIdx == 0 ) ? -((Int)m_uiNumPartition >> 3) : m_uiNumPartition >> 1; |
---|
3142 | break; |
---|
3143 | case SIZE_2NxnD: |
---|
3144 | ruiPartIdxLB += ( uiPartIdx == 0 ) ? (m_uiNumPartition >> 2) + (m_uiNumPartition >> 3): m_uiNumPartition >> 1; |
---|
3145 | break; |
---|
3146 | case SIZE_nLx2N: |
---|
3147 | ruiPartIdxLB += ( uiPartIdx == 0 ) ? m_uiNumPartition >> 1 : (m_uiNumPartition >> 1) + (m_uiNumPartition >> 4); |
---|
3148 | break; |
---|
3149 | case SIZE_nRx2N: |
---|
3150 | ruiPartIdxLB += ( uiPartIdx == 0 ) ? m_uiNumPartition >> 1 : (m_uiNumPartition >> 1) + (m_uiNumPartition >> 2) + (m_uiNumPartition >> 4); |
---|
3151 | break; |
---|
3152 | default: |
---|
3153 | assert (0); |
---|
3154 | break; |
---|
3155 | } |
---|
3156 | } |
---|
3157 | |
---|
3158 | /** Derives the partition index of neighbouring bottom right block |
---|
3159 | * \param [in] eCUMode |
---|
3160 | * \param [in] uiPartIdx |
---|
3161 | * \param [out] ruiPartIdxRB |
---|
3162 | */ |
---|
3163 | Void TComDataCU::deriveRightBottomIdx( UInt uiPartIdx, UInt& ruiPartIdxRB ) |
---|
3164 | { |
---|
3165 | ruiPartIdxRB = g_auiRasterToZscan [g_auiZscanToRaster[ m_uiAbsIdxInLCU ] + ( ((m_puhHeight[0] / m_pcPic->getMinCUHeight())>>1) - 1)*m_pcPic->getNumPartInWidth() + m_puhWidth[0] / m_pcPic->getMinCUWidth() - 1]; |
---|
3166 | |
---|
3167 | switch ( m_pePartSize[0] ) |
---|
3168 | { |
---|
3169 | case SIZE_2Nx2N: |
---|
3170 | ruiPartIdxRB += m_uiNumPartition >> 1; |
---|
3171 | break; |
---|
3172 | case SIZE_2NxN: |
---|
3173 | ruiPartIdxRB += ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 1; |
---|
3174 | break; |
---|
3175 | case SIZE_Nx2N: |
---|
3176 | ruiPartIdxRB += ( uiPartIdx == 0 )? m_uiNumPartition >> 2 : (m_uiNumPartition >> 1); |
---|
3177 | break; |
---|
3178 | case SIZE_NxN: |
---|
3179 | ruiPartIdxRB += ( m_uiNumPartition >> 2 ) * ( uiPartIdx - 1 ); |
---|
3180 | break; |
---|
3181 | case SIZE_2NxnU: |
---|
3182 | ruiPartIdxRB += ( uiPartIdx == 0 ) ? -((Int)m_uiNumPartition >> 3) : m_uiNumPartition >> 1; |
---|
3183 | break; |
---|
3184 | case SIZE_2NxnD: |
---|
3185 | ruiPartIdxRB += ( uiPartIdx == 0 ) ? (m_uiNumPartition >> 2) + (m_uiNumPartition >> 3): m_uiNumPartition >> 1; |
---|
3186 | break; |
---|
3187 | case SIZE_nLx2N: |
---|
3188 | ruiPartIdxRB += ( uiPartIdx == 0 ) ? (m_uiNumPartition >> 3) + (m_uiNumPartition >> 4): m_uiNumPartition >> 1; |
---|
3189 | break; |
---|
3190 | case SIZE_nRx2N: |
---|
3191 | ruiPartIdxRB += ( uiPartIdx == 0 ) ? (m_uiNumPartition >> 2) + (m_uiNumPartition >> 3) + (m_uiNumPartition >> 4) : m_uiNumPartition >> 1; |
---|
3192 | break; |
---|
3193 | default: |
---|
3194 | assert (0); |
---|
3195 | break; |
---|
3196 | } |
---|
3197 | } |
---|
3198 | |
---|
3199 | Void TComDataCU::deriveLeftRightTopIdxAdi ( UInt& ruiPartIdxLT, UInt& ruiPartIdxRT, UInt uiPartOffset, UInt uiPartDepth ) |
---|
3200 | { |
---|
3201 | UInt uiNumPartInWidth = (m_puhWidth[0]/m_pcPic->getMinCUWidth())>>uiPartDepth; |
---|
3202 | ruiPartIdxLT = m_uiAbsIdxInLCU + uiPartOffset; |
---|
3203 | ruiPartIdxRT = g_auiRasterToZscan[ g_auiZscanToRaster[ ruiPartIdxLT ] + uiNumPartInWidth - 1 ]; |
---|
3204 | } |
---|
3205 | |
---|
3206 | Void TComDataCU::deriveLeftBottomIdxAdi( UInt& ruiPartIdxLB, UInt uiPartOffset, UInt uiPartDepth ) |
---|
3207 | { |
---|
3208 | UInt uiAbsIdx; |
---|
3209 | UInt uiMinCuWidth, uiWidthInMinCus; |
---|
3210 | |
---|
3211 | uiMinCuWidth = getPic()->getMinCUWidth(); |
---|
3212 | uiWidthInMinCus = (getWidth(0)/uiMinCuWidth)>>uiPartDepth; |
---|
3213 | uiAbsIdx = getZorderIdxInCU()+uiPartOffset+(m_uiNumPartition>>(uiPartDepth<<1))-1; |
---|
3214 | uiAbsIdx = g_auiZscanToRaster[uiAbsIdx]-(uiWidthInMinCus-1); |
---|
3215 | ruiPartIdxLB = g_auiRasterToZscan[uiAbsIdx]; |
---|
3216 | } |
---|
3217 | |
---|
3218 | Bool TComDataCU::hasEqualMotion( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx ) |
---|
3219 | { |
---|
3220 | |
---|
3221 | if ( getInterDir( uiAbsPartIdx ) != pcCandCU->getInterDir( uiCandAbsPartIdx ) ) |
---|
3222 | { |
---|
3223 | return false; |
---|
3224 | } |
---|
3225 | |
---|
3226 | for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) |
---|
3227 | { |
---|
3228 | if ( getInterDir( uiAbsPartIdx ) & ( 1 << uiRefListIdx ) ) |
---|
3229 | { |
---|
3230 | if ( getCUMvField( RefPicList( uiRefListIdx ) )->getMv( uiAbsPartIdx ) != pcCandCU->getCUMvField( RefPicList( uiRefListIdx ) )->getMv( uiCandAbsPartIdx ) || |
---|
3231 | getCUMvField( RefPicList( uiRefListIdx ) )->getRefIdx( uiAbsPartIdx ) != pcCandCU->getCUMvField( RefPicList( uiRefListIdx ) )->getRefIdx( uiCandAbsPartIdx ) ) |
---|
3232 | { |
---|
3233 | return false; |
---|
3234 | } |
---|
3235 | } |
---|
3236 | } |
---|
3237 | |
---|
3238 | return true; |
---|
3239 | } |
---|
3240 | |
---|
3241 | #if H_3D_VSP |
---|
3242 | |
---|
3243 | /** Add a VSP merging candidate |
---|
3244 | * \Inputs |
---|
3245 | * \param uiPUIdx: PU index within a CU |
---|
3246 | * \param ucVspMergePos: Specify the VSP merge candidate position |
---|
3247 | * \param mrgCandIdx: Target merge candidate index. At encoder, it is set equal to -1, such that the whole merge candidate list will be constructed. |
---|
3248 | * \param pDinfo: The "disparity information" derived from neighboring blocks. Type 1 MV. |
---|
3249 | * \param uiCount: The next position to add VSP merge candidate |
---|
3250 | * |
---|
3251 | * \Outputs |
---|
3252 | * \param uiCount: The next position to add merge candidate. Will be updated if VSP is successfully added |
---|
3253 | * \param abCandIsInter: abCandIsInter[iCount] tells that VSP candidate is an Inter candidate, if VSP is successfully added |
---|
3254 | * \param pcMvFieldNeighbours: Return combined motion information, then stored to a global buffer |
---|
3255 | * 1) the "disparity vector". Type 1 MV. To be used to fetch a depth block. |
---|
3256 | * 2) the ref index /list. Type 2 reference picture pointer, typically for texture |
---|
3257 | * \param puhInterDirNeighbours: Indicate the VSP prediction direction. |
---|
3258 | * \param vspFlag: vspFlag[iCount] will be set (equal to 1), if VSP is successfully added. To be used to indicate the actual position of the VSP candidate |
---|
3259 | * |
---|
3260 | * \Return |
---|
3261 | * true: if the VSP candidate is added at the target position |
---|
3262 | * false: otherwise |
---|
3263 | */ |
---|
3264 | inline Bool TComDataCU::xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount, |
---|
3265 | Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* vspFlag, Int& iCount3DV, InheritedVSPDisInfo* inheritedVSPDisInfo ) |
---|
3266 | { |
---|
3267 | if ( m_pcSlice->getViewIndex() == 0 || !m_pcSlice->getVPS()->getViewSynthesisPredFlag( m_pcSlice->getLayerIdInVps() ) || m_pcSlice->getIsDepth() || pDInfo->m_aVIdxCan == -1) |
---|
3268 | { |
---|
3269 | return false; |
---|
3270 | } |
---|
3271 | |
---|
3272 | Int refViewIdx = pDInfo->m_aVIdxCan; |
---|
3273 | TComPic* picDepth = getSlice()->getIvPic( true, refViewIdx ); |
---|
3274 | |
---|
3275 | if( picDepth == NULL ) // No depth reference avail |
---|
3276 | { |
---|
3277 | // Is this allowed to happen? When not an assertion should be added here! |
---|
3278 | return false; |
---|
3279 | } |
---|
3280 | |
---|
3281 | rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (5-iCount), iCount3DV); |
---|
3282 | |
---|
3283 | Bool refViewAvailFlag = false; |
---|
3284 | UChar predFlag[2] = {0, 0}; |
---|
3285 | |
---|
3286 | for( Int iRefListIdX = 0; iRefListIdX < 2 && !refViewAvailFlag; iRefListIdX++ ) |
---|
3287 | { |
---|
3288 | RefPicList eRefPicListX = RefPicList( iRefListIdX ); |
---|
3289 | for ( Int i = 0; i < m_pcSlice->getNumRefIdx(eRefPicListX) && !refViewAvailFlag; i++ ) |
---|
3290 | { |
---|
3291 | Int viewIdxRefInListX = m_pcSlice->getRefPic(eRefPicListX, i)->getViewIndex(); |
---|
3292 | if ( viewIdxRefInListX == refViewIdx ) |
---|
3293 | { |
---|
3294 | refViewAvailFlag = true; |
---|
3295 | predFlag[iRefListIdX] = 1; |
---|
3296 | pcMvFieldNeighbours[(iCount<<1)+iRefListIdX].setMvField( pDInfo->m_acNBDV, i ); |
---|
3297 | #if H_3D_NBDV |
---|
3298 | pcMvFieldNeighbours[(iCount<<1)+iRefListIdX].getMv().setIDVFlag (false); |
---|
3299 | #endif |
---|
3300 | } |
---|
3301 | } |
---|
3302 | } |
---|
3303 | |
---|
3304 | // Set values to be returned |
---|
3305 | abCandIsInter [iCount] = true; |
---|
3306 | puhInterDirNeighbours[iCount] = (predFlag[0] | (predFlag[1] << 1)); |
---|
3307 | vspFlag [iCount] = 1; |
---|
3308 | |
---|
3309 | if ( mrgCandIdx == iCount ) |
---|
3310 | { |
---|
3311 | return true; |
---|
3312 | } |
---|
3313 | |
---|
3314 | iCount++; |
---|
3315 | |
---|
3316 | return false; |
---|
3317 | } |
---|
3318 | |
---|
3319 | #endif |
---|
3320 | |
---|
3321 | #if H_3D_IV_MERGE |
---|
3322 | inline Bool TComDataCU::xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* ivCandDir, TComMv* ivCandMv, |
---|
3323 | Int* ivCandRefIdx, Int iPosIvDC, Int* vspFlag, Int &iCount3DV, InheritedVSPDisInfo* inheritedVSPDisInfo ) |
---|
3324 | { |
---|
3325 | for(Int iLoop = 0; iLoop < 2; iLoop ++ ) |
---|
3326 | { |
---|
3327 | // IvDcShift (Derived from spatial Iv neighboring blocks) |
---|
3328 | if( iLoop == 1 ) |
---|
3329 | { |
---|
3330 | Int iFirDispCand = -1; |
---|
3331 | if (xGetPosFirstAvailDmvCand(iCount, pcMvFieldNeighbours, ivCandDir, iPosIvDC, vspFlag, iFirDispCand)) |
---|
3332 | { |
---|
3333 | TComMv cMv; |
---|
3334 | cMv = pcMvFieldNeighbours[(iFirDispCand<<1)].getMv(); |
---|
3335 | cMv.setHor(cMv.getHor()+4); |
---|
3336 | if(m_pcSlice->getVPS()->getViewSynthesisPredFlag(m_pcSlice->getLayerIdInVps())) |
---|
3337 | { |
---|
3338 | cMv.setVer(0); |
---|
3339 | } |
---|
3340 | #if !(NTT_BUG_FIX_TK54) |
---|
3341 | clipMv( cMv ); |
---|
3342 | #endif |
---|
3343 | |
---|
3344 | rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (5-iCount), iCount3DV); |
---|
3345 | |
---|
3346 | abCandIsInter [ iCount ] = true; |
---|
3347 | puhInterDirNeighbours[ iCount ] = puhInterDirNeighbours[iFirDispCand]; |
---|
3348 | pcMvFieldNeighbours [ iCount << 1 ].setMvField(cMv, pcMvFieldNeighbours[( iFirDispCand << 1)].getRefIdx() ); |
---|
3349 | pcMvFieldNeighbours [(iCount << 1) + 1 ].setMvField(pcMvFieldNeighbours[(iFirDispCand << 1) + 1].getMv(), pcMvFieldNeighbours[( iFirDispCand << 1) + 1].getRefIdx() ); |
---|
3350 | |
---|
3351 | if( mrgCandIdx == iCount ) |
---|
3352 | { |
---|
3353 | return true; |
---|
3354 | } |
---|
3355 | |
---|
3356 | iCount++; |
---|
3357 | break; |
---|
3358 | } |
---|
3359 | } |
---|
3360 | |
---|
3361 | /// iLoop = 0 --> IvMCShift |
---|
3362 | /// iLoop = 1 --> IvDCShift (Derived from IvDC) |
---|
3363 | if(ivCandDir[iLoop + 2]) |
---|
3364 | { |
---|
3365 | TComMvField tmpMV[2]; |
---|
3366 | UChar tmpDir = ivCandDir[iLoop + 2]; |
---|
3367 | if( ( ivCandDir[iLoop + 2] & 1 ) == 1 ) |
---|
3368 | { |
---|
3369 | tmpMV[0].setMvField( ivCandMv[ (iLoop<<1) + 4 ], ivCandRefIdx[ (iLoop<<1) + 4 ] ); |
---|
3370 | } |
---|
3371 | if( ( ivCandDir[iLoop + 2] & 2 ) == 2 ) |
---|
3372 | { |
---|
3373 | tmpMV[1].setMvField( ivCandMv[ (iLoop<<1) + 5 ], ivCandRefIdx[ (iLoop<<1) + 5 ] ); |
---|
3374 | } |
---|
3375 | |
---|
3376 | // Prune IvMC vs. IvMcShift |
---|
3377 | Bool bRemove = false; |
---|
3378 | if( !iLoop && ivCandDir[0] > 0) |
---|
3379 | { |
---|
3380 | if(tmpDir == puhInterDirNeighbours[0] && pcMvFieldNeighbours[0]==tmpMV[0] && pcMvFieldNeighbours[1]==tmpMV[1]) |
---|
3381 | { |
---|
3382 | bRemove = true; |
---|
3383 | } |
---|
3384 | } |
---|
3385 | if(!bRemove) |
---|
3386 | { |
---|
3387 | rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (5-iCount), iCount3DV); |
---|
3388 | |
---|
3389 | abCandIsInter[ iCount ] = true; |
---|
3390 | puhInterDirNeighbours[ iCount ] = ivCandDir[iLoop + 2]; |
---|
3391 | if( ( ivCandDir[iLoop + 2] & 1 ) == 1 ) |
---|
3392 | { |
---|
3393 | pcMvFieldNeighbours[ iCount<<1 ].setMvField( ivCandMv[ (iLoop<<1) + 4 ], ivCandRefIdx[ (iLoop<<1) + 4 ] ); |
---|
3394 | } |
---|
3395 | if( ( ivCandDir[iLoop + 2] & 2 ) == 2 ) |
---|
3396 | { |
---|
3397 | pcMvFieldNeighbours[ (iCount<<1)+1 ].setMvField( ivCandMv[ (iLoop<<1) + 5 ], ivCandRefIdx[ (iLoop<<1) + 5 ] ); |
---|
3398 | } |
---|
3399 | #if H_3D_NBDV |
---|
3400 | if(iLoop) // For IvMcShift candidate |
---|
3401 | { |
---|
3402 | pcMvFieldNeighbours[iCount<<1 ].getMv().setIDVFlag (false); |
---|
3403 | pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false); |
---|
3404 | } |
---|
3405 | #endif |
---|
3406 | if( mrgCandIdx == iCount ) |
---|
3407 | { |
---|
3408 | return true; |
---|
3409 | } |
---|
3410 | iCount++; |
---|
3411 | } |
---|
3412 | break; |
---|
3413 | } |
---|
3414 | } |
---|
3415 | return false; |
---|
3416 | } |
---|
3417 | |
---|
3418 | inline Bool TComDataCU::xGetPosFirstAvailDmvCand( Int iCount, TComMvField* pcMvFieldNeighbours, Int* ivCandDir, Int posIvDC, Int* vspFlag, Int& posFirstAvailDmvCand ) |
---|
3419 | { |
---|
3420 | // ivCandDir[0] == true --> IvMC is available and excluded in loop over merge list. |
---|
3421 | for ( Int currListPos = (ivCandDir[0] ? 1 : 0); currListPos < iCount; currListPos++ ) |
---|
3422 | { |
---|
3423 | if ( ( currListPos == posIvDC ) || ( vspFlag[ currListPos ] != 0 ) ) |
---|
3424 | { |
---|
3425 | continue; |
---|
3426 | } |
---|
3427 | else if((pcMvFieldNeighbours[currListPos<<1].getRefIdx() != -1 ) && (getSlice()->getViewIndex() != getSlice()->getRefPic(RefPicList(0), pcMvFieldNeighbours[currListPos<<1].getRefIdx())->getViewIndex())) |
---|
3428 | { |
---|
3429 | posFirstAvailDmvCand = currListPos; |
---|
3430 | return true; |
---|
3431 | } |
---|
3432 | } |
---|
3433 | return false; |
---|
3434 | } |
---|
3435 | |
---|
3436 | #endif |
---|
3437 | |
---|
3438 | #if H_3D |
---|
3439 | Void TComDataCU::rightShiftMergeCandList( TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* iVSPIndexTrue, InheritedVSPDisInfo* inheritedVSPDisInfo, UInt start, UInt num, Int &iCount3DV) |
---|
3440 | { |
---|
3441 | iCount3DV++; |
---|
3442 | for (int i=num; i>0; i--) |
---|
3443 | { |
---|
3444 | pcMvFieldNeighbours[(start+i)<<1].setMvField(pcMvFieldNeighbours[(start+i-1)<<1].getMv(), pcMvFieldNeighbours[(start+i-1)<<1].getRefIdx()); |
---|
3445 | pcMvFieldNeighbours[((start+i)<<1)+1].setMvField(pcMvFieldNeighbours[((start+i-1)<<1)+1].getMv(), pcMvFieldNeighbours[((start+i-1)<<1)+1].getRefIdx()); |
---|
3446 | puhInterDirNeighbours[start+i] = puhInterDirNeighbours[start+i-1]; |
---|
3447 | iVSPIndexTrue[start+i] = iVSPIndexTrue[start+i-1]; |
---|
3448 | inheritedVSPDisInfo[start+i].m_acDvInfo = inheritedVSPDisInfo[start+i-1].m_acDvInfo; |
---|
3449 | } |
---|
3450 | TComMv cZeroMv; |
---|
3451 | pcMvFieldNeighbours[start<<1].setMvField( cZeroMv, NOT_VALID ); |
---|
3452 | pcMvFieldNeighbours[(start<<1)+1].setMvField( cZeroMv, NOT_VALID ); |
---|
3453 | puhInterDirNeighbours[start] = 0; |
---|
3454 | iVSPIndexTrue[start] = 0; |
---|
3455 | inheritedVSPDisInfo[start].m_acDvInfo = m_cDefaultDisInfo; |
---|
3456 | |
---|
3457 | return; |
---|
3458 | } |
---|
3459 | |
---|
3460 | /** Constructs a list of merging candidates |
---|
3461 | * \param uiAbsPartIdx |
---|
3462 | * \param uiPUIdx |
---|
3463 | * \param uiDepth |
---|
3464 | * \param pcMvFieldNeighbours |
---|
3465 | * \param puhInterDirNeighbours |
---|
3466 | * \param numValidMergeCand |
---|
3467 | */ |
---|
3468 | // HM 12.0 based merge candidate list construction |
---|
3469 | |
---|
3470 | Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx ) |
---|
3471 | { |
---|
3472 | |
---|
3473 | UInt uiAbsPartAddr = m_uiAbsIdxInLCU + uiAbsPartIdx; |
---|
3474 | Bool abCandIsInter[ MRG_MAX_NUM_CANDS_MEM ]; |
---|
3475 | TComMv cZeroMv; |
---|
3476 | for( UInt ui = 0; ui < getSlice()->getMaxNumMergeCand(); ++ui ) |
---|
3477 | { |
---|
3478 | abCandIsInter[ui] = false; |
---|
3479 | pcMvFieldNeighbours[ ( ui << 1 ) ].setMvField(cZeroMv, NOT_VALID); |
---|
3480 | pcMvFieldNeighbours[ ( ui << 1 ) + 1 ].setMvField(cZeroMv, NOT_VALID); |
---|
3481 | } |
---|
3482 | numValidMergeCand = getSlice()->getMaxNumMergeCand(); |
---|
3483 | // compute the location of the current PU |
---|
3484 | Int xP, yP, nPSW, nPSH; |
---|
3485 | this->getPartPosition(uiPUIdx, xP, yP, nPSW, nPSH); |
---|
3486 | |
---|
3487 | Int iCount = 0; |
---|
3488 | |
---|
3489 | UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB; |
---|
3490 | PartSize cCurPS = getPartitionSize( uiAbsPartIdx ); |
---|
3491 | deriveLeftRightTopIdxGeneral( uiAbsPartIdx, uiPUIdx, uiPartIdxLT, uiPartIdxRT ); |
---|
3492 | deriveLeftBottomIdxGeneral ( uiAbsPartIdx, uiPUIdx, uiPartIdxLB ); |
---|
3493 | |
---|
3494 | //left |
---|
3495 | UInt uiLeftPartIdx = 0; |
---|
3496 | TComDataCU* pcCULeft = 0; |
---|
3497 | pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB ); |
---|
3498 | Bool isAvailableA1 = pcCULeft && |
---|
3499 | pcCULeft->isDiffMER(xP -1, yP+nPSH-1, xP, yP) && |
---|
3500 | !( uiPUIdx == 1 && (cCurPS == SIZE_Nx2N || cCurPS == SIZE_nLx2N || cCurPS == SIZE_nRx2N) ) && |
---|
3501 | !pcCULeft->isIntra( uiLeftPartIdx ) ; |
---|
3502 | if ( isAvailableA1 ) |
---|
3503 | { |
---|
3504 | m_bAvailableFlagA1 = 1; |
---|
3505 | abCandIsInter[iCount] = true; |
---|
3506 | // get Inter Dir |
---|
3507 | puhInterDirNeighbours[iCount] = pcCULeft->getInterDir( uiLeftPartIdx ); |
---|
3508 | // get Mv from Left |
---|
3509 | pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); |
---|
3510 | if ( getSlice()->isInterB() ) |
---|
3511 | { |
---|
3512 | pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); |
---|
3513 | } |
---|
3514 | |
---|
3515 | iCount ++; |
---|
3516 | } |
---|
3517 | |
---|
3518 | // early termination |
---|
3519 | if (iCount == getSlice()->getMaxNumMergeCand()) |
---|
3520 | { |
---|
3521 | return; |
---|
3522 | } |
---|
3523 | // above |
---|
3524 | UInt uiAbovePartIdx = 0; |
---|
3525 | TComDataCU* pcCUAbove = 0; |
---|
3526 | pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT ); |
---|
3527 | Bool isAvailableB1 = pcCUAbove && |
---|
3528 | pcCUAbove->isDiffMER(xP+nPSW-1, yP-1, xP, yP) && |
---|
3529 | !( uiPUIdx == 1 && (cCurPS == SIZE_2NxN || cCurPS == SIZE_2NxnU || cCurPS == SIZE_2NxnD) ) && |
---|
3530 | !pcCUAbove->isIntra( uiAbovePartIdx ); |
---|
3531 | if ( isAvailableB1 && (!isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAbove, uiAbovePartIdx ) ) ) |
---|
3532 | { |
---|
3533 | m_bAvailableFlagB1 = 1; |
---|
3534 | abCandIsInter[iCount] = true; |
---|
3535 | // get Inter Dir |
---|
3536 | puhInterDirNeighbours[iCount] = pcCUAbove->getInterDir( uiAbovePartIdx ); |
---|
3537 | // get Mv from Left |
---|
3538 | pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); |
---|
3539 | if ( getSlice()->isInterB() ) |
---|
3540 | { |
---|
3541 | pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); |
---|
3542 | } |
---|
3543 | if ( mrgCandIdx == iCount ) |
---|
3544 | { |
---|
3545 | return; |
---|
3546 | } |
---|
3547 | iCount ++; |
---|
3548 | } |
---|
3549 | // early termination |
---|
3550 | if (iCount == getSlice()->getMaxNumMergeCand()) |
---|
3551 | { |
---|
3552 | return; |
---|
3553 | } |
---|
3554 | |
---|
3555 | // above right |
---|
3556 | UInt uiAboveRightPartIdx = 0; |
---|
3557 | TComDataCU* pcCUAboveRight = 0; |
---|
3558 | pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT ); |
---|
3559 | Bool isAvailableB0 = pcCUAboveRight && |
---|
3560 | pcCUAboveRight->isDiffMER(xP+nPSW, yP-1, xP, yP) && |
---|
3561 | !pcCUAboveRight->isIntra( uiAboveRightPartIdx ); |
---|
3562 | if ( isAvailableB0 && ( !isAvailableB1 || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveRight, uiAboveRightPartIdx ) ) ) |
---|
3563 | { |
---|
3564 | m_bAvailableFlagB0 = 1; |
---|
3565 | abCandIsInter[iCount] = true; |
---|
3566 | // get Inter Dir |
---|
3567 | puhInterDirNeighbours[iCount] = pcCUAboveRight->getInterDir( uiAboveRightPartIdx ); |
---|
3568 | // get Mv from Left |
---|
3569 | pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); |
---|
3570 | if ( getSlice()->isInterB() ) |
---|
3571 | { |
---|
3572 | pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); |
---|
3573 | } |
---|
3574 | if ( mrgCandIdx == iCount ) |
---|
3575 | { |
---|
3576 | return; |
---|
3577 | } |
---|
3578 | iCount ++; |
---|
3579 | } |
---|
3580 | // early termination |
---|
3581 | if (iCount == getSlice()->getMaxNumMergeCand()) |
---|
3582 | { |
---|
3583 | return; |
---|
3584 | } |
---|
3585 | |
---|
3586 | //left bottom |
---|
3587 | UInt uiLeftBottomPartIdx = 0; |
---|
3588 | TComDataCU* pcCULeftBottom = 0; |
---|
3589 | pcCULeftBottom = this->getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB ); |
---|
3590 | Bool isAvailableA0 = pcCULeftBottom && |
---|
3591 | pcCULeftBottom->isDiffMER(xP-1, yP+nPSH, xP, yP) && |
---|
3592 | !pcCULeftBottom->isIntra( uiLeftBottomPartIdx ) ; |
---|
3593 | if ( isAvailableA0 && ( !isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCULeftBottom, uiLeftBottomPartIdx ) ) ) |
---|
3594 | { |
---|
3595 | m_bAvailableFlagA0 = 1; |
---|
3596 | abCandIsInter[iCount] = true; |
---|
3597 | // get Inter Dir |
---|
3598 | puhInterDirNeighbours[iCount] = pcCULeftBottom->getInterDir( uiLeftBottomPartIdx ); |
---|
3599 | // get Mv from Left |
---|
3600 | pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); |
---|
3601 | if ( getSlice()->isInterB() ) |
---|
3602 | { |
---|
3603 | pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); |
---|
3604 | } |
---|
3605 | if ( mrgCandIdx == iCount ) |
---|
3606 | { |
---|
3607 | return; |
---|
3608 | } |
---|
3609 | iCount ++; |
---|
3610 | } |
---|
3611 | // early termination |
---|
3612 | if (iCount == getSlice()->getMaxNumMergeCand()) |
---|
3613 | { |
---|
3614 | return; |
---|
3615 | } |
---|
3616 | // above left |
---|
3617 | if( iCount < 4 ) |
---|
3618 | { |
---|
3619 | UInt uiAboveLeftPartIdx = 0; |
---|
3620 | TComDataCU* pcCUAboveLeft = 0; |
---|
3621 | pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr ); |
---|
3622 | Bool isAvailableB2 = pcCUAboveLeft && |
---|
3623 | pcCUAboveLeft->isDiffMER(xP-1, yP-1, xP, yP) && |
---|
3624 | !pcCUAboveLeft->isIntra( uiAboveLeftPartIdx ); |
---|
3625 | if ( isAvailableB2 && ( !isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) ) |
---|
3626 | && ( !isAvailableB1 || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) ) ) |
---|
3627 | { |
---|
3628 | m_bAvailableFlagB2 = 1; |
---|
3629 | abCandIsInter[iCount] = true; |
---|
3630 | // get Inter Dir |
---|
3631 | puhInterDirNeighbours[iCount] = pcCUAboveLeft->getInterDir( uiAboveLeftPartIdx ); |
---|
3632 | // get Mv from Left |
---|
3633 | pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); |
---|
3634 | if ( getSlice()->isInterB() ) |
---|
3635 | { |
---|
3636 | pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); |
---|
3637 | } |
---|
3638 | if ( mrgCandIdx == iCount ) |
---|
3639 | { |
---|
3640 | return; |
---|
3641 | } |
---|
3642 | iCount ++; |
---|
3643 | } |
---|
3644 | } |
---|
3645 | // early termination |
---|
3646 | if (iCount == getSlice()->getMaxNumMergeCand()) |
---|
3647 | { |
---|
3648 | return; |
---|
3649 | } |
---|
3650 | if ( getSlice()->getEnableTMVPFlag()) |
---|
3651 | { |
---|
3652 | //>> MTK colocated-RightBottom |
---|
3653 | UInt uiPartIdxRB; |
---|
3654 | |
---|
3655 | deriveRightBottomIdx( uiPUIdx, uiPartIdxRB ); |
---|
3656 | |
---|
3657 | UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB]; |
---|
3658 | UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); |
---|
3659 | |
---|
3660 | TComMv cColMv; |
---|
3661 | Int iRefIdx; |
---|
3662 | Int uiLCUIdx = -1; |
---|
3663 | |
---|
3664 | if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) // image boundary check |
---|
3665 | { |
---|
3666 | } |
---|
3667 | else if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples() ) |
---|
3668 | { |
---|
3669 | } |
---|
3670 | else |
---|
3671 | { |
---|
3672 | if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) && // is not at the last column of LCU |
---|
3673 | ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row of LCU |
---|
3674 | { |
---|
3675 | uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ]; |
---|
3676 | uiLCUIdx = getAddr(); |
---|
3677 | } |
---|
3678 | else if ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) // is not at the last column of LCU But is last row of LCU |
---|
3679 | { |
---|
3680 | uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ]; |
---|
3681 | } |
---|
3682 | else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU |
---|
3683 | { |
---|
3684 | uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ]; |
---|
3685 | uiLCUIdx = getAddr() + 1; |
---|
3686 | } |
---|
3687 | else //is the right bottom corner of LCU |
---|
3688 | { |
---|
3689 | uiAbsPartAddr = 0; |
---|
3690 | } |
---|
3691 | } |
---|
3692 | |
---|
3693 | iRefIdx = 0; |
---|
3694 | Bool bExistMV = false; |
---|
3695 | UInt uiPartIdxCenter; |
---|
3696 | UInt uiCurLCUIdx = getAddr(); |
---|
3697 | Int dir = 0; |
---|
3698 | UInt uiArrayAddr = iCount; |
---|
3699 | xDeriveCenterIdx( uiPUIdx, uiPartIdxCenter ); |
---|
3700 | bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_0, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx ); |
---|
3701 | if( bExistMV == false ) |
---|
3702 | { |
---|
3703 | bExistMV = xGetColMVP( REF_PIC_LIST_0, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx ); |
---|
3704 | } |
---|
3705 | if( bExistMV ) |
---|
3706 | { |
---|
3707 | dir |= 1; |
---|
3708 | pcMvFieldNeighbours[ 2 * uiArrayAddr ].setMvField( cColMv, iRefIdx ); |
---|
3709 | } |
---|
3710 | |
---|
3711 | if ( getSlice()->isInterB() ) |
---|
3712 | { |
---|
3713 | #if H_3D_TMVP |
---|
3714 | iRefIdx = 0; |
---|
3715 | #endif |
---|
3716 | bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_1, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx); |
---|
3717 | if( bExistMV == false ) |
---|
3718 | { |
---|
3719 | bExistMV = xGetColMVP( REF_PIC_LIST_1, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx ); |
---|
3720 | } |
---|
3721 | if( bExistMV ) |
---|
3722 | { |
---|
3723 | dir |= 2; |
---|
3724 | pcMvFieldNeighbours[ 2 * uiArrayAddr + 1 ].setMvField( cColMv, iRefIdx ); |
---|
3725 | } |
---|
3726 | } |
---|
3727 | |
---|
3728 | if (dir != 0) |
---|
3729 | { |
---|
3730 | puhInterDirNeighbours[uiArrayAddr] = dir; |
---|
3731 | abCandIsInter[uiArrayAddr] = true; |
---|
3732 | #if H_3D_NBDV |
---|
3733 | pcMvFieldNeighbours[iCount<<1 ].getMv().setIDVFlag (false); |
---|
3734 | pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false); |
---|
3735 | #endif |
---|
3736 | if ( mrgCandIdx == iCount ) |
---|
3737 | { |
---|
3738 | return; |
---|
3739 | } |
---|
3740 | iCount++; |
---|
3741 | } |
---|
3742 | } |
---|
3743 | // early termination |
---|
3744 | if (iCount == getSlice()->getMaxNumMergeCand()) |
---|
3745 | { |
---|
3746 | return; |
---|
3747 | } |
---|
3748 | UInt uiArrayAddr = iCount; |
---|
3749 | UInt uiCutoff = uiArrayAddr; |
---|
3750 | |
---|
3751 | if ( getSlice()->isInterB() && iCount<5) // JCT3V-F0129 by Qualcomm |
---|
3752 | { |
---|
3753 | UInt uiPriorityList0[12] = {0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3}; |
---|
3754 | UInt uiPriorityList1[12] = {1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2}; |
---|
3755 | |
---|
3756 | for (Int idx=0; idx<uiCutoff*(uiCutoff-1) && uiArrayAddr!= getSlice()->getMaxNumMergeCand(); idx++) |
---|
3757 | { |
---|
3758 | Int i = uiPriorityList0[idx]; Int j = uiPriorityList1[idx]; |
---|
3759 | if (abCandIsInter[i] && abCandIsInter[j]&& (puhInterDirNeighbours[i]&0x1)&&(puhInterDirNeighbours[j]&0x2)) |
---|
3760 | { |
---|
3761 | abCandIsInter[uiArrayAddr] = true; |
---|
3762 | puhInterDirNeighbours[uiArrayAddr] = 3; |
---|
3763 | |
---|
3764 | // get Mv from cand[i] and cand[j] |
---|
3765 | pcMvFieldNeighbours[uiArrayAddr << 1].setMvField(pcMvFieldNeighbours[i<<1].getMv(), pcMvFieldNeighbours[i<<1].getRefIdx()); |
---|
3766 | pcMvFieldNeighbours[( uiArrayAddr << 1 ) + 1].setMvField(pcMvFieldNeighbours[(j<<1)+1].getMv(), pcMvFieldNeighbours[(j<<1)+1].getRefIdx()); |
---|
3767 | |
---|
3768 | Int iRefPOCL0 = m_pcSlice->getRefPOC( REF_PIC_LIST_0, pcMvFieldNeighbours[(uiArrayAddr<<1)].getRefIdx() ); |
---|
3769 | Int iRefPOCL1 = m_pcSlice->getRefPOC( REF_PIC_LIST_1, pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getRefIdx() ); |
---|
3770 | if (iRefPOCL0 == iRefPOCL1 && pcMvFieldNeighbours[(uiArrayAddr<<1)].getMv() == pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getMv()) |
---|
3771 | { |
---|
3772 | abCandIsInter[uiArrayAddr] = false; |
---|
3773 | } |
---|
3774 | else |
---|
3775 | { |
---|
3776 | uiArrayAddr++; |
---|
3777 | } |
---|
3778 | } |
---|
3779 | } |
---|
3780 | } |
---|
3781 | // early termination |
---|
3782 | if (uiArrayAddr == getSlice()->getMaxNumMergeCand()) |
---|
3783 | { |
---|
3784 | return; |
---|
3785 | } |
---|
3786 | |
---|
3787 | Int iNumRefIdx = (getSlice()->isInterB()) ? min(m_pcSlice->getNumRefIdx(REF_PIC_LIST_0), m_pcSlice->getNumRefIdx(REF_PIC_LIST_1)) : m_pcSlice->getNumRefIdx(REF_PIC_LIST_0); |
---|
3788 | Int r = 0; |
---|
3789 | Int refcnt = 0; |
---|
3790 | while (uiArrayAddr < getSlice()->getMaxNumMergeCand()) |
---|
3791 | { |
---|
3792 | abCandIsInter[uiArrayAddr] = true; |
---|
3793 | puhInterDirNeighbours[uiArrayAddr] = 1; |
---|
3794 | pcMvFieldNeighbours[uiArrayAddr << 1].setMvField( TComMv(0, 0), r); |
---|
3795 | |
---|
3796 | if ( getSlice()->isInterB() ) |
---|
3797 | { |
---|
3798 | puhInterDirNeighbours[uiArrayAddr] = 3; |
---|
3799 | pcMvFieldNeighbours[(uiArrayAddr << 1) + 1].setMvField(TComMv(0, 0), r); |
---|
3800 | } |
---|
3801 | uiArrayAddr++; |
---|
3802 | if ( refcnt == iNumRefIdx - 1 ) |
---|
3803 | { |
---|
3804 | r = 0; |
---|
3805 | } |
---|
3806 | else |
---|
3807 | { |
---|
3808 | ++r; |
---|
3809 | ++refcnt; |
---|
3810 | } |
---|
3811 | } |
---|
3812 | |
---|
3813 | numValidMergeCand = uiArrayAddr; |
---|
3814 | } |
---|
3815 | |
---|
3816 | |
---|
3817 | |
---|
3818 | /** Constructs a list of merging candidates |
---|
3819 | * \param uiAbsPartIdx |
---|
3820 | * \param uiPUIdx |
---|
3821 | * \param uiDepth |
---|
3822 | * \param pcMvFieldNeighbours |
---|
3823 | * \param puhInterDirNeighbours |
---|
3824 | * \param numValidMergeCand |
---|
3825 | */ |
---|
3826 | #if H_3D |
---|
3827 | Void TComDataCU::xGetInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours |
---|
3828 | #else |
---|
3829 | Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours |
---|
3830 | #endif |
---|
3831 | #if H_3D_VSP |
---|
3832 | , Int* vspFlag |
---|
3833 | , InheritedVSPDisInfo* inheritedVSPDisInfo |
---|
3834 | #endif |
---|
3835 | #if H_3D_SPIVMP |
---|
3836 | , Bool* pbSPIVMPFlag, TComMvField* pcMvFieldSP, UChar* puhInterDirSP |
---|
3837 | #endif |
---|
3838 | , Int& numValidMergeCand, Int mrgCandIdx |
---|
3839 | ) |
---|
3840 | { |
---|
3841 | UInt uiAbsPartAddr = m_uiAbsIdxInLCU + uiAbsPartIdx; |
---|
3842 | #if H_3D_IV_MERGE |
---|
3843 | //////////////////////////// |
---|
3844 | //////// INIT LISTS //////// |
---|
3845 | //////////////////////////// |
---|
3846 | TComMv cZeroMv; |
---|
3847 | Bool abCandIsInter[ MRG_MAX_NUM_CANDS_MEM ]; |
---|
3848 | #else |
---|
3849 | Bool abCandIsInter[ MRG_MAX_NUM_CANDS ]; |
---|
3850 | #endif |
---|
3851 | #if H_3D |
---|
3852 | TComMvField tmpMV[2]; |
---|
3853 | UChar tmpDir; |
---|
3854 | |
---|
3855 | #if H_3D_DDD |
---|
3856 | m_iUseDDDCandIdx = -1; |
---|
3857 | #endif |
---|
3858 | |
---|
3859 | ////////////////////////////////// |
---|
3860 | //////// GET DISPARITIES //////// |
---|
3861 | ////////////////////////////////// |
---|
3862 | DisInfo cDisInfo = getDvInfo(uiAbsPartIdx); |
---|
3863 | for(Int i = 0; i < MRG_MAX_NUM_CANDS_MEM; i++) |
---|
3864 | { |
---|
3865 | inheritedVSPDisInfo[i].m_acDvInfo = cDisInfo; // To prevent run-time error, this code must be executed always for merging process. |
---|
3866 | } |
---|
3867 | m_cDefaultDisInfo = cDisInfo; |
---|
3868 | |
---|
3869 | if (!( getSlice()->getIsDepth() || getSlice()->getViewIndex()>0)) // current slice is not both dependent view or depth |
---|
3870 | { |
---|
3871 | return; |
---|
3872 | } |
---|
3873 | #else |
---|
3874 | for( UInt ui = 0; ui < getSlice()->getMaxNumMergeCand(); ++ui ) |
---|
3875 | { |
---|
3876 | abCandIsInter[ui] = false; |
---|
3877 | pcMvFieldNeighbours[ ( ui << 1 ) ].setRefIdx(NOT_VALID); |
---|
3878 | pcMvFieldNeighbours[ ( ui << 1 ) + 1 ].setRefIdx(NOT_VALID); |
---|
3879 | } |
---|
3880 | #endif |
---|
3881 | |
---|
3882 | numValidMergeCand = getSlice()->getMaxNumMergeCand(); |
---|
3883 | #if H_3D |
---|
3884 | ////////////////////////////////// |
---|
3885 | //////// DERIVE LOCATIONS //////// |
---|
3886 | ////////////////////////////////// |
---|
3887 | #endif |
---|
3888 | // compute the location of the current PU |
---|
3889 | Int xP, yP, nPSW, nPSH; |
---|
3890 | this->getPartPosition(uiPUIdx, xP, yP, nPSW, nPSH); |
---|
3891 | |
---|
3892 | Int iCount = 0; |
---|
3893 | |
---|
3894 | UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB; |
---|
3895 | #if !H_3D |
---|
3896 | PartSize cCurPS = getPartitionSize( uiAbsPartIdx ); |
---|
3897 | #endif |
---|
3898 | deriveLeftRightTopIdxGeneral( uiAbsPartIdx, uiPUIdx, uiPartIdxLT, uiPartIdxRT ); |
---|
3899 | deriveLeftBottomIdxGeneral ( uiAbsPartIdx, uiPUIdx, uiPartIdxLB ); |
---|
3900 | #if H_3D |
---|
3901 | Bool bMPIFlag = getSlice()->getVPS()->getMPIFlag( getSlice()->getLayerIdInVps() ); |
---|
3902 | Bool bIsDepth = getSlice()->getIsDepth(); |
---|
3903 | #endif |
---|
3904 | |
---|
3905 | #if H_3D_IC |
---|
3906 | Bool bICFlag = getICFlag(uiAbsPartIdx); |
---|
3907 | #endif |
---|
3908 | #if H_3D_ARP |
---|
3909 | Bool bARPFlag = getARPW(uiAbsPartIdx)>0 ? true : false; |
---|
3910 | #endif |
---|
3911 | #if H_3D_DBBP |
---|
3912 | Bool bDBBPFlag = getDBBPFlag(uiAbsPartIdx); |
---|
3913 | #endif |
---|
3914 | |
---|
3915 | #if H_3D |
---|
3916 | Int iPosLeftAbove[2] = {-1, -1}; |
---|
3917 | |
---|
3918 | Int iCountHEVC = 0; |
---|
3919 | Int iCount3DV = 0; |
---|
3920 | Int numA1B1B0 = 0; |
---|
3921 | Int numA0B2 = 0; |
---|
3922 | |
---|
3923 | #if H_3D_NBDV |
---|
3924 | for(Int i = 0; i < MRG_MAX_NUM_CANDS_MEM; i++) |
---|
3925 | { |
---|
3926 | pcMvFieldNeighbours[i<<1 ].getMv().setIDVFlag (false); |
---|
3927 | pcMvFieldNeighbours[(i<<1)+1].getMv().setIDVFlag (false); |
---|
3928 | } |
---|
3929 | #endif |
---|
3930 | |
---|
3931 | //left |
---|
3932 | UInt uiLeftPartIdx = 0; |
---|
3933 | TComDataCU* pcCULeft = 0; |
---|
3934 | pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB ); |
---|
3935 | if (getAvailableFlagA1()) |
---|
3936 | { |
---|
3937 | iPosLeftAbove[0] = numA1B1B0; |
---|
3938 | #if H_3D_VSP |
---|
3939 | if (pcCULeft->getVSPFlag(uiLeftPartIdx) != 0 |
---|
3940 | #if H_3D_IC |
---|
3941 | && !bICFlag |
---|
3942 | #endif |
---|
3943 | #if H_3D_ARP |
---|
3944 | && !bARPFlag |
---|
3945 | #endif |
---|
3946 | ) |
---|
3947 | { |
---|
3948 | vspFlag[numA1B1B0] = 1; |
---|
3949 | } |
---|
3950 | #endif |
---|
3951 | numA1B1B0++; |
---|
3952 | } |
---|
3953 | |
---|
3954 | // above |
---|
3955 | UInt uiAbovePartIdx = 0; |
---|
3956 | TComDataCU* pcCUAbove = 0; |
---|
3957 | pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT ); |
---|
3958 | if ( getAvailableFlagB1()) |
---|
3959 | { |
---|
3960 | iPosLeftAbove[1] = numA1B1B0; |
---|
3961 | #if H_3D_VSP |
---|
3962 | if ( ( ( getAddr() - pcCUAbove->getAddr() ) == 0) && (pcCUAbove->getVSPFlag(uiAbovePartIdx) != 0) |
---|
3963 | #if H_3D_IC |
---|
3964 | && !bICFlag |
---|
3965 | #endif |
---|
3966 | #if H_3D_ARP |
---|
3967 | && !bARPFlag |
---|
3968 | #endif |
---|
3969 | ) |
---|
3970 | { |
---|
3971 | vspFlag[numA1B1B0] = 1; |
---|
3972 | } |
---|
3973 | #endif |
---|
3974 | |
---|
3975 | numA1B1B0++; |
---|
3976 | } |
---|
3977 | |
---|
3978 | // above right |
---|
3979 | UInt uiAboveRightPartIdx = 0; |
---|
3980 | TComDataCU* pcCUAboveRight = 0; |
---|
3981 | pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT ); |
---|
3982 | if ( getAvailableFlagB0()) |
---|
3983 | { |
---|
3984 | #if H_3D_VSP |
---|
3985 | if ( ( ( getAddr() - pcCUAboveRight->getAddr() ) == 0) && (pcCUAboveRight->getVSPFlag(uiAboveRightPartIdx) != 0) |
---|
3986 | #if H_3D_IC |
---|
3987 | && !bICFlag |
---|
3988 | #endif |
---|
3989 | #if H_3D_ARP |
---|
3990 | && !bARPFlag |
---|
3991 | #endif |
---|
3992 | ) |
---|
3993 | { |
---|
3994 | vspFlag[numA1B1B0] = 1; |
---|
3995 | } |
---|
3996 | #endif |
---|
3997 | numA1B1B0++; |
---|
3998 | } |
---|
3999 | |
---|
4000 | // left bottom |
---|
4001 | UInt uiLeftBottomPartIdx = 0; |
---|
4002 | TComDataCU* pcCULeftBottom = getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB ); |
---|
4003 | if ( getAvailableFlagA0()) |
---|
4004 | { |
---|
4005 | #if H_3D_VSP |
---|
4006 | if (pcCULeftBottom->getVSPFlag(uiLeftBottomPartIdx) != 0 |
---|
4007 | #if H_3D_IC |
---|
4008 | && !bICFlag |
---|
4009 | #endif |
---|
4010 | #if H_3D_ARP |
---|
4011 | && !bARPFlag |
---|
4012 | #endif |
---|
4013 | ) |
---|
4014 | { |
---|
4015 | vspFlag[numA1B1B0] = 1; |
---|
4016 | } |
---|
4017 | #endif |
---|
4018 | iCountHEVC++; |
---|
4019 | numA0B2++; |
---|
4020 | } |
---|
4021 | |
---|
4022 | // above left |
---|
4023 | UInt uiAboveLeftPartIdx = 0; |
---|
4024 | TComDataCU* pcCUAboveLeft = 0; |
---|
4025 | pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr ); |
---|
4026 | if (getAvailableFlagB2()) |
---|
4027 | { |
---|
4028 | #if H_3D_VSP |
---|
4029 | if ( ( ( getAddr() - pcCUAboveLeft->getAddr() ) == 0) && (pcCUAboveLeft->getVSPFlag(uiAboveLeftPartIdx) != 0) |
---|
4030 | #if H_3D_IC |
---|
4031 | && !bICFlag |
---|
4032 | #endif |
---|
4033 | #if H_3D_ARP |
---|
4034 | && !bARPFlag |
---|
4035 | #endif |
---|
4036 | ) |
---|
4037 | { |
---|
4038 | vspFlag[numA1B1B0+iCountHEVC] = 1; |
---|
4039 | } |
---|
4040 | #endif |
---|
4041 | iCountHEVC++; |
---|
4042 | numA0B2++; |
---|
4043 | } |
---|
4044 | |
---|
4045 | iCountHEVC = numValidMergeCand; |
---|
4046 | #endif |
---|
4047 | |
---|
4048 | |
---|
4049 | #if H_3D_IV_MERGE |
---|
4050 | |
---|
4051 | ///////////////////////////////////////////// |
---|
4052 | //////// TEXTURE MERGE CANDIDATE (T) //////// |
---|
4053 | ///////////////////////////////////////////// |
---|
4054 | |
---|
4055 | if( bMPIFlag) |
---|
4056 | { |
---|
4057 | tmpMV[0].setMvField( cZeroMv, NOT_VALID ); |
---|
4058 | tmpMV[1].setMvField( cZeroMv, NOT_VALID ); |
---|
4059 | tmpDir = 0; |
---|
4060 | |
---|
4061 | TComPic * pcTexPic = m_pcSlice->getTexturePic(); |
---|
4062 | #if H_3D_FCO |
---|
4063 | if (pcTexturePic->getReconMark()) |
---|
4064 | { |
---|
4065 | #endif |
---|
4066 | TComPicYuv* pcTexRec = pcTexPic->getPicYuvRec (); |
---|
4067 | UInt uiPartAddr; |
---|
4068 | Int iWidth, iHeight; |
---|
4069 | Int iCurrPosX, iCurrPosY; |
---|
4070 | |
---|
4071 | this->getPartIndexAndSize( uiPUIdx, uiPartAddr, iWidth, iHeight ); |
---|
4072 | pcTexRec->getTopLeftSamplePos( this->getAddr(), this->getZorderIdxInCU() + uiPartAddr, iCurrPosX, iCurrPosY ); |
---|
4073 | |
---|
4074 | Int iPUWidth, iPUHeight, iNumPart, iNumPartLine; |
---|
4075 | this->getSPPara(iWidth, iHeight, iNumPart, iNumPartLine, iPUWidth, iPUHeight); |
---|
4076 | |
---|
4077 | for (Int i=0; i<iNumPart; i++) |
---|
4078 | { |
---|
4079 | puhInterDirSP[i] = 0; |
---|
4080 | pcMvFieldSP[2*i].getMv().set(0, 0); |
---|
4081 | pcMvFieldSP[2*i+1].getMv().set(0, 0); |
---|
4082 | pcMvFieldSP[2*i].setRefIdx(-1); |
---|
4083 | pcMvFieldSP[2*i+1].setRefIdx(-1); |
---|
4084 | } |
---|
4085 | |
---|
4086 | Int iTexCUAddr; |
---|
4087 | Int iTexAbsPartIdx; |
---|
4088 | TComDataCU* pcTexCU; |
---|
4089 | Int iPartition = 0; |
---|
4090 | Int iInterDirSaved = 0; |
---|
4091 | TComMvField cMvFieldSaved[2]; |
---|
4092 | |
---|
4093 | Int iOffsetX = iPUWidth/2;; |
---|
4094 | Int iOffsetY = iPUHeight/2; |
---|
4095 | |
---|
4096 | Int iTexPosX, iTexPosY; |
---|
4097 | const TComMv cMvRounding( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) ); |
---|
4098 | for (Int i=iCurrPosY; i < iCurrPosY + iHeight; i += iPUHeight) |
---|
4099 | { |
---|
4100 | for (Int j = iCurrPosX; j < iCurrPosX + iWidth; j += iPUWidth) |
---|
4101 | { |
---|
4102 | iTexPosX = j + iOffsetX; |
---|
4103 | iTexPosY = i + iOffsetY; |
---|
4104 | pcTexRec->getCUAddrAndPartIdx( iTexPosX, iTexPosY, iTexCUAddr, iTexAbsPartIdx ); |
---|
4105 | pcTexCU = pcTexPic->getCU( iTexCUAddr ); |
---|
4106 | |
---|
4107 | if( pcTexCU && !pcTexCU->isIntra(iTexAbsPartIdx) ) |
---|
4108 | { |
---|
4109 | for( UInt uiCurrRefListId = 0; uiCurrRefListId < 2; uiCurrRefListId++ ) |
---|
4110 | { |
---|
4111 | RefPicList eCurrRefPicList = RefPicList( uiCurrRefListId ); |
---|
4112 | TComMvField cTexMvField; |
---|
4113 | pcTexCU->getMvField( pcTexCU, iTexAbsPartIdx, eCurrRefPicList, cTexMvField ); |
---|
4114 | Int iValidDepRef = getPic()->isTextRefValid( eCurrRefPicList, cTexMvField.getRefIdx() ); |
---|
4115 | if( (cTexMvField.getRefIdx()>=0) && ( iValidDepRef >= 0 ) ) |
---|
4116 | { |
---|
4117 | TComMv cMv = cTexMvField.getMv() + cMvRounding; |
---|
4118 | cMv >>=2; |
---|
4119 | #if !(NTT_BUG_FIX_TK54) |
---|
4120 | this->clipMv( cMv ); |
---|
4121 | #endif |
---|
4122 | pcMvFieldSP[2*iPartition + uiCurrRefListId].setMvField(cMv, iValidDepRef); |
---|
4123 | } |
---|
4124 | } |
---|
4125 | } |
---|
4126 | puhInterDirSP[iPartition] = (pcMvFieldSP[2*iPartition].getRefIdx()!=-1 ? 1: 0) + (pcMvFieldSP[2*iPartition+1].getRefIdx()!=-1 ? 2: 0); |
---|
4127 | if (puhInterDirSP[iPartition] == 0) |
---|
4128 | { |
---|
4129 | if (iInterDirSaved != 0) |
---|
4130 | { |
---|
4131 | puhInterDirSP[iPartition] = iInterDirSaved; |
---|
4132 | pcMvFieldSP[2*iPartition] = cMvFieldSaved[0]; |
---|
4133 | pcMvFieldSP[2*iPartition + 1] = cMvFieldSaved[1]; |
---|
4134 | } |
---|
4135 | } |
---|
4136 | else |
---|
4137 | { |
---|
4138 | if (iInterDirSaved ==0) |
---|
4139 | { |
---|
4140 | pbSPIVMPFlag[iCount] = true; |
---|
4141 | tmpDir = puhInterDirSP[iPartition]; |
---|
4142 | tmpMV[0] = pcMvFieldSP[2*iPartition]; |
---|
4143 | tmpMV[1] = pcMvFieldSP[2*iPartition+1]; |
---|
4144 | |
---|
4145 | if (iPartition != 0) |
---|
4146 | { |
---|
4147 | for (Int iPart = iPartition-1; iPart >= 0; iPart--) |
---|
4148 | { |
---|
4149 | puhInterDirSP[iPart] = puhInterDirSP[iPartition]; |
---|
4150 | pcMvFieldSP[2*iPart] = pcMvFieldSP[2*iPartition]; |
---|
4151 | pcMvFieldSP[2*iPart + 1] = pcMvFieldSP[2*iPartition + 1]; |
---|
4152 | } |
---|
4153 | } |
---|
4154 | } |
---|
4155 | iInterDirSaved = puhInterDirSP[iPartition]; |
---|
4156 | cMvFieldSaved[0] = pcMvFieldSP[2*iPartition]; |
---|
4157 | cMvFieldSaved[1] = pcMvFieldSP[2*iPartition + 1]; |
---|
4158 | } |
---|
4159 | iPartition ++; |
---|
4160 | } |
---|
4161 | } |
---|
4162 | #if H_3D_FCO |
---|
4163 | } |
---|
4164 | #endif |
---|
4165 | if( tmpDir != 0 ) |
---|
4166 | { |
---|
4167 | Int iCnloop = 0; |
---|
4168 | Bool bRemoveSpa = false; //pruning |
---|
4169 | |
---|
4170 | for(Int i = 0; i < 2; i ++) |
---|
4171 | { |
---|
4172 | iCnloop = iPosLeftAbove[i]; |
---|
4173 | if ( iCnloop == -1 ) |
---|
4174 | { |
---|
4175 | continue; |
---|
4176 | } |
---|
4177 | if(tmpDir == puhInterDirNeighbours[iCnloop] && tmpMV[0]==pcMvFieldNeighbours[(iCnloop<<1)] && tmpMV[1]==pcMvFieldNeighbours[(iCnloop<<1)+1]) |
---|
4178 | { |
---|
4179 | bRemoveSpa = true; |
---|
4180 | break; |
---|
4181 | } |
---|
4182 | } |
---|
4183 | |
---|
4184 | if (!bRemoveSpa) |
---|
4185 | { |
---|
4186 | rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, 5-iCount, iCount3DV); |
---|
4187 | } |
---|
4188 | else |
---|
4189 | { |
---|
4190 | rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (iCnloop-iCount), iCount3DV); |
---|
4191 | if (iCnloop<numA1B1B0) |
---|
4192 | { |
---|
4193 | numA1B1B0--; |
---|
4194 | } |
---|
4195 | iCountHEVC--; |
---|
4196 | |
---|
4197 | if (iPosLeftAbove[0] != -1) |
---|
4198 | { |
---|
4199 | if (iCnloop == iPosLeftAbove[0]) |
---|
4200 | { |
---|
4201 | iPosLeftAbove[0] = -1; |
---|
4202 | } |
---|
4203 | else |
---|
4204 | { |
---|
4205 | iPosLeftAbove[0]++; |
---|
4206 | } |
---|
4207 | } |
---|
4208 | if (iPosLeftAbove[1] != -1) |
---|
4209 | { |
---|
4210 | if (iCnloop == iPosLeftAbove[1]) |
---|
4211 | { |
---|
4212 | iPosLeftAbove[1] = -1; |
---|
4213 | } |
---|
4214 | else |
---|
4215 | { |
---|
4216 | if (iCnloop > iPosLeftAbove[1]) |
---|
4217 | { |
---|
4218 | iPosLeftAbove[1]++; |
---|
4219 | } |
---|
4220 | } |
---|
4221 | } |
---|
4222 | } |
---|
4223 | pcMvFieldNeighbours[iCount<<1].setMvField(tmpMV[0].getMv(), tmpMV[0].getRefIdx()); |
---|
4224 | pcMvFieldNeighbours[(iCount<<1)+1].setMvField(tmpMV[1].getMv(), tmpMV[1].getRefIdx()); |
---|
4225 | |
---|
4226 | puhInterDirNeighbours[iCount] = tmpDir; |
---|
4227 | |
---|
4228 | if ( mrgCandIdx == iCount ) |
---|
4229 | { |
---|
4230 | return; |
---|
4231 | } |
---|
4232 | iCount ++; |
---|
4233 | } |
---|
4234 | } |
---|
4235 | #if H_3D_DDD |
---|
4236 | if( m_pcSlice->getIsDepth() && m_pcSlice->getViewIndex() != 0 && bMPIFlag ) |
---|
4237 | { |
---|
4238 | UInt uiPartIdx; |
---|
4239 | TComDataCU *pcTextureCU = m_pcSlice->getTexturePic()->getCU( getAddr() ); |
---|
4240 | TComSlice *pcTextureSlice = pcTextureCU->getSlice(); |
---|
4241 | |
---|
4242 | |
---|
4243 | tmpMV[0].setMvField( cZeroMv, NOT_VALID ); |
---|
4244 | tmpMV[1].setMvField( cZeroMv, NOT_VALID ); |
---|
4245 | tmpDir = 0; |
---|
4246 | |
---|
4247 | xDeriveCenterIdx( uiPUIdx, uiPartIdx); |
---|
4248 | |
---|
4249 | if ( pcTextureCU && !pcTextureCU->isIntra( uiPartIdx ) ) |
---|
4250 | { |
---|
4251 | |
---|
4252 | TComMvField cMVField; |
---|
4253 | Int iDV = 0; |
---|
4254 | Int iViewIdx = 0; |
---|
4255 | pcTextureCU->getMvField( pcTextureCU, uiPartIdx, REF_PIC_LIST_0, cMVField ); |
---|
4256 | if( cMVField.getRefIdx() >= 0 ) |
---|
4257 | { |
---|
4258 | if( pcTextureSlice->getRefPOC( REF_PIC_LIST_0, cMVField.getRefIdx()) == pcTextureSlice->getPOC() ) |
---|
4259 | { |
---|
4260 | iViewIdx = pcTextureSlice->getRefPic( REF_PIC_LIST_0, cMVField.getRefIdx())->getViewIndex(); |
---|
4261 | iDV = cMVField.getHor(); |
---|
4262 | |
---|
4263 | |
---|
4264 | Int iValidDepRef = getPic()->isTextRefValid( REF_PIC_LIST_0, cMVField.getRefIdx() ); |
---|
4265 | |
---|
4266 | if( iValidDepRef >= 0 ) |
---|
4267 | { |
---|
4268 | const TComMv cAdd( 2, 2 ); |
---|
4269 | cMVField.getMv() += cAdd; |
---|
4270 | cMVField.getMv() >>= 2; |
---|
4271 | #if !(NTT_BUG_FIX_TK54) |
---|
4272 | clipMv( cMVField.getMv() ); |
---|
4273 | #endif |
---|
4274 | tmpMV[ 0 ].setMvField( cMVField.getMv(), iValidDepRef ); |
---|
4275 | tmpDir = 1; |
---|
4276 | } |
---|
4277 | } |
---|
4278 | } |
---|
4279 | |
---|
4280 | pcTextureCU->getMvField( pcTextureCU, uiPartIdx, REF_PIC_LIST_1, cMVField ); |
---|
4281 | |
---|
4282 | if( !tmpDir && cMVField.getRefIdx() >= 0 ) |
---|
4283 | { |
---|
4284 | if( pcTextureSlice->getRefPOC( REF_PIC_LIST_1, cMVField.getRefIdx()) == pcTextureSlice->getPOC() ) |
---|
4285 | { |
---|
4286 | iViewIdx = pcTextureSlice->getRefPic( REF_PIC_LIST_1, cMVField.getRefIdx())->getViewIndex(); |
---|
4287 | iDV = cMVField.getHor(); |
---|
4288 | |
---|
4289 | Int iValidDepRef = getPic()->isTextRefValid( REF_PIC_LIST_1, cMVField.getRefIdx() ); |
---|
4290 | |
---|
4291 | if( iValidDepRef >= 0 ) |
---|
4292 | { |
---|
4293 | const TComMv cAdd( 2, 2 ); |
---|
4294 | cMVField.getMv() += cAdd; |
---|
4295 | cMVField.getMv() >>= 2; |
---|
4296 | #if !(NTT_BUG_FIX_TK54) |
---|
4297 | clipMv( cMVField.getMv() ); |
---|
4298 | #endif |
---|
4299 | tmpMV[ 1 ].setMvField( cMVField.getMv(), iValidDepRef ); |
---|
4300 | tmpDir = 2; |
---|
4301 | } |
---|
4302 | } |
---|
4303 | } |
---|
4304 | if( tmpDir != 0 ) |
---|
4305 | { |
---|
4306 | rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, 5-iCount, iCount3DV); |
---|
4307 | m_ucDDTmpDepth = m_pcSlice->getDepthFromDV( iDV, iViewIdx ); |
---|
4308 | m_iUseDDDCandIdx = iCount; |
---|
4309 | |
---|
4310 | if( tmpDir == 1 ) |
---|
4311 | { |
---|
4312 | pcMvFieldNeighbours[ iCount << 1 ] = tmpMV[ 0 ]; |
---|
4313 | } |
---|
4314 | else if( tmpDir == 2 ) |
---|
4315 | { |
---|
4316 | pcMvFieldNeighbours[( iCount << 1 ) + 1 ] = tmpMV[ 1 ]; |
---|
4317 | } |
---|
4318 | |
---|
4319 | abCandIsInter [ iCount ] = true; |
---|
4320 | puhInterDirNeighbours[ iCount ] = tmpDir; |
---|
4321 | |
---|
4322 | if ( mrgCandIdx == iCount ) |
---|
4323 | { |
---|
4324 | return; |
---|
4325 | } |
---|
4326 | iCount ++; |
---|
4327 | |
---|
4328 | Int iLeftAboveAvail = 0; |
---|
4329 | if( iPosLeftAbove[ 0 ] != -1 ) |
---|
4330 | { |
---|
4331 | iPosLeftAbove[ 0 ] = iCount; |
---|
4332 | iLeftAboveAvail = 1; |
---|
4333 | } |
---|
4334 | if( iPosLeftAbove[ 1 ] != -1 ) |
---|
4335 | { |
---|
4336 | iPosLeftAbove[ 1 ] = iCount + iLeftAboveAvail; |
---|
4337 | } |
---|
4338 | } |
---|
4339 | } |
---|
4340 | } |
---|
4341 | #endif |
---|
4342 | ///////////////////////////////////////////////////////////////// |
---|
4343 | //////// DERIVE IvMC, IvMCShift,IvDCShift, IvDC Candidates ///// |
---|
4344 | ///////////////////////////////////////////////////////////////// |
---|
4345 | |
---|
4346 | Int posIvDC = -1; |
---|
4347 | |
---|
4348 | // { IvMCL0, IvMCL1, IvDCL0, IvDCL1, IvMCL0Shift, IvMCL1Shift, IvDCL0Shift, IvDCL1Shift }; |
---|
4349 | // An enumerator would be appropriate here! |
---|
4350 | TComMv ivCandMv [8]; |
---|
4351 | Int ivCandRefIdx[8] = {-1, -1, -1, -1, -1, -1, -1, -1}; |
---|
4352 | |
---|
4353 | // { IvMC, IvDC, IvMCShift, IvDCShift }; |
---|
4354 | Int ivCandDir [4] = {0, 0, 0, 0}; |
---|
4355 | |
---|
4356 | Bool ivMvPredFlag = getSlice()->getVPS()->getIvMvPredFlag( getSlice()->getLayerIdInVps() ); |
---|
4357 | |
---|
4358 | if ( ivMvPredFlag && cDisInfo.m_aVIdxCan!=-1) |
---|
4359 | { |
---|
4360 | getInterViewMergeCands(uiPUIdx, ivCandRefIdx, ivCandMv, &cDisInfo, ivCandDir , bIsDepth, pcMvFieldSP, puhInterDirSP ); |
---|
4361 | } |
---|
4362 | |
---|
4363 | /////////////////////////////////////////////// |
---|
4364 | //////// INTER VIEW MOTION COMP(IvMC) ///////// |
---|
4365 | /////////////////////////////////////////////// |
---|
4366 | if( getSlice()->getIsDepth() ) |
---|
4367 | { |
---|
4368 | ivCandDir[1] = ivCandDir[2] = ivCandDir[3] = 0; |
---|
4369 | } |
---|
4370 | |
---|
4371 | if( ivCandDir[0] ) |
---|
4372 | { |
---|
4373 | tmpMV[0].setMvField( cZeroMv, NOT_VALID ); |
---|
4374 | tmpMV[1].setMvField( cZeroMv, NOT_VALID ); |
---|
4375 | |
---|
4376 | if( ( ivCandDir[0] & 1 ) == 1 ) |
---|
4377 | { |
---|
4378 | tmpMV[0].setMvField( ivCandMv[ 0 ], ivCandRefIdx[ 0 ] ); |
---|
4379 | } |
---|
4380 | if( ( ivCandDir[0] & 2 ) == 2 ) |
---|
4381 | { |
---|
4382 | tmpMV[1].setMvField( ivCandMv[ 1 ], ivCandRefIdx[ 1 ] ); |
---|
4383 | } |
---|
4384 | |
---|
4385 | Bool bRemoveSpa = false; //pruning |
---|
4386 | Bool bIvMC = false; |
---|
4387 | Int iCnloop=0; |
---|
4388 | |
---|
4389 | if (!bIsDepth) |
---|
4390 | { |
---|
4391 | for(Int i = 0; i < 2; i ++) |
---|
4392 | { |
---|
4393 | iCnloop = iPosLeftAbove[i]; |
---|
4394 | if ( iCnloop == -1 ) |
---|
4395 | { |
---|
4396 | continue; |
---|
4397 | } |
---|
4398 | if(ivCandDir[0] == puhInterDirNeighbours[iCnloop] && tmpMV[0]==pcMvFieldNeighbours[(iCnloop<<1)] && tmpMV[1]==pcMvFieldNeighbours[(iCnloop<<1)+1]) |
---|
4399 | { |
---|
4400 | bRemoveSpa = true; |
---|
4401 | break; |
---|
4402 | } |
---|
4403 | } |
---|
4404 | } |
---|
4405 | if (bIsDepth) |
---|
4406 | { |
---|
4407 | iCnloop = iCount-1; |
---|
4408 | for(; iCnloop >= 0; iCnloop --) |
---|
4409 | { |
---|
4410 | #if H_3D_DDD |
---|
4411 | if( iCnloop == m_iUseDDDCandIdx ) |
---|
4412 | { |
---|
4413 | continue; |
---|
4414 | } |
---|
4415 | #endif |
---|
4416 | if(ivCandDir[0] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==tmpMV[0] && pcMvFieldNeighbours[(iCnloop<<1)+1]==tmpMV[1]) // F0125 compatible with F0093 |
---|
4417 | { |
---|
4418 | bRemoveSpa = true; |
---|
4419 | break; |
---|
4420 | } |
---|
4421 | } |
---|
4422 | } |
---|
4423 | |
---|
4424 | if (!bRemoveSpa) |
---|
4425 | { |
---|
4426 | bIvMC = true; |
---|
4427 | rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (5-iCount), iCount3DV); |
---|
4428 | |
---|
4429 | if (iPosLeftAbove[0] != -1) |
---|
4430 | { |
---|
4431 | iPosLeftAbove[0]++; |
---|
4432 | } |
---|
4433 | if (iPosLeftAbove[1] != -1) |
---|
4434 | { |
---|
4435 | iPosLeftAbove[1]++; |
---|
4436 | } |
---|
4437 | } |
---|
4438 | else if (bRemoveSpa && !bIsDepth) |
---|
4439 | { |
---|
4440 | bIvMC = true; |
---|
4441 | rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (iCnloop-iCount), iCount3DV); |
---|
4442 | |
---|
4443 | if (iCnloop<numA1B1B0) |
---|
4444 | { |
---|
4445 | numA1B1B0--; |
---|
4446 | } |
---|
4447 | iCountHEVC--; |
---|
4448 | |
---|
4449 | if (iPosLeftAbove[0] != -1) |
---|
4450 | { |
---|
4451 | if (iCnloop == iPosLeftAbove[0]) |
---|
4452 | { |
---|
4453 | iPosLeftAbove[0] = -1; |
---|
4454 | } |
---|
4455 | else |
---|
4456 | { |
---|
4457 | iPosLeftAbove[0]++; |
---|
4458 | } |
---|
4459 | } |
---|
4460 | if (iPosLeftAbove[1] != -1) |
---|
4461 | { |
---|
4462 | if (iCnloop == iPosLeftAbove[1]) |
---|
4463 | { |
---|
4464 | iPosLeftAbove[1] = -1; |
---|
4465 | } |
---|
4466 | else |
---|
4467 | { |
---|
4468 | if (iCnloop > iPosLeftAbove[1]) |
---|
4469 | { |
---|
4470 | iPosLeftAbove[1]++; |
---|
4471 | } |
---|
4472 | } |
---|
4473 | } |
---|
4474 | } |
---|
4475 | |
---|
4476 | if (bIvMC) |
---|
4477 | { |
---|
4478 | if(!m_pcSlice->getIsDepth() && getPartitionSize(0) == SIZE_2Nx2N ) |
---|
4479 | { |
---|
4480 | pbSPIVMPFlag[iCount] = true; |
---|
4481 | } |
---|
4482 | #if H_3D_DBBP |
---|
4483 | pbSPIVMPFlag[iCount] &= !bDBBPFlag; |
---|
4484 | #endif |
---|
4485 | if( ( ivCandDir[0] & 1 ) == 1 ) |
---|
4486 | { |
---|
4487 | pcMvFieldNeighbours[iCount<<1].setMvField( ivCandMv[ 0 ], ivCandRefIdx[ 0 ] ); |
---|
4488 | } |
---|
4489 | if( ( ivCandDir[0] & 2 ) == 2 ) |
---|
4490 | { |
---|
4491 | pcMvFieldNeighbours[(iCount<<1)+1].setMvField( ivCandMv[ 1 ], ivCandRefIdx[ 1 ] ); |
---|
4492 | } |
---|
4493 | |
---|
4494 | puhInterDirNeighbours[ iCount ] = ivCandDir[0]; |
---|
4495 | |
---|
4496 | if ( mrgCandIdx == iCount ) |
---|
4497 | { |
---|
4498 | return; |
---|
4499 | } |
---|
4500 | iCount ++; |
---|
4501 | } |
---|
4502 | } |
---|
4503 | |
---|
4504 | // early termination |
---|
4505 | if (iCount == getSlice()->getMaxNumMergeCand()) |
---|
4506 | { |
---|
4507 | return; |
---|
4508 | } |
---|
4509 | #endif |
---|
4510 | |
---|
4511 | #if H_3D |
---|
4512 | iCount += numA1B1B0; |
---|
4513 | #else |
---|
4514 | //left |
---|
4515 | UInt uiLeftPartIdx = 0; |
---|
4516 | TComDataCU* pcCULeft = 0; |
---|
4517 | pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB ); |
---|
4518 | Bool isAvailableA1 = pcCULeft && |
---|
4519 | pcCULeft->isDiffMER(xP -1, yP+nPSH-1, xP, yP) && |
---|
4520 | !( uiPUIdx == 1 && (cCurPS == SIZE_Nx2N || cCurPS == SIZE_nLx2N || cCurPS == SIZE_nRx2N) ) && |
---|
4521 | !pcCULeft->isIntra( uiLeftPartIdx ) ; |
---|
4522 | if ( isAvailableA1 ) |
---|
4523 | { |
---|
4524 | abCandIsInter[iCount] = true; |
---|
4525 | // get Inter Dir |
---|
4526 | puhInterDirNeighbours[iCount] = pcCULeft->getInterDir( uiLeftPartIdx ); |
---|
4527 | // get Mv from Left |
---|
4528 | pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); |
---|
4529 | if ( getSlice()->isInterB() ) |
---|
4530 | { |
---|
4531 | pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); |
---|
4532 | } |
---|
4533 | |
---|
4534 | if ( mrgCandIdx == iCount ) |
---|
4535 | { |
---|
4536 | return; |
---|
4537 | } |
---|
4538 | iCount ++; |
---|
4539 | } |
---|
4540 | |
---|
4541 | // early termination |
---|
4542 | if (iCount == getSlice()->getMaxNumMergeCand()) |
---|
4543 | { |
---|
4544 | return; |
---|
4545 | } |
---|
4546 | |
---|
4547 | // above |
---|
4548 | UInt uiAbovePartIdx = 0; |
---|
4549 | TComDataCU* pcCUAbove = 0; |
---|
4550 | pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT ); |
---|
4551 | Bool isAvailableB1 = pcCUAbove && |
---|
4552 | pcCUAbove->isDiffMER(xP+nPSW-1, yP-1, xP, yP) && |
---|
4553 | !( uiPUIdx == 1 && (cCurPS == SIZE_2NxN || cCurPS == SIZE_2NxnU || cCurPS == SIZE_2NxnD) ) && |
---|
4554 | !pcCUAbove->isIntra( uiAbovePartIdx ); |
---|
4555 | if ( isAvailableB1 && (!isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAbove, uiAbovePartIdx ) ) ) |
---|
4556 | { |
---|
4557 | abCandIsInter[iCount] = true; |
---|
4558 | // get Inter Dir |
---|
4559 | puhInterDirNeighbours[iCount] = pcCUAbove->getInterDir( uiAbovePartIdx ); |
---|
4560 | // get Mv from Left |
---|
4561 | pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); |
---|
4562 | if ( getSlice()->isInterB() ) |
---|
4563 | { |
---|
4564 | pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); |
---|
4565 | } |
---|
4566 | |
---|
4567 | if ( mrgCandIdx == iCount ) |
---|
4568 | { |
---|
4569 | return; |
---|
4570 | } |
---|
4571 | iCount ++; |
---|
4572 | } |
---|
4573 | // early termination |
---|
4574 | if (iCount == getSlice()->getMaxNumMergeCand()) |
---|
4575 | { |
---|
4576 | return; |
---|
4577 | } |
---|
4578 | |
---|
4579 | // above right |
---|
4580 | UInt uiAboveRightPartIdx = 0; |
---|
4581 | TComDataCU* pcCUAboveRight = 0; |
---|
4582 | pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT ); |
---|
4583 | Bool isAvailableB0 = pcCUAboveRight && |
---|
4584 | pcCUAboveRight->isDiffMER(xP+nPSW, yP-1, xP, yP) && |
---|
4585 | !pcCUAboveRight->isIntra( uiAboveRightPartIdx ); |
---|
4586 | if ( isAvailableB0 && ( !isAvailableB1 || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveRight, uiAboveRightPartIdx ) ) ) |
---|
4587 | { |
---|
4588 | abCandIsInter[iCount] = true; |
---|
4589 | // get Inter Dir |
---|
4590 | puhInterDirNeighbours[iCount] = pcCUAboveRight->getInterDir( uiAboveRightPartIdx ); |
---|
4591 | // get Mv from Left |
---|
4592 | pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); |
---|
4593 | if ( getSlice()->isInterB() ) |
---|
4594 | { |
---|
4595 | pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); |
---|
4596 | } |
---|
4597 | |
---|
4598 | if ( mrgCandIdx == iCount ) |
---|
4599 | { |
---|
4600 | return; |
---|
4601 | } |
---|
4602 | iCount ++; |
---|
4603 | } |
---|
4604 | // early termination |
---|
4605 | if (iCount == getSlice()->getMaxNumMergeCand()) |
---|
4606 | { |
---|
4607 | return; |
---|
4608 | } |
---|
4609 | #endif |
---|
4610 | |
---|
4611 | #if H_3D_DDD |
---|
4612 | // early termination |
---|
4613 | if ( iCount >= getSlice()->getMaxNumMergeCand()) |
---|
4614 | { |
---|
4615 | return; |
---|
4616 | } |
---|
4617 | #endif |
---|
4618 | |
---|
4619 | #if H_3D_IV_MERGE |
---|
4620 | ///////////////////////////////////////////// |
---|
4621 | //////// INTER VIEW DISP COMP (IvDC) //////// |
---|
4622 | ///////////////////////////////////////////// |
---|
4623 | if( ivCandDir[1] && iCount < getSlice()->getMaxNumMergeCand() && !getSlice()->getIsDepth() ) |
---|
4624 | { |
---|
4625 | assert(iCount < getSlice()->getMaxNumMergeCand()); |
---|
4626 | |
---|
4627 | tmpMV[0].setMvField( cZeroMv, NOT_VALID ); |
---|
4628 | tmpMV[1].setMvField( cZeroMv, NOT_VALID ); |
---|
4629 | if( ( ivCandDir[1] & 1 ) == 1 ) |
---|
4630 | { |
---|
4631 | tmpMV[0].setMvField( ivCandMv[ 2 ], ivCandRefIdx[ 2 ] ); |
---|
4632 | } |
---|
4633 | if( ( ivCandDir[1] & 2 ) == 2 ) |
---|
4634 | { |
---|
4635 | tmpMV[1].setMvField( ivCandMv[ 3 ], ivCandRefIdx[ 3 ] ); |
---|
4636 | } |
---|
4637 | |
---|
4638 | Bool bRemoveSpa = false; //pruning to A1, B1 |
---|
4639 | for(Int i = 0; i < 2; i ++) |
---|
4640 | { |
---|
4641 | Int iCnloop = iPosLeftAbove[i]; |
---|
4642 | if ( iCnloop == -1 ) |
---|
4643 | { |
---|
4644 | continue; |
---|
4645 | } |
---|
4646 | if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1]) |
---|
4647 | { |
---|
4648 | bRemoveSpa = true; |
---|
4649 | break; |
---|
4650 | } |
---|
4651 | } |
---|
4652 | if(!bRemoveSpa) |
---|
4653 | { |
---|
4654 | rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (5-iCount), iCount3DV); |
---|
4655 | puhInterDirNeighbours[ iCount ] = ivCandDir[1]; |
---|
4656 | if( ( ivCandDir[1] & 1 ) == 1 ) |
---|
4657 | { |
---|
4658 | pcMvFieldNeighbours[ iCount<<1 ].setMvField( ivCandMv[ 2 ], ivCandRefIdx[ 2 ] ); |
---|
4659 | } |
---|
4660 | if( ( ivCandDir[1] & 2 ) == 2 ) |
---|
4661 | { |
---|
4662 | pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( ivCandMv[ 3 ], ivCandRefIdx[ 3 ] ); |
---|
4663 | } |
---|
4664 | #if H_3D_NBDV |
---|
4665 | pcMvFieldNeighbours[iCount<<1 ].getMv().setIDVFlag (false); |
---|
4666 | pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false); |
---|
4667 | #endif |
---|
4668 | posIvDC = iCount; |
---|
4669 | if ( mrgCandIdx == iCount ) |
---|
4670 | return; |
---|
4671 | iCount ++; |
---|
4672 | |
---|
4673 | // early termination |
---|
4674 | if (iCount == getSlice()->getMaxNumMergeCand()) |
---|
4675 | { |
---|
4676 | return; |
---|
4677 | } |
---|
4678 | } |
---|
4679 | } |
---|
4680 | #endif // H_3D_IV_MERGE |
---|
4681 | |
---|
4682 | #if H_3D_VSP |
---|
4683 | ///////////////////////////////////////////////// |
---|
4684 | //////// VIEW SYNTHESIS PREDICTION (VSP) //////// |
---|
4685 | ///////////////////////////////////////////////// |
---|
4686 | if (iCount<getSlice()->getMaxNumMergeCand()) |
---|
4687 | { |
---|
4688 | |
---|
4689 | if ( |
---|
4690 | #if H_3D_IC |
---|
4691 | !bICFlag && |
---|
4692 | #endif |
---|
4693 | #if H_3D_ARP |
---|
4694 | !bARPFlag && |
---|
4695 | #endif |
---|
4696 | xAddVspCand( mrgCandIdx, &cDisInfo, iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, iCount3DV, inheritedVSPDisInfo ) ) |
---|
4697 | { |
---|
4698 | return; |
---|
4699 | } |
---|
4700 | |
---|
4701 | // early termination |
---|
4702 | if (iCount == getSlice()->getMaxNumMergeCand()) |
---|
4703 | { |
---|
4704 | return; |
---|
4705 | } |
---|
4706 | #endif |
---|
4707 | #if H_3D |
---|
4708 | } |
---|
4709 | #endif |
---|
4710 | |
---|
4711 | #if H_3D |
---|
4712 | iCount += numA0B2; |
---|
4713 | #else |
---|
4714 | //left bottom |
---|
4715 | UInt uiLeftBottomPartIdx = 0; |
---|
4716 | TComDataCU* pcCULeftBottom = 0; |
---|
4717 | pcCULeftBottom = this->getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB ); |
---|
4718 | Bool isAvailableA0 = pcCULeftBottom && |
---|
4719 | pcCULeftBottom->isDiffMER(xP-1, yP+nPSH, xP, yP) && |
---|
4720 | !pcCULeftBottom->isIntra( uiLeftBottomPartIdx ) ; |
---|
4721 | if ( isAvailableA0 && ( !isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCULeftBottom, uiLeftBottomPartIdx ) ) ) |
---|
4722 | { |
---|
4723 | abCandIsInter[iCount] = true; |
---|
4724 | // get Inter Dir |
---|
4725 | puhInterDirNeighbours[iCount] = pcCULeftBottom->getInterDir( uiLeftBottomPartIdx ); |
---|
4726 | // get Mv from Left |
---|
4727 | pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); |
---|
4728 | if ( getSlice()->isInterB() ) |
---|
4729 | { |
---|
4730 | pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); |
---|
4731 | } |
---|
4732 | if ( mrgCandIdx == iCount ) |
---|
4733 | { |
---|
4734 | return; |
---|
4735 | } |
---|
4736 | iCount ++; |
---|
4737 | } |
---|
4738 | // early termination |
---|
4739 | if (iCount == getSlice()->getMaxNumMergeCand()) |
---|
4740 | { |
---|
4741 | return; |
---|
4742 | } |
---|
4743 | |
---|
4744 | // above left |
---|
4745 | if( iCount < 4 ) |
---|
4746 | { |
---|
4747 | UInt uiAboveLeftPartIdx = 0; |
---|
4748 | TComDataCU* pcCUAboveLeft = 0; |
---|
4749 | pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr ); |
---|
4750 | Bool isAvailableB2 = pcCUAboveLeft && |
---|
4751 | pcCUAboveLeft->isDiffMER(xP-1, yP-1, xP, yP) && |
---|
4752 | !pcCUAboveLeft->isIntra( uiAboveLeftPartIdx ); |
---|
4753 | if ( isAvailableB2 && ( !isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) ) |
---|
4754 | && ( !isAvailableB1 || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) ) ) |
---|
4755 | { |
---|
4756 | abCandIsInter[iCount] = true; |
---|
4757 | // get Inter Dir |
---|
4758 | puhInterDirNeighbours[iCount] = pcCUAboveLeft->getInterDir( uiAboveLeftPartIdx ); |
---|
4759 | // get Mv from Left |
---|
4760 | pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); |
---|
4761 | if ( getSlice()->isInterB() ) |
---|
4762 | { |
---|
4763 | pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); |
---|
4764 | } |
---|
4765 | if ( mrgCandIdx == iCount ) |
---|
4766 | { |
---|
4767 | return; |
---|
4768 | } |
---|
4769 | iCount ++; |
---|
4770 | } |
---|
4771 | } |
---|
4772 | // early termination |
---|
4773 | if (iCount == getSlice()->getMaxNumMergeCand()) |
---|
4774 | { |
---|
4775 | return; |
---|
4776 | } |
---|
4777 | #endif |
---|
4778 | |
---|
4779 | |
---|
4780 | #if H_3D_IV_MERGE |
---|
4781 | //////////////////////////////////////////////////// |
---|
4782 | //////// SHIFTED IV (IvMCShift + IvDCShift) //////// |
---|
4783 | //////////////////////////////////////////////////// |
---|
4784 | if( ivMvPredFlag && iCount < getSlice()->getMaxNumMergeCand() && !getSlice()->getIsDepth() ) |
---|
4785 | { |
---|
4786 | if(xAddIvMRGCand( mrgCandIdx, iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, ivCandDir, ivCandMv, ivCandRefIdx, posIvDC, vspFlag, iCount3DV, inheritedVSPDisInfo ) ) |
---|
4787 | { |
---|
4788 | return; |
---|
4789 | } |
---|
4790 | //early termination |
---|
4791 | if (iCount == getSlice()->getMaxNumMergeCand()) |
---|
4792 | { |
---|
4793 | return; |
---|
4794 | } |
---|
4795 | } |
---|
4796 | #endif |
---|
4797 | |
---|
4798 | #if H_3D |
---|
4799 | if (iCountHEVC + iCount3DV > getSlice()->getMaxNumMergeCand()) |
---|
4800 | { |
---|
4801 | iCount = getSlice()->getMaxNumMergeCand(); |
---|
4802 | } |
---|
4803 | else |
---|
4804 | { |
---|
4805 | iCount = iCountHEVC + iCount3DV; |
---|
4806 | } |
---|
4807 | numValidMergeCand = iCount; |
---|
4808 | #else |
---|
4809 | if ( getSlice()->getEnableTMVPFlag()) |
---|
4810 | { |
---|
4811 | //>> MTK colocated-RightBottom |
---|
4812 | UInt uiPartIdxRB; |
---|
4813 | |
---|
4814 | deriveRightBottomIdx( uiPUIdx, uiPartIdxRB ); |
---|
4815 | |
---|
4816 | UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB]; |
---|
4817 | UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); |
---|
4818 | |
---|
4819 | TComMv cColMv; |
---|
4820 | Int iRefIdx; |
---|
4821 | Int uiLCUIdx = -1; |
---|
4822 | |
---|
4823 | if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) // image boundary check |
---|
4824 | { |
---|
4825 | } |
---|
4826 | else if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples() ) |
---|
4827 | { |
---|
4828 | } |
---|
4829 | else |
---|
4830 | { |
---|
4831 | if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) && // is not at the last column of LCU |
---|
4832 | ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row of LCU |
---|
4833 | { |
---|
4834 | uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ]; |
---|
4835 | uiLCUIdx = getAddr(); |
---|
4836 | } |
---|
4837 | else if ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) // is not at the last column of LCU But is last row of LCU |
---|
4838 | { |
---|
4839 | uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ]; |
---|
4840 | } |
---|
4841 | else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU |
---|
4842 | { |
---|
4843 | uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ]; |
---|
4844 | uiLCUIdx = getAddr() + 1; |
---|
4845 | } |
---|
4846 | else //is the right bottom corner of LCU |
---|
4847 | { |
---|
4848 | uiAbsPartAddr = 0; |
---|
4849 | } |
---|
4850 | } |
---|
4851 | |
---|
4852 | |
---|
4853 | iRefIdx = 0; |
---|
4854 | Bool bExistMV = false; |
---|
4855 | UInt uiPartIdxCenter; |
---|
4856 | UInt uiCurLCUIdx = getAddr(); |
---|
4857 | Int dir = 0; |
---|
4858 | UInt uiArrayAddr = iCount; |
---|
4859 | xDeriveCenterIdx( uiPUIdx, uiPartIdxCenter ); |
---|
4860 | bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_0, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx ); |
---|
4861 | if( bExistMV == false ) |
---|
4862 | { |
---|
4863 | bExistMV = xGetColMVP( REF_PIC_LIST_0, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx ); |
---|
4864 | } |
---|
4865 | if( bExistMV ) |
---|
4866 | { |
---|
4867 | dir |= 1; |
---|
4868 | pcMvFieldNeighbours[ 2 * uiArrayAddr ].setMvField( cColMv, iRefIdx ); |
---|
4869 | } |
---|
4870 | |
---|
4871 | if ( getSlice()->isInterB() ) |
---|
4872 | { |
---|
4873 | bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_1, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx); |
---|
4874 | if( bExistMV == false ) |
---|
4875 | { |
---|
4876 | bExistMV = xGetColMVP( REF_PIC_LIST_1, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx ); |
---|
4877 | } |
---|
4878 | if( bExistMV ) |
---|
4879 | { |
---|
4880 | dir |= 2; |
---|
4881 | pcMvFieldNeighbours[ 2 * uiArrayAddr + 1 ].setMvField( cColMv, iRefIdx ); |
---|
4882 | } |
---|
4883 | } |
---|
4884 | |
---|
4885 | if (dir != 0) |
---|
4886 | { |
---|
4887 | puhInterDirNeighbours[uiArrayAddr] = dir; |
---|
4888 | abCandIsInter[uiArrayAddr] = true; |
---|
4889 | if ( mrgCandIdx == iCount ) |
---|
4890 | { |
---|
4891 | return; |
---|
4892 | } |
---|
4893 | iCount++; |
---|
4894 | } |
---|
4895 | } |
---|
4896 | // early termination |
---|
4897 | if (iCount == getSlice()->getMaxNumMergeCand()) |
---|
4898 | { |
---|
4899 | return; |
---|
4900 | } |
---|
4901 | UInt uiArrayAddr = iCount; |
---|
4902 | UInt uiCutoff = uiArrayAddr; |
---|
4903 | |
---|
4904 | if ( getSlice()->isInterB()) |
---|
4905 | { |
---|
4906 | UInt uiPriorityList0[12] = {0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3}; |
---|
4907 | UInt uiPriorityList1[12] = {1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2}; |
---|
4908 | |
---|
4909 | for (Int idx=0; idx<uiCutoff*(uiCutoff-1) && uiArrayAddr!= getSlice()->getMaxNumMergeCand(); idx++) |
---|
4910 | { |
---|
4911 | Int i = uiPriorityList0[idx]; Int j = uiPriorityList1[idx]; |
---|
4912 | if (abCandIsInter[i] && abCandIsInter[j]&& (puhInterDirNeighbours[i]&0x1)&&(puhInterDirNeighbours[j]&0x2)) |
---|
4913 | { |
---|
4914 | abCandIsInter[uiArrayAddr] = true; |
---|
4915 | puhInterDirNeighbours[uiArrayAddr] = 3; |
---|
4916 | |
---|
4917 | // get Mv from cand[i] and cand[j] |
---|
4918 | pcMvFieldNeighbours[uiArrayAddr << 1].setMvField(pcMvFieldNeighbours[i<<1].getMv(), pcMvFieldNeighbours[i<<1].getRefIdx()); |
---|
4919 | pcMvFieldNeighbours[( uiArrayAddr << 1 ) + 1].setMvField(pcMvFieldNeighbours[(j<<1)+1].getMv(), pcMvFieldNeighbours[(j<<1)+1].getRefIdx()); |
---|
4920 | |
---|
4921 | Int iRefPOCL0 = m_pcSlice->getRefPOC( REF_PIC_LIST_0, pcMvFieldNeighbours[(uiArrayAddr<<1)].getRefIdx() ); |
---|
4922 | Int iRefPOCL1 = m_pcSlice->getRefPOC( REF_PIC_LIST_1, pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getRefIdx() ); |
---|
4923 | if (iRefPOCL0 == iRefPOCL1 && pcMvFieldNeighbours[(uiArrayAddr<<1)].getMv() == pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getMv()) |
---|
4924 | { |
---|
4925 | abCandIsInter[uiArrayAddr] = false; |
---|
4926 | } |
---|
4927 | else |
---|
4928 | { |
---|
4929 | uiArrayAddr++; |
---|
4930 | } |
---|
4931 | } |
---|
4932 | } |
---|
4933 | } |
---|
4934 | // early termination |
---|
4935 | if (uiArrayAddr == getSlice()->getMaxNumMergeCand()) |
---|
4936 | { |
---|
4937 | return; |
---|
4938 | } |
---|
4939 | Int iNumRefIdx = (getSlice()->isInterB()) ? min(m_pcSlice->getNumRefIdx(REF_PIC_LIST_0), m_pcSlice->getNumRefIdx(REF_PIC_LIST_1)) : m_pcSlice->getNumRefIdx(REF_PIC_LIST_0); |
---|
4940 | Int r = 0; |
---|
4941 | Int refcnt = 0; |
---|
4942 | while (uiArrayAddr < getSlice()->getMaxNumMergeCand()) |
---|
4943 | { |
---|
4944 | abCandIsInter[uiArrayAddr] = true; |
---|
4945 | puhInterDirNeighbours[uiArrayAddr] = 1; |
---|
4946 | pcMvFieldNeighbours[uiArrayAddr << 1].setMvField( TComMv(0, 0), r); |
---|
4947 | |
---|
4948 | if ( getSlice()->isInterB() ) |
---|
4949 | { |
---|
4950 | puhInterDirNeighbours[uiArrayAddr] = 3; |
---|
4951 | pcMvFieldNeighbours[(uiArrayAddr << 1) + 1].setMvField(TComMv(0, 0), r); |
---|
4952 | } |
---|
4953 | uiArrayAddr++; |
---|
4954 | if ( refcnt == iNumRefIdx - 1 ) |
---|
4955 | { |
---|
4956 | r = 0; |
---|
4957 | } |
---|
4958 | else |
---|
4959 | { |
---|
4960 | ++r; |
---|
4961 | ++refcnt; |
---|
4962 | } |
---|
4963 | } |
---|
4964 | |
---|
4965 | numValidMergeCand = uiArrayAddr; |
---|
4966 | #endif |
---|
4967 | } |
---|
4968 | #else |
---|
4969 | |
---|
4970 | /** Constructs a list of merging candidates |
---|
4971 | * \param uiAbsPartIdx |
---|
4972 | * \param uiPUIdx |
---|
4973 | * \param uiDepth |
---|
4974 | * \param pcMvFieldNeighbours |
---|
4975 | * \param puhInterDirNeighbours |
---|
4976 | * \param numValidMergeCand |
---|
4977 | */ |
---|
4978 | Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours |
---|
4979 | , Int& numValidMergeCand, Int mrgCandIdx |
---|
4980 | ) |
---|
4981 | { |
---|
4982 | UInt uiAbsPartAddr = m_uiAbsIdxInLCU + uiAbsPartIdx; |
---|
4983 | Bool abCandIsInter[ MRG_MAX_NUM_CANDS ]; |
---|
4984 | for( UInt ui = 0; ui < getSlice()->getMaxNumMergeCand(); ++ui ) |
---|
4985 | { |
---|
4986 | abCandIsInter[ui] = false; |
---|
4987 | pcMvFieldNeighbours[ ( ui << 1 ) ].setRefIdx(NOT_VALID); |
---|
4988 | pcMvFieldNeighbours[ ( ui << 1 ) + 1 ].setRefIdx(NOT_VALID); |
---|
4989 | } |
---|
4990 | numValidMergeCand = getSlice()->getM |
---|