1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

lavc/vvc: Fix NumEntryPoints derivation

If pps_single_slice_per_subpic_flag is 1,
slice_{width,height}_in_tiles are undefined and we must instead get the
dimensions of the slice by referring to the corresponding subpicture.

Signed-off-by: Frank Plowman <post@frankplowman.com>
This commit is contained in:
Frank Plowman
2025-03-05 18:38:41 +00:00
committed by Nuo Mi
parent 2da40904f3
commit 26c5d8cf5d

View File

@ -3440,6 +3440,42 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw,
for (i = 0; i < current->curr_subpic_idx; i++) { for (i = 0; i < current->curr_subpic_idx; i++) {
slice_idx += pps->num_slices_in_subpic[i]; slice_idx += pps->num_slices_in_subpic[i];
} }
if (pps->pps_single_slice_per_subpic_flag) {
const int width_in_ctus = sps->sps_subpic_width_minus1[slice_idx] + 1;
const int subpic_l = sps->sps_subpic_ctu_top_left_x[slice_idx];
const int subpic_r = subpic_l + width_in_ctus;
int ctb_x = 0, tile_x = 0;
for (; ctb_x < subpic_l && tile_x < pps->num_tile_columns; tile_x++)
ctb_x += pps->col_width_val[tile_x];
width_in_tiles = 0;
for (; ctb_x < subpic_r && tile_x < pps->num_tile_columns; tile_x++) {
ctb_x += pps->col_width_val[tile_x];
width_in_tiles++;
}
if (entropy_sync) {
height = sps->sps_subpic_height_minus1[slice_idx] + 1;
} else {
const int height_in_ctus = sps->sps_subpic_height_minus1[slice_idx] + 1;
const int subpic_t = sps->sps_subpic_ctu_top_left_y[slice_idx];
const int subpic_b = subpic_t + height_in_ctus;
int ctb_y = 0, tile_y = 0, height_in_tiles;
for (; ctb_y < subpic_t && tile_y < pps->num_tile_rows; tile_y++)
ctb_y += pps->row_height_val[tile_y];
height_in_tiles = 0;
for (; ctb_y < subpic_b && tile_y < pps->num_tile_rows; tile_y++) {
ctb_y += pps->row_height_val[tile_y];
height_in_tiles++;
}
height = height_in_tiles;
}
} else {
width_in_tiles = width_in_tiles =
pps->pps_slice_width_in_tiles_minus1[slice_idx] + 1; pps->pps_slice_width_in_tiles_minus1[slice_idx] + 1;
@ -3447,6 +3483,7 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw,
height = pps->slice_height_in_ctus[slice_idx]; height = pps->slice_height_in_ctus[slice_idx];
else else
height = pps->pps_slice_height_in_tiles_minus1[slice_idx] + 1; height = pps->pps_slice_height_in_tiles_minus1[slice_idx] + 1;
}
current->num_entry_points = width_in_tiles * height; current->num_entry_points = width_in_tiles * height;
} else { } else {