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 | Void TComDataCU::getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight ) |
---|
2886 | { |
---|
2887 | switch ( m_pePartSize[0] ) |
---|
2888 | { |
---|
2889 | case SIZE_2NxN: |
---|
2890 | riWidth = getWidth(0); riHeight = getHeight(0) >> 1; ruiPartAddr = ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 1; |
---|
2891 | break; |
---|
2892 | case SIZE_Nx2N: |
---|
2893 | riWidth = getWidth(0) >> 1; riHeight = getHeight(0); ruiPartAddr = ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 2; |
---|
2894 | break; |
---|
2895 | case SIZE_NxN: |
---|
2896 | riWidth = getWidth(0) >> 1; riHeight = getHeight(0) >> 1; ruiPartAddr = ( m_uiNumPartition >> 2 ) * uiPartIdx; |
---|
2897 | break; |
---|
2898 | case SIZE_2NxnU: |
---|
2899 | riWidth = getWidth(0); |
---|
2900 | riHeight = ( uiPartIdx == 0 ) ? getHeight(0) >> 2 : ( getHeight(0) >> 2 ) + ( getHeight(0) >> 1 ); |
---|
2901 | ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : m_uiNumPartition >> 3; |
---|
2902 | break; |
---|
2903 | case SIZE_2NxnD: |
---|
2904 | riWidth = getWidth(0); |
---|
2905 | riHeight = ( uiPartIdx == 0 ) ? ( getHeight(0) >> 2 ) + ( getHeight(0) >> 1 ) : getHeight(0) >> 2; |
---|
2906 | ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : (m_uiNumPartition >> 1) + (m_uiNumPartition >> 3); |
---|
2907 | break; |
---|
2908 | case SIZE_nLx2N: |
---|
2909 | riWidth = ( uiPartIdx == 0 ) ? getWidth(0) >> 2 : ( getWidth(0) >> 2 ) + ( getWidth(0) >> 1 ); |
---|
2910 | riHeight = getHeight(0); |
---|
2911 | ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : m_uiNumPartition >> 4; |
---|
2912 | break; |
---|
2913 | case SIZE_nRx2N: |
---|
2914 | riWidth = ( uiPartIdx == 0 ) ? ( getWidth(0) >> 2 ) + ( getWidth(0) >> 1 ) : getWidth(0) >> 2; |
---|
2915 | riHeight = getHeight(0); |
---|
2916 | ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : (m_uiNumPartition >> 2) + (m_uiNumPartition >> 4); |
---|
2917 | break; |
---|
2918 | default: |
---|
2919 | assert ( m_pePartSize[0] == SIZE_2Nx2N ); |
---|
2920 | riWidth = getWidth(0); riHeight = getHeight(0); ruiPartAddr = 0; |
---|
2921 | break; |
---|
2922 | } |
---|
2923 | } |
---|
2924 | |
---|
2925 | |
---|
2926 | Void TComDataCU::getMvField ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, TComMvField& rcMvField ) |
---|
2927 | { |
---|
2928 | if ( pcCU == NULL ) // OUT OF BOUNDARY |
---|
2929 | { |
---|
2930 | TComMv cZeroMv; |
---|
2931 | rcMvField.setMvField( cZeroMv, NOT_VALID ); |
---|
2932 | return; |
---|
2933 | } |
---|
2934 | |
---|
2935 | TComCUMvField* pcCUMvField = pcCU->getCUMvField( eRefPicList ); |
---|
2936 | rcMvField.setMvField( pcCUMvField->getMv( uiAbsPartIdx ), pcCUMvField->getRefIdx( uiAbsPartIdx ) ); |
---|
2937 | } |
---|
2938 | |
---|
2939 | Void TComDataCU::deriveLeftRightTopIdxGeneral ( PartSize eCUMode, UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ) |
---|
2940 | { |
---|
2941 | ruiPartIdxLT = m_uiAbsIdxInLCU + uiAbsPartIdx; |
---|
2942 | UInt uiPUWidth = 0; |
---|
2943 | |
---|
2944 | switch ( m_pePartSize[uiAbsPartIdx] ) |
---|
2945 | { |
---|
2946 | case SIZE_2Nx2N: uiPUWidth = m_puhWidth[uiAbsPartIdx]; break; |
---|
2947 | case SIZE_2NxN: uiPUWidth = m_puhWidth[uiAbsPartIdx]; break; |
---|
2948 | case SIZE_Nx2N: uiPUWidth = m_puhWidth[uiAbsPartIdx] >> 1; break; |
---|
2949 | case SIZE_NxN: uiPUWidth = m_puhWidth[uiAbsPartIdx] >> 1; break; |
---|
2950 | case SIZE_2NxnU: uiPUWidth = m_puhWidth[uiAbsPartIdx]; break; |
---|
2951 | case SIZE_2NxnD: uiPUWidth = m_puhWidth[uiAbsPartIdx]; break; |
---|
2952 | case SIZE_nLx2N: |
---|
2953 | if ( uiPartIdx == 0 ) |
---|
2954 | { |
---|
2955 | uiPUWidth = m_puhWidth[uiAbsPartIdx] >> 2; |
---|
2956 | } |
---|
2957 | else if ( uiPartIdx == 1 ) |
---|
2958 | { |
---|
2959 | uiPUWidth = (m_puhWidth[uiAbsPartIdx] >> 1) + (m_puhWidth[uiAbsPartIdx] >> 2); |
---|
2960 | } |
---|
2961 | else |
---|
2962 | { |
---|
2963 | assert(0); |
---|
2964 | } |
---|
2965 | break; |
---|
2966 | case SIZE_nRx2N: |
---|
2967 | if ( uiPartIdx == 0 ) |
---|
2968 | { |
---|
2969 | uiPUWidth = (m_puhWidth[uiAbsPartIdx] >> 1) + (m_puhWidth[uiAbsPartIdx] >> 2); |
---|
2970 | } |
---|
2971 | else if ( uiPartIdx == 1 ) |
---|
2972 | { |
---|
2973 | uiPUWidth = m_puhWidth[uiAbsPartIdx] >> 2; |
---|
2974 | } |
---|
2975 | else |
---|
2976 | { |
---|
2977 | assert(0); |
---|
2978 | } |
---|
2979 | break; |
---|
2980 | default: |
---|
2981 | assert (0); |
---|
2982 | break; |
---|
2983 | } |
---|
2984 | |
---|
2985 | ruiPartIdxRT = g_auiRasterToZscan [g_auiZscanToRaster[ ruiPartIdxLT ] + uiPUWidth / m_pcPic->getMinCUWidth() - 1 ]; |
---|
2986 | } |
---|
2987 | |
---|
2988 | Void TComDataCU::deriveLeftBottomIdxGeneral( PartSize eCUMode, UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB ) |
---|
2989 | { |
---|
2990 | UInt uiPUHeight = 0; |
---|
2991 | switch ( m_pePartSize[uiAbsPartIdx] ) |
---|
2992 | { |
---|
2993 | case SIZE_2Nx2N: uiPUHeight = m_puhHeight[uiAbsPartIdx]; break; |
---|
2994 | case SIZE_2NxN: uiPUHeight = m_puhHeight[uiAbsPartIdx] >> 1; break; |
---|
2995 | case SIZE_Nx2N: uiPUHeight = m_puhHeight[uiAbsPartIdx]; break; |
---|
2996 | case SIZE_NxN: uiPUHeight = m_puhHeight[uiAbsPartIdx] >> 1; break; |
---|
2997 | case SIZE_2NxnU: |
---|
2998 | if ( uiPartIdx == 0 ) |
---|
2999 | { |
---|
3000 | uiPUHeight = m_puhHeight[uiAbsPartIdx] >> 2; |
---|
3001 | } |
---|
3002 | else if ( uiPartIdx == 1 ) |
---|
3003 | { |
---|
3004 | uiPUHeight = (m_puhHeight[uiAbsPartIdx] >> 1) + (m_puhHeight[uiAbsPartIdx] >> 2); |
---|
3005 | } |
---|
3006 | else |
---|
3007 | { |
---|
3008 | assert(0); |
---|
3009 | } |
---|
3010 | break; |
---|
3011 | case SIZE_2NxnD: |
---|
3012 | if ( uiPartIdx == 0 ) |
---|
3013 | { |
---|
3014 | uiPUHeight = (m_puhHeight[uiAbsPartIdx] >> 1) + (m_puhHeight[uiAbsPartIdx] >> 2); |
---|
3015 | } |
---|
3016 | else if ( uiPartIdx == 1 ) |
---|
3017 | { |
---|
3018 | uiPUHeight = m_puhHeight[uiAbsPartIdx] >> 2; |
---|
3019 | } |
---|
3020 | else |
---|
3021 | { |
---|
3022 | assert(0); |
---|
3023 | } |
---|
3024 | break; |
---|
3025 | case SIZE_nLx2N: uiPUHeight = m_puhHeight[uiAbsPartIdx]; break; |
---|
3026 | case SIZE_nRx2N: uiPUHeight = m_puhHeight[uiAbsPartIdx]; break; |
---|
3027 | default: |
---|
3028 | assert (0); |
---|
3029 | break; |
---|
3030 | } |
---|
3031 | |
---|
3032 | ruiPartIdxLB = g_auiRasterToZscan [g_auiZscanToRaster[ m_uiAbsIdxInLCU + uiAbsPartIdx ] + ((uiPUHeight / m_pcPic->getMinCUHeight()) - 1)*m_pcPic->getNumPartInWidth()]; |
---|
3033 | } |
---|
3034 | |
---|
3035 | Void TComDataCU::deriveLeftRightTopIdx ( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ) |
---|
3036 | { |
---|
3037 | ruiPartIdxLT = m_uiAbsIdxInLCU; |
---|
3038 | ruiPartIdxRT = g_auiRasterToZscan [g_auiZscanToRaster[ ruiPartIdxLT ] + m_puhWidth[0] / m_pcPic->getMinCUWidth() - 1 ]; |
---|
3039 | |
---|
3040 | switch ( m_pePartSize[0] ) |
---|
3041 | { |
---|
3042 | case SIZE_2Nx2N: break; |
---|
3043 | case SIZE_2NxN: |
---|
3044 | ruiPartIdxLT += ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 1; ruiPartIdxRT += ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 1; |
---|
3045 | break; |
---|
3046 | case SIZE_Nx2N: |
---|
3047 | ruiPartIdxLT += ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 2; ruiPartIdxRT -= ( uiPartIdx == 1 )? 0 : m_uiNumPartition >> 2; |
---|
3048 | break; |
---|
3049 | case SIZE_NxN: |
---|
3050 | ruiPartIdxLT += ( m_uiNumPartition >> 2 ) * uiPartIdx; ruiPartIdxRT += ( m_uiNumPartition >> 2 ) * ( uiPartIdx - 1 ); |
---|
3051 | break; |
---|
3052 | case SIZE_2NxnU: |
---|
3053 | ruiPartIdxLT += ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 3; |
---|
3054 | ruiPartIdxRT += ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 3; |
---|
3055 | break; |
---|
3056 | case SIZE_2NxnD: |
---|
3057 | ruiPartIdxLT += ( uiPartIdx == 0 )? 0 : ( m_uiNumPartition >> 1 ) + ( m_uiNumPartition >> 3 ); |
---|
3058 | ruiPartIdxRT += ( uiPartIdx == 0 )? 0 : ( m_uiNumPartition >> 1 ) + ( m_uiNumPartition >> 3 ); |
---|
3059 | break; |
---|
3060 | case SIZE_nLx2N: |
---|
3061 | ruiPartIdxLT += ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 4; |
---|
3062 | ruiPartIdxRT -= ( uiPartIdx == 1 )? 0 : ( m_uiNumPartition >> 2 ) + ( m_uiNumPartition >> 4 ); |
---|
3063 | break; |
---|
3064 | case SIZE_nRx2N: |
---|
3065 | ruiPartIdxLT += ( uiPartIdx == 0 )? 0 : ( m_uiNumPartition >> 2 ) + ( m_uiNumPartition >> 4 ); |
---|
3066 | ruiPartIdxRT -= ( uiPartIdx == 1 )? 0 : m_uiNumPartition >> 4; |
---|
3067 | break; |
---|
3068 | default: |
---|
3069 | assert (0); |
---|
3070 | break; |
---|
3071 | } |
---|
3072 | |
---|
3073 | } |
---|
3074 | |
---|
3075 | Void TComDataCU::deriveLeftBottomIdx( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxLB ) |
---|
3076 | { |
---|
3077 | ruiPartIdxLB = g_auiRasterToZscan [g_auiZscanToRaster[ m_uiAbsIdxInLCU ] + ( ((m_puhHeight[0] / m_pcPic->getMinCUHeight())>>1) - 1)*m_pcPic->getNumPartInWidth()]; |
---|
3078 | |
---|
3079 | switch ( m_pePartSize[0] ) |
---|
3080 | { |
---|
3081 | case SIZE_2Nx2N: |
---|
3082 | ruiPartIdxLB += m_uiNumPartition >> 1; |
---|
3083 | break; |
---|
3084 | case SIZE_2NxN: |
---|
3085 | ruiPartIdxLB += ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 1; |
---|
3086 | break; |
---|
3087 | case SIZE_Nx2N: |
---|
3088 | ruiPartIdxLB += ( uiPartIdx == 0 )? m_uiNumPartition >> 1 : (m_uiNumPartition >> 2)*3; |
---|
3089 | break; |
---|
3090 | case SIZE_NxN: |
---|
3091 | ruiPartIdxLB += ( m_uiNumPartition >> 2 ) * uiPartIdx; |
---|
3092 | break; |
---|
3093 | case SIZE_2NxnU: |
---|
3094 | ruiPartIdxLB += ( uiPartIdx == 0 ) ? -((Int)m_uiNumPartition >> 3) : m_uiNumPartition >> 1; |
---|
3095 | break; |
---|
3096 | case SIZE_2NxnD: |
---|
3097 | ruiPartIdxLB += ( uiPartIdx == 0 ) ? (m_uiNumPartition >> 2) + (m_uiNumPartition >> 3): m_uiNumPartition >> 1; |
---|
3098 | break; |
---|
3099 | case SIZE_nLx2N: |
---|
3100 | ruiPartIdxLB += ( uiPartIdx == 0 ) ? m_uiNumPartition >> 1 : (m_uiNumPartition >> 1) + (m_uiNumPartition >> 4); |
---|
3101 | break; |
---|
3102 | case SIZE_nRx2N: |
---|
3103 | ruiPartIdxLB += ( uiPartIdx == 0 ) ? m_uiNumPartition >> 1 : (m_uiNumPartition >> 1) + (m_uiNumPartition >> 2) + (m_uiNumPartition >> 4); |
---|
3104 | break; |
---|
3105 | default: |
---|
3106 | assert (0); |
---|
3107 | break; |
---|
3108 | } |
---|
3109 | } |
---|
3110 | |
---|
3111 | /** Derives the partition index of neighbouring bottom right block |
---|
3112 | * \param [in] eCUMode |
---|
3113 | * \param [in] uiPartIdx |
---|
3114 | * \param [out] ruiPartIdxRB |
---|
3115 | */ |
---|
3116 | Void TComDataCU::deriveRightBottomIdx( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxRB ) |
---|
3117 | { |
---|
3118 | 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]; |
---|
3119 | |
---|
3120 | switch ( m_pePartSize[0] ) |
---|
3121 | { |
---|
3122 | case SIZE_2Nx2N: |
---|
3123 | ruiPartIdxRB += m_uiNumPartition >> 1; |
---|
3124 | break; |
---|
3125 | case SIZE_2NxN: |
---|
3126 | ruiPartIdxRB += ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 1; |
---|
3127 | break; |
---|
3128 | case SIZE_Nx2N: |
---|
3129 | ruiPartIdxRB += ( uiPartIdx == 0 )? m_uiNumPartition >> 2 : (m_uiNumPartition >> 1); |
---|
3130 | break; |
---|
3131 | case SIZE_NxN: |
---|
3132 | ruiPartIdxRB += ( m_uiNumPartition >> 2 ) * ( uiPartIdx - 1 ); |
---|
3133 | break; |
---|
3134 | case SIZE_2NxnU: |
---|
3135 | ruiPartIdxRB += ( uiPartIdx == 0 ) ? -((Int)m_uiNumPartition >> 3) : m_uiNumPartition >> 1; |
---|
3136 | break; |
---|
3137 | case SIZE_2NxnD: |
---|
3138 | ruiPartIdxRB += ( uiPartIdx == 0 ) ? (m_uiNumPartition >> 2) + (m_uiNumPartition >> 3): m_uiNumPartition >> 1; |
---|
3139 | break; |
---|
3140 | case SIZE_nLx2N: |
---|
3141 | ruiPartIdxRB += ( uiPartIdx == 0 ) ? (m_uiNumPartition >> 3) + (m_uiNumPartition >> 4): m_uiNumPartition >> 1; |
---|
3142 | break; |
---|
3143 | case SIZE_nRx2N: |
---|
3144 | ruiPartIdxRB += ( uiPartIdx == 0 ) ? (m_uiNumPartition >> 2) + (m_uiNumPartition >> 3) + (m_uiNumPartition >> 4) : m_uiNumPartition >> 1; |
---|
3145 | break; |
---|
3146 | default: |
---|
3147 | assert (0); |
---|
3148 | break; |
---|
3149 | } |
---|
3150 | } |
---|
3151 | |
---|
3152 | Void TComDataCU::deriveLeftRightTopIdxAdi ( UInt& ruiPartIdxLT, UInt& ruiPartIdxRT, UInt uiPartOffset, UInt uiPartDepth ) |
---|
3153 | { |
---|
3154 | UInt uiNumPartInWidth = (m_puhWidth[0]/m_pcPic->getMinCUWidth())>>uiPartDepth; |
---|
3155 | ruiPartIdxLT = m_uiAbsIdxInLCU + uiPartOffset; |
---|
3156 | ruiPartIdxRT = g_auiRasterToZscan[ g_auiZscanToRaster[ ruiPartIdxLT ] + uiNumPartInWidth - 1 ]; |
---|
3157 | } |
---|
3158 | |
---|
3159 | Void TComDataCU::deriveLeftBottomIdxAdi( UInt& ruiPartIdxLB, UInt uiPartOffset, UInt uiPartDepth ) |
---|
3160 | { |
---|
3161 | UInt uiAbsIdx; |
---|
3162 | UInt uiMinCuWidth, uiWidthInMinCus; |
---|
3163 | |
---|
3164 | uiMinCuWidth = getPic()->getMinCUWidth(); |
---|
3165 | uiWidthInMinCus = (getWidth(0)/uiMinCuWidth)>>uiPartDepth; |
---|
3166 | uiAbsIdx = getZorderIdxInCU()+uiPartOffset+(m_uiNumPartition>>(uiPartDepth<<1))-1; |
---|
3167 | uiAbsIdx = g_auiZscanToRaster[uiAbsIdx]-(uiWidthInMinCus-1); |
---|
3168 | ruiPartIdxLB = g_auiRasterToZscan[uiAbsIdx]; |
---|
3169 | } |
---|
3170 | |
---|
3171 | Bool TComDataCU::hasEqualMotion( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx ) |
---|
3172 | { |
---|
3173 | |
---|
3174 | if ( getInterDir( uiAbsPartIdx ) != pcCandCU->getInterDir( uiCandAbsPartIdx ) ) |
---|
3175 | { |
---|
3176 | return false; |
---|
3177 | } |
---|
3178 | |
---|
3179 | for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) |
---|
3180 | { |
---|
3181 | if ( getInterDir( uiAbsPartIdx ) & ( 1 << uiRefListIdx ) ) |
---|
3182 | { |
---|
3183 | if ( getCUMvField( RefPicList( uiRefListIdx ) )->getMv( uiAbsPartIdx ) != pcCandCU->getCUMvField( RefPicList( uiRefListIdx ) )->getMv( uiCandAbsPartIdx ) || |
---|
3184 | getCUMvField( RefPicList( uiRefListIdx ) )->getRefIdx( uiAbsPartIdx ) != pcCandCU->getCUMvField( RefPicList( uiRefListIdx ) )->getRefIdx( uiCandAbsPartIdx ) ) |
---|
3185 | { |
---|
3186 | return false; |
---|
3187 | } |
---|
3188 | } |
---|
3189 | } |
---|
3190 | |
---|
3191 | return true; |
---|
3192 | } |
---|
3193 | |
---|
3194 | /** Constructs a list of merging candidates |
---|
3195 | * \param uiAbsPartIdx |
---|
3196 | * \param uiPUIdx |
---|
3197 | * \param uiDepth |
---|
3198 | * \param pcMvFieldNeighbours |
---|
3199 | * \param puhInterDirNeighbours |
---|
3200 | * \param numValidMergeCand |
---|
3201 | */ |
---|
3202 | #if SIMP_MRG_PRUN |
---|
3203 | Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx ) |
---|
3204 | #else |
---|
3205 | Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand ) |
---|
3206 | #endif |
---|
3207 | { |
---|
3208 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
3209 | const Int extraMergeCand = ( getSlice()->getSPS()->getMultiviewMvPredMode() ? 1 : 0 ); |
---|
3210 | #endif |
---|
3211 | |
---|
3212 | UInt uiAbsPartAddr = m_uiAbsIdxInLCU + uiAbsPartIdx; |
---|
3213 | UInt uiIdx = 1; |
---|
3214 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
3215 | bool abCandIsInter[ MRG_MAX_NUM_CANDS_MEM ]; |
---|
3216 | for( UInt ui = 0; ui < MRG_MAX_NUM_CANDS_MEM; ++ui ) |
---|
3217 | #else |
---|
3218 | bool abCandIsInter[ MRG_MAX_NUM_CANDS ]; |
---|
3219 | for( UInt ui = 0; ui < MRG_MAX_NUM_CANDS; ++ui ) |
---|
3220 | #endif |
---|
3221 | { |
---|
3222 | abCandIsInter[ui] = false; |
---|
3223 | } |
---|
3224 | // compute the location of the current PU |
---|
3225 | #if PARALLEL_MERGE |
---|
3226 | Int xP, yP, nPSW, nPSH; |
---|
3227 | this->getPartPosition(uiPUIdx, xP, yP, nPSW, nPSH); |
---|
3228 | #endif |
---|
3229 | |
---|
3230 | Int iCount = 0; |
---|
3231 | |
---|
3232 | UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB; |
---|
3233 | PartSize cCurPS = getPartitionSize( uiAbsPartIdx ); |
---|
3234 | deriveLeftRightTopIdxGeneral( cCurPS, uiAbsPartIdx, uiPUIdx, uiPartIdxLT, uiPartIdxRT ); |
---|
3235 | deriveLeftBottomIdxGeneral( cCurPS, uiAbsPartIdx, uiPUIdx, uiPartIdxLB ); |
---|
3236 | |
---|
3237 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
3238 | Bool bNoPdmMerge = ( m_pcSlice->getSPS()->getViewId() == 0 || ( m_pcSlice->getSPS()->getMultiviewMvPredMode() & PDM_USE_FOR_MERGE ) != PDM_USE_FOR_MERGE ); |
---|
3239 | |
---|
3240 | //===== add merge with predicted depth maps ===== |
---|
3241 | TComMv acPdmMv [2]; |
---|
3242 | Int aiPdmRefIdx [2] = {-1, -1}; |
---|
3243 | Int iPdmInterDir = getPdmMergeCandidate( uiPUIdx, aiPdmRefIdx, acPdmMv ); |
---|
3244 | |
---|
3245 | if( iPdmInterDir && !bNoPdmMerge && PDM_MERGE_POS == 0 ) |
---|
3246 | { |
---|
3247 | abCandIsInter [ iCount ] = true; |
---|
3248 | puhInterDirNeighbours[ iCount ] = iPdmInterDir; |
---|
3249 | if( ( iPdmInterDir & 1 ) == 1 ) |
---|
3250 | { |
---|
3251 | pcMvFieldNeighbours[ iCount<<1 ].setMvField( acPdmMv[ 0 ], aiPdmRefIdx[ 0 ] ); |
---|
3252 | } |
---|
3253 | if( ( iPdmInterDir & 2 ) == 2 ) |
---|
3254 | { |
---|
3255 | pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 1 ], aiPdmRefIdx[ 1 ] ); |
---|
3256 | } |
---|
3257 | #if SIMP_MRG_PRUN |
---|
3258 | if ( mrgCandIdx == iCount ) |
---|
3259 | { |
---|
3260 | return; |
---|
3261 | } |
---|
3262 | #endif |
---|
3263 | iCount ++; |
---|
3264 | } |
---|
3265 | #endif |
---|
3266 | |
---|
3267 | //left |
---|
3268 | UInt uiLeftPartIdx = 0; |
---|
3269 | TComDataCU* pcCULeft = 0; |
---|
3270 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
3271 | pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB, true, false ); |
---|
3272 | #else |
---|
3273 | pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB ); |
---|
3274 | #endif |
---|
3275 | #if PARALLEL_MERGE |
---|
3276 | if (pcCULeft) |
---|
3277 | { |
---|
3278 | if (!pcCULeft->isDiffMER(xP -1, yP+nPSH-1, xP, yP)) |
---|
3279 | { |
---|
3280 | pcCULeft = NULL; |
---|
3281 | } |
---|
3282 | } |
---|
3283 | #endif |
---|
3284 | PartSize partSize = getPartitionSize( uiAbsPartIdx ); |
---|
3285 | if (!(uiPUIdx == 1 && (partSize == SIZE_Nx2N || partSize == SIZE_nLx2N || partSize == SIZE_nRx2N))) |
---|
3286 | { |
---|
3287 | if ( pcCULeft && !pcCULeft->isIntra( uiLeftPartIdx ) ) |
---|
3288 | { |
---|
3289 | abCandIsInter[iCount] = true; |
---|
3290 | // get Inter Dir |
---|
3291 | puhInterDirNeighbours[iCount] = pcCULeft->getInterDir( uiLeftPartIdx ); |
---|
3292 | // get Mv from Left |
---|
3293 | pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); |
---|
3294 | if ( getSlice()->isInterB() ) |
---|
3295 | { |
---|
3296 | pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); |
---|
3297 | } |
---|
3298 | #if SIMP_MRG_PRUN |
---|
3299 | if ( mrgCandIdx == iCount ) |
---|
3300 | { |
---|
3301 | return; |
---|
3302 | } |
---|
3303 | #endif |
---|
3304 | iCount ++; |
---|
3305 | } |
---|
3306 | } |
---|
3307 | |
---|
3308 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
3309 | if( iPdmInterDir && !bNoPdmMerge && PDM_MERGE_POS == 1 ) |
---|
3310 | { |
---|
3311 | abCandIsInter [ iCount ] = true; |
---|
3312 | puhInterDirNeighbours[ iCount ] = iPdmInterDir; |
---|
3313 | if( ( iPdmInterDir & 1 ) == 1 ) |
---|
3314 | { |
---|
3315 | pcMvFieldNeighbours[ iCount<<1 ].setMvField( acPdmMv[ 0 ], aiPdmRefIdx[ 0 ] ); |
---|
3316 | } |
---|
3317 | if( ( iPdmInterDir & 2 ) == 2 ) |
---|
3318 | { |
---|
3319 | pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 1 ], aiPdmRefIdx[ 1 ] ); |
---|
3320 | } |
---|
3321 | #if SIMP_MRG_PRUN |
---|
3322 | if ( mrgCandIdx == iCount ) |
---|
3323 | { |
---|
3324 | return; |
---|
3325 | } |
---|
3326 | #endif |
---|
3327 | iCount ++; |
---|
3328 | } |
---|
3329 | #endif |
---|
3330 | |
---|
3331 | // above |
---|
3332 | #if !SIMP_MRG_PRUN |
---|
3333 | partSize = getPartitionSize( uiAbsPartIdx ); |
---|
3334 | if (!(uiPUIdx == 1 && (partSize == SIZE_2NxN || partSize == SIZE_2NxnU || partSize == SIZE_2NxnD))) |
---|
3335 | { |
---|
3336 | #endif |
---|
3337 | UInt uiAbovePartIdx = 0; |
---|
3338 | TComDataCU* pcCUAbove = 0; |
---|
3339 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
3340 | pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT, true, false, true ); |
---|
3341 | #else |
---|
3342 | pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT, true, true, true ); |
---|
3343 | #endif |
---|
3344 | #if PARALLEL_MERGE |
---|
3345 | if (pcCUAbove) |
---|
3346 | { |
---|
3347 | if (!pcCUAbove->isDiffMER(xP+nPSW-1, yP-1, xP, yP)) |
---|
3348 | { |
---|
3349 | pcCUAbove = NULL; |
---|
3350 | } |
---|
3351 | } |
---|
3352 | #endif |
---|
3353 | #if SIMP_MRG_PRUN |
---|
3354 | if ( pcCUAbove && !pcCUAbove->isIntra( uiAbovePartIdx ) |
---|
3355 | && !(uiPUIdx == 1 && (cCurPS == SIZE_2NxN || cCurPS == SIZE_2NxnU || cCurPS == SIZE_2NxnD)) |
---|
3356 | && ( !pcCULeft || pcCULeft->isIntra( uiLeftPartIdx ) || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAbove, uiAbovePartIdx ) ) ) |
---|
3357 | #else |
---|
3358 | if ( pcCUAbove && !pcCUAbove->isIntra( uiAbovePartIdx ) ) |
---|
3359 | #endif |
---|
3360 | { |
---|
3361 | abCandIsInter[iCount] = true; |
---|
3362 | // get Inter Dir |
---|
3363 | puhInterDirNeighbours[iCount] = pcCUAbove->getInterDir( uiAbovePartIdx ); |
---|
3364 | // get Mv from Left |
---|
3365 | pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); |
---|
3366 | if ( getSlice()->isInterB() ) |
---|
3367 | { |
---|
3368 | pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); |
---|
3369 | } |
---|
3370 | #if SIMP_MRG_PRUN |
---|
3371 | if ( mrgCandIdx == iCount ) |
---|
3372 | { |
---|
3373 | return; |
---|
3374 | } |
---|
3375 | #endif |
---|
3376 | iCount ++; |
---|
3377 | } |
---|
3378 | #if !SIMP_MRG_PRUN |
---|
3379 | } |
---|
3380 | #endif |
---|
3381 | |
---|
3382 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
3383 | if( iPdmInterDir && !bNoPdmMerge && PDM_MERGE_POS == 2 ) |
---|
3384 | { |
---|
3385 | abCandIsInter [ iCount ] = true; |
---|
3386 | puhInterDirNeighbours[ iCount ] = iPdmInterDir; |
---|
3387 | if( ( iPdmInterDir & 1 ) == 1 ) |
---|
3388 | { |
---|
3389 | pcMvFieldNeighbours[ iCount<<1 ].setMvField( acPdmMv[ 0 ], aiPdmRefIdx[ 0 ] ); |
---|
3390 | } |
---|
3391 | if( ( iPdmInterDir & 2 ) == 2 ) |
---|
3392 | { |
---|
3393 | pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 1 ], aiPdmRefIdx[ 1 ] ); |
---|
3394 | } |
---|
3395 | #if SIMP_MRG_PRUN |
---|
3396 | if ( mrgCandIdx == iCount ) |
---|
3397 | { |
---|
3398 | return; |
---|
3399 | } |
---|
3400 | #endif |
---|
3401 | iCount ++; |
---|
3402 | } |
---|
3403 | #endif |
---|
3404 | |
---|
3405 | // above right |
---|
3406 | UInt uiAboveRightPartIdx = 0; |
---|
3407 | TComDataCU* pcCUAboveRight = 0; |
---|
3408 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
3409 | pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT, true, false, true ); |
---|
3410 | #else |
---|
3411 | pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT, true, true, true); |
---|
3412 | #endif |
---|
3413 | #if PARALLEL_MERGE |
---|
3414 | if (pcCUAboveRight) |
---|
3415 | { |
---|
3416 | if (!pcCUAboveRight->isDiffMER(xP+nPSW, yP-1, xP, yP)) |
---|
3417 | { |
---|
3418 | pcCUAboveRight = NULL; |
---|
3419 | } |
---|
3420 | } |
---|
3421 | #endif |
---|
3422 | #if SIMP_MRG_PRUN |
---|
3423 | if ( pcCUAboveRight && !pcCUAboveRight->isIntra( uiAboveRightPartIdx ) && ( !pcCUAbove || pcCUAbove->isIntra( uiAbovePartIdx ) || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveRight, uiAboveRightPartIdx ) ) ) |
---|
3424 | #else |
---|
3425 | if ( pcCUAboveRight && !pcCUAboveRight->isIntra( uiAboveRightPartIdx ) ) |
---|
3426 | #endif |
---|
3427 | { |
---|
3428 | abCandIsInter[iCount] = true; |
---|
3429 | // get Inter Dir |
---|
3430 | puhInterDirNeighbours[iCount] = pcCUAboveRight->getInterDir( uiAboveRightPartIdx ); |
---|
3431 | // get Mv from Left |
---|
3432 | pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); |
---|
3433 | if ( getSlice()->isInterB() ) |
---|
3434 | { |
---|
3435 | pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); |
---|
3436 | } |
---|
3437 | #if SIMP_MRG_PRUN |
---|
3438 | if ( mrgCandIdx == iCount ) |
---|
3439 | { |
---|
3440 | return; |
---|
3441 | } |
---|
3442 | #endif |
---|
3443 | iCount ++; |
---|
3444 | } |
---|
3445 | |
---|
3446 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
3447 | if( iPdmInterDir && !bNoPdmMerge && PDM_MERGE_POS == 3 ) |
---|
3448 | { |
---|
3449 | abCandIsInter [ iCount ] = true; |
---|
3450 | puhInterDirNeighbours[ iCount ] = iPdmInterDir; |
---|
3451 | if( ( iPdmInterDir & 1 ) == 1 ) |
---|
3452 | { |
---|
3453 | pcMvFieldNeighbours[ iCount<<1 ].setMvField( acPdmMv[ 0 ], aiPdmRefIdx[ 0 ] ); |
---|
3454 | } |
---|
3455 | if( ( iPdmInterDir & 2 ) == 2 ) |
---|
3456 | { |
---|
3457 | pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 1 ], aiPdmRefIdx[ 1 ] ); |
---|
3458 | } |
---|
3459 | #if SIMP_MRG_PRUN |
---|
3460 | if ( mrgCandIdx == iCount ) |
---|
3461 | { |
---|
3462 | return; |
---|
3463 | } |
---|
3464 | #endif |
---|
3465 | iCount ++; |
---|
3466 | } |
---|
3467 | #endif |
---|
3468 | |
---|
3469 | //left bottom |
---|
3470 | UInt uiLeftBottomPartIdx = 0; |
---|
3471 | TComDataCU* pcCULeftBottom = 0; |
---|
3472 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
3473 | pcCULeftBottom = this->getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB, true, false ); |
---|
3474 | #else |
---|
3475 | pcCULeftBottom = this->getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB ); |
---|
3476 | #endif |
---|
3477 | #if PARALLEL_MERGE |
---|
3478 | if (pcCULeftBottom) |
---|
3479 | { |
---|
3480 | if (!pcCULeftBottom->isDiffMER(xP-1, yP+nPSH, xP, yP)) |
---|
3481 | { |
---|
3482 | pcCULeftBottom = NULL; |
---|
3483 | } |
---|
3484 | } |
---|
3485 | #endif |
---|
3486 | #if SIMP_MRG_PRUN |
---|
3487 | if ( pcCULeftBottom && !pcCULeftBottom->isIntra( uiLeftBottomPartIdx ) && ( !pcCULeft || pcCULeft->isIntra( uiLeftPartIdx ) || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCULeftBottom, uiLeftBottomPartIdx ) ) ) |
---|
3488 | #else |
---|
3489 | if ( pcCULeftBottom && !pcCULeftBottom->isIntra( uiLeftBottomPartIdx ) ) |
---|
3490 | #endif |
---|
3491 | { |
---|
3492 | abCandIsInter[iCount] = true; |
---|
3493 | // get Inter Dir |
---|
3494 | puhInterDirNeighbours[iCount] = pcCULeftBottom->getInterDir( uiLeftBottomPartIdx ); |
---|
3495 | // get Mv from Left |
---|
3496 | pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); |
---|
3497 | if ( getSlice()->isInterB() ) |
---|
3498 | { |
---|
3499 | pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); |
---|
3500 | } |
---|
3501 | #if SIMP_MRG_PRUN |
---|
3502 | if ( mrgCandIdx == iCount ) |
---|
3503 | { |
---|
3504 | return; |
---|
3505 | } |
---|
3506 | #endif |
---|
3507 | iCount ++; |
---|
3508 | } |
---|
3509 | |
---|
3510 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
3511 | if( iPdmInterDir && !bNoPdmMerge && PDM_MERGE_POS == 4 ) |
---|
3512 | { |
---|
3513 | abCandIsInter [ iCount ] = true; |
---|
3514 | puhInterDirNeighbours[ iCount ] = iPdmInterDir; |
---|
3515 | if( ( iPdmInterDir & 1 ) == 1 ) |
---|
3516 | { |
---|
3517 | pcMvFieldNeighbours[ iCount<<1 ].setMvField( acPdmMv[ 0 ], aiPdmRefIdx[ 0 ] ); |
---|
3518 | } |
---|
3519 | if( ( iPdmInterDir & 2 ) == 2 ) |
---|
3520 | { |
---|
3521 | pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 1 ], aiPdmRefIdx[ 1 ] ); |
---|
3522 | } |
---|
3523 | #if SIMP_MRG_PRUN |
---|
3524 | if ( mrgCandIdx == iCount ) |
---|
3525 | { |
---|
3526 | return; |
---|
3527 | } |
---|
3528 | #endif |
---|
3529 | iCount ++; |
---|
3530 | } |
---|
3531 | #endif |
---|
3532 | |
---|
3533 | // above left |
---|
3534 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
3535 | if( iCount < 4 + extraMergeCand ) |
---|
3536 | #else |
---|
3537 | if( iCount < 4 ) |
---|
3538 | #endif |
---|
3539 | { |
---|
3540 | UInt uiAboveLeftPartIdx = 0; |
---|
3541 | TComDataCU* pcCUAboveLeft = 0; |
---|
3542 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
3543 | pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr, true, false, true ); |
---|
3544 | #else |
---|
3545 | pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr, true, true, true ); |
---|
3546 | #endif |
---|
3547 | #if PARALLEL_MERGE |
---|
3548 | if (pcCUAboveLeft) |
---|
3549 | { |
---|
3550 | if (!pcCUAboveLeft->isDiffMER(xP-1, yP-1, xP, yP)) |
---|
3551 | { |
---|
3552 | pcCUAboveLeft = NULL; |
---|
3553 | } |
---|
3554 | } |
---|
3555 | #endif |
---|
3556 | #if SIMP_MRG_PRUN |
---|
3557 | if( pcCUAboveLeft && !pcCUAboveLeft->isIntra( uiAboveLeftPartIdx ) |
---|
3558 | && ( !pcCULeft || pcCULeft->isIntra( uiLeftPartIdx ) || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) ) |
---|
3559 | && ( !pcCUAbove || pcCUAbove->isIntra( uiAbovePartIdx ) || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) ) |
---|
3560 | ) |
---|
3561 | #else |
---|
3562 | if( pcCUAboveLeft && !pcCUAboveLeft->isIntra( uiAboveLeftPartIdx ) ) |
---|
3563 | #endif |
---|
3564 | { |
---|
3565 | abCandIsInter[iCount] = true; |
---|
3566 | // get Inter Dir |
---|
3567 | puhInterDirNeighbours[iCount] = pcCUAboveLeft->getInterDir( uiAboveLeftPartIdx ); |
---|
3568 | // get Mv from Left |
---|
3569 | pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); |
---|
3570 | if ( getSlice()->isInterB() ) |
---|
3571 | { |
---|
3572 | pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); |
---|
3573 | } |
---|
3574 | #if SIMP_MRG_PRUN |
---|
3575 | if ( mrgCandIdx == iCount ) |
---|
3576 | { |
---|
3577 | return; |
---|
3578 | } |
---|
3579 | #endif |
---|
3580 | iCount ++; |
---|
3581 | } |
---|
3582 | } |
---|
3583 | |
---|
3584 | if ( getSlice()->getPPS()->getEnableTMVPFlag() ) |
---|
3585 | { |
---|
3586 | // col [2] |
---|
3587 | Int iRefIdxSkip[2] = {-1, -1}; |
---|
3588 | for (Int i=0; i<2; i++) |
---|
3589 | { |
---|
3590 | RefPicList eRefPicList = ( i==1 ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); |
---|
3591 | #if SET_MERGE_TMVP_REFIDX |
---|
3592 | Int iRefIdxTmp; |
---|
3593 | if ( uiPUIdx != 0 ) |
---|
3594 | { |
---|
3595 | iRefIdxTmp = 0; |
---|
3596 | } |
---|
3597 | else |
---|
3598 | { |
---|
3599 | iRefIdxTmp = (pcCULeft != NULL) ? pcCULeft->getCUMvField(eRefPicList)->getRefIdx(uiLeftPartIdx) : -1; |
---|
3600 | } |
---|
3601 | #else |
---|
3602 | Int iRefIdxTmp = (pcCULeft != NULL) ? pcCULeft->getCUMvField(eRefPicList)->getRefIdx(uiLeftPartIdx) : -1; |
---|
3603 | #endif |
---|
3604 | iRefIdxSkip[i] = (iRefIdxTmp != -1) ? iRefIdxTmp : 0; |
---|
3605 | } |
---|
3606 | //>> MTK colocated-RightBottom |
---|
3607 | UInt uiPartIdxRB; |
---|
3608 | Int uiLCUIdx = getAddr(); |
---|
3609 | PartSize eCUMode = getPartitionSize( 0 ); |
---|
3610 | |
---|
3611 | deriveRightBottomIdx( eCUMode, uiPUIdx, uiPartIdxRB ); |
---|
3612 | |
---|
3613 | UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB]; |
---|
3614 | UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); |
---|
3615 | |
---|
3616 | TComMv cColMv; |
---|
3617 | Int iRefIdx; |
---|
3618 | |
---|
3619 | if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) // image boundary check |
---|
3620 | { |
---|
3621 | uiLCUIdx = -1; |
---|
3622 | } |
---|
3623 | else if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples() ) |
---|
3624 | { |
---|
3625 | uiLCUIdx = -1; |
---|
3626 | } |
---|
3627 | else |
---|
3628 | { |
---|
3629 | if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) && // is not at the last column of LCU |
---|
3630 | ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row of LCU |
---|
3631 | { |
---|
3632 | uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ]; |
---|
3633 | uiLCUIdx = getAddr(); |
---|
3634 | } |
---|
3635 | else if ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) // is not at the last column of LCU But is last row of LCU |
---|
3636 | { |
---|
3637 | uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ]; |
---|
3638 | uiLCUIdx = -1 ; |
---|
3639 | } |
---|
3640 | else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU |
---|
3641 | { |
---|
3642 | uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ]; |
---|
3643 | uiLCUIdx = getAddr() + 1; |
---|
3644 | } |
---|
3645 | else //is the right bottom corner of LCU |
---|
3646 | { |
---|
3647 | uiAbsPartAddr = 0; |
---|
3648 | uiLCUIdx = -1 ; |
---|
3649 | } |
---|
3650 | } |
---|
3651 | iRefIdx = iRefIdxSkip[0]; |
---|
3652 | |
---|
3653 | Bool bExistMV = false; |
---|
3654 | UInt uiPartIdxCenter; |
---|
3655 | UInt uiCurLCUIdx = getAddr(); |
---|
3656 | xDeriveCenterIdx( eCUMode, uiPUIdx, uiPartIdxCenter ); |
---|
3657 | bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_0, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx ); |
---|
3658 | if( bExistMV == false ) |
---|
3659 | { |
---|
3660 | bExistMV = xGetColMVP( REF_PIC_LIST_0, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx ); |
---|
3661 | } |
---|
3662 | if( bExistMV ) |
---|
3663 | { |
---|
3664 | UInt uiArrayAddr = iCount; |
---|
3665 | abCandIsInter[uiArrayAddr] = true; |
---|
3666 | pcMvFieldNeighbours[uiArrayAddr << 1].setMvField( cColMv, iRefIdx ); |
---|
3667 | |
---|
3668 | if ( getSlice()->isInterB() ) |
---|
3669 | { |
---|
3670 | iRefIdx = iRefIdxSkip[1]; |
---|
3671 | bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_1, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx); |
---|
3672 | if( bExistMV == false ) |
---|
3673 | { |
---|
3674 | bExistMV = xGetColMVP( REF_PIC_LIST_1, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx ); |
---|
3675 | } |
---|
3676 | if( bExistMV ) |
---|
3677 | { |
---|
3678 | pcMvFieldNeighbours[ ( uiArrayAddr << 1 ) + 1 ].setMvField( cColMv, iRefIdx ); |
---|
3679 | puhInterDirNeighbours[uiArrayAddr] = 3; |
---|
3680 | } |
---|
3681 | else |
---|
3682 | { |
---|
3683 | puhInterDirNeighbours[uiArrayAddr] = 1; |
---|
3684 | } |
---|
3685 | } |
---|
3686 | else |
---|
3687 | { |
---|
3688 | puhInterDirNeighbours[uiArrayAddr] = 1; |
---|
3689 | } |
---|
3690 | #if SIMP_MRG_PRUN |
---|
3691 | if ( mrgCandIdx == iCount ) |
---|
3692 | { |
---|
3693 | return; |
---|
3694 | } |
---|
3695 | iCount++; |
---|
3696 | #endif |
---|
3697 | } |
---|
3698 | uiIdx++; |
---|
3699 | |
---|
3700 | } |
---|
3701 | |
---|
3702 | #if SIMP_MRG_PRUN |
---|
3703 | UInt uiArrayAddr = iCount; |
---|
3704 | #else |
---|
3705 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
3706 | for( UInt uiOuter = 0; uiOuter < MRG_MAX_NUM_CANDS_MEM; uiOuter++ ) |
---|
3707 | #else |
---|
3708 | for( UInt uiOuter = 0; uiOuter < MRG_MAX_NUM_CANDS; uiOuter++ ) |
---|
3709 | #endif |
---|
3710 | { |
---|
3711 | if( abCandIsInter[ uiOuter ] ) |
---|
3712 | { |
---|
3713 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
3714 | for( UInt uiIter = uiOuter + 1; uiIter < MRG_MAX_NUM_CANDS_MEM; uiIter++ ) |
---|
3715 | #else |
---|
3716 | for( UInt uiIter = uiOuter + 1; uiIter < MRG_MAX_NUM_CANDS; uiIter++ ) |
---|
3717 | #endif |
---|
3718 | { |
---|
3719 | UInt uiMvFieldNeighIdxCurr = uiOuter << 1; |
---|
3720 | UInt uiMvFieldNeighIdxComp = uiIter << 1; |
---|
3721 | if( getSlice()->isInterB() ) |
---|
3722 | { |
---|
3723 | if( puhInterDirNeighbours[ uiOuter ] == 3 ) |
---|
3724 | { |
---|
3725 | if( pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getRefIdx() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getRefIdx() && pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr + 1 ].getRefIdx() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp + 1 ].getRefIdx() && |
---|
3726 | pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getMv() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getMv() && pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr + 1 ].getMv() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp + 1 ].getMv() && |
---|
3727 | puhInterDirNeighbours[ uiOuter ] == puhInterDirNeighbours[ uiIter ] ) |
---|
3728 | { |
---|
3729 | abCandIsInter[ uiIter ] = false; |
---|
3730 | } |
---|
3731 | } |
---|
3732 | else if( puhInterDirNeighbours[ uiOuter ] == 2 ) |
---|
3733 | { |
---|
3734 | if( pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr + 1 ].getRefIdx() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp + 1 ].getRefIdx() && |
---|
3735 | pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr + 1 ].getMv() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp + 1 ].getMv() && |
---|
3736 | puhInterDirNeighbours[ uiOuter ] == puhInterDirNeighbours[ uiIter ] ) |
---|
3737 | { |
---|
3738 | abCandIsInter[ uiIter ] = false; |
---|
3739 | } |
---|
3740 | } |
---|
3741 | else |
---|
3742 | { |
---|
3743 | if( pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getRefIdx() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getRefIdx() && |
---|
3744 | pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getMv() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getMv() && |
---|
3745 | puhInterDirNeighbours[ uiOuter ] == puhInterDirNeighbours[ uiIter ] ) |
---|
3746 | { |
---|
3747 | abCandIsInter[ uiIter ] = false; |
---|
3748 | } |
---|
3749 | } |
---|
3750 | } |
---|
3751 | else |
---|
3752 | { |
---|
3753 | if( pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getRefIdx() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getRefIdx() && |
---|
3754 | pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getMv() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getMv() ) |
---|
3755 | { |
---|
3756 | assert( puhInterDirNeighbours[ uiOuter ] == puhInterDirNeighbours[ uiIter ] ); |
---|
3757 | abCandIsInter[ uiIter ] = false; |
---|
3758 | } |
---|
3759 | } |
---|
3760 | } |
---|
3761 | } |
---|
3762 | } |
---|
3763 | |
---|
3764 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
3765 | bool abCandIsInterFlag[MRG_MAX_NUM_CANDS_MEM]; |
---|
3766 | for (int i=0; i<MRG_MAX_NUM_CANDS_MEM; i++) |
---|
3767 | #else |
---|
3768 | bool abCandIsInterFlag[MRG_MAX_NUM_CANDS]; |
---|
3769 | for (int i=0; i<MRG_MAX_NUM_CANDS; i++) |
---|
3770 | #endif |
---|
3771 | { |
---|
3772 | abCandIsInterFlag[i] = abCandIsInter[ i ]; |
---|
3773 | abCandIsInter[ i ] = false; |
---|
3774 | } |
---|
3775 | |
---|
3776 | UInt uiArrayAddr = 0; |
---|
3777 | |
---|
3778 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
3779 | for (int i=0; i<MRG_MAX_NUM_CANDS_MEM; i++) |
---|
3780 | #else |
---|
3781 | for (int i=0; i<MRG_MAX_NUM_CANDS; i++) |
---|
3782 | #endif |
---|
3783 | { |
---|
3784 | if (abCandIsInterFlag[i]) |
---|
3785 | { |
---|
3786 | abCandIsInter[uiArrayAddr] = true; |
---|
3787 | puhInterDirNeighbours[uiArrayAddr] = puhInterDirNeighbours[i]; |
---|
3788 | pcMvFieldNeighbours[uiArrayAddr<<1].setMvField(pcMvFieldNeighbours[i<<1].getMv(), pcMvFieldNeighbours[i<<1].getRefIdx()); |
---|
3789 | pcMvFieldNeighbours[(uiArrayAddr<<1)+1].setMvField(pcMvFieldNeighbours[(i<<1)+1].getMv(), pcMvFieldNeighbours[(i<<1)+1].getRefIdx()); |
---|
3790 | ++uiArrayAddr; |
---|
3791 | } |
---|
3792 | } |
---|
3793 | |
---|
3794 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
3795 | for (int i=uiArrayAddr; i<MRG_MAX_NUM_CANDS_MEM; i++) |
---|
3796 | #else |
---|
3797 | for (int i=uiArrayAddr; i<MRG_MAX_NUM_CANDS; i++) |
---|
3798 | #endif |
---|
3799 | { |
---|
3800 | puhInterDirNeighbours[i] = (getSlice()->isInterB()) ? 3 : 1; |
---|
3801 | abCandIsInter[i] = false; |
---|
3802 | TComMv tmpMv; |
---|
3803 | tmpMv.set(0,0); |
---|
3804 | pcMvFieldNeighbours[i<<1].setMvField(tmpMv, 0); |
---|
3805 | if ( getSlice()->isInterB() ) |
---|
3806 | { |
---|
3807 | pcMvFieldNeighbours[(i<<1)+1].setMvField(tmpMv, 0); |
---|
3808 | } |
---|
3809 | } |
---|
3810 | #endif |
---|
3811 | UInt uiCutoff = uiArrayAddr; |
---|
3812 | |
---|
3813 | if ( getSlice()->isInterB() ) |
---|
3814 | { |
---|
3815 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
3816 | Int iCombinedCount = 0; |
---|
3817 | Int iMaxCombCount = ( extraMergeCand ? 6 : 5 ); |
---|
3818 | Int iMaxIdx = ( extraMergeCand ? 20 : 12 ); |
---|
3819 | UInt uiPriorityList0[20] = {0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3, 0, 4, 1, 4, 2, 4, 3, 4 }; |
---|
3820 | UInt uiPriorityList1[20] = {1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2, 4, 0, 4, 1, 4, 2, 4, 3 }; |
---|
3821 | |
---|
3822 | for (Int idx=0; idx<uiCutoff*(uiCutoff-1) && uiArrayAddr!=MRG_MAX_NUM_CANDS_MEM && iCombinedCount<iMaxCombCount && idx < iMaxIdx; idx++) |
---|
3823 | #else |
---|
3824 | Int iCombinedCount = 0; |
---|
3825 | UInt uiPriorityList0[12] = {0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3}; |
---|
3826 | UInt uiPriorityList1[12] = {1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2}; |
---|
3827 | |
---|
3828 | for (Int idx=0; idx<uiCutoff*(uiCutoff-1) && uiArrayAddr!=MRG_MAX_NUM_CANDS && iCombinedCount<5 && idx < 12; idx++) |
---|
3829 | #endif |
---|
3830 | { |
---|
3831 | Int i = uiPriorityList0[idx]; Int j = uiPriorityList1[idx]; |
---|
3832 | if (abCandIsInter[i] && abCandIsInter[j]&& (puhInterDirNeighbours[i]&0x1)&&(puhInterDirNeighbours[j]&0x2)) |
---|
3833 | { |
---|
3834 | abCandIsInter[uiArrayAddr] = true; |
---|
3835 | puhInterDirNeighbours[uiArrayAddr] = 3; |
---|
3836 | |
---|
3837 | // get Mv from cand[i] and cand[j] |
---|
3838 | pcMvFieldNeighbours[uiArrayAddr << 1].setMvField(pcMvFieldNeighbours[i<<1].getMv(), pcMvFieldNeighbours[i<<1].getRefIdx()); |
---|
3839 | pcMvFieldNeighbours[( uiArrayAddr << 1 ) + 1].setMvField(pcMvFieldNeighbours[(j<<1)+1].getMv(), pcMvFieldNeighbours[(j<<1)+1].getRefIdx()); |
---|
3840 | |
---|
3841 | Int iRefPOCL0 = m_pcSlice->getRefPOC ( REF_PIC_LIST_0, pcMvFieldNeighbours[(uiArrayAddr<<1)].getRefIdx() ); |
---|
3842 | Int iRefViewIdL0 = m_pcSlice->getRefViewId( REF_PIC_LIST_0, pcMvFieldNeighbours[(uiArrayAddr<<1)].getRefIdx() ); |
---|
3843 | Int iRefPOCL1 = m_pcSlice->getRefPOC ( REF_PIC_LIST_1, pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getRefIdx() ); |
---|
3844 | Int iRefViewIdL1 = m_pcSlice->getRefViewId( REF_PIC_LIST_1, pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getRefIdx() ); |
---|
3845 | if(iRefPOCL0 == iRefPOCL1 && iRefViewIdL0 == iRefViewIdL1 && pcMvFieldNeighbours[(uiArrayAddr<<1)].getMv() == pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getMv()) |
---|
3846 | { |
---|
3847 | abCandIsInter[uiArrayAddr] = false; |
---|
3848 | } |
---|
3849 | else |
---|
3850 | { |
---|
3851 | uiArrayAddr++; |
---|
3852 | iCombinedCount++; |
---|
3853 | } |
---|
3854 | } |
---|
3855 | } |
---|
3856 | #if !REMOVE_NON_SCALED |
---|
3857 | Int iScaledCount = 0; |
---|
3858 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
3859 | for (int i=0; i<uiCutoff && uiArrayAddr!=MRG_MAX_NUM_CANDS_MEM && iScaledCount<1; i++) |
---|
3860 | #else |
---|
3861 | for (int i=0; i<uiCutoff && uiArrayAddr!=MRG_MAX_NUM_CANDS && iScaledCount<1; i++) |
---|
3862 | #endif |
---|
3863 | { |
---|
3864 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
3865 | for (int j=0; j<2 && uiArrayAddr!=MRG_MAX_NUM_CANDS_MEM && iScaledCount<1; j++) |
---|
3866 | #else |
---|
3867 | for (int j=0; j<2 && uiArrayAddr!=MRG_MAX_NUM_CANDS && iScaledCount<1; j++) |
---|
3868 | #endif |
---|
3869 | { |
---|
3870 | 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)) |
---|
3871 | { |
---|
3872 | Int iCurrPOC = m_pcSlice->getPOC(); |
---|
3873 | Int iCurrRefPOC1 = m_pcSlice->getRefPOC( (j==0)?REF_PIC_LIST_1:REF_PIC_LIST_0, pcMvFieldNeighbours[(i<<1)+j].getRefIdx() ); |
---|
3874 | Int iCurrRefPOC2 = m_pcSlice->getRefPOC( (j==0)?REF_PIC_LIST_0:REF_PIC_LIST_1, pcMvFieldNeighbours[(i<<1)+j].getRefIdx() ); |
---|
3875 | |
---|
3876 | if (iCurrRefPOC1 != iCurrRefPOC2 && abs(iCurrPOC-iCurrRefPOC1) == abs(iCurrPOC-iCurrRefPOC2)) |
---|
3877 | { |
---|
3878 | abCandIsInter[uiArrayAddr] = true; |
---|
3879 | puhInterDirNeighbours[uiArrayAddr] = 3; |
---|
3880 | |
---|
3881 | TComMv cMvPred = pcMvFieldNeighbours[(i<<1)+j].getMv(); |
---|
3882 | TComMv rcMv; |
---|
3883 | |
---|
3884 | rcMv.set(-1*cMvPred.getHor(), -1*cMvPred.getVer()); |
---|
3885 | |
---|
3886 | if (j==0) |
---|
3887 | { |
---|
3888 | pcMvFieldNeighbours[uiArrayAddr << 1].setMvField(pcMvFieldNeighbours[(i<<1)].getMv(), pcMvFieldNeighbours[(i<<1)].getRefIdx()); |
---|
3889 | pcMvFieldNeighbours[( uiArrayAddr << 1 ) + 1].setMvField(rcMv, pcMvFieldNeighbours[(i<<1)].getRefIdx()); |
---|
3890 | } |
---|
3891 | else |
---|
3892 | { |
---|
3893 | pcMvFieldNeighbours[uiArrayAddr << 1].setMvField(rcMv, pcMvFieldNeighbours[(i<<1)+1].getRefIdx()); |
---|
3894 | pcMvFieldNeighbours[( uiArrayAddr << 1 ) + 1].setMvField(pcMvFieldNeighbours[(i<<1)+1].getMv(), pcMvFieldNeighbours[(i<<1)+1].getRefIdx()); |
---|
3895 | } |
---|
3896 | |
---|
3897 | uiArrayAddr++; |
---|
3898 | iScaledCount++; |
---|
3899 | } |
---|
3900 | } |
---|
3901 | } |
---|
3902 | } |
---|
3903 | #endif |
---|
3904 | } |
---|
3905 | |
---|
3906 | 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); |
---|
3907 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
3908 | for (int r=0; r<iNumRefIdx && uiArrayAddr!=MRG_MAX_NUM_CANDS_MEM; r++) |
---|
3909 | #else |
---|
3910 | for (int r=0; r<iNumRefIdx && uiArrayAddr!=MRG_MAX_NUM_CANDS; r++) |
---|
3911 | #endif |
---|
3912 | { |
---|
3913 | abCandIsInter[uiArrayAddr] = true; |
---|
3914 | puhInterDirNeighbours[uiArrayAddr] = 1; |
---|
3915 | pcMvFieldNeighbours[uiArrayAddr << 1].setMvField( TComMv(0, 0), r); |
---|
3916 | |
---|
3917 | if ( getSlice()->isInterB() ) |
---|
3918 | { |
---|
3919 | puhInterDirNeighbours[uiArrayAddr] = 3; |
---|
3920 | pcMvFieldNeighbours[(uiArrayAddr << 1) + 1].setMvField(TComMv(0, 0), r); |
---|
3921 | } |
---|
3922 | uiArrayAddr++; |
---|
3923 | } |
---|
3924 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
3925 | if (uiArrayAddr > MRG_MAX_NUM_CANDS_SIGNALED + extraMergeCand ) |
---|
3926 | { |
---|
3927 | uiArrayAddr = MRG_MAX_NUM_CANDS_SIGNALED + extraMergeCand; |
---|
3928 | } |
---|
3929 | #else |
---|
3930 | if (uiArrayAddr > MRG_MAX_NUM_CANDS_SIGNALED) |
---|
3931 | { |
---|
3932 | uiArrayAddr = MRG_MAX_NUM_CANDS_SIGNALED; |
---|
3933 | } |
---|
3934 | #endif |
---|
3935 | numValidMergeCand = uiArrayAddr; |
---|
3936 | } |
---|
3937 | |
---|
3938 | /** Check the duplicated candidate in the list |
---|
3939 | * \param pcMvFieldNeighbours |
---|
3940 | * \param puhInterDirNeighbours |
---|
3941 | * \param pbCandIsInter |
---|
3942 | * \param ruiArrayAddr |
---|
3943 | * \returns Void |
---|
3944 | */ |
---|
3945 | Void TComDataCU::xCheckDuplicateCand(TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, bool* pbCandIsInter, UInt& ruiArrayAddr) |
---|
3946 | { |
---|
3947 | if (getSlice()->isInterB()) |
---|
3948 | { |
---|
3949 | UInt uiMvFieldNeighIdxCurr = ruiArrayAddr << 1; |
---|
3950 | Int iRefIdxL0 = pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getRefIdx(); |
---|
3951 | Int iRefIdxL1 = pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr + 1 ].getRefIdx(); |
---|
3952 | TComMv MvL0 = pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getMv(); |
---|
3953 | TComMv MvL1 = pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr + 1 ].getMv(); |
---|
3954 | |
---|
3955 | for (int k=0; k<ruiArrayAddr; k++) |
---|
3956 | { |
---|
3957 | UInt uiMvFieldNeighIdxComp = k << 1; |
---|
3958 | if (iRefIdxL0 == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getRefIdx() && |
---|
3959 | iRefIdxL1 == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp + 1 ].getRefIdx() && |
---|
3960 | MvL0 == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getMv() && |
---|
3961 | MvL1 == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp + 1 ].getMv() && |
---|
3962 | puhInterDirNeighbours[ ruiArrayAddr ] == puhInterDirNeighbours[ k ] ) |
---|
3963 | { |
---|
3964 | pbCandIsInter[ruiArrayAddr] = false; |
---|
3965 | break; |
---|
3966 | } |
---|
3967 | } |
---|
3968 | } |
---|
3969 | else |
---|
3970 | { |
---|
3971 | UInt uiMvFieldNeighIdxCurr = ruiArrayAddr << 1; |
---|
3972 | Int iRefIdxL0 = pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getRefIdx(); |
---|
3973 | TComMv MvL0 = pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getMv(); |
---|
3974 | |
---|
3975 | for (int k=0; k<ruiArrayAddr; k++) |
---|
3976 | { |
---|
3977 | UInt uiMvFieldNeighIdxComp = k << 1; |
---|
3978 | if (iRefIdxL0 == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getRefIdx() && |
---|
3979 | MvL0 == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getMv() && |
---|
3980 | puhInterDirNeighbours[ ruiArrayAddr ] == puhInterDirNeighbours[ k ] ) |
---|
3981 | { |
---|
3982 | pbCandIsInter[ruiArrayAddr] = false; |
---|
3983 | break; |
---|
3984 | } |
---|
3985 | } |
---|
3986 | } |
---|
3987 | |
---|
3988 | if (pbCandIsInter[ruiArrayAddr]) |
---|
3989 | { |
---|
3990 | ++ruiArrayAddr; |
---|
3991 | } |
---|
3992 | } |
---|
3993 | |
---|
3994 | Void TComDataCU::xCheckCornerCand( TComDataCU* pcCorner, UInt uiCornerPUIdx, UInt uiIter, Bool& rbValidCand ) |
---|
3995 | { |
---|
3996 | if( uiIter == 0 ) |
---|
3997 | { |
---|
3998 | if( pcCorner && !pcCorner->isIntra( uiCornerPUIdx ) ) |
---|
3999 | { |
---|
4000 | rbValidCand = true; |
---|
4001 | if( getSlice()->isInterB() ) |
---|
4002 | { |
---|
4003 | if ( pcCorner->getInterDir( uiCornerPUIdx ) == 1 ) |
---|
4004 | { |
---|
4005 | if( pcCorner->getCUMvField(REF_PIC_LIST_0)->getRefIdx( uiCornerPUIdx ) != 0 ) |
---|
4006 | { |
---|
4007 | rbValidCand = false; |
---|
4008 | } |
---|
4009 | } |
---|
4010 | else if ( pcCorner->getInterDir( uiCornerPUIdx ) == 2 ) |
---|
4011 | { |
---|
4012 | if( pcCorner->getCUMvField(REF_PIC_LIST_1)->getRefIdx( uiCornerPUIdx ) != 0 ) |
---|
4013 | { |
---|
4014 | rbValidCand = false; |
---|
4015 | } |
---|
4016 | } |
---|
4017 | else |
---|
4018 | { |
---|
4019 | if( pcCorner->getCUMvField(REF_PIC_LIST_0)->getRefIdx( uiCornerPUIdx ) != 0 || pcCorner->getCUMvField(REF_PIC_LIST_1)->getRefIdx( uiCornerPUIdx ) != 0 ) |
---|
4020 | { |
---|
4021 | rbValidCand = false; |
---|
4022 | } |
---|
4023 | } |
---|
4024 | } |
---|
4025 | else if( pcCorner->getCUMvField(REF_PIC_LIST_0)->getRefIdx( uiCornerPUIdx ) != 0 ) |
---|
4026 | { |
---|
4027 | rbValidCand = false; |
---|
4028 | } |
---|
4029 | } |
---|
4030 | } |
---|
4031 | else |
---|
4032 | { |
---|
4033 | if( pcCorner && !pcCorner->isIntra( uiCornerPUIdx ) ) |
---|
4034 | { |
---|
4035 | rbValidCand = true; |
---|
4036 | if( getSlice()->isInterB() ) |
---|
4037 | { |
---|
4038 | if ( pcCorner->getInterDir( uiCornerPUIdx ) == 1 ) |
---|
4039 | { |
---|
4040 | if( pcCorner->getCUMvField(REF_PIC_LIST_0)->getRefIdx( uiCornerPUIdx ) < 0 ) |
---|
4041 | { |
---|
4042 | rbValidCand = false; |
---|
4043 | } |
---|
4044 | } |
---|
4045 | else if ( pcCorner->getInterDir( uiCornerPUIdx ) == 2 ) |
---|
4046 | { |
---|
4047 | if( pcCorner->getCUMvField(REF_PIC_LIST_1)->getRefIdx( uiCornerPUIdx ) < 0 ) |
---|
4048 | { |
---|
4049 | rbValidCand = false; |
---|
4050 | } |
---|
4051 | } |
---|
4052 | else |
---|
4053 | { |
---|
4054 | if( pcCorner->getCUMvField(REF_PIC_LIST_0)->getRefIdx( uiCornerPUIdx ) < 0 || pcCorner->getCUMvField(REF_PIC_LIST_1)->getRefIdx( uiCornerPUIdx ) < 0 ) |
---|
4055 | { |
---|
4056 | rbValidCand = false; |
---|
4057 | } |
---|
4058 | } |
---|
4059 | } |
---|
4060 | else if( pcCorner->getCUMvField(REF_PIC_LIST_0)->getRefIdx( uiCornerPUIdx ) < 0 ) |
---|
4061 | { |
---|
4062 | rbValidCand = false; |
---|
4063 | } |
---|
4064 | } |
---|
4065 | } |
---|
4066 | } |
---|
4067 | #if PARALLEL_MERGE |
---|
4068 | /** Check whether the current PU and a spatial neighboring PU are in a same ME region. |
---|
4069 | * \param xN, xN location of the upper-left corner pixel of a neighboring PU |
---|
4070 | * \param xP, yP location of the upper-left corner pixel of the current PU |
---|
4071 | * \returns Bool |
---|
4072 | */ |
---|
4073 | Bool TComDataCU::isDiffMER(Int xN, Int yN, Int xP, Int yP) |
---|
4074 | { |
---|
4075 | |
---|
4076 | UInt plevel = this->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() + 2; |
---|
4077 | if ((xN>>plevel)!= (xP>>plevel)) |
---|
4078 | { |
---|
4079 | return true; |
---|
4080 | } |
---|
4081 | if ((yN>>plevel)!= (yP>>plevel)) |
---|
4082 | { |
---|
4083 | return true; |
---|
4084 | } |
---|
4085 | return false; |
---|
4086 | } |
---|
4087 | /** calculate the location of upper-left corner pixel and size of the current PU. |
---|
4088 | * \param partIdx PU index within a CU |
---|
4089 | * \param xP, yP location of the upper-left corner pixel of the current PU |
---|
4090 | * \param PSW, nPSH size of the curren PU |
---|
4091 | * \returns Void |
---|
4092 | */ |
---|
4093 | Void TComDataCU::getPartPosition( UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH) |
---|
4094 | { |
---|
4095 | UInt col = m_uiCUPelX; |
---|
4096 | UInt row = m_uiCUPelY; |
---|
4097 | |
---|
4098 | switch ( m_pePartSize[0] ) |
---|
4099 | { |
---|
4100 | case SIZE_2NxN: |
---|
4101 | nPSW = getWidth(0); |
---|
4102 | nPSH = getHeight(0) >> 1; |
---|
4103 | xP = col; |
---|
4104 | yP = (partIdx ==0)? row: row + nPSH; |
---|
4105 | break; |
---|
4106 | case SIZE_Nx2N: |
---|
4107 | nPSW = getWidth(0) >> 1; |
---|
4108 | nPSH = getHeight(0); |
---|
4109 | xP = (partIdx ==0)? col: col + nPSW; |
---|
4110 | yP = row; |
---|
4111 | break; |
---|
4112 | case SIZE_NxN: |
---|
4113 | nPSW = getWidth(0) >> 1; |
---|
4114 | nPSH = getHeight(0) >> 1; |
---|
4115 | xP = col + (partIdx&0x1)*nPSW; |
---|
4116 | yP = row + (partIdx>>1)*nPSH; |
---|
4117 | break; |
---|
4118 | case SIZE_2NxnU: |
---|
4119 | nPSW = getWidth(0); |
---|
4120 | nPSH = ( partIdx == 0 ) ? getHeight(0) >> 2 : ( getHeight(0) >> 2 ) + ( getHeight(0) >> 1 ); |
---|
4121 | xP = col; |
---|
4122 | yP = (partIdx ==0)? row: row + getHeight(0) - nPSH; |
---|
4123 | |
---|
4124 | break; |
---|
4125 | case SIZE_2NxnD: |
---|
4126 | nPSW = getWidth(0); |
---|
4127 | nPSH = ( partIdx == 0 ) ? ( getHeight(0) >> 2 ) + ( getHeight(0) >> 1 ) : getHeight(0) >> 2; |
---|
4128 | xP = col; |
---|
4129 | yP = (partIdx ==0)? row: row + getHeight(0) - nPSH; |
---|
4130 | break; |
---|
4131 | case SIZE_nLx2N: |
---|
4132 | nPSW = ( partIdx == 0 ) ? getWidth(0) >> 2 : ( getWidth(0) >> 2 ) + ( getWidth(0) >> 1 ); |
---|
4133 | nPSH = getHeight(0); |
---|
4134 | xP = (partIdx ==0)? col: col + getWidth(0) - nPSW; |
---|
4135 | yP = row; |
---|
4136 | break; |
---|
4137 | case SIZE_nRx2N: |
---|
4138 | nPSW = ( partIdx == 0 ) ? ( getWidth(0) >> 2 ) + ( getWidth(0) >> 1 ) : getWidth(0) >> 2; |
---|
4139 | nPSH = getHeight(0); |
---|
4140 | xP = (partIdx ==0)? col: col + getWidth(0) - nPSW; |
---|
4141 | yP = row; |
---|
4142 | break; |
---|
4143 | default: |
---|
4144 | assert ( m_pePartSize[0] == SIZE_2Nx2N ); |
---|
4145 | nPSW = getWidth(0); |
---|
4146 | nPSH = getHeight(0); |
---|
4147 | xP = col ; |
---|
4148 | yP = row ; |
---|
4149 | |
---|
4150 | break; |
---|
4151 | } |
---|
4152 | } |
---|
4153 | |
---|
4154 | #endif |
---|
4155 | AMVP_MODE TComDataCU::getAMVPMode(UInt uiIdx) |
---|
4156 | { |
---|
4157 | return m_pcSlice->getSPS()->getAMVPMode(m_puhDepth[uiIdx]); |
---|
4158 | } |
---|
4159 | |
---|
4160 | /** Constructs a list of candidates for AMVP |
---|
4161 | * \param uiPartIdx |
---|
4162 | * \param uiPartAddr |
---|
4163 | * \param eRefPicList |
---|
4164 | * \param iRefIdx |
---|
4165 | * \param pInfo |
---|
4166 | */ |
---|
4167 | Void TComDataCU::fillMvpCand ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo ) |
---|
4168 | { |
---|
4169 | PartSize eCUMode = getPartitionSize( 0 ); |
---|
4170 | |
---|
4171 | TComMv cMvPred; |
---|
4172 | Bool bAddedSmvp = false; |
---|
4173 | |
---|
4174 | pInfo->iN = 0; |
---|
4175 | if (iRefIdx < 0) |
---|
4176 | { |
---|
4177 | return; |
---|
4178 | } |
---|
4179 | |
---|
4180 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
4181 | #if ( PDM_AMVP_POS == 0 ) |
---|
4182 | // get inter-view mv predictor (at position 0) |
---|
4183 | TComMv cPdmMvPred; |
---|
4184 | if( getPdmMvPred( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred ) ) |
---|
4185 | { |
---|
4186 | clipMv( cPdmMvPred ); |
---|
4187 | pInfo->m_acMvCand[ pInfo->iN++ ] = cPdmMvPred; |
---|
4188 | } |
---|
4189 | #endif |
---|
4190 | #endif |
---|
4191 | |
---|
4192 | //-- Get Spatial MV |
---|
4193 | UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB; |
---|
4194 | UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); |
---|
4195 | Bool bAdded = false; |
---|
4196 | |
---|
4197 | deriveLeftRightTopIdx( eCUMode, uiPartIdx, uiPartIdxLT, uiPartIdxRT ); |
---|
4198 | deriveLeftBottomIdx( eCUMode, uiPartIdx, uiPartIdxLB ); |
---|
4199 | |
---|
4200 | TComDataCU* tmpCU = NULL; |
---|
4201 | UInt idx; |
---|
4202 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
4203 | tmpCU = getPUBelowLeft(idx, uiPartIdxLB, true, false); |
---|
4204 | #else |
---|
4205 | tmpCU = getPUBelowLeft(idx, uiPartIdxLB); |
---|
4206 | #endif |
---|
4207 | bAddedSmvp = (tmpCU != NULL) && (tmpCU->getPredictionMode(idx) != MODE_INTRA); |
---|
4208 | |
---|
4209 | if (!bAddedSmvp) |
---|
4210 | { |
---|
4211 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
4212 | tmpCU = getPULeft(idx, uiPartIdxLB, true, false); |
---|
4213 | #else |
---|
4214 | tmpCU = getPULeft(idx, uiPartIdxLB); |
---|
4215 | #endif |
---|
4216 | bAddedSmvp = (tmpCU != NULL) && (tmpCU->getPredictionMode(idx) != MODE_INTRA); |
---|
4217 | } |
---|
4218 | |
---|
4219 | // Left predictor search |
---|
4220 | bAdded = xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxLB, MD_BELOW_LEFT); |
---|
4221 | if (!bAdded) |
---|
4222 | { |
---|
4223 | bAdded = xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxLB, MD_LEFT ); |
---|
4224 | } |
---|
4225 | |
---|
4226 | if(!bAdded) |
---|
4227 | { |
---|
4228 | bAdded = xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxLB, MD_BELOW_LEFT); |
---|
4229 | if (!bAdded) |
---|
4230 | { |
---|
4231 | bAdded = xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxLB, MD_LEFT ); |
---|
4232 | } |
---|
4233 | } |
---|
4234 | |
---|
4235 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
4236 | #if ( PDM_AMVP_POS == 1 ) |
---|
4237 | // get inter-view mv predictor (at position 1) |
---|
4238 | TComMv cPdmMvPred; |
---|
4239 | if( getPdmMvPred( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred ) ) |
---|
4240 | { |
---|
4241 | clipMv( cPdmMvPred ); |
---|
4242 | pInfo->m_acMvCand[ pInfo->iN++ ] = cPdmMvPred; |
---|
4243 | } |
---|
4244 | #endif |
---|
4245 | #endif |
---|
4246 | |
---|
4247 | // Above predictor search |
---|
4248 | bAdded = xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxRT, MD_ABOVE_RIGHT); |
---|
4249 | |
---|
4250 | if (!bAdded) |
---|
4251 | { |
---|
4252 | bAdded = xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxRT, MD_ABOVE); |
---|
4253 | } |
---|
4254 | |
---|
4255 | if(!bAdded) |
---|
4256 | { |
---|
4257 | bAdded = xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxLT, MD_ABOVE_LEFT); |
---|
4258 | } |
---|
4259 | bAdded = bAddedSmvp; |
---|
4260 | if (pInfo->iN==2) bAdded = true; |
---|
4261 | |
---|
4262 | if(!bAdded) |
---|
4263 | { |
---|
4264 | bAdded = xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxRT, MD_ABOVE_RIGHT); |
---|
4265 | if (!bAdded) |
---|
4266 | { |
---|
4267 | bAdded = xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxRT, MD_ABOVE); |
---|
4268 | } |
---|
4269 | |
---|
4270 | if(!bAdded) |
---|
4271 | { |
---|
4272 | bAdded = xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxLT, MD_ABOVE_LEFT); |
---|
4273 | } |
---|
4274 | } |
---|
4275 | |
---|
4276 | if (getAMVPMode(uiPartAddr) == AM_NONE) //Should be optimized later for special cases |
---|
4277 | { |
---|
4278 | assert(pInfo->iN > 0); |
---|
4279 | pInfo->iN = 1; |
---|
4280 | return; |
---|
4281 | } |
---|
4282 | |
---|
4283 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
4284 | #if ( PDM_AMVP_POS == 2 ) |
---|
4285 | // get inter-view mv predictor (at position 2) |
---|
4286 | TComMv cPdmMvPred; |
---|
4287 | if( getPdmMvPred( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred ) ) |
---|
4288 | { |
---|
4289 | clipMv( cPdmMvPred ); |
---|
4290 | pInfo->m_acMvCand[ pInfo->iN++ ] = cPdmMvPred; |
---|
4291 | } |
---|
4292 | #endif |
---|
4293 | #endif |
---|
4294 | |
---|
4295 | #if AMVP_PRUNING_SIMPLIFICATION |
---|
4296 | if ( pInfo->iN == 2 ) |
---|
4297 | { |
---|
4298 | if ( pInfo->m_acMvCand[ 0 ] == pInfo->m_acMvCand[ 1 ] ) |
---|
4299 | { |
---|
4300 | pInfo->iN = 1; |
---|
4301 | } |
---|
4302 | } |
---|
4303 | #endif |
---|
4304 | |
---|
4305 | if ( getSlice()->getPPS()->getEnableTMVPFlag() ) |
---|
4306 | { |
---|
4307 | // Get Temporal Motion Predictor |
---|
4308 | int iRefIdx_Col = iRefIdx; |
---|
4309 | TComMv cColMv; |
---|
4310 | UInt uiPartIdxRB; |
---|
4311 | UInt uiAbsPartIdx; |
---|
4312 | UInt uiAbsPartAddr; |
---|
4313 | int uiLCUIdx = getAddr(); |
---|
4314 | |
---|
4315 | deriveRightBottomIdx( eCUMode, uiPartIdx, uiPartIdxRB ); |
---|
4316 | uiAbsPartAddr = m_uiAbsIdxInLCU + uiPartAddr; |
---|
4317 | |
---|
4318 | //---- co-located RightBottom Temporal Predictor (H) ---// |
---|
4319 | uiAbsPartIdx = g_auiZscanToRaster[uiPartIdxRB]; |
---|
4320 | if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdx] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) // image boundary check |
---|
4321 | { |
---|
4322 | uiLCUIdx = -1; |
---|
4323 | } |
---|
4324 | else if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdx] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples() ) |
---|
4325 | { |
---|
4326 | uiLCUIdx = -1; |
---|
4327 | } |
---|
4328 | else |
---|
4329 | { |
---|
4330 | if ( ( uiAbsPartIdx % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) && // is not at the last column of LCU |
---|
4331 | ( uiAbsPartIdx / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row of LCU |
---|
4332 | { |
---|
4333 | uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdx + uiNumPartInCUWidth + 1 ]; |
---|
4334 | uiLCUIdx = getAddr(); |
---|
4335 | } |
---|
4336 | else if ( uiAbsPartIdx % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) // is not at the last column of LCU But is last row of LCU |
---|
4337 | { |
---|
4338 | uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdx + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ]; |
---|
4339 | uiLCUIdx = -1 ; |
---|
4340 | } |
---|
4341 | else if ( uiAbsPartIdx / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU |
---|
4342 | { |
---|
4343 | uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdx + 1 ]; |
---|
4344 | uiLCUIdx = getAddr() + 1; |
---|
4345 | } |
---|
4346 | else //is the right bottom corner of LCU |
---|
4347 | { |
---|
4348 | uiAbsPartAddr = 0; |
---|
4349 | uiLCUIdx = -1 ; |
---|
4350 | } |
---|
4351 | } |
---|
4352 | if ( uiLCUIdx >= 0 && xGetColMVP( eRefPicList, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx_Col ) ) |
---|
4353 | { |
---|
4354 | pInfo->m_acMvCand[pInfo->iN++] = cColMv; |
---|
4355 | } |
---|
4356 | else |
---|
4357 | { |
---|
4358 | UInt uiPartIdxCenter; |
---|
4359 | UInt uiCurLCUIdx = getAddr(); |
---|
4360 | xDeriveCenterIdx( eCUMode, uiPartIdx, uiPartIdxCenter ); |
---|
4361 | if (xGetColMVP( eRefPicList, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx_Col )) |
---|
4362 | { |
---|
4363 | pInfo->m_acMvCand[pInfo->iN++] = cColMv; |
---|
4364 | } |
---|
4365 | } |
---|
4366 | //---- co-located RightBottom Temporal Predictor ---// |
---|
4367 | } |
---|
4368 | |
---|
4369 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
4370 | #if ( PDM_AMVP_POS == 3 ) |
---|
4371 | // get inter-view mv predictor (at position 3) |
---|
4372 | TComMv cPdmMvPred; |
---|
4373 | if( getPdmMvPred( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred ) ) |
---|
4374 | { |
---|
4375 | clipMv( cPdmMvPred ); |
---|
4376 | pInfo->m_acMvCand[ pInfo->iN++ ] = cPdmMvPred; |
---|
4377 | } |
---|
4378 | #endif |
---|
4379 | #endif |
---|
4380 | |
---|
4381 | #if !AMVP_PRUNING_SIMPLIFICATION |
---|
4382 | // Check No MV Candidate |
---|
4383 | xUniqueMVPCand( pInfo ); |
---|
4384 | #endif |
---|
4385 | |
---|
4386 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
4387 | const Int iNumAMVPCands = AMVP_MAX_NUM_CANDS + ( getSlice()->getSPS()->getMultiviewMvPredMode() ? 1 : 0 ); |
---|
4388 | if (pInfo->iN > iNumAMVPCands) |
---|
4389 | { |
---|
4390 | pInfo->iN = iNumAMVPCands; |
---|
4391 | } |
---|
4392 | else if (pInfo->iN < iNumAMVPCands) |
---|
4393 | #else |
---|
4394 | if (pInfo->iN > AMVP_MAX_NUM_CANDS) |
---|
4395 | { |
---|
4396 | pInfo->iN = AMVP_MAX_NUM_CANDS; |
---|
4397 | } |
---|
4398 | else if (pInfo->iN < AMVP_MAX_NUM_CANDS) |
---|
4399 | #endif |
---|
4400 | { |
---|
4401 | #if !AMVP_ZERO_CHECKING_REMOVAL |
---|
4402 | int j; |
---|
4403 | for (j=0; j<pInfo->iN; j++) |
---|
4404 | { |
---|
4405 | if (pInfo->m_acMvCand[j].getHor() == 0 && pInfo->m_acMvCand[j].getVer() == 0) |
---|
4406 | { |
---|
4407 | break; |
---|
4408 | } |
---|
4409 | } |
---|
4410 | if (j == pInfo->iN) |
---|
4411 | { |
---|
4412 | #endif |
---|
4413 | pInfo->m_acMvCand[pInfo->iN].set(0,0); |
---|
4414 | pInfo->iN++; |
---|
4415 | #if !AMVP_ZERO_CHECKING_REMOVAL |
---|
4416 | } |
---|
4417 | #endif |
---|
4418 | } |
---|
4419 | return ; |
---|
4420 | } |
---|
4421 | |
---|
4422 | Void TComDataCU::clipMv (TComMv& rcMv) |
---|
4423 | { |
---|
4424 | Int iMvShift = 2; |
---|
4425 | #if HHI_FULL_PEL_DEPTH_MAP_MV_ACC |
---|
4426 | if( getSlice()->getIsDepth() ) |
---|
4427 | iMvShift = 0; |
---|
4428 | #endif |
---|
4429 | Int iOffset = 8; |
---|
4430 | Int iHorMax = ( m_pcSlice->getSPS()->getPicWidthInLumaSamples() + iOffset - m_uiCUPelX - 1 ) << iMvShift; |
---|
4431 | Int iHorMin = ( -(Int)g_uiMaxCUWidth - iOffset - (Int)m_uiCUPelX + 1 ) << iMvShift; |
---|
4432 | |
---|
4433 | Int iVerMax = ( m_pcSlice->getSPS()->getPicHeightInLumaSamples() + iOffset - m_uiCUPelY - 1 ) << iMvShift; |
---|
4434 | Int iVerMin = ( -(Int)g_uiMaxCUHeight - iOffset - (Int)m_uiCUPelY + 1 ) << iMvShift; |
---|
4435 | |
---|
4436 | rcMv.setHor( min (iHorMax, max (iHorMin, rcMv.getHor())) ); |
---|
4437 | rcMv.setVer( min (iVerMax, max (iVerMin, rcMv.getVer())) ); |
---|
4438 | } |
---|
4439 | |
---|
4440 | |
---|
4441 | Void TComDataCU::convertTransIdx( UInt uiAbsPartIdx, UInt uiTrIdx, UInt& ruiLumaTrMode, UInt& ruiChromaTrMode ) |
---|
4442 | { |
---|
4443 | ruiLumaTrMode = uiTrIdx; |
---|
4444 | ruiChromaTrMode = uiTrIdx; |
---|
4445 | return; |
---|
4446 | } |
---|
4447 | |
---|
4448 | UInt TComDataCU::getIntraSizeIdx(UInt uiAbsPartIdx) |
---|
4449 | { |
---|
4450 | UInt uiShift = ( (m_puhTrIdx[uiAbsPartIdx]==0) && (m_pePartSize[uiAbsPartIdx]==SIZE_NxN) ) ? m_puhTrIdx[uiAbsPartIdx]+1 : m_puhTrIdx[uiAbsPartIdx]; |
---|
4451 | uiShift = ( m_pePartSize[uiAbsPartIdx]==SIZE_NxN ? 1 : 0 ); |
---|
4452 | |
---|
4453 | UChar uiWidth = m_puhWidth[uiAbsPartIdx]>>uiShift; |
---|
4454 | UInt uiCnt = 0; |
---|
4455 | while( uiWidth ) |
---|
4456 | { |
---|
4457 | uiCnt++; |
---|
4458 | uiWidth>>=1; |
---|
4459 | } |
---|
4460 | uiCnt-=2; |
---|
4461 | return uiCnt > 6 ? 6 : uiCnt; |
---|
4462 | } |
---|
4463 | |
---|
4464 | Void TComDataCU::clearCbf( UInt uiIdx, TextType eType, UInt uiNumParts ) |
---|
4465 | { |
---|
4466 | ::memset( &m_puhCbf[g_aucConvertTxtTypeToIdx[eType]][uiIdx], 0, sizeof(UChar)*uiNumParts); |
---|
4467 | } |
---|
4468 | |
---|
4469 | /** Set a I_PCM flag for all sub-partitions of a partition. |
---|
4470 | * \param bIpcmFlag I_PCM flag |
---|
4471 | * \param uiAbsPartIdx patition index |
---|
4472 | * \param uiDepth CU depth |
---|
4473 | * \returns Void |
---|
4474 | */ |
---|
4475 | Void TComDataCU::setIPCMFlagSubParts (Bool bIpcmFlag, UInt uiAbsPartIdx, UInt uiDepth) |
---|
4476 | { |
---|
4477 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
4478 | |
---|
4479 | memset(m_pbIPCMFlag + uiAbsPartIdx, bIpcmFlag, sizeof(Bool)*uiCurrPartNumb ); |
---|
4480 | } |
---|
4481 | |
---|
4482 | /** Test whether the current block is skipped |
---|
4483 | * \param uiPartIdx Block index |
---|
4484 | * \returns Flag indicating whether the block is skipped |
---|
4485 | */ |
---|
4486 | Bool TComDataCU::isSkipped( UInt uiPartIdx ) |
---|
4487 | { |
---|
4488 | if ( m_pcSlice->isIntra () ) |
---|
4489 | { |
---|
4490 | return false; |
---|
4491 | } |
---|
4492 | return ( m_pePredMode[ uiPartIdx ] == MODE_SKIP && getMergeFlag( uiPartIdx ) && !getQtRootCbf( uiPartIdx ) ); |
---|
4493 | } |
---|
4494 | |
---|
4495 | // ==================================================================================================================== |
---|
4496 | // Protected member functions |
---|
4497 | // ==================================================================================================================== |
---|
4498 | |
---|
4499 | Bool TComDataCU::xAddMVPCand( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir ) |
---|
4500 | { |
---|
4501 | TComDataCU* pcTmpCU = NULL; |
---|
4502 | UInt uiIdx; |
---|
4503 | switch( eDir ) |
---|
4504 | { |
---|
4505 | case MD_LEFT: |
---|
4506 | { |
---|
4507 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
4508 | pcTmpCU = getPULeft(uiIdx, uiPartUnitIdx, true, false); |
---|
4509 | #else |
---|
4510 | pcTmpCU = getPULeft(uiIdx, uiPartUnitIdx); |
---|
4511 | #endif |
---|
4512 | break; |
---|
4513 | } |
---|
4514 | case MD_ABOVE: |
---|
4515 | { |
---|
4516 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
4517 | pcTmpCU = getPUAbove(uiIdx, uiPartUnitIdx, true, false, true); |
---|
4518 | #else |
---|
4519 | pcTmpCU = getPUAbove(uiIdx, uiPartUnitIdx, true, true, true); |
---|
4520 | #endif |
---|
4521 | break; |
---|
4522 | } |
---|
4523 | case MD_ABOVE_RIGHT: |
---|
4524 | { |
---|
4525 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
4526 | pcTmpCU = getPUAboveRight(uiIdx, uiPartUnitIdx, true, false, true); |
---|
4527 | #else |
---|
4528 | pcTmpCU = getPUAboveRight(uiIdx, uiPartUnitIdx, true, true, true); |
---|
4529 | #endif |
---|
4530 | break; |
---|
4531 | } |
---|
4532 | case MD_BELOW_LEFT: |
---|
4533 | { |
---|
4534 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
4535 | pcTmpCU = getPUBelowLeft(uiIdx, uiPartUnitIdx, true, false); |
---|
4536 | #else |
---|
4537 | pcTmpCU = getPUBelowLeft(uiIdx, uiPartUnitIdx); |
---|
4538 | #endif |
---|
4539 | break; |
---|
4540 | } |
---|
4541 | case MD_ABOVE_LEFT: |
---|
4542 | { |
---|
4543 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
4544 | pcTmpCU = getPUAboveLeft(uiIdx, uiPartUnitIdx, true, false, true); |
---|
4545 | #else |
---|
4546 | pcTmpCU = getPUAboveLeft(uiIdx, uiPartUnitIdx, true, true, true); |
---|
4547 | #endif |
---|
4548 | break; |
---|
4549 | } |
---|
4550 | default: |
---|
4551 | { |
---|
4552 | break; |
---|
4553 | } |
---|
4554 | } |
---|
4555 | |
---|
4556 | if ( pcTmpCU != NULL && m_pcSlice->isEqualRef(eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx), iRefIdx) ) |
---|
4557 | { |
---|
4558 | TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); |
---|
4559 | |
---|
4560 | pInfo->m_acMvCand[ pInfo->iN++] = cMvPred; |
---|
4561 | return true; |
---|
4562 | } |
---|
4563 | |
---|
4564 | if ( pcTmpCU == NULL ) |
---|
4565 | { |
---|
4566 | return false; |
---|
4567 | } |
---|
4568 | |
---|
4569 | RefPicList eRefPicList2nd = REF_PIC_LIST_0; |
---|
4570 | if( eRefPicList == REF_PIC_LIST_0 ) |
---|
4571 | { |
---|
4572 | eRefPicList2nd = REF_PIC_LIST_1; |
---|
4573 | } |
---|
4574 | else if ( eRefPicList == REF_PIC_LIST_1) |
---|
4575 | { |
---|
4576 | eRefPicList2nd = REF_PIC_LIST_0; |
---|
4577 | } |
---|
4578 | |
---|
4579 | |
---|
4580 | Int iCurrRefPOC = m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getPOC(); |
---|
4581 | Int iNeibRefPOC; |
---|
4582 | |
---|
4583 | |
---|
4584 | if( pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) >= 0 ) |
---|
4585 | { |
---|
4586 | if( pcTmpCU->getSlice()->getRefViewId( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) ) != m_pcSlice->getRefViewId( eRefPicList, iRefIdx ) ) |
---|
4587 | { |
---|
4588 | return false; |
---|
4589 | } |
---|
4590 | iNeibRefPOC = pcTmpCU->getSlice()->getRefPOC( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) ); |
---|
4591 | if( iNeibRefPOC == iCurrRefPOC ) // Same Reference Frame But Diff List// |
---|
4592 | { |
---|
4593 | TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList2nd)->getMv(uiIdx); |
---|
4594 | pInfo->m_acMvCand[ pInfo->iN++] = cMvPred; |
---|
4595 | return true; |
---|
4596 | } |
---|
4597 | } |
---|
4598 | return false; |
---|
4599 | } |
---|
4600 | |
---|
4601 | #if !AMVP_PRUNING_SIMPLIFICATION |
---|
4602 | /** |
---|
4603 | * Reduce list of motion vector predictors to a set of unique predictors |
---|
4604 | * \param pInfo list of motion vector predictors |
---|
4605 | */ |
---|
4606 | Void TComDataCU::xUniqueMVPCand(AMVPInfo* pInfo) |
---|
4607 | { |
---|
4608 | Int n = 1; |
---|
4609 | if ( pInfo->iN == 0 ) |
---|
4610 | { |
---|
4611 | #if AMVP_ZERO_CHECKING_REMOVAL |
---|
4612 | return; |
---|
4613 | #else |
---|
4614 | // Add a zero candidate is none is available |
---|
4615 | pInfo->m_acMvCand[ 0 ].setZero(); |
---|
4616 | #endif |
---|
4617 | } |
---|
4618 | else |
---|
4619 | { |
---|
4620 | for (Int i = 1; i < pInfo->iN; i++) |
---|
4621 | { |
---|
4622 | Int j; |
---|
4623 | for (j = n - 1; j >= 0; j--) |
---|
4624 | { |
---|
4625 | if ( pInfo->m_acMvCand[ i ] == pInfo->m_acMvCand[ j ] ) |
---|
4626 | { |
---|
4627 | break; |
---|
4628 | } |
---|
4629 | } |
---|
4630 | if ( j < 0 ) |
---|
4631 | { |
---|
4632 | pInfo->m_acMvCand[ n++ ] = pInfo->m_acMvCand[ i ]; |
---|
4633 | } |
---|
4634 | } |
---|
4635 | } |
---|
4636 | pInfo->iN = n; |
---|
4637 | } |
---|
4638 | #endif |
---|
4639 | |
---|
4640 | /** |
---|
4641 | * \param pInfo |
---|
4642 | * \param eRefPicList |
---|
4643 | * \param iRefIdx |
---|
4644 | * \param uiPartUnitIdx |
---|
4645 | * \param eDir |
---|
4646 | * \returns Bool |
---|
4647 | */ |
---|
4648 | Bool TComDataCU::xAddMVPCandOrder( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir ) |
---|
4649 | { |
---|
4650 | TComDataCU* pcTmpCU = NULL; |
---|
4651 | UInt uiIdx; |
---|
4652 | switch( eDir ) |
---|
4653 | { |
---|
4654 | case MD_LEFT: |
---|
4655 | { |
---|
4656 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
4657 | pcTmpCU = getPULeft(uiIdx, uiPartUnitIdx, true, false); |
---|
4658 | #else |
---|
4659 | pcTmpCU = getPULeft(uiIdx, uiPartUnitIdx); |
---|
4660 | #endif |
---|
4661 | break; |
---|
4662 | } |
---|
4663 | case MD_ABOVE: |
---|
4664 | { |
---|
4665 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
4666 | pcTmpCU = getPUAbove(uiIdx, uiPartUnitIdx, true, false, true); |
---|
4667 | #else |
---|
4668 | pcTmpCU = getPUAbove(uiIdx, uiPartUnitIdx, true, true, true); |
---|
4669 | #endif |
---|
4670 | break; |
---|
4671 | } |
---|
4672 | case MD_ABOVE_RIGHT: |
---|
4673 | { |
---|
4674 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
4675 | pcTmpCU = getPUAboveRight(uiIdx, uiPartUnitIdx, true, false, true); |
---|
4676 | #else |
---|
4677 | pcTmpCU = getPUAboveRight(uiIdx, uiPartUnitIdx, true, true, true); |
---|
4678 | #endif |
---|
4679 | break; |
---|
4680 | } |
---|
4681 | case MD_BELOW_LEFT: |
---|
4682 | { |
---|
4683 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
4684 | pcTmpCU = getPUBelowLeft(uiIdx, uiPartUnitIdx, true, false); |
---|
4685 | #else |
---|
4686 | pcTmpCU = getPUBelowLeft(uiIdx, uiPartUnitIdx); |
---|
4687 | #endif |
---|
4688 | break; |
---|
4689 | } |
---|
4690 | case MD_ABOVE_LEFT: |
---|
4691 | { |
---|
4692 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
4693 | pcTmpCU = getPUAboveLeft(uiIdx, uiPartUnitIdx, true, false, true); |
---|
4694 | #else |
---|
4695 | pcTmpCU = getPUAboveLeft(uiIdx, uiPartUnitIdx, true, true, true); |
---|
4696 | #endif |
---|
4697 | break; |
---|
4698 | } |
---|
4699 | default: |
---|
4700 | { |
---|
4701 | break; |
---|
4702 | } |
---|
4703 | } |
---|
4704 | |
---|
4705 | if ( pcTmpCU == NULL ) |
---|
4706 | { |
---|
4707 | return false; |
---|
4708 | } |
---|
4709 | |
---|
4710 | RefPicList eRefPicList2nd = REF_PIC_LIST_0; |
---|
4711 | if( eRefPicList == REF_PIC_LIST_0 ) |
---|
4712 | { |
---|
4713 | eRefPicList2nd = REF_PIC_LIST_1; |
---|
4714 | } |
---|
4715 | else if ( eRefPicList == REF_PIC_LIST_1) |
---|
4716 | { |
---|
4717 | eRefPicList2nd = REF_PIC_LIST_0; |
---|
4718 | } |
---|
4719 | |
---|
4720 | Int iCurrPOC = m_pcSlice->getPOC(); |
---|
4721 | Int iCurrRefPOC = m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getPOC(); |
---|
4722 | Int iNeibPOC = iCurrPOC; |
---|
4723 | Int iNeibRefPOC; |
---|
4724 | |
---|
4725 | //--------------- V1 (END) ------------------// |
---|
4726 | if( pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) >= 0) |
---|
4727 | { |
---|
4728 | iNeibRefPOC = pcTmpCU->getSlice()->getRefPOC( eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ); |
---|
4729 | TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); |
---|
4730 | TComMv rcMv; |
---|
4731 | |
---|
4732 | if( pcTmpCU->getSlice()->getRefViewId( eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ) != m_pcSlice->getRefViewId( eRefPicList, iRefIdx ) ) |
---|
4733 | { |
---|
4734 | return false; |
---|
4735 | } |
---|
4736 | |
---|
4737 | Int iScale = xGetDistScaleFactor( iCurrPOC, iCurrRefPOC, iNeibPOC, iNeibRefPOC ); |
---|
4738 | if ( iScale == 4096 ) |
---|
4739 | { |
---|
4740 | rcMv = cMvPred; |
---|
4741 | } |
---|
4742 | else |
---|
4743 | { |
---|
4744 | rcMv = cMvPred.scaleMv( iScale ); |
---|
4745 | } |
---|
4746 | pInfo->m_acMvCand[ pInfo->iN++] = rcMv; |
---|
4747 | return true; |
---|
4748 | } |
---|
4749 | //---------------------- V2(END) --------------------// |
---|
4750 | if( pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) >= 0) |
---|
4751 | { |
---|
4752 | iNeibRefPOC = pcTmpCU->getSlice()->getRefPOC( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) ); |
---|
4753 | TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList2nd)->getMv(uiIdx); |
---|
4754 | TComMv rcMv; |
---|
4755 | |
---|
4756 | if( pcTmpCU->getSlice()->getRefViewId( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) ) != m_pcSlice->getRefViewId( eRefPicList, iRefIdx ) ) |
---|
4757 | { |
---|
4758 | return false; |
---|
4759 | } |
---|
4760 | |
---|
4761 | Int iScale = xGetDistScaleFactor( iCurrPOC, iCurrRefPOC, iNeibPOC, iNeibRefPOC ); |
---|
4762 | if ( iScale == 4096 ) |
---|
4763 | { |
---|
4764 | rcMv = cMvPred; |
---|
4765 | } |
---|
4766 | else |
---|
4767 | { |
---|
4768 | rcMv = cMvPred.scaleMv( iScale ); |
---|
4769 | } |
---|
4770 | pInfo->m_acMvCand[ pInfo->iN++] = rcMv; |
---|
4771 | return true; |
---|
4772 | } |
---|
4773 | //---------------------- V3(END) --------------------// |
---|
4774 | return false; |
---|
4775 | } |
---|
4776 | |
---|
4777 | /** |
---|
4778 | * \param eRefPicList |
---|
4779 | * \param uiCUAddr |
---|
4780 | * \param uiPartUnitIdx |
---|
4781 | * \param riRefIdx |
---|
4782 | * \returns Bool |
---|
4783 | */ |
---|
4784 | Bool TComDataCU::xGetColMVP( RefPicList eRefPicList, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx ) |
---|
4785 | { |
---|
4786 | UInt uiAbsPartAddr = uiPartUnitIdx; |
---|
4787 | |
---|
4788 | RefPicList eColRefPicList; |
---|
4789 | Int iColPOC, iColRefPOC, iCurrPOC, iCurrRefPOC, iScale; |
---|
4790 | #if SONY_COLPIC_AVAILABILITY |
---|
4791 | Int iColViewOrderIdx, iColRefViewOrderIdx, iCurrViewOrderIdx, iCurrRefViewOrderIdx; |
---|
4792 | #endif |
---|
4793 | TComMv cColMv; |
---|
4794 | |
---|
4795 | #if SONY_COLPIC_AVAILABILITY |
---|
4796 | iCurrViewOrderIdx = m_pcSlice->getViewOrderIdx(); |
---|
4797 | iCurrRefViewOrderIdx = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getViewOrderIdx(); |
---|
4798 | #endif |
---|
4799 | // use coldir. |
---|
4800 | #if COLLOCATED_REF_IDX |
---|
4801 | TComPic *pColPic = getSlice()->getRefPic( RefPicList(getSlice()->isInterB() ? getSlice()->getColDir() : 0), getSlice()->getColRefIdx()); |
---|
4802 | #else |
---|
4803 | TComPic *pColPic = getSlice()->getRefPic( RefPicList(getSlice()->isInterB() ? getSlice()->getColDir() : 0), 0); |
---|
4804 | #endif |
---|
4805 | TComDataCU *pColCU = pColPic->getCU( uiCUAddr ); |
---|
4806 | if(pColCU->getPic()==0||pColCU->getPartitionSize(uiPartUnitIdx)==SIZE_NONE) |
---|
4807 | { |
---|
4808 | return false; |
---|
4809 | } |
---|
4810 | iCurrPOC = m_pcSlice->getPOC(); |
---|
4811 | iCurrRefPOC = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getPOC(); |
---|
4812 | iColPOC = pColCU->getSlice()->getPOC(); |
---|
4813 | #if SONY_COLPIC_AVAILABILITY |
---|
4814 | iColViewOrderIdx = pColCU->getSlice()->getViewOrderIdx(); |
---|
4815 | #endif |
---|
4816 | |
---|
4817 | if (pColCU->isIntra(uiAbsPartAddr)) |
---|
4818 | { |
---|
4819 | return false; |
---|
4820 | } |
---|
4821 | |
---|
4822 | #if !SONY_COLPIC_AVAILABILITY |
---|
4823 | if( m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getViewId() != m_pcSlice->getViewId() ) |
---|
4824 | return false; |
---|
4825 | #endif |
---|
4826 | |
---|
4827 | if ( !pColPic->getUsedForTMVP() ) |
---|
4828 | { |
---|
4829 | return false; |
---|
4830 | } |
---|
4831 | |
---|
4832 | eColRefPicList = getSlice()->getCheckLDC() ? eRefPicList : RefPicList(1-getSlice()->getColDir()); |
---|
4833 | |
---|
4834 | Int iColRefIdx = pColCU->getCUMvField(RefPicList(eColRefPicList))->getRefIdx(uiAbsPartAddr); |
---|
4835 | |
---|
4836 | if (iColRefIdx < 0 ) |
---|
4837 | { |
---|
4838 | eColRefPicList = RefPicList(1 - eColRefPicList); |
---|
4839 | iColRefIdx = pColCU->getCUMvField(RefPicList(eColRefPicList))->getRefIdx(uiAbsPartAddr); |
---|
4840 | |
---|
4841 | if (iColRefIdx < 0 ) |
---|
4842 | { |
---|
4843 | return false; |
---|
4844 | } |
---|
4845 | } |
---|
4846 | |
---|
4847 | // Scale the vector. |
---|
4848 | iColRefPOC = pColCU->getSlice()->getRefPOC(eColRefPicList, iColRefIdx); |
---|
4849 | |
---|
4850 | #if SONY_COLPIC_AVAILABILITY |
---|
4851 | iColRefViewOrderIdx = pColCU->getSlice()->getRefPic( eColRefPicList, pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiAbsPartAddr))->getViewOrderIdx(); |
---|
4852 | #else |
---|
4853 | if( pColCU->getSlice()->getRefViewId( eColRefPicList, iColRefIdx ) != m_pcSlice->getRefPic( eRefPicList, riRefIdx )->getViewId() ) |
---|
4854 | { |
---|
4855 | return false; |
---|
4856 | } |
---|
4857 | #endif |
---|
4858 | |
---|
4859 | cColMv = pColCU->getCUMvField(eColRefPicList)->getMv(uiAbsPartAddr); |
---|
4860 | |
---|
4861 | iCurrRefPOC = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getPOC(); |
---|
4862 | #if SONY_COLPIC_AVAILABILITY |
---|
4863 | iScale = 0; |
---|
4864 | iCurrRefViewOrderIdx = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getViewOrderIdx(); |
---|
4865 | if((iColPOC != iColRefPOC)&&(iCurrPOC != iCurrRefPOC)) |
---|
4866 | iScale = xGetDistScaleFactor(iCurrPOC, iCurrRefPOC, iColPOC, iColRefPOC); |
---|
4867 | else if((iColPOC == iColRefPOC)&&(iCurrPOC == iCurrRefPOC)) |
---|
4868 | iScale = xGetDistScaleFactor(iCurrViewOrderIdx, iCurrRefViewOrderIdx, iColViewOrderIdx, iColRefViewOrderIdx); |
---|
4869 | #else |
---|
4870 | iScale = xGetDistScaleFactor(iCurrPOC, iCurrRefPOC, iColPOC, iColRefPOC); |
---|
4871 | #endif |
---|
4872 | if ( iScale == 4096 ) |
---|
4873 | { |
---|
4874 | rcMv = cColMv; |
---|
4875 | } |
---|
4876 | else |
---|
4877 | { |
---|
4878 | rcMv = cColMv.scaleMv( iScale ); |
---|
4879 | } |
---|
4880 | |
---|
4881 | return true; |
---|
4882 | } |
---|
4883 | |
---|
4884 | UInt TComDataCU::xGetMvdBits(TComMv cMvd) |
---|
4885 | { |
---|
4886 | return ( xGetComponentBits(cMvd.getHor()) + xGetComponentBits(cMvd.getVer()) ); |
---|
4887 | } |
---|
4888 | |
---|
4889 | UInt TComDataCU::xGetComponentBits(Int iVal) |
---|
4890 | { |
---|
4891 | UInt uiLength = 1; |
---|
4892 | UInt uiTemp = ( iVal <= 0) ? (-iVal<<1)+1: (iVal<<1); |
---|
4893 | |
---|
4894 | assert ( uiTemp ); |
---|
4895 | |
---|
4896 | while ( 1 != uiTemp ) |
---|
4897 | { |
---|
4898 | uiTemp >>= 1; |
---|
4899 | uiLength += 2; |
---|
4900 | } |
---|
4901 | |
---|
4902 | return uiLength; |
---|
4903 | } |
---|
4904 | |
---|
4905 | |
---|
4906 | Int TComDataCU::xGetDistScaleFactor(Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC) |
---|
4907 | { |
---|
4908 | Int iDiffPocD = iColPOC - iColRefPOC; |
---|
4909 | Int iDiffPocB = iCurrPOC - iCurrRefPOC; |
---|
4910 | |
---|
4911 | if( iDiffPocD == iDiffPocB ) |
---|
4912 | { |
---|
4913 | return 4096; |
---|
4914 | } |
---|
4915 | else |
---|
4916 | { |
---|
4917 | Int iTDB = Clip3( -128, 127, iDiffPocB ); |
---|
4918 | Int iTDD = Clip3( -128, 127, iDiffPocD ); |
---|
4919 | Int iX = (0x4000 + abs(iTDD/2)) / iTDD; |
---|
4920 | Int iScale = Clip3( -4096, 4095, (iTDB * iX + 32) >> 6 ); |
---|
4921 | return iScale; |
---|
4922 | } |
---|
4923 | } |
---|
4924 | |
---|
4925 | /** |
---|
4926 | * \param eCUMode |
---|
4927 | * \param uiPartIdx |
---|
4928 | * \param ruiPartIdxCenter |
---|
4929 | * \returns Void |
---|
4930 | */ |
---|
4931 | Void TComDataCU::xDeriveCenterIdx( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxCenter ) |
---|
4932 | { |
---|
4933 | UInt uiPartAddr; |
---|
4934 | Int iPartWidth; |
---|
4935 | Int iPartHeight; |
---|
4936 | getPartIndexAndSize( uiPartIdx, uiPartAddr, iPartWidth, iPartHeight); |
---|
4937 | |
---|
4938 | ruiPartIdxCenter = m_uiAbsIdxInLCU+uiPartAddr; // partition origin. |
---|
4939 | ruiPartIdxCenter = g_auiRasterToZscan[ g_auiZscanToRaster[ ruiPartIdxCenter ] |
---|
4940 | + ( iPartHeight/m_pcPic->getMinCUHeight() )/2*m_pcPic->getNumPartInWidth() |
---|
4941 | + ( iPartWidth/m_pcPic->getMinCUWidth() )/2]; |
---|
4942 | } |
---|
4943 | |
---|
4944 | /** |
---|
4945 | * \param uiPartIdx |
---|
4946 | * \param eRefPicList |
---|
4947 | * \param iRefIdx |
---|
4948 | * \param pcMv |
---|
4949 | * \returns Bool |
---|
4950 | */ |
---|
4951 | Bool TComDataCU::xGetCenterCol( UInt uiPartIdx, RefPicList eRefPicList, int iRefIdx, TComMv *pcMv ) |
---|
4952 | { |
---|
4953 | PartSize eCUMode = getPartitionSize( 0 ); |
---|
4954 | |
---|
4955 | Int iCurrPOC = m_pcSlice->getPOC(); |
---|
4956 | |
---|
4957 | // use coldir. |
---|
4958 | #if COLLOCATED_REF_IDX |
---|
4959 | TComPic *pColPic = getSlice()->getRefPic( RefPicList(getSlice()->isInterB() ? getSlice()->getColDir() : 0), getSlice()->getColRefIdx()); |
---|
4960 | #else |
---|
4961 | TComPic *pColPic = getSlice()->getRefPic( RefPicList(getSlice()->isInterB() ? getSlice()->getColDir() : 0), 0); |
---|
4962 | #endif |
---|
4963 | TComDataCU *pColCU = pColPic->getCU( m_uiCUAddr ); |
---|
4964 | |
---|
4965 | Int iColPOC = pColCU->getSlice()->getPOC(); |
---|
4966 | UInt uiPartIdxCenter; |
---|
4967 | xDeriveCenterIdx( eCUMode, uiPartIdx, uiPartIdxCenter ); |
---|
4968 | |
---|
4969 | if (pColCU->isIntra(uiPartIdxCenter)) |
---|
4970 | { |
---|
4971 | return false; |
---|
4972 | } |
---|
4973 | |
---|
4974 | if( m_pcSlice->getRefPic( eRefPicList, iRefIdx )->getViewId() != m_pcSlice->getViewId() ) |
---|
4975 | { |
---|
4976 | return false; |
---|
4977 | } |
---|
4978 | |
---|
4979 | // Prefer a vector crossing us. Prefer shortest. |
---|
4980 | RefPicList eColRefPicList = REF_PIC_LIST_0; |
---|
4981 | bool bFirstCrosses = false; |
---|
4982 | Int iFirstColDist = -1; |
---|
4983 | for (Int l = 0; l < 2; l++) |
---|
4984 | { |
---|
4985 | bool bSaveIt = false; |
---|
4986 | int iColRefIdx = pColCU->getCUMvField(RefPicList(l))->getRefIdx(uiPartIdxCenter); |
---|
4987 | if (iColRefIdx < 0) |
---|
4988 | { |
---|
4989 | continue; |
---|
4990 | } |
---|
4991 | int iColRefPOC = pColCU->getSlice()->getRefPOC(RefPicList(l), iColRefIdx); |
---|
4992 | if( pColCU->getSlice()->getRefViewId( RefPicList(l), iColRefIdx ) != pColCU->getSlice()->getViewId() ) |
---|
4993 | { |
---|
4994 | continue; |
---|
4995 | } |
---|
4996 | int iColDist = abs(iColRefPOC - iColPOC); |
---|
4997 | bool bCrosses = iColPOC < iCurrPOC ? iColRefPOC > iCurrPOC : iColRefPOC < iCurrPOC; |
---|
4998 | if (iFirstColDist < 0) |
---|
4999 | { |
---|
5000 | bSaveIt = true; |
---|
5001 | } |
---|
5002 | else if (bCrosses && !bFirstCrosses) |
---|
5003 | { |
---|
5004 | bSaveIt = true; |
---|
5005 | } |
---|
5006 | else if (bCrosses == bFirstCrosses && l == eRefPicList) |
---|
5007 | { |
---|
5008 | bSaveIt = true; |
---|
5009 | } |
---|
5010 | |
---|
5011 | if (bSaveIt) |
---|
5012 | { |
---|
5013 | bFirstCrosses = bCrosses; |
---|
5014 | iFirstColDist = iColDist; |
---|
5015 | eColRefPicList = RefPicList(l); |
---|
5016 | } |
---|
5017 | } |
---|
5018 | |
---|
5019 | // Scale the vector. |
---|
5020 | Int iColRefPOC = pColCU->getSlice()->getRefPOC(eColRefPicList, pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiPartIdxCenter)); |
---|
5021 | TComMv cColMv = pColCU->getCUMvField(eColRefPicList)->getMv(uiPartIdxCenter); |
---|
5022 | |
---|
5023 | Int iCurrRefPOC = m_pcSlice->getRefPic(eRefPicList, iRefIdx)->getPOC(); |
---|
5024 | Int iScale = xGetDistScaleFactor(iCurrPOC, iCurrRefPOC, iColPOC, iColRefPOC); |
---|
5025 | if ( iScale == 4096 ) |
---|
5026 | { |
---|
5027 | pcMv[0] = cColMv; |
---|
5028 | } |
---|
5029 | else |
---|
5030 | { |
---|
5031 | pcMv[0] = cColMv.scaleMv( iScale ); |
---|
5032 | } |
---|
5033 | |
---|
5034 | return true; |
---|
5035 | } |
---|
5036 | |
---|
5037 | Void TComDataCU::compressMV() |
---|
5038 | { |
---|
5039 | Int scaleFactor = 4 * AMVP_DECIMATION_FACTOR / m_unitSize; |
---|
5040 | if (scaleFactor > 0) |
---|
5041 | { |
---|
5042 | #if HHI_MPI |
---|
5043 | m_acCUMvField[0].compress(m_pePredMode, m_puhInterDir, scaleFactor); |
---|
5044 | m_acCUMvField[1].compress(m_pePredMode, m_puhInterDir, scaleFactor); |
---|
5045 | #else |
---|
5046 | m_acCUMvField[0].compress(m_pePredMode, scaleFactor); |
---|
5047 | m_acCUMvField[1].compress(m_pePredMode, scaleFactor); |
---|
5048 | #endif |
---|
5049 | } |
---|
5050 | } |
---|
5051 | |
---|
5052 | UInt TComDataCU::getCoefScanIdx(UInt uiAbsPartIdx, UInt uiWidth, Bool bIsLuma, Bool bIsIntra) |
---|
5053 | { |
---|
5054 | #if !LOGI_INTRA_NAME_3MPM |
---|
5055 | static const UChar aucIntraDirToScanIdx[MAX_CU_DEPTH][NUM_INTRA_MODE] = |
---|
5056 | { |
---|
5057 | {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 |
---|
5058 | }, |
---|
5059 | {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 |
---|
5060 | }, |
---|
5061 | {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 |
---|
5062 | }, |
---|
5063 | {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 |
---|
5064 | }, |
---|
5065 | {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 |
---|
5066 | }, |
---|
5067 | {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 |
---|
5068 | }, |
---|
5069 | {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 |
---|
5070 | }, |
---|
5071 | }; |
---|
5072 | #endif |
---|
5073 | |
---|
5074 | UInt uiCTXIdx; |
---|
5075 | UInt uiScanIdx; |
---|
5076 | UInt uiDirMode; |
---|
5077 | |
---|
5078 | if ( !bIsIntra ) |
---|
5079 | { |
---|
5080 | uiScanIdx = SCAN_ZIGZAG; |
---|
5081 | return uiScanIdx; |
---|
5082 | } |
---|
5083 | |
---|
5084 | switch(uiWidth) |
---|
5085 | { |
---|
5086 | case 2: uiCTXIdx = 6; break; |
---|
5087 | case 4: uiCTXIdx = 5; break; |
---|
5088 | case 8: uiCTXIdx = 4; break; |
---|
5089 | case 16: uiCTXIdx = 3; break; |
---|
5090 | case 32: uiCTXIdx = 2; break; |
---|
5091 | case 64: uiCTXIdx = 1; break; |
---|
5092 | default: uiCTXIdx = 0; break; |
---|
5093 | } |
---|
5094 | |
---|
5095 | if ( bIsLuma ) |
---|
5096 | { |
---|
5097 | uiDirMode = getLumaIntraDir(uiAbsPartIdx); |
---|
5098 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
5099 | mapDMMtoIntraMode( uiDirMode ); |
---|
5100 | #endif |
---|
5101 | |
---|
5102 | #if LOGI_INTRA_NAME_3MPM |
---|
5103 | uiScanIdx = SCAN_ZIGZAG; |
---|
5104 | if (uiCTXIdx >3 && uiCTXIdx < 6) //if multiple scans supported for PU size |
---|
5105 | { |
---|
5106 | uiScanIdx = abs((Int) uiDirMode - VER_IDX) < 5 ? 1 : (abs((Int)uiDirMode - HOR_IDX) < 5 ? 2 : 0); |
---|
5107 | } |
---|
5108 | #else |
---|
5109 | uiScanIdx = aucIntraDirToScanIdx[uiCTXIdx][uiDirMode]; |
---|
5110 | #endif |
---|
5111 | } |
---|
5112 | else |
---|
5113 | { |
---|
5114 | uiDirMode = getChromaIntraDir(uiAbsPartIdx); |
---|
5115 | if( uiDirMode == DM_CHROMA_IDX ) |
---|
5116 | { |
---|
5117 | // get number of partitions in current CU |
---|
5118 | UInt depth = getDepth(uiAbsPartIdx); |
---|
5119 | UInt numParts = getPic()->getNumPartInCU() >> (2 * depth); |
---|
5120 | |
---|
5121 | // get luma mode from upper-left corner of current CU |
---|
5122 | uiDirMode = getLumaIntraDir((uiAbsPartIdx/numParts)*numParts); |
---|
5123 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
5124 | mapDMMtoIntraMode( uiDirMode ); |
---|
5125 | #endif |
---|
5126 | } |
---|
5127 | #if LOGI_INTRA_NAME_3MPM |
---|
5128 | uiScanIdx = SCAN_ZIGZAG; |
---|
5129 | if (uiCTXIdx >4 && uiCTXIdx < 7) //if multiple scans supported for PU size |
---|
5130 | { |
---|
5131 | uiScanIdx = abs((Int) uiDirMode - VER_IDX) < 5 ? 1 : (abs((Int)uiDirMode - HOR_IDX) < 5 ? 2 : 0); |
---|
5132 | } |
---|
5133 | #else |
---|
5134 | uiScanIdx = aucIntraDirToScanIdx[max<Int>(uiCTXIdx-1,0)][uiDirMode]; |
---|
5135 | #endif |
---|
5136 | } |
---|
5137 | |
---|
5138 | return uiScanIdx; |
---|
5139 | } |
---|
5140 | |
---|
5141 | Bool TComDataCU::useNonSquareTrans(UInt uiTrMode, Int absPartIdx) |
---|
5142 | { |
---|
5143 | UInt minTuSize = ( 1 << ( getSlice()->getSPS()->getQuadtreeTULog2MinSize() + 1 ) ); |
---|
5144 | const UInt uiLog2TrSize = g_aucConvertToBit[ getSlice()->getSPS()->getMaxCUWidth() >> ( m_puhDepth[ absPartIdx ] + uiTrMode ) ] + 2; |
---|
5145 | if ( uiTrMode && uiLog2TrSize < getSlice()->getSPS()->getQuadtreeTULog2MaxSize() && ( getWidth( absPartIdx ) > minTuSize ) && |
---|
5146 | ( m_pePartSize[absPartIdx] == SIZE_Nx2N || m_pePartSize[absPartIdx] == SIZE_2NxN || ( m_pePartSize[absPartIdx] >= SIZE_2NxnU && m_pePartSize[absPartIdx] <= SIZE_nRx2N ) ) ) |
---|
5147 | { |
---|
5148 | return getSlice()->getSPS()->getUseNSQT(); |
---|
5149 | } |
---|
5150 | else |
---|
5151 | { |
---|
5152 | return false; |
---|
5153 | } |
---|
5154 | } |
---|
5155 | |
---|
5156 | Void TComDataCU::getNSQTSize(Int trMode, Int absPartIdx, Int &trWidth, Int &trHeight) |
---|
5157 | { |
---|
5158 | UInt minTuSize = ( 1 << getSlice()->getSPS()->getQuadtreeTULog2MinSize() ); |
---|
5159 | if ( useNonSquareTrans( trMode, absPartIdx ) && ( trWidth > minTuSize ) ) |
---|
5160 | { |
---|
5161 | trWidth = ( m_pePartSize[absPartIdx] == SIZE_Nx2N || m_pePartSize[absPartIdx] == SIZE_nLx2N || m_pePartSize[absPartIdx] == SIZE_nRx2N )? trWidth >> 1 : trWidth << 1; |
---|
5162 | trHeight = ( m_pePartSize[absPartIdx] == SIZE_Nx2N || m_pePartSize[absPartIdx] == SIZE_nLx2N || m_pePartSize[absPartIdx] == SIZE_nRx2N )? trHeight << 1 : trHeight >> 1; |
---|
5163 | } |
---|
5164 | } |
---|
5165 | Bool TComDataCU::useNonSquarePU(UInt absPartIdx) |
---|
5166 | { |
---|
5167 | if ( ( m_pePartSize[absPartIdx] == SIZE_Nx2N ) || ( m_pePartSize[absPartIdx] == SIZE_2NxN ) || ( m_pePartSize[absPartIdx] >= SIZE_2NxnU && m_pePartSize[absPartIdx] <= SIZE_nRx2N ) ) |
---|
5168 | { |
---|
5169 | return true; |
---|
5170 | } |
---|
5171 | else |
---|
5172 | { |
---|
5173 | return false; |
---|
5174 | } |
---|
5175 | } |
---|
5176 | |
---|
5177 | UInt TComDataCU::getInterTUSplitDirection( Int trWidth, Int trHeight, Int trLastWidth, Int trLastHeight ) |
---|
5178 | { |
---|
5179 | UInt interTUSplitDirection = 2; |
---|
5180 | if ( ( trWidth == trLastWidth ) && ( trHeight < trLastHeight ) ) |
---|
5181 | { |
---|
5182 | interTUSplitDirection = 0; |
---|
5183 | } |
---|
5184 | else if ( ( trWidth < trLastWidth ) && ( trHeight == trLastHeight ) ) |
---|
5185 | { |
---|
5186 | interTUSplitDirection = 1; |
---|
5187 | } |
---|
5188 | |
---|
5189 | return interTUSplitDirection; |
---|
5190 | } |
---|
5191 | |
---|
5192 | UInt TComDataCU::getNSAbsPartIdx ( UInt log2TrafoSize, UInt absPartIdx, UInt absTUPartIdx, UInt innerQuadIdx, UInt trMode ) |
---|
5193 | { |
---|
5194 | Int trWidth, trHeight, trLastWidth, trLastHeight; |
---|
5195 | UInt lcuWidthInBaseUnits = getPic()->getNumPartInWidth(); |
---|
5196 | UInt nsTUWidthInBaseUnits, nsTUHeightInBaseUnits; |
---|
5197 | UInt interTUSplitDirection; |
---|
5198 | |
---|
5199 | if( isIntra(absPartIdx) ) |
---|
5200 | { |
---|
5201 | return absPartIdx; |
---|
5202 | } |
---|
5203 | |
---|
5204 | trWidth = trHeight = ( 1 << log2TrafoSize ); |
---|
5205 | trLastWidth = trWidth << 1, trLastHeight = trHeight << 1; |
---|
5206 | |
---|
5207 | getNSQTSize( trMode, absPartIdx, trWidth, trHeight ); |
---|
5208 | getNSQTSize( trMode - 1, absPartIdx, trLastWidth, trLastHeight ); |
---|
5209 | interTUSplitDirection = getInterTUSplitDirection ( trWidth, trHeight, trLastWidth, trLastHeight ); |
---|
5210 | |
---|
5211 | nsTUWidthInBaseUnits = trWidth / getPic()->getMinCUWidth(); |
---|
5212 | nsTUHeightInBaseUnits = trHeight / getPic()->getMinCUHeight(); |
---|
5213 | |
---|
5214 | if ( interTUSplitDirection != 2 ) |
---|
5215 | { |
---|
5216 | UInt uiNSTUBaseUnits = nsTUWidthInBaseUnits < nsTUHeightInBaseUnits ? nsTUWidthInBaseUnits : nsTUHeightInBaseUnits; |
---|
5217 | absTUPartIdx = g_auiRasterToZscan[ g_auiZscanToRaster[absTUPartIdx] + innerQuadIdx * uiNSTUBaseUnits * lcuWidthInBaseUnits * ( 1 - interTUSplitDirection ) + innerQuadIdx * uiNSTUBaseUnits * interTUSplitDirection ]; |
---|
5218 | } |
---|
5219 | else |
---|
5220 | { |
---|
5221 | absTUPartIdx = g_auiRasterToZscan[ g_auiZscanToRaster[absTUPartIdx] + (innerQuadIdx & 0x01) * nsTUWidthInBaseUnits + ( ( innerQuadIdx >> 1 ) & 0x01 ) * nsTUHeightInBaseUnits * lcuWidthInBaseUnits ]; |
---|
5222 | } |
---|
5223 | |
---|
5224 | return absTUPartIdx; |
---|
5225 | } |
---|
5226 | |
---|
5227 | UInt TComDataCU::getNSAddrChroma( UInt uiLog2TrSizeC, UInt uiTrModeC, UInt uiQuadrant, UInt absTUPartIdx ) |
---|
5228 | { |
---|
5229 | if( uiLog2TrSizeC != getSlice()->getSPS()->getQuadtreeTULog2MinSize() ) |
---|
5230 | { |
---|
5231 | return absTUPartIdx; |
---|
5232 | } |
---|
5233 | |
---|
5234 | UInt lcuWidthInBaseUnits = getPic()->getNumPartInWidth(); |
---|
5235 | Int trWidth = ( 1 << ( uiLog2TrSizeC + 1 ) ); |
---|
5236 | Int trHeight = ( 1 << ( uiLog2TrSizeC + 1 ) ); |
---|
5237 | Int trLastWidth = trWidth << 1, trLastHeight = trHeight << 1; |
---|
5238 | |
---|
5239 | getNSQTSize ( uiTrModeC - 1, absTUPartIdx, trLastWidth, trLastHeight ); |
---|
5240 | getNSQTSize ( uiTrModeC, absTUPartIdx, trWidth, trHeight ); |
---|
5241 | |
---|
5242 | UInt interTUSplitDirection = getInterTUSplitDirection ( trWidth, trHeight, trLastWidth, trLastHeight ); |
---|
5243 | UInt nsTUWidthInBaseUnits = trWidth / getPic()->getMinCUWidth(); |
---|
5244 | UInt nsTUHeightInBaseUnits = trHeight / getPic()->getMinCUHeight(); |
---|
5245 | UInt firstTURasterIdx = 0, absTUPartIdxC = 0; |
---|
5246 | |
---|
5247 | if(interTUSplitDirection != 2) |
---|
5248 | { |
---|
5249 | UInt uiNSTUBaseUnits = nsTUWidthInBaseUnits < nsTUHeightInBaseUnits ? 1 : lcuWidthInBaseUnits; |
---|
5250 | firstTURasterIdx = g_auiZscanToRaster[absTUPartIdx] - uiQuadrant * uiNSTUBaseUnits; |
---|
5251 | absTUPartIdxC = g_auiRasterToZscan[firstTURasterIdx] + uiQuadrant * nsTUWidthInBaseUnits * nsTUHeightInBaseUnits; |
---|
5252 | } |
---|
5253 | else |
---|
5254 | { |
---|
5255 | UInt uiNSTUBaseUnits = nsTUWidthInBaseUnits < nsTUHeightInBaseUnits ? 2 * lcuWidthInBaseUnits : 2; |
---|
5256 | firstTURasterIdx = g_auiZscanToRaster[absTUPartIdx] - ( ( uiQuadrant >> 1 ) & 0x01 ) * nsTUHeightInBaseUnits * lcuWidthInBaseUnits - ( uiQuadrant & 0x01 ) * nsTUWidthInBaseUnits; |
---|
5257 | absTUPartIdxC = g_auiRasterToZscan[firstTURasterIdx + uiQuadrant * uiNSTUBaseUnits]; |
---|
5258 | } |
---|
5259 | |
---|
5260 | return absTUPartIdxC; |
---|
5261 | } |
---|
5262 | |
---|
5263 | |
---|
5264 | UInt TComDataCU::getSCUAddr() |
---|
5265 | { |
---|
5266 | return getPic()->getPicSym()->getInverseCUOrderMap(m_uiCUAddr)*(1<<(m_pcSlice->getSPS()->getMaxCUDepth()<<1))+m_uiAbsIdxInLCU; |
---|
5267 | } |
---|
5268 | |
---|
5269 | /** Set neighboring blocks availabilities for non-deblocked filtering |
---|
5270 | * \param numLCUInPicWidth number of LCUs in picture width |
---|
5271 | * \param numLCUInPicHeight number of LCUs in picture height |
---|
5272 | * \param numSUInLCUWidth number of SUs in LCU width |
---|
5273 | * \param numSUInLCUHeight number of SUs in LCU height |
---|
5274 | * \param picWidth picture width |
---|
5275 | * \param picHeight picture height |
---|
5276 | * \param bIndependentSliceBoundaryEnabled true for independent slice boundary enabled |
---|
5277 | * \param bTopTileBoundary true means that top boundary coincides tile boundary |
---|
5278 | * \param bDownTileBoundary true means that bottom boundary coincides tile boundary |
---|
5279 | * \param bLeftTileBoundary true means that left boundary coincides tile boundary |
---|
5280 | * \param bRightTileBoundary true means that right boundary coincides tile boundary |
---|
5281 | * \param bIndependentTileBoundaryEnabled true for independent tile boundary enabled |
---|
5282 | */ |
---|
5283 | Void TComDataCU::setNDBFilterBlockBorderAvailability(UInt numLCUInPicWidth, UInt numLCUInPicHeight, UInt numSUInLCUWidth, UInt numSUInLCUHeight, UInt picWidth, UInt picHeight |
---|
5284 | ,Bool bIndependentSliceBoundaryEnabled |
---|
5285 | ,Bool bTopTileBoundary, Bool bDownTileBoundary, Bool bLeftTileBoundary, Bool bRightTileBoundary |
---|
5286 | ,Bool bIndependentTileBoundaryEnabled) |
---|
5287 | { |
---|
5288 | UInt numSUInLCU = numSUInLCUWidth*numSUInLCUHeight; |
---|
5289 | Int* pSliceIDMapLCU = m_piSliceSUMap; |
---|
5290 | |
---|
5291 | UInt uiLPelX, uiTPelY; |
---|
5292 | UInt width, height; |
---|
5293 | Bool bPicRBoundary, bPicBBoundary, bPicTBoundary, bPicLBoundary; |
---|
5294 | Bool bLCURBoundary= false, bLCUBBoundary= false, bLCUTBoundary= false, bLCULBoundary= false; |
---|
5295 | Bool* pbAvailBorder; |
---|
5296 | Bool* pbAvail; |
---|
5297 | UInt rTLSU, rBRSU, widthSU, heightSU; |
---|
5298 | UInt zRefSU; |
---|
5299 | Int* pRefID; |
---|
5300 | Int* pRefMapLCU; |
---|
5301 | UInt rTRefSU= 0, rBRefSU= 0, rLRefSU= 0, rRRefSU= 0; |
---|
5302 | Int* pRRefMapLCU= NULL; |
---|
5303 | Int* pLRefMapLCU= NULL; |
---|
5304 | Int* pTRefMapLCU= NULL; |
---|
5305 | Int* pBRefMapLCU= NULL; |
---|
5306 | Int sliceID; |
---|
5307 | UInt numSGU = (UInt)m_vNDFBlock.size(); |
---|
5308 | |
---|
5309 | for(Int i=0; i< numSGU; i++) |
---|
5310 | { |
---|
5311 | NDBFBlockInfo& rSGU = m_vNDFBlock[i]; |
---|
5312 | |
---|
5313 | sliceID = rSGU.sliceID; |
---|
5314 | uiLPelX = rSGU.posX; |
---|
5315 | uiTPelY = rSGU.posY; |
---|
5316 | width = rSGU.width; |
---|
5317 | height = rSGU.height; |
---|
5318 | |
---|
5319 | rTLSU = g_auiZscanToRaster[ rSGU.startSU ]; |
---|
5320 | rBRSU = g_auiZscanToRaster[ rSGU.endSU ]; |
---|
5321 | widthSU = rSGU.widthSU; |
---|
5322 | heightSU = rSGU.heightSU; |
---|
5323 | |
---|
5324 | pbAvailBorder = rSGU.isBorderAvailable; |
---|
5325 | |
---|
5326 | bPicTBoundary= (uiTPelY == 0 )?(true):(false); |
---|
5327 | bPicLBoundary= (uiLPelX == 0 )?(true):(false); |
---|
5328 | bPicRBoundary= (!(uiLPelX+ width < picWidth ) )?(true):(false); |
---|
5329 | bPicBBoundary= (!(uiTPelY + height < picHeight))?(true):(false); |
---|
5330 | |
---|
5331 | bLCULBoundary = (rTLSU % numSUInLCUWidth == 0)?(true):(false); |
---|
5332 | bLCURBoundary = ( (rTLSU+ widthSU) % numSUInLCUWidth == 0)?(true):(false); |
---|
5333 | bLCUTBoundary = ( (UInt)(rTLSU / numSUInLCUWidth)== 0)?(true):(false); |
---|
5334 | bLCUBBoundary = ( (UInt)(rBRSU / numSUInLCUWidth) == (numSUInLCUHeight-1) )?(true):(false); |
---|
5335 | |
---|
5336 | // SGU_L |
---|
5337 | pbAvail = &(pbAvailBorder[SGU_L]); |
---|
5338 | if(bPicLBoundary) |
---|
5339 | { |
---|
5340 | *pbAvail = false; |
---|
5341 | } |
---|
5342 | else if (!bIndependentSliceBoundaryEnabled) |
---|
5343 | { |
---|
5344 | *pbAvail = true; |
---|
5345 | } |
---|
5346 | else |
---|
5347 | { |
---|
5348 | // bLCULBoundary = (rTLSU % uiNumSUInLCUWidth == 0)?(true):(false); |
---|
5349 | if(bLCULBoundary) |
---|
5350 | { |
---|
5351 | rLRefSU = rTLSU + numSUInLCUWidth -1; |
---|
5352 | zRefSU = g_auiRasterToZscan[rLRefSU]; |
---|
5353 | pRefMapLCU = pLRefMapLCU= (pSliceIDMapLCU - numSUInLCU); |
---|
5354 | } |
---|
5355 | else |
---|
5356 | { |
---|
5357 | zRefSU = g_auiRasterToZscan[rTLSU - 1]; |
---|
5358 | pRefMapLCU = pSliceIDMapLCU; |
---|
5359 | } |
---|
5360 | pRefID = pRefMapLCU + zRefSU; |
---|
5361 | *pbAvail = (*pRefID == sliceID)?(true):(false); |
---|
5362 | } |
---|
5363 | |
---|
5364 | // SGU_R |
---|
5365 | pbAvail = &(pbAvailBorder[SGU_R]); |
---|
5366 | if(bPicRBoundary) |
---|
5367 | { |
---|
5368 | *pbAvail = false; |
---|
5369 | } |
---|
5370 | else if (!bIndependentSliceBoundaryEnabled) |
---|
5371 | { |
---|
5372 | *pbAvail = true; |
---|
5373 | } |
---|
5374 | else |
---|
5375 | { |
---|
5376 | // bLCURBoundary = ( (rTLSU+ uiWidthSU) % uiNumSUInLCUWidth == 0)?(true):(false); |
---|
5377 | if(bLCURBoundary) |
---|
5378 | { |
---|
5379 | rRRefSU = rTLSU + widthSU - numSUInLCUWidth; |
---|
5380 | zRefSU = g_auiRasterToZscan[rRRefSU]; |
---|
5381 | pRefMapLCU = pRRefMapLCU= (pSliceIDMapLCU + numSUInLCU); |
---|
5382 | } |
---|
5383 | else |
---|
5384 | { |
---|
5385 | zRefSU = g_auiRasterToZscan[rTLSU + widthSU]; |
---|
5386 | pRefMapLCU = pSliceIDMapLCU; |
---|
5387 | } |
---|
5388 | pRefID = pRefMapLCU + zRefSU; |
---|
5389 | *pbAvail = (*pRefID == sliceID)?(true):(false); |
---|
5390 | } |
---|
5391 | |
---|
5392 | // SGU_T |
---|
5393 | pbAvail = &(pbAvailBorder[SGU_T]); |
---|
5394 | if(bPicTBoundary) |
---|
5395 | { |
---|
5396 | *pbAvail = false; |
---|
5397 | } |
---|
5398 | else if (!bIndependentSliceBoundaryEnabled) |
---|
5399 | { |
---|
5400 | *pbAvail = true; |
---|
5401 | } |
---|
5402 | else |
---|
5403 | { |
---|
5404 | // bLCUTBoundary = ( (UInt)(rTLSU / uiNumSUInLCUWidth)== 0)?(true):(false); |
---|
5405 | if(bLCUTBoundary) |
---|
5406 | { |
---|
5407 | rTRefSU = numSUInLCU - (numSUInLCUWidth - rTLSU); |
---|
5408 | zRefSU = g_auiRasterToZscan[rTRefSU]; |
---|
5409 | pRefMapLCU = pTRefMapLCU= (pSliceIDMapLCU - (numLCUInPicWidth*numSUInLCU)); |
---|
5410 | } |
---|
5411 | else |
---|
5412 | { |
---|
5413 | zRefSU = g_auiRasterToZscan[rTLSU - numSUInLCUWidth]; |
---|
5414 | pRefMapLCU = pSliceIDMapLCU; |
---|
5415 | } |
---|
5416 | pRefID = pRefMapLCU + zRefSU; |
---|
5417 | *pbAvail = (*pRefID == sliceID)?(true):(false); |
---|
5418 | } |
---|
5419 | |
---|
5420 | // SGU_B |
---|
5421 | pbAvail = &(pbAvailBorder[SGU_B]); |
---|
5422 | if(bPicBBoundary) |
---|
5423 | { |
---|
5424 | *pbAvail = false; |
---|
5425 | } |
---|
5426 | else if (!bIndependentSliceBoundaryEnabled) |
---|
5427 | { |
---|
5428 | *pbAvail = true; |
---|
5429 | } |
---|
5430 | else |
---|
5431 | { |
---|
5432 | // bLCUBBoundary = ( (UInt)(rBRSU / uiNumSUInLCUWidth) == (uiNumSUInLCUHeight-1) )?(true):(false); |
---|
5433 | if(bLCUBBoundary) |
---|
5434 | { |
---|
5435 | rBRefSU = rTLSU % numSUInLCUWidth; |
---|
5436 | zRefSU = g_auiRasterToZscan[rBRefSU]; |
---|
5437 | pRefMapLCU = pBRefMapLCU= (pSliceIDMapLCU + (numLCUInPicWidth*numSUInLCU)); |
---|
5438 | } |
---|
5439 | else |
---|
5440 | { |
---|
5441 | zRefSU = g_auiRasterToZscan[rTLSU + (heightSU*numSUInLCUWidth)]; |
---|
5442 | pRefMapLCU = pSliceIDMapLCU; |
---|
5443 | } |
---|
5444 | pRefID = pRefMapLCU + zRefSU; |
---|
5445 | *pbAvail = (*pRefID == sliceID)?(true):(false); |
---|
5446 | } |
---|
5447 | |
---|
5448 | // SGU_TL |
---|
5449 | pbAvail = &(pbAvailBorder[SGU_TL]); |
---|
5450 | if(bPicTBoundary || bPicLBoundary) |
---|
5451 | { |
---|
5452 | *pbAvail = false; |
---|
5453 | } |
---|
5454 | else if (!bIndependentSliceBoundaryEnabled) |
---|
5455 | { |
---|
5456 | *pbAvail = true; |
---|
5457 | } |
---|
5458 | else |
---|
5459 | { |
---|
5460 | if(bLCUTBoundary && bLCULBoundary) |
---|
5461 | { |
---|
5462 | zRefSU = numSUInLCU -1; |
---|
5463 | pRefMapLCU = pSliceIDMapLCU - ( (numLCUInPicWidth+1)*numSUInLCU); |
---|
5464 | } |
---|
5465 | else if(bLCUTBoundary) |
---|
5466 | { |
---|
5467 | zRefSU = g_auiRasterToZscan[ rTRefSU- 1]; |
---|
5468 | pRefMapLCU = pTRefMapLCU; |
---|
5469 | } |
---|
5470 | else if(bLCULBoundary) |
---|
5471 | { |
---|
5472 | zRefSU = g_auiRasterToZscan[ rLRefSU- numSUInLCUWidth ]; |
---|
5473 | pRefMapLCU = pLRefMapLCU; |
---|
5474 | } |
---|
5475 | else //inside LCU |
---|
5476 | { |
---|
5477 | zRefSU = g_auiRasterToZscan[ rTLSU - numSUInLCUWidth -1]; |
---|
5478 | pRefMapLCU = pSliceIDMapLCU; |
---|
5479 | } |
---|
5480 | pRefID = pRefMapLCU + zRefSU; |
---|
5481 | *pbAvail = (*pRefID == sliceID)?(true):(false); |
---|
5482 | } |
---|
5483 | |
---|
5484 | // SGU_TR |
---|
5485 | pbAvail = &(pbAvailBorder[SGU_TR]); |
---|
5486 | if(bPicTBoundary || bPicRBoundary) |
---|
5487 | { |
---|
5488 | *pbAvail = false; |
---|
5489 | } |
---|
5490 | else if (!bIndependentSliceBoundaryEnabled) |
---|
5491 | { |
---|
5492 | *pbAvail = true; |
---|
5493 | } |
---|
5494 | else |
---|
5495 | { |
---|
5496 | if(bLCUTBoundary && bLCURBoundary) |
---|
5497 | { |
---|
5498 | zRefSU = g_auiRasterToZscan[numSUInLCU - numSUInLCUWidth]; |
---|
5499 | pRefMapLCU = pSliceIDMapLCU - ( (numLCUInPicWidth-1)*numSUInLCU); |
---|
5500 | } |
---|
5501 | else if(bLCUTBoundary) |
---|
5502 | { |
---|
5503 | zRefSU = g_auiRasterToZscan[ rTRefSU+ widthSU]; |
---|
5504 | pRefMapLCU = pTRefMapLCU; |
---|
5505 | } |
---|
5506 | else if(bLCURBoundary) |
---|
5507 | { |
---|
5508 | zRefSU = g_auiRasterToZscan[ rRRefSU- numSUInLCUWidth ]; |
---|
5509 | pRefMapLCU = pRRefMapLCU; |
---|
5510 | } |
---|
5511 | else //inside LCU |
---|
5512 | { |
---|
5513 | zRefSU = g_auiRasterToZscan[ rTLSU - numSUInLCUWidth +widthSU]; |
---|
5514 | pRefMapLCU = pSliceIDMapLCU; |
---|
5515 | } |
---|
5516 | pRefID = pRefMapLCU + zRefSU; |
---|
5517 | *pbAvail = (*pRefID == sliceID)?(true):(false); |
---|
5518 | } |
---|
5519 | |
---|
5520 | // SGU_BL |
---|
5521 | pbAvail = &(pbAvailBorder[SGU_BL]); |
---|
5522 | if(bPicBBoundary || bPicLBoundary) |
---|
5523 | { |
---|
5524 | *pbAvail = false; |
---|
5525 | } |
---|
5526 | else if (!bIndependentSliceBoundaryEnabled) |
---|
5527 | { |
---|
5528 | *pbAvail = true; |
---|
5529 | } |
---|
5530 | else |
---|
5531 | { |
---|
5532 | if(bLCUBBoundary && bLCULBoundary) |
---|
5533 | { |
---|
5534 | zRefSU = g_auiRasterToZscan[numSUInLCUWidth - 1]; |
---|
5535 | pRefMapLCU = pSliceIDMapLCU + ( (numLCUInPicWidth-1)*numSUInLCU); |
---|
5536 | } |
---|
5537 | else if(bLCUBBoundary) |
---|
5538 | { |
---|
5539 | zRefSU = g_auiRasterToZscan[ rBRefSU - 1]; |
---|
5540 | pRefMapLCU = pBRefMapLCU; |
---|
5541 | } |
---|
5542 | else if(bLCULBoundary) |
---|
5543 | { |
---|
5544 | zRefSU = g_auiRasterToZscan[ rLRefSU+ heightSU*numSUInLCUWidth ]; |
---|
5545 | pRefMapLCU = pLRefMapLCU; |
---|
5546 | } |
---|
5547 | else //inside LCU |
---|
5548 | { |
---|
5549 | zRefSU = g_auiRasterToZscan[ rTLSU + heightSU*numSUInLCUWidth -1]; |
---|
5550 | pRefMapLCU = pSliceIDMapLCU; |
---|
5551 | } |
---|
5552 | pRefID = pRefMapLCU + zRefSU; |
---|
5553 | *pbAvail = (*pRefID == sliceID)?(true):(false); |
---|
5554 | } |
---|
5555 | |
---|
5556 | // SGU_BR |
---|
5557 | pbAvail = &(pbAvailBorder[SGU_BR]); |
---|
5558 | if(bPicBBoundary || bPicRBoundary) |
---|
5559 | { |
---|
5560 | *pbAvail = false; |
---|
5561 | } |
---|
5562 | else if (!bIndependentSliceBoundaryEnabled) |
---|
5563 | { |
---|
5564 | *pbAvail = true; |
---|
5565 | } |
---|
5566 | else |
---|
5567 | { |
---|
5568 | if(bLCUBBoundary && bLCURBoundary) |
---|
5569 | { |
---|
5570 | zRefSU = 0; |
---|
5571 | pRefMapLCU = pSliceIDMapLCU+ ( (numLCUInPicWidth+1)*numSUInLCU); |
---|
5572 | } |
---|
5573 | else if(bLCUBBoundary) |
---|
5574 | { |
---|
5575 | zRefSU = g_auiRasterToZscan[ rBRefSU + widthSU]; |
---|
5576 | pRefMapLCU = pBRefMapLCU; |
---|
5577 | } |
---|
5578 | else if(bLCURBoundary) |
---|
5579 | { |
---|
5580 | zRefSU = g_auiRasterToZscan[ rRRefSU + (heightSU*numSUInLCUWidth)]; |
---|
5581 | pRefMapLCU = pRRefMapLCU; |
---|
5582 | } |
---|
5583 | else //inside LCU |
---|
5584 | { |
---|
5585 | zRefSU = g_auiRasterToZscan[ rTLSU + (heightSU*numSUInLCUWidth)+ widthSU]; |
---|
5586 | pRefMapLCU = pSliceIDMapLCU; |
---|
5587 | } |
---|
5588 | pRefID = pRefMapLCU + zRefSU; |
---|
5589 | *pbAvail = (*pRefID == sliceID)?(true):(false); |
---|
5590 | } |
---|
5591 | |
---|
5592 | if(bIndependentTileBoundaryEnabled) |
---|
5593 | { |
---|
5594 | //left LCU boundary |
---|
5595 | if(!bPicLBoundary && bLCULBoundary) |
---|
5596 | { |
---|
5597 | if(bLeftTileBoundary) |
---|
5598 | { |
---|
5599 | pbAvailBorder[SGU_L] = pbAvailBorder[SGU_TL] = pbAvailBorder[SGU_BL] = false; |
---|
5600 | } |
---|
5601 | } |
---|
5602 | //right LCU boundary |
---|
5603 | if(!bPicRBoundary && bLCURBoundary) |
---|
5604 | { |
---|
5605 | if(bRightTileBoundary) |
---|
5606 | { |
---|
5607 | pbAvailBorder[SGU_R] = pbAvailBorder[SGU_TR] = pbAvailBorder[SGU_BR] = false; |
---|
5608 | } |
---|
5609 | } |
---|
5610 | //top LCU boundary |
---|
5611 | if(!bPicTBoundary && bLCUTBoundary) |
---|
5612 | { |
---|
5613 | if(bTopTileBoundary) |
---|
5614 | { |
---|
5615 | pbAvailBorder[SGU_T] = pbAvailBorder[SGU_TL] = pbAvailBorder[SGU_TR] = false; |
---|
5616 | } |
---|
5617 | } |
---|
5618 | //down LCU boundary |
---|
5619 | if(!bPicBBoundary && bLCUBBoundary) |
---|
5620 | { |
---|
5621 | if(bDownTileBoundary) |
---|
5622 | { |
---|
5623 | pbAvailBorder[SGU_B] = pbAvailBorder[SGU_BL] = pbAvailBorder[SGU_BR] = false; |
---|
5624 | } |
---|
5625 | } |
---|
5626 | } |
---|
5627 | #if LCU_SYNTAX_ALF |
---|
5628 | rSGU.allBordersAvailable = true; |
---|
5629 | for(Int b=0; b< NUM_SGU_BORDER; b++) |
---|
5630 | { |
---|
5631 | if(pbAvailBorder[b] == false) |
---|
5632 | { |
---|
5633 | rSGU.allBordersAvailable = false; |
---|
5634 | break; |
---|
5635 | } |
---|
5636 | } |
---|
5637 | #endif |
---|
5638 | |
---|
5639 | } |
---|
5640 | } |
---|
5641 | |
---|
5642 | Void TComDataCU::getPosInPic( UInt uiAbsPartIndex, Int& riPosX, Int& riPosY ) |
---|
5643 | { |
---|
5644 | riPosX = g_auiRasterToPelX[g_auiZscanToRaster[uiAbsPartIndex]] + getCUPelX(); |
---|
5645 | riPosY = g_auiRasterToPelY[g_auiZscanToRaster[uiAbsPartIndex]] + getCUPelY(); |
---|
5646 | } |
---|
5647 | |
---|
5648 | // ------------------------------------------------------------------------------------------------------------------- |
---|
5649 | // public functions for depth model modes |
---|
5650 | // ------------------------------------------------------------------------------------------------------------------- |
---|
5651 | #if HHI_DMM_WEDGE_INTRA |
---|
5652 | Void TComDataCU::setWedgeFullTabIdxSubParts( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
5653 | { |
---|
5654 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
5655 | |
---|
5656 | for ( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
5657 | { |
---|
5658 | m_puiWedgeFullTabIdx[uiAbsPartIdx+ui] = uiTIdx; |
---|
5659 | } |
---|
5660 | } |
---|
5661 | |
---|
5662 | Void TComDataCU::setWedgeFullDeltaDC1SubParts( Int iDC1, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
5663 | { |
---|
5664 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
5665 | |
---|
5666 | for ( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
5667 | { |
---|
5668 | m_piWedgeFullDeltaDC1[uiAbsPartIdx+ui] = iDC1; |
---|
5669 | } |
---|
5670 | } |
---|
5671 | |
---|
5672 | Void TComDataCU::setWedgeFullDeltaDC2SubParts( Int iDC2, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
5673 | { |
---|
5674 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
5675 | |
---|
5676 | for ( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
5677 | { |
---|
5678 | m_piWedgeFullDeltaDC2[uiAbsPartIdx+ui] = iDC2; |
---|
5679 | } |
---|
5680 | } |
---|
5681 | |
---|
5682 | Void TComDataCU::setWedgePredDirTabIdxSubParts( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
5683 | { |
---|
5684 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
5685 | |
---|
5686 | for ( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
5687 | { |
---|
5688 | m_puiWedgePredDirTabIdx[uiAbsPartIdx+ui] = uiTIdx; |
---|
5689 | } |
---|
5690 | } |
---|
5691 | |
---|
5692 | Void TComDataCU::setWedgePredDirDeltaDC1SubParts( Int iDC1, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
5693 | { |
---|
5694 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
5695 | |
---|
5696 | for ( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
5697 | { |
---|
5698 | m_piWedgePredDirDeltaDC1[uiAbsPartIdx+ui] = iDC1; |
---|
5699 | } |
---|
5700 | } |
---|
5701 | |
---|
5702 | Void TComDataCU::setWedgePredDirDeltaDC2SubParts( Int iDC2, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
5703 | { |
---|
5704 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
5705 | |
---|
5706 | for ( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
5707 | { |
---|
5708 | m_piWedgePredDirDeltaDC2[uiAbsPartIdx+ui] = iDC2; |
---|
5709 | } |
---|
5710 | } |
---|
5711 | |
---|
5712 | Void TComDataCU::setWedgePredDirDeltaEndSubParts( Int iDelta, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
5713 | { |
---|
5714 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
5715 | |
---|
5716 | for ( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
5717 | { |
---|
5718 | m_piWedgePredDirDeltaEnd[uiAbsPartIdx+ui] = iDelta; |
---|
5719 | } |
---|
5720 | } |
---|
5721 | #endif |
---|
5722 | #if HHI_DMM_PRED_TEX |
---|
5723 | Void TComDataCU::setWedgePredTexTabIdxSubParts( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
5724 | { |
---|
5725 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
5726 | |
---|
5727 | for ( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
5728 | { |
---|
5729 | m_puiWedgePredTexTabIdx[uiAbsPartIdx+ui] = uiTIdx; |
---|
5730 | } |
---|
5731 | } |
---|
5732 | |
---|
5733 | Void TComDataCU::setWedgePredTexDeltaDC1SubParts( Int iDC1, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
5734 | { |
---|
5735 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
5736 | |
---|
5737 | for ( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
5738 | { |
---|
5739 | m_piWedgePredTexDeltaDC1[uiAbsPartIdx+ui] = iDC1; |
---|
5740 | } |
---|
5741 | } |
---|
5742 | |
---|
5743 | Void TComDataCU::setWedgePredTexDeltaDC2SubParts( Int iDC2, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
5744 | { |
---|
5745 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
5746 | |
---|
5747 | for ( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
5748 | { |
---|
5749 | m_piWedgePredTexDeltaDC2[uiAbsPartIdx+ui] = iDC2; |
---|
5750 | } |
---|
5751 | } |
---|
5752 | |
---|
5753 | Void TComDataCU::setContourPredTexDeltaDC1SubParts( Int iDC1, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
5754 | { |
---|
5755 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
5756 | |
---|
5757 | for ( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
5758 | { |
---|
5759 | m_piContourPredTexDeltaDC1[uiAbsPartIdx+ui] = iDC1; |
---|
5760 | } |
---|
5761 | } |
---|
5762 | |
---|
5763 | Void TComDataCU::setContourPredTexDeltaDC2SubParts( Int iDC2, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
5764 | { |
---|
5765 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
5766 | |
---|
5767 | for ( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
5768 | { |
---|
5769 | m_piContourPredTexDeltaDC2[uiAbsPartIdx+ui] = iDC2; |
---|
5770 | } |
---|
5771 | } |
---|
5772 | #endif |
---|
5773 | |
---|
5774 | #if HHI_MPI |
---|
5775 | Void TComDataCU::setTextureModeDepthSubParts( Int iTextureModeDepth, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
5776 | { |
---|
5777 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
5778 | |
---|
5779 | for (UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
5780 | { |
---|
5781 | m_piTextureModeDepth[uiAbsPartIdx + ui] = iTextureModeDepth; |
---|
5782 | } |
---|
5783 | } |
---|
5784 | |
---|
5785 | Void TComDataCU::copyTextureMotionDataFrom( TComDataCU* pcCU, UInt uiDepth, UInt uiAbsPartIdxSrc, UInt uiAbsPartIdxDst ) |
---|
5786 | { |
---|
5787 | assert( getSlice()->getIsDepth() && ! pcCU->getSlice()->getIsDepth() ); |
---|
5788 | UInt uiNumPartition = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
5789 | |
---|
5790 | memcpy( m_pePredMode + uiAbsPartIdxDst, pcCU->getPredictionMode() + uiAbsPartIdxSrc, sizeof( m_pePredMode[0] ) * uiNumPartition ); |
---|
5791 | memcpy( m_puhInterDir + uiAbsPartIdxDst, pcCU->getInterDir() + uiAbsPartIdxSrc, sizeof( m_puhInterDir[0] ) * uiNumPartition ); |
---|
5792 | |
---|
5793 | memcpy( m_apiMVPIdx[0] + uiAbsPartIdxDst, pcCU->getMVPIdx(REF_PIC_LIST_0) + uiAbsPartIdxSrc, sizeof(*m_apiMVPIdx[0]) * uiNumPartition ); |
---|
5794 | memcpy( m_apiMVPIdx[1] + uiAbsPartIdxDst, pcCU->getMVPIdx(REF_PIC_LIST_1) + uiAbsPartIdxSrc, sizeof(*m_apiMVPIdx[0]) * uiNumPartition ); |
---|
5795 | memcpy( m_apiMVPNum[0] + uiAbsPartIdxDst, pcCU->getMVPNum(REF_PIC_LIST_0) + uiAbsPartIdxSrc, sizeof(*m_apiMVPNum[0]) * uiNumPartition ); |
---|
5796 | memcpy( m_apiMVPNum[1] + uiAbsPartIdxDst, pcCU->getMVPNum(REF_PIC_LIST_1) + uiAbsPartIdxSrc, sizeof(*m_apiMVPNum[0]) * uiNumPartition ); |
---|
5797 | |
---|
5798 | pcCU->getCUMvField( REF_PIC_LIST_0 )->copyTo( &m_acCUMvField[0], -Int(uiAbsPartIdxSrc) + uiAbsPartIdxDst, uiAbsPartIdxSrc, uiNumPartition ); |
---|
5799 | pcCU->getCUMvField( REF_PIC_LIST_1 )->copyTo( &m_acCUMvField[1], -Int(uiAbsPartIdxSrc) + uiAbsPartIdxDst, uiAbsPartIdxSrc, uiNumPartition ); |
---|
5800 | |
---|
5801 | #if HHI_FULL_PEL_DEPTH_MAP_MV_ACC |
---|
5802 | m_acCUMvField[0].decreaseMvAccuracy( uiAbsPartIdxDst, uiNumPartition, 2 ); |
---|
5803 | m_acCUMvField[1].decreaseMvAccuracy( uiAbsPartIdxDst, uiNumPartition, 2 ); |
---|
5804 | #endif |
---|
5805 | } |
---|
5806 | #endif |
---|
5807 | |
---|
5808 | // ------------------------------------------------------------------------------------------------------------------- |
---|
5809 | // public functions for Multi-view tools |
---|
5810 | // ------------------------------------------------------------------------------------------------------------------- |
---|
5811 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
5812 | Int |
---|
5813 | TComDataCU::getPdmMergeCandidate( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv ) |
---|
5814 | { |
---|
5815 | TComDepthMapGenerator* pcDepthMapGenerator = m_pcSlice->getSPS()->getDepthMapGenerator(); |
---|
5816 | ROFRS( pcDepthMapGenerator, 0 ); |
---|
5817 | return pcDepthMapGenerator->getPdmMergeCandidate( this, uiPartIdx, paiPdmRefIdx, pacPdmMv ); |
---|
5818 | } |
---|
5819 | |
---|
5820 | |
---|
5821 | Bool |
---|
5822 | TComDataCU::getPdmMvPred( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, Bool bMerge ) |
---|
5823 | { |
---|
5824 | TComDepthMapGenerator* pcDepthMapGenerator = m_pcSlice->getSPS()->getDepthMapGenerator(); |
---|
5825 | ROFRS( pcDepthMapGenerator, false ); |
---|
5826 | return pcDepthMapGenerator->getPdmMvPred( this, uiPartIdx, eRefPicList, iRefIdx, rcMv, bMerge ); |
---|
5827 | } |
---|
5828 | |
---|
5829 | |
---|
5830 | Bool |
---|
5831 | TComDataCU::getIViewOrgDepthMvPred( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv ) |
---|
5832 | { |
---|
5833 | TComDepthMapGenerator* pcDepthMapGenerator = m_pcSlice->getSPS()->getDepthMapGenerator(); |
---|
5834 | ROFRS( pcDepthMapGenerator, false ); |
---|
5835 | return pcDepthMapGenerator->getIViewOrgDepthMvPred( this, uiPartIdx, eRefPicList, iRefIdx, rcMv ); |
---|
5836 | } |
---|
5837 | #endif |
---|
5838 | |
---|
5839 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
5840 | Bool |
---|
5841 | TComDataCU::getResidualSamples( UInt uiPartIdx, TComYuv* pcYuv ) |
---|
5842 | { |
---|
5843 | TComResidualGenerator* pcResidualGenerator = m_pcSlice->getSPS()->getResidualGenerator(); |
---|
5844 | ROFRS( pcResidualGenerator, false ); |
---|
5845 | return pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv ); |
---|
5846 | } |
---|
5847 | #endif |
---|
5848 | |
---|
5849 | //! \} |
---|