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"
27 
28 #include "aom_film_grain.h"
29 #include "avcodec.h"
30 #include "bytestream.h"
31 #include "codec_id.h"
32 #include "get_bits.h"
33 #include "h2645_vui.h"
34 #include "sei.h"
35 
36 typedef struct H2645SEIA53Caption {
39 
40 typedef struct H2645SEIAFD {
41  int present;
43 } H2645SEIAFD;
44 
45 typedef struct HEVCSEIDynamicHDRPlus {
48 
49 typedef struct HEVCSEIDynamicHDRVivid {
52 
53 typedef struct H2645SEIUnregistered {
55  unsigned nb_buf_ref;
56  int x264_build; //< H.264 only
58 
59 typedef struct H2645SEIFramePacking {
60  int present;
62  int arrangement_cancel_flag; ///< is previous arrangement canceled, -1 if never received (currently H.264 only)
69 
71  int present;
73  int hflip, vflip;
75 
77  int present;
80 
82  int present;
84  uint16_t ambient_light_x;
85  uint16_t ambient_light_y;
87 
89  int present;
90  int model_id;
102  uint8_t num_model_values[3];
105  int16_t comp_model_value[3][256][6];
106  int repetition_period; //< H.264 only
107  int persistence_flag; //< HEVC only
109 
110 typedef struct H2645SEIMasteringDisplay {
111  int present;
112  uint16_t display_primaries[3][2];
113  uint16_t white_point[2];
114  uint32_t max_luminance;
115  uint32_t min_luminance;
117 
118 typedef struct H2645SEIContentLight {
119  int present;
123 
124 typedef struct H2645SEI {
138 } H2645SEI;
139 
140 enum {
143 };
144 
145 /**
146  * Decode a single SEI message.
147  *
148  * This function may either use gb or gbyte to decode the SEI message.
149  *
150  * @param[in, out] gb GetBitContext that needs to be at the start
151  * of the payload (i.e. after the payload_size bytes);
152  * it needs to be initially byte-aligned
153  * @param[in, out] gbyte a GetByteContext for the same data as gb
154  * @return < 0 on error, FF_H2645_SEI_MESSAGE_HANDLED if the SEI message
155  * has been handled or FF_H2645_SEI_MESSAGE_UNHANDLED if not.
156  */
158  enum AVCodecID codec_id, GetBitContext *gb,
159  GetByteContext *gbyte, void *logctx);
160 
162 
164 
166  enum AVCodecID codec_id,
167  AVCodecContext *avctx, const H2645VUI *vui,
168  unsigned bit_depth_luma, unsigned bit_depth_chroma,
169  int seed);
170 
172 
173 #endif /* AVCODEC_H2645_SEI_H */
H2645SEI::aom_film_grain
AVFilmGrainAFGS1Params aom_film_grain
Definition: h2645_sei.h:137
H2645SEIFilmGrainCharacteristics::persistence_flag
int persistence_flag
Definition: h2645_sei.h:107
H2645SEIFramePacking::arrangement_type
SEIFpaType arrangement_type
Definition: h2645_sei.h:63
H2645SEIAmbientViewingEnvironment::ambient_light_x
uint16_t ambient_light_x
Definition: h2645_sei.h:84
H2645SEIFramePacking
Definition: h2645_sei.h:59
H2645SEIContentLight::max_pic_average_light_level
uint16_t max_pic_average_light_level
Definition: h2645_sei.h:121
GetByteContext
Definition: bytestream.h:33
H2645SEIAFD
Definition: h2645_sei.h:40
H2645SEIMasteringDisplay::white_point
uint16_t white_point[2]
Definition: h2645_sei.h:113
H2645SEIFilmGrainCharacteristics::bit_depth_chroma
int bit_depth_chroma
Definition: h2645_sei.h:93
H2645SEI::afd
H2645SEIAFD afd
Definition: h2645_sei.h:126
H2645SEIMasteringDisplay::display_primaries
uint16_t display_primaries[3][2]
Definition: h2645_sei.h:112
H2645SEIA53Caption::buf_ref
AVBufferRef * buf_ref
Definition: h2645_sei.h:37
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:375
H2645SEIA53Caption
Definition: h2645_sei.h:36
H2645SEIMasteringDisplay
Definition: h2645_sei.h:110
H2645SEIAlternativeTransfer::preferred_transfer_characteristics
int preferred_transfer_characteristics
Definition: h2645_sei.h:78
H2645SEI::film_grain_characteristics
H2645SEIFilmGrainCharacteristics film_grain_characteristics
Definition: h2645_sei.h:133
H2645SEIDisplayOrientation
Definition: h2645_sei.h:70
H2645SEIFramePacking::present
int present
Definition: h2645_sei.h:60
H2645SEI::a53_caption
H2645SEIA53Caption a53_caption
Definition: h2645_sei.h:125
H2645SEI::dynamic_hdr_vivid
HEVCSEIDynamicHDRVivid dynamic_hdr_vivid
Definition: h2645_sei.h:128
H2645SEIFilmGrainCharacteristics::intensity_interval_upper_bound
uint8_t intensity_interval_upper_bound[3][256]
Definition: h2645_sei.h:104
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:463
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:134
film_grain_params.h
H2645SEIFilmGrainCharacteristics::intensity_interval_lower_bound
uint8_t intensity_interval_lower_bound[3][256]
Definition: h2645_sei.h:103
H2645SEIFramePacking::current_frame_is_frame0_flag
int current_frame_is_frame0_flag
Definition: h2645_sei.h:67
HEVCSEIDynamicHDRPlus::info
AVBufferRef * info
Definition: h2645_sei.h:46
codec_id.h
H2645SEIFilmGrainCharacteristics::matrix_coeffs
int matrix_coeffs
Definition: h2645_sei.h:97
H2645SEIFramePacking::arrangement_cancel_flag
int arrangement_cancel_flag
is previous arrangement canceled, -1 if never received (currently H.264 only)
Definition: h2645_sei.h:62
H2645SEIDisplayOrientation::anticlockwise_rotation
int anticlockwise_rotation
Definition: h2645_sei.h:72
s
#define s(width, name)
Definition: cbs_vp9.c:198
H2645SEIAmbientViewingEnvironment
Definition: h2645_sei.h:81
H2645SEIFilmGrainCharacteristics::log2_scale_factor
int log2_scale_factor
Definition: h2645_sei.h:99
SEIType
SEIType
Definition: sei.h:29
get_bits.h
ff_h2645_sei_reset
void ff_h2645_sei_reset(H2645SEI *s)
Definition: h2645_sei.c:866
codec_id
enum AVCodecID codec_id
Definition: vaapi_decode.c:387
FF_H2645_SEI_MESSAGE_UNHANDLED
@ FF_H2645_SEI_MESSAGE_UNHANDLED
Definition: h2645_sei.h:142
H2645SEIDisplayOrientation::hflip
int hflip
Definition: h2645_sei.h:73
H2645SEIContentLight::max_content_light_level
uint16_t max_content_light_level
Definition: h2645_sei.h:120
H2645SEIFilmGrainCharacteristics::color_primaries
int color_primaries
Definition: h2645_sei.h:95
H2645SEIFilmGrainCharacteristics::repetition_period
int repetition_period
Definition: h2645_sei.h:106
H2645SEIFilmGrainCharacteristics::model_id
int model_id
Definition: h2645_sei.h:90
sei.h
H2645SEIFilmGrainCharacteristics::comp_model_present_flag
int comp_model_present_flag[3]
Definition: h2645_sei.h:100
H2645SEI
Definition: h2645_sei.h:124
H2645VUI
Definition: h2645_vui.h:27
aom_film_grain.h
H2645SEIFilmGrainCharacteristics::num_intensity_intervals
uint16_t num_intensity_intervals[3]
Definition: h2645_sei.h:101
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:131
FF_H2645_SEI_MESSAGE_HANDLED
@ FF_H2645_SEI_MESSAGE_HANDLED
Definition: h2645_sei.h:141
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:92
H2645SEIFilmGrainCharacteristics::num_model_values
uint8_t num_model_values[3]
Definition: h2645_sei.h:102
H2645SEIAFD::present
int present
Definition: h2645_sei.h:41
H2645SEI::frame_packing
H2645SEIFramePacking frame_packing
Definition: h2645_sei.h:130
H2645SEIDisplayOrientation::vflip
int vflip
Definition: h2645_sei.h:73
H2645SEIFramePacking::arrangement_repetition_period
int arrangement_repetition_period
Definition: h2645_sei.h:64
H2645SEIFilmGrainCharacteristics::blending_mode_id
int blending_mode_id
Definition: h2645_sei.h:98
frame.h
buffer.h
H2645SEI::mastering_display
H2645SEIMasteringDisplay mastering_display
Definition: h2645_sei.h:135
H2645SEIDisplayOrientation::present
int present
Definition: h2645_sei.h:71
H2645SEIFilmGrainCharacteristics::transfer_characteristics
int transfer_characteristics
Definition: h2645_sei.h:96
HEVCSEIDynamicHDRPlus
Definition: h2645_sei.h:45
H2645SEI::content_light
H2645SEIContentLight content_light
Definition: h2645_sei.h:136
ff_h2645_sei_to_context
int ff_h2645_sei_to_context(AVCodecContext *avctx, H2645SEI *sei)
Definition: h2645_sei.c:860
H2645SEIUnregistered::x264_build
int x264_build
Definition: h2645_sei.h:56
H2645SEIFilmGrainCharacteristics::present
int present
Definition: h2645_sei.h:89
HEVCSEIDynamicHDRVivid::info
AVBufferRef * info
Definition: h2645_sei.h:50
H2645SEIFramePacking::arrangement_id
int arrangement_id
Definition: h2645_sei.h:61
H2645SEIFilmGrainCharacteristics::separate_colour_description_present_flag
int separate_colour_description_present_flag
Definition: h2645_sei.h:91
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:65
H2645SEIUnregistered
Definition: h2645_sei.h:53
h2645_vui.h
SEIFpaType
SEIFpaType
frame_packing_arrangement types.
Definition: sei.h:147
H2645SEI::unregistered
H2645SEIUnregistered unregistered
Definition: h2645_sei.h:129
AVCodecContext
main external API structure.
Definition: avcodec.h:445
ff_h2645_sei_ctx_replace
int ff_h2645_sei_ctx_replace(H2645SEI *dst, const H2645SEI *src)
Definition: h2645_sei.c:493
H2645SEIMasteringDisplay::max_luminance
uint32_t max_luminance
Definition: h2645_sei.h:114
HEVCSEIDynamicHDRVivid
Definition: h2645_sei.h:49
H2645SEIAmbientViewingEnvironment::ambient_illuminance
uint32_t ambient_illuminance
Definition: h2645_sei.h:83
H2645SEIAmbientViewingEnvironment::ambient_light_y
uint16_t ambient_light_y
Definition: h2645_sei.h:85
H2645SEIFramePacking::quincunx_sampling_flag
int quincunx_sampling_flag
Definition: h2645_sei.h:66
AVBufferRef
A reference to a data buffer.
Definition: buffer.h:82
H2645SEIAlternativeTransfer::present
int present
Definition: h2645_sei.h:77
H2645SEIContentLight::present
int present
Definition: h2645_sei.h:119
AVFilmGrainAFGS1Params
Definition: aom_film_grain.h:33
src
INIT_CLIP pixel * src
Definition: h264pred_template.c:418
H2645SEI::dynamic_hdr_plus
HEVCSEIDynamicHDRPlus dynamic_hdr_plus
Definition: h2645_sei.h:127
H2645SEIAmbientViewingEnvironment::present
int present
Definition: h2645_sei.h:82
H2645SEIFilmGrainCharacteristics::full_range
int full_range
Definition: h2645_sei.h:94
H2645SEIUnregistered::nb_buf_ref
unsigned nb_buf_ref
Definition: h2645_sei.h:55
bytestream.h
H2645SEIMasteringDisplay::min_luminance
uint32_t min_luminance
Definition: h2645_sei.h:115
H2645SEIContentLight
Definition: h2645_sei.h:118
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:668
H2645SEIFilmGrainCharacteristics::comp_model_value
int16_t comp_model_value[3][256][6]
Definition: h2645_sei.h:105
H2645SEIUnregistered::buf_ref
AVBufferRef ** buf_ref
Definition: h2645_sei.h:54
H2645SEIMasteringDisplay::present
int present
Definition: h2645_sei.h:111
H2645SEI::alternative_transfer
H2645SEIAlternativeTransfer alternative_transfer
Definition: h2645_sei.h:132
H2645SEIAlternativeTransfer
Definition: h2645_sei.h:76
H2645SEIAFD::active_format_description
uint8_t active_format_description
Definition: h2645_sei.h:42
H2645SEIFilmGrainCharacteristics
Definition: h2645_sei.h:88