Changeset 1432 in SHVCSoftware
- Timestamp:
- 10 Aug 2015, 23:04:12 (9 years ago)
- Location:
- branches/SHM-dev/source
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/App/TAppEncoder/TAppEncTop.cpp
r1424 r1432 834 834 #if Q0074_COLOUR_REMAPPING_SEI 835 835 #if SVC_EXTENSION 836 m_cTEncTop. setCRISEIFileRoot ( const_cast<Char*>(m_apcLayerCfg[layer]->m_colourRemapSEIFileRoot.c_str()) );836 m_cTEncTop.xSetCRISEIFileRoot ( const_cast<Char*>(m_apcLayerCfg[layer]->m_colourRemapSEIFileRoot.c_str()) ); 837 837 #else 838 m_cTEncTop. setCRISEIFileRoot ( const_cast<Char*>(m_colourRemapSEIFileRoot.c_str()) );838 m_cTEncTop.xSetCRISEIFileRoot ( const_cast<Char*>(m_colourRemapSEIFileRoot.c_str()) ); 839 839 #endif 840 840 #endif -
branches/SHM-dev/source/Lib/TLibCommon/CommonDef.h
r1431 r1432 123 123 #if SVC_EXTENSION 124 124 static const Int POS_SCALING_FACTOR_1X = 65536; ///< position scaling factor equal to 1x 125 static const Int MV_SCALING_FACTOR_1X = 4096 ; ///< MV scaling factor equal to 1x 125 static const Int POS_SCALING_FACTOR_2X = 32768; ///< position scaling factor equal to 1x 126 static const Int MV_SCALING_FACTOR_1X = 4096; ///< MV scaling factor equal to 1x 126 127 #endif 127 128 … … 257 258 static const Int LAST_SIGNIFICANT_GROUPS = 10 ; 258 259 260 #if SVC_EXTENSION 261 static const Int CGS_FILTER_LENGTH = 13; 262 static const Int CGS_FILTER_PHASES_2X = 4; 263 static const Int CGS_FILTER_PHASES_1X = 8; 264 #endif 259 265 260 266 // ==================================================================================================================== -
branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
r1425 r1432 3556 3556 { 3557 3557 UInt uiNumRefLayersM1; 3558 READ_UVLC( uiNumRefLayersM1 3558 READ_UVLC( uiNumRefLayersM1, "num_cm_ref_layers_minus1" ); 3559 3559 assert( uiNumRefLayersM1 <= 61 ); 3560 3560 for( UInt i = 0 ; i <= uiNumRefLayersM1 ; i++ ) 3561 3561 { 3562 3562 UInt uiRefLayerId; 3563 READ_CODE( 6 , uiRefLayerId, "cm_ref_layer_id" );3563 READ_CODE( 6, uiRefLayerId, "cm_ref_layer_id" ); 3564 3564 pc3DAsymLUT->addRefLayerId( uiRefLayerId ); 3565 3565 } … … 3567 3567 UInt uiCurOctantDepth, uiCurPartNumLog2, uiInputBitDepthM8, uiOutputBitDepthM8, uiResQaunBit, uiDeltaBits;; 3568 3568 3569 READ_CODE( 2 , uiCurOctantDepth, "cm_octant_depth" );3570 READ_CODE( 2 , uiCurPartNumLog2, "cm_y_part_num_log2" );3571 3572 UInt uiChromaInputBitDepthM8 3573 3574 READ_UVLC( uiInputBitDepthM8 3569 READ_CODE( 2, uiCurOctantDepth, "cm_octant_depth" ); 3570 READ_CODE( 2, uiCurPartNumLog2, "cm_y_part_num_log2" ); 3571 3572 UInt uiChromaInputBitDepthM8, uiChromaOutputBitDepthM8; 3573 3574 READ_UVLC( uiInputBitDepthM8, "cm_input_luma_bit_depth_minus8" ); 3575 3575 READ_UVLC( uiChromaInputBitDepthM8 , "cm_input_chroma_bit_depth_minus8" ); 3576 READ_UVLC( uiOutputBitDepthM8 3577 READ_UVLC( uiChromaOutputBitDepthM8 ,"cm_output_chroma_bit_depth_minus8" );3578 READ_CODE( 2 , uiResQaunBit, "cm_res_quant_bit" );3579 3580 READ_CODE( 2 , uiDeltaBits, "cm_flc_bits" );3576 READ_UVLC( uiOutputBitDepthM8, "cm_output_luma_bit_depth_minus8" ); 3577 READ_UVLC( uiChromaOutputBitDepthM8 "cm_output_chroma_bit_depth_minus8" ); 3578 READ_CODE( 2, uiResQaunBit, "cm_res_quant_bit" ); 3579 3580 READ_CODE( 2, uiDeltaBits, "cm_flc_bits" ); 3581 3581 pc3DAsymLUT->setDeltaBits(uiDeltaBits + 1); 3582 3582 … … 3587 3587 { 3588 3588 Int delta = 0; 3589 READ_SVLC( delta 3589 READ_SVLC( delta, "cm_adapt_threshold_u_delta" ); 3590 3590 nAdaptCThresholdU += delta; 3591 READ_SVLC( delta 3591 READ_SVLC( delta, "cm_adapt_threshold_v_delta" ); 3592 3592 nAdaptCThresholdV += delta; 3593 3593 } … … 3600 3600 pc3DAsymLUT->xInitCuboids(); 3601 3601 #endif 3602 xParse3DAsymLUTOctant( pc3DAsymLUT , 0 , 0 , 0 , 0, 1 << pc3DAsymLUT->getCurOctantDepth() );3602 xParse3DAsymLUTOctant( pc3DAsymLUT, 0, 0, 0, 0, 1 << pc3DAsymLUT->getCurOctantDepth() ); 3603 3603 #if R0164_CGS_LUT_BUGFIX_CHECK 3604 3604 printf("============= Before 'xCuboidsFilledCheck()': ================\n"); … … 3610 3610 } 3611 3611 3612 Void TDecCavlc::xParse3DAsymLUTOctant( TCom3DAsymLUT * pc3DAsymLUT , Int nDepth , Int yIdx , Int uIdx , Int vIdx, Int nLength )3612 Void TDecCavlc::xParse3DAsymLUTOctant( TCom3DAsymLUT * pc3DAsymLUT, Int nDepth, Int yIdx, Int uIdx, Int vIdx, Int nLength ) 3613 3613 { 3614 3614 UInt uiOctantSplit = nDepth < pc3DAsymLUT->getCurOctantDepth(); 3615 3615 if( nDepth < pc3DAsymLUT->getCurOctantDepth() ) 3616 READ_FLAG( uiOctantSplit , "split_octant_flag" ); 3616 { 3617 READ_FLAG( uiOctantSplit, "split_octant_flag" ); 3618 } 3617 3619 Int nYPartNum = 1 << pc3DAsymLUT->getCurYPartNumLog2(); 3620 3618 3621 if( uiOctantSplit ) 3619 3622 { … … 3625 3628 for( Int n = 0 ; n < 2 ; n++ ) 3626 3629 { 3627 xParse3DAsymLUTOctant( pc3DAsymLUT , nDepth + 1 , yIdx + l * nHalfLength * nYPartNum , uIdx + m * nHalfLength , vIdx + n * nHalfLength, nHalfLength );3630 xParse3DAsymLUTOctant( pc3DAsymLUT, nDepth + 1, yIdx + l * nHalfLength * nYPartNum, uIdx + m * nHalfLength, vIdx + n * nHalfLength, nHalfLength ); 3628 3631 } 3629 3632 } … … 3635 3638 nFLCbits = nFLCbits >= 0 ? nFLCbits:0; 3636 3639 3637 for( Int l = 0 ; l < nYPartNum; l++ )3640 for( Int l = 0; l < nYPartNum; l++ ) 3638 3641 { 3639 3642 Int shift = pc3DAsymLUT->getCurOctantDepth() - nDepth; 3640 3643 3641 for( Int nVertexIdx = 0 ; nVertexIdx < 4; nVertexIdx++ )3644 for( Int nVertexIdx = 0; nVertexIdx < 4; nVertexIdx++ ) 3642 3645 { 3643 3646 UInt uiCodeVertex = 0; 3644 Int deltaY = 0 , deltaU = 0 , deltaV = 0; 3645 READ_FLAG( uiCodeVertex , "coded_vertex_flag" ); 3647 Int deltaY = 0, deltaU = 0, deltaV = 0; 3648 3649 READ_FLAG( uiCodeVertex, "coded_vertex_flag" ); 3650 3646 3651 if( uiCodeVertex ) 3647 3652 { … … 3651 3656 } 3652 3657 3653 pc3DAsymLUT->setCuboidVertexResTree( yIdx + (l<<shift) , uIdx , vIdx , nVertexIdx , deltaY , deltaU, deltaV );3658 pc3DAsymLUT->setCuboidVertexResTree( yIdx + (l<<shift), uIdx, vIdx, nVertexIdx, deltaY, deltaU, deltaV ); 3654 3659 3655 3660 for( Int m = 1; m < (1<<shift); m++ ) 3656 3661 { 3657 pc3DAsymLUT->setCuboidVertexResTree( yIdx + (l<<shift) + m , uIdx , vIdx , nVertexIdx , 0 , 0, 0 );3662 pc3DAsymLUT->setCuboidVertexResTree( yIdx + (l<<shift) + m, uIdx, vIdx, nVertexIdx, 0, 0, 0 ); 3658 3663 #if R0164_CGS_LUT_BUGFIX_CHECK 3659 3664 pc3DAsymLUT->xSetFilled( yIdx + (l<<shift) + m , uIdx , vIdx ); … … 3672 3677 if( u!=0 || v!=0 ) 3673 3678 { 3674 for( Int y=0 ; y<nLength*nYPartNum; y++ )3679 for( Int y=0; y<nLength*nYPartNum; y++ ) 3675 3680 { 3676 for( Int nVertexIdx = 0 ; nVertexIdx < 4; nVertexIdx++ )3681 for( Int nVertexIdx = 0; nVertexIdx < 4; nVertexIdx++ ) 3677 3682 { 3678 pc3DAsymLUT->setCuboidVertexResTree( yIdx + y , uIdx + u , vIdx + v , nVertexIdx , 0 , 0, 0 );3683 pc3DAsymLUT->setCuboidVertexResTree( yIdx + y, uIdx + , vIdx + v, nVertexIdx, 0, 0, 0 ); 3679 3684 #if R0164_CGS_LUT_BUGFIX_CHECK 3680 pc3DAsymLUT->xSetFilled( yIdx + y , uIdx + u, vIdx + v );3685 pc3DAsymLUT->xSetFilled( yIdx + y, uIdx + u, vIdx + v ); 3681 3686 #endif 3682 3687 } -
branches/SHM-dev/source/Lib/TLibEncoder/TEnc3DAsymLUT.cpp
r1419 r1432 138 138 } 139 139 140 Double TEnc3DAsymLUT::x xDeriveVertexPerColor( Double N , Double Ys , Double Yy , Double Yu , Double Yv , Double ys , Double us , Double vs , Double yy , Double yu , Double yv , Double uu , Double uv , Double vv , Double YY ,140 Double TEnc3DAsymLUT::xDeriveVertexPerColor( Double N , Double Ys , Double Yy , Double Yu , Double Yv , Double ys , Double us , Double vs , Double yy , Double yu , Double yv , Double uu , Double uv , Double vv , Double YY , 141 141 Pel & rP0 , Pel & rP1 , Pel & rP3 , Pel & rP7 , Int nResQuantBit ) 142 142 { … … 182 182 { 183 183 Int nTestP7 = Clip3( nMin , nMax , nInitP7 + m * nStepSize ); 184 Double dError = x xCalEstDist( N , Ys , Yy , Yu , Yv , ys , us , vs , yy , yu , yv , uu , uv , vv , YY , a , b , c , nTestP7 );184 Double dError = xCalEstDist( N , Ys , Yy , Yu , Yv , ys , us , vs , yy , yu , yv , uu , uv , vv , YY , a , b , c , nTestP7 ); 185 185 if( dError < dMinError ) 186 186 { … … 202 202 Double TEnc3DAsymLUT::estimateDistWithCur3DAsymLUT( TComPic * pCurPic , UInt refLayerIdc ) 203 203 { 204 x xCollectData( pCurPic , refLayerIdc );204 xCollectData( pCurPic , refLayerIdc ); 205 205 206 206 Double dErrorLuma = 0 , dErrorChroma = 0; … … 218 218 if( rCuboidColorInfo.N > 0 ) 219 219 { 220 dErrorLuma += x xCalEstDist( rCuboidColorInfo.N , rCuboidColorInfo.Ys , rCuboidColorInfo.Yy , rCuboidColorInfo.Yu , rCuboidColorInfo.Yv , rCuboidColorInfo.ys , rCuboidColorInfo.us , rCuboidColorInfo.vs , rCuboidColorInfo.yy , rCuboidColorInfo.yu , rCuboidColorInfo.yv , rCuboidColorInfo.uu , rCuboidColorInfo.uv , rCuboidColorInfo.vv , rCuboidColorInfo.YY ,220 dErrorLuma += xCalEstDist( rCuboidColorInfo.N , rCuboidColorInfo.Ys , rCuboidColorInfo.Yy , rCuboidColorInfo.Yu , rCuboidColorInfo.Yv , rCuboidColorInfo.ys , rCuboidColorInfo.us , rCuboidColorInfo.vs , rCuboidColorInfo.yy , rCuboidColorInfo.yu , rCuboidColorInfo.yv , rCuboidColorInfo.uu , rCuboidColorInfo.uv , rCuboidColorInfo.vv , rCuboidColorInfo.YY , 221 221 rCuboid.P[0].Y , rCuboid.P[1].Y , rCuboid.P[2].Y , rCuboid.P[3].Y ); 222 222 } 223 223 if( rCuboidColorInfoC.N > 0 ) 224 224 { 225 dErrorChroma += x xCalEstDist( rCuboidColorInfoC.N , rCuboidColorInfoC.Us , rCuboidColorInfoC.Uy , rCuboidColorInfoC.Uu , rCuboidColorInfoC.Uv , rCuboidColorInfoC.ys , rCuboidColorInfoC.us , rCuboidColorInfoC.vs , rCuboidColorInfoC.yy , rCuboidColorInfoC.yu , rCuboidColorInfoC.yv , rCuboidColorInfoC.uu , rCuboidColorInfoC.uv , rCuboidColorInfoC.vv , rCuboidColorInfoC.UU ,225 dErrorChroma += xCalEstDist( rCuboidColorInfoC.N , rCuboidColorInfoC.Us , rCuboidColorInfoC.Uy , rCuboidColorInfoC.Uu , rCuboidColorInfoC.Uv , rCuboidColorInfoC.ys , rCuboidColorInfoC.us , rCuboidColorInfoC.vs , rCuboidColorInfoC.yy , rCuboidColorInfoC.yu , rCuboidColorInfoC.yv , rCuboidColorInfoC.uu , rCuboidColorInfoC.uv , rCuboidColorInfoC.vv , rCuboidColorInfoC.UU , 226 226 rCuboid.P[0].U , rCuboid.P[1].U , rCuboid.P[2].U , rCuboid.P[3].U ); 227 dErrorChroma += x xCalEstDist( rCuboidColorInfoC.N , rCuboidColorInfoC.Vs , rCuboidColorInfoC.Vy , rCuboidColorInfoC.Vu , rCuboidColorInfoC.Vv , rCuboidColorInfoC.ys , rCuboidColorInfoC.us , rCuboidColorInfoC.vs , rCuboidColorInfoC.yy , rCuboidColorInfoC.yu , rCuboidColorInfoC.yv , rCuboidColorInfoC.uu , rCuboidColorInfoC.uv , rCuboidColorInfoC.vv , rCuboidColorInfoC.VV ,227 dErrorChroma += xCalEstDist( rCuboidColorInfoC.N , rCuboidColorInfoC.Vs , rCuboidColorInfoC.Vy , rCuboidColorInfoC.Vu , rCuboidColorInfoC.Vv , rCuboidColorInfoC.ys , rCuboidColorInfoC.us , rCuboidColorInfoC.vs , rCuboidColorInfoC.yy , rCuboidColorInfoC.yu , rCuboidColorInfoC.yv , rCuboidColorInfoC.uu , rCuboidColorInfoC.uv , rCuboidColorInfoC.vv , rCuboidColorInfoC.VV , 228 228 rCuboid.P[0].V , rCuboid.P[1].V , rCuboid.P[2].V , rCuboid.P[3].V ); 229 229 } … … 253 253 Int nMaxPartNumLog2 = xGetMaxPartNumLog2(); 254 254 255 x xMapPartNum2DepthYPart( nMaxPartNumLog2 , nCurOctantDepth , nCurYPartNumLog2 );255 xMapPartNum2DepthYPart( nMaxPartNumLog2 , nCurOctantDepth , nCurYPartNumLog2 ); 256 256 xUpdatePartitioning( nCurOctantDepth , nCurYPartNumLog2, nBestAdaptCThresholdU, nBestAdaptCThresholdV ); 257 x xCollectData( pCurPic , refLayerIdc );258 x xCopyColorInfo(m_pMaxColorInfo, m_pColorInfo, m_pMaxColorInfoC, m_pColorInfoC);257 xCollectData( pCurPic , refLayerIdc ); 258 xCopyColorInfo(m_pMaxColorInfo, m_pColorInfo, m_pMaxColorInfoC, m_pColorInfoC); 259 259 260 260 sMaxLutSize.iCPartNumLog2 = nCurOctantDepth; … … 275 275 276 276 // check all LUT sizes 277 x xGetAllLutSizes(pSlice);277 xGetAllLutSizes(pSlice); 278 278 if (m_nTotalLutSizes == 0) // return if no valid size is found, LUT will not be updated 279 279 { … … 291 291 nCurYPartNumLog2 = m_sLutSizes[i].iYPartNumLog2-nCurOctantDepth; 292 292 xUpdatePartitioning( nCurOctantDepth , nCurYPartNumLog2, nBestAdaptCThresholdU, nBestAdaptCThresholdV ); 293 x xConsolidateData( &m_sLutSizes[i], &sMaxLutSize );293 xConsolidateData( &m_sLutSizes[i], &sMaxLutSize ); 294 294 295 dCurError = x xDeriveVertexes(nBestResQuanBit, m_pEncCuboid);295 dCurError = xDeriveVertexes(nBestResQuanBit, m_pEncCuboid); 296 296 297 297 setResQuantBit( nBestResQuanBit ); … … 329 329 nCurYPartNumLog2 = getMaxYPartNumLog2()+getMaxOctantDepth()-nCurOctantDepth; 330 330 xUpdatePartitioning( nCurOctantDepth , nCurYPartNumLog2 , nAdaptCThresholdU , nAdaptCThresholdV ); 331 x xCollectData( pCurPic , refLayerIdc );332 333 dCurError = x xDeriveVertexes( nBestResQuanBit , m_pEncCuboid ) ;331 xCollectData( pCurPic , refLayerIdc ); 332 333 dCurError = xDeriveVertexes( nBestResQuanBit , m_pEncCuboid ) ; 334 334 setResQuantBit( nBestResQuanBit ); 335 335 xSaveCuboids( m_pEncCuboid ); … … 356 356 // check res_quant_bits only for the best table size and best U/V threshold 357 357 if( !bUseNewColorInfo ) 358 x xConsolidateData( &m_sLutSizes[iBestLUTSizeIdx], &sMaxLutSize );359 360 // x xCollectData( pCurPic , refLayerIdc );358 xConsolidateData( &m_sLutSizes[iBestLUTSizeIdx], &sMaxLutSize ); 359 360 // xCollectData( pCurPic , refLayerIdc ); 361 361 for( Int nResQuanBit = 1 ; nResQuanBit < 4 ; nResQuanBit++ ) 362 362 { 363 dCurError = x xDeriveVertexes( nResQuanBit , m_pEncCuboid );363 dCurError = xDeriveVertexes( nResQuanBit , m_pEncCuboid ); 364 364 365 365 setResQuantBit( nResQuanBit ); … … 407 407 m_nLUTBitDepth = pCfg->getCGSLUTBit(); 408 408 Int nCurYPartNumLog2 = 0 , nCurOctantDepth = 0; 409 x xDerivePartNumLog2( pSlice , pCfg , nCurOctantDepth , nCurYPartNumLog2 , bSignalPPS , bElRapSliceTypeB );409 xDerivePartNumLog2( pSlice , pCfg , nCurOctantDepth , nCurYPartNumLog2 , bSignalPPS , bElRapSliceTypeB ); 410 410 411 411 Int nBestResQuanBit = 0; … … 435 435 436 436 xUpdatePartitioning( nCurOctantDepth , nCurYPartNumLog2 , nAdaptCThresholdU , nAdaptCThresholdV ); 437 x xCollectData( pCurPic , refLayerIdc );437 xCollectData( pCurPic , refLayerIdc ); 438 438 for( Int nResQuanBit = 0 ; nResQuanBit < 4 ; nResQuanBit++ ) 439 439 { 440 Double dError = x xDeriveVertexes( nResQuanBit , m_pEncCuboid ) / ( 1 + ( nResQuanBit > 0 ) * 0.001 * ( pSlice->getDepth() + 1 ) );440 Double dError = xDeriveVertexes( nResQuanBit , m_pEncCuboid ) / ( 1 + ( nResQuanBit > 0 ) * 0.001 * ( pSlice->getDepth() + 1 ) ); 441 441 if( dError <= dMinError ) 442 442 { … … 465 465 } 466 466 467 Double TEnc3DAsymLUT::x xDeriveVertexes( Int nResQuanBit , SCuboid *** pCurCuboid )467 Double TEnc3DAsymLUT::xDeriveVertexes( Int nResQuanBit , SCuboid *** pCurCuboid ) 468 468 { 469 469 Double dErrorLuma = 0 , dErrorChroma = 0; … … 488 488 if( rCuboidColorInfo.N > 0 ) 489 489 { 490 dErrorLuma += x xDeriveVertexPerColor( rCuboidColorInfo.N , rCuboidColorInfo.Ys , rCuboidColorInfo.Yy , rCuboidColorInfo.Yu , rCuboidColorInfo.Yv , rCuboidColorInfo.ys , rCuboidColorInfo.us , rCuboidColorInfo.vs , rCuboidColorInfo.yy , rCuboidColorInfo.yu , rCuboidColorInfo.yv , rCuboidColorInfo.uu , rCuboidColorInfo.uv , rCuboidColorInfo.vv , rCuboidColorInfo.YY ,490 dErrorLuma += xDeriveVertexPerColor( rCuboidColorInfo.N , rCuboidColorInfo.Ys , rCuboidColorInfo.Yy , rCuboidColorInfo.Yu , rCuboidColorInfo.Yv , rCuboidColorInfo.ys , rCuboidColorInfo.us , rCuboidColorInfo.vs , rCuboidColorInfo.yy , rCuboidColorInfo.yu , rCuboidColorInfo.yv , rCuboidColorInfo.uu , rCuboidColorInfo.uv , rCuboidColorInfo.vv , rCuboidColorInfo.YY , 491 491 rCuboid.P[0].Y , rCuboid.P[1].Y , rCuboid.P[2].Y , rCuboid.P[3].Y , nResQuanBit ); 492 492 } … … 494 494 if( rCuboidColorInfoC.N > 0 ) 495 495 { 496 dErrorChroma += x xDeriveVertexPerColor( rCuboidColorInfoC.N , rCuboidColorInfoC.Us , rCuboidColorInfoC.Uy , rCuboidColorInfoC.Uu , rCuboidColorInfoC.Uv , rCuboidColorInfoC.ys , rCuboidColorInfoC.us , rCuboidColorInfoC.vs , rCuboidColorInfoC.yy , rCuboidColorInfoC.yu , rCuboidColorInfoC.yv , rCuboidColorInfoC.uu , rCuboidColorInfoC.uv , rCuboidColorInfoC.vv , rCuboidColorInfoC.UU ,496 dErrorChroma += xDeriveVertexPerColor( rCuboidColorInfoC.N , rCuboidColorInfoC.Us , rCuboidColorInfoC.Uy , rCuboidColorInfoC.Uu , rCuboidColorInfoC.Uv , rCuboidColorInfoC.ys , rCuboidColorInfoC.us , rCuboidColorInfoC.vs , rCuboidColorInfoC.yy , rCuboidColorInfoC.yu , rCuboidColorInfoC.yv , rCuboidColorInfoC.uu , rCuboidColorInfoC.uv , rCuboidColorInfoC.vv , rCuboidColorInfoC.UU , 497 497 rCuboid.P[0].U , rCuboid.P[1].U , rCuboid.P[2].U , rCuboid.P[3].U , nResQuanBit ); 498 498 499 dErrorChroma += x xDeriveVertexPerColor( rCuboidColorInfoC.N , rCuboidColorInfoC.Vs , rCuboidColorInfoC.Vy , rCuboidColorInfoC.Vu , rCuboidColorInfoC.Vv , rCuboidColorInfoC.ys , rCuboidColorInfoC.us , rCuboidColorInfoC.vs , rCuboidColorInfoC.yy , rCuboidColorInfoC.yu , rCuboidColorInfoC.yv , rCuboidColorInfoC.uu , rCuboidColorInfoC.uv , rCuboidColorInfoC.vv , rCuboidColorInfoC.VV ,499 dErrorChroma += xDeriveVertexPerColor( rCuboidColorInfoC.N , rCuboidColorInfoC.Vs , rCuboidColorInfoC.Vy , rCuboidColorInfoC.Vu , rCuboidColorInfoC.Vv , rCuboidColorInfoC.ys , rCuboidColorInfoC.us , rCuboidColorInfoC.vs , rCuboidColorInfoC.yy , rCuboidColorInfoC.yu , rCuboidColorInfoC.yv , rCuboidColorInfoC.uu , rCuboidColorInfoC.uv , rCuboidColorInfoC.vv , rCuboidColorInfoC.VV , 500 500 rCuboid.P[0].V , rCuboid.P[1].V , rCuboid.P[2].V , rCuboid.P[3].V , nResQuanBit ); 501 501 } … … 519 519 } 520 520 521 Void TEnc3DAsymLUT::x xCollectData( TComPic * pCurPic , UInt refLayerIdc )521 Void TEnc3DAsymLUT::xCollectData( TComPic * pCurPic , UInt refLayerIdc ) 522 522 { 523 523 Pel * pSrcY = m_pDsOrigPic->getAddr(COMPONENT_Y); … … 659 659 } 660 660 661 Void TEnc3DAsymLUT::x xDerivePartNumLog2( TComSlice * pSlice , TEncCfg * pcCfg , Int & rOctantDepth , Int & rYPartNumLog2 , Bool bSignalPPS , Bool bElRapSliceTypeB )661 Void TEnc3DAsymLUT::xDerivePartNumLog2( TComSlice * pSlice , TEncCfg * pcCfg , Int & rOctantDepth , Int & rYPartNumLog2 , Bool bSignalPPS , Bool bElRapSliceTypeB ) 662 662 { 663 663 Int nPartNumLog2 = 4; … … 684 684 685 685 nPartNumLog2 = Clip3( 0 , xGetMaxPartNumLog2() , nPartNumLog2 ); 686 x xMapPartNum2DepthYPart( nPartNumLog2 , rOctantDepth , rYPartNumLog2 );687 } 688 689 Void TEnc3DAsymLUT::x xMapPartNum2DepthYPart( Int nPartNumLog2 , Int & rOctantDepth , Int & rYPartNumLog2 )686 xMapPartNum2DepthYPart( nPartNumLog2 , rOctantDepth , rYPartNumLog2 ); 687 } 688 689 Void TEnc3DAsymLUT::xMapPartNum2DepthYPart( Int nPartNumLog2 , Int & rOctantDepth , Int & rYPartNumLog2 ) 690 690 { 691 691 for( Int y = getMaxYPartNumLog2() ; y >= 0 ; y-- ) … … 728 728 #if R0179_ENC_OPT_3DLUT_SIZE 729 729 730 Void TEnc3DAsymLUT::x xGetAllLutSizes(TComSlice *pSlice)730 Void TEnc3DAsymLUT::xGetAllLutSizes(TComSlice *pSlice) 731 731 { 732 732 Int iMaxYPartNumLog2, iMaxCPartNumLog2; … … 735 735 Int iNumELFrameBits = m_nPrevELFrameBit[pSlice->getSliceType()][pSlice->getDepth()]; 736 736 737 x xMapPartNum2DepthYPart( xGetMaxPartNumLog2() , iMaxCPartNumLog2 , iMaxYPartNumLog2 );737 xMapPartNum2DepthYPart( xGetMaxPartNumLog2() , iMaxCPartNumLog2 , iMaxYPartNumLog2 ); 738 738 iMaxAddYPartNumLog2 = iMaxYPartNumLog2; 739 739 iMaxYPartNumLog2 += iMaxCPartNumLog2; … … 762 762 } 763 763 764 Void TEnc3DAsymLUT::x xCopyColorInfo( SColorInfo *** dst, SColorInfo *** src , SColorInfo *** dstC, SColorInfo *** srcC )764 Void TEnc3DAsymLUT::xCopyColorInfo( SColorInfo *** dst, SColorInfo *** src , SColorInfo *** dstC, SColorInfo *** srcC ) 765 765 { 766 766 Int yIdx, uIdx, vIdx; … … 780 780 } 781 781 782 Void TEnc3DAsymLUT::x xAddColorInfo( Int yIdx, Int uIdx, Int vIdx, Int iYDiffLog2, Int iCDiffLog2 )782 Void TEnc3DAsymLUT::xAddColorInfo( Int yIdx, Int uIdx, Int vIdx, Int iYDiffLog2, Int iCDiffLog2 ) 783 783 { 784 784 SColorInfo & rCuboidColorInfo = m_pColorInfo [yIdx][uIdx][vIdx]; … … 798 798 } 799 799 800 Void TEnc3DAsymLUT::x xConsolidateData( SLUTSize *pCurLUTSize, SLUTSize *pMaxLUTSize )800 Void TEnc3DAsymLUT::xConsolidateData( SLUTSize *pCurLUTSize, SLUTSize *pMaxLUTSize ) 801 801 { 802 802 Int yIdx, uIdx, vIdx; … … 811 811 if (iYDiffLog2 == 0 && iCDiffLog2 == 0) // shouldn't have to do anything 812 812 { 813 x xCopyColorInfo(m_pColorInfo, m_pMaxColorInfo, m_pColorInfoC, m_pMaxColorInfoC);813 xCopyColorInfo(m_pColorInfo, m_pMaxColorInfo, m_pColorInfoC, m_pMaxColorInfoC); 814 814 return; 815 815 } -
branches/SHM-dev/source/Lib/TLibEncoder/TEnc3DAsymLUT.h
r1297 r1432 144 144 Int m_nLUTBitDepth; 145 145 #if R0179_ENC_OPT_3DLUT_SIZE 146 147 Double m_dDistFactor[3][MAX_TLAYER]; 148 Int m_nNumLUTBits[MAX_Y_SIZE][MAX_C_SIZE]; 149 Int m_nPrevELFrameBit[3][MAX_TLAYER]; 150 151 152 Int m_nTotalLutSizes; 153 SLUTSize m_sLutSizes[MAX_NUM_LUT_SIZES]; 154 #endif 155 Double m_dSumU; 156 Double m_dSumV; 157 Int m_nNChroma; 146 Double m_dDistFactor[3][MAX_TLAYER]; 147 Int m_nNumLUTBits[MAX_Y_SIZE][MAX_C_SIZE]; 148 Int m_nPrevELFrameBit[3][MAX_TLAYER]; 149 150 151 Int m_nTotalLutSizes; 152 SLUTSize m_sLutSizes[MAX_NUM_LUT_SIZES]; 153 #endif 154 Double m_dSumU; 155 Double m_dSumV; 156 Int m_nNChroma; 158 157 #if R0179_ENC_OPT_3DLUT_SIZE 159 158 TComOutputBitstream *m_pBitstreamRedirect; 160 TEncCavlc *m_pEncCavlc;159 TEncCavlc *m_pEncCavlc; 161 160 #endif 162 161 163 162 private: 164 Double x xDeriveVertexPerColor( Double N , Double Ys , Double Yy , Double Yu , Double Yv , Double ys , Double us , Double vs , Double yy , Double yu , Double yv , Double uu , Double uv , Double vv , Double YY ,165 Pel & rP0 , Pel & rP1 , Pel & rP3 , Pel & rP7, Int nResQuantBit );166 167 Void x xDerivePartNumLog2( TComSlice * pSlice , TEncCfg * pcCfg , Int & rOctantDepth , Int & rYPartNumLog2 , Bool bSignalPPS , Bool bElRapSliceTypeB );168 Void x xMapPartNum2DepthYPart( Int nPartNumLog2 , Int & rOctantDepth , Int & rYPartNumLog2 );169 Int x xCoeff2Vertex( Double a , Double b , Double c , Double d , Int y , Int u , Int v ) { return ( ( Int )( a * y + b * u + c * v + d + 0.5 ) ); }170 Void x xCollectData( TComPic * pCurPic , UInt refLayerIdc );171 172 Double x xDeriveVertexes( Int nResQuantBit , SCuboid *** pCurCuboid );173 174 inline Double x xCalEstDist( Double N, Double Ys, Double Yy, Double Yu, Double Yv, Double ys, Double us, Double vs, Double yy, Double yu, Double yv, Double uu, Double uv, Double vv, Double YY,175 Int y0, Int u0, Int v0, Int nLengthY, Int nLengthUV, Pel nP0, Pel nP1, Pel nP3, Pel nP7 );176 177 inline Double x xCalEstDist( Double N, Double Ys, Double Yy, Double Yu, Double Yv, Double ys, Double us, Double vs, Double yy, Double yu, Double yv, Double uu, Double uv, Double vv, Double YY, Double a, Double b, Double c, Double d );178 179 inline Double x xCalEstDist( Double N, Double Ys, Double Yy, Double Yu, Double Yv, Double ys, Double us, Double vs, Double yy, Double yu, Double yv, Double uu, Double uv, Double vv, Double YY, Pel nP0, Pel nP1, Pel nP3, Pel nP7 );180 181 #if R0179_ENC_OPT_3DLUT_SIZE 182 Void x xConsolidateData( SLUTSize *pCurLUTSize, SLUTSize *pMaxLUTSize );183 Void x xGetAllLutSizes(TComSlice *pSlice);184 Void x xCopyColorInfo( SColorInfo *** dst, SColorInfo *** src , SColorInfo *** dstC, SColorInfo *** srcC );185 Void x xAddColorInfo( Int yIdx, Int uIdx, Int vIdx, Int iYDiffLog2, Int iCDiffLog2 );163 Double xDeriveVertexPerColor( Double N, Double Ys, Double Yy, Double Yu, Double Yv, Double ys, Double us, Double vs, Double yy, Double yu, Double yv, Double uu, Double uv, Double vv, Double YY, 164 Pel & rP0, Pel & rP1, Pel & rP3, Pel & rP7, Int nResQuantBit ); 165 166 Void xDerivePartNumLog2( TComSlice * pSlice , TEncCfg * pcCfg , Int & rOctantDepth , Int & rYPartNumLog2 , Bool bSignalPPS , Bool bElRapSliceTypeB ); 167 Void xMapPartNum2DepthYPart( Int nPartNumLog2 , Int & rOctantDepth , Int & rYPartNumLog2 ); 168 Int xCoeff2Vertex( Double a , Double b , Double c , Double d , Int y , Int u , Int v ) { return ( ( Int )( a * y + b * u + c * v + d + 0.5 ) ); } 169 Void xCollectData( TComPic * pCurPic , UInt refLayerIdc ); 170 171 Double xDeriveVertexes( Int nResQuantBit , SCuboid *** pCurCuboid ); 172 173 inline Double xCalEstDist( Double N, Double Ys, Double Yy, Double Yu, Double Yv, Double ys, Double us, Double vs, Double yy, Double yu, Double yv, Double uu, Double uv, Double vv, Double YY, 174 Int y0, Int u0, Int v0, Int nLengthY, Int nLengthUV, Pel nP0, Pel nP1, Pel nP3, Pel nP7 ); 175 176 inline Double xCalEstDist( Double N, Double Ys, Double Yy, Double Yu, Double Yv, Double ys, Double us, Double vs, Double yy, Double yu, Double yv, Double uu, Double uv, Double vv, Double YY, Double a, Double b, Double c, Double d ); 177 178 inline Double xCalEstDist( Double N, Double Ys, Double Yy, Double Yu, Double Yv, Double ys, Double us, Double vs, Double yy, Double yu, Double yv, Double uu, Double uv, Double vv, Double YY, Pel nP0, Pel nP1, Pel nP3, Pel nP7 ); 179 180 #if R0179_ENC_OPT_3DLUT_SIZE 181 Void xConsolidateData( SLUTSize *pCurLUTSize, SLUTSize *pMaxLUTSize ); 182 Void xGetAllLutSizes(TComSlice *pSlice); 183 Void xCopyColorInfo( SColorInfo *** dst, SColorInfo *** src , SColorInfo *** dstC, SColorInfo *** srcC ); 184 Void xAddColorInfo( Int yIdx, Int uIdx, Int vIdx, Int iYDiffLog2, Int iCDiffLog2 ); 186 185 #endif 187 186 }; 188 187 189 Double TEnc3DAsymLUT::x xCalEstDist( Double N , Double Ys , Double Yy , Double Yu , Double Yv , Double ys , Double us , Double vs , Double yy , Double yu , Double yv , Double uu , Double uv , Double vv , Double YY,190 Int y0 , Int u0 , Int v0 , Int nLengthY , Int nLengthUV , Pel nP0 , Pel nP1 , Pel nP3, Pel nP7 )188 Double TEnc3DAsymLUT::xCalEstDist( Double N, Double Ys, Double Yy, Double Yu, Double Yv, Double ys, Double us, Double vs, Double yy, Double yu, Double yv, Double uu, Double uv, Double vv, Double YY, 189 Int y0, Int u0, Int v0, Int nLengthY, Int nLengthUV, Pel nP0, Pel nP1, Pel nP3, Pel nP7 ) 191 190 { 192 191 Double a = 1.0 * ( nP7 - nP3 ) / nLengthY; … … 194 193 Double c = 1.0 * ( nP3 - nP1 ) / nLengthUV; 195 194 Double d = ( ( nP0 * nLengthUV + u0 * nP0 + ( v0 - u0 ) * nP1 - v0 * nP3 ) * nLengthY + y0 * nLengthUV * ( nP3 - nP7 ) ) / nLengthUV / nLengthY; 196 return( x xCalEstDist( N , Ys , Yy , Yu , Yv , ys , us , vs , yy , yu , yv , uu , uv , vv , YY , a , b , c , d ) );195 return( xCalEstDist( N , Ys , Yy , Yu , Yv , ys , us , vs , yy , yu , yv , uu , uv , vv , YY , a , b , c , d ) ); 197 196 } 198 197 199 Double TEnc3DAsymLUT::x xCalEstDist( Double N, Double Ys, Double Yy, Double Yu, Double Yv, Double ys, Double us, Double vs, Double yy, Double yu, Double yv, Double uu, Double uv, Double vv, Double YY, Double a, Double b, Double c, Double d )198 Double TEnc3DAsymLUT::xCalEstDist( Double N, Double Ys, Double Yy, Double Yu, Double Yv, Double ys, Double us, Double vs, Double yy, Double yu, Double yv, Double uu, Double uv, Double vv, Double YY, Double a, Double b, Double c, Double d ) 200 199 { 201 200 Double dError = N * d * d + 2 * b * c * uv + 2 * a * c * yv + 2 * a * b * yu - 2 * c * Yv - 2 * b * Yu - 2 * a * Yy + 2 * c * d * vs + 2 * b * d * us + 2 * a * d * ys + a * a * yy + c * c * vv + b * b * uu - 2 * d * Ys + YY; … … 203 202 }; 204 203 205 Double TEnc3DAsymLUT::x xCalEstDist( Double N, Double Ys, Double Yy, Double Yu, Double Yv, Double ys, Double us, Double vs, Double yy, Double yu, Double yv, Double uu, Double uv, Double vv, Double YY, Pel nP0, Pel nP1, Pel nP3, Pel nP7 )204 Double TEnc3DAsymLUT::xCalEstDist( Double N, Double Ys, Double Yy, Double Yu, Double Yv, Double ys, Double us, Double vs, Double yy, Double yu, Double yv, Double uu, Double uv, Double vv, Double YY, Pel nP0, Pel nP1, Pel nP3, Pel nP7 ) 206 205 { 207 206 const Int nOne = xGetNormCoeffOne(); -
branches/SHM-dev/source/Lib/TLibEncoder/TEncCfg.h
r1424 r1432 1086 1086 #endif 1087 1087 #if Q0074_COLOUR_REMAPPING_SEI 1088 Void setCRISEIFileRoot( Char* pch ) { m_colourRemapSEIFileRoot = pch; }1088 Void xSetCRISEIFileRoot( Char* pch ) { m_colourRemapSEIFileRoot = pch; } 1089 1089 Char* getCRISEIFileRoot() { return m_colourRemapSEIFileRoot; } 1090 1090 #endif -
branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp
r1431 r1432 138 138 if(m_temp) 139 139 { 140 free_mem2DintWithPad(m_temp, m_iTap>>1, 0);140 xDestroy2DArray(m_temp, m_cgsFilterLength>>1, 0); 141 141 m_temp = NULL; 142 142 } … … 697 697 698 698 #if Q0074_COLOUR_REMAPPING_SEI 699 Void TEncGOP:: freeColourCRI()699 Void TEncGOP::xFreeColourCRI() 700 700 { 701 701 for( Int c=0 ; c<3 ; c++) … … 724 724 } 725 725 726 Int TEncGOP:: readingCRIparameters(){726 Int TEncGOP::xReadingCRIparameters(){ 727 727 728 728 // reading external Colour Remapping Information SEI message parameters from file … … 938 938 #if Q0074_COLOUR_REMAPPING_SEI 939 939 // insert one CRI by picture (if the file exist) 940 freeColourCRI();940 xFreeColourCRI(); 941 941 942 942 // building the CRI file name with poc num in suffix "_poc.txt" … … 945 945 string colourRemapSEIFileWithPoc(m_pcCfg->getCRISEIFileRoot()); 946 946 colourRemapSEIFileWithPoc.append(suffix); 947 setCRISEIFile( const_cast<Char*>(colourRemapSEIFileWithPoc.c_str()) );947 xSetCRISEIFile( const_cast<Char*>(colourRemapSEIFileWithPoc.c_str()) ); 948 948 949 Int ret = readingCRIparameters();949 Int ret = xReadingCRIparameters(); 950 950 951 951 if(ret != -1 && m_pcCfg->getCRISEIFileRoot()) … … 1802 1802 { 1803 1803 //downsampling 1804 downScalePic(pcPic->getPicYuvOrg(), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvOrg(), pcSlice->getBitDepths(), pcPic->getPosScalingFactor(refLayerIdc, 0));1804 xDownScalePic(pcPic->getPicYuvOrg(), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvOrg(), pcSlice->getBitDepths(), pcPic->getPosScalingFactor(refLayerIdc, 0)); 1805 1805 1806 1806 m_Enc3DAsymLUTPPS.setDsOrigPic(pcSlice->getBaseColPic(refLayerIdc)->getPicYuvOrg()); … … 4194 4194 } 4195 4195 4196 Void TEncGOP:: downScalePic( TComPicYuv* pcYuvSrc, TComPicYuv* pcYuvDest, BitDepths& bitDepth, const Int posScalingFactorX)4196 Void TEncGOP::xDownScalePic( TComPicYuv* pcYuvSrc, TComPicYuv* pcYuvDest, BitDepths& bitDepth, const Int posScalingFactorX) 4197 4197 { 4198 4198 pcYuvSrc->setBorderExtension(false); … … 4205 4205 if(!m_temp) 4206 4206 { 4207 initDs(iWidth, iHeight, m_pcCfg->getIntraPeriod()>1, posScalingFactorX); 4208 } 4209 4210 filterImg(pcYuvSrc->getAddr(COMPONENT_Y), pcYuvSrc->getStride(COMPONENT_Y), pcYuvDest->getAddr(COMPONENT_Y), pcYuvDest->getStride(COMPONENT_Y), iHeight, iWidth, bitDepth, 0); 4211 filterImg(pcYuvSrc->getAddr(COMPONENT_Cb), pcYuvSrc->getStride(COMPONENT_Cb), pcYuvDest->getAddr(COMPONENT_Cb), pcYuvDest->getStride(COMPONENT_Cb), iHeight>>1, iWidth>>1, bitDepth, 1); 4212 filterImg(pcYuvSrc->getAddr(COMPONENT_Cr), pcYuvSrc->getStride(COMPONENT_Cr), pcYuvDest->getAddr(COMPONENT_Cr), pcYuvDest->getStride(COMPONENT_Cr), iHeight>>1, iWidth>>1, bitDepth, 2); 4213 } 4214 const Int TEncGOP::m_phase_filter_0_t0[4][13]={ 4207 xInitDs(iWidth, iHeight, m_pcCfg->getIntraPeriod() > 1, posScalingFactorX); 4208 } 4209 4210 xFilterImg(pcYuvSrc->getAddr(COMPONENT_Y), pcYuvSrc->getStride(COMPONENT_Y), pcYuvDest->getAddr(COMPONENT_Y), pcYuvDest->getStride(COMPONENT_Y), iHeight, iWidth, bitDepth, COMPONENT_Y); 4211 xFilterImg(pcYuvSrc->getAddr(COMPONENT_Cb), pcYuvSrc->getStride(COMPONENT_Cb), pcYuvDest->getAddr(COMPONENT_Cb), pcYuvDest->getStride(COMPONENT_Cb), iHeight>>1, iWidth>>1, bitDepth, COMPONENT_Cb); 4212 xFilterImg(pcYuvSrc->getAddr(COMPONENT_Cr), pcYuvSrc->getStride(COMPONENT_Cr), pcYuvDest->getAddr(COMPONENT_Cr), pcYuvDest->getStride(COMPONENT_Cr), iHeight>>1, iWidth>>1, bitDepth, COMPONENT_Cr); 4213 } 4214 const Pel TEncGOP::m_phaseFilter0T0[CGS_FILTER_PHASES_2X][CGS_FILTER_LENGTH] = 4215 { 4215 4216 {0, 2, -3, -9, 6, 39, 58, 39, 6, -9, -3, 2, 0}, 4216 {0, 0, 0, -2, 8,-20, 116, 34, -10, 2, 0, 0, 0},//{0, 1, -1, -8, -1, 31, 57, 47, 13, -7, -5, 1, 0}, //4217 {0, 0, 0, -2, 8, -20, 116, 34, -10, 2, 0, 0, 0}, //{0, 1, -1, -8, -1, 31, 57, 47, 13, -7, -5, 1, 0}, // 4217 4218 {0, 1, 0, -7, -5, 22, 53, 53, 22, -5, -7, 0, 1}, 4218 {0, 0, 1, -5, -7, 13, 47, 57, 31, -1, -8, -1, 1}4219 {0, 0, 1, -5, -7, 13, 47, 57, 31, -1, -8, -1, 1} 4219 4220 }; 4220 4221 4221 const Int TEncGOP::m_phase_filter_0_t1[4][13]={ 4222 {0, 4, 0, -12, 0, 40, 64, 40, 0, -12, 0, 4, 0}, 4223 {0, 0, 0, -2, 8,-20, 116,34,-10, 2, 0, 0, 0}, //{0, 1, -1, -8, -1, 31, 57, 47, 13, -7, -5, 1, 0}, // 4224 {0, 1, 0, -7, -5, 22, 53, 53, 22, -5, -7, 0, 1}, 4225 {0, 0, 1, -5, -7, 13, 47, 57, 31, -1, -8,-1, 1} 4222 const Pel TEncGOP::m_phaseFilter0T1[CGS_FILTER_PHASES_2X][CGS_FILTER_LENGTH] = 4223 { 4224 {0, 4, 0, -12, 0, 40, 64, 40, 0, -12, 0, 4, 0}, 4225 {0, 0, 0, -2, 8, -20, 116, 34, -10, 2, 0, 0, 0}, //{0, 1, -1, -8, -1, 31, 57, 47, 13, -7, -5, 1, 0}, // 4226 {0, 1, 0, -7, -5, 22, 53, 53, 22, -5, -7, 0, 1}, 4227 {0, 0, 1, -5, -7, 13, 47, 57, 31, -1, -8, -1, 1} 4226 4228 }; 4227 const Int TEncGOP::m_phase_filter_0_t1_chroma[4][13]={ 4228 {0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0}, 4229 {0, 0, 0, -2, 8,-20, 116,34,-10, 2, 0, 0, 0}, //{0, 1, -1, -8, -1, 31, 57, 47, 13, -7, -5, 1, 0}, // 4230 {0, 1, 0, -7, -5, 22, 53, 53, 22, -5, -7, 0, 1}, 4231 {0, 0, 1, -5, -7, 13, 47, 57, 31, -1, -8,-1, 1} 4229 4230 const Pel TEncGOP::m_phaseFilter0T1Chroma[CGS_FILTER_PHASES_2X][CGS_FILTER_LENGTH] = 4231 { 4232 {0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0}, 4233 {0, 0, 0, -2, 8, -20, 116, 34, -10, 2, 0, 0, 0}, //{0, 1, -1, -8, -1, 31, 57, 47, 13, -7, -5, 1, 0}, // 4234 {0, 1, 0, -7, -5, 22, 53, 53, 22, -5, -7, 0, 1}, 4235 {0, 0, 1, -5, -7, 13, 47, 57, 31, -1, -8, -1, 1} 4232 4236 }; 4233 4237 4234 const Int TEncGOP::m_phase_filter_1[8][13]={ 4235 {0, 0, 5, -6, -10,37, 76, 37,-10, -6, 5, 0, 0}, 4236 {0, -1, 5, -3, -12,29, 75, 45, -7, -8, 5, 0, 0}, 4237 {0, -1, 4, -1, -13,22, 73, 52, -3, -10, 4, 1, 0}, 4238 {0, -1, 4, 1, -13,14, 70, 59, 2, -12, 3, 2, -1}, 4239 {0, -1, 3, 2, -13, 8, 65, 65, 8, -13, 2, 3, -1}, 4240 {0, -1, 2, 3, -12, 2, 59, 70, 14, -13, 1, 4, -1}, 4241 {0, 0, 1, 4, -10,-3, 52, 73, 22, -13,-1, 4, -1}, 4242 {0, 0, 0, 5, -8,-7, 45, 75, 29, -12,-3, 5, -1} 4238 const Pel TEncGOP::m_phaseFilter1[CGS_FILTER_PHASES_1X][CGS_FILTER_LENGTH] = 4239 { 4240 {0, 0, 5, -6, -10, 37, 76, 37, -10, -6, 5, 0, 0}, 4241 {0, -1, 5, -3, -12, 29, 75, 45, -7, -8, 5, 0, 0}, 4242 {0, -1, 4, -1, -13, 22, 73, 52, -3, -10, 4, 1, 0}, 4243 {0, -1, 4, 1, -13, 14, 70, 59, 2, -12, 3, 2, -1}, 4244 {0, -1, 3, 2, -13, 8, 65, 65, 8, -13, 2, 3, -1}, 4245 {0, -1, 2, 3, -12, 2, 59, 70, 14, -13, 1, 4, -1}, 4246 {0, 0, 1, 4, -10, -3, 52, 73, 22, -13,-1, 4, -1}, 4247 {0, 0, 0, 5, -8, -7, 45, 75, 29, -12,-3, 5, -1} 4243 4248 }; 4244 4249 … … 4251 4256 #endif 4252 4257 #endif 4253 Void TEncGOP::filterImg( Pel *src, Int iSrcStride, Pel *dst, Int iDstStride, Int height1, Int width1, BitDepths& bitDepth, Int plane ) 4254 { 4255 Int length = m_iTap; 4256 Int height2,width2; 4257 Int k,iSum; 4258 Int i0, div_i0, i1; 4259 Int j0, div_j0, j1; 4260 const Int *p_filter; 4261 Pel *p_src, *p_dst; 4262 Pel *p_src_line, *p_dst_line; 4263 Int **p_temp, *p_tmp; 4264 Int shift = bitDepth.recon[CHANNEL_TYPE_LUMA] - bitDepth.recon[CHANNEL_TYPE_CHROMA]; 4258 Void TEncGOP::xFilterImg( Pel *src, Int iSrcStride, Pel *dst, Int iDstStride, Int height1, Int width1, BitDepths& bitDepth, ComponentID comp ) 4259 { 4260 Int height2, width2; 4261 4262 Pel *srcLine = src; 4263 Pel *dstLine = dst; 4264 Int length = m_cgsFilterLength; 4265 Int shift = bitDepth.recon[CHANNEL_TYPE_LUMA] - bitDepth.recon[CHANNEL_TYPE_CHROMA]; 4265 4266 Int shift2 = 2*7+shift; 4266 Int shift_round= (1 << (shift2 - 1));4267 Int iMax = (1<<(bitDepth.recon[CHANNEL_TYPE_LUMA]-shift))-1;4268 height2 = (height1 * m_ iM) / m_iN;4269 width2 = (width1 * m_ iM) / m_iN;4270 4271 m_phase _filter = plane? m_phase_filter_chroma : m_phase_filter_luma;4267 Int roundingOffset = (1 << (shift2 - 1)); 4268 Int maxVal = (1<<(bitDepth.recon[toChannelType(comp)]-shift))-1; 4269 height2 = (height1 * m_cgsFilterPhases) / m_iN; 4270 width2 = (width1 * m_cgsFilterPhases) / m_iN; 4271 4272 m_phaseFilter = comp == COMPONENT_Y ? m_phaseFilterLuma : m_phaseFilterChroma; 4272 4273 4273 4274 // horizontal filtering 4274 p_src_line = src; 4275 for(j1 = 0; j1 < height1; j1++) 4276 { 4277 i0=-m_iN; 4278 p_tmp = m_temp[j1]; 4275 for( Int j1 = 0; j1 < height1; j1++ ) 4276 { 4277 Int i0 = -m_iN; 4278 Int *tmp = m_temp[j1]; 4279 4279 4280 for(i1 = 0; i1 < width2; i1++) 4281 { 4282 i0 += m_iN; 4283 div_i0 = (i0 / m_iM); 4284 p_src = p_src_line + ( div_i0 - (length >> 1)); 4285 p_filter = m_phase_filter[i0 - div_i0 * m_iM]; // phase_filter[i0 % M] 4286 iSum = 0; 4287 for(k = 0; k < length; k++) 4288 { 4289 iSum += (*p_src++) * (*p_filter++); 4290 } 4291 *p_tmp++ = iSum; 4292 } 4293 p_src_line += iSrcStride; 4280 for( Int i1 = 0; i1 < width2; i1++ ) 4281 { 4282 i0 += m_iN; 4283 Int div_i0 = i0 / m_cgsFilterPhases; 4284 4285 Pel *srcTmp = srcLine + ( div_i0 - (length >> 1)); 4286 const Pel *filter = m_phaseFilter[i0 - div_i0 * m_cgsFilterPhases]; // phase_filter[i0 % M] 4287 4288 Int sum = 0; 4289 for(Int k = 0; k < length; k++) 4290 { 4291 sum += (*srcTmp++) * (*filter++); 4292 } 4293 *tmp++ = sum; 4294 } 4295 srcLine += iSrcStride; 4294 4296 } 4295 4297 4296 4298 // pad temp (vertical) 4297 for (k=-(length>>1); k<0; k++)4299 for( Int k = -(length>>1); k<0; k++ ) 4298 4300 { 4299 4301 memcpy(m_temp[k], m_temp[0], width2*sizeof(Int)); 4300 4302 } 4301 for (k=height1; k<(height1+(length>>1)); k++) 4302 { 4303 memcpy(m_temp[k], m_temp[k-1], (width2)* sizeof(Int)); 4303 4304 for( Int k = height1; k < (height1 + (length>>1)); k++) 4305 { 4306 memcpy(m_temp[k], m_temp[k-1], (width2) * sizeof(Int)); 4304 4307 } 4305 4308 4306 4309 // vertical filtering 4307 j0 = (plane == 0) ? -m_iN : -(m_iN-1);4310 Int j0 = comp == COMPONENT_Y ? -m_iN : (1 - m_iN); 4308 4311 4309 p_dst_line = dst; 4310 for(j1 = 0; j1 < height2; j1++) 4311 { 4312 j0 += m_iN; 4313 div_j0 = (j0 / m_iM); 4314 p_dst = p_dst_line; 4315 p_temp = &m_temp[div_j0 - (length>>1)]; 4316 p_filter = m_phase_filter[j0 - div_j0 * m_iM]; // phase_filter[j0 % M] 4317 for(i1 = 0; i1 < width2;i1++) 4318 { 4319 iSum=0; 4320 for(k = 0; k < length; k++) 4321 { 4322 iSum += p_temp[k][i1] * p_filter[k]; 4323 } 4324 iSum=((iSum + shift_round) >> shift2); 4325 *p_dst++ = (Short)(iSum > iMax ? iMax : (iSum < 0 ? 0 : iSum)); 4326 } 4327 p_dst_line += iDstStride; 4328 } 4329 } 4330 4331 Void TEncGOP::initDs(Int iWidth, Int iHeight, Int iType, const Int posScalingFactorX) 4332 { 4333 m_iTap = 13; 4334 if(posScalingFactorX == (1<<15)) 4335 { 4336 m_iM = 4; 4312 for( Int j1 = 0; j1 < height2; j1++ ) 4313 { 4314 j0 += m_iN; 4315 Int div_j0 = j0 / m_cgsFilterPhases; 4316 4317 Pel* dstTmp = dstLine; 4318 4319 Int **temp = &m_temp[div_j0 - (length>>1)]; 4320 const Pel *filter = m_phaseFilter[j0 - div_j0 * m_cgsFilterPhases]; // phase_filter[j0 % M] 4321 4322 for( Int i1 = 0; i1 < width2;i1++ ) 4323 { 4324 Int sum=0; 4325 for( Int k = 0; k < length; k++ ) 4326 { 4327 sum += temp[k][i1] * filter[k]; 4328 } 4329 sum = ((sum + roundingOffset) >> shift2); 4330 4331 *dstTmp++ = Clip3<Short>(sum < 0 ? 0 : sum, maxVal, sum); 4332 } 4333 dstLine += iDstStride; 4334 } 4335 } 4336 4337 Void TEncGOP::xInitDs( const Int iWidth, const Int iHeight, const Bool allIntra, const Int posScalingFactorX ) 4338 { 4339 m_cgsFilterLength = CGS_FILTER_LENGTH; 4340 4341 if( posScalingFactorX == POS_SCALING_FACTOR_2X ) 4342 { 4343 m_cgsFilterPhases = CGS_FILTER_PHASES_2X; 4337 4344 m_iN = 8; 4338 m_phase _filter_luma = iType? m_phase_filter_0_t1 : m_phase_filter_0_t0;4339 m_phase _filter_chroma = m_phase_filter_0_t1_chroma;4345 m_phaseFilterLuma = allIntra ? m_phaseFilter0T1 : m_phaseFilter0T0; 4346 m_phaseFilterChroma = m_phaseFilter0T1Chroma; 4340 4347 } 4341 4348 else 4342 4349 { 4343 m_ iM = 8;4350 m_cgsFilterPhases = CGS_FILTER_PHASES_1X; 4344 4351 m_iN = 12; 4345 m_phase _filter_luma = m_phase_filter_chroma = m_phase_filter_1;4346 m_phase _filter = m_phase_filter_1;4347 } 4348 4349 get_mem2DintWithPad (&m_temp, iHeight, iWidth*m_iM/m_iN, m_iTap>>1, 0);4350 } 4351 4352 Int TEncGOP:: get_mem2DintWithPad(Int ***array2D, Int dim0, Int dim1, Int iPadY, Int iPadX)4352 m_phaseFilterLuma = m_phaseFilterChroma = m_phaseFilter1; 4353 m_phaseFilter = m_phaseFilter1; 4354 } 4355 4356 xCreate2DArray( &m_temp, iHeight, iWidth * m_cgsFilterPhases/m_iN, m_cgsFilterLength >> 1, 0 ); 4357 } 4358 4359 Int TEncGOP::xCreate2DArray(Int ***array2D, Int dim0, Int dim1, Int iPadY, Int iPadX) 4353 4360 { 4354 4361 Int i; … … 4373 4380 } 4374 4381 4375 Void TEncGOP:: free_mem2DintWithPad(Int **array2D, Int iPadY, Int iPadX)4382 Void TEncGOP::xDestroy2DArray(Int **array2D, Int iPadY, Int iPadX) 4376 4383 { 4377 4384 if (array2D) … … 4383 4390 else 4384 4391 { 4385 printf(" free_mem2DintWithPad: trying to free unused memory\r\nPress Any Key\r\n");4392 printf("xDestroy2DArray: trying to free unused memory\r\nPress Any Key\r\n"); 4386 4393 } 4387 4394 … … 4390 4397 else 4391 4398 { 4392 printf(" free_mem2DintWithPad: trying to free unused memory\r\nPress Any Key\r\n");4399 printf("xDestroy2DArray: trying to free unused memory\r\nPress Any Key\r\n"); 4393 4400 } 4394 4401 } -
branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.h
r1430 r1432 152 152 TComPicYuv* m_pColorMappedPic; 153 153 154 Int m_iTap; 155 const Int (*m_phase_filter)[13]; 156 const Int (*m_phase_filter_luma)[13]; 157 const Int (*m_phase_filter_chroma)[13]; 158 Int m_iM, m_iN; 159 static const Int m_phase_filter_0_t0[4][13]; 160 static const Int m_phase_filter_0_t1[4][13]; 161 static const Int m_phase_filter_0_t1_chroma[4][13]; 162 static const Int m_phase_filter_1[8][13]; 163 Int **m_temp; 164 #endif 165 Int m_lastPocPeriodId; 166 Bool m_noRaslOutputFlag; 167 Bool m_prevPicHasEos; 168 static Bool m_signalledVPS; 154 Char m_cgsFilterLength; 155 Char m_cgsFilterPhases; 156 Int m_iN; 157 Int **m_temp; 158 const Pel (*m_phaseFilter)[CGS_FILTER_LENGTH]; 159 const Pel (*m_phaseFilterLuma)[CGS_FILTER_LENGTH]; 160 const Pel (*m_phaseFilterChroma)[CGS_FILTER_LENGTH]; 161 static const Pel m_phaseFilter0T0[CGS_FILTER_PHASES_2X][CGS_FILTER_LENGTH]; 162 static const Pel m_phaseFilter0T1[CGS_FILTER_PHASES_2X][CGS_FILTER_LENGTH]; 163 static const Pel m_phaseFilter0T1Chroma[CGS_FILTER_PHASES_2X][CGS_FILTER_LENGTH]; 164 static const Pel m_phaseFilter1[CGS_FILTER_PHASES_1X][CGS_FILTER_LENGTH]; 165 #endif 166 Int m_lastPocPeriodId; 167 Bool m_noRaslOutputFlag; 168 Bool m_prevPicHasEos; 169 static Bool m_signalledVPS; 169 170 #endif 170 171 … … 275 276 #if Q0074_COLOUR_REMAPPING_SEI 276 277 TComSEIColourRemappingInfo* xGetSEIColourRemappingInfo() { return &m_seiColourRemappingInfo; } 277 Void setCRISEIFile( Char* pch ){ m_seiColourRemappingInfo.m_colourRemapSEIFile = pch; }278 279 Void freeColourCRI();280 Int readingCRIparameters();278 Void xSetCRISEIFile( Char* pch ) { m_seiColourRemappingInfo.m_colourRemapSEIFile = pch; } 279 280 Void xFreeColourCRI(); 281 Int xReadingCRIparameters(); 281 282 Void xCheckParameter(); 282 283 #endif … … 287 288 #if CGS_3D_ASYMLUT 288 289 Void xDetermine3DAsymLUT( TComSlice * pSlice , TComPic * pCurPic , UInt refLayerIdc , TEncCfg * pCfg , Bool bSignalPPS ); 289 Void downScalePic( TComPicYuv* pcYuvSrc, TComPicYuv* pcYuvDest, BitDepths& bitDepth, const Int posScalingFactorX);290 Void downScaleComponent2x2( const Pel* pSrc, Pel* pDest, const Int iSrcStride, const Int iDestStride, const Int iSrcWidth, const Int iSrcHeight, const Int inputBitDepth, const Int outputBitDepth );291 inline Short xClip( Short x 292 Void initDs(Int iWidth, Int iHeight, Int iType, const Int posScalingFactorX);293 Void filterImg( Pel *src, Int iSrcStride, Pel *dst, Int iDstStride, Int height1, Int width1, BitDepths& bitDepth, Int plane);294 295 Int get_mem2DintWithPad(Int ***array2D, Int dim0, Int dim1, Int iPadY, Int iPadX);296 Void free_mem2DintWithPad(Int **array2D, Int iPadY, Int iPadX);290 Void xDownScalePic( TComPicYuv* pcYuvSrc, TComPicYuv* pcYuvDest, BitDepths& bitDepth, const Int posScalingFactorX); 291 Void xDownScaleComponent2x2( const Pel* pSrc, Pel* pDest, const Int iSrcStride, const Int iDestStride, const Int iSrcWidth, const Int iSrcHeight, const Int inputBitDepth, const Int outputBitDepth ); 292 inline Short xClip( Short x, Int bitdepth ); 293 Void xInitDs( const Int iWidth, const Int iHeight, const Bool allIntra, const Int posScalingFactorX); 294 Void xFilterImg( Pel *src, Int iSrcStride, Pel *dst, Int iDstStride, Int height1, Int width1, BitDepths& bitDepth, ComponentID comp ); 295 296 Int xCreate2DArray(Int ***array2D, Int dim0, Int dim1, Int iPadY, Int iPadX); 297 Void xDestroy2DArray(Int **array2D, Int iPadY, Int iPadX); 297 298 #endif 298 299 Void xCheckLayerReset(TComSlice *slice);
Note: See TracChangeset for help on using the changeset viewer.