FFmpeg
h2645_sei.h
Go to the documentation of this file.
1 /*
2  * This file is part of FFmpeg.
3  *
4  * FFmpeg is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * FFmpeg is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with FFmpeg; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #ifndef AVCODEC_H2645_SEI_H
20 #define AVCODEC_H2645_SEI_H
21 
22 #include <stdint.h>
23 
24 #include "libavutil/buffer.h"
25 #include "libavutil/frame.h"
26 
27 #include "avcodec.h"
28 #include "bytestream.h"
29 #include "codec_id.h"
30 #include "get_bits.h"
31 #include "h2645_vui.h"
32 #include "sei.h"
33 
34 typedef struct H2645SEIA53Caption {
37 
38 typedef struct H2645SEIAFD {
39  int present;
41 } H2645SEIAFD;
42 
43 typedef struct HEVCSEIDynamicHDRPlus {
46 
47 typedef struct HEVCSEIDynamicHDRVivid {
50 
51 typedef struct H2645SEIUnregistered {
53  unsigned nb_buf_ref;
54  int x264_build; //< H.264 only
56 
57 typedef struct H2645SEIFramePacking {
58  int present;
60  int arrangement_cancel_flag; ///< is previous arrangement canceled, -1 if never received (currently H.264 only)
67 
69  int present;
71  int hflip, vflip;
73 
75  int present;
78 
80  int present;
82  uint16_t ambient_light_x;
83  uint16_t ambient_light_y;
85 
87  int present;
88  int model_id;
100  uint8_t num_model_values[3];
103  int16_t comp_model_value[3][256][6];
104  int repetition_period; //< H.264 only
105  int persistence_flag; //< HEVC only
107 
108 typedef struct H2645SEI {
119 } H2645SEI;
120 
121 enum {
124 };
125 
126 /**
127  * Decode a single SEI message.
128  *
129  * This function may either use gb or gbyte to decode the SEI message.
130  *
131  * @param[in, out] gb GetBitContext that needs to be at the start
132  * of the payload (i.e. after the payload_size bytes);
133  * it needs to be initially byte-aligned
134  * @param[in, out] gbyte a GetByteContext for the same data as gb
135  * @return < 0 on error, FF_H2645_SEI_MESSAGE_HANDLED if the SEI message
136  * has been handled or FF_H2645_SEI_MESSAGE_UNHANDLED if not.
137  */
139  enum AVCodecID codec_id, GetBitContext *gb,
140  GetByteContext *gbyte, void *logctx);
141 
143 
145 
147  enum AVCodecID codec_id,
148  AVCodecContext *avctx, const H2645VUI *vui,
149  unsigned bit_depth_luma, unsigned bit_depth_chroma,
150  int seed);
151 
152 #endif /* AVCODEC_H2645_SEI_H */
H2645SEIFilmGrainCharacteristics::persistence_flag
int persistence_flag
Definition: h2645_sei.h:105
H2645SEIFramePacking::arrangement_type
SEIFpaType arrangement_type
Definition: h2645_sei.h:61
H2645SEIAmbientViewingEnvironment::ambient_light_x
uint16_t ambient_light_x
Definition: h2645_sei.h:82
H2645SEIFramePacking
Definition: h2645_sei.h:57
GetByteContext
Definition: bytestream.h:33
H2645SEIAFD
Definition: h2645_sei.h:38
H2645SEIFilmGrainCharacteristics::bit_depth_chroma
int bit_depth_chroma
Definition: h2645_sei.h:91
H2645SEI::afd
H2645SEIAFD afd
Definition: h2645_sei.h:110
H2645SEIA53Caption::buf_ref
AVBufferRef * buf_ref
Definition: h2645_sei.h:35
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:330
H2645SEIA53Caption
Definition: h2645_sei.h:34
H2645SEIAlternativeTransfer::preferred_transfer_characteristics
int preferred_transfer_characteristics
Definition: h2645_sei.h:76
H2645SEI::film_grain_characteristics
H2645SEIFilmGrainCharacteristics film_grain_characteristics
Definition: h2645_sei.h:117
FF_H2645_SEI_MESSAGE_HANDLED
@ FF_H2645_SEI_MESSAGE_HANDLED
Definition: h2645_sei.h:122
H2645SEIDisplayOrientation
Definition: h2645_sei.h:68
H2645SEIFramePacking::present
int present
Definition: h2645_sei.h:58
H2645SEI::a53_caption
H2645SEIA53Caption a53_caption
Definition: h2645_sei.h:109
H2645SEI::dynamic_hdr_vivid
HEVCSEIDynamicHDRVivid dynamic_hdr_vivid
Definition: h2645_sei.h:112
H2645SEIFilmGrainCharacteristics::intensity_interval_upper_bound
uint8_t intensity_interval_upper_bound[3][256]
Definition: h2645_sei.h:102
GetBitContext
Definition: get_bits.h:107
ff_h2645_sei_message_decode
int ff_h2645_sei_message_decode(H2645SEI *h, enum SEIType type, enum AVCodecID codec_id, GetBitContext *gb, GetByteContext *gbyte, void *logctx)
Decode a single SEI message.
Definition: h2645_sei.c:395
type
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
Definition: writing_filters.txt:86
H2645SEI::ambient_viewing_environment
H2645SEIAmbientViewingEnvironment ambient_viewing_environment
Definition: h2645_sei.h:118
H2645SEIFilmGrainCharacteristics::intensity_interval_lower_bound
uint8_t intensity_interval_lower_bound[3][256]
Definition: h2645_sei.h:101
H2645SEIFramePacking::current_frame_is_frame0_flag
int current_frame_is_frame0_flag
Definition: h2645_sei.h:65
HEVCSEIDynamicHDRPlus::info
AVBufferRef * info
Definition: h2645_sei.h:44
codec_id.h
H2645SEIFilmGrainCharacteristics::matrix_coeffs
int matrix_coeffs
Definition: h2645_sei.h:95
H2645SEIFramePacking::arrangement_cancel_flag
int arrangement_cancel_flag
is previous arrangement canceled, -1 if never received (currently H.264 only)
Definition: h2645_sei.h:60
H2645SEIDisplayOrientation::anticlockwise_rotation
int anticlockwise_rotation
Definition: h2645_sei.h:70
s
#define s(width, name)
Definition: cbs_vp9.c:256
H2645SEIAmbientViewingEnvironment
Definition: h2645_sei.h:79
H2645SEIFilmGrainCharacteristics::log2_scale_factor
int log2_scale_factor
Definition: h2645_sei.h:97
SEIType
SEIType
Definition: sei.h:29
get_bits.h
ff_h2645_sei_reset
void ff_h2645_sei_reset(H2645SEI *s)
Definition: h2645_sei.c:658
codec_id
enum AVCodecID codec_id
Definition: vaapi_decode.c:388
H2645SEIDisplayOrientation::hflip
int hflip
Definition: h2645_sei.h:71
H2645SEIFilmGrainCharacteristics::color_primaries
int color_primaries
Definition: h2645_sei.h:93
H2645SEIFilmGrainCharacteristics::repetition_period
int repetition_period
Definition: h2645_sei.h:104
H2645SEIFilmGrainCharacteristics::model_id
int model_id
Definition: h2645_sei.h:88
FF_H2645_SEI_MESSAGE_UNHANDLED
@ FF_H2645_SEI_MESSAGE_UNHANDLED
Definition: h2645_sei.h:123
sei.h
H2645SEIFilmGrainCharacteristics::comp_model_present_flag
int comp_model_present_flag[3]
Definition: h2645_sei.h:98
H2645SEI
Definition: h2645_sei.h:108
H2645VUI
Definition: h2645_vui.h:27
H2645SEIFilmGrainCharacteristics::num_intensity_intervals
uint16_t num_intensity_intervals[3]
Definition: h2645_sei.h:99
seed
static unsigned int seed
Definition: videogen.c:78
sei
static int FUNC() sei(CodedBitstreamContext *ctx, RWContext *rw, H264RawSEI *current)
Definition: cbs_h264_syntax_template.c:825
H2645SEI::display_orientation
H2645SEIDisplayOrientation display_orientation
Definition: h2645_sei.h:115
AVCodecID
AVCodecID
Identify the syntax and semantics of the bitstream.
Definition: codec_id.h:49
H2645SEIFilmGrainCharacteristics::bit_depth_luma
int bit_depth_luma
Definition: h2645_sei.h:90
H2645SEIFilmGrainCharacteristics::num_model_values
uint8_t num_model_values[3]
Definition: h2645_sei.h:100
H2645SEIAFD::present
int present
Definition: h2645_sei.h:39
H2645SEI::frame_packing
H2645SEIFramePacking frame_packing
Definition: h2645_sei.h:114
H2645SEIDisplayOrientation::vflip
int vflip
Definition: h2645_sei.h:71
H2645SEIFramePacking::arrangement_repetition_period
int arrangement_repetition_period
Definition: h2645_sei.h:62
H2645SEIFilmGrainCharacteristics::blending_mode_id
int blending_mode_id
Definition: h2645_sei.h:96
frame.h
buffer.h
H2645SEIDisplayOrientation::present
int present
Definition: h2645_sei.h:69
H2645SEIFilmGrainCharacteristics::transfer_characteristics
int transfer_characteristics
Definition: h2645_sei.h:94
HEVCSEIDynamicHDRPlus
Definition: h2645_sei.h:43
H2645SEIUnregistered::x264_build
int x264_build
Definition: h2645_sei.h:54
H2645SEIFilmGrainCharacteristics::present
int present
Definition: h2645_sei.h:87
HEVCSEIDynamicHDRVivid::info
AVBufferRef * info
Definition: h2645_sei.h:48
H2645SEIFramePacking::arrangement_id
int arrangement_id
Definition: h2645_sei.h:59
H2645SEIFilmGrainCharacteristics::separate_colour_description_present_flag
int separate_colour_description_present_flag
Definition: h2645_sei.h:89
avcodec.h
frame
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
Definition: filter_design.txt:264
H2645SEIFramePacking::content_interpretation_type
int content_interpretation_type
Definition: h2645_sei.h:63
H2645SEIUnregistered
Definition: h2645_sei.h:51
h2645_vui.h
SEIFpaType
SEIFpaType
frame_packing_arrangement types.
Definition: sei.h:147
H2645SEI::unregistered
H2645SEIUnregistered unregistered
Definition: h2645_sei.h:113
AVCodecContext
main external API structure.
Definition: avcodec.h:426
ff_h2645_sei_ctx_replace
int ff_h2645_sei_ctx_replace(H2645SEI *dst, const H2645SEI *src)
Definition: h2645_sei.c:420
HEVCSEIDynamicHDRVivid
Definition: h2645_sei.h:47
H2645SEIAmbientViewingEnvironment::ambient_illuminance
uint32_t ambient_illuminance
Definition: h2645_sei.h:81
H2645SEIAmbientViewingEnvironment::ambient_light_y
uint16_t ambient_light_y
Definition: h2645_sei.h:83
H2645SEIFramePacking::quincunx_sampling_flag
int quincunx_sampling_flag
Definition: h2645_sei.h:64
AVBufferRef
A reference to a data buffer.
Definition: buffer.h:82
H2645SEIAlternativeTransfer::present
int present
Definition: h2645_sei.h:75
src
INIT_CLIP pixel * src
Definition: h264pred_template.c:418
H2645SEI::dynamic_hdr_plus
HEVCSEIDynamicHDRPlus dynamic_hdr_plus
Definition: h2645_sei.h:111
H2645SEIAmbientViewingEnvironment::present
int present
Definition: h2645_sei.h:80
H2645SEIFilmGrainCharacteristics::full_range
int full_range
Definition: h2645_sei.h:92
H2645SEIUnregistered::nb_buf_ref
unsigned nb_buf_ref
Definition: h2645_sei.h:53
bytestream.h
h
h
Definition: vp9dsp_template.c:2038
ff_h2645_sei_to_frame
int ff_h2645_sei_to_frame(AVFrame *frame, H2645SEI *sei, enum AVCodecID codec_id, AVCodecContext *avctx, const H2645VUI *vui, unsigned bit_depth_luma, unsigned bit_depth_chroma, int seed)
Definition: h2645_sei.c:459
H2645SEIFilmGrainCharacteristics::comp_model_value
int16_t comp_model_value[3][256][6]
Definition: h2645_sei.h:103
H2645SEIUnregistered::buf_ref
AVBufferRef ** buf_ref
Definition: h2645_sei.h:52
H2645SEI::alternative_transfer
H2645SEIAlternativeTransfer alternative_transfer
Definition: h2645_sei.h:116
H2645SEIAlternativeTransfer
Definition: h2645_sei.h:74
H2645SEIAFD::active_format_description
uint8_t active_format_description
Definition: h2645_sei.h:40
H2645SEIFilmGrainCharacteristics
Definition: h2645_sei.h:86