Skip to content

Commit

Permalink
vcomp/cmpto_j2k: print opt hint in help
Browse files Browse the repository at this point in the history
+ use unit_evaluate_dbl (instead of unit_evaluate) - **also** in decompress
  • Loading branch information
MartinPulec committed Sep 12, 2024
1 parent ff1d9f3 commit 0a8467b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/utils/misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/video_compress/cmpto_j2k.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down
4 changes: 2 additions & 2 deletions src/video_decompress/cmpto_j2k.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 0a8467b

Please sign in to comment.