benchmark_codec_custom.h (1659B)
1 // Copyright (c) the JPEG XL Project Authors. All rights reserved. 2 // 3 // Use of this source code is governed by a BSD-style 4 // license that can be found in the LICENSE file. 5 6 #ifndef TOOLS_BENCHMARK_BENCHMARK_CODEC_CUSTOM_H_ 7 #define TOOLS_BENCHMARK_BENCHMARK_CODEC_CUSTOM_H_ 8 9 // This is a benchmark codec that can be used with any command-line 10 // encoder/decoder that satisfies the following conditions: 11 // 12 // - the encoder can read from a PNG file `$input.png` and write the encoded 13 // image to `$encoded.$ext` if it is called as: 14 // 15 // $encoder [OPTIONS] $input.png $encoded.$ext 16 // 17 // - the decoder can read from an encoded file `$encoded.$ext` and write to a 18 // PNG file `$decoded.png` if it is called as: 19 // 20 // $decoder $encoded.$ext $decoded.png 21 // 22 // On the benchmark command line, the codec must be specified as: 23 // 24 // custom:$ext:$encoder:$decoder:$options 25 // 26 // Where the options are also separated by colons. 27 // 28 // An example with JPEG XL itself would be: 29 // 30 // custom:jxl:cjxl:djxl:--distance:3 31 // 32 // Optionally, to have encoding and decoding speed reported, the codec may write 33 // the number of seconds (as a floating point number) elapsed during actual 34 // encoding/decoding to $encoded.time and $decoded.time, respectively (replacing 35 // the .$ext and .png extensions). 36 37 #include "tools/benchmark/benchmark_args.h" 38 #include "tools/benchmark/benchmark_codec.h" 39 40 namespace jpegxl { 41 namespace tools { 42 43 ImageCodec* CreateNewCustomCodec(const BenchmarkArgs& args); 44 Status AddCommandLineOptionsCustomCodec(BenchmarkArgs* args); 45 46 } // namespace tools 47 } // namespace jpegxl 48 49 #endif // TOOLS_BENCHMARK_BENCHMARK_CODEC_CUSTOM_H_