GLIP-Lib
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | Static Public Member Functions | List of all members
Glip::Modules::GenerateFFT2DPipeline Class Reference

Generate a 2D FFT PipelineLayout. More...

#include <FFT.hpp>

Inheritance diagram for Glip::Modules::GenerateFFT2DPipeline:
Inheritance graph

Public Member Functions

 GenerateFFT2DPipeline (void)
 Module constructor. More...
 
- Public Member Functions inherited from Glip::Modules::LayoutLoaderModule
virtual void apply (const std::vector< std::string > &arguments, const std::string &body, const std::string &currentPath, std::vector< std::string > &dynamicPaths, std::map< std::string, HdlTextureFormat > &formatList, std::map< std::string, ShaderSource > &sourceList, std::map< std::string, GeometryModel > &geometryList, std::map< std::string, FilterLayout > &filterList, std::map< std::string, PipelineLayout > &pipelineList, std::string &mainPipelineName, const std::vector< std::string > &staticPaths, const std::map< std::string, HdlTextureFormat > &requiredFormatList, const std::map< std::string, ShaderSource > &requiredSourceList, const std::map< std::string, GeometryModel > &requiredGeometryList, const std::map< std::string, PipelineLayout > &requiredPipelineList, const std::map< std::string, LayoutLoaderModule * > &moduleList, const std::string &sourceName, const int startLine, const int bodyLine, std::string &executionSource, std::string &executionSourceName, int &executionStartLine)=0
 Interface of the module : this function will be called on each corresponding token CALL for the LayoutLoader which has the module. More...
 
const std::string & getName (void) const
 Get the name of the module. More...
 
const int & getMinNumArguments (void) const
 Get the minimum number of arguments of the module. More...
 
const int & getMaxNumArguments (void) const
 Get the maximum number of arguments of the module. More...
 
const char & bodyPresenceTest (void) const
 Get the requirement on the body. More...
 
const std::string & getDescription (void) const
 Get the description of the module. More...
 
const std::string & getBodyDescription (void) const
 Get the description of the body of the module. More...
 
const std::vector< std::pair
< std::string, std::string > > & 
getArgumentsDescriptions (void) const
 Get the description of all the arguments of the module. More...
 
std::string getManual (void) const
 Get the manual of the module. More...
 
virtual void beginLoadLayout (void)
 Function called at the beginning of a loading session.
 
virtual void endLoadLayout (void)
 Function called at the end of a loading session.
 

Static Public Member Functions

static PipelineLayout generate (int width, int height, int flags=0, const ShaderSource &pre=std::string(), const ShaderSource &post=std::string())
 Construct a pipeline performing a 2D FFT. More...
 
- Static Public Member Functions inherited from Glip::Modules::LayoutLoaderModule
static void addBasicModules (LayoutLoader &loader)
 Add the basic modules to a LayoutLoader. More...
 
static std::vector
< LayoutLoaderModule * > 
getBasicModulesList (void)
 Retrieve the list of standard modules. More...
 
static bool getBoolean (const std::string &arg, const std::string &sourceName="", int line=1)
 Convert a keyword to a boolean. More...
 
static void getCases (const std::string &body, std::string &trueCase, int &trueCaseStartLine, std::string &falseCase, int &falseCaseStartLine, const std::string &sourceName="", int bodyLine=1)
 Get true and false cases out of a body. More...
 
static std::vector< std::string > findFile (const std::string &filename, const std::vector< std::string > &dynamicPaths)
 Find in which path a file can be found. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Glip::Modules::LayoutLoaderModule
 LayoutLoaderModule (const std::string &_name, const std::string &_manual, const int &_minNumArguments, const int &_maxNumArguments, const char &_bodyPresence)
 LayoutLoaderModule constructor. For simple modules you can just use the macro LAYOUT_LOADER_MODULE_APPLY. More...
 

Detailed Description

Generate a 2D FFT PipelineLayout.

Warning : This module might return low accuracy or even erroneous result if the driver performs a blind optimization.

The FFT is computed in single precision. The pipeline will have the input port inputTexture and the output port outputTexture. The input texture will have the real part in its red channel and the imaginary part in its green channel.

Here is an example of PRE and POST functions given when creating the pipeline via a LayoutLoader script. Note that you can provide the content of the blocks PRE and POST directly to the GenerateFFT2DPipeline::generate function.

CALL:GENERATE_FFT2D_PIPELINE(512, 512, FFTPipelineLayout)
{
PRE
{
uniform vec4 selection = vec4(1.0, 0.0, 0.0, 0.0);
vec4 pre(in vec4 c, in vec2 x) // c will contain the color of the texture, sampled at the right position, x is the position vector (normalized in the [0, 1] range).
{
c.r = dot(c, selection)/(selection.r + selection.g + selection.b); // Select which channel (or combination to use as the real data.
c.gba = vec3(0.0, 0.0, 0.0); // Do not set any imaginary data (green channel). Both blue and alpha channels are omitted.
return c;
}
}
POST
{
vec4 post(in vec4 c, in vec2 x) // c will contain the color of the texture, sampled at the right position, x is the position vector (normalized in the [0, 1] range).
{
c.g = c.r; // copy the real value of the FFT transform (red channel) to the imaginary value (green channel).
return c;
}
}
}

Constructor & Destructor Documentation

GenerateFFT2DPipeline::GenerateFFT2DPipeline ( void  )

Module constructor.

This object can be added to a LayoutLoader via LayoutLoader::addModule().

Member Function Documentation

PipelineLayout GenerateFFT2DPipeline::generate ( int  width,
int  height,
int  flags = 0,
const ShaderSource pre = std::string(),
const ShaderSource post = std::string() 
)
static

Construct a pipeline performing a 2D FFT.

Parameters
widthWidth of the signal.
heightHeight of the signal.
flagsPossible flags associated to the transformation (see Glip::Modules::FFTModules::Flag).
preAdd a filtering function before the transform.
postAdd a filtering function after the transform.
Returns
A complete pipeline layout.

The pre-function will be inserted before the transform. It should be a block of code declaring the function pre as in the following example :

vec4 pre(in vec4 colorFromTexture, in vec2 pos)
{
return modifiedColor;
}

The post-function will be inserted after the transform. It should be a block of code declaring the function post as in the following example :

vec4 post(in vec4 colorAfterFFT, in vec2 pos)
{
return modifiedColor;
}

Each time, the position is normalized from 0.0 to 1.0. You are allowed to declare uniform variables in these filters.


The documentation for this class was generated from the following files: