1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<html> 3<head> 4<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 5<title>GstFFTF32: GStreamer Base Plugins 1.0 Library Reference Manual</title> 6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 7<link rel="home" href="index.html" title="GStreamer Base Plugins 1.0 Library Reference Manual"> 8<link rel="up" href="gstreamer-ffft.html" title="FFT Library"> 9<link rel="prev" href="gst-plugins-base-libs-GstFFTS32.html" title="GstFFTS32"> 10<link rel="next" href="gst-plugins-base-libs-GstFFTF64.html" title="GstFFTF64"> 11<meta name="generator" content="GTK-Doc V1.28 (XML mode)"> 12<link rel="stylesheet" href="style.css" type="text/css"> 13</head> 14<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 15<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle"> 16<td width="100%" align="left" class="shortcuts"> 17<a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span> 18 <a href="#gst-plugins-base-libs-GstFFTF32.description" class="shortcut">Description</a></span> 19</td> 20<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td> 21<td><a accesskey="u" href="gstreamer-ffft.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td> 22<td><a accesskey="p" href="gst-plugins-base-libs-GstFFTS32.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td> 23<td><a accesskey="n" href="gst-plugins-base-libs-GstFFTF64.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td> 24</tr></table> 25<div class="refentry"> 26<a name="gst-plugins-base-libs-GstFFTF32"></a><div class="titlepage"></div> 27<div class="refnamediv"><table width="100%"><tr> 28<td valign="top"> 29<h2><span class="refentrytitle"><a name="gst-plugins-base-libs-GstFFTF32.top_of_page"></a>GstFFTF32</span></h2> 30<p>GstFFTF32 — FFT functions for 32 bit float samples</p> 31</td> 32<td class="gallery_image" valign="top" align="right"></td> 33</tr></table></div> 34<div class="refsect1"> 35<a name="gst-plugins-base-libs-GstFFTF32.functions"></a><h2>Functions</h2> 36<div class="informaltable"><table class="informaltable" width="100%" border="0"> 37<colgroup> 38<col width="150px" class="functions_return"> 39<col class="functions_name"> 40</colgroup> 41<tbody> 42<tr> 43<td class="function_type"> 44<a class="link" href="gst-plugins-base-libs-GstFFTF32.html#GstFFTF32" title="GstFFTF32"><span class="returnvalue">GstFFTF32</span></a> * 45</td> 46<td class="function_name"> 47<a class="link" href="gst-plugins-base-libs-GstFFTF32.html#gst-fft-f32-new" title="gst_fft_f32_new ()">gst_fft_f32_new</a> <span class="c_punctuation">()</span> 48</td> 49</tr> 50<tr> 51<td class="function_type"> 52<span class="returnvalue">void</span> 53</td> 54<td class="function_name"> 55<a class="link" href="gst-plugins-base-libs-GstFFTF32.html#gst-fft-f32-fft" title="gst_fft_f32_fft ()">gst_fft_f32_fft</a> <span class="c_punctuation">()</span> 56</td> 57</tr> 58<tr> 59<td class="function_type"> 60<span class="returnvalue">void</span> 61</td> 62<td class="function_name"> 63<a class="link" href="gst-plugins-base-libs-GstFFTF32.html#gst-fft-f32-inverse-fft" title="gst_fft_f32_inverse_fft ()">gst_fft_f32_inverse_fft</a> <span class="c_punctuation">()</span> 64</td> 65</tr> 66<tr> 67<td class="function_type"> 68<span class="returnvalue">void</span> 69</td> 70<td class="function_name"> 71<a class="link" href="gst-plugins-base-libs-GstFFTF32.html#gst-fft-f32-window" title="gst_fft_f32_window ()">gst_fft_f32_window</a> <span class="c_punctuation">()</span> 72</td> 73</tr> 74<tr> 75<td class="function_type"> 76<span class="returnvalue">void</span> 77</td> 78<td class="function_name"> 79<a class="link" href="gst-plugins-base-libs-GstFFTF32.html#gst-fft-f32-free" title="gst_fft_f32_free ()">gst_fft_f32_free</a> <span class="c_punctuation">()</span> 80</td> 81</tr> 82</tbody> 83</table></div> 84</div> 85<div class="refsect1"> 86<a name="gst-plugins-base-libs-GstFFTF32.other"></a><h2>Types and Values</h2> 87<div class="informaltable"><table class="informaltable" width="100%" border="0"> 88<colgroup> 89<col width="150px" class="name"> 90<col class="description"> 91</colgroup> 92<tbody> 93<tr> 94<td class="datatype_keyword"> </td> 95<td class="function_name"><a class="link" href="gst-plugins-base-libs-GstFFTF32.html#GstFFTF32" title="GstFFTF32">GstFFTF32</a></td> 96</tr> 97<tr> 98<td class="datatype_keyword">struct</td> 99<td class="function_name"><a class="link" href="gst-plugins-base-libs-GstFFTF32.html#GstFFTF32Complex" title="struct GstFFTF32Complex">GstFFTF32Complex</a></td> 100</tr> 101</tbody> 102</table></div> 103</div> 104<div class="refsect1"> 105<a name="gst-plugins-base-libs-GstFFTF32.includes"></a><h2>Includes</h2> 106<pre class="synopsis">#include <gst/fft/fft.h> 107</pre> 108</div> 109<div class="refsect1"> 110<a name="gst-plugins-base-libs-GstFFTF32.description"></a><h2>Description</h2> 111<p><a class="link" href="gst-plugins-base-libs-GstFFTF32.html#GstFFTF32" title="GstFFTF32"><span class="type">GstFFTF32</span></a> provides a FFT implementation and related functions for 11232 bit float samples. To use this call <a class="link" href="gst-plugins-base-libs-GstFFTF32.html#gst-fft-f32-new" title="gst_fft_f32_new ()"><code class="function">gst_fft_f32_new()</code></a> for 113allocating a <a class="link" href="gst-plugins-base-libs-GstFFTF32.html#GstFFTF32" title="GstFFTF32"><span class="type">GstFFTF32</span></a> instance with the appropriate parameters and 114then call <a class="link" href="gst-plugins-base-libs-GstFFTF32.html#gst-fft-f32-fft" title="gst_fft_f32_fft ()"><code class="function">gst_fft_f32_fft()</code></a> or <a class="link" href="gst-plugins-base-libs-GstFFTF32.html#gst-fft-f32-inverse-fft" title="gst_fft_f32_inverse_fft ()"><code class="function">gst_fft_f32_inverse_fft()</code></a> to perform the 115FFT or inverse FFT on a buffer of samples.</p> 116<p>After use free the <a class="link" href="gst-plugins-base-libs-GstFFTF32.html#GstFFTF32" title="GstFFTF32"><span class="type">GstFFTF32</span></a> instance with <a class="link" href="gst-plugins-base-libs-GstFFTF32.html#gst-fft-f32-free" title="gst_fft_f32_free ()"><code class="function">gst_fft_f32_free()</code></a>.</p> 117<p>For the best performance use <a class="link" href="gst-plugins-base-libs-GstFFT.html#gst-fft-next-fast-length" title="gst_fft_next_fast_length ()"><code class="function">gst_fft_next_fast_length()</code></a> to get a 118number that is entirely a product of 2, 3 and 5 and use this as the 119<em class="parameter"><code>len</code></em> 120 parameter for <a class="link" href="gst-plugins-base-libs-GstFFTF32.html#gst-fft-f32-new" title="gst_fft_f32_new ()"><code class="function">gst_fft_f32_new()</code></a>.</p> 121<p>The <em class="parameter"><code>len</code></em> 122 parameter specifies the number of samples in the time domain that 123will be processed or generated. The number of samples in the frequency domain 124is <em class="parameter"><code>len</code></em> 125/2 + 1. To get n samples in the frequency domain use 2*n - 2 as <em class="parameter"><code>len</code></em> 126.</p> 127<p>Before performing the FFT on time domain data it usually makes sense 128to apply a window function to it. For this <a class="link" href="gst-plugins-base-libs-GstFFTF32.html#gst-fft-f32-window" title="gst_fft_f32_window ()"><code class="function">gst_fft_f32_window()</code></a> can comfortably 129be used.</p> 130<p>Be aware, that you can't simply run <a class="link" href="gst-plugins-base-libs-GstFFTF32.html#gst-fft-f32-inverse-fft" title="gst_fft_f32_inverse_fft ()"><code class="function">gst_fft_f32_inverse_fft()</code></a> on the 131resulting frequency data of <a class="link" href="gst-plugins-base-libs-GstFFTF32.html#gst-fft-f32-fft" title="gst_fft_f32_fft ()"><code class="function">gst_fft_f32_fft()</code></a> to get the original data back. 132The relation between them is iFFT (FFT (x)) = x * nfft where nfft is the 133length of the FFT. This also has to be taken into account when calculation 134the magnitude of the frequency data.</p> 135</div> 136<div class="refsect1"> 137<a name="gst-plugins-base-libs-GstFFTF32.functions_details"></a><h2>Functions</h2> 138<div class="refsect2"> 139<a name="gst-fft-f32-new"></a><h3>gst_fft_f32_new ()</h3> 140<pre class="programlisting"><a class="link" href="gst-plugins-base-libs-GstFFTF32.html#GstFFTF32" title="GstFFTF32"><span class="returnvalue">GstFFTF32</span></a> * 141gst_fft_f32_new (<em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> len</code></em>, 142 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> inverse</code></em>);</pre> 143<p>This returns a new <a class="link" href="gst-plugins-base-libs-GstFFTF32.html#GstFFTF32" title="GstFFTF32"><span class="type">GstFFTF32</span></a> instance with the given parameters. It makes 144sense to keep one instance for several calls for speed reasons.</p> 145<p><em class="parameter"><code>len</code></em> 146 must be even and to get the best performance a product of 1472, 3 and 5. To get the next number with this characteristics use 148<a class="link" href="gst-plugins-base-libs-GstFFT.html#gst-fft-next-fast-length" title="gst_fft_next_fast_length ()"><code class="function">gst_fft_next_fast_length()</code></a>.</p> 149<p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p> 150<div class="refsect3"> 151<a name="gst-fft-f32-new.parameters"></a><h4>Parameters</h4> 152<div class="informaltable"><table class="informaltable" width="100%" border="0"> 153<colgroup> 154<col width="150px" class="parameters_name"> 155<col class="parameters_description"> 156<col width="200px" class="parameters_annotations"> 157</colgroup> 158<tbody> 159<tr> 160<td class="parameter_name"><p>len</p></td> 161<td class="parameter_description"><p>Length of the FFT in the time domain</p></td> 162<td class="parameter_annotations"> </td> 163</tr> 164<tr> 165<td class="parameter_name"><p>inverse</p></td> 166<td class="parameter_description"><p><a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the <a class="link" href="gst-plugins-base-libs-GstFFTF32.html#GstFFTF32" title="GstFFTF32"><span class="type">GstFFTF32</span></a> instance should be used for the inverse FFT</p></td> 167<td class="parameter_annotations"> </td> 168</tr> 169</tbody> 170</table></div> 171</div> 172<div class="refsect3"> 173<a name="gst-fft-f32-new.returns"></a><h4>Returns</h4> 174<p> a new <a class="link" href="gst-plugins-base-libs-GstFFTF32.html#GstFFTF32" title="GstFFTF32"><span class="type">GstFFTF32</span></a> instance.</p> 175</div> 176</div> 177<hr> 178<div class="refsect2"> 179<a name="gst-fft-f32-fft"></a><h3>gst_fft_f32_fft ()</h3> 180<pre class="programlisting"><span class="returnvalue">void</span> 181gst_fft_f32_fft (<em class="parameter"><code><a class="link" href="gst-plugins-base-libs-GstFFTF32.html#GstFFTF32" title="GstFFTF32"><span class="type">GstFFTF32</span></a> *self</code></em>, 182 <em class="parameter"><code>const <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gfloat"><span class="type">gfloat</span></a> *timedata</code></em>, 183 <em class="parameter"><code><a class="link" href="gst-plugins-base-libs-GstFFTF32.html#GstFFTF32Complex" title="struct GstFFTF32Complex"><span class="type">GstFFTF32Complex</span></a> *freqdata</code></em>);</pre> 184<p>This performs the FFT on <em class="parameter"><code>timedata</code></em> 185 and puts the result in <em class="parameter"><code>freqdata</code></em> 186.</p> 187<p><em class="parameter"><code>timedata</code></em> 188 must have as many samples as specified with the <em class="parameter"><code>len</code></em> 189 parameter while 190allocating the <a class="link" href="gst-plugins-base-libs-GstFFTF32.html#GstFFTF32" title="GstFFTF32"><span class="type">GstFFTF32</span></a> instance with <a class="link" href="gst-plugins-base-libs-GstFFTF32.html#gst-fft-f32-new" title="gst_fft_f32_new ()"><code class="function">gst_fft_f32_new()</code></a>.</p> 191<p><em class="parameter"><code>freqdata</code></em> 192 must be large enough to hold <em class="parameter"><code>len</code></em> 193/2 + 1 <a class="link" href="gst-plugins-base-libs-GstFFTF32.html#GstFFTF32Complex" title="struct GstFFTF32Complex"><span class="type">GstFFTF32Complex</span></a> frequency 194domain samples.</p> 195<div class="refsect3"> 196<a name="gst-fft-f32-fft.parameters"></a><h4>Parameters</h4> 197<div class="informaltable"><table class="informaltable" width="100%" border="0"> 198<colgroup> 199<col width="150px" class="parameters_name"> 200<col class="parameters_description"> 201<col width="200px" class="parameters_annotations"> 202</colgroup> 203<tbody> 204<tr> 205<td class="parameter_name"><p>self</p></td> 206<td class="parameter_description"><p><a class="link" href="gst-plugins-base-libs-GstFFTF32.html#GstFFTF32" title="GstFFTF32"><span class="type">GstFFTF32</span></a> instance for this call</p></td> 207<td class="parameter_annotations"> </td> 208</tr> 209<tr> 210<td class="parameter_name"><p>timedata</p></td> 211<td class="parameter_description"><p>Buffer of the samples in the time domain</p></td> 212<td class="parameter_annotations"> </td> 213</tr> 214<tr> 215<td class="parameter_name"><p>freqdata</p></td> 216<td class="parameter_description"><p>Target buffer for the samples in the frequency domain</p></td> 217<td class="parameter_annotations"> </td> 218</tr> 219</tbody> 220</table></div> 221</div> 222</div> 223<hr> 224<div class="refsect2"> 225<a name="gst-fft-f32-inverse-fft"></a><h3>gst_fft_f32_inverse_fft ()</h3> 226<pre class="programlisting"><span class="returnvalue">void</span> 227gst_fft_f32_inverse_fft (<em class="parameter"><code><a class="link" href="gst-plugins-base-libs-GstFFTF32.html#GstFFTF32" title="GstFFTF32"><span class="type">GstFFTF32</span></a> *self</code></em>, 228 <em class="parameter"><code>const <a class="link" href="gst-plugins-base-libs-GstFFTF32.html#GstFFTF32Complex" title="struct GstFFTF32Complex"><span class="type">GstFFTF32Complex</span></a> *freqdata</code></em>, 229 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gfloat"><span class="type">gfloat</span></a> *timedata</code></em>);</pre> 230<p>This performs the inverse FFT on <em class="parameter"><code>freqdata</code></em> 231 and puts the result in <em class="parameter"><code>timedata</code></em> 232.</p> 233<p><em class="parameter"><code>freqdata</code></em> 234 must have <em class="parameter"><code>len</code></em> 235/2 + 1 samples, where <em class="parameter"><code>len</code></em> 236 is the parameter specified 237while allocating the <a class="link" href="gst-plugins-base-libs-GstFFTF32.html#GstFFTF32" title="GstFFTF32"><span class="type">GstFFTF32</span></a> instance with <a class="link" href="gst-plugins-base-libs-GstFFTF32.html#gst-fft-f32-new" title="gst_fft_f32_new ()"><code class="function">gst_fft_f32_new()</code></a>.</p> 238<p><em class="parameter"><code>timedata</code></em> 239 must be large enough to hold <em class="parameter"><code>len</code></em> 240 time domain samples.</p> 241<div class="refsect3"> 242<a name="gst-fft-f32-inverse-fft.parameters"></a><h4>Parameters</h4> 243<div class="informaltable"><table class="informaltable" width="100%" border="0"> 244<colgroup> 245<col width="150px" class="parameters_name"> 246<col class="parameters_description"> 247<col width="200px" class="parameters_annotations"> 248</colgroup> 249<tbody> 250<tr> 251<td class="parameter_name"><p>self</p></td> 252<td class="parameter_description"><p><a class="link" href="gst-plugins-base-libs-GstFFTF32.html#GstFFTF32" title="GstFFTF32"><span class="type">GstFFTF32</span></a> instance for this call</p></td> 253<td class="parameter_annotations"> </td> 254</tr> 255<tr> 256<td class="parameter_name"><p>freqdata</p></td> 257<td class="parameter_description"><p>Buffer of the samples in the frequency domain</p></td> 258<td class="parameter_annotations"> </td> 259</tr> 260<tr> 261<td class="parameter_name"><p>timedata</p></td> 262<td class="parameter_description"><p>Target buffer for the samples in the time domain</p></td> 263<td class="parameter_annotations"> </td> 264</tr> 265</tbody> 266</table></div> 267</div> 268</div> 269<hr> 270<div class="refsect2"> 271<a name="gst-fft-f32-window"></a><h3>gst_fft_f32_window ()</h3> 272<pre class="programlisting"><span class="returnvalue">void</span> 273gst_fft_f32_window (<em class="parameter"><code><a class="link" href="gst-plugins-base-libs-GstFFTF32.html#GstFFTF32" title="GstFFTF32"><span class="type">GstFFTF32</span></a> *self</code></em>, 274 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gfloat"><span class="type">gfloat</span></a> *timedata</code></em>, 275 <em class="parameter"><code><a class="link" href="gst-plugins-base-libs-GstFFT.html#GstFFTWindow" title="enum GstFFTWindow"><span class="type">GstFFTWindow</span></a> window</code></em>);</pre> 276<p>This calls the window function <em class="parameter"><code>window</code></em> 277 on the <em class="parameter"><code>timedata</code></em> 278 sample buffer.</p> 279<div class="refsect3"> 280<a name="gst-fft-f32-window.parameters"></a><h4>Parameters</h4> 281<div class="informaltable"><table class="informaltable" width="100%" border="0"> 282<colgroup> 283<col width="150px" class="parameters_name"> 284<col class="parameters_description"> 285<col width="200px" class="parameters_annotations"> 286</colgroup> 287<tbody> 288<tr> 289<td class="parameter_name"><p>self</p></td> 290<td class="parameter_description"><p><a class="link" href="gst-plugins-base-libs-GstFFTF32.html#GstFFTF32" title="GstFFTF32"><span class="type">GstFFTF32</span></a> instance for this call</p></td> 291<td class="parameter_annotations"> </td> 292</tr> 293<tr> 294<td class="parameter_name"><p>timedata</p></td> 295<td class="parameter_description"><p>Time domain samples</p></td> 296<td class="parameter_annotations"> </td> 297</tr> 298<tr> 299<td class="parameter_name"><p>window</p></td> 300<td class="parameter_description"><p>Window function to apply</p></td> 301<td class="parameter_annotations"> </td> 302</tr> 303</tbody> 304</table></div> 305</div> 306</div> 307<hr> 308<div class="refsect2"> 309<a name="gst-fft-f32-free"></a><h3>gst_fft_f32_free ()</h3> 310<pre class="programlisting"><span class="returnvalue">void</span> 311gst_fft_f32_free (<em class="parameter"><code><a class="link" href="gst-plugins-base-libs-GstFFTF32.html#GstFFTF32" title="GstFFTF32"><span class="type">GstFFTF32</span></a> *self</code></em>);</pre> 312<p>This frees the memory allocated for <em class="parameter"><code>self</code></em> 313.</p> 314<div class="refsect3"> 315<a name="gst-fft-f32-free.parameters"></a><h4>Parameters</h4> 316<div class="informaltable"><table class="informaltable" width="100%" border="0"> 317<colgroup> 318<col width="150px" class="parameters_name"> 319<col class="parameters_description"> 320<col width="200px" class="parameters_annotations"> 321</colgroup> 322<tbody><tr> 323<td class="parameter_name"><p>self</p></td> 324<td class="parameter_description"><p><a class="link" href="gst-plugins-base-libs-GstFFTF32.html#GstFFTF32" title="GstFFTF32"><span class="type">GstFFTF32</span></a> instance for this call</p></td> 325<td class="parameter_annotations"> </td> 326</tr></tbody> 327</table></div> 328</div> 329</div> 330</div> 331<div class="refsect1"> 332<a name="gst-plugins-base-libs-GstFFTF32.other_details"></a><h2>Types and Values</h2> 333<div class="refsect2"> 334<a name="GstFFTF32"></a><h3>GstFFTF32</h3> 335<pre class="programlisting">typedef struct _GstFFTF32 GstFFTF32;</pre> 336</div> 337<hr> 338<div class="refsect2"> 339<a name="GstFFTF32Complex"></a><h3>struct GstFFTF32Complex</h3> 340<pre class="programlisting">struct GstFFTF32Complex { 341 gfloat r; 342 gfloat i; 343}; 344</pre> 345<p>Data type for complex numbers composed of 34632 bit float.</p> 347<div class="refsect3"> 348<a name="GstFFTF32Complex.members"></a><h4>Members</h4> 349<div class="informaltable"><table class="informaltable" width="100%" border="0"> 350<colgroup> 351<col width="300px" class="struct_members_name"> 352<col class="struct_members_description"> 353<col width="200px" class="struct_members_annotations"> 354</colgroup> 355<tbody> 356<tr> 357<td class="struct_member_name"><p><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gfloat"><span class="type">gfloat</span></a> <em class="structfield"><code><a name="GstFFTF32Complex.r"></a>r</code></em>;</p></td> 358<td class="struct_member_description"><p>Real part</p></td> 359<td class="struct_member_annotations"> </td> 360</tr> 361<tr> 362<td class="struct_member_name"><p><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gfloat"><span class="type">gfloat</span></a> <em class="structfield"><code><a name="GstFFTF32Complex.i"></a>i</code></em>;</p></td> 363<td class="struct_member_description"><p>Imaginary part</p></td> 364<td class="struct_member_annotations"> </td> 365</tr> 366</tbody> 367</table></div> 368</div> 369</div> 370</div> 371</div> 372<div class="footer"> 373<hr>Generated by GTK-Doc V1.28</div> 374</body> 375</html>