Changeset 837 in 3DVCSoftware for branches/HTM-10.0rc1-dev0/source/Lib/TLibEncoder/TEncEntropy.cpp
- Timestamp:
- 8 Feb 2014, 00:23:11 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-10.0rc1-dev0/source/Lib/TLibEncoder/TEncEntropy.cpp
r833 r837 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-2013, ITU/ISO/IEC6 * Copyright (c) 2010-2014, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 51 51 Void TEncEntropy::encodeSliceHeader ( TComSlice* pcSlice ) 52 52 { 53 if (pcSlice->getSPS()->getUseSAO())54 {55 SAOParam *saoParam = pcSlice->getPic()->getPicSym()->getSaoParam();56 pcSlice->setSaoEnabledFlag (saoParam->bSaoFlag[0]);57 {58 pcSlice->setSaoEnabledFlagChroma (saoParam->bSaoFlag[1]);59 }60 }61 62 53 m_pcEntropyCoderIf->codeSliceHeader( pcSlice ); 63 54 return; … … 787 778 } 788 779 789 /** Encode SAO Offset790 * \param saoLcuParam SAO LCU paramters791 */792 Void TEncEntropy::encodeSaoOffset(SaoLcuParam* saoLcuParam, UInt compIdx)793 {794 UInt uiSymbol;795 Int i;796 797 uiSymbol = saoLcuParam->typeIdx + 1;798 if (compIdx!=2)799 {800 m_pcEntropyCoderIf->codeSaoTypeIdx(uiSymbol);801 }802 if (uiSymbol)803 {804 if (saoLcuParam->typeIdx < 4 && compIdx != 2)805 {806 saoLcuParam->subTypeIdx = saoLcuParam->typeIdx;807 }808 Int bitDepth = compIdx ? g_bitDepthC : g_bitDepthY;809 Int offsetTh = 1 << min(bitDepth - 5,5);810 if( saoLcuParam->typeIdx == SAO_BO )811 {812 for( i=0; i< saoLcuParam->length; i++)813 {814 UInt absOffset = ( (saoLcuParam->offset[i] < 0) ? -saoLcuParam->offset[i] : saoLcuParam->offset[i]);815 m_pcEntropyCoderIf->codeSaoMaxUvlc(absOffset, offsetTh-1);816 }817 for( i=0; i< saoLcuParam->length; i++)818 {819 if (saoLcuParam->offset[i] != 0)820 {821 UInt sign = (saoLcuParam->offset[i] < 0) ? 1 : 0 ;822 m_pcEntropyCoderIf->codeSAOSign(sign);823 }824 }825 uiSymbol = (UInt) (saoLcuParam->subTypeIdx);826 m_pcEntropyCoderIf->codeSaoUflc(5, uiSymbol);827 }828 else if( saoLcuParam->typeIdx < 4 )829 {830 m_pcEntropyCoderIf->codeSaoMaxUvlc( saoLcuParam->offset[0], offsetTh-1);831 m_pcEntropyCoderIf->codeSaoMaxUvlc( saoLcuParam->offset[1], offsetTh-1);832 m_pcEntropyCoderIf->codeSaoMaxUvlc(-saoLcuParam->offset[2], offsetTh-1);833 m_pcEntropyCoderIf->codeSaoMaxUvlc(-saoLcuParam->offset[3], offsetTh-1);834 if (compIdx!=2)835 {836 uiSymbol = (UInt) (saoLcuParam->subTypeIdx);837 m_pcEntropyCoderIf->codeSaoUflc(2, uiSymbol);838 }839 }840 }841 }842 843 /** Encode SAO unit interleaving844 * \param rx845 * \param ry846 * \param pSaoParam847 * \param pcCU848 * \param iCUAddrInSlice849 * \param iCUAddrUpInSlice850 * \param bLFCrossSliceBoundaryFlag851 */852 Void TEncEntropy::encodeSaoUnitInterleaving(Int compIdx, Bool saoFlag, Int rx, Int ry, SaoLcuParam* saoLcuParam, Int cuAddrInSlice, Int cuAddrUpInSlice, Int allowMergeLeft, Int allowMergeUp)853 {854 if (saoFlag)855 {856 if (rx>0 && cuAddrInSlice!=0 && allowMergeLeft)857 {858 m_pcEntropyCoderIf->codeSaoMerge(saoLcuParam->mergeLeftFlag);859 }860 else861 {862 saoLcuParam->mergeLeftFlag = 0;863 }864 if (saoLcuParam->mergeLeftFlag == 0)865 {866 if ( (ry > 0) && (cuAddrUpInSlice>=0) && allowMergeUp )867 {868 m_pcEntropyCoderIf->codeSaoMerge(saoLcuParam->mergeUpFlag);869 }870 else871 {872 saoLcuParam->mergeUpFlag = 0;873 }874 if (!saoLcuParam->mergeUpFlag)875 {876 encodeSaoOffset(saoLcuParam, compIdx);877 }878 }879 }880 }881 882 780 Int TEncEntropy::countNonZeroCoeffs( TCoeff* pcCoef, UInt uiSize ) 883 781 { … … 900 798 } 901 799 902 #if H_3D_INTER_SDC903 #if QC_SDC_UNIFY_G0130904 Void TEncEntropy::encodeDeltaDC ( TComDataCU* pcCU, UInt absPartIdx )905 {906 m_pcEntropyCoderIf->codeDeltaDC( pcCU, absPartIdx );907 }908 909 Void TEncEntropy::encodeSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )910 {911 if( ( !pcCU->isIntra( uiAbsPartIdx ) && !pcCU->getSlice()->getVPS()->getInterSDCFlag( pcCU->getSlice()->getLayerIdInVps() ) ) ||912 ( pcCU->isIntra( uiAbsPartIdx ) && !pcCU->getSlice()->getVPS()->getVpsDepthModesFlag( pcCU->getSlice()->getLayerIdInVps() ) ) )913 {914 return;915 }916 917 #if SEC_INTER_SDC_G0101918 if( !pcCU->getSlice()->getIsDepth() || pcCU->getPartitionSize( uiAbsPartIdx ) != SIZE_2Nx2N || pcCU->isSkipped( uiAbsPartIdx ) )919 #else920 if( !pcCU->getSlice()->getIsDepth() || ( pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) != SIZE_2Nx2N ) || pcCU->isSkipped( uiAbsPartIdx ) )921 #endif922 {923 return;924 }925 926 #if SEC_INTER_SDC_G0101927 assert( pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N || ( !pcCU->isIntra( uiAbsPartIdx ) && !pcCU->isSkipped( uiAbsPartIdx ) ) );928 #else929 assert( ( pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) || ( !pcCU->isIntra( uiAbsPartIdx ) && !pcCU->isSkipped( uiAbsPartIdx ) ) );930 #endif931 932 if( bRD )933 {934 uiAbsPartIdx = 0;935 }936 937 m_pcEntropyCoderIf->codeSDCFlag( pcCU, uiAbsPartIdx );938 }939 #else940 Void TEncEntropy::encodeInterSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )941 {942 if( !pcCU->getSlice()->getVPS()->getInterSDCFlag( pcCU->getSlice()->getLayerIdInVps() ) )943 {944 return;945 }946 947 if( !pcCU->getSlice()->getIsDepth() || pcCU->isIntra( uiAbsPartIdx ) || pcCU->isSkipped( uiAbsPartIdx ) )948 {949 return;950 }951 952 if( bRD )953 {954 uiAbsPartIdx = 0;955 }956 957 m_pcEntropyCoderIf->codeInterSDCFlag( pcCU, uiAbsPartIdx );958 }959 960 Void TEncEntropy::encodeInterSDCResidualData( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )961 {962 if( !pcCU->getSlice()->getVPS()->getInterSDCFlag( pcCU->getSlice()->getLayerIdInVps() ) )963 {964 return;965 }966 967 if( !pcCU->getSlice()->getIsDepth() || pcCU->isIntra( uiAbsPartIdx ) || !pcCU->getInterSDCFlag( uiAbsPartIdx ) )968 {969 return;970 }971 972 if( bRD )973 {974 uiAbsPartIdx = 0;975 }976 977 // number of segments depends on prediction mode for INTRA978 UInt uiNumSegments = ( pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) ? 1 : ( pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_NxN ? 4 : 2 );979 980 // encode residual data for each segment981 for( UInt uiSeg = 0; uiSeg < uiNumSegments; uiSeg++ )982 {983 m_pcEntropyCoderIf->codeInterSDCResidualData( pcCU, uiAbsPartIdx, uiSeg );984 }985 }986 #endif987 #endif988 #if H_3D_DBBP989 Void TEncEntropy::encodeDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )990 {991 if( bRD )992 {993 uiAbsPartIdx = 0;994 }995 m_pcEntropyCoderIf->codeDBBPFlag( pcCU, uiAbsPartIdx );996 }997 #endif998 999 800 //! \}
Note: See TracChangeset for help on using the changeset viewer.