Unified · Split
| @@ -1057,7 +1057,7 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw, · 1056 unmodified lines | |||
| 1057 | H266RawSPS *current) | 1057 | H266RawSPS *current) |
| 1058 | { | 1058 | { |
| 1059 | CodedBitstreamH266Context *h266 = ctx->priv_data; | 1059 | CodedBitstreamH266Context *h266 = ctx->priv_data; |
| 1060 | int err, i, j; | 1060 | int err, i, j, max_width_minus1, max_height_minus1; |
| 1061 | unsigned int ctb_log2_size_y, min_cb_log2_size_y, | 1061 | unsigned int ctb_log2_size_y, min_cb_log2_size_y, |
| 1062 | min_qt_log2_size_intra_y, min_qt_log2_size_inter_y, | 1062 | min_qt_log2_size_intra_y, min_qt_log2_size_inter_y, |
| 1063 | ctb_size_y, max_num_merge_cand, tmp_width_val, tmp_height_val; | 1063 | ctb_size_y, max_num_merge_cand, tmp_width_val, tmp_height_val; |
| @@ -1130,6 +1130,8 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw, · 66 unmodified lines | |||
| 1130 | ctb_log2_size_y); | 1130 | ctb_log2_size_y); |
| 1131 | tmp_height_val = AV_CEIL_RSHIFT(current->sps_pic_height_max_in_luma_samples, | 1131 | tmp_height_val = AV_CEIL_RSHIFT(current->sps_pic_height_max_in_luma_samples, |
| 1132 | ctb_log2_size_y); | 1132 | ctb_log2_size_y); |
| 1133 | max_width_minus1 = tmp_width_val - 1; | ||
| 1134 | max_height_minus1 = tmp_height_val - 1; | ||
| 1133 | 1135 | ||
| 1134 | flag(sps_subpic_info_present_flag); | 1136 | flag(sps_subpic_info_present_flag); |
| 1135 | if (current->sps_subpic_info_present_flag) { | 1137 | if (current->sps_subpic_info_present_flag) { |
| @@ -1147,11 +1149,11 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw, · 11 unmodified lines | |||
| 1147 | if (current->sps_pic_width_max_in_luma_samples > ctb_size_y) | 1149 | if (current->sps_pic_width_max_in_luma_samples > ctb_size_y) |
| 1148 | ubs(wlen, sps_subpic_width_minus1[0], 1, 0); | 1150 | ubs(wlen, sps_subpic_width_minus1[0], 1, 0); |
| 1149 | else | 1151 | else |
| 1150 | infer(sps_subpic_width_minus1[0], tmp_width_val - 1); | 1152 | infer(sps_subpic_width_minus1[0], max_width_minus1); |
| 1151 | if (current->sps_pic_height_max_in_luma_samples > ctb_size_y) | 1153 | if (current->sps_pic_height_max_in_luma_samples > ctb_size_y) |
| 1152 | ubs(hlen, sps_subpic_height_minus1[0], 1, 0); | 1154 | ubs(hlen, sps_subpic_height_minus1[0], 1, 0); |
| 1153 | else | 1155 | else |
| 1154 | infer(sps_subpic_height_minus1[0], tmp_height_val - 1); | 1156 | infer(sps_subpic_height_minus1[0], max_height_minus1); |
| 1155 | if (!current->sps_independent_subpics_flag) { | 1157 | if (!current->sps_independent_subpics_flag) { |
| 1156 | flags(sps_subpic_treated_as_pic_flag[0], 1, 0); | 1158 | flags(sps_subpic_treated_as_pic_flag[0], 1, 0); |
| 1157 | flags(sps_loop_filter_across_subpic_enabled_flag[0], 1, 0); | 1159 | flags(sps_loop_filter_across_subpic_enabled_flag[0], 1, 0); |
| @@ -1161,58 +1163,54 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw, · 3 unmodified lines | |||
| 1161 | } | 1163 | } |
| 1162 | for (i = 1; i <= current->sps_num_subpics_minus1; i++) { | 1164 | for (i = 1; i <= current->sps_num_subpics_minus1; i++) { |
| 1163 | if (!current->sps_subpic_same_size_flag) { | 1165 | if (!current->sps_subpic_same_size_flag) { |
| 1164 | if (current->sps_pic_width_max_in_luma_samples > ctb_size_y) { | 1166 | const int win_right_edge = |
| 1165 | const int win_right_edge = | 1167 | current->sps_pic_width_max_in_luma_samples - |
| 1166 | current->sps_pic_width_max_in_luma_samples | 1168 | current->sps_conf_win_right_offset * sub_width_c; |
| 1167 | - current->sps_conf_win_right_offset * sub_width_c; | 1169 | const int win_bottom_edge = |
| 1168 | us(wlen, sps_subpic_ctu_top_left_x[i], 0, | 1170 | current->sps_pic_height_max_in_luma_samples - |
| 1169 | AV_CEIL_RSHIFT(win_right_edge, ctb_log2_size_y) - 1, | 1171 | current->sps_conf_win_bottom_offset * sub_height_c; |
| 1170 | 1, i); | 1172 | const int win_left_edge = |
| 1171 | } else | 1173 | current->sps_conf_win_left_offset * sub_width_c; |
| 1174 | const int win_top_edge = | ||
| 1175 | current->sps_conf_win_top_offset * sub_height_c; | ||
| 1176 | const int win_left_edge_ctus = | ||
| 1177 | AV_CEIL_RSHIFT(win_left_edge, ctb_log2_size_y); | ||
| 1178 | const int win_right_edge_ctus = | ||
| 1179 | AV_CEIL_RSHIFT(win_right_edge, ctb_log2_size_y); | ||
| 1180 | const int win_top_edge_ctus = | ||
| 1181 | AV_CEIL_RSHIFT(win_top_edge, ctb_log2_size_y); | ||
| 1182 | const int win_bottom_edge_ctus = | ||
| 1183 | AV_CEIL_RSHIFT(win_bottom_edge, ctb_log2_size_y); | ||
| 1184 | const int min_width = | ||
| 1185 | FFMAX(win_left_edge_ctus - current->sps_subpic_ctu_top_left_x[i], 0); | ||
| 1186 | const int min_height = | ||
| 1187 | FFMAX(win_top_edge_ctus - current->sps_subpic_ctu_top_left_y[i], 0); | ||
| 1188 | |||
| 1189 | if (current->sps_pic_width_max_in_luma_samples > ctb_size_y) | ||
| 1190 | us(wlen, sps_subpic_ctu_top_left_x[i], 0, win_right_edge_ctus - 1, 1, i); | ||
| 1191 | else | ||
| 1172 | infer(sps_subpic_ctu_top_left_x[i], 0); | 1192 | infer(sps_subpic_ctu_top_left_x[i], 0); |
| 1173 | if (current->sps_pic_height_max_in_luma_samples > | 1193 | |
| 1174 | ctb_size_y) { | 1194 | if (current->sps_pic_height_max_in_luma_samples > ctb_size_y) |
| 1175 | const int win_bottom_edge = | 1195 | us(hlen, sps_subpic_ctu_top_left_y[i], 0, win_bottom_edge_ctus - 1, 1, i); |
| 1176 | current->sps_pic_height_max_in_luma_samples | 1196 | else |
| 1177 | - current->sps_conf_win_bottom_offset * sub_height_c; | ||
| 1178 | us(hlen, sps_subpic_ctu_top_left_y[i], 0, | ||
| 1179 | AV_CEIL_RSHIFT(win_bottom_edge, ctb_log2_size_y) - 1, | ||
| 1180 | 1, i); | ||
| 1181 | } else | ||
| 1182 | infer(sps_subpic_ctu_top_left_y[i], 0); | 1197 | infer(sps_subpic_ctu_top_left_y[i], 0); |
| 1198 | |||
| 1199 | max_width_minus1 = tmp_width_val - current->sps_subpic_ctu_top_left_x[i] - 1; | ||
| 1200 | max_height_minus1 = tmp_height_val - current->sps_subpic_ctu_top_left_y[i] - 1; | ||
| 1201 | |||
| 1183 | if (i < current->sps_num_subpics_minus1 && | 1202 | if (i < current->sps_num_subpics_minus1 && |
| 1184 | current->sps_pic_width_max_in_luma_samples > | 1203 | current->sps_pic_width_max_in_luma_samples > ctb_size_y) { |
| 1185 | ctb_size_y) { | 1204 | us(wlen, sps_subpic_width_minus1[i], min_width, MAX_UINT_BITS(wlen), 1, i); |
| 1186 | const int win_left_edge = | ||
| 1187 | current->sps_conf_win_left_offset * sub_width_c; | ||
| 1188 | const int win_left_edge_ctus = | ||
| 1189 | AV_CEIL_RSHIFT(win_left_edge, ctb_log2_size_y); | ||
| 1190 | us(wlen, sps_subpic_width_minus1[i], | ||
| 1191 | win_left_edge_ctus > current->sps_subpic_ctu_top_left_x[i] | ||
| 1192 | ? win_left_edge_ctus - current->sps_subpic_ctu_top_left_x[i] | ||
| 1193 | : 0, | ||
| 1194 | MAX_UINT_BITS(wlen), 1, i); | ||
| 1195 | } else { | 1205 | } else { |
| 1196 | infer(sps_subpic_width_minus1[i], | 1206 | infer(sps_subpic_width_minus1[i], max_width_minus1); |
| 1197 | tmp_width_val - | ||
| 1198 | current->sps_subpic_ctu_top_left_x[i] - 1); | ||
| 1199 | } | 1207 | } |
| 1208 | |||
| 1200 | if (i < current->sps_num_subpics_minus1 && | 1209 | if (i < current->sps_num_subpics_minus1 && |
| 1201 | current->sps_pic_height_max_in_luma_samples > | 1210 | current->sps_pic_height_max_in_luma_samples > ctb_size_y) { |
| 1202 | ctb_size_y) { | 1211 | us(hlen, sps_subpic_height_minus1[i], min_height, MAX_UINT_BITS(hlen), 1, i); |
| 1203 | const int win_top_edge = | ||
| 1204 | current->sps_conf_win_top_offset * sub_height_c; | ||
| 1205 | const int win_top_edge_ctus = | ||
| 1206 | AV_CEIL_RSHIFT(win_top_edge, ctb_log2_size_y); | ||
| 1207 | us(hlen, sps_subpic_height_minus1[i], | ||
| 1208 | win_top_edge_ctus > current->sps_subpic_ctu_top_left_y[i] | ||
| 1209 | ? win_top_edge_ctus - current->sps_subpic_ctu_top_left_y[i] | ||
| 1210 | : 0, | ||
| 1211 | MAX_UINT_BITS(hlen), 1, i); | ||
| 1212 | } else { | 1212 | } else { |
| 1213 | infer(sps_subpic_height_minus1[i], | 1213 | infer(sps_subpic_height_minus1[i], max_height_minus1); |
| 1214 | tmp_height_val - | ||
| 1215 | current->sps_subpic_ctu_top_left_y[i] - 1); | ||
| 1216 | } | 1214 | } |
| 1217 | } else { | 1215 | } else { |
| 1218 | int num_subpic_cols = tmp_width_val / | 1216 | int num_subpic_cols = tmp_width_val / |
| @@ -1245,8 +1243,8 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw, · 26 unmodified lines | |||
| 1245 | } else { | 1243 | } else { |
| 1246 | infer(sps_subpic_ctu_top_left_x[0], 0); | 1244 | infer(sps_subpic_ctu_top_left_x[0], 0); |
| 1247 | infer(sps_subpic_ctu_top_left_y[0], 0); | 1245 | infer(sps_subpic_ctu_top_left_y[0], 0); |
| 1248 | infer(sps_subpic_width_minus1[0], tmp_width_val - 1); | 1246 | infer(sps_subpic_width_minus1[0], max_width_minus1); |
| 1249 | infer(sps_subpic_height_minus1[0], tmp_height_val - 1); | 1247 | infer(sps_subpic_height_minus1[0], max_height_minus1); |
| 1250 | } | 1248 | } |
| 1251 | ue(sps_subpic_id_len_minus1, 0, 15); | 1249 | ue(sps_subpic_id_len_minus1, 0, 15); |
| 1252 | if ((1 << (current->sps_subpic_id_len_minus1 + 1)) < | 1250 | if ((1 << (current->sps_subpic_id_len_minus1 + 1)) < |
| @@ -1273,8 +1271,8 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw, · 20 unmodified lines | |||
| 1273 | infer(sps_subpic_id_mapping_explicitly_signalled_flag, 0); | 1271 | infer(sps_subpic_id_mapping_explicitly_signalled_flag, 0); |
| 1274 | infer(sps_subpic_ctu_top_left_x[0], 0); | 1272 | infer(sps_subpic_ctu_top_left_x[0], 0); |
| 1275 | infer(sps_subpic_ctu_top_left_y[0], 0); | 1273 | infer(sps_subpic_ctu_top_left_y[0], 0); |
| 1276 | infer(sps_subpic_width_minus1[0], tmp_width_val - 1); | 1274 | infer(sps_subpic_width_minus1[0], max_width_minus1); |
| 1277 | infer(sps_subpic_height_minus1[0], tmp_height_val - 1); | 1275 | infer(sps_subpic_height_minus1[0], max_height_minus1); |
| 1278 | } | 1276 | } |
| 1279 | 1277 | ||
| 1280 | 1278 | ||