From patchwork Fri Nov 24 09:34:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 119566 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp1957262qgn; Fri, 24 Nov 2017 01:36:03 -0800 (PST) X-Google-Smtp-Source: AGs4zMZ+VYny9sE6hZPj1XIR69MaItP7eulviJzFyQs78I79/fsyxKJeIsYvgQ2OajWowzqSjJO/ X-Received: by 10.98.87.138 with SMTP id i10mr26253949pfj.185.1511516054643; Fri, 24 Nov 2017 01:34:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511516054; cv=none; d=google.com; s=arc-20160816; b=Q8gBD/kv1qpob1JF+IiU3x1JteKaP5uGoSu+m+B707OZV0KqwUNzZ0RZKjWMrHmN47 Layy88Oo4xzD4Z9eoSnBtP3HnDnexLL+IsdsMsbgPoUWthWE6yYAfeng7kKwbxtHeigW cWEJasAUnzT4PFJj++WY0ZVMB6/XeuazkpPqt8zJ6UEIFExVJF7LeH4HI2MCMpcF5kjr HHSKbnJ+e+wtcyWYfPv6VcPs/AGX+tuBUuKFz9XxeYWyxcs7h965uxE+xXbVpgwyQNmY NO63hjH+gke644giPyOvGTAeCsFQ06RM6Gi30lU69Np/eEtoYCNrA2bmXMxhMlExrVBJ p9AQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=zbVPyyJiBVhW1G8PZ0PO40EQIhxmeh4MZacitMGrUik=; b=HV7IQZXJRBLJVhhCT9Nc6gzbVB4aypj3P8At3qbZwdMwUaZYhxuaZ0HNm+MLD4/Yta uMXnmNWhgmAgvG1ov3JaUWxwCp8dMNIg07VDhK1nJRL/f0n4lbdtusqp8bwG/txz1gWd yfOQIVkV0kpcLLEAvPL8Wns83XrrlCthpYL5c/vrNiz7wxviT6wzy2ofrck1dV6UtiLG YQXstqOvQNM9PSp8GemtbW+aTM/JBVxQhdAh0rlFvwVjptGimd0tklz1eb7Yr5mRoBB9 /4fDr/p1rAkIi9EoGZTy4EaYtnEUJvbC0u6fvV2IsCursD3Omu8xZ+twKKXK/WM3jiYW 8ngg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Iz9Qqo8n; spf=pass (google.com: best guess record for domain of linux-media-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-media-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v184si17011476pgd.540.2017.11.24.01.34.14; Fri, 24 Nov 2017 01:34:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-media-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Iz9Qqo8n; spf=pass (google.com: best guess record for domain of linux-media-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-media-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752563AbdKXJeM (ORCPT + 4 others); Fri, 24 Nov 2017 04:34:12 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:39878 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752770AbdKXJeI (ORCPT ); Fri, 24 Nov 2017 04:34:08 -0500 Received: by mail-wm0-f68.google.com with SMTP id x63so21141839wmf.4 for ; Fri, 24 Nov 2017 01:34:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=zbVPyyJiBVhW1G8PZ0PO40EQIhxmeh4MZacitMGrUik=; b=Iz9Qqo8nAuQuB7MniQ9+oZKBqdnpk5vRPMHVYwHFEU/UR75drGobpl9/bz/dROCQgO hcXxqi0AHIJUROu9KgGhI50PwotTMWRRP5TicaYwuN5aydUBe8MxsfFMsINxJBvKcF0V 6nl8xSiXRrPG3AF5ASWqEeeAQGw7yDBp4YEDc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=zbVPyyJiBVhW1G8PZ0PO40EQIhxmeh4MZacitMGrUik=; b=lK/mY4wAl0WKhUy0xu9C0o5CwHiHlK3jVX9ij4aYCmnwrs93tVj7Z+2mNsrdaEA1H8 BM8Dl5QkREVfT4ZpPz07GrLti//FoyXqyATzBCql2E2IB1oMD4FMz531QnsL6rcS50ow aq7ol75KrK2bidYzhzN1Mfjc8JxyYWmL9sfNmNE9MzX+J15axVb83+hZXFoGj/Oxp5g1 ORbq8eWEOV1h96IJ7pFioOKR8+wndi3HSAPK4aJ06wHsDj1a1I410UveoPj3pYA1GA38 Bo5ECf+Ve7cFIFf3XarQvbWBYfwH2MIs7BJpRLhhgck+TSqS8bXPjlFllzKeiuM34yy7 EmPw== X-Gm-Message-State: AJaThX4u5E2rKCJvR8yKY8FIaz4QNpGcjoQC7BSX4OubvFBose9cmCix LcbmqpGhL+18LTYu5XCO5W6l0g== X-Received: by 10.28.58.211 with SMTP id h202mr8718397wma.56.1511516046813; Fri, 24 Nov 2017 01:34:06 -0800 (PST) Received: from localhost.localdomain (LFbn-TOU-1-178-83.w86-201.abo.wanadoo.fr. [86.201.28.83]) by smtp.gmail.com with ESMTPSA id r3sm8922051wmg.31.2017.11.24.01.34.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 24 Nov 2017 01:34:06 -0800 (PST) From: Loic Poulain To: stanimir.varbanov@linaro.org, mchehab@kernel.org Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, Loic Poulain Subject: [PATCH 2/2] media: venus: venc: Apply inloop deblocking filter Date: Fri, 24 Nov 2017 10:34:02 +0100 Message-Id: <1511516042-11415-2-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511516042-11415-1-git-send-email-loic.poulain@linaro.org> References: <1511516042-11415-1-git-send-email-loic.poulain@linaro.org> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Deblocking filter allows to reduce blocking artifacts and improve visual quality. This is configurable via the V4L2 API but eventually not applied to the encoder. Note that alpha and beta deblocking values are 32-bit signed (-6;+6). Signed-off-by: Loic Poulain --- drivers/media/platform/qcom/venus/core.h | 4 ++-- drivers/media/platform/qcom/venus/hfi_helper.h | 4 ++-- drivers/media/platform/qcom/venus/venc.c | 22 ++++++++++++++++++++++ 3 files changed, 26 insertions(+), 4 deletions(-) -- 2.7.4 Reviewed-by: Stanimir Varbanov diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index cba092b..4833af7 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -144,8 +144,8 @@ struct venc_controls { u32 h264_min_qp; u32 h264_max_qp; u32 h264_loop_filter_mode; - u32 h264_loop_filter_alpha; - u32 h264_loop_filter_beta; + s32 h264_loop_filter_alpha; + s32 h264_loop_filter_beta; u32 vp8_min_qp; u32 vp8_max_qp; diff --git a/drivers/media/platform/qcom/venus/hfi_helper.h b/drivers/media/platform/qcom/venus/hfi_helper.h index 8d282db..55d8eb2 100644 --- a/drivers/media/platform/qcom/venus/hfi_helper.h +++ b/drivers/media/platform/qcom/venus/hfi_helper.h @@ -585,8 +585,8 @@ struct hfi_enable { struct hfi_h264_db_control { u32 mode; - u32 slice_alpha_offset; - u32 slice_beta_offset; + s32 slice_alpha_offset; + s32 slice_beta_offset; }; #define HFI_H264_ENTROPY_CAVLC 0x1 diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index d5d824e..1e79f49 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -234,6 +234,16 @@ static int venc_v4l2_to_hfi(int id, int value) case 3: return HFI_VPX_PROFILE_VERSION_3; } + case V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_MODE: + switch (value) { + case V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_ENABLED: + default: + return HFI_H264_DB_MODE_ALL_BOUNDARY; + case V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED: + return HFI_H264_DB_MODE_DISABLE; + case V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED_AT_SLICE_BOUNDARY: + return HFI_H264_DB_MODE_SKIP_SLICE_BOUNDARY; + } } return 0; @@ -642,6 +652,7 @@ static int venc_set_properties(struct venus_inst *inst) if (inst->fmt_cap->pixfmt == V4L2_PIX_FMT_H264) { struct hfi_h264_vui_timing_info info; struct hfi_h264_entropy_control entropy; + struct hfi_h264_db_control deblock; ptype = HFI_PROPERTY_PARAM_VENC_H264_VUI_TIMING_INFO; info.enable = 1; @@ -661,6 +672,17 @@ static int venc_set_properties(struct venus_inst *inst) ret = hfi_session_set_property(inst, ptype, &entropy); if (ret) return ret; + + ptype = HFI_PROPERTY_PARAM_VENC_H264_DEBLOCK_CONTROL; + deblock.mode = venc_v4l2_to_hfi( + V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_MODE, + ctr->h264_loop_filter_mode); + deblock.slice_alpha_offset = ctr->h264_loop_filter_alpha; + deblock.slice_beta_offset = ctr->h264_loop_filter_beta; + + ret = hfi_session_set_property(inst, ptype, &deblock); + if (ret) + return ret; } ptype = HFI_PROPERTY_CONFIG_VENC_IDR_PERIOD;