* If the output buffer space is exhausted, then the bits will be ignored, and
* xpress_flush_output() will return 0 when it gets called.
*/
* If the output buffer space is exhausted, then the bits will be ignored, and
* xpress_flush_output() will return 0 when it gets called.
*/
xpress_write_bits(struct xpress_output_bitstream *os,
const u32 bits, const unsigned num_bits)
{
xpress_write_bits(struct xpress_output_bitstream *os,
const u32 bits, const unsigned num_bits)
{
xpress_write_byte(struct xpress_output_bitstream *os, u8 byte)
{
if (os->next_byte < os->end)
xpress_write_byte(struct xpress_output_bitstream *os, u8 byte)
{
if (os->next_byte < os->end)
xpress_write_u16(struct xpress_output_bitstream *os, u16 v)
{
if (os->end - os->next_byte >= 2) {
xpress_write_u16(struct xpress_output_bitstream *os, u16 v)
{
if (os->end - os->next_byte >= 2) {
- put_unaligned_u16_le(os->bitbuf << (16 - os->bitcount), os->next_bits);
- put_unaligned_u16_le(0, os->next_bits2);
+ put_unaligned_le16(os->bitbuf << (16 - os->bitcount), os->next_bits);
+ put_unaligned_le16(0, os->next_bits2);
xpress_write_item(struct xpress_item item, struct xpress_output_bitstream *os,
const u32 codewords[], const u8 lens[])
{
xpress_write_item(struct xpress_item item, struct xpress_output_bitstream *os,
const u32 codewords[], const u8 lens[])
{
len_hdr = min(0xF, adjusted_len);
sym = XPRESS_NUM_CHARS + ((log2_offset << 4) | len_hdr);
len_hdr = min(0xF, adjusted_len);
sym = XPRESS_NUM_CHARS + ((log2_offset << 4) | len_hdr);
/* Tally the Huffman symbol for a literal and return the intermediate
* representation of that literal. */
/* Tally the Huffman symbol for a literal and return the intermediate
* representation of that literal. */
/* Tally the Huffman symbol for a match and return the intermediate
* representation of that match. */
/* Tally the Huffman symbol for a match and return the intermediate
* representation of that match. */
xpress_record_match(struct xpress_compressor *c, unsigned length, unsigned offset)
{
unsigned adjusted_len = length - XPRESS_MIN_MATCH_LEN;
unsigned len_hdr = min(adjusted_len, 0xF);
xpress_record_match(struct xpress_compressor *c, unsigned length, unsigned offset)
{
unsigned adjusted_len = length - XPRESS_MIN_MATCH_LEN;
unsigned len_hdr = min(adjusted_len, 0xF);
len_hdr = min(0xF, adjusted_len);
sym = XPRESS_NUM_CHARS + ((log2_offset << 4) | len_hdr);
len_hdr = min(0xF, adjusted_len);
sym = XPRESS_NUM_CHARS + ((log2_offset << 4) | len_hdr);
const u8 * const in_begin = in;
const u8 *in_next = in_begin;
struct lz_match *cache_ptr = c->match_cache;
const u8 * const in_begin = in;
const u8 *in_next = in_begin;
struct lz_match *cache_ptr = c->match_cache;
/* If we've found so many matches that the cache might overflow
* if we keep finding more, then stop finding matches. This
* case is very unlikely. */
/* If we've found so many matches that the cache might overflow
* if we keep finding more, then stop finding matches. This
* case is very unlikely. */
* highly compressible, so it doesn't matter as much what we do.
*/
if (best_len >= nice_len) {
* highly compressible, so it doesn't matter as much what we do.
*/
if (best_len >= nice_len) {
- c->max_search_depth = (compression_level * 24) / 16;
- c->nice_match_length = (compression_level * 48) / 16;
+ c->max_search_depth = (compression_level * 30) / 16;
+ c->nice_match_length = (compression_level * 60) / 16;
- c->max_search_depth = (compression_level * 24) / 32;
- c->nice_match_length = (compression_level * 48) / 32;
+ c->max_search_depth = (compression_level * 30) / 32;
+ c->nice_match_length = (compression_level * 60) / 32;
- c->max_search_depth = (compression_level * 32) / 100;
- c->nice_match_length = (compression_level * 50) / 100;
+ c->max_search_depth = (compression_level * 28) / 100;
+ c->nice_match_length = (compression_level * 56) / 100;