#include "CUDA_DataChange.cuh" __global__ void ucharToFloat_stream(const unsigned char *input, float *output, int size) { int tid = blockIdx.x * blockDim.x + threadIdx.x; if (tid < size) { output[tid] = static_cast(input[tid]); } } __global__ void floatToUchar_stream(const float *input, unsigned char *output, int size) { int tid = blockIdx.x * blockDim.x + threadIdx.x; if (tid < size) { output[tid] = static_cast(input[tid]); } } void Cuda_ucharToFloat_stream(const unsigned char *input, float *output, int size, cudaStream_t stream) { int blockSize = 1024; int numBlocks = (size + blockSize - 1) / blockSize; ucharToFloat_stream<<>>(input, output, size); } void Cuda_FloatTouchar_stream(const float *input, unsigned char *output, int size, cudaStream_t stream) { int blockSize = 1024; int numBlocks = (size + blockSize - 1) / blockSize; floatToUchar_stream<<>>(input, output, size); }