Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add NV12 to pixel formats #253

Merged
merged 1 commit into from
Dec 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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