Changeset 826 in SHVCSoftware for branches/SHM-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
- Timestamp:
- 12 Jul 2014, 08:45:16 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
r825 r826 2789 2789 assert( pc3DAsymLUT->getResQuantBit() < 4 ); 2790 2790 WRITE_CODE( pc3DAsymLUT->getResQuantBit() , 2 , "cm_res_quant_bit" ); 2791 #if R0300_CGS_RES_COEFF_CODING 2792 xFindDeltaBits( pc3DAsymLUT ); 2793 assert(pc3DAsymLUT->getDeltaBits() >=1 && pc3DAsymLUT->getDeltaBits() <= 4); 2794 WRITE_CODE( pc3DAsymLUT->getDeltaBits()-1 , 2 , "cm_delta_bit" ); 2795 #endif 2791 2796 #if R0151_CGS_3D_ASYMLUT_IMPROVE 2792 2797 if( pc3DAsymLUT->getCurOctantDepth() == 1 ) … … 2828 2833 else 2829 2834 { 2835 #if R0300_CGS_RES_COEFF_CODING 2836 Int nFLCbits = pc3DAsymLUT->getMappingShift()-pc3DAsymLUT->getResQuantBit()-pc3DAsymLUT->getDeltaBits() ; 2837 nFLCbits = nFLCbits >= 0 ? nFLCbits : 0; 2838 #endif 2830 2839 for( Int l = 0 ; l < nYPartNum ; l++ ) 2831 2840 { … … 2845 2854 { 2846 2855 #if R0151_CGS_3D_ASYMLUT_IMPROVE 2856 #if R0300_CGS_RES_COEFF_CODING 2857 xWriteParam( sRes.Y, nFLCbits ); 2858 xWriteParam( sRes.U, nFLCbits ); 2859 xWriteParam( sRes.V, nFLCbits ); 2860 #else 2847 2861 xWriteParam( sRes.Y ); 2848 2862 xWriteParam( sRes.U ); 2849 2863 xWriteParam( sRes.V ); 2864 #endif 2850 2865 #else 2851 2866 WRITE_SVLC( sRes.Y , "resY" ); … … 2863 2878 2864 2879 #if R0151_CGS_3D_ASYMLUT_IMPROVE 2880 #if R0300_CGS_RES_COEFF_CODING 2881 Void TEncCavlc::xWriteParam( Int param, UInt rParam) 2882 #else 2865 2883 Void TEncCavlc::xWriteParam( Int param) 2866 { 2884 #endif 2885 { 2886 #if !R0300_CGS_RES_COEFF_CODING 2867 2887 const UInt rParam = 7; 2888 #endif 2868 2889 Int codeNumber = abs(param); 2869 2890 WRITE_UVLC(codeNumber / (1 << rParam), "quotient"); … … 2874 2895 #endif 2875 2896 2897 #if R0300_CGS_RES_COEFF_CODING 2898 Void TEncCavlc::xFindDeltaBits( TCom3DAsymLUT * pc3DAsymLUT ) 2899 { 2900 Int nDeltaBits; 2901 Int nBestDeltaBits = -1; 2902 Int nBestBits = MAX_INT; 2903 for( nDeltaBits = 1; nDeltaBits < 5; nDeltaBits++) 2904 { 2905 Int nCurBits = 0; 2906 xTally3DAsymLUTOctantBits( pc3DAsymLUT , 0 , 0 , 0 , 0 , 1 << pc3DAsymLUT->getCurOctantDepth(), nDeltaBits, nCurBits ); 2907 //printf("%d, %d, %d\n", nDeltaBits, nCurBits, nBestBits); 2908 if(nCurBits < nBestBits) 2909 { 2910 nBestDeltaBits = nDeltaBits; 2911 nBestBits = nCurBits; 2912 } 2913 } 2914 2915 assert(nBestDeltaBits >=1 && nBestDeltaBits < 5); 2916 pc3DAsymLUT->setDeltaBits(nBestDeltaBits); 2917 } 2918 2919 Void TEncCavlc::xTally3DAsymLUTOctantBits( TCom3DAsymLUT * pc3DAsymLUT , Int nDepth , Int yIdx , Int uIdx , Int vIdx , Int nLength, Int nDeltaBits, Int& nCurBits ) 2920 { 2921 UInt uiOctantSplit = nDepth < pc3DAsymLUT->getCurOctantDepth(); 2922 if( nDepth < pc3DAsymLUT->getCurOctantDepth() ) 2923 nCurBits ++; 2924 Int nYPartNum = 1 << pc3DAsymLUT->getCurYPartNumLog2(); 2925 if( uiOctantSplit ) 2926 { 2927 Int nHalfLength = nLength >> 1; 2928 for( Int l = 0 ; l < 2 ; l++ ) 2929 { 2930 for( Int m = 0 ; m < 2 ; m++ ) 2931 { 2932 for( Int n = 0 ; n < 2 ; n++ ) 2933 { 2934 xTally3DAsymLUTOctantBits( pc3DAsymLUT , nDepth + 1 , yIdx + l * nHalfLength * nYPartNum , uIdx + m * nHalfLength , vIdx + n * nHalfLength , nHalfLength, nDeltaBits, nCurBits ); 2935 } 2936 } 2937 } 2938 } 2939 else 2940 { 2941 Int nFLCbits = pc3DAsymLUT->getMappingShift()-pc3DAsymLUT->getResQuantBit()-nDeltaBits ; 2942 nFLCbits = nFLCbits >= 0 ? nFLCbits:0; 2943 //printf("nFLCbits = %d\n", nFLCbits); 2944 2945 for( Int l = 0 ; l < nYPartNum ; l++ ) 2946 { 2947 for( Int nVertexIdx = 0 ; nVertexIdx < 4 ; nVertexIdx++ ) 2948 { 2949 SYUVP sRes = pc3DAsymLUT->getCuboidVertexResTree( yIdx + l , uIdx , vIdx , nVertexIdx ); 2950 2951 UInt uiCodeVertex = sRes.Y != 0 || sRes.U != 0 || sRes.V != 0; 2952 nCurBits++; 2953 if( uiCodeVertex ) 2954 { 2955 xCheckParamBits( sRes.Y, nFLCbits, nCurBits ); 2956 xCheckParamBits( sRes.U, nFLCbits, nCurBits ); 2957 xCheckParamBits( sRes.V, nFLCbits, nCurBits ); 2958 } 2959 } 2960 } 2961 } 2962 } 2963 2964 Void TEncCavlc::xCheckParamBits( Int param, Int rParam, Int &nBits) 2965 { 2966 Int codeNumber = abs(param); 2967 Int codeQuotient = codeNumber >> rParam; 2968 Int qLen; 2969 2970 UInt uiLength = 1; 2971 UInt uiTemp = ++codeQuotient; 2972 2973 while( 1 != uiTemp ) 2974 { 2975 uiTemp >>= 1; 2976 uiLength += 2; 2977 } 2978 2979 qLen = (uiLength >> 1); 2980 qLen += ((uiLength+1) >> 1); 2981 2982 nBits += qLen; 2983 nBits += rParam; 2984 if (abs(param)) 2985 nBits++; 2986 } 2987 #endif 2988 2876 2989 #endif 2877 2990 //! \}
Note: See TracChangeset for help on using the changeset viewer.