This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree:

Subject: v4l2-ctl: add HSV encoding support
Author:  Hans Verkuil <hans.verk...@cisco.com>
Date:    Sat Aug 11 11:41:10 2018 +0200

While the V4L2 API supported HSV encodings, they could not be set
via the v4l2-ctl utility. Add support for this.

Signed-off-by: Hans Verkuil <hans.verk...@cisco.com>

 utils/v4l2-ctl/v4l2-ctl-subdev.cpp | 13 ++++++++++---
 utils/v4l2-ctl/v4l2-ctl-vidcap.cpp |  5 ++++-
 utils/v4l2-ctl/v4l2-ctl-vidout.cpp |  5 ++++-
 utils/v4l2-ctl/v4l2-ctl.cpp        | 21 +++++++++++++++++----
 utils/v4l2-ctl/v4l2-ctl.h          |  1 +
 5 files changed, 36 insertions(+), 9 deletions(-)

---

http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=2b8c21241ce1bb42f2cd95456e7cdff08d58db2f
diff --git a/utils/v4l2-ctl/v4l2-ctl-subdev.cpp 
b/utils/v4l2-ctl/v4l2-ctl-subdev.cpp
index 3ce59aa7124d..3d39ccbbe6d3 100644
--- a/utils/v4l2-ctl/v4l2-ctl-subdev.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-subdev.cpp
@@ -72,7 +72,7 @@ void subdev_usage(void)
               "                     query the frame rate 
[VIDIOC_SUBDEV_G_FRAME_INTERVAL]\n"
               "  --set-subdev-fmt   (for testing only, otherwise use 
media-ctl)\n"
               "  --try-subdev-fmt 
pad=<pad>,width=<w>,height=<h>,code=<code>,field=<f>,colorspace=<c>,\n"
-              "                   xfer=<xf>,ycbcr=<y>,quantization=<q>\n"
+              "                   
xfer=<xf>,ycbcr=<y>,hsv=<hsv>,quantization=<q>\n"
               "                     set the frame format 
[VIDIOC_SUBDEV_S_FMT]\n"
               "                     <code> is the value of the mediabus code\n"
               "                     <f> can be one of the following field 
layouts:\n"
@@ -85,6 +85,8 @@ void subdev_usage(void)
               "                       default, 709, srgb, adobergb, smpte240m, 
smpte2084, dcip3, none\n"
               "                     <y> can be one of the following Y'CbCr 
encodings:\n"
               "                       default, 601, 709, xv601, xv709, bt2020, 
bt2020c, smpte240m\n"
+              "                     <hsv> can be one of the following HSV 
encodings:\n"
+              "                       default, 180, 256\n"
               "                     <q> can be one of the following 
quantization methods:\n"
               "                       default, full-range, lim-range\n"
               "  --set-subdev-selection (for testing only, otherwise use 
media-ctl)\n"
@@ -208,6 +210,7 @@ void subdev_cmd(int ch, char *optarg)
                                "field",
                                "colorspace",
                                "ycbcr",
+                               "hsv",
                                "quantization",
                                "xfer",
                                "pad",
@@ -243,14 +246,18 @@ void subdev_cmd(int ch, char *optarg)
                                set_fmt |= FmtYCbCr;
                                break;
                        case 6:
+                               ffmt.ycbcr_enc = parse_hsv(value);
+                               set_fmt |= FmtYCbCr;
+                               break;
+                       case 7:
                                ffmt.quantization = parse_quantization(value);
                                set_fmt |= FmtQuantization;
                                break;
-                       case 7:
+                       case 8:
                                ffmt.xfer_func = parse_xfer_func(value);
                                set_fmt |= FmtXferFunc;
                                break;
-                       case 8:
+                       case 9:
                                set_fmt_pad = strtoul(value, 0L, 0);
                                break;
                        default:
