Lines Matching refs:lzma
15 * Range decoder initialization eats the first five bytes of each LZMA chunk.
20 * Minimum number of usable input buffer to safely decode one LZMA symbol.
139 /* Types of the most recently seen LZMA symbols */
149 * LZMA properties or related bit masks (number of literal
231 /* Uncompressed size of LZMA chunk (2 MiB at maximum) */
235 * Compressed size of LZMA chunk or compressed/uncompressed
242 * the first chunk (LZMA or uncompressed).
247 * True if new LZMA properties are needed. This is false
248 * before the first LZMA chunk.
257 * including lzma.pos_mask are in the first 128 bytes on x86-32,
266 struct lzma_dec lzma;
470 * we have reached the end of the LZMA chunk.
489 * an extra branch. In this particular version of the LZMA decoder, this
568 * LZMA *
575 uint32_t low = prev_byte >> (8 - s->lzma.lc);
576 uint32_t high = (s->dict.pos & s->lzma.literal_pos_mask) << s->lzma.lc;
577 return s->lzma.literal[low + high];
592 if (lzma_state_is_literal(s->lzma.state)) {
596 match_byte = dict_get(&s->dict, s->lzma.rep0) << 1;
615 lzma_state_literal(&s->lzma.state);
618 /* Decode the length of the match into s->lzma.len. */
628 s->lzma.len = MATCH_LEN_MIN;
633 s->lzma.len = MATCH_LEN_MIN + LEN_LOW_SYMBOLS;
637 s->lzma.len = MATCH_LEN_MIN + LEN_LOW_SYMBOLS
642 s->lzma.len += rc_bittree(&s->rc, probs, limit) - limit;
645 /* Decode a match. The distance will be stored in s->lzma.rep0. */
652 lzma_state_match(&s->lzma.state);
654 s->lzma.rep3 = s->lzma.rep2;
655 s->lzma.rep2 = s->lzma.rep1;
656 s->lzma.rep1 = s->lzma.rep0;
658 lzma_len(s, &s->lzma.match_len_dec, pos_state);
660 probs = s->lzma.dist_slot[lzma_get_dist_state(s->lzma.len)];
664 s->lzma.rep0 = dist_slot;
667 s->lzma.rep0 = 2 + (dist_slot & 1);
670 s->lzma.rep0 <<= limit;
671 probs = s->lzma.dist_special + s->lzma.rep0
674 &s->lzma.rep0, limit);
676 rc_direct(&s->rc, &s->lzma.rep0, limit - ALIGN_BITS);
677 s->lzma.rep0 <<= ALIGN_BITS;
678 rc_bittree_reverse(&s->rc, s->lzma.dist_align,
679 &s->lzma.rep0, ALIGN_BITS);
686 * seen matches. The distance will be stored in s->lzma.rep0.
692 if (!rc_bit(&s->rc, &s->lzma.is_rep0[s->lzma.state])) {
693 if (!rc_bit(&s->rc, &s->lzma.is_rep0_long[
694 s->lzma.state][pos_state])) {
695 lzma_state_short_rep(&s->lzma.state);
696 s->lzma.len = 1;
700 if (!rc_bit(&s->rc, &s->lzma.is_rep1[s->lzma.state])) {
701 tmp = s->lzma.rep1;
703 if (!rc_bit(&s->rc, &s->lzma.is_rep2[s->lzma.state])) {
704 tmp = s->lzma.rep2;
706 tmp = s->lzma.rep3;
707 s->lzma.rep3 = s->lzma.rep2;
710 s->lzma.rep2 = s->lzma.rep1;
713 s->lzma.rep1 = s->lzma.rep0;
714 s->lzma.rep0 = tmp;
717 lzma_state_long_rep(&s->lzma.state);
718 lzma_len(s, &s->lzma.rep_len_dec, pos_state);
721 /* LZMA decoder core */
730 if (dict_has_space(&s->dict) && s->lzma.len > 0)
731 dict_repeat(&s->dict, &s->lzma.len, s->lzma.rep0);
734 * Decode more LZMA symbols. One iteration may consume up to
738 pos_state = s->dict.pos & s->lzma.pos_mask;
740 if (!rc_bit(&s->rc, &s->lzma.is_match[
741 s->lzma.state][pos_state])) {
744 if (rc_bit(&s->rc, &s->lzma.is_rep[s->lzma.state]))
749 if (!dict_repeat(&s->dict, &s->lzma.len, s->lzma.rep0))
764 * Reset the LZMA decoder and range decoder state. Dictionary is nore reset
765 * here, because LZMA state may be reset without resetting the dictionary.
772 s->lzma.state = STATE_LIT_LIT;
773 s->lzma.rep0 = 0;
774 s->lzma.rep1 = 0;
775 s->lzma.rep2 = 0;
776 s->lzma.rep3 = 0;
787 probs = s->lzma.is_match[0];
795 * Decode and validate LZMA properties (lc/lp/pb) and calculate the bit masks
796 * from the decoded lp and pb values. On success, the LZMA decoder state is
804 s->lzma.pos_mask = 0;
807 ++s->lzma.pos_mask;
810 s->lzma.pos_mask = (1 << s->lzma.pos_mask) - 1;
812 s->lzma.literal_pos_mask = 0;
815 ++s->lzma.literal_pos_mask;
818 s->lzma.lc = props;
820 if (s->lzma.lc + s->lzma.literal_pos_mask > 4)
823 s->lzma.literal_pos_mask = (1 << s->lzma.literal_pos_mask) - 1;
835 * The LZMA decoder assumes that if the input limit (s->rc.in_limit) hasn't
837 * wrapper function takes care of making the LZMA decoder's assumption safe.
839 * As long as there is plenty of input left to be decoded in the current LZMA
928 * Take care of the LZMA2 control layer, and forward the job of actual LZMA
950 * reset, followed by LZMA compressed chunk
952 * by LZMA compressed chunk (no dictionary
955 * followed by LZMA compressed chunk (no
957 * 0x80 LZMA chunk (no dictionary or state reset)
959 * For LZMA compressed chunks, the lowest five bits
964 * reset. The first LZMA chunk must set new
965 * properties and reset the LZMA state.
1075 if (s->lzma2.compressed > 0 || s->lzma.len > 0
1155 s->lzma.len = 0;