Changeset 235 in SHVCSoftware
- Timestamp:
- 24 May 2013, 00:25:51 (12 years ago)
- Location:
- branches/SHM-2.1-dev/source/Lib/TLibCommon
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-2.1-dev/source/Lib/TLibCommon/TComUpsampleFilter.cpp
r233 r235 4 4 5 5 #if SVC_UPSAMPLING 6 // ====================================================================================================================7 // Tables:8 // 1. PHASE_DERIVATION_IN_INTEGER = 0 is the implementation using 2 multi-phase (12 phase and 8 phase) filter sets9 // by following K0378.10 // 2. PHASE_DERIVATION_IN_INTEGER = 1 is the implemetation using a 16-phase filter set just for speed up. Some phases11 // is approximated to x/16 (e.g. 1/3 -> 5/16).12 // 3. It was confirmed that two implementations provides the identical result.13 // 4. By default, PHASE_DERIVATION_IN_INTEGER is set to 1.14 // ====================================================================================================================15 6 #define CNU -1 ///< Coefficients Not Used 16 7 17 #if PHASE_DERIVATION_IN_INTEGER18 8 const Int TComUpsampleFilter::m_lumaFixedFilter[16][NTAPS_US_LUMA] = 19 9 { … … 74 64 #endif 75 65 }; 76 #else77 const Int TComUpsampleFilter::m_lumaFixedFilter[12][NTAPS_US_LUMA] =78 {79 { 0, 0, 0, 64, 0, 0, 0, 0},80 {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU},//1/1281 {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU},//2/1282 {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU},//3/1283 { -1, 4, -11, 52, 26, -8, 3, -1},//4/1284 {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU},//5/1285 { -1, 4, -11, 40, 40, -11, 4, -1},//6/1286 {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU},//7/1287 { -1, 3, -8, 26, 52, -11, 4, -1},//8/1288 {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU},//9/1289 {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU},//10/1290 {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU},//11/1291 };92 93 const Int TComUpsampleFilter::m_chromaFixedFilter15[12][NTAPS_US_CHROMA] =94 {95 { 0, 64, 0, 0},96 {CNU,CNU,CNU,CNU},//1/1297 {CNU,CNU,CNU,CNU},//2/1298 { -4, 54, 16, -2},//3/1299 { -5, 50, 22, -3},//4/12100 {CNU,CNU,CNU,CNU},//5/12101 {CNU,CNU,CNU,CNU},//6/12102 { -4, 30, 43, -5},//7/12103 { -3, 22, 50, -5},//8/12104 {CNU,CNU,CNU,CNU},//9/12105 {CNU,CNU,CNU,CNU},//10/12106 { -1, 5, 62, -2} //11/12107 };108 109 const Int TComUpsampleFilter::m_chromaFixedFilter20[8][NTAPS_US_CHROMA] =110 {111 { 0, 64, 0, 0},112 {CNU,CNU,CNU,CNU},//1/8113 {CNU,CNU,CNU,CNU},//2/8114 { -6, 46, 28, -4},//3/8115 { -4, 36, 36, -4},//4/8116 {CNU,CNU,CNU,CNU},//5/8117 {CNU,CNU,CNU,CNU},//6/8118 { -2, 10, 58, -2},//7/8119 };120 #endif121 66 122 67 TComUpsampleFilter::TComUpsampleFilter(void) … … 248 193 else 249 194 { 250 #if PHASE_DERIVATION_IN_INTEGER251 195 Int refPos16 = 0; 252 196 Int phase = 0; … … 258 202 memcpy( m_chromaFilter[i], m_chromaFixedFilter[i], sizeof(Int) * NTAPS_US_CHROMA ); 259 203 } 260 #else261 for ( i = 0; i < 12; i++)262 {263 memcpy( m_lumaFilter[i], m_lumaFixedFilter[i], sizeof(Int) * NTAPS_US_LUMA );264 }265 266 Int chromaPhaseDenominator;267 if (widthEL == 2*widthBL) // 2x scalability268 {269 for ( i = 0; i < 8; i++)270 {271 memcpy( m_chromaFilter[i], m_chromaFixedFilter20[i], sizeof(Int) * NTAPS_US_CHROMA );272 }273 chromaPhaseDenominator = 8;274 }275 else276 {277 for ( i = 0; i < 12; i++) // 1.5x scalability278 {279 memcpy( m_chromaFilter[i], m_chromaFixedFilter15[i], sizeof(Int) * NTAPS_US_CHROMA );280 }281 chromaPhaseDenominator = 12;282 }283 #endif284 204 285 205 assert ( widthEL == widthBL || widthEL == 2*widthBL || 2*widthEL == 3*widthBL ); … … 360 280 pcBasePic->extendPicBorder (); // extend the border. 361 281 362 #if PHASE_DERIVATION_IN_INTEGER363 282 Int shiftX = 16; 364 283 Int shiftY = 16; … … 378 297 Int scaleX = ( ( widthBL << shiftX ) + ( widthEL >> 1 ) ) / widthEL; 379 298 Int scaleY = ( ( heightBL << shiftY ) + ( heightEL >> 1 ) ) / heightEL; 380 #else 381 const Double sFactor = 1.0 * widthBL / widthEL; 382 const Double sFactor12 = sFactor * 12; 383 #endif 299 384 300 #if ILP_DECODED_PICTURE 385 301 widthEL = pcUsPic->getWidth (); … … 401 317 #if SCALED_REF_LAYER_OFFSETS 402 318 Int x = Clip3( leftStartL, rightEndL - 1, i ); 403 #endif404 #if PHASE_DERIVATION_IN_INTEGER405 #if SCALED_REF_LAYER_OFFSETS406 319 refPos16 = (((x - leftStartL)*scaleX + addX) >> shiftXM4) - deltaX; 407 320 #else … … 411 324 refPos = refPos16 >> 4; 412 325 coeff = m_lumaFilter[phase]; 413 #else414 Int refPos12 = (Int) ( i * sFactor12 );415 Int refPos = (Int)( i * sFactor );416 Int phase = (refPos12 + 12) % 12;417 Int* coeff = m_lumaFilter[phase];418 #endif419 326 420 327 piSrcY = piSrcBufY + refPos -((NTAPS_US_LUMA>>1) - 1); … … 447 354 #if SCALED_REF_LAYER_OFFSETS 448 355 Int y = Clip3(topStartL, bottomEndL - 1, j); 449 #endif450 #if PHASE_DERIVATION_IN_INTEGER451 #if SCALED_REF_LAYER_OFFSETS452 356 refPos16 = ((( y - topStartL )*scaleY + addY) >> shiftYM4) - deltaY; 453 357 #else … … 457 361 refPos = refPos16 >> 4; 458 362 coeff = m_lumaFilter[phase]; 459 #else460 Int refPos12 = (Int) (j * sFactor12 );461 Int refPos = (Int)( j * sFactor );462 Int phase = (refPos12 + 12) % 12;463 Int* coeff = m_lumaFilter[phase];464 #endif465 363 466 364 piSrcY = piTempBufY + (refPos -((NTAPS_US_LUMA>>1) - 1))*strideEL; … … 520 418 #endif 521 419 522 #if PHASE_DERIVATION_IN_INTEGER523 420 shiftX = 16; 524 421 shiftY = 16; … … 538 435 scaleX = ( ( widthBL << shiftX ) + ( widthEL >> 1 ) ) / widthEL; 539 436 scaleY = ( ( heightBL << shiftY ) + ( heightEL >> 1 ) ) / heightEL; 540 #endif541 437 542 438 #if ILP_DECODED_PICTURE … … 553 449 #if SCALED_REF_LAYER_OFFSETS 554 450 Int x = Clip3(leftStartC, rightEndC - 1, i); 555 #endif556 #if PHASE_DERIVATION_IN_INTEGER557 #if SCALED_REF_LAYER_OFFSETS558 451 refPos16 = (((x - leftStartC)*scaleX + addX) >> shiftXM4) - deltaX; 559 452 #else … … 563 456 refPos = refPos16 >> 4; 564 457 coeff = m_chromaFilter[phase]; 565 #else566 Int refPosM = (Int) ( i * chromaPhaseDenominator * sFactor );567 Int refPos = (Int)( i * sFactor );568 Int phase = (refPosM + chromaPhaseDenominator) % chromaPhaseDenominator;569 Int* coeff = m_chromaFilter[phase];570 #endif571 458 572 459 piSrcU = piSrcBufU + refPos -((NTAPS_US_CHROMA>>1) - 1); … … 601 488 #if SCALED_REF_LAYER_OFFSETS 602 489 Int y = Clip3(topStartC, bottomEndC - 1, j); 603 #endif604 #if PHASE_DERIVATION_IN_INTEGER605 #if SCALED_REF_LAYER_OFFSETS606 490 refPos16 = (((y - topStartC)*scaleY + addY) >> shiftYM4) - deltaY; 607 491 #else … … 611 495 refPos = refPos16 >> 4; 612 496 coeff = m_chromaFilter[phase]; 613 #else614 Int refPosM = (Int) (j * chromaPhaseDenominator * sFactor) - 1;615 Int refPos;616 if ( refPosM < 0 )617 {618 refPos = (Int)( j * sFactor ) - 1;619 }620 else621 {622 refPos = refPosM / chromaPhaseDenominator;623 }624 Int phase = (refPosM + chromaPhaseDenominator) % chromaPhaseDenominator;625 Int* coeff = m_chromaFilter[phase];626 #endif627 497 628 498 piSrcU = piTempBufU + (refPos -((NTAPS_US_CHROMA>>1) - 1))*strideEL; -
branches/SHM-2.1-dev/source/Lib/TLibCommon/TComUpsampleFilter.h
r189 r235 13 13 { 14 14 private: 15 #if PHASE_DERIVATION_IN_INTEGER16 15 static const Int m_lumaFixedFilter[16][NTAPS_US_LUMA]; ///< Luma filter taps for both 1.5x and 2x scalability 17 16 static const Int m_chromaFixedFilter[16][NTAPS_US_CHROMA]; ///< Chroma filter taps for 1.5x scalability … … 19 18 Int m_lumaFilter[16][NTAPS_US_LUMA]; 20 19 Int m_chromaFilter[16][NTAPS_US_CHROMA]; 21 #else22 static const Int m_lumaFixedFilter[12][NTAPS_US_LUMA]; ///< Luma filter taps for both 1.5x and 2x scalability23 static const Int m_chromaFixedFilter20[8][NTAPS_US_CHROMA]; ///< Chroma filter taps for 2x scalability24 static const Int m_chromaFixedFilter15[12][NTAPS_US_CHROMA]; ///< Chroma filter taps for 1.5x scalability25 26 Int m_lumaFilter[12][NTAPS_US_LUMA];27 Int m_chromaFilter[12][NTAPS_US_CHROMA];28 #endif29 20 30 21 static inline Int sumLumaHor( Pel* pel, Int* coeff ) -
branches/SHM-2.1-dev/source/Lib/TLibCommon/TypeDef.h
r228 r235 67 67 #define SVC_COL_BLK 1 ///< get co-located block 68 68 #define SVC_UPSAMPLING 1 ///< upsampling filters 69 #define PHASE_DERIVATION_IN_INTEGER 1 ///< upsampling filters implementation using only integer arithmetic70 69 #define ENCODER_BUGFIX 1 ///< L0167: encoder bug fix for inter mode 71 70 #define CHROMA_UPSAMPLING 1 ///< L0335: Chroma upsampling with 5 bits coefficients
Note: See TracChangeset for help on using the changeset viewer.