JPEG XL library for PureBasic

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
D Ogre
User
User
Posts: 17
Joined: Tue Jan 01, 2008 3:15 am
Location: Michigan, USA

JPEG XL library for PureBasic

Post by D Ogre »

I'm posting this source code for anyone that's interested in utilizing the JPEG XL format in their projects. This is an untested early version. It does compile under PureBasic LTS 6.03, but there may be some datatype errors and omissions. Feel free to modify and use any way you like. All I ask is for you to post any corrections, updates, and usage examples for the community.

Code: Select all

;   JPEGXL Library Wrapper For PureBasic  
;               By: D_Ogre
;             Date: 10/19/23 -

;       Updated By:
; Language Version: PureBasic 6.03 LTS (x64)
;  Library Version: JPEGXL (x64)

;   Free for commercial and personal use.

Global hLibJXL, hLibJXL_Multi
hLibJXL       = OpenLibrary(#PB_Any,         "jxl.dll")
hLibJXL_Multi = OpenLibrary(#PB_Any, "jxl_threads.dll")

If IsLibrary(hLibJXL) And IsLibrary(hLibJXL_Multi)
  
#JXL_TRUE                                                 = 1
#JXL_FALSE                                                = 0
#JXL_PARALLEL_RET_RUNNER_ERROR                            = (-1)

Enumeration ; JxlSignature
  #JXL_SIG_NOT_ENOUGH_BYTES                               = 0
  #JXL_SIG_INVALID                                        = 1
  #JXL_SIG_CODESTREAM                                     = 2
  #JXL_SIG_CONTAINER                                      = 3
EndEnumeration

Enumeration ; JxlDecoderStatus
  #JXL_DEC_SUCCESS                                        = 0
  #JXL_DEC_ERROR                                          = 1
  #JXL_DEC_NEED_MORE_INPUT                                = 2
  #JXL_DEC_NEED_PREVIEW_OUT_BUFFER                        = 3
  #JXL_DEC_NEED_IMAGE_OUT_BUFFER                          = 5
  #JXL_DEC_JPEG_NEED_MORE_OUTPUT                          = 6
  #JXL_DEC_BOX_NEED_MORE_OUTPUT                           = 7
  #JXL_DEC_BASIC_INFO                                     = $40
  #JXL_DEC_EXTENSIONS                                     = $80
  #JXL_DEC_COLOR_ENCODING                                 = $100
  #JXL_DEC_PREVIEW_IMAGE                                  = $200
  #JXL_DEC_FRAME                                          = $400
  #JXL_DEC_FULL_IMAGE                                     = $1000
  #JXL_DEC_JPEG_RECONSTRUCTION                            = $2000
  #JXL_DEC_BOX                                            = $4000
  #JXL_DEC_FRAME_PROGRESSION                              = $8000
EndEnumeration

Enumeration ; JxlEncoderStatus
  #JXL_ENC_SUCCESS                                        = 0
  #JXL_ENC_ERROR                                          = 1
  #JXL_ENC_NEED_MORE_OUTPUT                               = 2
  #JXL_ENC_NOT_SUPPORTED                                  = 3
EndEnumeration

Enumeration ; JxlEncoderError
  #JXL_ENC_ERR_OK                                         = 0
  #JXL_ENC_ERR_GENERIC                                    = 1
  #JXL_ENC_ERR_OOM                                        = 2
  #JXL_ENC_ERR_JBRD                                       = 3
  #JXL_ENC_ERR_BAD_INPUT                                  = 4
  #JXL_ENC_ERR_NOT_SUPPORTED                              = $80
  #JXL_ENC_ERR_API_USAGE                                  = $81
EndEnumeration

Enumeration ; JxlEncoderFrameSettingId
  #JXL_ENC_FRAME_SETTING_EFFORT                           = 0
  #JXL_ENC_FRAME_SETTING_DECODING_SPEED                   = 1
  #JXL_ENC_FRAME_SETTING_RESAMPLING                       = 2
  #JXL_ENC_FRAME_SETTING_EXTRA_CHANNEL_RESAMPLING         = 3
  #JXL_ENC_FRAME_SETTING_ALREADY_DOWNSAMPLED              = 4
  #JXL_ENC_FRAME_SETTING_PHOTON_NOISE                     = 5
  #JXL_ENC_FRAME_SETTING_NOISE                            = 6
  #JXL_ENC_FRAME_SETTING_DOTS                             = 7
  #JXL_ENC_FRAME_SETTING_PATCHES                          = 8
  #JXL_ENC_FRAME_SETTING_EPF                              = 9
  #JXL_ENC_FRAME_SETTING_GABORISH                         = 10
  #JXL_ENC_FRAME_SETTING_MODULAR                          = 11
  #JXL_ENC_FRAME_SETTING_KEEP_INVISIBLE                   = 12
  #JXL_ENC_FRAME_SETTING_GROUP_ORDER                      = 13
  #JXL_ENC_FRAME_SETTING_GROUP_ORDER_CENTER_X             = 14
  #JXL_ENC_FRAME_SETTING_GROUP_ORDER_CENTER_Y             = 15
  #JXL_ENC_FRAME_SETTING_RESPONSIVE                       = 16
  #JXL_ENC_FRAME_SETTING_PROGRESSIVE_AC                   = 17
  #JXL_ENC_FRAME_SETTING_QPROGRESSIVE_AC                  = 18
  #JXL_ENC_FRAME_SETTING_PROGRESSIVE_DC                   = 19
  #JXL_ENC_FRAME_SETTING_CHANNEL_COLORS_GLOBAL_PERCENT    = 20
  #JXL_ENC_FRAME_SETTING_CHANNEL_COLORS_GROUP_PERCENT     = 21
  #JXL_ENC_FRAME_SETTING_PALETTE_COLORS                   = 22
  #JXL_ENC_FRAME_SETTING_LOSSY_PALETTE                    = 23
  #JXL_ENC_FRAME_SETTING_COLOR_TRANSFORM                  = 24
  #JXL_ENC_FRAME_SETTING_MODULAR_COLOR_SPACE              = 25
  #JXL_ENC_FRAME_SETTING_MODULAR_GROUP_SIZE               = 26
  #JXL_ENC_FRAME_SETTING_MODULAR_PREDICTOR                = 27
  #JXL_ENC_FRAME_SETTING_MODULAR_MA_TREE_LEARNING_PERCENT = 28
  #JXL_ENC_FRAME_SETTING_MODULAR_NB_PREV_CHANNELS         = 29
  #JXL_ENC_FRAME_SETTING_JPEG_RECON_CFL                   = 30
  #JXL_ENC_FRAME_INDEX_BOX                                = 31
  #JXL_ENC_FRAME_SETTING_BROTLI_EFFORT                    = 32
  #JXL_ENC_FRAME_SETTING_JPEG_COMPRESS_BOXES              = 33
  #JXL_ENC_FRAME_SETTING_FILL_ENUM                        = 65535
EndEnumeration

Enumeration ; JxlEncoderStatsKey
  #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
EndEnumeration

Enumeration ; JxlColorProfileTarget
  #JXL_COLOR_PROFILE_TARGET_ORIGINAL                      = 0
  #JXL_COLOR_PROFILE_TARGET_DATA                          = 1
EndEnumeration

Enumeration ; JxlOrientation
  #JXL_ORIENT_IDENTITY                                    = 1 
  #JXL_ORIENT_FLIP_HORIZONTAL                             = 2
  #JXL_ORIENT_ROTATE_180                                  = 3
  #JXL_ORIENT_FLIP_VERTICAL                               = 4
  #JXL_ORIENT_TRANSPOSE                                   = 5
  #JXL_ORIENT_ROTATE_90_CW                                = 6
  #JXL_ORIENT_ANTI_TRANSPOSE                              = 7
  #JXL_ORIENT_ROTATE_90_CCW                               = 8
EndEnumeration

Enumeration ; JxlExtraChannelType
  #JXL_CHANNEL_ALPHA
  #JXL_CHANNEL_DEPTH
  #JXL_CHANNEL_SPOT_COLOR
  #JXL_CHANNEL_SELECTION_MASK
  #JXL_CHANNEL_BLACK
  #JXL_CHANNEL_CFA
  #JXL_CHANNEL_THERMAL
  #JXL_CHANNEL_RESERVED0
  #JXL_CHANNEL_RESERVED1
  #JXL_CHANNEL_RESERVED2
  #JXL_CHANNEL_RESERVED3
  #JXL_CHANNEL_RESERVED4
  #JXL_CHANNEL_RESERVED5
  #JXL_CHANNEL_RESERVED6
  #JXL_CHANNEL_RESERVED7
  #JXL_CHANNEL_UNKNOWN
  #JXL_CHANNEL_OPTIONAL
EndEnumeration

Enumeration ; JxlDataType
  #JXL_TYPE_FLOAT                                         = 0
  #JXL_TYPE_UINT8                                         = 2
  #JXL_TYPE_UINT16                                        = 3
  #JXL_TYPE_FLOAT16                                       = 5
EndEnumeration

Enumeration ; JxlEndianness
  #JXL_NATIVE_ENDIAN                                      = 0
  #JXL_LITTLE_ENDIAN                                      = 1
  #JXL_BIG_ENDIAN                                         = 2
EndEnumeration

Enumeration ; JxlBitDepthType
  #JXL_BIT_DEPTH_FROM_PIXEL_FORMAT                        = 0
  #JXL_BIT_DEPTH_FROM_CODESTREAM                          = 1
  #JXL_BIT_DEPTH_CUSTOM                                   = 2
EndEnumeration

Enumeration ; JxlProgressiveDetail
  #kFrames
  #kDC
  #KLastPasses
  #kPasses
  #kDCProgressive
  #kDCGroups
  #KGroups
EndEnumeration

Enumeration ; JxlColorSpace
  #JXL_COLOR_SPACE_RGB
  #JXL_COLOR_SPACE_GRAY 
  #JXL_COLOR_SPACE_XYB
  #JXL_COLOR_SPACE_UNKNOWN
EndEnumeration

Enumeration ; JxlWhitePoint
  #JXL_ORIENT_ROTATE_90_CCW                               = 8
  #JXL_WHITE_POINT_D65                                    = 1
  #JXL_WHITE_POINT_CUSTOM                                 = 2
  #JXL_WHITE_POINT_E                                      = 10  
  #JXL_WHITE_POINT_DCI                                    = 11
EndEnumeration

Enumeration ; JxlPrimaries
  #JXL_PRIMARIES_SRGB                                     = 1
  #JXL_PRIMARIES_CUSTOM                                   = 2
  #JXL_PRIMARIES_2100                                     = 9
  #JXL_PRIMARIES_P3                                       = 11
EndEnumeration

Enumeration ; JxlTransferFunction
  #JXL_TRANSFER_FUNCTION_709                              = 1 
  #JXL_TRANSFER_FUNCTION_UNKNOWN                          = 2 
  #JXL_TRANSFER_FUNCTION_LINEAR                           = 8
  #JXL_TRANSFER_FUNCTION_SRGB                             = 13
  #JXL_TRANSFER_FUNCTION_PQ                               = 16
  #JXL_TRANSFER_FUNCTION_DCI                              = 17
  #JXL_TRANSFER_FUNCTION_HLG                              = 183
  #JXL_TRANSFER_FUNCTION_GAMMA                            = 65535
EndEnumeration

Enumeration ; JxlRenderingIntent
  #JXL_RENDERING_INTENT_PERCEPTUAL                        = 0
  #JXL_RENDERING_INTENT_RELATIVE
  #JXL_RENDERING_INTENT_SATURATION
  #JXL_RENDERING_INTENT_ABSOLUTE
EndEnumeration

Enumeration ; JxlBlendMode
  #JXL_BLEND_REPLACE                                      = 0
  #JXL_BLEND_ADD                                          = 1
  #JXL_BLEND_BLEND                                        = 2
  #JXL_BLEND_MULADD                                       = 3
  #JXL_BLEND_MUL                                          = 4
EndEnumeration

; *** Opaque Structures

Structure JxlButteraugliApi    : EndStructure
Structure JxlButteraugliResult : EndStructure
Structure JxlDecoder           : EndStructure
Structure JxlEncoder           : EndStructure

Structure JxlEncoderFrameSettings : EndStructure

Structure icc
  *Data
  size.i
EndStructure

Structure JxlPixelFormat
  num_channels.l
  data_type.b ; JxlDataType
  endianness.b ;JxlEndianness
  align.i
EndStructure

Structure JxlBitDepth
  type.b ; JxlBitDepthType
  bits_per_sample.l
  exponent_bits_per_sample.l
EndStructure

Structure JxlColorEncoding
  color_space.b ; JxlColorSpace
  white_point.b ; JxlWhitePoint
  white_point_xy.d[2]
  primaries.b ; JxlPrimaries
  primaries_red_xy.d[2]
  primaries_green_xy.d[2]
  primaries_blue_xy.d[2]
  transfer_function.b ; JxlTransferFunction
  gamma.d
  rendering_intent.b ; JxlRenderingIntent
EndStructure

Structure JxlColorProfile
  JxlColorProfile.icc
  color_encoding.JxlColorEncoding
  num_channels.l
EndStructure

Structure JxlPreviewHeader
  xsize.l
  ysize.l
EndStructure

Structure JxlAnimationHeader
  tps_numerator.l
  tps_denominator.l
  num_loops.l
  have_timecodes.b
EndStructure

Structure JxlBasicInfo
  have_container.b
  xsize.l
  ysize.l
  bits_per_sample.l
  exponent_bits_per_sample.l
  intensity_target.f
  min_nits.f
  relative_to_max_display.b
  linear_below.f
  uses_original_profile.b
  have_preview.b
  have_animation.b
  orientation.b ; JxlOrientation
  num_color_channels.l
  num_extra_channels.l
  alpha_bits.l
  alpha_exponent_bits.l
  alpha_premultiplied.b
  preview.JxlPreviewHeader
  animation.JxlAnimationHeader
  intrinsic_xsize.l
  intrinsic_ysize.l
  padding.l[100]
EndStructure

Structure JxlExtraChannelInfo
  type.b ; JxlExtraChannelType
  bits_per_sample.l
  exponent_bits_per_sample.l
  dim_shift.l
  name_length.l
  alpha_premultiplied.b
  spot_color.f[4]
  cfa_channel.l
EndStructure

Structure JxlHeaderExtensions
  extensions.q
EndStructure

Structure JxlBlendInfo
  blendmode.b ; JxlBlendMode
  source.l
  alpha.l
  clamp.l
EndStructure

Structure JxlLayerInfo
  have_crop.b
  crop_x0.l
  crop_y0.l
  xsize.l
  ysize.l
  blend_info.JxlBlendInfo
  save_as_reference.l
EndStructure

Structure JxlFrameHeader
  duration.l
  timecode.l
  name_length.l
  is_last.b
  layer_info.JxlLayerInfo
EndStructure

PrototypeC jpegxl_cms_init_func(*init_data, num_threads, pixels_per_thread, *input_profile.JxlColorProfile, *output_profile.JxlColorProfile, intensity_target.f)                                     
PrototypeC jpegxl_cms_get_buffer_func(*user_data, thread)
PrototypeC jpegxl_cms_run_func(*user_data, thread, *input_buffer, *output_buffer, num_pixels)                                       
PrototypeC jpegxl_cms_destroy_func()

Structure JxlCmsInterface
  *init_data
  init.jpegxl_cms_init_func
  get_src_buf.jpegxl_cms_get_buffer_func
  get_dst_buf.jpegxl_cms_get_buffer_func
  run.jpegxl_cms_run_func
  destroy.jpegxl_cms_destroy_func
EndStructure

PrototypeC jpegxl_alloc_func(*opaque, size)
PrototypeC jpegxl_free_func(*opaque, *address)

Structure JxlMemoryManager
  *opaque
  alloc.jpegxl_alloc_func
  free.jpegxl_free_func
EndStructure

Define JxlParallelRetCode.i

PrototypeC JxlParallelRunInit(*jpegxl_opaque, num_threads)
PrototypeC JxlParallelRunFunction(*jpegxl_opaque, value, thread_id)
PrototypeC JxlParallelRunner(*runner_opaque, *jpegxl_opaque, init.JxlParallelRunInit, func.JxlParallelRunFunction, start_range, end_range)


; * Butteraugli Api

PrototypeC JxlButteraugliApiCreate(*Memory_Manager.JxlMemoryManager) ; JXL_EXPORT JxlButteraugliApi *JxlButteraugliApiCreate(const JxlMemoryManager *memory_manager)
PrototypeC JxlButteraugliApiDestroy(*Api.JxlButteraugliApi) ; JXL_EXPORT void JxlButteraugliApiDestroy(JxlButteraugliApi *api)
PrototypeC JxlButteraugliApiSetHFAsymmetry(*Api.JxlButteraugliApi, V.f) ; JXL_EXPORT void JxlButteraugliApiSetHFAsymmetry(JxlButteraugliApi *api, float v)
PrototypeC JxlButteraugliApiSetIntensityTarget(*Api.JxlButteraugliApi, V.f) ; JXL_EXPORT void JxlButteraugliApiSetIntensityTarget(JxlButteraugliApi *api, float v)
PrototypeC JxlButteraugliApiSetParallelRunner(*Api.JxlButteraugliApi, parallel_runner, *parallel_runner_opaque) ; JXL_EXPORT void JxlButteraugliApiSetParallelRunner(JxlButteraugliApi *api, JxlParallelRunner parallel_runner, void *parallel_runner_opaque)
PrototypeC JxlButteraugliCompute(*Api.JxlButteraugliApi, XSize, YSize, *pixel_format_orig.JxlPixelFormat, *buffer_orig, size_orig, *pixel_format_dist.JxlPixelFormat, *buffer_dist, size_dist) ;JXL_EXPORT JxlButteraugliResult *JxlButteraugliCompute(const JxlButteraugliApi *api, uint32_t xsize, uint32_t ysize, const JxlPixelFormat *pixel_format_orig, const void *buffer_orig, size_t size_orig, const JxlPixelFormat *pixel_format_dist, const void *buffer_dist, size_t size_dist)
PrototypeC JxlButteraugliResultDestroy(*Result.JxlButteraugliResult) ; JXL_EXPORT void JxlButteraugliResultDestroy(JxlButteraugliResult *result)
PrototypeC JxlButteraugliResultGetDistance(*Result.JxlButteraugliResult, Pnorm.f) ; JXL_EXPORT float JxlButteraugliResultGetDistance(const JxlButteraugliResult *result, float pnorm)
PrototypeC JxlButteraugliResultGetDistmap(*Result.JxlButteraugliResult, *Buffer, *Row_Stride) ; JXL_EXPORT void JxlButteraugliResultGetDistmap(const JxlButteraugliResult *result, const float **buffer, uint32_t *row_stride)
PrototypeC JxlButteraugliResultGetMaxDistance(*Result.JxlButteraugliResult) ;J XL_EXPORT float JxlButteraugliResultGetMaxDistance(const JxlButteraugliResult *result)

; * Decoder Api

PrototypeC JxlDecoderVersion()

PrototypeC JxlSignatureCheck(*Buffer, Length)

PrototypeC JxlDecoderCloseInput(*Dec.JxlDecoder) ; JXL_EXPORT void JxlDecoderCloseInput(JxlDecoder* dec)
PrototypeC JxlDecoderCreate(*Memory_Manager.JxlMemoryManager) ; JXL_EXPORT JxlDecoder* JxlDecoderCreate(const JxlMemoryManager* memory_manager)
PrototypeC JxlDecoderDefaultPixelFormat(*Dec.JxlDecoder, *Format.JxlPixelFormat) ; JXL_DEPRECATED JXL_EXPORT JxlDecoderStatus JxlDecoderDefaultPixelFormat(const JxlDecoder* dec, JxlPixelFormat* format)
PrototypeC JxlDecoderDestroy(*Dec.JxlDecoder) ; JXL_EXPORT void JxlDecoderDestroy(JxlDecoder* dec)
PrototypeC JxlDecoderExtraChannelBufferSize(*Dec.JxlDecoder, *Format.JxlPixelFormat, Size, Index) ; JXL_EXPORT JxlDecoderStatus JxlDecoderExtraChannelBufferSize(const JxlDecoder* dec, const JxlPixelFormat* format, size_t* size, uint32_t index)
PrototypeC JxlDecoderFlushImage(*Dec.JxlDecoder) ; JXL_EXPORT JxlDecoderStatus JxlDecoderFlushImage(JxlDecoder* dec)
PrototypeC JxlDecoderGetBasicInfo(*Dec.JxlDecoder, *Info.JxlBasicInfo) ; JXL_EXPORT JxlDecoderStatus JxlDecoderGetBasicInfo(const JxlDecoder* dec, JxlBasicInfo* info)
PrototypeC JxlDecoderGetBoxSizeRaw(*Dec.JxlDecoder, *Size) ; JXL_EXPORT JxlDecoderStatus JxlDecoderGetBoxSizeRaw(const JxlDecoder* dec, uint64_t* size)
PrototypeC JxlDecoderGetBoxType(*Dec.JxlDecoder, BoxType, Decompressed) ; JXL_EXPORT JxlDecoderStatus JxlDecoderGetBoxType(JxlDecoder* dec, JxlBoxType type, JXL_BOOL decompressed)
PrototypeC JxlDecoderGetColorAsEncodedProfile(*Dec.JxlDecoder, *Unused_Format.JxlPixelFormat, Target, *Color_Encoding.JxlColorEncoding) ; JXL_EXPORT JxlDecoderStatus JxlDecoderGetColorAsEncodedProfile(const JxlDecoder* dec, const JxlPixelFormat* unused_format, JxlColorProfileTarget target, JxlColorEncoding* color_encoding)
PrototypeC JxlDecoderGetColorAsICCProfile(*Dec.JxlDecoder, *Unused_Format.JxlPixelFormat, Target, *ICCProfile, Size) ; JXL_EXPORT JxlDecoderStatus JxlDecoderGetColorAsICCProfile(const JxlDecoder* dec, const JxlPixelFormat* unused_format, JxlColorProfileTarget target, uint8_t* icc_profile, size_t size)
PrototypeC JxlDecoderGetExtraChannelBlendInfo(*Dec.JxlDecoder, Index, *Blend_Info.JxlBlendInfo) ; JXL_EXPORT JxlDecoderStatus JxlDecoderGetExtraChannelBlendInfo(const JxlDecoder* dec, size_t index, JxlBlendInfo* blend_info)
PrototypeC JxlDecoderGetExtraChannelInfo(*Dec.JxlDecoder, Index, *Info.JxlExtraChannelInfo) ; JXL_EXPORT JxlDecoderStatus JxlDecoderGetExtraChannelInfo(const JxlDecoder* dec, size_t index, JxlExtraChannelInfo* info)
PrototypeC JxlDecoderGetExtraChannelName(*Dec.JxlDecoder, Index, *Name, Size) ; JXL_EXPORT JxlDecoderStatus JxlDecoderGetExtraChannelName(const JxlDecoder* dec, size_t index, char* name, size_t size)
PrototypeC JxlDecoderGetFrameHeader(*Dec.JxlDecoder, *Header.JxlFrameHeader) ; JXL_EXPORT JxlDecoderStatus JxlDecoderGetFrameHeader(const JxlDecoder* dec, JxlFrameHeader* header)
PrototypeC JxlDecoderGetFrameName(*Dec.JxlDecoder, *Name, Size) ; JXL_EXPORT JxlDecoderStatus JxlDecoderGetFrameName(const JxlDecoder* dec, char* name, size_t size)
PrototypeC JxlDecoderGetICCProfileSize(*Dec.JxlDecoder, *Used_Format.JxlPixelFormat, Target, Size) ; JXL_EXPORT JxlDecoderStatus JxlDecoderGetICCProfileSize(const JxlDecoder* dec, const JxlPixelFormat* unused_format, JxlColorProfileTarget target, size_t* size)
PrototypeC JxlDecoderGetIntendedDownsamplingRatio(*Dec.JxlDecoder) ; JXL_EXPORT size_t JxlDecoderGetIntendedDownsamplingRatio(JxlDecoder* dec)
PrototypeC JxlDecoderImageOutBufferSize(*Dec.JxlDecoder, *Format.JxlPixelFormat, Size) ; JXL_EXPORT JxlDecoderStatus JxlDecoderImageOutBufferSize(const JxlDecoder* dec, const JxlPixelFormat* format, size_t* size)
PrototypeC JxlDecoderPreviewOutBufferSize(*Dec.JxlDecoder, *Format.JxlPixelFormat, Size) ; JXL_EXPORT JxlDecoderStatus JxlDecoderPreviewOutBufferSize(const JxlDecoder* dec, const JxlPixelFormat* format, size_t* size)
PrototypeC JxlDecoderProcessInput(*Dec.JxlDecoder) ; JXL_EXPORT JxlDecoderStatus JxlDecoderProcessInput(JxlDecoder* dec)
PrototypeC JxlDecoderReleaseBoxBuffer(*Dec.JxlDecoder) ; JXL_EXPORT size_t JxlDecoderReleaseBoxBuffer(JxlDecoder* dec)
PrototypeC JxlDecoderReleaseInput(*Dec.JxlDecoder) ; JXL_EXPORT size_t JxlDecoderReleaseInput(JxlDecoder* dec)
PrototypeC JxlDecoderReleaseJPEGBuffer(*Dec.JxlDecoder) ; JXL_EXPORT size_t JxlDecoderReleaseJPEGBuffer(JxlDecoder* dec)
PrototypeC JxlDecoderReset(*Dec.JxlDecoder) ; JXL_EXPORT void JxlDecoderReset(JxlDecoder* dec)
PrototypeC JxlDecoderRewind(*Dec.JxlDecoder) ; JXL_EXPORT void JxlDecoderRewind(JxlDecoder* dec)
PrototypeC JxlDecoderSetBoxBuffer(*Dec.JxlDecoder, *Data, Size) ; JXL_EXPORT JxlDecoderStatus JxlDecoderSetBoxBuffer(JxlDecoder* dec, uint8_t* Data, size_t size)
PrototypeC JxlDecoderSetCoalescing(*Dec.JxlDecoder, Coalescing) ; JXL_EXPORT JxlDecoderStatus JxlDecoderSetCoalescing(JxlDecoder* dec, JXL_BOOL coalescing)
PrototypeC JxlDecoderSetDecompressBoxes(*Dec.JxlDecoder, Decompress) ; JXL_EXPORT JxlDecoderStatus JxlDecoderSetDecompressBoxes(JxlDecoder* dec, JXL_BOOL decompress)
PrototypeC JxlDecoderSetDesiredIntensityTarget(*Dec.JxlDecoder, Desired_Intensity_Target.f) ; JXL_EXPORT JxlDecoderStatus JxlDecoderSetDesiredIntensityTarget(JxlDecoder* dec, float desired_intensity_target)
PrototypeC JxlDecoderSetExtraChannelBuffer(*Dec.JxlDecoder, *Format.JxlPixelFormat, *Buffer, Size, Index) ; JXL_EXPORT JxlDecoderStatus JxlDecoderSetExtraChannelBuffer(JxlDecoder* dec, const JxlPixelFormat* format, void* buffer, size_t size, uint32_t index)
PrototypeC JxlDecoderSetImageOutBitDepth(*Dec.JxlDecoder, *Bit_Depth.JxlBitDepth) ; JXL_EXPORT JxlDecoderStatus JxlDecoderSetImageOutBitDepth(JxlDecoder* dec, const JxlBitDepth* bit_depth)
PrototypeC JxlDecoderSetImageOutBuffer(*Dec.JxlDecoder, *Format.JxlPixelFormat, *Buffer, Size) ; JXL_EXPORT JxlDecoderStatus JxlDecoderSetImageOutBuffer(JxlDecoder* dec, const JxlPixelFormat* format, void* buffer, size_t size)
PrototypeC JxlDecoderSetImageOutCallback(*Dec.JxlDecoder, *Format.JxlPixelFormat, Callback, *Opaque) ; JxlDecoderSetImageOutCallback(JxlDecoder* dec, const JxlPixelFormat* format, JxlImageOutCallback callback, void* opaque)
PrototypeC JxlDecoderSetInput(*Dec.JxlDecoder, *Data, Size) ; JXL_EXPORT JxlDecoderStatus JxlDecoderSetInput(JxlDecoder* dec, const uint8_t* Data, size_t size)
PrototypeC JxlDecoderSetJPEGBuffer(*Dec.JxlDecoder, *Data, Size) ; ; JXL_EXPORT JxlDecoderStatus JxlDecoderSetJPEGBuffer(JxlDecoder* dec, uint8_t* Data, size_t size)
PrototypeC JxlDecoderSetKeepOrientation(*Dec.JxlDecoder, Skip_Reorientation) ; JXL_EXPORT JxlDecoderStatus JxlDecoderSetKeepOrientation(JxlDecoder* dec, JXL_BOOL skip_reorientation)
PrototypeC JxlDecoderSetMultithreadedImageOutCallback(*Dec.JxlDecoder, *Format.JxlPixelFormat, Init_Callback, Run_Callback, Destroy_Callback, *Init_Opaque) ; JXL_EXPORT JxlDecoderStatus JxlDecoderSetMultithreadedImageOutCallback(JxlDecoder* dec, const JxlPixelFormat* format, JxlImageOutInitCallback init_callback, JxlImageOutRunCallback run_callback, JxlImageOutDestroyCallback destroy_callback, void* init_opaque)
PrototypeC JxlDecoderSetParallelRunner(*Dec.JxlDecoder, Parallel_Runner, *Parallel_Runner_Opaque) ; JXL_EXPORT JxlDecoderStatus JxlDecoderSetParallelRunner(JxlDecoder* dec, JxlParallelRunner parallel_runner, void* parallel_runner_opaque)
PrototypeC JxlDecoderSetPreferredColorProfile(*Dec.JxlDecoder,  *Color_Encoding.JxlColorEncoding); JXL_EXPORT JxlDecoderStatus JxlDecoderSetPreferredColorProfile(JxlDecoder* dec, const JxlColorEncoding* color_encoding)
PrototypeC JxlDecoderSetPreviewOutBuffer(*Dec.JxlDecoder, *Format.JxlPixelFormat, *Buffer, Size) ; JXL_EXPORT JxlDecoderStatus JxlDecoderSetPreviewOutBuffer(JxlDecoder* dec, const JxlPixelFormat* format, void* buffer, size_t size)
PrototypeC JxlDecoderSetProgressiveDetail(*Dec.JxlDecoder, Detail) ; JXL_EXPORT JxlDecoderStatus JxlDecoderSetProgressiveDetail(JxlDecoder* dec, JxlProgressiveDetail detail)
PrototypeC JxlDecoderSetRenderSpotcolors(*Dec.JxlDecoder, Render_Spotcolors) ; JXL_EXPORT JxlDecoderStatus JxlDecoderSetRenderSpotcolors(JxlDecoder* dec, JXL_BOOL render_spotcolors)
PrototypeC JxlDecoderSetUnpremultiplyAlpha(*Dec.JxlDecoder, Unpremul_Alpha) ; JXL_EXPORT JxlDecoderStatus JxlDecoderSetUnpremultiplyAlpha(JxlDecoder* dec, JXL_BOOL unpremul_alpha)
PrototypeC JxlDecoderSizeHintBasicInfo(*Dec.JxlDecoder) ; JXL_EXPORT size_t JxlDecoderSizeHintBasicInfo(const JxlDecoder* dec)
PrototypeC JxlDecoderSkipCurrentFrame(*Dec.JxlDecoder) ; JXL_EXPORT JxlDecoderStatus JxlDecoderSkipCurrentFrame(JxlDecoder* dec)
PrototypeC JxlDecoderSkipFrames(*Dec.JxlDecoder, Amount) ; JXL_EXPORT void JxlDecoderSkipFrames(JxlDecoder* dec, size_t amount)
PrototypeC JxlDecoderSubscribeEvents(*Dec.JxlDecoder, Events_Wanted) ; JXL_EXPORT JxlDecoderStatus JxlDecoderSubscribeEvents(JxlDecoder* dec, int events_wanted)

; * Encoder Api

PrototypeC JxlEncoderVersion() ; JXL_EXPORT uint32_t JxlEncoderVersion(void)

PrototypeC JxlColorEncodingSetToLinearSRGB(*Color_Encoding.JxlColorEncoding, Is_Gray) ; JXL_EXPORT void JxlColorEncodingSetToLinearSRGB(JxlColorEncoding *color_encoding, JXL_BOOL is_gray)
PrototypeC JxlColorEncodingSetToSRGB(*Color_Encoding, Is_Gray) ; JXL_EXPORT void JxlColorEncodingSetToSRGB(JxlColorEncoding *color_encoding, JXL_BOOL is_gray)
PrototypeC JxlEncoderAddBox(*Enc.JxlEncoder, Type, *Contents, Size, Compress_Box) ; JXL_EXPORT JxlEncoderStatus JxlEncoderAddBox(JxlEncoder *enc, const JxlBoxType type, const uint8_t *contents, size_t size, JXL_BOOL compress_box)
PrototypeC JxlEncoderAddImageFrame(*Frame_Setting.JxlEncoderFrameSettings, *Pixel.JxlPixelFormat, *Buffer, Size) ; JXL_EXPORT JxlEncoderStatus JxlEncoderAddImageFrame(const JxlEncoderFrameSettings *frame_settings, const JxlPixelFormat *pixel_format, const void *buffer, size_t size)
PrototypeC JxlEncoderAddJPEGFrame(*Frame_Setting.JxlEncoderFrameSettings, *Buffer, Size) ; JXL_EXPORT JxlEncoderStatus JxlEncoderAddJPEGFrame(const JxlEncoderFrameSettings *frame_settings, const uint8_t *buffer, size_t size)
PrototypeC JxlEncoderAllowExpertOptions(*Enc.JxlEncoder) ; JXL_EXPORT void JxlEncoderAllowExpertOptions(JxlEncoder *enc)
PrototypeC JxlEncoderCloseBoxes(*Enc.JxlEncoder) ; JXL_EXPORT void JxlEncoderCloseBoxes(JxlEncoder *enc)
PrototypeC JxlEncoderCloseFrames(*Enc.JxlEncoder) ; JXL_EXPORT void JxlEncoderCloseFrames(JxlEncoder *enc)
PrototypeC JxlEncoderCloseInput(*Enc.JxlEncoder) ; JXL_EXPORT void JxlEncoderCloseInput(JxlEncoder *enc)
PrototypeC JxlEncoderCreate(*Memory_Manager.JxlMemoryManager) ; JXL_EXPORT JxlEncoder *JxlEncoderCreate(const JxlMemoryManager *memory_manager)
PrototypeC JxlEncoderDestroy(*Enc.JxlEncoder) ; JXL_EXPORT void JxlEncoderDestroy(JxlEncoder *enc)
PrototypeC JxlEncoderFrameSettingsCreate(*Enc.JxlEncoder, *Source.JxlEncoderFrameSettings) ; JXL_EXPORT JxlEncoderFrameSettings *JxlEncoderFrameSettingsCreate(JxlEncoder *enc, const JxlEncoderFrameSettings *source)
PrototypeC JxlEncoderFrameSettingsSetFloatOption(*Frame_Setting.JxlEncoderFrameSettings); JXL_EXPORT JxlEncoderStatus JxlEncoderFrameSettingsSetFloatOption(JxlEncoderFrameSettings *frame_settings, JxlEncoderFrameSettingId option, float value)
PrototypeC JxlEncoderFrameSettingsSetOption(*Frame_Setting.JxlEncoderFrameSettings, Option, Value.q) ; JXL_EXPORT JxlEncoderStatus JxlEncoderFrameSettingsSetOption(JxlEncoderFrameSettings *frame_settings, JxlEncoderFrameSettingId option, int64_t value)
PrototypeC JxlEncoderGetError(*Enc.JxlEncoder) ; JXL_EXPORT JxlEncoderError JxlEncoderGetError(JxlEncoder *enc)
PrototypeC JxlEncoderGetRequiredCodestreamLevel(*Enc.JxlEncoder) ; JXL_EXPORT int JxlEncoderGetRequiredCodestreamLevel(const JxlEncoder *enc)
PrototypeC JxlEncoderInitBasicInfo(*Info.JxlBasicInfo) ; JXL_EXPORT void JxlEncoderInitBasicInfo(JxlBasicInfo *info)
PrototypeC JxlEncoderInitBlendInfo(*Blend_Info.JxlBlendInfo) ; JXL_EXPORT void JxlEncoderInitBlendInfo(JxlBlendInfo *blend_info)
PrototypeC JxlEncoderInitExtraChannelInfo(Type, *Info.JxlExtraChannelInfo) ; JXL_EXPORT void JxlEncoderInitExtraChannelInfo(JxlExtraChannelType type, JxlExtraChannelInfo *info)
PrototypeC JxlEncoderInitFrameHeader(*Frame_Header.JxlFrameHeader) ; JXL_EXPORT void JxlEncoderInitFrameHeader(JxlFrameHeader *frame_header)
PrototypeC JxlEncoderOptionsCreate(*Enc.JxlEncoder, *JxlEncoderFrameSettings) ; JXL_DEPRECATED JXL_EXPORT JxlEncoderFrameSettings *JxlEncoderOptionsCreate(JxlEncoder*, const JxlEncoderFrameSettings*)
PrototypeC JxlEncoderOptionsSetDecodingSpeed(*Frame_Setting.JxlEncoderFrameSettings, Tier) ; JXL_DEPRECATED JXL_EXPORT JxlEncoderStatus JxlEncoderOptionsSetDecodingSpeed(JxlEncoderFrameSettings *frame_settings, int tier)
PrototypeC JxlEncoderOptionsSetDistance(*Frame_Setting.JxlEncoderFrameSettings, Distance.f) ; JXL_EXPORT JxlEncoderStatus JxlEncoderSetFrameDistance(JxlEncoderFrameSettings *frame_settings, float distance)
PrototypeC JxlEncoderOptionsSetEffort(*Frame_Setting.JxlEncoderFrameSettings, Effort) ; JXL_DEPRECATED JXL_EXPORT JxlEncoderStatus JxlEncoderOptionsSetEffort(JxlEncoderFrameSettings *frame_settings, int effort)
PrototypeC JxlEncoderOptionsSetLossless(*JxlEncoderFrameSettings, JXL_BOOL); JXL_EXPORT JxlEncoderStatus JxlEncoderOptionsSetLossless(JxlEncoderFrameSettings*, JXL_BOOL)
PrototypeC JxlEncoderProcessOutput(*Enc.JxlEncoder, *Next_Out, *Avail_Out) ; JXL_EXPORT JxlEncoderStatus JxlEncoderProcessOutput(JxlEncoder *enc, uint8_t **next_out, size_t *avail_out)
PrototypeC JxlEncoderReset(*Enc.JxlEncoder) ; JXL_EXPORT void JxlEncoderReset(JxlEncoder *enc)
PrototypeC JxlEncoderSetBasicInfo(*Enc.JxlEncoder, *Info.JxlBasicInfo) ; JXL_EXPORT JxlEncoderStatus JxlEncoderSetBasicInfo(JxlEncoder *enc, const JxlBasicInfo *info)
PrototypeC JxlEncoderSetCms(*Enc.JxlEncoder, *Cms.JxlCmsInterface) ; JXL_EXPORT void JxlEncoderSetCms(JxlEncoder *enc, JxlCmsInterface cms)
PrototypeC JxlEncoderSetCodestreamLevel(*Enc.JxlEncoder, Level) ; JXL_EXPORT JxlEncoderStatus JxlEncoderSetCodestreamLevel(JxlEncoder *enc, int level)
PrototypeC JxlEncoderSetColorEncoding(*Enc.JxlEncoder, *Color.JxlColorEncoding) ; JXL_EXPORT JxlEncoderStatus JxlEncoderSetColorEncoding(JxlEncoder *enc, const JxlColorEncoding *color)
PrototypeC JxlEncoderSetExtraChannelBlendInfo(*Frame_Setting.JxlEncoderFrameSettings, Index, *Blend_Info.JxlBlendInfo) ; JXL_EXPORT JxlEncoderStatus JxlEncoderSetExtraChannelBlendInfo(JxlEncoderFrameSettings *frame_settings, size_t index, const JxlBlendInfo *blend_info)
PrototypeC JxlEncoderSetExtraChannelBuffer(*Frame_Setting.JxlEncoderFrameSettings, *Pixel_Format.JxlPixelFormat, *Buffer, Size, Index) ; JXL_EXPORT JxlEncoderStatus JxlEncoderSetExtraChannelBuffer(const JxlEncoderFrameSettings *frame_settings, const JxlPixelFormat *pixel_format, const void *buffer, size_t size, uint32_t index)
PrototypeC JxlEncoderSetExtraChannelInfo(*Enc.JxlEncoder, Index, *Info.JxlExtraChannelInfo) ; JXL_EXPORT JxlEncoderStatus JxlEncoderSetExtraChannelInfo(JxlEncoder *enc, size_t index, const JxlExtraChannelInfo *info)
PrototypeC JxlEncoderSetExtraChannelName(*Enc.JxlEncoder, Index, *Name, Size) ; JXL_EXPORT JxlEncoderStatus JxlEncoderSetExtraChannelName(JxlEncoder *enc, size_t index, const char *name, size_t size)
PrototypeC JxlEncoderSetFrameBitDepth(*Frame_Setting.JxlEncoderFrameSettings, *Bit_Depth.JxlBitDepth) ; JXL_EXPORT JxlEncoderStatus JxlEncoderSetFrameBitDepth(JxlEncoderFrameSettings *frame_settings, const JxlBitDepth *bit_depth)
PrototypeC JxlEncoderSetFrameDistance(*Frame_Setting.JxlEncoderFrameSettings, Distance.f); JXL_EXPORT JxlEncoderStatus JxlEncoderSetFrameDistance(JxlEncoderFrameSettings *frame_settings, float distance)
PrototypeC JxlEncoderSetFrameHeader(*Frame_Setting.JxlEncoderFrameSettings, *Frame_Header.JxlFrameHeader); JXL_EXPORT JxlEncoderStatus JxlEncoderSetFrameHeader(JxlEncoderFrameSettings *frame_settings, const JxlFrameHeader *frame_header)
PrototypeC JxlEncoderSetFrameLossless(*Frame_Setting.JxlEncoderFrameSettings, Lossless) ; JXL_EXPORT JxlEncoderStatus JxlEncoderSetFrameLossless(JxlEncoderFrameSettings *frame_settings, JXL_BOOL lossless)
PrototypeC JxlEncoderSetFrameName(*Frame_Setting.JxlEncoderFrameSettings, *Frame_Name) ; JXL_EXPORT JxlEncoderStatus JxlEncoderSetFrameName(JxlEncoderFrameSettings *frame_settings, const char *frame_name)
PrototypeC JxlEncoderSetICCProfile(*Enc.JxlEncoder, *ICC_Profile, Size) ; JXL_EXPORT JxlEncoderStatus JxlEncoderSetICCProfile(JxlEncoder *enc, const uint8_t *icc_profile, size_t size)
PrototypeC JxlEncoderSetParallelRunner(*Enc.JxlEncoder,  Parallel_Runner, *Parallel_Runner_Opaque); JXL_EXPORT JxlEncoderStatus JxlEncoderSetParallelRunner(JxlEncoder *enc, JxlParallelRunner parallel_runner, void *parallel_runner_opaque)
PrototypeC JxlEncoderStoreJPEGMetadata(*Enc.JxlEncoder, Store_JPEG_Metadata) ; JXL_EXPORT JxlEncoderStatus JxlEncoderStoreJPEGMetadata(JxlEncoder *enc, JXL_BOOL store_jpeg_metadata)
PrototypeC JxlEncoderUseBoxes(*Enc.JxlEncoder) ; JXL_EXPORT JxlEncoderStatus JxlEncoderUseBoxes(JxlEncoder *enc)
PrototypeC JxlEncoderUseContainer(*Enc.JxlEncoder, Use_Container) ; JXL_EXPORT JxlEncoderStatus JxlEncoderUseContainer(JxlEncoder *enc, JXL_BOOL use_container)

; *** New functions in latest release. Not yet implemented in stable release.

; JXL_EXPORT JxlEncoderStatus JxlEncoderSetOutputProcessor(JxlEncoder *enc, struct JxlEncoderOutputProcessor output_processor)
; JXL_EXPORT JxlEncoderStatus JxlEncoderFlushInput(JxlEncoder *enc)
; JXL_EXPORT JxlEncoderStatus JxlEncoderAddChunkedFrame(const JxlEncoderFrameSettings *frame_settings, JXL_BOOL is_last_frame, struct JxlChunkedFrameInputSource chunked_frame_input)
; JXL_EXPORT JxlEncoderStatus JxlEncoderSetUpsamplingMode(JxlEncoder *enc, const int64_t factor, const int64_t mode)
; JXL_EXPORT JxlEncoderStatus JxlEncoderSetExtraChannelDistance(JxlEncoderFrameSettings *frame_settings, size_t index, float distance)

; JXL_EXPORT void JxlEncoderSetDebugImageCallback(JxlEncoderFrameSettings *frame_settings, JxlDebugImageCallback callback, void *opaque)
; JXL_EXPORT void JxlEncoderCollectStats(JxlEncoderFrameSettings *frame_settings, JxlEncoderStats *stats)
; JXL_EXPORT JxlEncoderStats *JxlEncoderStatsCreate(void)
; JXL_EXPORT void JxlEncoderStatsDestroy(JxlEncoderStats *stats)
; JXL_EXPORT size_t JxlEncoderStatsGet(const JxlEncoderStats *stats, JxlEncoderStatsKey key)
; JXL_EXPORT void JxlEncoderStatsMerge(JxlEncoderStats *stats, const JxlEncoderStats *other)


; * Multi-threaded Encoder/Decoder                                                                                                                                                                                                                                              

PrototypeC JxlResizableParallelRunner(*runner_opaque, *jpegxl_opaque, init.JxlParallelRunInit, func.JxlParallelRunFunction, start_range, end_range) ; JXL_THREADS_EXPORT JxlParallelRetCode JxlResizableParallelRunner(void *runner_opaque, void *jpegxl_opaque, JxlParallelRunInit init, JxlParallelRunFunction func, uint32_t start_range, uint32_t end_range)
PrototypeC JxlResizableParallelRunnerCreate(*Memory_Manager.JxlMemoryManager) ; JXL_THREADS_EXPORT void *JxlResizableParallelRunnerCreate(const JxlMemoryManager *memory_manager)
PrototypeC JxlResizableParallelRunnerDestroy(*runner_opaque) ; JXL_THREADS_EXPORT void JxlResizableParallelRunnerDestroy(void *runner_opaque)
PrototypeC JxlResizableParallelRunnerSetThreads(*runner_opaque, num_threads) ; JXL_THREADS_EXPORT void JxlResizableParallelRunnerSetThreads(void *runner_opaque, size_t num_threads)
PrototypeC JxlResizableParallelRunnerSuggestThreads(xsize, ysize) ; JXL_THREADS_EXPORT uint32_t JxlResizableParallelRunnerSuggestThreads(uint64_t xsize, uint64_t ysize)
PrototypeC JxlThreadParallelRunner(*runner_opaque, *jpegxl_opaque, init.JxlParallelRunInit, func.JxlParallelRunFunction, start_range, end_range); JXL_THREADS_EXPORT JxlParallelRetCode JxlThreadParallelRunner(void *runner_opaque, void *jpegxl_opaque, JxlParallelRunInit init, JxlParallelRunFunction func, uint32_t start_range, uint32_t end_range)
PrototypeC JxlThreadParallelRunnerCreate(*memory_manager.JxlMemoryManager, num_worker_threads) ; JXL_THREADS_EXPORT void *JxlThreadParallelRunnerCreate(const JxlMemoryManager *memory_manager, size_t num_worker_threads)
PrototypeC JxlThreadParallelRunnerDefaultNumWorkerThreads() ; JXL_THREADS_EXPORT size_t JxlThreadParallelRunnerDefaultNumWorkerThreads()
PrototypeC JxlThreadParallelRunnerDestroy(*runner_opaque) ; JXL_THREADS_EXPORT void JxlThreadParallelRunnerDestroy(void *runner_opaque)


Global JxlButteraugliApiCreate.JxlButteraugliApiCreate                                       = GetFunction(hLibJXL, "JxlButteraugliApiCreate")
Global JxlButteraugliApiDestroy.JxlButteraugliApiDestroy                                     = GetFunction(hLibJXL, "JxlButteraugliApiDestroy")
Global JxlButteraugliApiSetHFAsymmetry.JxlButteraugliApiSetHFAsymmetry                       = GetFunction(hLibJXL, "JxlButteraugliApiSetHFAsymmetry")
Global JxlButteraugliApiSetIntensityTarget.JxlButteraugliApiSetIntensityTarget               = GetFunction(hLibJXL, "JxlButteraugliApiSetIntensityTarget")
Global JxlButteraugliApiSetParallelRunner.JxlButteraugliApiSetParallelRunner                 = GetFunction(hLibJXL, "JxlButteraugliApiSetParallelRunner")
Global JxlButteraugliCompute.JxlButteraugliCompute                                           = GetFunction(hLibJXL, "JxlButteraugliCompute")
Global JxlButteraugliResultDestroy.JxlButteraugliResultDestroy                               = GetFunction(hLibJXL, "JxlButteraugliResultDestroy")
Global JxlButteraugliResultGetDistance.JxlButteraugliResultGetDistance                       = GetFunction(hLibJXL, "JxlButteraugliResultGetDistance")
Global JxlButteraugliResultGetDistmap.JxlButteraugliResultGetDistmap                         = GetFunction(hLibJXL, "JxlButteraugliResultGetDistmap")
Global JxlButteraugliResultGetMaxDistance.JxlButteraugliResultGetMaxDistance                 = GetFunction(hLibJXL, "JxlButteraugliResultGetMaxDistance")


Global JxlDecoderVersion.JxlDecoderVersion                                                   = GetFunction(hLibJXL, "JxlDecoderVersion")

Global JxlSignatureCheck.JxlSignatureCheck                                                   = GetFunction(hLibJXL, "JxlSignatureCheck")

Global JxlDecoderCloseInput.JxlDecoderCloseInput                                             = GetFunction(hLibJXL, "JxlDecoderCloseInput")
Global JxlDecoderCreate.JxlDecoderCreate                                                     = GetFunction(hLibJXL, "JxlDecoderCreate")
Global JxlDecoderDefaultPixelFormat.JxlDecoderDefaultPixelFormat                             = GetFunction(hLibJXL, "JxlDecoderDefaultPixelFormat")
Global JxlDecoderDestroy.JxlDecoderDestroy                                                   = GetFunction(hLibJXL, "JxlDecoderDestroy")
Global JxlDecoderExtraChannelBufferSize.JxlDecoderExtraChannelBufferSize                     = GetFunction(hLibJXL, "JxlDecoderExtraChannelBufferSize")
Global JxlDecoderFlushImage.JxlDecoderFlushImage                                             = GetFunction(hLibJXL, "JxlDecoderFlushImage")
Global JxlDecoderGetBasicInfo.JxlDecoderGetBasicInfo                                         = GetFunction(hLibJXL, "JxlDecoderGetBasicInfo")
Global JxlDecoderGetBoxSizeRaw.JxlDecoderGetBoxSizeRaw                                       = GetFunction(hLibJXL, "JxlDecoderGetBoxSizeRaw")
Global JxlDecoderGetBoxType.JxlDecoderGetBoxType                                             = GetFunction(hLibJXL, "JxlDecoderGetBoxType")
Global JxlDecoderGetColorAsEncodedProfile.JxlDecoderGetColorAsEncodedProfile                 = GetFunction(hLibJXL, "JxlDecoderGetColorAsEncodedProfile")
Global JxlDecoderGetColorAsICCProfile.JxlDecoderGetColorAsICCProfile                         = GetFunction(hLibJXL, "JxlDecoderGetColorAsICCProfile")
Global JxlDecoderGetExtraChannelBlendInfo.JxlDecoderGetExtraChannelBlendInfo                 = GetFunction(hLibJXL, "JxlDecoderGetExtraChannelBlendInfo")
Global JxlDecoderGetExtraChannelInfo.JxlDecoderGetExtraChannelInfo                           = GetFunction(hLibJXL, "JxlDecoderGetExtraChannelInfo")
Global JxlDecoderGetExtraChannelName.JxlDecoderGetExtraChannelName                           = GetFunction(hLibJXL, "JxlDecoderGetExtraChannelName")
Global JxlDecoderGetFrameHeader.JxlDecoderGetFrameHeader                                     = GetFunction(hLibJXL, "JxlDecoderGetFrameHeader")
Global JxlDecoderGetFrameName.JxlDecoderGetFrameName                                         = GetFunction(hLibJXL, "JxlDecoderGetFrameName")
Global JxlDecoderGetICCProfileSize.JxlDecoderGetICCProfileSize                               = GetFunction(hLibJXL, "JxlDecoderGetICCProfileSize")
Global JxlDecoderGetIntendedDownsamplingRatio.JxlDecoderGetIntendedDownsamplingRatio         = GetFunction(hLibJXL, "JxlDecoderGetIntendedDownsamplingRatio")
Global JxlDecoderImageOutBufferSize.JxlDecoderImageOutBufferSize                             = GetFunction(hLibJXL, "JxlDecoderImageOutBufferSize")
Global JxlDecoderPreviewOutBufferSize.JxlDecoderPreviewOutBufferSize                         = GetFunction(hLibJXL, "JxlDecoderPreviewOutBufferSize")
Global JxlDecoderProcessInput.JxlDecoderProcessInput                                         = GetFunction(hLibJXL, "JxlDecoderProcessInput")
Global JxlDecoderReleaseBoxBuffer.JxlDecoderReleaseBoxBuffer                                 = GetFunction(hLibJXL, "JxlDecoderReleaseBoxBuffer")
Global JxlDecoderReleaseInput.JxlDecoderReleaseInput                                         = GetFunction(hLibJXL, "JxlDecoderReleaseInput")
Global JxlDecoderReleaseJPEGBuffer.JxlDecoderReleaseJPEGBuffer                               = GetFunction(hLibJXL, "JxlDecoderReleaseJPEGBuffer")
Global JxlDecoderReset.JxlDecoderReset                                                       = GetFunction(hLibJXL, "JxlDecoderReset")
Global JxlDecoderRewind.JxlDecoderRewind                                                     = GetFunction(hLibJXL, "JxlDecoderRewind")
Global JxlDecoderSetBoxBuffer.JxlDecoderSetBoxBuffer                                         = GetFunction(hLibJXL, "JxlDecoderSetBoxBuffer")
Global JxlDecoderSetCoalescing.JxlDecoderSetCoalescing                                       = GetFunction(hLibJXL, "JxlDecoderSetCoalescing")
Global JxlDecoderSetDecompressBoxes.JxlDecoderSetDecompressBoxes                             = GetFunction(hLibJXL, "JxlDecoderSetDecompressBoxes")
Global JxlDecoderSetDesiredIntensityTarget.JxlDecoderSetDesiredIntensityTarget               = GetFunction(hLibJXL, "JxlDecoderSetDesiredIntensityTarget")
Global JxlDecoderSetExtraChannelBuffer.JxlDecoderSetExtraChannelBuffer                       = GetFunction(hLibJXL, "JxlDecoderSetExtraChannelBuffer")
Global JxlDecoderSetImageOutBitDepth.JxlDecoderSetImageOutBitDepth                           = GetFunction(hLibJXL, "JxlDecoderSetImageOutBitDepth")
Global JxlDecoderSetImageOutBuffer.JxlDecoderSetImageOutBuffer                               = GetFunction(hLibJXL, "JxlDecoderSetImageOutBuffer")
Global JxlDecoderSetImageOutCallback.JxlDecoderSetImageOutCallback                           = GetFunction(hLibJXL, "JxlDecoderSetImageOutCallback")
Global JxlDecoderSetInput.JxlDecoderSetInput                                                 = GetFunction(hLibJXL, "JxlDecoderSetInput")
Global JxlDecoderSetJPEGBuffer.JxlDecoderSetJPEGBuffer                                       = GetFunction(hLibJXL, "JxlDecoderSetJPEGBuffer")
Global JxlDecoderSetKeepOrientation.JxlDecoderSetKeepOrientation                             = GetFunction(hLibJXL, "JxlDecoderSetKeepOrientation")
Global JxlDecoderSetMultithreadedImageOutCallback.JxlDecoderSetMultithreadedImageOutCallback = GetFunction(hLibJXL, "JxlDecoderSetMultithreadedImageOutCallback")
Global JxlDecoderSetParallelRunner.JxlDecoderSetParallelRunner                               = GetFunction(hLibJXL, "JxlDecoderSetParallelRunner")
Global JxlDecoderSetPreferredColorProfile.JxlDecoderSetPreferredColorProfile                 = GetFunction(hLibJXL, "JxlDecoderSetPreferredColorProfile")
Global JxlDecoderSetPreviewOutBuffer.JxlDecoderSetPreviewOutBuffer                           = GetFunction(hLibJXL, "JxlDecoderSetPreviewOutBuffer")
Global JxlDecoderSetProgressiveDetail.JxlDecoderSetProgressiveDetail                         = GetFunction(hLibJXL, "JxlDecoderSetProgressiveDetail")
Global JxlDecoderSetRenderSpotcolors.JxlDecoderSetRenderSpotcolors                           = GetFunction(hLibJXL, "JxlDecoderSetRenderSpotcolors")
Global JxlDecoderSetUnpremultiplyAlpha.JxlDecoderSetUnpremultiplyAlpha                       = GetFunction(hLibJXL, "JxlDecoderSetUnpremultiplyAlpha")
Global JxlDecoderSizeHintBasicInfo.JxlDecoderSizeHintBasicInfo                               = GetFunction(hLibJXL, "JxlDecoderSizeHintBasicInfo")
Global JxlDecoderSkipCurrentFrame.JxlDecoderSkipCurrentFrame                                 = GetFunction(hLibJXL, "JxlDecoderSkipCurrentFrame")
Global JxlDecoderSkipFrames.JxlDecoderSkipFrames                                             = GetFunction(hLibJXL, "JxlDecoderSkipFrames")
Global JxlDecoderSubscribeEvents.JxlDecoderSubscribeEvents                                   = GetFunction(hLibJXL, "JxlDecoderSubscribeEvents")


Global JxlEncoderVersion.JxlEncoderVersion                                                   = GetFunction(hLibJXL, "JxlEncoderVersion")

Global JxlColorEncodingSetToLinearSRGB.JxlColorEncodingSetToLinearSRGB                       = GetFunction(hLibJXL, "JxlColorEncodingSetToLinearSRGB")
Global JxlColorEncodingSetToSRGB.JxlColorEncodingSetToSRGB                                   = GetFunction(hLibJXL, "JxlColorEncodingSetToSRGB")

Global JxlEncoderAddBox.JxlEncoderAddBox                                                     = GetFunction(hLibJXL, "JxlEncoderAddBox")
Global JxlEncoderAddImageFrame.JxlEncoderAddImageFrame                                       = GetFunction(hLibJXL, "JxlEncoderAddImageFrame")
Global JxlEncoderAddJPEGFrame.JxlEncoderAddJPEGFrame                                         = GetFunction(hLibJXL, "JxlEncoderAddJPEGFrame")
Global JxlEncoderAllowExpertOptions.JxlEncoderAllowExpertOptions                             = GetFunction(hLibJXL, "JxlEncoderAllowExpertOptions")
Global JxlEncoderCloseBoxes.JxlEncoderCloseBoxes                                             = GetFunction(hLibJXL, "JxlEncoderCloseBoxes")
Global JxlEncoderCloseFrames.JxlEncoderCloseFrames                                           = GetFunction(hLibJXL, "JxlEncoderCloseFrames")
Global JxlEncoderCloseInput.JxlEncoderCloseInput                                             = GetFunction(hLibJXL, "JxlEncoderCloseInput")
Global JxlEncoderCreate.JxlEncoderCreate                                                     = GetFunction(hLibJXL, "JxlEncoderCreate")
Global JxlEncoderDestroy.JxlEncoderDestroy                                                   = GetFunction(hLibJXL, "JxlEncoderDestroy")
Global JxlEncoderFrameSettingsCreate.JxlEncoderFrameSettingsCreate                           = GetFunction(hLibJXL, "JxlEncoderFrameSettingsCreate")
Global JxlEncoderFrameSettingsSetFloatOption.JxlEncoderFrameSettingsSetFloatOption           = GetFunction(hLibJXL, "JxlEncoderFrameSettingsSetFloatOption")
Global JxlEncoderFrameSettingsSetOption.JxlEncoderFrameSettingsSetOption                     = GetFunction(hLibJXL, "JxlEncoderFrameSettingsSetOption")
Global JxlEncoderGetError.JxlEncoderGetError                                                 = GetFunction(hLibJXL, "JxlEncoderGetError")
Global JxlEncoderGetRequiredCodestreamLevel.JxlEncoderGetRequiredCodestreamLevel             = GetFunction(hLibJXL, "JxlEncoderGetRequiredCodestreamLevel")
Global JxlEncoderInitBasicInfo.JxlEncoderInitBasicInfo                                       = GetFunction(hLibJXL, "JxlEncoderInitBasicInfo")
Global JxlEncoderInitBlendInfo.JxlEncoderInitBlendInfo                                       = GetFunction(hLibJXL, "JxlEncoderInitBlendInfo")
Global JxlEncoderInitExtraChannelInfo.JxlEncoderInitExtraChannelInfo                         = GetFunction(hLibJXL, "JxlEncoderInitExtraChannelInfo")
Global JxlEncoderInitFrameHeader.JxlEncoderInitFrameHeader                                   = GetFunction(hLibJXL, "JxlEncoderInitFrameHeader")
Global JxlEncoderOptionsCreate.JxlEncoderOptionsCreate                                       = GetFunction(hLibJXL, "JxlEncoderOptionsCreate")
Global JxlEncoderOptionsSetDecodingSpeed.JxlEncoderOptionsSetDecodingSpeed                   = GetFunction(hLibJXL, "JxlEncoderOptionsSetDecodingSpeed")
Global JxlEncoderOptionsSetDistance.JxlEncoderOptionsSetDistance                             = GetFunction(hLibJXL, "JxlEncoderOptionsSetDistance")
Global JxlEncoderOptionsSetEffort.JxlEncoderOptionsSetEffort                                 = GetFunction(hLibJXL, "JxlEncoderOptionsSetEffort")
Global JxlEncoderOptionsSetLossless.JxlEncoderOptionsSetLossless                             = GetFunction(hLibJXL, "JxlEncoderOptionsSetLossless")
Global JxlEncoderProcessOutput.JxlEncoderProcessOutput                                       = GetFunction(hLibJXL, "JxlEncoderProcessOutput")
Global JxlEncoderReset.JxlEncoderReset                                                       = GetFunction(hLibJXL, "JxlEncoderReset")
Global JxlEncoderSetBasicInfo.JxlEncoderSetBasicInfo                                         = GetFunction(hLibJXL, "JxlEncoderSetBasicInfo")
Global JxlEncoderSetCms.JxlEncoderSetCms                                                     = GetFunction(hLibJXL, "JxlEncoderSetCms")
Global JxlEncoderSetCodestreamLevel.JxlEncoderSetCodestreamLevel                             = GetFunction(hLibJXL, "JxlEncoderSetCodestreamLevel")
Global JxlEncoderSetColorEncoding.JxlEncoderSetColorEncoding                                 = GetFunction(hLibJXL, "JxlEncoderSetColorEncoding")
Global JxlEncoderSetExtraChannelBlendInfo.JxlEncoderSetExtraChannelBlendInfo                 = GetFunction(hLibJXL, "JxlEncoderSetExtraChannelBlendInfo")
Global JxlEncoderSetExtraChannelBuffer.JxlEncoderSetExtraChannelBuffer                       = GetFunction(hLibJXL, "JxlEncoderSetExtraChannelBuffer")
Global JxlEncoderSetExtraChannelInfo.JxlEncoderSetExtraChannelInfo                           = GetFunction(hLibJXL, "JxlEncoderSetExtraChannelInfo")
Global JxlEncoderSetExtraChannelName.JxlEncoderSetExtraChannelName                           = GetFunction(hLibJXL, "JxlEncoderSetExtraChannelName")
Global JxlEncoderSetFrameBitDepth.JxlEncoderSetFrameBitDepth                                 = GetFunction(hLibJXL, "JxlEncoderSetFrameBitDepth")
Global JxlEncoderSetFrameDistance.JxlEncoderSetFrameDistance                                 = GetFunction(hLibJXL, "JxlEncoderSetFrameDistance")
Global JxlEncoderSetFrameHeader.JxlEncoderSetFrameHeader                                     = GetFunction(hLibJXL, "JxlEncoderSetFrameHeader")
Global JxlEncoderSetFrameLossless.JxlEncoderSetFrameLossless                                 = GetFunction(hLibJXL, "JxlEncoderSetFrameLossless")
Global JxlEncoderSetFrameName.JxlEncoderSetFrameName                                         = GetFunction(hLibJXL, "JxlEncoderSetFrameName")
Global JxlEncoderSetICCProfile.JxlEncoderSetICCProfile                                       = GetFunction(hLibJXL, "JxlEncoderSetICCProfile")
Global JxlEncoderSetParallelRunner.JxlEncoderSetParallelRunner                               = GetFunction(hLibJXL, "JxlEncoderSetParallelRunner")
Global JxlEncoderStoreJPEGMetadata.JxlEncoderStoreJPEGMetadata                               = GetFunction(hLibJXL, "JxlEncoderStoreJPEGMetadata")
Global JxlEncoderUseBoxes.JxlEncoderUseBoxes                                                 = GetFunction(hLibJXL, "JxlEncoderUseBoxes")
Global JxlEncoderUseContainer.JxlEncoderUseContainer                                         = GetFunction(hLibJXL, "JxlEncoderUseContainer")

Global JxlResizableParallelRunner.JxlResizableParallelRunner                                         = GetFunction(hLibJXL_Multi, "JxlResizableParallelRunner")                               
Global JxlResizableParallelRunnerCreate.JxlResizableParallelRunnerCreate                             = GetFunction(hLibJXL_Multi, "JxlResizableParallelRunnerCreate")
Global JxlResizableParallelRunnerDestroy.JxlResizableParallelRunnerDestroy                           = GetFunction(hLibJXL_Multi, "JxlResizableParallelRunnerDestroy")
Global JxlResizableParallelRunnerSetThreads.JxlResizableParallelRunnerSetThreads                     = GetFunction(hLibJXL_Multi, "JxlResizableParallelRunnerSetThreads")
Global JxlResizableParallelRunnerSuggestThreads.JxlResizableParallelRunnerSuggestThreads             = GetFunction(hLibJXL_Multi, "JxlResizableParallelRunnerSuggestThreads")
Global JxlThreadParallelRunner.JxlThreadParallelRunner                                               = GetFunction(hLibJXL_Multi, "JxlThreadParallelRunner")
Global JxlThreadParallelRunnerCreate.JxlThreadParallelRunnerCreate                                   = GetFunction(hLibJXL_Multi, "JxlThreadParallelRunnerCreate")
Global JxlThreadParallelRunnerDefaultNumWorkerThreads.JxlThreadParallelRunnerDefaultNumWorkerThreads = GetFunction(hLibJXL_Multi, "JxlThreadParallelRunnerDefaultNumWorkerThreads")
Global JxlThreadParallelRunnerDestroy.JxlThreadParallelRunnerDestroy                                 = GetFunction(hLibJXL_Multi, "JxlThreadParallelRunnerDestroy")

Else
  
MessageRequester("Error", "Unable to load JPEGXL library.", #PB_MessageRequester_Ok)
  
EndIf

User avatar
jacdelad
Addict
Addict
Posts: 1436
Joined: Wed Feb 03, 2021 12:46 pm
Location: Planet Riesa
Contact:

Re: JPEG XL library for PureBasic

Post by jacdelad »

Looks like you invested already a lot of work into it. I am totally going to test it tomorrow. I didn't want to ask for JPEG XL because some people who seem to run the internet want to see it dead (looking at you, browser developers!). I see it as good successor to the rather outdated jpeg.
PureBasic 6.04/XProfan X4a/Embarcadero RAD Studio 11/Perl 5.2/Python 3.10
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
D Ogre
User
User
Posts: 17
Joined: Tue Jan 01, 2008 3:15 am
Location: Michigan, USA

Re: JPEG XL library for PureBasic

Post by D Ogre »

Well, I hope you find it useful. Like I said, it's an early version. Don't be surprised if there's issues with it. If you get it working, please post your work. :D
User avatar
jacdelad
Addict
Addict
Posts: 1436
Joined: Wed Feb 03, 2021 12:46 pm
Location: Planet Riesa
Contact:

Re: JPEG XL library for PureBasic

Post by jacdelad »

Don't expect too much. I'm still busy with my Gerber module. :wink:
PureBasic 6.04/XProfan X4a/Embarcadero RAD Studio 11/Perl 5.2/Python 3.10
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
Post Reply