From patchwork Tue Jul 28 22:50:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Thompson X-Patchwork-Id: 21348 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 2FAE044B063 for ; Wed, 29 Jul 2020 01:53:09 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 10C3468B9F9; Wed, 29 Jul 2020 01:53:09 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5F57A68B9ED for ; Wed, 29 Jul 2020 01:53:01 +0300 (EEST) Received: by mail-wr1-f68.google.com with SMTP id a14so19809622wra.5 for ; Tue, 28 Jul 2020 15:53:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jkqxz-net.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=mvhlcJzzyFVwcWI5yjuPubvz9Rpocq24mWYB1m6LsCM=; b=RycgrFqiIQSkafXYUVZ0wB/YSv1AUPK1cbj+mD9ctcQPQNo0TMzQgl8CSfztOlt76S Y+iZNX1Or14dXKc7RDTlu4cXoiej3eU6Mnsv23UDnFp/qIeLK/Kn8674BEwlgBDjGxRk Ks07pcozZ8FgEDeibvSYbarsLa5A/NzqONQLGnwdSCFVNmX5CW5gpvY28T/Ir2XwUUFU TMBQtua/Zr9JqDguul3MXZ/HF6vIkJGQWn+GaPPFu1ruNK7PyQtgMA9e9vzMRMhidgry TmcClMlUy9gKVle4W969nRX9LvoJ4YrTwFkGSmyR0r38HcQ2108mvCJ9lNKD/YlcM1Wm rQzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mvhlcJzzyFVwcWI5yjuPubvz9Rpocq24mWYB1m6LsCM=; b=V125FjNzqBerxXFIZWzu1TsFDVo2FpQpnAkA5uZ25GjSXrkED01zFPaVBwVktvhzB4 WowuNlQpgtzTyox6PMHCMN++1lYErJvzBJRckkdW9tRt4ysZhnjtoywUYvWRL7l7i24z /7h0h6PogS3qS6YIXakyGrU84Lv5PDXSml1mNzHY9xoXt20wsmqHIBDJ6WaQAx9ajG8o O5xaXes5T1ijOD89m6OTiKinguZPPhu/lXj6YEZW+Zg4A0slLtL8I/kfXumoLlNg5HZB MrYl+6uhwipENBE64wtkdBklWEIDadwixEZVv1/T9AtzLFqitik3JQKRcbwHJsgVe0zD ttcw== X-Gm-Message-State: AOAM531ByBlX3S6Fq2JvaJNJyKw5JdPwP+vLbQcjge/8lQuCjb7+9ubH awJSYheum1s+8I1RtGDydlk2M8LtCBY= X-Google-Smtp-Source: ABdhPJxQvN0fMG8cUWvK1gF4qlnaylUlkZU2dtsv1+1IkBgeFuT7HM9g+Y1HV06tN09YBvrE5Jn+PQ== X-Received: by 2002:a5d:658a:: with SMTP id q10mr25905381wru.1.1595976780477; Tue, 28 Jul 2020 15:53:00 -0700 (PDT) Received: from localhost.localdomain (cpc91242-cmbg18-2-0-cust650.5-4.cable.virginm.net. [82.8.130.139]) by smtp.gmail.com with ESMTPSA id 5sm629197wmk.9.2020.07.28.15.52.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jul 2020 15:52:59 -0700 (PDT) From: Mark Thompson To: ffmpeg-devel@ffmpeg.org Date: Tue, 28 Jul 2020 23:50:22 +0100 Message-Id: <20200728225025.1830283-3-sw@jkqxz.net> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200728225025.1830283-1-sw@jkqxz.net> References: <20200728225025.1830283-1-sw@jkqxz.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/6] vaapi_encode_h265: Don't require uniform_spacing_flag X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Though still use it if the tile arrangement matches. Also try to keep the fields in the same order as the standard. --- libavcodec/vaapi_encode_h265.c | 39 ++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c index 04bd2bef1d..a7230a676c 100644 --- a/libavcodec/vaapi_encode_h265.c +++ b/libavcodec/vaapi_encode_h265.c @@ -555,23 +555,40 @@ static int vaapi_encode_h265_init_sequence_params(AVCodecContext *avctx) pps->cu_qp_delta_enabled_flag = (ctx->va_rc_mode != VA_RC_CQP); pps->diff_cu_qp_delta_depth = 0; - pps->pps_loop_filter_across_slices_enabled_flag = 1; - if (ctx->tile_rows && ctx->tile_cols) { - pps->tiles_enabled_flag = 1; - pps->uniform_spacing_flag = 1; - - pps->num_tile_rows_minus1 = ctx->tile_rows - 1; - pps->num_tile_columns_minus1 = ctx->tile_cols - 1; - - pps->loop_filter_across_tiles_enabled_flag = 1; + int uniform_spacing; + + pps->tiles_enabled_flag = 1; + pps->num_tile_columns_minus1 = ctx->tile_cols - 1; + pps->num_tile_rows_minus1 = ctx->tile_rows - 1; + + // Test whether the spacing provided matches the H.265 uniform + // spacing, and set the flag if it does. + uniform_spacing = 1; + for (i = 0; i <= pps->num_tile_columns_minus1; i++) { + if (ctx->col_width[i] != + (i + 1) * ctx->slice_block_cols / ctx->tile_cols - + i * ctx->slice_block_cols / ctx->tile_cols) + uniform_spacing = 0; + } + for (i = 0; i <= pps->num_tile_rows_minus1; i++) { + if (ctx->row_height[i] != + (i + 1) * ctx->slice_block_rows / ctx->tile_rows - + i * ctx->slice_block_rows / ctx->tile_rows) + uniform_spacing = 0; + } + pps->uniform_spacing_flag = uniform_spacing; - for (i = 0; i <= pps->num_tile_rows_minus1; i++) - pps->row_height_minus1[i] = ctx->row_height[i] - 1; for (i = 0; i <= pps->num_tile_columns_minus1; i++) pps->column_width_minus1[i] = ctx->col_width[i] - 1; + for (i = 0; i <= pps->num_tile_rows_minus1; i++) + pps->row_height_minus1[i] = ctx->row_height[i] - 1; + + pps->loop_filter_across_tiles_enabled_flag = 1; } + pps->pps_loop_filter_across_slices_enabled_flag = 1; + // Fill VAAPI parameter buffers. *vseq = (VAEncSequenceParameterBufferHEVC) {