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, 1 }, - { V4L2_PIX_FMT_YUYV, 2, 2, 1, 2, 4, 2, 1 }, - { V4L2_PIX_FMT_YVYU, 2, 2, 1, 2, 4, 2, 1 }, - { V4L2_PIX_FMT_UYVY, 2, 2, 1, 2, 4, 2, 1 }, - { V4L2_PIX_FMT_VYUY, 2, 2, 1, 2, 4, 2, 1 }, - { V4L2_PIX_FMT_BGR24, 3, 3, 1, 3, 3, 1, 1 }, - { V4L2_PIX_FMT_RGB24, 3, 3, 1, 3, 3, 1, 1 }, - { V4L2_PIX_FMT_HSV24, 3, 3, 1, 3, 3, 1, 1 }, - { V4L2_PIX_FMT_BGR32, 4, 4, 1, 4, 4, 1, 1 }, - { V4L2_PIX_FMT_XBGR32, 4, 4, 1, 4, 4, 1, 1 }, - { V4L2_PIX_FMT_RGB32, 4, 4, 1, 4, 4, 1, 1 }, - { V4L2_PIX_FMT_XRGB32, 4, 4, 1, 4, 4, 1, 1 }, - { V4L2_PIX_FMT_HSV32, 4, 4, 1, 4, 4, 1, 1 }, + { V4L2_PIX_FMT_YUV420, 1, 3, 2, 1, 1, 2, 2, 3}, + { V4L2_PIX_FMT_YVU420, 1, 3, 2, 1, 1, 2, 2, 3}, + { V4L2_PIX_FMT_YUV422P, 1, 2, 1, 1, 1, 2, 1, 3}, + { V4L2_PIX_FMT_NV12, 1, 3, 2, 1, 2, 2, 2, 3}, + { V4L2_PIX_FMT_NV21, 1, 3, 2, 1, 2, 2, 2, 3}, + { V4L2_PIX_FMT_NV16, 1, 2, 1, 1, 2, 2, 1, 3}, + { V4L2_PIX_FMT_NV61, 1, 2, 1, 1, 2, 2, 1, 3}, + { V4L2_PIX_FMT_NV24, 1, 3, 1, 1, 2, 1, 1, 3}, + { V4L2_PIX_FMT_NV42, 1, 3, 1, 1, 2, 1, 1, 3}, + { V4L2_PIX_FMT_YUYV, 2, 2, 1, 2, 4, 2, 1, 3}, + { V4L2_PIX_FMT_YVYU, 2, 2, 1, 2, 4, 2, 1, 3}, + { V4L2_PIX_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) From patchwork Thu Nov 15 11:23:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dafna Hirschfeld X-Patchwork-Id: 10684161 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 62CC413B5 for ; Thu, 15 Nov 2018 11:24:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5218C2C462 for ; Thu, 15 Nov 2018 11:24:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 463772C466; Thu, 15 Nov 2018 11:24:51 +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 7AE7A2C462 for ; Thu, 15 Nov 2018 11:24:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731813AbeKOVcQ (ORCPT ); Thu, 15 Nov 2018 16:32:16 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:51167 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726664AbeKOVcP (ORCPT ); Thu, 15 Nov 2018 16:32:15 -0500 Received: by mail-wm1-f68.google.com with SMTP id 124-v6so18582626wmw.0 for ; Thu, 15 Nov 2018 03:24:47 -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=9UpUfqxzfSHDUPwzX/Myw3dUjIS3r4lQdJPk92BCSA0=; b=JSB+3XO2YGR5uj5itJ5o6W1twKaQj0dhkOKs3Y0+vAmbs+VOnIZby0Qvp1rEypabKP LDqPhjJPjzECd76o2DCSZ0HIvBROcJi2WAtiKQ/wPDwBny8ambrDmF0vgHOjys42Ro5W 9Ias6vWnykKRWEK0vq98Kn1NzmoLGUtrRX86freSmKux2GZObubH+w6zwi7rgDmewKSA Vr+Okre79XX2VKyj8MtzJrAw5H2nzyf7SbIw1qR2jC9Ut/bw6K1pvOkC5W0l3R2Ag6cg SjLSSWcW34a6OagzvS9sSwGRSoe4Z2ePluRmX6tg+x9Tj5i2FIGpGmYGY2ex+MJeyqxZ miwg== 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=9UpUfqxzfSHDUPwzX/Myw3dUjIS3r4lQdJPk92BCSA0=; b=BgfjWLX+1iF2Q7iQD/Y3sJ1yGMZbB703J8BvrKjRb6xK91abpHDawHICM3uejjQgOH gh4tf202/530J4/VNl+/mIoEa/yRmhMrplvOnm/+GqWcJsmNxj+uzoWisLIg6P/uhZEL +/boXhOvJ+rr6wW4pmGYG+oW8I1t87BTFCqiph9xbU0LUnu9lHF+SgGJcr0V+nSzXlx4 GJtaN6h6xjnZq5fVu+9eAcRFOrLXsRH0vM/kXiDjf/XxeBjrVImfv8zRs+CwvsFp+Yxv UA5gGeqABmLqvnEtx1blCmkT7iEda9f8KPPrlWxwxjPOz1JVr/tUaktcE9EG8qV0qZOh XWOA== X-Gm-Message-State: AGRZ1gK5cTIBY6GiZkOk1eA5B0GFCONJRb7hfAg4XryI20SHmZL2eb1H lsAud/uu2SXBrkkaXmTQEE4= X-Google-Smtp-Source: AJdET5dLTBJiICHbz5pAomu8aXjlHL7wt/K7yLjZQomUEkfGpgdi5a/aoZMmztKfDt/0PPiSVQ1HIQ== X-Received: by 2002:a1c:7fc1:: with SMTP id a184mr4833786wmd.55.1542281087086; Thu, 15 Nov 2018 03:24:47 -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.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Nov 2018 03:24:46 -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 2/3] media: vicodec: Add support of greyscale format Date: Thu, 15 Nov 2018 13:23:31 +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 support for single plane greyscale format V4L2_PIX_FMT_GREY. Also change the header of the encoded file to include the number of components. Signed-off-by: Dafna Hirschfeld --- drivers/media/platform/vicodec/codec-fwht.c | 56 +++++++++++-------- drivers/media/platform/vicodec/codec-fwht.h | 8 ++- .../media/platform/vicodec/codec-v4l2-fwht.c | 44 ++++++++++++--- drivers/media/platform/vicodec/vicodec-core.c | 25 +++++++-- 4 files changed, 93 insertions(+), 40 deletions(-) diff --git a/drivers/media/platform/vicodec/codec-fwht.c b/drivers/media/platform/vicodec/codec-fwht.c index 4ee6d7e0fbe2..1af9af84163e 100644 --- a/drivers/media/platform/vicodec/codec-fwht.c +++ b/drivers/media/platform/vicodec/codec-fwht.c @@ -753,9 +753,6 @@ u32 fwht_encode_frame(struct fwht_raw_frame *frm, __be16 *rlco = cf->rlc_data; __be16 *rlco_max; u32 encoding; - u32 chroma_h = frm->height / frm->height_div; - u32 chroma_w = frm->width / frm->width_div; - unsigned int chroma_size = chroma_h * chroma_w; rlco_max = rlco + size / 2 - 256; encoding = encode_plane(frm->luma, ref_frm->luma, &rlco, rlco_max, cf, @@ -764,20 +761,27 @@ u32 fwht_encode_frame(struct fwht_raw_frame *frm, if (encoding & FWHT_FRAME_UNENCODED) encoding |= FWHT_LUMA_UNENCODED; encoding &= ~FWHT_FRAME_UNENCODED; - rlco_max = rlco + chroma_size / 2 - 256; - encoding |= encode_plane(frm->cb, ref_frm->cb, &rlco, rlco_max, cf, + + if (frm->components_num >= 3) { + u32 chroma_h = frm->height / frm->height_div; + u32 chroma_w = frm->width / frm->width_div; + unsigned int chroma_size = chroma_h * chroma_w; + + rlco_max = rlco + chroma_size / 2 - 256; + encoding |= encode_plane(frm->cb, ref_frm->cb, &rlco, rlco_max, cf, chroma_h, chroma_w, frm->chroma_step, is_intra, next_is_intra); - if (encoding & FWHT_FRAME_UNENCODED) - encoding |= FWHT_CB_UNENCODED; - encoding &= ~FWHT_FRAME_UNENCODED; - rlco_max = rlco + chroma_size / 2 - 256; - encoding |= encode_plane(frm->cr, ref_frm->cr, &rlco, rlco_max, cf, + if (encoding & FWHT_FRAME_UNENCODED) + encoding |= FWHT_CB_UNENCODED; + encoding &= ~FWHT_FRAME_UNENCODED; + rlco_max = rlco + chroma_size / 2 - 256; + encoding |= encode_plane(frm->cr, ref_frm->cr, &rlco, rlco_max, cf, chroma_h, chroma_w, frm->chroma_step, is_intra, next_is_intra); - if (encoding & FWHT_FRAME_UNENCODED) - encoding |= FWHT_CR_UNENCODED; - encoding &= ~FWHT_FRAME_UNENCODED; + if (encoding & FWHT_FRAME_UNENCODED) + encoding |= FWHT_CR_UNENCODED; + encoding &= ~FWHT_FRAME_UNENCODED; + } cf->size = (rlco - cf->rlc_data) * sizeof(*rlco); return encoding; } @@ -836,20 +840,24 @@ static void decode_plane(struct fwht_cframe *cf, const __be16 **rlco, u8 *ref, } void fwht_decode_frame(struct fwht_cframe *cf, struct fwht_raw_frame *ref, - u32 hdr_flags) + u32 hdr_flags, unsigned int components_num) { const __be16 *rlco = cf->rlc_data; - u32 h = cf->height / 2; - u32 w = cf->width / 2; - if (hdr_flags & FWHT_FL_CHROMA_FULL_HEIGHT) - h *= 2; - if (hdr_flags & FWHT_FL_CHROMA_FULL_WIDTH) - w *= 2; decode_plane(cf, &rlco, ref->luma, cf->height, cf->width, hdr_flags & FWHT_FL_LUMA_IS_UNCOMPRESSED); - decode_plane(cf, &rlco, ref->cb, h, w, - hdr_flags & FWHT_FL_CB_IS_UNCOMPRESSED); - decode_plane(cf, &rlco, ref->cr, h, w, - hdr_flags & FWHT_FL_CR_IS_UNCOMPRESSED); + + if (components_num >= 3) { + u32 h = cf->height; + u32 w = cf->width; + + if (!(hdr_flags & FWHT_FL_CHROMA_FULL_HEIGHT)) + h /= 2; + if (!(hdr_flags & FWHT_FL_CHROMA_FULL_WIDTH)) + w /= 2; + decode_plane(cf, &rlco, ref->cb, h, w, + hdr_flags & FWHT_FL_CB_IS_UNCOMPRESSED); + decode_plane(cf, &rlco, ref->cr, h, w, + hdr_flags & FWHT_FL_CR_IS_UNCOMPRESSED); + } } diff --git a/drivers/media/platform/vicodec/codec-fwht.h b/drivers/media/platform/vicodec/codec-fwht.h index 743d78e112f8..bde11fb93f26 100644 --- a/drivers/media/platform/vicodec/codec-fwht.h +++ b/drivers/media/platform/vicodec/codec-fwht.h @@ -56,7 +56,7 @@ #define FWHT_MAGIC1 0x4f4f4f4f #define FWHT_MAGIC2 0xffffffff -#define FWHT_VERSION 1 +#define FWHT_VERSION 2 /* Set if this is an interlaced format */ #define FWHT_FL_IS_INTERLACED BIT(0) @@ -76,6 +76,10 @@ #define FWHT_FL_CHROMA_FULL_HEIGHT BIT(7) #define FWHT_FL_CHROMA_FULL_WIDTH BIT(8) +/* A 4-values flag - the number of components - 1 */ +#define FWHT_FL_COMPONENTS_NUM_MSK GENMASK(17, 16) +#define FWHT_FL_COMPONENTS_NUM_OFFSET 16 + struct fwht_cframe_hdr { u32 magic1; u32 magic2; @@ -121,6 +125,6 @@ u32 fwht_encode_frame(struct fwht_raw_frame *frm, struct fwht_cframe *cf, bool is_intra, bool next_is_intra); void fwht_decode_frame(struct fwht_cframe *cf, struct fwht_raw_frame *ref, - u32 hdr_flags); + u32 hdr_flags, unsigned int components_num); #endif diff --git a/drivers/media/platform/vicodec/codec-v4l2-fwht.c b/drivers/media/platform/vicodec/codec-v4l2-fwht.c index b842636e71a9..7dc3918a017e 100644 --- a/drivers/media/platform/vicodec/codec-v4l2-fwht.c +++ b/drivers/media/platform/vicodec/codec-v4l2-fwht.c @@ -11,6 +11,7 @@ #include "codec-v4l2-fwht.h" static const struct v4l2_fwht_pixfmt_info v4l2_fwht_pixfmts[] = { + { V4L2_PIX_FMT_GREY, 1, 1, 1, 1, 0, 1, 1, 1}, { V4L2_PIX_FMT_YUV420, 1, 3, 2, 1, 1, 2, 2, 3}, { V4L2_PIX_FMT_YVU420, 1, 3, 2, 1, 1, 2, 2, 3}, { V4L2_PIX_FMT_YUV422P, 1, 2, 1, 1, 1, 2, 1, 3}, @@ -75,6 +76,10 @@ int v4l2_fwht_encode(struct v4l2_fwht_state *state, u8 *p_in, u8 *p_out) rf.components_num = info->components_num; switch (info->id) { + case V4L2_PIX_FMT_GREY: + rf.cb = NULL; + rf.cr = NULL; + break; case V4L2_PIX_FMT_YUV420: rf.cb = rf.luma + size; rf.cr = rf.cb + size / 4; @@ -165,6 +170,7 @@ int v4l2_fwht_encode(struct v4l2_fwht_state *state, u8 *p_in, u8 *p_out) p_hdr->version = htonl(FWHT_VERSION); p_hdr->width = htonl(cf.width); p_hdr->height = htonl(cf.height); + flags |= (info->components_num - 1) << FWHT_FL_COMPONENTS_NUM_OFFSET; if (encoding & FWHT_LUMA_UNENCODED) flags |= FWHT_FL_LUMA_IS_UNCOMPRESSED; if (encoding & FWHT_CB_UNENCODED) @@ -195,6 +201,8 @@ int v4l2_fwht_decode(struct v4l2_fwht_state *state, u8 *p_in, u8 *p_out) struct fwht_cframe_hdr *p_hdr; struct fwht_cframe cf; u8 *p; + unsigned int components_num = 3; + unsigned int version; if (!state->info) return -EINVAL; @@ -202,16 +210,16 @@ int v4l2_fwht_decode(struct v4l2_fwht_state *state, u8 *p_in, u8 *p_out) p_hdr = (struct fwht_cframe_hdr *)p_in; cf.width = ntohl(p_hdr->width); cf.height = ntohl(p_hdr->height); - flags = ntohl(p_hdr->flags); - state->colorspace = ntohl(p_hdr->colorspace); - state->xfer_func = ntohl(p_hdr->xfer_func); - state->ycbcr_enc = ntohl(p_hdr->ycbcr_enc); - state->quantization = ntohl(p_hdr->quantization); - cf.rlc_data = (__be16 *)(p_in + sizeof(*p_hdr)); + + version = ntohl(p_hdr->version); + if (!version || version > FWHT_VERSION) { + pr_err("version %d is not supported, current version is %d\n", + version, FWHT_VERSION); + return -EINVAL; + } if (p_hdr->magic1 != FWHT_MAGIC1 || p_hdr->magic2 != FWHT_MAGIC2 || - ntohl(p_hdr->version) != FWHT_VERSION || (cf.width & 7) || (cf.height & 7)) return -EINVAL; @@ -219,14 +227,34 @@ int v4l2_fwht_decode(struct v4l2_fwht_state *state, u8 *p_in, u8 *p_out) if (cf.width != state->width || cf.height != state->height) return -EINVAL; + flags = ntohl(p_hdr->flags); + + if (version == FWHT_VERSION) { + components_num = 1 + ((flags & FWHT_FL_COMPONENTS_NUM_MSK) >> + FWHT_FL_COMPONENTS_NUM_OFFSET); + } + + state->colorspace = ntohl(p_hdr->colorspace); + state->xfer_func = ntohl(p_hdr->xfer_func); + state->ycbcr_enc = ntohl(p_hdr->ycbcr_enc); + state->quantization = ntohl(p_hdr->quantization); + cf.rlc_data = (__be16 *)(p_in + sizeof(*p_hdr)); + if (!(flags & FWHT_FL_CHROMA_FULL_WIDTH)) chroma_size /= 2; if (!(flags & FWHT_FL_CHROMA_FULL_HEIGHT)) chroma_size /= 2; - fwht_decode_frame(&cf, &state->ref_frame, flags); + fwht_decode_frame(&cf, &state->ref_frame, flags, components_num); + /* + * TODO - handle the case where the compressed stream encodes a different + * format than the requested decoded format. + */ switch (state->info->id) { + case V4L2_PIX_FMT_GREY: + memcpy(p_out, state->ref_frame.luma, size); + break; case V4L2_PIX_FMT_YUV420: case V4L2_PIX_FMT_YUV422P: memcpy(p_out, state->ref_frame.luma, size); diff --git a/drivers/media/platform/vicodec/vicodec-core.c b/drivers/media/platform/vicodec/vicodec-core.c index fb6d5e9a06ab..92bc68694a21 100644 --- a/drivers/media/platform/vicodec/vicodec-core.c +++ b/drivers/media/platform/vicodec/vicodec-core.c @@ -993,6 +993,16 @@ static int vicodec_start_streaming(struct vb2_queue *q, unsigned int size = q_data->width * q_data->height; const struct v4l2_fwht_pixfmt_info *info = q_data->info; unsigned int chroma_div = info->width_div * info->height_div; + unsigned int total_planes_size; + + /* + * we don't know ahead how many components are in the encoding type + * V4L2_PIX_FMT_FWHT, so we will allocate space for 3 planes. + */ + if (info->id == V4L2_PIX_FMT_FWHT || info->components_num >= 3) + total_planes_size = size + 2 * (size / chroma_div); + else + total_planes_size = size; q_data->sequence = 0; @@ -1002,10 +1012,8 @@ static int vicodec_start_streaming(struct vb2_queue *q, state->width = q_data->width; state->height = q_data->height; state->ref_frame.width = state->ref_frame.height = 0; - state->ref_frame.luma = kvmalloc(size + 2 * size / chroma_div, - GFP_KERNEL); - ctx->comp_max_size = size + 2 * size / chroma_div + - sizeof(struct fwht_cframe_hdr); + state->ref_frame.luma = kvmalloc(total_planes_size, GFP_KERNEL); + ctx->comp_max_size = total_planes_size + sizeof(struct fwht_cframe_hdr); state->compressed_frame = kvmalloc(ctx->comp_max_size, GFP_KERNEL); if (!state->ref_frame.luma || !state->compressed_frame) { kvfree(state->ref_frame.luma); @@ -1013,8 +1021,13 @@ static int vicodec_start_streaming(struct vb2_queue *q, vicodec_return_bufs(q, VB2_BUF_STATE_QUEUED); return -ENOMEM; } - state->ref_frame.cb = state->ref_frame.luma + size; - state->ref_frame.cr = state->ref_frame.cb + size / chroma_div; + if (info->id == V4L2_PIX_FMT_FWHT || info->components_num >= 3) { + state->ref_frame.cb = state->ref_frame.luma + size; + state->ref_frame.cr = state->ref_frame.cb + size / chroma_div; + } else { + state->ref_frame.cb = NULL; + state->ref_frame.cr = NULL; + } ctx->last_src_buf = NULL; ctx->last_dst_buf = NULL; state->gop_cnt = 0; From patchwork Thu Nov 15 11:23:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dafna Hirschfeld X-Patchwork-Id: 10684163 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 D602213BF for ; Thu, 15 Nov 2018 11:24:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C74952C462 for ; Thu, 15 Nov 2018 11:24:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB8052C466; Thu, 15 Nov 2018 11:24:52 +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 398EE2C462 for ; Thu, 15 Nov 2018 11:24:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732655AbeKOVcR (ORCPT ); Thu, 15 Nov 2018 16:32:17 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:52108 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729047AbeKOVcR (ORCPT ); Thu, 15 Nov 2018 16:32:17 -0500 Received: by mail-wm1-f68.google.com with SMTP id w7-v6so18437596wmc.1 for ; Thu, 15 Nov 2018 03:24:49 -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=0cNv84/NEjQ+I8IQZvd9JNwezmqAwDdrJVj7e41DMYw=; b=Q4qLMLj/i6OpUQex53JBzCabMARoZunkkN3e1Epe5VEnx+u/vtisa1alPaJDHZNRMu 9IZ73xmRlYUyhHCkZiz7SZ5uPmAyB5R3EI0MsuWGdaBnT2jF242+9hineobEPdq8J9m/ AoznQVjmBoFkCxm0bUfGAGtdf6qAqUtg8e+mx/R4rQarTjWKyCUCA4s8z6Wn6uOjyDGy QUBw9iwo7iVaKkY/Kf4Ib1ke5iDdXsb9Q3rfHxVKgJs++LyXabSIWGMyNK/6FxiltXhj GGTMDAWTCe6+8BwNCDBuMt4gvo3LaDUlL2k+shZPehJgTpZsdBfUpc5lij5jFMfZLdji FZxQ== 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=0cNv84/NEjQ+I8IQZvd9JNwezmqAwDdrJVj7e41DMYw=; b=fokQV1ZlhfAaD5NLyICxevB6SqpADUJtExZejrI9z0MXi1fQsy86TSKUwMmA8fEcuW 049wYmIO43Ailmulhkm2lxGOQhhCmYNLlipjJiCUljMXSddLkSIi8pxarpxFjnNkJ4KH Kuf+5wOOkfi7dxZ0JMoRgIYFq902YXm5ywWBGNZpZyFIzD2q8zjJkut21ynZ/On+6etm BoL/Y5bGnM1khbbsK1ZlPYBtmpxLCDLFJJ7KmM5+0GmvqZv2Qg7+CSnawKs3+8fFoQhp bho9RUbRbpH0upCk5cjqr+yDs4FLcOd5pN1Tc5jBpVgS5erVc2QcrBx++DPbHcQzIogx AEOg== X-Gm-Message-State: AGRZ1gI1PKscB3lKreejUY2P8Nh7XQVPz6BV1aqnjIUXE5B14A/oHK7e WxIAyGzEQk229HMubzraSYU= X-Google-Smtp-Source: AJdET5fi04Ke183Gn9ezveAusB7hp9jOFITrrRUyoxs932DaN4tvpGsKXKuBl+OrB71UK2h1Cy5Fag== X-Received: by 2002:a7b:c5cc:: with SMTP id n12mr836403wmk.149.1542281089167; Thu, 15 Nov 2018 03:24:49 -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.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Nov 2018 03:24:48 -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 3/3] media: vicodec: Add support for 4 planes formats Date: Thu, 15 Nov 2018 13:23:32 +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 support for formats with 4 planes: V4L2_PIX_FMT_ABGR32, V4L2_PIX_FMT_ARGB32. Also add alpha plane related flags to the header of the encoded file. Signed-off-by: Dafna Hirschfeld --- drivers/media/platform/vicodec/codec-fwht.c | 15 +++++++++ drivers/media/platform/vicodec/codec-fwht.h | 2 ++ .../media/platform/vicodec/codec-v4l2-fwht.c | 32 +++++++++++++++++++ drivers/media/platform/vicodec/vicodec-core.c | 12 +++++-- 4 files changed, 59 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/vicodec/codec-fwht.c b/drivers/media/platform/vicodec/codec-fwht.c index 1af9af84163e..9513374e8f44 100644 --- a/drivers/media/platform/vicodec/codec-fwht.c +++ b/drivers/media/platform/vicodec/codec-fwht.c @@ -782,6 +782,17 @@ u32 fwht_encode_frame(struct fwht_raw_frame *frm, encoding |= FWHT_CR_UNENCODED; encoding &= ~FWHT_FRAME_UNENCODED; } + + if (frm->components_num == 4) { + rlco_max = rlco + size / 2 - 256; + encoding = encode_plane(frm->alpha, ref_frm->alpha, &rlco, rlco_max, cf, + frm->height, frm->width, + frm->luma_alpha_step, is_intra, next_is_intra); + if (encoding & FWHT_FRAME_UNENCODED) + encoding |= FWHT_ALPHA_UNENCODED; + encoding &= ~FWHT_FRAME_UNENCODED; + } + cf->size = (rlco - cf->rlc_data) * sizeof(*rlco); return encoding; } @@ -860,4 +871,8 @@ void fwht_decode_frame(struct fwht_cframe *cf, struct fwht_raw_frame *ref, decode_plane(cf, &rlco, ref->cr, h, w, hdr_flags & FWHT_FL_CR_IS_UNCOMPRESSED); } + + if (components_num == 4) + decode_plane(cf, &rlco, ref->alpha, cf->height, cf->width, + hdr_flags & FWHT_FL_ALPHA_IS_UNCOMPRESSED); } diff --git a/drivers/media/platform/vicodec/codec-fwht.h b/drivers/media/platform/vicodec/codec-fwht.h index bde11fb93f26..90ff8962fca7 100644 --- a/drivers/media/platform/vicodec/codec-fwht.h +++ b/drivers/media/platform/vicodec/codec-fwht.h @@ -75,6 +75,7 @@ #define FWHT_FL_CR_IS_UNCOMPRESSED BIT(6) #define FWHT_FL_CHROMA_FULL_HEIGHT BIT(7) #define FWHT_FL_CHROMA_FULL_WIDTH BIT(8) +#define FWHT_FL_ALPHA_IS_UNCOMPRESSED BIT(9) /* A 4-values flag - the number of components - 1 */ #define FWHT_FL_COMPONENTS_NUM_MSK GENMASK(17, 16) @@ -119,6 +120,7 @@ struct fwht_raw_frame { #define FWHT_LUMA_UNENCODED BIT(2) #define FWHT_CB_UNENCODED BIT(3) #define FWHT_CR_UNENCODED BIT(4) +#define FWHT_ALPHA_UNENCODED BIT(5) u32 fwht_encode_frame(struct fwht_raw_frame *frm, struct fwht_raw_frame *ref_frm, diff --git a/drivers/media/platform/vicodec/codec-v4l2-fwht.c b/drivers/media/platform/vicodec/codec-v4l2-fwht.c index 7dc3918a017e..b53655a8cef6 100644 --- a/drivers/media/platform/vicodec/codec-v4l2-fwht.c +++ b/drivers/media/platform/vicodec/codec-v4l2-fwht.c @@ -33,6 +33,8 @@ static const struct v4l2_fwht_pixfmt_info v4l2_fwht_pixfmts[] = { { 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}, + { V4L2_PIX_FMT_ARGB32, 4, 4, 1, 4, 4, 1, 1, 4}, + { V4L2_PIX_FMT_ABGR32, 4, 4, 1, 4, 4, 1, 1, 4}, }; @@ -146,6 +148,18 @@ int v4l2_fwht_encode(struct v4l2_fwht_state *state, u8 *p_in, u8 *p_out) rf.cr = rf.cb + 2; rf.luma++; break; + case V4L2_PIX_FMT_ARGB32: + rf.alpha = rf.luma; + rf.cr = rf.luma + 1; + rf.cb = rf.cr + 2; + rf.luma += 2; + break; + case V4L2_PIX_FMT_ABGR32: + rf.cb = rf.luma; + rf.cr = rf.cb + 2; + rf.luma++; + rf.alpha = rf.cr + 1; + break; default: return -EINVAL; } @@ -177,6 +191,8 @@ int v4l2_fwht_encode(struct v4l2_fwht_state *state, u8 *p_in, u8 *p_out) flags |= FWHT_FL_CB_IS_UNCOMPRESSED; if (encoding & FWHT_CR_UNENCODED) flags |= FWHT_FL_CR_IS_UNCOMPRESSED; + if (encoding & FWHT_ALPHA_UNENCODED) + flags |= FWHT_FL_ALPHA_IS_UNCOMPRESSED; if (rf.height_div == 1) flags |= FWHT_FL_CHROMA_FULL_HEIGHT; if (rf.width_div == 1) @@ -356,6 +372,22 @@ int v4l2_fwht_decode(struct v4l2_fwht_state *state, u8 *p_in, u8 *p_out) *p++ = 0; } break; + case V4L2_PIX_FMT_ARGB32: + for (i = 0, p = p_out; i < size; i++) { + *p++ = state->ref_frame.alpha[i]; + *p++ = state->ref_frame.cr[i]; + *p++ = state->ref_frame.luma[i]; + *p++ = state->ref_frame.cb[i]; + } + break; + case V4L2_PIX_FMT_ABGR32: + for (i = 0, p = p_out; i < size; i++) { + *p++ = state->ref_frame.cb[i]; + *p++ = state->ref_frame.luma[i]; + *p++ = state->ref_frame.cr[i]; + *p++ = state->ref_frame.alpha[i]; + } + break; default: return -EINVAL; } diff --git a/drivers/media/platform/vicodec/vicodec-core.c b/drivers/media/platform/vicodec/vicodec-core.c index 92bc68694a21..5ae876238e13 100644 --- a/drivers/media/platform/vicodec/vicodec-core.c +++ b/drivers/media/platform/vicodec/vicodec-core.c @@ -997,9 +997,11 @@ static int vicodec_start_streaming(struct vb2_queue *q, /* * we don't know ahead how many components are in the encoding type - * V4L2_PIX_FMT_FWHT, so we will allocate space for 3 planes. + * V4L2_PIX_FMT_FWHT, so we will allocate space for 4 planes. */ - if (info->id == V4L2_PIX_FMT_FWHT || info->components_num >= 3) + if (info->id == V4L2_PIX_FMT_FWHT || info->components_num == 4) + total_planes_size = 2 * size + 2 * (size / chroma_div); + else if (info->components_num == 3) total_planes_size = size + 2 * (size / chroma_div); else total_planes_size = size; @@ -1028,6 +1030,12 @@ static int vicodec_start_streaming(struct vb2_queue *q, state->ref_frame.cb = NULL; state->ref_frame.cr = NULL; } + + if (info->id == V4L2_PIX_FMT_FWHT || info->components_num == 4) + state->ref_frame.alpha = state->ref_frame.cr + size / chroma_div; + else + state->ref_frame.alpha = NULL; + ctx->last_src_buf = NULL; ctx->last_dst_buf = NULL; state->gop_cnt = 0;