From patchwork Fri Mar 1 13:24:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 10835315 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 583391880 for ; Fri, 1 Mar 2019 13:24:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 49A9B2DD97 for ; Fri, 1 Mar 2019 13:24:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3DC272EE41; Fri, 1 Mar 2019 13:24:34 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 233F42DD97 for ; Fri, 1 Mar 2019 13:24:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387588AbfCANYb (ORCPT ); Fri, 1 Mar 2019 08:24:31 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:50544 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387550AbfCANYa (ORCPT ); Fri, 1 Mar 2019 08:24:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=7q+FhjWdYXA1o+3VwsL572UHQ/YkxZUbnx9oC112dvQ=; b=u1tstb+HPFPaLQvXLJSgECz+f3 4qXmZTwH2DDvjpeTvG3fPTbRLNbarIS9pjqIkuHGyX427xpooRSuSruK1382ts/O62ZaB6zRHNgOf ui2/fzRArO0R3C6tchdMQwnVeEyM/7S/MGqZpQv/u2UceXymeEunoucnQcV5HXjiC0kDbFZdwYQQt 8zB85NctrtsY5Jw/ePKNAg4qjjT4XjnAx9S1/ABGuiZqVqYsC1PWfziB/W4svDFUCqQtobbBy6q5H dyrgG7HqUosCXG98UI1dek4tazIQ3YKcIHF6iPThcuixATLgD+V4Yy9I9/ecc2yrXfVSIGgtcZI6G TJQm00XQ==; Received: from 177.41.113.159.dynamic.adsl.gvt.net.br ([177.41.113.159] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gzi9O-0003y3-0l; Fri, 01 Mar 2019 13:24:30 +0000 Received: from mchehab by bombadil.infradead.org with local (Exim 4.92) (envelope-from ) id 1gzi9L-0002Nc-Tm; Fri, 01 Mar 2019 10:24:27 -0300 From: Mauro Carvalho Chehab To: Linux Media Mailing List Cc: Mauro Carvalho Chehab , Mauro Carvalho Chehab , Hans Verkuil , Ezequiel Garcia Subject: [PATCH 08/10] media: vim2m: don't accept YUYV anymore as output format Date: Fri, 1 Mar 2019 10:24:24 -0300 Message-Id: <906312367485f0e67e16bc4fb12c239885b61dbc.1551446121.git.mchehab+samsung@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 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 Handling any Y,Cr,Cb formats require some extra logic, as it handles a group of two pixels. That's easy while we don't do horizontal scaling. However, doing horizontal scaling with such formats would require a lot more code, in order to avoid distortions, as, if it scales to two non-consecutive points, the logic would need to read 4 points in order to properly convert to RGB. As this is just a test driver, and we want fast algorithms, let's just get rid of this format as an output one. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/vim2m.c | 57 ++-------------------------------- 1 file changed, 2 insertions(+), 55 deletions(-) diff --git a/drivers/media/platform/vim2m.c b/drivers/media/platform/vim2m.c index 1708becbaa9d..a0e52eb205e3 100644 --- a/drivers/media/platform/vim2m.c +++ b/drivers/media/platform/vim2m.c @@ -113,7 +113,7 @@ static struct vim2m_fmt formats[] = { }, { .fourcc = V4L2_PIX_FMT_YUYV, .depth = 16, - .types = MEM2MEM_CAPTURE | MEM2MEM_OUTPUT, + .types = MEM2MEM_CAPTURE, }, { .fourcc = V4L2_PIX_FMT_SBGGR8, .depth = 8, @@ -280,26 +280,6 @@ static void fast_copy_two_pixels(struct vim2m_q_data *q_data_in, return; } - /* Copy line at reverse order - YUYV format */ - if (q_data_in->fmt->fourcc == V4L2_PIX_FMT_YUYV) { - int u, v, y, y1; - - *src -= 2; - - y1 = (*src)[0]; /* copy as second point */ - u = (*src)[1]; - y = (*src)[2]; /* copy as first point */ - v = (*src)[3]; - - *src -= 2; - - *(*dst)++ = y; - *(*dst)++ = u; - *(*dst)++ = y1; - *(*dst)++ = v; - return; - } - /* copy RGB formats in reverse order */ memcpy(*dst, *src, depth); memcpy(*dst + depth, *src - depth, depth); @@ -352,6 +332,7 @@ static void copy_two_pixels(struct vim2m_q_data *q_data_in, *src += step << 1; } break; + default: case V4L2_PIX_FMT_RGB24: for (i = 0; i < 2; i++) { *r++ = (*src)[0]; @@ -370,40 +351,6 @@ static void copy_two_pixels(struct vim2m_q_data *q_data_in, *src += step * 3; } break; - default: /* V4L2_PIX_FMT_YUYV */ - { - int u, v, y, y1, u1, v1, tmp; - - if (reverse) { - *src -= 2; - - y1 = (*src)[0]; /* copy as second point */ - u = (*src)[1]; - y = (*src)[2]; /* copy as first point */ - v = (*src)[3]; - - *src -= 2; - } else { - y = *(*src)++; - u = *(*src)++; - y1 = *(*src)++; - v = *(*src)++; - } - - u1 = (((u - 128) << 7) + (u - 128)) >> 6; - tmp = (((u - 128) << 1) + (u - 128) + - ((v - 128) << 2) + ((v - 128) << 1)) >> 3; - v1 = (((v - 128) << 1) + (v - 128)) >> 1; - - *r++ = CLIP(y + v1); - *g++ = CLIP(y - tmp); - *b++ = CLIP(y + u1); - - *r = CLIP(y1 + v1); - *g = CLIP(y1 - tmp); - *b = CLIP(y1 + u1); - break; - } } /* Step 2: store two consecutive points, reversing them if needed */