1 | /* The copyright in this software is being made available under the BSD |
---|
2 | * License, included below. This software may be subject to other third party |
---|
3 | * and contributor rights, including patent rights, and no such rights are |
---|
4 | * granted under this license. |
---|
5 | * |
---|
6 | * Copyright (c) 2010-2012, ITU/ISO/IEC |
---|
7 | * All rights reserved. |
---|
8 | * |
---|
9 | * Redistribution and use in source and binary forms, with or without |
---|
10 | * modification, are permitted provided that the following conditions are met: |
---|
11 | * |
---|
12 | * * Redistributions of source code must retain the above copyright notice, |
---|
13 | * this list of conditions and the following disclaimer. |
---|
14 | * * Redistributions in binary form must reproduce the above copyright notice, |
---|
15 | * this list of conditions and the following disclaimer in the documentation |
---|
16 | * and/or other materials provided with the distribution. |
---|
17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
---|
18 | * be used to endorse or promote products derived from this software without |
---|
19 | * specific prior written permission. |
---|
20 | * |
---|
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS |
---|
25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
---|
31 | * THE POSSIBILITY OF SUCH DAMAGE. |
---|
32 | */ |
---|
33 | |
---|
34 | /** \file 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 | #include "TComDepthMapGenerator.h" |
---|
42 | #include "TComResidualGenerator.h" |
---|
43 | |
---|
44 | //! \ingroup TLibCommon |
---|
45 | //! \{ |
---|
46 | |
---|
47 | #if ADAPTIVE_QP_SELECTION |
---|
48 | Int * TComDataCU::m_pcGlbArlCoeffY = NULL; |
---|
49 | Int * TComDataCU::m_pcGlbArlCoeffCb = NULL; |
---|
50 | Int * TComDataCU::m_pcGlbArlCoeffCr = NULL; |
---|
51 | #endif |
---|
52 | |
---|
53 | // ==================================================================================================================== |
---|
54 | // Constructor / destructor / create / destroy |
---|
55 | // ==================================================================================================================== |
---|
56 | |
---|
57 | TComDataCU::TComDataCU() |
---|
58 | { |
---|
59 | m_pcPic = NULL; |
---|
60 | m_pcSlice = NULL; |
---|
61 | m_puhDepth = NULL; |
---|
62 | #if HHI_MPI |
---|
63 | m_piTextureModeDepth = NULL; |
---|
64 | #endif |
---|
65 | |
---|
66 | m_pePartSize = NULL; |
---|
67 | #if HHI_INTERVIEW_SKIP |
---|
68 | m_pbRenderable = NULL; |
---|
69 | #endif |
---|
70 | m_pePredMode = NULL; |
---|
71 | m_puiAlfCtrlFlag = NULL; |
---|
72 | m_puiTmpAlfCtrlFlag = NULL; |
---|
73 | m_puhWidth = NULL; |
---|
74 | m_puhHeight = NULL; |
---|
75 | m_phQP = NULL; |
---|
76 | m_pbMergeFlag = NULL; |
---|
77 | m_puhMergeIndex = NULL; |
---|
78 | m_puhLumaIntraDir = NULL; |
---|
79 | m_puhChromaIntraDir = NULL; |
---|
80 | m_puhInterDir = NULL; |
---|
81 | m_puhTrIdx = NULL; |
---|
82 | #if NSQT_MOD2 |
---|
83 | m_nsqtPartIdx = NULL; |
---|
84 | #endif |
---|
85 | m_puhCbf[0] = NULL; |
---|
86 | m_puhCbf[1] = NULL; |
---|
87 | m_puhCbf[2] = NULL; |
---|
88 | m_pcTrCoeffY = NULL; |
---|
89 | m_pcTrCoeffCb = NULL; |
---|
90 | m_pcTrCoeffCr = NULL; |
---|
91 | #if ADAPTIVE_QP_SELECTION |
---|
92 | m_pcArlCoeffY = NULL; |
---|
93 | m_pcArlCoeffCb = NULL; |
---|
94 | m_pcArlCoeffCr = NULL; |
---|
95 | #endif |
---|
96 | |
---|
97 | m_pbIPCMFlag = NULL; |
---|
98 | m_pcIPCMSampleY = NULL; |
---|
99 | m_pcIPCMSampleCb = NULL; |
---|
100 | m_pcIPCMSampleCr = NULL; |
---|
101 | |
---|
102 | m_pcPattern = NULL; |
---|
103 | |
---|
104 | m_pcCUAboveLeft = NULL; |
---|
105 | m_pcCUAboveRight = NULL; |
---|
106 | m_pcCUAbove = NULL; |
---|
107 | m_pcCULeft = NULL; |
---|
108 | |
---|
109 | m_apcCUColocated[0] = NULL; |
---|
110 | m_apcCUColocated[1] = NULL; |
---|
111 | |
---|
112 | m_apiMVPIdx[0] = NULL; |
---|
113 | m_apiMVPIdx[1] = NULL; |
---|
114 | m_apiMVPNum[0] = NULL; |
---|
115 | m_apiMVPNum[1] = NULL; |
---|
116 | |
---|
117 | m_bDecSubCu = false; |
---|
118 | m_uiSliceStartCU = 0; |
---|
119 | m_uiEntropySliceStartCU = 0; |
---|
120 | |
---|
121 | #if HHI_DMM_WEDGE_INTRA |
---|
122 | m_puiWedgeFullTabIdx = NULL; |
---|
123 | m_piWedgeFullDeltaDC1 = NULL; |
---|
124 | m_piWedgeFullDeltaDC2 = NULL; |
---|
125 | |
---|
126 | m_puiWedgePredDirTabIdx = NULL; |
---|
127 | m_piWedgePredDirDeltaDC1 = NULL; |
---|
128 | m_piWedgePredDirDeltaDC2 = NULL; |
---|
129 | m_piWedgePredDirDeltaEnd = NULL; |
---|
130 | #endif |
---|
131 | #if HHI_DMM_PRED_TEX |
---|
132 | m_puiWedgePredTexTabIdx = NULL; |
---|
133 | m_piWedgePredTexDeltaDC1 = NULL; |
---|
134 | m_piWedgePredTexDeltaDC2 = NULL; |
---|
135 | |
---|
136 | m_piContourPredTexDeltaDC1 = NULL; |
---|
137 | m_piContourPredTexDeltaDC2 = NULL; |
---|
138 | #endif |
---|
139 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
140 | m_pbResPredAvailable = NULL; |
---|
141 | m_pbResPredFlag = NULL; |
---|
142 | #endif |
---|
143 | } |
---|
144 | |
---|
145 | TComDataCU::~TComDataCU() |
---|
146 | { |
---|
147 | } |
---|
148 | |
---|
149 | Void TComDataCU::create(UInt uiNumPartition, UInt uiWidth, UInt uiHeight, Bool bDecSubCu, Int unitSize |
---|
150 | #if ADAPTIVE_QP_SELECTION |
---|
151 | , Bool bGlobalRMARLBuffer |
---|
152 | #endif |
---|
153 | ) |
---|
154 | { |
---|
155 | m_bDecSubCu = bDecSubCu; |
---|
156 | |
---|
157 | m_pcPic = NULL; |
---|
158 | m_pcSlice = NULL; |
---|
159 | m_uiNumPartition = uiNumPartition; |
---|
160 | m_unitSize = unitSize; |
---|
161 | |
---|
162 | if ( !bDecSubCu ) |
---|
163 | { |
---|
164 | #if H0736_AVC_STYLE_QP_RANGE |
---|
165 | m_phQP = (Char* )xMalloc(Char, uiNumPartition); |
---|
166 | #else |
---|
167 | m_phQP = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
168 | #endif |
---|
169 | m_puhDepth = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
170 | #if HHI_MPI |
---|
171 | m_piTextureModeDepth = (Int* )xMalloc(Int, uiNumPartition); |
---|
172 | #endif |
---|
173 | m_puhWidth = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
174 | m_puhHeight = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
175 | m_pePartSize = new Char[ uiNumPartition ]; |
---|
176 | #if HHI_INTERVIEW_SKIP |
---|
177 | m_pbRenderable = (Bool* )xMalloc(Bool, uiNumPartition); |
---|
178 | #endif |
---|
179 | memset( m_pePartSize, SIZE_NONE,uiNumPartition * sizeof( *m_pePartSize ) ); |
---|
180 | m_pePredMode = new Char[ uiNumPartition ]; |
---|
181 | |
---|
182 | m_puiAlfCtrlFlag = new Bool[ uiNumPartition ]; |
---|
183 | |
---|
184 | m_pbMergeFlag = (Bool* )xMalloc(Bool, uiNumPartition); |
---|
185 | m_puhMergeIndex = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
186 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
187 | m_pbResPredAvailable = (Bool* )xMalloc(Bool, uiNumPartition); |
---|
188 | m_pbResPredFlag = (Bool* )xMalloc(Bool, uiNumPartition); |
---|
189 | #endif |
---|
190 | m_puhLumaIntraDir = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
191 | m_puhChromaIntraDir = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
192 | m_puhInterDir = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
193 | |
---|
194 | m_puhTrIdx = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
195 | m_nsqtPartIdx = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
196 | |
---|
197 | m_puhCbf[0] = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
198 | m_puhCbf[1] = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
199 | m_puhCbf[2] = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
200 | |
---|
201 | m_apiMVPIdx[0] = new Char[ uiNumPartition ]; |
---|
202 | m_apiMVPIdx[1] = new Char[ uiNumPartition ]; |
---|
203 | m_apiMVPNum[0] = new Char[ uiNumPartition ]; |
---|
204 | m_apiMVPNum[1] = new Char[ uiNumPartition ]; |
---|
205 | memset( m_apiMVPIdx[0], -1,uiNumPartition * sizeof( Char ) ); |
---|
206 | memset( m_apiMVPIdx[1], -1,uiNumPartition * sizeof( Char ) ); |
---|
207 | |
---|
208 | m_pcTrCoeffY = (TCoeff*)xMalloc(TCoeff, uiWidth*uiHeight); |
---|
209 | m_pcTrCoeffCb = (TCoeff*)xMalloc(TCoeff, uiWidth*uiHeight/4); |
---|
210 | m_pcTrCoeffCr = (TCoeff*)xMalloc(TCoeff, uiWidth*uiHeight/4); |
---|
211 | memset( m_pcTrCoeffY, 0,uiWidth*uiHeight * sizeof( TCoeff ) ); |
---|
212 | memset( m_pcTrCoeffCb, 0,uiWidth*uiHeight/4 * sizeof( TCoeff ) ); |
---|
213 | memset( m_pcTrCoeffCr, 0,uiWidth*uiHeight/4 * sizeof( TCoeff ) ); |
---|
214 | #if ADAPTIVE_QP_SELECTION |
---|
215 | if( bGlobalRMARLBuffer ) |
---|
216 | { |
---|
217 | if( m_pcGlbArlCoeffY == NULL ) |
---|
218 | { |
---|
219 | m_pcGlbArlCoeffY = (Int*)xMalloc(Int, uiWidth*uiHeight); |
---|
220 | m_pcGlbArlCoeffCb = (Int*)xMalloc(Int, uiWidth*uiHeight/4); |
---|
221 | m_pcGlbArlCoeffCr = (Int*)xMalloc(Int, uiWidth*uiHeight/4); |
---|
222 | } |
---|
223 | m_pcArlCoeffY = m_pcGlbArlCoeffY; |
---|
224 | m_pcArlCoeffCb = m_pcGlbArlCoeffCb; |
---|
225 | m_pcArlCoeffCr = m_pcGlbArlCoeffCr; |
---|
226 | } |
---|
227 | else |
---|
228 | { |
---|
229 | m_pcArlCoeffY = (Int*)xMalloc(Int, uiWidth*uiHeight); |
---|
230 | m_pcArlCoeffCb = (Int*)xMalloc(Int, uiWidth*uiHeight/4); |
---|
231 | m_pcArlCoeffCr = (Int*)xMalloc(Int, uiWidth*uiHeight/4); |
---|
232 | } |
---|
233 | #endif |
---|
234 | |
---|
235 | m_pbIPCMFlag = (Bool* )xMalloc(Bool, uiNumPartition); |
---|
236 | m_pcIPCMSampleY = (Pel* )xMalloc(Pel , uiWidth*uiHeight); |
---|
237 | m_pcIPCMSampleCb = (Pel* )xMalloc(Pel , uiWidth*uiHeight/4); |
---|
238 | m_pcIPCMSampleCr = (Pel* )xMalloc(Pel , uiWidth*uiHeight/4); |
---|
239 | |
---|
240 | m_acCUMvField[0].create( uiNumPartition ); |
---|
241 | m_acCUMvField[1].create( uiNumPartition ); |
---|
242 | |
---|
243 | #if HHI_DMM_WEDGE_INTRA |
---|
244 | m_puiWedgeFullTabIdx = (UInt*)xMalloc(UInt, uiNumPartition); |
---|
245 | m_piWedgeFullDeltaDC1 = (Int* )xMalloc(Int, uiNumPartition); |
---|
246 | m_piWedgeFullDeltaDC2 = (Int* )xMalloc(Int, uiNumPartition); |
---|
247 | |
---|
248 | m_puiWedgePredDirTabIdx = (UInt*)xMalloc(UInt, uiNumPartition); |
---|
249 | m_piWedgePredDirDeltaDC1 = (Int* )xMalloc(Int, uiNumPartition); |
---|
250 | m_piWedgePredDirDeltaDC2 = (Int* )xMalloc(Int, uiNumPartition); |
---|
251 | m_piWedgePredDirDeltaEnd = (Int* )xMalloc(Int, uiNumPartition); |
---|
252 | #endif |
---|
253 | #if HHI_DMM_PRED_TEX |
---|
254 | m_puiWedgePredTexTabIdx = (UInt*)xMalloc(UInt, uiNumPartition); |
---|
255 | m_piWedgePredTexDeltaDC1 = (Int* )xMalloc(Int, uiNumPartition); |
---|
256 | m_piWedgePredTexDeltaDC2 = (Int* )xMalloc(Int, uiNumPartition); |
---|
257 | |
---|
258 | m_piContourPredTexDeltaDC1 = (Int* )xMalloc(Int, uiNumPartition); |
---|
259 | m_piContourPredTexDeltaDC2 = (Int* )xMalloc(Int, uiNumPartition); |
---|
260 | #endif |
---|
261 | } |
---|
262 | else |
---|
263 | { |
---|
264 | m_acCUMvField[0].setNumPartition(uiNumPartition ); |
---|
265 | m_acCUMvField[1].setNumPartition(uiNumPartition ); |
---|
266 | } |
---|
267 | |
---|
268 | m_uiSliceStartCU = (UInt* )xMalloc(UInt, uiNumPartition); |
---|
269 | m_uiEntropySliceStartCU = (UInt* )xMalloc(UInt, uiNumPartition); |
---|
270 | |
---|
271 | // create pattern memory |
---|
272 | m_pcPattern = (TComPattern*)xMalloc(TComPattern, 1); |
---|
273 | |
---|
274 | // create motion vector fields |
---|
275 | |
---|
276 | m_pcCUAboveLeft = NULL; |
---|
277 | m_pcCUAboveRight = NULL; |
---|
278 | m_pcCUAbove = NULL; |
---|
279 | m_pcCULeft = NULL; |
---|
280 | |
---|
281 | m_apcCUColocated[0] = NULL; |
---|
282 | m_apcCUColocated[1] = NULL; |
---|
283 | } |
---|
284 | |
---|
285 | Void TComDataCU::destroy() |
---|
286 | { |
---|
287 | m_pcPic = NULL; |
---|
288 | m_pcSlice = NULL; |
---|
289 | |
---|
290 | if ( m_pcPattern ) |
---|
291 | { |
---|
292 | xFree(m_pcPattern); |
---|
293 | m_pcPattern = NULL; |
---|
294 | } |
---|
295 | |
---|
296 | // encoder-side buffer free |
---|
297 | if ( !m_bDecSubCu ) |
---|
298 | { |
---|
299 | if ( m_phQP ) { xFree(m_phQP); m_phQP = NULL; } |
---|
300 | if ( m_puhDepth ) { xFree(m_puhDepth); m_puhDepth = NULL; } |
---|
301 | #if HHI_MPI |
---|
302 | if ( m_piTextureModeDepth ) { xFree(m_piTextureModeDepth); m_piTextureModeDepth= NULL; } |
---|
303 | #endif |
---|
304 | if ( m_puhWidth ) { xFree(m_puhWidth); m_puhWidth = NULL; } |
---|
305 | if ( m_puhHeight ) { xFree(m_puhHeight); m_puhHeight = NULL; } |
---|
306 | if ( m_pePartSize ) { delete[] m_pePartSize; m_pePartSize = NULL; } |
---|
307 | #if HHI_INTERVIEW_SKIP |
---|
308 | if ( m_pbRenderable ) { xFree(m_pbRenderable); m_pbRenderable = NULL; } |
---|
309 | #endif |
---|
310 | if ( m_pePredMode ) { delete[] m_pePredMode; m_pePredMode = NULL; } |
---|
311 | if ( m_puhCbf[0] ) { xFree(m_puhCbf[0]); m_puhCbf[0] = NULL; } |
---|
312 | if ( m_puhCbf[1] ) { xFree(m_puhCbf[1]); m_puhCbf[1] = NULL; } |
---|
313 | if ( m_puhCbf[2] ) { xFree(m_puhCbf[2]); m_puhCbf[2] = NULL; } |
---|
314 | if ( m_puiAlfCtrlFlag ) { delete[] m_puiAlfCtrlFlag; m_puiAlfCtrlFlag = NULL; } |
---|
315 | if ( m_puhInterDir ) { xFree(m_puhInterDir); m_puhInterDir = NULL; } |
---|
316 | if ( m_pbMergeFlag ) { xFree(m_pbMergeFlag); m_pbMergeFlag = NULL; } |
---|
317 | if ( m_puhMergeIndex ) { xFree(m_puhMergeIndex); m_puhMergeIndex = NULL; } |
---|
318 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
319 | if ( m_pbResPredAvailable ) { xFree(m_pbResPredAvailable); m_pbResPredAvailable= NULL; } |
---|
320 | if ( m_pbResPredFlag ) { xFree(m_pbResPredFlag); m_pbResPredFlag = NULL; } |
---|
321 | #endif |
---|
322 | if ( m_puhLumaIntraDir ) { xFree(m_puhLumaIntraDir); m_puhLumaIntraDir = NULL; } |
---|
323 | if ( m_puhChromaIntraDir ) { xFree(m_puhChromaIntraDir); m_puhChromaIntraDir = NULL; } |
---|
324 | if ( m_puhTrIdx ) { xFree(m_puhTrIdx); m_puhTrIdx = NULL; } |
---|
325 | if ( m_nsqtPartIdx ) { xFree(m_nsqtPartIdx); m_nsqtPartIdx = NULL; } |
---|
326 | if ( m_pcTrCoeffY ) { xFree(m_pcTrCoeffY); m_pcTrCoeffY = NULL; } |
---|
327 | if ( m_pcTrCoeffCb ) { xFree(m_pcTrCoeffCb); m_pcTrCoeffCb = NULL; } |
---|
328 | if ( m_pcTrCoeffCr ) { xFree(m_pcTrCoeffCr); m_pcTrCoeffCr = NULL; } |
---|
329 | #if ADAPTIVE_QP_SELECTION |
---|
330 | if ( m_pcGlbArlCoeffY ) { xFree(m_pcGlbArlCoeffY); m_pcGlbArlCoeffY = NULL; } |
---|
331 | if ( m_pcGlbArlCoeffCb ) { xFree(m_pcGlbArlCoeffCb); m_pcGlbArlCoeffCb = NULL; } |
---|
332 | if ( m_pcGlbArlCoeffCr ) { xFree(m_pcGlbArlCoeffCr); m_pcGlbArlCoeffCr = NULL; } |
---|
333 | #endif |
---|
334 | if ( m_pbIPCMFlag ) { xFree(m_pbIPCMFlag ); m_pbIPCMFlag = NULL; } |
---|
335 | if ( m_pcIPCMSampleY ) { xFree(m_pcIPCMSampleY); m_pcIPCMSampleY = NULL; } |
---|
336 | if ( m_pcIPCMSampleCb ) { xFree(m_pcIPCMSampleCb); m_pcIPCMSampleCb = NULL; } |
---|
337 | if ( m_pcIPCMSampleCr ) { xFree(m_pcIPCMSampleCr); m_pcIPCMSampleCr = NULL; } |
---|
338 | if ( m_apiMVPIdx[0] ) { delete[] m_apiMVPIdx[0]; m_apiMVPIdx[0] = NULL; } |
---|
339 | if ( m_apiMVPIdx[1] ) { delete[] m_apiMVPIdx[1]; m_apiMVPIdx[1] = NULL; } |
---|
340 | if ( m_apiMVPNum[0] ) { delete[] m_apiMVPNum[0]; m_apiMVPNum[0] = NULL; } |
---|
341 | if ( m_apiMVPNum[1] ) { delete[] m_apiMVPNum[1]; m_apiMVPNum[1] = NULL; } |
---|
342 | |
---|
343 | #if HHI_DMM_WEDGE_INTRA |
---|
344 | if ( m_puiWedgeFullTabIdx ) { xFree(m_puiWedgeFullTabIdx ); m_puiWedgeFullTabIdx = NULL; } |
---|
345 | if ( m_piWedgeFullDeltaDC1 ) { xFree(m_piWedgeFullDeltaDC1 ); m_piWedgeFullDeltaDC1 = NULL; } |
---|
346 | if ( m_piWedgeFullDeltaDC2 ) { xFree(m_piWedgeFullDeltaDC2 ); m_piWedgeFullDeltaDC2 = NULL; } |
---|
347 | |
---|
348 | if ( m_puiWedgePredDirTabIdx ) { xFree(m_puiWedgePredDirTabIdx ); m_puiWedgePredDirTabIdx = NULL; } |
---|
349 | if ( m_piWedgePredDirDeltaEnd ) { xFree(m_piWedgePredDirDeltaEnd ); m_piWedgePredDirDeltaEnd = NULL; } |
---|
350 | if ( m_piWedgePredDirDeltaDC1 ) { xFree(m_piWedgePredDirDeltaDC1 ); m_piWedgePredDirDeltaDC1 = NULL; } |
---|
351 | if ( m_piWedgePredDirDeltaDC2 ) { xFree(m_piWedgePredDirDeltaDC2 ); m_piWedgePredDirDeltaDC2 = NULL; } |
---|
352 | #endif |
---|
353 | #if HHI_DMM_PRED_TEX |
---|
354 | if ( m_puiWedgePredTexTabIdx ) { xFree(m_puiWedgePredTexTabIdx ); m_puiWedgePredTexTabIdx = NULL; } |
---|
355 | if ( m_piWedgePredTexDeltaDC1 ) { xFree(m_piWedgePredTexDeltaDC1 ); m_piWedgePredTexDeltaDC1 = NULL; } |
---|
356 | if ( m_piWedgePredTexDeltaDC2 ) { xFree(m_piWedgePredTexDeltaDC2 ); m_piWedgePredTexDeltaDC2 = NULL; } |
---|
357 | |
---|
358 | if ( m_piContourPredTexDeltaDC1 ) { xFree(m_piContourPredTexDeltaDC1); m_piContourPredTexDeltaDC1 = NULL; } |
---|
359 | if ( m_piContourPredTexDeltaDC2 ) { xFree(m_piContourPredTexDeltaDC2); m_piContourPredTexDeltaDC2 = NULL; } |
---|
360 | #endif |
---|
361 | m_acCUMvField[0].destroy(); |
---|
362 | m_acCUMvField[1].destroy(); |
---|
363 | |
---|
364 | } |
---|
365 | |
---|
366 | m_pcCUAboveLeft = NULL; |
---|
367 | m_pcCUAboveRight = NULL; |
---|
368 | m_pcCUAbove = NULL; |
---|
369 | m_pcCULeft = NULL; |
---|
370 | |
---|
371 | m_apcCUColocated[0] = NULL; |
---|
372 | m_apcCUColocated[1] = NULL; |
---|
373 | |
---|
374 | if( m_uiSliceStartCU ) |
---|
375 | { |
---|
376 | xFree(m_uiSliceStartCU); |
---|
377 | m_uiSliceStartCU=NULL; |
---|
378 | } |
---|
379 | if(m_uiEntropySliceStartCU ) |
---|
380 | { |
---|
381 | xFree(m_uiEntropySliceStartCU); |
---|
382 | m_uiEntropySliceStartCU=NULL; |
---|
383 | } |
---|
384 | } |
---|
385 | |
---|
386 | const NDBFBlockInfo& NDBFBlockInfo::operator= (const NDBFBlockInfo& src) |
---|
387 | { |
---|
388 | this->tileID = src.tileID; |
---|
389 | this->sliceID= src.sliceID; |
---|
390 | this->startSU= src.startSU; |
---|
391 | this->endSU = src.endSU; |
---|
392 | this->widthSU= src.widthSU; |
---|
393 | this->heightSU=src.heightSU; |
---|
394 | this->posX = src.posX; |
---|
395 | this->posY = src.posY; |
---|
396 | this->width = src.width; |
---|
397 | this->height = src.height; |
---|
398 | ::memcpy(this->isBorderAvailable, src.isBorderAvailable, sizeof(Bool)*((Int)NUM_SGU_BORDER)); |
---|
399 | #if LCU_SYNTAX_ALF |
---|
400 | this->allBordersAvailable = src.allBordersAvailable; |
---|
401 | #endif |
---|
402 | |
---|
403 | return *this; |
---|
404 | } |
---|
405 | |
---|
406 | |
---|
407 | // ==================================================================================================================== |
---|
408 | // Public member functions |
---|
409 | // ==================================================================================================================== |
---|
410 | |
---|
411 | // -------------------------------------------------------------------------------------------------------------------- |
---|
412 | // Initialization |
---|
413 | // -------------------------------------------------------------------------------------------------------------------- |
---|
414 | |
---|
415 | /** |
---|
416 | - initialize top-level CU |
---|
417 | - internal buffers are already created |
---|
418 | - set values before encoding a CU |
---|
419 | . |
---|
420 | \param pcPic picture (TComPic) class pointer |
---|
421 | \param iCUAddr CU address |
---|
422 | */ |
---|
423 | Void TComDataCU::initCU( TComPic* pcPic, UInt iCUAddr ) |
---|
424 | { |
---|
425 | |
---|
426 | m_pcPic = pcPic; |
---|
427 | m_pcSlice = pcPic->getSlice(pcPic->getCurrSliceIdx()); |
---|
428 | m_uiCUAddr = iCUAddr; |
---|
429 | m_uiCUPelX = ( iCUAddr % pcPic->getFrameWidthInCU() ) * g_uiMaxCUWidth; |
---|
430 | m_uiCUPelY = ( iCUAddr / pcPic->getFrameWidthInCU() ) * g_uiMaxCUHeight; |
---|
431 | m_uiAbsIdxInLCU = 0; |
---|
432 | m_dTotalCost = MAX_DOUBLE; |
---|
433 | m_uiTotalDistortion = 0; |
---|
434 | m_uiTotalBits = 0; |
---|
435 | m_uiTotalBins = 0; |
---|
436 | m_uiNumPartition = pcPic->getNumPartInCU(); |
---|
437 | #if BURST_IPCM |
---|
438 | m_numSucIPCM = 0; |
---|
439 | m_lastCUSucIPCMFlag = false; |
---|
440 | #endif |
---|
441 | |
---|
442 | for(int i=0; i<pcPic->getNumPartInCU(); i++) |
---|
443 | { |
---|
444 | if(pcPic->getPicSym()->getInverseCUOrderMap(iCUAddr)*pcPic->getNumPartInCU()+i>=getSlice()->getSliceCurStartCUAddr()) |
---|
445 | { |
---|
446 | m_uiSliceStartCU[i]=getSlice()->getSliceCurStartCUAddr(); |
---|
447 | } |
---|
448 | else |
---|
449 | { |
---|
450 | m_uiSliceStartCU[i]=pcPic->getCU(getAddr())->m_uiSliceStartCU[i]; |
---|
451 | } |
---|
452 | } |
---|
453 | for(int i=0; i<pcPic->getNumPartInCU(); i++) |
---|
454 | { |
---|
455 | if(pcPic->getPicSym()->getInverseCUOrderMap(iCUAddr)*pcPic->getNumPartInCU()+i>=getSlice()->getEntropySliceCurStartCUAddr()) |
---|
456 | { |
---|
457 | m_uiEntropySliceStartCU[i]=getSlice()->getEntropySliceCurStartCUAddr(); |
---|
458 | } |
---|
459 | else |
---|
460 | { |
---|
461 | m_uiEntropySliceStartCU[i]=pcPic->getCU(getAddr())->m_uiEntropySliceStartCU[i]; |
---|
462 | } |
---|
463 | } |
---|
464 | |
---|
465 | Int partStartIdx = getSlice()->getEntropySliceCurStartCUAddr() - pcPic->getPicSym()->getInverseCUOrderMap(iCUAddr) * pcPic->getNumPartInCU(); |
---|
466 | |
---|
467 | Int numElements = min<Int>( partStartIdx, m_uiNumPartition ); |
---|
468 | for ( Int ui = 0; ui < numElements; ui++ ) |
---|
469 | { |
---|
470 | TComDataCU * pcFrom = pcPic->getCU(getAddr()); |
---|
471 | m_pePartSize[ui] = pcFrom->getPartitionSize(ui); |
---|
472 | m_pePredMode[ui] = pcFrom->getPredictionMode(ui); |
---|
473 | m_puhDepth[ui] = pcFrom->getDepth(ui); |
---|
474 | #if HHI_MPI |
---|
475 | m_piTextureModeDepth[ui] = pcFrom->getTextureModeDepth(ui); |
---|
476 | #endif |
---|
477 | m_puhWidth [ui] = pcFrom->getWidth(ui); |
---|
478 | m_puhHeight [ui] = pcFrom->getHeight(ui); |
---|
479 | m_puhTrIdx [ui] = pcFrom->getTransformIdx(ui); |
---|
480 | m_nsqtPartIdx[ui] = pcFrom->getNSQTPartIdx(ui); |
---|
481 | m_apiMVPIdx[0][ui] = pcFrom->m_apiMVPIdx[0][ui];; |
---|
482 | m_apiMVPIdx[1][ui] = pcFrom->m_apiMVPIdx[1][ui]; |
---|
483 | m_apiMVPNum[0][ui] = pcFrom->m_apiMVPNum[0][ui]; |
---|
484 | m_apiMVPNum[1][ui] = pcFrom->m_apiMVPNum[1][ui]; |
---|
485 | m_phQP[ui]=pcFrom->m_phQP[ui]; |
---|
486 | m_puiAlfCtrlFlag[ui]=pcFrom->m_puiAlfCtrlFlag[ui]; |
---|
487 | m_pbMergeFlag[ui]=pcFrom->m_pbMergeFlag[ui]; |
---|
488 | m_puhMergeIndex[ui]=pcFrom->m_puhMergeIndex[ui]; |
---|
489 | m_puhLumaIntraDir[ui]=pcFrom->m_puhLumaIntraDir[ui]; |
---|
490 | m_puhChromaIntraDir[ui]=pcFrom->m_puhChromaIntraDir[ui]; |
---|
491 | m_puhInterDir[ui]=pcFrom->m_puhInterDir[ui]; |
---|
492 | m_puhCbf[0][ui]=pcFrom->m_puhCbf[0][ui]; |
---|
493 | m_puhCbf[1][ui]=pcFrom->m_puhCbf[1][ui]; |
---|
494 | m_puhCbf[2][ui]=pcFrom->m_puhCbf[2][ui]; |
---|
495 | m_pbIPCMFlag[ui] = pcFrom->m_pbIPCMFlag[ui]; |
---|
496 | } |
---|
497 | |
---|
498 | Int firstElement = max<Int>( partStartIdx, 0 ); |
---|
499 | numElements = m_uiNumPartition - firstElement; |
---|
500 | |
---|
501 | if ( numElements > 0 ) |
---|
502 | { |
---|
503 | memset( m_pePartSize + firstElement, SIZE_NONE, numElements * sizeof( *m_pePartSize ) ); |
---|
504 | memset( m_pePredMode + firstElement, MODE_NONE, numElements * sizeof( *m_pePredMode ) ); |
---|
505 | memset( m_puhDepth + firstElement, 0, numElements * sizeof( *m_puhDepth ) ); |
---|
506 | #if HHI_MPI |
---|
507 | memset( m_piTextureModeDepth+ firstElement,-1, numElements * sizeof( *m_piTextureModeDepth ) ); |
---|
508 | #endif |
---|
509 | memset( m_puhTrIdx + firstElement, 0, numElements * sizeof( *m_puhTrIdx ) ); |
---|
510 | memset( m_nsqtPartIdx + firstElement, 0, numElements * sizeof( *m_nsqtPartIdx) ); |
---|
511 | memset( m_puhWidth + firstElement, g_uiMaxCUWidth, numElements * sizeof( *m_puhWidth ) ); |
---|
512 | memset( m_puhHeight + firstElement, g_uiMaxCUHeight, numElements * sizeof( *m_puhHeight ) ); |
---|
513 | memset( m_apiMVPIdx[0] + firstElement, -1, numElements * sizeof( *m_apiMVPIdx[0] ) ); |
---|
514 | memset( m_apiMVPIdx[1] + firstElement, -1, numElements * sizeof( *m_apiMVPIdx[1] ) ); |
---|
515 | memset( m_apiMVPNum[0] + firstElement, -1, numElements * sizeof( *m_apiMVPNum[0] ) ); |
---|
516 | memset( m_apiMVPNum[1] + firstElement, -1, numElements * sizeof( *m_apiMVPNum[1] ) ); |
---|
517 | memset( m_phQP + firstElement, getSlice()->getSliceQp(), numElements * sizeof( *m_phQP ) ); |
---|
518 | memset( m_puiAlfCtrlFlag + firstElement, false, numElements * sizeof( *m_puiAlfCtrlFlag ) ); |
---|
519 | memset( m_pbMergeFlag + firstElement, false, numElements * sizeof( *m_pbMergeFlag ) ); |
---|
520 | memset( m_puhMergeIndex + firstElement, 0, numElements * sizeof( *m_puhMergeIndex ) ); |
---|
521 | memset( m_puhLumaIntraDir + firstElement, 2, numElements * sizeof( *m_puhLumaIntraDir ) ); |
---|
522 | memset( m_puhChromaIntraDir + firstElement, 0, numElements * sizeof( *m_puhChromaIntraDir ) ); |
---|
523 | memset( m_puhInterDir + firstElement, 0, numElements * sizeof( *m_puhInterDir ) ); |
---|
524 | memset( m_puhCbf[0] + firstElement, 0, numElements * sizeof( *m_puhCbf[0] ) ); |
---|
525 | memset( m_puhCbf[1] + firstElement, 0, numElements * sizeof( *m_puhCbf[1] ) ); |
---|
526 | memset( m_puhCbf[2] + firstElement, 0, numElements * sizeof( *m_puhCbf[2] ) ); |
---|
527 | memset( m_pbIPCMFlag + firstElement, false, numElements * sizeof( *m_pbIPCMFlag ) ); |
---|
528 | |
---|
529 | #if HHI_DMM_WEDGE_INTRA |
---|
530 | memset( m_puiWedgeFullTabIdx + firstElement, 0, sizeof( UInt ) * numElements ); |
---|
531 | memset( m_piWedgeFullDeltaDC1 + firstElement, 0, sizeof( Int ) * numElements ); |
---|
532 | memset( m_piWedgeFullDeltaDC2 + firstElement, 0, sizeof( Int ) * numElements ); |
---|
533 | |
---|
534 | memset( m_puiWedgePredDirTabIdx + firstElement, 0, sizeof( UInt ) * numElements ); |
---|
535 | memset( m_piWedgePredDirDeltaDC1 + firstElement, 0, sizeof( Int ) * numElements ); |
---|
536 | memset( m_piWedgePredDirDeltaDC2 + firstElement, 0, sizeof( Int ) * numElements ); |
---|
537 | memset( m_piWedgePredDirDeltaEnd + firstElement, 0, sizeof( Int ) * numElements ); |
---|
538 | #endif |
---|
539 | #if HHI_DMM_PRED_TEX |
---|
540 | memset( m_puiWedgePredTexTabIdx + firstElement, 0, sizeof( UInt ) * numElements ); |
---|
541 | memset( m_piWedgePredTexDeltaDC1 + firstElement, 0, sizeof( Int ) * numElements ); |
---|
542 | memset( m_piWedgePredTexDeltaDC2 + firstElement, 0, sizeof( Int ) * numElements ); |
---|
543 | |
---|
544 | memset( m_piContourPredTexDeltaDC1 + firstElement, 0, sizeof( Int ) * numElements ); |
---|
545 | memset( m_piContourPredTexDeltaDC2 + firstElement, 0, sizeof( Int ) * numElements ); |
---|
546 | #endif |
---|
547 | #if HHI_INTERVIEW_SKIP |
---|
548 | memset (m_pbRenderable + firstElement, false, sizeof( Bool ) * numElements) ; |
---|
549 | #endif |
---|
550 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
551 | memset( m_pbResPredAvailable + firstElement, 0 , sizeof( Bool ) * numElements ); |
---|
552 | memset( m_pbResPredFlag + firstElement, 0 , sizeof( Bool ) * numElements ); |
---|
553 | #endif |
---|
554 | } |
---|
555 | |
---|
556 | UInt uiTmp = g_uiMaxCUWidth*g_uiMaxCUHeight; |
---|
557 | if ( 0 >= partStartIdx ) |
---|
558 | { |
---|
559 | m_acCUMvField[0].clearMvField(); |
---|
560 | m_acCUMvField[1].clearMvField(); |
---|
561 | memset( m_pcTrCoeffY , 0, sizeof( TCoeff ) * uiTmp ); |
---|
562 | #if ADAPTIVE_QP_SELECTION |
---|
563 | memset( m_pcArlCoeffY , 0, sizeof( Int ) * uiTmp ); |
---|
564 | #endif |
---|
565 | memset( m_pcIPCMSampleY , 0, sizeof( Pel ) * uiTmp ); |
---|
566 | uiTmp >>= 2; |
---|
567 | memset( m_pcTrCoeffCb, 0, sizeof( TCoeff ) * uiTmp ); |
---|
568 | memset( m_pcTrCoeffCr, 0, sizeof( TCoeff ) * uiTmp ); |
---|
569 | #if ADAPTIVE_QP_SELECTION |
---|
570 | memset( m_pcArlCoeffCb, 0, sizeof( Int ) * uiTmp ); |
---|
571 | memset( m_pcArlCoeffCr, 0, sizeof( Int ) * uiTmp ); |
---|
572 | #endif |
---|
573 | memset( m_pcIPCMSampleCb , 0, sizeof( Pel ) * uiTmp ); |
---|
574 | memset( m_pcIPCMSampleCr , 0, sizeof( Pel ) * uiTmp ); |
---|
575 | } |
---|
576 | else |
---|
577 | { |
---|
578 | TComDataCU * pcFrom = pcPic->getCU(getAddr()); |
---|
579 | m_acCUMvField[0].copyFrom(&pcFrom->m_acCUMvField[0],m_uiNumPartition,0); |
---|
580 | m_acCUMvField[1].copyFrom(&pcFrom->m_acCUMvField[1],m_uiNumPartition,0); |
---|
581 | for(int i=0; i<uiTmp; i++) |
---|
582 | { |
---|
583 | m_pcTrCoeffY[i]=pcFrom->m_pcTrCoeffY[i]; |
---|
584 | #if ADAPTIVE_QP_SELECTION |
---|
585 | m_pcArlCoeffY[i]=pcFrom->m_pcArlCoeffY[i]; |
---|
586 | #endif |
---|
587 | m_pcIPCMSampleY[i]=pcFrom->m_pcIPCMSampleY[i]; |
---|
588 | } |
---|
589 | for(int i=0; i<(uiTmp>>2); i++) |
---|
590 | { |
---|
591 | m_pcTrCoeffCb[i]=pcFrom->m_pcTrCoeffCb[i]; |
---|
592 | m_pcTrCoeffCr[i]=pcFrom->m_pcTrCoeffCr[i]; |
---|
593 | #if ADAPTIVE_QP_SELECTION |
---|
594 | m_pcArlCoeffCb[i]=pcFrom->m_pcArlCoeffCb[i]; |
---|
595 | m_pcArlCoeffCr[i]=pcFrom->m_pcArlCoeffCr[i]; |
---|
596 | #endif |
---|
597 | m_pcIPCMSampleCb[i]=pcFrom->m_pcIPCMSampleCb[i]; |
---|
598 | m_pcIPCMSampleCr[i]=pcFrom->m_pcIPCMSampleCr[i]; |
---|
599 | } |
---|
600 | } |
---|
601 | |
---|
602 | // Setting neighbor CU |
---|
603 | m_pcCULeft = NULL; |
---|
604 | m_pcCUAbove = NULL; |
---|
605 | m_pcCUAboveLeft = NULL; |
---|
606 | m_pcCUAboveRight = NULL; |
---|
607 | |
---|
608 | m_apcCUColocated[0] = NULL; |
---|
609 | m_apcCUColocated[1] = NULL; |
---|
610 | |
---|
611 | UInt uiWidthInCU = pcPic->getFrameWidthInCU(); |
---|
612 | if ( m_uiCUAddr % uiWidthInCU ) |
---|
613 | { |
---|
614 | m_pcCULeft = pcPic->getCU( m_uiCUAddr - 1 ); |
---|
615 | } |
---|
616 | |
---|
617 | if ( m_uiCUAddr / uiWidthInCU ) |
---|
618 | { |
---|
619 | m_pcCUAbove = pcPic->getCU( m_uiCUAddr - uiWidthInCU ); |
---|
620 | } |
---|
621 | |
---|
622 | if ( m_pcCULeft && m_pcCUAbove ) |
---|
623 | { |
---|
624 | m_pcCUAboveLeft = pcPic->getCU( m_uiCUAddr - uiWidthInCU - 1 ); |
---|
625 | } |
---|
626 | |
---|
627 | if ( m_pcCUAbove && ( (m_uiCUAddr%uiWidthInCU) < (uiWidthInCU-1) ) ) |
---|
628 | { |
---|
629 | m_pcCUAboveRight = pcPic->getCU( m_uiCUAddr - uiWidthInCU + 1 ); |
---|
630 | } |
---|
631 | |
---|
632 | if ( getSlice()->getNumRefIdx( REF_PIC_LIST_0 ) > 0 ) |
---|
633 | { |
---|
634 | m_apcCUColocated[0] = getSlice()->getRefPic( REF_PIC_LIST_0, 0)->getCU( m_uiCUAddr ); |
---|
635 | } |
---|
636 | |
---|
637 | if ( getSlice()->getNumRefIdx( REF_PIC_LIST_1 ) > 0 ) |
---|
638 | { |
---|
639 | m_apcCUColocated[1] = getSlice()->getRefPic( REF_PIC_LIST_1, 0)->getCU( m_uiCUAddr ); |
---|
640 | } |
---|
641 | } |
---|
642 | |
---|
643 | #if H0736_AVC_STYLE_QP_RANGE |
---|
644 | /** initialize prediction data with enabling sub-LCU-level delta QP |
---|
645 | *\param uiDepth depth of the current CU |
---|
646 | *\param qp qp for the current CU |
---|
647 | *- set CU width and CU height according to depth |
---|
648 | *- set qp value according to input qp |
---|
649 | *- set last-coded qp value according to input last-coded qp |
---|
650 | */ |
---|
651 | Void TComDataCU::initEstData( UInt uiDepth, Int qp ) |
---|
652 | #else |
---|
653 | /** initialize prediction data with enabling sub-LCU-level delta QP |
---|
654 | *\param uiDepth depth of the current CU |
---|
655 | *\param uiQP QP for the current CU |
---|
656 | *- set CU width and CU height according to depth |
---|
657 | *- set QP value according to input QP |
---|
658 | *- set last-coded QP value according to input last-coded QP |
---|
659 | */ |
---|
660 | Void TComDataCU::initEstData( UInt uiDepth, UInt uiQP ) |
---|
661 | #endif |
---|
662 | { |
---|
663 | m_dTotalCost = MAX_DOUBLE; |
---|
664 | m_uiTotalDistortion = 0; |
---|
665 | m_uiTotalBits = 0; |
---|
666 | m_uiTotalBins = 0; |
---|
667 | |
---|
668 | UChar uhWidth = g_uiMaxCUWidth >> uiDepth; |
---|
669 | UChar uhHeight = g_uiMaxCUHeight >> uiDepth; |
---|
670 | |
---|
671 | for (UInt ui = 0; ui < m_uiNumPartition; ui++) |
---|
672 | { |
---|
673 | if(getPic()->getPicSym()->getInverseCUOrderMap(getAddr())*m_pcPic->getNumPartInCU()+m_uiAbsIdxInLCU+ui >= getSlice()->getEntropySliceCurStartCUAddr()) |
---|
674 | { |
---|
675 | #if HHI_INTERVIEW_SKIP |
---|
676 | m_pbRenderable[ui]= 0 ; |
---|
677 | #endif |
---|
678 | m_apiMVPIdx[0][ui] = -1; |
---|
679 | m_apiMVPIdx[1][ui] = -1; |
---|
680 | m_apiMVPNum[0][ui] = -1; |
---|
681 | m_apiMVPNum[1][ui] = -1; |
---|
682 | m_puhDepth [ui] = uiDepth; |
---|
683 | m_puhWidth [ui] = uhWidth; |
---|
684 | m_puhHeight [ui] = uhHeight; |
---|
685 | m_puhTrIdx [ui] = 0; |
---|
686 | #if HHI_MPI |
---|
687 | m_piTextureModeDepth[ui] = -1; |
---|
688 | #endif |
---|
689 | m_nsqtPartIdx[ui] = 0; |
---|
690 | m_pePartSize[ui] = SIZE_NONE; |
---|
691 | m_pePredMode[ui] = MODE_NONE; |
---|
692 | m_pbIPCMFlag[ui] = 0; |
---|
693 | #if H0736_AVC_STYLE_QP_RANGE |
---|
694 | m_phQP[ui] = qp; |
---|
695 | #else |
---|
696 | m_phQP[ui] = uiQP; |
---|
697 | #endif |
---|
698 | m_puiAlfCtrlFlag[ui]= false; |
---|
699 | m_pbMergeFlag[ui] = 0; |
---|
700 | m_puhMergeIndex[ui] = 0; |
---|
701 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
702 | m_pbResPredAvailable[ui] = 0; |
---|
703 | m_pbResPredFlag[ui] = 0; |
---|
704 | #endif |
---|
705 | m_puhLumaIntraDir[ui] = 2; |
---|
706 | m_puhChromaIntraDir[ui] = 0; |
---|
707 | m_puhInterDir[ui] = 0; |
---|
708 | m_puhCbf[0][ui] = 0; |
---|
709 | m_puhCbf[1][ui] = 0; |
---|
710 | m_puhCbf[2][ui] = 0; |
---|
711 | #if HHI_DMM_WEDGE_INTRA |
---|
712 | m_puiWedgeFullTabIdx [ui] = 0; |
---|
713 | m_piWedgeFullDeltaDC1 [ui] = 0; |
---|
714 | m_piWedgeFullDeltaDC2 [ui] = 0; |
---|
715 | |
---|
716 | m_puiWedgePredDirTabIdx [ui] = 0; |
---|
717 | m_piWedgePredDirDeltaDC1 [ui] = 0; |
---|
718 | m_piWedgePredDirDeltaDC2 [ui] = 0; |
---|
719 | m_piWedgePredDirDeltaEnd [ui] = 0; |
---|
720 | #endif |
---|
721 | #if HHI_DMM_PRED_TEX |
---|
722 | m_puiWedgePredTexTabIdx [ui] = 0; |
---|
723 | m_piWedgePredTexDeltaDC1 [ui] = 0; |
---|
724 | m_piWedgePredTexDeltaDC2 [ui] = 0; |
---|
725 | |
---|
726 | m_piContourPredTexDeltaDC1[ui] = 0; |
---|
727 | m_piContourPredTexDeltaDC2[ui] = 0; |
---|
728 | #endif |
---|
729 | } |
---|
730 | } |
---|
731 | |
---|
732 | UInt uiTmp = uhWidth*uhHeight; |
---|
733 | |
---|
734 | if(getPic()->getPicSym()->getInverseCUOrderMap(getAddr())*m_pcPic->getNumPartInCU()+m_uiAbsIdxInLCU >= getSlice()->getEntropySliceCurStartCUAddr()) |
---|
735 | { |
---|
736 | m_acCUMvField[0].clearMvField(); |
---|
737 | m_acCUMvField[1].clearMvField(); |
---|
738 | uiTmp = uhWidth*uhHeight; |
---|
739 | |
---|
740 | memset( m_pcTrCoeffY, 0, uiTmp * sizeof( *m_pcTrCoeffY ) ); |
---|
741 | #if ADAPTIVE_QP_SELECTION |
---|
742 | memset( m_pcArlCoeffY , 0, uiTmp * sizeof( *m_pcArlCoeffY ) ); |
---|
743 | #endif |
---|
744 | memset( m_pcIPCMSampleY, 0, uiTmp * sizeof( *m_pcIPCMSampleY ) ); |
---|
745 | |
---|
746 | uiTmp>>=2; |
---|
747 | memset( m_pcTrCoeffCb, 0, uiTmp * sizeof( *m_pcTrCoeffCb ) ); |
---|
748 | memset( m_pcTrCoeffCr, 0, uiTmp * sizeof( *m_pcTrCoeffCr ) ); |
---|
749 | #if ADAPTIVE_QP_SELECTION |
---|
750 | memset( m_pcArlCoeffCb, 0, uiTmp * sizeof( *m_pcArlCoeffCb ) ); |
---|
751 | memset( m_pcArlCoeffCr, 0, uiTmp * sizeof( *m_pcArlCoeffCr ) ); |
---|
752 | #endif |
---|
753 | memset( m_pcIPCMSampleCb, 0, uiTmp * sizeof( *m_pcIPCMSampleCb ) ); |
---|
754 | memset( m_pcIPCMSampleCr, 0, uiTmp * sizeof( *m_pcIPCMSampleCr ) ); |
---|
755 | } |
---|
756 | } |
---|
757 | |
---|
758 | |
---|
759 | // initialize Sub partition |
---|
760 | #if H0736_AVC_STYLE_QP_RANGE |
---|
761 | Void TComDataCU::initSubCU( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, Int qp ) |
---|
762 | #else |
---|
763 | Void TComDataCU::initSubCU( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, UInt uiQP ) |
---|
764 | #endif |
---|
765 | { |
---|
766 | assert( uiPartUnitIdx<4 ); |
---|
767 | |
---|
768 | UInt uiPartOffset = ( pcCU->getTotalNumPart()>>2 )*uiPartUnitIdx; |
---|
769 | |
---|
770 | m_pcPic = pcCU->getPic(); |
---|
771 | m_pcSlice = m_pcPic->getSlice(m_pcPic->getCurrSliceIdx()); |
---|
772 | m_uiCUAddr = pcCU->getAddr(); |
---|
773 | m_uiAbsIdxInLCU = pcCU->getZorderIdxInCU() + uiPartOffset; |
---|
774 | |
---|
775 | m_uiCUPelX = pcCU->getCUPelX() + ( g_uiMaxCUWidth>>uiDepth )*( uiPartUnitIdx & 1 ); |
---|
776 | m_uiCUPelY = pcCU->getCUPelY() + ( g_uiMaxCUHeight>>uiDepth )*( uiPartUnitIdx >> 1 ); |
---|
777 | |
---|
778 | m_dTotalCost = MAX_DOUBLE; |
---|
779 | m_uiTotalDistortion = 0; |
---|
780 | m_uiTotalBits = 0; |
---|
781 | m_uiTotalBins = 0; |
---|
782 | m_uiNumPartition = pcCU->getTotalNumPart() >> 2; |
---|
783 | |
---|
784 | #if BURST_IPCM |
---|
785 | m_numSucIPCM = 0; |
---|
786 | m_lastCUSucIPCMFlag = false; |
---|
787 | #endif |
---|
788 | |
---|
789 | Int iSizeInUchar = sizeof( UChar ) * m_uiNumPartition; |
---|
790 | Int iSizeInBool = sizeof( Bool ) * m_uiNumPartition; |
---|
791 | |
---|
792 | #if H0736_AVC_STYLE_QP_RANGE |
---|
793 | Int sizeInChar = sizeof( Char ) * m_uiNumPartition; |
---|
794 | memset( m_phQP, qp, sizeInChar ); |
---|
795 | #else |
---|
796 | memset( m_phQP, uiQP, iSizeInUchar ); |
---|
797 | #endif |
---|
798 | |
---|
799 | memset( m_puiAlfCtrlFlag, 0, iSizeInBool ); |
---|
800 | memset( m_pbMergeFlag, 0, iSizeInBool ); |
---|
801 | #if HHI_INTERVIEW_SKIP |
---|
802 | memset( m_pbRenderable, 0, iSizeInBool ); |
---|
803 | #endif |
---|
804 | memset( m_puhMergeIndex, 0, iSizeInUchar ); |
---|
805 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
806 | memset( m_pbResPredAvailable, 0, iSizeInBool ); |
---|
807 | memset( m_pbResPredFlag, 0, iSizeInBool ); |
---|
808 | #endif |
---|
809 | memset( m_puhLumaIntraDir, 2, iSizeInUchar ); |
---|
810 | memset( m_puhChromaIntraDir, 0, iSizeInUchar ); |
---|
811 | memset( m_puhInterDir, 0, iSizeInUchar ); |
---|
812 | memset( m_puhTrIdx, 0, iSizeInUchar ); |
---|
813 | memset( m_puhCbf[0], 0, iSizeInUchar ); |
---|
814 | memset( m_puhCbf[1], 0, iSizeInUchar ); |
---|
815 | memset( m_puhCbf[2], 0, iSizeInUchar ); |
---|
816 | memset( m_puhDepth, uiDepth, iSizeInUchar ); |
---|
817 | #if HHI_MPI |
---|
818 | memset( m_piTextureModeDepth, -1, sizeof( Int ) * m_uiNumPartition ); |
---|
819 | #endif |
---|
820 | |
---|
821 | #if HHI_DMM_WEDGE_INTRA |
---|
822 | memset( m_puiWedgeFullTabIdx, 0, sizeof( UInt ) * m_uiNumPartition ); |
---|
823 | memset( m_piWedgeFullDeltaDC1, 0, sizeof( Int ) * m_uiNumPartition ); |
---|
824 | memset( m_piWedgeFullDeltaDC2, 0, sizeof( Int ) * m_uiNumPartition ); |
---|
825 | |
---|
826 | memset( m_puiWedgePredDirTabIdx, 0, sizeof( UInt ) * m_uiNumPartition ); |
---|
827 | memset( m_piWedgePredDirDeltaDC1, 0, sizeof( Int ) * m_uiNumPartition ); |
---|
828 | memset( m_piWedgePredDirDeltaDC2, 0, sizeof( Int ) * m_uiNumPartition ); |
---|
829 | memset( m_piWedgePredDirDeltaEnd, 0, sizeof( Int ) * m_uiNumPartition ); |
---|
830 | #endif |
---|
831 | #if HHI_DMM_PRED_TEX |
---|
832 | memset( m_puiWedgePredTexTabIdx, 0, sizeof( UInt ) * m_uiNumPartition ); |
---|
833 | memset( m_piWedgePredTexDeltaDC1, 0, sizeof( Int ) * m_uiNumPartition ); |
---|
834 | memset( m_piWedgePredTexDeltaDC2, 0, sizeof( Int ) * m_uiNumPartition ); |
---|
835 | |
---|
836 | memset( m_piContourPredTexDeltaDC1, 0, sizeof( Int ) * m_uiNumPartition ); |
---|
837 | memset( m_piContourPredTexDeltaDC2, 0, sizeof( Int ) * m_uiNumPartition ); |
---|
838 | #endif |
---|
839 | |
---|
840 | UChar uhWidth = g_uiMaxCUWidth >> uiDepth; |
---|
841 | UChar uhHeight = g_uiMaxCUHeight >> uiDepth; |
---|
842 | memset( m_puhWidth, uhWidth, iSizeInUchar ); |
---|
843 | memset( m_puhHeight, uhHeight, iSizeInUchar ); |
---|
844 | memset( m_pbIPCMFlag, 0, iSizeInBool ); |
---|
845 | for (UInt ui = 0; ui < m_uiNumPartition; ui++) |
---|
846 | { |
---|
847 | m_pePartSize[ui] = SIZE_NONE; |
---|
848 | m_pePredMode[ui] = MODE_NONE; |
---|
849 | #if HHI_INTERVIEW_SKIP |
---|
850 | m_pbRenderable[ui]= 0 ; |
---|
851 | #endif |
---|
852 | m_apiMVPIdx[0][ui] = -1; |
---|
853 | m_apiMVPIdx[1][ui] = -1; |
---|
854 | m_apiMVPNum[0][ui] = -1; |
---|
855 | m_apiMVPNum[1][ui] = -1; |
---|
856 | if(m_pcPic->getPicSym()->getInverseCUOrderMap(getAddr())*m_pcPic->getNumPartInCU()+m_uiAbsIdxInLCU+ui<getSlice()->getEntropySliceCurStartCUAddr()) |
---|
857 | { |
---|
858 | m_apiMVPIdx[0][ui] = pcCU->m_apiMVPIdx[0][uiPartOffset+ui]; |
---|
859 | m_apiMVPIdx[1][ui] = pcCU->m_apiMVPIdx[1][uiPartOffset+ui];; |
---|
860 | m_apiMVPNum[0][ui] = pcCU->m_apiMVPNum[0][uiPartOffset+ui];; |
---|
861 | m_apiMVPNum[1][ui] = pcCU->m_apiMVPNum[1][uiPartOffset+ui];; |
---|
862 | m_puhDepth [ui] = pcCU->getDepth(uiPartOffset+ui); |
---|
863 | #if HHI_MPI |
---|
864 | m_piTextureModeDepth[ui] = pcCU->getTextureModeDepth(uiPartOffset+ui); |
---|
865 | #endif |
---|
866 | m_puhWidth [ui] = pcCU->getWidth(uiPartOffset+ui); |
---|
867 | m_puhHeight [ui] = pcCU->getHeight(uiPartOffset+ui); |
---|
868 | m_puhTrIdx [ui] = pcCU->getTransformIdx(uiPartOffset+ui); |
---|
869 | m_nsqtPartIdx[ui] = pcCU->getNSQTPartIdx(uiPartOffset+ui); |
---|
870 | m_pePartSize[ui] = pcCU->getPartitionSize(uiPartOffset+ui); |
---|
871 | m_pePredMode[ui] = pcCU->getPredictionMode(uiPartOffset+ui); |
---|
872 | m_pbIPCMFlag[ui]=pcCU->m_pbIPCMFlag[uiPartOffset+ui]; |
---|
873 | m_phQP[ui] = pcCU->m_phQP[uiPartOffset+ui]; |
---|
874 | m_puiAlfCtrlFlag[ui]=pcCU->m_puiAlfCtrlFlag[uiPartOffset+ui]; |
---|
875 | m_pbMergeFlag[ui]=pcCU->m_pbMergeFlag[uiPartOffset+ui]; |
---|
876 | m_puhMergeIndex[ui]=pcCU->m_puhMergeIndex[uiPartOffset+ui]; |
---|
877 | m_puhLumaIntraDir[ui]=pcCU->m_puhLumaIntraDir[uiPartOffset+ui]; |
---|
878 | m_puhChromaIntraDir[ui]=pcCU->m_puhChromaIntraDir[uiPartOffset+ui]; |
---|
879 | m_puhInterDir[ui]=pcCU->m_puhInterDir[uiPartOffset+ui]; |
---|
880 | m_puhCbf[0][ui]=pcCU->m_puhCbf[0][uiPartOffset+ui]; |
---|
881 | m_puhCbf[1][ui]=pcCU->m_puhCbf[1][uiPartOffset+ui]; |
---|
882 | m_puhCbf[2][ui]=pcCU->m_puhCbf[2][uiPartOffset+ui]; |
---|
883 | |
---|
884 | #if HHI_DMM_WEDGE_INTRA |
---|
885 | m_puiWedgeFullTabIdx [ui]=pcCU->getWedgeFullTabIdx (uiPartOffset+ui); |
---|
886 | m_piWedgeFullDeltaDC1 [ui]=pcCU->getWedgeFullDeltaDC1 (uiPartOffset+ui); |
---|
887 | m_piWedgeFullDeltaDC2 [ui]=pcCU->getWedgeFullDeltaDC2 (uiPartOffset+ui); |
---|
888 | |
---|
889 | m_puiWedgePredDirTabIdx [ui]=pcCU->getWedgePredDirTabIdx (uiPartOffset+ui); |
---|
890 | m_piWedgePredDirDeltaDC1 [ui]=pcCU->getWedgePredDirDeltaDC1 (uiPartOffset+ui); |
---|
891 | m_piWedgePredDirDeltaDC2 [ui]=pcCU->getWedgePredDirDeltaDC2 (uiPartOffset+ui); |
---|
892 | m_piWedgePredDirDeltaEnd [ui]=pcCU->getWedgePredDirDeltaEnd (uiPartOffset+ui); |
---|
893 | #endif |
---|
894 | #if HHI_DMM_PRED_TEX |
---|
895 | m_puiWedgePredTexTabIdx [ui]=pcCU->getWedgePredTexTabIdx (uiPartOffset+ui); |
---|
896 | m_piWedgePredTexDeltaDC1 [ui]=pcCU->getWedgePredTexDeltaDC1 (uiPartOffset+ui); |
---|
897 | m_piWedgePredTexDeltaDC2 [ui]=pcCU->getWedgePredTexDeltaDC2 (uiPartOffset+ui); |
---|
898 | |
---|
899 | m_piContourPredTexDeltaDC1[ui]=pcCU->getContourPredTexDeltaDC1(uiPartOffset+ui); |
---|
900 | m_piContourPredTexDeltaDC2[ui]=pcCU->getContourPredTexDeltaDC2(uiPartOffset+ui); |
---|
901 | #endif |
---|
902 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
903 | m_pbResPredAvailable[ui] = pcCU->m_pbResPredAvailable[ uiPartOffset + ui ]; |
---|
904 | m_pbResPredFlag [ui] = pcCU->m_pbResPredFlag [ uiPartOffset + ui ]; |
---|
905 | #endif |
---|
906 | } |
---|
907 | } |
---|
908 | UInt uiTmp = uhWidth*uhHeight; |
---|
909 | memset( m_pcTrCoeffY , 0, sizeof(TCoeff)*uiTmp ); |
---|
910 | #if ADAPTIVE_QP_SELECTION |
---|
911 | memset( m_pcArlCoeffY , 0, sizeof(Int)*uiTmp ); |
---|
912 | #endif |
---|
913 | memset( m_pcIPCMSampleY , 0, sizeof( Pel ) * uiTmp ); |
---|
914 | uiTmp >>= 2; |
---|
915 | memset( m_pcTrCoeffCb, 0, sizeof(TCoeff)*uiTmp ); |
---|
916 | memset( m_pcTrCoeffCr, 0, sizeof(TCoeff)*uiTmp ); |
---|
917 | #if ADAPTIVE_QP_SELECTION |
---|
918 | memset( m_pcArlCoeffCb, 0, sizeof(Int)*uiTmp ); |
---|
919 | memset( m_pcArlCoeffCr, 0, sizeof(Int)*uiTmp ); |
---|
920 | #endif |
---|
921 | memset( m_pcIPCMSampleCb , 0, sizeof( Pel ) * uiTmp ); |
---|
922 | memset( m_pcIPCMSampleCr , 0, sizeof( Pel ) * uiTmp ); |
---|
923 | m_acCUMvField[0].clearMvField(); |
---|
924 | m_acCUMvField[1].clearMvField(); |
---|
925 | |
---|
926 | if(m_pcPic->getPicSym()->getInverseCUOrderMap(getAddr())*m_pcPic->getNumPartInCU()+m_uiAbsIdxInLCU<getSlice()->getEntropySliceCurStartCUAddr()) |
---|
927 | { |
---|
928 | // Part of this CU contains data from an older slice. Now copy in that data. |
---|
929 | UInt uiMaxCuWidth=pcCU->getSlice()->getSPS()->getMaxCUWidth(); |
---|
930 | UInt uiMaxCuHeight=pcCU->getSlice()->getSPS()->getMaxCUHeight(); |
---|
931 | TComDataCU * bigCU = getPic()->getCU(getAddr()); |
---|
932 | Int minui = uiPartOffset; |
---|
933 | minui = -minui; |
---|
934 | pcCU->m_acCUMvField[0].copyTo(&m_acCUMvField[0],minui,uiPartOffset,m_uiNumPartition); |
---|
935 | pcCU->m_acCUMvField[1].copyTo(&m_acCUMvField[1],minui,uiPartOffset,m_uiNumPartition); |
---|
936 | UInt uiCoffOffset = uiMaxCuWidth*uiMaxCuHeight*m_uiAbsIdxInLCU/pcCU->getPic()->getNumPartInCU(); |
---|
937 | uiTmp = uhWidth*uhHeight; |
---|
938 | for(int i=0; i<uiTmp; i++) |
---|
939 | { |
---|
940 | m_pcTrCoeffY[i]=bigCU->m_pcTrCoeffY[uiCoffOffset+i]; |
---|
941 | #if ADAPTIVE_QP_SELECTION |
---|
942 | m_pcArlCoeffY[i]=bigCU->m_pcArlCoeffY[uiCoffOffset+i]; |
---|
943 | #endif |
---|
944 | m_pcIPCMSampleY[i]=bigCU->m_pcIPCMSampleY[uiCoffOffset+i]; |
---|
945 | } |
---|
946 | uiTmp>>=2; |
---|
947 | uiCoffOffset>>=2; |
---|
948 | for(int i=0; i<uiTmp; i++) |
---|
949 | { |
---|
950 | m_pcTrCoeffCr[i]=bigCU->m_pcTrCoeffCr[uiCoffOffset+i]; |
---|
951 | m_pcTrCoeffCb[i]=bigCU->m_pcTrCoeffCb[uiCoffOffset+i]; |
---|
952 | #if ADAPTIVE_QP_SELECTION |
---|
953 | m_pcArlCoeffCr[i]=bigCU->m_pcArlCoeffCr[uiCoffOffset+i]; |
---|
954 | m_pcArlCoeffCb[i]=bigCU->m_pcArlCoeffCb[uiCoffOffset+i]; |
---|
955 | #endif |
---|
956 | m_pcIPCMSampleCb[i]=bigCU->m_pcIPCMSampleCb[uiCoffOffset+i]; |
---|
957 | m_pcIPCMSampleCr[i]=bigCU->m_pcIPCMSampleCr[uiCoffOffset+i]; |
---|
958 | } |
---|
959 | } |
---|
960 | |
---|
961 | m_pcCULeft = pcCU->getCULeft(); |
---|
962 | m_pcCUAbove = pcCU->getCUAbove(); |
---|
963 | m_pcCUAboveLeft = pcCU->getCUAboveLeft(); |
---|
964 | m_pcCUAboveRight = pcCU->getCUAboveRight(); |
---|
965 | |
---|
966 | m_apcCUColocated[0] = pcCU->getCUColocated(REF_PIC_LIST_0); |
---|
967 | m_apcCUColocated[1] = pcCU->getCUColocated(REF_PIC_LIST_1); |
---|
968 | memcpy(m_uiSliceStartCU,pcCU->m_uiSliceStartCU+uiPartOffset,sizeof(UInt)*m_uiNumPartition); |
---|
969 | memcpy(m_uiEntropySliceStartCU,pcCU->m_uiEntropySliceStartCU+uiPartOffset,sizeof(UInt)*m_uiNumPartition); |
---|
970 | } |
---|
971 | |
---|
972 | Void TComDataCU::setOutsideCUPart( UInt uiAbsPartIdx, UInt uiDepth ) |
---|
973 | { |
---|
974 | UInt uiNumPartition = m_uiNumPartition >> (uiDepth << 1); |
---|
975 | UInt uiSizeInUchar = sizeof( UChar ) * uiNumPartition; |
---|
976 | |
---|
977 | UChar uhWidth = g_uiMaxCUWidth >> uiDepth; |
---|
978 | UChar uhHeight = g_uiMaxCUHeight >> uiDepth; |
---|
979 | memset( m_puhDepth + uiAbsPartIdx, uiDepth, uiSizeInUchar ); |
---|
980 | memset( m_puhWidth + uiAbsPartIdx, uhWidth, uiSizeInUchar ); |
---|
981 | memset( m_puhHeight + uiAbsPartIdx, uhHeight, uiSizeInUchar ); |
---|
982 | } |
---|
983 | |
---|
984 | // -------------------------------------------------------------------------------------------------------------------- |
---|
985 | // Copy |
---|
986 | // -------------------------------------------------------------------------------------------------------------------- |
---|
987 | |
---|
988 | Void TComDataCU::copySubCU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
989 | { |
---|
990 | UInt uiPart = uiAbsPartIdx; |
---|
991 | |
---|
992 | m_pcPic = pcCU->getPic(); |
---|
993 | m_pcSlice = pcCU->getSlice(); |
---|
994 | m_uiCUAddr = pcCU->getAddr(); |
---|
995 | m_uiAbsIdxInLCU = uiAbsPartIdx; |
---|
996 | |
---|
997 | m_uiCUPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ]; |
---|
998 | m_uiCUPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ]; |
---|
999 | |
---|
1000 | UInt uiWidth = g_uiMaxCUWidth >> uiDepth; |
---|
1001 | UInt uiHeight = g_uiMaxCUHeight >> uiDepth; |
---|
1002 | |
---|
1003 | m_phQP=pcCU->getQP() + uiPart; |
---|
1004 | m_pePartSize = pcCU->getPartitionSize() + uiPart; |
---|
1005 | #if HHI_INTERVIEW_SKIP |
---|
1006 | m_pbRenderable = pcCU->getRenderable() + uiPart; |
---|
1007 | |
---|
1008 | #endif |
---|
1009 | m_pePredMode=pcCU->getPredictionMode() + uiPart; |
---|
1010 | |
---|
1011 | m_pbMergeFlag = pcCU->getMergeFlag() + uiPart; |
---|
1012 | m_puhMergeIndex = pcCU->getMergeIndex() + uiPart; |
---|
1013 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
1014 | m_pbResPredAvailable = pcCU->getResPredAvail() + uiPart; |
---|
1015 | m_pbResPredFlag = pcCU->getResPredFlag () + uiPart; |
---|
1016 | #endif |
---|
1017 | m_puhLumaIntraDir = pcCU->getLumaIntraDir() + uiPart; |
---|
1018 | m_puhChromaIntraDir = pcCU->getChromaIntraDir() + uiPart; |
---|
1019 | m_puhInterDir = pcCU->getInterDir() + uiPart; |
---|
1020 | m_puhTrIdx = pcCU->getTransformIdx() + uiPart; |
---|
1021 | m_nsqtPartIdx = pcCU->getNSQTPartIdx() + uiPart; |
---|
1022 | |
---|
1023 | m_puhCbf[0]= pcCU->getCbf(TEXT_LUMA) + uiPart; |
---|
1024 | m_puhCbf[1]= pcCU->getCbf(TEXT_CHROMA_U) + uiPart; |
---|
1025 | m_puhCbf[2]= pcCU->getCbf(TEXT_CHROMA_V) + uiPart; |
---|
1026 | |
---|
1027 | m_puhDepth=pcCU->getDepth() + uiPart; |
---|
1028 | m_puhWidth=pcCU->getWidth() + uiPart; |
---|
1029 | m_puhHeight=pcCU->getHeight() + uiPart; |
---|
1030 | #if HHI_MPI |
---|
1031 | m_piTextureModeDepth=pcCU->getTextureModeDepth()+ uiPart; |
---|
1032 | #endif |
---|
1033 | |
---|
1034 | m_apiMVPIdx[0]=pcCU->getMVPIdx(REF_PIC_LIST_0) + uiPart; |
---|
1035 | m_apiMVPIdx[1]=pcCU->getMVPIdx(REF_PIC_LIST_1) + uiPart; |
---|
1036 | m_apiMVPNum[0]=pcCU->getMVPNum(REF_PIC_LIST_0) + uiPart; |
---|
1037 | m_apiMVPNum[1]=pcCU->getMVPNum(REF_PIC_LIST_1) + uiPart; |
---|
1038 | |
---|
1039 | m_pbIPCMFlag = pcCU->getIPCMFlag() + uiPart; |
---|
1040 | |
---|
1041 | m_pcCUAboveLeft = pcCU->getCUAboveLeft(); |
---|
1042 | m_pcCUAboveRight = pcCU->getCUAboveRight(); |
---|
1043 | m_pcCUAbove = pcCU->getCUAbove(); |
---|
1044 | m_pcCULeft = pcCU->getCULeft(); |
---|
1045 | |
---|
1046 | m_apcCUColocated[0] = pcCU->getCUColocated(REF_PIC_LIST_0); |
---|
1047 | m_apcCUColocated[1] = pcCU->getCUColocated(REF_PIC_LIST_1); |
---|
1048 | |
---|
1049 | UInt uiTmp = uiWidth*uiHeight; |
---|
1050 | UInt uiMaxCuWidth=pcCU->getSlice()->getSPS()->getMaxCUWidth(); |
---|
1051 | UInt uiMaxCuHeight=pcCU->getSlice()->getSPS()->getMaxCUHeight(); |
---|
1052 | |
---|
1053 | UInt uiCoffOffset = uiMaxCuWidth*uiMaxCuHeight*uiAbsPartIdx/pcCU->getPic()->getNumPartInCU(); |
---|
1054 | |
---|
1055 | m_pcTrCoeffY = pcCU->getCoeffY() + uiCoffOffset; |
---|
1056 | #if ADAPTIVE_QP_SELECTION |
---|
1057 | m_pcArlCoeffY= pcCU->getArlCoeffY() + uiCoffOffset; |
---|
1058 | #endif |
---|
1059 | m_pcIPCMSampleY = pcCU->getPCMSampleY() + uiCoffOffset; |
---|
1060 | |
---|
1061 | uiTmp >>= 2; |
---|
1062 | uiCoffOffset >>=2; |
---|
1063 | m_pcTrCoeffCb=pcCU->getCoeffCb() + uiCoffOffset; |
---|
1064 | m_pcTrCoeffCr=pcCU->getCoeffCr() + uiCoffOffset; |
---|
1065 | #if ADAPTIVE_QP_SELECTION |
---|
1066 | m_pcArlCoeffCb=pcCU->getArlCoeffCb() + uiCoffOffset; |
---|
1067 | m_pcArlCoeffCr=pcCU->getArlCoeffCr() + uiCoffOffset; |
---|
1068 | #endif |
---|
1069 | m_pcIPCMSampleCb = pcCU->getPCMSampleCb() + uiCoffOffset; |
---|
1070 | m_pcIPCMSampleCr = pcCU->getPCMSampleCr() + uiCoffOffset; |
---|
1071 | |
---|
1072 | m_acCUMvField[0].linkToWithOffset( pcCU->getCUMvField(REF_PIC_LIST_0), uiPart ); |
---|
1073 | m_acCUMvField[1].linkToWithOffset( pcCU->getCUMvField(REF_PIC_LIST_1), uiPart ); |
---|
1074 | memcpy(m_uiSliceStartCU,pcCU->m_uiSliceStartCU+uiPart,sizeof(UInt)*m_uiNumPartition); |
---|
1075 | memcpy(m_uiEntropySliceStartCU,pcCU->m_uiEntropySliceStartCU+uiPart,sizeof(UInt)*m_uiNumPartition); |
---|
1076 | |
---|
1077 | #if HHI_DMM_WEDGE_INTRA |
---|
1078 | m_puiWedgeFullTabIdx = pcCU->getWedgeFullTabIdx() + uiPart; |
---|
1079 | m_piWedgeFullDeltaDC1 = pcCU->getWedgeFullDeltaDC1() + uiPart; |
---|
1080 | m_piWedgeFullDeltaDC2 = pcCU->getWedgeFullDeltaDC2() + uiPart; |
---|
1081 | |
---|
1082 | m_puiWedgePredDirTabIdx = pcCU->getWedgePredDirTabIdx() + uiPart; |
---|
1083 | m_piWedgePredDirDeltaDC1 = pcCU->getWedgePredDirDeltaDC1() + uiPart; |
---|
1084 | m_piWedgePredDirDeltaDC2 = pcCU->getWedgePredDirDeltaDC2() + uiPart; |
---|
1085 | m_piWedgePredDirDeltaEnd = pcCU->getWedgePredDirDeltaEnd() + uiPart; |
---|
1086 | #endif |
---|
1087 | #if HHI_DMM_PRED_TEX |
---|
1088 | m_puiWedgePredTexTabIdx = pcCU->getWedgePredTexTabIdx() + uiPart; |
---|
1089 | m_piWedgePredTexDeltaDC1 = pcCU->getWedgePredTexDeltaDC1() + uiPart; |
---|
1090 | m_piWedgePredTexDeltaDC2 = pcCU->getWedgePredTexDeltaDC2() + uiPart; |
---|
1091 | |
---|
1092 | m_piContourPredTexDeltaDC1 = pcCU->getContourPredTexDeltaDC1() + uiPart; |
---|
1093 | m_piContourPredTexDeltaDC2 = pcCU->getContourPredTexDeltaDC2() + uiPart; |
---|
1094 | #endif |
---|
1095 | } |
---|
1096 | |
---|
1097 | // Copy inter prediction info from the biggest CU |
---|
1098 | Void TComDataCU::copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList ) |
---|
1099 | { |
---|
1100 | m_pcPic = pcCU->getPic(); |
---|
1101 | m_pcSlice = pcCU->getSlice(); |
---|
1102 | m_uiCUAddr = pcCU->getAddr(); |
---|
1103 | m_uiAbsIdxInLCU = uiAbsPartIdx; |
---|
1104 | |
---|
1105 | Int iRastPartIdx = g_auiZscanToRaster[uiAbsPartIdx]; |
---|
1106 | m_uiCUPelX = pcCU->getCUPelX() + m_pcPic->getMinCUWidth ()*( iRastPartIdx % m_pcPic->getNumPartInWidth() ); |
---|
1107 | m_uiCUPelY = pcCU->getCUPelY() + m_pcPic->getMinCUHeight()*( iRastPartIdx / m_pcPic->getNumPartInWidth() ); |
---|
1108 | |
---|
1109 | m_pcCUAboveLeft = pcCU->getCUAboveLeft(); |
---|
1110 | m_pcCUAboveRight = pcCU->getCUAboveRight(); |
---|
1111 | m_pcCUAbove = pcCU->getCUAbove(); |
---|
1112 | m_pcCULeft = pcCU->getCULeft(); |
---|
1113 | |
---|
1114 | m_apcCUColocated[0] = pcCU->getCUColocated(REF_PIC_LIST_0); |
---|
1115 | m_apcCUColocated[1] = pcCU->getCUColocated(REF_PIC_LIST_1); |
---|
1116 | |
---|
1117 | m_pePartSize = pcCU->getPartitionSize () + uiAbsPartIdx; |
---|
1118 | #if HHI_INTERVIEW_SKIP |
---|
1119 | m_pbRenderable = pcCU->getRenderable() + uiAbsPartIdx; |
---|
1120 | |
---|
1121 | #endif |
---|
1122 | m_pePredMode = pcCU->getPredictionMode() + uiAbsPartIdx; |
---|
1123 | m_puhInterDir = pcCU->getInterDir () + uiAbsPartIdx; |
---|
1124 | |
---|
1125 | m_puhDepth = pcCU->getDepth () + uiAbsPartIdx; |
---|
1126 | m_puhWidth = pcCU->getWidth () + uiAbsPartIdx; |
---|
1127 | m_puhHeight = pcCU->getHeight() + uiAbsPartIdx; |
---|
1128 | |
---|
1129 | m_pbMergeFlag = pcCU->getMergeFlag() + uiAbsPartIdx; |
---|
1130 | m_puhMergeIndex = pcCU->getMergeIndex() + uiAbsPartIdx; |
---|
1131 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
1132 | m_pbResPredAvailable = pcCU->getResPredAvail() + uiAbsPartIdx; |
---|
1133 | m_pbResPredFlag = pcCU->getResPredFlag () + uiAbsPartIdx; |
---|
1134 | #endif |
---|
1135 | m_apiMVPIdx[eRefPicList] = pcCU->getMVPIdx(eRefPicList) + uiAbsPartIdx; |
---|
1136 | m_apiMVPNum[eRefPicList] = pcCU->getMVPNum(eRefPicList) + uiAbsPartIdx; |
---|
1137 | |
---|
1138 | m_acCUMvField[ eRefPicList ].linkToWithOffset( pcCU->getCUMvField(eRefPicList), uiAbsPartIdx ); |
---|
1139 | #if HHI_MPI |
---|
1140 | m_piTextureModeDepth = pcCU->getTextureModeDepth() + uiAbsPartIdx; |
---|
1141 | #endif |
---|
1142 | |
---|
1143 | memcpy(m_uiSliceStartCU,pcCU->m_uiSliceStartCU+uiAbsPartIdx,sizeof(UInt)*m_uiNumPartition); |
---|
1144 | memcpy(m_uiEntropySliceStartCU,pcCU->m_uiEntropySliceStartCU+uiAbsPartIdx,sizeof(UInt)*m_uiNumPartition); |
---|
1145 | } |
---|
1146 | |
---|
1147 | // Copy small CU to bigger CU. |
---|
1148 | // One of quarter parts overwritten by predicted sub part. |
---|
1149 | Void TComDataCU::copyPartFrom( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth ) |
---|
1150 | { |
---|
1151 | assert( uiPartUnitIdx<4 ); |
---|
1152 | |
---|
1153 | m_dTotalCost += pcCU->getTotalCost(); |
---|
1154 | m_uiTotalDistortion += pcCU->getTotalDistortion(); |
---|
1155 | m_uiTotalBits += pcCU->getTotalBits(); |
---|
1156 | |
---|
1157 | UInt uiOffset = pcCU->getTotalNumPart()*uiPartUnitIdx; |
---|
1158 | |
---|
1159 | UInt uiNumPartition = pcCU->getTotalNumPart(); |
---|
1160 | Int iSizeInUchar = sizeof( UChar ) * uiNumPartition; |
---|
1161 | Int iSizeInBool = sizeof( Bool ) * uiNumPartition; |
---|
1162 | |
---|
1163 | #if H0736_AVC_STYLE_QP_RANGE |
---|
1164 | Int sizeInChar = sizeof( Char ) * uiNumPartition; |
---|
1165 | memcpy( m_phQP + uiOffset, pcCU->getQP(), sizeInChar ); |
---|
1166 | #else |
---|
1167 | memcpy( m_phQP + uiOffset, pcCU->getQP(), iSizeInUchar ); |
---|
1168 | #endif |
---|
1169 | memcpy( m_pePartSize + uiOffset, pcCU->getPartitionSize(), sizeof( *m_pePartSize ) * uiNumPartition ); |
---|
1170 | memcpy( m_pePredMode + uiOffset, pcCU->getPredictionMode(), sizeof( *m_pePredMode ) * uiNumPartition ); |
---|
1171 | #if HHI_INTERVIEW_SKIP |
---|
1172 | memcpy( m_pbRenderable + uiOffset, pcCU->getRenderable(), iSizeInBool ); |
---|
1173 | #endif |
---|
1174 | memcpy( m_puiAlfCtrlFlag + uiOffset, pcCU->getAlfCtrlFlag(), iSizeInBool ); |
---|
1175 | memcpy( m_pbMergeFlag + uiOffset, pcCU->getMergeFlag(), iSizeInBool ); |
---|
1176 | memcpy( m_puhMergeIndex + uiOffset, pcCU->getMergeIndex(), iSizeInUchar ); |
---|
1177 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
1178 | memcpy( m_pbResPredAvailable + uiOffset, pcCU->getResPredAvail(), iSizeInBool ); |
---|
1179 | memcpy( m_pbResPredFlag + uiOffset, pcCU->getResPredFlag(), iSizeInBool ); |
---|
1180 | #endif |
---|
1181 | memcpy( m_puhLumaIntraDir + uiOffset, pcCU->getLumaIntraDir(), iSizeInUchar ); |
---|
1182 | memcpy( m_puhChromaIntraDir + uiOffset, pcCU->getChromaIntraDir(), iSizeInUchar ); |
---|
1183 | memcpy( m_puhInterDir + uiOffset, pcCU->getInterDir(), iSizeInUchar ); |
---|
1184 | memcpy( m_puhTrIdx + uiOffset, pcCU->getTransformIdx(), iSizeInUchar ); |
---|
1185 | memcpy( m_nsqtPartIdx + uiOffset, pcCU->getNSQTPartIdx(), iSizeInUchar ); |
---|
1186 | |
---|
1187 | memcpy( m_puhCbf[0] + uiOffset, pcCU->getCbf(TEXT_LUMA) , iSizeInUchar ); |
---|
1188 | memcpy( m_puhCbf[1] + uiOffset, pcCU->getCbf(TEXT_CHROMA_U), iSizeInUchar ); |
---|
1189 | memcpy( m_puhCbf[2] + uiOffset, pcCU->getCbf(TEXT_CHROMA_V), iSizeInUchar ); |
---|
1190 | |
---|
1191 | memcpy( m_puhDepth + uiOffset, pcCU->getDepth(), iSizeInUchar ); |
---|
1192 | memcpy( m_puhWidth + uiOffset, pcCU->getWidth(), iSizeInUchar ); |
---|
1193 | memcpy( m_puhHeight + uiOffset, pcCU->getHeight(), iSizeInUchar ); |
---|
1194 | |
---|
1195 | memcpy( m_apiMVPIdx[0] + uiOffset, pcCU->getMVPIdx(REF_PIC_LIST_0), iSizeInUchar ); |
---|
1196 | memcpy( m_apiMVPIdx[1] + uiOffset, pcCU->getMVPIdx(REF_PIC_LIST_1), iSizeInUchar ); |
---|
1197 | memcpy( m_apiMVPNum[0] + uiOffset, pcCU->getMVPNum(REF_PIC_LIST_0), iSizeInUchar ); |
---|
1198 | memcpy( m_apiMVPNum[1] + uiOffset, pcCU->getMVPNum(REF_PIC_LIST_1), iSizeInUchar ); |
---|
1199 | |
---|
1200 | memcpy( m_pbIPCMFlag + uiOffset, pcCU->getIPCMFlag(), iSizeInBool ); |
---|
1201 | |
---|
1202 | m_pcCUAboveLeft = pcCU->getCUAboveLeft(); |
---|
1203 | m_pcCUAboveRight = pcCU->getCUAboveRight(); |
---|
1204 | m_pcCUAbove = pcCU->getCUAbove(); |
---|
1205 | m_pcCULeft = pcCU->getCULeft(); |
---|
1206 | |
---|
1207 | m_apcCUColocated[0] = pcCU->getCUColocated(REF_PIC_LIST_0); |
---|
1208 | m_apcCUColocated[1] = pcCU->getCUColocated(REF_PIC_LIST_1); |
---|
1209 | |
---|
1210 | m_acCUMvField[0].copyFrom( pcCU->getCUMvField( REF_PIC_LIST_0 ), pcCU->getTotalNumPart(), uiOffset ); |
---|
1211 | m_acCUMvField[1].copyFrom( pcCU->getCUMvField( REF_PIC_LIST_1 ), pcCU->getTotalNumPart(), uiOffset ); |
---|
1212 | |
---|
1213 | UInt uiTmp = g_uiMaxCUWidth*g_uiMaxCUHeight >> (uiDepth<<1); |
---|
1214 | UInt uiTmp2 = uiPartUnitIdx*uiTmp; |
---|
1215 | memcpy( m_pcTrCoeffY + uiTmp2, pcCU->getCoeffY(), sizeof(TCoeff)*uiTmp ); |
---|
1216 | #if ADAPTIVE_QP_SELECTION |
---|
1217 | memcpy( m_pcArlCoeffY + uiTmp2, pcCU->getArlCoeffY(), sizeof(Int)*uiTmp ); |
---|
1218 | #endif |
---|
1219 | memcpy( m_pcIPCMSampleY + uiTmp2 , pcCU->getPCMSampleY(), sizeof(Pel) * uiTmp ); |
---|
1220 | |
---|
1221 | uiTmp >>= 2; uiTmp2>>= 2; |
---|
1222 | memcpy( m_pcTrCoeffCb + uiTmp2, pcCU->getCoeffCb(), sizeof(TCoeff)*uiTmp ); |
---|
1223 | memcpy( m_pcTrCoeffCr + uiTmp2, pcCU->getCoeffCr(), sizeof(TCoeff)*uiTmp ); |
---|
1224 | #if ADAPTIVE_QP_SELECTION |
---|
1225 | memcpy( m_pcArlCoeffCb + uiTmp2, pcCU->getArlCoeffCb(), sizeof(Int)*uiTmp ); |
---|
1226 | memcpy( m_pcArlCoeffCr + uiTmp2, pcCU->getArlCoeffCr(), sizeof(Int)*uiTmp ); |
---|
1227 | #endif |
---|
1228 | memcpy( m_pcIPCMSampleCb + uiTmp2 , pcCU->getPCMSampleCb(), sizeof(Pel) * uiTmp ); |
---|
1229 | memcpy( m_pcIPCMSampleCr + uiTmp2 , pcCU->getPCMSampleCr(), sizeof(Pel) * uiTmp ); |
---|
1230 | m_uiTotalBins += pcCU->getTotalBins(); |
---|
1231 | memcpy( m_uiSliceStartCU + uiOffset, pcCU->m_uiSliceStartCU, sizeof( UInt ) * uiNumPartition ); |
---|
1232 | memcpy( m_uiEntropySliceStartCU + uiOffset, pcCU->m_uiEntropySliceStartCU, sizeof( UInt ) * uiNumPartition ); |
---|
1233 | |
---|
1234 | #if HHI_DMM_WEDGE_INTRA |
---|
1235 | memcpy( m_puiWedgeFullTabIdx + uiOffset, pcCU->getWedgeFullTabIdx(), sizeof( UInt ) * uiNumPartition ); |
---|
1236 | memcpy( m_piWedgeFullDeltaDC1 + uiOffset, pcCU->getWedgeFullDeltaDC1(), sizeof( Int ) * uiNumPartition ); |
---|
1237 | memcpy( m_piWedgeFullDeltaDC2 + uiOffset, pcCU->getWedgeFullDeltaDC2(), sizeof( Int ) * uiNumPartition ); |
---|
1238 | |
---|
1239 | memcpy( m_puiWedgePredDirTabIdx + uiOffset, pcCU->getWedgePredDirTabIdx(), sizeof( UInt ) * uiNumPartition ); |
---|
1240 | memcpy( m_piWedgePredDirDeltaDC1 + uiOffset, pcCU->getWedgePredDirDeltaDC1(), sizeof( Int ) * uiNumPartition ); |
---|
1241 | memcpy( m_piWedgePredDirDeltaDC2 + uiOffset, pcCU->getWedgePredDirDeltaDC2(), sizeof( Int ) * uiNumPartition ); |
---|
1242 | memcpy( m_piWedgePredDirDeltaEnd + uiOffset, pcCU->getWedgePredDirDeltaEnd(), sizeof( Int ) * uiNumPartition ); |
---|
1243 | #endif |
---|
1244 | #if HHI_DMM_PRED_TEX |
---|
1245 | memcpy( m_puiWedgePredTexTabIdx + uiOffset, pcCU->getWedgePredTexTabIdx(), sizeof( UInt ) * uiNumPartition ); |
---|
1246 | memcpy( m_piWedgePredTexDeltaDC1 + uiOffset, pcCU->getWedgePredTexDeltaDC1(), sizeof( Int ) * uiNumPartition ); |
---|
1247 | memcpy( m_piWedgePredTexDeltaDC2 + uiOffset, pcCU->getWedgePredTexDeltaDC2(), sizeof( Int ) * uiNumPartition ); |
---|
1248 | |
---|
1249 | memcpy( m_piContourPredTexDeltaDC1 + uiOffset, pcCU->getContourPredTexDeltaDC1(), sizeof( Int ) * uiNumPartition ); |
---|
1250 | memcpy( m_piContourPredTexDeltaDC2 + uiOffset, pcCU->getContourPredTexDeltaDC2(), sizeof( Int ) * uiNumPartition ); |
---|
1251 | #endif |
---|
1252 | #if HHI_MPI |
---|
1253 | memcpy( m_piTextureModeDepth + uiOffset, pcCU->getTextureModeDepth(), sizeof( Int ) * uiNumPartition ); |
---|
1254 | #endif |
---|
1255 | } |
---|
1256 | |
---|
1257 | // Copy current predicted part to a CU in picture. |
---|
1258 | // It is used to predict for next part |
---|
1259 | Void TComDataCU::copyToPic( UChar uhDepth ) |
---|
1260 | { |
---|
1261 | TComDataCU*& rpcCU = m_pcPic->getCU( m_uiCUAddr ); |
---|
1262 | |
---|
1263 | rpcCU->getTotalCost() = m_dTotalCost; |
---|
1264 | rpcCU->getTotalDistortion() = m_uiTotalDistortion; |
---|
1265 | rpcCU->getTotalBits() = m_uiTotalBits; |
---|
1266 | |
---|
1267 | Int iSizeInUchar = sizeof( UChar ) * m_uiNumPartition; |
---|
1268 | Int iSizeInBool = sizeof( Bool ) * m_uiNumPartition; |
---|
1269 | |
---|
1270 | #if H0736_AVC_STYLE_QP_RANGE |
---|
1271 | Int sizeInChar = sizeof( Char ) * m_uiNumPartition; |
---|
1272 | memcpy( rpcCU->getQP() + m_uiAbsIdxInLCU, m_phQP, sizeInChar ); |
---|
1273 | #else |
---|
1274 | memcpy( rpcCU->getQP() + m_uiAbsIdxInLCU, m_phQP, iSizeInUchar ); |
---|
1275 | #endif |
---|
1276 | |
---|
1277 | memcpy( rpcCU->getPartitionSize() + m_uiAbsIdxInLCU, m_pePartSize, sizeof( *m_pePartSize ) * m_uiNumPartition ); |
---|
1278 | #if HHI_INTERVIEW_SKIP |
---|
1279 | memcpy( rpcCU->getRenderable() + m_uiAbsIdxInLCU, m_pbRenderable, iSizeInBool ); |
---|
1280 | #endif |
---|
1281 | memcpy( rpcCU->getPredictionMode() + m_uiAbsIdxInLCU, m_pePredMode, sizeof( *m_pePredMode ) * m_uiNumPartition ); |
---|
1282 | |
---|
1283 | memcpy( rpcCU->getAlfCtrlFlag() + m_uiAbsIdxInLCU, m_puiAlfCtrlFlag, iSizeInBool ); |
---|
1284 | |
---|
1285 | memcpy( rpcCU->getMergeFlag() + m_uiAbsIdxInLCU, m_pbMergeFlag, iSizeInBool ); |
---|
1286 | memcpy( rpcCU->getMergeIndex() + m_uiAbsIdxInLCU, m_puhMergeIndex, iSizeInUchar ); |
---|
1287 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
1288 | memcpy( rpcCU->getResPredAvail() + m_uiAbsIdxInLCU, m_pbResPredAvailable, iSizeInBool ); |
---|
1289 | memcpy( rpcCU->getResPredFlag() + m_uiAbsIdxInLCU, m_pbResPredFlag, iSizeInBool ); |
---|
1290 | #endif |
---|
1291 | memcpy( rpcCU->getLumaIntraDir() + m_uiAbsIdxInLCU, m_puhLumaIntraDir, iSizeInUchar ); |
---|
1292 | memcpy( rpcCU->getChromaIntraDir() + m_uiAbsIdxInLCU, m_puhChromaIntraDir, iSizeInUchar ); |
---|
1293 | memcpy( rpcCU->getInterDir() + m_uiAbsIdxInLCU, m_puhInterDir, iSizeInUchar ); |
---|
1294 | memcpy( rpcCU->getTransformIdx() + m_uiAbsIdxInLCU, m_puhTrIdx, iSizeInUchar ); |
---|
1295 | memcpy( rpcCU->getNSQTPartIdx() + m_uiAbsIdxInLCU, m_nsqtPartIdx, iSizeInUchar ); |
---|
1296 | |
---|
1297 | memcpy( rpcCU->getCbf(TEXT_LUMA) + m_uiAbsIdxInLCU, m_puhCbf[0], iSizeInUchar ); |
---|
1298 | memcpy( rpcCU->getCbf(TEXT_CHROMA_U) + m_uiAbsIdxInLCU, m_puhCbf[1], iSizeInUchar ); |
---|
1299 | memcpy( rpcCU->getCbf(TEXT_CHROMA_V) + m_uiAbsIdxInLCU, m_puhCbf[2], iSizeInUchar ); |
---|
1300 | |
---|
1301 | memcpy( rpcCU->getDepth() + m_uiAbsIdxInLCU, m_puhDepth, iSizeInUchar ); |
---|
1302 | memcpy( rpcCU->getWidth() + m_uiAbsIdxInLCU, m_puhWidth, iSizeInUchar ); |
---|
1303 | memcpy( rpcCU->getHeight() + m_uiAbsIdxInLCU, m_puhHeight, iSizeInUchar ); |
---|
1304 | |
---|
1305 | memcpy( rpcCU->getMVPIdx(REF_PIC_LIST_0) + m_uiAbsIdxInLCU, m_apiMVPIdx[0], iSizeInUchar ); |
---|
1306 | memcpy( rpcCU->getMVPIdx(REF_PIC_LIST_1) + m_uiAbsIdxInLCU, m_apiMVPIdx[1], iSizeInUchar ); |
---|
1307 | memcpy( rpcCU->getMVPNum(REF_PIC_LIST_0) + m_uiAbsIdxInLCU, m_apiMVPNum[0], iSizeInUchar ); |
---|
1308 | memcpy( rpcCU->getMVPNum(REF_PIC_LIST_1) + m_uiAbsIdxInLCU, m_apiMVPNum[1], iSizeInUchar ); |
---|
1309 | |
---|
1310 | m_acCUMvField[0].copyTo( rpcCU->getCUMvField( REF_PIC_LIST_0 ), m_uiAbsIdxInLCU ); |
---|
1311 | m_acCUMvField[1].copyTo( rpcCU->getCUMvField( REF_PIC_LIST_1 ), m_uiAbsIdxInLCU ); |
---|
1312 | |
---|
1313 | memcpy( rpcCU->getIPCMFlag() + m_uiAbsIdxInLCU, m_pbIPCMFlag, iSizeInBool ); |
---|
1314 | |
---|
1315 | UInt uiTmp = (g_uiMaxCUWidth*g_uiMaxCUHeight)>>(uhDepth<<1); |
---|
1316 | UInt uiTmp2 = m_uiAbsIdxInLCU*m_pcPic->getMinCUWidth()*m_pcPic->getMinCUHeight(); |
---|
1317 | memcpy( rpcCU->getCoeffY() + uiTmp2, m_pcTrCoeffY, sizeof(TCoeff)*uiTmp ); |
---|
1318 | #if ADAPTIVE_QP_SELECTION |
---|
1319 | memcpy( rpcCU->getArlCoeffY() + uiTmp2, m_pcArlCoeffY, sizeof(Int)*uiTmp ); |
---|
1320 | #endif |
---|
1321 | memcpy( rpcCU->getPCMSampleY() + uiTmp2 , m_pcIPCMSampleY, sizeof(Pel)*uiTmp ); |
---|
1322 | |
---|
1323 | uiTmp >>= 2; uiTmp2 >>= 2; |
---|
1324 | memcpy( rpcCU->getCoeffCb() + uiTmp2, m_pcTrCoeffCb, sizeof(TCoeff)*uiTmp ); |
---|
1325 | memcpy( rpcCU->getCoeffCr() + uiTmp2, m_pcTrCoeffCr, sizeof(TCoeff)*uiTmp ); |
---|
1326 | #if ADAPTIVE_QP_SELECTION |
---|
1327 | memcpy( rpcCU->getArlCoeffCb() + uiTmp2, m_pcArlCoeffCb, sizeof(Int)*uiTmp ); |
---|
1328 | memcpy( rpcCU->getArlCoeffCr() + uiTmp2, m_pcArlCoeffCr, sizeof(Int)*uiTmp ); |
---|
1329 | #endif |
---|
1330 | memcpy( rpcCU->getPCMSampleCb() + uiTmp2 , m_pcIPCMSampleCb, sizeof( Pel ) * uiTmp ); |
---|
1331 | memcpy( rpcCU->getPCMSampleCr() + uiTmp2 , m_pcIPCMSampleCr, sizeof( Pel ) * uiTmp ); |
---|
1332 | rpcCU->getTotalBins() = m_uiTotalBins; |
---|
1333 | memcpy( rpcCU->m_uiSliceStartCU + m_uiAbsIdxInLCU, m_uiSliceStartCU, sizeof( UInt ) * m_uiNumPartition ); |
---|
1334 | memcpy( rpcCU->m_uiEntropySliceStartCU + m_uiAbsIdxInLCU, m_uiEntropySliceStartCU, sizeof( UInt ) * m_uiNumPartition ); |
---|
1335 | |
---|
1336 | #if HHI_DMM_WEDGE_INTRA |
---|
1337 | memcpy( rpcCU->getWedgeFullTabIdx() + m_uiAbsIdxInLCU, m_puiWedgeFullTabIdx, sizeof( UInt ) * m_uiNumPartition ); |
---|
1338 | memcpy( rpcCU->getWedgeFullDeltaDC1() + m_uiAbsIdxInLCU, m_piWedgeFullDeltaDC1, sizeof( Int ) * m_uiNumPartition ); |
---|
1339 | memcpy( rpcCU->getWedgeFullDeltaDC2() + m_uiAbsIdxInLCU, m_piWedgeFullDeltaDC2, sizeof( Int ) * m_uiNumPartition ); |
---|
1340 | |
---|
1341 | memcpy( rpcCU->getWedgePredDirTabIdx() + m_uiAbsIdxInLCU, m_puiWedgePredDirTabIdx, sizeof( UInt ) * m_uiNumPartition ); |
---|
1342 | memcpy( rpcCU->getWedgePredDirDeltaDC1() + m_uiAbsIdxInLCU, m_piWedgePredDirDeltaDC1, sizeof( Int ) * m_uiNumPartition ); |
---|
1343 | memcpy( rpcCU->getWedgePredDirDeltaDC2() + m_uiAbsIdxInLCU, m_piWedgePredDirDeltaDC2, sizeof( Int ) * m_uiNumPartition ); |
---|
1344 | memcpy( rpcCU->getWedgePredDirDeltaEnd() + m_uiAbsIdxInLCU, m_piWedgePredDirDeltaEnd, sizeof( Int ) * m_uiNumPartition ); |
---|
1345 | #endif |
---|
1346 | #if HHI_DMM_PRED_TEX |
---|
1347 | memcpy( rpcCU->getWedgePredTexTabIdx() + m_uiAbsIdxInLCU, m_puiWedgePredTexTabIdx, sizeof( UInt ) * m_uiNumPartition ); |
---|
1348 | memcpy( rpcCU->getWedgePredTexDeltaDC1() + m_uiAbsIdxInLCU, m_piWedgePredTexDeltaDC1, sizeof( Int ) * m_uiNumPartition ); |
---|
1349 | memcpy( rpcCU->getWedgePredTexDeltaDC2() + m_uiAbsIdxInLCU, m_piWedgePredTexDeltaDC2, sizeof( Int ) * m_uiNumPartition ); |
---|
1350 | |
---|
1351 | memcpy( rpcCU->getContourPredTexDeltaDC1() + m_uiAbsIdxInLCU, m_piContourPredTexDeltaDC1, sizeof( Int ) * m_uiNumPartition ); |
---|
1352 | memcpy( rpcCU->getContourPredTexDeltaDC2() + m_uiAbsIdxInLCU, m_piContourPredTexDeltaDC2, sizeof( Int ) * m_uiNumPartition ); |
---|
1353 | #endif |
---|
1354 | #if HHI_MPI |
---|
1355 | memcpy( rpcCU->getTextureModeDepth() + m_uiAbsIdxInLCU, m_piTextureModeDepth, sizeof( Int ) * m_uiNumPartition ); |
---|
1356 | #endif |
---|
1357 | } |
---|
1358 | |
---|
1359 | Void TComDataCU::copyToPic( UChar uhDepth, UInt uiPartIdx, UInt uiPartDepth ) |
---|
1360 | { |
---|
1361 | TComDataCU*& rpcCU = m_pcPic->getCU( m_uiCUAddr ); |
---|
1362 | UInt uiQNumPart = m_uiNumPartition>>(uiPartDepth<<1); |
---|
1363 | |
---|
1364 | UInt uiPartStart = uiPartIdx*uiQNumPart; |
---|
1365 | UInt uiPartOffset = m_uiAbsIdxInLCU + uiPartStart; |
---|
1366 | |
---|
1367 | rpcCU->getTotalCost() = m_dTotalCost; |
---|
1368 | rpcCU->getTotalDistortion() = m_uiTotalDistortion; |
---|
1369 | rpcCU->getTotalBits() = m_uiTotalBits; |
---|
1370 | |
---|
1371 | Int iSizeInUchar = sizeof( UChar ) * uiQNumPart; |
---|
1372 | Int iSizeInBool = sizeof( Bool ) * uiQNumPart; |
---|
1373 | |
---|
1374 | #if H0736_AVC_STYLE_QP_RANGE |
---|
1375 | Int sizeInChar = sizeof( Char ) * uiQNumPart; |
---|
1376 | memcpy( rpcCU->getQP() + uiPartOffset, m_phQP, sizeInChar ); |
---|
1377 | #else |
---|
1378 | memcpy( rpcCU->getQP() + uiPartOffset, m_phQP, iSizeInUchar ); |
---|
1379 | #endif |
---|
1380 | memcpy( rpcCU->getPartitionSize() + uiPartOffset, m_pePartSize, sizeof( *m_pePartSize ) * uiQNumPart ); |
---|
1381 | #if HHI_INTERVIEW_SKIP |
---|
1382 | memcpy( rpcCU->getRenderable() + uiPartOffset, m_pbRenderable, iSizeInBool ); |
---|
1383 | #endif |
---|
1384 | memcpy( rpcCU->getPredictionMode() + uiPartOffset, m_pePredMode, sizeof( *m_pePredMode ) * uiQNumPart ); |
---|
1385 | |
---|
1386 | memcpy( rpcCU->getAlfCtrlFlag() + uiPartOffset, m_puiAlfCtrlFlag, iSizeInBool ); |
---|
1387 | memcpy( rpcCU->getMergeFlag() + uiPartOffset, m_pbMergeFlag, iSizeInBool ); |
---|
1388 | memcpy( rpcCU->getMergeIndex() + uiPartOffset, m_puhMergeIndex, iSizeInUchar ); |
---|
1389 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
1390 | memcpy( rpcCU->getResPredAvail() + uiPartOffset, m_pbResPredAvailable, iSizeInBool ); |
---|
1391 | memcpy( rpcCU->getResPredFlag() + uiPartOffset, m_pbResPredFlag, iSizeInBool ); |
---|
1392 | #endif |
---|
1393 | memcpy( rpcCU->getLumaIntraDir() + uiPartOffset, m_puhLumaIntraDir, iSizeInUchar ); |
---|
1394 | memcpy( rpcCU->getChromaIntraDir() + uiPartOffset, m_puhChromaIntraDir, iSizeInUchar ); |
---|
1395 | memcpy( rpcCU->getInterDir() + uiPartOffset, m_puhInterDir, iSizeInUchar ); |
---|
1396 | memcpy( rpcCU->getTransformIdx() + uiPartOffset, m_puhTrIdx, iSizeInUchar ); |
---|
1397 | memcpy( rpcCU->getNSQTPartIdx() + uiPartOffset, m_nsqtPartIdx, iSizeInUchar ); |
---|
1398 | |
---|
1399 | memcpy( rpcCU->getCbf(TEXT_LUMA) + uiPartOffset, m_puhCbf[0], iSizeInUchar ); |
---|
1400 | memcpy( rpcCU->getCbf(TEXT_CHROMA_U) + uiPartOffset, m_puhCbf[1], iSizeInUchar ); |
---|
1401 | memcpy( rpcCU->getCbf(TEXT_CHROMA_V) + uiPartOffset, m_puhCbf[2], iSizeInUchar ); |
---|
1402 | |
---|
1403 | memcpy( rpcCU->getDepth() + uiPartOffset, m_puhDepth, iSizeInUchar ); |
---|
1404 | memcpy( rpcCU->getWidth() + uiPartOffset, m_puhWidth, iSizeInUchar ); |
---|
1405 | memcpy( rpcCU->getHeight() + uiPartOffset, m_puhHeight, iSizeInUchar ); |
---|
1406 | |
---|
1407 | memcpy( rpcCU->getMVPIdx(REF_PIC_LIST_0) + uiPartOffset, m_apiMVPIdx[0], iSizeInUchar ); |
---|
1408 | memcpy( rpcCU->getMVPIdx(REF_PIC_LIST_1) + uiPartOffset, m_apiMVPIdx[1], iSizeInUchar ); |
---|
1409 | memcpy( rpcCU->getMVPNum(REF_PIC_LIST_0) + uiPartOffset, m_apiMVPNum[0], iSizeInUchar ); |
---|
1410 | memcpy( rpcCU->getMVPNum(REF_PIC_LIST_1) + uiPartOffset, m_apiMVPNum[1], iSizeInUchar ); |
---|
1411 | m_acCUMvField[0].copyTo( rpcCU->getCUMvField( REF_PIC_LIST_0 ), m_uiAbsIdxInLCU, uiPartStart, uiQNumPart ); |
---|
1412 | m_acCUMvField[1].copyTo( rpcCU->getCUMvField( REF_PIC_LIST_1 ), m_uiAbsIdxInLCU, uiPartStart, uiQNumPart ); |
---|
1413 | |
---|
1414 | memcpy( rpcCU->getIPCMFlag() + uiPartOffset, m_pbIPCMFlag, iSizeInBool ); |
---|
1415 | |
---|
1416 | UInt uiTmp = (g_uiMaxCUWidth*g_uiMaxCUHeight)>>((uhDepth+uiPartDepth)<<1); |
---|
1417 | UInt uiTmp2 = uiPartOffset*m_pcPic->getMinCUWidth()*m_pcPic->getMinCUHeight(); |
---|
1418 | memcpy( rpcCU->getCoeffY() + uiTmp2, m_pcTrCoeffY, sizeof(TCoeff)*uiTmp ); |
---|
1419 | #if ADAPTIVE_QP_SELECTION |
---|
1420 | memcpy( rpcCU->getArlCoeffY() + uiTmp2, m_pcArlCoeffY, sizeof(Int)*uiTmp ); |
---|
1421 | #endif |
---|
1422 | |
---|
1423 | memcpy( rpcCU->getPCMSampleY() + uiTmp2 , m_pcIPCMSampleY, sizeof( Pel ) * uiTmp ); |
---|
1424 | |
---|
1425 | uiTmp >>= 2; uiTmp2 >>= 2; |
---|
1426 | memcpy( rpcCU->getCoeffCb() + uiTmp2, m_pcTrCoeffCb, sizeof(TCoeff)*uiTmp ); |
---|
1427 | memcpy( rpcCU->getCoeffCr() + uiTmp2, m_pcTrCoeffCr, sizeof(TCoeff)*uiTmp ); |
---|
1428 | #if ADAPTIVE_QP_SELECTION |
---|
1429 | memcpy( rpcCU->getArlCoeffCb() + uiTmp2, m_pcArlCoeffCb, sizeof(Int)*uiTmp ); |
---|
1430 | memcpy( rpcCU->getArlCoeffCr() + uiTmp2, m_pcArlCoeffCr, sizeof(Int)*uiTmp ); |
---|
1431 | #endif |
---|
1432 | |
---|
1433 | memcpy( rpcCU->getPCMSampleCb() + uiTmp2 , m_pcIPCMSampleCb, sizeof( Pel ) * uiTmp ); |
---|
1434 | memcpy( rpcCU->getPCMSampleCr() + uiTmp2 , m_pcIPCMSampleCr, sizeof( Pel ) * uiTmp ); |
---|
1435 | rpcCU->getTotalBins() = m_uiTotalBins; |
---|
1436 | memcpy( rpcCU->m_uiSliceStartCU + uiPartOffset, m_uiSliceStartCU, sizeof( UInt ) * uiQNumPart ); |
---|
1437 | memcpy( rpcCU->m_uiEntropySliceStartCU + uiPartOffset, m_uiEntropySliceStartCU, sizeof( UInt ) * uiQNumPart ); |
---|
1438 | |
---|
1439 | #if HHI_DMM_WEDGE_INTRA |
---|
1440 | memcpy( rpcCU->getWedgeFullTabIdx() + uiPartOffset, m_puiWedgeFullTabIdx, sizeof( UInt ) * uiQNumPart ); |
---|
1441 | memcpy( rpcCU->getWedgeFullDeltaDC1() + uiPartOffset, m_piWedgeFullDeltaDC1, sizeof( Int ) * uiQNumPart ); |
---|
1442 | memcpy( rpcCU->getWedgeFullDeltaDC2() + uiPartOffset, m_piWedgeFullDeltaDC2, sizeof( Int ) * uiQNumPart ); |
---|
1443 | |
---|
1444 | memcpy( rpcCU->getWedgePredDirTabIdx() + uiPartOffset, m_puiWedgePredDirTabIdx, sizeof( UInt ) * uiQNumPart ); |
---|
1445 | memcpy( rpcCU->getWedgePredDirDeltaDC1() + uiPartOffset, m_piWedgePredDirDeltaDC1, sizeof( Int ) * uiQNumPart ); |
---|
1446 | memcpy( rpcCU->getWedgePredDirDeltaDC2() + uiPartOffset, m_piWedgePredDirDeltaDC2, sizeof( Int ) * uiQNumPart ); |
---|
1447 | memcpy( rpcCU->getWedgePredDirDeltaEnd() + uiPartOffset, m_piWedgePredDirDeltaEnd, sizeof( Int ) * uiQNumPart ); |
---|
1448 | #endif |
---|
1449 | #if HHI_DMM_PRED_TEX |
---|
1450 | memcpy( rpcCU->getWedgePredTexTabIdx() + uiPartOffset, m_puiWedgePredTexTabIdx, sizeof( UInt ) * uiQNumPart ); |
---|
1451 | memcpy( rpcCU->getWedgePredTexDeltaDC1() + uiPartOffset, m_piWedgePredTexDeltaDC1, sizeof( Int ) * uiQNumPart ); |
---|
1452 | memcpy( rpcCU->getWedgePredTexDeltaDC2() + uiPartOffset, m_piWedgePredTexDeltaDC2, sizeof( Int ) * uiQNumPart ); |
---|
1453 | |
---|
1454 | memcpy( rpcCU->getContourPredTexDeltaDC1() + uiPartOffset, m_piContourPredTexDeltaDC1, sizeof( Int ) * uiQNumPart ); |
---|
1455 | memcpy( rpcCU->getContourPredTexDeltaDC2() + uiPartOffset, m_piContourPredTexDeltaDC2, sizeof( Int ) * uiQNumPart ); |
---|
1456 | #endif |
---|
1457 | #if HHI_MPI |
---|
1458 | memcpy( rpcCU->getTextureModeDepth() + uiPartOffset, m_piTextureModeDepth, sizeof( Int ) * uiQNumPart ); |
---|
1459 | #endif |
---|
1460 | } |
---|
1461 | |
---|
1462 | // -------------------------------------------------------------------------------------------------------------------- |
---|
1463 | // Other public functions |
---|
1464 | // -------------------------------------------------------------------------------------------------------------------- |
---|
1465 | |
---|
1466 | TComDataCU* TComDataCU::getPULeft( UInt& uiLPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction, Bool bEnforceEntropySliceRestriction |
---|
1467 | , Bool bEnforceTileRestriction |
---|
1468 | ) |
---|
1469 | { |
---|
1470 | UInt uiAbsPartIdx = g_auiZscanToRaster[uiCurrPartUnitIdx]; |
---|
1471 | UInt uiAbsZorderCUIdx = g_auiZscanToRaster[m_uiAbsIdxInLCU]; |
---|
1472 | UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); |
---|
1473 | |
---|
1474 | if ( !RasterAddress::isZeroCol( uiAbsPartIdx, uiNumPartInCUWidth ) ) |
---|
1475 | { |
---|
1476 | uiLPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdx - 1 ]; |
---|
1477 | if ( RasterAddress::isEqualCol( uiAbsPartIdx, uiAbsZorderCUIdx, uiNumPartInCUWidth ) ) |
---|
1478 | { |
---|
1479 | TComDataCU* pcTempReconCU = m_pcPic->getCU( getAddr() ); |
---|
1480 | if ((bEnforceSliceRestriction && (pcTempReconCU==NULL || pcTempReconCU->getSlice() == NULL || pcTempReconCU->getSCUAddr()+uiLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU (uiCurrPartUnitIdx))) |
---|
1481 | ||(bEnforceEntropySliceRestriction && (pcTempReconCU==NULL || pcTempReconCU->getSlice() == NULL || pcTempReconCU->getSCUAddr()+uiLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)))) |
---|
1482 | { |
---|
1483 | return NULL; |
---|
1484 | } |
---|
1485 | return m_pcPic->getCU( getAddr() ); |
---|
1486 | } |
---|
1487 | else |
---|
1488 | { |
---|
1489 | uiLPartUnitIdx -= m_uiAbsIdxInLCU; |
---|
1490 | if ((bEnforceSliceRestriction && (this->getSCUAddr()+uiLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU (uiCurrPartUnitIdx) || m_pcSlice==NULL)) |
---|
1491 | ||(bEnforceEntropySliceRestriction && (this->getSCUAddr()+uiLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx) || m_pcSlice==NULL))) |
---|
1492 | { |
---|
1493 | return NULL; |
---|
1494 | } |
---|
1495 | return this; |
---|
1496 | } |
---|
1497 | } |
---|
1498 | |
---|
1499 | uiLPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdx + uiNumPartInCUWidth - 1 ]; |
---|
1500 | |
---|
1501 | |
---|
1502 | if ( (bEnforceSliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || m_pcCULeft->getSCUAddr()+uiLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx))) |
---|
1503 | || |
---|
1504 | (bEnforceEntropySliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || m_pcCULeft->getSCUAddr()+uiLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx))) |
---|
1505 | || |
---|
1506 | #if !REMOVE_TILE_DEPENDENCE |
---|
1507 | (bEnforceTileRestriction && ( m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) ) ) |
---|
1508 | #else |
---|
1509 | (bEnforceTileRestriction && ( m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) ) ) |
---|
1510 | #endif |
---|
1511 | ) |
---|
1512 | { |
---|
1513 | return NULL; |
---|
1514 | } |
---|
1515 | return m_pcCULeft; |
---|
1516 | } |
---|
1517 | |
---|
1518 | |
---|
1519 | TComDataCU* TComDataCU::getPUAbove( UInt& uiAPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction, Bool bEnforceEntropySliceRestriction, Bool MotionDataCompresssion |
---|
1520 | , Bool planarAtLCUBoundary |
---|
1521 | , Bool bEnforceTileRestriction |
---|
1522 | ) |
---|
1523 | { |
---|
1524 | UInt uiAbsPartIdx = g_auiZscanToRaster[uiCurrPartUnitIdx]; |
---|
1525 | UInt uiAbsZorderCUIdx = g_auiZscanToRaster[m_uiAbsIdxInLCU]; |
---|
1526 | UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); |
---|
1527 | |
---|
1528 | if ( !RasterAddress::isZeroRow( uiAbsPartIdx, uiNumPartInCUWidth ) ) |
---|
1529 | { |
---|
1530 | uiAPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdx - uiNumPartInCUWidth ]; |
---|
1531 | if ( RasterAddress::isEqualRow( uiAbsPartIdx, uiAbsZorderCUIdx, uiNumPartInCUWidth ) ) |
---|
1532 | { |
---|
1533 | TComDataCU* pcTempReconCU = m_pcPic->getCU( getAddr() ); |
---|
1534 | if ((bEnforceSliceRestriction && (pcTempReconCU==NULL || pcTempReconCU->getSlice() == NULL || pcTempReconCU->getSCUAddr()+uiAPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU (uiCurrPartUnitIdx))) |
---|
1535 | ||(bEnforceEntropySliceRestriction && (pcTempReconCU==NULL || pcTempReconCU->getSlice() == NULL || pcTempReconCU->getSCUAddr()+uiAPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)))) |
---|
1536 | { |
---|
1537 | return NULL; |
---|
1538 | } |
---|
1539 | return m_pcPic->getCU( getAddr() ); |
---|
1540 | } |
---|
1541 | else |
---|
1542 | { |
---|
1543 | uiAPartUnitIdx -= m_uiAbsIdxInLCU; |
---|
1544 | if ((bEnforceSliceRestriction && (this->getSCUAddr()+uiAPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU (uiCurrPartUnitIdx) || m_pcSlice==NULL)) |
---|
1545 | ||(bEnforceEntropySliceRestriction && (this->getSCUAddr()+uiAPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx) || m_pcSlice==NULL))) |
---|
1546 | { |
---|
1547 | return NULL; |
---|
1548 | } |
---|
1549 | return this; |
---|
1550 | } |
---|
1551 | } |
---|
1552 | |
---|
1553 | if(planarAtLCUBoundary) |
---|
1554 | { |
---|
1555 | return NULL; |
---|
1556 | } |
---|
1557 | |
---|
1558 | uiAPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdx + m_pcPic->getNumPartInCU() - uiNumPartInCUWidth ]; |
---|
1559 | if(MotionDataCompresssion) |
---|
1560 | { |
---|
1561 | uiAPartUnitIdx = g_motionRefer[uiAPartUnitIdx]; |
---|
1562 | } |
---|
1563 | |
---|
1564 | if ( (bEnforceSliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || m_pcCUAbove->getSCUAddr()+uiAPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx))) |
---|
1565 | || |
---|
1566 | (bEnforceEntropySliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || m_pcCUAbove->getSCUAddr()+uiAPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx))) |
---|
1567 | || |
---|
1568 | #if !REMOVE_TILE_DEPENDENCE |
---|
1569 | (bEnforceTileRestriction &&(m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())))) |
---|
1570 | #else |
---|
1571 | (bEnforceTileRestriction &&(m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())))) |
---|
1572 | #endif |
---|
1573 | ) |
---|
1574 | { |
---|
1575 | return NULL; |
---|
1576 | } |
---|
1577 | return m_pcCUAbove; |
---|
1578 | } |
---|
1579 | |
---|
1580 | TComDataCU* TComDataCU::getPUAboveLeft( UInt& uiALPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction, Bool bEnforceEntropySliceRestriction, Bool MotionDataCompresssion ) |
---|
1581 | { |
---|
1582 | UInt uiAbsPartIdx = g_auiZscanToRaster[uiCurrPartUnitIdx]; |
---|
1583 | UInt uiAbsZorderCUIdx = g_auiZscanToRaster[m_uiAbsIdxInLCU]; |
---|
1584 | UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); |
---|
1585 | |
---|
1586 | if ( !RasterAddress::isZeroCol( uiAbsPartIdx, uiNumPartInCUWidth ) ) |
---|
1587 | { |
---|
1588 | if ( !RasterAddress::isZeroRow( uiAbsPartIdx, uiNumPartInCUWidth ) ) |
---|
1589 | { |
---|
1590 | uiALPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdx - uiNumPartInCUWidth - 1 ]; |
---|
1591 | if ( RasterAddress::isEqualRowOrCol( uiAbsPartIdx, uiAbsZorderCUIdx, uiNumPartInCUWidth ) ) |
---|
1592 | { |
---|
1593 | TComDataCU* pcTempReconCU = m_pcPic->getCU( getAddr() ); |
---|
1594 | if ((bEnforceSliceRestriction && (pcTempReconCU==NULL || pcTempReconCU->getSlice() == NULL || pcTempReconCU->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU (uiCurrPartUnitIdx))) |
---|
1595 | ||(bEnforceEntropySliceRestriction && (pcTempReconCU==NULL || pcTempReconCU->getSlice() == NULL || pcTempReconCU->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)))) |
---|
1596 | { |
---|
1597 | return NULL; |
---|
1598 | } |
---|
1599 | return m_pcPic->getCU( getAddr() ); |
---|
1600 | } |
---|
1601 | else |
---|
1602 | { |
---|
1603 | uiALPartUnitIdx -= m_uiAbsIdxInLCU; |
---|
1604 | if ((bEnforceSliceRestriction && (this->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU (uiCurrPartUnitIdx) || m_pcSlice==NULL)) |
---|
1605 | ||(bEnforceEntropySliceRestriction && (this->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx) || m_pcSlice==NULL))) |
---|
1606 | { |
---|
1607 | return NULL; |
---|
1608 | } |
---|
1609 | return this; |
---|
1610 | } |
---|
1611 | } |
---|
1612 | uiALPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdx + getPic()->getNumPartInCU() - uiNumPartInCUWidth - 1 ]; |
---|
1613 | if(MotionDataCompresssion) |
---|
1614 | { |
---|
1615 | uiALPartUnitIdx = g_motionRefer[uiALPartUnitIdx]; |
---|
1616 | } |
---|
1617 | if ( (bEnforceSliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || |
---|
1618 | m_pcCUAbove->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)|| |
---|
1619 | #if !REMOVE_TILE_DEPENDENCE |
---|
1620 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
1621 | #else |
---|
1622 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
1623 | #endif |
---|
1624 | ))|| |
---|
1625 | (bEnforceEntropySliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || |
---|
1626 | m_pcCUAbove->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)|| |
---|
1627 | #if !REMOVE_TILE_DEPENDENCE |
---|
1628 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
1629 | #else |
---|
1630 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
1631 | #endif |
---|
1632 | )) |
---|
1633 | ) |
---|
1634 | { |
---|
1635 | return NULL; |
---|
1636 | } |
---|
1637 | return m_pcCUAbove; |
---|
1638 | } |
---|
1639 | |
---|
1640 | if ( !RasterAddress::isZeroRow( uiAbsPartIdx, uiNumPartInCUWidth ) ) |
---|
1641 | { |
---|
1642 | uiALPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdx - 1 ]; |
---|
1643 | if ( (bEnforceSliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || |
---|
1644 | m_pcCULeft->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)|| |
---|
1645 | #if !REMOVE_TILE_DEPENDENCE |
---|
1646 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
1647 | #else |
---|
1648 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
1649 | #endif |
---|
1650 | ))|| |
---|
1651 | (bEnforceEntropySliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || |
---|
1652 | m_pcCULeft->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)|| |
---|
1653 | #if !REMOVE_TILE_DEPENDENCE |
---|
1654 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
1655 | #else |
---|
1656 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
1657 | #endif |
---|
1658 | )) |
---|
1659 | ) |
---|
1660 | { |
---|
1661 | return NULL; |
---|
1662 | } |
---|
1663 | return m_pcCULeft; |
---|
1664 | } |
---|
1665 | |
---|
1666 | uiALPartUnitIdx = g_auiRasterToZscan[ m_pcPic->getNumPartInCU() - 1 ]; |
---|
1667 | if(MotionDataCompresssion) |
---|
1668 | { |
---|
1669 | uiALPartUnitIdx = g_motionRefer[uiALPartUnitIdx]; |
---|
1670 | } |
---|
1671 | if ( (bEnforceSliceRestriction && (m_pcCUAboveLeft==NULL || m_pcCUAboveLeft->getSlice()==NULL || |
---|
1672 | m_pcCUAboveLeft->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)|| |
---|
1673 | #if !REMOVE_TILE_DEPENDENCE |
---|
1674 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveLeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
1675 | #else |
---|
1676 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveLeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
1677 | #endif |
---|
1678 | ))|| |
---|
1679 | (bEnforceEntropySliceRestriction && (m_pcCUAboveLeft==NULL || m_pcCUAboveLeft->getSlice()==NULL || |
---|
1680 | m_pcCUAboveLeft->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)|| |
---|
1681 | #if !REMOVE_TILE_DEPENDENCE |
---|
1682 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveLeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
1683 | #else |
---|
1684 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveLeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
1685 | #endif |
---|
1686 | )) |
---|
1687 | ) |
---|
1688 | { |
---|
1689 | return NULL; |
---|
1690 | } |
---|
1691 | return m_pcCUAboveLeft; |
---|
1692 | } |
---|
1693 | |
---|
1694 | TComDataCU* TComDataCU::getPUAboveRight( UInt& uiARPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction, Bool bEnforceEntropySliceRestriction, Bool MotionDataCompresssion ) |
---|
1695 | { |
---|
1696 | UInt uiAbsPartIdxRT = g_auiZscanToRaster[uiCurrPartUnitIdx]; |
---|
1697 | UInt uiAbsZorderCUIdx = g_auiZscanToRaster[ m_uiAbsIdxInLCU ] + m_puhWidth[0] / m_pcPic->getMinCUWidth() - 1; |
---|
1698 | UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); |
---|
1699 | |
---|
1700 | if( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxRT] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) |
---|
1701 | { |
---|
1702 | uiARPartUnitIdx = MAX_UINT; |
---|
1703 | return NULL; |
---|
1704 | } |
---|
1705 | |
---|
1706 | if ( RasterAddress::lessThanCol( uiAbsPartIdxRT, uiNumPartInCUWidth - 1, uiNumPartInCUWidth ) ) |
---|
1707 | { |
---|
1708 | if ( !RasterAddress::isZeroRow( uiAbsPartIdxRT, uiNumPartInCUWidth ) ) |
---|
1709 | { |
---|
1710 | if ( uiCurrPartUnitIdx > g_auiRasterToZscan[ uiAbsPartIdxRT - uiNumPartInCUWidth + 1 ] ) |
---|
1711 | { |
---|
1712 | uiARPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdxRT - uiNumPartInCUWidth + 1 ]; |
---|
1713 | if ( RasterAddress::isEqualRowOrCol( uiAbsPartIdxRT, uiAbsZorderCUIdx, uiNumPartInCUWidth ) ) |
---|
1714 | { |
---|
1715 | TComDataCU* pcTempReconCU = m_pcPic->getCU( getAddr() ); |
---|
1716 | if ((bEnforceSliceRestriction && (pcTempReconCU==NULL || pcTempReconCU->getSlice() == NULL || pcTempReconCU->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU (uiCurrPartUnitIdx))) |
---|
1717 | ||(bEnforceEntropySliceRestriction && (pcTempReconCU==NULL || pcTempReconCU->getSlice() == NULL || pcTempReconCU->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)))) |
---|
1718 | { |
---|
1719 | return NULL; |
---|
1720 | } |
---|
1721 | return m_pcPic->getCU( getAddr() ); |
---|
1722 | } |
---|
1723 | else |
---|
1724 | { |
---|
1725 | uiARPartUnitIdx -= m_uiAbsIdxInLCU; |
---|
1726 | if ((bEnforceSliceRestriction && (this->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU (uiCurrPartUnitIdx) || m_pcSlice==NULL)) |
---|
1727 | ||(bEnforceEntropySliceRestriction && (this->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx) || m_pcSlice==NULL))) |
---|
1728 | { |
---|
1729 | return NULL; |
---|
1730 | } |
---|
1731 | return this; |
---|
1732 | } |
---|
1733 | } |
---|
1734 | uiARPartUnitIdx = MAX_UINT; |
---|
1735 | return NULL; |
---|
1736 | } |
---|
1737 | uiARPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdxRT + m_pcPic->getNumPartInCU() - uiNumPartInCUWidth + 1 ]; |
---|
1738 | if(MotionDataCompresssion) |
---|
1739 | { |
---|
1740 | uiARPartUnitIdx = g_motionRefer[uiARPartUnitIdx]; |
---|
1741 | } |
---|
1742 | |
---|
1743 | if ( (bEnforceSliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || |
---|
1744 | m_pcCUAbove->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)|| |
---|
1745 | #if !REMOVE_TILE_DEPENDENCE |
---|
1746 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
1747 | #else |
---|
1748 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
1749 | #endif |
---|
1750 | ))|| |
---|
1751 | (bEnforceEntropySliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || |
---|
1752 | m_pcCUAbove->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)|| |
---|
1753 | #if !REMOVE_TILE_DEPENDENCE |
---|
1754 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
1755 | #else |
---|
1756 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
1757 | #endif |
---|
1758 | )) |
---|
1759 | ) |
---|
1760 | { |
---|
1761 | return NULL; |
---|
1762 | } |
---|
1763 | return m_pcCUAbove; |
---|
1764 | } |
---|
1765 | |
---|
1766 | if ( !RasterAddress::isZeroRow( uiAbsPartIdxRT, uiNumPartInCUWidth ) ) |
---|
1767 | { |
---|
1768 | uiARPartUnitIdx = MAX_UINT; |
---|
1769 | return NULL; |
---|
1770 | } |
---|
1771 | |
---|
1772 | uiARPartUnitIdx = g_auiRasterToZscan[ m_pcPic->getNumPartInCU() - uiNumPartInCUWidth ]; |
---|
1773 | if(MotionDataCompresssion) |
---|
1774 | { |
---|
1775 | uiARPartUnitIdx = g_motionRefer[uiARPartUnitIdx]; |
---|
1776 | } |
---|
1777 | if ( (bEnforceSliceRestriction && (m_pcCUAboveRight==NULL || m_pcCUAboveRight->getSlice()==NULL || |
---|
1778 | m_pcPic->getPicSym()->getInverseCUOrderMap( m_pcCUAboveRight->getAddr()) > m_pcPic->getPicSym()->getInverseCUOrderMap( getAddr()) || |
---|
1779 | m_pcCUAboveRight->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)|| |
---|
1780 | #if !REMOVE_TILE_DEPENDENCE |
---|
1781 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
1782 | #else |
---|
1783 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
1784 | #endif |
---|
1785 | ))|| |
---|
1786 | (bEnforceEntropySliceRestriction && (m_pcCUAboveRight==NULL || m_pcCUAboveRight->getSlice()==NULL || |
---|
1787 | m_pcPic->getPicSym()->getInverseCUOrderMap( m_pcCUAboveRight->getAddr()) > m_pcPic->getPicSym()->getInverseCUOrderMap( getAddr()) || |
---|
1788 | m_pcCUAboveRight->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)|| |
---|
1789 | #if !REMOVE_TILE_DEPENDENCE |
---|
1790 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
1791 | #else |
---|
1792 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
1793 | #endif |
---|
1794 | )) |
---|
1795 | ) |
---|
1796 | { |
---|
1797 | return NULL; |
---|
1798 | } |
---|
1799 | return m_pcCUAboveRight; |
---|
1800 | } |
---|
1801 | |
---|
1802 | TComDataCU* TComDataCU::getPUBelowLeft( UInt& uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction, Bool bEnforceEntropySliceRestriction ) |
---|
1803 | { |
---|
1804 | UInt uiAbsPartIdxLB = g_auiZscanToRaster[uiCurrPartUnitIdx]; |
---|
1805 | UInt uiAbsZorderCUIdxLB = g_auiZscanToRaster[ m_uiAbsIdxInLCU ] + (m_puhHeight[0] / m_pcPic->getMinCUHeight() - 1)*m_pcPic->getNumPartInWidth(); |
---|
1806 | UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); |
---|
1807 | |
---|
1808 | if( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxLB] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples() ) |
---|
1809 | { |
---|
1810 | uiBLPartUnitIdx = MAX_UINT; |
---|
1811 | return NULL; |
---|
1812 | } |
---|
1813 | |
---|
1814 | if ( RasterAddress::lessThanRow( uiAbsPartIdxLB, m_pcPic->getNumPartInHeight() - 1, uiNumPartInCUWidth ) ) |
---|
1815 | { |
---|
1816 | if ( !RasterAddress::isZeroCol( uiAbsPartIdxLB, uiNumPartInCUWidth ) ) |
---|
1817 | { |
---|
1818 | if ( uiCurrPartUnitIdx > g_auiRasterToZscan[ uiAbsPartIdxLB + uiNumPartInCUWidth - 1 ] ) |
---|
1819 | { |
---|
1820 | uiBLPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdxLB + uiNumPartInCUWidth - 1 ]; |
---|
1821 | if ( RasterAddress::isEqualRowOrCol( uiAbsPartIdxLB, uiAbsZorderCUIdxLB, uiNumPartInCUWidth ) ) |
---|
1822 | { |
---|
1823 | TComDataCU* pcTempReconCU = m_pcPic->getCU( getAddr() ); |
---|
1824 | if ((bEnforceSliceRestriction && (pcTempReconCU==NULL || pcTempReconCU->getSlice() == NULL || pcTempReconCU->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU (uiCurrPartUnitIdx))) |
---|
1825 | ||(bEnforceEntropySliceRestriction && (pcTempReconCU==NULL || pcTempReconCU->getSlice() == NULL || pcTempReconCU->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)))) |
---|
1826 | { |
---|
1827 | return NULL; |
---|
1828 | } |
---|
1829 | return m_pcPic->getCU( getAddr() ); |
---|
1830 | } |
---|
1831 | else |
---|
1832 | { |
---|
1833 | uiBLPartUnitIdx -= m_uiAbsIdxInLCU; |
---|
1834 | if ((bEnforceSliceRestriction && (this->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU (uiCurrPartUnitIdx) || m_pcSlice==NULL)) |
---|
1835 | ||(bEnforceEntropySliceRestriction && (this->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx) || m_pcSlice==NULL))) |
---|
1836 | { |
---|
1837 | return NULL; |
---|
1838 | } |
---|
1839 | return this; |
---|
1840 | } |
---|
1841 | } |
---|
1842 | uiBLPartUnitIdx = MAX_UINT; |
---|
1843 | return NULL; |
---|
1844 | } |
---|
1845 | uiBLPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdxLB + uiNumPartInCUWidth*2 - 1 ]; |
---|
1846 | if ( (bEnforceSliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || |
---|
1847 | m_pcCULeft->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)|| |
---|
1848 | #if !REMOVE_TILE_DEPENDENCE |
---|
1849 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
1850 | #else |
---|
1851 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
1852 | #endif |
---|
1853 | ))|| |
---|
1854 | (bEnforceEntropySliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || |
---|
1855 | m_pcCULeft->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)|| |
---|
1856 | #if !REMOVE_TILE_DEPENDENCE |
---|
1857 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
1858 | #else |
---|
1859 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
1860 | #endif |
---|
1861 | )) |
---|
1862 | ) |
---|
1863 | { |
---|
1864 | return NULL; |
---|
1865 | } |
---|
1866 | return m_pcCULeft; |
---|
1867 | } |
---|
1868 | |
---|
1869 | uiBLPartUnitIdx = MAX_UINT; |
---|
1870 | return NULL; |
---|
1871 | } |
---|
1872 | |
---|
1873 | TComDataCU* TComDataCU::getPUBelowLeftAdi(UInt& uiBLPartUnitIdx, UInt uiPuHeight, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset, Bool bEnforceSliceRestriction, Bool bEnforceEntropySliceRestriction ) |
---|
1874 | { |
---|
1875 | UInt uiAbsPartIdxLB = g_auiZscanToRaster[uiCurrPartUnitIdx]; |
---|
1876 | UInt uiAbsZorderCUIdxLB = g_auiZscanToRaster[ m_uiAbsIdxInLCU ] + ((m_puhHeight[0] / m_pcPic->getMinCUHeight()) - 1)*m_pcPic->getNumPartInWidth(); |
---|
1877 | UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); |
---|
1878 | |
---|
1879 | if( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxLB] + (m_pcPic->getPicSym()->getMinCUHeight() * uiPartUnitOffset)) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples()) |
---|
1880 | { |
---|
1881 | uiBLPartUnitIdx = MAX_UINT; |
---|
1882 | return NULL; |
---|
1883 | } |
---|
1884 | |
---|
1885 | if ( RasterAddress::lessThanRow( uiAbsPartIdxLB, m_pcPic->getNumPartInHeight() - uiPartUnitOffset, uiNumPartInCUWidth ) ) |
---|
1886 | { |
---|
1887 | if ( !RasterAddress::isZeroCol( uiAbsPartIdxLB, uiNumPartInCUWidth ) ) |
---|
1888 | { |
---|
1889 | if ( uiCurrPartUnitIdx > g_auiRasterToZscan[ uiAbsPartIdxLB + uiPartUnitOffset * uiNumPartInCUWidth - 1 ] ) |
---|
1890 | { |
---|
1891 | uiBLPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdxLB + uiPartUnitOffset * uiNumPartInCUWidth - 1 ]; |
---|
1892 | if ( RasterAddress::isEqualRowOrCol( uiAbsPartIdxLB, uiAbsZorderCUIdxLB, uiNumPartInCUWidth ) ) |
---|
1893 | { |
---|
1894 | TComDataCU* pcTempReconCU = m_pcPic->getCU( getAddr() ); |
---|
1895 | if ((bEnforceSliceRestriction && (pcTempReconCU==NULL || pcTempReconCU->getSlice() == NULL || pcTempReconCU->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU (uiCurrPartUnitIdx))) |
---|
1896 | ||(bEnforceEntropySliceRestriction && (pcTempReconCU==NULL || pcTempReconCU->getSlice() == NULL || pcTempReconCU->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)))) |
---|
1897 | { |
---|
1898 | return NULL; |
---|
1899 | } |
---|
1900 | return m_pcPic->getCU( getAddr() ); |
---|
1901 | } |
---|
1902 | else |
---|
1903 | { |
---|
1904 | uiBLPartUnitIdx -= m_uiAbsIdxInLCU; |
---|
1905 | if ((bEnforceSliceRestriction && (this->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU (uiCurrPartUnitIdx) || m_pcSlice==NULL)) |
---|
1906 | ||(bEnforceEntropySliceRestriction && (this->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx) || m_pcSlice==NULL))) |
---|
1907 | { |
---|
1908 | return NULL; |
---|
1909 | } |
---|
1910 | return this; |
---|
1911 | } |
---|
1912 | } |
---|
1913 | uiBLPartUnitIdx = MAX_UINT; |
---|
1914 | return NULL; |
---|
1915 | } |
---|
1916 | uiBLPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdxLB + (1+uiPartUnitOffset) * uiNumPartInCUWidth - 1 ]; |
---|
1917 | if ( (bEnforceSliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || |
---|
1918 | m_pcCULeft->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)|| |
---|
1919 | #if !REMOVE_TILE_DEPENDENCE |
---|
1920 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
1921 | #else |
---|
1922 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
1923 | #endif |
---|
1924 | ))|| |
---|
1925 | (bEnforceEntropySliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || |
---|
1926 | m_pcCULeft->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)|| |
---|
1927 | #if !REMOVE_TILE_DEPENDENCE |
---|
1928 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
1929 | #else |
---|
1930 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
1931 | #endif |
---|
1932 | )) |
---|
1933 | ) |
---|
1934 | { |
---|
1935 | return NULL; |
---|
1936 | } |
---|
1937 | return m_pcCULeft; |
---|
1938 | } |
---|
1939 | |
---|
1940 | uiBLPartUnitIdx = MAX_UINT; |
---|
1941 | return NULL; |
---|
1942 | } |
---|
1943 | |
---|
1944 | TComDataCU* TComDataCU::getPUAboveRightAdi(UInt& uiARPartUnitIdx, UInt uiPuWidth, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset, Bool bEnforceSliceRestriction, Bool bEnforceEntropySliceRestriction ) |
---|
1945 | { |
---|
1946 | UInt uiAbsPartIdxRT = g_auiZscanToRaster[uiCurrPartUnitIdx]; |
---|
1947 | UInt uiAbsZorderCUIdx = g_auiZscanToRaster[ m_uiAbsIdxInLCU ] + (m_puhWidth[0] / m_pcPic->getMinCUWidth()) - 1; |
---|
1948 | UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); |
---|
1949 | |
---|
1950 | if( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxRT] + (m_pcPic->getPicSym()->getMinCUHeight() * uiPartUnitOffset)) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) |
---|
1951 | { |
---|
1952 | uiARPartUnitIdx = MAX_UINT; |
---|
1953 | return NULL; |
---|
1954 | } |
---|
1955 | |
---|
1956 | if ( RasterAddress::lessThanCol( uiAbsPartIdxRT, uiNumPartInCUWidth - uiPartUnitOffset, uiNumPartInCUWidth ) ) |
---|
1957 | { |
---|
1958 | if ( !RasterAddress::isZeroRow( uiAbsPartIdxRT, uiNumPartInCUWidth ) ) |
---|
1959 | { |
---|
1960 | if ( uiCurrPartUnitIdx > g_auiRasterToZscan[ uiAbsPartIdxRT - uiNumPartInCUWidth + uiPartUnitOffset ] ) |
---|
1961 | { |
---|
1962 | uiARPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdxRT - uiNumPartInCUWidth + uiPartUnitOffset ]; |
---|
1963 | if ( RasterAddress::isEqualRowOrCol( uiAbsPartIdxRT, uiAbsZorderCUIdx, uiNumPartInCUWidth ) ) |
---|
1964 | { |
---|
1965 | TComDataCU* pcTempReconCU = m_pcPic->getCU( getAddr() ); |
---|
1966 | if ((bEnforceSliceRestriction && (pcTempReconCU==NULL || pcTempReconCU->getSlice() == NULL || pcTempReconCU->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx))) |
---|
1967 | ||( bEnforceEntropySliceRestriction && (pcTempReconCU==NULL || pcTempReconCU->getSlice() == NULL || pcTempReconCU->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)))) |
---|
1968 | |
---|
1969 | { |
---|
1970 | return NULL; |
---|
1971 | } |
---|
1972 | return m_pcPic->getCU( getAddr() ); |
---|
1973 | } |
---|
1974 | else |
---|
1975 | { |
---|
1976 | uiARPartUnitIdx -= m_uiAbsIdxInLCU; |
---|
1977 | if ((bEnforceSliceRestriction && (this->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx) || m_pcSlice==NULL)) |
---|
1978 | ||(bEnforceEntropySliceRestriction && (this->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx) || m_pcSlice==NULL))) |
---|
1979 | { |
---|
1980 | return NULL; |
---|
1981 | } |
---|
1982 | return this; |
---|
1983 | } |
---|
1984 | } |
---|
1985 | uiARPartUnitIdx = MAX_UINT; |
---|
1986 | return NULL; |
---|
1987 | } |
---|
1988 | uiARPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdxRT + m_pcPic->getNumPartInCU() - uiNumPartInCUWidth + uiPartUnitOffset ]; |
---|
1989 | if ( (bEnforceSliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || |
---|
1990 | m_pcCUAbove->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)|| |
---|
1991 | #if !REMOVE_TILE_DEPENDENCE |
---|
1992 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
1993 | #else |
---|
1994 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
1995 | #endif |
---|
1996 | ))|| |
---|
1997 | (bEnforceEntropySliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || |
---|
1998 | m_pcCUAbove->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)|| |
---|
1999 | #if !REMOVE_TILE_DEPENDENCE |
---|
2000 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
2001 | #else |
---|
2002 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
2003 | #endif |
---|
2004 | )) |
---|
2005 | ) |
---|
2006 | { |
---|
2007 | return NULL; |
---|
2008 | } |
---|
2009 | return m_pcCUAbove; |
---|
2010 | } |
---|
2011 | |
---|
2012 | if ( !RasterAddress::isZeroRow( uiAbsPartIdxRT, uiNumPartInCUWidth ) ) |
---|
2013 | { |
---|
2014 | uiARPartUnitIdx = MAX_UINT; |
---|
2015 | return NULL; |
---|
2016 | } |
---|
2017 | |
---|
2018 | uiARPartUnitIdx = g_auiRasterToZscan[ m_pcPic->getNumPartInCU() - uiNumPartInCUWidth + uiPartUnitOffset-1 ]; |
---|
2019 | if ( (bEnforceSliceRestriction && (m_pcCUAboveRight==NULL || m_pcCUAboveRight->getSlice()==NULL || |
---|
2020 | m_pcPic->getPicSym()->getInverseCUOrderMap( m_pcCUAboveRight->getAddr()) > m_pcPic->getPicSym()->getInverseCUOrderMap( getAddr()) || |
---|
2021 | m_pcCUAboveRight->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)|| |
---|
2022 | #if !REMOVE_TILE_DEPENDENCE |
---|
2023 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
2024 | #else |
---|
2025 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
2026 | #endif |
---|
2027 | ))|| |
---|
2028 | (bEnforceEntropySliceRestriction && (m_pcCUAboveRight==NULL || m_pcCUAboveRight->getSlice()==NULL || |
---|
2029 | m_pcPic->getPicSym()->getInverseCUOrderMap( m_pcCUAboveRight->getAddr()) > m_pcPic->getPicSym()->getInverseCUOrderMap( getAddr()) || |
---|
2030 | m_pcCUAboveRight->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)|| |
---|
2031 | #if !REMOVE_TILE_DEPENDENCE |
---|
2032 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
2033 | #else |
---|
2034 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
2035 | #endif |
---|
2036 | )) |
---|
2037 | ) |
---|
2038 | { |
---|
2039 | return NULL; |
---|
2040 | } |
---|
2041 | return m_pcCUAboveRight; |
---|
2042 | } |
---|
2043 | |
---|
2044 | /** Get left QpMinCu |
---|
2045 | *\param uiLPartUnitIdx |
---|
2046 | *\param uiCurrAbsIdxInLCU |
---|
2047 | *\param bEnforceSliceRestriction |
---|
2048 | *\param bEnforceEntropySliceRestriction |
---|
2049 | *\returns TComDataCU* point of TComDataCU of left QpMinCu |
---|
2050 | */ |
---|
2051 | TComDataCU* TComDataCU::getQpMinCuLeft( UInt& uiLPartUnitIdx, UInt uiCurrAbsIdxInLCU, Bool bEnforceSliceRestriction, Bool bEnforceEntropySliceRestriction) |
---|
2052 | { |
---|
2053 | UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); |
---|
2054 | |
---|
2055 | UInt uiAbsRorderQpMinCUIdx = g_auiZscanToRaster[(uiCurrAbsIdxInLCU>>(8-(getSlice()->getPPS()->getMaxCuDQPDepth()<<1)))<<(8-(getSlice()->getPPS()->getMaxCuDQPDepth()<<1))]; |
---|
2056 | UInt uiNumPartInQpMinCUWidth = getSlice()->getPPS()->getMinCuDQPSize()>>2; |
---|
2057 | |
---|
2058 | UInt uiAbsZorderQpMinCUIdx = (uiCurrAbsIdxInLCU>>(8-(getSlice()->getPPS()->getMaxCuDQPDepth()<<1)))<<(8-(getSlice()->getPPS()->getMaxCuDQPDepth()<<1)); |
---|
2059 | if( (uiCurrAbsIdxInLCU != uiAbsZorderQpMinCUIdx) && |
---|
2060 | ((bEnforceSliceRestriction && (m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrAbsIdxInLCU) != m_pcPic->getCU( getAddr() )->getSliceStartCU (uiAbsZorderQpMinCUIdx))) || |
---|
2061 | (bEnforceEntropySliceRestriction &&(m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrAbsIdxInLCU) != m_pcPic->getCU( getAddr() )->getEntropySliceStartCU (uiAbsZorderQpMinCUIdx)) )) ) |
---|
2062 | { |
---|
2063 | return NULL; |
---|
2064 | } |
---|
2065 | |
---|
2066 | if ( !RasterAddress::isZeroCol( uiAbsRorderQpMinCUIdx, uiNumPartInCUWidth ) ) |
---|
2067 | { |
---|
2068 | uiLPartUnitIdx = g_auiRasterToZscan[ uiAbsRorderQpMinCUIdx - uiNumPartInQpMinCUWidth ]; |
---|
2069 | TComDataCU* pcTempReconCU = m_pcPic->getCU( getAddr() ); |
---|
2070 | if ((bEnforceSliceRestriction && (pcTempReconCU==NULL || pcTempReconCU->getSlice() == NULL || pcTempReconCU->getSCUAddr()+uiLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU (uiAbsZorderQpMinCUIdx))) |
---|
2071 | ||(bEnforceEntropySliceRestriction && (pcTempReconCU==NULL || pcTempReconCU->getSlice() == NULL || pcTempReconCU->getSCUAddr()+uiLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiAbsZorderQpMinCUIdx)))) |
---|
2072 | { |
---|
2073 | return NULL; |
---|
2074 | } |
---|
2075 | return m_pcPic->getCU( getAddr() ); |
---|
2076 | } |
---|
2077 | |
---|
2078 | uiLPartUnitIdx = g_auiRasterToZscan[ uiAbsRorderQpMinCUIdx + uiNumPartInCUWidth - uiNumPartInQpMinCUWidth ]; |
---|
2079 | |
---|
2080 | if ( (bEnforceSliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || |
---|
2081 | m_pcCULeft->getSCUAddr()+uiLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiAbsZorderQpMinCUIdx)|| |
---|
2082 | #if !REMOVE_TILE_DEPENDENCE |
---|
2083 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
2084 | #else |
---|
2085 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
2086 | #endif |
---|
2087 | ))|| |
---|
2088 | (bEnforceEntropySliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || |
---|
2089 | m_pcCULeft->getSCUAddr()+uiLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiAbsZorderQpMinCUIdx)|| |
---|
2090 | #if !REMOVE_TILE_DEPENDENCE |
---|
2091 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
2092 | #else |
---|
2093 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
2094 | #endif |
---|
2095 | )) |
---|
2096 | ) |
---|
2097 | { |
---|
2098 | return NULL; |
---|
2099 | } |
---|
2100 | |
---|
2101 | #if H0204_QP_PREDICTION |
---|
2102 | if ( m_pcCULeft && m_pcCULeft->getAddr() != getAddr() ) |
---|
2103 | { |
---|
2104 | return NULL; |
---|
2105 | } |
---|
2106 | #endif |
---|
2107 | |
---|
2108 | return m_pcCULeft; |
---|
2109 | } |
---|
2110 | |
---|
2111 | #if H0204_QP_PREDICTION |
---|
2112 | /** Get Above QpMinCu |
---|
2113 | *\param aPartUnitIdx |
---|
2114 | *\param currAbsIdxInLCU |
---|
2115 | *\param enforceSliceRestriction |
---|
2116 | *\param enforceEntropySliceRestriction |
---|
2117 | *\returns TComDataCU* point of TComDataCU of above QpMinCu |
---|
2118 | */ |
---|
2119 | TComDataCU* TComDataCU::getQpMinCuAbove( UInt& aPartUnitIdx, UInt currAbsIdxInLCU, Bool enforceSliceRestriction, Bool enforceEntropySliceRestriction ) |
---|
2120 | { |
---|
2121 | UInt numPartInCUWidth = m_pcPic->getNumPartInWidth(); |
---|
2122 | |
---|
2123 | UInt absRorderQpMinCUIdx = g_auiZscanToRaster[(currAbsIdxInLCU>>(8-(getSlice()->getPPS()->getMaxCuDQPDepth()<<1)))<<(8-(getSlice()->getPPS()->getMaxCuDQPDepth()<<1))]; |
---|
2124 | |
---|
2125 | UInt absZorderQpMinCUIdx = (currAbsIdxInLCU>>(8-(getSlice()->getPPS()->getMaxCuDQPDepth()<<1)))<<(8-(getSlice()->getPPS()->getMaxCuDQPDepth()<<1)); |
---|
2126 | if( (currAbsIdxInLCU != absZorderQpMinCUIdx) && |
---|
2127 | ((enforceSliceRestriction && (m_pcPic->getCU( getAddr() )->getSliceStartCU(currAbsIdxInLCU) != m_pcPic->getCU( getAddr() )->getSliceStartCU (absZorderQpMinCUIdx))) |
---|
2128 | ||(enforceEntropySliceRestriction && (m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(currAbsIdxInLCU) != m_pcPic->getCU( getAddr() )->getEntropySliceStartCU (absZorderQpMinCUIdx)) )) ) |
---|
2129 | { |
---|
2130 | return NULL; |
---|
2131 | } |
---|
2132 | |
---|
2133 | if ( !RasterAddress::isZeroRow( absRorderQpMinCUIdx, numPartInCUWidth ) ) |
---|
2134 | { |
---|
2135 | aPartUnitIdx = g_auiRasterToZscan[ absRorderQpMinCUIdx - numPartInCUWidth ]; |
---|
2136 | TComDataCU* pcTempReconCU = m_pcPic->getCU( getAddr() ); |
---|
2137 | if ((enforceSliceRestriction && (pcTempReconCU==NULL || pcTempReconCU->getSlice() == NULL || pcTempReconCU->getSCUAddr()+aPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU (absZorderQpMinCUIdx))) |
---|
2138 | ||(enforceEntropySliceRestriction && (pcTempReconCU==NULL || pcTempReconCU->getSlice() == NULL || pcTempReconCU->getSCUAddr()+aPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(absZorderQpMinCUIdx)))) |
---|
2139 | { |
---|
2140 | return NULL; |
---|
2141 | } |
---|
2142 | return m_pcPic->getCU( getAddr() ); |
---|
2143 | } |
---|
2144 | |
---|
2145 | aPartUnitIdx = g_auiRasterToZscan[ absRorderQpMinCUIdx + m_pcPic->getNumPartInCU() - numPartInCUWidth ]; |
---|
2146 | |
---|
2147 | if ( (enforceSliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || |
---|
2148 | m_pcCUAbove->getSCUAddr()+aPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(absZorderQpMinCUIdx)|| |
---|
2149 | #if !REMOVE_TILE_DEPENDENCE |
---|
2150 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
2151 | #else |
---|
2152 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
2153 | #endif |
---|
2154 | ))|| |
---|
2155 | (enforceEntropySliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || |
---|
2156 | m_pcCUAbove->getSCUAddr()+aPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(absZorderQpMinCUIdx)|| |
---|
2157 | #if !REMOVE_TILE_DEPENDENCE |
---|
2158 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
2159 | #else |
---|
2160 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
2161 | #endif |
---|
2162 | )) |
---|
2163 | ) |
---|
2164 | { |
---|
2165 | return NULL; |
---|
2166 | } |
---|
2167 | |
---|
2168 | if ( m_pcCUAbove && m_pcCUAbove->getAddr() != getAddr() ) |
---|
2169 | { |
---|
2170 | return NULL; |
---|
2171 | } |
---|
2172 | |
---|
2173 | return m_pcCUAbove; |
---|
2174 | } |
---|
2175 | #endif |
---|
2176 | |
---|
2177 | #if H0736_AVC_STYLE_QP_RANGE |
---|
2178 | /** Get reference QP from left QpMinCu or latest coded QP |
---|
2179 | *\param uiCurrAbsIdxInLCU |
---|
2180 | *\returns Char reference QP value |
---|
2181 | */ |
---|
2182 | Char TComDataCU::getRefQP( UInt uiCurrAbsIdxInLCU ) |
---|
2183 | #else |
---|
2184 | /** Get reference QP from left QpMinCu or latest coded QP |
---|
2185 | *\param uiCurrAbsIdxInLCU |
---|
2186 | *\returns UChar reference QP value |
---|
2187 | */ |
---|
2188 | UChar TComDataCU::getRefQP( UInt uiCurrAbsIdxInLCU ) |
---|
2189 | #endif |
---|
2190 | { |
---|
2191 | #if H0204_QP_PREDICTION |
---|
2192 | UInt lPartIdx, aPartIdx; |
---|
2193 | TComDataCU* cULeft = getQpMinCuLeft ( lPartIdx, m_uiAbsIdxInLCU + uiCurrAbsIdxInLCU ); |
---|
2194 | TComDataCU* cUAbove = getQpMinCuAbove( aPartIdx, m_uiAbsIdxInLCU + uiCurrAbsIdxInLCU ); |
---|
2195 | return (((cULeft? cULeft->getQP( lPartIdx ): getLastCodedQP( uiCurrAbsIdxInLCU )) + (cUAbove? cUAbove->getQP( aPartIdx ): getLastCodedQP( uiCurrAbsIdxInLCU )) + 1) >> 1); |
---|
2196 | #else |
---|
2197 | // Left CU |
---|
2198 | TComDataCU* pcCULeft; |
---|
2199 | UInt uiLPartIdx; |
---|
2200 | pcCULeft = getQpMinCuLeft( uiLPartIdx, m_uiAbsIdxInLCU + uiCurrAbsIdxInLCU ); |
---|
2201 | if ( pcCULeft ) |
---|
2202 | { |
---|
2203 | return pcCULeft->getQP(uiLPartIdx); |
---|
2204 | } |
---|
2205 | // Last QP |
---|
2206 | return getLastCodedQP( uiCurrAbsIdxInLCU ); |
---|
2207 | #endif |
---|
2208 | } |
---|
2209 | |
---|
2210 | Int TComDataCU::getLastValidPartIdx( Int iAbsPartIdx ) |
---|
2211 | { |
---|
2212 | Int iLastValidPartIdx = iAbsPartIdx-1; |
---|
2213 | while ( iLastValidPartIdx >= 0 |
---|
2214 | && getPredictionMode( iLastValidPartIdx ) == MODE_NONE ) |
---|
2215 | { |
---|
2216 | UInt uiDepth = getDepth( iLastValidPartIdx ); |
---|
2217 | iLastValidPartIdx -= m_uiNumPartition>>(uiDepth<<1); |
---|
2218 | } |
---|
2219 | return iLastValidPartIdx; |
---|
2220 | } |
---|
2221 | |
---|
2222 | #if H0736_AVC_STYLE_QP_RANGE |
---|
2223 | Char TComDataCU::getLastCodedQP( UInt uiAbsPartIdx ) |
---|
2224 | #else |
---|
2225 | UChar TComDataCU::getLastCodedQP( UInt uiAbsPartIdx ) |
---|
2226 | #endif |
---|
2227 | { |
---|
2228 | UInt uiQUPartIdxMask = ~((1<<(8-(getSlice()->getPPS()->getMaxCuDQPDepth()<<1)))-1); |
---|
2229 | Int iLastValidPartIdx = getLastValidPartIdx( uiAbsPartIdx&uiQUPartIdxMask ); |
---|
2230 | if ( uiAbsPartIdx < m_uiNumPartition |
---|
2231 | && (getSCUAddr()+iLastValidPartIdx < getSliceStartCU(m_uiAbsIdxInLCU+uiAbsPartIdx) || getSCUAddr()+iLastValidPartIdx < getEntropySliceStartCU(m_uiAbsIdxInLCU+uiAbsPartIdx) )) |
---|
2232 | { |
---|
2233 | return getSlice()->getSliceQp(); |
---|
2234 | } |
---|
2235 | else |
---|
2236 | if ( iLastValidPartIdx >= 0 ) |
---|
2237 | { |
---|
2238 | return getQP( iLastValidPartIdx ); |
---|
2239 | } |
---|
2240 | else |
---|
2241 | { |
---|
2242 | if ( getZorderIdxInCU() > 0 ) |
---|
2243 | { |
---|
2244 | return getPic()->getCU( getAddr() )->getLastCodedQP( getZorderIdxInCU() ); |
---|
2245 | } |
---|
2246 | else if ( getAddr() > 0 ) |
---|
2247 | { |
---|
2248 | return getPic()->getCU( getAddr()-1 )->getLastCodedQP( getPic()->getNumPartInCU() ); |
---|
2249 | } |
---|
2250 | else |
---|
2251 | { |
---|
2252 | return getSlice()->getSliceQp(); |
---|
2253 | } |
---|
2254 | } |
---|
2255 | } |
---|
2256 | #if LOSSLESS_CODING |
---|
2257 | /** Check whether the CU is coded in lossless coding mode |
---|
2258 | * \param uiAbsPartIdx |
---|
2259 | * \returns true if the CU is coded in lossless coding mode; false if otherwise |
---|
2260 | */ |
---|
2261 | Bool TComDataCU::isLosslessCoded(UInt absPartIdx) |
---|
2262 | { |
---|
2263 | #if H0736_AVC_STYLE_QP_RANGE |
---|
2264 | return ( getSlice()->getSPS()->getUseLossless() && ((getQP(absPartIdx) + getSlice()->getSPS()->getQpBDOffsetY()) == 0) ); |
---|
2265 | #else |
---|
2266 | return ( getSlice()->getSPS()->getUseLossless() && (getQP(absPartPIdx) == 0) ); |
---|
2267 | #endif |
---|
2268 | } |
---|
2269 | #endif |
---|
2270 | |
---|
2271 | /** Get allowed chroma intra modes |
---|
2272 | *\param uiAbsPartIdx |
---|
2273 | *\param uiModeList pointer to chroma intra modes array |
---|
2274 | *\returns |
---|
2275 | *- fill uiModeList with chroma intra modes |
---|
2276 | */ |
---|
2277 | Void TComDataCU::getAllowedChromaDir( UInt uiAbsPartIdx, UInt* uiModeList ) |
---|
2278 | { |
---|
2279 | uiModeList[0] = PLANAR_IDX; |
---|
2280 | #if LOGI_INTRA_NAME_3MPM |
---|
2281 | uiModeList[1] = VER_IDX; |
---|
2282 | uiModeList[2] = HOR_IDX; |
---|
2283 | #else |
---|
2284 | uiModeList[1] = 1; |
---|
2285 | uiModeList[2] = 2; |
---|
2286 | #endif |
---|
2287 | uiModeList[3] = DC_IDX; |
---|
2288 | uiModeList[4] = LM_CHROMA_IDX; |
---|
2289 | uiModeList[5] = DM_CHROMA_IDX; |
---|
2290 | |
---|
2291 | UInt uiLumaMode = getLumaIntraDir( uiAbsPartIdx ); |
---|
2292 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
2293 | mapDMMtoIntraMode( uiLumaMode ); |
---|
2294 | #endif |
---|
2295 | |
---|
2296 | for( Int i = 0; i < NUM_CHROMA_MODE - 2; i++ ) |
---|
2297 | { |
---|
2298 | if( uiLumaMode == uiModeList[i] ) |
---|
2299 | { |
---|
2300 | #if LOGI_INTRA_NAME_3MPM |
---|
2301 | uiModeList[i] = 34; // VER+8 mode |
---|
2302 | #else |
---|
2303 | uiModeList[i] = 7; // VER+8 mode |
---|
2304 | #endif |
---|
2305 | break; |
---|
2306 | } |
---|
2307 | } |
---|
2308 | } |
---|
2309 | |
---|
2310 | /** Get most probable intra modes |
---|
2311 | *\param uiAbsPartIdx |
---|
2312 | *\param uiIntraDirPred pointer to the array for MPM storage |
---|
2313 | *\param piMode it is set with MPM mode in case both MPM are equal. It is used to restrict RD search at encode side. |
---|
2314 | *\returns Number of MPM |
---|
2315 | */ |
---|
2316 | Int TComDataCU::getIntraDirLumaPredictor( UInt uiAbsPartIdx, Int* uiIntraDirPred, Int* piMode ) |
---|
2317 | { |
---|
2318 | TComDataCU* pcTempCU; |
---|
2319 | UInt uiTempPartIdx; |
---|
2320 | Int iLeftIntraDir, iAboveIntraDir; |
---|
2321 | Int uiPredNum = 0; |
---|
2322 | |
---|
2323 | // Get intra direction of left PU |
---|
2324 | pcTempCU = getPULeft( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx ); |
---|
2325 | |
---|
2326 | #if DEFAULT_DC |
---|
2327 | iLeftIntraDir = pcTempCU ? ( pcTempCU->isIntra( uiTempPartIdx ) ? pcTempCU->getLumaIntraDir( uiTempPartIdx ) : DC_IDX ) : DC_IDX; |
---|
2328 | #else |
---|
2329 | iLeftIntraDir = pcTempCU ? ( pcTempCU->isIntra( uiTempPartIdx ) ? pcTempCU->getLumaIntraDir( uiTempPartIdx ) : PLANAR_IDX ) : PLANAR_IDX; |
---|
2330 | #endif |
---|
2331 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
2332 | mapDMMtoIntraMode( iLeftIntraDir ); |
---|
2333 | #endif |
---|
2334 | |
---|
2335 | // Get intra direction of above PU |
---|
2336 | pcTempCU = getPUAbove( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx, true, true, false, true ); |
---|
2337 | |
---|
2338 | #if DEFAULT_DC |
---|
2339 | iAboveIntraDir = pcTempCU ? ( pcTempCU->isIntra( uiTempPartIdx ) ? pcTempCU->getLumaIntraDir( uiTempPartIdx ) : DC_IDX ) : DC_IDX; |
---|
2340 | #else |
---|
2341 | iAboveIntraDir = pcTempCU ? ( pcTempCU->isIntra( uiTempPartIdx ) ? pcTempCU->getLumaIntraDir( uiTempPartIdx ) : PLANAR_IDX ) : PLANAR_IDX; |
---|
2342 | #endif |
---|
2343 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
2344 | mapDMMtoIntraMode( iAboveIntraDir ); |
---|
2345 | #endif |
---|
2346 | |
---|
2347 | #if LOGI_INTRA_NAME_3MPM |
---|
2348 | uiPredNum = 3; |
---|
2349 | if(iLeftIntraDir == iAboveIntraDir) |
---|
2350 | { |
---|
2351 | if( piMode ) |
---|
2352 | { |
---|
2353 | *piMode = 1; |
---|
2354 | } |
---|
2355 | |
---|
2356 | if (iLeftIntraDir > 1) // angular modes |
---|
2357 | { |
---|
2358 | uiIntraDirPred[0] = iLeftIntraDir; |
---|
2359 | uiIntraDirPred[1] = ((iLeftIntraDir + 29) % 32) + 2; |
---|
2360 | uiIntraDirPred[2] = ((iLeftIntraDir - 1 ) % 32) + 2; |
---|
2361 | } |
---|
2362 | else //non-angular |
---|
2363 | { |
---|
2364 | uiIntraDirPred[0] = PLANAR_IDX; |
---|
2365 | uiIntraDirPred[1] = DC_IDX; |
---|
2366 | uiIntraDirPred[2] = VER_IDX; |
---|
2367 | } |
---|
2368 | } |
---|
2369 | else |
---|
2370 | { |
---|
2371 | if( piMode ) |
---|
2372 | { |
---|
2373 | *piMode = 2; |
---|
2374 | } |
---|
2375 | uiIntraDirPred[0] = iLeftIntraDir; |
---|
2376 | uiIntraDirPred[1] = iAboveIntraDir; |
---|
2377 | |
---|
2378 | if (iLeftIntraDir && iAboveIntraDir ) //both modes are non-planar |
---|
2379 | { |
---|
2380 | uiIntraDirPred[2] = PLANAR_IDX; |
---|
2381 | } |
---|
2382 | else |
---|
2383 | { |
---|
2384 | uiIntraDirPred[2] = (iLeftIntraDir+iAboveIntraDir)<2? VER_IDX : DC_IDX; |
---|
2385 | } |
---|
2386 | } |
---|
2387 | #else |
---|
2388 | Int iIdx = getIntraSizeIdx(uiAbsPartIdx); |
---|
2389 | |
---|
2390 | |
---|
2391 | if ( iLeftIntraDir >= g_aucIntraModeNumAng[iIdx] ) |
---|
2392 | { |
---|
2393 | iLeftIntraDir = PLANAR_IDX; |
---|
2394 | } |
---|
2395 | |
---|
2396 | |
---|
2397 | if ( iAboveIntraDir >= g_aucIntraModeNumAng[iIdx] ) |
---|
2398 | { |
---|
2399 | iAboveIntraDir = PLANAR_IDX; |
---|
2400 | } |
---|
2401 | |
---|
2402 | if(iLeftIntraDir == iAboveIntraDir) |
---|
2403 | { |
---|
2404 | uiPredNum = 2; |
---|
2405 | |
---|
2406 | if( piMode ) |
---|
2407 | { |
---|
2408 | *piMode = iLeftIntraDir; |
---|
2409 | } |
---|
2410 | |
---|
2411 | iAboveIntraDir = iLeftIntraDir == PLANAR_IDX ? DC_IDX : PLANAR_IDX; // DC or Planar |
---|
2412 | |
---|
2413 | assert( iLeftIntraDir != iAboveIntraDir ); |
---|
2414 | |
---|
2415 | uiIntraDirPred[0] = min(iLeftIntraDir, iAboveIntraDir); |
---|
2416 | uiIntraDirPred[1] = max(iLeftIntraDir, iAboveIntraDir); |
---|
2417 | } |
---|
2418 | else |
---|
2419 | { |
---|
2420 | uiPredNum = 2; |
---|
2421 | uiIntraDirPred[0] = min(iLeftIntraDir, iAboveIntraDir); |
---|
2422 | uiIntraDirPred[1] = max(iLeftIntraDir, iAboveIntraDir); |
---|
2423 | } |
---|
2424 | #endif |
---|
2425 | |
---|
2426 | return uiPredNum; |
---|
2427 | } |
---|
2428 | |
---|
2429 | UInt TComDataCU::getCtxSplitFlag( UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2430 | { |
---|
2431 | TComDataCU* pcTempCU; |
---|
2432 | UInt uiTempPartIdx; |
---|
2433 | UInt uiCtx; |
---|
2434 | // Get left split flag |
---|
2435 | pcTempCU = getPULeft( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx ); |
---|
2436 | uiCtx = ( pcTempCU ) ? ( ( pcTempCU->getDepth( uiTempPartIdx ) > uiDepth ) ? 1 : 0 ) : 0; |
---|
2437 | |
---|
2438 | // Get above split flag |
---|
2439 | pcTempCU = getPUAbove( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx ); |
---|
2440 | uiCtx += ( pcTempCU ) ? ( ( pcTempCU->getDepth( uiTempPartIdx ) > uiDepth ) ? 1 : 0 ) : 0; |
---|
2441 | |
---|
2442 | return uiCtx; |
---|
2443 | } |
---|
2444 | |
---|
2445 | UInt TComDataCU::getCtxQtCbf( UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth ) |
---|
2446 | { |
---|
2447 | if( eType ) |
---|
2448 | { |
---|
2449 | return uiTrDepth; |
---|
2450 | } |
---|
2451 | else |
---|
2452 | { |
---|
2453 | const UInt uiDepth = getDepth( uiAbsPartIdx ); |
---|
2454 | const UInt uiLog2TrafoSize = g_aucConvertToBit[ getSlice()->getSPS()->getMaxCUWidth() ] + 2 - uiDepth - uiTrDepth; |
---|
2455 | const UInt uiCtx = uiTrDepth == 0 || uiLog2TrafoSize == getSlice()->getSPS()->getQuadtreeTULog2MaxSize() ? 1 : 0; |
---|
2456 | return uiCtx; |
---|
2457 | } |
---|
2458 | } |
---|
2459 | |
---|
2460 | UInt TComDataCU::getQuadtreeTULog2MinSizeInCU( UInt absPartIdx ) |
---|
2461 | { |
---|
2462 | UInt log2CbSize = g_aucConvertToBit[getWidth( absPartIdx )] + 2; |
---|
2463 | PartSize partSize = getPartitionSize( absPartIdx ); |
---|
2464 | UInt quadtreeTUMaxDepth = getPredictionMode( absPartIdx ) == MODE_INTRA ? m_pcSlice->getSPS()->getQuadtreeTUMaxDepthIntra() : m_pcSlice->getSPS()->getQuadtreeTUMaxDepthInter(); |
---|
2465 | Int intraSplitFlag = ( getPredictionMode( absPartIdx ) == MODE_INTRA && partSize == SIZE_NxN ) ? 1 : 0; |
---|
2466 | #if G519_TU_AMP_NSQT_HARMONIZATION |
---|
2467 | Int interSplitFlag = ((quadtreeTUMaxDepth == 1) && (getPredictionMode( absPartIdx ) == MODE_INTER) && (partSize != SIZE_2Nx2N) ); |
---|
2468 | #else |
---|
2469 | Int interSplitFlag = ((quadtreeTUMaxDepth == 1) && (getPredictionMode( absPartIdx ) == MODE_INTER) && (partSize == SIZE_Nx2N || partSize == SIZE_2NxN) ); |
---|
2470 | #endif |
---|
2471 | |
---|
2472 | UInt log2MinTUSizeInCU = 0; |
---|
2473 | if (log2CbSize < (m_pcSlice->getSPS()->getQuadtreeTULog2MinSize() + quadtreeTUMaxDepth - 1 + interSplitFlag + intraSplitFlag) ) |
---|
2474 | { |
---|
2475 | // when fully making use of signaled TUMaxDepth + inter/intraSplitFlag, resulting luma TB size is < QuadtreeTULog2MinSize |
---|
2476 | log2MinTUSizeInCU = m_pcSlice->getSPS()->getQuadtreeTULog2MinSize(); |
---|
2477 | } |
---|
2478 | else |
---|
2479 | { |
---|
2480 | // when fully making use of signaled TUMaxDepth + inter/intraSplitFlag, resulting luma TB size is still >= QuadtreeTULog2MinSize |
---|
2481 | log2MinTUSizeInCU = log2CbSize - ( quadtreeTUMaxDepth - 1 + interSplitFlag + intraSplitFlag); // stop when trafoDepth == hierarchy_depth = splitFlag |
---|
2482 | if ( log2MinTUSizeInCU > m_pcSlice->getSPS()->getQuadtreeTULog2MaxSize()) |
---|
2483 | { |
---|
2484 | // when fully making use of signaled TUMaxDepth + inter/intraSplitFlag, resulting luma TB size is still > QuadtreeTULog2MaxSize |
---|
2485 | log2MinTUSizeInCU = m_pcSlice->getSPS()->getQuadtreeTULog2MaxSize(); |
---|
2486 | } |
---|
2487 | } |
---|
2488 | return log2MinTUSizeInCU; |
---|
2489 | } |
---|
2490 | |
---|
2491 | |
---|
2492 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
2493 | UInt |
---|
2494 | TComDataCU::getCtxResPredFlag( UInt uiAbsPartIdx ) |
---|
2495 | { |
---|
2496 | #if 1 // simple context |
---|
2497 | UInt uiCtx = 0; |
---|
2498 | #else |
---|
2499 | TComDataCU* pcTempCU; |
---|
2500 | UInt uiTempPartIdx; |
---|
2501 | UInt uiCtx = 0; |
---|
2502 | |
---|
2503 | // Get BCBP of left PU |
---|
2504 | pcTempCU = getPULeft( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx ); |
---|
2505 | uiCtx = ( pcTempCU ) ? pcTempCU->getResPredFlag( uiTempPartIdx ) : 0; |
---|
2506 | |
---|
2507 | // Get BCBP of above PU |
---|
2508 | pcTempCU = getPUAbove( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx ); |
---|
2509 | uiCtx += ( pcTempCU ) ? pcTempCU->getResPredFlag( uiTempPartIdx ) : 0; |
---|
2510 | #endif |
---|
2511 | return uiCtx; |
---|
2512 | } |
---|
2513 | #endif |
---|
2514 | |
---|
2515 | |
---|
2516 | UInt TComDataCU::getCtxSkipFlag( UInt uiAbsPartIdx ) |
---|
2517 | { |
---|
2518 | TComDataCU* pcTempCU; |
---|
2519 | UInt uiTempPartIdx; |
---|
2520 | UInt uiCtx = 0; |
---|
2521 | |
---|
2522 | // Get BCBP of left PU |
---|
2523 | pcTempCU = getPULeft( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx ); |
---|
2524 | uiCtx = ( pcTempCU ) ? pcTempCU->isSkipped( uiTempPartIdx ) : 0; |
---|
2525 | |
---|
2526 | // Get BCBP of above PU |
---|
2527 | pcTempCU = getPUAbove( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx ); |
---|
2528 | uiCtx += ( pcTempCU ) ? pcTempCU->isSkipped( uiTempPartIdx ) : 0; |
---|
2529 | |
---|
2530 | return uiCtx; |
---|
2531 | } |
---|
2532 | |
---|
2533 | UInt TComDataCU::getCtxInterDir( UInt uiAbsPartIdx ) |
---|
2534 | { |
---|
2535 | return getDepth( uiAbsPartIdx ); |
---|
2536 | } |
---|
2537 | |
---|
2538 | Void TComDataCU::setCbfSubParts( UInt uiCbfY, UInt uiCbfU, UInt uiCbfV, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2539 | { |
---|
2540 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
2541 | memset( m_puhCbf[0] + uiAbsPartIdx, uiCbfY, sizeof( UChar ) * uiCurrPartNumb ); |
---|
2542 | memset( m_puhCbf[1] + uiAbsPartIdx, uiCbfU, sizeof( UChar ) * uiCurrPartNumb ); |
---|
2543 | memset( m_puhCbf[2] + uiAbsPartIdx, uiCbfV, sizeof( UChar ) * uiCurrPartNumb ); |
---|
2544 | } |
---|
2545 | |
---|
2546 | Void TComDataCU::setCbfSubParts( UInt uiCbf, TextType eTType, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2547 | { |
---|
2548 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
2549 | memset( m_puhCbf[g_aucConvertTxtTypeToIdx[eTType]] + uiAbsPartIdx, uiCbf, sizeof( UChar ) * uiCurrPartNumb ); |
---|
2550 | } |
---|
2551 | |
---|
2552 | /** Sets a coded block flag for all sub-partitions of a partition |
---|
2553 | * \param uiCbf The value of the coded block flag to be set |
---|
2554 | * \param eTType |
---|
2555 | * \param uiAbsPartIdx |
---|
2556 | * \param uiPartIdx |
---|
2557 | * \param uiDepth |
---|
2558 | * \returns Void |
---|
2559 | */ |
---|
2560 | Void TComDataCU::setCbfSubParts ( UInt uiCbf, TextType eTType, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) |
---|
2561 | { |
---|
2562 | setSubPart<UChar>( uiCbf, m_puhCbf[g_aucConvertTxtTypeToIdx[eTType]], uiAbsPartIdx, uiDepth, uiPartIdx ); |
---|
2563 | } |
---|
2564 | |
---|
2565 | Void TComDataCU::setDepthSubParts( UInt uiDepth, UInt uiAbsPartIdx ) |
---|
2566 | { |
---|
2567 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
2568 | memset( m_puhDepth + uiAbsPartIdx, uiDepth, sizeof(UChar)*uiCurrPartNumb ); |
---|
2569 | } |
---|
2570 | |
---|
2571 | Bool TComDataCU::isFirstAbsZorderIdxInDepth (UInt uiAbsPartIdx, UInt uiDepth) |
---|
2572 | { |
---|
2573 | UInt uiPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
2574 | return (((m_uiAbsIdxInLCU + uiAbsPartIdx)% uiPartNumb) == 0); |
---|
2575 | } |
---|
2576 | |
---|
2577 | Void TComDataCU::setAlfCtrlFlagSubParts( Bool uiFlag, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2578 | { |
---|
2579 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> ( 2 * uiDepth ); |
---|
2580 | memset( m_puiAlfCtrlFlag + uiAbsPartIdx, uiFlag, sizeof( *m_puiAlfCtrlFlag ) * uiCurrPartNumb ); |
---|
2581 | } |
---|
2582 | |
---|
2583 | Void TComDataCU::createTmpAlfCtrlFlag() |
---|
2584 | { |
---|
2585 | m_puiTmpAlfCtrlFlag = new Bool[ m_uiNumPartition ]; |
---|
2586 | } |
---|
2587 | |
---|
2588 | Void TComDataCU::destroyTmpAlfCtrlFlag() |
---|
2589 | { |
---|
2590 | if(m_puiTmpAlfCtrlFlag) |
---|
2591 | { |
---|
2592 | delete[] m_puiTmpAlfCtrlFlag; |
---|
2593 | m_puiTmpAlfCtrlFlag = NULL; |
---|
2594 | } |
---|
2595 | } |
---|
2596 | |
---|
2597 | Void TComDataCU::copyAlfCtrlFlagToTmp() |
---|
2598 | { |
---|
2599 | memcpy( m_puiTmpAlfCtrlFlag, m_puiAlfCtrlFlag, sizeof( *m_puiAlfCtrlFlag )*m_uiNumPartition ); |
---|
2600 | } |
---|
2601 | |
---|
2602 | Void TComDataCU::copyAlfCtrlFlagFromTmp() |
---|
2603 | { |
---|
2604 | memcpy( m_puiAlfCtrlFlag, m_puiTmpAlfCtrlFlag, sizeof( *m_puiAlfCtrlFlag )*m_uiNumPartition ); |
---|
2605 | } |
---|
2606 | |
---|
2607 | Void TComDataCU::setPartSizeSubParts( PartSize eMode, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2608 | { |
---|
2609 | assert( sizeof( *m_pePartSize) == 1 ); |
---|
2610 | memset( m_pePartSize + uiAbsPartIdx, eMode, m_pcPic->getNumPartInCU() >> ( 2 * uiDepth ) ); |
---|
2611 | } |
---|
2612 | #if HHI_INTERVIEW_SKIP |
---|
2613 | Void TComDataCU::setRenderableSubParts ( Bool bRenderable, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2614 | { |
---|
2615 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
2616 | |
---|
2617 | for (UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
2618 | { |
---|
2619 | m_pbRenderable[uiAbsPartIdx + ui] = bRenderable; |
---|
2620 | } |
---|
2621 | } |
---|
2622 | #endif |
---|
2623 | |
---|
2624 | Void TComDataCU::setPredModeSubParts( PredMode eMode, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2625 | { |
---|
2626 | assert( sizeof( *m_pePartSize) == 1 ); |
---|
2627 | memset( m_pePredMode + uiAbsPartIdx, eMode, m_pcPic->getNumPartInCU() >> ( 2 * uiDepth ) ); |
---|
2628 | } |
---|
2629 | |
---|
2630 | #if H0736_AVC_STYLE_QP_RANGE |
---|
2631 | Void TComDataCU::setQPSubParts( Int qp, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2632 | #else |
---|
2633 | Void TComDataCU::setQPSubParts( UInt uiQP, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2634 | #endif |
---|
2635 | { |
---|
2636 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
2637 | TComSlice * pcSlice = getPic()->getSlice(getPic()->getCurrSliceIdx()); |
---|
2638 | |
---|
2639 | for(UInt uiSCUIdx = uiAbsPartIdx; uiSCUIdx < uiAbsPartIdx+uiCurrPartNumb; uiSCUIdx++) |
---|
2640 | { |
---|
2641 | if( m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiSCUIdx+getZorderIdxInCU()) == pcSlice->getEntropySliceCurStartCUAddr() ) |
---|
2642 | { |
---|
2643 | #if H0736_AVC_STYLE_QP_RANGE |
---|
2644 | m_phQP[uiSCUIdx] = qp; |
---|
2645 | #else |
---|
2646 | m_phQP[uiSCUIdx] = uiQP; |
---|
2647 | #endif |
---|
2648 | } |
---|
2649 | } |
---|
2650 | } |
---|
2651 | |
---|
2652 | Void TComDataCU::setLumaIntraDirSubParts( UInt uiDir, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2653 | { |
---|
2654 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
2655 | |
---|
2656 | memset( m_puhLumaIntraDir + uiAbsPartIdx, uiDir, sizeof(UChar)*uiCurrPartNumb ); |
---|
2657 | } |
---|
2658 | |
---|
2659 | template<typename T> |
---|
2660 | Void TComDataCU::setSubPart( T uiParameter, T* puhBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx ) |
---|
2661 | { |
---|
2662 | assert( sizeof(T) == 1 ); // Using memset() works only for types of size 1 |
---|
2663 | |
---|
2664 | UInt uiCurrPartNumQ = (m_pcPic->getNumPartInCU() >> (2 * uiCUDepth)) >> 2; |
---|
2665 | switch ( m_pePartSize[ uiCUAddr ] ) |
---|
2666 | { |
---|
2667 | case SIZE_2Nx2N: |
---|
2668 | memset( puhBaseLCU + uiCUAddr, uiParameter, 4 * uiCurrPartNumQ ); |
---|
2669 | break; |
---|
2670 | case SIZE_2NxN: |
---|
2671 | memset( puhBaseLCU + uiCUAddr, uiParameter, 2 * uiCurrPartNumQ ); |
---|
2672 | break; |
---|
2673 | case SIZE_Nx2N: |
---|
2674 | memset( puhBaseLCU + uiCUAddr, uiParameter, uiCurrPartNumQ ); |
---|
2675 | memset( puhBaseLCU + uiCUAddr + 2 * uiCurrPartNumQ, uiParameter, uiCurrPartNumQ ); |
---|
2676 | break; |
---|
2677 | case SIZE_NxN: |
---|
2678 | memset( puhBaseLCU + uiCUAddr, uiParameter, uiCurrPartNumQ ); |
---|
2679 | break; |
---|
2680 | case SIZE_2NxnU: |
---|
2681 | if ( uiPUIdx == 0 ) |
---|
2682 | { |
---|
2683 | memset( puhBaseLCU + uiCUAddr, uiParameter, (uiCurrPartNumQ >> 1) ); |
---|
2684 | memset( puhBaseLCU + uiCUAddr + uiCurrPartNumQ, uiParameter, (uiCurrPartNumQ >> 1) ); |
---|
2685 | } |
---|
2686 | else if ( uiPUIdx == 1 ) |
---|
2687 | { |
---|
2688 | memset( puhBaseLCU + uiCUAddr, uiParameter, (uiCurrPartNumQ >> 1) ); |
---|
2689 | memset( puhBaseLCU + uiCUAddr + uiCurrPartNumQ, uiParameter, ((uiCurrPartNumQ >> 1) + (uiCurrPartNumQ << 1)) ); |
---|
2690 | } |
---|
2691 | else |
---|
2692 | { |
---|
2693 | assert(0); |
---|
2694 | } |
---|
2695 | break; |
---|
2696 | case SIZE_2NxnD: |
---|
2697 | if ( uiPUIdx == 0 ) |
---|
2698 | { |
---|
2699 | memset( puhBaseLCU + uiCUAddr, uiParameter, ((uiCurrPartNumQ << 1) + (uiCurrPartNumQ >> 1)) ); |
---|
2700 | memset( puhBaseLCU + uiCUAddr + (uiCurrPartNumQ << 1) + uiCurrPartNumQ, uiParameter, (uiCurrPartNumQ >> 1) ); |
---|
2701 | } |
---|
2702 | else if ( uiPUIdx == 1 ) |
---|
2703 | { |
---|
2704 | memset( puhBaseLCU + uiCUAddr, uiParameter, (uiCurrPartNumQ >> 1) ); |
---|
2705 | memset( puhBaseLCU + uiCUAddr + uiCurrPartNumQ, uiParameter, (uiCurrPartNumQ >> 1) ); |
---|
2706 | } |
---|
2707 | else |
---|
2708 | { |
---|
2709 | assert(0); |
---|
2710 | } |
---|
2711 | break; |
---|
2712 | case SIZE_nLx2N: |
---|
2713 | if ( uiPUIdx == 0 ) |
---|
2714 | { |
---|
2715 | memset( puhBaseLCU + uiCUAddr, uiParameter, (uiCurrPartNumQ >> 2) ); |
---|
2716 | memset( puhBaseLCU + uiCUAddr + (uiCurrPartNumQ >> 1), uiParameter, (uiCurrPartNumQ >> 2) ); |
---|
2717 | memset( puhBaseLCU + uiCUAddr + (uiCurrPartNumQ << 1), uiParameter, (uiCurrPartNumQ >> 2) ); |
---|
2718 | memset( puhBaseLCU + uiCUAddr + (uiCurrPartNumQ << 1) + (uiCurrPartNumQ >> 1), uiParameter, (uiCurrPartNumQ >> 2) ); |
---|
2719 | } |
---|
2720 | else if ( uiPUIdx == 1 ) |
---|
2721 | { |
---|
2722 | memset( puhBaseLCU + uiCUAddr, uiParameter, (uiCurrPartNumQ >> 2) ); |
---|
2723 | memset( puhBaseLCU + uiCUAddr + (uiCurrPartNumQ >> 1), uiParameter, (uiCurrPartNumQ + (uiCurrPartNumQ >> 2)) ); |
---|
2724 | memset( puhBaseLCU + uiCUAddr + (uiCurrPartNumQ << 1), uiParameter, (uiCurrPartNumQ >> 2) ); |
---|
2725 | memset( puhBaseLCU + uiCUAddr + (uiCurrPartNumQ << 1) + (uiCurrPartNumQ >> 1), uiParameter, (uiCurrPartNumQ + (uiCurrPartNumQ >> 2)) ); |
---|
2726 | } |
---|
2727 | else |
---|
2728 | { |
---|
2729 | assert(0); |
---|
2730 | } |
---|
2731 | break; |
---|
2732 | case SIZE_nRx2N: |
---|
2733 | if ( uiPUIdx == 0 ) |
---|
2734 | { |
---|
2735 | memset( puhBaseLCU + uiCUAddr, uiParameter, (uiCurrPartNumQ + (uiCurrPartNumQ >> 2)) ); |
---|
2736 | memset( puhBaseLCU + uiCUAddr + uiCurrPartNumQ + (uiCurrPartNumQ >> 1), uiParameter, (uiCurrPartNumQ >> 2) ); |
---|
2737 | memset( puhBaseLCU + uiCUAddr + (uiCurrPartNumQ << 1), uiParameter, (uiCurrPartNumQ + (uiCurrPartNumQ >> 2)) ); |
---|
2738 | memset( puhBaseLCU + uiCUAddr + (uiCurrPartNumQ << 1) + uiCurrPartNumQ + (uiCurrPartNumQ >> 1), uiParameter, (uiCurrPartNumQ >> 2) ); |
---|
2739 | } |
---|
2740 | else if ( uiPUIdx == 1 ) |
---|
2741 | { |
---|
2742 | memset( puhBaseLCU + uiCUAddr, uiParameter, (uiCurrPartNumQ >> 2) ); |
---|
2743 | memset( puhBaseLCU + uiCUAddr + (uiCurrPartNumQ >> 1), uiParameter, (uiCurrPartNumQ >> 2) ); |
---|
2744 | memset( puhBaseLCU + uiCUAddr + (uiCurrPartNumQ << 1), uiParameter, (uiCurrPartNumQ >> 2) ); |
---|
2745 | memset( puhBaseLCU + uiCUAddr + (uiCurrPartNumQ << 1) + (uiCurrPartNumQ >> 1), uiParameter, (uiCurrPartNumQ >> 2) ); |
---|
2746 | } |
---|
2747 | else |
---|
2748 | { |
---|
2749 | assert(0); |
---|
2750 | } |
---|
2751 | break; |
---|
2752 | default: |
---|
2753 | assert( 0 ); |
---|
2754 | } |
---|
2755 | } |
---|
2756 | |
---|
2757 | Void TComDataCU::setMergeFlagSubParts ( Bool bMergeFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) |
---|
2758 | { |
---|
2759 | setSubPart( bMergeFlag, m_pbMergeFlag, uiAbsPartIdx, uiDepth, uiPartIdx ); |
---|
2760 | } |
---|
2761 | |
---|
2762 | Void TComDataCU::setMergeIndexSubParts ( UInt uiMergeIndex, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) |
---|
2763 | { |
---|
2764 | setSubPart<UChar>( uiMergeIndex, m_puhMergeIndex, uiAbsPartIdx, uiDepth, uiPartIdx ); |
---|
2765 | } |
---|
2766 | |
---|
2767 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
2768 | Void TComDataCU::setResPredAvailSubParts( Bool bResPredAvailable, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) |
---|
2769 | { |
---|
2770 | setSubPart( bResPredAvailable, m_pbResPredAvailable, uiAbsPartIdx, uiDepth, uiPartIdx ); |
---|
2771 | } |
---|
2772 | |
---|
2773 | Void TComDataCU::setResPredFlagSubParts( Bool bResPredFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) |
---|
2774 | { |
---|
2775 | setSubPart( bResPredFlag, m_pbResPredFlag, uiAbsPartIdx, uiDepth, uiPartIdx ); |
---|
2776 | } |
---|
2777 | #endif |
---|
2778 | |
---|
2779 | Void TComDataCU::setChromIntraDirSubParts( UInt uiDir, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2780 | { |
---|
2781 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
2782 | |
---|
2783 | memset( m_puhChromaIntraDir + uiAbsPartIdx, uiDir, sizeof(UChar)*uiCurrPartNumb ); |
---|
2784 | } |
---|
2785 | |
---|
2786 | Void TComDataCU::setInterDirSubParts( UInt uiDir, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) |
---|
2787 | { |
---|
2788 | setSubPart<UChar>( uiDir, m_puhInterDir, uiAbsPartIdx, uiDepth, uiPartIdx ); |
---|
2789 | } |
---|
2790 | |
---|
2791 | Void TComDataCU::setMVPIdxSubParts( Int iMVPIdx, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) |
---|
2792 | { |
---|
2793 | setSubPart<Char>( iMVPIdx, m_apiMVPIdx[eRefPicList], uiAbsPartIdx, uiDepth, uiPartIdx ); |
---|
2794 | } |
---|
2795 | |
---|
2796 | Void TComDataCU::setMVPNumSubParts( Int iMVPNum, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) |
---|
2797 | { |
---|
2798 | setSubPart<Char>( iMVPNum, m_apiMVPNum[eRefPicList], uiAbsPartIdx, uiDepth, uiPartIdx ); |
---|
2799 | } |
---|
2800 | |
---|
2801 | |
---|
2802 | Void TComDataCU::setTrIdxSubParts( UInt uiTrIdx, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2803 | { |
---|
2804 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
2805 | |
---|
2806 | memset( m_puhTrIdx + uiAbsPartIdx, uiTrIdx, sizeof(UChar)*uiCurrPartNumb ); |
---|
2807 | } |
---|
2808 | |
---|
2809 | Void TComDataCU::setNSQTIdxSubParts( UInt absPartIdx, UInt depth ) |
---|
2810 | { |
---|
2811 | UInt currPartNumb = m_pcPic->getNumPartInCU() >> (depth << 1); |
---|
2812 | |
---|
2813 | memset( m_nsqtPartIdx + absPartIdx, absPartIdx, sizeof(UChar)*currPartNumb ); |
---|
2814 | } |
---|
2815 | |
---|
2816 | Void TComDataCU::setNSQTIdxSubParts( UInt log2TrafoSize, UInt absPartIdx, UInt absTUPartIdx, UInt trMode ) |
---|
2817 | { |
---|
2818 | UInt trWidth, trHeight; |
---|
2819 | UInt nsTUWidthInBaseUnits, nsTUHeightInBaseUnits; |
---|
2820 | UInt lcuWidthInBaseUnits = getPic()->getNumPartInWidth(); |
---|
2821 | UInt minTuSize = ( 1 << getSlice()->getSPS()->getQuadtreeTULog2MinSize() ); |
---|
2822 | |
---|
2823 | trWidth = trHeight = ( 1 << log2TrafoSize ); |
---|
2824 | |
---|
2825 | if ( useNonSquareTrans( trMode, absPartIdx ) && ( trWidth > minTuSize ) ) |
---|
2826 | { |
---|
2827 | trWidth = ( m_pePartSize[absPartIdx] == SIZE_Nx2N || m_pePartSize[absPartIdx] == SIZE_nLx2N || m_pePartSize[absPartIdx] == SIZE_nRx2N )? trWidth >> 1 : trWidth << 1; |
---|
2828 | trHeight = ( m_pePartSize[absPartIdx] == SIZE_Nx2N || m_pePartSize[absPartIdx] == SIZE_nLx2N || m_pePartSize[absPartIdx] == SIZE_nRx2N )? trHeight << 1 : trHeight >> 1; |
---|
2829 | } |
---|
2830 | |
---|
2831 | nsTUWidthInBaseUnits = trWidth / getPic()->getMinCUWidth(); |
---|
2832 | nsTUHeightInBaseUnits = trHeight / getPic()->getMinCUHeight(); |
---|
2833 | |
---|
2834 | if ( nsTUWidthInBaseUnits > nsTUHeightInBaseUnits ) |
---|
2835 | { |
---|
2836 | UInt currPartNumb = nsTUHeightInBaseUnits*nsTUHeightInBaseUnits; |
---|
2837 | memset( m_nsqtPartIdx + absTUPartIdx , absPartIdx, sizeof(UChar)*(currPartNumb) ); |
---|
2838 | memset( m_nsqtPartIdx + g_auiRasterToZscan[g_auiZscanToRaster[absTUPartIdx]+ nsTUHeightInBaseUnits], absPartIdx, sizeof(UChar)*(currPartNumb) ); |
---|
2839 | memset( m_nsqtPartIdx + g_auiRasterToZscan[g_auiZscanToRaster[absTUPartIdx]+2*nsTUHeightInBaseUnits], absPartIdx, sizeof(UChar)*(currPartNumb) ); |
---|
2840 | memset( m_nsqtPartIdx + g_auiRasterToZscan[g_auiZscanToRaster[absTUPartIdx]+3*nsTUHeightInBaseUnits], absPartIdx, sizeof(UChar)*(currPartNumb) ); |
---|
2841 | } |
---|
2842 | else if ( nsTUWidthInBaseUnits < nsTUHeightInBaseUnits ) |
---|
2843 | { |
---|
2844 | UInt currPartNumb = nsTUWidthInBaseUnits*nsTUWidthInBaseUnits; |
---|
2845 | memset( m_nsqtPartIdx + absTUPartIdx , absPartIdx, sizeof(UChar)*(currPartNumb) ); |
---|
2846 | memset( m_nsqtPartIdx + g_auiRasterToZscan[g_auiZscanToRaster[absTUPartIdx]+ nsTUWidthInBaseUnits*lcuWidthInBaseUnits], absPartIdx, sizeof(UChar)*(currPartNumb) ); |
---|
2847 | memset( m_nsqtPartIdx + g_auiRasterToZscan[g_auiZscanToRaster[absTUPartIdx]+2*nsTUWidthInBaseUnits*lcuWidthInBaseUnits], absPartIdx, sizeof(UChar)*(currPartNumb) ); |
---|
2848 | memset( m_nsqtPartIdx + g_auiRasterToZscan[g_auiZscanToRaster[absTUPartIdx]+3*nsTUWidthInBaseUnits*lcuWidthInBaseUnits], absPartIdx, sizeof(UChar)*(currPartNumb) ); |
---|
2849 | } |
---|
2850 | else |
---|
2851 | { |
---|
2852 | UInt currPartNumb = nsTUWidthInBaseUnits*nsTUHeightInBaseUnits; |
---|
2853 | memset( m_nsqtPartIdx + absTUPartIdx, absPartIdx, sizeof(UChar)*(currPartNumb) ); |
---|
2854 | } |
---|
2855 | } |
---|
2856 | |
---|
2857 | Void TComDataCU::setSizeSubParts( UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2858 | { |
---|
2859 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
2860 | |
---|
2861 | memset( m_puhWidth + uiAbsPartIdx, uiWidth, sizeof(UChar)*uiCurrPartNumb ); |
---|
2862 | memset( m_puhHeight + uiAbsPartIdx, uiHeight, sizeof(UChar)*uiCurrPartNumb ); |
---|
2863 | } |
---|
2864 | |
---|
2865 | UChar TComDataCU::getNumPartInter() |
---|
2866 | { |
---|
2867 | UChar iNumPart = 0; |
---|
2868 | |
---|
2869 | switch ( m_pePartSize[0] ) |
---|
2870 | { |
---|
2871 | case SIZE_2Nx2N: iNumPart = 1; break; |
---|
2872 | case SIZE_2NxN: iNumPart = 2; break; |
---|
2873 | case SIZE_Nx2N: iNumPart = 2; break; |
---|
2874 | case SIZE_NxN: iNumPart = 4; break; |
---|
2875 | case SIZE_2NxnU: iNumPart = 2; break; |
---|
2876 | case SIZE_2NxnD: iNumPart = 2; break; |
---|
2877 | case SIZE_nLx2N: iNumPart = 2; break; |
---|
2878 | case SIZE_nRx2N: iNumPart = 2; break; |
---|
2879 | default: assert (0); break; |
---|
2880 | } |
---|
2881 | |
---|
2882 | return iNumPart; |
---|
2883 | } |
---|
2884 | |
---|
2885 | #if LG_RESTRICTEDRESPRED_M24766 |
---|
2886 | Void TComDataCU::getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx, Bool bLCU) |
---|
2887 | { |
---|
2888 | UInt uiNumPartition = bLCU ? (getWidth(uiAbsPartIdx)*getHeight(uiAbsPartIdx) >> 4) : m_uiNumPartition; |
---|
2889 | UInt uiTmpAbsPartIdx = bLCU ? uiAbsPartIdx : 0; |
---|
2890 | |
---|
2891 | switch ( m_pePartSize[uiTmpAbsPartIdx] ) |
---|
2892 | { |
---|
2893 | case SIZE_2NxN: |
---|
2894 | riWidth = getWidth(uiTmpAbsPartIdx); riHeight = getHeight(uiTmpAbsPartIdx) >> 1; ruiPartAddr = ( uiPartIdx == 0 )? 0 : uiNumPartition >> 1; |
---|
2895 | break; |
---|
2896 | case SIZE_Nx2N: |
---|
2897 | riWidth = getWidth(uiTmpAbsPartIdx) >> 1; riHeight = getHeight(uiTmpAbsPartIdx); ruiPartAddr = ( uiPartIdx == 0 )? 0 : uiNumPartition >> 2; |
---|
2898 | break; |
---|
2899 | case SIZE_NxN: |
---|
2900 | riWidth = getWidth(uiTmpAbsPartIdx) >> 1; riHeight = getHeight(uiTmpAbsPartIdx) >> 1; ruiPartAddr = ( uiNumPartition >> 2 ) * uiPartIdx; |
---|
2901 | break; |
---|
2902 | case SIZE_2NxnU: |
---|
2903 | riWidth = getWidth(uiTmpAbsPartIdx); |
---|
2904 | riHeight = ( uiPartIdx == 0 ) ? getHeight(uiTmpAbsPartIdx) >> 2 : ( getHeight(uiTmpAbsPartIdx) >> 2 ) + ( getHeight(uiTmpAbsPartIdx) >> 1 ); |
---|
2905 | ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : uiNumPartition >> 3; |
---|
2906 | break; |
---|
2907 | case SIZE_2NxnD: |
---|
2908 | riWidth = getWidth(uiTmpAbsPartIdx); |
---|
2909 | riHeight = ( uiPartIdx == 0 ) ? ( getHeight(uiTmpAbsPartIdx) >> 2 ) + ( getHeight(uiTmpAbsPartIdx) >> 1 ) : getHeight(uiTmpAbsPartIdx) >> 2; |
---|
2910 | ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : (uiNumPartition >> 1) + (uiNumPartition >> 3); |
---|
2911 | break; |
---|
2912 | case SIZE_nLx2N: |
---|
2913 | riWidth = ( uiPartIdx == 0 ) ? getWidth(uiTmpAbsPartIdx) >> 2 : ( getWidth(uiTmpAbsPartIdx) >> 2 ) + ( getWidth(uiTmpAbsPartIdx) >> 1 ); |
---|
2914 | riHeight = getHeight(uiTmpAbsPartIdx); |
---|
2915 | ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : uiNumPartition >> 4; |
---|
2916 | break; |
---|
2917 | case SIZE_nRx2N: |
---|
2918 | riWidth = ( uiPartIdx == 0 ) ? ( getWidth(uiTmpAbsPartIdx) >> 2 ) + ( getWidth(uiTmpAbsPartIdx) >> 1 ) : getWidth(uiTmpAbsPartIdx) >> 2; |
---|
2919 | riHeight = getHeight(uiTmpAbsPartIdx); |
---|
2920 | ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : (uiNumPartition >> 2) + (uiNumPartition >> 4); |
---|
2921 | break; |
---|
2922 | default: |
---|
2923 | #if HHI_FIX |
---|
2924 | assert ( m_pePartSize[uiTmpAbsPartIdx ] == SIZE_2Nx2N ); |
---|
2925 | #else |
---|
2926 | assert ( m_pePartSize[0] == SIZE_2Nx2N ); |
---|
2927 | #endif |
---|
2928 | riWidth = getWidth(uiTmpAbsPartIdx); riHeight = getHeight(uiTmpAbsPartIdx); ruiPartAddr = 0; |
---|
2929 | break; |
---|
2930 | } |
---|
2931 | } |
---|
2932 | #else |
---|
2933 | Void TComDataCU::getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight ) |
---|
2934 | { |
---|
2935 | switch ( m_pePartSize[0] ) |
---|
2936 | { |
---|
2937 | case SIZE_2NxN: |
---|
2938 | riWidth = getWidth(0); riHeight = getHeight(0) >> 1; ruiPartAddr = ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 1; |
---|
2939 | break; |
---|
2940 | case SIZE_Nx2N: |
---|
2941 | riWidth = getWidth(0) >> 1; riHeight = getHeight(0); ruiPartAddr = ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 2; |
---|
2942 | break; |
---|
2943 | case SIZE_NxN: |
---|
2944 | riWidth = getWidth(0) >> 1; riHeight = getHeight(0) >> 1; ruiPartAddr = ( m_uiNumPartition >> 2 ) * uiPartIdx; |
---|
2945 | break; |
---|
2946 | case SIZE_2NxnU: |
---|
2947 | riWidth = getWidth(0); |
---|
2948 | riHeight = ( uiPartIdx == 0 ) ? getHeight(0) >> 2 : ( getHeight(0) >> 2 ) + ( getHeight(0) >> 1 ); |
---|
2949 | ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : m_uiNumPartition >> 3; |
---|
2950 | break; |
---|
2951 | case SIZE_2NxnD: |
---|
2952 | riWidth = getWidth(0); |
---|
2953 | riHeight = ( uiPartIdx == 0 ) ? ( getHeight(0) >> 2 ) + ( getHeight(0) >> 1 ) : getHeight(0) >> 2; |
---|
2954 | ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : (m_uiNumPartition >> 1) + (m_uiNumPartition >> 3); |
---|
2955 | break; |
---|
2956 | case SIZE_nLx2N: |
---|
2957 | riWidth = ( uiPartIdx == 0 ) ? getWidth(0) >> 2 : ( getWidth(0) >> 2 ) + ( getWidth(0) >> 1 ); |
---|
2958 | riHeight = getHeight(0); |
---|
2959 | ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : m_uiNumPartition >> 4; |
---|
2960 | break; |
---|
2961 | case SIZE_nRx2N: |
---|
2962 | riWidth = ( uiPartIdx == 0 ) ? ( getWidth(0) >> 2 ) + ( getWidth(0) >> 1 ) : getWidth(0) >> 2; |
---|
2963 | riHeight = getHeight(0); |
---|
2964 | ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : (m_uiNumPartition >> 2) + (m_uiNumPartition >> 4); |
---|
2965 | break; |
---|
2966 | default: |
---|
2967 | assert ( m_pePartSize[0] == SIZE_2Nx2N ); |
---|
2968 | riWidth = getWidth(0); riHeight = getHeight(0); ruiPartAddr = 0; |
---|
2969 | break; |
---|
2970 | } |
---|
2971 | } |
---|
2972 | #endif |
---|
2973 | |
---|
2974 | #if LG_RESTRICTEDRESPRED_M24766 |
---|
2975 | Int TComDataCU::getResiPredMode(UInt uiPartAddr) |
---|
2976 | { |
---|
2977 | Int iAddResiShift = -1; |
---|
2978 | |
---|
2979 | for(UInt uiRefIdx = 0; uiRefIdx < 2; uiRefIdx++) |
---|
2980 | { |
---|
2981 | RefPicList eRefList = uiRefIdx ? REF_PIC_LIST_1 : REF_PIC_LIST_0; |
---|
2982 | Int iBestRefIdx = getCUMvField(eRefList)->getRefIdx(uiPartAddr); |
---|
2983 | if(iBestRefIdx >= 0 && getSlice()->getViewId() == getSlice()->getRefViewId(eRefList, iBestRefIdx)) |
---|
2984 | iAddResiShift++; |
---|
2985 | } |
---|
2986 | |
---|
2987 | return iAddResiShift; |
---|
2988 | } |
---|
2989 | |
---|
2990 | Void TComDataCU::getPUResiPredShift(Int *iPUResiPredShift, UInt uiAbsPartIndex) |
---|
2991 | { |
---|
2992 | UInt uiPartSize = getPartitionSize(uiAbsPartIndex); |
---|
2993 | UInt uiPartAddr; |
---|
2994 | Int iWidth, iHeight; |
---|
2995 | Int iAddResiShift; |
---|
2996 | |
---|
2997 | if(uiPartSize == SIZE_2Nx2N) |
---|
2998 | { |
---|
2999 | iAddResiShift = getResiPredMode(uiAbsPartIndex); |
---|
3000 | for(UInt i = 0; i < 4; i++) |
---|
3001 | iPUResiPredShift[i] = (getSlice()->getPPS()->getUseWP() || getInterDir(uiAbsPartIndex) != 3) ? (iAddResiShift >= 0 ? 0 : -1) : (iAddResiShift >= 0 ? 1-iAddResiShift : -1); |
---|
3002 | return; |
---|
3003 | } |
---|
3004 | |
---|
3005 | if(uiPartSize == SIZE_2NxN || uiPartSize == SIZE_2NxnU || uiPartSize == SIZE_2NxnD) |
---|
3006 | { |
---|
3007 | for(UInt i = 0; i < 2; i++) |
---|
3008 | { |
---|
3009 | getPartIndexAndSize(i, uiPartAddr, iWidth, iHeight, uiAbsPartIndex, true); |
---|
3010 | uiPartAddr += uiAbsPartIndex; |
---|
3011 | iAddResiShift = getResiPredMode(uiPartAddr); |
---|
3012 | iPUResiPredShift[2*i] = iPUResiPredShift[2*i+1] = (getSlice()->getPPS()->getUseWP() || getInterDir(uiPartAddr) != 3) ? (iAddResiShift >= 0 ? 0 : -1) : (iAddResiShift >= 0 ? 1-iAddResiShift : -1); |
---|
3013 | } |
---|
3014 | return; |
---|
3015 | } |
---|
3016 | |
---|
3017 | if(uiPartSize == SIZE_Nx2N || uiPartSize == SIZE_nLx2N || uiPartSize == SIZE_nRx2N) |
---|
3018 | { |
---|
3019 | for(UInt i = 0; i < 2; i++) |
---|
3020 | { |
---|
3021 | getPartIndexAndSize(i, uiPartAddr, iWidth, iHeight, uiAbsPartIndex, true); |
---|
3022 | uiPartAddr += uiAbsPartIndex; |
---|
3023 | iAddResiShift = getResiPredMode(uiPartAddr); |
---|
3024 | iPUResiPredShift[i] = iPUResiPredShift[2+i] = (getSlice()->getPPS()->getUseWP() || getInterDir(uiPartAddr) != 3) ? (iAddResiShift >= 0 ? 0 : -1) : (iAddResiShift >= 0 ? 1-iAddResiShift : -1); |
---|
3025 | } |
---|
3026 | return; |
---|
3027 | } |
---|
3028 | |
---|
3029 | if(uiPartSize == SIZE_NxN) |
---|
3030 | { |
---|
3031 | for(UInt i = 0; i < 4; i++) |
---|
3032 | { |
---|
3033 | getPartIndexAndSize(i, uiPartAddr, iWidth, iHeight, uiAbsPartIndex, true); |
---|
3034 | uiPartAddr += uiAbsPartIndex; |
---|
3035 | iAddResiShift = getResiPredMode(uiPartAddr); |
---|
3036 | iPUResiPredShift[i] = (getSlice()->getPPS()->getUseWP() || getInterDir(uiPartAddr) != 3) ? (iAddResiShift >= 0 ? 0 : -1) : (iAddResiShift >= 0 ? 1-iAddResiShift : -1); |
---|
3037 | } |
---|
3038 | } |
---|
3039 | |
---|
3040 | } |
---|
3041 | #endif |
---|
3042 | |
---|
3043 | Void TComDataCU::getMvField ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, TComMvField& rcMvField ) |
---|
3044 | { |
---|
3045 | if ( pcCU == NULL ) // OUT OF BOUNDARY |
---|
3046 | { |
---|
3047 | TComMv cZeroMv; |
---|
3048 | rcMvField.setMvField( cZeroMv, NOT_VALID ); |
---|
3049 | return; |
---|
3050 | } |
---|
3051 | |
---|
3052 | TComCUMvField* pcCUMvField = pcCU->getCUMvField( eRefPicList ); |
---|
3053 | rcMvField.setMvField( pcCUMvField->getMv( uiAbsPartIdx ), pcCUMvField->getRefIdx( uiAbsPartIdx ) ); |
---|
3054 | } |
---|
3055 | |
---|
3056 | Void TComDataCU::deriveLeftRightTopIdxGeneral ( PartSize eCUMode, UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ) |
---|
3057 | { |
---|
3058 | ruiPartIdxLT = m_uiAbsIdxInLCU + uiAbsPartIdx; |
---|
3059 | UInt uiPUWidth = 0; |
---|
3060 | |
---|
3061 | switch ( m_pePartSize[uiAbsPartIdx] ) |
---|
3062 | { |
---|
3063 | case SIZE_2Nx2N: uiPUWidth = m_puhWidth[uiAbsPartIdx]; break; |
---|
3064 | case SIZE_2NxN: uiPUWidth = m_puhWidth[uiAbsPartIdx]; break; |
---|
3065 | case SIZE_Nx2N: uiPUWidth = m_puhWidth[uiAbsPartIdx] >> 1; break; |
---|
3066 | case SIZE_NxN: uiPUWidth = m_puhWidth[uiAbsPartIdx] >> 1; break; |
---|
3067 | case SIZE_2NxnU: uiPUWidth = m_puhWidth[uiAbsPartIdx]; break; |
---|
3068 | case SIZE_2NxnD: uiPUWidth = m_puhWidth[uiAbsPartIdx]; break; |
---|
3069 | case SIZE_nLx2N: |
---|
3070 | if ( uiPartIdx == 0 ) |
---|
3071 | { |
---|
3072 | uiPUWidth = m_puhWidth[uiAbsPartIdx] >> 2; |
---|
3073 | } |
---|
3074 | else if ( uiPartIdx == 1 ) |
---|
3075 | { |
---|
3076 | uiPUWidth = (m_puhWidth[uiAbsPartIdx] >> 1) + (m_puhWidth[uiAbsPartIdx] >> 2); |
---|
3077 | } |
---|
3078 | else |
---|
3079 | { |
---|
3080 | assert(0); |
---|
3081 | } |
---|
3082 | break; |
---|
3083 | case SIZE_nRx2N: |
---|
3084 | if ( uiPartIdx == 0 ) |
---|
3085 | { |
---|
3086 | uiPUWidth = (m_puhWidth[uiAbsPartIdx] >> 1) + (m_puhWidth[uiAbsPartIdx] >> 2); |
---|
3087 | } |
---|
3088 | else if ( uiPartIdx == 1 ) |
---|
3089 | { |
---|
3090 | uiPUWidth = m_puhWidth[uiAbsPartIdx] >> 2; |
---|
3091 | } |
---|
3092 | else |
---|
3093 | { |
---|
3094 | assert(0); |
---|
3095 | } |
---|
3096 | break; |
---|
3097 | default: |
---|
3098 | assert (0); |
---|
3099 | break; |
---|
3100 | } |
---|
3101 | |
---|
3102 | ruiPartIdxRT = g_auiRasterToZscan [g_auiZscanToRaster[ ruiPartIdxLT ] + uiPUWidth / m_pcPic->getMinCUWidth() - 1 ]; |
---|
3103 | } |
---|
3104 | |
---|
3105 | Void TComDataCU::deriveLeftBottomIdxGeneral( PartSize eCUMode, UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB ) |
---|
3106 | { |
---|
3107 | UInt uiPUHeight = 0; |
---|
3108 | switch ( m_pePartSize[uiAbsPartIdx] ) |
---|
3109 | { |
---|
3110 | case SIZE_2Nx2N: uiPUHeight = m_puhHeight[uiAbsPartIdx]; break; |
---|
3111 | case SIZE_2NxN: uiPUHeight = m_puhHeight[uiAbsPartIdx] >> 1; break; |
---|
3112 | case SIZE_Nx2N: uiPUHeight = m_puhHeight[uiAbsPartIdx]; break; |
---|
3113 | case SIZE_NxN: uiPUHeight = m_puhHeight[uiAbsPartIdx] >> 1; break; |
---|
3114 | case SIZE_2NxnU: |
---|
3115 | if ( uiPartIdx == 0 ) |
---|
3116 | { |
---|
3117 | uiPUHeight = m_puhHeight[uiAbsPartIdx] >> 2; |
---|
3118 | } |
---|
3119 | else if ( uiPartIdx == 1 ) |
---|
3120 | { |
---|
3121 | uiPUHeight = (m_puhHeight[uiAbsPartIdx] >> 1) + (m_puhHeight[uiAbsPartIdx] >> 2); |
---|
3122 | } |
---|
3123 | else |
---|
3124 | { |
---|
3125 | assert(0); |
---|
3126 | } |
---|
3127 | break; |
---|
3128 | case SIZE_2NxnD: |
---|
3129 | if ( uiPartIdx == 0 ) |
---|
3130 | { |
---|
3131 | uiPUHeight = (m_puhHeight[uiAbsPartIdx] >> 1) + (m_puhHeight[uiAbsPartIdx] >> 2); |
---|
3132 | } |
---|
3133 | else if ( uiPartIdx == 1 ) |
---|
3134 | { |
---|
3135 | uiPUHeight = m_puhHeight[uiAbsPartIdx] >> 2; |
---|
3136 | } |
---|
3137 | else |
---|
3138 | { |
---|
3139 | assert(0); |
---|
3140 | } |
---|
3141 | break; |
---|
3142 | case SIZE_nLx2N: uiPUHeight = m_puhHeight[uiAbsPartIdx]; break; |
---|
3143 | case SIZE_nRx2N: uiPUHeight = m_puhHeight[uiAbsPartIdx]; break; |
---|
3144 | default: |
---|
3145 | assert (0); |
---|
3146 | break; |
---|
3147 | } |
---|
3148 | |
---|
3149 | ruiPartIdxLB = g_auiRasterToZscan [g_auiZscanToRaster[ m_uiAbsIdxInLCU + uiAbsPartIdx ] + ((uiPUHeight / m_pcPic->getMinCUHeight()) - 1)*m_pcPic->getNumPartInWidth()]; |
---|
3150 | } |
---|
3151 | |
---|
3152 | Void TComDataCU::deriveLeftRightTopIdx ( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ) |
---|
3153 | { |
---|
3154 | ruiPartIdxLT = m_uiAbsIdxInLCU; |
---|
3155 | ruiPartIdxRT = g_auiRasterToZscan [g_auiZscanToRaster[ ruiPartIdxLT ] + m_puhWidth[0] / m_pcPic->getMinCUWidth() - 1 ]; |
---|
3156 | |
---|
3157 | switch ( m_pePartSize[0] ) |
---|
3158 | { |
---|
3159 | case SIZE_2Nx2N: break; |
---|
3160 | case SIZE_2NxN: |
---|
3161 | ruiPartIdxLT += ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 1; ruiPartIdxRT += ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 1; |
---|
3162 | break; |
---|
3163 | case SIZE_Nx2N: |
---|
3164 | ruiPartIdxLT += ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 2; ruiPartIdxRT -= ( uiPartIdx == 1 )? 0 : m_uiNumPartition >> 2; |
---|
3165 | break; |
---|
3166 | case SIZE_NxN: |
---|
3167 | ruiPartIdxLT += ( m_uiNumPartition >> 2 ) * uiPartIdx; ruiPartIdxRT += ( m_uiNumPartition >> 2 ) * ( uiPartIdx - 1 ); |
---|
3168 | break; |
---|
3169 | case SIZE_2NxnU: |
---|
3170 | ruiPartIdxLT += ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 3; |
---|
3171 | ruiPartIdxRT += ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 3; |
---|
3172 | break; |
---|
3173 | case SIZE_2NxnD: |
---|
3174 | ruiPartIdxLT += ( uiPartIdx == 0 )? 0 : ( m_uiNumPartition >> 1 ) + ( m_uiNumPartition >> 3 ); |
---|
3175 | ruiPartIdxRT += ( uiPartIdx == 0 )? 0 : ( m_uiNumPartition >> 1 ) + ( m_uiNumPartition >> 3 ); |
---|
3176 | break; |
---|
3177 | case SIZE_nLx2N: |
---|
3178 | ruiPartIdxLT += ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 4; |
---|
3179 | ruiPartIdxRT -= ( uiPartIdx == 1 )? 0 : ( m_uiNumPartition >> 2 ) + ( m_uiNumPartition >> 4 ); |
---|
3180 | break; |
---|
3181 | case SIZE_nRx2N: |
---|
3182 | ruiPartIdxLT += ( uiPartIdx == 0 )? 0 : ( m_uiNumPartition >> 2 ) + ( m_uiNumPartition >> 4 ); |
---|
3183 | ruiPartIdxRT -= ( uiPartIdx == 1 )? 0 : m_uiNumPartition >> 4; |
---|
3184 | break; |
---|
3185 | default: |
---|
3186 | assert (0); |
---|
3187 | break; |
---|
3188 | } |
---|
3189 | |
---|
3190 | } |
---|
3191 | |
---|
3192 | Void TComDataCU::deriveLeftBottomIdx( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxLB ) |
---|
3193 | { |
---|
3194 | ruiPartIdxLB = g_auiRasterToZscan [g_auiZscanToRaster[ m_uiAbsIdxInLCU ] + ( ((m_puhHeight[0] / m_pcPic->getMinCUHeight())>>1) - 1)*m_pcPic->getNumPartInWidth()]; |
---|
3195 | |
---|
3196 | switch ( m_pePartSize[0] ) |
---|
3197 | { |
---|
3198 | case SIZE_2Nx2N: |
---|
3199 | ruiPartIdxLB += m_uiNumPartition >> 1; |
---|
3200 | break; |
---|
3201 | case SIZE_2NxN: |
---|
3202 | ruiPartIdxLB += ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 1; |
---|
3203 | break; |
---|
3204 | case SIZE_Nx2N: |
---|
3205 | ruiPartIdxLB += ( uiPartIdx == 0 )? m_uiNumPartition >> 1 : (m_uiNumPartition >> 2)*3; |
---|
3206 | break; |
---|
3207 | case SIZE_NxN: |
---|
3208 | ruiPartIdxLB += ( m_uiNumPartition >> 2 ) * uiPartIdx; |
---|
3209 | break; |
---|
3210 | case SIZE_2NxnU: |
---|
3211 | ruiPartIdxLB += ( uiPartIdx == 0 ) ? -((Int)m_uiNumPartition >> 3) : m_uiNumPartition >> 1; |
---|
3212 | break; |
---|
3213 | case SIZE_2NxnD: |
---|
3214 | ruiPartIdxLB += ( uiPartIdx == 0 ) ? (m_uiNumPartition >> 2) + (m_uiNumPartition >> 3): m_uiNumPartition >> 1; |
---|
3215 | break; |
---|
3216 | case SIZE_nLx2N: |
---|
3217 | ruiPartIdxLB += ( uiPartIdx == 0 ) ? m_uiNumPartition >> 1 : (m_uiNumPartition >> 1) + (m_uiNumPartition >> 4); |
---|
3218 | break; |
---|
3219 | case SIZE_nRx2N: |
---|
3220 | ruiPartIdxLB += ( uiPartIdx == 0 ) ? m_uiNumPartition >> 1 : (m_uiNumPartition >> 1) + (m_uiNumPartition >> 2) + (m_uiNumPartition >> 4); |
---|
3221 | break; |
---|
3222 | default: |
---|
3223 | assert (0); |
---|
3224 | break; |
---|
3225 | } |
---|
3226 | } |
---|
3227 | |
---|
3228 | /** Derives the partition index of neighbouring bottom right block |
---|
3229 | * \param [in] eCUMode |
---|
3230 | * \param [in] uiPartIdx |
---|
3231 | * \param [out] ruiPartIdxRB |
---|
3232 | */ |
---|
3233 | Void TComDataCU::deriveRightBottomIdx( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxRB ) |
---|
3234 | { |
---|
3235 | 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]; |
---|
3236 | |
---|
3237 | switch ( m_pePartSize[0] ) |
---|
3238 | { |
---|
3239 | case SIZE_2Nx2N: |
---|
3240 | ruiPartIdxRB += m_uiNumPartition >> 1; |
---|
3241 | break; |
---|
3242 | case SIZE_2NxN: |
---|
3243 | ruiPartIdxRB += ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 1; |
---|
3244 | break; |
---|
3245 | case SIZE_Nx2N: |
---|
3246 | ruiPartIdxRB += ( uiPartIdx == 0 )? m_uiNumPartition >> 2 : (m_uiNumPartition >> 1); |
---|
3247 | break; |
---|
3248 | case SIZE_NxN: |
---|
3249 | ruiPartIdxRB += ( m_uiNumPartition >> 2 ) * ( uiPartIdx - 1 ); |
---|
3250 | break; |
---|
3251 | case SIZE_2NxnU: |
---|
3252 | ruiPartIdxRB += ( uiPartIdx == 0 ) ? -((Int)m_uiNumPartition >> 3) : m_uiNumPartition >> 1; |
---|
3253 | break; |
---|
3254 | case SIZE_2NxnD: |
---|
3255 | ruiPartIdxRB += ( uiPartIdx == 0 ) ? (m_uiNumPartition >> 2) + (m_uiNumPartition >> 3): m_uiNumPartition >> 1; |
---|
3256 | break; |
---|
3257 | case SIZE_nLx2N: |
---|
3258 | ruiPartIdxRB += ( uiPartIdx == 0 ) ? (m_uiNumPartition >> 3) + (m_uiNumPartition >> 4): m_uiNumPartition >> 1; |
---|
3259 | break; |
---|
3260 | case SIZE_nRx2N: |
---|
3261 | ruiPartIdxRB += ( uiPartIdx == 0 ) ? (m_uiNumPartition >> 2) + (m_uiNumPartition >> 3) + (m_uiNumPartition >> 4) : m_uiNumPartition >> 1; |
---|
3262 | break; |
---|
3263 | default: |
---|
3264 | assert (0); |
---|
3265 | break; |
---|
3266 | } |
---|
3267 | } |
---|
3268 | |
---|
3269 | Void TComDataCU::deriveLeftRightTopIdxAdi ( UInt& ruiPartIdxLT, UInt& ruiPartIdxRT, UInt uiPartOffset, UInt uiPartDepth ) |
---|
3270 | { |
---|
3271 | UInt uiNumPartInWidth = (m_puhWidth[0]/m_pcPic->getMinCUWidth())>>uiPartDepth; |
---|
3272 | ruiPartIdxLT = m_uiAbsIdxInLCU + uiPartOffset; |
---|
3273 | ruiPartIdxRT = g_auiRasterToZscan[ g_auiZscanToRaster[ ruiPartIdxLT ] + uiNumPartInWidth - 1 ]; |
---|
3274 | } |
---|
3275 | |
---|
3276 | Void TComDataCU::deriveLeftBottomIdxAdi( UInt& ruiPartIdxLB, UInt uiPartOffset, UInt uiPartDepth ) |
---|
3277 | { |
---|
3278 | UInt uiAbsIdx; |
---|
3279 | UInt uiMinCuWidth, uiWidthInMinCus; |
---|
3280 | |
---|
3281 | uiMinCuWidth = getPic()->getMinCUWidth(); |
---|
3282 | uiWidthInMinCus = (getWidth(0)/uiMinCuWidth)>>uiPartDepth; |
---|
3283 | uiAbsIdx = getZorderIdxInCU()+uiPartOffset+(m_uiNumPartition>>(uiPartDepth<<1))-1; |
---|
3284 | uiAbsIdx = g_auiZscanToRaster[uiAbsIdx]-(uiWidthInMinCus-1); |
---|
3285 | ruiPartIdxLB = g_auiRasterToZscan[uiAbsIdx]; |
---|
3286 | } |
---|
3287 | |
---|
3288 | Bool TComDataCU::hasEqualMotion( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx ) |
---|
3289 | { |
---|
3290 | |
---|
3291 | if ( getInterDir( uiAbsPartIdx ) != pcCandCU->getInterDir( uiCandAbsPartIdx ) ) |
---|
3292 | { |
---|
3293 | return false; |
---|
3294 | } |
---|
3295 | |
---|
3296 | for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) |
---|
3297 | { |
---|
3298 | if ( getInterDir( uiAbsPartIdx ) & ( 1 << uiRefListIdx ) ) |
---|
3299 | { |
---|
3300 | if ( getCUMvField( RefPicList( uiRefListIdx ) )->getMv( uiAbsPartIdx ) != pcCandCU->getCUMvField( RefPicList( uiRefListIdx ) )->getMv( uiCandAbsPartIdx ) || |
---|
3301 | getCUMvField( RefPicList( uiRefListIdx ) )->getRefIdx( uiAbsPartIdx ) != pcCandCU->getCUMvField( RefPicList( uiRefListIdx ) )->getRefIdx( uiCandAbsPartIdx ) ) |
---|
3302 | { |
---|
3303 | return false; |
---|
3304 | } |
---|
3305 | } |
---|
3306 | } |
---|
3307 | |
---|
3308 | return true; |
---|
3309 | } |
---|
3310 | |
---|
3311 | /** Constructs a list of merging candidates |
---|
3312 | * \param uiAbsPartIdx |
---|
3313 | * \param uiPUIdx |
---|
3314 | * \param uiDepth |
---|
3315 | * \param pcMvFieldNeighbours |
---|
3316 | * \param puhInterDirNeighbours |
---|
3317 | * \param numValidMergeCand |
---|
3318 | */ |
---|
3319 | #if SIMP_MRG_PRUN |
---|
3320 | Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx ) |
---|
3321 | #else |
---|
3322 | Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand ) |
---|
3323 | #endif |
---|
3324 | { |
---|
3325 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
3326 | const Int extraMergeCand = ( getSlice()->getSPS()->getMultiviewMvPredMode() ? 1 : 0 ); |
---|
3327 | #endif |
---|
3328 | |
---|
3329 | UInt uiAbsPartAddr = m_uiAbsIdxInLCU + uiAbsPartIdx; |
---|
3330 | UInt uiIdx = 1; |
---|
3331 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
3332 | bool abCandIsInter[ MRG_MAX_NUM_CANDS_MEM ]; |
---|
3333 | for( UInt ui = 0; ui < MRG_MAX_NUM_CANDS_MEM; ++ui ) |
---|
3334 | #else |
---|
3335 | bool abCandIsInter[ MRG_MAX_NUM_CANDS ]; |
---|
3336 | for( UInt ui = 0; ui < MRG_MAX_NUM_CANDS; ++ui ) |
---|
3337 | #endif |
---|
3338 | { |
---|
3339 | abCandIsInter[ui] = false; |
---|
3340 | } |
---|
3341 | // compute the location of the current PU |
---|
3342 | #if PARALLEL_MERGE |
---|
3343 | Int xP, yP, nPSW, nPSH; |
---|
3344 | this->getPartPosition(uiPUIdx, xP, yP, nPSW, nPSH); |
---|
3345 | #endif |
---|
3346 | |
---|
3347 | Int iCount = 0; |
---|
3348 | |
---|
3349 | UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB; |
---|
3350 | PartSize cCurPS = getPartitionSize( uiAbsPartIdx ); |
---|
3351 | deriveLeftRightTopIdxGeneral( cCurPS, uiAbsPartIdx, uiPUIdx, uiPartIdxLT, uiPartIdxRT ); |
---|
3352 | deriveLeftBottomIdxGeneral( cCurPS, uiAbsPartIdx, uiPUIdx, uiPartIdxLB ); |
---|
3353 | |
---|
3354 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
3355 | Bool bNoPdmMerge = ( m_pcSlice->getSPS()->getViewId() == 0 || ( m_pcSlice->getSPS()->getMultiviewMvPredMode() & PDM_USE_FOR_MERGE ) != PDM_USE_FOR_MERGE ); |
---|
3356 | |
---|
3357 | //===== add merge with predicted depth maps ===== |
---|
3358 | TComMv acPdmMv [2]; |
---|
3359 | Int aiPdmRefIdx [2] = {-1, -1}; |
---|
3360 | #if QC_MULTI_DIS_CAN |
---|
3361 | DisInfo cDisInfo; |
---|
3362 | cDisInfo.iN = 0; |
---|
3363 | if(!bNoPdmMerge) |
---|
3364 | getDisMvpCand (uiPUIdx, uiAbsPartIdx, &cDisInfo ); |
---|
3365 | if(cDisInfo.iN==0) |
---|
3366 | { |
---|
3367 | cDisInfo.iN = 1; |
---|
3368 | cDisInfo.m_acMvCand[0].setHor(0); |
---|
3369 | cDisInfo.m_acMvCand[0].setVer(0); |
---|
3370 | cDisInfo.m_aVIdxCan[0] = 0; |
---|
3371 | } |
---|
3372 | Int iPdmInterDir = cDisInfo.iN==0? 0:getPdmMergeCandidateDisCan ( uiPUIdx, aiPdmRefIdx, acPdmMv, &cDisInfo ); |
---|
3373 | #else |
---|
3374 | Int iPdmInterDir = getPdmMergeCandidate( uiPUIdx, aiPdmRefIdx, acPdmMv ); |
---|
3375 | #endif |
---|
3376 | |
---|
3377 | if( iPdmInterDir && !bNoPdmMerge && PDM_MERGE_POS == 0 ) |
---|
3378 | { |
---|
3379 | abCandIsInter [ iCount ] = true; |
---|
3380 | puhInterDirNeighbours[ iCount ] = iPdmInterDir; |
---|
3381 | if( ( iPdmInterDir & 1 ) == 1 ) |
---|
3382 | { |
---|
3383 | pcMvFieldNeighbours[ iCount<<1 ].setMvField( acPdmMv[ 0 ], aiPdmRefIdx[ 0 ] ); |
---|
3384 | } |
---|
3385 | if( ( iPdmInterDir & 2 ) == 2 ) |
---|
3386 | { |
---|
3387 | pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 1 ], aiPdmRefIdx[ 1 ] ); |
---|
3388 | } |
---|
3389 | #if SIMP_MRG_PRUN |
---|
3390 | if ( mrgCandIdx == iCount ) |
---|
3391 | { |
---|
3392 | return; |
---|
3393 | } |
---|
3394 | #endif |
---|
3395 | iCount ++; |
---|
3396 | } |
---|
3397 | #endif |
---|
3398 | |
---|
3399 | //left |
---|
3400 | UInt uiLeftPartIdx = 0; |
---|
3401 | TComDataCU* pcCULeft = 0; |
---|
3402 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
3403 | pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB, true, false ); |
---|
3404 | #else |
---|
3405 | pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB ); |
---|
3406 | #endif |
---|
3407 | #if PARALLEL_MERGE |
---|
3408 | if (pcCULeft) |
---|
3409 | { |
---|
3410 | if (!pcCULeft->isDiffMER(xP -1, yP+nPSH-1, xP, yP)) |
---|
3411 | { |
---|
3412 | pcCULeft = NULL; |
---|
3413 | } |
---|
3414 | } |
---|
3415 | #endif |
---|
3416 | PartSize partSize = getPartitionSize( uiAbsPartIdx ); |
---|
3417 | if (!(uiPUIdx == 1 && (partSize == SIZE_Nx2N || partSize == SIZE_nLx2N || partSize == SIZE_nRx2N))) |
---|
3418 | { |
---|
3419 | if ( pcCULeft && !pcCULeft->isIntra( uiLeftPartIdx ) ) |
---|
3420 | { |
---|
3421 | abCandIsInter[iCount] = true; |
---|
3422 | // get Inter Dir |
---|
3423 | puhInterDirNeighbours[iCount] = pcCULeft->getInterDir( uiLeftPartIdx ); |
---|
3424 | // get Mv from Left |
---|
3425 | pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); |
---|
3426 | if ( getSlice()->isInterB() ) |
---|
3427 | { |
---|
3428 | pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); |
---|
3429 | } |
---|
3430 | #if SIMP_MRG_PRUN |
---|
3431 | if ( mrgCandIdx == iCount ) |
---|
3432 | { |
---|
3433 | return; |
---|
3434 | } |
---|
3435 | #endif |
---|
3436 | iCount ++; |
---|
3437 | } |
---|
3438 | } |
---|
3439 | |
---|
3440 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
3441 | if( iPdmInterDir && !bNoPdmMerge && PDM_MERGE_POS == 1 ) |
---|
3442 | { |
---|
3443 | abCandIsInter [ iCount ] = true; |
---|
3444 | puhInterDirNeighbours[ iCount ] = iPdmInterDir; |
---|
3445 | if( ( iPdmInterDir & 1 ) == 1 ) |
---|
3446 | { |
---|
3447 | pcMvFieldNeighbours[ iCount<<1 ].setMvField( acPdmMv[ 0 ], aiPdmRefIdx[ 0 ] ); |
---|
3448 | } |
---|
3449 | if( ( iPdmInterDir & 2 ) == 2 ) |
---|
3450 | { |
---|
3451 | pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 1 ], aiPdmRefIdx[ 1 ] ); |
---|
3452 | } |
---|
3453 | #if SIMP_MRG_PRUN |
---|
3454 | if ( mrgCandIdx == iCount ) |
---|
3455 | { |
---|
3456 | return; |
---|
3457 | } |
---|
3458 | #endif |
---|
3459 | iCount ++; |
---|
3460 | } |
---|
3461 | #endif |
---|
3462 | |
---|
3463 | // above |
---|
3464 | #if !SIMP_MRG_PRUN |
---|
3465 | partSize = getPartitionSize( uiAbsPartIdx ); |
---|
3466 | if (!(uiPUIdx == 1 && (partSize == SIZE_2NxN || partSize == SIZE_2NxnU || partSize == SIZE_2NxnD))) |
---|
3467 | { |
---|
3468 | #endif |
---|
3469 | UInt uiAbovePartIdx = 0; |
---|
3470 | TComDataCU* pcCUAbove = 0; |
---|
3471 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
3472 | pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT, true, false, true ); |
---|
3473 | #else |
---|
3474 | pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT, true, true, true ); |
---|
3475 | #endif |
---|
3476 | #if PARALLEL_MERGE |
---|
3477 | if (pcCUAbove) |
---|
3478 | { |
---|
3479 | if (!pcCUAbove->isDiffMER(xP+nPSW-1, yP-1, xP, yP)) |
---|
3480 | { |
---|
3481 | pcCUAbove = NULL; |
---|
3482 | } |
---|
3483 | } |
---|
3484 | #endif |
---|
3485 | #if SIMP_MRG_PRUN |
---|
3486 | if ( pcCUAbove && !pcCUAbove->isIntra( uiAbovePartIdx ) |
---|
3487 | && !(uiPUIdx == 1 && (cCurPS == SIZE_2NxN || cCurPS == SIZE_2NxnU || cCurPS == SIZE_2NxnD)) |
---|
3488 | && ( !pcCULeft || pcCULeft->isIntra( uiLeftPartIdx ) || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAbove, uiAbovePartIdx ) ) ) |
---|
3489 | #else |
---|
3490 | if ( pcCUAbove && !pcCUAbove->isIntra( uiAbovePartIdx ) ) |
---|
3491 | #endif |
---|
3492 | { |
---|
3493 | abCandIsInter[iCount] = true; |
---|
3494 | // get Inter Dir |
---|
3495 | puhInterDirNeighbours[iCount] = pcCUAbove->getInterDir( uiAbovePartIdx ); |
---|
3496 | // get Mv from Left |
---|
3497 | pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); |
---|
3498 | if ( getSlice()->isInterB() ) |
---|
3499 | { |
---|
3500 | pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); |
---|
3501 | } |
---|
3502 | #if SIMP_MRG_PRUN |
---|
3503 | if ( mrgCandIdx == iCount ) |
---|
3504 | { |
---|
3505 | return; |
---|
3506 | } |
---|
3507 | #endif |
---|
3508 | iCount ++; |
---|
3509 | } |
---|
3510 | #if !SIMP_MRG_PRUN |
---|
3511 | } |
---|
3512 | #endif |
---|
3513 | |
---|
3514 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
3515 | if( iPdmInterDir && !bNoPdmMerge && PDM_MERGE_POS == 2 ) |
---|
3516 | { |
---|
3517 | abCandIsInter [ iCount ] = true; |
---|
3518 | puhInterDirNeighbours[ iCount ] = iPdmInterDir; |
---|
3519 | if( ( iPdmInterDir & 1 ) == 1 ) |
---|
3520 | { |
---|
3521 | pcMvFieldNeighbours[ iCount<<1 ].setMvField( acPdmMv[ 0 ], aiPdmRefIdx[ 0 ] ); |
---|
3522 | } |
---|
3523 | if( ( iPdmInterDir & 2 ) == 2 ) |
---|
3524 | { |
---|
3525 | pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 1 ], aiPdmRefIdx[ 1 ] ); |
---|
3526 | } |
---|
3527 | #if SIMP_MRG_PRUN |
---|
3528 | if ( mrgCandIdx == iCount ) |
---|
3529 | { |
---|
3530 | return; |
---|
3531 | } |
---|
3532 | #endif |
---|
3533 | iCount ++; |
---|
3534 | } |
---|
3535 | #endif |
---|
3536 | |
---|
3537 | // above right |
---|
3538 | UInt uiAboveRightPartIdx = 0; |
---|
3539 | TComDataCU* pcCUAboveRight = 0; |
---|
3540 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
3541 | pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT, true, false, true ); |
---|
3542 | #else |
---|
3543 | pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT, true, true, true); |
---|
3544 | #endif |
---|
3545 | #if PARALLEL_MERGE |
---|
3546 | if (pcCUAboveRight) |
---|
3547 | { |
---|
3548 | if (!pcCUAboveRight->isDiffMER(xP+nPSW, yP-1, xP, yP)) |
---|
3549 | { |
---|
3550 | pcCUAboveRight = NULL; |
---|
3551 | } |
---|
3552 | } |
---|
3553 | #endif |
---|
3554 | #if SIMP_MRG_PRUN |
---|
3555 | if ( pcCUAboveRight && !pcCUAboveRight->isIntra( uiAboveRightPartIdx ) && ( !pcCUAbove || pcCUAbove->isIntra( uiAbovePartIdx ) || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveRight, uiAboveRightPartIdx ) ) ) |
---|
3556 | #else |
---|
3557 | if ( pcCUAboveRight && !pcCUAboveRight->isIntra( uiAboveRightPartIdx ) ) |
---|
3558 | #endif |
---|
3559 | { |
---|
3560 | abCandIsInter[iCount] = true; |
---|
3561 | // get Inter Dir |
---|
3562 | puhInterDirNeighbours[iCount] = pcCUAboveRight->getInterDir( uiAboveRightPartIdx ); |
---|
3563 | // get Mv from Left |
---|
3564 | pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); |
---|
3565 | if ( getSlice()->isInterB() ) |
---|
3566 | { |
---|
3567 | pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); |
---|
3568 | } |
---|
3569 | #if SIMP_MRG_PRUN |
---|
3570 | if ( mrgCandIdx == iCount ) |
---|
3571 | { |
---|
3572 | return; |
---|
3573 | } |
---|
3574 | #endif |
---|
3575 | iCount ++; |
---|
3576 | } |
---|
3577 | |
---|
3578 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
3579 | if( iPdmInterDir && !bNoPdmMerge && PDM_MERGE_POS == 3 ) |
---|
3580 | { |
---|
3581 | abCandIsInter [ iCount ] = true; |
---|
3582 | puhInterDirNeighbours[ iCount ] = iPdmInterDir; |
---|
3583 | if( ( iPdmInterDir & 1 ) == 1 ) |
---|
3584 | { |
---|
3585 | pcMvFieldNeighbours[ iCount<<1 ].setMvField( acPdmMv[ 0 ], aiPdmRefIdx[ 0 ] ); |
---|
3586 | } |
---|
3587 | if( ( iPdmInterDir & 2 ) == 2 ) |
---|
3588 | { |
---|
3589 | pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 1 ], aiPdmRefIdx[ 1 ] ); |
---|
3590 | } |
---|
3591 | #if SIMP_MRG_PRUN |
---|
3592 | if ( mrgCandIdx == iCount ) |
---|
3593 | { |
---|
3594 | return; |
---|
3595 | } |
---|
3596 | #endif |
---|
3597 | iCount ++; |
---|
3598 | } |
---|
3599 | #endif |
---|
3600 | |
---|
3601 | //left bottom |
---|
3602 | UInt uiLeftBottomPartIdx = 0; |
---|
3603 | TComDataCU* pcCULeftBottom = 0; |
---|
3604 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
3605 | pcCULeftBottom = this->getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB, true, false ); |
---|
3606 | #else |
---|
3607 | pcCULeftBottom = this->getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB ); |
---|
3608 | #endif |
---|
3609 | #if PARALLEL_MERGE |
---|
3610 | if (pcCULeftBottom) |
---|
3611 | { |
---|
3612 | if (!pcCULeftBottom->isDiffMER(xP-1, yP+nPSH, xP, yP)) |
---|
3613 | { |
---|
3614 | pcCULeftBottom = NULL; |
---|
3615 | } |
---|
3616 | } |
---|
3617 | #endif |
---|
3618 | #if SIMP_MRG_PRUN |
---|
3619 | if ( pcCULeftBottom && !pcCULeftBottom->isIntra( uiLeftBottomPartIdx ) && ( !pcCULeft || pcCULeft->isIntra( uiLeftPartIdx ) || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCULeftBottom, uiLeftBottomPartIdx ) ) ) |
---|
3620 | #else |
---|
3621 | if ( pcCULeftBottom && !pcCULeftBottom->isIntra( uiLeftBottomPartIdx ) ) |
---|
3622 | #endif |
---|
3623 | { |
---|
3624 | abCandIsInter[iCount] = true; |
---|
3625 | // get Inter Dir |
---|
3626 | puhInterDirNeighbours[iCount] = pcCULeftBottom->getInterDir( uiLeftBottomPartIdx ); |
---|
3627 | // get Mv from Left |
---|
3628 | pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); |
---|
3629 | if ( getSlice()->isInterB() ) |
---|
3630 | { |
---|
3631 | pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); |
---|
3632 | } |
---|
3633 | #if SIMP_MRG_PRUN |
---|
3634 | if ( mrgCandIdx == iCount ) |
---|
3635 | { |
---|
3636 | return; |
---|
3637 | } |
---|
3638 | #endif |
---|
3639 | iCount ++; |
---|
3640 | } |
---|
3641 | |
---|
3642 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
3643 | if( iPdmInterDir && !bNoPdmMerge && PDM_MERGE_POS == 4 ) |
---|
3644 | { |
---|
3645 | abCandIsInter [ iCount ] = true; |
---|
3646 | puhInterDirNeighbours[ iCount ] = iPdmInterDir; |
---|
3647 | if( ( iPdmInterDir & 1 ) == 1 ) |
---|
3648 | { |
---|
3649 | pcMvFieldNeighbours[ iCount<<1 ].setMvField( acPdmMv[ 0 ], aiPdmRefIdx[ 0 ] ); |
---|
3650 | } |
---|
3651 | if( ( iPdmInterDir & 2 ) == 2 ) |
---|
3652 | { |
---|
3653 | pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 1 ], aiPdmRefIdx[ 1 ] ); |
---|
3654 | } |
---|
3655 | #if SIMP_MRG_PRUN |
---|
3656 | if ( mrgCandIdx == iCount ) |
---|
3657 | { |
---|
3658 | return; |
---|
3659 | } |
---|
3660 | #endif |
---|
3661 | iCount ++; |
---|
3662 | } |
---|
3663 | #endif |
---|
3664 | |
---|
3665 | // above left |
---|
3666 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
3667 | if( iCount < 4 + extraMergeCand ) |
---|
3668 | #else |
---|
3669 | if( iCount < 4 ) |
---|
3670 | #endif |
---|
3671 | { |
---|
3672 | UInt uiAboveLeftPartIdx = 0; |
---|
3673 | TComDataCU* pcCUAboveLeft = 0; |
---|
3674 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
3675 | pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr, true, false, true ); |
---|
3676 | #else |
---|
3677 | pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr, true, true, true ); |
---|
3678 | #endif |
---|
3679 | #if PARALLEL_MERGE |
---|
3680 | if (pcCUAboveLeft) |
---|
3681 | { |
---|
3682 | if (!pcCUAboveLeft->isDiffMER(xP-1, yP-1, xP, yP)) |
---|
3683 | { |
---|
3684 | pcCUAboveLeft = NULL; |
---|
3685 | } |
---|
3686 | } |
---|
3687 | #endif |
---|
3688 | #if SIMP_MRG_PRUN |
---|
3689 | if( pcCUAboveLeft && !pcCUAboveLeft->isIntra( uiAboveLeftPartIdx ) |
---|
3690 | && ( !pcCULeft || pcCULeft->isIntra( uiLeftPartIdx ) || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) ) |
---|
3691 | && ( !pcCUAbove || pcCUAbove->isIntra( uiAbovePartIdx ) || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) ) |
---|
3692 | ) |
---|
3693 | #else |
---|
3694 | if( pcCUAboveLeft && !pcCUAboveLeft->isIntra( uiAboveLeftPartIdx ) ) |
---|
3695 | #endif |
---|
3696 | { |
---|
3697 | abCandIsInter[iCount] = true; |
---|
3698 | // get Inter Dir |
---|
3699 | puhInterDirNeighbours[iCount] = pcCUAboveLeft->getInterDir( uiAboveLeftPartIdx ); |
---|
3700 | // get Mv from Left |
---|
3701 | pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); |
---|
3702 | if ( getSlice()->isInterB() ) |
---|
3703 | { |
---|
3704 | pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); |
---|
3705 | } |
---|
3706 | #if SIMP_MRG_PRUN |
---|
3707 | if ( mrgCandIdx == iCount ) |
---|
3708 | { |
---|
3709 | return; |
---|
3710 | } |
---|
3711 | #endif |
---|
3712 | iCount ++; |
---|
3713 | } |
---|
3714 | } |
---|
3715 | |
---|
3716 | if ( getSlice()->getPPS()->getEnableTMVPFlag() ) |
---|
3717 | { |
---|
3718 | // col [2] |
---|
3719 | Int iRefIdxSkip[2] = {-1, -1}; |
---|
3720 | for (Int i=0; i<2; i++) |
---|
3721 | { |
---|
3722 | RefPicList eRefPicList = ( i==1 ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); |
---|
3723 | #if SET_MERGE_TMVP_REFIDX |
---|
3724 | Int iRefIdxTmp; |
---|
3725 | if ( uiPUIdx != 0 ) |
---|
3726 | { |
---|
3727 | iRefIdxTmp = 0; |
---|
3728 | } |
---|
3729 | else |
---|
3730 | { |
---|
3731 | iRefIdxTmp = (pcCULeft != NULL) ? pcCULeft->getCUMvField(eRefPicList)->getRefIdx(uiLeftPartIdx) : -1; |
---|
3732 | } |
---|
3733 | #else |
---|
3734 | Int iRefIdxTmp = (pcCULeft != NULL) ? pcCULeft->getCUMvField(eRefPicList)->getRefIdx(uiLeftPartIdx) : -1; |
---|
3735 | #endif |
---|
3736 | iRefIdxSkip[i] = (iRefIdxTmp != -1) ? iRefIdxTmp : 0; |
---|
3737 | } |
---|
3738 | //>> MTK colocated-RightBottom |
---|
3739 | UInt uiPartIdxRB; |
---|
3740 | Int uiLCUIdx = getAddr(); |
---|
3741 | PartSize eCUMode = getPartitionSize( 0 ); |
---|
3742 | |
---|
3743 | deriveRightBottomIdx( eCUMode, uiPUIdx, uiPartIdxRB ); |
---|
3744 | |
---|
3745 | UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB]; |
---|
3746 | UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); |
---|
3747 | |
---|
3748 | TComMv cColMv; |
---|
3749 | Int iRefIdx; |
---|
3750 | |
---|
3751 | if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) // image boundary check |
---|
3752 | { |
---|
3753 | uiLCUIdx = -1; |
---|
3754 | } |
---|
3755 | else if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples() ) |
---|
3756 | { |
---|
3757 | uiLCUIdx = -1; |
---|
3758 | } |
---|
3759 | else |
---|
3760 | { |
---|
3761 | if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) && // is not at the last column of LCU |
---|
3762 | ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row of LCU |
---|
3763 | { |
---|
3764 | uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ]; |
---|
3765 | uiLCUIdx = getAddr(); |
---|
3766 | } |
---|
3767 | else if ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) // is not at the last column of LCU But is last row of LCU |
---|
3768 | { |
---|
3769 | uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ]; |
---|
3770 | uiLCUIdx = -1 ; |
---|
3771 | } |
---|
3772 | else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU |
---|
3773 | { |
---|
3774 | uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ]; |
---|
3775 | uiLCUIdx = getAddr() + 1; |
---|
3776 | } |
---|
3777 | else //is the right bottom corner of LCU |
---|
3778 | { |
---|
3779 | uiAbsPartAddr = 0; |
---|
3780 | uiLCUIdx = -1 ; |
---|
3781 | } |
---|
3782 | } |
---|
3783 | iRefIdx = iRefIdxSkip[0]; |
---|
3784 | |
---|
3785 | Bool bExistMV = false; |
---|
3786 | UInt uiPartIdxCenter; |
---|
3787 | UInt uiCurLCUIdx = getAddr(); |
---|
3788 | xDeriveCenterIdx( eCUMode, uiPUIdx, uiPartIdxCenter ); |
---|
3789 | bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_0, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx ); |
---|
3790 | if( bExistMV == false ) |
---|
3791 | { |
---|
3792 | bExistMV = xGetColMVP( REF_PIC_LIST_0, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx ); |
---|
3793 | } |
---|
3794 | if( bExistMV ) |
---|
3795 | { |
---|
3796 | UInt uiArrayAddr = iCount; |
---|
3797 | abCandIsInter[uiArrayAddr] = true; |
---|
3798 | pcMvFieldNeighbours[uiArrayAddr << 1].setMvField( cColMv, iRefIdx ); |
---|
3799 | |
---|
3800 | if ( getSlice()->isInterB() ) |
---|
3801 | { |
---|
3802 | iRefIdx = iRefIdxSkip[1]; |
---|
3803 | bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_1, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx); |
---|
3804 | if( bExistMV == false ) |
---|
3805 | { |
---|
3806 | bExistMV = xGetColMVP( REF_PIC_LIST_1, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx ); |
---|
3807 | } |
---|
3808 | if( bExistMV ) |
---|
3809 | { |
---|
3810 | pcMvFieldNeighbours[ ( uiArrayAddr << 1 ) + 1 ].setMvField( cColMv, iRefIdx ); |
---|
3811 | puhInterDirNeighbours[uiArrayAddr] = 3; |
---|
3812 | } |
---|
3813 | else |
---|
3814 | { |
---|
3815 | puhInterDirNeighbours[uiArrayAddr] = 1; |
---|
3816 | } |
---|
3817 | } |
---|
3818 | else |
---|
3819 | { |
---|
3820 | puhInterDirNeighbours[uiArrayAddr] = 1; |
---|
3821 | } |
---|
3822 | #if SIMP_MRG_PRUN |
---|
3823 | if ( mrgCandIdx == iCount ) |
---|
3824 | { |
---|
3825 | return; |
---|
3826 | } |
---|
3827 | iCount++; |
---|
3828 | #endif |
---|
3829 | } |
---|
3830 | uiIdx++; |
---|
3831 | |
---|
3832 | } |
---|
3833 | |
---|
3834 | #if SIMP_MRG_PRUN |
---|
3835 | UInt uiArrayAddr = iCount; |
---|
3836 | #else |
---|
3837 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
3838 | for( UInt uiOuter = 0; uiOuter < MRG_MAX_NUM_CANDS_MEM; uiOuter++ ) |
---|
3839 | #else |
---|
3840 | for( UInt uiOuter = 0; uiOuter < MRG_MAX_NUM_CANDS; uiOuter++ ) |
---|
3841 | #endif |
---|
3842 | { |
---|
3843 | if( abCandIsInter[ uiOuter ] ) |
---|
3844 | { |
---|
3845 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
3846 | for( UInt uiIter = uiOuter + 1; uiIter < MRG_MAX_NUM_CANDS_MEM; uiIter++ ) |
---|
3847 | #else |
---|
3848 | for( UInt uiIter = uiOuter + 1; uiIter < MRG_MAX_NUM_CANDS; uiIter++ ) |
---|
3849 | #endif |
---|
3850 | { |
---|
3851 | UInt uiMvFieldNeighIdxCurr = uiOuter << 1; |
---|
3852 | UInt uiMvFieldNeighIdxComp = uiIter << 1; |
---|
3853 | if( getSlice()->isInterB() ) |
---|
3854 | { |
---|
3855 | if( puhInterDirNeighbours[ uiOuter ] == 3 ) |
---|
3856 | { |
---|
3857 | if( pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getRefIdx() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getRefIdx() && pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr + 1 ].getRefIdx() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp + 1 ].getRefIdx() && |
---|
3858 | pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getMv() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getMv() && pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr + 1 ].getMv() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp + 1 ].getMv() && |
---|
3859 | puhInterDirNeighbours[ uiOuter ] == puhInterDirNeighbours[ uiIter ] ) |
---|
3860 | { |
---|
3861 | abCandIsInter[ uiIter ] = false; |
---|
3862 | } |
---|
3863 | } |
---|
3864 | else if( puhInterDirNeighbours[ uiOuter ] == 2 ) |
---|
3865 | { |
---|
3866 | if( pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr + 1 ].getRefIdx() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp + 1 ].getRefIdx() && |
---|
3867 | pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr + 1 ].getMv() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp + 1 ].getMv() && |
---|
3868 | puhInterDirNeighbours[ uiOuter ] == puhInterDirNeighbours[ uiIter ] ) |
---|
3869 | { |
---|
3870 | abCandIsInter[ uiIter ] = false; |
---|
3871 | } |
---|
3872 | } |
---|
3873 | else |
---|
3874 | { |
---|
3875 | if( pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getRefIdx() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getRefIdx() && |
---|
3876 | pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getMv() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getMv() && |
---|
3877 | puhInterDirNeighbours[ uiOuter ] == puhInterDirNeighbours[ uiIter ] ) |
---|
3878 | { |
---|
3879 | abCandIsInter[ uiIter ] = false; |
---|
3880 | } |
---|
3881 | } |
---|
3882 | } |
---|
3883 | else |
---|
3884 | { |
---|
3885 | if( pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getRefIdx() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getRefIdx() && |
---|
3886 | pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getMv() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getMv() ) |
---|
3887 | { |
---|
3888 | assert( puhInterDirNeighbours[ uiOuter ] == puhInterDirNeighbours[ uiIter ] ); |
---|
3889 | abCandIsInter[ uiIter ] = false; |
---|
3890 | } |
---|
3891 | } |
---|
3892 | } |
---|
3893 | } |
---|
3894 | } |
---|
3895 | |
---|
3896 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
3897 | bool abCandIsInterFlag[MRG_MAX_NUM_CANDS_MEM]; |
---|
3898 | for (int i=0; i<MRG_MAX_NUM_CANDS_MEM; i++) |
---|
3899 | #else |
---|
3900 | bool abCandIsInterFlag[MRG_MAX_NUM_CANDS]; |
---|
3901 | for (int i=0; i<MRG_MAX_NUM_CANDS; i++) |
---|
3902 | #endif |
---|
3903 | { |
---|
3904 | abCandIsInterFlag[i] = abCandIsInter[ i ]; |
---|
3905 | abCandIsInter[ i ] = false; |
---|
3906 | } |
---|
3907 | |
---|
3908 | UInt uiArrayAddr = 0; |
---|
3909 | |
---|
3910 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
3911 | for (int i=0; i<MRG_MAX_NUM_CANDS_MEM; i++) |
---|
3912 | #else |
---|
3913 | for (int i=0; i<MRG_MAX_NUM_CANDS; i++) |
---|
3914 | #endif |
---|
3915 | { |
---|
3916 | if (abCandIsInterFlag[i]) |
---|
3917 | { |
---|
3918 | abCandIsInter[uiArrayAddr] = true; |
---|
3919 | puhInterDirNeighbours[uiArrayAddr] = puhInterDirNeighbours[i]; |
---|
3920 | pcMvFieldNeighbours[uiArrayAddr<<1].setMvField(pcMvFieldNeighbours[i<<1].getMv(), pcMvFieldNeighbours[i<<1].getRefIdx()); |
---|
3921 | pcMvFieldNeighbours[(uiArrayAddr<<1)+1].setMvField(pcMvFieldNeighbours[(i<<1)+1].getMv(), pcMvFieldNeighbours[(i<<1)+1].getRefIdx()); |
---|
3922 | ++uiArrayAddr; |
---|
3923 | } |
---|
3924 | } |
---|
3925 | |
---|
3926 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
3927 | for (int i=uiArrayAddr; i<MRG_MAX_NUM_CANDS_MEM; i++) |
---|
3928 | #else |
---|
3929 | for (int i=uiArrayAddr; i<MRG_MAX_NUM_CANDS; i++) |
---|
3930 | #endif |
---|
3931 | { |
---|
3932 | puhInterDirNeighbours[i] = (getSlice()->isInterB()) ? 3 : 1; |
---|
3933 | abCandIsInter[i] = false; |
---|
3934 | TComMv tmpMv; |
---|
3935 | tmpMv.set(0,0); |
---|
3936 | pcMvFieldNeighbours[i<<1].setMvField(tmpMv, 0); |
---|
3937 | if ( getSlice()->isInterB() ) |
---|
3938 | { |
---|
3939 | pcMvFieldNeighbours[(i<<1)+1].setMvField(tmpMv, 0); |
---|
3940 | } |
---|
3941 | } |
---|
3942 | #endif |
---|
3943 | UInt uiCutoff = uiArrayAddr; |
---|
3944 | |
---|
3945 | if ( getSlice()->isInterB() ) |
---|
3946 | { |
---|
3947 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
3948 | Int iCombinedCount = 0; |
---|
3949 | Int iMaxCombCount = ( extraMergeCand ? 6 : 5 ); |
---|
3950 | Int iMaxIdx = ( extraMergeCand ? 20 : 12 ); |
---|
3951 | UInt uiPriorityList0[20] = {0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3, 0, 4, 1, 4, 2, 4, 3, 4 }; |
---|
3952 | UInt uiPriorityList1[20] = {1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2, 4, 0, 4, 1, 4, 2, 4, 3 }; |
---|
3953 | |
---|
3954 | for (Int idx=0; idx<uiCutoff*(uiCutoff-1) && uiArrayAddr!=MRG_MAX_NUM_CANDS_MEM && iCombinedCount<iMaxCombCount && idx < iMaxIdx; idx++) |
---|
3955 | #else |
---|
3956 | Int iCombinedCount = 0; |
---|
3957 | UInt uiPriorityList0[12] = {0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3}; |
---|
3958 | UInt uiPriorityList1[12] = {1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2}; |
---|
3959 | |
---|
3960 | for (Int idx=0; idx<uiCutoff*(uiCutoff-1) && uiArrayAddr!=MRG_MAX_NUM_CANDS && iCombinedCount<5 && idx < 12; idx++) |
---|
3961 | #endif |
---|
3962 | { |
---|
3963 | Int i = uiPriorityList0[idx]; Int j = uiPriorityList1[idx]; |
---|
3964 | if (abCandIsInter[i] && abCandIsInter[j]&& (puhInterDirNeighbours[i]&0x1)&&(puhInterDirNeighbours[j]&0x2)) |
---|
3965 | { |
---|
3966 | abCandIsInter[uiArrayAddr] = true; |
---|
3967 | puhInterDirNeighbours[uiArrayAddr] = 3; |
---|
3968 | |
---|
3969 | // get Mv from cand[i] and cand[j] |
---|
3970 | pcMvFieldNeighbours[uiArrayAddr << 1].setMvField(pcMvFieldNeighbours[i<<1].getMv(), pcMvFieldNeighbours[i<<1].getRefIdx()); |
---|
3971 | pcMvFieldNeighbours[( uiArrayAddr << 1 ) + 1].setMvField(pcMvFieldNeighbours[(j<<1)+1].getMv(), pcMvFieldNeighbours[(j<<1)+1].getRefIdx()); |
---|
3972 | |
---|
3973 | Int iRefPOCL0 = m_pcSlice->getRefPOC ( REF_PIC_LIST_0, pcMvFieldNeighbours[(uiArrayAddr<<1)].getRefIdx() ); |
---|
3974 | Int iRefViewIdL0 = m_pcSlice->getRefViewId( REF_PIC_LIST_0, pcMvFieldNeighbours[(uiArrayAddr<<1)].getRefIdx() ); |
---|
3975 | Int iRefPOCL1 = m_pcSlice->getRefPOC ( REF_PIC_LIST_1, pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getRefIdx() ); |
---|
3976 | Int iRefViewIdL1 = m_pcSlice->getRefViewId( REF_PIC_LIST_1, pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getRefIdx() ); |
---|
3977 | if(iRefPOCL0 == iRefPOCL1 && iRefViewIdL0 == iRefViewIdL1 && pcMvFieldNeighbours[(uiArrayAddr<<1)].getMv() == pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getMv()) |
---|
3978 | { |
---|
3979 | abCandIsInter[uiArrayAddr] = false; |
---|
3980 | } |
---|
3981 | else |
---|
3982 | { |
---|
3983 | uiArrayAddr++; |
---|
3984 | iCombinedCount++; |
---|
3985 | } |
---|
3986 | } |
---|
3987 | } |
---|
3988 | #if !REMOVE_NON_SCALED |
---|
3989 | Int iScaledCount = 0; |
---|
3990 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
3991 | for (int i=0; i<uiCutoff && uiArrayAddr!=MRG_MAX_NUM_CANDS_MEM && iScaledCount<1; i++) |
---|
3992 | #else |
---|
3993 | for (int i=0; i<uiCutoff && uiArrayAddr!=MRG_MAX_NUM_CANDS && iScaledCount<1; i++) |
---|
3994 | #endif |
---|
3995 | { |
---|
3996 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
3997 | for (int j=0; j<2 && uiArrayAddr!=MRG_MAX_NUM_CANDS_MEM && iScaledCount<1; j++) |
---|
3998 | #else |
---|
3999 | for (int j=0; j<2 && uiArrayAddr!=MRG_MAX_NUM_CANDS && iScaledCount<1; j++) |
---|
4000 | #endif |
---|
4001 | { |
---|
4002 | if (abCandIsInter[i] && pcMvFieldNeighbours[(i<<1)+j].getRefIdx()>=0 && pcMvFieldNeighbours[(i<<1)+j].getRefIdx() < m_pcSlice->getNumRefIdx((j==0)?REF_PIC_LIST_1:REF_PIC_LIST_0)) |
---|
4003 | { |
---|
4004 | Int iCurrPOC = m_pcSlice->getPOC(); |
---|
4005 | Int iCurrRefPOC1 = m_pcSlice->getRefPOC( (j==0)?REF_PIC_LIST_1:REF_PIC_LIST_0, pcMvFieldNeighbours[(i<<1)+j].getRefIdx() ); |
---|
4006 | Int iCurrRefPOC2 = m_pcSlice->getRefPOC( (j==0)?REF_PIC_LIST_0:REF_PIC_LIST_1, pcMvFieldNeighbours[(i<<1)+j].getRefIdx() ); |
---|
4007 | |
---|
4008 | if (iCurrRefPOC1 != iCurrRefPOC2 && abs(iCurrPOC-iCurrRefPOC1) == abs(iCurrPOC-iCurrRefPOC2)) |
---|
4009 | { |
---|
4010 | abCandIsInter[uiArrayAddr] = true; |
---|
4011 | puhInterDirNeighbours[uiArrayAddr] = 3; |
---|
4012 | |
---|
4013 | TComMv cMvPred = pcMvFieldNeighbours[(i<<1)+j].getMv(); |
---|
4014 | TComMv rcMv; |
---|
4015 | |
---|
4016 | rcMv.set(-1*cMvPred.getHor(), -1*cMvPred.getVer()); |
---|
4017 | |
---|
4018 | if (j==0) |
---|
4019 | { |
---|
4020 | pcMvFieldNeighbours[uiArrayAddr << 1].setMvField(pcMvFieldNeighbours[(i<<1)].getMv(), pcMvFieldNeighbours[(i<<1)].getRefIdx()); |
---|
4021 | pcMvFieldNeighbours[( uiArrayAddr << 1 ) + 1].setMvField(rcMv, pcMvFieldNeighbours[(i<<1)].getRefIdx()); |
---|
4022 | } |
---|
4023 | else |
---|
4024 | { |
---|
4025 | pcMvFieldNeighbours[uiArrayAddr << 1].setMvField(rcMv, pcMvFieldNeighbours[(i<<1)+1].getRefIdx()); |
---|
4026 | pcMvFieldNeighbours[( uiArrayAddr << 1 ) + 1].setMvField(pcMvFieldNeighbours[(i<<1)+1].getMv(), pcMvFieldNeighbours[(i<<1)+1].getRefIdx()); |
---|
4027 | } |
---|
4028 | |
---|
4029 | uiArrayAddr++; |
---|
4030 | iScaledCount++; |
---|
4031 | } |
---|
4032 | } |
---|
4033 | } |
---|
4034 | } |
---|
4035 | #endif |
---|
4036 | } |
---|
4037 | |
---|
4038 | 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); |
---|
4039 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
4040 | for (int r=0; r<iNumRefIdx && uiArrayAddr!=MRG_MAX_NUM_CANDS_MEM; r++) |
---|
4041 | #else |
---|
4042 | for (int r=0; r<iNumRefIdx && uiArrayAddr!=MRG_MAX_NUM_CANDS; r++) |
---|
4043 | #endif |
---|
4044 | { |
---|
4045 | abCandIsInter[uiArrayAddr] = true; |
---|
4046 | puhInterDirNeighbours[uiArrayAddr] = 1; |
---|
4047 | pcMvFieldNeighbours[uiArrayAddr << 1].setMvField( TComMv(0, 0), r); |
---|
4048 | |
---|
4049 | if ( getSlice()->isInterB() ) |
---|
4050 | { |
---|
4051 | puhInterDirNeighbours[uiArrayAddr] = 3; |
---|
4052 | pcMvFieldNeighbours[(uiArrayAddr << 1) + 1].setMvField(TComMv(0, 0), r); |
---|
4053 | } |
---|
4054 | uiArrayAddr++; |
---|
4055 | } |
---|
4056 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
4057 | if (uiArrayAddr > MRG_MAX_NUM_CANDS_SIGNALED + extraMergeCand ) |
---|
4058 | { |
---|
4059 | uiArrayAddr = MRG_MAX_NUM_CANDS_SIGNALED + extraMergeCand; |
---|
4060 | } |
---|
4061 | #else |
---|
4062 | if (uiArrayAddr > MRG_MAX_NUM_CANDS_SIGNALED) |
---|
4063 | { |
---|
4064 | uiArrayAddr = MRG_MAX_NUM_CANDS_SIGNALED; |
---|
4065 | } |
---|
4066 | #endif |
---|
4067 | numValidMergeCand = uiArrayAddr; |
---|
4068 | } |
---|
4069 | |
---|
4070 | /** Check the duplicated candidate in the list |
---|
4071 | * \param pcMvFieldNeighbours |
---|
4072 | * \param puhInterDirNeighbours |
---|
4073 | * \param pbCandIsInter |
---|
4074 | * \param ruiArrayAddr |
---|
4075 | * \returns Void |
---|
4076 | */ |
---|
4077 | Void TComDataCU::xCheckDuplicateCand(TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, bool* pbCandIsInter, UInt& ruiArrayAddr) |
---|
4078 | { |
---|
4079 | if (getSlice()->isInterB()) |
---|
4080 | { |
---|
4081 | UInt uiMvFieldNeighIdxCurr = ruiArrayAddr << 1; |
---|
4082 | Int iRefIdxL0 = pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getRefIdx(); |
---|
4083 | Int iRefIdxL1 = pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr + 1 ].getRefIdx(); |
---|
4084 | TComMv MvL0 = pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getMv(); |
---|
4085 | TComMv MvL1 = pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr + 1 ].getMv(); |
---|
4086 | |
---|
4087 | for (int k=0; k<ruiArrayAddr; k++) |
---|
4088 | { |
---|
4089 | UInt uiMvFieldNeighIdxComp = k << 1; |
---|
4090 | if (iRefIdxL0 == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getRefIdx() && |
---|
4091 | iRefIdxL1 == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp + 1 ].getRefIdx() && |
---|
4092 | MvL0 == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getMv() && |
---|
4093 | MvL1 == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp + 1 ].getMv() && |
---|
4094 | puhInterDirNeighbours[ ruiArrayAddr ] == puhInterDirNeighbours[ k ] ) |
---|
4095 | { |
---|
4096 | pbCandIsInter[ruiArrayAddr] = false; |
---|
4097 | break; |
---|
4098 | } |
---|
4099 | } |
---|
4100 | } |
---|
4101 | else |
---|
4102 | { |
---|
4103 | UInt uiMvFieldNeighIdxCurr = ruiArrayAddr << 1; |
---|
4104 | Int iRefIdxL0 = pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getRefIdx(); |
---|
4105 | TComMv MvL0 = pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getMv(); |
---|
4106 | |
---|
4107 | for (int k=0; k<ruiArrayAddr; k++) |
---|
4108 | { |
---|
4109 | UInt uiMvFieldNeighIdxComp = k << 1; |
---|
4110 | if (iRefIdxL0 == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getRefIdx() && |
---|
4111 | MvL0 == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getMv() && |
---|
4112 | puhInterDirNeighbours[ ruiArrayAddr ] == puhInterDirNeighbours[ k ] ) |
---|
4113 | { |
---|
4114 | pbCandIsInter[ruiArrayAddr] = false; |
---|
4115 | break; |
---|
4116 | } |
---|
4117 | } |
---|
4118 | } |
---|
4119 | |
---|
4120 | if (pbCandIsInter[ruiArrayAddr]) |
---|
4121 | { |
---|
4122 | ++ruiArrayAddr; |
---|
4123 | } |
---|
4124 | } |
---|
4125 | |
---|
4126 | Void TComDataCU::xCheckCornerCand( TComDataCU* pcCorner, UInt uiCornerPUIdx, UInt uiIter, Bool& rbValidCand ) |
---|
4127 | { |
---|
4128 | if( uiIter == 0 ) |
---|
4129 | { |
---|
4130 | if( pcCorner && !pcCorner->isIntra( uiCornerPUIdx ) ) |
---|
4131 | { |
---|
4132 | rbValidCand = true; |
---|
4133 | if( getSlice()->isInterB() ) |
---|
4134 | { |
---|
4135 | if ( pcCorner->getInterDir( uiCornerPUIdx ) == 1 ) |
---|
4136 | { |
---|
4137 | if( pcCorner->getCUMvField(REF_PIC_LIST_0)->getRefIdx( uiCornerPUIdx ) != 0 ) |
---|
4138 | { |
---|
4139 | rbValidCand = false; |
---|
4140 | } |
---|
4141 | } |
---|
4142 | else if ( pcCorner->getInterDir( uiCornerPUIdx ) == 2 ) |
---|
4143 | { |
---|
4144 | if( pcCorner->getCUMvField(REF_PIC_LIST_1)->getRefIdx( uiCornerPUIdx ) != 0 ) |
---|
4145 | { |
---|
4146 | rbValidCand = false; |
---|
4147 | } |
---|
4148 | } |
---|
4149 | else |
---|
4150 | { |
---|
4151 | if( pcCorner->getCUMvField(REF_PIC_LIST_0)->getRefIdx( uiCornerPUIdx ) != 0 || pcCorner->getCUMvField(REF_PIC_LIST_1)->getRefIdx( uiCornerPUIdx ) != 0 ) |
---|
4152 | { |
---|
4153 | rbValidCand = false; |
---|
4154 | } |
---|
4155 | } |
---|
4156 | } |
---|
4157 | else if( pcCorner->getCUMvField(REF_PIC_LIST_0)->getRefIdx( uiCornerPUIdx ) != 0 ) |
---|
4158 | { |
---|
4159 | rbValidCand = false; |
---|
4160 | } |
---|
4161 | } |
---|
4162 | } |
---|
4163 | else |
---|
4164 | { |
---|
4165 | if( pcCorner && !pcCorner->isIntra( uiCornerPUIdx ) ) |
---|
4166 | { |
---|
4167 | rbValidCand = true; |
---|
4168 | if( getSlice()->isInterB() ) |
---|
4169 | { |
---|
4170 | if ( pcCorner->getInterDir( uiCornerPUIdx ) == 1 ) |
---|
4171 | { |
---|
4172 | if( pcCorner->getCUMvField(REF_PIC_LIST_0)->getRefIdx( uiCornerPUIdx ) < 0 ) |
---|
4173 | { |
---|
4174 | rbValidCand = false; |
---|
4175 | } |
---|
4176 | } |
---|
4177 | else if ( pcCorner->getInterDir( uiCornerPUIdx ) == 2 ) |
---|
4178 | { |
---|
4179 | if( pcCorner->getCUMvField(REF_PIC_LIST_1)->getRefIdx( uiCornerPUIdx ) < 0 ) |
---|
4180 | { |
---|
4181 | rbValidCand = false; |
---|
4182 | } |
---|
4183 | } |
---|
4184 | else |
---|
4185 | { |
---|
4186 | if( pcCorner->getCUMvField(REF_PIC_LIST_0)->getRefIdx( uiCornerPUIdx ) < 0 || pcCorner->getCUMvField(REF_PIC_LIST_1)->getRefIdx( uiCornerPUIdx ) < 0 ) |
---|
4187 | { |
---|
4188 | rbValidCand = false; |
---|
4189 | } |
---|
4190 | } |
---|
4191 | } |
---|
4192 | else if( pcCorner->getCUMvField(REF_PIC_LIST_0)->getRefIdx( uiCornerPUIdx ) < 0 ) |
---|
4193 | { |
---|
4194 | rbValidCand = false; |
---|
4195 | } |
---|
4196 | } |
---|
4197 | } |
---|
4198 | } |
---|
4199 | #if PARALLEL_MERGE |
---|
4200 | /** Check whether the current PU and a spatial neighboring PU are in a same ME region. |
---|
4201 | * \param xN, xN location of the upper-left corner pixel of a neighboring PU |
---|
4202 | * \param xP, yP location of the upper-left corner pixel of the current PU |
---|
4203 | * \returns Bool |
---|
4204 | */ |
---|
4205 | Bool TComDataCU::isDiffMER(Int xN, Int yN, Int xP, Int yP) |
---|
4206 | { |
---|
4207 | |
---|
4208 | UInt plevel = this->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() + 2; |
---|
4209 | if ((xN>>plevel)!= (xP>>plevel)) |
---|
4210 | { |
---|
4211 | return true; |
---|
4212 | } |
---|
4213 | if ((yN>>plevel)!= (yP>>plevel)) |
---|
4214 | { |
---|
4215 | return true; |
---|
4216 | } |
---|
4217 | return false; |
---|
4218 | } |
---|
4219 | /** calculate the location of upper-left corner pixel and size of the current PU. |
---|
4220 | * \param partIdx PU index within a CU |
---|
4221 | * \param xP, yP location of the upper-left corner pixel of the current PU |
---|
4222 | * \param PSW, nPSH size of the curren PU |
---|
4223 | * \returns Void |
---|
4224 | */ |
---|
4225 | Void TComDataCU::getPartPosition( UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH) |
---|
4226 | { |
---|
4227 | UInt col = m_uiCUPelX; |
---|
4228 | UInt row = m_uiCUPelY; |
---|
4229 | |
---|
4230 | switch ( m_pePartSize[0] ) |
---|
4231 | { |
---|
4232 | case SIZE_2NxN: |
---|
4233 | nPSW = getWidth(0); |
---|
4234 | nPSH = getHeight(0) >> 1; |
---|
4235 | xP = col; |
---|
4236 | yP = (partIdx ==0)? row: row + nPSH; |
---|
4237 | break; |
---|
4238 | case SIZE_Nx2N: |
---|
4239 | nPSW = getWidth(0) >> 1; |
---|
4240 | nPSH = getHeight(0); |
---|
4241 | xP = (partIdx ==0)? col: col + nPSW; |
---|
4242 | yP = row; |
---|
4243 | break; |
---|
4244 | case SIZE_NxN: |
---|
4245 | nPSW = getWidth(0) >> 1; |
---|
4246 | nPSH = getHeight(0) >> 1; |
---|
4247 | xP = col + (partIdx&0x1)*nPSW; |
---|
4248 | yP = row + (partIdx>>1)*nPSH; |
---|
4249 | break; |
---|
4250 | case SIZE_2NxnU: |
---|
4251 | nPSW = getWidth(0); |
---|
4252 | nPSH = ( partIdx == 0 ) ? getHeight(0) >> 2 : ( getHeight(0) >> 2 ) + ( getHeight(0) >> 1 ); |
---|
4253 | xP = col; |
---|
4254 | yP = (partIdx ==0)? row: row + getHeight(0) - nPSH; |
---|
4255 | |
---|
4256 | break; |
---|
4257 | case SIZE_2NxnD: |
---|
4258 | nPSW = getWidth(0); |
---|
4259 | nPSH = ( partIdx == 0 ) ? ( getHeight(0) >> 2 ) + ( getHeight(0) >> 1 ) : getHeight(0) >> 2; |
---|
4260 | xP = col; |
---|
4261 | yP = (partIdx ==0)? row: row + getHeight(0) - nPSH; |
---|
4262 | break; |
---|
4263 | case SIZE_nLx2N: |
---|
4264 | nPSW = ( partIdx == 0 ) ? getWidth(0) >> 2 : ( getWidth(0) >> 2 ) + ( getWidth(0) >> 1 ); |
---|
4265 | nPSH = getHeight(0); |
---|
4266 | xP = (partIdx ==0)? col: col + getWidth(0) - nPSW; |
---|
4267 | yP = row; |
---|
4268 | break; |
---|
4269 | case SIZE_nRx2N: |
---|
4270 | nPSW = ( partIdx == 0 ) ? ( getWidth(0) >> 2 ) + ( getWidth(0) >> 1 ) : getWidth(0) >> 2; |
---|
4271 | nPSH = getHeight(0); |
---|
4272 | xP = (partIdx ==0)? col: col + getWidth(0) - nPSW; |
---|
4273 | yP = row; |
---|
4274 | break; |
---|
4275 | default: |
---|
4276 | assert ( m_pePartSize[0] == SIZE_2Nx2N ); |
---|
4277 | nPSW = getWidth(0); |
---|
4278 | nPSH = getHeight(0); |
---|
4279 | xP = col ; |
---|
4280 | yP = row ; |
---|
4281 | |
---|
4282 | break; |
---|
4283 | } |
---|
4284 | } |
---|
4285 | |
---|
4286 | #endif |
---|
4287 | AMVP_MODE TComDataCU::getAMVPMode(UInt uiIdx) |
---|
4288 | { |
---|
4289 | return m_pcSlice->getSPS()->getAMVPMode(m_puhDepth[uiIdx]); |
---|
4290 | } |
---|
4291 | #if QC_MULTI_DIS_CAN |
---|
4292 | /** construct a list of disparity motion vectors from the neighbouring PUs **/ |
---|
4293 | Void TComDataCU::getDisMvpCand ( UInt uiPartIdx, UInt uiPartAddr,DisInfo* pDInfo ) |
---|
4294 | { |
---|
4295 | PartSize eCUMode = getPartitionSize( uiPartAddr ); |
---|
4296 | TComDataCU* pcTmpCU = NULL; |
---|
4297 | pDInfo->iN = 0; |
---|
4298 | |
---|
4299 | RefPicList eRefPicList = REF_PIC_LIST_0 ; |
---|
4300 | //-- Get Spatial MV |
---|
4301 | UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB; |
---|
4302 | UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); |
---|
4303 | |
---|
4304 | deriveLeftRightTopIdxGeneral( eCUMode, uiPartAddr, uiPartIdx, uiPartIdxLT, uiPartIdxRT ); |
---|
4305 | deriveLeftBottomIdxGeneral( eCUMode, uiPartAddr, uiPartIdx, uiPartIdxLB ); |
---|
4306 | |
---|
4307 | UInt uiIdx = 0; |
---|
4308 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
4309 | pcTmpCU = getPULeft(uiIdx, uiPartIdxLB, true, false); |
---|
4310 | #else |
---|
4311 | pcTmpCU = getPULeft(uiIdx, uiPartIdxLB); |
---|
4312 | #endif |
---|
4313 | if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) ) |
---|
4314 | { |
---|
4315 | for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++) |
---|
4316 | { |
---|
4317 | eRefPicList = RefPicList(iList); |
---|
4318 | Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ; |
---|
4319 | if( refId >= 0) |
---|
4320 | { |
---|
4321 | Int refViewIdx = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId); |
---|
4322 | if (refViewIdx!= m_pcSlice->getViewId()) |
---|
4323 | { |
---|
4324 | TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); |
---|
4325 | clipMv(cMvPred); |
---|
4326 | pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred; |
---|
4327 | pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx; |
---|
4328 | return; |
---|
4329 | } |
---|
4330 | } |
---|
4331 | } |
---|
4332 | } |
---|
4333 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
4334 | pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT, true, false, true); |
---|
4335 | #else |
---|
4336 | pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT); |
---|
4337 | #endif |
---|
4338 | |
---|
4339 | if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx )) |
---|
4340 | { |
---|
4341 | for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++) |
---|
4342 | { |
---|
4343 | eRefPicList = RefPicList(iList); |
---|
4344 | Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ; |
---|
4345 | if( refId >= 0) |
---|
4346 | { |
---|
4347 | Int refViewIdx = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId); |
---|
4348 | if (refViewIdx!= m_pcSlice->getViewId()) |
---|
4349 | { |
---|
4350 | TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); |
---|
4351 | clipMv(cMvPred); |
---|
4352 | pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred; |
---|
4353 | pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx; |
---|
4354 | return; |
---|
4355 | } |
---|
4356 | } |
---|
4357 | } |
---|
4358 | } |
---|
4359 | |
---|
4360 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
4361 | pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, false, true); |
---|
4362 | #else |
---|
4363 | pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, true, true); |
---|
4364 | #endif |
---|
4365 | if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) ) |
---|
4366 | { |
---|
4367 | for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++) |
---|
4368 | { |
---|
4369 | eRefPicList = RefPicList(iList); |
---|
4370 | Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ; |
---|
4371 | if( refId >= 0) |
---|
4372 | { |
---|
4373 | Int refViewIdx = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId); |
---|
4374 | if (refViewIdx!= m_pcSlice->getViewId()) |
---|
4375 | { |
---|
4376 | TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); |
---|
4377 | clipMv(cMvPred); |
---|
4378 | pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred; |
---|
4379 | pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx; |
---|
4380 | return; |
---|
4381 | } |
---|
4382 | } |
---|
4383 | } |
---|
4384 | } |
---|
4385 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
4386 | pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB, true, false); |
---|
4387 | #else |
---|
4388 | pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB); |
---|
4389 | #endif |
---|
4390 | if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx )) |
---|
4391 | { |
---|
4392 | for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++) |
---|
4393 | { |
---|
4394 | eRefPicList = RefPicList(iList); |
---|
4395 | Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ; |
---|
4396 | if( refId >= 0) |
---|
4397 | { |
---|
4398 | Int refViewIdx = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId); |
---|
4399 | if (refViewIdx!= m_pcSlice->getViewId()) |
---|
4400 | { |
---|
4401 | TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); |
---|
4402 | clipMv(cMvPred); |
---|
4403 | pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred; |
---|
4404 | pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx; |
---|
4405 | return; |
---|
4406 | } |
---|
4407 | } |
---|
4408 | } |
---|
4409 | } |
---|
4410 | |
---|
4411 | // Above predictor search |
---|
4412 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
4413 | pcTmpCU = getPUAboveLeft(uiIdx, (m_uiAbsIdxInLCU + uiPartAddr), true, false, true); |
---|
4414 | assert(uiPartIdxLT == (m_uiAbsIdxInLCU + uiPartAddr)); |
---|
4415 | #else |
---|
4416 | pcTmpCU = getPUAboveLeft(uiIdx, uiPartIdxLT, true, true, true); |
---|
4417 | #endif |
---|
4418 | if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx )) |
---|
4419 | { |
---|
4420 | for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++) |
---|
4421 | { |
---|
4422 | eRefPicList = RefPicList(iList); |
---|
4423 | Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ; |
---|
4424 | if( refId >= 0) |
---|
4425 | { |
---|
4426 | Int refViewIdx = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId); |
---|
4427 | if (refViewIdx!= m_pcSlice->getViewId()) |
---|
4428 | { |
---|
4429 | TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); |
---|
4430 | clipMv(cMvPred); |
---|
4431 | pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred; |
---|
4432 | pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx; |
---|
4433 | return; |
---|
4434 | } |
---|
4435 | } |
---|
4436 | } |
---|
4437 | } |
---|
4438 | //Get temporal MV |
---|
4439 | TComMv cColMv; |
---|
4440 | Int iTargetViewIdx = 0; |
---|
4441 | Int iTStartViewIdx = 0; |
---|
4442 | UInt uiPartIdxRB, uiBRIdx; |
---|
4443 | Int uiViewIdxCurr= getSlice()->getViewId(); |
---|
4444 | |
---|
4445 | UInt uiAbsPartAddr; |
---|
4446 | int uiLCUIdx = getAddr(); |
---|
4447 | Int uiLCUnew = uiLCUIdx; |
---|
4448 | eCUMode = getPartitionSize( 0 ); |
---|
4449 | deriveRightBottomIdx( eCUMode, uiPartIdx, uiPartIdxRB ); |
---|
4450 | uiBRIdx = uiPartIdxLT; |
---|
4451 | UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB]; |
---|
4452 | if ( (( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) < m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) &&(( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) < m_pcSlice->getSPS()->getPicHeightInLumaSamples() )) // image boundary check |
---|
4453 | { |
---|
4454 | if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) && // is not at the last column of LCU |
---|
4455 | ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row of LCU |
---|
4456 | { |
---|
4457 | uiBRIdx = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ]; |
---|
4458 | } |
---|
4459 | else if ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) // is not at the last column of LCU But is last row of LCU |
---|
4460 | { |
---|
4461 | uiBRIdx = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ]; |
---|
4462 | uiLCUnew = uiLCUIdx + m_pcPic->getFrameWidthInCU(); |
---|
4463 | } |
---|
4464 | else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU |
---|
4465 | { |
---|
4466 | uiBRIdx = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ]; |
---|
4467 | uiLCUnew = uiLCUIdx + 1; |
---|
4468 | } |
---|
4469 | else //is the right bottom corner of LCU |
---|
4470 | { |
---|
4471 | uiBRIdx = 0; |
---|
4472 | uiLCUnew = uiLCUIdx + m_pcPic->getFrameWidthInCU() + 1; |
---|
4473 | } |
---|
4474 | } |
---|
4475 | |
---|
4476 | Int MaxRef = getSlice()->getNumRefIdx(RefPicList(0)); |
---|
4477 | UInt uiNumPartInCUHeight = m_pcPic->getNumPartInHeight(); |
---|
4478 | UInt uiPUVert = (UInt)((Int)g_auiZscanToRaster[uiPartIdxLB]/(Int)(uiNumPartInCUWidth)-(Int)g_auiZscanToRaster[uiPartIdxLT]/(Int)(uiNumPartInCUWidth)); |
---|
4479 | UInt uiPUHorStart = g_auiZscanToRaster[uiPartIdxLT]; |
---|
4480 | UInt uiPUHorEnd = g_auiZscanToRaster[uiPartIdxRT]; |
---|
4481 | for( Int i= 0; i< getSlice()->getNumRefIdx(RefPicList(0)); i ++) |
---|
4482 | { |
---|
4483 | getSlice()->getRefPic( RefPicList(0), i)->setCandPicCheckedFlag(0); |
---|
4484 | } |
---|
4485 | for( Int i= 0; i< getSlice()->getNumRefIdx(RefPicList(1)); i ++) |
---|
4486 | { |
---|
4487 | getSlice()->getRefPic( RefPicList(1), i)->setCandPicCheckedFlag(0); |
---|
4488 | } |
---|
4489 | { |
---|
4490 | //check the col-located picture |
---|
4491 | eRefPicList = RefPicList(getSlice()->isInterB() ? getSlice()->getColDir() : 0); |
---|
4492 | #if COLLOCATED_REF_IDX |
---|
4493 | Int lpRef = getSlice()->getColRefIdx(); |
---|
4494 | #else |
---|
4495 | Int lpRef = 0; |
---|
4496 | #endif |
---|
4497 | if( m_pcSlice->getViewId() == getSlice()->getRefPic( eRefPicList, lpRef)->getViewId() ) |
---|
4498 | { |
---|
4499 | if (uiViewIdxCurr > 1) |
---|
4500 | { |
---|
4501 | if( (uiLCUnew >= 0 && xGetColDisMV( eRefPicList, lpRef, uiLCUnew, uiBRIdx, cColMv, iTargetViewIdx, iTStartViewIdx)) ) |
---|
4502 | { |
---|
4503 | clipMv(cColMv); |
---|
4504 | pDInfo->m_acMvCand[pDInfo->iN] = cColMv; |
---|
4505 | pDInfo->m_aVIdxCan[pDInfo->iN++] = iTargetViewIdx; |
---|
4506 | return ; |
---|
4507 | } |
---|
4508 | } |
---|
4509 | for(UInt uiLoopVert = 0; uiLoopVert <= uiPUVert; uiLoopVert+=4) |
---|
4510 | for( uiIdx = uiPUHorStart; uiIdx <= uiPUHorEnd; uiIdx +=4 ) |
---|
4511 | { |
---|
4512 | uiAbsPartAddr = g_auiRasterToZscan[uiIdx+uiNumPartInCUWidth*uiLoopVert]; |
---|
4513 | if ( uiLCUIdx >= 0 && xGetColDisMV( eRefPicList, lpRef, uiLCUIdx, uiAbsPartAddr, cColMv, iTargetViewIdx, iTStartViewIdx ) ) |
---|
4514 | { |
---|
4515 | clipMv(cColMv); |
---|
4516 | pDInfo->m_acMvCand[pDInfo->iN] = cColMv; |
---|
4517 | pDInfo->m_aVIdxCan[pDInfo->iN++] = iTargetViewIdx; |
---|
4518 | return ; |
---|
4519 | } |
---|
4520 | } |
---|
4521 | for(UInt uiIdx_y = 0; uiIdx_y <uiNumPartInCUHeight; uiIdx_y +=4 ) |
---|
4522 | for(UInt uiIdx_X = 0; uiIdx_X <uiNumPartInCUWidth; uiIdx_X +=4 ) |
---|
4523 | { |
---|
4524 | uiIdx = uiIdx_X + uiIdx_y * uiNumPartInCUWidth; |
---|
4525 | uiAbsPartAddr = g_auiRasterToZscan[uiIdx]; |
---|
4526 | if ( uiLCUIdx >= 0 && xGetColDisMV( eRefPicList, lpRef, uiLCUIdx, uiAbsPartAddr, cColMv, iTargetViewIdx, iTStartViewIdx ) ) |
---|
4527 | { |
---|
4528 | clipMv(cColMv); |
---|
4529 | pDInfo->m_acMvCand[pDInfo->iN] = cColMv; |
---|
4530 | pDInfo->m_aVIdxCan[pDInfo->iN++] = iTargetViewIdx; |
---|
4531 | return ; |
---|
4532 | } |
---|
4533 | } |
---|
4534 | if (uiViewIdxCurr == 1) |
---|
4535 | { |
---|
4536 | if( (uiLCUnew >= 0 && xGetColDisMV( eRefPicList, lpRef, uiLCUnew, uiBRIdx, cColMv, iTargetViewIdx, iTStartViewIdx)) ) |
---|
4537 | { |
---|
4538 | clipMv(cColMv); |
---|
4539 | pDInfo->m_acMvCand[pDInfo->iN] = cColMv; |
---|
4540 | pDInfo->m_aVIdxCan[pDInfo->iN++] = iTargetViewIdx; |
---|
4541 | return ; |
---|
4542 | } |
---|
4543 | } |
---|
4544 | } |
---|
4545 | getSlice()->getRefPic( eRefPicList, lpRef)->setCandPicCheckedFlag(1); |
---|
4546 | } |
---|
4547 | { |
---|
4548 | //check the remaining reference pictures in list0 and list1 |
---|
4549 | if(getSlice()->isInterB()) |
---|
4550 | { |
---|
4551 | if(getSlice()->getNumRefIdx(RefPicList(0))< getSlice()->getNumRefIdx(RefPicList(1))) |
---|
4552 | MaxRef = getSlice()->getNumRefIdx(RefPicList(1)); |
---|
4553 | } |
---|
4554 | for(Int lpRef = 0; lpRef < MaxRef; lpRef++) |
---|
4555 | { |
---|
4556 | for(Int lpNr = 0; lpNr < (getSlice()->isInterB() ? 2: 1); lpNr ++) |
---|
4557 | { |
---|
4558 | eRefPicList = RefPicList(0); |
---|
4559 | if(getSlice()->isInterB()) |
---|
4560 | eRefPicList = RefPicList(lpNr==0 ? (getSlice()->getColDir()): (1-getSlice()->getColDir())); |
---|
4561 | if(getSlice()->getRefPic( eRefPicList, lpRef)->getCandPicCheckedFlag()) |
---|
4562 | continue; |
---|
4563 | |
---|
4564 | if(lpRef >= getSlice()->getNumRefIdx(eRefPicList)||(m_pcSlice->getViewId() != getSlice()->getRefPic( eRefPicList, lpRef)->getViewId())) |
---|
4565 | continue; |
---|
4566 | if (uiViewIdxCurr > 1 ) |
---|
4567 | { |
---|
4568 | if( (uiLCUnew >= 0 && xGetColDisMV( eRefPicList, lpRef, uiLCUnew, uiBRIdx, cColMv, iTargetViewIdx, iTStartViewIdx)) ) |
---|
4569 | { |
---|
4570 | clipMv(cColMv); |
---|
4571 | pDInfo->m_acMvCand[pDInfo->iN] = cColMv; |
---|
4572 | pDInfo->m_aVIdxCan[pDInfo->iN++] = iTargetViewIdx; |
---|
4573 | return ; |
---|
4574 | } |
---|
4575 | } |
---|
4576 | for(UInt uiLoopVert = 0; uiLoopVert <= uiPUVert; uiLoopVert += 4) |
---|
4577 | for( uiIdx = uiPUHorStart; uiIdx <= uiPUHorEnd; uiIdx += 4 ) |
---|
4578 | { |
---|
4579 | uiAbsPartAddr = g_auiRasterToZscan[uiIdx+uiNumPartInCUWidth*uiLoopVert]; |
---|
4580 | if ( uiLCUIdx >= 0 && xGetColDisMV( eRefPicList, lpRef, uiLCUIdx, uiAbsPartAddr, cColMv, iTargetViewIdx, iTStartViewIdx ) ) |
---|
4581 | { |
---|
4582 | clipMv(cColMv); |
---|
4583 | pDInfo->m_acMvCand[pDInfo->iN] = cColMv; |
---|
4584 | pDInfo->m_aVIdxCan[pDInfo->iN++] = iTargetViewIdx; |
---|
4585 | return ; |
---|
4586 | } |
---|
4587 | } |
---|
4588 | for(UInt uiIdx_y = 0; uiIdx_y <uiNumPartInCUHeight; uiIdx_y += 4 ) |
---|
4589 | for(UInt uiIdx_X = 0; uiIdx_X <uiNumPartInCUWidth; uiIdx_X += 4 ) |
---|
4590 | { |
---|
4591 | uiIdx = uiIdx_X + uiIdx_y * uiNumPartInCUWidth; |
---|
4592 | uiAbsPartAddr = g_auiRasterToZscan[uiIdx]; |
---|
4593 | if ( uiLCUIdx >= 0 && xGetColDisMV( eRefPicList, lpRef, uiLCUIdx, uiAbsPartAddr, cColMv, iTargetViewIdx, iTStartViewIdx ) ) |
---|
4594 | { |
---|
4595 | clipMv(cColMv); |
---|
4596 | pDInfo->m_acMvCand[pDInfo->iN] = cColMv; |
---|
4597 | pDInfo->m_aVIdxCan[pDInfo->iN++] = iTargetViewIdx; |
---|
4598 | return ; |
---|
4599 | } |
---|
4600 | } |
---|
4601 | if (uiViewIdxCurr == 1 ) |
---|
4602 | { |
---|
4603 | if( (uiLCUnew >= 0 && xGetColDisMV( eRefPicList, lpRef, uiLCUnew, uiBRIdx, cColMv, iTargetViewIdx, iTStartViewIdx)) ) |
---|
4604 | { |
---|
4605 | clipMv(cColMv); |
---|
4606 | pDInfo->m_acMvCand[pDInfo->iN] = cColMv; |
---|
4607 | pDInfo->m_aVIdxCan[pDInfo->iN++] = iTargetViewIdx; |
---|
4608 | return ; |
---|
4609 | } |
---|
4610 | } |
---|
4611 | getSlice()->getRefPic( eRefPicList, lpRef)->setCandPicCheckedFlag(1); |
---|
4612 | }//reference lists |
---|
4613 | }//reference indices |
---|
4614 | }//remaining pictures |
---|
4615 | } |
---|
4616 | #endif |
---|
4617 | |
---|
4618 | /** Constructs a list of candidates for AMVP |
---|
4619 | * \param uiPartIdx |
---|
4620 | * \param uiPartAddr |
---|
4621 | * \param eRefPicList |
---|
4622 | * \param iRefIdx |
---|
4623 | * \param pInfo |
---|
4624 | */ |
---|
4625 | Void TComDataCU::fillMvpCand ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo ) |
---|
4626 | { |
---|
4627 | PartSize eCUMode = getPartitionSize( 0 ); |
---|
4628 | |
---|
4629 | TComMv cMvPred; |
---|
4630 | Bool bAddedSmvp = false; |
---|
4631 | |
---|
4632 | pInfo->iN = 0; |
---|
4633 | if (iRefIdx < 0) |
---|
4634 | { |
---|
4635 | return; |
---|
4636 | } |
---|
4637 | |
---|
4638 | #if QC_MULTI_DIS_CAN |
---|
4639 | DisInfo cDisInfo; |
---|
4640 | cDisInfo.iN = 0; |
---|
4641 | if(m_pcSlice->getSPS()->getViewId() && m_pcSlice->getSPS()->getMultiviewMvPredMode()) |
---|
4642 | getDisMvpCand (uiPartIdx, uiPartAddr, &cDisInfo ); |
---|
4643 | if(cDisInfo.iN==0) |
---|
4644 | { |
---|
4645 | cDisInfo.iN = 1; |
---|
4646 | cDisInfo.m_acMvCand[0].setHor(0); |
---|
4647 | cDisInfo.m_acMvCand[0].setVer(0); |
---|
4648 | cDisInfo.m_aVIdxCan[0] = 0; |
---|
4649 | } |
---|
4650 | #endif |
---|
4651 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
4652 | #if ( PDM_AMVP_POS == 0 ) |
---|
4653 | // get inter-view mv predictor (at position 0) |
---|
4654 | TComMv cPdmMvPred; |
---|
4655 | #if QC_MULTI_DIS_CAN |
---|
4656 | if( getPdmMvPredDisCan( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred, &cDisInfo ) ) |
---|
4657 | #else |
---|
4658 | if( getPdmMvPred( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred ) ) |
---|
4659 | #endif |
---|
4660 | { |
---|
4661 | clipMv( cPdmMvPred ); |
---|
4662 | pInfo->m_acMvCand[ pInfo->iN++ ] = cPdmMvPred; |
---|
4663 | } |
---|
4664 | #endif |
---|
4665 | #endif |
---|
4666 | |
---|
4667 | //-- Get Spatial MV |
---|
4668 | UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB; |
---|
4669 | UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); |
---|
4670 | Bool bAdded = false; |
---|
4671 | |
---|
4672 | deriveLeftRightTopIdx( eCUMode, uiPartIdx, uiPartIdxLT, uiPartIdxRT ); |
---|
4673 | deriveLeftBottomIdx( eCUMode, uiPartIdx, uiPartIdxLB ); |
---|
4674 | |
---|
4675 | TComDataCU* tmpCU = NULL; |
---|
4676 | UInt idx; |
---|
4677 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
4678 | tmpCU = getPUBelowLeft(idx, uiPartIdxLB, true, false); |
---|
4679 | #else |
---|
4680 | tmpCU = getPUBelowLeft(idx, uiPartIdxLB); |
---|
4681 | #endif |
---|
4682 | bAddedSmvp = (tmpCU != NULL) && (tmpCU->getPredictionMode(idx) != MODE_INTRA); |
---|
4683 | |
---|
4684 | if (!bAddedSmvp) |
---|
4685 | { |
---|
4686 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
4687 | tmpCU = getPULeft(idx, uiPartIdxLB, true, false); |
---|
4688 | #else |
---|
4689 | tmpCU = getPULeft(idx, uiPartIdxLB); |
---|
4690 | #endif |
---|
4691 | bAddedSmvp = (tmpCU != NULL) && (tmpCU->getPredictionMode(idx) != MODE_INTRA); |
---|
4692 | } |
---|
4693 | |
---|
4694 | // Left predictor search |
---|
4695 | bAdded = xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxLB, MD_BELOW_LEFT); |
---|
4696 | if (!bAdded) |
---|
4697 | { |
---|
4698 | bAdded = xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxLB, MD_LEFT ); |
---|
4699 | } |
---|
4700 | |
---|
4701 | if(!bAdded) |
---|
4702 | { |
---|
4703 | bAdded = xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxLB, MD_BELOW_LEFT); |
---|
4704 | if (!bAdded) |
---|
4705 | { |
---|
4706 | bAdded = xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxLB, MD_LEFT ); |
---|
4707 | } |
---|
4708 | } |
---|
4709 | |
---|
4710 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
4711 | #if ( PDM_AMVP_POS == 1 ) |
---|
4712 | // get inter-view mv predictor (at position 1) |
---|
4713 | TComMv cPdmMvPred; |
---|
4714 | #if QC_MULTI_DIS_CAN |
---|
4715 | if( getPdmMvPredDisCan( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred, &cDisInfo ) ) |
---|
4716 | #else |
---|
4717 | if( getPdmMvPred( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred ) ) |
---|
4718 | #endif |
---|
4719 | { |
---|
4720 | clipMv( cPdmMvPred ); |
---|
4721 | pInfo->m_acMvCand[ pInfo->iN++ ] = cPdmMvPred; |
---|
4722 | } |
---|
4723 | #endif |
---|
4724 | #endif |
---|
4725 | |
---|
4726 | // Above predictor search |
---|
4727 | bAdded = xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxRT, MD_ABOVE_RIGHT); |
---|
4728 | |
---|
4729 | if (!bAdded) |
---|
4730 | { |
---|
4731 | bAdded = xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxRT, MD_ABOVE); |
---|
4732 | } |
---|
4733 | |
---|
4734 | if(!bAdded) |
---|
4735 | { |
---|
4736 | bAdded = xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxLT, MD_ABOVE_LEFT); |
---|
4737 | } |
---|
4738 | bAdded = bAddedSmvp; |
---|
4739 | if (pInfo->iN==2) bAdded = true; |
---|
4740 | |
---|
4741 | if(!bAdded) |
---|
4742 | { |
---|
4743 | bAdded = xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxRT, MD_ABOVE_RIGHT); |
---|
4744 | if (!bAdded) |
---|
4745 | { |
---|
4746 | bAdded = xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxRT, MD_ABOVE); |
---|
4747 | } |
---|
4748 | |
---|
4749 | if(!bAdded) |
---|
4750 | { |
---|
4751 | bAdded = xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxLT, MD_ABOVE_LEFT); |
---|
4752 | } |
---|
4753 | } |
---|
4754 | |
---|
4755 | if (getAMVPMode(uiPartAddr) == AM_NONE) //Should be optimized later for special cases |
---|
4756 | { |
---|
4757 | assert(pInfo->iN > 0); |
---|
4758 | pInfo->iN = 1; |
---|
4759 | return; |
---|
4760 | } |
---|
4761 | |
---|
4762 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
4763 | #if ( PDM_AMVP_POS == 2 ) |
---|
4764 | // get inter-view mv predictor (at position 2) |
---|
4765 | TComMv cPdmMvPred; |
---|
4766 | #if QC_MULTI_DIS_CAN |
---|
4767 | if( getPdmMvPredDisCan( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred, &cDisInfo ) ) |
---|
4768 | #else |
---|
4769 | if( getPdmMvPred( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred ) ) |
---|
4770 | #endif |
---|
4771 | { |
---|
4772 | clipMv( cPdmMvPred ); |
---|
4773 | pInfo->m_acMvCand[ pInfo->iN++ ] = cPdmMvPred; |
---|
4774 | } |
---|
4775 | #endif |
---|
4776 | #endif |
---|
4777 | |
---|
4778 | #if AMVP_PRUNING_SIMPLIFICATION |
---|
4779 | if ( pInfo->iN == 2 ) |
---|
4780 | { |
---|
4781 | if ( pInfo->m_acMvCand[ 0 ] == pInfo->m_acMvCand[ 1 ] ) |
---|
4782 | { |
---|
4783 | pInfo->iN = 1; |
---|
4784 | } |
---|
4785 | } |
---|
4786 | #if QC_MULTI_DIS_CAN |
---|
4787 | if ( getSlice()->getViewId()!=0 && pInfo->iN == 3 ) |
---|
4788 | { |
---|
4789 | if ( pInfo->m_acMvCand[ 1 ] == pInfo->m_acMvCand[ 2 ] ) |
---|
4790 | { |
---|
4791 | pInfo->iN = 2; |
---|
4792 | if( pInfo->m_acMvCand[ 0 ] == pInfo->m_acMvCand[ 1 ] ) |
---|
4793 | pInfo->iN = 1; |
---|
4794 | }else |
---|
4795 | { |
---|
4796 | if( pInfo->m_acMvCand[ 0 ] == pInfo->m_acMvCand[ 1 ] ) |
---|
4797 | { |
---|
4798 | pInfo->m_acMvCand[1 ] = pInfo->m_acMvCand[ 2 ]; |
---|
4799 | pInfo->iN = 2; |
---|
4800 | } |
---|
4801 | else if (pInfo->m_acMvCand[ 0 ] == pInfo->m_acMvCand[ 2 ]) |
---|
4802 | pInfo->iN = 2; |
---|
4803 | } |
---|
4804 | } |
---|
4805 | #endif |
---|
4806 | #endif |
---|
4807 | |
---|
4808 | if ( getSlice()->getPPS()->getEnableTMVPFlag() ) |
---|
4809 | { |
---|
4810 | // Get Temporal Motion Predictor |
---|
4811 | int iRefIdx_Col = iRefIdx; |
---|
4812 | TComMv cColMv; |
---|
4813 | UInt uiPartIdxRB; |
---|
4814 | UInt uiAbsPartIdx; |
---|
4815 | UInt uiAbsPartAddr; |
---|
4816 | int uiLCUIdx = getAddr(); |
---|
4817 | |
---|
4818 | deriveRightBottomIdx( eCUMode, uiPartIdx, uiPartIdxRB ); |
---|
4819 | uiAbsPartAddr = m_uiAbsIdxInLCU + uiPartAddr; |
---|
4820 | |
---|
4821 | //---- co-located RightBottom Temporal Predictor (H) ---// |
---|
4822 | uiAbsPartIdx = g_auiZscanToRaster[uiPartIdxRB]; |
---|
4823 | if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdx] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) // image boundary check |
---|
4824 | { |
---|
4825 | uiLCUIdx = -1; |
---|
4826 | } |
---|
4827 | else if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdx] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples() ) |
---|
4828 | { |
---|
4829 | uiLCUIdx = -1; |
---|
4830 | } |
---|
4831 | else |
---|
4832 | { |
---|
4833 | if ( ( uiAbsPartIdx % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) && // is not at the last column of LCU |
---|
4834 | ( uiAbsPartIdx / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row of LCU |
---|
4835 | { |
---|
4836 | uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdx + uiNumPartInCUWidth + 1 ]; |
---|
4837 | uiLCUIdx = getAddr(); |
---|
4838 | } |
---|
4839 | else if ( uiAbsPartIdx % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) // is not at the last column of LCU But is last row of LCU |
---|
4840 | { |
---|
4841 | uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdx + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ]; |
---|
4842 | uiLCUIdx = -1 ; |
---|
4843 | } |
---|
4844 | else if ( uiAbsPartIdx / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU |
---|
4845 | { |
---|
4846 | uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdx + 1 ]; |
---|
4847 | uiLCUIdx = getAddr() + 1; |
---|
4848 | } |
---|
4849 | else //is the right bottom corner of LCU |
---|
4850 | { |
---|
4851 | uiAbsPartAddr = 0; |
---|
4852 | uiLCUIdx = -1 ; |
---|
4853 | } |
---|
4854 | } |
---|
4855 | if ( uiLCUIdx >= 0 && xGetColMVP( eRefPicList, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx_Col ) ) |
---|
4856 | { |
---|
4857 | pInfo->m_acMvCand[pInfo->iN++] = cColMv; |
---|
4858 | } |
---|
4859 | else |
---|
4860 | { |
---|
4861 | UInt uiPartIdxCenter; |
---|
4862 | UInt uiCurLCUIdx = getAddr(); |
---|
4863 | xDeriveCenterIdx( eCUMode, uiPartIdx, uiPartIdxCenter ); |
---|
4864 | if (xGetColMVP( eRefPicList, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx_Col )) |
---|
4865 | { |
---|
4866 | pInfo->m_acMvCand[pInfo->iN++] = cColMv; |
---|
4867 | } |
---|
4868 | } |
---|
4869 | //---- co-located RightBottom Temporal Predictor ---// |
---|
4870 | } |
---|
4871 | |
---|
4872 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
4873 | #if ( PDM_AMVP_POS == 3 ) |
---|
4874 | // get inter-view mv predictor (at position 3) |
---|
4875 | TComMv cPdmMvPred; |
---|
4876 | #if QC_MULTI_DIS_CAN |
---|
4877 | if( getPdmMvPredDisCan( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred, &cDisInfo ) ) |
---|
4878 | #else |
---|
4879 | if( getPdmMvPred( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred ) ) |
---|
4880 | #endif |
---|
4881 | { |
---|
4882 | clipMv( cPdmMvPred ); |
---|
4883 | pInfo->m_acMvCand[ pInfo->iN++ ] = cPdmMvPred; |
---|
4884 | } |
---|
4885 | #endif |
---|
4886 | #endif |
---|
4887 | |
---|
4888 | #if !AMVP_PRUNING_SIMPLIFICATION |
---|
4889 | // Check No MV Candidate |
---|
4890 | xUniqueMVPCand( pInfo ); |
---|
4891 | #endif |
---|
4892 | |
---|
4893 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
4894 | const Int iNumAMVPCands = AMVP_MAX_NUM_CANDS + ( getSlice()->getSPS()->getMultiviewMvPredMode() ? 1 : 0 ); |
---|
4895 | if (pInfo->iN > iNumAMVPCands) |
---|
4896 | { |
---|
4897 | pInfo->iN = iNumAMVPCands; |
---|
4898 | } |
---|
4899 | else if (pInfo->iN < iNumAMVPCands) |
---|
4900 | #else |
---|
4901 | if (pInfo->iN > AMVP_MAX_NUM_CANDS) |
---|
4902 | { |
---|
4903 | pInfo->iN = AMVP_MAX_NUM_CANDS; |
---|
4904 | } |
---|
4905 | else if (pInfo->iN < AMVP_MAX_NUM_CANDS) |
---|
4906 | #endif |
---|
4907 | { |
---|
4908 | #if !AMVP_ZERO_CHECKING_REMOVAL |
---|
4909 | int j; |
---|
4910 | for (j=0; j<pInfo->iN; j++) |
---|
4911 | { |
---|
4912 | if (pInfo->m_acMvCand[j].getHor() == 0 && pInfo->m_acMvCand[j].getVer() == 0) |
---|
4913 | { |
---|
4914 | break; |
---|
4915 | } |
---|
4916 | } |
---|
4917 | if (j == pInfo->iN) |
---|
4918 | { |
---|
4919 | #endif |
---|
4920 | pInfo->m_acMvCand[pInfo->iN].set(0,0); |
---|
4921 | pInfo->iN++; |
---|
4922 | #if !AMVP_ZERO_CHECKING_REMOVAL |
---|
4923 | } |
---|
4924 | #endif |
---|
4925 | } |
---|
4926 | return ; |
---|
4927 | } |
---|
4928 | |
---|
4929 | Void TComDataCU::clipMv (TComMv& rcMv) |
---|
4930 | { |
---|
4931 | Int iMvShift = 2; |
---|
4932 | #if HHI_FULL_PEL_DEPTH_MAP_MV_ACC |
---|
4933 | if( getSlice()->getIsDepth() ) |
---|
4934 | iMvShift = 0; |
---|
4935 | #endif |
---|
4936 | Int iOffset = 8; |
---|
4937 | Int iHorMax = ( m_pcSlice->getSPS()->getPicWidthInLumaSamples() + iOffset - m_uiCUPelX - 1 ) << iMvShift; |
---|
4938 | Int iHorMin = ( -(Int)g_uiMaxCUWidth - iOffset - (Int)m_uiCUPelX + 1 ) << iMvShift; |
---|
4939 | |
---|
4940 | Int iVerMax = ( m_pcSlice->getSPS()->getPicHeightInLumaSamples() + iOffset - m_uiCUPelY - 1 ) << iMvShift; |
---|
4941 | Int iVerMin = ( -(Int)g_uiMaxCUHeight - iOffset - (Int)m_uiCUPelY + 1 ) << iMvShift; |
---|
4942 | |
---|
4943 | rcMv.setHor( min (iHorMax, max (iHorMin, rcMv.getHor())) ); |
---|
4944 | rcMv.setVer( min (iVerMax, max (iVerMin, rcMv.getVer())) ); |
---|
4945 | } |
---|
4946 | |
---|
4947 | |
---|
4948 | Void TComDataCU::convertTransIdx( UInt uiAbsPartIdx, UInt uiTrIdx, UInt& ruiLumaTrMode, UInt& ruiChromaTrMode ) |
---|
4949 | { |
---|
4950 | ruiLumaTrMode = uiTrIdx; |
---|
4951 | ruiChromaTrMode = uiTrIdx; |
---|
4952 | return; |
---|
4953 | } |
---|
4954 | |
---|
4955 | UInt TComDataCU::getIntraSizeIdx(UInt uiAbsPartIdx) |
---|
4956 | { |
---|
4957 | UInt uiShift = ( (m_puhTrIdx[uiAbsPartIdx]==0) && (m_pePartSize[uiAbsPartIdx]==SIZE_NxN) ) ? m_puhTrIdx[uiAbsPartIdx]+1 : m_puhTrIdx[uiAbsPartIdx]; |
---|
4958 | uiShift = ( m_pePartSize[uiAbsPartIdx]==SIZE_NxN ? 1 : 0 ); |
---|
4959 | |
---|
4960 | UChar uiWidth = m_puhWidth[uiAbsPartIdx]>>uiShift; |
---|
4961 | UInt uiCnt = 0; |
---|
4962 | while( uiWidth ) |
---|
4963 | { |
---|
4964 | uiCnt++; |
---|
4965 | uiWidth>>=1; |
---|
4966 | } |
---|
4967 | uiCnt-=2; |
---|
4968 | return uiCnt > 6 ? 6 : uiCnt; |
---|
4969 | } |
---|
4970 | |
---|
4971 | Void TComDataCU::clearCbf( UInt uiIdx, TextType eType, UInt uiNumParts ) |
---|
4972 | { |
---|
4973 | ::memset( &m_puhCbf[g_aucConvertTxtTypeToIdx[eType]][uiIdx], 0, sizeof(UChar)*uiNumParts); |
---|
4974 | } |
---|
4975 | |
---|
4976 | /** Set a I_PCM flag for all sub-partitions of a partition. |
---|
4977 | * \param bIpcmFlag I_PCM flag |
---|
4978 | * \param uiAbsPartIdx patition index |
---|
4979 | * \param uiDepth CU depth |
---|
4980 | * \returns Void |
---|
4981 | */ |
---|
4982 | Void TComDataCU::setIPCMFlagSubParts (Bool bIpcmFlag, UInt uiAbsPartIdx, UInt uiDepth) |
---|
4983 | { |
---|
4984 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
4985 | |
---|
4986 | memset(m_pbIPCMFlag + uiAbsPartIdx, bIpcmFlag, sizeof(Bool)*uiCurrPartNumb ); |
---|
4987 | } |
---|
4988 | |
---|
4989 | /** Test whether the current block is skipped |
---|
4990 | * \param uiPartIdx Block index |
---|
4991 | * \returns Flag indicating whether the block is skipped |
---|
4992 | */ |
---|
4993 | Bool TComDataCU::isSkipped( UInt uiPartIdx ) |
---|
4994 | { |
---|
4995 | if ( m_pcSlice->isIntra () ) |
---|
4996 | { |
---|
4997 | return false; |
---|
4998 | } |
---|
4999 | return ( m_pePredMode[ uiPartIdx ] == MODE_SKIP && getMergeFlag( uiPartIdx ) && !getQtRootCbf( uiPartIdx ) ); |
---|
5000 | } |
---|
5001 | |
---|
5002 | // ==================================================================================================================== |
---|
5003 | // Protected member functions |
---|
5004 | // ==================================================================================================================== |
---|
5005 | |
---|
5006 | Bool TComDataCU::xAddMVPCand( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir ) |
---|
5007 | { |
---|
5008 | TComDataCU* pcTmpCU = NULL; |
---|
5009 | UInt uiIdx; |
---|
5010 | switch( eDir ) |
---|
5011 | { |
---|
5012 | case MD_LEFT: |
---|
5013 | { |
---|
5014 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
5015 | pcTmpCU = getPULeft(uiIdx, uiPartUnitIdx, true, false); |
---|
5016 | #else |
---|
5017 | pcTmpCU = getPULeft(uiIdx, uiPartUnitIdx); |
---|
5018 | #endif |
---|
5019 | break; |
---|
5020 | } |
---|
5021 | case MD_ABOVE: |
---|
5022 | { |
---|
5023 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
5024 | pcTmpCU = getPUAbove(uiIdx, uiPartUnitIdx, true, false, true); |
---|
5025 | #else |
---|
5026 | pcTmpCU = getPUAbove(uiIdx, uiPartUnitIdx, true, true, true); |
---|
5027 | #endif |
---|
5028 | break; |
---|
5029 | } |
---|
5030 | case MD_ABOVE_RIGHT: |
---|
5031 | { |
---|
5032 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
5033 | pcTmpCU = getPUAboveRight(uiIdx, uiPartUnitIdx, true, false, true); |
---|
5034 | #else |
---|
5035 | pcTmpCU = getPUAboveRight(uiIdx, uiPartUnitIdx, true, true, true); |
---|
5036 | #endif |
---|
5037 | break; |
---|
5038 | } |
---|
5039 | case MD_BELOW_LEFT: |
---|
5040 | { |
---|
5041 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
5042 | pcTmpCU = getPUBelowLeft(uiIdx, uiPartUnitIdx, true, false); |
---|
5043 | #else |
---|
5044 | pcTmpCU = getPUBelowLeft(uiIdx, uiPartUnitIdx); |
---|
5045 | #endif |
---|
5046 | break; |
---|
5047 | } |
---|
5048 | case MD_ABOVE_LEFT: |
---|
5049 | { |
---|
5050 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
5051 | pcTmpCU = getPUAboveLeft(uiIdx, uiPartUnitIdx, true, false, true); |
---|
5052 | #else |
---|
5053 | pcTmpCU = getPUAboveLeft(uiIdx, uiPartUnitIdx, true, true, true); |
---|
5054 | #endif |
---|
5055 | break; |
---|
5056 | } |
---|
5057 | default: |
---|
5058 | { |
---|
5059 | break; |
---|
5060 | } |
---|
5061 | } |
---|
5062 | |
---|
5063 | if ( pcTmpCU != NULL && m_pcSlice->isEqualRef(eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx), iRefIdx) ) |
---|
5064 | { |
---|
5065 | TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); |
---|
5066 | |
---|
5067 | pInfo->m_acMvCand[ pInfo->iN++] = cMvPred; |
---|
5068 | return true; |
---|
5069 | } |
---|
5070 | |
---|
5071 | if ( pcTmpCU == NULL ) |
---|
5072 | { |
---|
5073 | return false; |
---|
5074 | } |
---|
5075 | |
---|
5076 | RefPicList eRefPicList2nd = REF_PIC_LIST_0; |
---|
5077 | if( eRefPicList == REF_PIC_LIST_0 ) |
---|
5078 | { |
---|
5079 | eRefPicList2nd = REF_PIC_LIST_1; |
---|
5080 | } |
---|
5081 | else if ( eRefPicList == REF_PIC_LIST_1) |
---|
5082 | { |
---|
5083 | eRefPicList2nd = REF_PIC_LIST_0; |
---|
5084 | } |
---|
5085 | |
---|
5086 | |
---|
5087 | Int iCurrRefPOC = m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getPOC(); |
---|
5088 | Int iNeibRefPOC; |
---|
5089 | |
---|
5090 | |
---|
5091 | if( pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) >= 0 ) |
---|
5092 | { |
---|
5093 | if( pcTmpCU->getSlice()->getRefViewId( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) ) != m_pcSlice->getRefViewId( eRefPicList, iRefIdx ) ) |
---|
5094 | { |
---|
5095 | return false; |
---|
5096 | } |
---|
5097 | iNeibRefPOC = pcTmpCU->getSlice()->getRefPOC( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) ); |
---|
5098 | if( iNeibRefPOC == iCurrRefPOC ) // Same Reference Frame But Diff List// |
---|
5099 | { |
---|
5100 | TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList2nd)->getMv(uiIdx); |
---|
5101 | pInfo->m_acMvCand[ pInfo->iN++] = cMvPred; |
---|
5102 | return true; |
---|
5103 | } |
---|
5104 | } |
---|
5105 | return false; |
---|
5106 | } |
---|
5107 | |
---|
5108 | #if !AMVP_PRUNING_SIMPLIFICATION |
---|
5109 | /** |
---|
5110 | * Reduce list of motion vector predictors to a set of unique predictors |
---|
5111 | * \param pInfo list of motion vector predictors |
---|
5112 | */ |
---|
5113 | Void TComDataCU::xUniqueMVPCand(AMVPInfo* pInfo) |
---|
5114 | { |
---|
5115 | Int n = 1; |
---|
5116 | if ( pInfo->iN == 0 ) |
---|
5117 | { |
---|
5118 | #if AMVP_ZERO_CHECKING_REMOVAL |
---|
5119 | return; |
---|
5120 | #else |
---|
5121 | // Add a zero candidate is none is available |
---|
5122 | pInfo->m_acMvCand[ 0 ].setZero(); |
---|
5123 | #endif |
---|
5124 | } |
---|
5125 | else |
---|
5126 | { |
---|
5127 | for (Int i = 1; i < pInfo->iN; i++) |
---|
5128 | { |
---|
5129 | Int j; |
---|
5130 | for (j = n - 1; j >= 0; j--) |
---|
5131 | { |
---|
5132 | if ( pInfo->m_acMvCand[ i ] == pInfo->m_acMvCand[ j ] ) |
---|
5133 | { |
---|
5134 | break; |
---|
5135 | } |
---|
5136 | } |
---|
5137 | if ( j < 0 ) |
---|
5138 | { |
---|
5139 | pInfo->m_acMvCand[ n++ ] = pInfo->m_acMvCand[ i ]; |
---|
5140 | } |
---|
5141 | } |
---|
5142 | } |
---|
5143 | pInfo->iN = n; |
---|
5144 | } |
---|
5145 | #endif |
---|
5146 | |
---|
5147 | /** |
---|
5148 | * \param pInfo |
---|
5149 | * \param eRefPicList |
---|
5150 | * \param iRefIdx |
---|
5151 | * \param uiPartUnitIdx |
---|
5152 | * \param eDir |
---|
5153 | * \returns Bool |
---|
5154 | */ |
---|
5155 | Bool TComDataCU::xAddMVPCandOrder( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir ) |
---|
5156 | { |
---|
5157 | TComDataCU* pcTmpCU = NULL; |
---|
5158 | UInt uiIdx; |
---|
5159 | switch( eDir ) |
---|
5160 | { |
---|
5161 | case MD_LEFT: |
---|
5162 | { |
---|
5163 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
5164 | pcTmpCU = getPULeft(uiIdx, uiPartUnitIdx, true, false); |
---|
5165 | #else |
---|
5166 | pcTmpCU = getPULeft(uiIdx, uiPartUnitIdx); |
---|
5167 | #endif |
---|
5168 | break; |
---|
5169 | } |
---|
5170 | case MD_ABOVE: |
---|
5171 | { |
---|
5172 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
5173 | pcTmpCU = getPUAbove(uiIdx, uiPartUnitIdx, true, false, true); |
---|
5174 | #else |
---|
5175 | pcTmpCU = getPUAbove(uiIdx, uiPartUnitIdx, true, true, true); |
---|
5176 | #endif |
---|
5177 | break; |
---|
5178 | } |
---|
5179 | case MD_ABOVE_RIGHT: |
---|
5180 | { |
---|
5181 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
5182 | pcTmpCU = getPUAboveRight(uiIdx, uiPartUnitIdx, true, false, true); |
---|
5183 | #else |
---|
5184 | pcTmpCU = getPUAboveRight(uiIdx, uiPartUnitIdx, true, true, true); |
---|
5185 | #endif |
---|
5186 | break; |
---|
5187 | } |
---|
5188 | case MD_BELOW_LEFT: |
---|
5189 | { |
---|
5190 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
5191 | pcTmpCU = getPUBelowLeft(uiIdx, uiPartUnitIdx, true, false); |
---|
5192 | #else |
---|
5193 | pcTmpCU = getPUBelowLeft(uiIdx, uiPartUnitIdx); |
---|
5194 | #endif |
---|
5195 | break; |
---|
5196 | } |
---|
5197 | case MD_ABOVE_LEFT: |
---|
5198 | { |
---|
5199 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
5200 | pcTmpCU = getPUAboveLeft(uiIdx, uiPartUnitIdx, true, false, true); |
---|
5201 | #else |
---|
5202 | pcTmpCU = getPUAboveLeft(uiIdx, uiPartUnitIdx, true, true, true); |
---|
5203 | #endif |
---|
5204 | break; |
---|
5205 | } |
---|
5206 | default: |
---|
5207 | { |
---|
5208 | break; |
---|
5209 | } |
---|
5210 | } |
---|
5211 | |
---|
5212 | if ( pcTmpCU == NULL ) |
---|
5213 | { |
---|
5214 | return false; |
---|
5215 | } |
---|
5216 | |
---|
5217 | RefPicList eRefPicList2nd = REF_PIC_LIST_0; |
---|
5218 | if( eRefPicList == REF_PIC_LIST_0 ) |
---|
5219 | { |
---|
5220 | eRefPicList2nd = REF_PIC_LIST_1; |
---|
5221 | } |
---|
5222 | else if ( eRefPicList == REF_PIC_LIST_1) |
---|
5223 | { |
---|
5224 | eRefPicList2nd = REF_PIC_LIST_0; |
---|
5225 | } |
---|
5226 | |
---|
5227 | Int iCurrPOC = m_pcSlice->getPOC(); |
---|
5228 | Int iCurrRefPOC = m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getPOC(); |
---|
5229 | Int iNeibPOC = iCurrPOC; |
---|
5230 | Int iNeibRefPOC; |
---|
5231 | |
---|
5232 | #if HHI_FIX |
---|
5233 | if( pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) >= 0 ) |
---|
5234 | { |
---|
5235 | iNeibRefPOC = pcTmpCU->getSlice()->getRefPOC( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) ); |
---|
5236 | if( pcTmpCU->getSlice()->getRefViewId( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) ) != m_pcSlice->getRefViewId( eRefPicList, iRefIdx ) ) |
---|
5237 | return false; |
---|
5238 | if( iNeibRefPOC == iCurrRefPOC ) // Same Reference Frame But Diff List// |
---|
5239 | { |
---|
5240 | TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList2nd)->getMv(uiIdx); |
---|
5241 | |
---|
5242 | clipMv(cMvPred); |
---|
5243 | pInfo->m_acMvCand[ pInfo->iN++] = cMvPred; |
---|
5244 | return true; |
---|
5245 | } |
---|
5246 | } |
---|
5247 | #endif |
---|
5248 | //--------------- V1 (END) ------------------// |
---|
5249 | if( pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) >= 0) |
---|
5250 | { |
---|
5251 | iNeibRefPOC = pcTmpCU->getSlice()->getRefPOC( eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ); |
---|
5252 | TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); |
---|
5253 | TComMv rcMv; |
---|
5254 | |
---|
5255 | if( pcTmpCU->getSlice()->getRefViewId( eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ) != m_pcSlice->getRefViewId( eRefPicList, iRefIdx ) ) |
---|
5256 | { |
---|
5257 | return false; |
---|
5258 | } |
---|
5259 | |
---|
5260 | Int iScale = xGetDistScaleFactor( iCurrPOC, iCurrRefPOC, iNeibPOC, iNeibRefPOC ); |
---|
5261 | if ( iScale == 4096 ) |
---|
5262 | { |
---|
5263 | rcMv = cMvPred; |
---|
5264 | } |
---|
5265 | else |
---|
5266 | { |
---|
5267 | rcMv = cMvPred.scaleMv( iScale ); |
---|
5268 | } |
---|
5269 | pInfo->m_acMvCand[ pInfo->iN++] = rcMv; |
---|
5270 | return true; |
---|
5271 | } |
---|
5272 | //---------------------- V2(END) --------------------// |
---|
5273 | if( pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) >= 0) |
---|
5274 | { |
---|
5275 | iNeibRefPOC = pcTmpCU->getSlice()->getRefPOC( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) ); |
---|
5276 | TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList2nd)->getMv(uiIdx); |
---|
5277 | TComMv rcMv; |
---|
5278 | |
---|
5279 | if( pcTmpCU->getSlice()->getRefViewId( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) ) != m_pcSlice->getRefViewId( eRefPicList, iRefIdx ) ) |
---|
5280 | { |
---|
5281 | return false; |
---|
5282 | } |
---|
5283 | |
---|
5284 | Int iScale = xGetDistScaleFactor( iCurrPOC, iCurrRefPOC, iNeibPOC, iNeibRefPOC ); |
---|
5285 | if ( iScale == 4096 ) |
---|
5286 | { |
---|
5287 | rcMv = cMvPred; |
---|
5288 | } |
---|
5289 | else |
---|
5290 | { |
---|
5291 | rcMv = cMvPred.scaleMv( iScale ); |
---|
5292 | } |
---|
5293 | pInfo->m_acMvCand[ pInfo->iN++] = rcMv; |
---|
5294 | return true; |
---|
5295 | } |
---|
5296 | //---------------------- V3(END) --------------------// |
---|
5297 | return false; |
---|
5298 | } |
---|
5299 | |
---|
5300 | #if QC_MULTI_DIS_CAN |
---|
5301 | Bool TComDataCU::xGetColDisMV( RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv , Int & iTargetViewIdx, Int & iStartViewIdx ) |
---|
5302 | { |
---|
5303 | |
---|
5304 | UInt uiAbsPartAddr = uiPartUnitIdx; |
---|
5305 | |
---|
5306 | RefPicList eColRefPicList = REF_PIC_LIST_0; |
---|
5307 | Int iColViewIdx, iColRefViewIdx; |
---|
5308 | TComPic *pColPic = getSlice()->getRefPic( eRefPicList, refidx); |
---|
5309 | TComDataCU *pColCU = pColPic->getCU( uiCUAddr ); |
---|
5310 | iColViewIdx = pColCU->getSlice()->getViewId(); |
---|
5311 | |
---|
5312 | if (pColCU->getPic()==0||pColCU->getPartitionSize(uiPartUnitIdx)==SIZE_NONE||pColCU->isIntra(uiAbsPartAddr)) |
---|
5313 | { |
---|
5314 | return false; |
---|
5315 | } |
---|
5316 | for (Int ilist = 0; ilist < (pColCU->getSlice()->isInterB()? 2:1); ilist++) |
---|
5317 | { |
---|
5318 | if(pColCU->getSlice()->isInterB()) |
---|
5319 | { |
---|
5320 | if(ilist == 0 ) |
---|
5321 | eColRefPicList = getSlice()->getCheckLDC() ? eRefPicList : RefPicList(1-getSlice()->getColDir()); |
---|
5322 | else |
---|
5323 | eColRefPicList = getSlice()->getCheckLDC() ? (eRefPicList== REF_PIC_LIST_0? REF_PIC_LIST_1:REF_PIC_LIST_0 ): RefPicList(getSlice()->getColDir()); |
---|
5324 | } |
---|
5325 | int iColRefIdx = pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiAbsPartAddr); |
---|
5326 | if (iColRefIdx < 0) |
---|
5327 | { |
---|
5328 | continue; |
---|
5329 | } |
---|
5330 | iColRefViewIdx = pColCU->getSlice()->getRefPic(eColRefPicList, iColRefIdx)->getViewId(); |
---|
5331 | if ( iColViewIdx == iColRefViewIdx ) // temporal vector |
---|
5332 | continue; |
---|
5333 | else |
---|
5334 | { |
---|
5335 | rcMv = pColCU->getCUMvField(eColRefPicList)->getMv(uiAbsPartAddr); |
---|
5336 | iTargetViewIdx = iColRefViewIdx ; |
---|
5337 | iStartViewIdx = iColViewIdx ; |
---|
5338 | return true; |
---|
5339 | } |
---|
5340 | } |
---|
5341 | return false; |
---|
5342 | } |
---|
5343 | #endif |
---|
5344 | /** |
---|
5345 | * \param eRefPicList |
---|
5346 | * \param uiCUAddr |
---|
5347 | * \param uiPartUnitIdx |
---|
5348 | * \param riRefIdx |
---|
5349 | * \returns Bool |
---|
5350 | */ |
---|
5351 | Bool TComDataCU::xGetColMVP( RefPicList eRefPicList, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx ) |
---|
5352 | { |
---|
5353 | UInt uiAbsPartAddr = uiPartUnitIdx; |
---|
5354 | |
---|
5355 | RefPicList eColRefPicList; |
---|
5356 | Int iColPOC, iColRefPOC, iCurrPOC, iCurrRefPOC, iScale; |
---|
5357 | #if SONY_COLPIC_AVAILABILITY |
---|
5358 | Int iColViewOrderIdx, iColRefViewOrderIdx, iCurrViewOrderIdx, iCurrRefViewOrderIdx; |
---|
5359 | #endif |
---|
5360 | TComMv cColMv; |
---|
5361 | |
---|
5362 | #if SONY_COLPIC_AVAILABILITY |
---|
5363 | iCurrViewOrderIdx = m_pcSlice->getViewOrderIdx(); |
---|
5364 | iCurrRefViewOrderIdx = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getViewOrderIdx(); |
---|
5365 | #endif |
---|
5366 | // use coldir. |
---|
5367 | #if COLLOCATED_REF_IDX |
---|
5368 | TComPic *pColPic = getSlice()->getRefPic( RefPicList(getSlice()->isInterB() ? getSlice()->getColDir() : 0), getSlice()->getColRefIdx()); |
---|
5369 | #else |
---|
5370 | TComPic *pColPic = getSlice()->getRefPic( RefPicList(getSlice()->isInterB() ? getSlice()->getColDir() : 0), 0); |
---|
5371 | #endif |
---|
5372 | TComDataCU *pColCU = pColPic->getCU( uiCUAddr ); |
---|
5373 | if(pColCU->getPic()==0||pColCU->getPartitionSize(uiPartUnitIdx)==SIZE_NONE) |
---|
5374 | { |
---|
5375 | return false; |
---|
5376 | } |
---|
5377 | iCurrPOC = m_pcSlice->getPOC(); |
---|
5378 | iCurrRefPOC = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getPOC(); |
---|
5379 | iColPOC = pColCU->getSlice()->getPOC(); |
---|
5380 | #if SONY_COLPIC_AVAILABILITY |
---|
5381 | iColViewOrderIdx = pColCU->getSlice()->getViewOrderIdx(); |
---|
5382 | #endif |
---|
5383 | |
---|
5384 | if (pColCU->isIntra(uiAbsPartAddr)) |
---|
5385 | { |
---|
5386 | return false; |
---|
5387 | } |
---|
5388 | |
---|
5389 | #if !SONY_COLPIC_AVAILABILITY |
---|
5390 | if( m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getViewId() != m_pcSlice->getViewId() ) |
---|
5391 | return false; |
---|
5392 | #endif |
---|
5393 | |
---|
5394 | if ( !pColPic->getUsedForTMVP() ) |
---|
5395 | { |
---|
5396 | return false; |
---|
5397 | } |
---|
5398 | |
---|
5399 | eColRefPicList = getSlice()->getCheckLDC() ? eRefPicList : RefPicList(1-getSlice()->getColDir()); |
---|
5400 | |
---|
5401 | Int iColRefIdx = pColCU->getCUMvField(RefPicList(eColRefPicList))->getRefIdx(uiAbsPartAddr); |
---|
5402 | |
---|
5403 | if (iColRefIdx < 0 ) |
---|
5404 | { |
---|
5405 | eColRefPicList = RefPicList(1 - eColRefPicList); |
---|
5406 | iColRefIdx = pColCU->getCUMvField(RefPicList(eColRefPicList))->getRefIdx(uiAbsPartAddr); |
---|
5407 | |
---|
5408 | if (iColRefIdx < 0 ) |
---|
5409 | { |
---|
5410 | return false; |
---|
5411 | } |
---|
5412 | } |
---|
5413 | |
---|
5414 | // Scale the vector. |
---|
5415 | iColRefPOC = pColCU->getSlice()->getRefPOC(eColRefPicList, iColRefIdx); |
---|
5416 | |
---|
5417 | #if SONY_COLPIC_AVAILABILITY |
---|
5418 | iColRefViewOrderIdx = pColCU->getSlice()->getRefPic( eColRefPicList, pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiAbsPartAddr))->getViewOrderIdx(); |
---|
5419 | #else |
---|
5420 | #if HHI_FIX |
---|
5421 | if( pColCU->getSlice()->getRefViewId( eColRefPicList, iColRefIdx ) != pColCU->getSlice()->getViewId() ) |
---|
5422 | #else |
---|
5423 | if( pColCU->getSlice()->getRefViewId( eColRefPicList, iColRefIdx ) != m_pcSlice->getRefPic( eRefPicList, riRefIdx )->getViewId() ) |
---|
5424 | #endif |
---|
5425 | { |
---|
5426 | return false; |
---|
5427 | } |
---|
5428 | #endif |
---|
5429 | |
---|
5430 | cColMv = pColCU->getCUMvField(eColRefPicList)->getMv(uiAbsPartAddr); |
---|
5431 | |
---|
5432 | iCurrRefPOC = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getPOC(); |
---|
5433 | #if SONY_COLPIC_AVAILABILITY |
---|
5434 | iScale = 0; |
---|
5435 | iCurrRefViewOrderIdx = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getViewOrderIdx(); |
---|
5436 | if((iColPOC != iColRefPOC)&&(iCurrPOC != iCurrRefPOC)) |
---|
5437 | iScale = xGetDistScaleFactor(iCurrPOC, iCurrRefPOC, iColPOC, iColRefPOC); |
---|
5438 | else if((iColPOC == iColRefPOC)&&(iCurrPOC == iCurrRefPOC)) |
---|
5439 | iScale = xGetDistScaleFactor(iCurrViewOrderIdx, iCurrRefViewOrderIdx, iColViewOrderIdx, iColRefViewOrderIdx); |
---|
5440 | #if HHI_FIX //GT: fix reported by Sony |
---|
5441 | else |
---|
5442 | return false; |
---|
5443 | #endif |
---|
5444 | #else |
---|
5445 | iScale = xGetDistScaleFactor(iCurrPOC, iCurrRefPOC, iColPOC, iColRefPOC); |
---|
5446 | #endif |
---|
5447 | if ( iScale == 4096 ) |
---|
5448 | { |
---|
5449 | rcMv = cColMv; |
---|
5450 | } |
---|
5451 | else |
---|
5452 | { |
---|
5453 | rcMv = cColMv.scaleMv( iScale ); |
---|
5454 | } |
---|
5455 | |
---|
5456 | return true; |
---|
5457 | } |
---|
5458 | |
---|
5459 | UInt TComDataCU::xGetMvdBits(TComMv cMvd) |
---|
5460 | { |
---|
5461 | return ( xGetComponentBits(cMvd.getHor()) + xGetComponentBits(cMvd.getVer()) ); |
---|
5462 | } |
---|
5463 | |
---|
5464 | UInt TComDataCU::xGetComponentBits(Int iVal) |
---|
5465 | { |
---|
5466 | UInt uiLength = 1; |
---|
5467 | UInt uiTemp = ( iVal <= 0) ? (-iVal<<1)+1: (iVal<<1); |
---|
5468 | |
---|
5469 | assert ( uiTemp ); |
---|
5470 | |
---|
5471 | while ( 1 != uiTemp ) |
---|
5472 | { |
---|
5473 | uiTemp >>= 1; |
---|
5474 | uiLength += 2; |
---|
5475 | } |
---|
5476 | |
---|
5477 | return uiLength; |
---|
5478 | } |
---|
5479 | |
---|
5480 | |
---|
5481 | Int TComDataCU::xGetDistScaleFactor(Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC) |
---|
5482 | { |
---|
5483 | Int iDiffPocD = iColPOC - iColRefPOC; |
---|
5484 | Int iDiffPocB = iCurrPOC - iCurrRefPOC; |
---|
5485 | |
---|
5486 | if( iDiffPocD == iDiffPocB ) |
---|
5487 | { |
---|
5488 | return 4096; |
---|
5489 | } |
---|
5490 | else |
---|
5491 | { |
---|
5492 | Int iTDB = Clip3( -128, 127, iDiffPocB ); |
---|
5493 | Int iTDD = Clip3( -128, 127, iDiffPocD ); |
---|
5494 | Int iX = (0x4000 + abs(iTDD/2)) / iTDD; |
---|
5495 | Int iScale = Clip3( -4096, 4095, (iTDB * iX + 32) >> 6 ); |
---|
5496 | return iScale; |
---|
5497 | } |
---|
5498 | } |
---|
5499 | |
---|
5500 | /** |
---|
5501 | * \param eCUMode |
---|
5502 | * \param uiPartIdx |
---|
5503 | * \param ruiPartIdxCenter |
---|
5504 | * \returns Void |
---|
5505 | */ |
---|
5506 | Void TComDataCU::xDeriveCenterIdx( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxCenter ) |
---|
5507 | { |
---|
5508 | UInt uiPartAddr; |
---|
5509 | Int iPartWidth; |
---|
5510 | Int iPartHeight; |
---|
5511 | getPartIndexAndSize( uiPartIdx, uiPartAddr, iPartWidth, iPartHeight); |
---|
5512 | |
---|
5513 | ruiPartIdxCenter = m_uiAbsIdxInLCU+uiPartAddr; // partition origin. |
---|
5514 | ruiPartIdxCenter = g_auiRasterToZscan[ g_auiZscanToRaster[ ruiPartIdxCenter ] |
---|
5515 | + ( iPartHeight/m_pcPic->getMinCUHeight() )/2*m_pcPic->getNumPartInWidth() |
---|
5516 | + ( iPartWidth/m_pcPic->getMinCUWidth() )/2]; |
---|
5517 | } |
---|
5518 | |
---|
5519 | /** |
---|
5520 | * \param uiPartIdx |
---|
5521 | * \param eRefPicList |
---|
5522 | * \param iRefIdx |
---|
5523 | * \param pcMv |
---|
5524 | * \returns Bool |
---|
5525 | */ |
---|
5526 | Bool TComDataCU::xGetCenterCol( UInt uiPartIdx, RefPicList eRefPicList, int iRefIdx, TComMv *pcMv ) |
---|
5527 | { |
---|
5528 | PartSize eCUMode = getPartitionSize( 0 ); |
---|
5529 | |
---|
5530 | Int iCurrPOC = m_pcSlice->getPOC(); |
---|
5531 | |
---|
5532 | // use coldir. |
---|
5533 | #if COLLOCATED_REF_IDX |
---|
5534 | TComPic *pColPic = getSlice()->getRefPic( RefPicList(getSlice()->isInterB() ? getSlice()->getColDir() : 0), getSlice()->getColRefIdx()); |
---|
5535 | #else |
---|
5536 | TComPic *pColPic = getSlice()->getRefPic( RefPicList(getSlice()->isInterB() ? getSlice()->getColDir() : 0), 0); |
---|
5537 | #endif |
---|
5538 | TComDataCU *pColCU = pColPic->getCU( m_uiCUAddr ); |
---|
5539 | |
---|
5540 | Int iColPOC = pColCU->getSlice()->getPOC(); |
---|
5541 | UInt uiPartIdxCenter; |
---|
5542 | xDeriveCenterIdx( eCUMode, uiPartIdx, uiPartIdxCenter ); |
---|
5543 | |
---|
5544 | if (pColCU->isIntra(uiPartIdxCenter)) |
---|
5545 | { |
---|
5546 | return false; |
---|
5547 | } |
---|
5548 | |
---|
5549 | if( m_pcSlice->getRefPic( eRefPicList, iRefIdx )->getViewId() != m_pcSlice->getViewId() ) |
---|
5550 | { |
---|
5551 | return false; |
---|
5552 | } |
---|
5553 | |
---|
5554 | // Prefer a vector crossing us. Prefer shortest. |
---|
5555 | RefPicList eColRefPicList = REF_PIC_LIST_0; |
---|
5556 | bool bFirstCrosses = false; |
---|
5557 | Int iFirstColDist = -1; |
---|
5558 | for (Int l = 0; l < 2; l++) |
---|
5559 | { |
---|
5560 | bool bSaveIt = false; |
---|
5561 | int iColRefIdx = pColCU->getCUMvField(RefPicList(l))->getRefIdx(uiPartIdxCenter); |
---|
5562 | if (iColRefIdx < 0) |
---|
5563 | { |
---|
5564 | continue; |
---|
5565 | } |
---|
5566 | int iColRefPOC = pColCU->getSlice()->getRefPOC(RefPicList(l), iColRefIdx); |
---|
5567 | if( pColCU->getSlice()->getRefViewId( RefPicList(l), iColRefIdx ) != pColCU->getSlice()->getViewId() ) |
---|
5568 | { |
---|
5569 | continue; |
---|
5570 | } |
---|
5571 | int iColDist = abs(iColRefPOC - iColPOC); |
---|
5572 | bool bCrosses = iColPOC < iCurrPOC ? iColRefPOC > iCurrPOC : iColRefPOC < iCurrPOC; |
---|
5573 | if (iFirstColDist < 0) |
---|
5574 | { |
---|
5575 | bSaveIt = true; |
---|
5576 | } |
---|
5577 | else if (bCrosses && !bFirstCrosses) |
---|
5578 | { |
---|
5579 | bSaveIt = true; |
---|
5580 | } |
---|
5581 | else if (bCrosses == bFirstCrosses && l == eRefPicList) |
---|
5582 | { |
---|
5583 | bSaveIt = true; |
---|
5584 | } |
---|
5585 | |
---|
5586 | if (bSaveIt) |
---|
5587 | { |
---|
5588 | bFirstCrosses = bCrosses; |
---|
5589 | iFirstColDist = iColDist; |
---|
5590 | eColRefPicList = RefPicList(l); |
---|
5591 | } |
---|
5592 | } |
---|
5593 | |
---|
5594 | // Scale the vector. |
---|
5595 | Int iColRefPOC = pColCU->getSlice()->getRefPOC(eColRefPicList, pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiPartIdxCenter)); |
---|
5596 | TComMv cColMv = pColCU->getCUMvField(eColRefPicList)->getMv(uiPartIdxCenter); |
---|
5597 | |
---|
5598 | Int iCurrRefPOC = m_pcSlice->getRefPic(eRefPicList, iRefIdx)->getPOC(); |
---|
5599 | Int iScale = xGetDistScaleFactor(iCurrPOC, iCurrRefPOC, iColPOC, iColRefPOC); |
---|
5600 | if ( iScale == 4096 ) |
---|
5601 | { |
---|
5602 | pcMv[0] = cColMv; |
---|
5603 | } |
---|
5604 | else |
---|
5605 | { |
---|
5606 | pcMv[0] = cColMv.scaleMv( iScale ); |
---|
5607 | } |
---|
5608 | |
---|
5609 | return true; |
---|
5610 | } |
---|
5611 | |
---|
5612 | Void TComDataCU::compressMV() |
---|
5613 | { |
---|
5614 | Int scaleFactor = 4 * AMVP_DECIMATION_FACTOR / m_unitSize; |
---|
5615 | if (scaleFactor > 0) |
---|
5616 | { |
---|
5617 | #if HHI_MPI |
---|
5618 | m_acCUMvField[0].compress(m_pePredMode, m_puhInterDir, scaleFactor); |
---|
5619 | m_acCUMvField[1].compress(m_pePredMode, m_puhInterDir, scaleFactor); |
---|
5620 | #else |
---|
5621 | m_acCUMvField[0].compress(m_pePredMode, scaleFactor); |
---|
5622 | m_acCUMvField[1].compress(m_pePredMode, scaleFactor); |
---|
5623 | #endif |
---|
5624 | } |
---|
5625 | } |
---|
5626 | |
---|
5627 | UInt TComDataCU::getCoefScanIdx(UInt uiAbsPartIdx, UInt uiWidth, Bool bIsLuma, Bool bIsIntra) |
---|
5628 | { |
---|
5629 | #if !LOGI_INTRA_NAME_3MPM |
---|
5630 | static const UChar aucIntraDirToScanIdx[MAX_CU_DEPTH][NUM_INTRA_MODE] = |
---|
5631 | { |
---|
5632 | {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 |
---|
5633 | }, |
---|
5634 | {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 |
---|
5635 | }, |
---|
5636 | {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 |
---|
5637 | }, |
---|
5638 | {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 |
---|
5639 | }, |
---|
5640 | {0, 1, 2, 0, 0, 1, 1, 0, 2, 2, 0, 0, 1, 1, 0, 0, 2, 2, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0 |
---|
5641 | }, |
---|
5642 | {0, 1, 2, 0, 0, 1, 1, 0, 2, 2, 0, 0, 1, 1, 0, 0, 2, 2, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0 |
---|
5643 | }, |
---|
5644 | {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 |
---|
5645 | }, |
---|
5646 | }; |
---|
5647 | #endif |
---|
5648 | |
---|
5649 | UInt uiCTXIdx; |
---|
5650 | UInt uiScanIdx; |
---|
5651 | UInt uiDirMode; |
---|
5652 | |
---|
5653 | if ( !bIsIntra ) |
---|
5654 | { |
---|
5655 | uiScanIdx = SCAN_ZIGZAG; |
---|
5656 | return uiScanIdx; |
---|
5657 | } |
---|
5658 | |
---|
5659 | switch(uiWidth) |
---|
5660 | { |
---|
5661 | case 2: uiCTXIdx = 6; break; |
---|
5662 | case 4: uiCTXIdx = 5; break; |
---|
5663 | case 8: uiCTXIdx = 4; break; |
---|
5664 | case 16: uiCTXIdx = 3; break; |
---|
5665 | case 32: uiCTXIdx = 2; break; |
---|
5666 | case 64: uiCTXIdx = 1; break; |
---|
5667 | default: uiCTXIdx = 0; break; |
---|
5668 | } |
---|
5669 | |
---|
5670 | if ( bIsLuma ) |
---|
5671 | { |
---|
5672 | uiDirMode = getLumaIntraDir(uiAbsPartIdx); |
---|
5673 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
5674 | mapDMMtoIntraMode( uiDirMode ); |
---|
5675 | #endif |
---|
5676 | |
---|
5677 | #if LOGI_INTRA_NAME_3MPM |
---|
5678 | uiScanIdx = SCAN_ZIGZAG; |
---|
5679 | if (uiCTXIdx >3 && uiCTXIdx < 6) //if multiple scans supported for PU size |
---|
5680 | { |
---|
5681 | uiScanIdx = abs((Int) uiDirMode - VER_IDX) < 5 ? 1 : (abs((Int)uiDirMode - HOR_IDX) < 5 ? 2 : 0); |
---|
5682 | } |
---|
5683 | #else |
---|
5684 | uiScanIdx = aucIntraDirToScanIdx[uiCTXIdx][uiDirMode]; |
---|
5685 | #endif |
---|
5686 | } |
---|
5687 | else |
---|
5688 | { |
---|
5689 | uiDirMode = getChromaIntraDir(uiAbsPartIdx); |
---|
5690 | if( uiDirMode == DM_CHROMA_IDX ) |
---|
5691 | { |
---|
5692 | // get number of partitions in current CU |
---|
5693 | UInt depth = getDepth(uiAbsPartIdx); |
---|
5694 | UInt numParts = getPic()->getNumPartInCU() >> (2 * depth); |
---|
5695 | |
---|
5696 | // get luma mode from upper-left corner of current CU |
---|
5697 | uiDirMode = getLumaIntraDir((uiAbsPartIdx/numParts)*numParts); |
---|
5698 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
5699 | mapDMMtoIntraMode( uiDirMode ); |
---|
5700 | #endif |
---|
5701 | } |
---|
5702 | #if LOGI_INTRA_NAME_3MPM |
---|
5703 | uiScanIdx = SCAN_ZIGZAG; |
---|
5704 | if (uiCTXIdx >4 && uiCTXIdx < 7) //if multiple scans supported for PU size |
---|
5705 | { |
---|
5706 | uiScanIdx = abs((Int) uiDirMode - VER_IDX) < 5 ? 1 : (abs((Int)uiDirMode - HOR_IDX) < 5 ? 2 : 0); |
---|
5707 | } |
---|
5708 | #else |
---|
5709 | uiScanIdx = aucIntraDirToScanIdx[max<Int>(uiCTXIdx-1,0)][uiDirMode]; |
---|
5710 | #endif |
---|
5711 | } |
---|
5712 | |
---|
5713 | return uiScanIdx; |
---|
5714 | } |
---|
5715 | |
---|
5716 | Bool TComDataCU::useNonSquareTrans(UInt uiTrMode, Int absPartIdx) |
---|
5717 | { |
---|
5718 | UInt minTuSize = ( 1 << ( getSlice()->getSPS()->getQuadtreeTULog2MinSize() + 1 ) ); |
---|
5719 | const UInt uiLog2TrSize = g_aucConvertToBit[ getSlice()->getSPS()->getMaxCUWidth() >> ( m_puhDepth[ absPartIdx ] + uiTrMode ) ] + 2; |
---|
5720 | if ( uiTrMode && uiLog2TrSize < getSlice()->getSPS()->getQuadtreeTULog2MaxSize() && ( getWidth( absPartIdx ) > minTuSize ) && |
---|
5721 | ( m_pePartSize[absPartIdx] == SIZE_Nx2N || m_pePartSize[absPartIdx] == SIZE_2NxN || ( m_pePartSize[absPartIdx] >= SIZE_2NxnU && m_pePartSize[absPartIdx] <= SIZE_nRx2N ) ) ) |
---|
5722 | { |
---|
5723 | return getSlice()->getSPS()->getUseNSQT(); |
---|
5724 | } |
---|
5725 | else |
---|
5726 | { |
---|
5727 | return false; |
---|
5728 | } |
---|
5729 | } |
---|
5730 | |
---|
5731 | Void TComDataCU::getNSQTSize(Int trMode, Int absPartIdx, Int &trWidth, Int &trHeight) |
---|
5732 | { |
---|
5733 | UInt minTuSize = ( 1 << getSlice()->getSPS()->getQuadtreeTULog2MinSize() ); |
---|
5734 | if ( useNonSquareTrans( trMode, absPartIdx ) && ( trWidth > minTuSize ) ) |
---|
5735 | { |
---|
5736 | trWidth = ( m_pePartSize[absPartIdx] == SIZE_Nx2N || m_pePartSize[absPartIdx] == SIZE_nLx2N || m_pePartSize[absPartIdx] == SIZE_nRx2N )? trWidth >> 1 : trWidth << 1; |
---|
5737 | trHeight = ( m_pePartSize[absPartIdx] == SIZE_Nx2N || m_pePartSize[absPartIdx] == SIZE_nLx2N || m_pePartSize[absPartIdx] == SIZE_nRx2N )? trHeight << 1 : trHeight >> 1; |
---|
5738 | } |
---|
5739 | } |
---|
5740 | Bool TComDataCU::useNonSquarePU(UInt absPartIdx) |
---|
5741 | { |
---|
5742 | if ( ( m_pePartSize[absPartIdx] == SIZE_Nx2N ) || ( m_pePartSize[absPartIdx] == SIZE_2NxN ) || ( m_pePartSize[absPartIdx] >= SIZE_2NxnU && m_pePartSize[absPartIdx] <= SIZE_nRx2N ) ) |
---|
5743 | { |
---|
5744 | return true; |
---|
5745 | } |
---|
5746 | else |
---|
5747 | { |
---|
5748 | return false; |
---|
5749 | } |
---|
5750 | } |
---|
5751 | |
---|
5752 | UInt TComDataCU::getInterTUSplitDirection( Int trWidth, Int trHeight, Int trLastWidth, Int trLastHeight ) |
---|
5753 | { |
---|
5754 | UInt interTUSplitDirection = 2; |
---|
5755 | if ( ( trWidth == trLastWidth ) && ( trHeight < trLastHeight ) ) |
---|
5756 | { |
---|
5757 | interTUSplitDirection = 0; |
---|
5758 | } |
---|
5759 | else if ( ( trWidth < trLastWidth ) && ( trHeight == trLastHeight ) ) |
---|
5760 | { |
---|
5761 | interTUSplitDirection = 1; |
---|
5762 | } |
---|
5763 | |
---|
5764 | return interTUSplitDirection; |
---|
5765 | } |
---|
5766 | |
---|
5767 | UInt TComDataCU::getNSAbsPartIdx ( UInt log2TrafoSize, UInt absPartIdx, UInt absTUPartIdx, UInt innerQuadIdx, UInt trMode ) |
---|
5768 | { |
---|
5769 | Int trWidth, trHeight, trLastWidth, trLastHeight; |
---|
5770 | UInt lcuWidthInBaseUnits = getPic()->getNumPartInWidth(); |
---|
5771 | UInt nsTUWidthInBaseUnits, nsTUHeightInBaseUnits; |
---|
5772 | UInt interTUSplitDirection; |
---|
5773 | |
---|
5774 | if( isIntra(absPartIdx) ) |
---|
5775 | { |
---|
5776 | return absPartIdx; |
---|
5777 | } |
---|
5778 | |
---|
5779 | trWidth = trHeight = ( 1 << log2TrafoSize ); |
---|
5780 | trLastWidth = trWidth << 1, trLastHeight = trHeight << 1; |
---|
5781 | |
---|
5782 | getNSQTSize( trMode, absPartIdx, trWidth, trHeight ); |
---|
5783 | getNSQTSize( trMode - 1, absPartIdx, trLastWidth, trLastHeight ); |
---|
5784 | interTUSplitDirection = getInterTUSplitDirection ( trWidth, trHeight, trLastWidth, trLastHeight ); |
---|
5785 | |
---|
5786 | nsTUWidthInBaseUnits = trWidth / getPic()->getMinCUWidth(); |
---|
5787 | nsTUHeightInBaseUnits = trHeight / getPic()->getMinCUHeight(); |
---|
5788 | |
---|
5789 | if ( interTUSplitDirection != 2 ) |
---|
5790 | { |
---|
5791 | UInt uiNSTUBaseUnits = nsTUWidthInBaseUnits < nsTUHeightInBaseUnits ? nsTUWidthInBaseUnits : nsTUHeightInBaseUnits; |
---|
5792 | absTUPartIdx = g_auiRasterToZscan[ g_auiZscanToRaster[absTUPartIdx] + innerQuadIdx * uiNSTUBaseUnits * lcuWidthInBaseUnits * ( 1 - interTUSplitDirection ) + innerQuadIdx * uiNSTUBaseUnits * interTUSplitDirection ]; |
---|
5793 | } |
---|
5794 | else |
---|
5795 | { |
---|
5796 | absTUPartIdx = g_auiRasterToZscan[ g_auiZscanToRaster[absTUPartIdx] + (innerQuadIdx & 0x01) * nsTUWidthInBaseUnits + ( ( innerQuadIdx >> 1 ) & 0x01 ) * nsTUHeightInBaseUnits * lcuWidthInBaseUnits ]; |
---|
5797 | } |
---|
5798 | |
---|
5799 | return absTUPartIdx; |
---|
5800 | } |
---|
5801 | |
---|
5802 | UInt TComDataCU::getNSAddrChroma( UInt uiLog2TrSizeC, UInt uiTrModeC, UInt uiQuadrant, UInt absTUPartIdx ) |
---|
5803 | { |
---|
5804 | if( uiLog2TrSizeC != getSlice()->getSPS()->getQuadtreeTULog2MinSize() ) |
---|
5805 | { |
---|
5806 | return absTUPartIdx; |
---|
5807 | } |
---|
5808 | |
---|
5809 | UInt lcuWidthInBaseUnits = getPic()->getNumPartInWidth(); |
---|
5810 | Int trWidth = ( 1 << ( uiLog2TrSizeC + 1 ) ); |
---|
5811 | Int trHeight = ( 1 << ( uiLog2TrSizeC + 1 ) ); |
---|
5812 | Int trLastWidth = trWidth << 1, trLastHeight = trHeight << 1; |
---|
5813 | |
---|
5814 | getNSQTSize ( uiTrModeC - 1, absTUPartIdx, trLastWidth, trLastHeight ); |
---|
5815 | getNSQTSize ( uiTrModeC, absTUPartIdx, trWidth, trHeight ); |
---|
5816 | |
---|
5817 | UInt interTUSplitDirection = getInterTUSplitDirection ( trWidth, trHeight, trLastWidth, trLastHeight ); |
---|
5818 | UInt nsTUWidthInBaseUnits = trWidth / getPic()->getMinCUWidth(); |
---|
5819 | UInt nsTUHeightInBaseUnits = trHeight / getPic()->getMinCUHeight(); |
---|
5820 | UInt firstTURasterIdx = 0, absTUPartIdxC = 0; |
---|
5821 | |
---|
5822 | if(interTUSplitDirection != 2) |
---|
5823 | { |
---|
5824 | UInt uiNSTUBaseUnits = nsTUWidthInBaseUnits < nsTUHeightInBaseUnits ? 1 : lcuWidthInBaseUnits; |
---|
5825 | firstTURasterIdx = g_auiZscanToRaster[absTUPartIdx] - uiQuadrant * uiNSTUBaseUnits; |
---|
5826 | absTUPartIdxC = g_auiRasterToZscan[firstTURasterIdx] + uiQuadrant * nsTUWidthInBaseUnits * nsTUHeightInBaseUnits; |
---|
5827 | } |
---|
5828 | else |
---|
5829 | { |
---|
5830 | UInt uiNSTUBaseUnits = nsTUWidthInBaseUnits < nsTUHeightInBaseUnits ? 2 * lcuWidthInBaseUnits : 2; |
---|
5831 | firstTURasterIdx = g_auiZscanToRaster[absTUPartIdx] - ( ( uiQuadrant >> 1 ) & 0x01 ) * nsTUHeightInBaseUnits * lcuWidthInBaseUnits - ( uiQuadrant & 0x01 ) * nsTUWidthInBaseUnits; |
---|
5832 | absTUPartIdxC = g_auiRasterToZscan[firstTURasterIdx + uiQuadrant * uiNSTUBaseUnits]; |
---|
5833 | } |
---|
5834 | |
---|
5835 | return absTUPartIdxC; |
---|
5836 | } |
---|
5837 | |
---|
5838 | |
---|
5839 | UInt TComDataCU::getSCUAddr() |
---|
5840 | { |
---|
5841 | return getPic()->getPicSym()->getInverseCUOrderMap(m_uiCUAddr)*(1<<(m_pcSlice->getSPS()->getMaxCUDepth()<<1))+m_uiAbsIdxInLCU; |
---|
5842 | } |
---|
5843 | |
---|
5844 | /** Set neighboring blocks availabilities for non-deblocked filtering |
---|
5845 | * \param numLCUInPicWidth number of LCUs in picture width |
---|
5846 | * \param numLCUInPicHeight number of LCUs in picture height |
---|
5847 | * \param numSUInLCUWidth number of SUs in LCU width |
---|
5848 | * \param numSUInLCUHeight number of SUs in LCU height |
---|
5849 | * \param picWidth picture width |
---|
5850 | * \param picHeight picture height |
---|
5851 | * \param bIndependentSliceBoundaryEnabled true for independent slice boundary enabled |
---|
5852 | * \param bTopTileBoundary true means that top boundary coincides tile boundary |
---|
5853 | * \param bDownTileBoundary true means that bottom boundary coincides tile boundary |
---|
5854 | * \param bLeftTileBoundary true means that left boundary coincides tile boundary |
---|
5855 | * \param bRightTileBoundary true means that right boundary coincides tile boundary |
---|
5856 | * \param bIndependentTileBoundaryEnabled true for independent tile boundary enabled |
---|
5857 | */ |
---|
5858 | Void TComDataCU::setNDBFilterBlockBorderAvailability(UInt numLCUInPicWidth, UInt numLCUInPicHeight, UInt numSUInLCUWidth, UInt numSUInLCUHeight, UInt picWidth, UInt picHeight |
---|
5859 | ,Bool bIndependentSliceBoundaryEnabled |
---|
5860 | ,Bool bTopTileBoundary, Bool bDownTileBoundary, Bool bLeftTileBoundary, Bool bRightTileBoundary |
---|
5861 | ,Bool bIndependentTileBoundaryEnabled) |
---|
5862 | { |
---|
5863 | UInt numSUInLCU = numSUInLCUWidth*numSUInLCUHeight; |
---|
5864 | Int* pSliceIDMapLCU = m_piSliceSUMap; |
---|
5865 | |
---|
5866 | UInt uiLPelX, uiTPelY; |
---|
5867 | UInt width, height; |
---|
5868 | Bool bPicRBoundary, bPicBBoundary, bPicTBoundary, bPicLBoundary; |
---|
5869 | Bool bLCURBoundary= false, bLCUBBoundary= false, bLCUTBoundary= false, bLCULBoundary= false; |
---|
5870 | Bool* pbAvailBorder; |
---|
5871 | Bool* pbAvail; |
---|
5872 | UInt rTLSU, rBRSU, widthSU, heightSU; |
---|
5873 | UInt zRefSU; |
---|
5874 | Int* pRefID; |
---|
5875 | Int* pRefMapLCU; |
---|
5876 | UInt rTRefSU= 0, rBRefSU= 0, rLRefSU= 0, rRRefSU= 0; |
---|
5877 | Int* pRRefMapLCU= NULL; |
---|
5878 | Int* pLRefMapLCU= NULL; |
---|
5879 | Int* pTRefMapLCU= NULL; |
---|
5880 | Int* pBRefMapLCU= NULL; |
---|
5881 | Int sliceID; |
---|
5882 | UInt numSGU = (UInt)m_vNDFBlock.size(); |
---|
5883 | |
---|
5884 | for(Int i=0; i< numSGU; i++) |
---|
5885 | { |
---|
5886 | NDBFBlockInfo& rSGU = m_vNDFBlock[i]; |
---|
5887 | |
---|
5888 | sliceID = rSGU.sliceID; |
---|
5889 | uiLPelX = rSGU.posX; |
---|
5890 | uiTPelY = rSGU.posY; |
---|
5891 | width = rSGU.width; |
---|
5892 | height = rSGU.height; |
---|
5893 | |
---|
5894 | rTLSU = g_auiZscanToRaster[ rSGU.startSU ]; |
---|
5895 | rBRSU = g_auiZscanToRaster[ rSGU.endSU ]; |
---|
5896 | widthSU = rSGU.widthSU; |
---|
5897 | heightSU = rSGU.heightSU; |
---|
5898 | |
---|
5899 | pbAvailBorder = rSGU.isBorderAvailable; |
---|
5900 | |
---|
5901 | bPicTBoundary= (uiTPelY == 0 )?(true):(false); |
---|
5902 | bPicLBoundary= (uiLPelX == 0 )?(true):(false); |
---|
5903 | bPicRBoundary= (!(uiLPelX+ width < picWidth ) )?(true):(false); |
---|
5904 | bPicBBoundary= (!(uiTPelY + height < picHeight))?(true):(false); |
---|
5905 | |
---|
5906 | bLCULBoundary = (rTLSU % numSUInLCUWidth == 0)?(true):(false); |
---|
5907 | bLCURBoundary = ( (rTLSU+ widthSU) % numSUInLCUWidth == 0)?(true):(false); |
---|
5908 | bLCUTBoundary = ( (UInt)(rTLSU / numSUInLCUWidth)== 0)?(true):(false); |
---|
5909 | bLCUBBoundary = ( (UInt)(rBRSU / numSUInLCUWidth) == (numSUInLCUHeight-1) )?(true):(false); |
---|
5910 | |
---|
5911 | // SGU_L |
---|
5912 | pbAvail = &(pbAvailBorder[SGU_L]); |
---|
5913 | if(bPicLBoundary) |
---|
5914 | { |
---|
5915 | *pbAvail = false; |
---|
5916 | } |
---|
5917 | else if (!bIndependentSliceBoundaryEnabled) |
---|
5918 | { |
---|
5919 | *pbAvail = true; |
---|
5920 | } |
---|
5921 | else |
---|
5922 | { |
---|
5923 | // bLCULBoundary = (rTLSU % uiNumSUInLCUWidth == 0)?(true):(false); |
---|
5924 | if(bLCULBoundary) |
---|
5925 | { |
---|
5926 | rLRefSU = rTLSU + numSUInLCUWidth -1; |
---|
5927 | zRefSU = g_auiRasterToZscan[rLRefSU]; |
---|
5928 | pRefMapLCU = pLRefMapLCU= (pSliceIDMapLCU - numSUInLCU); |
---|
5929 | } |
---|
5930 | else |
---|
5931 | { |
---|
5932 | zRefSU = g_auiRasterToZscan[rTLSU - 1]; |
---|
5933 | pRefMapLCU = pSliceIDMapLCU; |
---|
5934 | } |
---|
5935 | pRefID = pRefMapLCU + zRefSU; |
---|
5936 | *pbAvail = (*pRefID == sliceID)?(true):(false); |
---|
5937 | } |
---|
5938 | |
---|
5939 | // SGU_R |
---|
5940 | pbAvail = &(pbAvailBorder[SGU_R]); |
---|
5941 | if(bPicRBoundary) |
---|
5942 | { |
---|
5943 | *pbAvail = false; |
---|
5944 | } |
---|
5945 | else if (!bIndependentSliceBoundaryEnabled) |
---|
5946 | { |
---|
5947 | *pbAvail = true; |
---|
5948 | } |
---|
5949 | else |
---|
5950 | { |
---|
5951 | // bLCURBoundary = ( (rTLSU+ uiWidthSU) % uiNumSUInLCUWidth == 0)?(true):(false); |
---|
5952 | if(bLCURBoundary) |
---|
5953 | { |
---|
5954 | rRRefSU = rTLSU + widthSU - numSUInLCUWidth; |
---|
5955 | zRefSU = g_auiRasterToZscan[rRRefSU]; |
---|
5956 | pRefMapLCU = pRRefMapLCU= (pSliceIDMapLCU + numSUInLCU); |
---|
5957 | } |
---|
5958 | else |
---|
5959 | { |
---|
5960 | zRefSU = g_auiRasterToZscan[rTLSU + widthSU]; |
---|
5961 | pRefMapLCU = pSliceIDMapLCU; |
---|
5962 | } |
---|
5963 | pRefID = pRefMapLCU + zRefSU; |
---|
5964 | *pbAvail = (*pRefID == sliceID)?(true):(false); |
---|
5965 | } |
---|
5966 | |
---|
5967 | // SGU_T |
---|
5968 | pbAvail = &(pbAvailBorder[SGU_T]); |
---|
5969 | if(bPicTBoundary) |
---|
5970 | { |
---|
5971 | *pbAvail = false; |
---|
5972 | } |
---|
5973 | else if (!bIndependentSliceBoundaryEnabled) |
---|
5974 | { |
---|
5975 | *pbAvail = true; |
---|
5976 | } |
---|
5977 | else |
---|
5978 | { |
---|
5979 | // bLCUTBoundary = ( (UInt)(rTLSU / uiNumSUInLCUWidth)== 0)?(true):(false); |
---|
5980 | if(bLCUTBoundary) |
---|
5981 | { |
---|
5982 | rTRefSU = numSUInLCU - (numSUInLCUWidth - rTLSU); |
---|
5983 | zRefSU = g_auiRasterToZscan[rTRefSU]; |
---|
5984 | pRefMapLCU = pTRefMapLCU= (pSliceIDMapLCU - (numLCUInPicWidth*numSUInLCU)); |
---|
5985 | } |
---|
5986 | else |
---|
5987 | { |
---|
5988 | zRefSU = g_auiRasterToZscan[rTLSU - numSUInLCUWidth]; |
---|
5989 | pRefMapLCU = pSliceIDMapLCU; |
---|
5990 | } |
---|
5991 | pRefID = pRefMapLCU + zRefSU; |
---|
5992 | *pbAvail = (*pRefID == sliceID)?(true):(false); |
---|
5993 | } |
---|
5994 | |
---|
5995 | // SGU_B |
---|
5996 | pbAvail = &(pbAvailBorder[SGU_B]); |
---|
5997 | if(bPicBBoundary) |
---|
5998 | { |
---|
5999 | *pbAvail = false; |
---|
6000 | } |
---|
6001 | else if (!bIndependentSliceBoundaryEnabled) |
---|
6002 | { |
---|
6003 | *pbAvail = true; |
---|
6004 | } |
---|
6005 | else |
---|
6006 | { |
---|
6007 | // bLCUBBoundary = ( (UInt)(rBRSU / uiNumSUInLCUWidth) == (uiNumSUInLCUHeight-1) )?(true):(false); |
---|
6008 | if(bLCUBBoundary) |
---|
6009 | { |
---|
6010 | rBRefSU = rTLSU % numSUInLCUWidth; |
---|
6011 | zRefSU = g_auiRasterToZscan[rBRefSU]; |
---|
6012 | pRefMapLCU = pBRefMapLCU= (pSliceIDMapLCU + (numLCUInPicWidth*numSUInLCU)); |
---|
6013 | } |
---|
6014 | else |
---|
6015 | { |
---|
6016 | zRefSU = g_auiRasterToZscan[rTLSU + (heightSU*numSUInLCUWidth)]; |
---|
6017 | pRefMapLCU = pSliceIDMapLCU; |
---|
6018 | } |
---|
6019 | pRefID = pRefMapLCU + zRefSU; |
---|
6020 | *pbAvail = (*pRefID == sliceID)?(true):(false); |
---|
6021 | } |
---|
6022 | |
---|
6023 | // SGU_TL |
---|
6024 | pbAvail = &(pbAvailBorder[SGU_TL]); |
---|
6025 | if(bPicTBoundary || bPicLBoundary) |
---|
6026 | { |
---|
6027 | *pbAvail = false; |
---|
6028 | } |
---|
6029 | else if (!bIndependentSliceBoundaryEnabled) |
---|
6030 | { |
---|
6031 | *pbAvail = true; |
---|
6032 | } |
---|
6033 | else |
---|
6034 | { |
---|
6035 | if(bLCUTBoundary && bLCULBoundary) |
---|
6036 | { |
---|
6037 | zRefSU = numSUInLCU -1; |
---|
6038 | pRefMapLCU = pSliceIDMapLCU - ( (numLCUInPicWidth+1)*numSUInLCU); |
---|
6039 | } |
---|
6040 | else if(bLCUTBoundary) |
---|
6041 | { |
---|
6042 | zRefSU = g_auiRasterToZscan[ rTRefSU- 1]; |
---|
6043 | pRefMapLCU = pTRefMapLCU; |
---|
6044 | } |
---|
6045 | else if(bLCULBoundary) |
---|
6046 | { |
---|
6047 | zRefSU = g_auiRasterToZscan[ rLRefSU- numSUInLCUWidth ]; |
---|
6048 | pRefMapLCU = pLRefMapLCU; |
---|
6049 | } |
---|
6050 | else //inside LCU |
---|
6051 | { |
---|
6052 | zRefSU = g_auiRasterToZscan[ rTLSU - numSUInLCUWidth -1]; |
---|
6053 | pRefMapLCU = pSliceIDMapLCU; |
---|
6054 | } |
---|
6055 | pRefID = pRefMapLCU + zRefSU; |
---|
6056 | *pbAvail = (*pRefID == sliceID)?(true):(false); |
---|
6057 | } |
---|
6058 | |
---|
6059 | // SGU_TR |
---|
6060 | pbAvail = &(pbAvailBorder[SGU_TR]); |
---|
6061 | if(bPicTBoundary || bPicRBoundary) |
---|
6062 | { |
---|
6063 | *pbAvail = false; |
---|
6064 | } |
---|
6065 | else if (!bIndependentSliceBoundaryEnabled) |
---|
6066 | { |
---|
6067 | *pbAvail = true; |
---|
6068 | } |
---|
6069 | else |
---|
6070 | { |
---|
6071 | if(bLCUTBoundary && bLCURBoundary) |
---|
6072 | { |
---|
6073 | zRefSU = g_auiRasterToZscan[numSUInLCU - numSUInLCUWidth]; |
---|
6074 | pRefMapLCU = pSliceIDMapLCU - ( (numLCUInPicWidth-1)*numSUInLCU); |
---|
6075 | } |
---|
6076 | else if(bLCUTBoundary) |
---|
6077 | { |
---|
6078 | zRefSU = g_auiRasterToZscan[ rTRefSU+ widthSU]; |
---|
6079 | pRefMapLCU = pTRefMapLCU; |
---|
6080 | } |
---|
6081 | else if(bLCURBoundary) |
---|
6082 | { |
---|
6083 | zRefSU = g_auiRasterToZscan[ rRRefSU- numSUInLCUWidth ]; |
---|
6084 | pRefMapLCU = pRRefMapLCU; |
---|
6085 | } |
---|
6086 | else //inside LCU |
---|
6087 | { |
---|
6088 | zRefSU = g_auiRasterToZscan[ rTLSU - numSUInLCUWidth +widthSU]; |
---|
6089 | pRefMapLCU = pSliceIDMapLCU; |
---|
6090 | } |
---|
6091 | pRefID = pRefMapLCU + zRefSU; |
---|
6092 | *pbAvail = (*pRefID == sliceID)?(true):(false); |
---|
6093 | } |
---|
6094 | |
---|
6095 | // SGU_BL |
---|
6096 | pbAvail = &(pbAvailBorder[SGU_BL]); |
---|
6097 | if(bPicBBoundary || bPicLBoundary) |
---|
6098 | { |
---|
6099 | *pbAvail = false; |
---|
6100 | } |
---|
6101 | else if (!bIndependentSliceBoundaryEnabled) |
---|
6102 | { |
---|
6103 | *pbAvail = true; |
---|
6104 | } |
---|
6105 | else |
---|
6106 | { |
---|
6107 | if(bLCUBBoundary && bLCULBoundary) |
---|
6108 | { |
---|
6109 | zRefSU = g_auiRasterToZscan[numSUInLCUWidth - 1]; |
---|
6110 | pRefMapLCU = pSliceIDMapLCU + ( (numLCUInPicWidth-1)*numSUInLCU); |
---|
6111 | } |
---|
6112 | else if(bLCUBBoundary) |
---|
6113 | { |
---|
6114 | zRefSU = g_auiRasterToZscan[ rBRefSU - 1]; |
---|
6115 | pRefMapLCU = pBRefMapLCU; |
---|
6116 | } |
---|
6117 | else if(bLCULBoundary) |
---|
6118 | { |
---|
6119 | zRefSU = g_auiRasterToZscan[ rLRefSU+ heightSU*numSUInLCUWidth ]; |
---|
6120 | pRefMapLCU = pLRefMapLCU; |
---|
6121 | } |
---|
6122 | else //inside LCU |
---|
6123 | { |
---|
6124 | zRefSU = g_auiRasterToZscan[ rTLSU + heightSU*numSUInLCUWidth -1]; |
---|
6125 | pRefMapLCU = pSliceIDMapLCU; |
---|
6126 | } |
---|
6127 | pRefID = pRefMapLCU + zRefSU; |
---|
6128 | *pbAvail = (*pRefID == sliceID)?(true):(false); |
---|
6129 | } |
---|
6130 | |
---|
6131 | // SGU_BR |
---|
6132 | pbAvail = &(pbAvailBorder[SGU_BR]); |
---|
6133 | if(bPicBBoundary || bPicRBoundary) |
---|
6134 | { |
---|
6135 | *pbAvail = false; |
---|
6136 | } |
---|
6137 | else if (!bIndependentSliceBoundaryEnabled) |
---|
6138 | { |
---|
6139 | *pbAvail = true; |
---|
6140 | } |
---|
6141 | else |
---|
6142 | { |
---|
6143 | if(bLCUBBoundary && bLCURBoundary) |
---|
6144 | { |
---|
6145 | zRefSU = 0; |
---|
6146 | pRefMapLCU = pSliceIDMapLCU+ ( (numLCUInPicWidth+1)*numSUInLCU); |
---|
6147 | } |
---|
6148 | else if(bLCUBBoundary) |
---|
6149 | { |
---|
6150 | zRefSU = g_auiRasterToZscan[ rBRefSU + widthSU]; |
---|
6151 | pRefMapLCU = pBRefMapLCU; |
---|
6152 | } |
---|
6153 | else if(bLCURBoundary) |
---|
6154 | { |
---|
6155 | zRefSU = g_auiRasterToZscan[ rRRefSU + (heightSU*numSUInLCUWidth)]; |
---|
6156 | pRefMapLCU = pRRefMapLCU; |
---|
6157 | } |
---|
6158 | else //inside LCU |
---|
6159 | { |
---|
6160 | zRefSU = g_auiRasterToZscan[ rTLSU + (heightSU*numSUInLCUWidth)+ widthSU]; |
---|
6161 | pRefMapLCU = pSliceIDMapLCU; |
---|
6162 | } |
---|
6163 | pRefID = pRefMapLCU + zRefSU; |
---|
6164 | *pbAvail = (*pRefID == sliceID)?(true):(false); |
---|
6165 | } |
---|
6166 | |
---|
6167 | if(bIndependentTileBoundaryEnabled) |
---|
6168 | { |
---|
6169 | //left LCU boundary |
---|
6170 | if(!bPicLBoundary && bLCULBoundary) |
---|
6171 | { |
---|
6172 | if(bLeftTileBoundary) |
---|
6173 | { |
---|
6174 | pbAvailBorder[SGU_L] = pbAvailBorder[SGU_TL] = pbAvailBorder[SGU_BL] = false; |
---|
6175 | } |
---|
6176 | } |
---|
6177 | //right LCU boundary |
---|
6178 | if(!bPicRBoundary && bLCURBoundary) |
---|
6179 | { |
---|
6180 | if(bRightTileBoundary) |
---|
6181 | { |
---|
6182 | pbAvailBorder[SGU_R] = pbAvailBorder[SGU_TR] = pbAvailBorder[SGU_BR] = false; |
---|
6183 | } |
---|
6184 | } |
---|
6185 | //top LCU boundary |
---|
6186 | if(!bPicTBoundary && bLCUTBoundary) |
---|
6187 | { |
---|
6188 | if(bTopTileBoundary) |
---|
6189 | { |
---|
6190 | pbAvailBorder[SGU_T] = pbAvailBorder[SGU_TL] = pbAvailBorder[SGU_TR] = false; |
---|
6191 | } |
---|
6192 | } |
---|
6193 | //down LCU boundary |
---|
6194 | if(!bPicBBoundary && bLCUBBoundary) |
---|
6195 | { |
---|
6196 | if(bDownTileBoundary) |
---|
6197 | { |
---|
6198 | pbAvailBorder[SGU_B] = pbAvailBorder[SGU_BL] = pbAvailBorder[SGU_BR] = false; |
---|
6199 | } |
---|
6200 | } |
---|
6201 | } |
---|
6202 | #if LCU_SYNTAX_ALF |
---|
6203 | rSGU.allBordersAvailable = true; |
---|
6204 | for(Int b=0; b< NUM_SGU_BORDER; b++) |
---|
6205 | { |
---|
6206 | if(pbAvailBorder[b] == false) |
---|
6207 | { |
---|
6208 | rSGU.allBordersAvailable = false; |
---|
6209 | break; |
---|
6210 | } |
---|
6211 | } |
---|
6212 | #endif |
---|
6213 | |
---|
6214 | } |
---|
6215 | } |
---|
6216 | |
---|
6217 | Void TComDataCU::getPosInPic( UInt uiAbsPartIndex, Int& riPosX, Int& riPosY ) |
---|
6218 | { |
---|
6219 | riPosX = g_auiRasterToPelX[g_auiZscanToRaster[uiAbsPartIndex]] + getCUPelX(); |
---|
6220 | riPosY = g_auiRasterToPelY[g_auiZscanToRaster[uiAbsPartIndex]] + getCUPelY(); |
---|
6221 | } |
---|
6222 | |
---|
6223 | // ------------------------------------------------------------------------------------------------------------------- |
---|
6224 | // public functions for depth model modes |
---|
6225 | // ------------------------------------------------------------------------------------------------------------------- |
---|
6226 | #if HHI_DMM_WEDGE_INTRA |
---|
6227 | Void TComDataCU::setWedgeFullTabIdxSubParts( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
6228 | { |
---|
6229 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
6230 | |
---|
6231 | for ( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
6232 | { |
---|
6233 | m_puiWedgeFullTabIdx[uiAbsPartIdx+ui] = uiTIdx; |
---|
6234 | } |
---|
6235 | } |
---|
6236 | |
---|
6237 | Void TComDataCU::setWedgeFullDeltaDC1SubParts( Int iDC1, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
6238 | { |
---|
6239 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
6240 | |
---|
6241 | for ( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
6242 | { |
---|
6243 | m_piWedgeFullDeltaDC1[uiAbsPartIdx+ui] = iDC1; |
---|
6244 | } |
---|
6245 | } |
---|
6246 | |
---|
6247 | Void TComDataCU::setWedgeFullDeltaDC2SubParts( Int iDC2, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
6248 | { |
---|
6249 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
6250 | |
---|
6251 | for ( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
6252 | { |
---|
6253 | m_piWedgeFullDeltaDC2[uiAbsPartIdx+ui] = iDC2; |
---|
6254 | } |
---|
6255 | } |
---|
6256 | |
---|
6257 | Void TComDataCU::setWedgePredDirTabIdxSubParts( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
6258 | { |
---|
6259 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
6260 | |
---|
6261 | for ( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
6262 | { |
---|
6263 | m_puiWedgePredDirTabIdx[uiAbsPartIdx+ui] = uiTIdx; |
---|
6264 | } |
---|
6265 | } |
---|
6266 | |
---|
6267 | Void TComDataCU::setWedgePredDirDeltaDC1SubParts( Int iDC1, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
6268 | { |
---|
6269 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
6270 | |
---|
6271 | for ( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
6272 | { |
---|
6273 | m_piWedgePredDirDeltaDC1[uiAbsPartIdx+ui] = iDC1; |
---|
6274 | } |
---|
6275 | } |
---|
6276 | |
---|
6277 | Void TComDataCU::setWedgePredDirDeltaDC2SubParts( Int iDC2, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
6278 | { |
---|
6279 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
6280 | |
---|
6281 | for ( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
6282 | { |
---|
6283 | m_piWedgePredDirDeltaDC2[uiAbsPartIdx+ui] = iDC2; |
---|
6284 | } |
---|
6285 | } |
---|
6286 | |
---|
6287 | Void TComDataCU::setWedgePredDirDeltaEndSubParts( Int iDelta, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
6288 | { |
---|
6289 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
6290 | |
---|
6291 | for ( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
6292 | { |
---|
6293 | m_piWedgePredDirDeltaEnd[uiAbsPartIdx+ui] = iDelta; |
---|
6294 | } |
---|
6295 | } |
---|
6296 | #endif |
---|
6297 | #if HHI_DMM_PRED_TEX |
---|
6298 | Void TComDataCU::setWedgePredTexTabIdxSubParts( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
6299 | { |
---|
6300 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
6301 | |
---|
6302 | for ( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
6303 | { |
---|
6304 | m_puiWedgePredTexTabIdx[uiAbsPartIdx+ui] = uiTIdx; |
---|
6305 | } |
---|
6306 | } |
---|
6307 | |
---|
6308 | Void TComDataCU::setWedgePredTexDeltaDC1SubParts( Int iDC1, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
6309 | { |
---|
6310 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
6311 | |
---|
6312 | for ( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
6313 | { |
---|
6314 | m_piWedgePredTexDeltaDC1[uiAbsPartIdx+ui] = iDC1; |
---|
6315 | } |
---|
6316 | } |
---|
6317 | |
---|
6318 | Void TComDataCU::setWedgePredTexDeltaDC2SubParts( Int iDC2, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
6319 | { |
---|
6320 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
6321 | |
---|
6322 | for ( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
6323 | { |
---|
6324 | m_piWedgePredTexDeltaDC2[uiAbsPartIdx+ui] = iDC2; |
---|
6325 | } |
---|
6326 | } |
---|
6327 | |
---|
6328 | Void TComDataCU::setContourPredTexDeltaDC1SubParts( Int iDC1, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
6329 | { |
---|
6330 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
6331 | |
---|
6332 | for ( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
6333 | { |
---|
6334 | m_piContourPredTexDeltaDC1[uiAbsPartIdx+ui] = iDC1; |
---|
6335 | } |
---|
6336 | } |
---|
6337 | |
---|
6338 | Void TComDataCU::setContourPredTexDeltaDC2SubParts( Int iDC2, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
6339 | { |
---|
6340 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
6341 | |
---|
6342 | for ( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
6343 | { |
---|
6344 | m_piContourPredTexDeltaDC2[uiAbsPartIdx+ui] = iDC2; |
---|
6345 | } |
---|
6346 | } |
---|
6347 | #endif |
---|
6348 | |
---|
6349 | #if HHI_MPI |
---|
6350 | Void TComDataCU::setTextureModeDepthSubParts( Int iTextureModeDepth, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
6351 | { |
---|
6352 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
6353 | |
---|
6354 | for (UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
6355 | { |
---|
6356 | m_piTextureModeDepth[uiAbsPartIdx + ui] = iTextureModeDepth; |
---|
6357 | } |
---|
6358 | } |
---|
6359 | |
---|
6360 | Void TComDataCU::copyTextureMotionDataFrom( TComDataCU* pcCU, UInt uiDepth, UInt uiAbsPartIdxSrc, UInt uiAbsPartIdxDst ) |
---|
6361 | { |
---|
6362 | assert( getSlice()->getIsDepth() && ! pcCU->getSlice()->getIsDepth() ); |
---|
6363 | UInt uiNumPartition = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
6364 | |
---|
6365 | memcpy( m_pePredMode + uiAbsPartIdxDst, pcCU->getPredictionMode() + uiAbsPartIdxSrc, sizeof( m_pePredMode[0] ) * uiNumPartition ); |
---|
6366 | memcpy( m_puhInterDir + uiAbsPartIdxDst, pcCU->getInterDir() + uiAbsPartIdxSrc, sizeof( m_puhInterDir[0] ) * uiNumPartition ); |
---|
6367 | |
---|
6368 | memcpy( m_apiMVPIdx[0] + uiAbsPartIdxDst, pcCU->getMVPIdx(REF_PIC_LIST_0) + uiAbsPartIdxSrc, sizeof(*m_apiMVPIdx[0]) * uiNumPartition ); |
---|
6369 | memcpy( m_apiMVPIdx[1] + uiAbsPartIdxDst, pcCU->getMVPIdx(REF_PIC_LIST_1) + uiAbsPartIdxSrc, sizeof(*m_apiMVPIdx[0]) * uiNumPartition ); |
---|
6370 | memcpy( m_apiMVPNum[0] + uiAbsPartIdxDst, pcCU->getMVPNum(REF_PIC_LIST_0) + uiAbsPartIdxSrc, sizeof(*m_apiMVPNum[0]) * uiNumPartition ); |
---|
6371 | memcpy( m_apiMVPNum[1] + uiAbsPartIdxDst, pcCU->getMVPNum(REF_PIC_LIST_1) + uiAbsPartIdxSrc, sizeof(*m_apiMVPNum[0]) * uiNumPartition ); |
---|
6372 | |
---|
6373 | pcCU->getCUMvField( REF_PIC_LIST_0 )->copyTo( &m_acCUMvField[0], -Int(uiAbsPartIdxSrc) + uiAbsPartIdxDst, uiAbsPartIdxSrc, uiNumPartition ); |
---|
6374 | pcCU->getCUMvField( REF_PIC_LIST_1 )->copyTo( &m_acCUMvField[1], -Int(uiAbsPartIdxSrc) + uiAbsPartIdxDst, uiAbsPartIdxSrc, uiNumPartition ); |
---|
6375 | |
---|
6376 | #if HHI_FULL_PEL_DEPTH_MAP_MV_ACC |
---|
6377 | m_acCUMvField[0].decreaseMvAccuracy( uiAbsPartIdxDst, uiNumPartition, 2 ); |
---|
6378 | m_acCUMvField[1].decreaseMvAccuracy( uiAbsPartIdxDst, uiNumPartition, 2 ); |
---|
6379 | #endif |
---|
6380 | } |
---|
6381 | #endif |
---|
6382 | |
---|
6383 | // ------------------------------------------------------------------------------------------------------------------- |
---|
6384 | // public functions for Multi-view tools |
---|
6385 | // ------------------------------------------------------------------------------------------------------------------- |
---|
6386 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
6387 | #if !QC_MULTI_DIS_CAN |
---|
6388 | Int |
---|
6389 | TComDataCU::getPdmMergeCandidate( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv ) |
---|
6390 | { |
---|
6391 | TComDepthMapGenerator* pcDepthMapGenerator = m_pcSlice->getSPS()->getDepthMapGenerator(); |
---|
6392 | ROFRS( pcDepthMapGenerator, 0 ); |
---|
6393 | return pcDepthMapGenerator->getPdmMergeCandidate( this, uiPartIdx, paiPdmRefIdx, pacPdmMv ); |
---|
6394 | } |
---|
6395 | |
---|
6396 | |
---|
6397 | Bool |
---|
6398 | TComDataCU::getPdmMvPred( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, Bool bMerge ) |
---|
6399 | { |
---|
6400 | TComDepthMapGenerator* pcDepthMapGenerator = m_pcSlice->getSPS()->getDepthMapGenerator(); |
---|
6401 | ROFRS( pcDepthMapGenerator, false ); |
---|
6402 | return pcDepthMapGenerator->getPdmMvPred( this, uiPartIdx, eRefPicList, iRefIdx, rcMv, bMerge ); |
---|
6403 | } |
---|
6404 | #else |
---|
6405 | Int |
---|
6406 | TComDataCU::getPdmMergeCandidateDisCan( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo ) |
---|
6407 | { |
---|
6408 | TComDepthMapGenerator* pcDepthMapGenerator = m_pcSlice->getSPS()->getDepthMapGenerator(); |
---|
6409 | ROFRS( pcDepthMapGenerator, 0 ); |
---|
6410 | return pcDepthMapGenerator->getPdmMergeCandidate( this, uiPartIdx, paiPdmRefIdx, pacPdmMv, pDInfo ); |
---|
6411 | } |
---|
6412 | Bool |
---|
6413 | TComDataCU::getPdmMvPredDisCan( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, DisInfo* pDInfo, Bool bMerge ) |
---|
6414 | { |
---|
6415 | TComDepthMapGenerator* pcDepthMapGenerator = m_pcSlice->getSPS()->getDepthMapGenerator(); |
---|
6416 | ROFRS( pcDepthMapGenerator, false ); |
---|
6417 | if (pDInfo->iN > 0 && pcDepthMapGenerator->getDisCanPdmMvPred(this, uiPartIdx, eRefPicList, iRefIdx, rcMv, pDInfo, bMerge )) //bug fix li |
---|
6418 | return true; |
---|
6419 | return false; |
---|
6420 | } |
---|
6421 | #endif |
---|
6422 | |
---|
6423 | |
---|
6424 | Bool |
---|
6425 | TComDataCU::getIViewOrgDepthMvPred( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv ) |
---|
6426 | { |
---|
6427 | TComDepthMapGenerator* pcDepthMapGenerator = m_pcSlice->getSPS()->getDepthMapGenerator(); |
---|
6428 | ROFRS( pcDepthMapGenerator, false ); |
---|
6429 | return pcDepthMapGenerator->getIViewOrgDepthMvPred( this, uiPartIdx, eRefPicList, iRefIdx, rcMv ); |
---|
6430 | } |
---|
6431 | #endif |
---|
6432 | |
---|
6433 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
6434 | Bool |
---|
6435 | TComDataCU::getResidualSamples( UInt uiPartIdx, |
---|
6436 | #if QC_SIMPLIFIEDIVRP_M24938 |
---|
6437 | Bool bRecon , |
---|
6438 | #endif |
---|
6439 | TComYuv* pcYuv ) |
---|
6440 | { |
---|
6441 | TComResidualGenerator* pcResidualGenerator = m_pcSlice->getSPS()->getResidualGenerator(); |
---|
6442 | ROFRS( pcResidualGenerator, false ); |
---|
6443 | #if QC_MULTI_DIS_CAN |
---|
6444 | DisInfo cDisInfo; |
---|
6445 | cDisInfo.iN = 0; |
---|
6446 | PartSize m_peSaved = getPartitionSize( 0 ); |
---|
6447 | m_pePartSize[0] = SIZE_2Nx2N; |
---|
6448 | getDisMvpCand ( 0, 0, &cDisInfo ); |
---|
6449 | if( cDisInfo.iN == 0) |
---|
6450 | { |
---|
6451 | m_pePartSize[0] = m_peSaved; |
---|
6452 | return false; |
---|
6453 | } |
---|
6454 | else |
---|
6455 | { |
---|
6456 | Bool bAvailable = pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv, cDisInfo.m_acMvCand[0].getHor() |
---|
6457 | #if QC_SIMPLIFIEDIVRP_M24938 |
---|
6458 | , bRecon |
---|
6459 | #endif |
---|
6460 | ); |
---|
6461 | m_pePartSize[0] = m_peSaved; |
---|
6462 | return bAvailable; |
---|
6463 | } |
---|
6464 | #else |
---|
6465 | return pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv |
---|
6466 | #if QC_SIMPLIFIEDIVRP_M24938 |
---|
6467 | , bRecon |
---|
6468 | #endif |
---|
6469 | ); |
---|
6470 | #endif |
---|
6471 | } |
---|
6472 | #endif |
---|
6473 | |
---|
6474 | //! \} |
---|