MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / decode

Method decode

modules/camera/buffer_decoder.cpp:84–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82}
83
84void SeparateYuyvBufferDecoder::decode(StreamingBuffer p_buffer) {
85 uint8_t *y_dst = (uint8_t *)y_image_data.ptrw();
86 uint8_t *uv_dst = (uint8_t *)cbcr_image_data.ptrw();
87 uint8_t *src = (uint8_t *)p_buffer.start;
88 uint8_t *y0_src = src + component_indexes[0];
89 uint8_t *y1_src = src + component_indexes[1];
90 uint8_t *u_src = src + component_indexes[2];
91 uint8_t *v_src = src + component_indexes[3];
92
93 for (int i = 0; i < width * height; i += 2) {
94 *y_dst++ = *y0_src;
95 *y_dst++ = *y1_src;
96 *uv_dst++ = *u_src;
97 *uv_dst++ = *v_src;
98
99 y0_src += 4;
100 y1_src += 4;
101 u_src += 4;
102 v_src += 4;
103 }
104
105 if (y_image.is_valid()) {
106 y_image->set_data(width, height, false, Image::FORMAT_L8, y_image_data);
107 } else {
108 y_image.instantiate(width, height, false, Image::FORMAT_RGB8, y_image_data);
109 }
110 if (cbcr_image.is_valid()) {
111 cbcr_image->set_data(width, height, false, Image::FORMAT_L8, cbcr_image_data);
112 } else {
113 cbcr_image.instantiate(width, height, false, Image::FORMAT_RGB8, cbcr_image_data);
114 }
115
116 camera_feed->set_ycbcr_images(y_image, cbcr_image);
117}
118
119YuyvToGrayscaleBufferDecoder::YuyvToGrayscaleBufferDecoder(CameraFeed *p_camera_feed) :
120 AbstractYuyvBufferDecoder(p_camera_feed) {

Callers 14

detect_darwin_sdk_pathFunction · 0.45
is_apple_clangFunction · 0.45
to_raw_cstringFunction · 0.45
_read_frameMethod · 0.45
make_authors_headerFunction · 0.45
make_donors_headerFunction · 0.45
parse_unicode_dataFunction · 0.45

Calls 9

CLAMPFunction · 0.85
set_ycbcr_imagesMethod · 0.80
set_rgb_imageMethod · 0.80
load_jpg_from_bufferMethod · 0.80
ptrwMethod · 0.45
is_validMethod · 0.45
set_dataMethod · 0.45
instantiateMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected