Line | Branch | Exec | Source |
---|---|---|---|
1 | /* | ||
2 | * This file is part of FFmpeg. | ||
3 | * | ||
4 | * FFmpeg is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU Lesser General Public | ||
6 | * License as published by the Free Software Foundation; either | ||
7 | * version 2.1 of the License, or (at your option) any later version. | ||
8 | * | ||
9 | * FFmpeg is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
12 | * Lesser General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU Lesser General Public | ||
15 | * License along with FFmpeg; if not, write to the Free Software | ||
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
17 | */ | ||
18 | |||
19 | 8406 | static int FUNC(rbsp_trailing_bits)(CodedBitstreamContext *ctx, RWContext *rw) | |
20 | { | ||
21 | int err; | ||
22 | |||
23 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 4203 times.
|
8406 | fixed(1, rbsp_stop_one_bit, 1); |
24 |
2/2✓ Branch 1 taken 26257 times.
✓ Branch 2 taken 4203 times.
|
60920 | while (byte_alignment(rw) != 0) |
25 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 26257 times.
|
52514 | fixed(1, rbsp_alignment_zero_bit, 0); |
26 | |||
27 | 8406 | return 0; | |
28 | } | ||
29 | |||
30 | 34844 | static int FUNC(nal_unit_header)(CodedBitstreamContext *ctx, RWContext *rw, | |
31 | H265RawNALUnitHeader *current, | ||
32 | int expected_nal_unit_type) | ||
33 | { | ||
34 | int err; | ||
35 | |||
36 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 17422 times.
|
34844 | fixed(1, forbidden_zero_bit, 0); |
37 | |||
38 |
2/2✓ Branch 0 taken 4203 times.
✓ Branch 1 taken 13219 times.
|
34844 | if (expected_nal_unit_type >= 0) |
39 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 4203 times.
|
8406 | u(6, nal_unit_type, expected_nal_unit_type, |
40 | expected_nal_unit_type); | ||
41 | else | ||
42 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 13219 times.
|
26438 | ub(6, nal_unit_type); |
43 | |||
44 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 17422 times.
|
34844 | u(6, nuh_layer_id, 0, 62); |
45 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 17422 times.
|
34844 | u(3, nuh_temporal_id_plus1, 1, 7); |
46 | |||
47 | 34844 | return 0; | |
48 | } | ||
49 | |||
50 | 26438 | static int FUNC(byte_alignment)(CodedBitstreamContext *ctx, RWContext *rw) | |
51 | { | ||
52 | int err; | ||
53 | |||
54 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 13219 times.
|
26438 | fixed(1, alignment_bit_equal_to_one, 1); |
55 |
2/2✓ Branch 1 taken 52833 times.
✓ Branch 2 taken 13219 times.
|
132104 | while (byte_alignment(rw) != 0) |
56 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 52833 times.
|
105666 | fixed(1, alignment_bit_equal_to_zero, 0); |
57 | |||
58 | 26438 | return 0; | |
59 | } | ||
60 | |||
61 | ✗ | static int FUNC(extension_data)(CodedBitstreamContext *ctx, RWContext *rw, | |
62 | H265RawExtensionData *current) | ||
63 | { | ||
64 | int err; | ||
65 | size_t k; | ||
66 | #ifdef READ | ||
67 | GetBitContext start; | ||
68 | uint8_t bit; | ||
69 | ✗ | start = *rw; | |
70 | ✗ | for (k = 0; cbs_h2645_read_more_rbsp_data(rw); k++) | |
71 | ✗ | skip_bits(rw, 1); | |
72 | ✗ | current->bit_length = k; | |
73 | ✗ | if (k > 0) { | |
74 | ✗ | *rw = start; | |
75 | ✗ | allocate(current->data, (current->bit_length + 7) / 8); | |
76 | ✗ | for (k = 0; k < current->bit_length; k++) { | |
77 | ✗ | xu(1, extension_data, bit, 0, 1, 0); | |
78 | ✗ | current->data[k / 8] |= bit << (7 - k % 8); | |
79 | } | ||
80 | } | ||
81 | #else | ||
82 | ✗ | for (k = 0; k < current->bit_length; k++) | |
83 | ✗ | xu(1, extension_data, current->data[k / 8] >> (7 - k % 8) & 1, 0, 1, 0); | |
84 | #endif | ||
85 | ✗ | return 0; | |
86 | } | ||
87 | |||
88 | 456 | static int FUNC(profile_tier_level)(CodedBitstreamContext *ctx, RWContext *rw, | |
89 | H265RawProfileTierLevel *current, | ||
90 | int profile_present_flag, | ||
91 | int max_num_sub_layers_minus1) | ||
92 | { | ||
93 | int err, i, j; | ||
94 | |||
95 |
1/2✓ Branch 0 taken 228 times.
✗ Branch 1 not taken.
|
456 | if (profile_present_flag) { |
96 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 228 times.
|
456 | u(2, general_profile_space, 0, 0); |
97 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 228 times.
|
456 | flag(general_tier_flag); |
98 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 228 times.
|
456 | ub(5, general_profile_idc); |
99 | |||
100 |
2/2✓ Branch 0 taken 7296 times.
✓ Branch 1 taken 228 times.
|
15048 | for (j = 0; j < 32; j++) |
101 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 7296 times.
|
14592 | flags(general_profile_compatibility_flag[j], 1, j); |
102 | |||
103 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 228 times.
|
456 | flag(general_progressive_source_flag); |
104 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 228 times.
|
456 | flag(general_interlaced_source_flag); |
105 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 228 times.
|
456 | flag(general_non_packed_constraint_flag); |
106 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 228 times.
|
456 | flag(general_frame_only_constraint_flag); |
107 | |||
108 | #define profile_compatible(x) (current->general_profile_idc == (x) || \ | ||
109 | current->general_profile_compatibility_flag[x]) | ||
110 |
4/8✓ Branch 0 taken 228 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 228 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 228 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 228 times.
✗ Branch 7 not taken.
|
456 | if (profile_compatible(4) || profile_compatible(5) || |
111 |
4/8✓ Branch 0 taken 228 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 228 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 228 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 228 times.
✗ Branch 7 not taken.
|
456 | profile_compatible(6) || profile_compatible(7) || |
112 |
4/8✓ Branch 0 taken 228 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 228 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 228 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 228 times.
✗ Branch 7 not taken.
|
456 | profile_compatible(8) || profile_compatible(9) || |
113 |
4/8✓ Branch 0 taken 228 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 228 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 228 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 228 times.
|
456 | profile_compatible(10) || profile_compatible(11)) { |
114 | ✗ | flag(general_max_12bit_constraint_flag); | |
115 | ✗ | flag(general_max_10bit_constraint_flag); | |
116 | ✗ | flag(general_max_8bit_constraint_flag); | |
117 | ✗ | flag(general_max_422chroma_constraint_flag); | |
118 | ✗ | flag(general_max_420chroma_constraint_flag); | |
119 | ✗ | flag(general_max_monochrome_constraint_flag); | |
120 | ✗ | flag(general_intra_constraint_flag); | |
121 | ✗ | flag(general_one_picture_only_constraint_flag); | |
122 | ✗ | flag(general_lower_bit_rate_constraint_flag); | |
123 | |||
124 | ✗ | if (profile_compatible(5) || profile_compatible(9) || | |
125 | ✗ | profile_compatible(10) || profile_compatible(11)) { | |
126 | ✗ | flag(general_max_14bit_constraint_flag); | |
127 | ✗ | fixed(24, general_reserved_zero_33bits, 0); | |
128 | ✗ | fixed( 9, general_reserved_zero_33bits, 0); | |
129 | } else { | ||
130 | ✗ | fixed(24, general_reserved_zero_34bits, 0); | |
131 | ✗ | fixed(10, general_reserved_zero_34bits, 0); | |
132 | } | ||
133 |
4/4✓ Branch 0 taken 196 times.
✓ Branch 1 taken 32 times.
✓ Branch 2 taken 156 times.
✓ Branch 3 taken 40 times.
|
456 | } else if (profile_compatible(2)) { |
134 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 188 times.
|
376 | fixed(7, general_reserved_zero_7bits, 0); |
135 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 188 times.
|
376 | flag(general_one_picture_only_constraint_flag); |
136 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 188 times.
|
376 | fixed(24, general_reserved_zero_35bits, 0); |
137 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 188 times.
|
376 | fixed(11, general_reserved_zero_35bits, 0); |
138 | } else { | ||
139 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 40 times.
|
80 | fixed(24, general_reserved_zero_43bits, 0); |
140 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 40 times.
|
80 | fixed(19, general_reserved_zero_43bits, 0); |
141 | } | ||
142 | |||
143 |
4/8✓ Branch 0 taken 32 times.
✓ Branch 1 taken 196 times.
✓ Branch 2 taken 32 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 32 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
456 | if (profile_compatible(1) || profile_compatible(2) || |
144 | ✗ | profile_compatible(3) || profile_compatible(4) || | |
145 | ✗ | profile_compatible(5) || profile_compatible(9) || | |
146 | ✗ | profile_compatible(11)) { | |
147 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 228 times.
|
456 | flag(general_inbld_flag); |
148 | } else { | ||
149 | ✗ | fixed(1, general_reserved_zero_bit, 0); | |
150 | } | ||
151 | #undef profile_compatible | ||
152 | } | ||
153 | |||
154 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 228 times.
|
456 | ub(8, general_level_idc); |
155 | |||
156 |
2/2✓ Branch 0 taken 96 times.
✓ Branch 1 taken 228 times.
|
648 | for (i = 0; i < max_num_sub_layers_minus1; i++) { |
157 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 96 times.
|
192 | flags(sub_layer_profile_present_flag[i], 1, i); |
158 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 96 times.
|
192 | flags(sub_layer_level_present_flag[i], 1, i); |
159 | } | ||
160 | |||
161 |
2/2✓ Branch 0 taken 48 times.
✓ Branch 1 taken 180 times.
|
456 | if (max_num_sub_layers_minus1 > 0) { |
162 |
2/2✓ Branch 0 taken 288 times.
✓ Branch 1 taken 48 times.
|
672 | for (i = max_num_sub_layers_minus1; i < 8; i++) |
163 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 288 times.
|
576 | fixed(2, reserved_zero_2bits, 0); |
164 | } | ||
165 | |||
166 |
2/2✓ Branch 0 taken 96 times.
✓ Branch 1 taken 228 times.
|
648 | for (i = 0; i < max_num_sub_layers_minus1; i++) { |
167 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 80 times.
|
192 | if (current->sub_layer_profile_present_flag[i]) { |
168 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
|
32 | us(2, sub_layer_profile_space[i], 0, 0, 1, i); |
169 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
|
32 | flags(sub_layer_tier_flag[i], 1, i); |
170 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
|
32 | ubs(5, sub_layer_profile_idc[i], 1, i); |
171 | |||
172 |
2/2✓ Branch 0 taken 512 times.
✓ Branch 1 taken 16 times.
|
1056 | for (j = 0; j < 32; j++) |
173 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 512 times.
|
1024 | flags(sub_layer_profile_compatibility_flag[i][j], 2, i, j); |
174 | |||
175 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
|
32 | flags(sub_layer_progressive_source_flag[i], 1, i); |
176 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
|
32 | flags(sub_layer_interlaced_source_flag[i], 1, i); |
177 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
|
32 | flags(sub_layer_non_packed_constraint_flag[i], 1, i); |
178 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
|
32 | flags(sub_layer_frame_only_constraint_flag[i], 1, i); |
179 | |||
180 | #define profile_compatible(x) (current->sub_layer_profile_idc[i] == (x) || \ | ||
181 | current->sub_layer_profile_compatibility_flag[i][x]) | ||
182 |
4/8✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 16 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 16 times.
✗ Branch 7 not taken.
|
32 | if (profile_compatible(4) || profile_compatible(5) || |
183 |
4/8✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 16 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 16 times.
✗ Branch 7 not taken.
|
32 | profile_compatible(6) || profile_compatible(7) || |
184 |
4/8✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 16 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 16 times.
✗ Branch 7 not taken.
|
32 | profile_compatible(8) || profile_compatible(9) || |
185 |
4/8✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 16 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 16 times.
|
32 | profile_compatible(10) || profile_compatible(11)) { |
186 | ✗ | flags(sub_layer_max_12bit_constraint_flag[i], 1, i); | |
187 | ✗ | flags(sub_layer_max_10bit_constraint_flag[i], 1, i); | |
188 | ✗ | flags(sub_layer_max_8bit_constraint_flag[i], 1, i); | |
189 | ✗ | flags(sub_layer_max_422chroma_constraint_flag[i], 1, i); | |
190 | ✗ | flags(sub_layer_max_420chroma_constraint_flag[i], 1, i); | |
191 | ✗ | flags(sub_layer_max_monochrome_constraint_flag[i], 1, i); | |
192 | ✗ | flags(sub_layer_intra_constraint_flag[i], 1, i); | |
193 | ✗ | flags(sub_layer_one_picture_only_constraint_flag[i], 1, i); | |
194 | ✗ | flags(sub_layer_lower_bit_rate_constraint_flag[i], 1, i); | |
195 | |||
196 | ✗ | if (profile_compatible(5) || profile_compatible(9) || | |
197 | ✗ | profile_compatible(10) || profile_compatible(11)) { | |
198 | ✗ | flags(sub_layer_max_14bit_constraint_flag[i], 1, i); | |
199 | ✗ | fixed(24, sub_layer_reserved_zero_33bits, 0); | |
200 | ✗ | fixed( 9, sub_layer_reserved_zero_33bits, 0); | |
201 | } else { | ||
202 | ✗ | fixed(24, sub_layer_reserved_zero_34bits, 0); | |
203 | ✗ | fixed(10, sub_layer_reserved_zero_34bits, 0); | |
204 | } | ||
205 |
2/4✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 16 times.
|
32 | } else if (profile_compatible(2)) { |
206 | ✗ | fixed(7, sub_layer_reserved_zero_7bits, 0); | |
207 | ✗ | flags(sub_layer_one_picture_only_constraint_flag[i], 1, i); | |
208 | ✗ | fixed(24, sub_layer_reserved_zero_43bits, 0); | |
209 | ✗ | fixed(11, sub_layer_reserved_zero_43bits, 0); | |
210 | } else { | ||
211 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
|
32 | fixed(24, sub_layer_reserved_zero_43bits, 0); |
212 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
|
32 | fixed(19, sub_layer_reserved_zero_43bits, 0); |
213 | } | ||
214 | |||
215 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
32 | if (profile_compatible(1) || profile_compatible(2) || |
216 | ✗ | profile_compatible(3) || profile_compatible(4) || | |
217 | ✗ | profile_compatible(5) || profile_compatible(9) || | |
218 | ✗ | profile_compatible(11)) { | |
219 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
|
32 | flags(sub_layer_inbld_flag[i], 1, i); |
220 | } else { | ||
221 | ✗ | fixed(1, sub_layer_reserved_zero_bit, 0); | |
222 | } | ||
223 | #undef profile_compatible | ||
224 | } | ||
225 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 80 times.
|
192 | if (current->sub_layer_level_present_flag[i]) |
226 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
|
32 | ubs(8, sub_layer_level_idc[i], 1, i); |
227 | } | ||
228 | |||
229 | 456 | return 0; | |
230 | } | ||
231 | |||
232 | 32 | static int FUNC(sub_layer_hrd_parameters)(CodedBitstreamContext *ctx, RWContext *rw, | |
233 | H265RawHRDParameters *hrd, | ||
234 | int nal, int sub_layer_id) | ||
235 | { | ||
236 | H265RawSubLayerHRDParameters *current; | ||
237 | int err, i; | ||
238 | |||
239 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 8 times.
|
32 | if (nal) |
240 | 16 | current = &hrd->nal_sub_layer_hrd_parameters[sub_layer_id]; | |
241 | else | ||
242 | 16 | current = &hrd->vcl_sub_layer_hrd_parameters[sub_layer_id]; | |
243 | |||
244 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 16 times.
|
64 | for (i = 0; i <= hrd->cpb_cnt_minus1[sub_layer_id]; i++) { |
245 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
|
32 | ues(bit_rate_value_minus1[i], 0, UINT32_MAX - 1, 1, i); |
246 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
|
32 | ues(cpb_size_value_minus1[i], 0, UINT32_MAX - 1, 1, i); |
247 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 8 times.
|
32 | if (hrd->sub_pic_hrd_params_present_flag) { |
248 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
|
16 | ues(cpb_size_du_value_minus1[i], 0, UINT32_MAX - 1, 1, i); |
249 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
|
16 | ues(bit_rate_du_value_minus1[i], 0, UINT32_MAX - 1, 1, i); |
250 | } | ||
251 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
|
32 | flags(cbr_flag[i], 1, i); |
252 | } | ||
253 | |||
254 | 32 | return 0; | |
255 | } | ||
256 | |||
257 | 16 | static int FUNC(hrd_parameters)(CodedBitstreamContext *ctx, RWContext *rw, | |
258 | H265RawHRDParameters *current, int common_inf_present_flag, | ||
259 | int max_num_sub_layers_minus1) | ||
260 | { | ||
261 | int err, i; | ||
262 | |||
263 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
16 | if (common_inf_present_flag) { |
264 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
|
16 | flag(nal_hrd_parameters_present_flag); |
265 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
|
16 | flag(vcl_hrd_parameters_present_flag); |
266 | |||
267 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
16 | if (current->nal_hrd_parameters_present_flag || |
268 | ✗ | current->vcl_hrd_parameters_present_flag) { | |
269 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
|
16 | flag(sub_pic_hrd_params_present_flag); |
270 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 4 times.
|
16 | if (current->sub_pic_hrd_params_present_flag) { |
271 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
|
8 | ub(8, tick_divisor_minus2); |
272 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
|
8 | ub(5, du_cpb_removal_delay_increment_length_minus1); |
273 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
|
8 | flag(sub_pic_cpb_params_in_pic_timing_sei_flag); |
274 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
|
8 | ub(5, dpb_output_delay_du_length_minus1); |
275 | } | ||
276 | |||
277 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
|
16 | ub(4, bit_rate_scale); |
278 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
|
16 | ub(4, cpb_size_scale); |
279 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 4 times.
|
16 | if (current->sub_pic_hrd_params_present_flag) |
280 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
|
8 | ub(4, cpb_size_du_scale); |
281 | |||
282 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
|
16 | ub(5, initial_cpb_removal_delay_length_minus1); |
283 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
|
16 | ub(5, au_cpb_removal_delay_length_minus1); |
284 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
|
16 | ub(5, dpb_output_delay_length_minus1); |
285 | } else { | ||
286 | ✗ | infer(sub_pic_hrd_params_present_flag, 0); | |
287 | |||
288 | ✗ | infer(initial_cpb_removal_delay_length_minus1, 23); | |
289 | ✗ | infer(au_cpb_removal_delay_length_minus1, 23); | |
290 | ✗ | infer(dpb_output_delay_length_minus1, 23); | |
291 | } | ||
292 | } | ||
293 | |||
294 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 8 times.
|
32 | for (i = 0; i <= max_num_sub_layers_minus1; i++) { |
295 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
|
16 | flags(fixed_pic_rate_general_flag[i], 1, i); |
296 | |||
297 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 4 times.
|
16 | if (!current->fixed_pic_rate_general_flag[i]) |
298 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
|
8 | flags(fixed_pic_rate_within_cvs_flag[i], 1, i); |
299 | else | ||
300 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
8 | infer(fixed_pic_rate_within_cvs_flag[i], 1); |
301 | |||
302 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 4 times.
|
16 | if (current->fixed_pic_rate_within_cvs_flag[i]) { |
303 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
|
8 | ues(elemental_duration_in_tc_minus1[i], 0, 2047, 1, i); |
304 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
8 | infer(low_delay_hrd_flag[i], 0); |
305 | } else | ||
306 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
|
8 | flags(low_delay_hrd_flag[i], 1, i); |
307 | |||
308 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
16 | if (!current->low_delay_hrd_flag[i]) |
309 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
|
16 | ues(cpb_cnt_minus1[i], 0, 31, 1, i); |
310 | else | ||
311 | ✗ | infer(cpb_cnt_minus1[i], 0); | |
312 | |||
313 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
16 | if (current->nal_hrd_parameters_present_flag) |
314 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
|
16 | CHECK(FUNC(sub_layer_hrd_parameters)(ctx, rw, current, 0, i)); |
315 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
16 | if (current->vcl_hrd_parameters_present_flag) |
316 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
|
16 | CHECK(FUNC(sub_layer_hrd_parameters)(ctx, rw, current, 1, i)); |
317 | } | ||
318 | |||
319 | 16 | return 0; | |
320 | } | ||
321 | |||
322 | 104 | static int FUNC(vui_parameters)(CodedBitstreamContext *ctx, RWContext *rw, | |
323 | H265RawVUI *current, const H265RawSPS *sps) | ||
324 | { | ||
325 | int err; | ||
326 | |||
327 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 52 times.
|
104 | flag(aspect_ratio_info_present_flag); |
328 |
2/2✓ Branch 0 taken 28 times.
✓ Branch 1 taken 24 times.
|
104 | if (current->aspect_ratio_info_present_flag) { |
329 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 28 times.
|
56 | ub(8, aspect_ratio_idc); |
330 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 28 times.
|
56 | if (current->aspect_ratio_idc == 255) { |
331 | ✗ | ub(16, sar_width); | |
332 | ✗ | ub(16, sar_height); | |
333 | } | ||
334 | } else { | ||
335 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
|
48 | infer(aspect_ratio_idc, 0); |
336 | } | ||
337 | |||
338 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 52 times.
|
104 | flag(overscan_info_present_flag); |
339 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 52 times.
|
104 | if (current->overscan_info_present_flag) |
340 | ✗ | flag(overscan_appropriate_flag); | |
341 | |||
342 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 52 times.
|
104 | flag(video_signal_type_present_flag); |
343 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 52 times.
|
104 | if (current->video_signal_type_present_flag) { |
344 | ✗ | ub(3, video_format); | |
345 | ✗ | flag(video_full_range_flag); | |
346 | ✗ | flag(colour_description_present_flag); | |
347 | ✗ | if (current->colour_description_present_flag) { | |
348 | ✗ | ub(8, colour_primaries); | |
349 | ✗ | ub(8, transfer_characteristics); | |
350 | ✗ | ub(8, matrix_coefficients); | |
351 | } else { | ||
352 | ✗ | infer(colour_primaries, 2); | |
353 | ✗ | infer(transfer_characteristics, 2); | |
354 | ✗ | infer(matrix_coefficients, 2); | |
355 | } | ||
356 | } else { | ||
357 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
|
104 | infer(video_format, 5); |
358 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
|
104 | infer(video_full_range_flag, 0); |
359 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
|
104 | infer(colour_primaries, 2); |
360 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
|
104 | infer(transfer_characteristics, 2); |
361 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
|
104 | infer(matrix_coefficients, 2); |
362 | } | ||
363 | |||
364 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 52 times.
|
104 | flag(chroma_loc_info_present_flag); |
365 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 52 times.
|
104 | if (current->chroma_loc_info_present_flag) { |
366 | ✗ | ue(chroma_sample_loc_type_top_field, 0, 5); | |
367 | ✗ | ue(chroma_sample_loc_type_bottom_field, 0, 5); | |
368 | } else { | ||
369 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
|
104 | infer(chroma_sample_loc_type_top_field, 0); |
370 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
|
104 | infer(chroma_sample_loc_type_bottom_field, 0); |
371 | } | ||
372 | |||
373 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 52 times.
|
104 | flag(neutral_chroma_indication_flag); |
374 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 52 times.
|
104 | flag(field_seq_flag); |
375 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 52 times.
|
104 | flag(frame_field_info_present_flag); |
376 | |||
377 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 52 times.
|
104 | flag(default_display_window_flag); |
378 |
2/2✓ Branch 0 taken 28 times.
✓ Branch 1 taken 24 times.
|
104 | if (current->default_display_window_flag) { |
379 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 28 times.
|
56 | ue(def_disp_win_left_offset, 0, 16384); |
380 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 28 times.
|
56 | ue(def_disp_win_right_offset, 0, 16384); |
381 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 28 times.
|
56 | ue(def_disp_win_top_offset, 0, 16384); |
382 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 28 times.
|
56 | ue(def_disp_win_bottom_offset, 0, 16384); |
383 | } | ||
384 | |||
385 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 52 times.
|
104 | flag(vui_timing_info_present_flag); |
386 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 44 times.
|
104 | if (current->vui_timing_info_present_flag) { |
387 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
|
16 | u(32, vui_num_units_in_tick, 1, UINT32_MAX); |
388 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
|
16 | u(32, vui_time_scale, 1, UINT32_MAX); |
389 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
|
16 | flag(vui_poc_proportional_to_timing_flag); |
390 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 4 times.
|
16 | if (current->vui_poc_proportional_to_timing_flag) |
391 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
|
8 | ue(vui_num_ticks_poc_diff_one_minus1, 0, UINT32_MAX - 1); |
392 | |||
393 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
|
16 | flag(vui_hrd_parameters_present_flag); |
394 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
16 | if (current->vui_hrd_parameters_present_flag) { |
395 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
|
16 | CHECK(FUNC(hrd_parameters)(ctx, rw, ¤t->hrd_parameters, |
396 | 1, sps->sps_max_sub_layers_minus1)); | ||
397 | } | ||
398 | } | ||
399 | |||
400 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 52 times.
|
104 | flag(bitstream_restriction_flag); |
401 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 28 times.
|
104 | if (current->bitstream_restriction_flag) { |
402 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
|
48 | flag(tiles_fixed_structure_flag); |
403 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
|
48 | flag(motion_vectors_over_pic_boundaries_flag); |
404 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
|
48 | flag(restricted_ref_pic_lists_flag); |
405 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
|
48 | ue(min_spatial_segmentation_idc, 0, 4095); |
406 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
|
48 | ue(max_bytes_per_pic_denom, 0, 16); |
407 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
|
48 | ue(max_bits_per_min_cu_denom, 0, 16); |
408 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
|
48 | ue(log2_max_mv_length_horizontal, 0, 16); |
409 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
|
48 | ue(log2_max_mv_length_vertical, 0, 16); |
410 | } else { | ||
411 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
|
56 | infer(tiles_fixed_structure_flag, 0); |
412 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
|
56 | infer(motion_vectors_over_pic_boundaries_flag, 1); |
413 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
|
56 | infer(min_spatial_segmentation_idc, 0); |
414 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
|
56 | infer(max_bytes_per_pic_denom, 2); |
415 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
|
56 | infer(max_bits_per_min_cu_denom, 1); |
416 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
|
56 | infer(log2_max_mv_length_horizontal, 15); |
417 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
|
56 | infer(log2_max_mv_length_vertical, 15); |
418 | } | ||
419 | |||
420 | 104 | return 0; | |
421 | } | ||
422 | |||
423 | 224 | static int FUNC(vps)(CodedBitstreamContext *ctx, RWContext *rw, | |
424 | H265RawVPS *current) | ||
425 | { | ||
426 | int err, i, j; | ||
427 | |||
428 | 224 | HEADER("Video Parameter Set"); | |
429 | |||
430 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 112 times.
|
224 | CHECK(FUNC(nal_unit_header)(ctx, rw, ¤t->nal_unit_header, HEVC_NAL_VPS)); |
431 | |||
432 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 112 times.
|
224 | ub(4, vps_video_parameter_set_id); |
433 | |||
434 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 112 times.
|
224 | flag(vps_base_layer_internal_flag); |
435 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 112 times.
|
224 | flag(vps_base_layer_available_flag); |
436 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 112 times.
|
224 | u(6, vps_max_layers_minus1, 0, HEVC_MAX_LAYERS - 1); |
437 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 112 times.
|
224 | u(3, vps_max_sub_layers_minus1, 0, HEVC_MAX_SUB_LAYERS - 1); |
438 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 112 times.
|
224 | flag(vps_temporal_id_nesting_flag); |
439 | |||
440 |
2/2✓ Branch 0 taken 88 times.
✓ Branch 1 taken 24 times.
|
224 | if (current->vps_max_sub_layers_minus1 == 0 && |
441 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 88 times.
|
176 | current->vps_temporal_id_nesting_flag != 1) { |
442 | ✗ | av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid stream: " | |
443 | "vps_temporal_id_nesting_flag must be 1 if " | ||
444 | "vps_max_sub_layers_minus1 is 0.\n"); | ||
445 | ✗ | return AVERROR_INVALIDDATA; | |
446 | } | ||
447 | |||
448 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 112 times.
|
224 | fixed(16, vps_reserved_0xffff_16bits, 0xffff); |
449 | |||
450 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 112 times.
|
224 | CHECK(FUNC(profile_tier_level)(ctx, rw, ¤t->profile_tier_level, |
451 | 1, current->vps_max_sub_layers_minus1)); | ||
452 | |||
453 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 112 times.
|
224 | flag(vps_sub_layer_ordering_info_present_flag); |
454 | 224 | for (i = (current->vps_sub_layer_ordering_info_present_flag ? | |
455 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 88 times.
|
224 | 0 : current->vps_max_sub_layers_minus1); |
456 |
2/2✓ Branch 0 taken 120 times.
✓ Branch 1 taken 112 times.
|
464 | i <= current->vps_max_sub_layers_minus1; i++) { |
457 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 120 times.
|
240 | ues(vps_max_dec_pic_buffering_minus1[i], |
458 | 0, HEVC_MAX_DPB_SIZE - 1, 1, i); | ||
459 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 120 times.
|
240 | ues(vps_max_num_reorder_pics[i], |
460 | 0, current->vps_max_dec_pic_buffering_minus1[i], 1, i); | ||
461 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 120 times.
|
240 | ues(vps_max_latency_increase_plus1[i], |
462 | 0, UINT32_MAX - 1, 1, i); | ||
463 | } | ||
464 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 88 times.
|
224 | if (!current->vps_sub_layer_ordering_info_present_flag) { |
465 |
2/2✓ Branch 0 taken 40 times.
✓ Branch 1 taken 24 times.
|
128 | for (i = 0; i < current->vps_max_sub_layers_minus1; i++) { |
466 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 20 times.
|
80 | infer(vps_max_dec_pic_buffering_minus1[i], |
467 | current->vps_max_dec_pic_buffering_minus1[current->vps_max_sub_layers_minus1]); | ||
468 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 20 times.
|
80 | infer(vps_max_num_reorder_pics[i], |
469 | current->vps_max_num_reorder_pics[current->vps_max_sub_layers_minus1]); | ||
470 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 20 times.
|
80 | infer(vps_max_latency_increase_plus1[i], |
471 | current->vps_max_latency_increase_plus1[current->vps_max_sub_layers_minus1]); | ||
472 | } | ||
473 | } | ||
474 | |||
475 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 112 times.
|
224 | u(6, vps_max_layer_id, 0, HEVC_MAX_LAYERS - 1); |
476 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 112 times.
|
224 | ue(vps_num_layer_sets_minus1, 0, HEVC_MAX_LAYER_SETS - 1); |
477 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 112 times.
|
224 | for (i = 1; i <= current->vps_num_layer_sets_minus1; i++) { |
478 | ✗ | for (j = 0; j <= current->vps_max_layer_id; j++) | |
479 | ✗ | flags(layer_id_included_flag[i][j], 2, i, j); | |
480 | } | ||
481 |
2/2✓ Branch 0 taken 112 times.
✓ Branch 1 taken 112 times.
|
448 | for (j = 0; j <= current->vps_max_layer_id; j++) |
482 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 56 times.
|
224 | infer(layer_id_included_flag[0][j], j == 0); |
483 | |||
484 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 112 times.
|
224 | flag(vps_timing_info_present_flag); |
485 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 108 times.
|
224 | if (current->vps_timing_info_present_flag) { |
486 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
|
8 | u(32, vps_num_units_in_tick, 1, UINT32_MAX); |
487 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
|
8 | u(32, vps_time_scale, 1, UINT32_MAX); |
488 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
|
8 | flag(vps_poc_proportional_to_timing_flag); |
489 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
8 | if (current->vps_poc_proportional_to_timing_flag) |
490 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
|
8 | ue(vps_num_ticks_poc_diff_one_minus1, 0, UINT32_MAX - 1); |
491 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
|
8 | ue(vps_num_hrd_parameters, 0, current->vps_num_layer_sets_minus1 + 1); |
492 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
8 | for (i = 0; i < current->vps_num_hrd_parameters; i++) { |
493 | ✗ | ues(hrd_layer_set_idx[i], | |
494 | current->vps_base_layer_internal_flag ? 0 : 1, | ||
495 | current->vps_num_layer_sets_minus1, 1, i); | ||
496 | ✗ | if (i > 0) | |
497 | ✗ | flags(cprms_present_flag[i], 1, i); | |
498 | else | ||
499 | ✗ | infer(cprms_present_flag[0], 1); | |
500 | |||
501 | ✗ | CHECK(FUNC(hrd_parameters)(ctx, rw, ¤t->hrd_parameters[i], | |
502 | current->cprms_present_flag[i], | ||
503 | current->vps_max_sub_layers_minus1)); | ||
504 | } | ||
505 | } | ||
506 | |||
507 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 112 times.
|
224 | flag(vps_extension_flag); |
508 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 112 times.
|
224 | if (current->vps_extension_flag) |
509 | ✗ | CHECK(FUNC(extension_data)(ctx, rw, ¤t->extension_data)); | |
510 | |||
511 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 112 times.
|
224 | CHECK(FUNC(rbsp_trailing_bits)(ctx, rw)); |
512 | |||
513 | 224 | return 0; | |
514 | } | ||
515 | |||
516 | 9530 | static int FUNC(st_ref_pic_set)(CodedBitstreamContext *ctx, RWContext *rw, | |
517 | H265RawSTRefPicSet *current, int st_rps_idx, | ||
518 | const H265RawSPS *sps) | ||
519 | { | ||
520 | int err, i, j; | ||
521 | |||
522 |
2/2✓ Branch 0 taken 4601 times.
✓ Branch 1 taken 164 times.
|
9530 | if (st_rps_idx != 0) |
523 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 4601 times.
|
9202 | flag(inter_ref_pic_set_prediction_flag); |
524 | else | ||
525 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 82 times.
|
328 | infer(inter_ref_pic_set_prediction_flag, 0); |
526 | |||
527 |
2/2✓ Branch 0 taken 1199 times.
✓ Branch 1 taken 3566 times.
|
9530 | if (current->inter_ref_pic_set_prediction_flag) { |
528 | unsigned int ref_rps_idx, num_delta_pocs, num_ref_pics; | ||
529 | const H265RawSTRefPicSet *ref; | ||
530 | int delta_rps, d_poc; | ||
531 | int ref_delta_poc_s0[HEVC_MAX_REFS], ref_delta_poc_s1[HEVC_MAX_REFS]; | ||
532 | int delta_poc_s0[HEVC_MAX_REFS], delta_poc_s1[HEVC_MAX_REFS]; | ||
533 | uint8_t used_by_curr_pic_s0[HEVC_MAX_REFS], | ||
534 | used_by_curr_pic_s1[HEVC_MAX_REFS]; | ||
535 | |||
536 |
2/2✓ Branch 0 taken 403 times.
✓ Branch 1 taken 796 times.
|
2398 | if (st_rps_idx == sps->num_short_term_ref_pic_sets) |
537 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 403 times.
|
806 | ue(delta_idx_minus1, 0, st_rps_idx - 1); |
538 | else | ||
539 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 398 times.
|
1592 | infer(delta_idx_minus1, 0); |
540 | |||
541 | 2398 | ref_rps_idx = st_rps_idx - (current->delta_idx_minus1 + 1); | |
542 | 2398 | ref = &sps->st_ref_pic_set[ref_rps_idx]; | |
543 | 2398 | num_delta_pocs = ref->num_negative_pics + ref->num_positive_pics; | |
544 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1199 times.
|
2398 | av_assert0(num_delta_pocs < HEVC_MAX_DPB_SIZE); |
545 | |||
546 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1199 times.
|
2398 | flag(delta_rps_sign); |
547 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1199 times.
|
2398 | ue(abs_delta_rps_minus1, 0, INT16_MAX); |
548 | 2398 | delta_rps = (1 - 2 * current->delta_rps_sign) * | |
549 | 2398 | (current->abs_delta_rps_minus1 + 1); | |
550 | |||
551 | 2398 | num_ref_pics = 0; | |
552 |
2/2✓ Branch 0 taken 5258 times.
✓ Branch 1 taken 1199 times.
|
12914 | for (j = 0; j <= num_delta_pocs; j++) { |
553 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 5258 times.
|
10516 | flags(used_by_curr_pic_flag[j], 1, j); |
554 |
2/2✓ Branch 0 taken 1196 times.
✓ Branch 1 taken 4062 times.
|
10516 | if (!current->used_by_curr_pic_flag[j]) |
555 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1196 times.
|
2392 | flags(use_delta_flag[j], 1, j); |
556 | else | ||
557 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1995 times.
|
8124 | infer(use_delta_flag[j], 1); |
558 |
2/2✓ Branch 0 taken 4062 times.
✓ Branch 1 taken 1196 times.
|
10516 | if (current->use_delta_flag[j]) |
559 | 8124 | ++num_ref_pics; | |
560 | } | ||
561 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1199 times.
|
2398 | if (num_ref_pics >= HEVC_MAX_DPB_SIZE) { |
562 | ✗ | av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid stream: " | |
563 | "short-term ref pic set %d " | ||
564 | "contains too many pictures.\n", st_rps_idx); | ||
565 | ✗ | return AVERROR_INVALIDDATA; | |
566 | } | ||
567 | |||
568 | // Since the stored form of an RPS here is actually the delta-step | ||
569 | // form used when inter_ref_pic_set_prediction_flag is not set, we | ||
570 | // need to reconstruct that here in order to be able to refer to | ||
571 | // the RPS later (which is required for parsing, because we don't | ||
572 | // even know what syntax elements appear without it). Therefore, | ||
573 | // this code takes the delta-step form of the reference set, turns | ||
574 | // it into the delta-array form, applies the prediction process of | ||
575 | // 7.4.8, converts the result back to the delta-step form, and | ||
576 | // stores that as the current set for future use. Note that the | ||
577 | // inferences here mean that writers using prediction will need | ||
578 | // to fill in the delta-step values correctly as well - since the | ||
579 | // whole RPS prediction process is somewhat overly sophisticated, | ||
580 | // this hopefully forms a useful check for them to ensure their | ||
581 | // predicted form actually matches what was intended rather than | ||
582 | // an onerous additional requirement. | ||
583 | |||
584 | 2398 | d_poc = 0; | |
585 |
2/2✓ Branch 0 taken 2698 times.
✓ Branch 1 taken 1199 times.
|
7794 | for (i = 0; i < ref->num_negative_pics; i++) { |
586 | 5396 | d_poc -= ref->delta_poc_s0_minus1[i] + 1; | |
587 | 5396 | ref_delta_poc_s0[i] = d_poc; | |
588 | } | ||
589 | 2398 | d_poc = 0; | |
590 |
2/2✓ Branch 0 taken 1361 times.
✓ Branch 1 taken 1199 times.
|
5120 | for (i = 0; i < ref->num_positive_pics; i++) { |
591 | 2722 | d_poc += ref->delta_poc_s1_minus1[i] + 1; | |
592 | 2722 | ref_delta_poc_s1[i] = d_poc; | |
593 | } | ||
594 | |||
595 | 2398 | i = 0; | |
596 |
2/2✓ Branch 0 taken 1361 times.
✓ Branch 1 taken 1199 times.
|
5120 | for (j = ref->num_positive_pics - 1; j >= 0; j--) { |
597 | 2722 | d_poc = ref_delta_poc_s1[j] + delta_rps; | |
598 |
3/4✓ Branch 0 taken 349 times.
✓ Branch 1 taken 1012 times.
✓ Branch 2 taken 349 times.
✗ Branch 3 not taken.
|
2722 | if (d_poc < 0 && current->use_delta_flag[ref->num_negative_pics + j]) { |
599 | 698 | delta_poc_s0[i] = d_poc; | |
600 | 698 | used_by_curr_pic_s0[i++] = | |
601 | 698 | current->used_by_curr_pic_flag[ref->num_negative_pics + j]; | |
602 | } | ||
603 | } | ||
604 |
4/4✓ Branch 0 taken 605 times.
✓ Branch 1 taken 594 times.
✓ Branch 2 taken 236 times.
✓ Branch 3 taken 369 times.
|
2398 | if (delta_rps < 0 && current->use_delta_flag[num_delta_pocs]) { |
605 | 472 | delta_poc_s0[i] = delta_rps; | |
606 | 472 | used_by_curr_pic_s0[i++] = | |
607 | 472 | current->used_by_curr_pic_flag[num_delta_pocs]; | |
608 | } | ||
609 |
2/2✓ Branch 0 taken 2698 times.
✓ Branch 1 taken 1199 times.
|
7794 | for (j = 0; j < ref->num_negative_pics; j++) { |
610 | 5396 | d_poc = ref_delta_poc_s0[j] + delta_rps; | |
611 |
3/4✓ Branch 0 taken 2698 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1978 times.
✓ Branch 3 taken 720 times.
|
5396 | if (d_poc < 0 && current->use_delta_flag[j]) { |
612 | 3956 | delta_poc_s0[i] = d_poc; | |
613 | 3956 | used_by_curr_pic_s0[i++] = current->used_by_curr_pic_flag[j]; | |
614 | } | ||
615 | } | ||
616 | |||
617 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 587 times.
|
2398 | infer(num_negative_pics, i); |
618 |
2/2✓ Branch 0 taken 2563 times.
✓ Branch 1 taken 1199 times.
|
7524 | for (i = 0; i < current->num_negative_pics; i++) { |
619 |
3/6✓ Branch 0 taken 1412 times.
✓ Branch 1 taken 1151 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1255 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
5126 | infer(delta_poc_s0_minus1[i], |
620 | -(delta_poc_s0[i] - (i == 0 ? 0 : delta_poc_s0[i - 1])) - 1); | ||
621 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1255 times.
|
5126 | infer(used_by_curr_pic_s0_flag[i], used_by_curr_pic_s0[i]); |
622 | } | ||
623 | |||
624 | 2398 | i = 0; | |
625 |
2/2✓ Branch 0 taken 2698 times.
✓ Branch 1 taken 1199 times.
|
7794 | for (j = ref->num_negative_pics - 1; j >= 0; j--) { |
626 | 5396 | d_poc = ref_delta_poc_s0[j] + delta_rps; | |
627 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 2698 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
5396 | if (d_poc > 0 && current->use_delta_flag[j]) { |
628 | ✗ | delta_poc_s1[i] = d_poc; | |
629 | ✗ | used_by_curr_pic_s1[i++] = current->used_by_curr_pic_flag[j]; | |
630 | } | ||
631 | } | ||
632 |
4/4✓ Branch 0 taken 594 times.
✓ Branch 1 taken 605 times.
✓ Branch 2 taken 575 times.
✓ Branch 3 taken 19 times.
|
2398 | if (delta_rps > 0 && current->use_delta_flag[num_delta_pocs]) { |
633 | 1150 | delta_poc_s1[i] = delta_rps; | |
634 | 1150 | used_by_curr_pic_s1[i++] = | |
635 | 1150 | current->used_by_curr_pic_flag[num_delta_pocs]; | |
636 | } | ||
637 |
2/2✓ Branch 0 taken 1361 times.
✓ Branch 1 taken 1199 times.
|
5120 | for (j = 0; j < ref->num_positive_pics; j++) { |
638 | 2722 | d_poc = ref_delta_poc_s1[j] + delta_rps; | |
639 |
4/4✓ Branch 0 taken 1012 times.
✓ Branch 1 taken 349 times.
✓ Branch 2 taken 924 times.
✓ Branch 3 taken 88 times.
|
2722 | if (d_poc > 0 && current->use_delta_flag[ref->num_negative_pics + j]) { |
640 | 1848 | delta_poc_s1[i] = d_poc; | |
641 | 1848 | used_by_curr_pic_s1[i++] = | |
642 | 1848 | current->used_by_curr_pic_flag[ref->num_negative_pics + j]; | |
643 | } | ||
644 | } | ||
645 | |||
646 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 587 times.
|
2398 | infer(num_positive_pics, i); |
647 |
2/2✓ Branch 0 taken 1499 times.
✓ Branch 1 taken 1199 times.
|
5396 | for (i = 0; i < current->num_positive_pics; i++) { |
648 |
3/6✓ Branch 0 taken 598 times.
✓ Branch 1 taken 901 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 740 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
2998 | infer(delta_poc_s1_minus1[i], |
649 | delta_poc_s1[i] - (i == 0 ? 0 : delta_poc_s1[i - 1]) - 1); | ||
650 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 740 times.
|
2998 | infer(used_by_curr_pic_s1_flag[i], used_by_curr_pic_s1[i]); |
651 | } | ||
652 | |||
653 | } else { | ||
654 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 3566 times.
|
7132 | ue(num_negative_pics, 0, 15); |
655 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 3566 times.
|
7132 | ue(num_positive_pics, 0, 15 - current->num_negative_pics); |
656 | |||
657 |
2/2✓ Branch 0 taken 9792 times.
✓ Branch 1 taken 3566 times.
|
26716 | for (i = 0; i < current->num_negative_pics; i++) { |
658 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 9792 times.
|
19584 | ues(delta_poc_s0_minus1[i], 0, INT16_MAX, 1, i); |
659 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 9792 times.
|
19584 | flags(used_by_curr_pic_s0_flag[i], 1, i); |
660 | } | ||
661 | |||
662 |
2/2✓ Branch 0 taken 810 times.
✓ Branch 1 taken 3566 times.
|
8752 | for (i = 0; i < current->num_positive_pics; i++) { |
663 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 810 times.
|
1620 | ues(delta_poc_s1_minus1[i], 0, INT16_MAX, 1, i); |
664 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 810 times.
|
1620 | flags(used_by_curr_pic_s1_flag[i], 1, i); |
665 | } | ||
666 | } | ||
667 | |||
668 | 9530 | return 0; | |
669 | } | ||
670 | |||
671 | 352 | static int FUNC(scaling_list_data)(CodedBitstreamContext *ctx, RWContext *rw, | |
672 | H265RawScalingList *current) | ||
673 | { | ||
674 | int sizeId, matrixId; | ||
675 | int err, n, i; | ||
676 | |||
677 |
2/2✓ Branch 0 taken 704 times.
✓ Branch 1 taken 176 times.
|
1760 | for (sizeId = 0; sizeId < 4; sizeId++) { |
678 |
4/4✓ Branch 0 taken 352 times.
✓ Branch 1 taken 3168 times.
✓ Branch 2 taken 3520 times.
✓ Branch 3 taken 704 times.
|
8448 | for (matrixId = 0; matrixId < 6; matrixId += (sizeId == 3 ? 3 : 1)) { |
679 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 3520 times.
|
7040 | flags(scaling_list_pred_mode_flag[sizeId][matrixId], |
680 | 2, sizeId, matrixId); | ||
681 |
2/2✓ Branch 0 taken 1564 times.
✓ Branch 1 taken 1956 times.
|
7040 | if (!current->scaling_list_pred_mode_flag[sizeId][matrixId]) { |
682 |
3/4✓ Branch 0 taken 8 times.
✓ Branch 1 taken 1556 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1564 times.
|
3128 | ues(scaling_list_pred_matrix_id_delta[sizeId][matrixId], |
683 | 0, sizeId == 3 ? matrixId / 3 : matrixId, | ||
684 | 2, sizeId, matrixId); | ||
685 | } else { | ||
686 | 3912 | n = FFMIN(64, 1 << (4 + (sizeId << 1))); | |
687 |
2/2✓ Branch 0 taken 1188 times.
✓ Branch 1 taken 768 times.
|
3912 | if (sizeId > 1) { |
688 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1188 times.
|
2376 | ses(scaling_list_dc_coef_minus8[sizeId - 2][matrixId], -7, +247, |
689 | 2, sizeId - 2, matrixId); | ||
690 | } | ||
691 |
2/2✓ Branch 0 taken 105600 times.
✓ Branch 1 taken 1956 times.
|
215112 | for (i = 0; i < n; i++) { |
692 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 105600 times.
|
211200 | ses(scaling_list_delta_coeff[sizeId][matrixId][i], |
693 | -128, +127, 3, sizeId, matrixId, i); | ||
694 | } | ||
695 | } | ||
696 | } | ||
697 | } | ||
698 | |||
699 | 352 | return 0; | |
700 | } | ||
701 | |||
702 | ✗ | static int FUNC(sps_range_extension)(CodedBitstreamContext *ctx, RWContext *rw, | |
703 | H265RawSPS *current) | ||
704 | { | ||
705 | int err; | ||
706 | |||
707 | ✗ | flag(transform_skip_rotation_enabled_flag); | |
708 | ✗ | flag(transform_skip_context_enabled_flag); | |
709 | ✗ | flag(implicit_rdpcm_enabled_flag); | |
710 | ✗ | flag(explicit_rdpcm_enabled_flag); | |
711 | ✗ | flag(extended_precision_processing_flag); | |
712 | ✗ | flag(intra_smoothing_disabled_flag); | |
713 | ✗ | flag(high_precision_offsets_enabled_flag); | |
714 | ✗ | flag(persistent_rice_adaptation_enabled_flag); | |
715 | ✗ | flag(cabac_bypass_alignment_enabled_flag); | |
716 | |||
717 | ✗ | return 0; | |
718 | } | ||
719 | |||
720 | ✗ | static int FUNC(sps_scc_extension)(CodedBitstreamContext *ctx, RWContext *rw, | |
721 | H265RawSPS *current) | ||
722 | { | ||
723 | int err, comp, i; | ||
724 | |||
725 | ✗ | flag(sps_curr_pic_ref_enabled_flag); | |
726 | |||
727 | ✗ | flag(palette_mode_enabled_flag); | |
728 | ✗ | if (current->palette_mode_enabled_flag) { | |
729 | ✗ | ue(palette_max_size, 0, 64); | |
730 | ✗ | ue(delta_palette_max_predictor_size, 0, 128); | |
731 | |||
732 | ✗ | flag(sps_palette_predictor_initializer_present_flag); | |
733 | ✗ | if (current->sps_palette_predictor_initializer_present_flag) { | |
734 | ✗ | ue(sps_num_palette_predictor_initializer_minus1, 0, 127); | |
735 | ✗ | for (comp = 0; comp < (current->chroma_format_idc ? 3 : 1); comp++) { | |
736 | ✗ | int bit_depth = comp == 0 ? current->bit_depth_luma_minus8 + 8 | |
737 | ✗ | : current->bit_depth_chroma_minus8 + 8; | |
738 | ✗ | for (i = 0; i <= current->sps_num_palette_predictor_initializer_minus1; i++) | |
739 | ✗ | ubs(bit_depth, sps_palette_predictor_initializers[comp][i], 2, comp, i); | |
740 | } | ||
741 | } | ||
742 | } | ||
743 | |||
744 | ✗ | u(2, motion_vector_resolution_control_idc, 0, 2); | |
745 | ✗ | flag(intra_boundary_filtering_disable_flag); | |
746 | |||
747 | ✗ | return 0; | |
748 | } | ||
749 | |||
750 | ✗ | static int FUNC(sps_multilayer_extension)(CodedBitstreamContext *ctx, RWContext *rw, | |
751 | H265RawSPS *current) | ||
752 | { | ||
753 | int err; | ||
754 | |||
755 | ✗ | flag(inter_view_mv_vert_constraint_flag); | |
756 | |||
757 | ✗ | return 0; | |
758 | } | ||
759 | |||
760 | 128 | static int FUNC(vui_parameters_default)(CodedBitstreamContext *ctx, | |
761 | RWContext *rw, H265RawVUI *current, | ||
762 | H265RawSPS *sps) | ||
763 | { | ||
764 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
128 | infer(aspect_ratio_idc, 0); |
765 | |||
766 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
128 | infer(video_format, 5); |
767 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
128 | infer(video_full_range_flag, 0); |
768 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
128 | infer(colour_primaries, 2); |
769 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
128 | infer(transfer_characteristics, 2); |
770 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
128 | infer(matrix_coefficients, 2); |
771 | |||
772 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
128 | infer(chroma_sample_loc_type_top_field, 0); |
773 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
128 | infer(chroma_sample_loc_type_bottom_field, 0); |
774 | |||
775 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
128 | infer(tiles_fixed_structure_flag, 0); |
776 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
128 | infer(motion_vectors_over_pic_boundaries_flag, 1); |
777 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
128 | infer(min_spatial_segmentation_idc, 0); |
778 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
128 | infer(max_bytes_per_pic_denom, 2); |
779 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
128 | infer(max_bits_per_min_cu_denom, 1); |
780 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
128 | infer(log2_max_mv_length_horizontal, 15); |
781 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
128 | infer(log2_max_mv_length_vertical, 15); |
782 | |||
783 | 128 | return 0; | |
784 | } | ||
785 | |||
786 | 232 | static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw, | |
787 | H265RawSPS *current) | ||
788 | { | ||
789 | 232 | CodedBitstreamH265Context *h265 = ctx->priv_data; | |
790 | const H265RawVPS *vps; | ||
791 | int err, i; | ||
792 | unsigned int min_cb_log2_size_y, ctb_log2_size_y, | ||
793 | min_cb_size_y, min_tb_log2_size_y; | ||
794 | unsigned int multi_layer_ext_sps_flag; | ||
795 | |||
796 | 232 | HEADER("Sequence Parameter Set"); | |
797 | |||
798 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 116 times.
|
232 | CHECK(FUNC(nal_unit_header)(ctx, rw, ¤t->nal_unit_header, HEVC_NAL_SPS)); |
799 | |||
800 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 116 times.
|
232 | ub(4, sps_video_parameter_set_id); |
801 | 232 | h265->active_vps = vps = h265->vps[current->sps_video_parameter_set_id]; | |
802 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 116 times.
|
232 | if (!vps) { |
803 | ✗ | av_log(ctx->log_ctx, AV_LOG_ERROR, "VPS id %d not available.\n", | |
804 | ✗ | current->sps_video_parameter_set_id); | |
805 | ✗ | return AVERROR_INVALIDDATA; | |
806 | } | ||
807 | |||
808 |
1/2✓ Branch 0 taken 116 times.
✗ Branch 1 not taken.
|
232 | if (current->nal_unit_header.nuh_layer_id == 0) |
809 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 116 times.
|
232 | u(3, sps_max_sub_layers_minus1, 0, vps->vps_max_sub_layers_minus1); |
810 | else { | ||
811 | ✗ | u(3, sps_ext_or_max_sub_layers_minus1, 0, HEVC_MAX_SUB_LAYERS); | |
812 | ✗ | infer(sps_max_sub_layers_minus1, current->sps_ext_or_max_sub_layers_minus1 == HEVC_MAX_SUB_LAYERS | |
813 | ? vps->vps_max_sub_layers_minus1 | ||
814 | : current->sps_ext_or_max_sub_layers_minus1); | ||
815 | } | ||
816 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 116 times.
|
232 | multi_layer_ext_sps_flag = current->nal_unit_header.nuh_layer_id && |
817 | ✗ | current->sps_ext_or_max_sub_layers_minus1 == HEVC_MAX_SUB_LAYERS; | |
818 |
1/2✓ Branch 0 taken 116 times.
✗ Branch 1 not taken.
|
232 | if (!multi_layer_ext_sps_flag) { |
819 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 116 times.
|
232 | flag(sps_temporal_id_nesting_flag); |
820 | |||
821 |
2/2✓ Branch 0 taken 92 times.
✓ Branch 1 taken 24 times.
|
232 | if (vps->vps_temporal_id_nesting_flag && |
822 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 92 times.
|
184 | !current->sps_temporal_id_nesting_flag) { |
823 | ✗ | av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid stream: " | |
824 | "sps_temporal_id_nesting_flag must be 1 if " | ||
825 | "vps_temporal_id_nesting_flag is 1.\n"); | ||
826 | ✗ | return AVERROR_INVALIDDATA; | |
827 | } | ||
828 |
2/2✓ Branch 0 taken 92 times.
✓ Branch 1 taken 24 times.
|
232 | if (current->sps_max_sub_layers_minus1 == 0 && |
829 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 92 times.
|
184 | current->sps_temporal_id_nesting_flag != 1) { |
830 | ✗ | av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid stream: " | |
831 | "sps_temporal_id_nesting_flag must be 1 if " | ||
832 | "sps_max_sub_layers_minus1 is 0.\n"); | ||
833 | ✗ | return AVERROR_INVALIDDATA; | |
834 | } | ||
835 | |||
836 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 116 times.
|
232 | CHECK(FUNC(profile_tier_level)(ctx, rw, ¤t->profile_tier_level, |
837 | 1, current->sps_max_sub_layers_minus1)); | ||
838 | } else { | ||
839 | ✗ | if (current->sps_max_sub_layers_minus1 > 0) | |
840 | ✗ | infer(sps_temporal_id_nesting_flag, vps->vps_temporal_id_nesting_flag); | |
841 | else | ||
842 | ✗ | infer(sps_temporal_id_nesting_flag, 1); | |
843 | } | ||
844 | |||
845 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 116 times.
|
232 | ue(sps_seq_parameter_set_id, 0, 15); |
846 | |||
847 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 116 times.
|
232 | if (multi_layer_ext_sps_flag) { |
848 | ✗ | flag(update_rep_format_flag); | |
849 | ✗ | if (current->update_rep_format_flag) | |
850 | ✗ | ub(8, sps_rep_format_idx); | |
851 | } else { | ||
852 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 116 times.
|
232 | ue(chroma_format_idc, 0, 3); |
853 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 116 times.
|
232 | if (current->chroma_format_idc == 3) |
854 | ✗ | flag(separate_colour_plane_flag); | |
855 | else | ||
856 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 58 times.
|
232 | infer(separate_colour_plane_flag, 0); |
857 | |||
858 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 116 times.
|
232 | ue(pic_width_in_luma_samples, 1, HEVC_MAX_WIDTH); |
859 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 116 times.
|
232 | ue(pic_height_in_luma_samples, 1, HEVC_MAX_HEIGHT); |
860 | |||
861 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 116 times.
|
232 | flag(conformance_window_flag); |
862 |
2/2✓ Branch 0 taken 92 times.
✓ Branch 1 taken 24 times.
|
232 | if (current->conformance_window_flag) { |
863 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 92 times.
|
184 | ue(conf_win_left_offset, 0, current->pic_width_in_luma_samples); |
864 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 92 times.
|
184 | ue(conf_win_right_offset, 0, current->pic_width_in_luma_samples); |
865 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 92 times.
|
184 | ue(conf_win_top_offset, 0, current->pic_height_in_luma_samples); |
866 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 92 times.
|
184 | ue(conf_win_bottom_offset, 0, current->pic_height_in_luma_samples); |
867 | } else { | ||
868 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
|
48 | infer(conf_win_left_offset, 0); |
869 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
|
48 | infer(conf_win_right_offset, 0); |
870 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
|
48 | infer(conf_win_top_offset, 0); |
871 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
|
48 | infer(conf_win_bottom_offset, 0); |
872 | } | ||
873 | |||
874 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 116 times.
|
232 | ue(bit_depth_luma_minus8, 0, 8); |
875 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 116 times.
|
232 | ue(bit_depth_chroma_minus8, 0, 8); |
876 | } | ||
877 | |||
878 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 116 times.
|
232 | ue(log2_max_pic_order_cnt_lsb_minus4, 0, 12); |
879 | |||
880 |
1/2✓ Branch 0 taken 116 times.
✗ Branch 1 not taken.
|
232 | if (!multi_layer_ext_sps_flag) { |
881 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 116 times.
|
232 | flag(sps_sub_layer_ordering_info_present_flag); |
882 | 232 | for (i = (current->sps_sub_layer_ordering_info_present_flag ? | |
883 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 92 times.
|
232 | 0 : current->sps_max_sub_layers_minus1); |
884 |
2/2✓ Branch 0 taken 124 times.
✓ Branch 1 taken 116 times.
|
480 | i <= current->sps_max_sub_layers_minus1; i++) { |
885 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 124 times.
|
248 | ues(sps_max_dec_pic_buffering_minus1[i], |
886 | 0, HEVC_MAX_DPB_SIZE - 1, 1, i); | ||
887 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 124 times.
|
248 | ues(sps_max_num_reorder_pics[i], |
888 | 0, current->sps_max_dec_pic_buffering_minus1[i], 1, i); | ||
889 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 124 times.
|
248 | ues(sps_max_latency_increase_plus1[i], |
890 | 0, UINT32_MAX - 1, 1, i); | ||
891 | } | ||
892 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 92 times.
|
232 | if (!current->sps_sub_layer_ordering_info_present_flag) { |
893 |
2/2✓ Branch 0 taken 40 times.
✓ Branch 1 taken 24 times.
|
128 | for (i = 0; i < current->sps_max_sub_layers_minus1; i++) { |
894 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 20 times.
|
80 | infer(sps_max_dec_pic_buffering_minus1[i], |
895 | current->sps_max_dec_pic_buffering_minus1[current->sps_max_sub_layers_minus1]); | ||
896 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 20 times.
|
80 | infer(sps_max_num_reorder_pics[i], |
897 | current->sps_max_num_reorder_pics[current->sps_max_sub_layers_minus1]); | ||
898 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 20 times.
|
80 | infer(sps_max_latency_increase_plus1[i], |
899 | current->sps_max_latency_increase_plus1[current->sps_max_sub_layers_minus1]); | ||
900 | } | ||
901 | } | ||
902 | } | ||
903 | |||
904 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 116 times.
|
232 | ue(log2_min_luma_coding_block_size_minus3, 0, 3); |
905 | 232 | min_cb_log2_size_y = current->log2_min_luma_coding_block_size_minus3 + 3; | |
906 | |||
907 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 116 times.
|
232 | ue(log2_diff_max_min_luma_coding_block_size, 0, 3); |
908 | 232 | ctb_log2_size_y = min_cb_log2_size_y + | |
909 | 232 | current->log2_diff_max_min_luma_coding_block_size; | |
910 | |||
911 | 232 | min_cb_size_y = 1 << min_cb_log2_size_y; | |
912 |
1/2✓ Branch 0 taken 116 times.
✗ Branch 1 not taken.
|
232 | if (current->pic_width_in_luma_samples % min_cb_size_y || |
913 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 116 times.
|
232 | current->pic_height_in_luma_samples % min_cb_size_y) { |
914 | ✗ | av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid dimensions: %ux%u not divisible " | |
915 | ✗ | "by MinCbSizeY = %u.\n", current->pic_width_in_luma_samples, | |
916 | ✗ | current->pic_height_in_luma_samples, min_cb_size_y); | |
917 | ✗ | return AVERROR_INVALIDDATA; | |
918 | } | ||
919 | |||
920 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 116 times.
|
232 | ue(log2_min_luma_transform_block_size_minus2, 0, min_cb_log2_size_y - 3); |
921 | 232 | min_tb_log2_size_y = current->log2_min_luma_transform_block_size_minus2 + 2; | |
922 | |||
923 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 116 times.
|
232 | ue(log2_diff_max_min_luma_transform_block_size, |
924 | 0, FFMIN(ctb_log2_size_y, 5) - min_tb_log2_size_y); | ||
925 | |||
926 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 116 times.
|
232 | ue(max_transform_hierarchy_depth_inter, |
927 | 0, ctb_log2_size_y - min_tb_log2_size_y); | ||
928 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 116 times.
|
232 | ue(max_transform_hierarchy_depth_intra, |
929 | 0, ctb_log2_size_y - min_tb_log2_size_y); | ||
930 | |||
931 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 116 times.
|
232 | flag(scaling_list_enabled_flag); |
932 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 108 times.
|
232 | if (current->scaling_list_enabled_flag) { |
933 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
16 | if (multi_layer_ext_sps_flag) |
934 | ✗ | flag(sps_infer_scaling_list_flag); | |
935 | else | ||
936 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
16 | infer(sps_infer_scaling_list_flag, 0); |
937 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
16 | if (current->sps_infer_scaling_list_flag) |
938 | ✗ | ub(6, sps_scaling_list_ref_layer_id); | |
939 | else { | ||
940 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
|
16 | flag(sps_scaling_list_data_present_flag); |
941 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
16 | if (current->sps_scaling_list_data_present_flag) |
942 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
|
16 | CHECK(FUNC(scaling_list_data)(ctx, rw, ¤t->scaling_list)); |
943 | } | ||
944 | } else { | ||
945 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 54 times.
|
216 | infer(sps_scaling_list_data_present_flag, 0); |
946 | } | ||
947 | |||
948 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 116 times.
|
232 | flag(amp_enabled_flag); |
949 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 116 times.
|
232 | flag(sample_adaptive_offset_enabled_flag); |
950 | |||
951 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 116 times.
|
232 | flag(pcm_enabled_flag); |
952 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 112 times.
|
232 | if (current->pcm_enabled_flag) { |
953 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
|
8 | u(4, pcm_sample_bit_depth_luma_minus1, |
954 | 0, current->bit_depth_luma_minus8 + 8 - 1); | ||
955 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
|
8 | u(4, pcm_sample_bit_depth_chroma_minus1, |
956 | 0, current->bit_depth_chroma_minus8 + 8 - 1); | ||
957 | |||
958 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
|
8 | ue(log2_min_pcm_luma_coding_block_size_minus3, |
959 | FFMIN(min_cb_log2_size_y, 5) - 3, FFMIN(ctb_log2_size_y, 5) - 3); | ||
960 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
|
8 | ue(log2_diff_max_min_pcm_luma_coding_block_size, |
961 | 0, FFMIN(ctb_log2_size_y, 5) - (current->log2_min_pcm_luma_coding_block_size_minus3 + 3)); | ||
962 | |||
963 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
|
8 | flag(pcm_loop_filter_disabled_flag); |
964 | } | ||
965 | |||
966 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 116 times.
|
232 | ue(num_short_term_ref_pic_sets, 0, HEVC_MAX_SHORT_TERM_REF_PIC_SETS); |
967 |
2/2✓ Branch 0 taken 1004 times.
✓ Branch 1 taken 116 times.
|
2240 | for (i = 0; i < current->num_short_term_ref_pic_sets; i++) |
968 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1004 times.
|
2008 | CHECK(FUNC(st_ref_pic_set)(ctx, rw, ¤t->st_ref_pic_set[i], i, current)); |
969 | |||
970 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 116 times.
|
232 | flag(long_term_ref_pics_present_flag); |
971 |
2/2✓ Branch 0 taken 28 times.
✓ Branch 1 taken 88 times.
|
232 | if (current->long_term_ref_pics_present_flag) { |
972 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 28 times.
|
56 | ue(num_long_term_ref_pics_sps, 0, HEVC_MAX_LONG_TERM_REF_PICS); |
973 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 28 times.
|
120 | for (i = 0; i < current->num_long_term_ref_pics_sps; i++) { |
974 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 32 times.
|
64 | ubs(current->log2_max_pic_order_cnt_lsb_minus4 + 4, |
975 | lt_ref_pic_poc_lsb_sps[i], 1, i); | ||
976 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 32 times.
|
64 | flags(used_by_curr_pic_lt_sps_flag[i], 1, i); |
977 | } | ||
978 | } | ||
979 | |||
980 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 116 times.
|
232 | flag(sps_temporal_mvp_enabled_flag); |
981 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 116 times.
|
232 | flag(strong_intra_smoothing_enabled_flag); |
982 | |||
983 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 116 times.
|
232 | flag(vui_parameters_present_flag); |
984 |
2/2✓ Branch 0 taken 52 times.
✓ Branch 1 taken 64 times.
|
232 | if (current->vui_parameters_present_flag) |
985 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 52 times.
|
104 | CHECK(FUNC(vui_parameters)(ctx, rw, ¤t->vui, current)); |
986 | else | ||
987 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 64 times.
|
128 | CHECK(FUNC(vui_parameters_default)(ctx, rw, ¤t->vui, current)); |
988 | |||
989 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 116 times.
|
232 | flag(sps_extension_present_flag); |
990 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 116 times.
|
232 | if (current->sps_extension_present_flag) { |
991 | ✗ | flag(sps_range_extension_flag); | |
992 | ✗ | flag(sps_multilayer_extension_flag); | |
993 | ✗ | flag(sps_3d_extension_flag); | |
994 | ✗ | flag(sps_scc_extension_flag); | |
995 | ✗ | ub(4, sps_extension_4bits); | |
996 | } | ||
997 | |||
998 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 116 times.
|
232 | if (current->sps_range_extension_flag) |
999 | ✗ | CHECK(FUNC(sps_range_extension)(ctx, rw, current)); | |
1000 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 116 times.
|
232 | if (current->sps_multilayer_extension_flag) |
1001 | ✗ | CHECK(FUNC(sps_multilayer_extension)(ctx, rw, current)); | |
1002 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 116 times.
|
232 | if (current->sps_3d_extension_flag) |
1003 | ✗ | return AVERROR_PATCHWELCOME; | |
1004 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 116 times.
|
232 | if (current->sps_scc_extension_flag) |
1005 | ✗ | CHECK(FUNC(sps_scc_extension)(ctx, rw, current)); | |
1006 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 116 times.
|
232 | if (current->sps_extension_4bits) |
1007 | ✗ | CHECK(FUNC(extension_data)(ctx, rw, ¤t->extension_data)); | |
1008 | |||
1009 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 116 times.
|
232 | CHECK(FUNC(rbsp_trailing_bits)(ctx, rw)); |
1010 | |||
1011 | 232 | return 0; | |
1012 | } | ||
1013 | |||
1014 | ✗ | static int FUNC(pps_range_extension)(CodedBitstreamContext *ctx, RWContext *rw, | |
1015 | H265RawPPS *current) | ||
1016 | { | ||
1017 | ✗ | CodedBitstreamH265Context *h265 = ctx->priv_data; | |
1018 | ✗ | const H265RawSPS *sps = h265->active_sps; | |
1019 | int err, i; | ||
1020 | |||
1021 | ✗ | if (current->transform_skip_enabled_flag) | |
1022 | ✗ | ue(log2_max_transform_skip_block_size_minus2, 0, 3); | |
1023 | ✗ | flag(cross_component_prediction_enabled_flag); | |
1024 | |||
1025 | ✗ | flag(chroma_qp_offset_list_enabled_flag); | |
1026 | ✗ | if (current->chroma_qp_offset_list_enabled_flag) { | |
1027 | ✗ | ue(diff_cu_chroma_qp_offset_depth, | |
1028 | 0, sps->log2_diff_max_min_luma_coding_block_size); | ||
1029 | ✗ | ue(chroma_qp_offset_list_len_minus1, 0, 5); | |
1030 | ✗ | for (i = 0; i <= current->chroma_qp_offset_list_len_minus1; i++) { | |
1031 | ✗ | ses(cb_qp_offset_list[i], -12, +12, 1, i); | |
1032 | ✗ | ses(cr_qp_offset_list[i], -12, +12, 1, i); | |
1033 | } | ||
1034 | } | ||
1035 | |||
1036 | ✗ | ue(log2_sao_offset_scale_luma, 0, FFMAX(0, sps->bit_depth_luma_minus8 - 2)); | |
1037 | ✗ | ue(log2_sao_offset_scale_chroma, 0, FFMAX(0, sps->bit_depth_chroma_minus8 - 2)); | |
1038 | |||
1039 | ✗ | return 0; | |
1040 | } | ||
1041 | |||
1042 | ✗ | static int FUNC(colour_mapping_octants)(CodedBitstreamContext *ctx, RWContext *rw, | |
1043 | H265RawPPS *current, unsigned int inp_depth, | ||
1044 | unsigned int idx_y, unsigned int idx_cb, | ||
1045 | unsigned int idx_cr, unsigned int inp_length) | ||
1046 | { | ||
1047 | int part_num_y, cm_res_bits; | ||
1048 | int err; | ||
1049 | |||
1050 | ✗ | part_num_y = 1 << current->cm_y_part_num_log2; | |
1051 | |||
1052 | ✗ | av_assert0(inp_depth <= 1); | |
1053 | ✗ | if (inp_depth < current->cm_octant_depth) | |
1054 | ✗ | flags(split_octant_flag[inp_depth], 1, inp_depth); | |
1055 | else | ||
1056 | ✗ | infer(split_octant_flag[inp_depth], 0); | |
1057 | |||
1058 | ✗ | if (current->split_octant_flag[inp_depth]) | |
1059 | ✗ | for (int k = 0; k < 2; k++) | |
1060 | ✗ | for (int m = 0; m < 2; m++) | |
1061 | ✗ | for (int n = 0; n < 2; n++) | |
1062 | ✗ | CHECK(FUNC(colour_mapping_octants)(ctx, rw, current, inp_depth + 1, | |
1063 | idx_y + part_num_y * k * inp_length / 2, | ||
1064 | idx_cb + m * inp_length / 2, | ||
1065 | idx_cr + n * inp_length / 2, | ||
1066 | inp_length / 2)); | ||
1067 | else | ||
1068 | ✗ | for (int i = 0; i < part_num_y; i++) { | |
1069 | ✗ | int idx_shift_y = idx_y + (i << (current->cm_octant_depth - inp_depth)); | |
1070 | ✗ | for (int j = 0; j < 4; j++) { | |
1071 | ✗ | flags(coded_res_flag[idx_shift_y][idx_cb][idx_cr][j], | |
1072 | 4, idx_shift_y, idx_cb, idx_cr, j); | ||
1073 | ✗ | if (current->coded_res_flag[idx_shift_y][idx_cb][idx_cr][j]) { | |
1074 | ✗ | for (int c = 0; c < 3; c++) { | |
1075 | ✗ | ues(res_coeff_q[idx_shift_y][idx_cb][idx_cr][j][c], 0, 3, | |
1076 | 5, idx_shift_y, idx_cb, idx_cr, j, c); | ||
1077 | ✗ | cm_res_bits = FFMAX(0, 10 + (current->luma_bit_depth_cm_input_minus8 + 8) - | |
1078 | (current->luma_bit_depth_cm_output_minus8 + 8) - | ||
1079 | current->cm_res_quant_bits - (current->cm_delta_flc_bits_minus1 + 1)); | ||
1080 | ✗ | if (cm_res_bits) | |
1081 | ✗ | ubs(cm_res_bits, res_coeff_r[idx_shift_y][idx_cb][idx_cr][j][c], | |
1082 | 5, idx_shift_y, idx_cb, idx_cr, j, c); | ||
1083 | else | ||
1084 | ✗ | infer(res_coeff_r[idx_shift_y][idx_cb][idx_cr][j][c], 0); | |
1085 | ✗ | if (current->res_coeff_q[idx_shift_y][idx_cb][idx_cr][j][c] || | |
1086 | ✗ | current->res_coeff_r[idx_shift_y][idx_cb][idx_cr][j][c]) | |
1087 | ✗ | ub(1, res_coeff_s[idx_shift_y][idx_cb][idx_cr][j][c]); | |
1088 | else | ||
1089 | ✗ | infer(res_coeff_s[idx_shift_y][idx_cb][idx_cr][j][c], 0); | |
1090 | } | ||
1091 | } else { | ||
1092 | ✗ | for (int c = 0; c < 3; c++) { | |
1093 | ✗ | infer(res_coeff_q[idx_shift_y][idx_cb][idx_cr][j][c], 0); | |
1094 | ✗ | infer(res_coeff_r[idx_shift_y][idx_cb][idx_cr][j][c], 0); | |
1095 | ✗ | infer(res_coeff_s[idx_shift_y][idx_cb][idx_cr][j][c], 0); | |
1096 | } | ||
1097 | } | ||
1098 | } | ||
1099 | } | ||
1100 | |||
1101 | ✗ | return 0; | |
1102 | } | ||
1103 | |||
1104 | ✗ | static int FUNC(colour_mapping_table)(CodedBitstreamContext *ctx, RWContext *rw, | |
1105 | H265RawPPS *current) | ||
1106 | { | ||
1107 | int err; | ||
1108 | |||
1109 | ✗ | ue(num_cm_ref_layers_minus1, 0, 61); | |
1110 | ✗ | for (int i = 0; i <= current->num_cm_ref_layers_minus1; i++) | |
1111 | ✗ | ubs(6, cm_ref_layer_id[i], 1, i); | |
1112 | |||
1113 | ✗ | u(2, cm_octant_depth, 0, 1); | |
1114 | ✗ | u(2, cm_y_part_num_log2, 0, 3 - current->cm_octant_depth); | |
1115 | |||
1116 | ✗ | ue(luma_bit_depth_cm_input_minus8, 0, 8); | |
1117 | ✗ | ue(chroma_bit_depth_cm_input_minus8, 0, 8); | |
1118 | ✗ | ue(luma_bit_depth_cm_output_minus8, 0, 8); | |
1119 | ✗ | ue(chroma_bit_depth_cm_output_minus8, 0, 8); | |
1120 | |||
1121 | ✗ | ub(2, cm_res_quant_bits); | |
1122 | ✗ | ub(2, cm_delta_flc_bits_minus1); | |
1123 | |||
1124 | ✗ | if (current->cm_octant_depth == 1) { | |
1125 | ✗ | se(cm_adapt_threshold_u_delta, -32768, 32767); | |
1126 | ✗ | se(cm_adapt_threshold_v_delta, -32768, 32767); | |
1127 | } else { | ||
1128 | ✗ | infer(cm_adapt_threshold_u_delta, 0); | |
1129 | ✗ | infer(cm_adapt_threshold_v_delta, 0); | |
1130 | } | ||
1131 | |||
1132 | ✗ | CHECK(FUNC(colour_mapping_octants)(ctx, rw, current, 0, 0, 0, 0, 1 << current->cm_octant_depth)); | |
1133 | |||
1134 | ✗ | return 0; | |
1135 | } | ||
1136 | |||
1137 | ✗ | static int FUNC(pps_multilayer_extension)(CodedBitstreamContext *ctx, RWContext *rw, | |
1138 | H265RawPPS *current) | ||
1139 | { | ||
1140 | ✗ | CodedBitstreamH265Context *h265 = ctx->priv_data; | |
1141 | ✗ | const H265RawVPS *vps = h265->active_vps; | |
1142 | int offset; | ||
1143 | int err, i; | ||
1144 | |||
1145 | ✗ | flag(poc_reset_info_present_flag); | |
1146 | ✗ | flag(pps_infer_scaling_list_flag); | |
1147 | ✗ | if (current->pps_infer_scaling_list_flag) | |
1148 | ✗ | ub(6, pps_scaling_list_ref_layer_id); | |
1149 | |||
1150 | ✗ | if (!vps) { | |
1151 | ✗ | av_log(ctx->log_ctx, AV_LOG_ERROR, "VPS missing for PPS Multilayer Extension.\n"); | |
1152 | ✗ | return AVERROR_INVALIDDATA; | |
1153 | } | ||
1154 | |||
1155 | ✗ | ue(num_ref_loc_offsets, 0, vps->vps_max_layers_minus1); | |
1156 | ✗ | for (i = 0; i < current->num_ref_loc_offsets; i++) { | |
1157 | ✗ | ubs(6, ref_loc_offset_layer_id[i], 1, i); | |
1158 | ✗ | offset = current->ref_loc_offset_layer_id[i]; | |
1159 | ✗ | flags(scaled_ref_layer_offset_present_flag[i], 1, i); | |
1160 | ✗ | if (current->scaled_ref_layer_offset_present_flag[i]) { | |
1161 | ✗ | ses(scaled_ref_layer_left_offset[offset], -16384, 16383, 1, offset); | |
1162 | ✗ | ses(scaled_ref_layer_top_offset[offset], -16384, 16383, 1, offset); | |
1163 | ✗ | ses(scaled_ref_layer_right_offset[offset], -16384, 16383, 1, offset); | |
1164 | ✗ | ses(scaled_ref_layer_bottom_offset[offset], -16384, 16383, 1, offset); | |
1165 | } else { | ||
1166 | ✗ | infer(scaled_ref_layer_left_offset[offset], 0); | |
1167 | ✗ | infer(scaled_ref_layer_top_offset[offset], 0); | |
1168 | ✗ | infer(scaled_ref_layer_right_offset[offset], 0); | |
1169 | ✗ | infer(scaled_ref_layer_bottom_offset[offset], 0); | |
1170 | } | ||
1171 | ✗ | flags(ref_region_offset_present_flag[i], 1, i); | |
1172 | ✗ | if (current->ref_region_offset_present_flag[i]) { | |
1173 | ✗ | ses(ref_region_left_offset[offset], -16384, 16383, 1, offset); | |
1174 | ✗ | ses(ref_region_top_offset[offset], -16384, 16383, 1, offset); | |
1175 | ✗ | ses(ref_region_right_offset[offset], -16384, 16383, 1, offset); | |
1176 | ✗ | ses(ref_region_bottom_offset[offset], -16384, 16383, 1, offset); | |
1177 | } else { | ||
1178 | ✗ | infer(ref_region_left_offset[offset], 0); | |
1179 | ✗ | infer(ref_region_top_offset[offset], 0); | |
1180 | ✗ | infer(ref_region_right_offset[offset], 0); | |
1181 | ✗ | infer(ref_region_bottom_offset[offset], 0); | |
1182 | } | ||
1183 | ✗ | flags(resample_phase_set_present_flag[i], 1, i); | |
1184 | ✗ | if (current->resample_phase_set_present_flag[i]) { | |
1185 | ✗ | ues(phase_hor_luma[offset], 0, 31, 1, offset); | |
1186 | ✗ | ues(phase_ver_luma[offset], 0, 31, 1, offset); | |
1187 | ✗ | ues(phase_hor_chroma_plus8[offset], 0, 63, 1, offset); | |
1188 | ✗ | ues(phase_ver_chroma_plus8[offset], 0, 63, 1, offset); | |
1189 | } else { | ||
1190 | ✗ | infer(phase_hor_luma[offset], 0); | |
1191 | ✗ | infer(phase_ver_luma[offset], 0); | |
1192 | ✗ | infer(phase_hor_chroma_plus8[offset], 8); | |
1193 | } | ||
1194 | } | ||
1195 | |||
1196 | ✗ | flag(colour_mapping_enabled_flag); | |
1197 | ✗ | if (current->colour_mapping_enabled_flag) | |
1198 | ✗ | CHECK(FUNC(colour_mapping_table)(ctx, rw, current)); | |
1199 | |||
1200 | ✗ | return 0; | |
1201 | } | ||
1202 | |||
1203 | ✗ | static int FUNC(pps_scc_extension)(CodedBitstreamContext *ctx, RWContext *rw, | |
1204 | H265RawPPS *current) | ||
1205 | { | ||
1206 | int err, comp, i; | ||
1207 | |||
1208 | ✗ | flag(pps_curr_pic_ref_enabled_flag); | |
1209 | |||
1210 | ✗ | flag(residual_adaptive_colour_transform_enabled_flag); | |
1211 | ✗ | if (current->residual_adaptive_colour_transform_enabled_flag) { | |
1212 | ✗ | flag(pps_slice_act_qp_offsets_present_flag); | |
1213 | ✗ | se(pps_act_y_qp_offset_plus5, -7, +17); | |
1214 | ✗ | se(pps_act_cb_qp_offset_plus5, -7, +17); | |
1215 | ✗ | se(pps_act_cr_qp_offset_plus3, -9, +15); | |
1216 | } else { | ||
1217 | ✗ | infer(pps_slice_act_qp_offsets_present_flag, 0); | |
1218 | ✗ | infer(pps_act_y_qp_offset_plus5, 0); | |
1219 | ✗ | infer(pps_act_cb_qp_offset_plus5, 0); | |
1220 | ✗ | infer(pps_act_cr_qp_offset_plus3, 0); | |
1221 | } | ||
1222 | |||
1223 | ✗ | flag(pps_palette_predictor_initializer_present_flag); | |
1224 | ✗ | if (current->pps_palette_predictor_initializer_present_flag) { | |
1225 | ✗ | ue(pps_num_palette_predictor_initializer, 0, 128); | |
1226 | ✗ | if (current->pps_num_palette_predictor_initializer > 0) { | |
1227 | ✗ | flag(monochrome_palette_flag); | |
1228 | ✗ | ue(luma_bit_depth_entry_minus8, 0, 8); | |
1229 | ✗ | if (!current->monochrome_palette_flag) | |
1230 | ✗ | ue(chroma_bit_depth_entry_minus8, 0, 8); | |
1231 | ✗ | for (comp = 0; comp < (current->monochrome_palette_flag ? 1 : 3); comp++) { | |
1232 | ✗ | int bit_depth = comp == 0 ? current->luma_bit_depth_entry_minus8 + 8 | |
1233 | ✗ | : current->chroma_bit_depth_entry_minus8 + 8; | |
1234 | ✗ | for (i = 0; i < current->pps_num_palette_predictor_initializer; i++) | |
1235 | ✗ | ubs(bit_depth, pps_palette_predictor_initializers[comp][i], 2, comp, i); | |
1236 | } | ||
1237 | } | ||
1238 | } | ||
1239 | |||
1240 | ✗ | return 0; | |
1241 | } | ||
1242 | |||
1243 | 1132 | static int FUNC(pps)(CodedBitstreamContext *ctx, RWContext *rw, | |
1244 | H265RawPPS *current) | ||
1245 | { | ||
1246 | 1132 | CodedBitstreamH265Context *h265 = ctx->priv_data; | |
1247 | const H265RawSPS *sps; | ||
1248 | int err, i; | ||
1249 | |||
1250 | 1132 | HEADER("Picture Parameter Set"); | |
1251 | |||
1252 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 566 times.
|
1132 | CHECK(FUNC(nal_unit_header)(ctx, rw, ¤t->nal_unit_header, HEVC_NAL_PPS)); |
1253 | |||
1254 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 566 times.
|
1132 | ue(pps_pic_parameter_set_id, 0, 63); |
1255 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 566 times.
|
1132 | ue(pps_seq_parameter_set_id, 0, 15); |
1256 | 1132 | sps = h265->sps[current->pps_seq_parameter_set_id]; | |
1257 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 566 times.
|
1132 | if (!sps) { |
1258 | ✗ | av_log(ctx->log_ctx, AV_LOG_ERROR, "SPS id %d not available.\n", | |
1259 | ✗ | current->pps_seq_parameter_set_id); | |
1260 | ✗ | return AVERROR_INVALIDDATA; | |
1261 | } | ||
1262 | 1132 | h265->active_sps = sps; | |
1263 | |||
1264 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 566 times.
|
1132 | flag(dependent_slice_segments_enabled_flag); |
1265 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 566 times.
|
1132 | flag(output_flag_present_flag); |
1266 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 566 times.
|
1132 | ub(3, num_extra_slice_header_bits); |
1267 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 566 times.
|
1132 | flag(sign_data_hiding_enabled_flag); |
1268 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 566 times.
|
1132 | flag(cabac_init_present_flag); |
1269 | |||
1270 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 566 times.
|
1132 | ue(num_ref_idx_l0_default_active_minus1, 0, 14); |
1271 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 566 times.
|
1132 | ue(num_ref_idx_l1_default_active_minus1, 0, 14); |
1272 | |||
1273 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 566 times.
|
1132 | se(init_qp_minus26, -(26 + 6 * sps->bit_depth_luma_minus8), +25); |
1274 | |||
1275 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 566 times.
|
1132 | flag(constrained_intra_pred_flag); |
1276 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 566 times.
|
1132 | flag(transform_skip_enabled_flag); |
1277 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 566 times.
|
1132 | flag(cu_qp_delta_enabled_flag); |
1278 |
2/2✓ Branch 0 taken 28 times.
✓ Branch 1 taken 538 times.
|
1132 | if (current->cu_qp_delta_enabled_flag) |
1279 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 28 times.
|
56 | ue(diff_cu_qp_delta_depth, |
1280 | 0, sps->log2_diff_max_min_luma_coding_block_size); | ||
1281 | else | ||
1282 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 269 times.
|
1076 | infer(diff_cu_qp_delta_depth, 0); |
1283 | |||
1284 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 566 times.
|
1132 | se(pps_cb_qp_offset, -12, +12); |
1285 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 566 times.
|
1132 | se(pps_cr_qp_offset, -12, +12); |
1286 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 566 times.
|
1132 | flag(pps_slice_chroma_qp_offsets_present_flag); |
1287 | |||
1288 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 566 times.
|
1132 | flag(weighted_pred_flag); |
1289 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 566 times.
|
1132 | flag(weighted_bipred_flag); |
1290 | |||
1291 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 566 times.
|
1132 | flag(transquant_bypass_enabled_flag); |
1292 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 566 times.
|
1132 | flag(tiles_enabled_flag); |
1293 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 566 times.
|
1132 | flag(entropy_coding_sync_enabled_flag); |
1294 | |||
1295 |
2/2✓ Branch 0 taken 210 times.
✓ Branch 1 taken 356 times.
|
1132 | if (current->tiles_enabled_flag) { |
1296 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 210 times.
|
420 | ue(num_tile_columns_minus1, 0, HEVC_MAX_TILE_COLUMNS); |
1297 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 210 times.
|
420 | ue(num_tile_rows_minus1, 0, HEVC_MAX_TILE_ROWS); |
1298 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 210 times.
|
420 | flag(uniform_spacing_flag); |
1299 |
2/2✓ Branch 0 taken 202 times.
✓ Branch 1 taken 8 times.
|
420 | if (!current->uniform_spacing_flag) { |
1300 |
2/2✓ Branch 0 taken 808 times.
✓ Branch 1 taken 202 times.
|
2020 | for (i = 0; i < current->num_tile_columns_minus1; i++) |
1301 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 808 times.
|
1616 | ues(column_width_minus1[i], 0, sps->pic_width_in_luma_samples, 1, i); |
1302 |
2/2✓ Branch 0 taken 808 times.
✓ Branch 1 taken 202 times.
|
2020 | for (i = 0; i < current->num_tile_rows_minus1; i++) |
1303 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 808 times.
|
1616 | ues(row_height_minus1[i], 0, sps->pic_height_in_luma_samples, 1, i); |
1304 | } | ||
1305 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 210 times.
|
420 | flag(loop_filter_across_tiles_enabled_flag); |
1306 | } else { | ||
1307 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 178 times.
|
712 | infer(num_tile_columns_minus1, 0); |
1308 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 178 times.
|
712 | infer(num_tile_rows_minus1, 0); |
1309 | } | ||
1310 | |||
1311 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 566 times.
|
1132 | flag(pps_loop_filter_across_slices_enabled_flag); |
1312 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 566 times.
|
1132 | flag(deblocking_filter_control_present_flag); |
1313 |
2/2✓ Branch 0 taken 226 times.
✓ Branch 1 taken 340 times.
|
1132 | if (current->deblocking_filter_control_present_flag) { |
1314 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 226 times.
|
452 | flag(deblocking_filter_override_enabled_flag); |
1315 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 226 times.
|
452 | flag(pps_deblocking_filter_disabled_flag); |
1316 |
2/2✓ Branch 0 taken 222 times.
✓ Branch 1 taken 4 times.
|
452 | if (!current->pps_deblocking_filter_disabled_flag) { |
1317 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 222 times.
|
444 | se(pps_beta_offset_div2, -6, +6); |
1318 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 222 times.
|
444 | se(pps_tc_offset_div2, -6, +6); |
1319 | } else { | ||
1320 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
8 | infer(pps_beta_offset_div2, 0); |
1321 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
8 | infer(pps_tc_offset_div2, 0); |
1322 | } | ||
1323 | } else { | ||
1324 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 170 times.
|
680 | infer(deblocking_filter_override_enabled_flag, 0); |
1325 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 170 times.
|
680 | infer(pps_deblocking_filter_disabled_flag, 0); |
1326 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 170 times.
|
680 | infer(pps_beta_offset_div2, 0); |
1327 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 170 times.
|
680 | infer(pps_tc_offset_div2, 0); |
1328 | } | ||
1329 | |||
1330 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 566 times.
|
1132 | flag(pps_scaling_list_data_present_flag); |
1331 |
2/2✓ Branch 0 taken 168 times.
✓ Branch 1 taken 398 times.
|
1132 | if (current->pps_scaling_list_data_present_flag) |
1332 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 168 times.
|
336 | CHECK(FUNC(scaling_list_data)(ctx, rw, ¤t->scaling_list)); |
1333 | |||
1334 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 566 times.
|
1132 | flag(lists_modification_present_flag); |
1335 | |||
1336 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 566 times.
|
1132 | ue(log2_parallel_merge_level_minus2, |
1337 | 0, (sps->log2_min_luma_coding_block_size_minus3 + 3 + | ||
1338 | sps->log2_diff_max_min_luma_coding_block_size - 2)); | ||
1339 | |||
1340 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 566 times.
|
1132 | flag(slice_segment_header_extension_present_flag); |
1341 | |||
1342 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 566 times.
|
1132 | flag(pps_extension_present_flag); |
1343 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 566 times.
|
1132 | if (current->pps_extension_present_flag) { |
1344 | ✗ | flag(pps_range_extension_flag); | |
1345 | ✗ | flag(pps_multilayer_extension_flag); | |
1346 | ✗ | flag(pps_3d_extension_flag); | |
1347 | ✗ | flag(pps_scc_extension_flag); | |
1348 | ✗ | ub(4, pps_extension_4bits); | |
1349 | } | ||
1350 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 566 times.
|
1132 | if (current->pps_range_extension_flag) |
1351 | ✗ | CHECK(FUNC(pps_range_extension)(ctx, rw, current)); | |
1352 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 566 times.
|
1132 | if (current->pps_multilayer_extension_flag) |
1353 | ✗ | CHECK(FUNC(pps_multilayer_extension)(ctx, rw, current)); | |
1354 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 566 times.
|
1132 | if (current->pps_3d_extension_flag) |
1355 | ✗ | return AVERROR_PATCHWELCOME; | |
1356 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 566 times.
|
1132 | if (current->pps_scc_extension_flag) |
1357 | ✗ | CHECK(FUNC(pps_scc_extension)(ctx, rw, current)); | |
1358 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 566 times.
|
1132 | if (current->pps_extension_4bits) |
1359 | ✗ | CHECK(FUNC(extension_data)(ctx, rw, ¤t->extension_data)); | |
1360 | |||
1361 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 566 times.
|
1132 | CHECK(FUNC(rbsp_trailing_bits)(ctx, rw)); |
1362 | |||
1363 | 1132 | return 0; | |
1364 | } | ||
1365 | |||
1366 | 240 | static int FUNC(aud)(CodedBitstreamContext *ctx, RWContext *rw, | |
1367 | H265RawAUD *current) | ||
1368 | { | ||
1369 | int err; | ||
1370 | |||
1371 | 240 | HEADER("Access Unit Delimiter"); | |
1372 | |||
1373 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 120 times.
|
240 | CHECK(FUNC(nal_unit_header)(ctx, rw, ¤t->nal_unit_header, HEVC_NAL_AUD)); |
1374 | |||
1375 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 120 times.
|
240 | u(3, pic_type, 0, 2); |
1376 | |||
1377 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 120 times.
|
240 | CHECK(FUNC(rbsp_trailing_bits)(ctx, rw)); |
1378 | |||
1379 | 240 | return 0; | |
1380 | } | ||
1381 | |||
1382 | 2992 | static int FUNC(ref_pic_lists_modification)(CodedBitstreamContext *ctx, RWContext *rw, | |
1383 | H265RawSliceHeader *current, | ||
1384 | unsigned int num_pic_total_curr) | ||
1385 | { | ||
1386 | unsigned int entry_size; | ||
1387 | int err, i; | ||
1388 | |||
1389 | 2992 | entry_size = av_log2(num_pic_total_curr - 1) + 1; | |
1390 | |||
1391 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1496 times.
|
2992 | flag(ref_pic_list_modification_flag_l0); |
1392 |
2/2✓ Branch 0 taken 726 times.
✓ Branch 1 taken 770 times.
|
2992 | if (current->ref_pic_list_modification_flag_l0) { |
1393 |
2/2✓ Branch 0 taken 1672 times.
✓ Branch 1 taken 726 times.
|
4796 | for (i = 0; i <= current->num_ref_idx_l0_active_minus1; i++) |
1394 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1672 times.
|
3344 | us(entry_size, list_entry_l0[i], 0, num_pic_total_curr - 1, 1, i); |
1395 | } | ||
1396 | |||
1397 |
1/2✓ Branch 0 taken 1496 times.
✗ Branch 1 not taken.
|
2992 | if (current->slice_type == HEVC_SLICE_B) { |
1398 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1496 times.
|
2992 | flag(ref_pic_list_modification_flag_l1); |
1399 |
2/2✓ Branch 0 taken 426 times.
✓ Branch 1 taken 1070 times.
|
2992 | if (current->ref_pic_list_modification_flag_l1) { |
1400 |
2/2✓ Branch 0 taken 1010 times.
✓ Branch 1 taken 426 times.
|
2872 | for (i = 0; i <= current->num_ref_idx_l1_active_minus1; i++) |
1401 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1010 times.
|
2020 | us(entry_size, list_entry_l1[i], 0, num_pic_total_curr - 1, 1, i); |
1402 | } | ||
1403 | } | ||
1404 | |||
1405 | 2992 | return 0; | |
1406 | } | ||
1407 | |||
1408 | 1020 | static int FUNC(pred_weight_table)(CodedBitstreamContext *ctx, RWContext *rw, | |
1409 | H265RawSliceHeader *current) | ||
1410 | { | ||
1411 | 1020 | CodedBitstreamH265Context *h265 = ctx->priv_data; | |
1412 | 1020 | const H265RawSPS *sps = h265->active_sps; | |
1413 | int err, i, j; | ||
1414 |
1/2✓ Branch 0 taken 510 times.
✗ Branch 1 not taken.
|
2040 | int chroma = !sps->separate_colour_plane_flag && |
1415 |
1/2✓ Branch 0 taken 510 times.
✗ Branch 1 not taken.
|
1020 | sps->chroma_format_idc != 0; |
1416 | |||
1417 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 510 times.
|
1020 | ue(luma_log2_weight_denom, 0, 7); |
1418 |
1/2✓ Branch 0 taken 510 times.
✗ Branch 1 not taken.
|
1020 | if (chroma) |
1419 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 510 times.
|
1020 | se(delta_chroma_log2_weight_denom, -7, 7); |
1420 | else | ||
1421 | ✗ | infer(delta_chroma_log2_weight_denom, 0); | |
1422 | |||
1423 |
2/2✓ Branch 0 taken 2028 times.
✓ Branch 1 taken 510 times.
|
5076 | for (i = 0; i <= current->num_ref_idx_l0_active_minus1; i++) { |
1424 | if (1 /* is not same POC and same layer_id */) | ||
1425 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2028 times.
|
4056 | flags(luma_weight_l0_flag[i], 1, i); |
1426 | else | ||
1427 | infer(luma_weight_l0_flag[i], 0); | ||
1428 | } | ||
1429 |
1/2✓ Branch 0 taken 510 times.
✗ Branch 1 not taken.
|
1020 | if (chroma) { |
1430 |
2/2✓ Branch 0 taken 2028 times.
✓ Branch 1 taken 510 times.
|
5076 | for (i = 0; i <= current->num_ref_idx_l0_active_minus1; i++) { |
1431 | if (1 /* is not same POC and same layer_id */) | ||
1432 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2028 times.
|
4056 | flags(chroma_weight_l0_flag[i], 1, i); |
1433 | else | ||
1434 | infer(chroma_weight_l0_flag[i], 0); | ||
1435 | } | ||
1436 | } | ||
1437 | |||
1438 |
2/2✓ Branch 0 taken 2028 times.
✓ Branch 1 taken 510 times.
|
5076 | for (i = 0; i <= current->num_ref_idx_l0_active_minus1; i++) { |
1439 |
2/2✓ Branch 0 taken 1540 times.
✓ Branch 1 taken 488 times.
|
4056 | if (current->luma_weight_l0_flag[i]) { |
1440 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1540 times.
|
3080 | ses(delta_luma_weight_l0[i], -128, +127, 1, i); |
1441 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1540 times.
|
3080 | ses(luma_offset_l0[i], |
1442 | -(1 << (sps->bit_depth_luma_minus8 + 8 - 1)), | ||
1443 | ((1 << (sps->bit_depth_luma_minus8 + 8 - 1)) - 1), 1, i); | ||
1444 | } else { | ||
1445 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 244 times.
|
976 | infer(delta_luma_weight_l0[i], 0); |
1446 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 244 times.
|
976 | infer(luma_offset_l0[i], 0); |
1447 | } | ||
1448 |
2/2✓ Branch 0 taken 506 times.
✓ Branch 1 taken 1522 times.
|
4056 | if (current->chroma_weight_l0_flag[i]) { |
1449 |
2/2✓ Branch 0 taken 1012 times.
✓ Branch 1 taken 506 times.
|
3036 | for (j = 0; j < 2; j++) { |
1450 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1012 times.
|
2024 | ses(delta_chroma_weight_l0[i][j], -128, +127, 2, i, j); |
1451 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1012 times.
|
2024 | ses(chroma_offset_l0[i][j], |
1452 | -(4 << (sps->bit_depth_chroma_minus8 + 8 - 1)), | ||
1453 | ((4 << (sps->bit_depth_chroma_minus8 + 8 - 1)) - 1), 2, i, j); | ||
1454 | } | ||
1455 | } else { | ||
1456 |
2/2✓ Branch 0 taken 3044 times.
✓ Branch 1 taken 1522 times.
|
9132 | for (j = 0; j < 2; j++) { |
1457 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1522 times.
|
6088 | infer(delta_chroma_weight_l0[i][j], 0); |
1458 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1522 times.
|
6088 | infer(chroma_offset_l0[i][j], 0); |
1459 | } | ||
1460 | } | ||
1461 | } | ||
1462 | |||
1463 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 510 times.
|
1020 | if (current->slice_type == HEVC_SLICE_B) { |
1464 | ✗ | for (i = 0; i <= current->num_ref_idx_l1_active_minus1; i++) { | |
1465 | if (1 /* RefPicList1[i] is not CurrPic, nor is it in a different layer */) | ||
1466 | ✗ | flags(luma_weight_l1_flag[i], 1, i); | |
1467 | else | ||
1468 | infer(luma_weight_l1_flag[i], 0); | ||
1469 | } | ||
1470 | ✗ | if (chroma) { | |
1471 | ✗ | for (i = 0; i <= current->num_ref_idx_l1_active_minus1; i++) { | |
1472 | if (1 /* RefPicList1[i] is not CurrPic, nor is it in a different layer */) | ||
1473 | ✗ | flags(chroma_weight_l1_flag[i], 1, i); | |
1474 | else | ||
1475 | infer(chroma_weight_l1_flag[i], 0); | ||
1476 | } | ||
1477 | } | ||
1478 | |||
1479 | ✗ | for (i = 0; i <= current->num_ref_idx_l1_active_minus1; i++) { | |
1480 | ✗ | if (current->luma_weight_l1_flag[i]) { | |
1481 | ✗ | ses(delta_luma_weight_l1[i], -128, +127, 1, i); | |
1482 | ✗ | ses(luma_offset_l1[i], | |
1483 | -(1 << (sps->bit_depth_luma_minus8 + 8 - 1)), | ||
1484 | ((1 << (sps->bit_depth_luma_minus8 + 8 - 1)) - 1), 1, i); | ||
1485 | } else { | ||
1486 | ✗ | infer(delta_luma_weight_l1[i], 0); | |
1487 | ✗ | infer(luma_offset_l1[i], 0); | |
1488 | } | ||
1489 | ✗ | if (current->chroma_weight_l1_flag[i]) { | |
1490 | ✗ | for (j = 0; j < 2; j++) { | |
1491 | ✗ | ses(delta_chroma_weight_l1[i][j], -128, +127, 2, i, j); | |
1492 | ✗ | ses(chroma_offset_l1[i][j], | |
1493 | -(4 << (sps->bit_depth_chroma_minus8 + 8 - 1)), | ||
1494 | ((4 << (sps->bit_depth_chroma_minus8 + 8 - 1)) - 1), 2, i, j); | ||
1495 | } | ||
1496 | } else { | ||
1497 | ✗ | for (j = 0; j < 2; j++) { | |
1498 | ✗ | infer(delta_chroma_weight_l1[i][j], 0); | |
1499 | ✗ | infer(chroma_offset_l1[i][j], 0); | |
1500 | } | ||
1501 | } | ||
1502 | } | ||
1503 | } | ||
1504 | |||
1505 | 1020 | return 0; | |
1506 | } | ||
1507 | |||
1508 | 26438 | static int FUNC(slice_segment_header)(CodedBitstreamContext *ctx, RWContext *rw, | |
1509 | H265RawSliceHeader *current) | ||
1510 | { | ||
1511 | 26438 | CodedBitstreamH265Context *h265 = ctx->priv_data; | |
1512 | const H265RawSPS *sps; | ||
1513 | const H265RawPPS *pps; | ||
1514 | unsigned int min_cb_log2_size_y, ctb_log2_size_y, ctb_size_y; | ||
1515 | unsigned int pic_width_in_ctbs_y, pic_height_in_ctbs_y, pic_size_in_ctbs_y; | ||
1516 | 26438 | unsigned int num_pic_total_curr = 0; | |
1517 | int err, i; | ||
1518 | |||
1519 | 26438 | HEADER("Slice Segment Header"); | |
1520 | |||
1521 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 13219 times.
|
26438 | CHECK(FUNC(nal_unit_header)(ctx, rw, ¤t->nal_unit_header, -1)); |
1522 | |||
1523 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 13219 times.
|
26438 | flag(first_slice_segment_in_pic_flag); |
1524 | |||
1525 |
2/2✓ Branch 0 taken 266 times.
✓ Branch 1 taken 12953 times.
|
26438 | if (current->nal_unit_header.nal_unit_type >= HEVC_NAL_BLA_W_LP && |
1526 |
1/2✓ Branch 0 taken 266 times.
✗ Branch 1 not taken.
|
532 | current->nal_unit_header.nal_unit_type <= HEVC_NAL_RSV_IRAP_VCL23) |
1527 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 266 times.
|
532 | flag(no_output_of_prior_pics_flag); |
1528 | |||
1529 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 13219 times.
|
26438 | ue(slice_pic_parameter_set_id, 0, 63); |
1530 | |||
1531 | 26438 | pps = h265->pps[current->slice_pic_parameter_set_id]; | |
1532 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13219 times.
|
26438 | if (!pps) { |
1533 | ✗ | av_log(ctx->log_ctx, AV_LOG_ERROR, "PPS id %d not available.\n", | |
1534 | ✗ | current->slice_pic_parameter_set_id); | |
1535 | ✗ | return AVERROR_INVALIDDATA; | |
1536 | } | ||
1537 | 26438 | h265->active_pps = pps; | |
1538 | |||
1539 | 26438 | sps = h265->sps[pps->pps_seq_parameter_set_id]; | |
1540 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13219 times.
|
26438 | if (!sps) { |
1541 | ✗ | av_log(ctx->log_ctx, AV_LOG_ERROR, "SPS id %d not available.\n", | |
1542 | ✗ | pps->pps_seq_parameter_set_id); | |
1543 | ✗ | return AVERROR_INVALIDDATA; | |
1544 | } | ||
1545 | 26438 | h265->active_sps = sps; | |
1546 | |||
1547 | 26438 | min_cb_log2_size_y = sps->log2_min_luma_coding_block_size_minus3 + 3; | |
1548 | 26438 | ctb_log2_size_y = min_cb_log2_size_y + sps->log2_diff_max_min_luma_coding_block_size; | |
1549 | 26438 | ctb_size_y = 1 << ctb_log2_size_y; | |
1550 | 26438 | pic_width_in_ctbs_y = | |
1551 | 26438 | (sps->pic_width_in_luma_samples + ctb_size_y - 1) / ctb_size_y; | |
1552 | 26438 | pic_height_in_ctbs_y = | |
1553 | 26438 | (sps->pic_height_in_luma_samples + ctb_size_y - 1) / ctb_size_y; | |
1554 | 26438 | pic_size_in_ctbs_y = pic_width_in_ctbs_y * pic_height_in_ctbs_y; | |
1555 | |||
1556 |
2/2✓ Branch 0 taken 8736 times.
✓ Branch 1 taken 4483 times.
|
26438 | if (!current->first_slice_segment_in_pic_flag) { |
1557 | 17472 | unsigned int address_size = av_log2(pic_size_in_ctbs_y - 1) + 1; | |
1558 |
2/2✓ Branch 0 taken 5354 times.
✓ Branch 1 taken 3382 times.
|
17472 | if (pps->dependent_slice_segments_enabled_flag) |
1559 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 5354 times.
|
10708 | flag(dependent_slice_segment_flag); |
1560 | else | ||
1561 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1691 times.
|
6764 | infer(dependent_slice_segment_flag, 0); |
1562 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8736 times.
|
17472 | u(address_size, slice_segment_address, 0, pic_size_in_ctbs_y - 1); |
1563 | } else { | ||
1564 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2159 times.
|
8966 | infer(dependent_slice_segment_flag, 0); |
1565 | } | ||
1566 | |||
1567 |
2/2✓ Branch 0 taken 8709 times.
✓ Branch 1 taken 4510 times.
|
26438 | if (!current->dependent_slice_segment_flag) { |
1568 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8709 times.
|
17418 | for (i = 0; i < pps->num_extra_slice_header_bits; i++) |
1569 | ✗ | flags(slice_reserved_flag[i], 1, i); | |
1570 | |||
1571 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8709 times.
|
17418 | ue(slice_type, 0, 2); |
1572 | |||
1573 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8709 times.
|
17418 | if (pps->output_flag_present_flag) |
1574 | ✗ | flag(pic_output_flag); | |
1575 | |||
1576 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8709 times.
|
17418 | if (sps->separate_colour_plane_flag) |
1577 | ✗ | u(2, colour_plane_id, 0, 2); | |
1578 | |||
1579 |
2/2✓ Branch 0 taken 8595 times.
✓ Branch 1 taken 114 times.
|
17418 | if (current->nal_unit_header.nal_unit_type != HEVC_NAL_IDR_W_RADL && |
1580 |
2/2✓ Branch 0 taken 8593 times.
✓ Branch 1 taken 2 times.
|
17190 | current->nal_unit_header.nal_unit_type != HEVC_NAL_IDR_N_LP) { |
1581 | const H265RawSTRefPicSet *rps; | ||
1582 | int dpb_slots_remaining; | ||
1583 | |||
1584 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8593 times.
|
17186 | ub(sps->log2_max_pic_order_cnt_lsb_minus4 + 4, slice_pic_order_cnt_lsb); |
1585 | |||
1586 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8593 times.
|
17186 | flag(short_term_ref_pic_set_sps_flag); |
1587 |
2/2✓ Branch 0 taken 3761 times.
✓ Branch 1 taken 4832 times.
|
17186 | if (!current->short_term_ref_pic_set_sps_flag) { |
1588 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 3761 times.
|
7522 | CHECK(FUNC(st_ref_pic_set)(ctx, rw, ¤t->short_term_ref_pic_set, |
1589 | sps->num_short_term_ref_pic_sets, sps)); | ||
1590 | 7522 | rps = ¤t->short_term_ref_pic_set; | |
1591 |
1/2✓ Branch 0 taken 4832 times.
✗ Branch 1 not taken.
|
9664 | } else if (sps->num_short_term_ref_pic_sets > 1) { |
1592 | 9664 | unsigned int idx_size = av_log2(sps->num_short_term_ref_pic_sets - 1) + 1; | |
1593 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 4832 times.
|
9664 | u(idx_size, short_term_ref_pic_set_idx, |
1594 | 0, sps->num_short_term_ref_pic_sets - 1); | ||
1595 | 9664 | rps = &sps->st_ref_pic_set[current->short_term_ref_pic_set_idx]; | |
1596 | } else { | ||
1597 | ✗ | infer(short_term_ref_pic_set_idx, 0); | |
1598 | ✗ | rps = &sps->st_ref_pic_set[0]; | |
1599 | } | ||
1600 | |||
1601 | 17186 | dpb_slots_remaining = HEVC_MAX_DPB_SIZE - 1 - | |
1602 | 17186 | rps->num_negative_pics - rps->num_positive_pics; | |
1603 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8593 times.
|
17186 | if (pps->pps_curr_pic_ref_enabled_flag && |
1604 | ✗ | (sps->sample_adaptive_offset_enabled_flag || | |
1605 | ✗ | !pps->pps_deblocking_filter_disabled_flag || | |
1606 | ✗ | pps->deblocking_filter_override_enabled_flag)) { | |
1607 | // This picture will occupy two DPB slots. | ||
1608 | ✗ | if (dpb_slots_remaining == 0) { | |
1609 | ✗ | av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid stream: " | |
1610 | "short-term ref pic set contains too many pictures " | ||
1611 | "to use with current picture reference enabled.\n"); | ||
1612 | ✗ | return AVERROR_INVALIDDATA; | |
1613 | } | ||
1614 | ✗ | --dpb_slots_remaining; | |
1615 | } | ||
1616 | |||
1617 | 17186 | num_pic_total_curr = 0; | |
1618 |
2/2✓ Branch 0 taken 23127 times.
✓ Branch 1 taken 8593 times.
|
63440 | for (i = 0; i < rps->num_negative_pics; i++) |
1619 |
2/2✓ Branch 0 taken 22079 times.
✓ Branch 1 taken 1048 times.
|
46254 | if (rps->used_by_curr_pic_s0_flag[i]) |
1620 | 44158 | ++num_pic_total_curr; | |
1621 |
2/2✓ Branch 0 taken 6430 times.
✓ Branch 1 taken 8593 times.
|
30046 | for (i = 0; i < rps->num_positive_pics; i++) |
1622 |
2/2✓ Branch 0 taken 6140 times.
✓ Branch 1 taken 290 times.
|
12860 | if (rps->used_by_curr_pic_s1_flag[i]) |
1623 | 12280 | ++num_pic_total_curr; | |
1624 | |||
1625 |
2/2✓ Branch 0 taken 1664 times.
✓ Branch 1 taken 6929 times.
|
17186 | if (sps->long_term_ref_pics_present_flag) { |
1626 | unsigned int idx_size; | ||
1627 | |||
1628 |
2/2✓ Branch 0 taken 998 times.
✓ Branch 1 taken 666 times.
|
3328 | if (sps->num_long_term_ref_pics_sps > 0) { |
1629 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 998 times.
|
1996 | ue(num_long_term_sps, 0, FFMIN(sps->num_long_term_ref_pics_sps, |
1630 | dpb_slots_remaining)); | ||
1631 | 1996 | idx_size = av_log2(sps->num_long_term_ref_pics_sps - 1) + 1; | |
1632 | 1996 | dpb_slots_remaining -= current->num_long_term_sps; | |
1633 | } else { | ||
1634 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 333 times.
|
1332 | infer(num_long_term_sps, 0); |
1635 | 1332 | idx_size = 0; | |
1636 | } | ||
1637 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1664 times.
|
3328 | ue(num_long_term_pics, 0, dpb_slots_remaining); |
1638 | |||
1639 | 3328 | for (i = 0; i < current->num_long_term_sps + | |
1640 |
2/2✓ Branch 0 taken 2820 times.
✓ Branch 1 taken 1664 times.
|
8968 | current->num_long_term_pics; i++) { |
1641 |
2/2✓ Branch 0 taken 368 times.
✓ Branch 1 taken 2452 times.
|
5640 | if (i < current->num_long_term_sps) { |
1642 |
1/2✓ Branch 0 taken 368 times.
✗ Branch 1 not taken.
|
736 | if (sps->num_long_term_ref_pics_sps > 1) |
1643 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 368 times.
|
736 | us(idx_size, lt_idx_sps[i], |
1644 | 0, sps->num_long_term_ref_pics_sps - 1, 1, i); | ||
1645 |
2/2✓ Branch 0 taken 176 times.
✓ Branch 1 taken 192 times.
|
736 | if (sps->used_by_curr_pic_lt_sps_flag[current->lt_idx_sps[i]]) |
1646 | 352 | ++num_pic_total_curr; | |
1647 | } else { | ||
1648 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2452 times.
|
4904 | ubs(sps->log2_max_pic_order_cnt_lsb_minus4 + 4, poc_lsb_lt[i], 1, i); |
1649 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2452 times.
|
4904 | flags(used_by_curr_pic_lt_flag[i], 1, i); |
1650 |
2/2✓ Branch 0 taken 756 times.
✓ Branch 1 taken 1696 times.
|
4904 | if (current->used_by_curr_pic_lt_flag[i]) |
1651 | 1512 | ++num_pic_total_curr; | |
1652 | } | ||
1653 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2820 times.
|
5640 | flags(delta_poc_msb_present_flag[i], 1, i); |
1654 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2820 times.
|
5640 | if (current->delta_poc_msb_present_flag[i]) |
1655 | ✗ | ues(delta_poc_msb_cycle_lt[i], 0, UINT32_MAX - 1, 1, i); | |
1656 | else | ||
1657 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1410 times.
|
5640 | infer(delta_poc_msb_cycle_lt[i], 0); |
1658 | } | ||
1659 | } | ||
1660 | |||
1661 |
2/2✓ Branch 0 taken 5947 times.
✓ Branch 1 taken 2646 times.
|
17186 | if (sps->sps_temporal_mvp_enabled_flag) |
1662 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 5947 times.
|
11894 | flag(slice_temporal_mvp_enabled_flag); |
1663 | else | ||
1664 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1323 times.
|
5292 | infer(slice_temporal_mvp_enabled_flag, 0); |
1665 | |||
1666 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8593 times.
|
17186 | if (pps->pps_curr_pic_ref_enabled_flag) |
1667 | ✗ | ++num_pic_total_curr; | |
1668 | } | ||
1669 | |||
1670 |
2/2✓ Branch 0 taken 5441 times.
✓ Branch 1 taken 3268 times.
|
17418 | if (sps->sample_adaptive_offset_enabled_flag) { |
1671 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 5441 times.
|
10882 | flag(slice_sao_luma_flag); |
1672 |
2/4✓ Branch 0 taken 5441 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5441 times.
✗ Branch 3 not taken.
|
10882 | if (!sps->separate_colour_plane_flag && sps->chroma_format_idc != 0) |
1673 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 5441 times.
|
10882 | flag(slice_sao_chroma_flag); |
1674 | else | ||
1675 | ✗ | infer(slice_sao_chroma_flag, 0); | |
1676 | } else { | ||
1677 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1634 times.
|
6536 | infer(slice_sao_luma_flag, 0); |
1678 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1634 times.
|
6536 | infer(slice_sao_chroma_flag, 0); |
1679 | } | ||
1680 | |||
1681 |
2/2✓ Branch 0 taken 5341 times.
✓ Branch 1 taken 3368 times.
|
17418 | if (current->slice_type == HEVC_SLICE_P || |
1682 |
2/2✓ Branch 0 taken 5127 times.
✓ Branch 1 taken 214 times.
|
10682 | current->slice_type == HEVC_SLICE_B) { |
1683 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8495 times.
|
16990 | flag(num_ref_idx_active_override_flag); |
1684 |
2/2✓ Branch 0 taken 3677 times.
✓ Branch 1 taken 4818 times.
|
16990 | if (current->num_ref_idx_active_override_flag) { |
1685 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 3677 times.
|
7354 | ue(num_ref_idx_l0_active_minus1, 0, 14); |
1686 |
2/2✓ Branch 0 taken 937 times.
✓ Branch 1 taken 2740 times.
|
7354 | if (current->slice_type == HEVC_SLICE_B) |
1687 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 937 times.
|
1874 | ue(num_ref_idx_l1_active_minus1, 0, 14); |
1688 | else | ||
1689 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1370 times.
|
5480 | infer(num_ref_idx_l1_active_minus1, pps->num_ref_idx_l1_default_active_minus1); |
1690 | } else { | ||
1691 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2123 times.
|
9636 | infer(num_ref_idx_l0_active_minus1, pps->num_ref_idx_l0_default_active_minus1); |
1692 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2123 times.
|
9636 | infer(num_ref_idx_l1_active_minus1, pps->num_ref_idx_l1_default_active_minus1); |
1693 | } | ||
1694 | |||
1695 |
4/4✓ Branch 0 taken 1548 times.
✓ Branch 1 taken 6947 times.
✓ Branch 2 taken 1496 times.
✓ Branch 3 taken 52 times.
|
16990 | if (pps->lists_modification_present_flag && num_pic_total_curr > 1) |
1696 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1496 times.
|
2992 | CHECK(FUNC(ref_pic_lists_modification)(ctx, rw, current, |
1697 | num_pic_total_curr)); | ||
1698 | |||
1699 |
2/2✓ Branch 0 taken 5127 times.
✓ Branch 1 taken 3368 times.
|
16990 | if (current->slice_type == HEVC_SLICE_B) |
1700 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 5127 times.
|
10254 | flag(mvd_l1_zero_flag); |
1701 |
2/2✓ Branch 0 taken 5679 times.
✓ Branch 1 taken 2816 times.
|
16990 | if (pps->cabac_init_present_flag) |
1702 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 5679 times.
|
11358 | flag(cabac_init_flag); |
1703 | else | ||
1704 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1408 times.
|
5632 | infer(cabac_init_flag, 0); |
1705 |
2/2✓ Branch 0 taken 5859 times.
✓ Branch 1 taken 2636 times.
|
16990 | if (current->slice_temporal_mvp_enabled_flag) { |
1706 |
2/2✓ Branch 0 taken 5127 times.
✓ Branch 1 taken 732 times.
|
11718 | if (current->slice_type == HEVC_SLICE_B) |
1707 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 5127 times.
|
10254 | flag(collocated_from_l0_flag); |
1708 | else | ||
1709 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 366 times.
|
1464 | infer(collocated_from_l0_flag, 1); |
1710 |
2/2✓ Branch 0 taken 2729 times.
✓ Branch 1 taken 3130 times.
|
11718 | if (current->collocated_from_l0_flag) { |
1711 |
2/2✓ Branch 0 taken 2493 times.
✓ Branch 1 taken 236 times.
|
5458 | if (current->num_ref_idx_l0_active_minus1 > 0) |
1712 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2493 times.
|
4986 | ue(collocated_ref_idx, 0, current->num_ref_idx_l0_active_minus1); |
1713 | else | ||
1714 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118 times.
|
472 | infer(collocated_ref_idx, 0); |
1715 | } else { | ||
1716 |
2/2✓ Branch 0 taken 2943 times.
✓ Branch 1 taken 187 times.
|
6260 | if (current->num_ref_idx_l1_active_minus1 > 0) |
1717 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2943 times.
|
5886 | ue(collocated_ref_idx, 0, current->num_ref_idx_l1_active_minus1); |
1718 | else | ||
1719 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 92 times.
|
374 | infer(collocated_ref_idx, 0); |
1720 | } | ||
1721 | } | ||
1722 | |||
1723 |
3/4✓ Branch 0 taken 510 times.
✓ Branch 1 taken 7985 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 510 times.
|
16990 | if ((pps->weighted_pred_flag && current->slice_type == HEVC_SLICE_P) || |
1724 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 7985 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
15970 | (pps->weighted_bipred_flag && current->slice_type == HEVC_SLICE_B)) |
1725 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 510 times.
|
1020 | CHECK(FUNC(pred_weight_table)(ctx, rw, current)); |
1726 | |||
1727 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8495 times.
|
16990 | ue(five_minus_max_num_merge_cand, 0, 4); |
1728 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8495 times.
|
16990 | if (sps->motion_vector_resolution_control_idc == 2) |
1729 | ✗ | flag(use_integer_mv_flag); | |
1730 | else | ||
1731 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3954 times.
|
16990 | infer(use_integer_mv_flag, sps->motion_vector_resolution_control_idc); |
1732 | } | ||
1733 | |||
1734 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8709 times.
|
17418 | se(slice_qp_delta, |
1735 | - 6 * sps->bit_depth_luma_minus8 - (pps->init_qp_minus26 + 26), | ||
1736 | + 51 - (pps->init_qp_minus26 + 26)); | ||
1737 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8709 times.
|
17418 | if (pps->pps_slice_chroma_qp_offsets_present_flag) { |
1738 | ✗ | se(slice_cb_qp_offset, -12, +12); | |
1739 | ✗ | se(slice_cr_qp_offset, -12, +12); | |
1740 | } else { | ||
1741 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4061 times.
|
17418 | infer(slice_cb_qp_offset, 0); |
1742 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4061 times.
|
17418 | infer(slice_cr_qp_offset, 0); |
1743 | } | ||
1744 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8709 times.
|
17418 | if (pps->pps_slice_act_qp_offsets_present_flag) { |
1745 | ✗ | se(slice_act_y_qp_offset, | |
1746 | -12 - (pps->pps_act_y_qp_offset_plus5 - 5), | ||
1747 | +12 - (pps->pps_act_y_qp_offset_plus5 - 5)); | ||
1748 | ✗ | se(slice_act_cb_qp_offset, | |
1749 | -12 - (pps->pps_act_cb_qp_offset_plus5 - 5), | ||
1750 | +12 - (pps->pps_act_cb_qp_offset_plus5 - 5)); | ||
1751 | ✗ | se(slice_act_cr_qp_offset, | |
1752 | -12 - (pps->pps_act_cr_qp_offset_plus3 - 3), | ||
1753 | +12 - (pps->pps_act_cr_qp_offset_plus3 - 3)); | ||
1754 | } else { | ||
1755 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4061 times.
|
17418 | infer(slice_act_y_qp_offset, 0); |
1756 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4061 times.
|
17418 | infer(slice_act_cb_qp_offset, 0); |
1757 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4061 times.
|
17418 | infer(slice_act_cr_qp_offset, 0); |
1758 | } | ||
1759 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8709 times.
|
17418 | if (pps->chroma_qp_offset_list_enabled_flag) |
1760 | ✗ | flag(cu_chroma_qp_offset_enabled_flag); | |
1761 | else | ||
1762 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4061 times.
|
17418 | infer(cu_chroma_qp_offset_enabled_flag, 0); |
1763 | |||
1764 |
2/2✓ Branch 0 taken 74 times.
✓ Branch 1 taken 8635 times.
|
17418 | if (pps->deblocking_filter_override_enabled_flag) |
1765 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 74 times.
|
148 | flag(deblocking_filter_override_flag); |
1766 | else | ||
1767 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4024 times.
|
17270 | infer(deblocking_filter_override_flag, 0); |
1768 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 8707 times.
|
17418 | if (current->deblocking_filter_override_flag) { |
1769 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
|
4 | flag(slice_deblocking_filter_disabled_flag); |
1770 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
4 | if (!current->slice_deblocking_filter_disabled_flag) { |
1771 | ✗ | se(slice_beta_offset_div2, -6, +6); | |
1772 | ✗ | se(slice_tc_offset_div2, -6, +6); | |
1773 | } else { | ||
1774 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
4 | infer(slice_beta_offset_div2, pps->pps_beta_offset_div2); |
1775 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
4 | infer(slice_tc_offset_div2, pps->pps_tc_offset_div2); |
1776 | } | ||
1777 | } else { | ||
1778 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4060 times.
|
17414 | infer(slice_deblocking_filter_disabled_flag, |
1779 | pps->pps_deblocking_filter_disabled_flag); | ||
1780 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4060 times.
|
17414 | infer(slice_beta_offset_div2, pps->pps_beta_offset_div2); |
1781 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4060 times.
|
17414 | infer(slice_tc_offset_div2, pps->pps_tc_offset_div2); |
1782 | } | ||
1783 |
2/2✓ Branch 0 taken 7219 times.
✓ Branch 1 taken 1490 times.
|
17418 | if (pps->pps_loop_filter_across_slices_enabled_flag && |
1784 |
3/4✓ Branch 0 taken 5211 times.
✓ Branch 1 taken 2008 times.
✓ Branch 2 taken 5211 times.
✗ Branch 3 not taken.
|
14438 | (current->slice_sao_luma_flag || current->slice_sao_chroma_flag || |
1785 |
2/2✓ Branch 0 taken 5209 times.
✓ Branch 1 taken 2 times.
|
10422 | !current->slice_deblocking_filter_disabled_flag)) |
1786 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 7217 times.
|
14434 | flag(slice_loop_filter_across_slices_enabled_flag); |
1787 | else | ||
1788 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 746 times.
|
2984 | infer(slice_loop_filter_across_slices_enabled_flag, |
1789 | pps->pps_loop_filter_across_slices_enabled_flag); | ||
1790 | } | ||
1791 | |||
1792 |
4/4✓ Branch 0 taken 10483 times.
✓ Branch 1 taken 2736 times.
✓ Branch 2 taken 2365 times.
✓ Branch 3 taken 8118 times.
|
26438 | if (pps->tiles_enabled_flag || pps->entropy_coding_sync_enabled_flag) { |
1793 | unsigned int num_entry_point_offsets_limit; | ||
1794 |
3/4✓ Branch 0 taken 2365 times.
✓ Branch 1 taken 2736 times.
✓ Branch 2 taken 2365 times.
✗ Branch 3 not taken.
|
10202 | if (!pps->tiles_enabled_flag && pps->entropy_coding_sync_enabled_flag) |
1795 | 4730 | num_entry_point_offsets_limit = pic_height_in_ctbs_y - 1; | |
1796 |
2/4✓ Branch 0 taken 2736 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2736 times.
✗ Branch 3 not taken.
|
5472 | else if (pps->tiles_enabled_flag && !pps->entropy_coding_sync_enabled_flag) |
1797 | 5472 | num_entry_point_offsets_limit = | |
1798 | 5472 | (pps->num_tile_columns_minus1 + 1) * (pps->num_tile_rows_minus1 + 1); | |
1799 | else | ||
1800 | ✗ | num_entry_point_offsets_limit = | |
1801 | ✗ | (pps->num_tile_columns_minus1 + 1) * pic_height_in_ctbs_y - 1; | |
1802 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 5101 times.
|
10202 | ue(num_entry_point_offsets, 0, num_entry_point_offsets_limit); |
1803 | |||
1804 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5101 times.
|
10202 | if (current->num_entry_point_offsets > HEVC_MAX_ENTRY_POINT_OFFSETS) { |
1805 | ✗ | av_log(ctx->log_ctx, AV_LOG_ERROR, "Too many entry points: " | |
1806 | ✗ | "%"PRIu16".\n", current->num_entry_point_offsets); | |
1807 | ✗ | return AVERROR_PATCHWELCOME; | |
1808 | } | ||
1809 | |||
1810 |
2/2✓ Branch 0 taken 1703 times.
✓ Branch 1 taken 3398 times.
|
10202 | if (current->num_entry_point_offsets > 0) { |
1811 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1703 times.
|