OpenQMC API
Loading...
Searching...
No Matches
oqmc Namespace Reference

Namespaces

namespace  bntables
 
namespace  pcg
 

Classes

struct  EncodeKey
 Key to encode pixel coordinates. More...
 
class  SamplerInterface
 Public sampler API. More...
 
struct  State64Bit
 Generic sampler state type. More...
 

Typedefs

using LatticeSampler = SamplerInterface< LatticeImpl >
 Rank one lattice sampler.
 
using LatticeBnSampler = SamplerInterface< LatticeBnImpl >
 Blue noise variant of lattice sampler.
 
using PmjSampler = SamplerInterface< PmjImpl >
 Low discrepancy pmj sampler.
 
using PmjBnSampler = SamplerInterface< PmjBnImpl >
 Blue noise variant of pmj sampler.
 
using SobolSampler = SamplerInterface< SobolImpl >
 Owen scrambled sobol sampler.
 
using SobolBnSampler = SamplerInterface< SobolBnImpl >
 Blue noise variant of sobol sampler.
 

Functions

template<int XBits, int YBits, int ZBits>
std::uint16_t encodeBits16 (EncodeKey key)
 Encode a key value into 16 bits.
 
template<int XBits, int YBits, int ZBits>
EncodeKey decodeBits16 (std::uint16_t value)
 Decode a value back into a key.
 
float uintToFloat (std::uint32_t value)
 Convert an integer into a [0, 1) float.
 
constexpr std::uint32_t randomDigitScramble (std::uint32_t value, std::uint32_t hash)
 Random digit scramble an element in a sequence.
 
template<int Table, int Depth>
void shuffledScrambledLookup (std::uint32_t index, std::uint32_t hash, const std::uint32_t table[][Table], std::uint32_t sample[Depth])
 Compute a randomised value from a pre-computed table.
 
std::uint16_t sobolReversedIndex (std::uint16_t index, int dimension)
 Compute sobol sequence value at an index with reversed bits.
 
constexpr std::uint32_t scrambleAndReverse (std::uint32_t value, std::uint32_t seed)
 Permute an input integer and reverse the bits.
 
template<int Depth>
void shuffledScrambledSobol (std::uint32_t index, std::uint32_t seed, std::uint32_t sample[Depth])
 Compute a randomised sobol sequence value.
 
constexpr std::uint32_t laineKarrasPermutation (std::uint32_t value, std::uint32_t seed)
 Laine and Karras style permutation.
 
constexpr std::uint32_t reverseAndShuffle (std::uint32_t value, std::uint32_t seed)
 Reverse input bits and shuffle order.
 
constexpr std::uint32_t shuffle (std::uint32_t value, std::uint32_t seed)
 Compute a hash based owen scramble.
 
constexpr std::uint32_t uintToRange (std::uint32_t value, std::uint32_t range)
 Compute an unsigned integer within 0-bounded half-open range.
 
constexpr std::uint32_t uintToRange (std::uint32_t value, std::uint32_t begin, std::uint32_t end)
 Compute an unsigned integer within half-open range.
 
constexpr std::uint32_t rotate (std::uint32_t value, std::uint32_t distance)
 Rotate an integer a given distance.
 
constexpr std::uint32_t latticeReversedIndex (std::uint32_t index, int dimension)
 Compute a rank 1 lattice value at an index with reversed bits.
 
template<int Depth>
constexpr void shuffledRotatedLattice (std::uint32_t index, std::uint32_t patternId, std::uint32_t sample[Depth])
 Compute a randomised rank 1 lattice value.
 
constexpr std::uint32_t reverseBits32 (std::uint32_t value)
 Reverse bits of an unsigned 32 bit integer.
 
constexpr std::uint16_t reverseBits16 (std::uint16_t value)
 Reverse bits of an unsigned 16 bit integer.
 
constexpr std::uint32_t rotateBits (std::uint32_t value, std::uint32_t distance)
 Rotate bits in an integer value.
 
constexpr std::uint32_t rotateBytes (std::uint32_t value, int distance)
 Rotate bytes in an integer value.
 
constexpr int computeIndexKey (int index)
 Compute 16-bit key from index.
 
constexpr int computeIndexId (int index)
 Compute new 16-bit index from index.
 
void stochasticPmjInit (int nsamples, std::uint32_t table[][4])
 Initialise a table with a progressive mult-jittered (0,2) sequence.
 

Variables

constexpr auto floatOneOverUintMax = 2.3283064365386962890625e-10f
 0x1p-32
 
constexpr auto floatOneMinusEpsilon = 0.999999940395355224609375f
 max flt
 

Function Documentation

◆ sobolReversedIndex()

std::uint16_t oqmc::sobolReversedIndex ( std::uint16_t  index,
int  dimension 
)
inline

