NVIDIA OptiX 7.1 API nvidia_logo_transpbg.gif Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Denoiser

Functions

OptixResult optixDenoiserCreate (OptixDeviceContext context, const OptixDenoiserOptions *options, OptixDenoiser *denoiser)
 
OptixResult optixDenoiserSetModel (OptixDenoiser denoiser, OptixDenoiserModelKind kind, void *data, size_t sizeInBytes)
 
OptixResult optixDenoiserDestroy (OptixDenoiser denoiser)
 
OptixResult optixDenoiserComputeMemoryResources (const OptixDenoiser denoiser, unsigned int outputWidth, unsigned int outputHeight, OptixDenoiserSizes *returnSizes)
 
OptixResult optixDenoiserSetup (OptixDenoiser denoiser, CUstream stream, unsigned int inputWidth, unsigned int inputHeight, CUdeviceptr denoiserState, size_t denoiserStateSizeInBytes, CUdeviceptr scratch, size_t scratchSizeInBytes)
 
OptixResult optixDenoiserInvoke (OptixDenoiser denoiser, CUstream stream, const OptixDenoiserParams *params, CUdeviceptr denoiserState, size_t denoiserStateSizeInBytes, const OptixImage2D *inputLayers, unsigned int numInputLayers, unsigned int inputOffsetX, unsigned int inputOffsetY, const OptixImage2D *outputLayer, CUdeviceptr scratch, size_t scratchSizeInBytes)
 
OptixResult optixDenoiserComputeIntensity (OptixDenoiser denoiser, CUstream stream, const OptixImage2D *inputImage, CUdeviceptr outputIntensity, CUdeviceptr scratch, size_t scratchSizeInBytes)
 

Detailed Description

Function Documentation

OptixResult optixDenoiserComputeIntensity ( OptixDenoiser  denoiser,
CUstream  stream,
const OptixImage2D inputImage,
CUdeviceptr  outputIntensity,
CUdeviceptr  scratch,
size_t  scratchSizeInBytes 
)

Computes the logarithmic average intensity of the given image. The returned value 'outputIntensity' is multiplied with the RGB values of the input image/tile in optixDenoiserInvoke if given in the parameter OptixDenoiserParams::hdrIntensity (otherwise 'hdrIntensity' must be a null pointer). This is useful for denoising HDR images which are very dark or bright. When denoising tiles the intensity of the entire image should be computed, i.e. not per tile to get consistent results.

For each RGB pixel in the inputImage the intensity is calculated and summed if it is greater than 1e-8f: intensity = log(r * 0.212586f + g * 0.715170f + b * 0.072200f). The function returns 0.18 / exp(sum of intensities / number of summed pixels). More details could be found in the Reinhard tonemapping paper: http://www.cmap.polytechnique.fr/~peyre/cours/x2005signal/hdr_photographic.pdf

This function needs scratch memory with a size of at least sizeof( int ) * ( 2 + inputImage::width * inputImage::height ). When denoising entire images (no tiling) the same scratch memory as passed to optixDenoiserInvoke could be used.

Parameters
[in]denoiser
[in]stream
[in]inputImage
[out]outputIntensitysingle float
[in]scratch
[in]scratchSizeInBytes
OptixResult optixDenoiserComputeMemoryResources ( const OptixDenoiser  denoiser,
unsigned int  outputWidth,
unsigned int  outputHeight,
OptixDenoiserSizes returnSizes 
)

Computes the GPU memory resources required to execute the denoiser.

Memory for state and scratch buffers must be allocated with the sizes in 'returnSizes' and scratch memory passed to optixDenoiserSetup, optixDenoiserInvoke and optixDenoiserComputeIntensity. For tiled denoising an overlap area must be added to each tile on all sides which increases the amount of memory needed to denoise a tile. In case of tiling use withOverlapScratchSizeInBytes. If only full resolution images are denoised, withoutOverlapScratchSizeInBytes can be used which is always smaller than withOverlapScratchSizeInBytes.

'outputWidth' and 'outputHeight' is the dimension of the image to be denoised (without overlap in case tiling is being used). 'outputWidth' and 'outputHeight' must be greater than or equal to the dimensions passed to optixDenoiserSetup.

Parameters
[in]denoiser
[in]outputWidth
[in]outputHeight
[out]returnSizes
OptixResult optixDenoiserCreate ( OptixDeviceContext  context,
const OptixDenoiserOptions options,
OptixDenoiser denoiser 
)

Creates a denoiser object with the given options.

Parameters
[in]context
[in]options
[out]denoiser
OptixResult optixDenoiserDestroy ( OptixDenoiser  denoiser)

Destroys the denoiser object and any associated host resources.

OptixResult optixDenoiserInvoke ( OptixDenoiser  denoiser,
CUstream  stream,
const OptixDenoiserParams params,
CUdeviceptr  denoiserState,
size_t  denoiserStateSizeInBytes,
const OptixImage2D inputLayers,
unsigned int  numInputLayers,
unsigned int  inputOffsetX,
unsigned int  inputOffsetY,
const OptixImage2D outputLayer,
CUdeviceptr  scratch,
size_t  scratchSizeInBytes 
)

Invokes denoiser on a set of input data and produces one output image. State memory must be available during the execution of the denoiser (or until optixDenoiserSetup is called with a new state memory pointer). Scratch memory passed is used only for the duration of this function. Scratch and state memory sizes must have a size greater than or equal to the sizes as returned by optixDenoiserComputeMemoryResources.

'inputOffsetX' and 'inputOffsetY' are pixel offsets in the 'inputLayers' image specifying the beginning of the image without overlap. When denoising an entire image without tiling there is no overlap and 'inputOffsetX' and 'inputOffsetY' must be zero. When denoising a tile which is adjacent to one of the four sides of the entire image the corresponding offsets must also be zero since there is no overlap at the side adjacent to the image border.

Parameters
[in]denoiser
[in]stream
[in]params
[in]denoiserState
[in]denoiserStateSizeInBytes
[in]inputLayers
[in]numInputLayers
[in]inputOffsetX
[in]inputOffsetY
[in]outputLayer
[in]scratch
[in]scratchSizeInBytes
OptixResult optixDenoiserSetModel ( OptixDenoiser  denoiser,
OptixDenoiserModelKind  kind,
void *  data,
size_t  sizeInBytes 
)

Sets the model of the denoiser.

If the kind is OPTIX_DENOISER_MODEL_KIND_USER, then the data and sizeInByes must not be null and zero respectively. For other kinds, these parameters must be zero.

Parameters
[in]denoiser
[in]kind
[in]data
[in]sizeInBytes
OptixResult optixDenoiserSetup ( OptixDenoiser  denoiser,
CUstream  stream,
unsigned int  inputWidth,
unsigned int  inputHeight,
CUdeviceptr  denoiserState,
size_t  denoiserStateSizeInBytes,
CUdeviceptr  scratch,
size_t  scratchSizeInBytes 
)

Initializes the state required by the denoiser.

'inputWidth' and 'inputHeight' must include overlap on both sides of the image if tiling is being used. The overlap is returned by optixDenoiserComputeMemoryResources. For subsequent calls to optixDenoiserInvoke 'inputWidth' and 'inputHeight' are the maximum dimensions of the input layers. Dimensions of the input layers passed to optixDenoiserInvoke may be different in each invocation however they always must be smaller than 'inputWidth' and 'inputHeight' passed to optixDenoiserSetup.

Parameters
[in]denoiser
[in]stream
[in]inputWidth
[in]inputHeight
[in]denoiserState
[in]denoiserStateSizeInBytes
[in]scratch
[in]scratchSizeInBytes