diff --git a/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp 
b/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp
index 27ef25199625..21a59f69ce83 100644
--- a/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp
@@ -41,7 +41,8 @@ void vidcap_usage(void)
               "                     query the video capture format 
[VIDIOC_G_FMT]\n"
               "  -v, --set-fmt-video\n"
               "  --try-fmt-video 
width=<w>,height=<h>,pixelformat=<pf>,field=<f>,colorspace=<c>,\n"
-              "                  
xfer=<xf>,ycbcr=<y>,quantization=<q>,premul-alpha,bytesperline=<bpl>\n"
+              "                  
xfer=<xf>,ycbcr=<y>,hsv=<hsv>,quantization=<q>,\n"
+              "                  premul-alpha,bytesperline=<bpl>\n"
               "                     set/try the video capture format 
[VIDIOC_S/TRY_FMT]\n"
               "                     pixelformat is either the format index as 
reported by\n"
               "                       --list-formats, or the fourcc value as a 
string.\n"
@@ -57,6 +58,8 @@ void vidcap_usage(void)
               "                       default, 709, srgb, adobergb, smpte240m, 
smpte2084, dcip3, none\n"
               "                     <y> can be one of the following Y'CbCr 
encodings:\n"
               "                       default, 601, 709, xv601, xv709, bt2020, 
bt2020c, smpte240m\n"
+              "                     <hsv> can be one of the following HSV 
encodings:\n"
+              "                       default, 180, 256\n"
               "                     <q> can be one of the following 
quantization methods:\n"
               "                       default, full-range, lim-range\n"
               );
diff --git a/utils/v4l2-ctl/v4l2-ctl-vidout.cpp 
b/utils/v4l2-ctl/v4l2-ctl-vidout.cpp
index 927afbb19952..2827e00dbdaf 100644
--- a/utils/v4l2-ctl/v4l2-ctl-vidout.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-vidout.cpp
@@ -32,7 +32,8 @@ void vidout_usage(void)
               "                     query the video output format 
[VIDIOC_G_FMT]\n"
               "  -x, --set-fmt-video-out\n"
               "  --try-fmt-video-out 
width=<w>,height=<h>,pixelformat=<pf>,field=<f>,colorspace=<c>,\n"
-              "                      
xfer=<xf>,ycbcr=<y>,quantization=<q>,premul-alpha,bytesperline=<bpl>\n"
+              "                      
xfer=<xf>,ycbcr=<y>,hsv=<hsv>,quantization=<q>,\n"
+              "                      premul-alpha,bytesperline=<bpl>\n"
               "                     set/try the video output format 
[VIDIOC_S/TRY_FMT]\n"
               "                     pixelformat is either the format index as 
reported by\n"
               "                       --list-formats-out, or the fourcc value 
as a string.\n"
@@ -48,6 +49,8 @@ void vidout_usage(void)
               "                       default, 709, srgb, adobergb, smpte240m, 
smpte2084, dcip3, none\n"
               "                     <y> can be one of the following Y'CbCr 
encodings:\n"
               "                       default, 601, 709, xv601, xv709, bt2020, 
bt2020c, smpte240m\n"
+              "                     <hsv> can be one of the following HSV 
encodings:\n"
+              "                       default, 180, 256\n"
               "                     <q> can be one of the following 
quantization methods:\n"
               "                       default, full-range, lim-range\n"
               );
