FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/hevc_sei.h
Date: 2023-01-27 00:32:08
Exec Total Coverage
Lines: 3 3 100.0%
Functions: 1 1 100.0%
Branches: 0 0 -%

Line Branch Exec Source
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/buffer.h"
27
28 #include "get_bits.h"
29 #include "hevc.h"
30 #include "h2645_sei.h"
31 #include "sei.h"
32
33
34 typedef enum {
35 HEVC_SEI_PIC_STRUCT_FRAME_DOUBLING = 7,
36 HEVC_SEI_PIC_STRUCT_FRAME_TRIPLING = 8
37 } HEVC_SEI_PicStructType;
38
39 typedef struct HEVCSEIPictureHash {
40 uint8_t md5[3][16];
41 uint8_t is_md5;
42 } HEVCSEIPictureHash;
43
44 typedef struct HEVCSEIFramePacking {
45 int present;
46 int arrangement_type;
47 int content_interpretation_type;
48 int quincunx_subsampling;
49 int current_frame_is_frame0_flag;
50 } HEVCSEIFramePacking;
51
52 typedef struct HEVCSEIPictureTiming {
53 int picture_struct;
54 } HEVCSEIPictureTiming;
55
56 typedef struct HEVCSEIMasteringDisplay {
57 int present;
58 uint16_t display_primaries[3][2];
59 uint16_t white_point[2];
60 uint32_t max_luminance;
61 uint32_t min_luminance;
62 } HEVCSEIMasteringDisplay;
63
64 typedef struct HEVCSEIContentLight {
65 int present;
66 uint16_t max_content_light_level;
67 uint16_t max_pic_average_light_level;
68 } HEVCSEIContentLight;
69
70 typedef struct HEVCSEIAlternativeTransfer {
71 int present;
72 int preferred_transfer_characteristics;
73 } HEVCSEIAlternativeTransfer;
74
75 typedef struct HEVCSEITimeCode {
76 int present;
77 uint8_t num_clock_ts;
78 uint8_t clock_timestamp_flag[3];
79 uint8_t units_field_based_flag[3];
80 uint8_t counting_type[3];
81 uint8_t full_timestamp_flag[3];
82 uint8_t discontinuity_flag[3];
83 uint8_t cnt_dropped_flag[3];
84 uint16_t n_frames[3];
85 uint8_t seconds_value[3];
86 uint8_t minutes_value[3];
87 uint8_t hours_value[3];
88 uint8_t seconds_flag[3];
89 uint8_t minutes_flag[3];
90 uint8_t hours_flag[3];
91 uint8_t time_offset_length[3];
92 int32_t time_offset_value[3];
93 } HEVCSEITimeCode;
94
95 typedef struct HEVCSEI {
96 H2645SEI common;
97 HEVCSEIPictureHash picture_hash;
98 HEVCSEIPictureTiming picture_timing;
99 HEVCSEIMasteringDisplay mastering_display;
100 HEVCSEIContentLight content_light;
101 int active_seq_parameter_set_id;
102 HEVCSEITimeCode timecode;
103 } HEVCSEI;
104
105 struct HEVCParamSets;
106
107 int ff_hevc_decode_nal_sei(GetBitContext *gb, void *logctx, HEVCSEI *s,
108 const struct HEVCParamSets *ps, enum HEVCNALUnitType type);
109
110 static inline int ff_hevc_sei_ctx_replace(HEVCSEI *dst, const HEVCSEI *src)
111 {
112 return ff_h2645_sei_ctx_replace(&dst->common, &src->common);
113 }
114
115 /**
116 * Reset SEI values that are stored on the Context.
117 * e.g. Caption data that was extracted during NAL
118 * parsing.
119 *
120 * @param sei HEVCSEI.
121 */
122 12513 static inline void ff_hevc_reset_sei(HEVCSEI *sei)
123 {
124 12513 ff_h2645_sei_reset(&sei->common);
125 12513 }
126
127 #endif /* AVCODEC_HEVC_SEI_H */
128