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: v4l-utils: Add is_compressed_format helper to centralize compressed 
format checks
Author:  Dikshita Agarwal <[email protected]>
Date:    Thu Sep 18 16:02:35 2025 +0530

Both v4l2-ctl and v4l2-compliance require logic to determine if a given
v4l2_fmtdesc describes a compressed format, excluding internal
vendor-specific formats such as V4L2_PIX_FMT_QC08C and V4L2_PIX_FMT_QC10C.

Centralizing this check makes it easier to maintain and extend as more
such formats are identified in the future.

Signed-off-by: Dikshita Agarwal <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>

 utils/common/v4l2-info.cpp                | 13 +++++++++++++
 utils/common/v4l2-info.h                  |  3 +++
 utils/v4l2-compliance/v4l2-compliance.cpp | 12 ++----------
 utils/v4l2-ctl/v4l2-ctl-streaming.cpp     |  4 ++--
 4 files changed, 20 insertions(+), 12 deletions(-)

---

http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=b37bf873d31cc0eae2e33f1f41d3795b341f1395
diff --git a/utils/common/v4l2-info.cpp b/utils/common/v4l2-info.cpp
index 02dfd6da0248..c9ad1ba06d0b 100644
--- a/utils/common/v4l2-info.cpp
+++ b/utils/common/v4l2-info.cpp
@@ -892,3 +892,16 @@ std::string subdevclientcap2s(__u64 cap)
                s += "interval-uses-which ";
        return s;
 }
+
+bool is_codec_format(const v4l2_fmtdesc& fmt_desc) {
+    if (!(fmt_desc.flags & V4L2_FMT_FLAG_COMPRESSED))
+        return false;
+
+    switch (fmt_desc.pixelformat) {
+        case V4L2_PIX_FMT_QC08C:
+        case V4L2_PIX_FMT_QC10C:
+            return false;
+        default:
+            return true;
+    }
+}
diff --git a/utils/common/v4l2-info.h b/utils/common/v4l2-info.h
index ac227971b709..34e8f11e8e52 100644
--- a/utils/common/v4l2-info.h
+++ b/utils/common/v4l2-info.h
@@ -161,4 +161,7 @@ std::string modulation2s(unsigned modulation);
 /* Return subdev client capabilities description */
 std::string subdevclientcap2s(__u64 cap);
 
+/* Return whether a color format is compressed or not */
+bool is_codec_format(const v4l2_fmtdesc &fmt_desc);
+
 #endif
diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp 
b/utils/v4l2-compliance/v4l2-compliance.cpp
index 39b5e14c2201..b82d7dad3269 100644
--- a/utils/v4l2-compliance/v4l2-compliance.cpp
+++ b/utils/v4l2-compliance/v4l2-compliance.cpp
@@ -525,7 +525,7 @@ static void determine_codec_mask(struct node &node)
                return;
 
        do {
-               if (fmt_desc.flags & V4L2_FMT_FLAG_COMPRESSED) {
+               if (is_codec_format(fmt_desc)) {
                        num_compressed_cap_fmts++;
                        switch (fmt_desc.pixelformat) {
                        case V4L2_PIX_FMT_JPEG:
@@ -553,10 +553,6 @@ static void determine_codec_mask(struct node &node)
                                mask |= STATELESS_ENCODER;
                                break;
 #endif
-                       case V4L2_PIX_FMT_QC08C:
-                       case V4L2_PIX_FMT_QC10C:
-                               num_compressed_cap_fmts--;
-                               break;
                        default:
                                return;
                        }
@@ -569,7 +565,7 @@ static void determine_codec_mask(struct node &node)
                return;
 
        do {
-               if (fmt_desc.flags & V4L2_FMT_FLAG_COMPRESSED) {
+               if (is_codec_format(fmt_desc)) {
                        num_compressed_out_fmts++;
                        switch (fmt_desc.pixelformat) {
                        case V4L2_PIX_FMT_JPEG:
@@ -601,10 +597,6 @@ static void determine_codec_mask(struct node &node)
                        case V4L2_PIX_FMT_FWHT_STATELESS:
                                mask |= STATELESS_DECODER;
                                break;
-                       case V4L2_PIX_FMT_QC08C:
-                       case V4L2_PIX_FMT_QC10C:
-                               num_compressed_out_fmts--;
-                               break;
                        default:
                                return;
                        }
diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp 
b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
index a565628d3b73..ec85e41e9e12 100644
--- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
@@ -427,7 +427,7 @@ static void get_codec_type(cv4l_fd &fd)
                return;
 
        do {
-               if (fmt_desc.flags & V4L2_FMT_FLAG_COMPRESSED)
+               if (is_codec_format(fmt_desc))
                        num_compressed_cap_fmts++;
                num_cap_fmts++;
        } while (!fd.enum_fmt(fmt_desc));
@@ -437,7 +437,7 @@ static void get_codec_type(cv4l_fd &fd)
                return;
 
        do {
-               if (fmt_desc.flags & V4L2_FMT_FLAG_COMPRESSED)
+               if (is_codec_format(fmt_desc))
                        num_compressed_out_fmts++;
                num_out_fmts++;
        } while (!fd.enum_fmt(fmt_desc));

Reply via email to