From patchwork Thu Nov 15 11:23:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dafna Hirschfeld X-Patchwork-Id: 10684159 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E7A5F13B5 for ; Thu, 15 Nov 2018 11:24:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D52782C462 for ; Thu, 15 Nov 2018 11:24:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C68822C466; Thu, 15 Nov 2018 11:24:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3AF262C462 for ; Thu, 15 Nov 2018 11:24:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728984AbeKOVcI (ORCPT ); Thu, 15 Nov 2018 16:32:08 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:37169 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726664AbeKOVcI (ORCPT ); Thu, 15 Nov 2018 16:32:08 -0500 Received: by mail-wm1-f68.google.com with SMTP id p2-v6so17541547wmc.2 for ; Thu, 15 Nov 2018 03:24:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=IOTtexwJTJP2LnnkgtTSit70/4oafCLHOV16yEK3w4E=; b=UHn/CBb+F/imPyQszTtS/vsttioP/TPFA5CKrWRkFgEhQwG0CcnPZVsOA0q+tlcxCv ovk8/NMWoUT1ObQv6YD5TLXMm4mHUyYNiYA4qJdJJDH8/CTb2fh0164Q3vGRb+YGSvzN cQyVgV5MHc726H0WgK+DJKMlg71rmuMKyt4BegvxPBnr7SBCk8T6nTnHB6fxMaryvX/p Mmi+4DFcoBsk4Mbkr1S6TrBcMUFyy3VynbcosN3Lt1VFBVWCC0B/JufykMly/HNNTp1U KbdR+fUJXv3xnetf9IG1omuY8G3eL6k4yXrqR5CX5MCOpyz9p9SmSKHexyAwhRpMuB0s EJjQ== 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:in-reply-to:references; bh=IOTtexwJTJP2LnnkgtTSit70/4oafCLHOV16yEK3w4E=; b=tfxHRKhGh4UFeLD6dMVRIkGQtyeuaoFFy5vytOnBSCrKNHwcFlcQJNdiym8iZuUi3X 67MnkjM7V1caIwIS7U5oRd2eiCo9iBaCeR//2eJQzs4Mv0oW/QWnpXD+Oc2/GdgMQdus dS8nQ5xG5iZC6SphpemrQluOLwbF8fWQ++mFKu/xl078Fk8EwUCBGIv1MW1AIxc1RN51 X5dUO6pc9w6Qe912q9RBOrql6/3oapqqN5/3D0h7YDyZX8fQkgNOlT3j7VIlXYK9VH9M Am8OcCZDaIEVL6c+on/nAaRlCQXWNqnkICXxKO57Ev+2hArW0l1MNsBFmQvgJObS473c 3D0Q== X-Gm-Message-State: AGRZ1gLXLGvSxit8qLDkRFMnmlmF0VZv/q/vY1AcYLoMwYmMHeIrCJtQ tPHKxWQ2qXulP7UExgYt9+E= X-Google-Smtp-Source: AJdET5fSA9vGxlz+1DY+sMJu695n3efgK+5kGdNdIMRDbihgdauin06X19BWqf8Yi8smGW1l1Ar4yA== X-Received: by 2002:a1c:750d:: with SMTP id o13-v6mr5000316wmc.100.1542281080201; Thu, 15 Nov 2018 03:24:40 -0800 (PST) Received: from localhost.localdomain ([87.70.83.200]) by smtp.gmail.com with ESMTPSA id c6-v6sm10614682wre.45.2018.11.15.03.24.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Nov 2018 03:24:39 -0800 (PST) From: Dafna Hirschfeld To: helen.koike@collabora.com, hverkuil@xs4all.nl, mchehab@kernel.org Cc: linux-media@vger.kernel.org, Dafna Hirschfeld , outreachy-kernel@googlegroups.com Subject: [PATCH vicodec v4 1/3] media: vicodec: prepare support for various number of planes Date: Thu, 15 Nov 2018 13:23:30 +0200 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add fields to the structs `fwht_raw_frame`, `v4l2_fwht_pixfmts` to support various number of planes - formats with alpha channel that have 4 planes and greyscale formats that have 1 plane. Signed-off-by: Dafna Hirschfeld --- drivers/media/platform/vicodec/codec-fwht.c | 2 +- drivers/media/platform/vicodec/codec-fwht.h | 5 +- .../media/platform/vicodec/codec-v4l2-fwht.c | 47 ++++++++++--------- .../media/platform/vicodec/codec-v4l2-fwht.h | 3 +- drivers/media/platform/vicodec/vicodec-core.c | 2 +- 5 files changed, 32 insertions(+), 27 deletions(-) diff --git a/drivers/media/platform/vicodec/codec-fwht.c b/drivers/media/platform/vicodec/codec-fwht.c index 36656031b295..4ee6d7e0fbe2 100644 --- a/drivers/media/platform/vicodec/codec-fwht.c +++ b/drivers/media/platform/vicodec/codec-fwht.c @@ -760,7 +760,7 @@ u32 fwht_encode_frame(struct fwht_raw_frame *frm, rlco_max = rlco + size / 2 - 256; encoding = encode_plane(frm->luma, ref_frm->luma, &rlco, rlco_max, cf, frm->height, frm->width, - frm->luma_step, is_intra, next_is_intra); + frm->luma_alpha_step, is_intra, next_is_intra); if (encoding & FWHT_FRAME_UNENCODED) encoding |= FWHT_LUMA_UNENCODED; encoding &= ~FWHT_FRAME_UNENCODED; diff --git a/drivers/media/platform/vicodec/codec-fwht.h b/drivers/media/platform/vicodec/codec-fwht.h index 3e9391fec5fe..743d78e112f8 100644 --- a/drivers/media/platform/vicodec/codec-fwht.h +++ b/drivers/media/platform/vicodec/codec-fwht.h @@ -104,9 +104,10 @@ struct fwht_raw_frame { unsigned int width, height; unsigned int width_div; unsigned int height_div; - unsigned int luma_step; + unsigned int luma_alpha_step; unsigned int chroma_step; - u8 *luma, *cb, *cr; + unsigned int components_num; + u8 *luma, *cb, *cr, *alpha; }; #define FWHT_FRAME_PCODED BIT(0) diff --git a/drivers/media/platform/vicodec/codec-v4l2-fwht.c b/drivers/media/platform/vicodec/codec-v4l2-fwht.c index e5b68fb38aac..b842636e71a9 100644 --- a/drivers/media/platform/vicodec/codec-v4l2-fwht.c +++ b/drivers/media/platform/vicodec/codec-v4l2-fwht.c @@ -11,27 +11,28 @@ #include "codec-v4l2-fwht.h" static const struct v4l2_fwht_pixfmt_info v4l2_fwht_pixfmts[] = { - { V4L2_PIX_FMT_YUV420, 1, 3, 2, 1, 1, 2, 2 }, - { V4L2_PIX_FMT_YVU420, 1, 3, 2, 1, 1, 2, 2 }, - { V4L2_PIX_FMT_YUV422P, 1, 2, 1, 1, 1, 2, 1 }, - { V4L2_PIX_FMT_NV12, 1, 3, 2, 1, 2, 2, 2 }, - { V4L2_PIX_FMT_NV21, 1, 3, 2, 1, 2, 2, 2 }, - { V4L2_PIX_FMT_NV16, 1, 2, 1, 1, 2, 2, 1 }, - { V4L2_PIX_FMT_NV61, 1, 2, 1, 1, 2, 2, 1 }, - { V4L2_PIX_FMT_NV24, 1, 3, 1, 1, 2, 1, 1 }, - { V4L2_PIX_FMT_NV42, 1, 3, 1, 1, 2, 1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_FMT_UYVY, 2, 2, 1, 2, 4, 2, 1, 3}, + { V4L2_PIX_FMT_VYUY, 2, 2, 1, 2, 4, 2, 1, 3}, + { V4L2_PIX_FMT_BGR24, 3, 3, 1, 3, 3, 1, 1, 3}, + { V4L2_PIX_FMT_RGB24, 3, 3, 1, 3, 3, 1, 1, 3}, + { V4L2_PIX_FMT_HSV24, 3, 3, 1, 3, 3, 1, 1, 3}, + { V4L2_PIX_FMT_BGR32, 4, 4, 1, 4, 4, 1, 1, 3}, + { V4L2_PIX_FMT_XBGR32, 4, 4, 1, 4, 4, 1, 1, 3}, + { V4L2_PIX_FMT_RGB32, 4, 4, 1, 4, 4, 1, 1, 3}, + { V4L2_PIX_FMT_XRGB32, 4, 4, 1, 4, 4, 1, 1, 3}, + { V4L2_PIX_FMT_HSV32, 4, 4, 1, 4, 4, 1, 1, 3}, + }; const struct v4l2_fwht_pixfmt_info *v4l2_fwht_find_pixfmt(u32 pixelformat) @@ -68,8 +69,10 @@ int v4l2_fwht_encode(struct v4l2_fwht_state *state, u8 *p_in, u8 *p_out) rf.luma = p_in; rf.width_div = info->width_div; rf.height_div = info->height_div; - rf.luma_step = info->luma_step; + rf.luma_alpha_step = info->luma_alpha_step; rf.chroma_step = info->chroma_step; + rf.alpha = NULL; + rf.components_num = info->components_num; switch (info->id) { case V4L2_PIX_FMT_YUV420: diff --git a/drivers/media/platform/vicodec/codec-v4l2-fwht.h b/drivers/media/platform/vicodec/codec-v4l2-fwht.h index 162465b78067..ed53e28d4f9c 100644 --- a/drivers/media/platform/vicodec/codec-v4l2-fwht.h +++ b/drivers/media/platform/vicodec/codec-v4l2-fwht.h @@ -13,11 +13,12 @@ struct v4l2_fwht_pixfmt_info { unsigned int bytesperline_mult; unsigned int sizeimage_mult; unsigned int sizeimage_div; - unsigned int luma_step; + unsigned int luma_alpha_step; unsigned int chroma_step; /* Chroma plane subsampling */ unsigned int width_div; unsigned int height_div; + unsigned int components_num; }; struct v4l2_fwht_state { diff --git a/drivers/media/platform/vicodec/vicodec-core.c b/drivers/media/platform/vicodec/vicodec-core.c index 1eb9132bfc85..fb6d5e9a06ab 100644 --- a/drivers/media/platform/vicodec/vicodec-core.c +++ b/drivers/media/platform/vicodec/vicodec-core.c @@ -61,7 +61,7 @@ struct pixfmt_info { }; static const struct v4l2_fwht_pixfmt_info pixfmt_fwht = { - V4L2_PIX_FMT_FWHT, 0, 3, 1, 1, 1, 1, 1 + V4L2_PIX_FMT_FWHT, 0, 3, 1, 1, 1, 1, 1, 0 }; static void vicodec_dev_release(struct device *dev)