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