Allow null output file in test mode
In test mode, specifying "/dev/null" on Linux/macOS, or "NUL" or "nul"
on Windows, will cause the write of the output file to be omitted. This
can substantially improve test thoughput in cases where only the
PSNR metrics are required.
@@ -1206,6 +1206,14 @@ int main(
int store_result = -1;
const char *format_string = "";
+#if defined(_WIN32)
+ bool is_null = output_filename == "NUL" || output_filename == "nul";
+#else
+ bool is_null = output_filename == "/dev/null";
+#endif
+
+ if (!is_null)
+ {
store_result = store_ncimage(image_decomp_out, output_filename.c_str(),
&format_string, cli_config.y_flip);
if (store_result < 0)
@@ -1214,6 +1222,7 @@ int main(
return 1;
}
}
+ }
free_image(image_uncomp_in);
free_image(image_decomp_out);
