vcomp/cmpto_j2k: print opt hint in help

+ use unit_evaluate_dbl (instead of unit_evaluate) - **also** in decompress
This commit is contained in:
Martin Pulec
2024-09-12 16:01:35 +02:00
parent ff1d9f3e9f
commit 0a8467b01f
3 changed files with 6 additions and 4 deletions

View File

@@ -92,7 +92,7 @@ unit_evaluate(const char *str, const char **endptr)
* Converts units in format <val>[.<val>][kMG] to floating point representation.
*
* @param str string to be parsed, suffix following SI suffix is ignored (as in 1ms or 100MB)
* @param case_sensitive should 'm' be considered as mega
* @param case_sensitive if true 'm' will be considered as milli, otherwise mega
* @param endptr if not NULL, point to suffix after parse
* @returns positive floating point representation of the string
* @returns NAN if error

View File

@@ -483,11 +483,13 @@ static void usage() {
<< " - use CPU for pixfmt conversion (useful if GPU\n\t\tis fully "
"occupied by the encoder; an option for decoder exists as "
"well)\n";
color_printf("\nOption prefixes (eg. 'q=' for quality) can be used. SI "
"suffixes are recognized (eg. 'r=7.5M').\n");
}
#define ASSIGN_CHECK_VAL(var, str, minval) \
do { \
long long val = unit_evaluate(str, nullptr); \
long long val = unit_evaluate_dbl(str, false, nullptr); \
if (val < (minval) || val > UINT_MAX) { \
LOG(LOG_LEVEL_ERROR) \
<< "[J2K] Wrong value " << (str) \

View File

@@ -242,8 +242,8 @@ static void * j2k_decompress_init(void)
auto *s = new state_decompress_j2k(queue_len, encoder_in_frames);
if (get_commandline_param("j2k-dec-mem-limit") != nullptr) {
s->req_mem_limit = unit_evaluate(
get_commandline_param("j2k-dec-mem-limit"), nullptr);
s->req_mem_limit = unit_evaluate_dbl(
get_commandline_param("j2k-dec-mem-limit"), false, nullptr);
}
if (get_commandline_param("j2k-dec-tile-limit") != nullptr) {