* [PATCH] scripts: bin2png: Support conversion of all files in a directory
@ 2017-02-13 14:15 Laurent Pinchart
2017-02-22 15:52 ` [PATCH 1/1] scripts: bin2png.sh: Fix POSIX shell compliance Kieran Bingham
0 siblings, 1 reply; 3+ messages in thread
From: Laurent Pinchart @ 2017-02-13 14:15 UTC (permalink / raw)
To: linux-renesas-soc; +Cc: kieran.bingham
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 <laurent.pinchart@ideasonboard.com>
---
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 <file or directory>"
+fi
--
Regards,
Laurent Pinchart
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 1/1] scripts: bin2png.sh: Fix POSIX shell compliance
2017-02-13 14:15 [PATCH] scripts: bin2png: Support conversion of all files in a directory Laurent Pinchart
@ 2017-02-22 15:52 ` Kieran Bingham
2017-02-22 17:38 ` Laurent Pinchart
0 siblings, 1 reply; 3+ messages in thread
From: Kieran Bingham @ 2017-02-22 15:52 UTC (permalink / raw)
To: laurent.pinchart, linux-renesas-soc, kieran.bingham
From: Kieran Bingham <kieran.bingham@ideasonboard.com>
The string manipulations of the form ${VAR/search/replace} are not posix
compliant. Use string deletion, and append instead.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
scripts/bin2png.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/bin2png.sh b/scripts/bin2png.sh
index 090f31fa992d..6422ee51bc33 100755
--- a/scripts/bin2png.sh
+++ b/scripts/bin2png.sh
@@ -4,8 +4,8 @@ FILE=${1:-.}
convert_image() {
local file=$1
- local pnm=${file/%bin/pnm}
- local png=${file/%bin/png}
+ local pnm=${file%bin}pnm
+ local png=${file%bin}png
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|')
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] scripts: bin2png.sh: Fix POSIX shell compliance
2017-02-22 15:52 ` [PATCH 1/1] scripts: bin2png.sh: Fix POSIX shell compliance Kieran Bingham
@ 2017-02-22 17:38 ` Laurent Pinchart
0 siblings, 0 replies; 3+ messages in thread
From: Laurent Pinchart @ 2017-02-22 17:38 UTC (permalink / raw)
To: Kieran Bingham; +Cc: linux-renesas-soc, kieran.bingham
Hi Kieran,
Thank you for the patch.
On Wednesday 22 Feb 2017 15:52:43 Kieran Bingham wrote:
> From: Kieran Bingham <kieran.bingham@ideasonboard.com>
>
> The string manipulations of the form ${VAR/search/replace} are not posix
> compliant. Use string deletion, and append instead.
>
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by, applied and pushed.
> ---
> scripts/bin2png.sh | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/bin2png.sh b/scripts/bin2png.sh
> index 090f31fa992d..6422ee51bc33 100755
> --- a/scripts/bin2png.sh
> +++ b/scripts/bin2png.sh
> @@ -4,8 +4,8 @@ FILE=${1:-.}
>
> convert_image() {
> local file=$1
> - local pnm=${file/%bin/pnm}
> - local png=${file/%bin/png}
> + local pnm=${file%bin}pnm
> + local png=${file%bin}png
>
> 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|')
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-02-22 17:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-13 14:15 [PATCH] scripts: bin2png: Support conversion of all files in a directory Laurent Pinchart
2017-02-22 15:52 ` [PATCH 1/1] scripts: bin2png.sh: Fix POSIX shell compliance Kieran Bingham
2017-02-22 17:38 ` Laurent Pinchart
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.