diff --git a/utils/v4l2-ctl/v4l2-ctl.cpp b/utils/v4l2-ctl/v4l2-ctl.cpp
index e0a81a5298ca..4798330d2620 100644
--- a/utils/v4l2-ctl/v4l2-ctl.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl.cpp
@@ -432,7 +432,7 @@ void printfmt(int fd, const struct v4l2_format &vfmt)
                printf("\tFlags             : %s\n", 
pixflags2s(vfmt.fmt.pix_mp.flags).c_str());
                printf("\tColorspace        : %s\n", 
colorspace2s(vfmt.fmt.pix_mp.colorspace).c_str());
                printf("\tTransfer Function : %s\n", 
xfer_func2s(vfmt.fmt.pix_mp.xfer_func).c_str());
-               printf("\tYCbCr Encoding    : %s\n", 
ycbcr_enc2s(vfmt.fmt.pix_mp.ycbcr_enc).c_str());
+               printf("\tYCbCr/HSV Encoding: %s\n", 
ycbcr_enc2s(vfmt.fmt.pix_mp.ycbcr_enc).c_str());
                printf("\tQuantization      : %s\n", 
quantization2s(vfmt.fmt.pix_mp.quantization).c_str());
                for (int i = 0; i < vfmt.fmt.pix_mp.num_planes && i < 
VIDEO_MAX_PLANES; i++) {
                        printf("\tPlane %d           :\n", i);
@@ -703,6 +703,14 @@ __u32 parse_ycbcr(const char *s)
        return V4L2_YCBCR_ENC_DEFAULT;
 }
 
+__u32 parse_hsv(const char *s)
+{
+       if (!strcmp(s, "default")) return V4L2_YCBCR_ENC_DEFAULT;
+       if (!strcmp(s, "180")) return V4L2_HSV_ENC_180;
+       if (!strcmp(s, "256")) return V4L2_HSV_ENC_256;
+       return V4L2_YCBCR_ENC_DEFAULT;
+}
+
 __u32 parse_quantization(const char *s)
 {
        if (!strcmp(s, "default")) return V4L2_QUANTIZATION_DEFAULT;
@@ -731,6 +739,7 @@ int parse_fmt(char *optarg, __u32 &width, __u32 &height, 
__u32 &pixelformat,
                        "field",
                        "colorspace",
                        "ycbcr",
+                       "hsv",
                        "bytesperline",
                        "premul-alpha",
                        "quantization",
@@ -778,6 +787,10 @@ int parse_fmt(char *optarg, __u32 &width, __u32 &height, 
__u32 &pixelformat,
                        fmts |= FmtYCbCr;
                        break;
                case 6:
+                       ycbcr = parse_hsv(value);
+                       fmts |= FmtYCbCr;
+                       break;
+               case 7:
                        bytesperline[bpl_index] = strtoul(value, 0L, 0);
                        if (bytesperline[bpl_index] > 0xffff) {
                                fprintf(stderr, "bytesperline can't be more 
than 65535\n");
@@ -786,15 +799,15 @@ int parse_fmt(char *optarg, __u32 &width, __u32 &height, 
__u32 &pixelformat,
                        bpl_index++;
                        fmts |= FmtBytesPerLine;
                        break;
-               case 7:
+               case 8:
                        flags |= V4L2_PIX_FMT_FLAG_PREMUL_ALPHA;
                        fmts |= FmtFlags;
                        break;
-               case 8:
+               case 9:
                        quantization = parse_quantization(value);
                        fmts |= FmtQuantization;
                        break;
-               case 9:
+               case 10:
                        xfer_func = parse_xfer_func(value);
                        fmts |= FmtXferFunc;
                        break;
diff --git a/utils/v4l2-ctl/v4l2-ctl.h b/utils/v4l2-ctl/v4l2-ctl.h
index e4214e784576..60f17082386e 100644
--- a/utils/v4l2-ctl/v4l2-ctl.h
+++ b/utils/v4l2-ctl/v4l2-ctl.h
@@ -294,6 +294,7 @@ __u32 parse_field(const char *s);
 __u32 parse_colorspace(const char *s);
 __u32 parse_xfer_func(const char *s);
 __u32 parse_ycbcr(const char *s);
+__u32 parse_hsv(const char *s);
 __u32 parse_quantization(const char *s);
 int parse_fmt(char *optarg, __u32 &width, __u32 &height, __u32 &pixelformat,
              __u32 &field, __u32 &colorspace, __u32 &xfer, __u32 &ycbcr,

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to