FFmpeg coverage


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