OGLplus (0.52.0) a C++ wrapper for OpenGL

oglplus::images::SortNWMap Class Reference

Generator of an Image encoding a sorting network of specified size. More...

#include </home/chochlik/devel/oglplus/include/oglplus/images/sort_nw.hpp>

Inheritance diagram for oglplus::images::SortNWMap:
Collaboration diagram for oglplus::images::SortNWMap:

Public Member Functions

 SortNWMap (unsigned size)
 Generates the sorting network encoding for size elements.
 
GLsizei Dimension (std::size_t i) const
 Returns the i-th dimension of the image. More...
 
GLsizei Width (void) const
 Returns the width of the image.
 
GLsizei Height (void) const
 Returns the height of the image.
 
GLsizei Depth (void) const
 Returns the depth of the image.
 
GLsizei Channels (void) const
 Returns the number of channels.
 
PixelDataType Type (void) const
 Returns the pixel data type.
 
PixelDataFormat Format (void) const
 Return the pixel data format.
 
PixelDataInternalFormat InternalFormat (void) const
 Return a suitable pixel data internal format.
 
template<typename T >
const T * Data (void) const
 Returns a pointer to the data.
 
const void * RawData (void) const
 Returns an untyped pointer to the data.
 
std::size_t DataSize (void) const
 Returns the size of data in bytes.
 
Vector< double, 4 > Pixel (GLsizei width, GLsizei height, GLsizei depth) const
 Returns the pixel at the specified coordinates.
 
double Component (GLsizei width, GLsizei height, GLsizei depth, GLsizei component) const
 Returns the component of the pixel at the specified coordinates.
 
template<typename T >
ComponentAs (GLsizei width, GLsizei height, GLsizei depth, GLsizei component) const
 Returns the component of the pixel at the specified coordinates.
 

Detailed Description

Generator of an Image encoding a sorting network of specified size.

The sorting network for the specified number of elements is encoded into the Image in the following way:

The rows of the image represent the sorting operation passes, each row is a single pass. Each pass consists of trivial compare and swap operations which can be executed in parallel for the individual sorted elements.

The trivial operations consist of the following steps: 1) determining the index of the currently processed element, 2) determining the offset to the other element to compare (and swap), 3) getting the values for the current and the other element, 4) determining the direction in which the elements should be sorted, 5) comparing the values and swapping the elements if they are not sorted in the right direction.

The offset and direction parameters are encoded in the following way:

int pass;
int index;
uint texel = fetchTexel(ivec2(index, pass));
int offset = int(texel >> 2) * (texel & 0x02)?-1:1;
int direction = (texel & 0x01)?-1:1;
int other_index = index+offset;

Member Function Documentation

GLsizei oglplus::images::Image::Dimension ( std::size_t  i) const
inherited

Returns the i-th dimension of the image.

0: Width 1: Height 2: Depth 3: Channels

References oglplus::images::Image::Channels(), oglplus::images::Image::Depth(), oglplus::images::Image::Height(), and oglplus::images::Image::Width().


The documentation for this class was generated from the following file:
  • /home/chochlik/devel/oglplus/include/oglplus/images/sort_nw.hpp

Copyright © 2010-2014 Matúš Chochlík, University of Žilina, Žilina, Slovakia.
<matus.chochlik -at- fri.uniza.sk>
<chochlik -at -gmail.com>
Documentation generated on Mon Sep 22 2014 by Doxygen (version 1.8.6).