From 168934a257771070dbcef9d43fd199193cd68535 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Tue, 8 Jul 2014 09:39:11 +0200 Subject: [PATCH] v4l2-ctl: add support for generating limited range RGB The test pattern generator also supports limited range RGB. Add an option to select this. Signed-off-by: Hans Verkuil --- utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 14 ++++++++++---- utils/v4l2-ctl/v4l2-ctl.cpp | 1 + utils/v4l2-ctl/v4l2-ctl.h | 1 + 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp index f1c84f6..2112573 100644 --- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp @@ -33,6 +33,7 @@ static int stream_out_pixel_aspect = -1; static tpg_video_aspect stream_out_video_aspect; static u8 stream_out_alpha; static bool stream_out_alpha_red_only; +static bool stream_out_rgb_lim_range; static unsigned stream_out_perc_fill = 100; static v4l2_std_id stream_out_std; static bool stream_out_refresh; @@ -93,17 +94,17 @@ void streaming_usage(void) " --stream-out-eav insert an EAV code in every line.\n" " --stream-out-pixel-aspect= can be one of:\n" - " square, ntsc, pal\n" + " can be one of: square, ntsc, pal\n" " --stream-out-video-aspect= can be one of:\n" - " 4x3, 16x9, anamorphic\n" + " can be one of: 4x3, 16x9, anamorphic\n" " --stream-out-alpha=\n" " value to use for the alpha component, range 0-255. The default is 0.\n" " --stream-out-alpha-red-only\n" " only use the --stream-out-alpha value for the red colors,\n" " for all others use 0.\n" + " --stream-out-rgb-lim-range\n" + " Encode RGB values as limited [16-235] instead of full range.\n" " --stream-out-hor-speed=\n" " choose speed for horizontal movement. The default is 0,\n" " and the range is [-3...3].\n" @@ -330,6 +331,9 @@ void streaming_cmd(int ch, char *optarg) case OptStreamOutAlphaRedOnly: stream_out_alpha_red_only = true; break; + case OptStreamOutRGBLimitedRange: + stream_out_rgb_lim_range = true; + break; case OptStreamOutHorSpeed: case OptStreamOutVertSpeed: speed = strtol(optarg, 0L, 0); @@ -649,6 +653,8 @@ static int do_setup_out_buffers(int fd, buffers &b, FILE *fin, bool qbuf) tpg_s_insert_sav(&tpg, stream_out_sav); tpg_s_insert_eav(&tpg, stream_out_eav); tpg_s_perc_fill(&tpg, stream_out_perc_fill); + if (stream_out_rgb_lim_range) + tpg_s_real_rgb_range(&tpg, V4L2_DV_RGB_RANGE_LIMITED); tpg_s_alpha_component(&tpg, stream_out_alpha); tpg_s_alpha_mode(&tpg, stream_out_alpha_red_only); tpg_s_video_aspect(&tpg, stream_out_video_aspect); diff --git a/utils/v4l2-ctl/v4l2-ctl.cpp b/utils/v4l2-ctl/v4l2-ctl.cpp index 894d3d0..ac38d0e 100644 --- a/utils/v4l2-ctl/v4l2-ctl.cpp +++ b/utils/v4l2-ctl/v4l2-ctl.cpp @@ -221,6 +221,7 @@ static struct option long_options[] = { {"stream-out-video-aspect", required_argument, 0, OptStreamOutVideoAspect}, {"stream-out-alpha", required_argument, 0, OptStreamOutAlphaComponent}, {"stream-out-alpha-red-only", no_argument, 0, OptStreamOutAlphaRedOnly}, + {"stream-out-rgb-lim-range", required_argument, 0, OptStreamOutRGBLimitedRange}, {"stream-out-hor-speed", required_argument, 0, OptStreamOutHorSpeed}, {"stream-out-vert-speed", required_argument, 0, OptStreamOutVertSpeed}, {"stream-out-perc-fill", required_argument, 0, OptStreamOutPercFill}, diff --git a/utils/v4l2-ctl/v4l2-ctl.h b/utils/v4l2-ctl/v4l2-ctl.h index bc68a28..344bf60 100644 --- a/utils/v4l2-ctl/v4l2-ctl.h +++ b/utils/v4l2-ctl/v4l2-ctl.h @@ -178,6 +178,7 @@ enum Option { OptStreamOutPercFill, OptStreamOutAlphaComponent, OptStreamOutAlphaRedOnly, + OptStreamOutRGBLimitedRange, OptStreamOutPixelAspect, OptStreamOutVideoAspect, OptStreamOutMmap, -- 2.7.4