avcodec/aacdec_fixed: fix invalid shift in predict()
[ffmpeg.git] / libavcodec / hevc_sei.h
1 /*
2  * HEVC Supplementary Enhancement Information messages
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20
21 #ifndef AVCODEC_HEVC_SEI_H
22 #define AVCODEC_HEVC_SEI_H
23
24 #include <stdint.h>
25
26 #include "libavutil/md5.h"
27
28 #include "get_bits.h"
29
30 /**
31  * SEI message types
32  */
33 typedef enum {
34     HEVC_SEI_TYPE_BUFFERING_PERIOD                     = 0,
35     HEVC_SEI_TYPE_PICTURE_TIMING                       = 1,
36     HEVC_SEI_TYPE_PAN_SCAN_RECT                        = 2,
37     HEVC_SEI_TYPE_FILLER_PAYLOAD                       = 3,
38     HEVC_SEI_TYPE_USER_DATA_REGISTERED_ITU_T_T35       = 4,
39     HEVC_SEI_TYPE_USER_DATA_UNREGISTERED               = 5,
40     HEVC_SEI_TYPE_RECOVERY_POINT                       = 6,
41     HEVC_SEI_TYPE_SCENE_INFO                           = 9,
42     HEVC_SEI_TYPE_FULL_FRAME_SNAPSHOT                  = 15,
43     HEVC_SEI_TYPE_PROGRESSIVE_REFINEMENT_SEGMENT_START = 16,
44     HEVC_SEI_TYPE_PROGRESSIVE_REFINEMENT_SEGMENT_END   = 17,
45     HEVC_SEI_TYPE_FILM_GRAIN_CHARACTERISTICS           = 19,
46     HEVC_SEI_TYPE_POST_FILTER_HINT                     = 22,
47     HEVC_SEI_TYPE_TONE_MAPPING_INFO                    = 23,
48     HEVC_SEI_TYPE_FRAME_PACKING                        = 45,
49     HEVC_SEI_TYPE_DISPLAY_ORIENTATION                  = 47,
50     HEVC_SEI_TYPE_SOP_DESCRIPTION                      = 128,
51     HEVC_SEI_TYPE_ACTIVE_PARAMETER_SETS                = 129,
52     HEVC_SEI_TYPE_DECODING_UNIT_INFO                   = 130,
53     HEVC_SEI_TYPE_TEMPORAL_LEVEL0_INDEX                = 131,
54     HEVC_SEI_TYPE_DECODED_PICTURE_HASH                 = 132,
55     HEVC_SEI_TYPE_SCALABLE_NESTING                     = 133,
56     HEVC_SEI_TYPE_REGION_REFRESH_INFO                  = 134,
57     HEVC_SEI_TYPE_MASTERING_DISPLAY_INFO               = 137,
58     HEVC_SEI_TYPE_CONTENT_LIGHT_LEVEL_INFO             = 144,
59     HEVC_SEI_TYPE_ALTERNATIVE_TRANSFER_CHARACTERISTICS = 147,
60 } HEVC_SEI_Type;
61
62 typedef struct HEVCSEIPictureHash {
63     struct AVMD5 *md5_ctx;
64     uint8_t       md5[3][16];
65     uint8_t is_md5;
66 } HEVCSEIPictureHash;
67
68 typedef struct HEVCSEIFramePacking {
69     int present;
70     int arrangement_type;
71     int content_interpretation_type;
72     int quincunx_subsampling;
73 } HEVCSEIFramePacking;
74
75 typedef struct HEVCSEIDisplayOrientation {
76     int present;
77     int anticlockwise_rotation;
78     int hflip, vflip;
79 } HEVCSEIDisplayOrientation;
80
81 typedef struct HEVCSEIPictureTiming {
82     int picture_struct;
83 } HEVCSEIPictureTiming;
84
85 typedef struct HEVCSEIA53Caption {
86     int a53_caption_size;
87     uint8_t *a53_caption;
88 } HEVCSEIA53Caption;
89
90 typedef struct HEVCSEIMasteringDisplay {
91     int present;
92     uint16_t display_primaries[3][2];
93     uint16_t white_point[2];
94     uint32_t max_luminance;
95     uint32_t min_luminance;
96 } HEVCSEIMasteringDisplay;
97
98 typedef struct HEVCSEIContentLight {
99     int present;
100     uint16_t max_content_light_level;
101     uint16_t max_pic_average_light_level;
102 } HEVCSEIContentLight;
103
104 typedef struct HEVCSEIAlternativeTransfer {
105     int present;
106     int preferred_transfer_characteristics;
107 } HEVCSEIAlternativeTransfer;
108
109 typedef struct HEVCSEIContext {
110     HEVCSEIPictureHash picture_hash;
111     HEVCSEIFramePacking frame_packing;
112     HEVCSEIDisplayOrientation display_orientation;
113     HEVCSEIPictureTiming picture_timing;
114     HEVCSEIA53Caption a53_caption;
115     HEVCSEIMasteringDisplay mastering_display;
116     HEVCSEIContentLight content_light;
117     int active_seq_parameter_set_id;
118     HEVCSEIAlternativeTransfer alternative_transfer;
119 } HEVCSEIContext;
120
121 struct HEVCParamSets;
122
123 int ff_hevc_decode_nal_sei(GetBitContext *gb, void *logctx, HEVCSEIContext *s,
124                            const struct HEVCParamSets *ps, int type);
125
126 /**
127  * Reset SEI values that are stored on the Context.
128  * e.g. Caption data that was extracted during NAL
129  * parsing.
130  *
131  * @param s HEVCContext.
132  */
133 void ff_hevc_reset_sei(HEVCSEIContext *s);
134
135 #endif /* AVCODEC_HEVC_SEI_H */