From patchwork Fri Feb 10 13:30:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 9566771 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8506460573 for ; Fri, 10 Feb 2017 13:30:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6FC342858B for ; Fri, 10 Feb 2017 13:30:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 64A612858A; Fri, 10 Feb 2017 13:30:24 +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=-6.9 required=2.0 tests=BAYES_00,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 0EC8728589 for ; Fri, 10 Feb 2017 13:30:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751767AbdBJNaW (ORCPT ); Fri, 10 Feb 2017 08:30:22 -0500 Received: from mail.kernel.org ([198.145.29.136]:41846 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751457AbdBJNaW (ORCPT ); Fri, 10 Feb 2017 08:30:22 -0500 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BD0A620212; Fri, 10 Feb 2017 13:30:20 +0000 (UTC) Received: from CookieMonster.cookiemonster.local (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0C3332035D; Fri, 10 Feb 2017 13:30:18 +0000 (UTC) From: Kieran Bingham To: laurent.pinchart@ideasonboard.com, linux-renesas-soc@vger.kernel.org, kieran.bingham@ideasonboard.com Subject: [PATCH v2 3/4] vsp-lib: Support RPF frame cropping Date: Fri, 10 Feb 2017 13:30:07 +0000 Message-Id: X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Kieran Bingham Pass the optional '--crop (X,Y)/WxH' parameter through reference_frame allowing the input to be cropped for comparison Signed-off-by: Kieran Bingham --- scripts/vsp-lib.sh | 52 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 10 deletions(-) diff --git a/scripts/vsp-lib.sh b/scripts/vsp-lib.sh index 9e5e57b8c4ba..d13e7b6cde31 100755 --- a/scripts/vsp-lib.sh +++ b/scripts/vsp-lib.sh @@ -147,6 +147,9 @@ reference_frame() { clu) options="$options --clu $value" ;; + crop) + options="$options --crop $value" + ;; hflip) [ x$value = x1 ] && options="$options --hflip" ;; @@ -662,22 +665,51 @@ format_rpf_wpf() { local infmt=$(format_v4l2_to_mbus $3) local size=$4 local outfmt=$(format_v4l2_to_mbus $5) - local crop=$6 + local rpfcrop= + local wpfcrop= + local rpfoutsize= local outsize= + local option= + + __vsp_rpf_format=$3 + __vsp_wpf_format=$5 + + shift 5 + + for option in $* ; do + case $option in + --rpfcrop=*) + rpfcrop=${option/--rpfcrop=/} + ;; + + --wpfcrop=*) + wpfcrop=${option/--wpfcrop=/} + ;; + *) + echo "format_rpf_wpf: Unrecognised arguments" + return 1 + ;; + esac + done - if [ x$crop != 'x' ] ; then - crop="crop:$crop" - outsize=$(echo $crop | sed 's/.*\///') + if [ x$rpfcrop != 'x' ] ; then + rpfcrop="crop:$rpfcrop" + rpfoutsize=$(echo $rpfcrop | sed 's/.*\///') else - outsize=$size + rpfoutsize=$size fi - $mediactl -d $mdev -V "'$dev rpf.$rpf':0 [fmt:$infmt/$size]" - $mediactl -d $mdev -V "'$dev wpf.$wpf':0 [fmt:$infmt/$size $crop]" - $mediactl -d $mdev -V "'$dev wpf.$wpf':1 [fmt:$outfmt/$outsize]" + if [ x$wpfcrop != 'x' ] ; then + wpfcrop="crop:$wpfcrop" + outsize=$(echo $wpfcrop | sed 's/.*\///') + else + outsize=$rpfoutsize + fi - __vsp_rpf_format=$3 - __vsp_wpf_format=$5 + $mediactl -d $mdev -V "'$dev rpf.$rpf':0 [fmt:$infmt/$size $rpfcrop]" + $mediactl -d $mdev -V "'$dev rpf.$rpf':1 [fmt:$infmt/$rpfoutsize]" + $mediactl -d $mdev -V "'$dev wpf.$wpf':0 [fmt:$infmt/$rpfoutsize $wpfcrop]" + $mediactl -d $mdev -V "'$dev wpf.$wpf':1 [fmt:$outfmt/$outsize]" } format_wpf() {