Changeset 608 in 3DVCSoftware for trunk/source/Lib/TLibCommon/TComInterpolationFilter.cpp
- Timestamp:
- 1 Sep 2013, 22:47:26 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/Lib/TLibCommon/TComInterpolationFilter.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 * … … 72 72 { -2, 10, 58, -2 } 73 73 }; 74 #if QC_ARP_D0177 74 75 #if H_3D_ARP 75 76 const Short TComInterpolationFilter::m_lumaFilterARP[4][NTAPS_LUMA_ARP] = 76 77 { … … 92 93 }; 93 94 #endif 95 94 96 // ==================================================================================================================== 95 97 // Private member functions … … 99 101 * \brief Apply unit FIR filter to a block of samples 100 102 * 103 * \param bitDepth bitDepth of samples 101 104 * \param src Pointer to source samples 102 105 * \param srcStride Stride of source samples … … 108 111 * \param isLast Flag indicating whether it is the last filtering operation 109 112 */ 110 Void TComInterpolationFilter::filterCopy( const Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Bool isFirst, Bool isLast)113 Void TComInterpolationFilter::filterCopy(Int bitDepth, const Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Bool isFirst, Bool isLast) 111 114 { 112 115 Int row, col; … … 127 130 else if ( isFirst ) 128 131 { 129 Int shift = IF_INTERNAL_PREC - ( g_uiBitDepth + g_uiBitIncrement );132 Int shift = IF_INTERNAL_PREC - bitDepth; 130 133 131 134 for (row = 0; row < height; row++) … … 143 146 else 144 147 { 145 Int shift = IF_INTERNAL_PREC - ( g_uiBitDepth + g_uiBitIncrement ); 146 Short offset = IF_INTERNAL_OFFS + (1 << (shift - 1)); 147 Short maxVal = g_uiIBDI_MAX; 148 Int shift = IF_INTERNAL_PREC - bitDepth; 149 Short offset = IF_INTERNAL_OFFS; 150 offset += shift?(1 << (shift - 1)):0; 151 Short maxVal = (1 << bitDepth) - 1; 148 152 Short minVal = 0; 149 153 for (row = 0; row < height; row++) … … 171 175 * \tparam isFirst Flag indicating whether it is the first filtering operation 172 176 * \tparam isLast Flag indicating whether it is the last filtering operation 177 * \param bitDepth Bit depth of samples 173 178 * \param src Pointer to source samples 174 179 * \param srcStride Stride of source samples … … 179 184 * \param coeff Pointer to filter taps 180 185 */ 181 template< int N, bool isVertical, bool isFirst, bool isLast>182 Void TComInterpolationFilter::filter( Short const *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Short const *coeff)186 template<Int N, Bool isVertical, Bool isFirst, Bool isLast> 187 Void TComInterpolationFilter::filter(Int bitDepth, Short const *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Short const *coeff) 183 188 { 184 189 Int row, col; … … 208 213 Int offset; 209 214 Short maxVal; 210 Int headRoom = IF_INTERNAL_PREC - (g_uiBitDepth + g_uiBitIncrement);215 Int headRoom = IF_INTERNAL_PREC - bitDepth; 211 216 Int shift = IF_FILTER_PREC; 212 217 if ( isLast ) … … 215 220 offset = 1 << (shift - 1); 216 221 offset += (isFirst) ? 0 : IF_INTERNAL_OFFS << IF_FILTER_PREC; 217 maxVal = g_uiIBDI_MAX;222 maxVal = (1 << bitDepth) - 1; 218 223 } 219 224 else … … 266 271 * 267 272 * \tparam N Number of taps 273 * \param bitDepth Bit depth of samples 268 274 * \param src Pointer to source samples 269 275 * \param srcStride Stride of source samples … … 275 281 * \param coeff Pointer to filter taps 276 282 */ 277 template< int N>278 Void TComInterpolationFilter::filterHor( Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Bool isLast, Short const *coeff)283 template<Int N> 284 Void TComInterpolationFilter::filterHor(Int bitDepth, Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Bool isLast, Short const *coeff) 279 285 { 280 286 if ( isLast ) 281 287 { 282 filter<N, false, true, true>( src, srcStride, dst, dstStride, width, height, coeff);283 } 284 else 285 { 286 filter<N, false, true, false>( src, srcStride, dst, dstStride, width, height, coeff);288 filter<N, false, true, true>(bitDepth, src, srcStride, dst, dstStride, width, height, coeff); 289 } 290 else 291 { 292 filter<N, false, true, false>(bitDepth, src, srcStride, dst, dstStride, width, height, coeff); 287 293 } 288 294 } … … 292 298 * 293 299 * \tparam N Number of taps 300 * \param bitDpeth Sample bit depth 294 301 * \param src Pointer to source samples 295 302 * \param srcStride Stride of source samples … … 302 309 * \param coeff Pointer to filter taps 303 310 */ 304 template< int N>305 Void TComInterpolationFilter::filterVer( Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Bool isFirst, Bool isLast, Short const *coeff)311 template<Int N> 312 Void TComInterpolationFilter::filterVer(Int bitDepth, Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Bool isFirst, Bool isLast, Short const *coeff) 306 313 { 307 314 if ( isFirst && isLast ) 308 315 { 309 filter<N, true, true, true>( src, srcStride, dst, dstStride, width, height, coeff);316 filter<N, true, true, true>(bitDepth, src, srcStride, dst, dstStride, width, height, coeff); 310 317 } 311 318 else if ( isFirst && !isLast ) 312 319 { 313 filter<N, true, true, false>( src, srcStride, dst, dstStride, width, height, coeff);320 filter<N, true, true, false>(bitDepth, src, srcStride, dst, dstStride, width, height, coeff); 314 321 } 315 322 else if ( !isFirst && isLast ) 316 323 { 317 filter<N, true, false, true>( src, srcStride, dst, dstStride, width, height, coeff);318 } 319 else 320 { 321 filter<N, true, false, false>( src, srcStride, dst, dstStride, width, height, coeff);324 filter<N, true, false, true>(bitDepth, src, srcStride, dst, dstStride, width, height, coeff); 325 } 326 else 327 { 328 filter<N, true, false, false>(bitDepth, src, srcStride, dst, dstStride, width, height, coeff); 322 329 } 323 330 } … … 340 347 */ 341 348 Void TComInterpolationFilter::filterHorLuma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast 342 #if QC_ARP_D0177 343 , 344 Bool filterType 345 #endif 346 ) 349 #if H_3D_ARP 350 , Bool filterType 351 #endif 352 ) 347 353 { 348 354 assert(frac >= 0 && frac < 4); … … 350 356 if ( frac == 0 ) 351 357 { 352 filterCopy( src, srcStride, dst, dstStride, width, height, true, isLast );353 } 354 else 355 { 356 #if QC_ARP_D0177358 filterCopy(g_bitDepthY, src, srcStride, dst, dstStride, width, height, true, isLast ); 359 } 360 else 361 { 362 #if H_3D_ARP 357 363 if(filterType) 358 filterHor<NTAPS_LUMA_ARP>(src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilterARP[frac]); 364 { 365 filterHor<NTAPS_LUMA_ARP>(g_bitDepthY, src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilterARP[frac]); 366 } 359 367 else 360 #endif 361 filterHor<NTAPS_LUMA>(src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilter[frac]); 368 { 369 #endif 370 filterHor<NTAPS_LUMA>(g_bitDepthY, src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilter[frac]); 371 #if H_3D_ARP 372 } 373 #endif 362 374 } 363 375 } … … 376 388 * \param isLast Flag indicating whether it is the last filtering operation 377 389 */ 378 Void TComInterpolationFilter::filterVerLuma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast 379 #if QC_ARP_D0177 380 , 381 Bool filterType 382 #endif 383 ) 390 Void TComInterpolationFilter::filterVerLuma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast 391 #if H_3D_ARP 392 , Bool filterType 393 #endif 394 ) 384 395 { 385 396 assert(frac >= 0 && frac < 4); … … 387 398 if ( frac == 0 ) 388 399 { 389 filterCopy( src, srcStride, dst, dstStride, width, height, isFirst, isLast );390 } 391 else 392 { 393 #if QC_ARP_D0177400 filterCopy(g_bitDepthY, src, srcStride, dst, dstStride, width, height, isFirst, isLast ); 401 } 402 else 403 { 404 #if H_3D_ARP 394 405 if(filterType) 395 filterVer<NTAPS_LUMA_ARP>(src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaFilterARP[frac]); 406 { 407 filterVer<NTAPS_LUMA_ARP>(g_bitDepthY, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaFilterARP[frac]); 408 } 396 409 else 397 #endif 398 filterVer<NTAPS_LUMA>(src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaFilter[frac]); 410 { 411 #endif 412 filterVer<NTAPS_LUMA>(g_bitDepthY, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaFilter[frac]); 413 #if H_3D_ARP 414 } 415 #endif 399 416 } 400 417 } … … 412 429 * \param isLast Flag indicating whether it is the last filtering operation 413 430 */ 414 Void TComInterpolationFilter::filterHorChroma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast 415 #if QC_ARP_D0177 416 , 417 Bool filterType 418 #endif 419 ) 431 Void TComInterpolationFilter::filterHorChroma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast 432 #if H_3D_ARP 433 , Bool filterType 434 #endif 435 ) 420 436 { 421 437 assert(frac >= 0 && frac < 8); … … 423 439 if ( frac == 0 ) 424 440 { 425 filterCopy( src, srcStride, dst, dstStride, width, height, true, isLast );426 } 427 else 428 { 429 #if QC_ARP_D0177441 filterCopy(g_bitDepthC, src, srcStride, dst, dstStride, width, height, true, isLast ); 442 } 443 else 444 { 445 #if H_3D_ARP 430 446 if(filterType) 431 filterHor<NTAPS_CHROMA_ARP>(src, srcStride, dst, dstStride, width, height, isLast, m_chromaFilterARP[frac]); 447 { 448 filterHor<NTAPS_CHROMA_ARP>(g_bitDepthC, src, srcStride, dst, dstStride, width, height, isLast, m_chromaFilterARP[frac]); 449 } 432 450 else 433 #endif 434 filterHor<NTAPS_CHROMA>(src, srcStride, dst, dstStride, width, height, isLast, m_chromaFilter[frac]); 451 { 452 #endif 453 filterHor<NTAPS_CHROMA>(g_bitDepthC, src, srcStride, dst, dstStride, width, height, isLast, m_chromaFilter[frac]); 454 #if H_3D_ARP 455 } 456 #endif 435 457 } 436 458 } … … 449 471 * \param isLast Flag indicating whether it is the last filtering operation 450 472 */ 451 Void TComInterpolationFilter::filterVerChroma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast 452 #if QC_ARP_D0177 453 , 454 Bool filterType 455 #endif 456 ) 473 Void TComInterpolationFilter::filterVerChroma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast 474 #if H_3D_ARP 475 , Bool filterType 476 #endif 477 ) 457 478 { 458 479 assert(frac >= 0 && frac < 8); … … 460 481 if ( frac == 0 ) 461 482 { 462 filterCopy( src, srcStride, dst, dstStride, width, height, isFirst, isLast );463 } 464 else 465 { 466 #if QC_ARP_D0177483 filterCopy(g_bitDepthC, src, srcStride, dst, dstStride, width, height, isFirst, isLast ); 484 } 485 else 486 { 487 #if H_3D_ARP 467 488 if(filterType) 468 filterVer<NTAPS_CHROMA_ARP>(src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_chromaFilterARP[frac]); 489 { 490 filterVer<NTAPS_CHROMA_ARP>(g_bitDepthC, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_chromaFilterARP[frac]); 491 } 469 492 else 470 #endif 471 filterVer<NTAPS_CHROMA>(src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_chromaFilter[frac]); 493 { 494 #endif 495 filterVer<NTAPS_CHROMA>(g_bitDepthC, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_chromaFilter[frac]); 496 #if H_3D_ARP 497 } 498 #endif 472 499 } 473 500 }
Note: See TracChangeset for help on using the changeset viewer.