Debian Codegraph @

gst-libs/gst/codecs/gsth265picture.h

raw symbols SCIP
1 /* GStreamer
2 * Copyright (C) 2019 Seungha Yang <[email protected]>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library 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 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20 #ifndef __GST_H265_PICTURE_H__
21 #define __GST_H265_PICTURE_H__
22
23 #ifndef GST_USE_UNSTABLE_API
24 #warning "The CODECs library is unstable API and may change in future."
25 #warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
26 #endif
27
28 #include <gst/gst.h>
29 #include <gst/codecs/codecs-prelude.h>
30 #include <gst/codecs/gstcodecpicture.h>
31 #include <gst/codecparsers/gsth265parser.h>
32 #include <gst/video/video.h>
33
34 G_BEGIN_DECLS
35
36 #define GST_TYPE_H265_PICTURE (gst_h265_picture_get_type())
37 #define GST_IS_H265_PICTURE(obj) (GST_IS_MINI_OBJECT_TYPE(obj, GST_TYPE_H265_PICTURE))
38 #define GST_H265_PICTURE(obj) ((GstH265Picture *)obj)
39 #define GST_H265_PICTURE_CAST(obj) (GST_H265_PICTURE(obj))
40
41 typedef struct _GstH265Slice GstH265Slice;
42 typedef struct _GstH265Picture GstH265Picture;
43
44 #define GST_H265_DPB_MAX_SIZE 16
45
46 struct _GstH265Slice
47 {
48 GstH265SliceHdr header;
49
50 /* parsed nal unit (doesn't take ownership of raw data) */
51 GstH265NalUnit nalu;
52
53 /*< private >*/
54 gboolean rap_pic_flag;
55 gboolean no_rasl_output_flag;
56 gboolean no_output_of_prior_pics_flag;
57 gboolean clear_dpb;
58 gboolean intra_pic_flag;
59 };
60
61 struct _GstH265Picture
62 {
63 /*< private >*/
64 GstCodecPicture parent;
65
66 GstH265SliceType type;
67
68 gint pic_order_cnt;
69 gint pic_order_cnt_msb;
70 gint pic_order_cnt_lsb;
71
72 guint32 pic_latency_cnt; /* PicLatencyCount */
73
74 gboolean output_flag;
75 gboolean NoRaslOutputFlag;
76 gboolean NoOutputOfPriorPicsFlag;
77 gboolean RapPicFlag; /* nalu type between 16 and 21 */
78 gboolean IntraPicFlag; /* Intra pic (only Intra slices) */
79
80 gboolean ref;
81 gboolean long_term;
82 gboolean needed_for_output;
83
84 /* from picture timing SEI */
85 GstH265SEIPicStructType pic_struct;
86 guint8 source_scan_type;
87 guint8 duplicate_flag;
88
89 GstVideoBufferFlags buffer_flags;
90 };
91
92 GST_CODECS_API
93 GType gst_h265_picture_get_type (void);
94
95 GST_CODECS_API
96 GstH265Picture * gst_h265_picture_new (void) G_GNUC_WARN_UNUSED_RESULT;
97
98 static inline GstH265Picture *
99 gst_h265_picture_ref (GstH265Picture * picture)
100 {
101 return (GstH265Picture *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (picture));
102 }
103
104 static inline void
105 gst_h265_picture_unref (GstH265Picture * picture)
106 {
107 gst_mini_object_unref (GST_MINI_OBJECT_CAST (picture));
108 }
109
110 static inline gboolean
111 gst_h265_picture_replace (GstH265Picture ** old_picture,
112 GstH265Picture * new_picture)
113 {
114 return gst_mini_object_replace ((GstMiniObject **) old_picture,
115 (GstMiniObject *) new_picture);
116 }
117
118 static inline void
119 gst_clear_h265_picture (GstH265Picture ** picture)
120 {
121 if (picture && *picture) {
122 gst_h265_picture_unref (*picture);
123 *picture = NULL;
124 }
125 }
126
127 static inline void
128 gst_h265_picture_set_user_data (GstH265Picture * picture, gpointer user_data,
129 GDestroyNotify notify)
130 {
131 gst_codec_picture_set_user_data (GST_CODEC_PICTURE (picture),
132 user_data, notify);
133 }
134
135 static inline gpointer
136 gst_h265_picture_get_user_data (GstH265Picture * picture)
137 {
138 return gst_codec_picture_get_user_data (GST_CODEC_PICTURE (picture));
139 }
140
141 static inline void
142 gst_h265_picture_set_discont_state (GstH265Picture * picture,
143 GstVideoCodecState * discont_state)
144 {
145 gst_codec_picture_set_discont_state (GST_CODEC_PICTURE (picture),
146 discont_state);
147 }
148
149 /*******************
150 * GstH265Dpb *
151 *******************/
152 typedef struct _GstH265Dpb GstH265Dpb;
153
154 GST_CODECS_API
155 GstH265Dpb * gst_h265_dpb_new (void);
156
157 GST_CODECS_API
158 void gst_h265_dpb_set_max_num_pics (GstH265Dpb * dpb,
159 gint max_num_pics);
160
161 GST_CODECS_API
162 gint gst_h265_dpb_get_max_num_pics (GstH265Dpb * dpb);
163
164 GST_CODECS_API
165 void gst_h265_dpb_free (GstH265Dpb * dpb);
166
167 GST_CODECS_API
168 void gst_h265_dpb_clear (GstH265Dpb * dpb);
169
170 GST_CODECS_API
171 void gst_h265_dpb_add (GstH265Dpb * dpb,
172 GstH265Picture * picture);
173
174 GST_CODECS_API
175 void gst_h265_dpb_delete_unused (GstH265Dpb * dpb);
176
177 GST_CODECS_API
178 gint gst_h265_dpb_num_ref_pictures (GstH265Dpb * dpb);
179
180 GST_CODECS_API
181 void gst_h265_dpb_mark_all_non_ref (GstH265Dpb * dpb);
182
183 GST_CODECS_API
184 GstH265Picture * gst_h265_dpb_get_ref_by_poc (GstH265Dpb * dpb,
185 gint poc) G_GNUC_WARN_UNUSED_RESULT;
186
187 GST_CODECS_API
188 GstH265Picture * gst_h265_dpb_get_ref_by_poc_lsb (GstH265Dpb * dpb,
189 gint poc_lsb) G_GNUC_WARN_UNUSED_RESULT;
190
191 GST_CODECS_API
192 GstH265Picture * gst_h265_dpb_get_short_ref_by_poc (GstH265Dpb * dpb,
193 gint poc) G_GNUC_WARN_UNUSED_RESULT;
194
195 GST_CODECS_API
196 GstH265Picture * gst_h265_dpb_get_long_ref_by_poc (GstH265Dpb * dpb,
197 gint poc) G_GNUC_WARN_UNUSED_RESULT;
198
199 GST_CODECS_API
200 GArray * gst_h265_dpb_get_pictures_all (GstH265Dpb * dpb) G_GNUC_WARN_UNUSED_RESULT;
201
202 GST_CODECS_API
203 GstH265Picture * gst_h265_dpb_get_picture (GstH265Dpb * dpb,
204 guint32 system_frame_number) G_GNUC_WARN_UNUSED_RESULT;
205
206 GST_CODECS_API
207 gint gst_h265_dpb_get_size (GstH265Dpb * dpb);
208
209 GST_CODECS_API
210 gboolean gst_h265_dpb_needs_bump (GstH265Dpb * dpb,
211 guint max_num_reorder_pics,
212 guint max_latency_increase,
213 guint max_dec_pic_buffering);
214
215 GST_CODECS_API
216 GstH265Picture * gst_h265_dpb_bump (GstH265Dpb * dpb,
217 gboolean drain) G_GNUC_WARN_UNUSED_RESULT;
218
219 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstH265Picture, gst_h265_picture_unref)
220
221 G_END_DECLS
222
223 #endif /* __GST_H265_PICTURE_H__ */