/work/libde265/libde265/pps.h
Line | Count | Source |
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_PPS_H |
22 | | #define DE265_PPS_H |
23 | | |
24 | | #include "libde265/bitstream.h" |
25 | | #include "libde265/sps.h" // for scaling list only |
26 | | |
27 | | #include <vector> |
28 | | #include <memory> |
29 | | |
30 | | constexpr int DE265_MAX_TILE_COLUMNS = 10; |
31 | | constexpr int DE265_MAX_TILE_ROWS = 10; |
32 | | |
33 | | class decoder_context; |
34 | | class pic_parameter_set; |
35 | | |
36 | | |
37 | | class pps_range_extension |
38 | | { |
39 | | public: |
40 | 12 | pps_range_extension() { reset(); } |
41 | | |
42 | | void reset(); |
43 | | |
44 | | bool read(bitreader*, decoder_context*, const pic_parameter_set*); |
45 | | void dump(int fd) const; |
46 | | |
47 | | uint8_t log2_max_transform_skip_block_size; |
48 | | bool cross_component_prediction_enabled_flag; |
49 | | bool chroma_qp_offset_list_enabled_flag; |
50 | | uint8_t diff_cu_chroma_qp_offset_depth; |
51 | | uint8_t chroma_qp_offset_list_len; |
52 | | int8_t cb_qp_offset_list[6]; |
53 | | int8_t cr_qp_offset_list[6]; |
54 | | uint8_t log2_sao_offset_scale_luma; |
55 | | uint8_t log2_sao_offset_scale_chroma; |
56 | | }; |
57 | | |
58 | | |
59 | | class pic_parameter_set { |
60 | | public: |
61 | | pic_parameter_set(); |
62 | | ~pic_parameter_set(); |
63 | | |
64 | 24 | void reset() { set_defaults(); } |
65 | | bool read(bitreader*, decoder_context*); |
66 | | bool write(error_queue*, CABAC_encoder&, |
67 | | const seq_parameter_set* sps); |
68 | | |
69 | | bool is_tile_start_CTB(int ctbX,int ctbY) const; |
70 | | void dump(int fd) const; |
71 | | |
72 | | |
73 | | void set_defaults(enum PresetSet = Preset_Default); |
74 | | |
75 | | bool pps_read; // whether this pps has been read from bitstream |
76 | | std::shared_ptr<const seq_parameter_set> sps; |
77 | | |
78 | | |
79 | | uint8_t pic_parameter_set_id; |
80 | | uint8_t seq_parameter_set_id; |
81 | | bool dependent_slice_segments_enabled_flag; |
82 | | bool sign_data_hiding_flag; |
83 | | bool cabac_init_present_flag; |
84 | | uint8_t num_ref_idx_l0_default_active; // [1;16] |
85 | | uint8_t num_ref_idx_l1_default_active; // [1;16] |
86 | | |
87 | | int pic_init_qp; |
88 | | bool constrained_intra_pred_flag; |
89 | | bool transform_skip_enabled_flag; |
90 | | |
91 | | // --- QP --- |
92 | | |
93 | | bool cu_qp_delta_enabled_flag; |
94 | | uint8_t diff_cu_qp_delta_depth; // [ 0 ; log2_diff_max_min_luma_coding_block_size ] |
95 | | |
96 | | int pic_cb_qp_offset; |
97 | | int pic_cr_qp_offset; |
98 | | bool pps_slice_chroma_qp_offsets_present_flag; |
99 | | |
100 | | |
101 | | bool weighted_pred_flag; |
102 | | bool weighted_bipred_flag; |
103 | | bool output_flag_present_flag; |
104 | | bool transquant_bypass_enable_flag; |
105 | | bool entropy_coding_sync_enabled_flag; |
106 | | |
107 | | |
108 | | // --- tiles --- |
109 | | |
110 | | bool tiles_enabled_flag; |
111 | | uint8_t num_tile_columns; // [1;PicWidthInCtbsY] max DE265_MAX_TILE_COLUMNS |
112 | | uint8_t num_tile_rows; // [1;PicHeightInCtbsY] max DE265_MAX_TILE_ROWS |
113 | | bool uniform_spacing_flag; |
114 | | |
115 | | |
116 | | // --- --- |
117 | | |
118 | | bool loop_filter_across_tiles_enabled_flag; |
119 | | bool pps_loop_filter_across_slices_enabled_flag; |
120 | | bool deblocking_filter_control_present_flag; |
121 | | |
122 | | bool deblocking_filter_override_enabled_flag; |
123 | | bool pic_disable_deblocking_filter_flag; |
124 | | |
125 | | int8_t beta_offset; // [-12;12] |
126 | | int8_t tc_offset; // [-12;12] |
127 | | |
128 | | bool pic_scaling_list_data_present_flag; |
129 | | scaling_list_data scaling_list; // contains valid data if sps->scaling_list_enabled_flag set |
130 | | |
131 | | bool lists_modification_present_flag; |
132 | | uint8_t log2_parallel_merge_level; // [2 ; log2(max CB size)] |
133 | | uint8_t num_extra_slice_header_bits; |
134 | | bool slice_segment_header_extension_present_flag; |
135 | | bool pps_extension_flag; |
136 | | bool pps_range_extension_flag; |
137 | | bool pps_multilayer_extension_flag; |
138 | | uint8_t pps_extension_6bits; |
139 | | |
140 | | pps_range_extension range_extension; |
141 | | |
142 | | |
143 | | // --- derived values --- |
144 | | |
145 | | int Log2MinCuQpDeltaSize; |
146 | | int Log2MinCuChromaQpOffsetSize; |
147 | | int Log2MaxTransformSkipSize; |
148 | | |
149 | | uint16_t colWidth [ DE265_MAX_TILE_COLUMNS ]; |
150 | | uint16_t rowHeight[ DE265_MAX_TILE_ROWS ]; |
151 | | uint16_t colBd [ DE265_MAX_TILE_COLUMNS+1 ]; |
152 | | uint16_t rowBd [ DE265_MAX_TILE_ROWS+1 ]; |
153 | | |
154 | | std::vector<uint32_t> CtbAddrRStoTS; // #CTBs |
155 | | std::vector<uint32_t> CtbAddrTStoRS; // #CTBs |
156 | | std::vector<uint32_t> TileId; // #CTBs // index in tile-scan order |
157 | | std::vector<uint32_t> TileIdRS; // #CTBs // index in raster-scan order |
158 | | std::vector<uint32_t> MinTbAddrZS; // #TBs [x + y*PicWidthInTbsY] |
159 | | |
160 | | void set_derived_values(const seq_parameter_set* sps); |
161 | | }; |
162 | | |
163 | | #endif |