From 59b77941726d6a31ab276794dfde6c39e7027c91 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 24 Apr 2020 17:48:42 +0100 Subject: [PATCH] xrt: Rename XRT_FORMAT_YUV422 to XRT_FORMAT_YUYV422 --- src/xrt/auxiliary/tracking/t_calibration.cpp | 2 +- .../auxiliary/tracking/t_debug_hsv_picker.cpp | 2 +- src/xrt/auxiliary/tracking/t_hsv_filter.c | 2 +- src/xrt/auxiliary/util/u_format.c | 10 +++--- src/xrt/auxiliary/util/u_sink_converter.c | 32 +++++++++---------- src/xrt/drivers/v4l2/v4l2_driver.c | 2 +- src/xrt/include/xrt/xrt_defines.h | 2 +- 7 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/xrt/auxiliary/tracking/t_calibration.cpp b/src/xrt/auxiliary/tracking/t_calibration.cpp index 8404a02ec..4ee48f060 100644 --- a/src/xrt/auxiliary/tracking/t_calibration.cpp +++ b/src/xrt/auxiliary/tracking/t_calibration.cpp @@ -1183,7 +1183,7 @@ t_calibration_frame(struct xrt_frame_sink *xsink, struct xrt_frame *xf) // Fill both c.gui.rgb and c.gray with the data we got. switch (xf->format) { case XRT_FORMAT_YUV888: process_frame_yuv(c, xf); break; - case XRT_FORMAT_YUV422: process_frame_yuyv(c, xf); break; + case XRT_FORMAT_YUYV422: process_frame_yuyv(c, xf); break; case XRT_FORMAT_L8: process_frame_l8(c, xf); break; default: P("ERROR: Bad format '%s'", u_format_str(xf->format)); diff --git a/src/xrt/auxiliary/tracking/t_debug_hsv_picker.cpp b/src/xrt/auxiliary/tracking/t_debug_hsv_picker.cpp index e62de88ef..432050468 100644 --- a/src/xrt/auxiliary/tracking/t_debug_hsv_picker.cpp +++ b/src/xrt/auxiliary/tracking/t_debug_hsv_picker.cpp @@ -134,7 +134,7 @@ process_frame(class DebugHSVPicker &d, struct xrt_frame *xf) switch (xf->format) { case XRT_FORMAT_YUV888: process_frame_yuv(d, xf); break; - case XRT_FORMAT_YUV422: process_frame_yuyv(d, xf); break; + case XRT_FORMAT_YUYV422: process_frame_yuyv(d, xf); break; default: fprintf(stderr, "ERROR: Bad format '%s'", u_format_str(xf->format)); diff --git a/src/xrt/auxiliary/tracking/t_hsv_filter.c b/src/xrt/auxiliary/tracking/t_hsv_filter.c index 8b3358eca..2175091e8 100644 --- a/src/xrt/auxiliary/tracking/t_hsv_filter.c +++ b/src/xrt/auxiliary/tracking/t_hsv_filter.c @@ -297,7 +297,7 @@ push_frame(struct xrt_frame_sink *xsink, struct xrt_frame *xf) ensure_buf_allocated(f, xf); process_frame_yuv(f, xf); break; - case XRT_FORMAT_YUV422: + case XRT_FORMAT_YUYV422: ensure_buf_allocated(f, xf); process_frame_yuyv(f, xf); break; diff --git a/src/xrt/auxiliary/util/u_format.c b/src/xrt/auxiliary/util/u_format.c index 0b1d11a98..97983a70c 100644 --- a/src/xrt/auxiliary/util/u_format.c +++ b/src/xrt/auxiliary/util/u_format.c @@ -25,7 +25,7 @@ u_format_str(enum xrt_format f) case XRT_FORMAT_BITMAP_8X1: return "XRT_FORMAT_BITMAP_8X1"; case XRT_FORMAT_BITMAP_8X8: return "XRT_FORMAT_BITMAP_8X8"; case XRT_FORMAT_YUV888: return "XRT_FORMAT_YUV888"; - case XRT_FORMAT_YUV422: return "XRT_FORMAT_YUV422"; + case XRT_FORMAT_YUYV422: return "XRT_FORMAT_YUYV422"; case XRT_FORMAT_MJPEG: return "XRT_FORMAT_MJPEG"; default: assert(!"unsupported format"); return 0; } @@ -44,7 +44,7 @@ u_format_is_blocks(enum xrt_format f) case XRT_FORMAT_BITMAP_8X1: case XRT_FORMAT_BITMAP_8X8: case XRT_FORMAT_YUV888: - case XRT_FORMAT_YUV422: + case XRT_FORMAT_YUYV422: // Yes return true; case XRT_FORMAT_MJPEG: @@ -67,7 +67,7 @@ u_format_block_width(enum xrt_format f) case XRT_FORMAT_YUV888: // Regular one pixel per block formats. return 1; - case XRT_FORMAT_YUV422: + case XRT_FORMAT_YUYV422: // Two pixels per block. return 2; case XRT_FORMAT_BITMAP_8X8: @@ -90,7 +90,7 @@ u_format_block_height(enum xrt_format f) case XRT_FORMAT_L8: case XRT_FORMAT_BITMAP_8X1: case XRT_FORMAT_YUV888: - case XRT_FORMAT_YUV422: + case XRT_FORMAT_YUYV422: // One pixel high. return 1; case XRT_FORMAT_BITMAP_8X8: @@ -118,7 +118,7 @@ u_format_block_size(enum xrt_format f) return 3; case XRT_FORMAT_R8G8B8X8: case XRT_FORMAT_R8G8B8A8: - case XRT_FORMAT_YUV422: // Four bytes per two pixels. + case XRT_FORMAT_YUYV422: // Four bytes per two pixels. // 32bit pixel formats. return 4; case XRT_FORMAT_BITMAP_8X8: // 64 bits. diff --git a/src/xrt/auxiliary/util/u_sink_converter.c b/src/xrt/auxiliary/util/u_sink_converter.c index 24490b7d8..839a61b9d 100644 --- a/src/xrt/auxiliary/util/u_sink_converter.c +++ b/src/xrt/auxiliary/util/u_sink_converter.c @@ -98,7 +98,7 @@ generate_lookup_YUV_to_RGBX() #endif inline static void -YUV422_to_R8G8B8X8(const uint8_t *input, uint32_t *rgb1, uint32_t *rgb2) +YUYV422_to_R8G8B8X8(const uint8_t *input, uint32_t *rgb1, uint32_t *rgb2) { uint8_t y0 = input[0]; uint8_t u = input[1]; @@ -115,7 +115,7 @@ YUV422_to_R8G8B8X8(const uint8_t *input, uint32_t *rgb1, uint32_t *rgb2) } inline static void -YUV422_to_R8G8B8(const uint8_t *input, uint8_t *dst) +YUYV422_to_R8G8B8(const uint8_t *input, uint8_t *dst) { uint8_t y0 = input[0]; uint8_t u = input[1]; @@ -160,11 +160,11 @@ YUV444_to_R8G8B8(const uint8_t *input, uint8_t *dst) } static void -from_YUV422_to_R8G8B8(struct u_sink_converter *s, - uint32_t w, - uint32_t h, - size_t stride, - const uint8_t *data) +from_YUYV422_to_R8G8B8(struct u_sink_converter *s, + uint32_t w, + uint32_t h, + size_t stride, + const uint8_t *data) { for (uint32_t y = 0; y < h; y++) { for (uint32_t x = 0; x < w; x += 2) { @@ -173,7 +173,7 @@ from_YUV422_to_R8G8B8(struct u_sink_converter *s, src = src + (y * stride) + (x * 2); dst = dst + (y * s->frame->stride) + (x * 3); - YUV422_to_R8G8B8(src, dst); + YUYV422_to_R8G8B8(src, dst); } } } @@ -355,10 +355,10 @@ receive_frame_r8g8b8_or_l8(struct xrt_frame_sink *xs, struct xrt_frame *xf) case XRT_FORMAT_R8G8B8: s->downstream->push_frame(s->downstream, xf); return; - case XRT_FORMAT_YUV422: + case XRT_FORMAT_YUYV422: ensure_data(s, XRT_FORMAT_R8G8B8, xf->width, xf->height); - from_YUV422_to_R8G8B8(s, xf->width, xf->height, xf->stride, - xf->data); + from_YUYV422_to_R8G8B8(s, xf->width, xf->height, xf->stride, + xf->data); break; case XRT_FORMAT_YUV888: ensure_data(s, XRT_FORMAT_R8G8B8, xf->width, xf->height); @@ -392,10 +392,10 @@ receive_frame_r8g8b8(struct xrt_frame_sink *xs, struct xrt_frame *xf) case XRT_FORMAT_R8G8B8: s->downstream->push_frame(s->downstream, xf); return; - case XRT_FORMAT_YUV422: + case XRT_FORMAT_YUYV422: ensure_data(s, XRT_FORMAT_R8G8B8, xf->width, xf->height); - from_YUV422_to_R8G8B8(s, xf->width, xf->height, xf->stride, - xf->data); + from_YUYV422_to_R8G8B8(s, xf->width, xf->height, xf->stride, + xf->data); break; case XRT_FORMAT_YUV888: ensure_data(s, XRT_FORMAT_R8G8B8, xf->width, xf->height); @@ -427,7 +427,7 @@ receive_frame_yuv_yuyv_or_l8(struct xrt_frame_sink *xs, struct xrt_frame *xf) switch (xf->format) { case XRT_FORMAT_L8: - case XRT_FORMAT_YUV422: + case XRT_FORMAT_YUYV422: case XRT_FORMAT_YUV888: s->downstream->push_frame(s->downstream, xf); return; @@ -457,7 +457,7 @@ receive_frame_yuv_or_yuyv(struct xrt_frame_sink *xs, struct xrt_frame *xf) switch (xf->format) { - case XRT_FORMAT_YUV422: + case XRT_FORMAT_YUYV422: case XRT_FORMAT_YUV888: s->downstream->push_frame(s->downstream, xf); return; diff --git a/src/xrt/drivers/v4l2/v4l2_driver.c b/src/xrt/drivers/v4l2/v4l2_driver.c index 31d3721cb..9319a0f10 100644 --- a/src/xrt/drivers/v4l2/v4l2_driver.c +++ b/src/xrt/drivers/v4l2/v4l2_driver.c @@ -489,7 +489,7 @@ v4l2_list_modes_size(struct v4l2_fs *vid, enum xrt_format format = (enum xrt_format)0; switch (interval.pixel_format) { - case V4L2_PIX_FMT_YUYV: format = XRT_FORMAT_YUV422; break; + case V4L2_PIX_FMT_YUYV: format = XRT_FORMAT_YUYV422; break; case V4L2_PIX_FMT_MJPEG: format = XRT_FORMAT_MJPEG; break; default: V_ERROR(vid, "error: Format not supported."); return; } diff --git a/src/xrt/include/xrt/xrt_defines.h b/src/xrt/include/xrt/xrt_defines.h index 977de27cb..6e0e9e2b9 100644 --- a/src/xrt/include/xrt/xrt_defines.h +++ b/src/xrt/include/xrt/xrt_defines.h @@ -72,7 +72,7 @@ enum xrt_format XRT_FORMAT_BITMAP_8X8, // One bit format tiled in 8X8 blocks. XRT_FORMAT_YUV888, - XRT_FORMAT_YUV422, + XRT_FORMAT_YUYV422, XRT_FORMAT_MJPEG, };