Changeset 1313 in SHVCSoftware
- Timestamp:
- 21 Jul 2015, 01:34:51 (9 years ago)
- Location:
- branches/SHM-dev/source/Lib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/Lib/TLibCommon/TComYuv.cpp
r1287 r1313 68 68 m_chromaFormatIDC = chromaFormatIDC; 69 69 70 for(Int c h=0; ch<MAX_NUM_COMPONENT; ch++)70 for(Int comp=0; comp<MAX_NUM_COMPONENT; comp++) 71 71 { 72 72 // memory allocation 73 m_apiBuf[c h] = (Pel*)xMalloc( Pel, getWidth(ComponentID(ch))*getHeight(ComponentID(ch)) );73 m_apiBuf[comp] = (Pel*)xMalloc( Pel, getWidth(ComponentID(comp))*getHeight(ComponentID(comp)) ); 74 74 } 75 75 } … … 78 78 { 79 79 // memory free 80 for(Int c h=0; ch<MAX_NUM_COMPONENT; ch++)81 { 82 if (m_apiBuf[c h]!=NULL)83 { 84 xFree( m_apiBuf[c h] );85 m_apiBuf[c h] = NULL;80 for(Int comp=0; comp<MAX_NUM_COMPONENT; comp++) 81 { 82 if (m_apiBuf[comp]!=NULL) 83 { 84 xFree( m_apiBuf[comp] ); 85 m_apiBuf[comp] = NULL; 86 86 } 87 87 } … … 90 90 Void TComYuv::clear() 91 91 { 92 for(Int c h=0; ch<MAX_NUM_COMPONENT; ch++)93 { 94 if (m_apiBuf[c h]!=NULL)95 { 96 ::memset( m_apiBuf[c h], 0, ( getWidth(ComponentID(ch)) * getHeight(ComponentID(ch)) )*sizeof(Pel) );92 for(Int comp=0; comp<MAX_NUM_COMPONENT; comp++) 93 { 94 if (m_apiBuf[comp]!=NULL) 95 { 96 ::memset( m_apiBuf[comp], 0, ( getWidth(ComponentID(comp)) * getHeight(ComponentID(comp)) )*sizeof(Pel) ); 97 97 } 98 98 } … … 104 104 Void TComYuv::copyToPicYuv ( TComPicYuv* pcPicYuvDst, const UInt ctuRsAddr, const UInt uiAbsZorderIdx, const UInt uiPartDepth, const UInt uiPartIdx ) const 105 105 { 106 for(Int c h=0; ch<getNumberValidComponents(); ch++)107 { 108 copyToPicComponent ( ComponentID(c h), pcPicYuvDst, ctuRsAddr, uiAbsZorderIdx, uiPartDepth, uiPartIdx );109 } 110 } 111 112 Void TComYuv::copyToPicComponent ( const ComponentID c h, TComPicYuv* pcPicYuvDst, const UInt ctuRsAddr, const UInt uiAbsZorderIdx, const UInt uiPartDepth, const UInt uiPartIdx ) const113 { 114 const Int iWidth = getWidth(c h) >>uiPartDepth;115 const Int iHeight = getHeight(c h)>>uiPartDepth;116 117 const Pel* pSrc = getAddr(c h, uiPartIdx, iWidth);118 Pel* pDst = pcPicYuvDst->getAddr ( c h, ctuRsAddr, uiAbsZorderIdx );119 120 const UInt iSrcStride = getStride(c h);121 const UInt iDstStride = pcPicYuvDst->getStride(c h);106 for(Int comp=0; comp<getNumberValidComponents(); comp++) 107 { 108 copyToPicComponent ( ComponentID(comp), pcPicYuvDst, ctuRsAddr, uiAbsZorderIdx, uiPartDepth, uiPartIdx ); 109 } 110 } 111 112 Void TComYuv::copyToPicComponent ( const ComponentID compID, TComPicYuv* pcPicYuvDst, const UInt ctuRsAddr, const UInt uiAbsZorderIdx, const UInt uiPartDepth, const UInt uiPartIdx ) const 113 { 114 const Int iWidth = getWidth(compID) >>uiPartDepth; 115 const Int iHeight = getHeight(compID)>>uiPartDepth; 116 117 const Pel* pSrc = getAddr(compID, uiPartIdx, iWidth); 118 Pel* pDst = pcPicYuvDst->getAddr ( compID, ctuRsAddr, uiAbsZorderIdx ); 119 120 const UInt iSrcStride = getStride(compID); 121 const UInt iDstStride = pcPicYuvDst->getStride(compID); 122 122 123 123 for ( Int y = iHeight; y != 0; y-- ) … … 134 134 Void TComYuv::copyFromPicYuv ( const TComPicYuv* pcPicYuvSrc, const UInt ctuRsAddr, const UInt uiAbsZorderIdx ) 135 135 { 136 for(Int c h=0; ch<getNumberValidComponents(); ch++)137 { 138 copyFromPicComponent ( ComponentID(c h), pcPicYuvSrc, ctuRsAddr, uiAbsZorderIdx );139 } 140 } 141 142 Void TComYuv::copyFromPicComponent ( const ComponentID c h, const TComPicYuv* pcPicYuvSrc, const UInt ctuRsAddr, const UInt uiAbsZorderIdx )143 { 144 Pel* pDst = getAddr(c h);145 const Pel* pSrc = pcPicYuvSrc->getAddr ( c h, ctuRsAddr, uiAbsZorderIdx );146 147 const UInt iDstStride = getStride(c h);148 const UInt iSrcStride = pcPicYuvSrc->getStride(c h);149 const Int iWidth=getWidth(c h);150 const Int iHeight=getHeight(c h);136 for(Int comp=0; comp<getNumberValidComponents(); comp++) 137 { 138 copyFromPicComponent ( ComponentID(comp), pcPicYuvSrc, ctuRsAddr, uiAbsZorderIdx ); 139 } 140 } 141 142 Void TComYuv::copyFromPicComponent ( const ComponentID compID, const TComPicYuv* pcPicYuvSrc, const UInt ctuRsAddr, const UInt uiAbsZorderIdx ) 143 { 144 Pel* pDst = getAddr(compID); 145 const Pel* pSrc = pcPicYuvSrc->getAddr ( compID, ctuRsAddr, uiAbsZorderIdx ); 146 147 const UInt iDstStride = getStride(compID); 148 const UInt iSrcStride = pcPicYuvSrc->getStride(compID); 149 const Int iWidth=getWidth(compID); 150 const Int iHeight=getHeight(compID); 151 151 152 152 for (Int y = iHeight; y != 0; y-- ) … … 163 163 Void TComYuv::copyToPartYuv( TComYuv* pcYuvDst, const UInt uiDstPartIdx ) const 164 164 { 165 for(Int c h=0; ch<getNumberValidComponents(); ch++)166 { 167 copyToPartComponent ( ComponentID(c h), pcYuvDst, uiDstPartIdx );168 } 169 } 170 171 Void TComYuv::copyToPartComponent( const ComponentID c h, TComYuv* pcYuvDst, const UInt uiDstPartIdx ) const172 { 173 const Pel* pSrc = getAddr(c h);174 Pel* pDst = pcYuvDst->getAddr( c h, uiDstPartIdx );175 176 const UInt iSrcStride = getStride(c h);177 const UInt iDstStride = pcYuvDst->getStride(c h);178 const Int iWidth=getWidth(c h);179 const Int iHeight=getHeight(c h);165 for(Int comp=0; comp<getNumberValidComponents(); comp++) 166 { 167 copyToPartComponent ( ComponentID(comp), pcYuvDst, uiDstPartIdx ); 168 } 169 } 170 171 Void TComYuv::copyToPartComponent( const ComponentID compID, TComYuv* pcYuvDst, const UInt uiDstPartIdx ) const 172 { 173 const Pel* pSrc = getAddr(compID); 174 Pel* pDst = pcYuvDst->getAddr( compID, uiDstPartIdx ); 175 176 const UInt iSrcStride = getStride(compID); 177 const UInt iDstStride = pcYuvDst->getStride(compID); 178 const Int iWidth=getWidth(compID); 179 const Int iHeight=getHeight(compID); 180 180 181 181 for (Int y = iHeight; y != 0; y-- ) … … 192 192 Void TComYuv::copyPartToYuv( TComYuv* pcYuvDst, const UInt uiSrcPartIdx ) const 193 193 { 194 for(Int c h=0; ch<getNumberValidComponents(); ch++)195 { 196 copyPartToComponent ( ComponentID(c h), pcYuvDst, uiSrcPartIdx );197 } 198 } 199 200 Void TComYuv::copyPartToComponent( const ComponentID c h, TComYuv* pcYuvDst, const UInt uiSrcPartIdx ) const201 { 202 const Pel* pSrc = getAddr(c h, uiSrcPartIdx);203 Pel* pDst = pcYuvDst->getAddr(c h, 0 );204 205 const UInt iSrcStride = getStride(c h);206 const UInt iDstStride = pcYuvDst->getStride(c h);207 208 const UInt uiHeight = pcYuvDst->getHeight(c h);209 const UInt uiWidth = pcYuvDst->getWidth(c h);194 for(Int comp=0; comp<getNumberValidComponents(); comp++) 195 { 196 copyPartToComponent ( ComponentID(comp), pcYuvDst, uiSrcPartIdx ); 197 } 198 } 199 200 Void TComYuv::copyPartToComponent( const ComponentID compID, TComYuv* pcYuvDst, const UInt uiSrcPartIdx ) const 201 { 202 const Pel* pSrc = getAddr(compID, uiSrcPartIdx); 203 Pel* pDst = pcYuvDst->getAddr(compID, 0 ); 204 205 const UInt iSrcStride = getStride(compID); 206 const UInt iDstStride = pcYuvDst->getStride(compID); 207 208 const UInt uiHeight = pcYuvDst->getHeight(compID); 209 const UInt uiWidth = pcYuvDst->getWidth(compID); 210 210 211 211 for ( UInt y = uiHeight; y != 0; y-- ) … … 222 222 Void TComYuv::copyPartToPartYuv ( TComYuv* pcYuvDst, const UInt uiPartIdx, const UInt iWidth, const UInt iHeight ) const 223 223 { 224 for(Int c h=0; ch<getNumberValidComponents(); ch++)225 { 226 copyPartToPartComponent (ComponentID(c h), pcYuvDst, uiPartIdx, iWidth>>getComponentScaleX(ComponentID(ch)), iHeight>>getComponentScaleY(ComponentID(ch)) );227 } 228 } 229 230 Void TComYuv::copyPartToPartComponent ( const ComponentID c h, TComYuv* pcYuvDst, const UInt uiPartIdx, const UInt iWidthComponent, const UInt iHeightComponent ) const231 { 232 const Pel* pSrc = getAddr(c h, uiPartIdx);233 Pel* pDst = pcYuvDst->getAddr(c h, uiPartIdx);224 for(Int comp=0; comp<getNumberValidComponents(); comp++) 225 { 226 copyPartToPartComponent (ComponentID(comp), pcYuvDst, uiPartIdx, iWidth>>getComponentScaleX(ComponentID(comp)), iHeight>>getComponentScaleY(ComponentID(comp)) ); 227 } 228 } 229 230 Void TComYuv::copyPartToPartComponent ( const ComponentID compID, TComYuv* pcYuvDst, const UInt uiPartIdx, const UInt iWidthComponent, const UInt iHeightComponent ) const 231 { 232 const Pel* pSrc = getAddr(compID); 233 Pel* pDst = pcYuvDst->getAddr(compID, uiPartIdx); 234 234 if( pSrc == pDst ) 235 235 { … … 239 239 } 240 240 241 const UInt iSrcStride = getStride(c h);242 const UInt iDstStride = pcYuvDst->getStride(c h);241 const UInt iSrcStride = getStride(compID); 242 const UInt iDstStride = pcYuvDst->getStride(compID); 243 243 for ( UInt y = iHeightComponent; y != 0; y-- ) 244 244 { … … 252 252 253 253 254 Void TComYuv::copyPartToPartComponentMxN ( const ComponentID c h, TComYuv* pcYuvDst, const TComRectangle &rect) const255 { 256 const Pel* pSrc = getAddrPix( c h, rect.x0, rect.y0 );257 Pel* pDst = pcYuvDst->getAddrPix( c h, rect.x0, rect.y0 );254 Void TComYuv::copyPartToPartComponentMxN ( const ComponentID compID, TComYuv* pcYuvDst, const TComRectangle &rect) const 255 { 256 const Pel* pSrc = getAddrPix( compID, rect.x0, rect.y0 ); 257 Pel* pDst = pcYuvDst->getAddrPix( compID, rect.x0, rect.y0 ); 258 258 if( pSrc == pDst ) 259 259 { … … 263 263 } 264 264 265 const UInt iSrcStride = getStride(c h);266 const UInt iDstStride = pcYuvDst->getStride(c h);265 const UInt iSrcStride = getStride(compID); 266 const UInt iDstStride = pcYuvDst->getStride(compID); 267 267 const UInt uiHeightComponent=rect.height; 268 268 const UInt uiWidthComponent=rect.width; … … 280 280 Void TComYuv::addClip( const TComYuv* pcYuvSrc0, const TComYuv* pcYuvSrc1, const UInt uiTrUnitIdx, const UInt uiPartSize, const BitDepths &clipBitDepths ) 281 281 { 282 for(Int c han=0; chan<getNumberValidComponents(); chan++)283 { 284 const ComponentID c h=ComponentID(chan);285 const Int uiPartWidth =uiPartSize>>getComponentScaleX(c h);286 const Int uiPartHeight=uiPartSize>>getComponentScaleY(c h);287 288 const Pel* pSrc0 = pcYuvSrc0->getAddr(c h, uiTrUnitIdx, uiPartWidth );289 const Pel* pSrc1 = pcYuvSrc1->getAddr(c h, uiTrUnitIdx, uiPartWidth );290 Pel* pDst = getAddr(c h, uiTrUnitIdx, uiPartWidth );291 292 const UInt iSrc0Stride = pcYuvSrc0->getStride(c h);293 const UInt iSrc1Stride = pcYuvSrc1->getStride(c h);294 const UInt iDstStride = getStride(c h);295 const Int clipbd = clipBitDepths.recon[toChannelType(c h)];282 for(Int comp=0; comp<getNumberValidComponents(); comp++) 283 { 284 const ComponentID compID=ComponentID(comp); 285 const Int uiPartWidth =uiPartSize>>getComponentScaleX(compID); 286 const Int uiPartHeight=uiPartSize>>getComponentScaleY(compID); 287 288 const Pel* pSrc0 = pcYuvSrc0->getAddr(compID, uiTrUnitIdx, uiPartWidth ); 289 const Pel* pSrc1 = pcYuvSrc1->getAddr(compID, uiTrUnitIdx, uiPartWidth ); 290 Pel* pDst = getAddr(compID, uiTrUnitIdx, uiPartWidth ); 291 292 const UInt iSrc0Stride = pcYuvSrc0->getStride(compID); 293 const UInt iSrc1Stride = pcYuvSrc1->getStride(compID); 294 const UInt iDstStride = getStride(compID); 295 const Int clipbd = clipBitDepths.recon[toChannelType(compID)]; 296 296 #if O0043_BEST_EFFORT_DECODING 297 const Int bitDepthDelta = clipBitDepths.stream[toChannelType(c h)] - clipbd;297 const Int bitDepthDelta = clipBitDepths.stream[toChannelType(compID)] - clipbd; 298 298 #endif 299 299 … … 320 320 Void TComYuv::subtract( const TComYuv* pcYuvSrc0, const TComYuv* pcYuvSrc1, const UInt uiTrUnitIdx, const UInt uiPartSize ) 321 321 { 322 for(Int c han=0; chan<getNumberValidComponents(); chan++)323 { 324 const ComponentID c h=ComponentID(chan);325 const Int uiPartWidth =uiPartSize>>getComponentScaleX(c h);326 const Int uiPartHeight=uiPartSize>>getComponentScaleY(c h);327 328 const Pel* pSrc0 = pcYuvSrc0->getAddr( c h, uiTrUnitIdx, uiPartWidth );329 const Pel* pSrc1 = pcYuvSrc1->getAddr( c h, uiTrUnitIdx, uiPartWidth );330 Pel* pDst = getAddr( c h, uiTrUnitIdx, uiPartWidth );331 332 const Int iSrc0Stride = pcYuvSrc0->getStride(c h);333 const Int iSrc1Stride = pcYuvSrc1->getStride(c h);334 const Int iDstStride = getStride(c h);322 for(Int comp=0; comp<getNumberValidComponents(); comp++) 323 { 324 const ComponentID compID=ComponentID(comp); 325 const Int uiPartWidth =uiPartSize>>getComponentScaleX(compID); 326 const Int uiPartHeight=uiPartSize>>getComponentScaleY(compID); 327 328 const Pel* pSrc0 = pcYuvSrc0->getAddr( compID, uiTrUnitIdx, uiPartWidth ); 329 const Pel* pSrc1 = pcYuvSrc1->getAddr( compID, uiTrUnitIdx, uiPartWidth ); 330 Pel* pDst = getAddr( compID, uiTrUnitIdx, uiPartWidth ); 331 332 const Int iSrc0Stride = pcYuvSrc0->getStride(compID); 333 const Int iSrc1Stride = pcYuvSrc1->getStride(compID); 334 const Int iDstStride = getStride(compID); 335 335 336 336 for (Int y = uiPartHeight-1; y >= 0; y-- ) … … 352 352 Void TComYuv::addAvg( const TComYuv* pcYuvSrc0, const TComYuv* pcYuvSrc1, const UInt iPartUnitIdx, const UInt uiWidth, const UInt uiHeight, const BitDepths &clipBitDepths ) 353 353 { 354 for(Int c han=0; chan<getNumberValidComponents(); chan++)355 { 356 const ComponentID c h=ComponentID(chan);357 const Pel* pSrc0 = pcYuvSrc0->getAddr( c h, iPartUnitIdx );358 const Pel* pSrc1 = pcYuvSrc1->getAddr( c h, iPartUnitIdx );359 Pel* pDst = getAddr( c h, iPartUnitIdx );360 361 const UInt iSrc0Stride = pcYuvSrc0->getStride(c h);362 const UInt iSrc1Stride = pcYuvSrc1->getStride(c h);363 const UInt iDstStride = getStride(c h);364 const Int clipbd = clipBitDepths.recon[toChannelType(c h)];354 for(Int comp=0; comp<getNumberValidComponents(); comp++) 355 { 356 const ComponentID compID=ComponentID(comp); 357 const Pel* pSrc0 = pcYuvSrc0->getAddr( compID, iPartUnitIdx ); 358 const Pel* pSrc1 = pcYuvSrc1->getAddr( compID, iPartUnitIdx ); 359 Pel* pDst = getAddr( compID, iPartUnitIdx ); 360 361 const UInt iSrc0Stride = pcYuvSrc0->getStride(compID); 362 const UInt iSrc1Stride = pcYuvSrc1->getStride(compID); 363 const UInt iDstStride = getStride(compID); 364 const Int clipbd = clipBitDepths.recon[toChannelType(compID)]; 365 365 const Int shiftNum = std::max<Int>(2, (IF_INTERNAL_PREC - clipbd)) + 1; 366 366 const Int offset = ( 1 << ( shiftNum - 1 ) ) + 2 * IF_INTERNAL_OFFS; 367 367 368 const Int iWidth = uiWidth >> getComponentScaleX(c h);369 const Int iHeight = uiHeight >> getComponentScaleY(c h);368 const Int iWidth = uiWidth >> getComponentScaleX(compID); 369 const Int iHeight = uiHeight >> getComponentScaleY(compID); 370 370 371 371 if (iWidth&1) … … 407 407 } 408 408 409 Void TComYuv::removeHighFreq( const TComYuv* pcYuvSrc, const UInt uiPartIdx, const UInt uiWidth, UInt const uiHeight ) 410 { 411 for(Int chan=0; chan<getNumberValidComponents(); chan++) 412 { 413 const ComponentID ch=ComponentID(chan); 409 Void TComYuv::removeHighFreq( const TComYuv* pcYuvSrc, 410 const UInt uiPartIdx, 411 const UInt uiWidth, 412 const UInt uiHeight 414 413 #if !DISABLING_CLIP_FOR_BIPREDME 415 const ChannelType chType=toChannelType(ch);414 ,const Int bitDepths[MAX_NUM_CHANNEL_TYPE] 416 415 #endif 417 418 const Pel* pSrc = pcYuvSrc->getAddr(ch, uiPartIdx); 419 Pel* pDst = getAddr(ch, uiPartIdx); 420 421 const Int iSrcStride = pcYuvSrc->getStride(ch); 422 const Int iDstStride = getStride(ch); 423 const Int iWidth = uiWidth >>getComponentScaleX(ch); 424 const Int iHeight = uiHeight>>getComponentScaleY(ch); 416 ) 417 { 418 for(Int comp=0; comp<getNumberValidComponents(); comp++) 419 { 420 const ComponentID compID=ComponentID(comp); 421 #if !DISABLING_CLIP_FOR_BIPREDME 422 const Int clipBd=bitDepths[toChannelType(compID)]; 423 #endif 424 425 const Pel* pSrc = pcYuvSrc->getAddr(compID, uiPartIdx); 426 Pel* pDst = getAddr(compID, uiPartIdx); 427 428 const Int iSrcStride = pcYuvSrc->getStride(compID); 429 const Int iDstStride = getStride(compID); 430 const Int iWidth = uiWidth >>getComponentScaleX(compID); 431 const Int iHeight = uiHeight>>getComponentScaleY(compID); 425 432 426 433 for ( Int y = iHeight-1; y >= 0; y-- ) … … 431 438 pDst[x ] = (2 * pDst[x]) - pSrc[x]; 432 439 #else 433 pDst[x ] = Clip ((2 * pDst[x]) - pSrc[x], chType);440 pDst[x ] = ClipBD((2 * pDst[x]) - pSrc[x], clipBd); 434 441 #endif 435 442 } -
branches/SHM-dev/source/Lib/TLibCommon/TComYuv.h
r1287 r1313 139 139 Void addAvg ( const TComYuv* pcYuvSrc0, const TComYuv* pcYuvSrc1, const UInt iPartUnitIdx, const UInt iWidth, const UInt iHeight, const BitDepths &clipBitDepths ); 140 140 141 Void removeHighFreq ( const TComYuv* pcYuvSrc, const UInt uiPartIdx, const UInt uiWidth, const UInt uiHeight ); 141 Void removeHighFreq ( const TComYuv* pcYuvSrc, const UInt uiPartIdx, const UInt uiWidth, const UInt uiHeight 142 #if !DISABLING_CLIP_FOR_BIPREDME 143 , const Int bitDepths[MAX_NUM_CHANNEL_TYPE] 144 #endif 145 ); 142 146 143 147 // ------------------------------------------------------------------------------------------------------------------ -
branches/SHM-dev/source/Lib/TLibEncoder/TEncSearch.cpp
r1307 r1313 3892 3892 pcYuvOrg->copyPartToPartYuv( pcYuv, uiPartAddr, iRoiWidth, iRoiHeight ); 3893 3893 3894 pcYuv->removeHighFreq( pcYuvOther, uiPartAddr, iRoiWidth, iRoiHeight ); 3894 pcYuv->removeHighFreq( pcYuvOther, uiPartAddr, iRoiWidth, iRoiHeight 3895 #if !DISABLING_CLIP_FOR_BIPREDME 3896 , pcCU->getSlice()->getSPS()->getBitDepths().recon 3897 #endif 3898 ); 3895 3899 3896 3900 fWeight = 0.5;
Note: See TracChangeset for help on using the changeset viewer.