avifdec: Change default value of --jobs to "all"
Analogous to https://github.com/AOMediaCodec/libavif/issues/1522.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9525ca0..9f23bad 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -55,7 +55,8 @@
error instead of being ignored.
* API calls now return AVIF_RESULT_OUT_OF_MEMORY instead of aborting on memory
allocation failure.
-* avifenc: Change the default value of the --jobs option from 1 to "all".
+* avifdec and avifenc: Change the default value of the --jobs option from 1 to
+ "all".
* Update avifCropRectConvertCleanApertureBox() to the revised requirements in
ISO/IEC 23000-22:2019/Amd. 2:2021 Section 7.3.6.7.
* AVIF files with an exif_tiff_header_offset pointing at another byte than the
diff --git a/apps/avifdec.c b/apps/avifdec.c
index 5e2688e..435daba 100644
--- a/apps/avifdec.c
+++ b/apps/avifdec.c
@@ -36,7 +36,7 @@
printf("Options:\n");
printf(" -h,--help : Show syntax help\n");
printf(" -V,--version : Show the version number\n");
- printf(" -j,--jobs J : Number of jobs (worker threads, default: 1. Use \"all\" to use all available cores)\n");
+ printf(" -j,--jobs J : Number of jobs (worker threads). Use \"all\" to potentially use as many cores as possible (default: all)\n");
printf(" -c,--codec C : AV1 codec to use (choose from versions list below)\n");
printf(" -d,--depth D : Output depth [8,16]. (PNG only; For y4m, depth is retained, and JPEG is always 8bpc)\n");
printf(" -q,--quality Q : Output quality [0-100]. (JPEG only, default: %d)\n", DEFAULT_JPEG_QUALITY);
@@ -64,7 +64,7 @@
const char * inputFilename = NULL;
const char * outputFilename = NULL;
int requestedDepth = 0;
- int jobs = 1;
+ int jobs = -1;
int jpegQuality = DEFAULT_JPEG_QUALITY;
int pngCompressionLevel = -1; // -1 is a sentinel to avifPNGWrite() to skip calling png_set_compression_level()
avifCodecChoice codecChoice = AVIF_CODEC_CHOICE_AUTO;
@@ -225,6 +225,10 @@
++argIndex;
}
+ if (jobs == -1) {
+ jobs = avifQueryCPUCount();
+ }
+
if (!inputFilename) {
syntax();
return 1;