Changeset 677 in SHVCSoftware
- Timestamp:
- 15 Apr 2014, 05:23:37 (11 years ago)
- Location:
- branches/SHM-6-dev
- Files:
-
- 4 added
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-6-dev/build/linux/lib/TLibCommon/makefile
r125 r677 58 58 $(OBJ_DIR)/TComRdCostWeightPrediction.o \ 59 59 $(OBJ_DIR)/TComUpsampleFilter.o \ 60 $(OBJ_DIR)/TCom3DAsymLUT.o \ 60 61 61 62 LIBS = -lpthread -
branches/SHM-6-dev/build/linux/lib/TLibEncoder/makefile
r125 r677 52 52 $(OBJ_DIR)/WeightPredAnalysis.o \ 53 53 $(OBJ_DIR)/TEncRateCtrl.o \ 54 $(OBJ_DIR)/TEnc3DAsymLUT.o \ 54 55 55 56 LIBS = -lpthread -
branches/SHM-6-dev/build/vc10/TLibCommon_vc10.vcxproj
r125 r677 148 148 <ClCompile Include="..\..\source\Lib\libmd5\libmd5.c" /> 149 149 <ClCompile Include="..\..\source\Lib\TLibCommon\SEI.cpp" /> 150 <ClCompile Include="..\..\source\Lib\TLibCommon\TCom3DAsymLUT.cpp" /> 150 151 <ClCompile Include="..\..\source\Lib\TLibCommon\TComBitStream.cpp" /> 151 152 <ClCompile Include="..\..\source\Lib\TLibCommon\TComCABACTables.cpp" /> … … 180 181 <ClInclude Include="..\..\source\Lib\TLibCommon\NAL.h" /> 181 182 <ClInclude Include="..\..\source\Lib\TLibCommon\SEI.h" /> 183 <ClInclude Include="..\..\source\Lib\TLibCommon\TCom3DAsymLUT.h" /> 182 184 <ClInclude Include="..\..\source\Lib\TLibCommon\TComBitCounter.h" /> 183 185 <ClInclude Include="..\..\source\Lib\TLibCommon\TComBitStream.h" /> -
branches/SHM-6-dev/build/vc10/TLibEncoder_vc10.vcxproj
r125 r677 147 147 <ClCompile Include="..\..\source\Lib\TLibEncoder\SEIwrite.cpp" /> 148 148 <ClCompile Include="..\..\source\Lib\TLibEncoder\SyntaxElementWriter.cpp" /> 149 <ClCompile Include="..\..\source\Lib\TLibEncoder\TEnc3DAsymLUT.cpp" /> 149 150 <ClCompile Include="..\..\source\Lib\TLibEncoder\TEncAnalyze.cpp" /> 150 151 <ClCompile Include="..\..\source\Lib\TLibEncoder\TEncBinCoderCABAC.cpp" /> … … 169 170 <ClInclude Include="..\..\source\Lib\TLibEncoder\SEIwrite.h" /> 170 171 <ClInclude Include="..\..\source\Lib\TLibEncoder\SyntaxElementWriter.h" /> 172 <ClInclude Include="..\..\source\Lib\TLibEncoder\TEnc3DAsymLUT.h" /> 171 173 <ClInclude Include="..\..\source\Lib\TLibEncoder\TEncAnalyze.h" /> 172 174 <ClInclude Include="..\..\source\Lib\TLibEncoder\TEncBinCoder.h" /> -
branches/SHM-6-dev/source/App/TAppEncoder/TAppEncCfg.cpp
r652 r677 960 960 #if O0149_CROSS_LAYER_BLA_FLAG 961 961 ("CrossLayerBLAFlag", m_crossLayerBLAFlag, false, "Specifies the value of cross_layer_bla_flag in VPS") 962 #endif 963 #if Q0048_CGS_3D_ASYMLUT 964 ("CGS", m_nCGSFlag , 0, "whether CGS is enabled") 965 ("CGSMaxOctantDepth", m_nCGSMaxOctantDepth , 1, "max octant depth") 966 ("CGSMaxYPartNumLog", m_nCGSMaxYPartNumLog2 , 2, "max Y part number ") 967 ("CGSLUTBit", m_nCGSLUTBit , 12, "bit depth of CGS LUT") 962 968 #endif 963 969 ; … … 2301 2307 } 2302 2308 #endif 2309 #if Q0048_CGS_3D_ASYMLUT 2310 xConfirmPara( m_nCGSFlag < 0 || m_nCGSFlag > 1 , "0<=CGS<=1" ); 2311 #endif 2303 2312 #undef xConfirmPara 2304 2313 if (check_failed) … … 2560 2569 printf("RecalQP:%d", m_recalculateQPAccordingToLambda ? 1 : 0 ); 2561 2570 #endif 2571 #if Q0048_CGS_3D_ASYMLUT 2572 printf("CGS: %d CGSMaxOctantDepth: %d CGSMaxYPartNumLog2: %d CGSLUTBit:%d " , m_nCGSFlag , m_nCGSMaxOctantDepth , m_nCGSMaxYPartNumLog2 , m_nCGSLUTBit ); 2573 #endif 2562 2574 printf("\n\n"); 2563 2575 -
branches/SHM-6-dev/source/App/TAppEncoder/TAppEncCfg.h
r652 r677 395 395 Bool m_useInterLayerWeightedPred; 396 396 #endif 397 #if Q0048_CGS_3D_ASYMLUT 398 Int m_nCGSFlag; 399 Int m_nCGSMaxOctantDepth; 400 Int m_nCGSMaxYPartNumLog2; 401 Int m_nCGSLUTBit; 402 #endif 397 403 public: 398 404 TAppEncCfg(); -
branches/SHM-6-dev/source/App/TAppEncoder/TAppEncTop.cpp
r674 r677 604 604 #if O0149_CROSS_LAYER_BLA_FLAG 605 605 m_acTEncTop[layer].setCrossLayerBLAFlag( m_crossLayerBLAFlag ); 606 #endif 607 #if Q0048_CGS_3D_ASYMLUT 608 m_acTEncTop[layer].setCGSFlag( layer == 0 ? 0 : m_nCGSFlag ); 609 m_acTEncTop[layer].setCGSMaxOctantDepth( m_nCGSMaxOctantDepth ); 610 m_acTEncTop[layer].setCGSMaxYPartNumLog2( m_nCGSMaxYPartNumLog2 ); 611 m_acTEncTop[layer].setCGSLUTBit( m_nCGSLUTBit ); 606 612 #endif 607 613 } -
branches/SHM-6-dev/source/Lib/TLibCommon/TComPic.h
r652 r677 89 89 TComPicYuv* m_pcFullPelBaseRec[MAX_LAYERS]; // upsampled base layer recontruction for difference domain inter prediction 90 90 #endif 91 #if Q0048_CGS_3D_ASYMLUT 92 Int m_nFrameBit; 93 #endif 91 94 92 95 public: … … 220 223 #endif 221 224 225 #if Q0048_CGS_3D_ASYMLUT 226 Void setFrameBit( Int n ) { m_nFrameBit = n; } 227 Int getFrameBit() { return m_nFrameBit; } 228 #endif 222 229 };// END CLASS DEFINITION TComPic 223 230 -
branches/SHM-6-dev/source/Lib/TLibCommon/TComSlice.h
r672 r677 1744 1744 Bool m_pocResetInfoPresentFlag; 1745 1745 #endif 1746 #if Q0048_CGS_3D_ASYMLUT 1747 Int m_nCGSFlag; 1748 Int m_nCGSOutputBitDepthY; // not for syntax 1749 Int m_nCGSOutputBitDepthC; // not for syntax 1750 #endif 1746 1751 #endif 1747 1752 … … 1884 1889 Bool getPocResetInfoPresentFlag () { return m_pocResetInfoPresentFlag; } 1885 1890 Void setPocResetInfoPresentFlag (const Bool val) { m_pocResetInfoPresentFlag = val; } 1891 #endif 1892 #if Q0048_CGS_3D_ASYMLUT 1893 Int getCGSFlag() { return m_nCGSFlag; } 1894 Void setCGSFlag(Int n){ m_nCGSFlag = n; } 1895 Int getCGSOutputBitDepthY() { return m_nCGSOutputBitDepthY; } 1896 Void setCGSOutputBitDepthY(Int n){ m_nCGSOutputBitDepthY = n; } 1897 Int getCGSOutputBitDepthC() { return m_nCGSOutputBitDepthC; } 1898 Void setCGSOutputBitDepthC(Int n){ m_nCGSOutputBitDepthC = n; } 1886 1899 #endif 1887 1900 }; … … 2047 2060 Bool m_pocMsbValRequiredFlag; 2048 2061 Bool m_pocMsbValPresentFlag; 2062 #endif 2063 #if Q0048_CGS_3D_ASYMLUT 2064 Int m_nCGSOverWritePPS; // for optimization, not output to bitstream 2049 2065 #endif 2050 2066 #endif //SVC_EXTENSION … … 2164 2180 #if SVC_EXTENSION 2165 2181 Void setRefPicList ( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr = false, TComPic** ilpPic = NULL ); 2182 #if Q0048_CGS_3D_ASYMLUT 2183 Int getCGSOverWritePPS() { return m_nCGSOverWritePPS; } 2184 Void setCGSOverWritePPS(Int n) { m_nCGSOverWritePPS = n; } 2185 #endif 2166 2186 #else 2167 2187 Void setRefPicList ( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr = false ); -
branches/SHM-6-dev/source/Lib/TLibCommon/TComUpsampleFilter.cpp
r644 r677 172 172 #if O0194_JOINT_US_BITSHIFT 173 173 Int shift = g_bitDepthYLayer[currLayerId] - g_bitDepthYLayer[refLayerId]; 174 #if Q0048_CGS_3D_ASYMLUT 175 if( currSlice->getPPS()->getCGSFlag() ) 176 { 177 shift = g_bitDepthYLayer[currLayerId] - currSlice->getPPS()->getCGSOutputBitDepthY(); 178 } 179 assert( shift >= 0 ); 180 #endif 174 181 #endif 175 182 … … 205 212 #if O0194_JOINT_US_BITSHIFT 206 213 shift = g_bitDepthCLayer[currLayerId] - g_bitDepthCLayer[refLayerId]; 214 #if Q0048_CGS_3D_ASYMLUT 215 if( currSlice->getPPS()->getCGSFlag() ) 216 { 217 shift = g_bitDepthCLayer[currLayerId] - currSlice->getPPS()->getCGSOutputBitDepthC(); 218 } 219 #endif 207 220 #endif 208 221 … … 297 310 // g_bitDepthY was set to EL bit-depth, but shift1 should be calculated using BL bit-depth 298 311 Int shift1 = g_bitDepthYLayer[refLayerId] - 8; 312 #if Q0048_CGS_3D_ASYMLUT 313 if( currSlice->getPPS()->getCGSFlag() ) 314 { 315 shift1 = currSlice->getPPS()->getCGSOutputBitDepthY() - 8; 316 } 317 #endif 299 318 #else 300 319 Int shift1 = g_bitDepthY - 8; … … 444 463 // g_bitDepthC was set to EL bit-depth, but shift1 should be calculated using BL bit-depth 445 464 shift1 = g_bitDepthCLayer[refLayerId] - 8; 465 #if Q0048_CGS_3D_ASYMLUT 466 if( currSlice->getPPS()->getCGSFlag() ) 467 { 468 shift1 = currSlice->getPPS()->getCGSOutputBitDepthC() - 8; 469 } 470 #endif 446 471 #else 447 472 shift1 = g_bitDepthC - 8; -
branches/SHM-6-dev/source/Lib/TLibCommon/TypeDef.h
r673 r677 86 86 #define O0194_JOINT_US_BITSHIFT 1 ///< JCTVC-O0194: Joint Upsampling and bit-shift 87 87 #endif 88 #define Q0048_CGS_3D_ASYMLUT 1 89 #if Q0048_CGS_3D_ASYMLUT 90 #define Q0048_CGS_3D_ASYMLUT_OFF 0 91 #define Q0048_CGS_3D_ASYMLUT_PPSUPDATE 1 92 #define O0194_WEIGHTED_PREDICTION_CGS 0 93 #else 88 94 #define O0194_WEIGHTED_PREDICTION_CGS 1 ///< JCTVC-O0194: Weighted prediciton for color gamut scalability 95 #endif 89 96 #define MFM_ENCCONSTRAINT 1 ///< JCTVC-O0216: Encoder constraint for motion field mapping 90 97 #define VPS_NUH_LAYER_ID 1 ///< JCTVC-N0085: Assert that the nuh_layer_id of VPS NAL unit should be 0 -
branches/SHM-6-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
r674 r677 39 39 #include "SEIread.h" 40 40 #include "TDecSlice.h" 41 #if Q0048_CGS_3D_ASYMLUT 42 #include "../TLibCommon/TCom3DAsymLUT.h" 43 #endif 41 44 42 45 //! \ingroup TLibDecoder … … 175 178 } 176 179 177 Void TDecCavlc::parsePPS(TComPPS* pcPPS) 180 Void TDecCavlc::parsePPS(TComPPS* pcPPS 181 #if Q0048_CGS_3D_ASYMLUT 182 , TCom3DAsymLUT * pc3DAsymLUT , Int nLayerID 183 #endif 184 ) 178 185 { 179 186 #if ENC_DEC_TRACE … … 348 355 READ_FLAG( uiCode, "poc_reset_info_present_flag" ); 349 356 pcPPS->setPocResetInfoPresentFlag(uiCode ? true : false); 357 #if Q0048_CGS_3D_ASYMLUT 358 READ_FLAG( uiCode , "colour_mapping_enabled_flag" ); 359 pcPPS->setCGSFlag( uiCode ); 360 if( pcPPS->getCGSFlag() == Q0048_CGS_3D_ASYMLUT_PPSUPDATE ) 361 { 362 xParse3DAsymLUT( pc3DAsymLUT ); 363 pcPPS->setCGSOutputBitDepthY( pc3DAsymLUT->getOutputBitDepthY() ); 364 pcPPS->setCGSOutputBitDepthC( pc3DAsymLUT->getOutputBitDepthC() ); 365 } 366 #endif 350 367 #endif 351 368 } … … 3720 3737 } 3721 3738 3739 #if Q0048_CGS_3D_ASYMLUT 3740 Void TDecCavlc::xParse3DAsymLUT( TCom3DAsymLUT * pc3DAsymLUT ) 3741 { 3742 UInt uiCurOctantDepth , uiCurPartNumLog2 , uiInputBitDepthM8 , uiOutputBitDepthM8 , uiResQaunBit; 3743 READ_CODE( 2 , uiCurOctantDepth , "cm_octant_depth" ); 3744 READ_CODE( 2 , uiCurPartNumLog2 , "cm_y_part_num_log2" ); 3745 READ_CODE( 3 , uiInputBitDepthM8 , "cm_input_bit_depth_minus8" ); 3746 Int iInputBitDepthCDelta; 3747 READ_SVLC(iInputBitDepthCDelta, "cm_input_bit_depth_chroma delta"); 3748 READ_CODE( 3 , uiOutputBitDepthM8 , "cm_output_bit_depth_minus8" ); 3749 Int iOutputBitDepthCDelta; 3750 READ_SVLC(iOutputBitDepthCDelta, "cm_output_bit_depth_chroma_delta"); 3751 READ_CODE( 2 , uiResQaunBit , "cm_res_quant_bit" ); 3752 pc3DAsymLUT->destroy(); 3753 pc3DAsymLUT->create( uiCurOctantDepth , uiInputBitDepthM8 + 8 , uiInputBitDepthM8 + 8 + iInputBitDepthCDelta, uiOutputBitDepthM8 + 8 , uiOutputBitDepthM8 + 8 + iOutputBitDepthCDelta ,uiCurPartNumLog2 ); 3754 pc3DAsymLUT->setResQuantBit( uiResQaunBit ); 3755 3756 xParse3DAsymLUTOctant( pc3DAsymLUT , 0 , 0 , 0 , 0 , 1 << pc3DAsymLUT->getCurOctantDepth() ); 3757 } 3758 3759 Void TDecCavlc::xParse3DAsymLUTOctant( TCom3DAsymLUT * pc3DAsymLUT , Int nDepth , Int yIdx , Int uIdx , Int vIdx , Int nLength ) 3760 { 3761 UInt uiOctantSplit = nDepth < pc3DAsymLUT->getCurOctantDepth(); 3762 if( nDepth < pc3DAsymLUT->getCurOctantDepth() ) 3763 READ_FLAG( uiOctantSplit , "split_octant_flag" ); 3764 Int nYPartNum = 1 << pc3DAsymLUT->getCurYPartNumLog2(); 3765 if( uiOctantSplit ) 3766 { 3767 Int nHalfLength = nLength >> 1; 3768 for( Int l = 0 ; l < 2 ; l++ ) 3769 { 3770 for( Int m = 0 ; m < 2 ; m++ ) 3771 { 3772 for( Int n = 0 ; n < 2 ; n++ ) 3773 { 3774 xParse3DAsymLUTOctant( pc3DAsymLUT , nDepth + 1 , yIdx + l * nHalfLength * nYPartNum , uIdx + m * nHalfLength , vIdx + n * nHalfLength , nHalfLength ); 3775 } 3776 } 3777 } 3778 } 3779 else 3780 { 3781 for( Int l = 0 ; l < nYPartNum ; l++ ) 3782 { 3783 for( Int nVertexIdx = 0 ; nVertexIdx < 4 ; nVertexIdx++ ) 3784 { 3785 UInt uiCodeVertex = 0; 3786 Int deltaY = 0 , deltaU = 0 , deltaV = 0; 3787 READ_FLAG( uiCodeVertex , "coded_vertex_flag" ); 3788 if( uiCodeVertex ) 3789 { 3790 READ_SVLC( deltaY , "resY" ); 3791 READ_SVLC( deltaU , "resU" ); 3792 READ_SVLC( deltaV , "resV" ); 3793 } 3794 pc3DAsymLUT->setCuboidVertexResTree( yIdx + l , uIdx , vIdx , nVertexIdx , deltaY , deltaU , deltaV ); 3795 } 3796 } 3797 } 3798 } 3799 #endif 3722 3800 //! \} 3723 3801 -
branches/SHM-6-dev/source/Lib/TLibDecoder/TDecCAVLC.h
r672 r677 46 46 #include "SyntaxElementParser.h" 47 47 48 #if Q0048_CGS_3D_ASYMLUT 49 class TCom3DAsymLUT; 50 #endif 48 51 //! \ingroup TLibDecoder 49 52 //! \{ … … 97 100 Void parseSPS ( TComSPS* pcSPS ); 98 101 #endif //SVC_EXTENSION 99 Void parsePPS ( TComPPS* pcPPS); 102 Void parsePPS ( TComPPS* pcPPS 103 #if Q0048_CGS_3D_ASYMLUT 104 , TCom3DAsymLUT * pc3DAsymLUT , Int nLayerID 105 #endif 106 ); 100 107 Void parseVUI ( TComVUI* pcVUI, TComSPS* pcSPS ); 101 108 Void parseSEI ( SEIMessages& ); … … 137 144 protected: 138 145 Bool xMoreRbspData(); 146 147 #if Q0048_CGS_3D_ASYMLUT 148 Void xParse3DAsymLUT( TCom3DAsymLUT * pc3DAsymLUT ); 149 Void xParse3DAsymLUTOctant( TCom3DAsymLUT * pc3DAsymLUT , Int nDepth , Int yIdx , Int uIdx , Int vIdx , Int nLength ); 150 #endif 139 151 }; 140 152 -
branches/SHM-6-dev/source/Lib/TLibDecoder/TDecEntropy.h
r644 r677 49 49 class TDecCavlc; 50 50 class ParameterSetManagerDecoder; 51 #if Q0048_CGS_3D_ASYMLUT 52 class TCom3DAsymLUT; 53 #endif 51 54 52 55 //! \ingroup TLibDecoder … … 71 74 virtual Void parseSPS ( TComSPS* pcSPS ) = 0; 72 75 #endif 73 virtual Void parsePPS ( TComPPS* pcPPS ) = 0; 76 virtual Void parsePPS ( TComPPS* pcPPS 77 #if Q0048_CGS_3D_ASYMLUT 78 , TCom3DAsymLUT * pc3DAsymLUT , Int nLayerID 79 #endif 80 ) = 0; 74 81 75 82 virtual Void parseSliceHeader ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager) = 0; … … 138 145 Void decodeSPS ( TComSPS* pcSPS ) { m_pcEntropyDecoderIf->parseSPS(pcSPS); } 139 146 #endif 140 Void decodePPS ( TComPPS* pcPPS ) { m_pcEntropyDecoderIf->parsePPS(pcPPS); } 147 Void decodePPS ( TComPPS* pcPPS 148 #if Q0048_CGS_3D_ASYMLUT 149 , TCom3DAsymLUT * pc3DAsymLUT , Int nLayerID 150 #endif 151 ) { m_pcEntropyDecoderIf->parsePPS(pcPPS 152 #if Q0048_CGS_3D_ASYMLUT 153 , pc3DAsymLUT , nLayerID 154 #endif 155 ); } 141 156 Void decodeSliceHeader ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager) { m_pcEntropyDecoderIf->parseSliceHeader(rpcSlice, parameterSetManager); } 142 157 -
branches/SHM-6-dev/source/Lib/TLibDecoder/TDecSbac.h
r644 r677 81 81 Void parseSPS ( TComSPS* /*pcSPS*/ ) {} 82 82 #endif 83 Void parsePPS ( TComPPS* /*pcPPS*/ ) {} 83 Void parsePPS ( TComPPS* /*pcPPS*/ 84 #if Q0048_CGS_3D_ASYMLUT 85 , TCom3DAsymLUT * /*pc3DAsymLUT*/ , Int /*nLayerID*/ 86 #endif 87 ) {} 84 88 85 89 Void parseSliceHeader ( TComSlice*& /*rpcSlice*/, ParameterSetManagerDecoder* /*parameterSetManager*/) {} -
branches/SHM-6-dev/source/Lib/TLibDecoder/TDecTop.cpp
r669 r677 93 93 m_subDpbIdx = -1; 94 94 #endif 95 #if Q0048_CGS_3D_ASYMLUT 96 m_pColorMappedPic = NULL; 97 #endif 95 98 } 96 99 … … 99 102 #if ENC_DEC_TRACE 100 103 fclose( g_hTrace ); 104 #endif 105 #if Q0048_CGS_3D_ASYMLUT 106 if(m_pColorMappedPic) 107 { 108 m_pColorMappedPic->destroy(); 109 delete m_pColorMappedPic; 110 m_pColorMappedPic = NULL; 111 } 101 112 #endif 102 113 } … … 357 368 Bool sameBitDepths = ( g_bitDepthYLayer[m_layerId] == g_bitDepthYLayer[refLayerId] ) && ( g_bitDepthCLayer[m_layerId] == g_bitDepthCLayer[refLayerId] ); 358 369 359 if( pcPicYuvRecBase->getWidth() != pcSlice->getPicWidthInLumaSamples() || pcPicYuvRecBase->getHeight() != pcSlice->getPicHeightInLumaSamples() || !zeroOffsets || !sameBitDepths ) 370 if( pcPicYuvRecBase->getWidth() != pcSlice->getPicWidthInLumaSamples() || pcPicYuvRecBase->getHeight() != pcSlice->getPicHeightInLumaSamples() || !zeroOffsets || !sameBitDepths 371 #if Q0048_CGS_3D_ASYMLUT 372 || pcSlice->getPPS()->getCGSFlag() > 0 373 #endif 374 ) 360 375 #else 361 376 if(pcPicYuvRecBase->getWidth() != pcSlice->getPicWidthInLumaSamples() || pcPicYuvRecBase->getHeight() != pcSlice->getPicHeightInLumaSamples() || !zeroOffsets ) … … 1533 1548 g_posScalingFactor[refLayerIdc][1] = ((heightBL << 16) + (heightEL >> 1)) / heightEL; 1534 1549 1550 #if Q0048_CGS_3D_ASYMLUT 1551 TComPicYuv* pBaseColRec = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(); 1552 if( pcSlice->getPPS()->getCGSFlag() != Q0048_CGS_3D_ASYMLUT_OFF ) 1553 { 1554 if(!m_pColorMappedPic) 1555 initAsymLut(pcSlice->getBaseColPic(refLayerIdc)->getSlice(0)); 1556 m_c3DAsymLUTPPS.colorMapping( pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), m_pColorMappedPic ); 1557 pBaseColRec = m_pColorMappedPic; 1558 } 1559 #endif 1535 1560 #if SVC_UPSAMPLING 1536 1561 if( pcPic->isSpatialEnhLayer(refLayerIdc) ) … … 1543 1568 #if O0215_PHASE_ALIGNMENT 1544 1569 #if O0194_JOINT_US_BITSHIFT 1570 #if Q0048_CGS_3D_ASYMLUT 1571 m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL, pcSlice->getVPS()->getPhaseAlignFlag() ); 1572 #else 1545 1573 m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL, pcSlice->getVPS()->getPhaseAlignFlag() ); 1574 #endif 1575 #else 1576 #if Q0048_CGS_3D_ASYMLUT 1577 m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc), pcSlice->getVPS()->getPhaseAlignFlag() ); 1546 1578 #else 1547 1579 m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL, pcSlice->getVPS()->getPhaseAlignFlag() ); 1548 1580 #endif 1581 #endif 1549 1582 #else 1550 1583 #if O0194_JOINT_US_BITSHIFT 1584 #if Q0048_CGS_3D_ASYMLUT 1585 m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL ); 1586 #else 1551 1587 m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL ); 1588 #endif 1589 #else 1590 #if Q0048_CGS_3D_ASYMLUT 1591 m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL ); 1552 1592 #else 1553 1593 m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL ); 1594 #endif 1554 1595 #endif 1555 1596 #endif … … 1763 1804 } 1764 1805 1765 Void TDecTop::xDecodePPS() 1806 Void TDecTop::xDecodePPS( 1807 #if Q0048_CGS_3D_ASYMLUT 1808 TCom3DAsymLUT * pc3DAsymLUT 1809 #endif 1810 ) 1766 1811 { 1767 1812 TComPPS* pps = new TComPPS(); … … 1771 1816 #endif 1772 1817 1773 m_cEntropyDecoder.decodePPS( pps ); 1818 m_cEntropyDecoder.decodePPS( pps 1819 #if Q0048_CGS_3D_ASYMLUT 1820 , pc3DAsymLUT , m_layerId 1821 #endif 1822 ); 1774 1823 m_parameterSetManagerDecoder.storePrefetchedPPS( pps ); 1775 1824 … … 1949 1998 1950 1999 case NAL_UNIT_PPS: 1951 xDecodePPS(); 2000 xDecodePPS( 2001 #if Q0048_CGS_3D_ASYMLUT 2002 &m_c3DAsymLUTPPS 2003 #endif 2004 ); 1952 2005 return false; 1953 2006 … … 2313 2366 } 2314 2367 #endif 2368 2369 #if Q0048_CGS_3D_ASYMLUT 2370 Void TDecTop::initAsymLut(TComSlice *pcSlice) 2371 { 2372 if(m_layerId>0) 2373 { 2374 if(!m_pColorMappedPic) 2375 { 2376 Int picWidth = pcSlice->getPicWidthInLumaSamples(); 2377 Int picHeight = pcSlice->getPicHeightInLumaSamples(); 2378 m_pColorMappedPic = new TComPicYuv; 2379 m_pColorMappedPic->create( picWidth, picHeight, pcSlice->getChromaFormatIdc()/*CHROMA_420*/, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, NULL ); 2380 } 2381 } 2382 } 2383 #endif 2315 2384 #endif //SVC_EXTENSION 2316 2385 //! \} -
branches/SHM-6-dev/source/Lib/TLibDecoder/TDecTop.h
r669 r677 45 45 #include "TLibCommon/TComTrQuant.h" 46 46 #include "TLibCommon/SEI.h" 47 #if Q0048_CGS_3D_ASYMLUT 48 #include "TLibCommon/TCom3DAsymLUT.h" 49 #endif 47 50 48 51 #include "TDecGop.h" … … 79 82 // functional classes 80 83 TComPrediction m_cPrediction; 84 #if Q0048_CGS_3D_ASYMLUT 85 TCom3DAsymLUT m_c3DAsymLUTPPS; 86 TComPicYuv* m_pColorMappedPic; 87 #endif 81 88 TComTrQuant m_cTrQuant; 82 89 TDecGop m_cGopDecoder; … … 268 275 Void xDecodeVPS(); 269 276 Void xDecodeSPS(); 270 Void xDecodePPS(); 277 Void xDecodePPS( 278 #if Q0048_CGS_3D_ASYMLUT 279 TCom3DAsymLUT * pc3DAsymLUT 280 #endif 281 ); 271 282 Void xDecodeSEI( TComInputBitstream* bs, const NalUnitType nalUnitType ); 272 283 … … 279 290 Void setFirstPicInLayerDecodedFlag(Bool x) { m_firstPicInLayerDecodedFlag = x; } 280 291 #endif 292 #if Q0048_CGS_3D_ASYMLUT 293 Void initAsymLut(TComSlice *pcSlice); 294 #endif 281 295 };// END CLASS DEFINITION TDecTop 282 296 -
branches/SHM-6-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
r674 r677 154 154 155 155 156 Void TEncCavlc::codePPS( TComPPS* pcPPS ) 156 Void TEncCavlc::codePPS( TComPPS* pcPPS 157 #if Q0048_CGS_3D_ASYMLUT 158 , TEnc3DAsymLUT * pc3DAsymLUT 159 #endif 160 ) 157 161 { 158 162 #if ENC_DEC_TRACE … … 268 272 { 269 273 WRITE_FLAG( pcPPS->getPocResetInfoPresentFlag() ? 1 : 0, "poc_reset_info_present_flag" ); 274 #if Q0048_CGS_3D_ASYMLUT 275 UInt uiPos = getNumberOfWrittenBits(); 276 WRITE_FLAG( pcPPS->getCGSFlag() , "colour_mapping_enabled_flag" ); 277 if( pcPPS->getCGSFlag() == Q0048_CGS_3D_ASYMLUT_PPSUPDATE ) 278 { 279 assert( pc3DAsymLUT != NULL ); 280 xCode3DAsymLUT( pc3DAsymLUT ); 281 } 282 pc3DAsymLUT->setPPSBit( getNumberOfWrittenBits() - uiPos ); 283 #endif 270 284 #endif 271 285 } … … 2689 2703 return true; 2690 2704 } 2705 2706 #if Q0048_CGS_3D_ASYMLUT 2707 Void TEncCavlc::xCode3DAsymLUT( TCom3DAsymLUT * pc3DAsymLUT ) 2708 { 2709 assert( pc3DAsymLUT->getCurOctantDepth() < 4 ); 2710 WRITE_CODE( pc3DAsymLUT->getCurOctantDepth() , 2 , "cm_octant_depth" ); 2711 assert( pc3DAsymLUT->getCurYPartNumLog2() < 4 ); 2712 WRITE_CODE( pc3DAsymLUT->getCurYPartNumLog2() , 2 , "cm_y_part_num_log2" ); 2713 assert( pc3DAsymLUT->getInputBitDepthY() < 16 ); 2714 WRITE_CODE( pc3DAsymLUT->getInputBitDepthY() - 8 , 3 , "cm_input_bit_depth_minus8" ); 2715 WRITE_SVLC(pc3DAsymLUT->getInputBitDepthC()-pc3DAsymLUT->getInputBitDepthY(), "cm_input_bit_depth_chroma delta"); 2716 assert( pc3DAsymLUT->getOutputBitDepthY() < 16 ); 2717 WRITE_CODE( pc3DAsymLUT->getOutputBitDepthY() - 8 , 3 , "cm_output_bit_depth_minus8" ); 2718 WRITE_SVLC(pc3DAsymLUT->getOutputBitDepthC()-pc3DAsymLUT->getOutputBitDepthY(), "cm_output_bit_depth_chroma_delta"); 2719 assert( pc3DAsymLUT->getResQuantBit() < 4 ); 2720 WRITE_CODE( pc3DAsymLUT->getResQuantBit() , 2 , "cm_res_quant_bit" ); 2721 2722 xCode3DAsymLUTOctant( pc3DAsymLUT , 0 , 0 , 0 , 0 , 1 << pc3DAsymLUT->getCurOctantDepth() ); 2723 } 2724 2725 Void TEncCavlc::xCode3DAsymLUTOctant( TCom3DAsymLUT * pc3DAsymLUT , Int nDepth , Int yIdx , Int uIdx , Int vIdx , Int nLength ) 2726 { 2727 UInt uiOctantSplit = nDepth < pc3DAsymLUT->getCurOctantDepth(); 2728 if( nDepth < pc3DAsymLUT->getCurOctantDepth() ) 2729 WRITE_FLAG( uiOctantSplit , "split_octant_flag" ); 2730 Int nYPartNum = 1 << pc3DAsymLUT->getCurYPartNumLog2(); 2731 if( uiOctantSplit ) 2732 { 2733 Int nHalfLength = nLength >> 1; 2734 for( Int l = 0 ; l < 2 ; l++ ) 2735 { 2736 for( Int m = 0 ; m < 2 ; m++ ) 2737 { 2738 for( Int n = 0 ; n < 2 ; n++ ) 2739 { 2740 xCode3DAsymLUTOctant( pc3DAsymLUT , nDepth + 1 , yIdx + l * nHalfLength * nYPartNum , uIdx + m * nHalfLength , vIdx + n * nHalfLength , nHalfLength ); 2741 } 2742 } 2743 } 2744 } 2745 else 2746 { 2747 for( Int l = 0 ; l < nYPartNum ; l++ ) 2748 { 2749 for( Int nVertexIdx = 0 ; nVertexIdx < 4 ; nVertexIdx++ ) 2750 { 2751 SYUVP sRes = pc3DAsymLUT->getCuboidVertexResTree( yIdx + l , uIdx , vIdx , nVertexIdx ); 2752 UInt uiCodeVertex = sRes.Y != 0 || sRes.U != 0 || sRes.V != 0; 2753 WRITE_FLAG( uiCodeVertex , "coded_vertex_flag" ); 2754 if( uiCodeVertex ) 2755 { 2756 WRITE_SVLC( sRes.Y , "resY" ); 2757 WRITE_SVLC( sRes.U , "resU" ); 2758 WRITE_SVLC( sRes.V , "resV" ); 2759 } 2760 } 2761 } 2762 } 2763 } 2764 #endif 2691 2765 //! \} -
branches/SHM-6-dev/source/Lib/TLibEncoder/TEncCavlc.h
r644 r677 48 48 #include "TEncEntropy.h" 49 49 #include "SyntaxElementWriter.h" 50 #if Q0048_CGS_3D_ASYMLUT 51 #include "../TLibCommon/TCom3DAsymLUT.h" 52 #include "TEnc3DAsymLUT.h" 53 #endif 50 54 51 55 //! \ingroup TLibEncoder … … 53 57 54 58 class TEncTop; 59 #if Q0048_CGS_3D_ASYMLUT 60 class TCom3DAsymLUT; 61 #endif 55 62 56 63 // ==================================================================================================================== … … 90 97 Void codeVUI ( TComVUI *pcVUI, TComSPS* pcSPS ); 91 98 Void codeSPS ( TComSPS* pcSPS ); 92 Void codePPS ( TComPPS* pcPPS ); 99 Void codePPS ( TComPPS* pcPPS 100 #if Q0048_CGS_3D_ASYMLUT 101 , TEnc3DAsymLUT * pc3DAsymLUT 102 #endif 103 ); 93 104 Void codeSliceHeader ( TComSlice* pcSlice ); 94 105 Void codePTL ( TComPTL* pcPTL, Bool profilePresentFlag, Int maxNumSubLayersMinus1); … … 162 173 Void codeVpsDpbSizeTable (TComVPS *vps); 163 174 #endif 175 #if Q0048_CGS_3D_ASYMLUT 176 protected: 177 Void xCode3DAsymLUT( TCom3DAsymLUT * pc3DAsymLUT ); 178 Void xCode3DAsymLUTOctant( TCom3DAsymLUT * pc3DAsymLUT , Int nDepth , Int yIdx , Int uIdx , Int vIdx , Int nLength ); 179 #endif 164 180 #endif //SVC_EXTENSION 165 181 -
branches/SHM-6-dev/source/Lib/TLibEncoder/TEncCfg.h
r652 r677 364 364 UInt m_bottomRightTileIndex[1024]; 365 365 UInt m_ilcIdc[1024]; 366 #endif 367 #if Q0048_CGS_3D_ASYMLUT 368 Int m_nCGSFlag; 369 Int m_nCGSMaxOctantDepth; 370 Int m_nCGSMaxYPartNumLog2; 371 Int m_nCGSLUTBit; 366 372 #endif 367 373 #endif //SVC_EXTENSION … … 904 910 UInt getIlcIdc(UInt b) { return m_ilcIdc[b]; } 905 911 #endif 912 #if Q0048_CGS_3D_ASYMLUT 913 Void setCGSFlag(Int n) { m_nCGSFlag = n; } 914 Int getCGSFlag() { return m_nCGSFlag; } 915 Void setCGSMaxOctantDepth(Int n) { m_nCGSMaxOctantDepth = n; } 916 Int getCGSMaxOctantDepth() { return m_nCGSMaxOctantDepth; } 917 Void setCGSMaxYPartNumLog2(Int n) { m_nCGSMaxYPartNumLog2 = n; } 918 Int getCGSMaxYPartNumLog2() { return m_nCGSMaxYPartNumLog2; } 919 Void setCGSLUTBit(Int n) { m_nCGSLUTBit = n; } 920 Int getCGSLUTBit() { return m_nCGSLUTBit; } 921 #endif 906 922 #endif 907 923 }; -
branches/SHM-6-dev/source/Lib/TLibEncoder/TEncEntropy.cpp
r644 r677 79 79 } 80 80 81 Void TEncEntropy::encodePPS( TComPPS* pcPPS ) 82 { 83 m_pcEntropyCoderIf->codePPS( pcPPS ); 81 Void TEncEntropy::encodePPS( TComPPS* pcPPS 82 #if Q0048_CGS_3D_ASYMLUT 83 , TEnc3DAsymLUT * pc3DAsymLUT 84 #endif 85 ) 86 { 87 m_pcEntropyCoderIf->codePPS( pcPPS 88 #if Q0048_CGS_3D_ASYMLUT 89 , pc3DAsymLUT 90 #endif 91 ); 84 92 return; 85 93 } -
branches/SHM-6-dev/source/Lib/TLibEncoder/TEncEntropy.h
r644 r677 50 50 class TEncCavlc; 51 51 class SEI; 52 #if Q0048_CGS_3D_ASYMLUT 53 class TEnc3DAsymLUT; 54 #endif 52 55 53 56 // ==================================================================================================================== … … 70 73 virtual Void codeVPS ( TComVPS* pcVPS ) = 0; 71 74 virtual Void codeSPS ( TComSPS* pcSPS ) = 0; 72 virtual Void codePPS ( TComPPS* pcPPS ) = 0; 75 virtual Void codePPS ( TComPPS* pcPPS 76 #if Q0048_CGS_3D_ASYMLUT 77 , TEnc3DAsymLUT * pc3DAsymLUT 78 #endif 79 ) = 0; 73 80 virtual Void codeSliceHeader ( TComSlice* pcSlice ) = 0; 74 81 … … 156 163 // SPS 157 164 Void encodeSPS ( TComSPS* pcSPS ); 158 Void encodePPS ( TComPPS* pcPPS ); 165 Void encodePPS ( TComPPS* pcPPS 166 #if Q0048_CGS_3D_ASYMLUT 167 , TEnc3DAsymLUT * pc3DAsymLUT 168 #endif 169 ); 159 170 Void encodeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Bool bRD = false ); 160 171 Void encodeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); -
branches/SHM-6-dev/source/Lib/TLibEncoder/TEncGOP.cpp
r675 r677 106 106 m_pcPredSearch = NULL; 107 107 #endif 108 #if Q0048_CGS_3D_ASYMLUT 109 m_temp = NULL; 110 m_pColorMappedPic = NULL; 111 #endif 108 112 return; 109 113 } … … 111 115 TEncGOP::~TEncGOP() 112 116 { 117 #if Q0048_CGS_3D_ASYMLUT 118 if(m_pColorMappedPic) 119 { 120 m_pColorMappedPic->destroy(); 121 delete m_pColorMappedPic; 122 m_pColorMappedPic = NULL; 123 } 124 if(m_temp) 125 { 126 free_mem2DintWithPad(m_temp, m_iTap>>1, 0); 127 m_temp = NULL; 128 } 129 #endif 113 130 } 114 131 … … 159 176 #if SVC_UPSAMPLING 160 177 m_pcPredSearch = pcTEncTop->getPredSearch(); ///< encoder search class 178 #endif 179 #if Q0048_CGS_3D_ASYMLUT 180 if( pcTEncTop->getLayerId() ) 181 { 182 m_Enc3DAsymLUTPicUpdate.create( m_pcCfg->getCGSMaxOctantDepth() , g_bitDepthYLayer[pcTEncTop->getLayerId()-1] , g_bitDepthCLayer[pcTEncTop->getLayerId()-1] , g_bitDepthYLayer[pcTEncTop->getLayerId()] , g_bitDepthCLayer[pcTEncTop->getLayerId()] , m_pcCfg->getCGSMaxYPartNumLog2() /*, m_pcCfg->getCGSPhaseAlignment()*/ ); 183 m_Enc3DAsymLUTPPS.create( m_pcCfg->getCGSMaxOctantDepth() , g_bitDepthYLayer[pcTEncTop->getLayerId()-1] , g_bitDepthCLayer[pcTEncTop->getLayerId()-1] , g_bitDepthYLayer[pcTEncTop->getLayerId()] , g_bitDepthCLayer[pcTEncTop->getLayerId()] , m_pcCfg->getCGSMaxYPartNumLog2() /*, m_pcCfg->getCGSPhaseAlignment()*/ ); 184 if(!m_pColorMappedPic) 185 { 186 m_pColorMappedPic = new TComPicYuv; 187 m_pColorMappedPic->create( m_ppcTEncTop[0]->getSourceWidth(), m_ppcTEncTop[0]->getSourceHeight(), CHROMA_420, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, NULL ); 188 } 189 } 161 190 #endif 162 191 } … … 924 953 g_posScalingFactor[refLayerIdc][1] = ((heightBL << 16) + (heightEL >> 1)) / heightEL; 925 954 955 #if Q0048_CGS_3D_ASYMLUT 956 TComPicYuv* pBaseColRec = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(); 957 if( pcSlice->getPPS()->getCGSFlag() != Q0048_CGS_3D_ASYMLUT_OFF) 958 { 959 if(g_posScalingFactor[refLayerIdc][0] < (1<<16) || g_posScalingFactor[refLayerIdc][1] < (1<<16)) //if(pcPic->isSpatialEnhLayer(refLayerIdc)) 960 { 961 //downsampling; 962 downScalePic(pcPic->getPicYuvOrg(), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvOrg()); 963 //pcSlice->getBaseColPic(refLayerIdc)->getPicYuvOrg()->dump("ds.yuv", true, true); 964 m_Enc3DAsymLUTPPS.setDsOrigPic(pcSlice->getBaseColPic(refLayerIdc)->getPicYuvOrg()); 965 m_Enc3DAsymLUTPicUpdate.setDsOrigPic(pcSlice->getBaseColPic(refLayerIdc)->getPicYuvOrg()); 966 } 967 else 968 { 969 m_Enc3DAsymLUTPPS.setDsOrigPic(pcPic->getPicYuvOrg()); 970 m_Enc3DAsymLUTPicUpdate.setDsOrigPic(pcPic->getPicYuvOrg()); 971 } 972 973 Bool bSignalPPS = m_bSeqFirst; 974 bSignalPPS |= m_pcCfg->getGOPSize() > 1 ? pocCurr % m_pcCfg->getIntraPeriod() == 0 : pocCurr % m_pcCfg->getFrameRate() == 0; 975 xDetermin3DAsymLUT( pcSlice , pcPic , refLayerIdc , m_pcCfg , bSignalPPS ); 976 m_Enc3DAsymLUTPPS.colorMapping( pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), m_pColorMappedPic ); 977 pBaseColRec = m_pColorMappedPic; 978 } 979 #endif 926 980 #if SVC_UPSAMPLING 927 981 if( pcPic->isSpatialEnhLayer(refLayerIdc)) … … 941 995 #if O0215_PHASE_ALIGNMENT 942 996 #if O0194_JOINT_US_BITSHIFT 997 #if Q0048_CGS_3D_ASYMLUT 998 m_pcPredSearch->upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL, pcSlice->getVPS()->getPhaseAlignFlag() ); 999 #else 943 1000 m_pcPredSearch->upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL, pcSlice->getVPS()->getPhaseAlignFlag() ); 1001 #endif 1002 #else 1003 #if Q0048_CGS_3D_ASYMLUT 1004 m_pcPredSearch->upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL, pcSlice->getVPS()->getPhaseAlignFlag() ); 944 1005 #else 945 1006 m_pcPredSearch->upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL, pcSlice->getVPS()->getPhaseAlignFlag() ); 946 1007 #endif 1008 #endif 947 1009 #else 948 1010 #if O0194_JOINT_US_BITSHIFT 1011 #if Q0048_CGS_3D_ASYMLUT 1012 m_pcPredSearch->upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL ); 1013 #else 949 1014 m_pcPredSearch->upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL ); 1015 #endif 1016 #else 1017 #if Q0048_CGS_3D_ASYMLUT 1018 m_pcPredSearch->upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL ); 950 1019 #else 951 1020 m_pcPredSearch->upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL ); 952 1021 #endif 953 1022 #endif 1023 #endif 954 1024 } 955 1025 else 956 1026 { 1027 #if Q0048_CGS_3D_ASYMLUT 1028 pcPic->setFullPelBaseRec( refLayerIdc, pBaseColRec ); 1029 #else 957 1030 pcPic->setFullPelBaseRec( refLayerIdc, pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec() ); 1031 #endif 958 1032 } 959 1033 pcSlice->setFullPelBaseRec ( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc) ); … … 1884 1958 assert( pcSlice->getPPS()->getPPSId() == 0 || pcSlice->getPPS()->getPPSId() == m_layerId || m_pcEncTop->getVPS()->getRecursiveRefLayerFlag(m_layerId, pcSlice->getPPS()->getPPSId()) ); 1885 1959 #endif 1886 m_pcEntropyCoder->encodePPS(pcSlice->getPPS()); 1960 m_pcEntropyCoder->encodePPS(pcSlice->getPPS() 1961 #if Q0048_CGS_3D_ASYMLUT 1962 , & m_Enc3DAsymLUTPPS 1963 #endif 1964 ); 1887 1965 writeRBSPTrailingBits(nalu.m_Bitstream); 1888 1966 accessUnit.push_back(new NALUnitEBSP(nalu)); … … 1917 1995 m_bSeqFirst = false; 1918 1996 } 1997 #if Q0048_CGS_3D_ASYMLUT 1998 else if( m_pcCfg->getCGSFlag() == Q0048_CGS_3D_ASYMLUT_PPSUPDATE && pcSlice->getLayerId() && pcSlice->getCGSOverWritePPS() ) 1999 { 2000 #if SVC_EXTENSION 2001 OutputNALUnit nalu(NAL_UNIT_PPS, 0, m_layerId); 2002 #endif 2003 2004 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 2005 m_pcEntropyCoder->encodePPS(pcSlice->getPPS() , &m_Enc3DAsymLUTPPS ); 2006 writeRBSPTrailingBits(nalu.m_Bitstream); 2007 accessUnit.push_back(new NALUnitEBSP(nalu)); 2008 } 2009 #endif 1919 2010 1920 2011 if (writeSOP) // write SOP description SEI (if enabled) at the beginning of GOP … … 3339 3430 printf("]"); 3340 3431 } 3432 #if Q0048_CGS_3D_ASYMLUT 3433 pcPic->setFrameBit( (Int)uibits ); 3434 if( m_layerId && pcSlice->getPPS()->getCGSFlag()) 3435 m_Enc3DAsymLUTPicUpdate.updatePicCGSBits( pcSlice , m_Enc3DAsymLUTPPS.getPPSBit() ); 3436 #endif 3341 3437 } 3342 3438 … … 4045 4141 #endif 4046 4142 4143 #if Q0048_CGS_3D_ASYMLUT 4144 Void TEncGOP::xDetermin3DAsymLUT( TComSlice * pSlice , TComPic * pCurPic , UInt refLayerIdc , TEncCfg * pCfg , Bool bSignalPPS ) 4145 { 4146 Int nCGSFlag = pSlice->getPPS()->getCGSFlag(); 4147 m_Enc3DAsymLUTPPS.setPPSBit( 0 ); 4148 Double dErrorUpdatedPPS = 0 , dErrorPPS = 0; 4149 dErrorUpdatedPPS = m_Enc3DAsymLUTPicUpdate.derive3DAsymLUT( pSlice , pCurPic , refLayerIdc , pCfg , bSignalPPS , m_pcEncTop->getElRapSliceTypeB() ); 4150 if( bSignalPPS ) 4151 { 4152 m_Enc3DAsymLUTPPS.copy3DAsymLUT( &m_Enc3DAsymLUTPicUpdate ); 4153 pSlice->setCGSOverWritePPS( 1 ); // regular PPS update 4154 } 4155 else if( nCGSFlag == Q0048_CGS_3D_ASYMLUT_PPSUPDATE ) 4156 { 4157 dErrorPPS = m_Enc3DAsymLUTPPS.estimateDistWithCur3DAsymLUT( pCurPic , refLayerIdc ); 4158 Double dFactor = pCfg->getIntraPeriod() == 1 ? 0.99 : 0.9; 4159 pSlice->setCGSOverWritePPS( dErrorUpdatedPPS < dFactor * dErrorPPS ); 4160 if( pSlice->getCGSOverWritePPS() ) 4161 m_Enc3DAsymLUTPPS.copy3DAsymLUT( &m_Enc3DAsymLUTPicUpdate ); 4162 } 4163 pSlice->getPPS()->setCGSOutputBitDepthY( m_Enc3DAsymLUTPPS.getOutputBitDepthY() ); 4164 pSlice->getPPS()->setCGSOutputBitDepthC( m_Enc3DAsymLUTPPS.getOutputBitDepthC() ); 4165 } 4166 4167 Void TEncGOP::downScalePic( TComPicYuv* pcYuvSrc, TComPicYuv* pcYuvDest) 4168 { 4169 Int inputBitDepth = g_bitDepthYLayer[m_layerId]; 4170 Int outputBitDepth = g_bitDepthYLayer[m_layerId]; 4171 { 4172 pcYuvSrc->setBorderExtension(false); 4173 pcYuvSrc->extendPicBorder (); // extend the border. 4174 pcYuvSrc->setBorderExtension(false); 4175 4176 Int iWidth = pcYuvSrc->getWidth(); 4177 Int iHeight =pcYuvSrc->getHeight(); 4178 4179 if(!m_temp) 4180 initDs(iWidth, iHeight, m_pcCfg->getIntraPeriod()>1); 4181 4182 filterImg(pcYuvSrc->getLumaAddr(), pcYuvSrc->getStride(), pcYuvDest->getLumaAddr(), pcYuvDest->getStride(), iHeight, iWidth, inputBitDepth-outputBitDepth, 0); 4183 filterImg(pcYuvSrc->getCbAddr(), pcYuvSrc->getCStride(), pcYuvDest->getCbAddr(), pcYuvDest->getCStride(), iHeight>>1, iWidth>>1, inputBitDepth-outputBitDepth, 1); 4184 filterImg(pcYuvSrc->getCrAddr(), pcYuvSrc->getCStride(), pcYuvDest->getCrAddr(), pcYuvDest->getCStride(), iHeight>>1, iWidth>>1, inputBitDepth-outputBitDepth, 2); 4185 } 4186 } 4187 const int TEncGOP::m_phase_filter_0_t0[4][13]={ 4188 {0, 2, -3, -9, 6, 39, 58, 39, 6, -9, -3, 2, 0}, 4189 {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}, // 4190 {0, 1, 0, -7, -5, 22, 53, 53, 22, -5, -7, 0, 1}, 4191 {0, 0, 1, -5, -7, 13, 47, 57, 31, -1, -8,-1, 1} 4192 }; 4193 4194 const int TEncGOP::m_phase_filter_0_t1[4][13]={ 4195 {0, 4, 0, -12, 0, 40, 64, 40, 0, -12, 0, 4, 0}, 4196 {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}, // 4197 {0, 1, 0, -7, -5, 22, 53, 53, 22, -5, -7, 0, 1}, 4198 {0, 0, 1, -5, -7, 13, 47, 57, 31, -1, -8,-1, 1} 4199 }; 4200 const int TEncGOP::m_phase_filter_0_t1_chroma[4][13]={ 4201 {0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0}, 4202 {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}, // 4203 {0, 1, 0, -7, -5, 22, 53, 53, 22, -5, -7, 0, 1}, 4204 {0, 0, 1, -5, -7, 13, 47, 57, 31, -1, -8,-1, 1} 4205 }; 4206 4207 const int TEncGOP::m_phase_filter_1[8][13]={ 4208 {0, 0, 5, -6, -10,37, 76, 37,-10, -6, 5, 0, 0}, 4209 {0, -1, 5, -3, -12,29, 75, 45, -7, -8, 5, 0, 0}, 4210 {0, -1, 4, -1, -13,22, 73, 52, -3, -10, 4, 1, 0}, 4211 {0, -1, 4, 1, -13,14, 70, 59, 2, -12, 3, 2, -1}, 4212 {0, -1, 3, 2, -13, 8, 65, 65, 8, -13, 2, 3, -1}, 4213 {0, -1, 2, 3, -12, 2, 59, 70, 14, -13, 1, 4, -1}, 4214 {0, 0, 1, 4, -10,-3, 52, 73, 22, -13,-1, 4, -1}, 4215 {0, 0, 0, 5, -8,-7, 45, 75, 29, -12,-3, 5, -1} 4216 }; 4217 4218 Void TEncGOP::filterImg( 4219 Pel *src, 4220 Int iSrcStride, 4221 Pel *dst, 4222 Int iDstStride, 4223 Int height1, 4224 Int width1, 4225 Int shift, 4226 Int plane) 4227 { 4228 Int length = m_iTap; 4229 Int height2,width2; 4230 Int k,iSum; 4231 Int i0, div_i0, i1; 4232 Int j0, div_j0, j1; 4233 const Int *p_filter; 4234 Pel *p_src, *p_dst; 4235 Pel *p_src_line, *p_dst_line; 4236 Int **p_temp, *p_tmp; 4237 Int shift2 = 2*7+shift; 4238 Int shift_round = (1 << (shift2 - 1)); 4239 Int iMax = (1<<(g_bitDepthY-shift))-1; 4240 height2 = (height1 * m_iM) / m_iN; 4241 width2 = (width1 * m_iM) / m_iN; 4242 4243 m_phase_filter = plane? m_phase_filter_chroma : m_phase_filter_luma; 4244 4245 // horizontal filtering 4246 p_src_line = src; 4247 for(j1 = 0; j1 < height1; j1++) 4248 { 4249 i0=-m_iN; 4250 p_tmp = m_temp[j1]; 4251 4252 for(i1 = 0; i1 < width2; i1++) 4253 { 4254 i0 += m_iN; 4255 div_i0 = (i0 / m_iM); 4256 //p_src = &src[j1][ div_i0 - (length >> 1)]; 4257 p_src = p_src_line + ( div_i0 - (length >> 1)); 4258 p_filter = m_phase_filter[i0 - div_i0 * m_iM]; // phase_filter[i0 % M] 4259 iSum = 0; 4260 for(k = 0; k < length; k++) 4261 { 4262 iSum += (*p_src++) * (*p_filter++); 4263 } 4264 *p_tmp++ = iSum; 4265 } 4266 p_src_line += iSrcStride; 4267 } 4268 4269 // pad temp (vertical) 4270 for (k=-(length>>1); k<0; k++) 4271 memcpy(m_temp[k], m_temp[0], width2*sizeof(int)); 4272 for (k=height1; k<(height1+(length>>1)); k++) 4273 memcpy(m_temp[k], m_temp[k-1], (width2)* sizeof(int)); 4274 4275 // vertical filtering 4276 j0 = (plane == 0) ? -m_iN : -(m_iN-1); 4277 4278 p_dst_line = dst; 4279 for(j1 = 0; j1 < height2; j1++) 4280 { 4281 j0 += m_iN; 4282 div_j0 = (j0 / m_iM); 4283 //p_dst = dst[j1]; 4284 p_dst = p_dst_line; 4285 p_temp = &m_temp[div_j0 - (length>>1)]; 4286 p_filter = m_phase_filter[j0 - div_j0 * m_iM]; // phase_filter[j0 % M] 4287 for(i1 = 0; i1 < width2;i1++) 4288 { 4289 iSum=0; 4290 for(k = 0; k < length; k++) 4291 { 4292 iSum += p_temp[k][i1] * p_filter[k]; 4293 } 4294 iSum=((iSum + shift_round) >> shift2); 4295 *p_dst++ = (short)(iSum > iMax ? iMax : (iSum < 0 ? 0 : iSum)); 4296 } 4297 p_dst_line += iDstStride; 4298 } 4299 } 4300 4301 Void TEncGOP::initDs(Int iWidth, Int iHeight, Int iType) 4302 { 4303 m_iTap = 13; 4304 if(g_posScalingFactor[0][0] == (1<<15)) 4305 { 4306 m_iM = 4; 4307 m_iN = 8; 4308 m_phase_filter_luma = iType? m_phase_filter_0_t1 : m_phase_filter_0_t0; 4309 m_phase_filter_chroma = m_phase_filter_0_t1_chroma; 4310 } 4311 else 4312 { 4313 m_iM = 8; 4314 m_iN = 12; 4315 m_phase_filter_luma = m_phase_filter_chroma = m_phase_filter_1; 4316 m_phase_filter = m_phase_filter_1; 4317 } 4318 4319 get_mem2DintWithPad (&m_temp, iHeight, iWidth*m_iM/m_iN, m_iTap>>1, 0); 4320 } 4321 4322 Int TEncGOP::get_mem2DintWithPad(Int ***array2D, Int dim0, Int dim1, Int iPadY, Int iPadX) 4323 { 4324 Int i; 4325 Int *curr = NULL; 4326 Int iHeight, iWidth; 4327 4328 iHeight = dim0+2*iPadY; 4329 iWidth = dim1+2*iPadX; 4330 (*array2D) = (Int**)malloc(iHeight*sizeof(Int*)); 4331 *(*array2D) = (Int* )xMalloc(Int, iHeight*iWidth); 4332 4333 (*array2D)[0] += iPadX; 4334 curr = (*array2D)[0]; 4335 for(i = 1 ; i < iHeight; i++) 4336 { 4337 curr += iWidth; 4338 (*array2D)[i] = curr; 4339 } 4340 (*array2D) = &((*array2D)[iPadY]); 4341 4342 return 0; 4343 } 4344 4345 Void TEncGOP::free_mem2DintWithPad(Int **array2D, Int iPadY, Int iPadX) 4346 { 4347 if (array2D) 4348 { 4349 if (*array2D) 4350 xFree(array2D[-iPadY]-iPadX); 4351 else 4352 printf("free_mem2DintWithPad: trying to free unused memory\r\nPress Any Key\r\n"); 4353 4354 free (&array2D[-iPadY]); 4355 } 4356 else 4357 { 4358 printf("free_mem2DintWithPad: trying to free unused memory\r\nPress Any Key\r\n"); 4359 } 4360 } 4361 #endif 4047 4362 #endif //SVC_EXTENSION 4048 4363 -
branches/SHM-6-dev/source/Lib/TLibEncoder/TEncGOP.h
r652 r677 54 54 #include "TEncSbac.h" 55 55 #include "SEIwrite.h" 56 #if Q0048_CGS_3D_ASYMLUT 57 #include "TEnc3DAsymLUT.h" 58 #endif 56 59 57 60 #include "TEncAnalyze.h" … … 135 138 TEncSearch* m_pcPredSearch; ///< encoder search class 136 139 #endif 140 #if Q0048_CGS_3D_ASYMLUT 141 TEnc3DAsymLUT m_Enc3DAsymLUTPicUpdate; 142 TEnc3DAsymLUT m_Enc3DAsymLUTPPS; 143 TComPicYuv* m_pColorMappedPic; 144 145 Int m_iTap; 146 const Int (*m_phase_filter)[13]; 147 const Int (*m_phase_filter_luma)[13]; 148 const Int (*m_phase_filter_chroma)[13]; 149 Int m_iM, m_iN; 150 static const Int m_phase_filter_0_t0[4][13]; 151 static const Int m_phase_filter_0_t1[4][13]; 152 static const Int m_phase_filter_0_t1_chroma[4][13]; 153 static const Int m_phase_filter_1[8][13]; 154 Int **m_temp; 155 #endif 137 156 #endif 138 157 … … 217 236 SEIScalableNesting* xCreateBspNestingSEI(TComSlice *pcSlice); 218 237 #endif 238 #if Q0048_CGS_3D_ASYMLUT 239 Void xDetermin3DAsymLUT( TComSlice * pSlice , TComPic * pCurPic , UInt refLayerIdc , TEncCfg * pCfg , Bool bSignalPPS ); 240 Void downScalePic( TComPicYuv* pcYuvSrc, TComPicYuv* pcYuvDest); 241 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 ); 242 inline Short xClip( Short x , Int bitdepth ); 243 Void initDs(Int iWidth, Int iHeight, Int iType); 244 Void filterImg( 245 Pel *src, 246 Int iSrcStride, 247 Pel *dst, 248 Int iDstStride, 249 Int height1, 250 Int width1, 251 Int shift, 252 Int plane); 253 254 Int get_mem2DintWithPad(Int ***array2D, Int dim0, Int dim1, Int iPadY, Int iPadX); 255 Void free_mem2DintWithPad(Int **array2D, Int iPadY, Int iPadX); 256 #endif 219 257 #endif //SVC_EXTENSION 220 258 };// END CLASS DEFINITION TEncGOP -
branches/SHM-6-dev/source/Lib/TLibEncoder/TEncSbac.cpp
r644 r677 248 248 } 249 249 250 Void TEncSbac::codePPS( TComPPS* pcPPS ) 250 Void TEncSbac::codePPS( TComPPS* pcPPS 251 #if Q0048_CGS_3D_ASYMLUT 252 , TEnc3DAsymLUT * pc3DAsymLUT 253 #endif 254 ) 251 255 { 252 256 assert (0); -
branches/SHM-6-dev/source/Lib/TLibEncoder/TEncSbac.h
r652 r677 92 92 Void codeVPS ( TComVPS* pcVPS ); 93 93 Void codeSPS ( TComSPS* pcSPS ); 94 Void codePPS ( TComPPS* pcPPS ); 94 Void codePPS ( TComPPS* pcPPS 95 #if Q0048_CGS_3D_ASYMLUT 96 , TEnc3DAsymLUT * pc3DAsymLUT 97 #endif 98 ); 95 99 Void codeSliceHeader ( TComSlice* pcSlice ); 96 100 Void codeTilesWPPEntryPoint( TComSlice* pSlice ); -
branches/SHM-6-dev/source/Lib/TLibEncoder/TEncTop.cpp
r644 r677 795 795 Bool sameBitDepths = ( g_bitDepthYLayer[m_layerId] == g_bitDepthYLayer[refLayerId] ) && ( g_bitDepthCLayer[m_layerId] == g_bitDepthCLayer[refLayerId] ); 796 796 797 if( m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() || !zeroOffsets || !sameBitDepths ) 797 if( m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() || !zeroOffsets || !sameBitDepths 798 #if Q0048_CGS_3D_ASYMLUT 799 || m_cPPS.getCGSFlag() > 0 800 #endif 801 ) 798 802 #else 799 803 if(m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() || !zeroOffsets ) … … 1188 1192 } 1189 1193 #endif 1194 #if Q0048_CGS_3D_ASYMLUT 1195 m_cPPS.setCGSFlag( m_nCGSFlag ); 1196 #endif 1190 1197 } 1191 1198
Note: See TracChangeset for help on using the changeset viewer.