2#include "RasterFrame.h"
3#include "Base/Headers/RGBColor.h"
10 # define YUV2RGB_11 298
11 # define YUV2RGB_12 -1
12 # define YUV2RGB_13 409
13 # define YUV2RGB_22 -100
14 # define YUV2RGB_23 -210
15 # define YUV2RGB_32 519
23 int value = ((Text_Index - (Text_Index % 2)) * 2);
27 if (Text_Index % 2 == 0)
29 y = YUV2RGB_11 * (memory[value] - Y_OFFSET);
33 y = YUV2RGB_11 * (memory[value + 2] - Y_OFFSET);
35 u = memory[value + 1] - UV_OFFSET;
36 v = memory[value + 3] - UV_OFFSET;
38 uv_r = YUV2RGB_12 * u + YUV2RGB_13 * v;
39 uv_g = YUV2RGB_22 * u + YUV2RGB_23 * v;
40 uv_b = YUV2RGB_32 * u + YUV2RGB_33 * v;
43 clip((y + uv_r) >> 8, 0, 255)
44 ,
clip((y + uv_g) >> 8, 0, 255)
45 ,
clip((y + uv_b) >> 8, 0, 255));
57 return RGBColor(memory[value], memory[value + 1], memory[value + 2], 255U);
67 return RGBColor(memory[value + 2], memory[value + 1], memory[value + 0], 255U);
77 return RGBColor(memory[value], memory[value], memory[value], 255U);
93 default: lib_assert(
false,
"unknown format");
return Constant<RGBColor>::Invalid;
108 pixel = memory[index];
111 pixel =
reinterpret_cast<const uint16_t*
>(memory)[index];
114 pixel =
reinterpret_cast<const uint32_t*
>(memory)[index];
117 pixel =
reinterpret_cast<const uint64_t*
>(memory)[index];
Represents a color in the RGB space with optional alpha transparency.
The primary namespace for the NDEVR SDK.
static RGBColor PullAsRGB(const VideoFrameDetails &texture, int Text_Index, const uint01 *memory)
Extract an RGB color from a pixel in RGB byte order.
float fltp04
Defines an alias representing a 4 byte floating-point number Bit layout is as follows: -Sign: 1 bit a...
static RGBColor PullAsYUV(const VideoFrameDetails &, int Text_Index, const uint01 *memory)
Convert a YUV 4:2:2 pixel to an RGBColor.
static RGBColor PullAsY8(const VideoFrameDetails &texture, int Text_Index, const uint01 *memory)
Extract an RGB color from an 8-bit grayscale pixel.
static RGBColor PullRGB(const VideoFrameDetails &texture, int index, const uint01 *memory)
Extract an RGB color from a pixel, dispatching to the correct format converter.
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
static RGBColor PullAsBGR(const VideoFrameDetails &texture, int Text_Index, const uint01 *memory)
Extract an RGB color from a pixel in BGR byte order.
@ e_bgr
Blue-Green-Red byte order.
@ e_rgb
Red-Green-Blue byte order.
@ e_yuv
YUV 4:2:2 packed format.
static fltp04 PullDepth(const VideoFrameDetails &texture, int index, const uint01 *memory)
Extract a depth value from a pixel, handling 1/2/4/8 byte depths.
constexpr t_type clip(const t_type &value, const t_type &lower_bound, const t_type &upper_bound)
Clips the value given so that that the returned value falls between upper and lower bound.
constexpr t_to cast(const Angle< t_from > &value)
Casts an Angle from one backing type to another.
Describes the pixel format and dimensions of a video frame from a raster camera.
RasterColorFormat format
Pixel color format.
uint04 bytes_per_pixel
Number of bytes per pixel.