Use libbsc for AVI and MP4 files.
This commit is contained in:
parent
3f62cdf7d5
commit
5e484f0694
7 changed files with 24 additions and 21 deletions
|
@ -215,7 +215,8 @@ is_bsc_type(int btype)
|
||||||
{
|
{
|
||||||
int stype = PC_SUBTYPE(btype);
|
int stype = PC_SUBTYPE(btype);
|
||||||
return ((stype == TYPE_MARKUP) | (stype == TYPE_BMP) | (stype == TYPE_DNA_SEQ) |
|
return ((stype == TYPE_MARKUP) | (stype == TYPE_BMP) | (stype == TYPE_DNA_SEQ) |
|
||||||
(stype == TYPE_TIFF) | (stype == TYPE_MP4) | (stype == TYPE_FLAC));
|
(stype == TYPE_TIFF) | (stype == TYPE_MP4) | (stype == TYPE_FLAC) |
|
||||||
|
(stype == TYPE_AVI));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
12
pcompress.c
12
pcompress.c
|
@ -212,6 +212,7 @@ preproc_compress(pc_ctx_t *pctx, compress_func_ptr cmp_func, void *src, uint64_t
|
||||||
int64_t result;
|
int64_t result;
|
||||||
uint64_t _dstlen, fromlen;
|
uint64_t _dstlen, fromlen;
|
||||||
uchar_t *from, *to;
|
uchar_t *from, *to;
|
||||||
|
int stype;
|
||||||
DEBUG_STAT_EN(double strt, en);
|
DEBUG_STAT_EN(double strt, en);
|
||||||
|
|
||||||
_dstlen = *dstlen;
|
_dstlen = *dstlen;
|
||||||
|
@ -219,12 +220,13 @@ preproc_compress(pc_ctx_t *pctx, compress_func_ptr cmp_func, void *src, uint64_t
|
||||||
to = dst;
|
to = dst;
|
||||||
fromlen = srclen;
|
fromlen = srclen;
|
||||||
result = 0;
|
result = 0;
|
||||||
|
stype = PC_SUBTYPE(btype);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If Dispack is enabled it has to be done first since Dispack analyses the
|
* If Dispack is enabled it has to be done first since Dispack analyses the
|
||||||
* x86 instruction stream in the raw data.
|
* x86 instruction stream in the raw data.
|
||||||
*/
|
*/
|
||||||
if (pctx->dispack_preprocess && PC_SUBTYPE(btype) == TYPE_EXE32) {
|
if (pctx->dispack_preprocess && stype == TYPE_EXE32) {
|
||||||
_dstlen = fromlen;
|
_dstlen = fromlen;
|
||||||
result = dispack_encode((uchar_t *)from, fromlen, to, &_dstlen);
|
result = dispack_encode((uchar_t *)from, fromlen, to, &_dstlen);
|
||||||
if (result != -1) {
|
if (result != -1) {
|
||||||
|
@ -237,9 +239,7 @@ preproc_compress(pc_ctx_t *pctx, compress_func_ptr cmp_func, void *src, uint64_t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pctx->lzp_preprocess &&
|
if (pctx->lzp_preprocess && stype != TYPE_BMP && stype != TYPE_TIFF) {
|
||||||
PC_SUBTYPE(btype) != TYPE_BMP &&
|
|
||||||
PC_SUBTYPE(btype) != TYPE_TIFF) {
|
|
||||||
int hashsize;
|
int hashsize;
|
||||||
|
|
||||||
hashsize = lzp_hash_size(level);
|
hashsize = lzp_hash_size(level);
|
||||||
|
@ -256,8 +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 &&
|
stype != TYPE_DNA_SEQ && stype != TYPE_BMP &&
|
||||||
PC_SUBTYPE(btype) != TYPE_TIFF) {
|
stype != TYPE_TIFF && stype != TYPE_MP4) {
|
||||||
_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);
|
||||||
|
|
|
@ -106,6 +106,7 @@ struct ext_entry {
|
||||||
{"ofs" , TYPE_BINARY|TYPE_COMPRESSED, 3},
|
{"ofs" , TYPE_BINARY|TYPE_COMPRESSED, 3},
|
||||||
{"ofr" , TYPE_BINARY|TYPE_COMPRESSED, 3},
|
{"ofr" , TYPE_BINARY|TYPE_COMPRESSED, 3},
|
||||||
{"flac" , TYPE_BINARY|TYPE_FLAC, 4},
|
{"flac" , TYPE_BINARY|TYPE_FLAC, 4},
|
||||||
|
{"avi" , TYPE_BINARY|TYPE_AVI, 3},
|
||||||
{"pac" , TYPE_BINARY|TYPE_COMPRESSED, 3},
|
{"pac" , TYPE_BINARY|TYPE_COMPRESSED, 3},
|
||||||
{"gif" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_LZW, 3},
|
{"gif" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_LZW, 3},
|
||||||
{"jp2" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_JPEG, 3},
|
{"jp2" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_JPEG, 3},
|
||||||
|
@ -125,7 +126,7 @@ struct ext_entry {
|
||||||
{"lzo" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_LZO, 3},
|
{"lzo" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_LZO, 3},
|
||||||
{"dmg" , TYPE_BINARY, 3},
|
{"dmg" , TYPE_BINARY, 3},
|
||||||
{"7z" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_LZMA, 2},
|
{"7z" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_LZMA, 2},
|
||||||
{"uha" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_UHARC, 3},
|
{"uha" , TYPE_BINARY|TYPE_COMPRESSED, 3},
|
||||||
{"alz" , TYPE_BINARY|TYPE_COMPRESSED, 3},
|
{"alz" , TYPE_BINARY|TYPE_COMPRESSED, 3},
|
||||||
{"ace" , TYPE_BINARY|TYPE_COMPRESSED, 3},
|
{"ace" , TYPE_BINARY|TYPE_COMPRESSED, 3},
|
||||||
{"rar" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_RAR, 3},
|
{"rar" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_RAR, 3},
|
||||||
|
@ -139,7 +140,7 @@ struct ext_entry {
|
||||||
{"pyc" , TYPE_BINARY, 3},
|
{"pyc" , TYPE_BINARY, 3},
|
||||||
{"wav" , TYPE_BINARY, 3},
|
{"wav" , TYPE_BINARY, 3},
|
||||||
{"tta" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_AUDIO_COMPRESSED, 3},
|
{"tta" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_AUDIO_COMPRESSED, 3},
|
||||||
{"wv" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_AUDIO_COMPRESSED, 2},
|
{"wv" , TYPE_BINARY|TYPE_COMPRESSED, 2},
|
||||||
{"swf" , TYPE_BINARY, 3},
|
{"swf" , TYPE_BINARY, 3},
|
||||||
{"SVGZ" , TYPE_BINARY, 4},
|
{"SVGZ" , TYPE_BINARY, 4},
|
||||||
{"ODT" , TYPE_BINARY, 3},
|
{"ODT" , TYPE_BINARY, 3},
|
||||||
|
|
|
@ -96,6 +96,7 @@ m4p,TYPE_BINARY|TYPE_COMPRESSED
|
||||||
ofs,TYPE_BINARY|TYPE_COMPRESSED
|
ofs,TYPE_BINARY|TYPE_COMPRESSED
|
||||||
ofr,TYPE_BINARY|TYPE_COMPRESSED
|
ofr,TYPE_BINARY|TYPE_COMPRESSED
|
||||||
flac,TYPE_BINARY|TYPE_FLAC
|
flac,TYPE_BINARY|TYPE_FLAC
|
||||||
|
avi,TYPE_BINARY|TYPE_AVI
|
||||||
pac,TYPE_BINARY|TYPE_COMPRESSED
|
pac,TYPE_BINARY|TYPE_COMPRESSED
|
||||||
gif,TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_LZW
|
gif,TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_LZW
|
||||||
jp2,TYPE_BINARY|TYPE_COMPRESSED|TYPE_JPEG
|
jp2,TYPE_BINARY|TYPE_COMPRESSED|TYPE_JPEG
|
||||||
|
@ -115,7 +116,7 @@ lzma,TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_LZMA
|
||||||
lzo,TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_LZO
|
lzo,TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_LZO
|
||||||
dmg,TYPE_BINARY
|
dmg,TYPE_BINARY
|
||||||
7z,TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_LZMA
|
7z,TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_LZMA
|
||||||
uha,TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_UHARC
|
uha,TYPE_BINARY|TYPE_COMPRESSED
|
||||||
alz,TYPE_BINARY|TYPE_COMPRESSED
|
alz,TYPE_BINARY|TYPE_COMPRESSED
|
||||||
ace,TYPE_BINARY|TYPE_COMPRESSED
|
ace,TYPE_BINARY|TYPE_COMPRESSED
|
||||||
rar,TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_RAR
|
rar,TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_RAR
|
||||||
|
@ -129,7 +130,7 @@ pyo,TYPE_BINARY
|
||||||
pyc,TYPE_BINARY
|
pyc,TYPE_BINARY
|
||||||
wav,TYPE_BINARY
|
wav,TYPE_BINARY
|
||||||
tta,TYPE_BINARY|TYPE_COMPRESSED|TYPE_AUDIO_COMPRESSED
|
tta,TYPE_BINARY|TYPE_COMPRESSED|TYPE_AUDIO_COMPRESSED
|
||||||
wv,TYPE_BINARY|TYPE_COMPRESSED|TYPE_AUDIO_COMPRESSED
|
wv,TYPE_BINARY|TYPE_COMPRESSED
|
||||||
swf,TYPE_BINARY
|
swf,TYPE_BINARY
|
||||||
SVGZ,TYPE_BINARY,TYPE_COMPRESSED|TYPE_COMPRESSED_GZ
|
SVGZ,TYPE_BINARY,TYPE_COMPRESSED|TYPE_COMPRESSED_GZ
|
||||||
ODT,TYPE_BINARY,TYPE_COMPRESSED|TYPE_COMPRESSED_ZIP
|
ODT,TYPE_BINARY,TYPE_COMPRESSED|TYPE_COMPRESSED_ZIP
|
||||||
|
|
|
@ -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,82,125,113,82,87,113,0,0,7,0,0,113,125,
|
125,0,0,220,125,113,82,82,113,0,0,7,0,0,113,125,
|
||||||
0,0,7,87,0,113,0,0,0,125,0,131,0,7,125,22,
|
0,0,7,87,0,113,0,0,0,125,0,131,0,7,125,22,
|
||||||
0,0,0,0,85,0,0,0,0,113,85,113,0,7,22,0,
|
0,0,0,0,85,0,0,0,0,113,87,113,0,7,22,0,
|
||||||
82,0,124,113,125,125,0,0,0,0,113,7,85,0,0,85,
|
82,0,113,113,125,125,0,0,0,0,113,7,85,0,0,85,
|
||||||
0,82,0,0,113,0,125,183,82,55,124,88,58,183,0,0,
|
0,82,0,0,113,0,125,183,82,85,124,88,58,183,0,0,
|
||||||
124,0,113,85,0,125,0,116,0,82,125,74,0,125,0,32,
|
124,0,113,125,0,125,0,116,0,82,125,74,0,125,0,32,
|
||||||
0,0,113,124,0,85,0,0,42,61,0,87,0,40,183,4,
|
0,113,113,124,0,85,0,0,42,61,0,87,0,40,183,61,
|
||||||
0,0,0,0,0,24,0,0,169,11,0,0,127,200,0,0,
|
0,0,0,0,0,61,0,0,56,11,0,0,164,200,0,0,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The hash function */
|
/* The hash function */
|
||||||
|
|
|
@ -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 135 /* How many keys were hashed */
|
#define PHASHNKEYS 136 /* 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 */
|
||||||
|
|
||||||
|
|
|
@ -246,7 +246,7 @@ typedef enum {
|
||||||
/*
|
/*
|
||||||
* Sub-types.
|
* Sub-types.
|
||||||
*/
|
*/
|
||||||
#define NUM_SUB_TYPES 24
|
#define NUM_SUB_TYPES 26
|
||||||
TYPE_EXE32 = 8,
|
TYPE_EXE32 = 8,
|
||||||
TYPE_JPEG = 16,
|
TYPE_JPEG = 16,
|
||||||
TYPE_MARKUP = 24,
|
TYPE_MARKUP = 24,
|
||||||
|
@ -259,7 +259,7 @@ typedef enum {
|
||||||
TYPE_COMPRESSED_LH = 80,
|
TYPE_COMPRESSED_LH = 80,
|
||||||
TYPE_COMPRESSED_LZMA = 88,
|
TYPE_COMPRESSED_LZMA = 88,
|
||||||
TYPE_COMPRESSED_LZO = 96,
|
TYPE_COMPRESSED_LZO = 96,
|
||||||
TYPE_COMPRESSED_UHARC = 104,
|
TYPE_AVI = 104,
|
||||||
TYPE_MP4 = 112,
|
TYPE_MP4 = 112,
|
||||||
TYPE_FLAC = 120,
|
TYPE_FLAC = 120,
|
||||||
TYPE_COMPRESSED_RAR = 128,
|
TYPE_COMPRESSED_RAR = 128,
|
||||||
|
|
Loading…
Reference in a new issue