libjxl

FORK: libjxl patches used on blog
git clone https://git.neptards.moe/blog/libjxl.git
Log | Files | Refs | Submodules | README | LICENSE

jxl_decoder.h (1130B)


      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_WASM_DEMO_JXL_DECODER_H_
      7 #define TOOLS_WASM_DEMO_JXL_DECODER_H_
      8 
      9 #include <stddef.h>
     10 #include <stdint.h>
     11 
     12 extern "C" {
     13 
     14 typedef struct DecoderInstance {
     15   uint32_t width = 0;
     16   uint32_t height = 0;
     17   uint8_t* pixels = nullptr;
     18 
     19   // The rest is opaque.
     20 } DecoderInstance;
     21 
     22 /*
     23   Returns (as uint32_t):
     24     0 - OOM
     25     1 - JxlDecoderSetParallelRunner failed
     26     2 - JxlDecoderSubscribeEvents failed
     27     3 - JxlDecoderSetProgressiveDetail failed
     28     >=4 - OK
     29  */
     30 DecoderInstance* jxlCreateInstance(bool want_sdr, uint32_t display_nits);
     31 
     32 void jxlDestroyInstance(DecoderInstance* instance);
     33 
     34 /*
     35   Returns (as uint32_t):
     36     0 - OK (pixels are ready)
     37     1 - ready to flush
     38     2 - needs more input
     39     >=3 - error
     40  */
     41 uint32_t jxlProcessInput(DecoderInstance* instance, const uint8_t* input,
     42                          size_t input_size);
     43 
     44 uint32_t jxlFlush(DecoderInstance* instance);
     45 
     46 }  // extern "C"
     47 
     48 #endif  // TOOLS_WASM_DEMO_JXL_DECODER_H_