Changeset 677 in SHVCSoftware for branches/SHM-6-dev/source/Lib/TLibEncoder
- Timestamp:
- 15 Apr 2014, 05:23:37 (11 years ago)
- Location:
- branches/SHM-6-dev/source/Lib/TLibEncoder
- Files:
-
- 2 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
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.