Changeset 608 in 3DVCSoftware for trunk/source/Lib/TLibCommon/TComPicYuv.cpp
- Timestamp:
- 1 Sep 2013, 22:47:26 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/Lib/TLibCommon/TComPicYuv.cpp
r443 r608 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 2, ITU/ISO/IEC6 * Copyright (c) 2010-2013, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 60 60 m_piPicOrgU = NULL; 61 61 m_piPicOrgV = NULL; 62 63 #if FIX_APPENCTOP_T_ONLY 64 m_cuOffsetY = NULL; 65 m_cuOffsetC = NULL; 66 m_buOffsetY = NULL; 67 m_buOffsetC = NULL; 68 #endif 69 62 70 63 m_bIsBorderExtended = false; 71 64 } … … 84 77 m_iCuHeight = uiMaxCUHeight; 85 78 79 #if H_3D_IV_MERGE 86 80 m_iNumCuInWidth = m_iPicWidth / m_iCuWidth; 87 81 m_iNumCuInWidth += ( m_iPicWidth % m_iCuWidth ) ? 1 : 0; 88 82 89 m_uiMaxCuDepth = uiMaxCUDepth;90 91 83 m_iBaseUnitWidth = uiMaxCUWidth >> uiMaxCUDepth; 92 84 m_iBaseUnitHeight = uiMaxCUHeight >> uiMaxCUDepth; 93 85 #endif 94 86 Int numCuInWidth = m_iPicWidth / m_iCuWidth + (m_iPicWidth % m_iCuWidth != 0); 95 87 Int numCuInHeight = m_iPicHeight / m_iCuHeight + (m_iPicHeight % m_iCuHeight != 0); 96 88 97 m_iLumaMarginX = g_uiMaxCUWidth + PICYUV_PAD; // for 16-byte alignment98 m_iLumaMarginY = g_uiMaxCUHeight + PICYUV_PAD; // margin for 8-tap filter and infinite padding89 m_iLumaMarginX = g_uiMaxCUWidth + 16; // for 16-byte alignment 90 m_iLumaMarginY = g_uiMaxCUHeight + 16; // margin for 8-tap filter and infinite padding 99 91 100 92 m_iChromaMarginX = m_iLumaMarginX>>1; … … 144 136 if( m_apiPicBufU ){ xFree( m_apiPicBufU ); m_apiPicBufU = NULL; } 145 137 if( m_apiPicBufV ){ xFree( m_apiPicBufV ); m_apiPicBufV = NULL; } 146 #if FIX_APPENCTOP_T_ONLY 147 if( m_cuOffsetY ) 148 { 149 #endif 138 150 139 delete[] m_cuOffsetY; 151 140 delete[] m_cuOffsetC; 152 141 delete[] m_buOffsetY; 153 142 delete[] m_buOffsetC; 154 #if FIX_APPENCTOP_T_ONLY155 }156 #endif157 143 } 158 144 … … 165 151 m_iCuWidth = uiMaxCUWidth; 166 152 m_iCuHeight = uiMaxCUHeight; 167 m_uiMaxCuDepth = uiMaxCUDepth;168 169 m_iNumCuInWidth = m_iPicWidth / m_iCuWidth;170 m_iNumCuInWidth += ( m_iPicWidth % m_iCuWidth ) ? 1 : 0;171 172 m_iBaseUnitWidth = uiMaxCUWidth >> uiMaxCUDepth;173 m_iBaseUnitHeight = uiMaxCUHeight >> uiMaxCUDepth;174 175 153 176 154 Int numCuInWidth = m_iPicWidth / m_iCuWidth + (m_iPicWidth % m_iCuWidth != 0); 177 155 Int numCuInHeight = m_iPicHeight / m_iCuHeight + (m_iPicHeight % m_iCuHeight != 0); 178 156 179 m_iLumaMarginX = g_uiMaxCUWidth + PICYUV_PAD; // for 16-byte alignment180 m_iLumaMarginY = g_uiMaxCUHeight + PICYUV_PAD; // margin for 8-tap filter and infinite padding157 m_iLumaMarginX = g_uiMaxCUWidth + 16; // for 16-byte alignment 158 m_iLumaMarginY = g_uiMaxCUHeight + 16; // margin for 8-tap filter and infinite padding 181 159 182 160 m_apiPicBufY = (Pel*)xMalloc( Pel, ( m_iPicWidth + (m_iLumaMarginX <<1)) * ( m_iPicHeight + (m_iLumaMarginY <<1))); … … 253 231 } 254 232 255 256 Void TComPicYuv::getLumaMinMax( Int *pMin, Int *pMax )257 {258 Pel* piY = getLumaAddr();259 Int iMin = (1<<(g_uiBitDepth))-1;260 Int iMax = 0;261 Int x, y;262 263 for ( y = 0; y < m_iPicHeight; y++ )264 {265 for ( x = 0; x < m_iPicWidth; x++ )266 {267 if ( piY[x] < iMin ) iMin = piY[x];268 if ( piY[x] > iMax ) iMax = piY[x];269 }270 piY += getStride();271 }272 273 *pMin = iMin;274 *pMax = iMax;275 }276 277 233 Void TComPicYuv::extendPicBorder () 278 234 { … … 316 272 317 273 318 Void TComPicYuv::dump ( char* pFileName, Bool bAdd)274 Void TComPicYuv::dump (Char* pFileName, Bool bAdd) 319 275 { 320 276 FILE* pFile; … … 328 284 } 329 285 330 Int shift = g_ uiBitIncrement;286 Int shift = g_bitDepthY-8; 331 287 Int offset = (shift>0)?(1<<(shift-1)):0; 332 288 … … 338 294 Pel* piCr = getCrAddr(); 339 295 340 Pel iMax = ((1<<(g_uiBitDepth))-1);341 342 296 for ( y = 0; y < m_iPicHeight; y++ ) 343 297 { 344 298 for ( x = 0; x < m_iPicWidth; x++ ) 345 299 { 346 uc = (UChar)Clip3<Pel>(0, iMax, (piY[x]+offset)>>shift);300 uc = (UChar)Clip3<Pel>(0, 255, (piY[x]+offset)>>shift); 347 301 348 302 fwrite( &uc, sizeof(UChar), 1, pFile ); … … 351 305 } 352 306 307 shift = g_bitDepthC-8; 308 offset = (shift>0)?(1<<(shift-1)):0; 309 353 310 for ( y = 0; y < m_iPicHeight >> 1; y++ ) 354 311 { 355 312 for ( x = 0; x < m_iPicWidth >> 1; x++ ) 356 313 { 357 uc = (UChar)Clip3<Pel>(0, iMax, (piCb[x]+offset)>>shift);314 uc = (UChar)Clip3<Pel>(0, 255, (piCb[x]+offset)>>shift); 358 315 fwrite( &uc, sizeof(UChar), 1, pFile ); 359 316 } … … 365 322 for ( x = 0; x < m_iPicWidth >> 1; x++ ) 366 323 { 367 uc = (UChar)Clip3<Pel>(0, iMax, (piCr[x]+offset)>>shift);324 uc = (UChar)Clip3<Pel>(0, 255, (piCr[x]+offset)>>shift); 368 325 fwrite( &uc, sizeof(UChar), 1, pFile ); 369 326 } … … 374 331 } 375 332 376 #if FIXED_ROUNDING_FRAME_MEMORY 377 Void TComPicYuv::xFixedRoundingPic() 378 { 379 Int x, y; 380 Pel* pRec = getLumaAddr(); 381 Int iStride = getStride(); 382 Int iWidth = getWidth(); 383 Int iHeight = getHeight(); 384 #if FULL_NBIT 385 Int iOffset = ((g_uiBitDepth-8)>0)?(1<<(g_uiBitDepth-8-1)):0; 386 Int iMask = (~0<<(g_uiBitDepth-8)); 387 Int iMaxBdi = g_uiBASE_MAX<<(g_uiBitDepth-8); 388 #else 389 Int iOffset = (g_uiBitIncrement>0)?(1<<(g_uiBitIncrement-1)):0; 390 Int iMask = (~0<<g_uiBitIncrement); 391 Int iMaxBdi = g_uiBASE_MAX<<g_uiBitIncrement; 392 #endif 393 394 for( y = 0; y < iHeight; y++ ) 395 { 396 for( x = 0; x < iWidth; x++ ) 397 { 398 #if IBDI_NOCLIP_RANGE 399 pRec[x] = ( pRec[x] + iOffset ) & iMask; 400 #else 401 pRec[x] = ( pRec[x]+iOffset>iMaxBdi)? iMaxBdi : ((pRec[x]+iOffset) & iMask); 402 #endif 403 } 404 pRec += iStride; 405 } 406 407 iHeight >>= 1; 408 iWidth >>= 1; 409 iStride >>= 1; 410 pRec = getCbAddr(); 411 412 for( y = 0; y < iHeight; y++ ) 413 { 414 for( x = 0; x < iWidth; x++ ) 415 { 416 #if IBDI_NOCLIP_RANGE 417 pRec[x] = ( pRec[x] + iOffset ) & iMask; 418 #else 419 pRec[x] = ( pRec[x]+iOffset>iMaxBdi)? iMaxBdi : ((pRec[x]+iOffset) & iMask); 420 #endif 421 } 422 pRec += iStride; 423 } 424 425 pRec = getCrAddr(); 426 427 for( y = 0; y < iHeight; y++ ) 428 { 429 for( x = 0; x < iWidth; x++ ) 430 { 431 #if IBDI_NOCLIP_RANGE 432 pRec[x] = ( pRec[x] + iOffset ) & iMask; 433 #else 434 pRec[x] = ( pRec[x]+iOffset>iMaxBdi)? iMaxBdi : ((pRec[x]+iOffset) & iMask); 435 #endif 436 } 437 pRec += iStride; 438 } 439 } 440 #endif 441 333 #if H_3D 334 #if H_3D_IV_MERGE 442 335 Void 443 336 TComPicYuv::getTopLeftSamplePos( Int iCuAddr, Int iAbsZorderIdx, Int& riX, Int& riY ) … … 465 358 riAbsZorderIdx = g_auiRasterToZscan[ iRastPartIdx ]; 466 359 } 467 360 #endif 468 361 Void TComPicYuv::setLumaTo( Pel pVal ) 469 362 { … … 488 381 } 489 382 } 490 #if QC_ARP_D0177491 Void TComPicYuv::clearPic()492 {493 ::memset ( m_apiPicBufY, 0 , sizeof (Pel) * ( m_iPicWidth + (m_iLumaMarginX << 1)) * ( m_iPicHeight + (m_iLumaMarginY << 1)) );494 ::memset ( m_apiPicBufU, 0 , sizeof (Pel) * ((m_iPicWidth >> 1) + (m_iChromaMarginX << 1)) * ((m_iPicHeight >> 1) + (m_iChromaMarginY << 1)) );495 ::memset ( m_apiPicBufV, 0 , sizeof (Pel) * ((m_iPicWidth >> 1) + (m_iChromaMarginX << 1)) * ((m_iPicHeight >> 1) + (m_iChromaMarginY << 1)) );496 }497 383 #endif 384 498 385 //! \}
Note: See TracChangeset for help on using the changeset viewer.