[5] | 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-2011, 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 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 | */ |
---|
[2] | 33 | |
---|
| 34 | |
---|
[5] | 35 | |
---|
[2] | 36 | /** \file TComResidualGenerator.cpp |
---|
| 37 | \brief residual picture generator class |
---|
| 38 | */ |
---|
| 39 | |
---|
| 40 | |
---|
| 41 | |
---|
| 42 | #include "CommonDef.h" |
---|
| 43 | #include "TComResidualGenerator.h" |
---|
| 44 | |
---|
| 45 | |
---|
[443] | 46 | #if H3D_IVRP & !QC_ARP_D0177 |
---|
[2] | 47 | |
---|
[5] | 48 | |
---|
[2] | 49 | TComResidualGenerator::TComResidualGenerator() |
---|
| 50 | { |
---|
| 51 | m_bCreated = false; |
---|
| 52 | m_bInit = false; |
---|
| 53 | m_bDecoder = false; |
---|
| 54 | m_pcTrQuant = 0; |
---|
| 55 | m_pcDepthMapGenerator = 0; |
---|
| 56 | m_pcSPSAccess = 0; |
---|
| 57 | m_pcAUPicAccess = 0; |
---|
| 58 | m_uiMaxDepth = 0; |
---|
| 59 | m_uiOrgDepthBitDepth = 0; |
---|
| 60 | m_ppcYuvTmp = 0; |
---|
| 61 | m_ppcYuv = 0; |
---|
| 62 | m_ppcCU = 0; |
---|
| 63 | } |
---|
| 64 | |
---|
| 65 | TComResidualGenerator::~TComResidualGenerator() |
---|
| 66 | { |
---|
| 67 | destroy (); |
---|
| 68 | uninit (); |
---|
| 69 | } |
---|
| 70 | |
---|
| 71 | Void |
---|
| 72 | TComResidualGenerator::create( Bool bDecoder, UInt uiPicWidth, UInt uiPicHeight, UInt uiMaxCUDepth, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiOrgBitDepth ) |
---|
| 73 | { |
---|
| 74 | destroy(); |
---|
| 75 | m_bDecoder = bDecoder; |
---|
| 76 | m_uiMaxDepth = uiMaxCUDepth; |
---|
| 77 | m_uiOrgDepthBitDepth = uiOrgBitDepth; |
---|
| 78 | m_ppcYuvTmp = new TComYuv* [ NUM_TMP_YUV_BUFFERS ]; |
---|
| 79 | m_ppcYuv = new TComYuv* [ m_uiMaxDepth ]; |
---|
| 80 | m_ppcCU = new TComDataCU* [ m_uiMaxDepth ]; |
---|
| 81 | for( UInt uiIdx = 0; uiIdx < NUM_TMP_YUV_BUFFERS; uiIdx++ ) |
---|
| 82 | { |
---|
| 83 | m_ppcYuvTmp[uiIdx] = new TComYuv; m_ppcYuvTmp[uiIdx]->create( uiMaxCUWidth, uiMaxCUHeight ); |
---|
| 84 | } |
---|
| 85 | for( UInt uiDepth = 0; uiDepth < m_uiMaxDepth; uiDepth++ ) |
---|
| 86 | { |
---|
| 87 | UInt uiNumPart = 1 << ( ( m_uiMaxDepth - uiDepth ) << 1 ); |
---|
| 88 | UInt uiWidth = uiMaxCUWidth >> uiDepth; |
---|
| 89 | UInt uiHeight = uiMaxCUHeight >> uiDepth; |
---|
| 90 | |
---|
[56] | 91 | m_ppcYuv[ uiDepth ] = new TComYuv; m_ppcYuv[ uiDepth ]->create( uiWidth, uiHeight ); |
---|
| 92 | m_ppcCU [ uiDepth ] = new TComDataCU; m_ppcCU [ uiDepth ]->create( uiNumPart, uiWidth, uiHeight, true, uiMaxCUWidth >> (uiMaxCUDepth - 1) ); |
---|
[2] | 93 | } |
---|
| 94 | m_cTmpPic.create( uiPicWidth, uiPicHeight, uiMaxCUWidth, uiMaxCUHeight, uiMaxCUDepth ); |
---|
| 95 | m_bCreated = true; |
---|
| 96 | } |
---|
| 97 | |
---|
| 98 | Void |
---|
| 99 | TComResidualGenerator::destroy() |
---|
| 100 | { |
---|
| 101 | if( m_bCreated ) |
---|
| 102 | { |
---|
| 103 | m_bCreated = false; |
---|
| 104 | for( UInt uiIdx = 0; uiIdx < NUM_TMP_YUV_BUFFERS; uiIdx++ ) |
---|
| 105 | { |
---|
| 106 | m_ppcYuvTmp[uiIdx]->destroy(); delete m_ppcYuvTmp[uiIdx]; m_ppcYuvTmp[uiIdx] = 0; |
---|
| 107 | } |
---|
| 108 | for( UInt uiDepth = 0; uiDepth < m_uiMaxDepth; uiDepth++ ) |
---|
| 109 | { |
---|
| 110 | m_ppcYuv[ uiDepth ]->destroy(); delete m_ppcYuv[ uiDepth ]; m_ppcYuv[ uiDepth ] = 0; |
---|
| 111 | m_ppcCU [ uiDepth ]->destroy(); delete m_ppcCU [ uiDepth ]; m_ppcCU [ uiDepth ] = 0; |
---|
| 112 | } |
---|
| 113 | delete [] m_ppcYuvTmp; m_ppcYuvTmp = 0; |
---|
| 114 | delete [] m_ppcYuv; m_ppcYuv = 0; |
---|
| 115 | delete [] m_ppcCU; m_ppcCU = 0; |
---|
| 116 | m_cTmpPic.destroy(); |
---|
| 117 | m_uiMaxDepth = 0; |
---|
| 118 | m_uiOrgDepthBitDepth = 0; |
---|
| 119 | m_bDecoder = false; |
---|
| 120 | } |
---|
| 121 | } |
---|
| 122 | |
---|
| 123 | Void |
---|
| 124 | TComResidualGenerator::init( TComTrQuant* pcTrQuant, TComDepthMapGenerator* pcDepthMapGenerator ) |
---|
| 125 | { |
---|
| 126 | AOF( pcTrQuant ); |
---|
| 127 | AOF( pcDepthMapGenerator ); |
---|
| 128 | AOF( pcDepthMapGenerator->getSPSAccess () ); |
---|
| 129 | AOF( pcDepthMapGenerator->getAUPicAccess() ); |
---|
| 130 | uninit(); |
---|
| 131 | m_pcTrQuant = pcTrQuant; |
---|
| 132 | m_pcDepthMapGenerator = pcDepthMapGenerator; |
---|
| 133 | m_pcSPSAccess = pcDepthMapGenerator->getSPSAccess (); |
---|
| 134 | m_pcAUPicAccess = pcDepthMapGenerator->getAUPicAccess(); |
---|
| 135 | m_bInit = true; |
---|
| 136 | } |
---|
| 137 | |
---|
| 138 | Void |
---|
| 139 | TComResidualGenerator::uninit() |
---|
| 140 | { |
---|
| 141 | if( m_bInit ) |
---|
| 142 | { |
---|
| 143 | m_bInit = false; |
---|
| 144 | m_pcTrQuant = 0; |
---|
| 145 | m_pcDepthMapGenerator = 0; |
---|
| 146 | m_pcSPSAccess = 0; |
---|
| 147 | m_pcAUPicAccess = 0; |
---|
| 148 | } |
---|
| 149 | } |
---|
| 150 | |
---|
| 151 | |
---|
| 152 | |
---|
| 153 | Void |
---|
| 154 | TComResidualGenerator::initViewComponent( TComPic* pcPic ) |
---|
| 155 | { |
---|
| 156 | AOF ( m_bCreated && m_bInit ); |
---|
| 157 | AOF ( pcPic ); |
---|
| 158 | |
---|
| 159 | // set pointer in SPS |
---|
| 160 | pcPic->getSPS()->setResidualGenerator( this ); |
---|
| 161 | ROFVS( pcPic->getSPS()->getMultiviewResPredMode() ); |
---|
| 162 | |
---|
| 163 | #if OUTPUT_RESIDUAL_PICTURES |
---|
| 164 | // dump reconstructed residual picture for first AU |
---|
| 165 | if( pcPic->getPOC() == 0 ) |
---|
| 166 | { |
---|
| 167 | AOF( pcPic->getSPS()->getViewId() ); |
---|
| 168 | UInt uiBaseViewId = pcPic->getSPS()->getViewId() - 1; |
---|
| 169 | TComPic* pcBasePic = m_pcAUPicAccess->getPic( uiBaseViewId ); |
---|
| 170 | AOF( pcBasePic ); |
---|
| 171 | Char acFilenameBase[1024]; |
---|
| 172 | ::sprintf( acFilenameBase, "RecResidual_%s", ( m_bDecoder ? "Dec" : "Enc" ) ); |
---|
| 173 | xDumpResidual( pcBasePic, acFilenameBase ); |
---|
| 174 | } |
---|
| 175 | #endif |
---|
| 176 | } |
---|
| 177 | |
---|
| 178 | |
---|
| 179 | |
---|
| 180 | Void |
---|
| 181 | TComResidualGenerator::setRecResidualPic( TComPic* pcPic ) |
---|
| 182 | { |
---|
| 183 | AOF ( m_bCreated && m_bInit ); |
---|
| 184 | AOF ( pcPic ); |
---|
| 185 | |
---|
[332] | 186 | #if H3D_IVRP |
---|
[296] | 187 | if (pcPic->getSPS()->getViewId() != 0) |
---|
| 188 | { |
---|
| 189 | return; |
---|
| 190 | } |
---|
| 191 | #endif |
---|
| 192 | |
---|
[2] | 193 | if( pcPic->getPOC() == 0 ) |
---|
| 194 | { |
---|
| 195 | if( pcPic->getSPS()->getViewId() == 0 || m_pcSPSAccess->getResPrd() != 0 ) |
---|
| 196 | { |
---|
| 197 | // set residual picture |
---|
| 198 | AOT( pcPic->getResidual() ); |
---|
| 199 | if( !pcPic->getResidual() ) |
---|
| 200 | { |
---|
| 201 | pcPic->addResidualBuffer(); |
---|
| 202 | } |
---|
| 203 | xSetRecResidualPic( pcPic ); |
---|
| 204 | } |
---|
| 205 | } |
---|
| 206 | else |
---|
| 207 | { |
---|
| 208 | if( m_pcSPSAccess->getResPrd() != 0 && pcPic->getSPS()->getViewId() < m_pcAUPicAccess->getMaxVId() ) |
---|
| 209 | { |
---|
| 210 | // set residual picture |
---|
| 211 | AOT( pcPic->getResidual() ); |
---|
| 212 | if( !pcPic->getResidual() ) |
---|
| 213 | { |
---|
| 214 | pcPic->addResidualBuffer(); |
---|
| 215 | } |
---|
| 216 | xSetRecResidualPic( pcPic ); |
---|
| 217 | |
---|
| 218 | #if OUTPUT_RESIDUAL_PICTURES |
---|
| 219 | // dump reconstructed residual picture |
---|
| 220 | Char acFilenameBase[1024]; |
---|
| 221 | ::sprintf( acFilenameBase, "RecResidual_%s", ( m_bDecoder ? "Dec" : "Enc" ) ); |
---|
| 222 | xDumpResidual( pcPic, acFilenameBase ); |
---|
| 223 | #endif |
---|
| 224 | } |
---|
| 225 | } |
---|
| 226 | } |
---|
[443] | 227 | #endif |
---|
[2] | 228 | |
---|
[443] | 229 | #if !QC_ARP_D0177 |
---|
[296] | 230 | #if H3D_NBDV |
---|
[2] | 231 | Bool |
---|
[296] | 232 | TComResidualGenerator::getResidualSamples( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv, TComMv iDisp, Bool bRecon ) |
---|
| 233 | #else |
---|
| 234 | Bool |
---|
| 235 | TComResidualGenerator::getResidualSamples( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv, Bool bRecon ) |
---|
| 236 | #endif //H3D_NBDV |
---|
[2] | 237 | { |
---|
| 238 | AOF( pcCU ); |
---|
| 239 | UInt uiPartAddr; |
---|
| 240 | Int iBlkWidth, iBlkHeight, iXPos, iYPos; |
---|
| 241 | AOT( uiPUIdx ); |
---|
| 242 | uiPartAddr = 0; |
---|
| 243 | iBlkWidth = pcCU->getWidth ( 0 ); |
---|
| 244 | iBlkHeight = pcCU->getHeight ( 0 ); |
---|
| 245 | pcCU->getPic()->getPicYuvRec()->getTopLeftSamplePos( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr, iXPos, iYPos ); |
---|
[296] | 246 | #if H3D_NBDV |
---|
| 247 | return getResidualSamples( pcCU->getPic(), (UInt)iXPos, (UInt)iYPos, (UInt)iBlkWidth, (UInt)iBlkHeight, pcYuv, iDisp, bRecon); |
---|
[100] | 248 | #else |
---|
[296] | 249 | return getResidualSamples( pcCU->getPic(), (UInt)iXPos, (UInt)iYPos, (UInt)iBlkWidth, (UInt)iBlkHeight, pcYuv, bRecon); |
---|
| 250 | #endif // H3D_NBDV |
---|
[2] | 251 | } |
---|
| 252 | |
---|
[443] | 253 | #if H3D_NBDV |
---|
[2] | 254 | Bool |
---|
[296] | 255 | TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, TComMv iDisp, Bool bRecon) |
---|
| 256 | #else |
---|
| 257 | Bool |
---|
| 258 | TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Bool bRecon) |
---|
[77] | 259 | #endif |
---|
[2] | 260 | { |
---|
[296] | 261 | UInt uiBaseViewId = 0; |
---|
[2] | 262 | if( !pcYuv ) |
---|
| 263 | { |
---|
| 264 | pcYuv = m_ppcYuvTmp[1]; |
---|
| 265 | } |
---|
[77] | 266 | UInt uiXPosInRefView = uiXPos , uiYPosInRefView = uiYPos; |
---|
[443] | 267 | #if QC_ARP_D0177 |
---|
| 268 | if(pcPic->getSPS()->getMultiviewResPredMode()) |
---|
| 269 | { |
---|
| 270 | #endif |
---|
[296] | 271 | #if H3D_NBDV |
---|
| 272 | xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv, iDisp, &uiXPosInRefView , &uiYPosInRefView , bRecon ); |
---|
| 273 | #else |
---|
| 274 | xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv, &uiXPosInRefView , &uiYPosInRefView , bRecon ); |
---|
[77] | 275 | #endif |
---|
[296] | 276 | return true; |
---|
[443] | 277 | #if QC_ARP_D0177 |
---|
| 278 | } |
---|
| 279 | else |
---|
| 280 | return true; |
---|
| 281 | #endif |
---|
[2] | 282 | } |
---|
| 283 | |
---|
[77] | 284 | Bool TComResidualGenerator::xIsNonZeroByCBF( UInt uiBaseViewId , UInt uiXPos , UInt uiYPos, UInt uiBlkWidth , UInt uiBlkHeight ) |
---|
| 285 | { |
---|
| 286 | TComPic* pcBasePic = m_pcAUPicAccess->getPic( uiBaseViewId ); |
---|
| 287 | const Int nMaxPicX = pcBasePic->getSPS()->getPicWidthInLumaSamples() - 1; |
---|
| 288 | const Int nMaxPicY = pcBasePic->getSPS()->getPicHeightInLumaSamples() - 1; |
---|
| 289 | for( UInt y = 0 ; y < uiBlkHeight ; y +=4 ) |
---|
| 290 | { |
---|
| 291 | for( UInt x = 0 ; x <= uiBlkWidth ; x += 4 ) |
---|
| 292 | { // to cover both the mapped CU and the 1-pixel-right-shifted mapped CU |
---|
| 293 | Int iCuAddr = 0, iAbsZorderIdx = 0; |
---|
| 294 | pcBasePic->getPicYuvRec()->getCUAddrAndPartIdx( Min( uiXPos + x , nMaxPicX ) , Min( uiYPos + y , nMaxPicY ) , iCuAddr , iAbsZorderIdx ); |
---|
| 295 | TComDataCU *pCUInRefView = pcBasePic->getCU( iCuAddr ); |
---|
| 296 | if( pCUInRefView->isIntra( iAbsZorderIdx ) ) |
---|
| 297 | // no inter-view residual pred from a intra CU |
---|
| 298 | continue; |
---|
| 299 | UInt uiTempTrDepth = pCUInRefView->getTransformIdx( iAbsZorderIdx ); |
---|
| 300 | if( pCUInRefView->getCbf( iAbsZorderIdx , TEXT_LUMA , uiTempTrDepth ) |
---|
| 301 | || pCUInRefView->getCbf( iAbsZorderIdx , TEXT_CHROMA_U , uiTempTrDepth ) |
---|
| 302 | || pCUInRefView->getCbf( iAbsZorderIdx , TEXT_CHROMA_V , uiTempTrDepth ) ) |
---|
| 303 | return( true ); |
---|
| 304 | } |
---|
| 305 | } |
---|
[2] | 306 | |
---|
[77] | 307 | return( false ); |
---|
| 308 | } |
---|
[2] | 309 | |
---|
[77] | 310 | |
---|
| 311 | |
---|
[2] | 312 | Void |
---|
| 313 | TComResidualGenerator::xSetRecResidualPic( TComPic* pcPic ) |
---|
| 314 | { |
---|
| 315 | AOF( pcPic ); |
---|
| 316 | AOF( pcPic->getResidual() ); |
---|
| 317 | for( UInt uiCUAddr = 0; uiCUAddr < pcPic->getPicSym()->getNumberOfCUsInFrame(); uiCUAddr++ ) |
---|
| 318 | { |
---|
| 319 | TComDataCU* pcCU = pcPic->getCU( uiCUAddr ); |
---|
| 320 | xSetRecResidualCU( pcCU, 0, 0 ); |
---|
| 321 | } |
---|
| 322 | pcPic->getResidual()->setBorderExtension( false ); |
---|
| 323 | pcPic->getResidual()->extendPicBorder (); |
---|
| 324 | } |
---|
| 325 | |
---|
| 326 | |
---|
| 327 | Void |
---|
| 328 | TComResidualGenerator::xSetRecResidualCU( TComDataCU* pcCU, UInt uiDepth, UInt uiAbsPartIdx ) |
---|
| 329 | { |
---|
| 330 | UInt uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[ uiAbsPartIdx ] ]; |
---|
| 331 | UInt uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[ uiAbsPartIdx ] ]; |
---|
| 332 | UInt uiRPelX = uiLPelX + ( g_uiMaxCUWidth >> uiDepth ) - 1; |
---|
| 333 | UInt uiBPelY = uiTPelY + ( g_uiMaxCUHeight >> uiDepth ) - 1; |
---|
[56] | 334 | Bool bBoundary = ( uiRPelX >= pcCU->getSlice()->getSPS()->getPicWidthInLumaSamples() || uiBPelY >= pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples() ); |
---|
[2] | 335 | Bool bSplit = ( ( uiDepth < pcCU->getDepth( uiAbsPartIdx ) && uiDepth < ( g_uiMaxCUDepth - g_uiAddCUDepth ) ) || bBoundary ); |
---|
| 336 | if( bSplit ) |
---|
| 337 | { |
---|
| 338 | UInt uiQNumParts = ( pcCU->getPic()->getNumPartInCU() >> ( uiDepth << 1 ) ) >> 2; |
---|
| 339 | for ( UInt uiPartUnitIdx = 0; uiPartUnitIdx < 4; uiPartUnitIdx++, uiAbsPartIdx += uiQNumParts ) |
---|
| 340 | { |
---|
| 341 | uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[ uiAbsPartIdx ] ]; |
---|
| 342 | uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[ uiAbsPartIdx ] ]; |
---|
[56] | 343 | Bool bInside = ( uiLPelX < pcCU->getSlice()->getSPS()->getPicWidthInLumaSamples() && uiTPelY < pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples() ); |
---|
[2] | 344 | if( bInside ) |
---|
| 345 | { |
---|
| 346 | xSetRecResidualCU( pcCU, uiDepth + 1, uiAbsPartIdx ); |
---|
| 347 | } |
---|
| 348 | } |
---|
| 349 | return; |
---|
| 350 | } |
---|
| 351 | |
---|
| 352 | //--- set sub-CU and sub-residual --- |
---|
| 353 | TComDataCU* pcSubCU = m_ppcCU [ uiDepth ]; |
---|
| 354 | TComYuv* pcSubRes = m_ppcYuv[ uiDepth ]; |
---|
| 355 | TComPicYuv* pcPicRes = pcCU->getPic()->getResidual(); |
---|
| 356 | UInt uiCUAddr = pcCU->getAddr(); |
---|
| 357 | pcSubCU->copySubCU( pcCU, uiAbsPartIdx, uiDepth ); |
---|
[443] | 358 | #if QC_CU_NBDV_D0181 |
---|
| 359 | pcSubCU->copyDVInfoFrom( pcCU, uiAbsPartIdx); |
---|
| 360 | #endif |
---|
[2] | 361 | //--- set residual --- |
---|
| 362 | switch( pcSubCU->getPredictionMode( 0 ) ) |
---|
| 363 | { |
---|
| 364 | case MODE_INTRA: |
---|
| 365 | xSetRecResidualIntraCU( pcSubCU, pcSubRes ); |
---|
| 366 | break; |
---|
| 367 | case MODE_SKIP: |
---|
| 368 | case MODE_INTER: |
---|
| 369 | xSetRecResidualInterCU( pcSubCU, pcSubRes ); |
---|
| 370 | break; |
---|
| 371 | default: |
---|
| 372 | AOT( true ); |
---|
| 373 | break; |
---|
| 374 | } |
---|
| 375 | |
---|
| 376 | //--- copy sub-residual --- |
---|
| 377 | pcSubRes->copyToPicYuv( pcPicRes, uiCUAddr, uiAbsPartIdx ); |
---|
| 378 | } |
---|
| 379 | |
---|
| 380 | |
---|
| 381 | Void |
---|
| 382 | TComResidualGenerator::xSetRecResidualIntraCU( TComDataCU* pcCU, TComYuv* pcCUResidual ) |
---|
| 383 | { |
---|
| 384 | //===== set residual to zero for entire CU ===== |
---|
| 385 | xClearResidual( pcCUResidual, 0, pcCU->getWidth( 0 ), pcCU->getHeight( 0 ) ); |
---|
| 386 | } |
---|
| 387 | |
---|
| 388 | |
---|
| 389 | Void |
---|
| 390 | TComResidualGenerator::xSetRecResidualInterCU( TComDataCU* pcCU, TComYuv* pcCUResidual ) |
---|
| 391 | { |
---|
| 392 | //===== reconstruct residual from coded transform coefficient levels ===== |
---|
| 393 | xClearResidual( pcCUResidual, 0, pcCU->getWidth( 0 ), pcCU->getHeight( 0 ) ); |
---|
| 394 | // luma |
---|
| 395 | UInt uiWidth = pcCU->getWidth ( 0 ); |
---|
| 396 | UInt uiHeight = pcCU->getHeight ( 0 ); |
---|
| 397 | TCoeff* piCoeff = pcCU->getCoeffY (); |
---|
| 398 | Pel* pRes = pcCUResidual->getLumaAddr(); |
---|
| 399 | UInt uiLumaTrMode, uiChromaTrMode; |
---|
| 400 | pcCU->convertTransIdx ( 0, pcCU->getTransformIdx( 0 ), uiLumaTrMode, uiChromaTrMode ); |
---|
[56] | 401 | m_pcTrQuant->setQPforQuant ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 ); |
---|
[2] | 402 | m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_LUMA, pRes, 0, pcCUResidual->getStride(), uiWidth, uiHeight, uiLumaTrMode, 0, piCoeff ); |
---|
| 403 | // chroma Cb |
---|
| 404 | uiWidth >>= 1; |
---|
| 405 | uiHeight >>= 1; |
---|
| 406 | piCoeff = pcCU->getCoeffCb(); |
---|
| 407 | pRes = pcCUResidual->getCbAddr(); |
---|
[56] | 408 | m_pcTrQuant->setQPforQuant ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset() ); |
---|
[2] | 409 | m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_U, pRes, 0, pcCUResidual->getCStride(), uiWidth, uiHeight, uiChromaTrMode, 0, piCoeff ); |
---|
| 410 | // chroma Cr |
---|
| 411 | piCoeff = pcCU->getCoeffCr(); |
---|
| 412 | pRes = pcCUResidual->getCrAddr(); |
---|
| 413 | m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_V, pRes, 0, pcCUResidual->getCStride(), uiWidth, uiHeight, uiChromaTrMode, 0, piCoeff ); |
---|
| 414 | |
---|
| 415 | //===== clear inter-view predicted parts ===== |
---|
| 416 | for( UInt uiPartIdx = 0; uiPartIdx < pcCU->getNumPartInter(); uiPartIdx++ ) |
---|
| 417 | { |
---|
| 418 | xClearIntViewResidual( pcCU, pcCUResidual, uiPartIdx ); |
---|
| 419 | } |
---|
| 420 | } |
---|
| 421 | |
---|
| 422 | |
---|
| 423 | Void |
---|
| 424 | TComResidualGenerator::xClearIntViewResidual( TComDataCU* pcCU, TComYuv* pcCUResidual, UInt uiPartIdx ) |
---|
| 425 | { |
---|
| 426 | UInt uiCurrViewId = pcCU->getSlice()->getSPS()->getViewId(); |
---|
| 427 | if( uiCurrViewId ) |
---|
| 428 | { |
---|
| 429 | Int iWidth; |
---|
| 430 | Int iHeight; |
---|
| 431 | UInt uiAbsPartIdx; |
---|
| 432 | pcCU->getPartIndexAndSize( uiPartIdx, uiAbsPartIdx, iWidth, iHeight ); |
---|
| 433 | TComCUMvField* aiCurrMvField[2] = { pcCU->getCUMvField( REF_PIC_LIST_0 ), pcCU->getCUMvField( REF_PIC_LIST_1 ) }; |
---|
| 434 | Int aiCurrRefIdx [2] = { aiCurrMvField[0]->getRefIdx( uiAbsPartIdx ), aiCurrMvField[1]->getRefIdx( uiAbsPartIdx ) }; |
---|
| 435 | Bool abCurrIntView[2] = { aiCurrRefIdx[0] >= 0 && pcCU->getSlice()->getRefPic( REF_PIC_LIST_0, aiCurrRefIdx[0] )->getSPS()->getViewId() != uiCurrViewId, |
---|
| 436 | aiCurrRefIdx[1] >= 0 && pcCU->getSlice()->getRefPic( REF_PIC_LIST_1, aiCurrRefIdx[1] )->getSPS()->getViewId() != uiCurrViewId }; |
---|
| 437 | Bool bUsesInterViewPrd = ( abCurrIntView[0] || abCurrIntView[1] ); |
---|
| 438 | if( bUsesInterViewPrd ) |
---|
| 439 | { //===== set resiudal to zero ===== |
---|
| 440 | xClearResidual( pcCUResidual, uiAbsPartIdx, (UInt)iWidth, (UInt)iHeight ); |
---|
| 441 | } |
---|
| 442 | } |
---|
| 443 | } |
---|
| 444 | |
---|
| 445 | |
---|
| 446 | Void |
---|
| 447 | TComResidualGenerator::xClearResidual( TComYuv* pcCUResidual, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight ) |
---|
| 448 | { |
---|
| 449 | // luma |
---|
| 450 | Pel* pSamplesY = pcCUResidual->getLumaAddr( uiAbsPartIdx ); |
---|
| 451 | Int iStrideY = pcCUResidual->getStride (); |
---|
| 452 | for( UInt uiY = 0; uiY < uiHeight; uiY++, pSamplesY += iStrideY ) |
---|
| 453 | { |
---|
| 454 | ::memset( pSamplesY, 0x00, uiWidth * sizeof( Pel ) ); |
---|
| 455 | } |
---|
| 456 | // chroma |
---|
| 457 | uiWidth >>= 1; |
---|
| 458 | uiHeight >>= 1; |
---|
| 459 | Pel* pSamplesU = pcCUResidual->getCbAddr ( uiAbsPartIdx ); |
---|
| 460 | Pel* pSamplesV = pcCUResidual->getCrAddr ( uiAbsPartIdx ); |
---|
| 461 | Int iStrideC = pcCUResidual->getCStride(); |
---|
| 462 | for( UInt uiY = 0; uiY < uiHeight; uiY++, pSamplesU += iStrideC, pSamplesV += iStrideC ) |
---|
| 463 | { |
---|
| 464 | ::memset( pSamplesU, 0x00, uiWidth * sizeof( Pel ) ); |
---|
| 465 | ::memset( pSamplesV, 0x00, uiWidth * sizeof( Pel ) ); |
---|
| 466 | } |
---|
| 467 | } |
---|
| 468 | |
---|
| 469 | |
---|
[296] | 470 | #if H3D_NBDV |
---|
[2] | 471 | Void |
---|
[296] | 472 | TComResidualGenerator::xSetPredResidualBlock( TComPic* pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, TComMv iDisp |
---|
| 473 | ,UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon ) |
---|
| 474 | #else // H3D_NBDV |
---|
[100] | 475 | Void |
---|
[77] | 476 | TComResidualGenerator::xSetPredResidualBlock( TComPic* pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv |
---|
[296] | 477 | , UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon ) |
---|
| 478 | #endif // H3D_NBDV |
---|
[2] | 479 | { |
---|
| 480 | //===== set and check some basic variables ===== |
---|
| 481 | AOF( pcYuv ); |
---|
| 482 | TComPic* pcBasePic = m_pcAUPicAccess->getPic( uiBaseViewId ); |
---|
| 483 | AOF( pcPic ); |
---|
| 484 | AOF( pcBasePic ); |
---|
| 485 | TComPicYuv* pcBaseRes = pcBasePic->getResidual (); |
---|
| 486 | TComPicYuv* pcPdmMap = pcPic ->getPredDepthMap(); |
---|
| 487 | AOF( pcBaseRes ); |
---|
| 488 | AOF( pcPdmMap ); |
---|
| 489 | UInt uiPicWidth = pcBaseRes->getWidth (); |
---|
| 490 | UInt uiPicHeight = pcBaseRes->getHeight(); |
---|
| 491 | AOT( uiXPos + uiBlkWidth > uiPicWidth ); |
---|
| 492 | AOT( uiYPos + uiBlkHeight > uiPicHeight ); |
---|
| 493 | |
---|
| 494 | //===== get disparity ===== |
---|
[296] | 495 | #if H3D_NBDV |
---|
| 496 | Int iDisparity_y = iDisp.getVer(); |
---|
| 497 | Int iDisparity = iDisp.getHor(); |
---|
| 498 | #else //H3D_NBDV |
---|
[21] | 499 | Int iMidPosX = Int( uiXPos + ( ( uiBlkWidth - 1 ) >> 1 ) ) >> m_pcDepthMapGenerator->getSubSampExpX(); |
---|
| 500 | Int iMidPosY = Int( uiYPos + ( ( uiBlkHeight - 1 ) >> 1 ) ) >> m_pcDepthMapGenerator->getSubSampExpY(); |
---|
[2] | 501 | Int iDisparity = m_pcDepthMapGenerator->getDisparity( pcPic, iMidPosX, iMidPosY, uiBaseViewId ); |
---|
[296] | 502 | #endif //H3D_NBDV |
---|
[2] | 503 | //===== compensate luma ===== |
---|
| 504 | Int iYWidth = Int( uiBlkWidth ); |
---|
| 505 | Int iYHeight = Int( uiBlkHeight ); |
---|
| 506 | Int iYWeight1 = ( iDisparity & 3 ); |
---|
| 507 | Int iYWeight0 = 4 - iYWeight1; |
---|
| 508 | Int iYRefPosX0 = Int( uiXPos ) + ( iDisparity >> 2 ); |
---|
| 509 | Int iYRefPosX1 = iYRefPosX0 + 1; |
---|
[296] | 510 | Int iYMaxPosY = Int( uiPicHeight ) - 1; |
---|
| 511 | Int iYWeight3 = ( iDisparity_y & 3 ); |
---|
| 512 | Int iYWeight2 = 4 - iYWeight3; |
---|
| 513 | Int iYRefPosY0 = Max( 0, Min( iYMaxPosY, Int( uiYPos ) + ( iDisparity_y >> 2 )) ); |
---|
| 514 | Int iYRefPosY1 = Max( 0, Min( iYMaxPosY, iYRefPosY0 + 1 )); |
---|
[2] | 515 | Int iYMaxPosX = Int( uiPicWidth ) - 1; |
---|
| 516 | Int iSrcStrideY = pcBaseRes->getStride (); |
---|
| 517 | Int iDesStrideY = pcYuv ->getStride (); |
---|
[296] | 518 | Pel* pSrcSamplesY0= pcBaseRes->getLumaAddr ( 0 ) + iYRefPosY0 * iSrcStrideY; |
---|
| 519 | Pel* pSrcSamplesY1= pcBaseRes->getLumaAddr ( 0 ) + iYRefPosY1 * iSrcStrideY; |
---|
[2] | 520 | Pel* pDesSamplesY= pcYuv ->getLumaAddr (); |
---|
[77] | 521 | |
---|
[296] | 522 | |
---|
[77] | 523 | if( puiXPosInRefView != NULL ) |
---|
| 524 | *puiXPosInRefView = Max( 0, Min( iYMaxPosX, iYRefPosX0 ) ); |
---|
| 525 | if( puiYPosInRefView != NULL ) |
---|
| 526 | *puiYPosInRefView = uiYPos; |
---|
| 527 | if( bRecon == false ) |
---|
| 528 | return; |
---|
| 529 | |
---|
[296] | 530 | for( Int iY = 0; iY < iYHeight; iY++, pSrcSamplesY0 += iSrcStrideY, pSrcSamplesY1 += iSrcStrideY, pDesSamplesY += iDesStrideY ) |
---|
[2] | 531 | { |
---|
| 532 | for( Int iX = 0; iX < iYWidth; iX++ ) |
---|
| 533 | { |
---|
| 534 | Int iXPic0 = Max( 0, Min( iYMaxPosX, iYRefPosX0 + iX ) ); |
---|
| 535 | Int iXPic1 = Max( 0, Min( iYMaxPosX, iYRefPosX1 + iX ) ); |
---|
[296] | 536 | Pel Temp1,Temp2; |
---|
| 537 | Temp1 =( iYWeight0 * pSrcSamplesY0[iXPic0] + iYWeight1 * pSrcSamplesY0[iXPic1] + 2 ) >> 2; |
---|
| 538 | Temp2 =( iYWeight0 * pSrcSamplesY1[iXPic0] + iYWeight1 * pSrcSamplesY1[iXPic1] + 2 ) >> 2; |
---|
| 539 | pDesSamplesY[iX] = ( iYWeight2 * Temp1 + iYWeight3 * Temp2 + 2 ) >> 2; |
---|
[2] | 540 | } |
---|
| 541 | } |
---|
| 542 | |
---|
| 543 | //===== compensate chroma ===== |
---|
| 544 | Int iCWidth = Int( uiBlkWidth >> 1 ); |
---|
| 545 | Int iCHeight = Int( uiBlkHeight >> 1 ); |
---|
| 546 | Int iCWeight1 = ( iDisparity & 7 ); |
---|
| 547 | Int iCWeight0 = 8 - iCWeight1; |
---|
| 548 | Int iCRefPosX0 = Int( uiXPos >> 1 ) + ( iDisparity >> 3 ); |
---|
| 549 | Int iCRefPosX1 = iCRefPosX0 + 1; |
---|
[296] | 550 | Int iCMaxPosY = Int( uiPicHeight >> 1 ) - 1; |
---|
| 551 | Int iCWeight3 = ( iDisparity_y & 7 ); |
---|
| 552 | Int iCWeight2 = 8 - iCWeight3; |
---|
| 553 | Int iCRefPosY0 = Max( 0, Min( iCMaxPosY, Int( uiYPos >> 1 ) + ( iDisparity_y >> 3 )) ); |
---|
| 554 | Int iCRefPosY1 = Max( 0, Min( iCMaxPosY, iCRefPosY0 + 1 )); |
---|
[2] | 555 | Int iCMaxPosX = Int( uiPicWidth >> 1 ) - 1; |
---|
| 556 | Int iSrcStrideC = pcBaseRes->getCStride(); |
---|
| 557 | Int iDesStrideC = pcYuv ->getCStride(); |
---|
[332] | 558 | |
---|
[313] | 559 | Pel* pSrcSamplesU0= pcBaseRes->getCbAddr ( 0 ) + iCRefPosY0 * iSrcStrideC; |
---|
| 560 | Pel* pSrcSamplesU1= pcBaseRes->getCbAddr ( 0 ) + iCRefPosY1 * iSrcStrideC; |
---|
| 561 | Pel* pSrcSamplesV0= pcBaseRes->getCrAddr ( 0 ) + iCRefPosY0 * iSrcStrideC; |
---|
| 562 | Pel* pSrcSamplesV1= pcBaseRes->getCrAddr ( 0 ) + iCRefPosY1 * iSrcStrideC; |
---|
[2] | 563 | Pel* pDesSamplesU= pcYuv ->getCbAddr (); |
---|
| 564 | Pel* pDesSamplesV= pcYuv ->getCrAddr (); |
---|
[296] | 565 | for( Int iY = 0; iY < iCHeight; iY++, pSrcSamplesU0 += iSrcStrideC, pSrcSamplesU1 += iSrcStrideC, pDesSamplesU += iDesStrideC, |
---|
| 566 | pSrcSamplesV0 += iSrcStrideC, pSrcSamplesV1 += iSrcStrideC, pDesSamplesV += iDesStrideC ) |
---|
[2] | 567 | { |
---|
| 568 | for( Int iX = 0; iX < iCWidth; iX++ ) |
---|
| 569 | { |
---|
| 570 | Int iXPic0 = Max( 0, Min( iCMaxPosX, iCRefPosX0 + iX ) ); |
---|
| 571 | Int iXPic1 = Max( 0, Min( iCMaxPosX, iCRefPosX1 + iX ) ); |
---|
[296] | 572 | Pel Temp1,Temp2; |
---|
| 573 | Temp1 =( iCWeight0 * pSrcSamplesU0[iXPic0] + iCWeight1 * pSrcSamplesU0[iXPic1] + 4 ) >> 3; |
---|
| 574 | Temp2 =( iCWeight0 * pSrcSamplesU1[iXPic0] + iCWeight1 * pSrcSamplesU1[iXPic1] + 4 ) >> 3; |
---|
| 575 | pDesSamplesU[iX] = ( iCWeight2 * Temp1 + iCWeight3 * Temp2 + 4 ) >> 3; |
---|
| 576 | Temp1 =( iCWeight0 * pSrcSamplesV0[iXPic0] + iCWeight1 * pSrcSamplesV0[iXPic1] + 4 ) >> 3; |
---|
| 577 | Temp2 =( iCWeight0 * pSrcSamplesV1[iXPic0] + iCWeight1 * pSrcSamplesV1[iXPic1] + 4 ) >> 3; |
---|
| 578 | pDesSamplesV[iX] = ( iCWeight2 * Temp1 + iCWeight3 * Temp2 + 4 ) >> 3; |
---|
[2] | 579 | } |
---|
| 580 | } |
---|
| 581 | } |
---|
| 582 | |
---|
| 583 | |
---|
| 584 | Bool |
---|
| 585 | TComResidualGenerator::xIsNonZero( TComYuv* pcYuv, UInt uiBlkWidth, UInt uiBlkHeight ) |
---|
| 586 | { |
---|
| 587 | AOF( pcYuv ); |
---|
| 588 | //===== check luma ===== |
---|
| 589 | Int iYWidth = Int( uiBlkWidth ); |
---|
| 590 | Int iYHeight = Int( uiBlkHeight ); |
---|
| 591 | Int iStrideY = pcYuv->getStride (); |
---|
| 592 | Pel* pSamplesY = pcYuv->getLumaAddr (); |
---|
| 593 | for( Int iY = 0; iY < iYHeight; iY++, pSamplesY += iStrideY ) |
---|
| 594 | { |
---|
| 595 | for( Int iX = 0; iX < iYWidth; iX++ ) |
---|
| 596 | { |
---|
| 597 | ROTRS( pSamplesY[iX], true ); |
---|
| 598 | } |
---|
| 599 | } |
---|
| 600 | //===== compensate chroma ===== |
---|
| 601 | Int iCWidth = Int( uiBlkWidth >> 1 ); |
---|
| 602 | Int iCHeight = Int( uiBlkHeight >> 1 ); |
---|
| 603 | Int iStrideC = pcYuv->getCStride(); |
---|
| 604 | Pel* pSamplesU = pcYuv->getCbAddr (); |
---|
| 605 | Pel* pSamplesV = pcYuv->getCrAddr (); |
---|
| 606 | for( Int iY = 0; iY < iCHeight; iY++, pSamplesU += iStrideC, pSamplesV += iStrideC ) |
---|
| 607 | { |
---|
| 608 | for( Int iX = 0; iX < iCWidth; iX++ ) |
---|
| 609 | { |
---|
| 610 | ROTRS( pSamplesU[iX], true ); |
---|
| 611 | ROTRS( pSamplesV[iX], true ); |
---|
| 612 | } |
---|
| 613 | } |
---|
| 614 | return false; |
---|
| 615 | } |
---|
| 616 | |
---|
| 617 | |
---|
| 618 | |
---|
| 619 | Void |
---|
| 620 | TComResidualGenerator::xDumpResidual( TComPic* pcPic, char* pFilenameBase ) |
---|
| 621 | { |
---|
| 622 | AOF( m_bCreated && m_bInit ); |
---|
| 623 | AOF( pcPic ); |
---|
| 624 | AOF( pFilenameBase ); |
---|
| 625 | AOF( m_uiOrgDepthBitDepth == 8 + g_uiBitIncrement ); |
---|
| 626 | |
---|
| 627 | // convert to output format (just clip high absolute values, since they are very unlikely) |
---|
| 628 | Int iMin = 0; |
---|
| 629 | Int iMax = ( 1 << m_uiOrgDepthBitDepth ) - 1; |
---|
| 630 | Int iMid = ( 1 << m_uiOrgDepthBitDepth ) >> 1; |
---|
| 631 | UInt uiViewId = pcPic ->getSPS ()->getViewId(); |
---|
| 632 | TComPicYuv* pcPicYuv = pcPic ->getResidual (); |
---|
| 633 | // luma |
---|
| 634 | Int iWidth = pcPicYuv->getWidth (); |
---|
| 635 | Int iHeight = pcPicYuv->getHeight (); |
---|
| 636 | Int iSrcStride = pcPicYuv->getStride (); |
---|
| 637 | Int iDstStride = m_cTmpPic.getStride (); |
---|
| 638 | Pel* pSrcSamples = pcPicYuv->getLumaAddr ( 0 ); |
---|
| 639 | Pel* pDstSamples = m_cTmpPic.getLumaAddr ( 0 ); |
---|
| 640 | AOF( m_cTmpPic.getWidth () == iWidth ); |
---|
| 641 | AOF( m_cTmpPic.getHeight() == iHeight ); |
---|
| 642 | for( Int iY = 0; iY < iHeight; iY++, pSrcSamples += iSrcStride, pDstSamples += iDstStride ) |
---|
| 643 | { |
---|
| 644 | for( Int iX = 0; iX < iWidth; iX++ ) |
---|
| 645 | { |
---|
| 646 | pDstSamples[ iX ] = Max( iMin, Min( iMax, iMid + pSrcSamples[ iX ] ) ); |
---|
| 647 | } |
---|
| 648 | } |
---|
| 649 | // chroma |
---|
| 650 | iWidth >>= 1; |
---|
| 651 | iHeight >>= 1; |
---|
| 652 | iSrcStride = pcPicYuv->getCStride(); |
---|
| 653 | iDstStride = m_cTmpPic.getCStride(); |
---|
| 654 | Pel* pSrcCb = pcPicYuv->getCbAddr ( 0 ); |
---|
| 655 | Pel* pSrcCr = pcPicYuv->getCrAddr ( 0 ); |
---|
| 656 | Pel* pDstCb = m_cTmpPic.getCbAddr ( 0 ); |
---|
| 657 | Pel* pDstCr = m_cTmpPic.getCrAddr ( 0 ); |
---|
| 658 | for( Int iY = 0; iY < iHeight; iY++, pSrcCb += iSrcStride, pSrcCr += iSrcStride, pDstCb += iDstStride, pDstCr += iDstStride ) |
---|
| 659 | { |
---|
| 660 | for( Int iX = 0; iX < iWidth; iX++ ) |
---|
| 661 | { |
---|
| 662 | pDstCb[ iX ] = Max( iMin, Min( iMax, iMid + pSrcCb[ iX ] ) ); |
---|
| 663 | pDstCr[ iX ] = Max( iMin, Min( iMax, iMid + pSrcCr[ iX ] ) ); |
---|
| 664 | } |
---|
| 665 | } |
---|
| 666 | |
---|
| 667 | // output |
---|
| 668 | Char acFilename[1024]; |
---|
| 669 | ::sprintf ( acFilename, "%s_V%d.yuv", pFilenameBase, uiViewId ); |
---|
| 670 | m_cTmpPic.dump( acFilename, ( pcPic->getPOC() != 0 ) ); |
---|
| 671 | } |
---|
| 672 | |
---|
| 673 | |
---|
[296] | 674 | #endif // H3D_IVRP |
---|
[2] | 675 | |
---|