Associate input with decoder state. @param s uninitialized state without associated input
(State s)
| 316 | * @param s uninitialized state without associated input |
| 317 | */ |
| 318 | static int initState(State s) { |
| 319 | if (s.runningState != UNINITIALIZED) { |
| 320 | return Utils.makeError(s, BROTLI_PANIC_STATE_NOT_UNINITIALIZED); |
| 321 | } |
| 322 | /* 6 trees + 1 extra "offset" slot to simplify table decoding logic. */ |
| 323 | s.blockTrees = new int[7 + 3 * (HUFFMAN_TABLE_SIZE_258 + HUFFMAN_TABLE_SIZE_26)]; |
| 324 | s.blockTrees[0] = 7; |
| 325 | s.distRbIdx = 3; |
| 326 | int result = calculateDistanceAlphabetLimit(s, MAX_ALLOWED_DISTANCE, 3, 15 << 3); |
| 327 | if (result < BROTLI_OK) { |
| 328 | return result; |
| 329 | } |
| 330 | final int maxDistanceAlphabetLimit = result; |
| 331 | s.distExtraBits = new byte[maxDistanceAlphabetLimit]; |
| 332 | s.distOffset = new int[maxDistanceAlphabetLimit]; |
| 333 | result = BitReader.initBitReader(s); |
| 334 | if (result < BROTLI_OK) { |
| 335 | return result; |
| 336 | } |
| 337 | s.runningState = INITIALIZED; |
| 338 | return BROTLI_OK; |
| 339 | } |
| 340 | |
| 341 | static int close(State s) { |
| 342 | if (s.runningState == UNINITIALIZED) { |