@@ -787,6 +787,7 @@ char *codstr(unsigned codecid) { return ""; }
787
787
void tpsizeset (unsigned _tpbsize ) {}
788
788
void tpmodeset (unsigned _tpmode ) {}
789
789
int lzidget (char * scmd ) { return 0 ; }
790
+ unsigned * getAvailableLzs () { return NULL ; }
790
791
#endif
791
792
792
793
#ifdef _QCOMPRESS
@@ -2049,11 +2050,26 @@ unsigned bench64(unsigned char *in, unsigned n, unsigned char *out, unsigned cha
2049
2050
return l ;
2050
2051
}
2051
2052
2053
+ const char * printLzs (char buf [256 ]) {
2054
+ buf [0 ] = 0 ;
2055
+ for (unsigned * lzs = getAvailableLzs (); lzs && * lzs != ICC_LAST ; ++ lzs ){
2056
+ strcat (buf , codstr (* lzs ));
2057
+ strcat (buf , " " );
2058
+ }
2059
+ return buf ;
2060
+ }
2061
+
2052
2062
typedef struct len_t { unsigned id ,cnt ; uint64_t len ; } len_t ;
2053
2063
#define CMPSA (_a_ ,_b_ , _t_ , _v_ ) (((((_t_ *)_a_)->_v_) > (((_t_ *)_b_)->_v_)) - ((((_t_ *)_a_)->_v_) < (((_t_ *)_b_)->_v_)))
2054
2064
static int cmpsna (const void * a , const void * b ) { return CMPSA (a , b , len_t , len ); }
2065
+ #ifdef _LZ4
2066
+ static const char zDefault [] = "lz4,1" ;
2067
+ #else
2068
+ static const char zDefault [] = "memcpy" ;
2069
+ #endif
2055
2070
2056
2071
void usage (char * pgm ) {
2072
+ char lzs [256 ];
2057
2073
fprintf (stderr , "\nIcApp Copyright (c) 2013-2023 Powturbo %s\n" , __DATE__ );
2058
2074
fprintf (stderr , "Usage: %s [options] [file]\n" , pgm );
2059
2075
//fprintf(stderr, " -b#s # = blocksize (default filesize,). max=1GB\n");
@@ -2063,6 +2079,8 @@ void usage(char *pgm) {
2063
2079
fprintf (stderr , " -i#/-j# # = Minimum de/compression iterations per run (default=auto)\n" );
2064
2080
fprintf (stderr , " -I#/-J# # = Number of de/compression runs (default=3)\n" );
2065
2081
fprintf (stderr , " -e# # = function ids separated by ',' or ranges '#-#' (default='1-%d')\n" , ID_MEMCPY );
2082
+ fprintf (stderr , " -Zs s = secondary compressor with level separated by ',' (default %s)\n" , zDefault );
2083
+ fprintf (stderr , " available compressors: %s\n" , printLzs (lzs ));
2066
2084
fprintf (stderr , "File format:\n" );
2067
2085
fprintf (stderr , " -F[Xx[k][H]][.d]\n" );
2068
2086
fprintf (stderr , " X = file format:\n" );
@@ -2134,10 +2152,13 @@ int main(int argc, char* argv[]) { //testrazor();
2134
2152
for (fno = 0 ; fno < 255 ; fno ++ )
2135
2153
lens [fno ].id = 0 , lens [fno ].len = (uint64_t )-1 ;
2136
2154
2155
+ char _scmd [33 ];
2156
+ strcpy (_scmd , zDefault );
2157
+
2137
2158
int c , digit_optind = 0 , this_option_optind = optind ? optind : 1 , option_index = 0 ;
2138
2159
static struct option long_options [] = { {"blocsize" , 0 , 0 , 'b' }, {0 , 0 , 0 } };
2139
2160
for (;;) {
2140
- if ((c = getopt_long (argc , argv , "a:B:b:C:d:D:d:e:E:f:F:g:G:I:J:k:K:hH:l:m:M:n:p:q:R:s:v:V:w:W:yz:" , long_options , & option_index )) == -1 ) break ;
2161
+ if ((c = getopt_long (argc , argv , "a:B:b:C:d:D:d:e:E:f:F:g:G:I:J:k:K:hH:l:m:M:n:p:q:R:s:v:V:w:W:yz:Z: " , long_options , & option_index )) == -1 ) break ;
2141
2162
switch (c ) {
2142
2163
case 0 : printf ("Option %s" , long_options [option_index ].name ); if (optarg ) printf (" with arg %s" , optarg ); printf ("\n" ); break ;
2143
2164
case 'b' : bsize = argtoi (optarg ,1 ); break ;
@@ -2200,6 +2221,7 @@ int main(int argc, char* argv[]) { //testrazor();
2200
2221
case 'V' : tm_verbose = atoi (optarg ); break ;
2201
2222
case 'W' : divs = atoi (optarg ); break ;
2202
2223
case 'z' : zerrlim = strtod (optarg , NULL ); break ;
2224
+ case 'Z' : strncpy (_scmd , optarg , sizeof (_scmd )- 1 ); break ;
2203
2225
default :
2204
2226
fprintf (stderr , "type icapp -h for help\n" );
2205
2227
exit (0 );
@@ -2214,12 +2236,6 @@ int main(int argc, char* argv[]) { //testrazor();
2214
2236
}
2215
2237
isa = cpuisa ();
2216
2238
cpuini (0 ); if (verbose > 1 ) printf ("detected simd id=%x, %s\n\n" , cpuini (0 ), cpustr (cpuini (0 )));
2217
- char _scmd [33 ];
2218
- #ifdef _LZ4
2219
- strcpy (_scmd , "lz4,1" );
2220
- #else
2221
- strcpy (_scmd , "memcpy" );
2222
- #endif
2223
2239
if (!scmd ) scmd = _scmd ;
2224
2240
while (isspace (* scmd )) scmd ++ ;
2225
2241
char * q ;
0 commit comments