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