Given a 16 bit index, where the order of bits in the index have been reversed, compute a sobol sequence value to 16 bits of precision for a given dimension. Dimensions must be within the range [0, 4).

Parameters
[in]indexBit reversed index of element.
[in]dimensionDimension of sobol sequence.
Returns
Sobol sequence value.
Here is the caller graph for this function:

◆ scrambleAndReverse()

constexpr std::uint32_t oqmc::scrambleAndReverse ( std::uint32_t  value,
std::uint32_t  seed 
)
constexpr

Given an input integer value, perform a Laine and Karras style permutation and reverse the resulting bits. The permutation can be randomised with a given seed value. This will be equivalent to an Owen scramble when the input bits of the integer are already reversed.

Parameters
[in]valueInput integer value.
[in]seedSeed to change the permutation.
Returns
Permuted, reversed value.
Here is the caller graph for this function:

◆ shuffledScrambledSobol()

template<int Depth>
void oqmc::shuffledScrambledSobol ( std::uint32_t  index,
std::uint32_t  seed,
std::uint32_t  sample[Depth] 
)
inline

Given an index and a seed, compute an Owen scrambled sobol sequence value. The index will be shuffled in a manner that is progressive friendly. The value can be multi-dimensional. For a given sequence, the seed value must be constant. An index greater than 2^16 will repeat values.

Template Parameters
DepthDimensional space of output, up to 4 dimensions.
Parameters
[in]indexInput index of sequence value.
[in]seedSeed to randomise the sequence.
[out]sampleRandomised sequence value.

◆ rotate()

constexpr std::uint32_t oqmc::rotate ( std::uint32_t  value,
std::uint32_t  distance 
)
constexpr

Given a 32 bit unsigned integer value, offset the value a given distance, and rely on integer overflow for the value to wrap around. When applied to elements in a lattice, this represents a toroidal shift or rotation, upon the range of representable values. When the distance is constant for all elements, this can be used to efficiently randomise the values.

Parameters
[in]valueInteger value to offset.
[in]distanceDistance to offset value.
Returns
Rotated integer value.
Here is the caller graph for this function:

◆ latticeReversedIndex()

constexpr std::uint32_t oqmc::latticeReversedIndex ( std::uint32_t  index,
int  dimension 
)
constexpr

Given a 32 bit index, where the order of bits in the index have been reversed, compute a rank 1 lattice value to 32 bits of precision for a given dimension. Dimensions must be within the range [0, 4).

Parameters
[in]indexBit reversed index of element.
[in]dimensionDimension of rank 1 lattice.
Returns
Rank 1 lattice value.
Here is the caller graph for this function:

◆ shuffledRotatedLattice()

template<int Depth>
constexpr void oqmc::shuffledRotatedLattice ( std::uint32_t  index,
std::uint32_t  patternId,
std::uint32_t  sample[Depth] 
)
constexpr

Given an index and a patternId, compute a rank 1 lattice value. The index will be shuffled in a manner that is progressive friendly. The value can be multi-dimensional. For a given lattice, the patternId value must be constant.

Template Parameters
DepthDimensional space of output, up to 4 dimensions.
Parameters
[in]indexInput index of lattice value.
[in]patternIdSeed to randomise the lattice.
[out]sampleRandomised lattice value.

◆ computeIndexKey()

constexpr int oqmc::computeIndexKey ( int  index)
constexpr

Given a sample index, compute a key value based on the top 16-bits of the integer range. Use computeIndexId() to compute the corrosponding new index to pair with the key.

Parameters
[in]indexSample index.
Returns
16-bit Key value.
Here is the caller graph for this function:

◆ computeIndexId()

constexpr int oqmc::computeIndexId ( int  index)
constexpr

Given a sample index, compute a new index value based on the bottom 16-bits of the integer range. Use computeIndexKey() to compute the corrosponding key value to pair with the new index.

Parameters
[in]indexSample index.
Returns
New 16-bit index.
Here is the caller graph for this function:

◆ stochasticPmjInit()

void oqmc::stochasticPmjInit ( int  nsamples,
std::uint32_t  table[][4] 
)
inline

Given a data array and size, compute the corresponding progressive multi-jittered (0,2) sequence value for each element of the array. Each element in the array is a 4 dimensional sample. Number of samples must be larger than zero and no more than 2^16.

Parameters
[in]nsamplesSize of the table array.
[out]tableOutput array of 4 dimensional samples.

Variable Documentation

◆ floatOneOverUintMax

constexpr auto oqmc::floatOneOverUintMax = 2.3283064365386962890625e-10f
constexpr

◆ floatOneMinusEpsilon

constexpr auto oqmc::floatOneMinusEpsilon = 0.999999940395355224609375f
constexpr