File indexing completed on 2026-04-10 07:49:43
0001
0002 __global__ void _QTex_uchar4_rotate_kernel(uchar4* output, cudaTextureObject_t texObj, size_t width, size_t height, float theta)
0003 {
0004 unsigned int x = blockIdx.x * blockDim.x + threadIdx.x;
0005 unsigned int y = blockIdx.y * blockDim.y + threadIdx.y;
0006
0007 float u = x / (float) width;
0008 float v = y / (float) height;
0009
0010
0011 u -= 0.5f;
0012 v -= 0.5f;
0013
0014
0015 float tu = u * cosf(theta) - v * sinf(theta) ;
0016 float tv = v * cosf(theta) + u * sinf(theta) ;
0017
0018
0019 uchar4 c = tex2D<uchar4>(texObj, tu+0.5f, tv+0.5f);
0020
0021
0022
0023 c.w = 255u ;
0024
0025 output[y * width + x] = c ;
0026 }
0027
0028 extern "C" void QTex_uchar4_rotate_kernel(dim3 dimGrid, dim3 dimBlock, uchar4* d_output, cudaTextureObject_t texObj, size_t width, size_t height, float theta )
0029 {
0030 _QTex_uchar4_rotate_kernel<<<dimGrid,dimBlock>>>(d_output, texObj, width, height, theta);
0031 }
0032
0033