| 273 | } |
| 274 | |
| 275 | void IntegerCompressor::initDecompressor() |
| 276 | { |
| 277 | U32 i; |
| 278 | |
| 279 | assert(dec); |
| 280 | |
| 281 | // maybe create the models |
| 282 | if (mBits == 0) |
| 283 | { |
| 284 | mBits = new ArithmeticModel*[contexts]; |
| 285 | for (i = 0; i < contexts; i++) |
| 286 | { |
| 287 | mBits[i] = dec->createSymbolModel(corr_bits+1); |
| 288 | } |
| 289 | #ifndef COMPRESS_ONLY_K |
| 290 | mCorrector = new ArithmeticModel*[corr_bits+1]; |
| 291 | mCorrector[0] = (ArithmeticModel*)dec->createBitModel(); |
| 292 | for (i = 1; i <= corr_bits; i++) |
| 293 | { |
| 294 | if (i <= bits_high) |
| 295 | { |
| 296 | mCorrector[i] = dec->createSymbolModel(1<<i); |
| 297 | } |
| 298 | else |
| 299 | { |
| 300 | mCorrector[i] = dec->createSymbolModel(1<<bits_high); |
| 301 | } |
| 302 | } |
| 303 | #endif |
| 304 | } |
| 305 | |
| 306 | // certainly init the models |
| 307 | for (i = 0; i < contexts; i++) |
| 308 | { |
| 309 | dec->initSymbolModel(mBits[i]); |
| 310 | } |
| 311 | #ifndef COMPRESS_ONLY_K |
| 312 | dec->initBitModel((ArithmeticBitModel*)mCorrector[0]); |
| 313 | for (i = 1; i <= corr_bits; i++) |
| 314 | { |
| 315 | dec->initSymbolModel(mCorrector[i]); |
| 316 | } |
| 317 | #endif |
| 318 | } |
| 319 | |
| 320 | I32 IntegerCompressor::decompress(I32 pred, U32 context) |
| 321 | { |
no test coverage detected