aarch64: Add assembly support for -fsanitize=hwaddress tagged globals.
[libav.git] / libavcodec / h264_sei.h
1 /*
2 * This file is part of Libav.
3 *
4 * Libav 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 * Libav 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 Libav; 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_H264_SEI_H
20 #define AVCODEC_H264_SEI_H
21
22 #include "get_bits.h"
23
24 /**
25 * SEI message types
26 */
27 typedef enum {
28 H264_SEI_TYPE_BUFFERING_PERIOD = 0, ///< buffering period (H.264, D.1.1)
29 H264_SEI_TYPE_PIC_TIMING = 1, ///< picture timing
30 H264_SEI_TYPE_FILLER_PAYLOAD = 3, ///< filler data
31 H264_SEI_TYPE_USER_DATA_REGISTERED = 4, ///< registered user data as specified by Rec. ITU-T T.35
32 H264_SEI_TYPE_USER_DATA_UNREGISTERED = 5, ///< unregistered user data
33 H264_SEI_TYPE_RECOVERY_POINT = 6, ///< recovery point (frame # to decoder sync)
34 H264_SEI_TYPE_FRAME_PACKING = 45, ///< frame packing arrangement
35 H264_SEI_TYPE_DISPLAY_ORIENTATION = 47, ///< display orientation
36 H264_SEI_TYPE_ALTERNATIVE_TRANSFER = 147, ///< alternative transfer
37 } H264_SEI_Type;
38
39 /**
40 * pic_struct in picture timing SEI message
41 */
42 typedef enum {
43 H264_SEI_PIC_STRUCT_FRAME = 0, ///< 0: %frame
44 H264_SEI_PIC_STRUCT_TOP_FIELD = 1, ///< 1: top field
45 H264_SEI_PIC_STRUCT_BOTTOM_FIELD = 2, ///< 2: bottom field
46 H264_SEI_PIC_STRUCT_TOP_BOTTOM = 3, ///< 3: top field, bottom field, in that order
47 H264_SEI_PIC_STRUCT_BOTTOM_TOP = 4, ///< 4: bottom field, top field, in that order
48 H264_SEI_PIC_STRUCT_TOP_BOTTOM_TOP = 5, ///< 5: top field, bottom field, top field repeated, in that order
49 H264_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM = 6, ///< 6: bottom field, top field, bottom field repeated, in that order
50 H264_SEI_PIC_STRUCT_FRAME_DOUBLING = 7, ///< 7: %frame doubling
51 H264_SEI_PIC_STRUCT_FRAME_TRIPLING = 8 ///< 8: %frame tripling
52 } H264_SEI_PicStructType;
53
54 typedef struct H264SEIPictureTiming {
55 int present;
56 H264_SEI_PicStructType pic_struct;
57
58 /**
59 * Bit set of clock types for fields/frames in picture timing SEI message.
60 * For each found ct_type, appropriate bit is set (e.g., bit 1 for
61 * interlaced).
62 */
63 int ct_type;
64
65 /**
66 * dpb_output_delay in picture timing SEI message, see H.264 C.2.2
67 */
68 int dpb_output_delay;
69
70 /**
71 * cpb_removal_delay in picture timing SEI message, see H.264 C.1.2
72 */
73 int cpb_removal_delay;
74 } H264SEIPictureTiming;
75
76 typedef struct H264SEIAFD {
77 int present;
78 uint8_t active_format_description;
79 } H264SEIAFD;
80
81 typedef struct H264SEIA53Caption {
82 int a53_caption_size;
83 uint8_t *a53_caption;
84 } H264SEIA53Caption;
85
86 typedef struct H264SEIUnregistered {
87 int x264_build;
88 } H264SEIUnregistered;
89
90 typedef struct H264SEIRecoveryPoint {
91 /**
92 * recovery_frame_cnt
93 *
94 * Set to -1 if no recovery point SEI message found or to number of frames
95 * before playback synchronizes. Frames having recovery point are key
96 * frames.
97 */
98 int recovery_frame_cnt;
99 } H264SEIRecoveryPoint;
100
101 typedef struct H264SEIBufferingPeriod {
102 int present; ///< Buffering period SEI flag
103 int initial_cpb_removal_delay[32]; ///< Initial timestamps for CPBs
104 } H264SEIBufferingPeriod;
105
106 typedef struct H264SEIFramePacking {
107 int present;
108 int arrangement_type;
109 int content_interpretation_type;
110 int quincunx_subsampling;
111 int current_frame_is_frame0_flag;
112 } H264SEIFramePacking;
113
114 typedef struct H264SEIDisplayOrientation {
115 int present;
116 int anticlockwise_rotation;
117 int hflip, vflip;
118 } H264SEIDisplayOrientation;
119
120 typedef struct H264SEIAlternativeTransfer {
121 int present;
122 int preferred_transfer_characteristics;
123 } H264SEIAlternativeTransfer;
124
125 typedef struct H264SEIContext {
126 H264SEIPictureTiming picture_timing;
127 H264SEIAFD afd;
128 H264SEIA53Caption a53_caption;
129 H264SEIUnregistered unregistered;
130 H264SEIRecoveryPoint recovery_point;
131 H264SEIBufferingPeriod buffering_period;
132 H264SEIFramePacking frame_packing;
133 H264SEIDisplayOrientation display_orientation;
134 H264SEIAlternativeTransfer alternative_transfer;
135 } H264SEIContext;
136
137 struct H264ParamSets;
138
139 int ff_h264_sei_decode(H264SEIContext *h, GetBitContext *gb,
140 const struct H264ParamSets *ps, void *logctx);
141
142 /**
143 * Reset SEI values at the beginning of the frame.
144 */
145 void ff_h264_sei_uninit(H264SEIContext *h);
146
147 #endif /* AVCODEC_H264_SEI_H */