diff --git a/source/Lib/CommonLib/Quant.cpp b/source/Lib/CommonLib/Quant.cpp
index 31bcfdc6..febd661b 100644
a
|
b
|
void invResDPCM( const TransformUnit &tu, const ComponentID &compID, CoeffBuf &d |
149 | 149 | const int hgt = rect.height; |
150 | 150 | const CCoeffBuf coeffs = tu.getCoeffs(compID); |
151 | 151 | |
| 152 | const int maxLog2TrDynamicRange = tu.cs->sps->getMaxLog2TrDynamicRange(toChannelType(compID)); |
| 153 | const TCoeff inputMinimum = -(1 << maxLog2TrDynamicRange); |
| 154 | const TCoeff inputMaximum = (1 << maxLog2TrDynamicRange) - 1; |
| 155 | |
152 | 156 | const TCoeff* coef = &coeffs.buf[0]; |
153 | 157 | TCoeff* dst = &dstBuf.buf[0]; |
154 | 158 | |
… |
… |
void invResDPCM( const TransformUnit &tu, const ComponentID &compID, CoeffBuf &d |
159 | 163 | dst[0] = coef[0]; |
160 | 164 | for( int x = 1; x < wdt; x++ ) |
161 | 165 | { |
162 | | dst[x] = dst[x - 1] + coef[x]; |
| 166 | dst[x] = Clip3(inputMinimum, inputMaximum, dst[x - 1] + coef[x]); |
163 | 167 | } |
164 | 168 | coef += coeffs.stride; |
165 | 169 | dst += dstBuf.stride; |
… |
… |
void invResDPCM( const TransformUnit &tu, const ComponentID &compID, CoeffBuf &d |
175 | 179 | { |
176 | 180 | for( int x = 0; x < wdt; x++ ) |
177 | 181 | { |
178 | | dst[dstBuf.stride + x] = dst[x] + coef[coeffs.stride + x]; |
| 182 | dst[dstBuf.stride + x] = Clip3(inputMinimum, inputMaximum, dst[x] + coef[coeffs.stride + x]); |
179 | 183 | } |
180 | 184 | coef += coeffs.stride; |
181 | 185 | dst += dstBuf.stride; |