Avoid Delta2,LZP for TIFF files. Negatively impacts compression.

This commit is contained in:
Moinak Ghosh 2013-11-29 19:47:57 +05:30
parent 306f145f22
commit dfeea8c19b
6 changed files with 19 additions and 11 deletions

View file

@ -237,7 +237,9 @@ preproc_compress(pc_ctx_t *pctx, compress_func_ptr cmp_func, void *src, uint64_t
} }
} }
if (pctx->lzp_preprocess && PC_SUBTYPE(btype) != TYPE_BMP) { if (pctx->lzp_preprocess &&
PC_SUBTYPE(btype) != TYPE_BMP &&
PC_SUBTYPE(btype) != TYPE_TIFF) {
int hashsize; int hashsize;
hashsize = lzp_hash_size(level); hashsize = lzp_hash_size(level);
@ -254,7 +256,8 @@ preproc_compress(pc_ctx_t *pctx, compress_func_ptr cmp_func, void *src, uint64_t
} }
if (pctx->enable_delta2_encode && props->delta2_span > 0 && if (pctx->enable_delta2_encode && props->delta2_span > 0 &&
PC_SUBTYPE(btype) != TYPE_DNA_SEQ && PC_SUBTYPE(btype) != TYPE_BMP) { PC_SUBTYPE(btype) != TYPE_DNA_SEQ && PC_SUBTYPE(btype) != TYPE_BMP &&
PC_SUBTYPE(btype) != TYPE_TIFF) {
_dstlen = fromlen; _dstlen = fromlen;
result = delta2_encode((uchar_t *)from, fromlen, to, result = delta2_encode((uchar_t *)from, fromlen, to,
&_dstlen, props->delta2_span); &_dstlen, props->delta2_span);

View file

@ -89,6 +89,8 @@ struct ext_entry {
{"mom" , TYPE_TEXT, 3}, {"mom" , TYPE_TEXT, 3},
{"tmac" , TYPE_TEXT, 4}, {"tmac" , TYPE_TEXT, 4},
{"pdf" , TYPE_BINARY, 3}, {"pdf" , TYPE_BINARY, 3},
{"tif" , TYPE_BINARY|TYPE_TIFF, 3},
{"tiff" , TYPE_BINARY|TYPE_TIFF, 4},
{"jpg" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_JPEG, 3}, {"jpg" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_JPEG, 3},
{"jpeg" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_JPEG, 4}, {"jpeg" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_JPEG, 4},
{"mjpeg" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_MJPEG, 5}, {"mjpeg" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_MJPEG, 5},

View file

@ -79,6 +79,8 @@ upp,TYPE_TEXT
mom,TYPE_TEXT mom,TYPE_TEXT
tmac,TYPE_TEXT tmac,TYPE_TEXT
pdf,TYPE_BINARY pdf,TYPE_BINARY
tif,TYPE_BINARY|TYPE_TIFF
tiff,TYPE_BINARY|TYPE_TIFF
jpg,TYPE_BINARY|TYPE_COMPRESSED|TYPE_JPEG jpg,TYPE_BINARY|TYPE_COMPRESSED|TYPE_JPEG
jpeg,TYPE_BINARY|TYPE_COMPRESSED|TYPE_JPEG jpeg,TYPE_BINARY|TYPE_COMPRESSED|TYPE_JPEG
mjpeg,TYPE_BINARY|TYPE_COMPRESSED|TYPE_MJPEG mjpeg,TYPE_BINARY|TYPE_COMPRESSED|TYPE_MJPEG

View file

@ -12,14 +12,14 @@
/* small adjustments to _a_ to make values distinct */ /* small adjustments to _a_ to make values distinct */
ub1 tab[] = { ub1 tab[] = {
125,0,0,87,7,113,82,120,113,0,0,113,0,0,113,125, 125,0,0,82,125,113,82,87,113,0,0,113,0,0,113,125,
0,0,7,113,0,113,0,0,0,7,0,131,0,85,0,22, 0,0,7,113,0,113,0,0,0,125,0,131,0,85,125,22,
0,113,0,0,85,0,0,113,0,113,125,113,0,7,22,0, 0,113,0,0,85,0,0,113,0,113,125,113,0,7,22,0,
82,0,0,113,125,125,0,0,0,0,0,113,22,0,0,125, 82,0,0,113,125,125,0,0,0,0,113,7,74,0,0,125,
0,87,0,0,113,0,125,183,82,0,124,88,40,125,0,0, 0,87,0,0,113,0,125,183,82,0,124,40,40,183,0,0,
124,0,168,125,0,125,0,40,0,82,125,113,113,125,116,0, 124,0,55,85,0,125,0,32,0,82,125,74,0,125,0,0,
0,0,113,85,0,88,0,0,42,27,0,0,0,40,183,61, 0,0,113,113,0,40,0,0,42,27,0,0,0,40,183,4,
0,0,0,0,0,111,0,0,87,125,0,0,127,91,0,0, 0,0,0,0,0,24,0,0,114,124,0,0,103,200,0,0,
}; };
/* The hash function */ /* The hash function */

View file

@ -8,7 +8,7 @@
extern ub1 tab[]; extern ub1 tab[];
#define PHASHLEN 0x80 /* length of hash mapping table */ #define PHASHLEN 0x80 /* length of hash mapping table */
#define PHASHNKEYS 132 /* How many keys were hashed */ #define PHASHNKEYS 134 /* How many keys were hashed */
#define PHASHRANGE 256 /* Range any input might map to */ #define PHASHRANGE 256 /* Range any input might map to */
#define PHASHSALT 0x9e3779b9 /* internal, initialize normal hash */ #define PHASHSALT 0x9e3779b9 /* internal, initialize normal hash */

View file

@ -271,7 +271,8 @@ typedef enum {
TYPE_MJPEG = 176, TYPE_MJPEG = 176,
TYPE_AUDIO_COMPRESSED = 184, TYPE_AUDIO_COMPRESSED = 184,
TYPE_EXE64 = 192, TYPE_EXE64 = 192,
TYPE_BMP = 200 TYPE_BMP = 200,
TYPE_TIFF = 208
} data_type_t; } data_type_t;
/* /*