User:Evanlezar/CUDABitmapAdd

From K-3D

Jump to: navigation, search

Description

CUDA Implementation of the BitmapAdd plugin

This plugin requires Nvidia's CUDA Toolkit as well as the CUDA SDK which can both be found here.

Cmake files from nvidia-texture-tools have been modified for this plugin. To build the plugin, it is needed that the location of various CUDA libraries be specified. Provision is also made for running in device emulation mode with the CUDA_EMULATION option that is ON by default.

Process

  1. Copy the input bitmap to the device (GPU) memory
  2. Launch a kernel that applies the required transform to the pixels of the image in parallel
  3. Copy the result from the deivce memory to the output bitmap

The current release of the CUDA API does not directly support half-float opperations, although these are slated for a future release and the GPU assembler code does provide this functionality. Due to this limitation, each of the color values for a pixel are converted to a float before the required value is added and the result is converted back to a half-float before being stored.

Results

Images showing (from left to right) the CUDABitmapAdd filter applied to the test image, the BitmapAdd filter applied to the test image, and the per-pixel difference between the two images constucted using GIMP.

Image:Cuda_add_bitmap_example.jpg Image:Cuda_add_bitmap_reference.jpg Image:Cuda_add_bitmap_per_pixel_difference.jpg

Status

Experimental

Properties

Label Description Type Script Name
Selection Weight Node selection state, 1 = selected, 0 = unselected. double selection_weight
Input Bitmap Input bitmap k3d::bitmap* input_bitmap
Output Bitmap Output bitmap k3d::bitmap* output_bitmap
Add value Value to be added to each color channel double add_value