From patchwork Fri Jun 13 16:08:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Zabel X-Patchwork-Id: 4350551 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5AFDE9F314 for ; Fri, 13 Jun 2014 16:09:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7E8D120222 for ; Fri, 13 Jun 2014 16:09:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8BB13201B9 for ; Fri, 13 Jun 2014 16:09:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753465AbaFMQJW (ORCPT ); Fri, 13 Jun 2014 12:09:22 -0400 Received: from metis.ext.pengutronix.de ([92.198.50.35]:44594 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753246AbaFMQJU (ORCPT ); Fri, 13 Jun 2014 12:09:20 -0400 Received: from client-120-static.hi.pengutronix.de ([10.1.0.120] helo=paszta.pengutronix.de.) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1WvU2K-0006dC-UK; Fri, 13 Jun 2014 18:09:04 +0200 From: Philipp Zabel To: linux-media@vger.kernel.org Cc: Mauro Carvalho Chehab , Kamil Debski , Fabio Estevam , kernel@pengutronix.de, Philipp Zabel Subject: [PATCH 27/30] [media] coda: allow odd width, but still round up bytesperline Date: Fri, 13 Jun 2014 18:08:53 +0200 Message-Id: <1402675736-15379-28-git-send-email-p.zabel@pengutronix.de> X-Mailer: git-send-email 2.0.0.rc2 In-Reply-To: <1402675736-15379-1-git-send-email-p.zabel@pengutronix.de> References: <1402675736-15379-1-git-send-email-p.zabel@pengutronix.de> X-SA-Exim-Connect-IP: 10.1.0.120 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-media@vger.kernel.org Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Even though the CODA h.264 decoder always decodes complete macroblocks, we can set the stride to the corresponding multiple of 16 and use a value smaller than that as real width. Unfortunately the same doesn't work for height, as there is no vertical linesperframe stride for discontiguous planar YUV frames. Signed-off-by: Philipp Zabel --- drivers/media/platform/coda.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c index 0697436..2b997bd 100644 --- a/drivers/media/platform/coda.c +++ b/drivers/media/platform/coda.c @@ -742,9 +742,9 @@ static int coda_try_fmt_vid_cap(struct file *file, void *priv, /* The h.264 decoder only returns complete 16x16 macroblocks */ if (codec && codec->src_fourcc == V4L2_PIX_FMT_H264) { - f->fmt.pix.width = round_up(f->fmt.pix.width, 16); + f->fmt.pix.width = f->fmt.pix.width; f->fmt.pix.height = round_up(f->fmt.pix.height, 16); - f->fmt.pix.bytesperline = f->fmt.pix.width; + f->fmt.pix.bytesperline = round_up(f->fmt.pix.width, 16); f->fmt.pix.sizeimage = f->fmt.pix.bytesperline * f->fmt.pix.height * 3 / 2; }