FFmpeg
Macros | Enumerations | Functions
jpegxl_probe.c File Reference
#include "jpegxl_probe.h"
#include "libavcodec/get_bits.h"

Go to the source code of this file.

Macros

#define UNCHECKED_BITSTREAM_READER   0
 
#define BITSTREAM_READER_LE
 

Enumerations

enum  JpegXLExtraChannelType {
  FF_JPEGXL_CT_ALPHA = 0, FF_JPEGXL_CT_DEPTH, FF_JPEGXL_CT_SPOT_COLOR, FF_JPEGXL_CT_SELECTION_MASK,
  FF_JPEGXL_CT_BLACK, FF_JPEGXL_CT_CFA, FF_JPEGXL_CT_THERMAL, FF_JPEGXL_CT_NON_OPTIONAL = 15,
  FF_JPEGXL_CT_OPTIONAL
}
 
enum  JpegXLColorSpace { FF_JPEGXL_CS_RGB = 0, FF_JPEGXL_CS_GRAY, FF_JPEGXL_CS_XYB, FF_JPEGXL_CS_UNKNOWN }
 
enum  JpegXLWhitePoint { FF_JPEGXL_WP_D65 = 1, FF_JPEGXL_WP_CUSTOM, FF_JPEGXL_WP_E = 10, FF_JPEGXL_WP_DCI = 11 }
 
enum  JpegXLPrimaries { FF_JPEGXL_PR_SRGB = 1, FF_JPEGXL_PR_CUSTOM, FF_JPEGXL_PR_2100 = 9, FF_JPEGXL_PR_P3 = 11 }
 

Functions

static av_always_inline uint32_t jxl_u32 (GetBitContext *gb, uint32_t c0, uint32_t c1, uint32_t c2, uint32_t c3, uint32_t u0, uint32_t u1, uint32_t u2, uint32_t u3)
 
static av_always_inline uint32_t jxl_enum (GetBitContext *gb)
 
static uint64_t jpegxl_u64 (GetBitContext *gb)
 
static uint32_t jpegxl_width_from_ratio (uint32_t height, int ratio)
 
static int jpegxl_read_size_header (GetBitContext *gb)
 validate a Jpeg XL Size Header More...
 
static int jpegxl_read_preview_header (GetBitContext *gb)
 validate a Jpeg XL Preview Header More...
 
static void jpegxl_skip_bit_depth (GetBitContext *gb)
 skip a Jpeg XL BitDepth Header. More...
 
static int jpegxl_read_extra_channel_info (GetBitContext *gb, int validate_level)
 validate a Jpeg XL Extra Channel Info bundle More...
 
int ff_jpegxl_verify_codestream_header (const uint8_t *buf, int buflen, int validate_level)
 verify that a codestream header is valid More...
 

Macro Definition Documentation

◆ UNCHECKED_BITSTREAM_READER

#define UNCHECKED_BITSTREAM_READER   0

Definition at line 24 of file jpegxl_probe.c.

◆ BITSTREAM_READER_LE

#define BITSTREAM_READER_LE

Definition at line 25 of file jpegxl_probe.c.

Enumeration Type Documentation

◆ JpegXLExtraChannelType

Enumerator
FF_JPEGXL_CT_ALPHA 
FF_JPEGXL_CT_DEPTH 
FF_JPEGXL_CT_SPOT_COLOR 
FF_JPEGXL_CT_SELECTION_MASK 
FF_JPEGXL_CT_BLACK 
FF_JPEGXL_CT_CFA 
FF_JPEGXL_CT_THERMAL 
FF_JPEGXL_CT_NON_OPTIONAL 
FF_JPEGXL_CT_OPTIONAL 

Definition at line 28 of file jpegxl_probe.c.

◆ JpegXLColorSpace

Enumerator
FF_JPEGXL_CS_RGB 
FF_JPEGXL_CS_GRAY 
FF_JPEGXL_CS_XYB 
FF_JPEGXL_CS_UNKNOWN 

Definition at line 40 of file jpegxl_probe.c.

◆ JpegXLWhitePoint

Enumerator
FF_JPEGXL_WP_D65 
FF_JPEGXL_WP_CUSTOM 
FF_JPEGXL_WP_E 
FF_JPEGXL_WP_DCI 

Definition at line 47 of file jpegxl_probe.c.

◆ JpegXLPrimaries

Enumerator
FF_JPEGXL_PR_SRGB 
FF_JPEGXL_PR_CUSTOM 
FF_JPEGXL_PR_2100 
FF_JPEGXL_PR_P3 

Definition at line 54 of file jpegxl_probe.c.

Function Documentation

◆ jxl_u32()

static av_always_inline uint32_t jxl_u32 ( GetBitContext gb,
uint32_t  c0,
uint32_t  c1,
uint32_t  c2,
uint32_t  c3,
uint32_t  u0,
uint32_t  u1,
uint32_t  u2,
uint32_t  u3 
)
static

◆ jxl_enum()

static av_always_inline uint32_t jxl_enum ( GetBitContext gb)
static

◆ jpegxl_u64()

static uint64_t jpegxl_u64 ( GetBitContext gb)
static

Definition at line 83 of file jpegxl_probe.c.

Referenced by ff_jpegxl_verify_codestream_header().

◆ jpegxl_width_from_ratio()

static uint32_t jpegxl_width_from_ratio ( uint32_t  height,
int  ratio 
)
static

Definition at line 114 of file jpegxl_probe.c.

Referenced by jpegxl_read_preview_header(), and jpegxl_read_size_header().

◆ jpegxl_read_size_header()

static int jpegxl_read_size_header ( GetBitContext gb)
static

validate a Jpeg XL Size Header

Returns
>= 0 upon valid size, < 0 upon invalid size found

Definition at line 143 of file jpegxl_probe.c.

Referenced by ff_jpegxl_verify_codestream_header().

◆ jpegxl_read_preview_header()

static int jpegxl_read_preview_header ( GetBitContext gb)
static

validate a Jpeg XL Preview Header

Returns
>= 0 upon valid size, < 0 upon invalid size found

Definition at line 171 of file jpegxl_probe.c.

Referenced by ff_jpegxl_verify_codestream_header().

◆ jpegxl_skip_bit_depth()

static void jpegxl_skip_bit_depth ( GetBitContext gb)
static

skip a Jpeg XL BitDepth Header.

These cannot be invalid.

Definition at line 197 of file jpegxl_probe.c.

Referenced by ff_jpegxl_verify_codestream_header(), and jpegxl_read_extra_channel_info().

◆ jpegxl_read_extra_channel_info()

static int jpegxl_read_extra_channel_info ( GetBitContext gb,
int  validate_level 
)
static

validate a Jpeg XL Extra Channel Info bundle

Returns
>= 0 upon valid, < 0 upon invalid

Definition at line 213 of file jpegxl_probe.c.

Referenced by ff_jpegxl_verify_codestream_header().

◆ ff_jpegxl_verify_codestream_header()

int ff_jpegxl_verify_codestream_header ( const uint8_t *  buf,
int  buflen,
int  validate_level 
)

verify that a codestream header is valid

Returns
Negative upon error, 0 upon verifying that the codestream is not animated, and 1 upon verifying that it is animated

Definition at line 247 of file jpegxl_probe.c.

Referenced by jpegxl_anim_probe(), jpegxl_anim_read_header(), and jpegxl_probe().