From patchwork Mon Feb 13 14:15:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 9569813 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 C70D160572 for ; Mon, 13 Feb 2017 14:15:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BAE83262F0 for ; Mon, 13 Feb 2017 14:15:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ADE4127B13; Mon, 13 Feb 2017 14:15:04 +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.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, 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 353F9262F0 for ; Mon, 13 Feb 2017 14:15:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753038AbdBMOPC (ORCPT ); Mon, 13 Feb 2017 09:15:02 -0500 Received: from galahad.ideasonboard.com ([185.26.127.97]:46510 "EHLO galahad.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753030AbdBMOPB (ORCPT ); Mon, 13 Feb 2017 09:15:01 -0500 Received: from avalon.bb.dnainternet.fi (dfj612ybrt5fhg77mgycy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:2e86:4862:ef6a:2804]) by galahad.ideasonboard.com (Postfix) with ESMTPSA id C9371200DF; Mon, 13 Feb 2017 15:14:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1486995252; bh=k2DZCbk5nCFjxfcRnPJhTVgSR/4TNKoGGfclPd0DEDA=; h=From:To:Cc:Subject:Date:From; b=bNQPD/lOMGT3Ua14DVdGhorMHOva6VtqQPeMbm/YmlXUv9r+Y2asUeSe+KcMF2OgW lOGQSlIdd5Zthf0qSPnRagtA67rAuPu4qW0RTFJLEzy880EiNrdfGP+qD69uPBb6ho Uqyfnrz9okZ77b8VX9OlC1BE4Xn79JqKR386ncr8= From: Laurent Pinchart To: linux-renesas-soc@vger.kernel.org Cc: kieran.bingham@ideasonboard.com Subject: [PATCH] scripts: bin2png: Support conversion of all files in a directory Date: Mon, 13 Feb 2017 16:15:22 +0200 Message-Id: <20170213141522.11545-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.10.2 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 When the first argument is a directory name instead of a file name, convert all test script output binaries in that directory. Signed-off-by: Laurent Pinchart --- scripts/bin2png.sh | 41 ++++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/scripts/bin2png.sh b/scripts/bin2png.sh index 2563e87d4187..90fdfb077715 100755 --- a/scripts/bin2png.sh +++ b/scripts/bin2png.sh @@ -1,25 +1,40 @@ #!/bin/sh -FILE="$1" +FILE=${1:-.} -PNM=${FILE/.bin/.pnm} -PNG=${FILE/.bin/.png} +convert_image() { + local file=$1 + local pnm=${file/%bin/pnm} + local png=${file/%bin/png} -fmt=$(echo $FILE | sed -e 's|.*-\([[:alnum:]]*\)-\([0-9]*x[0-9]*\).*.bin|\1|' | tr '[:lower:]' '[:upper:]') -size=$(echo $FILE | sed -e 's|.*-\([[:alnum:]]*\)-\([0-9]*x[0-9]*\).*.bin|\2|') + local format=$(echo $file | sed -e 's|.*-\([[:alnum:]]*\)-\([0-9]*x[0-9]*\).*.bin|\1|' | tr '[:lower:]' '[:upper:]') + local size=$(echo $file | sed -e 's|.*-\([[:alnum:]]*\)-\([0-9]*x[0-9]*\).*.bin|\2|') -case $fmt in + case $format in yuv*|yvu*) - fmt=$(echo $fmt | tr 'M' 'P') + format=$(echo $format | tr 'M' 'P') ;; nv*) - fmt=$(echo $fmt | tr -d 'M') + format=$(echo $format | tr -d 'M') ;; *rgb*) - fmt=$(echo $fmt | tr -d 'AX') + format=$(echo $format | tr -d 'AX') ;; -esac + esac -raw2rgbpnm -s $size -f $fmt $FILE $PNM && \ - convert $PNM $PNG -rm $PNM + raw2rgbpnm -f $format -s $size $file $pnm && \ + convert $pnm $png + rm $pnm +} + +if [ -d $FILE ] ; then + if [ $(ls $FILE/vsp-unit-test-00*-*frame*.bin 2>/dev/null | wc -l) != 0 ] ; then + for f in $FILE/vsp-unit-test-00*-*frame*.bin ; do + convert_image $f + done + fi +elif [ -f $FILE ] ; then + convert_image $FILE +else + echo "Usage: $0 " +fi