|
0 |
Description: Don't update sps if they are only repeated
|
|
1 |
Origin: https://github.com/strukturag/libde265/pull/372
|
|
2 |
From 51f07f132f29832e025a8b913b61cbd20257c5fc Mon Sep 17 00:00:00 2001
|
|
3 |
From: Tobias Frost <tobi@debian.org>
|
|
4 |
Date: Fri, 13 Jan 2023 12:22:45 +0100
|
|
5 |
Subject: [PATCH] Don't update sps if they are only repeated
|
|
6 |
|
|
7 |
This is an attempt to improve the mitigations from #365 and #366 and picks up an idea I described at #345:
|
|
8 |
|
|
9 |
> One way would be just to look at the pointers of the SPS (fast and easy, but
|
|
10 |
> may reject more than required), or investigate if the SPS used for the image
|
|
11 |
> generations are "compatible".
|
|
12 |
|
|
13 |
This changes do exactly this: It (very conservativly) checks if the old and new sps have
|
|
14 |
identical information -- except the reference picture set, which I believe is supposed
|
|
15 |
to be updated by new sps'). If they are basically identical, the old sps will be
|
|
16 |
used instead of the new one, (of course, reference image set is updated from the new one)
|
|
17 |
|
|
18 |
I'm using standalone operator== and helper functions to avoid changing ABI of the library;
|
|
19 |
if an ABI bump would be done, of course this should go to the respective classes.
|
|
20 |
---
|
|
21 |
libde265/decctx.cc | 273 +++++++++++++++++++++++++++++++++++++++++++++
|
|
22 |
libde265/sps.cc | 6 +
|
|
23 |
2 files changed, 279 insertions(+)
|
|
24 |
|
|
25 |
diff --git a/libde265/decctx.cc b/libde265/decctx.cc
|
|
26 |
index 6701725f..0000b25d 100644
|
|
27 |
--- a/libde265/decctx.cc
|
|
28 |
+++ b/libde265/decctx.cc
|
|
29 |
@@ -545,6 +545,263 @@ de265_error decoder_context::read_vps_NAL(bitreader& reader)
|
|
30 |
return DE265_OK;
|
|
31 |
}
|
|
32 |
|
|
33 |
+// implemented as freestanding functions to avoid changing API
|
|
34 |
+
|
|
35 |
+bool operator==(const profile_data &lhs, const profile_data &rhs) {
|
|
36 |
+ if(&lhs == &rhs) return true;
|
|
37 |
+ if(lhs.profile_present_flag != rhs.profile_present_flag ) return false;
|
|
38 |
+ if(lhs.profile_present_flag) {
|
|
39 |
+ if(lhs.profile_space != rhs.profile_space ) return false;
|
|
40 |
+ if(lhs.tier_flag != rhs.tier_flag ) return false;
|
|
41 |
+ if(lhs.profile_idc != rhs.profile_idc ) return false;
|
|
42 |
+
|
|
43 |
+ if(memcmp(lhs.profile_compatibility_flag, rhs.profile_compatibility_flag, sizeof(rhs.profile_compatibility_flag)) ) return false;
|
|
44 |
+
|
|
45 |
+ if(lhs.progressive_source_flag != rhs.progressive_source_flag ) return false;
|
|
46 |
+ if(lhs.interlaced_source_flag != rhs.interlaced_source_flag ) return false;
|
|
47 |
+ if(lhs.non_packed_constraint_flag != rhs.non_packed_constraint_flag ) return false;
|
|
48 |
+ if(lhs.frame_only_constraint_flag != rhs.frame_only_constraint_flag ) return false;
|
|
49 |
+ }
|
|
50 |
+
|
|
51 |
+ if(lhs.level_present_flag != rhs.level_present_flag) return false;
|
|
52 |
+ if(lhs.level_present_flag && lhs.level_idc != rhs.level_idc ) return false;
|
|
53 |
+
|
|
54 |
+ return true;
|
|
55 |
+}
|
|
56 |
+
|
|
57 |
+bool operator!=(const profile_data &lhs, const profile_data &rhs) {
|
|
58 |
+ if(&lhs == &rhs) return false;
|
|
59 |
+ return (!(lhs==rhs));
|
|
60 |
+}
|
|
61 |
+
|
|
62 |
+// class does not store max_sub_layers, so operator == cannot be done.
|
|
63 |
+bool isEqual(const profile_tier_level &lhs , const profile_tier_level &rhs, int sps_max_sub_layers ) {
|
|
64 |
+ if(&lhs == &rhs) return true;
|
|
65 |
+
|
|
66 |
+ if(lhs.general != rhs.general ) return false;
|
|
67 |
+ for(int i = 0 ; i < sps_max_sub_layers; i++ ) {
|
|
68 |
+ if(lhs.sub_layer[i] != rhs.sub_layer[i]) return false;
|
|
69 |
+ }
|
|
70 |
+ return true;
|
|
71 |
+}
|
|
72 |
+
|
|
73 |
+bool isEqual(const video_usability_information &lhs, const video_usability_information &rhs, const seq_parameter_set &sps) {
|
|
74 |
+ if(&lhs == &rhs) return true;
|
|
75 |
+
|
|
76 |
+ // not seen yet if(lhs.nal_hrd_parameters_present_flag != rhs.nal_hrd_parameters_present_flag ) return false;
|
|
77 |
+
|
|
78 |
+ // populated by video_usability_information::read()
|
|
79 |
+ if(lhs.aspect_ratio_info_present_flag != rhs.aspect_ratio_info_present_flag ) return false;
|
|
80 |
+ if(lhs.aspect_ratio_info_present_flag) {
|
|
81 |
+ if(lhs.sar_width != rhs.sar_width ) return false;
|
|
82 |
+ if(lhs.sar_height != rhs.sar_height ) return false;
|
|
83 |
+ }
|
|
84 |
+
|
|
85 |
+ if(lhs.overscan_info_present_flag != rhs.overscan_info_present_flag ) return false;
|
|
86 |
+ if(lhs.overscan_info_present_flag) {
|
|
87 |
+ if(lhs.overscan_appropriate_flag != rhs.overscan_appropriate_flag ) return false;
|
|
88 |
+ }
|
|
89 |
+
|
|
90 |
+ if(lhs.video_signal_type_present_flag != rhs.video_signal_type_present_flag ) return false;
|
|
91 |
+ if(lhs.video_signal_type_present_flag) {
|
|
92 |
+ if(lhs.video_format != rhs.video_format ) return false;
|
|
93 |
+ if(lhs.video_full_range_flag != rhs.video_full_range_flag) return false;
|
|
94 |
+ if(lhs.colour_description_present_flag != rhs.colour_description_present_flag) return false;
|
|
95 |
+ if(lhs.colour_primaries != rhs.colour_primaries ) return false;
|
|
96 |
+ if(lhs.transfer_characteristics != rhs.transfer_characteristics ) return false;
|
|
97 |
+ if(lhs.matrix_coeffs != rhs.matrix_coeffs ) return false;
|
|
98 |
+ }
|
|
99 |
+
|
|
100 |
+ if(lhs.chroma_loc_info_present_flag != rhs.chroma_loc_info_present_flag ) return false;
|
|
101 |
+ if(lhs.chroma_loc_info_present_flag) {
|
|
102 |
+ if(lhs.chroma_sample_loc_type_top_field != rhs.chroma_sample_loc_type_top_field ) return false;
|
|
103 |
+ if(lhs.chroma_sample_loc_type_bottom_field != rhs.chroma_sample_loc_type_bottom_field ) return false;
|
|
104 |
+ }
|
|
105 |
+ if(lhs.neutral_chroma_indication_flag != rhs.neutral_chroma_indication_flag ) return false;
|
|
106 |
+ if(lhs.field_seq_flag != rhs.field_seq_flag ) return false;
|
|
107 |
+ if(lhs.frame_field_info_present_flag != rhs.frame_field_info_present_flag ) return false;
|
|
108 |
+
|
|
109 |
+ if(lhs.default_display_window_flag != rhs.default_display_window_flag ) return false;
|
|
110 |
+ if(lhs.default_display_window_flag) {
|
|
111 |
+ if(lhs.def_disp_win_left_offset != rhs.def_disp_win_left_offset ) return false;
|
|
112 |
+ if(lhs.def_disp_win_right_offset != rhs.def_disp_win_right_offset ) return false;
|
|
113 |
+ if(lhs.def_disp_win_top_offset != rhs.def_disp_win_top_offset ) return false;
|
|
114 |
+ if(lhs.def_disp_win_bottom_offset != rhs.def_disp_win_bottom_offset ) return false;
|
|
115 |
+ }
|
|
116 |
+
|
|
117 |
+ if(lhs.vui_timing_info_present_flag != rhs.vui_timing_info_present_flag ) return false;
|
|
118 |
+ if(lhs.vui_timing_info_present_flag) {
|
|
119 |
+ if(lhs.vui_num_units_in_tick != rhs.vui_num_units_in_tick ) return false;
|
|
120 |
+ if(lhs.vui_time_scale != rhs.vui_time_scale ) return false;
|
|
121 |
+ if(lhs.vui_timing_info_present_flag != rhs.vui_timing_info_present_flag ) return false;
|
|
122 |
+ if(lhs.vui_timing_info_present_flag) {
|
|
123 |
+ if(lhs.vui_num_ticks_poc_diff_one != rhs.vui_num_ticks_poc_diff_one ) return false;
|
|
124 |
+ }
|
|
125 |
+ }
|
|
126 |
+
|
|
127 |
+ if(lhs.vui_hrd_parameters_present_flag != rhs.vui_hrd_parameters_present_flag ) return false;
|
|
128 |
+
|
|
129 |
+
|
|
130 |
+ if(lhs.vui_hrd_parameters_present_flag) {
|
|
131 |
+ // check things made by hrd_parametes
|
|
132 |
+
|
|
133 |
+ if(lhs.vui_hrd_parameters_present_flag != rhs.vui_hrd_parameters_present_flag ) return false;
|
|
134 |
+ if(lhs.vcl_hrd_parameters_present_flag != rhs.vcl_hrd_parameters_present_flag ) return false;
|
|
135 |
+
|
|
136 |
+ if(lhs.nal_hrd_parameters_present_flag || lhs.vcl_hrd_parameters_present_flag) {
|
|
137 |
+ if(lhs.sub_pic_hrd_params_present_flag != rhs.sub_pic_hrd_params_present_flag ) return false;
|
|
138 |
+ if(lhs.sub_pic_hrd_params_present_flag) {
|
|
139 |
+ if(lhs.tick_divisor_minus2 != rhs.tick_divisor_minus2 ) return false;
|
|
140 |
+ if(lhs.du_cpb_removal_delay_increment_length_minus1 != rhs.du_cpb_removal_delay_increment_length_minus1 ) return false;
|
|
141 |
+ if(lhs.sub_pic_cpb_params_in_pic_timing_sei_flag != rhs.sub_pic_cpb_params_in_pic_timing_sei_flag ) return false;
|
|
142 |
+ if(lhs.dpb_output_delay_du_length_minus1 != rhs.dpb_output_delay_du_length_minus1 ) return false;
|
|
143 |
+ }
|
|
144 |
+ if(lhs.bit_rate_scale != rhs.bit_rate_scale ) return false;
|
|
145 |
+ if(lhs.cpb_size_scale != rhs.cpb_size_scale ) return false;
|
|
146 |
+ if(lhs.sub_pic_hrd_params_present_flag) {
|
|
147 |
+ if(lhs.cpb_size_du_scale != rhs.cpb_size_du_scale ) return false;
|
|
148 |
+ }
|
|
149 |
+ if(lhs.initial_cpb_removal_delay_length_minus1 != rhs.initial_cpb_removal_delay_length_minus1 ) return false;
|
|
150 |
+ if(lhs.au_cpb_removal_delay_length_minus1 != rhs.au_cpb_removal_delay_length_minus1 ) return false;
|
|
151 |
+ if(lhs.dpb_output_delay_length_minus1 != rhs.dpb_output_delay_length_minus1 ) return false;
|
|
152 |
+ }
|
|
153 |
+
|
|
154 |
+ int i;
|
|
155 |
+ unsigned int j, nalOrVcl;
|
|
156 |
+
|
|
157 |
+ for (i = 0; i < sps.sps_max_sub_layers; i++) {
|
|
158 |
+ if(lhs.fixed_pic_rate_general_flag[i] != rhs.fixed_pic_rate_general_flag[i] ) return false;
|
|
159 |
+ if(lhs.fixed_pic_rate_general_flag[i]) {
|
|
160 |
+ if(lhs.elemental_duration_in_tc_minus1[i] != rhs.elemental_duration_in_tc_minus1[i] ) return false;
|
|
161 |
+ }
|
|
162 |
+ if(lhs.low_delay_hrd_flag[i] != rhs.low_delay_hrd_flag[i] ) return false;
|
|
163 |
+ if(lhs.cpb_cnt_minus1[i] != rhs.cpb_cnt_minus1[i] ) return false;
|
|
164 |
+
|
|
165 |
+ for (nalOrVcl = 0; nalOrVcl < 2; nalOrVcl++) {
|
|
166 |
+ if (((nalOrVcl == 0) && lhs.nal_hrd_parameters_present_flag) || ((nalOrVcl == 1) && lhs.vcl_hrd_parameters_present_flag)) {
|
|
167 |
+ for (j = 0; j <= lhs.cpb_cnt_minus1[i]; j++) {
|
|
168 |
+ if(lhs.bit_rate_value_minus1[i][j][nalOrVcl] != rhs.bit_rate_value_minus1[i][j][nalOrVcl]) return false;
|
|
169 |
+ if(lhs.cpb_size_value_minus1[i][j][nalOrVcl] != rhs.cpb_size_value_minus1[i][j][nalOrVcl]) return false;
|
|
170 |
+
|
|
171 |
+ if (lhs.sub_pic_hrd_params_present_flag) {
|
|
172 |
+ if(lhs.cpb_size_du_value_minus1[i][j][nalOrVcl] != rhs.cpb_size_du_value_minus1[i][j][nalOrVcl]) return false;
|
|
173 |
+ if(lhs.bit_rate_du_value_minus1[i][j][nalOrVcl] != rhs.bit_rate_du_value_minus1[i][j][nalOrVcl]) return false;
|
|
174 |
+ }
|
|
175 |
+ if( lhs.cbr_flag[i][j][nalOrVcl] != rhs.cbr_flag[i][j][nalOrVcl]) return false;
|
|
176 |
+ }
|
|
177 |
+ }
|
|
178 |
+ }
|
|
179 |
+ }
|
|
180 |
+ }
|
|
181 |
+ return true;
|
|
182 |
+}
|
|
183 |
+
|
|
184 |
+bool operator==(const sps_range_extension &lhs, const sps_range_extension &rhs) {
|
|
185 |
+ if(&lhs == &rhs) return true;
|
|
186 |
+ if(lhs.transform_skip_rotation_enabled_flag != rhs.transform_skip_rotation_enabled_flag ) return false;
|
|
187 |
+ if(lhs.transform_skip_context_enabled_flag != rhs.transform_skip_context_enabled_flag ) return false;
|
|
188 |
+ if(lhs.implicit_rdpcm_enabled_flag != rhs.implicit_rdpcm_enabled_flag ) return false;
|
|
189 |
+ if(lhs.explicit_rdpcm_enabled_flag != rhs.explicit_rdpcm_enabled_flag ) return false;
|
|
190 |
+ if(lhs.extended_precision_processing_flag != rhs.extended_precision_processing_flag ) return false;
|
|
191 |
+ if(lhs.intra_smoothing_disabled_flag != rhs.intra_smoothing_disabled_flag ) return false;
|
|
192 |
+ if(lhs.high_precision_offsets_enabled_flag != rhs.high_precision_offsets_enabled_flag ) return false;
|
|
193 |
+ if(lhs.persistent_rice_adaptation_enabled_flag != rhs.persistent_rice_adaptation_enabled_flag ) return false;
|
|
194 |
+ if(lhs.cabac_bypass_alignment_enabled_flag != rhs.cabac_bypass_alignment_enabled_flag ) return false;
|
|
195 |
+ return true;
|
|
196 |
+}
|
|
197 |
+
|
|
198 |
+bool operator!=(const sps_range_extension &lhs, const sps_range_extension &rhs) {
|
|
199 |
+ if(&lhs == &rhs) return false;
|
|
200 |
+ return !(lhs==rhs);
|
|
201 |
+}
|
|
202 |
+
|
|
203 |
+
|
|
204 |
+bool operator==(const seq_parameter_set &lhs, const seq_parameter_set &rhs) {
|
|
205 |
+
|
|
206 |
+ if(&lhs== &rhs) return true;
|
|
207 |
+
|
|
208 |
+ if(lhs.sps_read != rhs.sps_read) return false;
|
|
209 |
+
|
|
210 |
+ if(lhs.video_parameter_set_id != rhs.video_parameter_set_id) return false;
|
|
211 |
+ if(lhs.sps_max_sub_layers != rhs.sps_max_sub_layers) return false;
|
|
212 |
+ if(lhs.sps_temporal_id_nesting_flag != rhs.sps_temporal_id_nesting_flag) return false;
|
|
213 |
+
|
|
214 |
+ if(!isEqual(lhs.profile_tier_level_, rhs.profile_tier_level_, lhs.sps_max_sub_layers)) return false;
|
|
215 |
+
|
|
216 |
+ if(lhs.seq_parameter_set_id != rhs.seq_parameter_set_id) return false;
|
|
217 |
+ if(lhs.chroma_format_idc != rhs.chroma_format_idc) return false;
|
|
218 |
+
|
|
219 |
+ if(lhs.separate_colour_plane_flag != rhs.separate_colour_plane_flag) return false;
|
|
220 |
+ if(lhs.pic_width_in_luma_samples != rhs.pic_width_in_luma_samples) return false;
|
|
221 |
+ if(lhs.pic_height_in_luma_samples != rhs.pic_height_in_luma_samples) return false;
|
|
222 |
+ if(lhs.conformance_window_flag != rhs.conformance_window_flag) return false;
|
|
223 |
+
|
|
224 |
+ if(lhs.conformance_window_flag) {
|
|
225 |
+ if(lhs.conf_win_left_offset != rhs.conf_win_left_offset) return false;
|
|
226 |
+ if(lhs.conf_win_right_offset != rhs.conf_win_right_offset) return false;
|
|
227 |
+ if(lhs.conf_win_top_offset != rhs.conf_win_top_offset) return false;
|
|
228 |
+ if(lhs.conf_win_bottom_offset != rhs.conf_win_bottom_offset) return false;
|
|
229 |
+ }
|
|
230 |
+
|
|
231 |
+ if(lhs.bit_depth_luma != rhs.bit_depth_luma) return false;
|
|
232 |
+ if(lhs.bit_depth_chroma != rhs.bit_depth_chroma) return false;
|
|
233 |
+
|
|
234 |
+ if(lhs.log2_max_pic_order_cnt_lsb != rhs.log2_max_pic_order_cnt_lsb) return false;
|
|
235 |
+ if(lhs.sps_sub_layer_ordering_info_present_flag != rhs.sps_sub_layer_ordering_info_present_flag) return false;
|
|
236 |
+
|
|
237 |
+ if(memcmp(lhs.sps_max_dec_pic_buffering, rhs.sps_max_dec_pic_buffering, sizeof(rhs.sps_max_dec_pic_buffering))) return false;
|
|
238 |
+ if(memcmp(lhs.sps_max_num_reorder_pics, rhs.sps_max_num_reorder_pics, sizeof(rhs.sps_max_num_reorder_pics))) return false;
|
|
239 |
+ if(memcmp(lhs.sps_max_latency_increase_plus1, rhs.sps_max_latency_increase_plus1, sizeof(rhs.sps_max_latency_increase_plus1))) return false;
|
|
240 |
+
|
|
241 |
+ if(lhs.log2_min_luma_coding_block_size != rhs.log2_min_luma_coding_block_size) return false;
|
|
242 |
+ if(lhs.log2_diff_max_min_luma_coding_block_size != rhs.log2_diff_max_min_luma_coding_block_size) return false;
|
|
243 |
+ if(lhs.log2_min_transform_block_size != rhs.log2_min_transform_block_size) return false;
|
|
244 |
+ if(lhs.log2_diff_max_min_transform_block_size != rhs.log2_diff_max_min_transform_block_size) return false;
|
|
245 |
+ if(lhs.max_transform_hierarchy_depth_inter != rhs.max_transform_hierarchy_depth_inter) return false;
|
|
246 |
+ if(lhs.max_transform_hierarchy_depth_intra != rhs.max_transform_hierarchy_depth_intra) return false;
|
|
247 |
+
|
|
248 |
+ if(lhs.scaling_list_enable_flag != rhs.scaling_list_enable_flag) return false;
|
|
249 |
+ if(lhs.scaling_list_enable_flag) {
|
|
250 |
+ if(lhs.sps_scaling_list_data_present_flag != rhs.sps_scaling_list_data_present_flag) return false;
|
|
251 |
+ if(lhs.sps_scaling_list_data_present_flag) {
|
|
252 |
+ // compare only needed if present, otherwise it is the default scaling list.
|
|
253 |
+ if(memcmp(&lhs.scaling_list, &rhs.scaling_list, sizeof(rhs.scaling_list))) return false;
|
|
254 |
+ }
|
|
255 |
+ }
|
|
256 |
+
|
|
257 |
+ if(lhs.amp_enabled_flag != rhs.amp_enabled_flag) return false;
|
|
258 |
+ if(lhs.sample_adaptive_offset_enabled_flag != rhs.sample_adaptive_offset_enabled_flag) return false;
|
|
259 |
+ if(lhs.pcm_enabled_flag != rhs.pcm_enabled_flag) return false;
|
|
260 |
+
|
|
261 |
+ if(lhs.pcm_enabled_flag) {
|
|
262 |
+ if(lhs.pcm_sample_bit_depth_luma != rhs.pcm_sample_bit_depth_luma) return false;
|
|
263 |
+ if(lhs.pcm_sample_bit_depth_chroma != rhs.pcm_sample_bit_depth_chroma) return false;
|
|
264 |
+ if(lhs.log2_min_pcm_luma_coding_block_size != rhs.log2_min_pcm_luma_coding_block_size) return false;
|
|
265 |
+ if(lhs.log2_diff_max_min_pcm_luma_coding_block_size != rhs.log2_diff_max_min_pcm_luma_coding_block_size) return false;
|
|
266 |
+ if(lhs.pcm_loop_filter_disable_flag != rhs.pcm_loop_filter_disable_flag) return false;
|
|
267 |
+ }
|
|
268 |
+
|
|
269 |
+ // (longterm) reference pics likely to change with a new sps, so ignored here.
|
|
270 |
+
|
|
271 |
+ if(lhs.sps_temporal_mvp_enabled_flag != rhs.sps_temporal_mvp_enabled_flag) return false;
|
|
272 |
+ if(lhs.strong_intra_smoothing_enable_flag != rhs.strong_intra_smoothing_enable_flag) return false;
|
|
273 |
+
|
|
274 |
+ if(lhs.vui_parameters_present_flag != rhs.vui_parameters_present_flag) return false;
|
|
275 |
+ if(lhs.vui_parameters_present_flag) {
|
|
276 |
+ if(!isEqual(lhs.vui, rhs.vui, lhs )) return false;
|
|
277 |
+ }
|
|
278 |
+
|
|
279 |
+ if(lhs.sps_extension_present_flag != rhs.sps_extension_present_flag ) return false;
|
|
280 |
+ if(lhs.sps_extension_present_flag) {
|
|
281 |
+ if(lhs.sps_range_extension_flag != rhs.sps_range_extension_flag ) return false;
|
|
282 |
+ if(lhs.sps_multilayer_extension_flag != rhs.sps_multilayer_extension_flag ) return false;
|
|
283 |
+ if(lhs.sps_extension_6bits != rhs.sps_extension_6bits ) return false;
|
|
284 |
+ if(lhs.range_extension != rhs.range_extension) return false;
|
|
285 |
+ }
|
|
286 |
+
|
|
287 |
+ return true;
|
|
288 |
+}
|
|
289 |
+
|
|
290 |
de265_error decoder_context::read_sps_NAL(bitreader& reader)
|
|
291 |
{
|
|
292 |
logdebug(LogHeaders,"----> read SPS\n");
|
|
293 |
@@ -560,6 +817,22 @@ de265_error decoder_context::read_sps_NAL(bitreader& reader)
|
|
294 |
new_sps->dump(param_sps_headers_fd);
|
|
295 |
}
|
|
296 |
|
|
297 |
+ if ( sps[ new_sps->seq_parameter_set_id ] ) {
|
|
298 |
+ auto old_sps = sps[ new_sps->seq_parameter_set_id ].get();
|
|
299 |
+ if ( *old_sps == *new_sps ) {
|
|
300 |
+ // printf(" **** keeping sps *****\n");
|
|
301 |
+ // the new sps is identical to the old one, so no replacing needed.
|
|
302 |
+ // however, reference pics and long-term reference pics might need updating.
|
|
303 |
+ old_sps->ref_pic_sets = new_sps->ref_pic_sets;
|
|
304 |
+ old_sps->long_term_ref_pics_present_flag = new_sps->long_term_ref_pics_present_flag;
|
|
305 |
+ memcpy(old_sps->lt_ref_pic_poc_lsb_sps, new_sps->lt_ref_pic_poc_lsb_sps, sizeof(old_sps->lt_ref_pic_poc_lsb_sps));
|
|
306 |
+ memcpy(old_sps->used_by_curr_pic_lt_sps_flag, new_sps->used_by_curr_pic_lt_sps_flag, sizeof(old_sps->used_by_curr_pic_lt_sps_flag));
|
|
307 |
+ return DE265_OK;
|
|
308 |
+ }
|
|
309 |
+ //printf(" **** replacing sps *****\n");
|
|
310 |
+
|
|
311 |
+ }
|
|
312 |
+
|
|
313 |
sps[ new_sps->seq_parameter_set_id ] = new_sps;
|
|
314 |
|
|
315 |
// Remove the all PPS that referenced the old SPS because parameters may have changed and we do not want to
|
|
316 |
diff --git a/libde265/sps.cc b/libde265/sps.cc
|
|
317 |
index f1c28255..31ce9470 100644
|
|
318 |
--- a/libde265/sps.cc
|
|
319 |
+++ b/libde265/sps.cc
|
|
320 |
@@ -287,6 +287,11 @@ de265_error seq_parameter_set::read(error_queue* errqueue, bitreader* br)
|
|
321 |
int firstLayer = (sps_sub_layer_ordering_info_present_flag ?
|
|
322 |
0 : sps_max_sub_layers-1 );
|
|
323 |
|
|
324 |
+ // zero out so that comparing is easier.
|
|
325 |
+ memset(sps_max_dec_pic_buffering, 0 , sizeof(sps_max_dec_pic_buffering));
|
|
326 |
+ memset(sps_max_num_reorder_pics, 0 , sizeof(sps_max_num_reorder_pics));
|
|
327 |
+ memset(sps_max_latency_increase_plus1, 0 , sizeof(sps_max_latency_increase_plus1));
|
|
328 |
+
|
|
329 |
for (int i=firstLayer ; i <= sps_max_sub_layers-1; i++ ) {
|
|
330 |
|
|
331 |
// sps_max_dec_pic_buffering[i]
|
|
332 |
@@ -347,6 +352,7 @@ de265_error seq_parameter_set::read(error_queue* errqueue, bitreader* br)
|
|
333 |
if (sps_scaling_list_data_present_flag) {
|
|
334 |
|
|
335 |
de265_error err;
|
|
336 |
+ memset(&scaling_list, 0 , sizeof(scaling_list)); // zero out, so that memcmp will do it to check for equality.
|
|
337 |
if ((err=read_scaling_list(br,this, &scaling_list, false)) != DE265_OK) {
|
|
338 |
return err;
|
|
339 |
}
|