y12i-to-y16y16.cpp
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2019 Intel Corporation. All Rights Reserved.
3 
4 #include "y12i-to-y16y16.h"
5 #include "stream.h"
6 #ifdef RS2_USE_CUDA
7 #include "cuda/cuda-conversion.cuh"
8 #endif
9 
10 namespace librealsense
11 {
12  struct y12i_pixel { uint8_t rl : 8, rh : 4, ll : 4, lh : 8; int l() const { return lh << 4 | ll; } int r() const { return rh << 8 | rl; } };
13  void unpack_y16_y16_from_y12i_10(byte * const dest[], const byte * source, int width, int height, int actual_size)
14  {
15  auto count = width * height;
16 #ifdef RS2_USE_CUDA
17  rscuda::split_frame_y16_y16_from_y12i_cuda(dest, count, reinterpret_cast<const y12i_pixel *>(source));
18 #else
19  split_frame(dest, count, reinterpret_cast<const y12i_pixel*>(source),
20  [](const y12i_pixel & p) -> uint16_t { return p.l() << 6 | p.l() >> 4; }, // We want to convert 10-bit data to 16-bit data
21  [](const y12i_pixel & p) -> uint16_t { return p.r() << 6 | p.r() >> 4; }); // Multiply by 64 1/16 to efficiently approximate 65535/1023
22 #endif
23  }
24 
25  y12i_to_y16y16::y12i_to_y16y16(int left_idx, int right_idx)
26  : y12i_to_y16y16("Y12I to Y16L Y16R Transform", left_idx, right_idx) {}
27 
28  y12i_to_y16y16::y12i_to_y16y16(const char * name, int left_idx, int right_idx)
31  {}
32 
33  void y12i_to_y16y16::process_function(byte * const dest[], const byte * source, int width, int height, int actual_size, int input_size)
34  {
35  unpack_y16_y16_from_y12i_10(dest, source, width, height, actual_size);
36  }
37 }
GLuint const GLchar * name
GLfloat GLfloat p
Definition: glext.h:12687
y12i_to_y16y16(int left_idx=1, int right_idx=2)
void unpack_y16_y16_from_y12i_10(byte *const dest[], const byte *source, int width, int height, int actual_size)
unsigned short uint16_t
Definition: stdint.h:79
void process_function(byte *const dest[], const byte *source, int width, int height, int actual_size, int input_size) override
unsigned char uint8_t
Definition: stdint.h:78
GLint GLsizei GLsizei height
unsigned char byte
Definition: src/types.h:52
GLint GLsizei count
GLsizei GLsizei GLchar * source
LZ4LIB_API char * dest
Definition: lz4.h:438
void split_frame(byte *const dest[], int count, const SOURCE *source, SPLIT_A split_a, SPLIT_B split_b)
Definition: image.h:15
GLint GLsizei width


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:50:23