#ifndef DE265_VPS_H
#define DE265_VPS_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef HAVE_STDBOOL_H
#include <stdbool.h>
#endif
#include "libde265/bitstream.h"
#include "libde265/de265.h"
#include "libde265/cabac.h"
#include <vector>
class error_queue;
#define MAX_TEMPORAL_SUBLAYERS 8
enum profile_idc {
Profile_Main = 1,
Profile_Main10 = 2,
Profile_MainStillPicture = 3,
Profile_FormatRangeExtensions = 4
};
class profile_data {
public:
void read(bitreader* reader);
void write(CABAC_encoder& writer) const;
void dump(bool general, FILE* fh) const;
void set_defaults(enum profile_idc, int level_major, int level_minor);
char profile_present_flag;
char profile_space;
char tier_flag;
enum profile_idc profile_idc;
char profile_compatibility_flag[32];
char progressive_source_flag;
char interlaced_source_flag;
char non_packed_constraint_flag;
char frame_only_constraint_flag;
char level_present_flag;
int level_idc;
};
class profile_tier_level
{
public:
void read(bitreader* reader, int max_sub_layers);
void write(CABAC_encoder& writer, int max_sub_layers) const;
void dump(int max_sub_layers, FILE* fh) const;
profile_data general;
profile_data sub_layer[MAX_TEMPORAL_SUBLAYERS];
};
typedef struct {
int vps_max_dec_pic_buffering;
int vps_max_num_reorder_pics;
int vps_max_latency_increase;
} layer_data;
class video_parameter_set
{
public:
de265_error read(error_queue* errqueue, bitreader* reader);
de265_error write(error_queue* errqueue, CABAC_encoder& out) const;
void dump(int fd) const;
void set_defaults(enum profile_idc profile, int level_major, int level_minor);
int video_parameter_set_id;
int vps_max_layers;
int vps_max_sub_layers;
int vps_temporal_id_nesting_flag;
profile_tier_level profile_tier_level_;
int vps_sub_layer_ordering_info_present_flag;
layer_data layer[MAX_TEMPORAL_SUBLAYERS];
uint8_t vps_max_layer_id;
int vps_num_layer_sets;
std::vector<std::vector<char> > layer_id_included_flag;
char vps_timing_info_present_flag;
uint32_t vps_num_units_in_tick;
uint32_t vps_time_scale;
char vps_poc_proportional_to_timing_flag;
uint32_t vps_num_ticks_poc_diff_one;
int vps_num_hrd_parameters;
std::vector<uint16_t> hrd_layer_set_idx;
std::vector<char> cprms_present_flag;
char vps_extension_flag;
};
#endif