Pointwise processing steps#
Pointwise processing steps transform each sample of the internal tile independently (no neighborhood).
Their traits report an empty local halo and can run on the Register-only API or on a Shared-memory
tile, depending upon the use case. Pair Function<function:: ...> with the matching parameter operator
(Function tag operator (processing step)).
Color convert#
function::color_convert. Function<function::color_convert>() with
ColorConvert<InputCS, OutputCS, InputDepth, OutputDepth> converts color space and/or
bit depth on the internal tile.
InputCS / OutputCS are color_space values:
rgb: RGByuv_bt601: YUV BT.601 (standard-definition TV)yuv_bt709: YUV BT.709 (high-definition TV)yuv_bt2020: YUV BT.2020 (ultra-high-definition TV)
InputDepth / OutputDepth are bit_depth values:
bpp_8u: 8-bit unsigned (0–255)bpp_10u: 10-bit unsigned (0–1023)bpp_16u: 16-bit unsigned (0–65535)
using Convert = decltype(
Function<function::color_convert>() +
ColorConvert<color_space::rgb,
color_space::yuv_bt601,
bit_depth::bpp_8u,
bit_depth::bpp_8u>() +
TileSize<48, 48>() +
Block() +
SM<900>());
See 01_color_conversion/image_conversion_example.cu and the fused three-step pattern in
Image Processing Using NPPDx.
Gamma#
function::gamma. Function<function::gamma>() with
GammaTransform<BitDepth, Direction, TransferFunction> applies a forward or inverse
transfer function on the internal tile.
gamma_dir selects direction: forward (linear \(\rightarrow\) encoded) or inverse (encoded \(\rightarrow\) linear).
TransferFunction is a gamma_transfer_function:
Standard Dynamic Range
SDR: Gamma curve y = x^(2.2-2.4) (BT.709-style encoding).Hybrid Log-Gamma
HLG: HDR transfer that remains compatible with SDR displays in the lower range; used in broadcast HDR workflows.Perceptual Quantizer
PQ: (SMPTE ST 2084). Developed by Dolby. Absolute HDR encoding used by formats such as HDR10.
using Gamma = decltype(
Function<function::gamma>() +
GammaTransform<bit_depth::bpp_8u,
gamma_dir::forward,
gamma_transfer_function::SDR>() +
TileSize<48, 48>() +
Block() +
SM<900>());
See 02_fused_pointwise/rgb_gamma_example.cu.
Affine channel map#
function::affine_channel_map. Function<function::affine_channel_map>() with
AffineChannelMap<Pre, Num, Den, Post[, ClipMin, ClipMax]> applies a per-channel integer
affine map:
This shifts the input by Pre, multiplies by Num/Den, and shifts the result by Post. In this way, linear ranges can be offset and scaled.
Following the mapping, optional clip bounds may be supplied as minimum and/or maximum bounds; use
NPPDX_AFFINE_NO_CLIP to disable a bound.
Examples:
0..255 -> 0..1023 (scaling only):
Pre= 0,Num= 1023,Den= 255,Post= 00..255 -> 255..0 (inverted 8-bit):
Pre= 0,Num= -1,Den= 1,Post= 2550..255 -> 16..240 (reduced range 8-bit):
Pre= 0,Num= 224,Den= 255,Post= 16,ClipMin= 16,ClipMax= 240
// 0..255 -> 16..240 (reduced range 8-bit)
using Affine = decltype(
Function<function::affine_channel_map>() +
AffineChannelMap</*Pre=*/0, /*Num=*/224, /*Den=*/255, /*Post=*/16>() +
TileSize<48, 48>() +
Block() +
SM<900>());
See 01_color_conversion/limited_range_example.cu.
Notes:#
These steps are independent of the ingest/exgest formats.
Data can be processed in-place since there are no neighboring pixel dependencies.