cuda_kernels.h 1.12 KB
#pragma once
#include "cuda_runtime.h"
#include "device_launch_parameters.h"

#include <stdio.h>
#include <stdlib.h>

#include <string.h>
#include <math.h>

#include <cuda.h>

typedef unsigned char   uint8;
typedef unsigned int    uint32;
typedef int             int32;

typedef enum
{
	ITU601 = 1,
	ITU709 = 2
} e_ColorSpace;

namespace cuda_common
{
	cudaError_t setColorSpace(e_ColorSpace CSC, float hue);

	cudaError_t NV12ToRGBnot(CUdeviceptr d_srcNV12, size_t nSourcePitch, unsigned char* d_dstRGB, int width, int height);
	cudaError_t CUDAToBGR(CUdeviceptr dataY, CUdeviceptr dataUV, size_t pitchY, size_t pitchUV, unsigned char* d_dstRGB, int width, int height);

	//int resizeAndNorm(void * p, int in_w, int in_h, float *d, int w, int h, bool keepration, bool keepcenter, cudaStream_t stream);
	//int resizeAndNorm(void * p, int in_w, int in_h, float *d, int w, int h, bool keepration, bool keepcenter);
	cudaError_t resizeAndNorm(unsigned char* d_srcRGB, int src_width, int src_height, float* d_dstRGB, int dst_width, int dst_height);

	int copy2square(void * p, void *d, int w, int h, int max_side_length, cudaStream_t stream);

}