diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /third_party/jpeg-xl/lib/include/jxl/stats.h | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/jpeg-xl/lib/include/jxl/stats.h')
-rw-r--r-- | third_party/jpeg-xl/lib/include/jxl/stats.h | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/third_party/jpeg-xl/lib/include/jxl/stats.h b/third_party/jpeg-xl/lib/include/jxl/stats.h new file mode 100644 index 0000000000..c9359dc870 --- /dev/null +++ b/third_party/jpeg-xl/lib/include/jxl/stats.h @@ -0,0 +1,103 @@ +/* Copyright (c) the JPEG XL Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style + * license that can be found in the LICENSE file. + */ + +/** @addtogroup libjxl_encoder + * @{ + * @file stats.h + * @brief API to collect various statistics from JXL encoder. + */ + +#ifndef JXL_STATS_H_ +#define JXL_STATS_H_ + +#include <jxl/jxl_export.h> +#include <stddef.h> + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + +/** + * Opaque structure that holds the encoder statistics. + * + * Allocated and initialized with JxlEncoderStatsCreate(). + * Cleaned up and deallocated with JxlEncoderStatsDestroy(). + */ +typedef struct JxlEncoderStatsStruct JxlEncoderStats; + +/** + * Creates an instance of JxlEncoderStats and initializes it. + * + * @return pointer to initialized JxlEncoderStats instance + */ +JXL_EXPORT JxlEncoderStats* JxlEncoderStatsCreate(void); + +/** + * Deinitializes and frees JxlEncoderStats instance. + * + * @param stats instance to be cleaned up and deallocated. No-op if stats is + * null pointer. + */ +JXL_EXPORT void JxlEncoderStatsDestroy(JxlEncoderStats* stats); + +/** Data type for querying JxlEncoderStats object + */ +typedef enum { + JXL_ENC_STAT_HEADER_BITS, + JXL_ENC_STAT_TOC_BITS, + JXL_ENC_STAT_DICTIONARY_BITS, + JXL_ENC_STAT_SPLINES_BITS, + JXL_ENC_STAT_NOISE_BITS, + JXL_ENC_STAT_QUANT_BITS, + JXL_ENC_STAT_MODULAR_TREE_BITS, + JXL_ENC_STAT_MODULAR_GLOBAL_BITS, + JXL_ENC_STAT_DC_BITS, + JXL_ENC_STAT_MODULAR_DC_GROUP_BITS, + JXL_ENC_STAT_CONTROL_FIELDS_BITS, + JXL_ENC_STAT_COEF_ORDER_BITS, + JXL_ENC_STAT_AC_HISTOGRAM_BITS, + JXL_ENC_STAT_AC_BITS, + JXL_ENC_STAT_MODULAR_AC_GROUP_BITS, + JXL_ENC_STAT_NUM_SMALL_BLOCKS, + JXL_ENC_STAT_NUM_DCT4X8_BLOCKS, + JXL_ENC_STAT_NUM_AFV_BLOCKS, + JXL_ENC_STAT_NUM_DCT8_BLOCKS, + JXL_ENC_STAT_NUM_DCT8X32_BLOCKS, + JXL_ENC_STAT_NUM_DCT16_BLOCKS, + JXL_ENC_STAT_NUM_DCT16X32_BLOCKS, + JXL_ENC_STAT_NUM_DCT32_BLOCKS, + JXL_ENC_STAT_NUM_DCT32X64_BLOCKS, + JXL_ENC_STAT_NUM_DCT64_BLOCKS, + JXL_ENC_STAT_NUM_BUTTERAUGLI_ITERS, + JXL_ENC_NUM_STATS, +} JxlEncoderStatsKey; + +/** Returns the value of the statistics corresponding the given key. + * + * @param stats object that was passed to the encoder with a + * @ref JxlEncoderCollectStats function + * @param key the particular statistics to query + * + * @return the value of the statistics + */ +JXL_EXPORT size_t JxlEncoderStatsGet(const JxlEncoderStats* stats, + JxlEncoderStatsKey key); + +/** Updates the values of the given stats object with that of an other. + * + * @param stats object whose values will be updated (usually added together) + * @param other stats object whose values will be merged with stats + */ +JXL_EXPORT void JxlEncoderStatsMerge(JxlEncoderStats* stats, + const JxlEncoderStats* other); + +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif + +#endif /* JXL_STATS_H_ */ + +/** @}*/ |