Skip to content

Commit

Permalink
avifdec: Change default value of --jobs to "all"
Browse files Browse the repository at this point in the history
Analogous to AOMediaCodec#1522.
  • Loading branch information
wantehchang committed Nov 20, 2023
1 parent 5ba0e14 commit 24c8ec6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
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
Expand Down
8 changes: 6 additions & 2 deletions apps/avifdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static void syntax(void)
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);
Expand Down Expand Up @@ -64,7 +64,7 @@ MAIN()
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;
Expand Down Expand Up @@ -225,6 +225,10 @@ MAIN()
++argIndex;
}

if (jobs == -1) {
jobs = avifQueryCPUCount();
}

if (!inputFilename) {
syntax();
return 1;
Expand Down

0 comments on commit 24c8ec6

Please sign in to comment.