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 BITSTREAM_READER_LE
 
#define jxl_bits(n)   get_bits_long(gb, (n))
 
#define jxl_bits_skip(n)   skip_bits_long(gb, (n))
 
#define jxl_u32(c0, c1, c2, c3, u0, u1, u2, u3)
 
#define jxl_u64()   jpegxl_u64(gb)
 
#define jxl_enum()   jxl_u32(0, 1, 2, 18, 0, 0, 4, 6)
 

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 uint32_t jpegxl_u32 (GetBitContext *gb, const uint32_t constants[4], const uint32_t ubits[4])
 
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)
 validate a Jpeg XL Extra Channel Info bundle More...
 
int ff_jpegxl_verify_codestream_header (const uint8_t *buf, int buflen)
 

Macro Definition Documentation

◆ BITSTREAM_READER_LE

#define BITSTREAM_READER_LE

Definition at line 24 of file jpegxl_probe.c.

◆ jxl_bits

#define jxl_bits (   n)    get_bits_long(gb, (n))

Definition at line 60 of file jpegxl_probe.c.

◆ jxl_bits_skip

#define jxl_bits_skip (   n)    skip_bits_long(gb, (n))

Definition at line 61 of file jpegxl_probe.c.

◆ jxl_u32

#define jxl_u32 (   c0,
  c1,
  c2,
  c3,
  u0,
  u1,
  u2,
  u3 
)
Value:
jpegxl_u32(gb, \
(const uint32_t[]){c0, c1, c2, c3}, (const uint32_t[]){u0, u1, u2, u3})

Definition at line 62 of file jpegxl_probe.c.

◆ jxl_u64

#define jxl_u64 ( )    jpegxl_u64(gb)

Definition at line 64 of file jpegxl_probe.c.

◆ jxl_enum

#define jxl_enum ( )    jxl_u32(0, 1, 2, 18, 0, 0, 4, 6)

Definition at line 65 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 27 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 39 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 46 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 53 of file jpegxl_probe.c.

Function Documentation

◆ jpegxl_u32()

static uint32_t jpegxl_u32 ( GetBitContext gb,
const uint32_t  constants[4],
const uint32_t  ubits[4] 
)
static

Definition at line 68 of file jpegxl_probe.c.

◆ jpegxl_u64()

static uint64_t jpegxl_u64 ( GetBitContext gb)
static

Definition at line 81 of file jpegxl_probe.c.

◆ jpegxl_width_from_ratio()

static uint32_t jpegxl_width_from_ratio ( uint32_t  height,
int  ratio 
)
static

Definition at line 112 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 141 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 169 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 195 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)
static

validate a Jpeg XL Extra Channel Info bundle

Returns
>= 0 upon valid, < 0 upon invalid

Definition at line 211 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 
)

Definition at line 246 of file jpegxl_probe.c.

Referenced by jpegxl_probe().

c1
static const uint64_t c1
Definition: murmur3.c:51
jpegxl_u32
static uint32_t jpegxl_u32(GetBitContext *gb, const uint32_t constants[4], const uint32_t ubits[4])
Definition: jpegxl_probe.c:68
c2
static const uint64_t c2
Definition: murmur3.c:52