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 TDecCu.cpp |
---|
35 | \brief CU decoder class |
---|
36 | */ |
---|
37 | |
---|
38 | #include "TDecCu.h" |
---|
39 | |
---|
40 | #if RWTH_SDC_DLT_B0036 |
---|
41 | #define GetDepthValue2Idx(val) (pcCU->getSlice()->getSPS()->depthValue2idx(val)) |
---|
42 | #define GetIdx2DepthValue(val) (pcCU->getSlice()->getSPS()->idx2DepthValue(val)) |
---|
43 | #endif |
---|
44 | |
---|
45 | //! \ingroup TLibDecoder |
---|
46 | //! \{ |
---|
47 | |
---|
48 | // ==================================================================================================================== |
---|
49 | // Constructor / destructor / create / destroy |
---|
50 | // ==================================================================================================================== |
---|
51 | |
---|
52 | TDecCu::TDecCu() |
---|
53 | { |
---|
54 | m_ppcYuvResi = NULL; |
---|
55 | m_ppcYuvReco = NULL; |
---|
56 | #if H3D_IVRP & !QC_ARP_D0177 |
---|
57 | m_ppcYuvResPred = NULL; |
---|
58 | #endif |
---|
59 | m_ppcCU = NULL; |
---|
60 | } |
---|
61 | |
---|
62 | TDecCu::~TDecCu() |
---|
63 | { |
---|
64 | } |
---|
65 | |
---|
66 | Void TDecCu::init( TDecEntropy* pcEntropyDecoder, TComTrQuant* pcTrQuant, TComPrediction* pcPrediction) |
---|
67 | { |
---|
68 | m_pcEntropyDecoder = pcEntropyDecoder; |
---|
69 | m_pcTrQuant = pcTrQuant; |
---|
70 | m_pcPrediction = pcPrediction; |
---|
71 | } |
---|
72 | |
---|
73 | /** |
---|
74 | \param uiMaxDepth total number of allowable depth |
---|
75 | \param uiMaxWidth largest CU width |
---|
76 | \param uiMaxHeight largest CU height |
---|
77 | */ |
---|
78 | Void TDecCu::create( UInt uiMaxDepth, UInt uiMaxWidth, UInt uiMaxHeight ) |
---|
79 | { |
---|
80 | m_uiMaxDepth = uiMaxDepth+1; |
---|
81 | |
---|
82 | m_ppcYuvResi = new TComYuv*[m_uiMaxDepth-1]; |
---|
83 | m_ppcYuvReco = new TComYuv*[m_uiMaxDepth-1]; |
---|
84 | #if H3D_IVRP & !QC_ARP_D0177 |
---|
85 | m_ppcYuvResPred = new TComYuv* [m_uiMaxDepth-1]; |
---|
86 | #endif |
---|
87 | m_ppcCU = new TComDataCU*[m_uiMaxDepth-1]; |
---|
88 | |
---|
89 | UInt uiNumPartitions; |
---|
90 | for ( UInt ui = 0; ui < m_uiMaxDepth-1; ui++ ) |
---|
91 | { |
---|
92 | uiNumPartitions = 1<<( ( m_uiMaxDepth - ui - 1 )<<1 ); |
---|
93 | UInt uiWidth = uiMaxWidth >> ui; |
---|
94 | UInt uiHeight = uiMaxHeight >> ui; |
---|
95 | |
---|
96 | m_ppcYuvResi[ui] = new TComYuv; m_ppcYuvResi[ui]->create( uiWidth, uiHeight ); |
---|
97 | m_ppcYuvReco[ui] = new TComYuv; m_ppcYuvReco[ui]->create( uiWidth, uiHeight ); |
---|
98 | #if H3D_IVRP & !QC_ARP_D0177 |
---|
99 | m_ppcYuvResPred[ui] = new TComYuv; m_ppcYuvResPred[ui]->create( uiWidth, uiHeight ); |
---|
100 | #endif |
---|
101 | m_ppcCU [ui] = new TComDataCU; m_ppcCU [ui]->create( uiNumPartitions, uiWidth, uiHeight, true, uiMaxWidth >> (m_uiMaxDepth - 1) ); |
---|
102 | } |
---|
103 | |
---|
104 | m_bDecodeDQP = false; |
---|
105 | |
---|
106 | // initialize partition order. |
---|
107 | UInt* piTmp = &g_auiZscanToRaster[0]; |
---|
108 | initZscanToRaster(m_uiMaxDepth, 1, 0, piTmp); |
---|
109 | initRasterToZscan( uiMaxWidth, uiMaxHeight, m_uiMaxDepth ); |
---|
110 | |
---|
111 | // initialize conversion matrix from partition index to pel |
---|
112 | initRasterToPelXY( uiMaxWidth, uiMaxHeight, m_uiMaxDepth ); |
---|
113 | initMotionReferIdx ( uiMaxWidth, uiMaxHeight, m_uiMaxDepth ); |
---|
114 | } |
---|
115 | |
---|
116 | Void TDecCu::destroy() |
---|
117 | { |
---|
118 | for ( UInt ui = 0; ui < m_uiMaxDepth-1; ui++ ) |
---|
119 | { |
---|
120 | m_ppcYuvResi[ui]->destroy(); delete m_ppcYuvResi[ui]; m_ppcYuvResi[ui] = NULL; |
---|
121 | m_ppcYuvReco[ui]->destroy(); delete m_ppcYuvReco[ui]; m_ppcYuvReco[ui] = NULL; |
---|
122 | #if H3D_IVRP & !QC_ARP_D0177 |
---|
123 | m_ppcYuvResPred[ui]->destroy(); delete m_ppcYuvResPred[ui]; m_ppcYuvResPred[ui] = NULL; |
---|
124 | #endif |
---|
125 | m_ppcCU [ui]->destroy(); delete m_ppcCU [ui]; m_ppcCU [ui] = NULL; |
---|
126 | } |
---|
127 | |
---|
128 | delete [] m_ppcYuvResi; m_ppcYuvResi = NULL; |
---|
129 | delete [] m_ppcYuvReco; m_ppcYuvReco = NULL; |
---|
130 | #if H3D_IVRP & !QC_ARP_D0177 |
---|
131 | delete [] m_ppcYuvResPred; m_ppcYuvResPred = NULL; |
---|
132 | #endif |
---|
133 | delete [] m_ppcCU ; m_ppcCU = NULL; |
---|
134 | } |
---|
135 | |
---|
136 | // ==================================================================================================================== |
---|
137 | // Public member functions |
---|
138 | // ==================================================================================================================== |
---|
139 | |
---|
140 | /** \param pcCU pointer of CU data |
---|
141 | \param ruiIsLast last data? |
---|
142 | */ |
---|
143 | Void TDecCu::decodeCU( TComDataCU* pcCU, UInt& ruiIsLast ) |
---|
144 | { |
---|
145 | if ( pcCU->getSlice()->getPPS()->getUseDQP() ) |
---|
146 | { |
---|
147 | setdQPFlag(true); |
---|
148 | } |
---|
149 | |
---|
150 | pcCU->setNumSucIPCM(0); |
---|
151 | |
---|
152 | // start from the top level CU |
---|
153 | xDecodeCU( pcCU, 0, 0, ruiIsLast); |
---|
154 | } |
---|
155 | |
---|
156 | /** \param pcCU pointer of CU data |
---|
157 | */ |
---|
158 | Void TDecCu::decompressCU( TComDataCU* pcCU ) |
---|
159 | { |
---|
160 | xDecompressCU( pcCU, pcCU, 0, 0 ); |
---|
161 | } |
---|
162 | |
---|
163 | // ==================================================================================================================== |
---|
164 | // Protected member functions |
---|
165 | // ==================================================================================================================== |
---|
166 | |
---|
167 | /**decode end-of-slice flag |
---|
168 | * \param pcCU |
---|
169 | * \param uiAbsPartIdx |
---|
170 | * \param uiDepth |
---|
171 | * \returns Bool |
---|
172 | */ |
---|
173 | Bool TDecCu::xDecodeSliceEnd( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth) { |
---|
174 | UInt uiIsLast; |
---|
175 | TComPic* pcPic = pcCU->getPic(); |
---|
176 | TComSlice * pcSlice = pcPic->getSlice(pcPic->getCurrSliceIdx()); |
---|
177 | UInt uiCurNumParts = pcPic->getNumPartInCU() >> (uiDepth<<1); |
---|
178 | UInt uiWidth = pcSlice->getSPS()->getPicWidthInLumaSamples(); |
---|
179 | UInt uiHeight = pcSlice->getSPS()->getPicHeightInLumaSamples(); |
---|
180 | UInt uiGranularityWidth = g_uiMaxCUWidth>>(pcSlice->getPPS()->getSliceGranularity()); |
---|
181 | UInt uiPosX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ]; |
---|
182 | UInt uiPosY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ]; |
---|
183 | |
---|
184 | #if HHI_MPI |
---|
185 | const UInt uiCUWidth = pcCU->getTextureModeDepth( uiAbsPartIdx ) != -1 ? g_uiMaxCUWidth>>uiDepth : pcCU->getWidth (uiAbsPartIdx); |
---|
186 | const UInt uiCUHeight = pcCU->getTextureModeDepth( uiAbsPartIdx ) != -1 ? g_uiMaxCUHeight>>uiDepth : pcCU->getHeight(uiAbsPartIdx); |
---|
187 | if(((uiPosX+uiCUWidth)%uiGranularityWidth==0||(uiPosX+uiCUWidth==uiWidth)) |
---|
188 | &&((uiPosY+uiCUHeight)%uiGranularityWidth==0||(uiPosY+uiCUHeight==uiHeight))) |
---|
189 | #else |
---|
190 | if(((uiPosX+pcCU->getWidth(uiAbsPartIdx))%uiGranularityWidth==0||(uiPosX+pcCU->getWidth(uiAbsPartIdx)==uiWidth)) |
---|
191 | &&((uiPosY+pcCU->getHeight(uiAbsPartIdx))%uiGranularityWidth==0||(uiPosY+pcCU->getHeight(uiAbsPartIdx)==uiHeight))) |
---|
192 | #endif |
---|
193 | { |
---|
194 | m_pcEntropyDecoder->decodeTerminatingBit( uiIsLast ); |
---|
195 | } |
---|
196 | else |
---|
197 | { |
---|
198 | uiIsLast=0; |
---|
199 | } |
---|
200 | |
---|
201 | if(uiIsLast) |
---|
202 | { |
---|
203 | if(pcSlice->isNextEntropySlice()&&!pcSlice->isNextSlice()) |
---|
204 | { |
---|
205 | pcSlice->setEntropySliceCurEndCUAddr(pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts); |
---|
206 | } |
---|
207 | else |
---|
208 | { |
---|
209 | pcSlice->setSliceCurEndCUAddr(pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts); |
---|
210 | pcSlice->setEntropySliceCurEndCUAddr(pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts); |
---|
211 | } |
---|
212 | } |
---|
213 | |
---|
214 | return uiIsLast>0; |
---|
215 | } |
---|
216 | |
---|
217 | /** decode CU block recursively |
---|
218 | * \param pcCU |
---|
219 | * \param uiAbsPartIdx |
---|
220 | * \param uiDepth |
---|
221 | * \returns Void |
---|
222 | */ |
---|
223 | |
---|
224 | Void TDecCu::xDecodeCU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt& ruiIsLast) |
---|
225 | { |
---|
226 | TComPic* pcPic = pcCU->getPic(); |
---|
227 | UInt uiCurNumParts = pcPic->getNumPartInCU() >> (uiDepth<<1); |
---|
228 | UInt uiQNumParts = uiCurNumParts>>2; |
---|
229 | |
---|
230 | Bool bBoundary = false; |
---|
231 | UInt uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ]; |
---|
232 | UInt uiRPelX = uiLPelX + (g_uiMaxCUWidth>>uiDepth) - 1; |
---|
233 | UInt uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ]; |
---|
234 | UInt uiBPelY = uiTPelY + (g_uiMaxCUHeight>>uiDepth) - 1; |
---|
235 | |
---|
236 | TComSlice * pcSlice = pcCU->getPic()->getSlice(pcCU->getPic()->getCurrSliceIdx()); |
---|
237 | Bool bStartInCU = pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts>pcSlice->getEntropySliceCurStartCUAddr()&&pcCU->getSCUAddr()+uiAbsPartIdx<pcSlice->getEntropySliceCurStartCUAddr(); |
---|
238 | if((!bStartInCU) && ( uiRPelX < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( uiBPelY < pcSlice->getSPS()->getPicHeightInLumaSamples() ) ) |
---|
239 | { |
---|
240 | if(pcCU->getNumSucIPCM() == 0) |
---|
241 | { |
---|
242 | #if HHI_MPI |
---|
243 | if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == -1 || uiDepth < pcCU->getTextureModeDepth( uiAbsPartIdx ) ) |
---|
244 | #endif |
---|
245 | m_pcEntropyDecoder->decodeSplitFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
246 | } |
---|
247 | else |
---|
248 | { |
---|
249 | pcCU->setDepthSubParts( uiDepth, uiAbsPartIdx ); |
---|
250 | } |
---|
251 | } |
---|
252 | else |
---|
253 | { |
---|
254 | bBoundary = true; |
---|
255 | } |
---|
256 | |
---|
257 | if( ( ( uiDepth < pcCU->getDepth( uiAbsPartIdx ) ) && ( uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth ) ) || bBoundary ) |
---|
258 | { |
---|
259 | UInt uiIdx = uiAbsPartIdx; |
---|
260 | if( (g_uiMaxCUWidth>>uiDepth) == pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP()) |
---|
261 | { |
---|
262 | setdQPFlag(true); |
---|
263 | pcCU->setQPSubParts( pcCU->getRefQP(uiAbsPartIdx), uiAbsPartIdx, uiDepth ); // set QP to default QP |
---|
264 | } |
---|
265 | |
---|
266 | for ( UInt uiPartUnitIdx = 0; uiPartUnitIdx < 4; uiPartUnitIdx++ ) |
---|
267 | { |
---|
268 | uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiIdx] ]; |
---|
269 | uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiIdx] ]; |
---|
270 | |
---|
271 | Bool bSubInSlice = pcCU->getSCUAddr()+uiIdx+uiQNumParts>pcSlice->getEntropySliceCurStartCUAddr(); |
---|
272 | if ( bSubInSlice ) |
---|
273 | { |
---|
274 | if ( ( uiLPelX < pcCU->getSlice()->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples() ) ) |
---|
275 | { |
---|
276 | xDecodeCU( pcCU, uiIdx, uiDepth+1, ruiIsLast ); |
---|
277 | } |
---|
278 | else |
---|
279 | { |
---|
280 | pcCU->setOutsideCUPart( uiIdx, uiDepth+1 ); |
---|
281 | } |
---|
282 | } |
---|
283 | if(ruiIsLast) |
---|
284 | { |
---|
285 | break; |
---|
286 | } |
---|
287 | |
---|
288 | uiIdx += uiQNumParts; |
---|
289 | } |
---|
290 | if( (g_uiMaxCUWidth>>uiDepth) == pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP()) |
---|
291 | { |
---|
292 | if ( getdQPFlag() ) |
---|
293 | { |
---|
294 | UInt uiQPSrcPartIdx; |
---|
295 | if ( pcPic->getCU( pcCU->getAddr() )->getEntropySliceStartCU(uiAbsPartIdx) != pcSlice->getEntropySliceCurStartCUAddr() ) |
---|
296 | { |
---|
297 | uiQPSrcPartIdx = pcSlice->getEntropySliceCurStartCUAddr() % pcPic->getNumPartInCU(); |
---|
298 | } |
---|
299 | else |
---|
300 | { |
---|
301 | uiQPSrcPartIdx = uiAbsPartIdx; |
---|
302 | } |
---|
303 | pcCU->setQPSubParts( pcCU->getRefQP( uiQPSrcPartIdx ), uiAbsPartIdx, uiDepth ); // set QP to default QP |
---|
304 | } |
---|
305 | } |
---|
306 | return; |
---|
307 | } |
---|
308 | |
---|
309 | if( (g_uiMaxCUWidth>>uiDepth) >= pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP()) |
---|
310 | { |
---|
311 | setdQPFlag(true); |
---|
312 | pcCU->setQPSubParts( pcCU->getRefQP(uiAbsPartIdx), uiAbsPartIdx, uiDepth ); // set QP to default QP |
---|
313 | } |
---|
314 | #if QC_CU_NBDV_D0181 |
---|
315 | DisInfo DvInfo; |
---|
316 | DvInfo.bDV = false; |
---|
317 | if(!pcCU->getSlice()->isIntra()) |
---|
318 | { |
---|
319 | #if QC_ARP_D0177 |
---|
320 | if(( pcCU->getSlice()->getSPS()->getMultiviewMvPredMode() || pcCU->getSlice()->getSPS()->getUseAdvRP()) && pcCU->getSlice()->getViewId()) |
---|
321 | #else |
---|
322 | if(( pcCU->getSlice()->getSPS()->getMultiviewMvPredMode() || pcCU->getSlice()->getSPS()->getMultiviewResPredMode()) && pcCU->getSlice()->getViewId()) |
---|
323 | #endif |
---|
324 | { |
---|
325 | m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0, true ); |
---|
326 | m_ppcCU[uiDepth]->copyDVInfoFrom( pcCU, uiAbsPartIdx); |
---|
327 | PartSize ePartTemp = m_ppcCU[uiDepth]->getPartitionSize(0); |
---|
328 | UChar cWidTemp = m_ppcCU[uiDepth]->getWidth(0); |
---|
329 | UChar cHeightTemp = m_ppcCU[uiDepth]->getHeight(0); |
---|
330 | m_ppcCU[uiDepth]->setWidth ( 0, pcCU->getSlice()->getSPS()->getMaxCUWidth ()/(1<<uiDepth) ); |
---|
331 | m_ppcCU[uiDepth]->setHeight ( 0, pcCU->getSlice()->getSPS()->getMaxCUHeight()/(1<<uiDepth) ); |
---|
332 | m_ppcCU[uiDepth]->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); |
---|
333 | #if MERL_VSP_C0152 |
---|
334 | DvInfo.bDV = m_ppcCU[uiDepth]->getDisMvpCandNBDV(0, 0, &DvInfo, false, true); |
---|
335 | #else |
---|
336 | DvInfo.bDV = m_ppcCU[uiDepth]->getDisMvpCandNBDV(0, 0, &DvInfo, false); |
---|
337 | #endif |
---|
338 | pcCU->setDvInfoSubParts(DvInfo, uiAbsPartIdx, uiDepth); |
---|
339 | m_ppcCU[uiDepth]->setPartSizeSubParts( ePartTemp, 0, uiDepth ); |
---|
340 | m_ppcCU[uiDepth]->setWidth ( 0, cWidTemp ); |
---|
341 | m_ppcCU[uiDepth]->setHeight ( 0, cHeightTemp ); |
---|
342 | } |
---|
343 | if(DvInfo.bDV==false) |
---|
344 | { |
---|
345 | DvInfo.iN=1; |
---|
346 | #if !SEC_DEFAULT_DV_D0112 |
---|
347 | DvInfo.m_acMvCand[0].setHor(0); |
---|
348 | DvInfo.m_acMvCand[0].setVer(0); |
---|
349 | DvInfo.m_aVIdxCan[0] = 0; |
---|
350 | #endif |
---|
351 | pcCU->setDvInfoSubParts(DvInfo, uiAbsPartIdx, uiDepth); |
---|
352 | } |
---|
353 | } |
---|
354 | #endif |
---|
355 | // decode CU mode and the partition size |
---|
356 | if( !pcCU->getSlice()->isIntra() && pcCU->getNumSucIPCM() == 0 ) |
---|
357 | #if HHI_MPI |
---|
358 | if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == -1 ) |
---|
359 | #endif |
---|
360 | { |
---|
361 | m_pcEntropyDecoder->decodeSkipFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
362 | } |
---|
363 | |
---|
364 | if( pcCU->isSkipped(uiAbsPartIdx) ) |
---|
365 | { |
---|
366 | m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0 ); |
---|
367 | m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_1 ); |
---|
368 | #if H3D_IVMP |
---|
369 | TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists |
---|
370 | UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM]; |
---|
371 | Int numValidMergeCand = 0; |
---|
372 | for( UInt ui = 0; ui < MRG_MAX_NUM_CANDS_MEM; ++ui ) |
---|
373 | #else |
---|
374 | TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS << 1]; // double length for mv of both lists |
---|
375 | UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS]; |
---|
376 | Int numValidMergeCand = 0; |
---|
377 | for( UInt ui = 0; ui < MRG_MAX_NUM_CANDS; ++ui ) |
---|
378 | #endif |
---|
379 | { |
---|
380 | uhInterDirNeighbours[ui] = 0; |
---|
381 | } |
---|
382 | m_pcEntropyDecoder->decodeMergeIndex( pcCU, 0, uiAbsPartIdx, SIZE_2Nx2N, uhInterDirNeighbours, cMvFieldNeighbours, uiDepth ); |
---|
383 | #if HHI_MPI |
---|
384 | if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == uiDepth ) |
---|
385 | { |
---|
386 | TComDataCU *pcTextureCU = pcCU->getSlice()->getTexturePic()->getCU( pcCU->getAddr() ); |
---|
387 | pcCU->copyTextureMotionDataFrom( pcTextureCU, uiDepth, pcCU->getZorderIdxInCU() + uiAbsPartIdx, uiAbsPartIdx ); |
---|
388 | |
---|
389 | UInt uiCurrPartNumb = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1); |
---|
390 | |
---|
391 | for( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
392 | { |
---|
393 | const UChar uhNewDepth = max<UInt>( uiDepth, pcTextureCU->getDepth( uiAbsPartIdx + ui ) ); |
---|
394 | #if MERL_VSP_C0152 |
---|
395 | Int vspIdx = pcTextureCU->getVSPIndex( uiAbsPartIdx + ui ); |
---|
396 | pcCU->setVSPIndex( uiAbsPartIdx + ui, vspIdx ); |
---|
397 | #endif |
---|
398 | #if MERL_VSP_NBDV_RefVId_Fix_D0166 |
---|
399 | Int vspDir = pcTextureCU->getVSPDir( uiAbsPartIdx + ui ); |
---|
400 | pcCU->setVSPDir( uiAbsPartIdx + ui, vspDir ); |
---|
401 | #endif |
---|
402 | pcCU->setPredictionMode( uiAbsPartIdx + ui, MODE_SKIP ); |
---|
403 | pcCU->setPartitionSize( uiAbsPartIdx + ui, SIZE_2Nx2N ); |
---|
404 | pcCU->setDepth( uiAbsPartIdx + ui, uhNewDepth ); |
---|
405 | pcCU->setWidth( uiAbsPartIdx + ui, g_uiMaxCUWidth>>uhNewDepth ); |
---|
406 | pcCU->setHeight( uiAbsPartIdx + ui, g_uiMaxCUHeight>>uhNewDepth ); |
---|
407 | } |
---|
408 | #if LGE_ILLUCOMP_DEPTH_C0046 |
---|
409 | m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
410 | #endif |
---|
411 | } |
---|
412 | else |
---|
413 | { |
---|
414 | #endif |
---|
415 | UInt uiMergeIndex = pcCU->getMergeIndex(uiAbsPartIdx); |
---|
416 | #if MERL_VSP_C0152 |
---|
417 | Int iVSPIndexTrue[3] = {-1, -1, -1}; |
---|
418 | #if MERL_VSP_NBDV_RefVId_Fix_D0166 |
---|
419 | Int iVSPDirTrue[3] = {-1, -1, -1}; |
---|
420 | m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, iVSPIndexTrue, iVSPDirTrue, uiMergeIndex ); |
---|
421 | #else |
---|
422 | m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, iVSPIndexTrue, uiMergeIndex ); |
---|
423 | #endif |
---|
424 | { |
---|
425 | Int iVSPIdx = 0; |
---|
426 | Int numVspIdx; |
---|
427 | numVspIdx = 3; |
---|
428 | for (Int i = 0; i < numVspIdx; i++) |
---|
429 | { |
---|
430 | if (iVSPIndexTrue[i] == uiMergeIndex) |
---|
431 | { |
---|
432 | iVSPIdx = i+1; |
---|
433 | break; |
---|
434 | } |
---|
435 | } |
---|
436 | pcCU->setVSPIndexSubParts( iVSPIdx, uiAbsPartIdx, 0, uiDepth ); // Initialize |
---|
437 | #if MERL_VSP_NBDV_RefVId_Fix_D0166 |
---|
438 | pcCU->setVSPDirSubParts( iVSPDirTrue[iVSPIdx-1], uiAbsPartIdx, 0, uiDepth ); |
---|
439 | #endif |
---|
440 | } |
---|
441 | #else |
---|
442 | m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); |
---|
443 | #endif |
---|
444 | pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiAbsPartIdx, 0, uiDepth ); |
---|
445 | |
---|
446 | TComMv cTmpMv( 0, 0 ); |
---|
447 | for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) |
---|
448 | { |
---|
449 | if ( pcCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 ) |
---|
450 | { |
---|
451 | pcCU->setMVPIdxSubParts( 0, RefPicList( uiRefListIdx ), uiAbsPartIdx, 0, uiDepth); |
---|
452 | pcCU->setMVPNumSubParts( 0, RefPicList( uiRefListIdx ), uiAbsPartIdx, 0, uiDepth); |
---|
453 | pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, SIZE_2Nx2N, uiAbsPartIdx, uiDepth ); |
---|
454 | pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], SIZE_2Nx2N, uiAbsPartIdx, uiDepth ); |
---|
455 | } |
---|
456 | } |
---|
457 | #if LGE_ILLUCOMP_B0045 |
---|
458 | m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
459 | #endif |
---|
460 | #if HHI_MPI |
---|
461 | } |
---|
462 | #endif |
---|
463 | #if QC_ARP_D0177 |
---|
464 | if( pcCU->getSlice()->getSPS()->getUseAdvRP() ) |
---|
465 | { |
---|
466 | pcCU->setResPredAvailSubParts ( false, uiAbsPartIdx, 0, uiDepth ); |
---|
467 | pcCU->setResPredFlagSubParts ( false, uiAbsPartIdx, 0, uiDepth ); |
---|
468 | m_pcEntropyDecoder->decodeARPW( pcCU , uiAbsPartIdx , uiDepth, m_ppcCU[uiDepth], 0 ); |
---|
469 | } |
---|
470 | #endif |
---|
471 | xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast ); |
---|
472 | return; |
---|
473 | } |
---|
474 | |
---|
475 | #if HHI_MPI |
---|
476 | if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == -1 ) |
---|
477 | { |
---|
478 | #endif |
---|
479 | if( pcCU->getNumSucIPCM() == 0 ) |
---|
480 | { |
---|
481 | m_pcEntropyDecoder->decodePredMode( pcCU, uiAbsPartIdx, uiDepth ); |
---|
482 | m_pcEntropyDecoder->decodePartSize( pcCU, uiAbsPartIdx, uiDepth ); |
---|
483 | } |
---|
484 | else |
---|
485 | { |
---|
486 | pcCU->setPredModeSubParts( MODE_INTRA, uiAbsPartIdx, uiDepth ); |
---|
487 | pcCU->setPartSizeSubParts( SIZE_2Nx2N, uiAbsPartIdx, uiDepth ); |
---|
488 | pcCU->setSizeSubParts( g_uiMaxCUWidth>>uiDepth, g_uiMaxCUHeight>>uiDepth, uiAbsPartIdx, uiDepth ); |
---|
489 | pcCU->setTrIdxSubParts( 0, uiAbsPartIdx, uiDepth ); |
---|
490 | } |
---|
491 | |
---|
492 | if (pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) |
---|
493 | { |
---|
494 | m_pcEntropyDecoder->decodeIPCMInfo( pcCU, uiAbsPartIdx, uiDepth ); |
---|
495 | |
---|
496 | if(pcCU->getIPCMFlag(uiAbsPartIdx)) |
---|
497 | { |
---|
498 | xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast ); |
---|
499 | return; |
---|
500 | } |
---|
501 | } |
---|
502 | |
---|
503 | #if ! HHI_MPI |
---|
504 | UInt uiCurrWidth = pcCU->getWidth ( uiAbsPartIdx ); |
---|
505 | UInt uiCurrHeight = pcCU->getHeight( uiAbsPartIdx ); |
---|
506 | #endif |
---|
507 | |
---|
508 | // prediction mode ( Intra : direction mode, Inter : Mv, reference idx ) |
---|
509 | m_pcEntropyDecoder->decodePredInfo( pcCU, uiAbsPartIdx, uiDepth, m_ppcCU[uiDepth]); |
---|
510 | |
---|
511 | #if LGE_ILLUCOMP_B0045 |
---|
512 | #if LGE_ILLUCOMP_DEPTH_C0046 && HHI_MPI |
---|
513 | if( pcCU->getTextureModeDepth( uiAbsPartIdx ) != uiDepth ) |
---|
514 | { |
---|
515 | #endif |
---|
516 | m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
517 | #endif |
---|
518 | |
---|
519 | #if LGE_ILLUCOMP_DEPTH_C0046 && HHI_MPI |
---|
520 | } |
---|
521 | #endif |
---|
522 | #if QC_ARP_D0177 |
---|
523 | if (pcCU->getSlice()->getSPS()->getUseAdvRP() && pcCU->isIntra( uiAbsPartIdx ) ) |
---|
524 | { |
---|
525 | pcCU->setResPredAvailSubParts ( 0, uiAbsPartIdx, 0, uiDepth ); |
---|
526 | pcCU->setResPredFlagSubParts ( 0, uiAbsPartIdx, 0, uiDepth ); |
---|
527 | } |
---|
528 | #endif |
---|
529 | #if HHI_MPI |
---|
530 | if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == uiDepth ) |
---|
531 | { |
---|
532 | assert( pcCU->getZorderIdxInCU() == 0 ); |
---|
533 | TComDataCU *pcTextureCU = pcCU->getSlice()->getTexturePic()->getCU( pcCU->getAddr() ); |
---|
534 | pcCU->copyTextureMotionDataFrom( pcTextureCU, uiDepth, pcCU->getZorderIdxInCU() + uiAbsPartIdx, uiAbsPartIdx ); |
---|
535 | |
---|
536 | UInt uiCurrPartNumb = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1); |
---|
537 | |
---|
538 | for( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
539 | { |
---|
540 | const UChar uhNewDepth = max<UInt>( uiDepth, pcTextureCU->getDepth( uiAbsPartIdx + ui ) ); |
---|
541 | #if MERL_VSP_C0152 |
---|
542 | Int vspIdx = pcTextureCU->getVSPIndex( uiAbsPartIdx + ui); |
---|
543 | pcCU->setVSPIndex( uiAbsPartIdx + ui, vspIdx); |
---|
544 | #endif |
---|
545 | #if MERL_VSP_NBDV_RefVId_Fix_D0166 |
---|
546 | if (pcCU->getSlice()->getIsDepth()) { |
---|
547 | pcCU->setVSPDir( uiAbsPartIdx + ui, 0); |
---|
548 | } |
---|
549 | else { |
---|
550 | Int vspDir = pcTextureCU->getVSPDir( uiAbsPartIdx + ui); |
---|
551 | pcCU->setVSPDir( uiAbsPartIdx + ui, vspDir); |
---|
552 | } |
---|
553 | #endif |
---|
554 | pcCU->setPredictionMode( uiAbsPartIdx + ui, MODE_INTER ); |
---|
555 | pcCU->setPartitionSize( uiAbsPartIdx + ui, SIZE_2Nx2N ); |
---|
556 | pcCU->setDepth( uiAbsPartIdx + ui, uhNewDepth ); |
---|
557 | pcCU->setWidth( uiAbsPartIdx + ui, g_uiMaxCUWidth>>uhNewDepth ); |
---|
558 | pcCU->setHeight( uiAbsPartIdx + ui, g_uiMaxCUHeight>>uhNewDepth ); |
---|
559 | } |
---|
560 | #if LGE_ILLUCOMP_DEPTH_C0046 |
---|
561 | m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
562 | #endif |
---|
563 | if( ( ( uiDepth < pcCU->getDepth( uiAbsPartIdx ) ) && ( uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth ) ) || bBoundary ) |
---|
564 | { |
---|
565 | UInt uiIdx = uiAbsPartIdx; |
---|
566 | if( (g_uiMaxCUWidth>>uiDepth) == pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP()) |
---|
567 | { |
---|
568 | setdQPFlag(true); |
---|
569 | pcCU->setQPSubParts( pcCU->getRefQP(uiAbsPartIdx), uiAbsPartIdx, uiDepth ); // set QP to default QP |
---|
570 | } |
---|
571 | |
---|
572 | for ( UInt uiPartUnitIdx = 0; uiPartUnitIdx < 4; uiPartUnitIdx++ ) |
---|
573 | { |
---|
574 | uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiIdx] ]; |
---|
575 | uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiIdx] ]; |
---|
576 | |
---|
577 | Bool bSubInSlice = pcCU->getSCUAddr()+uiIdx+uiQNumParts>pcSlice->getEntropySliceCurStartCUAddr(); |
---|
578 | if ( bSubInSlice ) |
---|
579 | { |
---|
580 | if ( ( uiLPelX < pcCU->getSlice()->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples() ) ) |
---|
581 | { |
---|
582 | xDecodeCU( pcCU, uiIdx, uiDepth+1, ruiIsLast ); |
---|
583 | } |
---|
584 | else |
---|
585 | { |
---|
586 | pcCU->setOutsideCUPart( uiIdx, uiDepth+1 ); |
---|
587 | } |
---|
588 | } |
---|
589 | if(ruiIsLast) |
---|
590 | { |
---|
591 | break; |
---|
592 | } |
---|
593 | uiIdx += uiQNumParts; |
---|
594 | } |
---|
595 | if( (g_uiMaxCUWidth>>uiDepth) == pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP()) |
---|
596 | { |
---|
597 | if ( getdQPFlag() ) |
---|
598 | { |
---|
599 | UInt uiQPSrcPartIdx; |
---|
600 | if ( pcPic->getCU( pcCU->getAddr() )->getEntropySliceStartCU(uiAbsPartIdx) != pcSlice->getEntropySliceCurStartCUAddr() ) |
---|
601 | { |
---|
602 | uiQPSrcPartIdx = pcSlice->getEntropySliceCurStartCUAddr() % pcPic->getNumPartInCU(); |
---|
603 | } |
---|
604 | else |
---|
605 | { |
---|
606 | uiQPSrcPartIdx = uiAbsPartIdx; |
---|
607 | } |
---|
608 | pcCU->setQPSubParts( pcCU->getRefQP( uiQPSrcPartIdx ), uiAbsPartIdx, uiDepth ); // set QP to default QP |
---|
609 | } |
---|
610 | } |
---|
611 | return; |
---|
612 | } |
---|
613 | } |
---|
614 | } |
---|
615 | |
---|
616 | UInt uiCurrWidth = pcCU->getWidth ( uiAbsPartIdx ); |
---|
617 | UInt uiCurrHeight = pcCU->getHeight( uiAbsPartIdx ); |
---|
618 | #endif |
---|
619 | |
---|
620 | // Coefficient decoding |
---|
621 | Bool bCodeDQP = getdQPFlag(); |
---|
622 | m_pcEntropyDecoder->decodeCoeff( pcCU, uiAbsPartIdx, uiDepth, uiCurrWidth, uiCurrHeight, bCodeDQP ); |
---|
623 | setdQPFlag( bCodeDQP ); |
---|
624 | xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast ); |
---|
625 | } |
---|
626 | |
---|
627 | Void TDecCu::xFinishDecodeCU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt& ruiIsLast) |
---|
628 | { |
---|
629 | if( (g_uiMaxCUWidth>>uiDepth) >= pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP()) |
---|
630 | { |
---|
631 | if( getdQPFlag() ) |
---|
632 | { |
---|
633 | pcCU->setQPSubParts( pcCU->getRefQP(uiAbsPartIdx), uiAbsPartIdx, uiDepth ); // set QP to default QP |
---|
634 | } |
---|
635 | } |
---|
636 | |
---|
637 | if( pcCU->getNumSucIPCM() > 0 ) |
---|
638 | { |
---|
639 | ruiIsLast = 0; |
---|
640 | return; |
---|
641 | } |
---|
642 | |
---|
643 | ruiIsLast = xDecodeSliceEnd( pcCU, uiAbsPartIdx, uiDepth); |
---|
644 | } |
---|
645 | |
---|
646 | Void TDecCu::xDecompressCU( TComDataCU* pcCU, TComDataCU* pcCUCur, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
647 | { |
---|
648 | TComPic* pcPic = pcCU->getPic(); |
---|
649 | |
---|
650 | Bool bBoundary = false; |
---|
651 | UInt uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ]; |
---|
652 | UInt uiRPelX = uiLPelX + (g_uiMaxCUWidth>>uiDepth) - 1; |
---|
653 | UInt uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ]; |
---|
654 | UInt uiBPelY = uiTPelY + (g_uiMaxCUHeight>>uiDepth) - 1; |
---|
655 | |
---|
656 | UInt uiCurNumParts = pcPic->getNumPartInCU() >> (uiDepth<<1); |
---|
657 | TComSlice * pcSlice = pcCU->getPic()->getSlice(pcCU->getPic()->getCurrSliceIdx()); |
---|
658 | Bool bStartInCU = pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts>pcSlice->getEntropySliceCurStartCUAddr()&&pcCU->getSCUAddr()+uiAbsPartIdx<pcSlice->getEntropySliceCurStartCUAddr(); |
---|
659 | if(bStartInCU||( uiRPelX >= pcSlice->getSPS()->getPicWidthInLumaSamples() ) || ( uiBPelY >= pcSlice->getSPS()->getPicHeightInLumaSamples() ) ) |
---|
660 | { |
---|
661 | bBoundary = true; |
---|
662 | } |
---|
663 | |
---|
664 | if( ( ( uiDepth < pcCU->getDepth( uiAbsPartIdx ) ) && ( uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth ) ) || bBoundary ) |
---|
665 | { |
---|
666 | UInt uiNextDepth = uiDepth + 1; |
---|
667 | UInt uiQNumParts = pcCU->getTotalNumPart() >> (uiNextDepth<<1); |
---|
668 | UInt uiIdx = uiAbsPartIdx; |
---|
669 | for ( UInt uiPartIdx = 0; uiPartIdx < 4; uiPartIdx++ ) |
---|
670 | { |
---|
671 | uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiIdx] ]; |
---|
672 | uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiIdx] ]; |
---|
673 | |
---|
674 | Bool binSlice = (pcCU->getSCUAddr()+uiIdx+uiQNumParts>pcSlice->getEntropySliceCurStartCUAddr())&&(pcCU->getSCUAddr()+uiIdx<pcSlice->getEntropySliceCurEndCUAddr()); |
---|
675 | if(binSlice&&( uiLPelX < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcSlice->getSPS()->getPicHeightInLumaSamples() ) ) |
---|
676 | { |
---|
677 | xDecompressCU(pcCU, m_ppcCU[uiNextDepth], uiIdx, uiNextDepth ); |
---|
678 | } |
---|
679 | |
---|
680 | uiIdx += uiQNumParts; |
---|
681 | } |
---|
682 | return; |
---|
683 | } |
---|
684 | |
---|
685 | // Residual reconstruction |
---|
686 | m_ppcYuvResi[uiDepth]->clear(); |
---|
687 | |
---|
688 | m_ppcCU[uiDepth]->copySubCU( pcCU, uiAbsPartIdx, uiDepth ); |
---|
689 | |
---|
690 | switch( m_ppcCU[uiDepth]->getPredictionMode(0) ) |
---|
691 | { |
---|
692 | case MODE_SKIP: |
---|
693 | case MODE_INTER: |
---|
694 | xReconInter( m_ppcCU[uiDepth], uiAbsPartIdx, uiDepth ); |
---|
695 | break; |
---|
696 | case MODE_INTRA: |
---|
697 | #if RWTH_SDC_DLT_B0036 |
---|
698 | if( m_ppcCU[uiDepth]->getSDCFlag(0) ) |
---|
699 | xReconIntraSDC( m_ppcCU[uiDepth], 0, uiDepth ); |
---|
700 | else |
---|
701 | #endif |
---|
702 | xReconIntraQT( m_ppcCU[uiDepth], uiAbsPartIdx, uiDepth ); |
---|
703 | break; |
---|
704 | default: |
---|
705 | assert(0); |
---|
706 | break; |
---|
707 | } |
---|
708 | #if LOSSLESS_CODING |
---|
709 | if ( m_ppcCU[uiDepth]->isLosslessCoded(0) && (m_ppcCU[uiDepth]->getIPCMFlag(0) == false)) |
---|
710 | { |
---|
711 | xFillPCMBuffer(m_ppcCU[uiDepth], uiAbsPartIdx, uiDepth); |
---|
712 | } |
---|
713 | #endif |
---|
714 | |
---|
715 | xCopyToPic( m_ppcCU[uiDepth], pcPic, uiAbsPartIdx, uiDepth ); |
---|
716 | } |
---|
717 | |
---|
718 | Void TDecCu::xReconInter( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
719 | { |
---|
720 | #if HHI_MPI |
---|
721 | #if FIX_MPI_B0065 |
---|
722 | if( pcCU->getTextureModeDepth( 0 ) != -1 ) |
---|
723 | { |
---|
724 | TComDataCU *pcTextureCU = pcCU->getSlice()->getTexturePic()->getCU( pcCU->getAddr() ); |
---|
725 | if( uiDepth == pcTextureCU->getDepth(uiAbsPartIdx)) |
---|
726 | { |
---|
727 | PartSize partSize = pcTextureCU->getPartitionSize(uiAbsPartIdx); |
---|
728 | pcCU->setPartSizeSubParts( partSize, 0, uiDepth ); |
---|
729 | } |
---|
730 | else |
---|
731 | { |
---|
732 | pcCU->setPartSizeSubParts( SIZE_NxN, 0, uiDepth ); |
---|
733 | } |
---|
734 | } |
---|
735 | #else |
---|
736 | if( pcCU->getTextureModeDepth( 0 ) != -1 ) |
---|
737 | pcCU->setPartSizeSubParts( SIZE_NxN, 0, uiDepth ); |
---|
738 | #endif |
---|
739 | #endif |
---|
740 | |
---|
741 | // inter prediction |
---|
742 | #if MERL_VSP_C0152 |
---|
743 | m_pcPrediction->motionCompensation( pcCU, m_ppcYuvReco[uiDepth], uiAbsPartIdx ); |
---|
744 | #else |
---|
745 | m_pcPrediction->motionCompensation( pcCU, m_ppcYuvReco[uiDepth] ); |
---|
746 | #endif |
---|
747 | #if H3D_IVRP & !QC_ARP_D0177 |
---|
748 | if (pcCU->getMergeFlag(0) && pcCU->getMergeIndex(0)==0 && pcCU->getResPredAvail(0)) |
---|
749 | { |
---|
750 | m_pcPrediction->residualPrediction(pcCU, m_ppcYuvReco[uiDepth], m_ppcYuvResPred[uiDepth]); |
---|
751 | } |
---|
752 | #endif |
---|
753 | |
---|
754 | #if HHI_MPI |
---|
755 | if( pcCU->getTextureModeDepth( 0 ) != -1 ) |
---|
756 | pcCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); |
---|
757 | #endif |
---|
758 | |
---|
759 | // inter recon |
---|
760 | xDecodeInterTexture( pcCU, 0, uiDepth ); |
---|
761 | |
---|
762 | // clip for only non-zero cbp case |
---|
763 | if ( ( pcCU->getCbf( 0, TEXT_LUMA ) ) || ( pcCU->getCbf( 0, TEXT_CHROMA_U ) ) || ( pcCU->getCbf(0, TEXT_CHROMA_V ) ) ) |
---|
764 | { |
---|
765 | m_ppcYuvReco[uiDepth]->addClip( m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], 0, pcCU->getWidth( 0 ) ); |
---|
766 | } |
---|
767 | else |
---|
768 | { |
---|
769 | #if H3D_IVRP |
---|
770 | if (pcCU->getMergeFlag(0) && pcCU->getMergeIndex(0)==0 && pcCU->getResPredAvail(0)) |
---|
771 | { |
---|
772 | m_ppcYuvReco[uiDepth]->clip( pcCU->getWidth( 0 ), pcCU->getHeight( 0 ) ); |
---|
773 | } |
---|
774 | #endif |
---|
775 | m_ppcYuvReco[uiDepth]->copyPartToPartYuv( m_ppcYuvReco[uiDepth],0, pcCU->getWidth( 0 ),pcCU->getHeight( 0 )); |
---|
776 | } |
---|
777 | } |
---|
778 | |
---|
779 | Void |
---|
780 | TDecCu::xIntraRecLumaBlk( TComDataCU* pcCU, |
---|
781 | UInt uiTrDepth, |
---|
782 | UInt uiAbsPartIdx, |
---|
783 | TComYuv* pcRecoYuv, |
---|
784 | TComYuv* pcPredYuv, |
---|
785 | TComYuv* pcResiYuv ) |
---|
786 | { |
---|
787 | UInt uiWidth = pcCU ->getWidth ( 0 ) >> uiTrDepth; |
---|
788 | UInt uiHeight = pcCU ->getHeight ( 0 ) >> uiTrDepth; |
---|
789 | UInt uiStride = pcRecoYuv->getStride (); |
---|
790 | Pel* piReco = pcRecoYuv->getLumaAddr( uiAbsPartIdx ); |
---|
791 | Pel* piPred = pcPredYuv->getLumaAddr( uiAbsPartIdx ); |
---|
792 | Pel* piResi = pcResiYuv->getLumaAddr( uiAbsPartIdx ); |
---|
793 | |
---|
794 | UInt uiNumCoeffInc = ( pcCU->getSlice()->getSPS()->getMaxCUWidth() * pcCU->getSlice()->getSPS()->getMaxCUHeight() ) >> ( pcCU->getSlice()->getSPS()->getMaxCUDepth() << 1 ); |
---|
795 | TCoeff* pcCoeff = pcCU->getCoeffY() + ( uiNumCoeffInc * uiAbsPartIdx ); |
---|
796 | |
---|
797 | UInt uiLumaPredMode = pcCU->getLumaIntraDir ( uiAbsPartIdx ); |
---|
798 | |
---|
799 | UInt uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx; |
---|
800 | Pel* piRecIPred = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder ); |
---|
801 | UInt uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride (); |
---|
802 | |
---|
803 | //===== init availability pattern ===== |
---|
804 | Bool bAboveAvail = false; |
---|
805 | Bool bLeftAvail = false; |
---|
806 | pcCU->getPattern()->initPattern ( pcCU, uiTrDepth, uiAbsPartIdx ); |
---|
807 | pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, uiTrDepth, |
---|
808 | m_pcPrediction->getPredicBuf (), |
---|
809 | m_pcPrediction->getPredicBufWidth (), |
---|
810 | m_pcPrediction->getPredicBufHeight (), |
---|
811 | bAboveAvail, bLeftAvail ); |
---|
812 | #if LGE_EDGE_INTRA_A0070 |
---|
813 | if( uiLumaPredMode >= EDGE_INTRA_IDX ) |
---|
814 | { |
---|
815 | m_pcPrediction->predIntraLumaEdge( pcCU, pcCU->getPattern(), uiAbsPartIdx, uiWidth, uiHeight, piPred, uiStride |
---|
816 | #if LGE_EDGE_INTRA_DELTA_DC |
---|
817 | , uiLumaPredMode == EDGE_INTRA_DELTA_IDX |
---|
818 | #endif |
---|
819 | ); |
---|
820 | } |
---|
821 | else |
---|
822 | #endif |
---|
823 | |
---|
824 | //===== get prediction signal ===== |
---|
825 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
826 | if( uiLumaPredMode >= NUM_INTRA_MODE ) |
---|
827 | { |
---|
828 | m_pcPrediction->predIntraLumaDMM( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail, false ); |
---|
829 | } |
---|
830 | else |
---|
831 | { |
---|
832 | #endif |
---|
833 | m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, pcCU, bAboveAvail, bLeftAvail ); |
---|
834 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
835 | } |
---|
836 | #endif |
---|
837 | |
---|
838 | //===== inverse transform ===== |
---|
839 | m_pcTrQuant->setQPforQuant ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 ); |
---|
840 | |
---|
841 | Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)TEXT_LUMA]; |
---|
842 | assert(scalingListType < 6); |
---|
843 | #if LOSSLESS_CODING |
---|
844 | m_pcTrQuant->invtransformNxN( pcCU, TEXT_LUMA, pcCU->getLumaIntraDir( uiAbsPartIdx ), piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType ); |
---|
845 | #else |
---|
846 | m_pcTrQuant->invtransformNxN( TEXT_LUMA, pcCU->getLumaIntraDir( uiAbsPartIdx ), piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType ); |
---|
847 | #endif |
---|
848 | |
---|
849 | |
---|
850 | //===== reconstruction ===== |
---|
851 | Pel* pPred = piPred; |
---|
852 | Pel* pResi = piResi; |
---|
853 | Pel* pReco = piReco; |
---|
854 | Pel* pRecIPred = piRecIPred; |
---|
855 | for( UInt uiY = 0; uiY < uiHeight; uiY++ ) |
---|
856 | { |
---|
857 | for( UInt uiX = 0; uiX < uiWidth; uiX++ ) |
---|
858 | { |
---|
859 | pReco [ uiX ] = Clip( pPred[ uiX ] + pResi[ uiX ] ); |
---|
860 | pRecIPred[ uiX ] = pReco[ uiX ]; |
---|
861 | } |
---|
862 | pPred += uiStride; |
---|
863 | pResi += uiStride; |
---|
864 | pReco += uiStride; |
---|
865 | pRecIPred += uiRecIPredStride; |
---|
866 | } |
---|
867 | } |
---|
868 | |
---|
869 | |
---|
870 | Void |
---|
871 | TDecCu::xIntraRecChromaBlk( TComDataCU* pcCU, |
---|
872 | UInt uiTrDepth, |
---|
873 | UInt uiAbsPartIdx, |
---|
874 | TComYuv* pcRecoYuv, |
---|
875 | TComYuv* pcPredYuv, |
---|
876 | TComYuv* pcResiYuv, |
---|
877 | UInt uiChromaId ) |
---|
878 | { |
---|
879 | UInt uiFullDepth = pcCU->getDepth( 0 ) + uiTrDepth; |
---|
880 | UInt uiLog2TrSize = g_aucConvertToBit[ pcCU->getSlice()->getSPS()->getMaxCUWidth() >> uiFullDepth ] + 2; |
---|
881 | |
---|
882 | if( uiLog2TrSize == 2 ) |
---|
883 | { |
---|
884 | assert( uiTrDepth > 0 ); |
---|
885 | uiTrDepth--; |
---|
886 | UInt uiQPDiv = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth( 0 ) + uiTrDepth ) << 1 ); |
---|
887 | Bool bFirstQ = ( ( uiAbsPartIdx % uiQPDiv ) == 0 ); |
---|
888 | if( !bFirstQ ) |
---|
889 | { |
---|
890 | return; |
---|
891 | } |
---|
892 | } |
---|
893 | |
---|
894 | TextType eText = ( uiChromaId > 0 ? TEXT_CHROMA_V : TEXT_CHROMA_U ); |
---|
895 | UInt uiWidth = pcCU ->getWidth ( 0 ) >> ( uiTrDepth + 1 ); |
---|
896 | UInt uiHeight = pcCU ->getHeight ( 0 ) >> ( uiTrDepth + 1 ); |
---|
897 | UInt uiStride = pcRecoYuv->getCStride (); |
---|
898 | Pel* piReco = ( uiChromaId > 0 ? pcRecoYuv->getCrAddr( uiAbsPartIdx ) : pcRecoYuv->getCbAddr( uiAbsPartIdx ) ); |
---|
899 | Pel* piPred = ( uiChromaId > 0 ? pcPredYuv->getCrAddr( uiAbsPartIdx ) : pcPredYuv->getCbAddr( uiAbsPartIdx ) ); |
---|
900 | Pel* piResi = ( uiChromaId > 0 ? pcResiYuv->getCrAddr( uiAbsPartIdx ) : pcResiYuv->getCbAddr( uiAbsPartIdx ) ); |
---|
901 | |
---|
902 | UInt uiNumCoeffInc = ( ( pcCU->getSlice()->getSPS()->getMaxCUWidth() * pcCU->getSlice()->getSPS()->getMaxCUHeight() ) >> ( pcCU->getSlice()->getSPS()->getMaxCUDepth() << 1 ) ) >> 2; |
---|
903 | TCoeff* pcCoeff = ( uiChromaId > 0 ? pcCU->getCoeffCr() : pcCU->getCoeffCb() ) + ( uiNumCoeffInc * uiAbsPartIdx ); |
---|
904 | |
---|
905 | UInt uiChromaPredMode = pcCU->getChromaIntraDir( 0 ); |
---|
906 | |
---|
907 | UInt uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx; |
---|
908 | Pel* piRecIPred = ( uiChromaId > 0 ? pcCU->getPic()->getPicYuvRec()->getCrAddr( pcCU->getAddr(), uiZOrder ) : pcCU->getPic()->getPicYuvRec()->getCbAddr( pcCU->getAddr(), uiZOrder ) ); |
---|
909 | UInt uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getCStride(); |
---|
910 | |
---|
911 | //===== init availability pattern ===== |
---|
912 | Bool bAboveAvail = false; |
---|
913 | Bool bLeftAvail = false; |
---|
914 | pcCU->getPattern()->initPattern ( pcCU, uiTrDepth, uiAbsPartIdx ); |
---|
915 | |
---|
916 | if( uiChromaPredMode == LM_CHROMA_IDX && uiChromaId == 0 ) |
---|
917 | { |
---|
918 | pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, uiTrDepth, |
---|
919 | m_pcPrediction->getPredicBuf (), |
---|
920 | m_pcPrediction->getPredicBufWidth (), |
---|
921 | m_pcPrediction->getPredicBufHeight (), |
---|
922 | bAboveAvail, bLeftAvail, |
---|
923 | true ); |
---|
924 | |
---|
925 | m_pcPrediction->getLumaRecPixels( pcCU->getPattern(), uiWidth, uiHeight ); |
---|
926 | } |
---|
927 | |
---|
928 | pcCU->getPattern()->initAdiPatternChroma( pcCU, uiAbsPartIdx, uiTrDepth, |
---|
929 | m_pcPrediction->getPredicBuf (), |
---|
930 | m_pcPrediction->getPredicBufWidth (), |
---|
931 | m_pcPrediction->getPredicBufHeight (), |
---|
932 | bAboveAvail, bLeftAvail ); |
---|
933 | Int* pPatChroma = ( uiChromaId > 0 ? pcCU->getPattern()->getAdiCrBuf( uiWidth, uiHeight, m_pcPrediction->getPredicBuf() ) : pcCU->getPattern()->getAdiCbBuf( uiWidth, uiHeight, m_pcPrediction->getPredicBuf() ) ); |
---|
934 | |
---|
935 | //===== get prediction signal ===== |
---|
936 | if( uiChromaPredMode == LM_CHROMA_IDX ) |
---|
937 | { |
---|
938 | m_pcPrediction->predLMIntraChroma( pcCU->getPattern(), pPatChroma, piPred, uiStride, uiWidth, uiHeight, uiChromaId ); |
---|
939 | } |
---|
940 | else |
---|
941 | { |
---|
942 | if( uiChromaPredMode == DM_CHROMA_IDX ) |
---|
943 | { |
---|
944 | uiChromaPredMode = pcCU->getLumaIntraDir( 0 ); |
---|
945 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
946 | mapDMMtoIntraMode( uiChromaPredMode ); |
---|
947 | #endif |
---|
948 | } |
---|
949 | m_pcPrediction->predIntraChromaAng( pcCU->getPattern(), pPatChroma, uiChromaPredMode, piPred, uiStride, uiWidth, uiHeight, pcCU, bAboveAvail, bLeftAvail ); |
---|
950 | } |
---|
951 | |
---|
952 | //===== inverse transform ===== |
---|
953 | if(eText == TEXT_CHROMA_U) |
---|
954 | { |
---|
955 | m_pcTrQuant->setQPforQuant ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), eText, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset() ); |
---|
956 | } |
---|
957 | else |
---|
958 | { |
---|
959 | m_pcTrQuant->setQPforQuant ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), eText, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset2nd() ); |
---|
960 | } |
---|
961 | |
---|
962 | Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)eText]; |
---|
963 | assert(scalingListType < 6); |
---|
964 | #if LOSSLESS_CODING |
---|
965 | m_pcTrQuant->invtransformNxN( pcCU, eText, REG_DCT, piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType ); |
---|
966 | #else |
---|
967 | m_pcTrQuant->invtransformNxN( eText, REG_DCT, piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType ); |
---|
968 | #endif |
---|
969 | |
---|
970 | //===== reconstruction ===== |
---|
971 | Pel* pPred = piPred; |
---|
972 | Pel* pResi = piResi; |
---|
973 | Pel* pReco = piReco; |
---|
974 | Pel* pRecIPred = piRecIPred; |
---|
975 | for( UInt uiY = 0; uiY < uiHeight; uiY++ ) |
---|
976 | { |
---|
977 | for( UInt uiX = 0; uiX < uiWidth; uiX++ ) |
---|
978 | { |
---|
979 | pReco [ uiX ] = Clip( pPred[ uiX ] + pResi[ uiX ] ); |
---|
980 | pRecIPred[ uiX ] = pReco[ uiX ]; |
---|
981 | } |
---|
982 | pPred += uiStride; |
---|
983 | pResi += uiStride; |
---|
984 | pReco += uiStride; |
---|
985 | pRecIPred += uiRecIPredStride; |
---|
986 | } |
---|
987 | } |
---|
988 | |
---|
989 | Void |
---|
990 | TDecCu::xIntraRecQT( TComDataCU* pcCU, |
---|
991 | UInt uiTrDepth, |
---|
992 | UInt uiAbsPartIdx, |
---|
993 | TComYuv* pcRecoYuv, |
---|
994 | TComYuv* pcPredYuv, |
---|
995 | TComYuv* pcResiYuv ) |
---|
996 | { |
---|
997 | UInt uiFullDepth = pcCU->getDepth(0) + uiTrDepth; |
---|
998 | UInt uiTrMode = pcCU->getTransformIdx( uiAbsPartIdx ); |
---|
999 | if( uiTrMode == uiTrDepth ) |
---|
1000 | { |
---|
1001 | xIntraRecLumaBlk ( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv ); |
---|
1002 | xIntraRecChromaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv, 0 ); |
---|
1003 | xIntraRecChromaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv, 1 ); |
---|
1004 | } |
---|
1005 | else |
---|
1006 | { |
---|
1007 | UInt uiNumQPart = pcCU->getPic()->getNumPartInCU() >> ( ( uiFullDepth + 1 ) << 1 ); |
---|
1008 | for( UInt uiPart = 0; uiPart < 4; uiPart++ ) |
---|
1009 | { |
---|
1010 | xIntraRecQT( pcCU, uiTrDepth + 1, uiAbsPartIdx + uiPart * uiNumQPart, pcRecoYuv, pcPredYuv, pcResiYuv ); |
---|
1011 | } |
---|
1012 | } |
---|
1013 | } |
---|
1014 | |
---|
1015 | Void |
---|
1016 | TDecCu::xReconIntraQT( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
1017 | { |
---|
1018 | UInt uiInitTrDepth = ( pcCU->getPartitionSize(0) == SIZE_2Nx2N ? 0 : 1 ); |
---|
1019 | UInt uiNumPart = pcCU->getNumPartInter(); |
---|
1020 | UInt uiNumQParts = pcCU->getTotalNumPart() >> 2; |
---|
1021 | |
---|
1022 | if (pcCU->getIPCMFlag(0)) |
---|
1023 | { |
---|
1024 | xReconPCM( pcCU, uiAbsPartIdx, uiDepth ); |
---|
1025 | return; |
---|
1026 | } |
---|
1027 | |
---|
1028 | for( UInt uiPU = 0; uiPU < uiNumPart; uiPU++ ) |
---|
1029 | { |
---|
1030 | xIntraLumaRecQT( pcCU, uiInitTrDepth, uiPU * uiNumQParts, m_ppcYuvReco[uiDepth], m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth] ); |
---|
1031 | } |
---|
1032 | |
---|
1033 | for( UInt uiPU = 0; uiPU < uiNumPart; uiPU++ ) |
---|
1034 | { |
---|
1035 | xIntraChromaRecQT( pcCU, uiInitTrDepth, uiPU * uiNumQParts, m_ppcYuvReco[uiDepth], m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth] ); |
---|
1036 | } |
---|
1037 | |
---|
1038 | } |
---|
1039 | |
---|
1040 | #if RWTH_SDC_DLT_B0036 |
---|
1041 | Void TDecCu::xReconIntraSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
1042 | { |
---|
1043 | UInt uiWidth = pcCU->getWidth ( 0 ); |
---|
1044 | UInt uiHeight = pcCU->getHeight ( 0 ); |
---|
1045 | |
---|
1046 | TComYuv* pcRecoYuv = m_ppcYuvReco[uiDepth]; |
---|
1047 | TComYuv* pcPredYuv = m_ppcYuvReco[uiDepth]; |
---|
1048 | TComYuv* pcResiYuv = m_ppcYuvResi[uiDepth]; |
---|
1049 | |
---|
1050 | UInt uiStride = pcRecoYuv->getStride (); |
---|
1051 | Pel* piReco = pcRecoYuv->getLumaAddr( uiAbsPartIdx ); |
---|
1052 | Pel* piPred = pcPredYuv->getLumaAddr( uiAbsPartIdx ); |
---|
1053 | Pel* piResi = pcResiYuv->getLumaAddr( uiAbsPartIdx ); |
---|
1054 | |
---|
1055 | UInt uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx; |
---|
1056 | Pel* piRecIPred = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder ); |
---|
1057 | UInt uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride (); |
---|
1058 | |
---|
1059 | UInt uiLumaPredMode = pcCU->getLumaIntraDir ( uiAbsPartIdx ); |
---|
1060 | |
---|
1061 | AOF( uiWidth == uiHeight ); |
---|
1062 | AOF( uiAbsPartIdx == 0 ); |
---|
1063 | AOF( pcCU->getSDCAvailable(uiAbsPartIdx) ); |
---|
1064 | AOF( pcCU->getSDCFlag(uiAbsPartIdx) ); |
---|
1065 | |
---|
1066 | //===== init availability pattern ===== |
---|
1067 | Bool bAboveAvail = false; |
---|
1068 | Bool bLeftAvail = false; |
---|
1069 | pcCU->getPattern()->initPattern ( pcCU, 0, uiAbsPartIdx ); |
---|
1070 | pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, 0, m_pcPrediction->getPredicBuf(), m_pcPrediction->getPredicBufWidth(), m_pcPrediction->getPredicBufHeight(), bAboveAvail, bLeftAvail ); |
---|
1071 | |
---|
1072 | //===== get prediction signal ===== |
---|
1073 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
1074 | if( uiLumaPredMode >= NUM_INTRA_MODE ) |
---|
1075 | { |
---|
1076 | m_pcPrediction->predIntraLumaDMM( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail, false ); |
---|
1077 | } |
---|
1078 | else |
---|
1079 | { |
---|
1080 | #endif |
---|
1081 | m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, pcCU, bAboveAvail, bLeftAvail ); |
---|
1082 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
1083 | } |
---|
1084 | #endif |
---|
1085 | |
---|
1086 | // number of segments depends on prediction mode |
---|
1087 | UInt uiNumSegments = 1; |
---|
1088 | Bool* pbMask = NULL; |
---|
1089 | UInt uiMaskStride = 0; |
---|
1090 | |
---|
1091 | if( uiLumaPredMode == DMM_WEDGE_FULL_IDX || uiLumaPredMode == DMM_WEDGE_PREDDIR_IDX ) |
---|
1092 | { |
---|
1093 | Int uiTabIdx = (uiLumaPredMode == DMM_WEDGE_FULL_IDX)?pcCU->getWedgeFullTabIdx(uiAbsPartIdx):pcCU->getWedgePredDirTabIdx(uiAbsPartIdx); |
---|
1094 | |
---|
1095 | WedgeList* pacWedgeList = &g_aacWedgeLists[(g_aucConvertToBit[uiWidth])]; |
---|
1096 | TComWedgelet* pcWedgelet = &(pacWedgeList->at( uiTabIdx )); |
---|
1097 | |
---|
1098 | uiNumSegments = 2; |
---|
1099 | pbMask = pcWedgelet->getPattern(); |
---|
1100 | uiMaskStride = pcWedgelet->getStride(); |
---|
1101 | } |
---|
1102 | |
---|
1103 | // get DC prediction for each segment |
---|
1104 | Pel apDCPredValues[2]; |
---|
1105 | xAnalyzeSegmentsSDC(piPred, uiStride, uiWidth, apDCPredValues, uiNumSegments, pbMask, uiMaskStride); |
---|
1106 | |
---|
1107 | // reconstruct residual based on mask + DC residuals |
---|
1108 | Pel apDCResiValues[2]; |
---|
1109 | #if !MERL_General_Fix |
---|
1110 | Pel apDCRecoValues[2]; |
---|
1111 | #endif |
---|
1112 | for( UInt ui = 0; ui < uiNumSegments; ui++ ) |
---|
1113 | { |
---|
1114 | Pel pPredIdx = GetDepthValue2Idx( apDCPredValues[ui] ); |
---|
1115 | Pel pResiIdx = pcCU->getSDCSegmentDCOffset(ui, uiAbsPartIdx); |
---|
1116 | Pel pRecoValue = GetIdx2DepthValue( pPredIdx + pResiIdx ); |
---|
1117 | |
---|
1118 | #if !MERL_General_Fix |
---|
1119 | apDCRecoValues[ui] = pRecoValue; |
---|
1120 | #endif |
---|
1121 | apDCResiValues[ui] = pRecoValue - apDCPredValues[ui]; |
---|
1122 | } |
---|
1123 | |
---|
1124 | //===== reconstruction ===== |
---|
1125 | Bool*pMask = pbMask; |
---|
1126 | Pel* pPred = piPred; |
---|
1127 | Pel* pResi = piResi; |
---|
1128 | Pel* pReco = piReco; |
---|
1129 | Pel* pRecIPred = piRecIPred; |
---|
1130 | |
---|
1131 | for( UInt uiY = 0; uiY < uiHeight; uiY++ ) |
---|
1132 | { |
---|
1133 | for( UInt uiX = 0; uiX < uiWidth; uiX++ ) |
---|
1134 | { |
---|
1135 | UChar ucSegment = pMask?(UChar)pMask[uiX]:0; |
---|
1136 | assert( ucSegment < uiNumSegments ); |
---|
1137 | |
---|
1138 | Pel pPredVal= apDCPredValues[ucSegment]; |
---|
1139 | Pel pResiDC = apDCResiValues[ucSegment]; |
---|
1140 | |
---|
1141 | pReco [ uiX ] = Clip( pPredVal + pResiDC ); |
---|
1142 | pRecIPred[ uiX ] = pReco[ uiX ]; |
---|
1143 | } |
---|
1144 | pPred += uiStride; |
---|
1145 | pResi += uiStride; |
---|
1146 | pReco += uiStride; |
---|
1147 | pRecIPred += uiRecIPredStride; |
---|
1148 | pMask += uiMaskStride; |
---|
1149 | } |
---|
1150 | |
---|
1151 | // clear UV |
---|
1152 | UInt uiStrideC = pcPredYuv->getCStride(); |
---|
1153 | Pel *pRecCb = pcPredYuv->getCbAddr(); |
---|
1154 | Pel *pRecCr = pcPredYuv->getCrAddr(); |
---|
1155 | |
---|
1156 | for (Int y=0; y<uiHeight/2; y++) |
---|
1157 | { |
---|
1158 | for (Int x=0; x<uiWidth/2; x++) |
---|
1159 | { |
---|
1160 | pRecCb[x] = (Pel)(128<<g_uiBitIncrement); |
---|
1161 | pRecCr[x] = (Pel)(128<<g_uiBitIncrement); |
---|
1162 | } |
---|
1163 | |
---|
1164 | pRecCb += uiStrideC; |
---|
1165 | pRecCr += uiStrideC; |
---|
1166 | } |
---|
1167 | } |
---|
1168 | #endif |
---|
1169 | |
---|
1170 | /** Function for deriving recontructed PU/CU Luma sample with QTree structure |
---|
1171 | * \param pcCU pointer of current CU |
---|
1172 | * \param uiTrDepth current tranform split depth |
---|
1173 | * \param uiAbsPartIdx part index |
---|
1174 | * \param pcRecoYuv pointer to reconstructed sample arrays |
---|
1175 | * \param pcPredYuv pointer to prediction sample arrays |
---|
1176 | * \param pcResiYuv pointer to residue sample arrays |
---|
1177 | * |
---|
1178 | \ This function dervies recontructed PU/CU Luma sample with recursive QTree structure |
---|
1179 | */ |
---|
1180 | Void |
---|
1181 | TDecCu::xIntraLumaRecQT( TComDataCU* pcCU, |
---|
1182 | UInt uiTrDepth, |
---|
1183 | UInt uiAbsPartIdx, |
---|
1184 | TComYuv* pcRecoYuv, |
---|
1185 | TComYuv* pcPredYuv, |
---|
1186 | TComYuv* pcResiYuv ) |
---|
1187 | { |
---|
1188 | UInt uiFullDepth = pcCU->getDepth(0) + uiTrDepth; |
---|
1189 | UInt uiTrMode = pcCU->getTransformIdx( uiAbsPartIdx ); |
---|
1190 | if( uiTrMode == uiTrDepth ) |
---|
1191 | { |
---|
1192 | xIntraRecLumaBlk ( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv ); |
---|
1193 | } |
---|
1194 | else |
---|
1195 | { |
---|
1196 | UInt uiNumQPart = pcCU->getPic()->getNumPartInCU() >> ( ( uiFullDepth + 1 ) << 1 ); |
---|
1197 | for( UInt uiPart = 0; uiPart < 4; uiPart++ ) |
---|
1198 | { |
---|
1199 | xIntraLumaRecQT( pcCU, uiTrDepth + 1, uiAbsPartIdx + uiPart * uiNumQPart, pcRecoYuv, pcPredYuv, pcResiYuv ); |
---|
1200 | } |
---|
1201 | } |
---|
1202 | } |
---|
1203 | |
---|
1204 | /** Function for deriving recontructed PU/CU chroma samples with QTree structure |
---|
1205 | * \param pcCU pointer of current CU |
---|
1206 | * \param uiTrDepth current tranform split depth |
---|
1207 | * \param uiAbsPartIdx part index |
---|
1208 | * \param pcRecoYuv pointer to reconstructed sample arrays |
---|
1209 | * \param pcPredYuv pointer to prediction sample arrays |
---|
1210 | * \param pcResiYuv pointer to residue sample arrays |
---|
1211 | * |
---|
1212 | \ This function dervies recontructed PU/CU chroma samples with QTree recursive structure |
---|
1213 | */ |
---|
1214 | Void |
---|
1215 | TDecCu::xIntraChromaRecQT( TComDataCU* pcCU, |
---|
1216 | UInt uiTrDepth, |
---|
1217 | UInt uiAbsPartIdx, |
---|
1218 | TComYuv* pcRecoYuv, |
---|
1219 | TComYuv* pcPredYuv, |
---|
1220 | TComYuv* pcResiYuv ) |
---|
1221 | { |
---|
1222 | UInt uiFullDepth = pcCU->getDepth(0) + uiTrDepth; |
---|
1223 | UInt uiTrMode = pcCU->getTransformIdx( uiAbsPartIdx ); |
---|
1224 | if( uiTrMode == uiTrDepth ) |
---|
1225 | { |
---|
1226 | xIntraRecChromaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv, 0 ); |
---|
1227 | xIntraRecChromaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv, 1 ); |
---|
1228 | } |
---|
1229 | else |
---|
1230 | { |
---|
1231 | UInt uiNumQPart = pcCU->getPic()->getNumPartInCU() >> ( ( uiFullDepth + 1 ) << 1 ); |
---|
1232 | for( UInt uiPart = 0; uiPart < 4; uiPart++ ) |
---|
1233 | { |
---|
1234 | xIntraChromaRecQT( pcCU, uiTrDepth + 1, uiAbsPartIdx + uiPart * uiNumQPart, pcRecoYuv, pcPredYuv, pcResiYuv ); |
---|
1235 | } |
---|
1236 | } |
---|
1237 | } |
---|
1238 | |
---|
1239 | Void TDecCu::xCopyToPic( TComDataCU* pcCU, TComPic* pcPic, UInt uiZorderIdx, UInt uiDepth ) |
---|
1240 | { |
---|
1241 | UInt uiCUAddr = pcCU->getAddr(); |
---|
1242 | |
---|
1243 | m_ppcYuvReco[uiDepth]->copyToPicYuv ( pcPic->getPicYuvRec (), uiCUAddr, uiZorderIdx ); |
---|
1244 | |
---|
1245 | return; |
---|
1246 | } |
---|
1247 | |
---|
1248 | Void TDecCu::xDecodeInterTexture ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
1249 | { |
---|
1250 | UInt uiWidth = pcCU->getWidth ( uiAbsPartIdx ); |
---|
1251 | UInt uiHeight = pcCU->getHeight( uiAbsPartIdx ); |
---|
1252 | TCoeff* piCoeff; |
---|
1253 | |
---|
1254 | Pel* pResi; |
---|
1255 | UInt uiLumaTrMode, uiChromaTrMode; |
---|
1256 | |
---|
1257 | pcCU->convertTransIdx( uiAbsPartIdx, pcCU->getTransformIdx( uiAbsPartIdx ), uiLumaTrMode, uiChromaTrMode ); |
---|
1258 | |
---|
1259 | // Y |
---|
1260 | piCoeff = pcCU->getCoeffY(); |
---|
1261 | pResi = m_ppcYuvResi[uiDepth]->getLumaAddr(); |
---|
1262 | |
---|
1263 | m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 ); |
---|
1264 | |
---|
1265 | m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_LUMA, pResi, 0, m_ppcYuvResi[uiDepth]->getStride(), uiWidth, uiHeight, uiLumaTrMode, 0, piCoeff ); |
---|
1266 | |
---|
1267 | // Cb and Cr |
---|
1268 | m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset() ); |
---|
1269 | |
---|
1270 | uiWidth >>= 1; |
---|
1271 | uiHeight >>= 1; |
---|
1272 | piCoeff = pcCU->getCoeffCb(); pResi = m_ppcYuvResi[uiDepth]->getCbAddr(); |
---|
1273 | m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_U, pResi, 0, m_ppcYuvResi[uiDepth]->getCStride(), uiWidth, uiHeight, uiChromaTrMode, 0, piCoeff ); |
---|
1274 | |
---|
1275 | m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset2nd() ); |
---|
1276 | |
---|
1277 | piCoeff = pcCU->getCoeffCr(); pResi = m_ppcYuvResi[uiDepth]->getCrAddr(); |
---|
1278 | m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_V, pResi, 0, m_ppcYuvResi[uiDepth]->getCStride(), uiWidth, uiHeight, uiChromaTrMode, 0, piCoeff ); |
---|
1279 | } |
---|
1280 | |
---|
1281 | /** Function for deriving reconstructed luma/chroma samples of a PCM mode CU. |
---|
1282 | * \param pcCU pointer to current CU |
---|
1283 | * \param uiPartIdx part index |
---|
1284 | * \param piPCM pointer to PCM code arrays |
---|
1285 | * \param piReco pointer to reconstructed sample arrays |
---|
1286 | * \param uiStride stride of reconstructed sample arrays |
---|
1287 | * \param uiWidth CU width |
---|
1288 | * \param uiHeight CU height |
---|
1289 | * \param ttText texture component type |
---|
1290 | * \returns Void |
---|
1291 | */ |
---|
1292 | Void TDecCu::xDecodePCMTexture( TComDataCU* pcCU, UInt uiPartIdx, Pel *piPCM, Pel* piReco, UInt uiStride, UInt uiWidth, UInt uiHeight, TextType ttText) |
---|
1293 | { |
---|
1294 | UInt uiX, uiY; |
---|
1295 | Pel* piPicReco; |
---|
1296 | UInt uiPicStride; |
---|
1297 | UInt uiPcmLeftShiftBit; |
---|
1298 | |
---|
1299 | if( ttText == TEXT_LUMA ) |
---|
1300 | { |
---|
1301 | uiPicStride = pcCU->getPic()->getPicYuvRec()->getStride(); |
---|
1302 | piPicReco = pcCU->getPic()->getPicYuvRec()->getLumaAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiPartIdx); |
---|
1303 | uiPcmLeftShiftBit = g_uiBitDepth + g_uiBitIncrement - pcCU->getSlice()->getSPS()->getPCMBitDepthLuma(); |
---|
1304 | } |
---|
1305 | else |
---|
1306 | { |
---|
1307 | uiPicStride = pcCU->getPic()->getPicYuvRec()->getCStride(); |
---|
1308 | |
---|
1309 | if( ttText == TEXT_CHROMA_U ) |
---|
1310 | { |
---|
1311 | piPicReco = pcCU->getPic()->getPicYuvRec()->getCbAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiPartIdx); |
---|
1312 | } |
---|
1313 | else |
---|
1314 | { |
---|
1315 | piPicReco = pcCU->getPic()->getPicYuvRec()->getCrAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiPartIdx); |
---|
1316 | } |
---|
1317 | uiPcmLeftShiftBit = g_uiBitDepth + g_uiBitIncrement - pcCU->getSlice()->getSPS()->getPCMBitDepthChroma(); |
---|
1318 | } |
---|
1319 | |
---|
1320 | for( uiY = 0; uiY < uiHeight; uiY++ ) |
---|
1321 | { |
---|
1322 | for( uiX = 0; uiX < uiWidth; uiX++ ) |
---|
1323 | { |
---|
1324 | piReco[uiX] = (piPCM[uiX] << uiPcmLeftShiftBit); |
---|
1325 | piPicReco[uiX] = piReco[uiX]; |
---|
1326 | } |
---|
1327 | piPCM += uiWidth; |
---|
1328 | piReco += uiStride; |
---|
1329 | piPicReco += uiPicStride; |
---|
1330 | } |
---|
1331 | } |
---|
1332 | |
---|
1333 | /** Function for reconstructing a PCM mode CU. |
---|
1334 | * \param pcCU pointer to current CU |
---|
1335 | * \param uiAbsPartIdx CU index |
---|
1336 | * \param uiDepth CU Depth |
---|
1337 | * \returns Void |
---|
1338 | */ |
---|
1339 | Void TDecCu::xReconPCM( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
1340 | { |
---|
1341 | // Luma |
---|
1342 | UInt uiWidth = (g_uiMaxCUWidth >> uiDepth); |
---|
1343 | UInt uiHeight = (g_uiMaxCUHeight >> uiDepth); |
---|
1344 | |
---|
1345 | Pel* piPcmY = pcCU->getPCMSampleY(); |
---|
1346 | Pel* piRecoY = m_ppcYuvReco[uiDepth]->getLumaAddr(0, uiWidth); |
---|
1347 | |
---|
1348 | UInt uiStride = m_ppcYuvResi[uiDepth]->getStride(); |
---|
1349 | |
---|
1350 | xDecodePCMTexture( pcCU, 0, piPcmY, piRecoY, uiStride, uiWidth, uiHeight, TEXT_LUMA); |
---|
1351 | |
---|
1352 | // Cb and Cr |
---|
1353 | UInt uiCWidth = (uiWidth>>1); |
---|
1354 | UInt uiCHeight = (uiHeight>>1); |
---|
1355 | |
---|
1356 | Pel* piPcmCb = pcCU->getPCMSampleCb(); |
---|
1357 | Pel* piPcmCr = pcCU->getPCMSampleCr(); |
---|
1358 | Pel* pRecoCb = m_ppcYuvReco[uiDepth]->getCbAddr(); |
---|
1359 | Pel* pRecoCr = m_ppcYuvReco[uiDepth]->getCrAddr(); |
---|
1360 | |
---|
1361 | UInt uiCStride = m_ppcYuvReco[uiDepth]->getCStride(); |
---|
1362 | |
---|
1363 | xDecodePCMTexture( pcCU, 0, piPcmCb, pRecoCb, uiCStride, uiCWidth, uiCHeight, TEXT_CHROMA_U); |
---|
1364 | xDecodePCMTexture( pcCU, 0, piPcmCr, pRecoCr, uiCStride, uiCWidth, uiCHeight, TEXT_CHROMA_V); |
---|
1365 | } |
---|
1366 | |
---|
1367 | #if LOSSLESS_CODING |
---|
1368 | /** Function for filling the PCM buffer of a CU using its reconstructed sample array |
---|
1369 | * \param pcCU pointer to current CU |
---|
1370 | * \param uiAbsPartIdx CU index |
---|
1371 | * \param uiDepth CU Depth |
---|
1372 | * \returns Void |
---|
1373 | */ |
---|
1374 | Void TDecCu::xFillPCMBuffer(TComDataCU* pCU, UInt absPartIdx, UInt depth) |
---|
1375 | { |
---|
1376 | // Luma |
---|
1377 | UInt width = (g_uiMaxCUWidth >> depth); |
---|
1378 | UInt height = (g_uiMaxCUHeight >> depth); |
---|
1379 | |
---|
1380 | Pel* pPcmY = pCU->getPCMSampleY(); |
---|
1381 | Pel* pRecoY = m_ppcYuvReco[depth]->getLumaAddr(0, width); |
---|
1382 | |
---|
1383 | UInt stride = m_ppcYuvReco[depth]->getStride(); |
---|
1384 | |
---|
1385 | for(Int y = 0; y < height; y++ ) |
---|
1386 | { |
---|
1387 | for(Int x = 0; x < width; x++ ) |
---|
1388 | { |
---|
1389 | pPcmY[x] = pRecoY[x]; |
---|
1390 | } |
---|
1391 | pPcmY += width; |
---|
1392 | pRecoY += stride; |
---|
1393 | } |
---|
1394 | |
---|
1395 | // Cb and Cr |
---|
1396 | UInt widthC = (width>>1); |
---|
1397 | UInt heightC = (height>>1); |
---|
1398 | |
---|
1399 | Pel* pPcmCb = pCU->getPCMSampleCb(); |
---|
1400 | Pel* pPcmCr = pCU->getPCMSampleCr(); |
---|
1401 | Pel* pRecoCb = m_ppcYuvReco[depth]->getCbAddr(); |
---|
1402 | Pel* pRecoCr = m_ppcYuvReco[depth]->getCrAddr(); |
---|
1403 | |
---|
1404 | UInt strideC = m_ppcYuvReco[depth]->getCStride(); |
---|
1405 | |
---|
1406 | for(Int y = 0; y < heightC; y++ ) |
---|
1407 | { |
---|
1408 | for(Int x = 0; x < widthC; x++ ) |
---|
1409 | { |
---|
1410 | pPcmCb[x] = pRecoCb[x]; |
---|
1411 | pPcmCr[x] = pRecoCr[x]; |
---|
1412 | } |
---|
1413 | pPcmCr += widthC; |
---|
1414 | pPcmCb += widthC; |
---|
1415 | pRecoCb += strideC; |
---|
1416 | pRecoCr += strideC; |
---|
1417 | } |
---|
1418 | |
---|
1419 | } |
---|
1420 | #endif |
---|
1421 | |
---|
1422 | #if RWTH_SDC_DLT_B0036 |
---|
1423 | Void TDecCu::xAnalyzeSegmentsSDC( Pel* pOrig, UInt uiStride, UInt uiSize, Pel* rpSegMeans, UInt uiNumSegments, Bool* pMask, UInt uiMaskStride ) |
---|
1424 | { |
---|
1425 | Int iSumDepth[2]; |
---|
1426 | memset(iSumDepth, 0, sizeof(Int)*2); |
---|
1427 | Int iSumPix[2]; |
---|
1428 | memset(iSumPix, 0, sizeof(Int)*2); |
---|
1429 | #if HS_REFERENCE_SUBSAMPLE_C0154 |
---|
1430 | Int subSamplePix; |
---|
1431 | if ( uiSize == 64 || uiSize == 32 ) |
---|
1432 | { |
---|
1433 | subSamplePix = 2; |
---|
1434 | } |
---|
1435 | else |
---|
1436 | { |
---|
1437 | subSamplePix = 1; |
---|
1438 | } |
---|
1439 | for (Int y=0; y<uiSize; y+=subSamplePix) |
---|
1440 | { |
---|
1441 | for (Int x=0; x<uiSize; x+=subSamplePix) |
---|
1442 | { |
---|
1443 | UChar ucSegment = pMask?(UChar)pMask[x]:0; |
---|
1444 | assert( ucSegment < uiNumSegments ); |
---|
1445 | |
---|
1446 | iSumDepth[ucSegment] += pOrig[x]; |
---|
1447 | iSumPix[ucSegment] += 1; |
---|
1448 | } |
---|
1449 | pOrig += uiStride*subSamplePix; |
---|
1450 | pMask += uiMaskStride*subSamplePix; |
---|
1451 | } |
---|
1452 | #else |
---|
1453 | for (Int y=0; y<uiSize; y++) |
---|
1454 | { |
---|
1455 | for (Int x=0; x<uiSize; x++) |
---|
1456 | { |
---|
1457 | UChar ucSegment = pMask?(UChar)pMask[x]:0; |
---|
1458 | assert( ucSegment < uiNumSegments ); |
---|
1459 | |
---|
1460 | iSumDepth[ucSegment] += pOrig[x]; |
---|
1461 | iSumPix[ucSegment] += 1; |
---|
1462 | } |
---|
1463 | |
---|
1464 | pOrig += uiStride; |
---|
1465 | pMask += uiMaskStride; |
---|
1466 | } |
---|
1467 | #endif |
---|
1468 | // compute mean for each segment |
---|
1469 | for( UChar ucSeg = 0; ucSeg < uiNumSegments; ucSeg++ ) |
---|
1470 | { |
---|
1471 | if( iSumPix[ucSeg] > 0 ) |
---|
1472 | rpSegMeans[ucSeg] = iSumDepth[ucSeg] / iSumPix[ucSeg]; |
---|
1473 | else |
---|
1474 | rpSegMeans[ucSeg] = 0; // this happens for zero-segments |
---|
1475 | } |
---|
1476 | } |
---|
1477 | #endif |
---|
1478 | |
---|
1479 | //! \} |
---|