Skip to content

Commit

Permalink
Add NV12 to color formats (#253)
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Schäper <[email protected]>
  • Loading branch information
lcschaeper authored Dec 23, 2024
1 parent c0c0bc5 commit 7f75faa
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions sensor_msgs/include/sensor_msgs/image_encodings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ const char YUYV[] = "yuyv";
const char YUV422_YUY2[] = "yuv422_yuy2"; // deprecated

// YUV 4:2:0 encodings with an 8-bit depth
// NV21: https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/pixfmt-yuv-planar.html#nv12-nv21-nv12m-and-nv21m
// NV12 & NV21: https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/pixfmt-yuv-planar.html#nv12-nv21-nv12m-and-nv21m
const char NV12[] = "nv12";
const char NV21[] = "nv21";

// YUV 4:4:4 encodings with 8-bit depth
Expand All @@ -126,7 +127,8 @@ static inline bool isColor(const std::string & encoding)
encoding == RGBA16 || encoding == BGRA16 ||
encoding == YUV422 || encoding == YUV422_YUY2 ||
encoding == UYVY || encoding == YUYV ||
encoding == NV21 || encoding == NV24;
encoding == NV12 || encoding == NV21 ||
encoding == NV24;
}

static inline bool isMono(const std::string & encoding)
Expand Down Expand Up @@ -193,6 +195,7 @@ static inline int numChannels(const std::string & encoding)
encoding == YUV422_YUY2 ||
encoding == UYVY ||
encoding == YUYV ||
encoding == NV12 ||
encoding == NV21 ||
encoding == NV24)
{
Expand Down Expand Up @@ -245,6 +248,7 @@ static inline int bitDepth(const std::string & encoding)
encoding == YUV422_YUY2 ||
encoding == UYVY ||
encoding == YUYV ||
encoding == NV12 ||
encoding == NV21 ||
encoding == NV24)
{
Expand Down

0 comments on commit 7f75faa

Please sign in to comment.