Document toolboxDocument toolbox

(8.D.2.1) Log2Fract32

Overview

Computes the log base 2 using a fast polynomial approximation.

Discussion

Computes the log base 2 using a polynomial approximation. The input format is Q9.23 as well as the output (values in the range +/- 256) The function computes the absolute value of the input before computing the log. The output will always be in the ranage [8 -23]. The results are accurate to within 1.326392691030e-3 (in Q9.23).

For negative inputs the function takes the absolute value. An input of 0 returns -256.

Type Definition

typedef struct _ModuleLog2Fract32 { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure } ModuleLog2Fract32Class;

Pins

Input Pins

Name: in

Description: Input signal

Data type: fract32

Channel range: Unrestricted

Block size range: Unrestricted

Sample rate range: Unrestricted

Complex support: Real

Output Pins

Name: out

Description: Output signal

Data type: fract32

MATLAB Usage

File Name: log2_fract32_module.m

M = log2_fract32_module(NAME) Creates an Audio Weaver module that computes the log base 2 using a polynomial approximation. The input is in Q9.23 format and the output in Q9.23. Arguments: NAME - name of the module.

Â