* [PATCH v2 0/4] vsp-tests: Implement RPF cropping tests
@ 2017-02-10 13:30 Kieran Bingham
2017-02-10 13:30 ` [PATCH v2 1/4] vsp-lib: Filter non-filesystem regular characters Kieran Bingham
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Kieran Bingham @ 2017-02-10 13:30 UTC (permalink / raw)
To: laurent.pinchart, linux-renesas-soc, kieran.bingham
From: Kieran Bingham <kieran.bingham@ideasonboard.com>
Update the gen-image utility such that it can crop the image at input,
and provide tests to ensure that the output of the RPF is as we expect.
v2:
- rebased on master branch
- review comments fixed
- vsp-unit-test-0021.sh description fixed
Kieran Bingham (4):
vsp-lib: Filter non-filesystem regular characters
gen-image: Implement option to parse an input crop
vsp-lib: Support RPF frame cropping
tests: Add RPF cropping test
scripts/vsp-lib.sh | 55 ++++++++++++---
src/gen-image.c | 132 +++++++++++++++++++++++++++++++++++++-
tests/vsp-unit-test-0021.sh | 36 ++++++++++-
3 files changed, 213 insertions(+), 10 deletions(-)
create mode 100755 tests/vsp-unit-test-0021.sh
base-commit: 8d7af82da291e16c770040c857f6d5cb43590df1
--
git-series 0.9.1
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH v2 1/4] vsp-lib: Filter non-filesystem regular characters 2017-02-10 13:30 [PATCH v2 0/4] vsp-tests: Implement RPF cropping tests Kieran Bingham @ 2017-02-10 13:30 ` Kieran Bingham 2017-02-12 21:05 ` Laurent Pinchart 2017-02-10 13:30 ` [PATCH v2 2/4] gen-image: Implement option to parse an input crop Kieran Bingham ` (2 subsequent siblings) 3 siblings, 1 reply; 8+ messages in thread From: Kieran Bingham @ 2017-02-10 13:30 UTC (permalink / raw) To: laurent.pinchart, linux-renesas-soc, kieran.bingham From: Kieran Bingham <kieran.bingham@ideasonboard.com> Parameters can contain characters not suited to use in filenames. Add '=','(', and ')' to the filtering, and replace with '_' This reduces extra escaping, and quoting when working with the output filenames of failed tests and VSP_KEEP_FRAMES=1 Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> --- scripts/vsp-lib.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/vsp-lib.sh b/scripts/vsp-lib.sh index 8f2755b57519..9e5e57b8c4ba 100755 --- a/scripts/vsp-lib.sh +++ b/scripts/vsp-lib.sh @@ -258,6 +258,9 @@ compare_frames() { local params=${args// /-} params=${params:+-$params} params=${params//\//_} + params=${params//=/_} + params=${params//(/_} + params=${params//)/_} params=$in_fmt-$out_fmt-$size$params if [ x$__vsp_pixel_perfect != xtrue ] ; then -- git-series 0.9.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2 1/4] vsp-lib: Filter non-filesystem regular characters 2017-02-10 13:30 ` [PATCH v2 1/4] vsp-lib: Filter non-filesystem regular characters Kieran Bingham @ 2017-02-12 21:05 ` Laurent Pinchart 0 siblings, 0 replies; 8+ messages in thread From: Laurent Pinchart @ 2017-02-12 21:05 UTC (permalink / raw) To: Kieran Bingham; +Cc: linux-renesas-soc, kieran.bingham Hi Kieran, Thank you for the patch. On Friday 10 Feb 2017 13:30:05 Kieran Bingham wrote: > From: Kieran Bingham <kieran.bingham@ideasonboard.com> > > Parameters can contain characters not suited to use in filenames. > > Add '=','(', and ')' to the filtering, and replace with '_' > > This reduces extra escaping, and quoting when working with the output > filenames of failed tests and VSP_KEEP_FRAMES=1 I agree that some characters can increase the difficulty of handling file names in scripts or on the command line by requiring escaping. I would prefer fixing the scripts, but I'll accept this patch on the ground that the information loss caused by replacing the =, ( and ) characters with _ will not adversely affect our tests. If that turns out not to be true anymore in the future I reserve the right to revert the patch and ask you to fix your scripts :-) > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > --- > scripts/vsp-lib.sh | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/scripts/vsp-lib.sh b/scripts/vsp-lib.sh > index 8f2755b57519..9e5e57b8c4ba 100755 > --- a/scripts/vsp-lib.sh > +++ b/scripts/vsp-lib.sh > @@ -258,6 +258,9 @@ compare_frames() { > local params=${args// /-} > params=${params:+-$params} > params=${params//\//_} > + params=${params//=/_} > + params=${params//(/_} > + params=${params//)/_} > params=$in_fmt-$out_fmt-$size$params > > if [ x$__vsp_pixel_perfect != xtrue ] ; then -- Regards, Laurent Pinchart ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 2/4] gen-image: Implement option to parse an input crop 2017-02-10 13:30 [PATCH v2 0/4] vsp-tests: Implement RPF cropping tests Kieran Bingham 2017-02-10 13:30 ` [PATCH v2 1/4] vsp-lib: Filter non-filesystem regular characters Kieran Bingham @ 2017-02-10 13:30 ` Kieran Bingham 2017-02-12 21:39 ` Laurent Pinchart 2017-02-10 13:30 ` [PATCH v2 3/4] vsp-lib: Support RPF frame cropping Kieran Bingham 2017-02-10 13:30 ` [PATCH v2 4/4] tests: Add RPF cropping test Kieran Bingham 3 siblings, 1 reply; 8+ messages in thread From: Kieran Bingham @ 2017-02-10 13:30 UTC (permalink / raw) To: laurent.pinchart, linux-renesas-soc, kieran.bingham From: Kieran Bingham <kieran.bingham@ideasonboard.com> Allow the user to specify an input crop in the form (X,Y)/WxH Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> --- src/gen-image.c | 132 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 132 insertions(+) diff --git a/src/gen-image.c b/src/gen-image.c index 31d42e0211db..088e8b26f648 100644 --- a/src/gen-image.c +++ b/src/gen-image.c @@ -95,6 +95,13 @@ struct format_info { struct format_yuv_info yuv; }; +struct image_rect { + int left; + int top; + unsigned int width; + unsigned int height; +}; + struct image { const struct format_info *format; unsigned int width; @@ -127,6 +134,8 @@ struct options { bool rotate; unsigned int compose; struct params params; + bool crop; + struct image_rect inputcrop; }; /* ----------------------------------------------------------------------------- @@ -1076,6 +1085,25 @@ static void image_flip(const struct image *input, struct image *output, } /* ----------------------------------------------------------------------------- + * Image Cropping + */ + +static void image_crop(const struct image *input, const struct image *output, + const struct image_rect *crop) +{ + unsigned int offset = (crop->top * input->width + crop->left) * 3; + const uint8_t *idata = input->data + offset; + uint8_t *odata = output->data; + unsigned int y; + + for (y = 0; y < output->height; ++y) { + memcpy(odata, idata, output->width * 3); + odata += output->width * 3; + idata += input->width * 3; + } +} + +/* ----------------------------------------------------------------------------- * Look Up Table */ @@ -1363,6 +1391,21 @@ static int process(const struct options *options) input = rgb; } + if (options->crop) { + struct image *cropped; + + cropped = image_new(input->format, options->inputcrop.width, + options->inputcrop.height); + if (!cropped) { + ret = -ENOMEM; + goto done; + } + + image_crop(input, cropped, &options->inputcrop); + image_delete(input); + input = cropped; + } + /* Scale */ if (options->output_width && options->output_height) { output_width = options->output_width; @@ -1596,6 +1639,7 @@ static void usage(const char *argv0) printf(" or percentages ([0%% - 100%%]). Defaults to 1.0\n"); printf("-c, --compose n Compose n copies of the image offset by (50,50) over a black background\n"); printf("-C, --no-chroma-average Disable chroma averaging for odd pixels on output\n"); + printf(" --crop (X,Y)/WxH Crop the input image\n"); printf("-e, --encoding enc Set the YCbCr encoding method. Valid values are\n"); printf(" BT.601, REC.709, BT.2020 and SMPTE240M\n"); printf("-f, --format format Set the output image format\n"); @@ -1628,11 +1672,13 @@ static void list_formats(void) #define OPT_HFLIP 256 #define OPT_VFLIP 257 +#define OPT_CROP 260 static struct option opts[] = { {"alpha", 1, 0, 'a'}, {"clu", 1, 0, 'L'}, {"compose", 1, 0, 'c'}, + {"crop", 1, 0, OPT_CROP}, {"encoding", 1, 0, 'e'}, {"format", 1, 0, 'f'}, {"help", 0, 0, 'h'}, @@ -1649,6 +1695,84 @@ static struct option opts[] = { {0, 0, 0, 0} }; +static int parse_crop(struct image_rect *crop, char *optarg, char **endp) +{ + /* (X,Y)/WxH */ + char *endptr = optarg; + + if (*endptr != '(') { + printf("Invalid crop argument\n"); + *endp = endptr; + return 1; + } + + crop->left = strtol(endptr + 1, &endptr, 10); + if (*endptr != ',') { + printf("Invalid crop position\n"); + *endp = endptr; + return 1; + } + + if (crop->left < 0) { + printf("Invalid negative crop\n"); + *endp = endptr - 1; + return 1; + } + + crop->top = strtol(endptr + 1, &endptr, 10); + if (*endptr != ')') { + printf("Invalid crop position\n"); + *endp = endptr; + return 1; + } + + if (crop->top < 0) { + printf("Invalid negative crop\n"); + *endp = endptr - 1; + return 1; + } + + endptr++; + + if (*endptr != '/') { + printf("Invalid crop argument\n"); + *endp = endptr; + return 1; + } + + crop->width = strtol(endptr + 1, &endptr, 10); + if (*endptr != 'x') { + printf("Invalid crop size\n"); + *endp = endptr; + return 1; + } + + crop->height = strtol(endptr + 1, &endptr, 10); + if (*endptr != 0) { + printf("Invalid crop size\n"); + *endp = endptr; + return 1; + } + + return 0; +} + +void print_streampos(const char *p, const char *end) +{ + int pos; + + pos = end - p + 1; + + if (pos < 0) + pos = 0; + if (pos > (int) strlen(p)) + pos = strlen(p); + + printf("\n"); + printf(" %s\n", p); + printf(" %*s\n", pos, "^"); +} + static int parse_args(struct options *options, int argc, char *argv[]) { char *endptr; @@ -1809,6 +1933,14 @@ static int parse_args(struct options *options, int argc, char *argv[]) options->vflip = true; break; + case OPT_CROP: + if (parse_crop(&options->inputcrop, optarg, &endptr)) { + print_streampos(optarg, endptr); + return 1; + } + options->crop = true; + break; + default: printf("Invalid option -%c\n", c); printf("Run %s -h for help.\n", argv[0]); -- git-series 0.9.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2 2/4] gen-image: Implement option to parse an input crop 2017-02-10 13:30 ` [PATCH v2 2/4] gen-image: Implement option to parse an input crop Kieran Bingham @ 2017-02-12 21:39 ` Laurent Pinchart 0 siblings, 0 replies; 8+ messages in thread From: Laurent Pinchart @ 2017-02-12 21:39 UTC (permalink / raw) To: Kieran Bingham; +Cc: linux-renesas-soc, kieran.bingham Hi Kieran, Thank you for the patch. On Friday 10 Feb 2017 13:30:06 Kieran Bingham wrote: > From: Kieran Bingham <kieran.bingham@ideasonboard.com> > > Allow the user to specify an input crop in the form (X,Y)/WxH > > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > --- > src/gen-image.c | 132 +++++++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 132 insertions(+) > > diff --git a/src/gen-image.c b/src/gen-image.c > index 31d42e0211db..088e8b26f648 100644 > --- a/src/gen-image.c > +++ b/src/gen-image.c > @@ -95,6 +95,13 @@ struct format_info { > struct format_yuv_info yuv; > }; > > +struct image_rect { > + int left; > + int top; > + unsigned int width; > + unsigned int height; > +}; > + > struct image { > const struct format_info *format; > unsigned int width; > @@ -127,6 +134,8 @@ struct options { > bool rotate; > unsigned int compose; > struct params params; > + bool crop; > + struct image_rect inputcrop; > }; > > /* ------------------------------------------------------------------------ > @@ -1076,6 +1085,25 @@ static void image_flip(const struct image *input, > struct image *output, } > > /* ------------------------------------------------------------------------ > + * Image Cropping > + */ > + > +static void image_crop(const struct image *input, const struct image > *output, > + const struct image_rect *crop) > +{ > + unsigned int offset = (crop->top * input->width + crop->left) * 3; > + const uint8_t *idata = input->data + offset; > + uint8_t *odata = output->data; > + unsigned int y; > + > + for (y = 0; y < output->height; ++y) { > + memcpy(odata, idata, output->width * 3); > + odata += output->width * 3; > + idata += input->width * 3; > + } > +} > + > +/* ------------------------------------------------------------------------ > * Look Up Table > */ > > @@ -1363,6 +1391,21 @@ static int process(const struct options *options) > input = rgb; > } > > + if (options->crop) { > + struct image *cropped; > + > + cropped = image_new(input->format, options->inputcrop.width, > + options->inputcrop.height); > + if (!cropped) { > + ret = -ENOMEM; > + goto done; > + } > + > + image_crop(input, cropped, &options->inputcrop); > + image_delete(input); > + input = cropped; > + } > + > /* Scale */ > if (options->output_width && options->output_height) { > output_width = options->output_width; > @@ -1596,6 +1639,7 @@ static void usage(const char *argv0) > printf(" or percentages ([0%% - 100%%]). Defaults to 1.0\n"); > printf("-c, --compose n Compose n copies of the image offset > by (50,50) over a black background\n"); > printf("-C, --no-chroma-average Disable chroma averaging for odd > pixels on output\n"); > + printf(" --crop (X,Y)/WxH Crop the input image\n"); The alignment is incorrect. > printf("-e, --encoding enc Set the YCbCr encoding method. Valid > values are\n"); > printf(" BT.601, REC.709, BT.2020 and > SMPTE240M\n"); > printf("-f, --format format Set the output image format\n"); > @@ -1628,11 +1672,13 @@ static void list_formats(void) > > #define OPT_HFLIP 256 > #define OPT_VFLIP 257 > +#define OPT_CROP 260 > > static struct option opts[] = { > {"alpha", 1, 0, 'a'}, > {"clu", 1, 0, 'L'}, > {"compose", 1, 0, 'c'}, > + {"crop", 1, 0, OPT_CROP}, > {"encoding", 1, 0, 'e'}, > {"format", 1, 0, 'f'}, > {"help", 0, 0, 'h'}, > @@ -1649,6 +1695,84 @@ static struct option opts[] = { > {0, 0, 0, 0} > }; > > +static int parse_crop(struct image_rect *crop, char *optarg, char **endp) The optarg argument should be made const. I would also rename it to value as it might not come from an option. > +{ > + /* (X,Y)/WxH */ > + char *endptr = optarg; > + > + if (*endptr != '(') { > + printf("Invalid crop argument\n"); How about "Invalid crop format, expected '('\n" to clearly indicate what's wrong ? > + *endp = endptr; > + return 1; > + } > + > + crop->left = strtol(endptr + 1, &endptr, 10); > + if (*endptr != ',') { > + printf("Invalid crop position\n"); > + *endp = endptr; > + return 1; > + } > + > + if (crop->left < 0) { > + printf("Invalid negative crop\n"); > + *endp = endptr - 1; > + return 1; > + } > + > + crop->top = strtol(endptr + 1, &endptr, 10); > + if (*endptr != ')') { > + printf("Invalid crop position\n"); > + *endp = endptr; > + return 1; > + } > + > + if (crop->top < 0) { > + printf("Invalid negative crop\n"); > + *endp = endptr - 1; > + return 1; > + } > + > + endptr++; > + > + if (*endptr != '/') { > + printf("Invalid crop argument\n"); > + *endp = endptr; > + return 1; > + } > + > + crop->width = strtol(endptr + 1, &endptr, 10); > + if (*endptr != 'x') { > + printf("Invalid crop size\n"); > + *endp = endptr; > + return 1; > + } > + > + crop->height = strtol(endptr + 1, &endptr, 10); > + if (*endptr != 0) { > + printf("Invalid crop size\n"); > + *endp = endptr; > + return 1; > + } > + > + return 0; > +} > + > +void print_streampos(const char *p, const char *end) This function should be static. I would rename it to parser_print_error(), "streampos" not being very explicit. > +{ > + int pos; > + > + pos = end - p + 1; > + > + if (pos < 0) > + pos = 0; > + if (pos > (int) strlen(p)) > + pos = strlen(p); > + > + printf("\n"); > + printf(" %s\n", p); > + printf(" %*s\n", pos, "^"); > +} > + > static int parse_args(struct options *options, int argc, char *argv[]) > { > char *endptr; > @@ -1809,6 +1933,14 @@ static int parse_args(struct options *options, int > argc, char *argv[]) options->vflip = true; > break; > > + case OPT_CROP: > + if (parse_crop(&options->inputcrop, optarg, &endptr)) { > + print_streampos(optarg, endptr); I would move this inside parse_crop(). I'll fix while applying, no need to resend. > + return 1; > + } > + options->crop = true; > + break; > + > default: > printf("Invalid option -%c\n", c); > printf("Run %s -h for help.\n", argv[0]); -- Regards, Laurent Pinchart ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 3/4] vsp-lib: Support RPF frame cropping 2017-02-10 13:30 [PATCH v2 0/4] vsp-tests: Implement RPF cropping tests Kieran Bingham 2017-02-10 13:30 ` [PATCH v2 1/4] vsp-lib: Filter non-filesystem regular characters Kieran Bingham 2017-02-10 13:30 ` [PATCH v2 2/4] gen-image: Implement option to parse an input crop Kieran Bingham @ 2017-02-10 13:30 ` Kieran Bingham 2017-02-12 21:46 ` Laurent Pinchart 2017-02-10 13:30 ` [PATCH v2 4/4] tests: Add RPF cropping test Kieran Bingham 3 siblings, 1 reply; 8+ messages in thread From: Kieran Bingham @ 2017-02-10 13:30 UTC (permalink / raw) To: laurent.pinchart, linux-renesas-soc, kieran.bingham From: Kieran Bingham <kieran.bingham@ideasonboard.com> Pass the optional '--crop (X,Y)/WxH' parameter through reference_frame allowing the input to be cropped for comparison Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> --- 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() { -- git-series 0.9.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2 3/4] vsp-lib: Support RPF frame cropping 2017-02-10 13:30 ` [PATCH v2 3/4] vsp-lib: Support RPF frame cropping Kieran Bingham @ 2017-02-12 21:46 ` Laurent Pinchart 0 siblings, 0 replies; 8+ messages in thread From: Laurent Pinchart @ 2017-02-12 21:46 UTC (permalink / raw) To: Kieran Bingham; +Cc: linux-renesas-soc, kieran.bingham Hi Kieran, Thank you for the patch. On Friday 10 Feb 2017 13:30:07 Kieran Bingham wrote: > From: Kieran Bingham <kieran.bingham@ideasonboard.com> > > Pass the optional '--crop (X,Y)/WxH' parameter through reference_frame > allowing the input to be cropped for comparison > > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > --- > 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" Let's also print the argument value to ease debugging. > + 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() { -- Regards, Laurent Pinchart ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 4/4] tests: Add RPF cropping test 2017-02-10 13:30 [PATCH v2 0/4] vsp-tests: Implement RPF cropping tests Kieran Bingham ` (2 preceding siblings ...) 2017-02-10 13:30 ` [PATCH v2 3/4] vsp-lib: Support RPF frame cropping Kieran Bingham @ 2017-02-10 13:30 ` Kieran Bingham 3 siblings, 0 replies; 8+ messages in thread From: Kieran Bingham @ 2017-02-10 13:30 UTC (permalink / raw) To: laurent.pinchart, linux-renesas-soc, kieran.bingham From: Kieran Bingham <kieran.bingham@ideasonboard.com> Test both the input cropping size and position Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> --- tests/vsp-unit-test-0021.sh | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 tests/vsp-unit-test-0021.sh diff --git a/tests/vsp-unit-test-0021.sh b/tests/vsp-unit-test-0021.sh new file mode 100755 index 000000000000..9d692cfc6194 --- /dev/null +++ b/tests/vsp-unit-test-0021.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +# +# Test RPF crop using RGB. Use a RPF -> WPF pipeline, passing a selection of +# cropping windows. +# + +source vsp-lib.sh + +features="rpf.0 wpf.0" +crops="(0,0)/512x384 (32,32)/512x384 (32,64)/512x384 (64,32)/512x384" + +test_rpf_cropping() { + test_start "RPF crop from $crop" + + pipe_configure rpf-wpf 0 0 + format_configure rpf-wpf 0 0 RGB24 1024x768 ARGB32 --rpfcrop=$crop + + vsp_runner rpf.0 & + vsp_runner wpf.0 + + local result=$(compare_frames crop=${crop}) + + test_complete $result +} + +test_main() { + local crop + + for crop in $crops ; do + test_rpf_cropping $crop + done +} + +test_init $0 "$features" +test_run -- git-series 0.9.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-02-12 21:46 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-02-10 13:30 [PATCH v2 0/4] vsp-tests: Implement RPF cropping tests Kieran Bingham 2017-02-10 13:30 ` [PATCH v2 1/4] vsp-lib: Filter non-filesystem regular characters Kieran Bingham 2017-02-12 21:05 ` Laurent Pinchart 2017-02-10 13:30 ` [PATCH v2 2/4] gen-image: Implement option to parse an input crop Kieran Bingham 2017-02-12 21:39 ` Laurent Pinchart 2017-02-10 13:30 ` [PATCH v2 3/4] vsp-lib: Support RPF frame cropping Kieran Bingham 2017-02-12 21:46 ` Laurent Pinchart 2017-02-10 13:30 ` [PATCH v2 4/4] tests: Add RPF cropping test Kieran Bingham
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.