| 217 | } |
| 218 | |
| 219 | void IntegerCompressor::initCompressor() |
| 220 | { |
| 221 | U32 i; |
| 222 | |
| 223 | assert(enc); |
| 224 | |
| 225 | // maybe create the models |
| 226 | if (mBits == 0) |
| 227 | { |
| 228 | mBits = new ArithmeticModel*[contexts]; |
| 229 | for (i = 0; i < contexts; i++) |
| 230 | { |
| 231 | mBits[i] = enc->createSymbolModel(corr_bits+1); |
| 232 | } |
| 233 | #ifndef COMPRESS_ONLY_K |
| 234 | mCorrector = new ArithmeticModel*[corr_bits+1]; |
| 235 | mCorrector[0] = (ArithmeticModel*)enc->createBitModel(); |
| 236 | for (i = 1; i <= corr_bits; i++) |
| 237 | { |
| 238 | if (i <= bits_high) |
| 239 | { |
| 240 | mCorrector[i] = enc->createSymbolModel(1<<i); |
| 241 | } |
| 242 | else |
| 243 | { |
| 244 | mCorrector[i] = enc->createSymbolModel(1<<bits_high); |
| 245 | } |
| 246 | } |
| 247 | #endif |
| 248 | } |
| 249 | |
| 250 | // certainly init the models |
| 251 | for (i = 0; i < contexts; i++) |
| 252 | { |
| 253 | enc->initSymbolModel(mBits[i]); |
| 254 | } |
| 255 | #ifndef COMPRESS_ONLY_K |
| 256 | enc->initBitModel((ArithmeticBitModel*)mCorrector[0]); |
| 257 | for (i = 1; i <= corr_bits; i++) |
| 258 | { |
| 259 | enc->initSymbolModel(mCorrector[i]); |
| 260 | } |
| 261 | #endif |
| 262 | } |
| 263 | |
| 264 | void IntegerCompressor::compress(I32 pred, I32 real, U32 context) |
| 265 | { |
no test coverage detected