1 | diff -c -p -r HEVC_HM11.0/source/Lib/TLibCommon/TComRom.cpp HEVC_Patched_1026/source/Lib/TLibCommon/TComRom.cpp |
---|
2 | *** HEVC_HM11.0/source/Lib/TLibCommon/TComRom.cpp 2013-04-23 15:08:58.000000000 +0100 |
---|
3 | --- HEVC_Patched_1026/source/Lib/TLibCommon/TComRom.cpp 2013-08-09 10:34:47.000000000 +0100 |
---|
4 | *************** UInt g_sigLastScanCG32x32[ 64 ]; |
---|
5 | *** 342,358 **** |
---|
6 | const UInt g_uiMinInGroup[ 10 ] = {0,1,2,3,4,6,8,12,16,24}; |
---|
7 | const UInt g_uiGroupIdx[ 32 ] = {0,1,2,3,4,4,5,5,6,6,6,6,7,7,7,7,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9}; |
---|
8 | |
---|
9 | - // Rice parameters for absolute transform levels |
---|
10 | - const UInt g_auiGoRiceRange[5] = |
---|
11 | - { |
---|
12 | - 7, 14, 26, 46, 78 |
---|
13 | - }; |
---|
14 | - |
---|
15 | - const UInt g_auiGoRicePrefixLen[5] = |
---|
16 | - { |
---|
17 | - 8, 7, 6, 5, 4 |
---|
18 | - }; |
---|
19 | - |
---|
20 | Void initSigLastScan(UInt* pBuffD, UInt* pBuffH, UInt* pBuffV, Int iWidth, Int iHeight) |
---|
21 | { |
---|
22 | const UInt uiNumScanPos = UInt( iWidth * iWidth ); |
---|
23 | --- 342,347 ---- |
---|
24 | diff -c -p -r HEVC_HM11.0/source/Lib/TLibCommon/TComRom.h HEVC_Patched_1026/source/Lib/TLibCommon/TComRom.h |
---|
25 | *** HEVC_HM11.0/source/Lib/TLibCommon/TComRom.h 2013-01-31 16:52:13.000000000 +0000 |
---|
26 | --- HEVC_Patched_1026/source/Lib/TLibCommon/TComRom.h 2013-08-09 10:34:47.000000000 +0100 |
---|
27 | *************** extern UInt* g_auiSigLastScan[ 3 |
---|
28 | *** 119,127 **** |
---|
29 | |
---|
30 | extern const UInt g_uiGroupIdx[ 32 ]; |
---|
31 | extern const UInt g_uiMinInGroup[ 10 ]; |
---|
32 | - |
---|
33 | - extern const UInt g_auiGoRiceRange[5]; //!< maximum value coded with Rice codes |
---|
34 | - extern const UInt g_auiGoRicePrefixLen[5]; //!< prefix length for each maximum value |
---|
35 | |
---|
36 | extern const UInt g_sigLastScan8x8[ 3 ][ 4 ]; //!< coefficient group scan order for 8x8 TUs |
---|
37 | extern UInt g_sigLastScanCG32x32[ 64 ]; |
---|
38 | --- 119,124 ---- |
---|
39 | diff -c -p -r HEVC_HM11.0/source/Lib/TLibCommon/TComTrQuant.cpp HEVC_Patched_1026/source/Lib/TLibCommon/TComTrQuant.cpp |
---|
40 | *** HEVC_HM11.0/source/Lib/TLibCommon/TComTrQuant.cpp 2013-06-07 15:36:28.000000000 +0100 |
---|
41 | --- HEVC_Patched_1026/source/Lib/TLibCommon/TComTrQuant.cpp 2013-08-09 10:34:47.000000000 +0100 |
---|
42 | *************** Void TComTrQuant::xRateDistOptQuant |
---|
43 | *** 1926,1932 **** |
---|
44 | { |
---|
45 | Int64 costUp = rdFactor * ( - deltaU[uiBlkPos] ) + rateIncUp[uiBlkPos] ; |
---|
46 | Int64 costDown = rdFactor * ( deltaU[uiBlkPos] ) + rateIncDown[uiBlkPos] |
---|
47 | ! - ( abs(piDstCoeff[uiBlkPos])==1?((1<<15)+sigRateDelta[uiBlkPos]):0 ); |
---|
48 | |
---|
49 | if(lastCG==1 && lastNZPosInCG==n && abs(piDstCoeff[uiBlkPos])==1) |
---|
50 | { |
---|
51 | --- 1926,1932 ---- |
---|
52 | { |
---|
53 | Int64 costUp = rdFactor * ( - deltaU[uiBlkPos] ) + rateIncUp[uiBlkPos] ; |
---|
54 | Int64 costDown = rdFactor * ( deltaU[uiBlkPos] ) + rateIncDown[uiBlkPos] |
---|
55 | ! - ((abs(piDstCoeff[uiBlkPos]) == 1) ? sigRateDelta[uiBlkPos] : 0); |
---|
56 | |
---|
57 | if(lastCG==1 && lastNZPosInCG==n && abs(piDstCoeff[uiBlkPos])==1) |
---|
58 | { |
---|
59 | *************** __inline UInt TComTrQuant::xGetCodedLeve |
---|
60 | *** 2145,2151 **** |
---|
61 | for( Int uiAbsLevel = uiMaxAbsLevel; uiAbsLevel >= uiMinAbsLevel ; uiAbsLevel-- ) |
---|
62 | { |
---|
63 | Double dErr = Double( lLevelDouble - ( uiAbsLevel << iQBits ) ); |
---|
64 | ! Double dCurrCost = dErr * dErr * dTemp + xGetICRateCost( uiAbsLevel, ui16CtxNumOne, ui16CtxNumAbs, ui16AbsGoRice, c1Idx, c2Idx ); |
---|
65 | dCurrCost += dCurrCostSig; |
---|
66 | |
---|
67 | if( dCurrCost < rd64CodedCost ) |
---|
68 | --- 2145,2151 ---- |
---|
69 | for( Int uiAbsLevel = uiMaxAbsLevel; uiAbsLevel >= uiMinAbsLevel ; uiAbsLevel-- ) |
---|
70 | { |
---|
71 | Double dErr = Double( lLevelDouble - ( uiAbsLevel << iQBits ) ); |
---|
72 | ! Double dCurrCost = dErr * dErr * dTemp + xGetICost(xGetICRate( uiAbsLevel, ui16CtxNumOne, ui16CtxNumAbs, ui16AbsGoRice, c1Idx, c2Idx )); |
---|
73 | dCurrCost += dCurrCostSig; |
---|
74 | |
---|
75 | if( dCurrCost < rd64CodedCost ) |
---|
76 | *************** __inline UInt TComTrQuant::xGetCodedLeve |
---|
77 | *** 2166,2180 **** |
---|
78 | * \param ui16AbsGoRice Rice parameter for coeff_abs_level_minus3 |
---|
79 | * \returns cost of given absolute transform level |
---|
80 | */ |
---|
81 | ! __inline Double TComTrQuant::xGetICRateCost ( UInt uiAbsLevel, |
---|
82 | ! UShort ui16CtxNumOne, |
---|
83 | ! UShort ui16CtxNumAbs, |
---|
84 | ! UShort ui16AbsGoRice |
---|
85 | ! , UInt c1Idx, |
---|
86 | ! UInt c2Idx |
---|
87 | ! ) const |
---|
88 | { |
---|
89 | ! Double iRate = xGetIEPRate(); |
---|
90 | UInt baseLevel = (c1Idx < C1FLAG_NUMBER)? (2 + (c2Idx < C2FLAG_NUMBER)) : 1; |
---|
91 | |
---|
92 | if ( uiAbsLevel >= baseLevel ) |
---|
93 | --- 2166,2180 ---- |
---|
94 | * \param ui16AbsGoRice Rice parameter for coeff_abs_level_minus3 |
---|
95 | * \returns cost of given absolute transform level |
---|
96 | */ |
---|
97 | ! __inline Int TComTrQuant::xGetICRate ( UInt uiAbsLevel, |
---|
98 | ! UShort ui16CtxNumOne, |
---|
99 | ! UShort ui16CtxNumAbs, |
---|
100 | ! UShort ui16AbsGoRice |
---|
101 | ! , UInt c1Idx, |
---|
102 | ! UInt c2Idx |
---|
103 | ! ) const |
---|
104 | { |
---|
105 | ! Int iRate = Int(xGetIEPRate()); |
---|
106 | UInt baseLevel = (c1Idx < C1FLAG_NUMBER)? (2 + (c2Idx < C2FLAG_NUMBER)) : 1; |
---|
107 | |
---|
108 | if ( uiAbsLevel >= baseLevel ) |
---|
109 | *************** __inline Double TComTrQuant::xGetICRateC |
---|
110 | *** 2218,2285 **** |
---|
111 | } |
---|
112 | else |
---|
113 | { |
---|
114 | ! assert (0); |
---|
115 | ! } |
---|
116 | ! return xGetICost( iRate ); |
---|
117 | ! } |
---|
118 | ! |
---|
119 | ! __inline Int TComTrQuant::xGetICRate ( UInt uiAbsLevel, |
---|
120 | ! UShort ui16CtxNumOne, |
---|
121 | ! UShort ui16CtxNumAbs, |
---|
122 | ! UShort ui16AbsGoRice |
---|
123 | ! , UInt c1Idx, |
---|
124 | ! UInt c2Idx |
---|
125 | ! ) const |
---|
126 | ! { |
---|
127 | ! Int iRate = 0; |
---|
128 | ! UInt baseLevel = (c1Idx < C1FLAG_NUMBER)? (2 + (c2Idx < C2FLAG_NUMBER)) : 1; |
---|
129 | ! |
---|
130 | ! if ( uiAbsLevel >= baseLevel ) |
---|
131 | ! { |
---|
132 | ! UInt uiSymbol = uiAbsLevel - baseLevel; |
---|
133 | ! UInt uiMaxVlc = g_auiGoRiceRange[ ui16AbsGoRice ]; |
---|
134 | ! Bool bExpGolomb = ( uiSymbol > uiMaxVlc ); |
---|
135 | ! |
---|
136 | ! if( bExpGolomb ) |
---|
137 | ! { |
---|
138 | ! uiAbsLevel = uiSymbol - uiMaxVlc; |
---|
139 | ! Int iEGS = 1; for( UInt uiMax = 2; uiAbsLevel >= uiMax; uiMax <<= 1, iEGS += 2 ); |
---|
140 | ! iRate += iEGS << 15; |
---|
141 | ! uiSymbol = min<UInt>( uiSymbol, ( uiMaxVlc + 1 ) ); |
---|
142 | ! } |
---|
143 | ! |
---|
144 | ! UShort ui16PrefLen = UShort( uiSymbol >> ui16AbsGoRice ) + 1; |
---|
145 | ! UShort ui16NumBins = min<UInt>( ui16PrefLen, g_auiGoRicePrefixLen[ ui16AbsGoRice ] ) + ui16AbsGoRice; |
---|
146 | ! |
---|
147 | ! iRate += ui16NumBins << 15; |
---|
148 | ! |
---|
149 | ! if (c1Idx < C1FLAG_NUMBER) |
---|
150 | ! { |
---|
151 | ! iRate += m_pcEstBitsSbac->m_greaterOneBits[ ui16CtxNumOne ][ 1 ]; |
---|
152 | ! |
---|
153 | ! if (c2Idx < C2FLAG_NUMBER) |
---|
154 | ! { |
---|
155 | ! iRate += m_pcEstBitsSbac->m_levelAbsBits[ ui16CtxNumAbs ][ 1 ]; |
---|
156 | ! } |
---|
157 | ! } |
---|
158 | ! } |
---|
159 | ! else |
---|
160 | ! if( uiAbsLevel == 0 ) |
---|
161 | ! { |
---|
162 | ! return 0; |
---|
163 | ! } |
---|
164 | ! else if( uiAbsLevel == 1 ) |
---|
165 | ! { |
---|
166 | ! iRate += m_pcEstBitsSbac->m_greaterOneBits[ ui16CtxNumOne ][ 0 ]; |
---|
167 | ! } |
---|
168 | ! else if( uiAbsLevel == 2 ) |
---|
169 | ! { |
---|
170 | ! iRate += m_pcEstBitsSbac->m_greaterOneBits[ ui16CtxNumOne ][ 1 ]; |
---|
171 | ! iRate += m_pcEstBitsSbac->m_levelAbsBits[ ui16CtxNumAbs ][ 0 ]; |
---|
172 | ! } |
---|
173 | ! else |
---|
174 | ! { |
---|
175 | ! assert(0); |
---|
176 | } |
---|
177 | return iRate; |
---|
178 | } |
---|
179 | --- 2218,2224 ---- |
---|
180 | } |
---|
181 | else |
---|
182 | { |
---|
183 | ! iRate = 0; |
---|
184 | } |
---|
185 | return iRate; |
---|
186 | } |
---|
187 | diff -c -p -r HEVC_HM11.0/source/Lib/TLibCommon/TComTrQuant.h HEVC_Patched_1026/source/Lib/TLibCommon/TComTrQuant.h |
---|
188 | *** HEVC_HM11.0/source/Lib/TLibCommon/TComTrQuant.h 2013-08-09 09:53:44.000000000 +0100 |
---|
189 | --- HEVC_Patched_1026/source/Lib/TLibCommon/TComTrQuant.h 2013-08-09 10:34:47.000000000 +0100 |
---|
190 | *************** __inline UInt xGetCodedLeve |
---|
191 | *** 271,283 **** |
---|
192 | Int iQBits, |
---|
193 | Double dTemp, |
---|
194 | Bool bLast ) const; |
---|
195 | - __inline Double xGetICRateCost ( UInt uiAbsLevel, |
---|
196 | - UShort ui16CtxNumOne, |
---|
197 | - UShort ui16CtxNumAbs, |
---|
198 | - UShort ui16AbsGoRice |
---|
199 | - , UInt c1Idx, |
---|
200 | - UInt c2Idx |
---|
201 | - ) const; |
---|
202 | __inline Int xGetICRate ( UInt uiAbsLevel, |
---|
203 | UShort ui16CtxNumOne, |
---|
204 | UShort ui16CtxNumAbs, |
---|
205 | --- 271,276 ---- |
---|