digiKam
vps.h
Go to the documentation of this file.
1 /*
2  * H.265 video codec.
3  * Copyright (c) 2013-2014 struktur AG, Dirk Farin <farin@struktur.de>
4  *
5  * This file is part of libde265.
6  *
7  * libde265 is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Lesser General Public License as
9  * published by the Free Software Foundation, either version 3 of
10  * the License, or (at your option) any later version.
11  *
12  * libde265 is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with libde265. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef DE265_VPS_H
22 #define DE265_VPS_H
23 
24 #ifdef HAVE_CONFIG_H
25 #include <config.h>
26 #endif
27 
28 #ifdef HAVE_STDBOOL_H
29 #include <stdbool.h>
30 #endif
31 
32 #include "libde265/bitstream.h"
33 #include "libde265/de265.h"
34 #include "libde265/cabac.h"
35 
36 #include <vector>
37 
38 class error_queue;
39 
40 #define MAX_TEMPORAL_SUBLAYERS 8
41 
42 
48 };
49 
50 
51 class profile_data {
52 public:
53  void read(bitreader* reader);
54  void write(CABAC_encoder& writer) const;
55  void dump(bool general, FILE* fh) const;
56 
57  void set_defaults(enum profile_idc, int level_major, int level_minor);
58 
59  // --- profile ---
60 
61  char profile_present_flag; // always true for general profile
62 
63  char profile_space; // currently always 0
64  char tier_flag; // main tier or low tier (see Table A-66/A-67)
65  enum profile_idc profile_idc; // profile
66 
67  char profile_compatibility_flag[32]; // to which profile we are compatible
68 
73 
74 
75  // --- level ---
76 
77  char level_present_flag; // always true for general level
78  int level_idc; // level * 30
79 };
80 
81 
83 {
84 public:
85  void read(bitreader* reader, int max_sub_layers);
86  void write(CABAC_encoder& writer, int max_sub_layers) const;
87  void dump(int max_sub_layers, FILE* fh) const;
88 
90 
91  //bool sub_layer_profile_present[MAX_TEMPORAL_SUBLAYERS];
92  //bool sub_layer_level_present[MAX_TEMPORAL_SUBLAYERS];
93 
95 };
96 
97 
98 /*
99 struct bit_rate_pic_rate_info {
100  char bit_rate_info_present_flag[8];
101  char pic_rate_info_present_flag[8];
102 
103  int avg_bit_rate[8];
104  int max_bit_rate[8];
105 
106  char constant_pic_rate_idc[8];
107  int avg_pic_rate[8];
108 
109 };
110 
111 void read_bit_rate_pic_rate_info(bitreader* reader,
112  struct bit_rate_pic_rate_info* hdr,
113  int TempLevelLow,
114  int TempLevelHigh);
115 
116 void dump_bit_rate_pic_rate_info(struct bit_rate_pic_rate_info* hdr,
117  int TempLevelLow,
118  int TempLevelHigh);
119 */
120 
121 
122 typedef struct {
125  int vps_max_latency_increase; // 0 -> no limit, otherwise value is (x-1)
126 } layer_data;
127 
128 
130 {
131 public:
132  de265_error read(error_queue* errqueue, bitreader* reader);
133  de265_error write(error_queue* errqueue, CABAC_encoder& out) const;
134  void dump(int fd) const;
135 
136  void set_defaults(enum profile_idc profile, int level_major, int level_minor);
137 
139  int vps_max_layers; // [1;?] currently always 1
140  int vps_max_sub_layers; // [1;7] number of temporal sub-layers
141  int vps_temporal_id_nesting_flag; // indicate temporal up-switching always possible
143 
146 
147  uint8_t vps_max_layer_id; // max value for nuh_layer_id in NALs
148  int vps_num_layer_sets; // [1;1024], currently always 1
149 
150  std::vector<std::vector<char> > layer_id_included_flag; // max size = [1024][64]
151 
152 
153  // --- timing info ---
154 
157  uint32_t vps_time_scale;
160 
161  int vps_num_hrd_parameters; // currently [0;1]
162 
163  std::vector<uint16_t> hrd_layer_set_idx; // max size = 1024
164  std::vector<char> cprms_present_flag; // max size = 1024
165 
166 
167  // --- vps extension ---
168 
170 };
171 
172 
173 #endif
Definition: cabac.h:55
Definition: decctx.h:128
Definition: vps.h:51
char profile_present_flag
Definition: vps.h:61
char interlaced_source_flag
Definition: vps.h:70
enum profile_idc profile_idc
Definition: vps.h:65
char profile_compatibility_flag[32]
Definition: vps.h:67
void read(bitreader *reader)
int level_idc
Definition: vps.h:78
void write(CABAC_encoder &writer) const
void set_defaults(enum profile_idc, int level_major, int level_minor)
char progressive_source_flag
Definition: vps.h:69
char level_present_flag
Definition: vps.h:77
char non_packed_constraint_flag
Definition: vps.h:71
char frame_only_constraint_flag
Definition: vps.h:72
char profile_space
Definition: vps.h:63
char tier_flag
Definition: vps.h:64
void dump(bool general, FILE *fh) const
Definition: vps.h:83
profile_data sub_layer[MAX_TEMPORAL_SUBLAYERS]
Definition: vps.h:94
void dump(int max_sub_layers, FILE *fh) const
void write(CABAC_encoder &writer, int max_sub_layers) const
profile_data general
Definition: vps.h:89
void read(bitreader *reader, int max_sub_layers)
Definition: vps.h:130
void set_defaults(enum profile_idc profile, int level_major, int level_minor)
void dump(int fd) const
de265_error read(error_queue *errqueue, bitreader *reader)
std::vector< char > cprms_present_flag
Definition: vps.h:164
uint8_t vps_max_layer_id
Definition: vps.h:147
uint32_t vps_num_ticks_poc_diff_one
Definition: vps.h:159
int vps_max_layers
Definition: vps.h:139
layer_data layer[MAX_TEMPORAL_SUBLAYERS]
Definition: vps.h:145
char vps_timing_info_present_flag
Definition: vps.h:155
uint32_t vps_num_units_in_tick
Definition: vps.h:156
std::vector< uint16_t > hrd_layer_set_idx
Definition: vps.h:163
char vps_extension_flag
Definition: vps.h:169
int video_parameter_set_id
Definition: vps.h:138
int vps_sub_layer_ordering_info_present_flag
Definition: vps.h:144
char vps_poc_proportional_to_timing_flag
Definition: vps.h:158
int vps_num_hrd_parameters
Definition: vps.h:161
uint32_t vps_time_scale
Definition: vps.h:157
int vps_max_sub_layers
Definition: vps.h:140
int vps_temporal_id_nesting_flag
Definition: vps.h:141
std::vector< std::vector< char > > layer_id_included_flag
Definition: vps.h:150
de265_error write(error_queue *errqueue, CABAC_encoder &out) const
profile_tier_level profile_tier_level_
Definition: vps.h:142
int vps_num_layer_sets
Definition: vps.h:148
de265_error
Definition: de265.h:82
Definition: bitstream.h:39
Definition: vps.h:122
int vps_max_latency_increase
Definition: vps.h:125
int vps_max_num_reorder_pics
Definition: vps.h:124
int vps_max_dec_pic_buffering
Definition: vps.h:123
profile_idc
Definition: vps.h:43
@ Profile_MainStillPicture
Definition: vps.h:46
@ Profile_FormatRangeExtensions
Definition: vps.h:47
@ Profile_Main10
Definition: vps.h:45
@ Profile_Main
Definition: vps.h:44
#define MAX_TEMPORAL_SUBLAYERS
Definition: vps.h:40