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 H2645SEIMasteringDisplay {
109  int present;
110  uint16_t display_primaries[3][2];
111  uint16_t white_point[2];
112  uint32_t max_luminance;
113  uint32_t min_luminance;
115 
116 typedef struct H2645SEIContentLight {
117  int present;
121 
122 typedef struct H2645SEI {
135 } H2645SEI;
136 
137 enum {
140 };
141 
142 /**
143  * Decode a single SEI message.
144  *
145  * This function may either use gb or gbyte to decode the SEI message.
146  *
147  * @param[in, out] gb GetBitContext that needs to be at the start
148  * of the payload (i.e. after the payload_size bytes);
149  * it needs to be initially byte-aligned
150  * @param[in, out] gbyte a GetByteContext for the same data as gb
151  * @return < 0 on error, FF_H2645_SEI_MESSAGE_HANDLED if the SEI message
152  * has been handled or FF_H2645_SEI_MESSAGE_UNHANDLED if not.
153  */
155  enum AVCodecID codec_id, GetBitContext *gb,
156  GetByteContext *gbyte, void *logctx);
157 
159 
161 
163  enum AVCodecID codec_id,
164  AVCodecContext *avctx, const H2645VUI *vui,
165  unsigned bit_depth_luma, unsigned bit_depth_chroma,
166  int seed);
167 
168 #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
H2645SEIContentLight::max_pic_average_light_level
uint16_t max_pic_average_light_level
Definition: h2645_sei.h:119
GetByteContext
Definition: bytestream.h:33
H2645SEIAFD
Definition: h2645_sei.h:38
H2645SEIMasteringDisplay::white_point
uint16_t white_point[2]
Definition: h2645_sei.h:111
H2645SEIFilmGrainCharacteristics::bit_depth_chroma
int bit_depth_chroma
Definition: h2645_sei.h:91
H2645SEI::afd
H2645SEIAFD afd
Definition: h2645_sei.h:124
H2645SEIMasteringDisplay::display_primaries
uint16_t display_primaries[3][2]
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:340
H2645SEIA53Caption
Definition: h2645_sei.h:34
H2645SEIMasteringDisplay
Definition: h2645_sei.h:108
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:131
H2645SEIDisplayOrientation
Definition: h2645_sei.h:68
FF_H2645_SEI_MESSAGE_UNHANDLED
@ FF_H2645_SEI_MESSAGE_UNHANDLED
Definition: h2645_sei.h:139
H2645SEIFramePacking::present
int present
Definition: h2645_sei.h:58
H2645SEI::a53_caption
H2645SEIA53Caption a53_caption
Definition: h2645_sei.h:123
H2645SEI::dynamic_hdr_vivid
HEVCSEIDynamicHDRVivid dynamic_hdr_vivid
Definition: h2645_sei.h:126
H2645SEIFilmGrainCharacteristics::intensity_interval_upper_bound
uint8_t intensity_interval_upper_bound[3][256]
Definition: h2645_sei.h:102
GetBitContext
Definition: get_bits.h:108
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:442
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:132
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:198
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:768
codec_id
enum AVCodecID codec_id
Definition: vaapi_decode.c:389
frame
static AVFrame * frame
Definition: demux_decode.c:54
H2645SEIDisplayOrientation::hflip
int hflip
Definition: h2645_sei.h:71
H2645SEIContentLight::max_content_light_level
uint16_t max_content_light_level
Definition: h2645_sei.h:118
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
sei.h
H2645SEIFilmGrainCharacteristics::comp_model_present_flag
int comp_model_present_flag[3]
Definition: h2645_sei.h:98
H2645SEI
Definition: h2645_sei.h:122
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:824
H2645SEI::display_orientation
H2645SEIDisplayOrientation display_orientation
Definition: h2645_sei.h:129
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:128
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
H2645SEI::mastering_display
H2645SEIMasteringDisplay mastering_display
Definition: h2645_sei.h:133
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
H2645SEI::content_light
H2645SEIContentLight content_light
Definition: h2645_sei.h:134
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
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:127
AVCodecContext
main external API structure.
Definition: avcodec.h:441
ff_h2645_sei_ctx_replace
int ff_h2645_sei_ctx_replace(H2645SEI *dst, const H2645SEI *src)
Definition: h2645_sei.c:472
H2645SEIMasteringDisplay::max_luminance
uint32_t max_luminance
Definition: h2645_sei.h:112
FF_H2645_SEI_MESSAGE_HANDLED
@ FF_H2645_SEI_MESSAGE_HANDLED
Definition: h2645_sei.h:138
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
H2645SEIContentLight::present
int present
Definition: h2645_sei.h:117
src
INIT_CLIP pixel * src
Definition: h264pred_template.c:418
H2645SEI::dynamic_hdr_plus
HEVCSEIDynamicHDRPlus dynamic_hdr_plus
Definition: h2645_sei.h:125
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
H2645SEIMasteringDisplay::min_luminance
uint32_t min_luminance
Definition: h2645_sei.h:113
H2645SEIContentLight
Definition: h2645_sei.h:116
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:511
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
H2645SEIMasteringDisplay::present
int present
Definition: h2645_sei.h:109
H2645SEI::alternative_transfer
H2645SEIAlternativeTransfer alternative_transfer
Definition: h2645_sei.h:130
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