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