UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
cuda_dxt.h File Reference

Interface of DXT compression CUDA implementation. More...

#include "cuda_wrapper.h"
Include dependency graph for cuda_dxt.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int cuda_rgb_to_dxt1 (const void *src, void *out, int size_x, int size_y, cuda_wrapper_stream_t stream)
 
int cuda_rgb_to_dxt6 (const void *src, void *out, int size_x, int size_y, cuda_wrapper_stream_t stream)
 
int cuda_yuv422_to_yuv444 (const void *src, void *out, int pix_count, cuda_wrapper_stream_t str)
 
int cuda_yuv_to_dxt1 (const void *src, void *out, int size_x, int size_y, cuda_wrapper_stream_t stream)
 
int cuda_yuv_to_dxt6 (const void *src, void *out, int size_x, int size_y, cuda_wrapper_stream_t stream)
 

Detailed Description

Interface of DXT compression CUDA implementation.

Author
Martin Jirman jirma.nosp@m.n@ce.nosp@m.snet..nosp@m.cz Based on GLSL code by Martin Srom

Definition in file cuda_dxt.h.

Function Documentation

◆ cuda_rgb_to_dxt1()

int cuda_rgb_to_dxt1 ( const void * src,
void * out,
int size_x,
int size_y,
cuda_wrapper_stream_t stream )

CUDA DXT1 compression (only RGB without alpha).

Parameters
srcPointer to top-left source pixel in device-memory buffer. 8bit RGB samples are expected (no alpha and no padding). (Pointer must be aligned to multiples of 16 bytes.)
outPointer to output buffer in device memory. (Must be aligned to multiples of 8 bytes.)
size_xWidth of the input image (must be divisible by 4).
size_yHeight of the input image (must be divisible by 4). (Input is read bottom up if negative)
streamCUDA stream to run in, or 0 for default stream.
Returns
0 if OK, nonzero if failed.

CUDA DXT1 compression (only RGB without alpha).

Parameters
srcPointer to top-left source pixel in device-memory buffer. 8bit RGB samples are expected (no alpha and no padding). (Pointer must be aligned to multiples of 16 bytes.)
outPointer to output buffer in device memory. (Must be aligned to multiples of 8 bytes.)
size_xWidth of the input image (must be divisible by 4).
size_yHeight of the input image (must be divisible by 4).
streamCUDA stream to run in, or 0 for default stream.
Returns
0 if OK, nonzero if failed.

Definition at line 782 of file cuda_dxt.cu.

783 {
784 return dxt_launch<false, 1>(src, out, size_x, size_y, (cudaStream_t) stream);
785}
static int dxt_launch(const void *src, void *out, int sx, int sy, cudaStream_t str)
Compute grid size and launch DXT kernel.
Definition cuda_dxt.cu:736

References dxt_launch().

Referenced by main(), and worker_thread().

Here is the call graph for this function:

◆ cuda_rgb_to_dxt6()

int cuda_rgb_to_dxt6 ( const void * src,
void * out,
int size_x,
int size_y,
cuda_wrapper_stream_t stream )

CUDA DXT6 (DXT5-YcOcG) compression (only RGB without alpha).

Parameters
srcPointer to top-left source pixel in device-memory buffer. 8bit RGB samples are expected (no alpha and no padding). (Pointer must be aligned to multiples of 16 bytes.)
outPointer to output buffer in device memory. (Must be aligned to multiples of 8 bytes.)
size_xWidth of the input image (must be divisible by 4).
size_yHeight of the input image (must be divisible by 4). (Input is read bottom up if negative)
streamCUDA stream to run in, or 0 for default stream.
Returns
0 if OK, nonzero if failed.

Definition at line 816 of file cuda_dxt.cu.

817 {
818 return dxt_launch<false, 6>(src, out, size_x, size_y, (cudaStream_t) stream);
819}

References dxt_launch().

Referenced by main(), and worker_thread().

Here is the call graph for this function:

◆ cuda_yuv422_to_yuv444()

int cuda_yuv422_to_yuv444 ( const void * src,
void * out,
int pix_count,
cuda_wrapper_stream_t str )

Definition at line 762 of file cuda_dxt.cu.

763 {
764 // grid and threadblock sizes
765 const dim3 tsiz(64, 1);
766 int thread_count = pix_count / 4; // we process block of 4 pixels
767 const dim3 gsiz((thread_count + tsiz.x - 1) / tsiz.x, 1);
768 yuv422_to_yuv444_kernel<<<gsiz, tsiz, 0, (cudaStream_t) str>>>(src, out, pix_count);
769 return cudaSuccess != cudaStreamSynchronize((cudaStream_t) str) ? -3 : 0;
770}
static __global__ void yuv422_to_yuv444_kernel(const void *src, void *out, int pix_count)
Definition cuda_dxt.cu:697
#define cudaSuccess

References cudaSuccess, and yuv422_to_yuv444_kernel().

Here is the call graph for this function:

◆ cuda_yuv_to_dxt1()

int cuda_yuv_to_dxt1 ( const void * src,
void * out,
int size_x,
int size_y,
cuda_wrapper_stream_t stream )

CUDA DXT1 compression (only RGB without alpha). Converts input from YUV to RGB color space.

Parameters
srcPointer to top-left source pixel in device-memory buffer. 8bit RGB samples are expected (no alpha and no padding). (Pointer must be aligned to multiples of 16 bytes.)
outPointer to output buffer in device memory. (Must be aligned to multiples of 8 bytes.)
size_xWidth of the input image (must be divisible by 4).
size_yHeight of the input image (must be divisible by 4). (Input is read bottom up if negative)
streamCUDA stream to run in, or 0 for default stream.
Returns
0 if OK, nonzero if failed.

CUDA DXT1 compression (only RGB without alpha). Converts input from YUV to RGB color space.

Parameters
srcPointer to top-left source pixel in device-memory buffer. 8bit RGB samples are expected (no alpha and no padding). (Pointer must be aligned to multiples of 16 bytes.)
outPointer to output buffer in device memory. (Must be aligned to multiples of 8 bytes.)
size_xWidth of the input image (must be divisible by 4).
size_yHeight of the input image (must be divisible by 4).
streamCUDA stream to run in, or 0 for default stream.
Returns
0 if OK, nonzero if failed.

Definition at line 799 of file cuda_dxt.cu.

800 {
801 return dxt_launch<true, 1>(src, out, size_x, size_y, (cudaStream_t) stream);
802}

References dxt_launch().

Here is the call graph for this function:

◆ cuda_yuv_to_dxt6()

int cuda_yuv_to_dxt6 ( const void * src,
void * out,
int size_x,
int size_y,
cuda_wrapper_stream_t stream )

Definition at line 821 of file cuda_dxt.cu.

822 {
823 return dxt_launch<true, 6>(src, out, size_x, size_y, (cudaStream_t) stream);
824}

References dxt_launch().

Here is the call graph for this function: