History

vaapi_encode_h265: Don't require uniform_spacing_flag

Though still use it if the tile arrangement matches. Also try to keep the fields in the same order as the standard.

Mark Thompson committed 6 years ago

Commit 3d19c5e1 parent bc58d1f1 file · +30 −11Browse files

Unified · Split

libavcodec/vaapi_encode_h265.c+30−11
@@ -555,23 +555,42 @@ static int vaapi_encode_h265_init_sequence_params(AVCodecContext *avctx) · 554 unmodified lines
555555 pps->cu_qp_delta_enabled_flag = (ctx->va_rc_mode != VA_RC_CQP);
556556 pps->diff_cu_qp_delta_depth = 0;
557557
558− pps->pps_loop_filter_across_slices_enabled_flag = 1;
559−
560558 if (ctx->tile_rows && ctx->tile_cols) {
561− pps->tiles_enabled_flag = 1;
562− pps->uniform_spacing_flag = 1;
563−
564− pps->num_tile_rows_minus1 = ctx->tile_rows - 1;
565− pps->num_tile_columns_minus1 = ctx->tile_cols - 1;
566−
567− pps->loop_filter_across_tiles_enabled_flag = 1;
559+ int uniform_spacing;
560+
561+ pps->tiles_enabled_flag = 1;
562+ pps->num_tile_columns_minus1 = ctx->tile_cols - 1;
563+ pps->num_tile_rows_minus1 = ctx->tile_rows - 1;
564+
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;
568583
569− for (i = 0; i <= pps->num_tile_rows_minus1; i++)
570− pps->row_height_minus1[i] = ctx->row_height[i] - 1;
571584 for (i = 0; i <= pps->num_tile_columns_minus1; i++)
572585 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;
573590 }
574591
592+ pps->pps_loop_filter_across_slices_enabled_flag = 1;
593+
575594 // Fill VAAPI parameter buffers.
576595
577596 *vseq = (VAEncSequenceParameterBufferHEVC) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t