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