Though still use it if the tile arrangement matches. Also try to keep the fields in the same order as the standard.
Unified · Split
| @@ -555,23 +555,42 @@ static int vaapi_encode_h265_init_sequence_params(AVCodecContext *avctx) · 554 unmodified lines | |||
| 555 | pps->cu_qp_delta_enabled_flag = (ctx->va_rc_mode != VA_RC_CQP); | 555 | pps->cu_qp_delta_enabled_flag = (ctx->va_rc_mode != VA_RC_CQP); |
| 556 | pps->diff_cu_qp_delta_depth = 0; | 556 | pps->diff_cu_qp_delta_depth = 0; |
| 557 | 557 | ||
| 558 | pps->pps_loop_filter_across_slices_enabled_flag = 1; | ||
| 559 | |||
| 560 | if (ctx->tile_rows && ctx->tile_cols) { | 558 | if (ctx->tile_rows && ctx->tile_cols) { |
| 561 | pps->tiles_enabled_flag = 1; | 559 | int uniform_spacing; |
| 562 | pps->uniform_spacing_flag = 1; | 560 | |
| 563 | 561 | pps->tiles_enabled_flag = 1; | |
| 564 | pps->num_tile_rows_minus1 = ctx->tile_rows - 1; | 562 | pps->num_tile_columns_minus1 = ctx->tile_cols - 1; |
| 565 | pps->num_tile_columns_minus1 = ctx->tile_cols - 1; | 563 | pps->num_tile_rows_minus1 = ctx->tile_rows - 1; |
| 566 | 564 | ||
| 567 | pps->loop_filter_across_tiles_enabled_flag = 1; | 565 | // Test whether the spacing provided matches the H.265 uniform |
| 566 | // spacing, and set the flag if it does. | ||
| 567 | uniform_spacing = 1; | ||
| 568 | for (i = 0; i <= pps->num_tile_columns_minus1 && | ||
| 569 | uniform_spacing; i++) { | ||
| 570 | if (ctx->col_width[i] != | ||
| 571 | (i + 1) * ctx->slice_block_cols / ctx->tile_cols - | ||
| 572 | i * ctx->slice_block_cols / ctx->tile_cols) | ||
| 573 | uniform_spacing = 0; | ||
| 574 | } | ||
| 575 | for (i = 0; i <= pps->num_tile_rows_minus1 && | ||
| 576 | uniform_spacing; i++) { | ||
| 577 | if (ctx->row_height[i] != | ||
| 578 | (i + 1) * ctx->slice_block_rows / ctx->tile_rows - | ||
| 579 | i * ctx->slice_block_rows / ctx->tile_rows) | ||
| 580 | uniform_spacing = 0; | ||
| 581 | } | ||
| 582 | pps->uniform_spacing_flag = uniform_spacing; | ||
| 568 | 583 | ||
| 569 | for (i = 0; i <= pps->num_tile_rows_minus1; i++) | ||
| 570 | pps->row_height_minus1[i] = ctx->row_height[i] - 1; | ||
| 571 | for (i = 0; i <= pps->num_tile_columns_minus1; i++) | 584 | for (i = 0; i <= pps->num_tile_columns_minus1; i++) |
| 572 | pps->column_width_minus1[i] = ctx->col_width[i] - 1; | 585 | pps->column_width_minus1[i] = ctx->col_width[i] - 1; |
| 586 | for (i = 0; i <= pps->num_tile_rows_minus1; i++) | ||
| 587 | pps->row_height_minus1[i] = ctx->row_height[i] - 1; | ||
| 588 | |||
| 589 | pps->loop_filter_across_tiles_enabled_flag = 1; | ||
| 573 | } | 590 | } |
| 574 | 591 | ||
| 592 | pps->pps_loop_filter_across_slices_enabled_flag = 1; | ||
| 593 | |||
| 575 | // Fill VAAPI parameter buffers. | 594 | // Fill VAAPI parameter buffers. |
| 576 | 595 | ||
| 577 | *vseq = (VAEncSequenceParameterBufferHEVC) { | 596 | *vseq = (VAEncSequenceParameterBufferHEVC) { |