FFmpeg
jpegxl_parse.h
Go to the documentation of this file.
1 /*
2  * JPEG XL Header Parser
3  * Copyright (c) 2023 Leo Izen <leo.izen@gmail.com>
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #ifndef AVCODEC_JPEGXL_PARSE_H
23 #define AVCODEC_JPEGXL_PARSE_H
24 
25 #include <stdint.h>
26 
27 #include "libavutil/rational.h"
28 
29 #include "jpegxl.h"
30 
31 typedef struct FFJXLMetadata {
32  uint32_t width;
33  uint32_t height;
34  uint32_t coded_width;
35  uint32_t coded_height;
36  int bit_depth;
38  /*
39  * offset, in bits, of the animation header
40  * zero if not animated
41  */
48 
49  /* used by the parser */
55 
56 /*
57  * copies as much of the codestream into the buffer as possible
58  * pass a shorter buflen to request less
59  * returns the number of bytes consumed from input, may be greater than input_len
60  * if the input doesn't end on an ISOBMFF-box boundary
61  */
62 int ff_jpegxl_collect_codestream_header(const uint8_t *input_buffer, int input_len,
63  uint8_t *buffer, int buflen, int *copied);
64 
65 /*
66  * Parse the codestream header with the provided buffer. Returns negative upon failure,
67  * or the number of bits consumed upon success.
68  * The FFJXLMetadata parameter may be NULL, in which case it's ignored.
69  */
70 int ff_jpegxl_parse_codestream_header(const uint8_t *buf, int buflen, FFJXLMetadata *meta, int validate);
71 
72 #endif /* AVCODEC_JPEGXL_PARSE_H */
ff_jpegxl_parse_codestream_header
int ff_jpegxl_parse_codestream_header(const uint8_t *buf, int buflen, FFJXLMetadata *meta, int validate)
Definition: jpegxl_parse.c:255
FFJXLMetadata::coded_width
uint32_t coded_width
Definition: jpegxl_parse.h:34
rational.h
FFJXLColorSpace
FFJXLColorSpace
Definition: jpegxl.h:62
FFJXLMetadata::have_timecodes
int have_timecodes
Definition: jpegxl_parse.h:52
ff_jpegxl_collect_codestream_header
int ff_jpegxl_collect_codestream_header(const uint8_t *input_buffer, int input_len, uint8_t *buffer, int buflen, int *copied)
Definition: jpegxl_parse.c:449
FFJXLMetadata::primaries
FFJXLPrimaries primaries
Definition: jpegxl_parse.h:46
FFJXLMetadata
Definition: jpegxl_parse.h:31
FFJXLWhitePoint
FFJXLWhitePoint
Definition: jpegxl.h:69
FFJXLMetadata::num_extra_channels
uint32_t num_extra_channels
Definition: jpegxl_parse.h:53
FFJXLMetadata::timebase
AVRational timebase
Definition: jpegxl_parse.h:43
FFJXLMetadata::height
uint32_t height
Definition: jpegxl_parse.h:33
FFJXLTransferCharacteristic
FFJXLTransferCharacteristic
Definition: jpegxl.h:83
FFJXLMetadata::coded_height
uint32_t coded_height
Definition: jpegxl_parse.h:35
jpegxl.h
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
FFJXLMetadata::xyb_encoded
int xyb_encoded
Definition: jpegxl_parse.h:50
FFJXLMetadata::animation_offset
int animation_offset
Definition: jpegxl_parse.h:42
FFJXLMetadata::csp
FFJXLColorSpace csp
Definition: jpegxl_parse.h:44
FFJXLPrimaries
FFJXLPrimaries
Definition: jpegxl.h:76
FFJXLMetadata::width
uint32_t width
Definition: jpegxl_parse.h:32
FFJXLMetadata::wp
FFJXLWhitePoint wp
Definition: jpegxl_parse.h:45
FFJXLMetadata::have_alpha
int have_alpha
Definition: jpegxl_parse.h:37
buffer
the frame and frame reference mechanism is intended to as much as expensive copies of that data while still allowing the filters to produce correct results The data is stored in buffers represented by AVFrame structures Several references can point to the same frame buffer
Definition: filter_design.txt:49
FFJXLMetadata::have_icc_profile
int have_icc_profile
Definition: jpegxl_parse.h:51
FFJXLMetadata::bit_depth
int bit_depth
Definition: jpegxl_parse.h:36
FFJXLMetadata::trc
FFJXLTransferCharacteristic trc
Definition: jpegxl_parse.h:47