#ifndef DE265_PPS_H
#define DE265_PPS_H
#include "libde265/bitstream.h"
#include "libde265/sps.h"
#include <vector>
#define DE265_MAX_TILE_COLUMNS 10
#define DE265_MAX_TILE_ROWS 10
class decoder_context;
class pic_parameter_set;
class pps_range_extension
{
public:
pps_range_extension() { reset(); }
void reset();
bool read(bitreader*, decoder_context*, const pic_parameter_set*);
void dump(int fd) const;
uint8_t log2_max_transform_skip_block_size;
bool cross_component_prediction_enabled_flag;
bool chroma_qp_offset_list_enabled_flag;
uint8_t diff_cu_chroma_qp_offset_depth;
uint8_t chroma_qp_offset_list_len;
int8_t cb_qp_offset_list[6];
int8_t cr_qp_offset_list[6];
uint8_t log2_sao_offset_scale_luma;
uint8_t log2_sao_offset_scale_chroma;
};
class pic_parameter_set {
public:
pic_parameter_set();
~pic_parameter_set();
void reset() { set_defaults(); }
bool read(bitreader*, decoder_context*);
bool write(error_queue*, CABAC_encoder&,
const seq_parameter_set* sps);
bool is_tile_start_CTB(int ctbX,int ctbY) const;
void dump(int fd) const;
void set_defaults(enum PresetSet = Preset_Default);
bool pps_read;
const seq_parameter_set* sps;
char pic_parameter_set_id;
char seq_parameter_set_id;
char dependent_slice_segments_enabled_flag;
char sign_data_hiding_flag;
char cabac_init_present_flag;
char num_ref_idx_l0_default_active;
char num_ref_idx_l1_default_active;
int pic_init_qp;
char constrained_intra_pred_flag;
char transform_skip_enabled_flag;
char cu_qp_delta_enabled_flag;
int diff_cu_qp_delta_depth;
int pic_cb_qp_offset;
int pic_cr_qp_offset;
char pps_slice_chroma_qp_offsets_present_flag;
char weighted_pred_flag;
char weighted_bipred_flag;
char output_flag_present_flag;
char transquant_bypass_enable_flag;
char entropy_coding_sync_enabled_flag;
char tiles_enabled_flag;
int num_tile_columns;
int num_tile_rows;
char uniform_spacing_flag;
char loop_filter_across_tiles_enabled_flag;
char pps_loop_filter_across_slices_enabled_flag;
char deblocking_filter_control_present_flag;
char deblocking_filter_override_enabled_flag;
char pic_disable_deblocking_filter_flag;
int beta_offset;
int tc_offset;
char pic_scaling_list_data_present_flag;
struct scaling_list_data scaling_list;
char lists_modification_present_flag;
int log2_parallel_merge_level;
char num_extra_slice_header_bits;
char slice_segment_header_extension_present_flag;
char pps_extension_flag;
char pps_range_extension_flag;
char pps_multilayer_extension_flag;
char pps_extension_6bits;
pps_range_extension range_extension;
int Log2MinCuQpDeltaSize;
int Log2MinCuChromaQpOffsetSize;
int Log2MaxTransformSkipSize;
int colWidth [ DE265_MAX_TILE_COLUMNS ];
int rowHeight[ DE265_MAX_TILE_ROWS ];
int colBd [ DE265_MAX_TILE_COLUMNS+1 ];
int rowBd [ DE265_MAX_TILE_ROWS+1 ];
std::vector<int> CtbAddrRStoTS;
std::vector<int> CtbAddrTStoRS;
std::vector<int> TileId;
std::vector<int> TileIdRS;
std::vector<int> MinTbAddrZS;
void set_derived_values(const seq_parameter_set* sps);
};
#endif