AAX SDK  2.4.1
Avid Audio Extensions Development Kit
AAX_FastInterpolatedTableLookup.h
Go to the documentation of this file.
1 /*================================================================================================*/
2 /*
3  * Copyright 2013-2015, 2019 by Avid Technology, Inc.
4  * All rights reserved.
5  *
6  * CONFIDENTIAL: This document contains confidential information. Do not
7  * read or examine this document unless you are an Avid Technology employee
8  * or have signed a non-disclosure agreement with Avid Technology which protects
9  * the confidentiality of this document. DO NOT DISCLOSE ANY INFORMATION
10  * CONTAINED IN THIS DOCUMENT TO ANY THIRD-PARTY WITHOUT THE PRIOR WRITTEN CONSENT
11  * OF Avid Technology, INC.
12  */
13 
21 /*================================================================================================*/
22 #pragma once
23 
24 #ifndef AAX_FASTINTERPOLATEDTABLELOOKUP_H
25 #define AAX_FASTINTERPOLATEDTABLELOOKUP_H
26 
27 #include "AAX_Quantize.h"
28 
29 //==============================================================================
30 //
31 // NOTE:
32 // Construtors and destructors are not call because state and coefficientrs blocks
33 // are not allocated as classes
34 //
35 
36 #include AAX_ALIGN_FILE_BEGIN
37 #include AAX_ALIGN_FILE_ALG
38 #include AAX_ALIGN_FILE_END
39 
40 template<class TFLOAT, class DFLOAT>
42 {
43 public:
44 
59  void SetParameters(int iTableSize, TFLOAT iMin=0.0, TFLOAT iMax=1.0, int iNumTables=1)
60  {
61  mTableSizeM1=(TFLOAT)(iTableSize-1);
62  mTableSize=(TFLOAT)iTableSize;
63  mIntTableSizeM1=iTableSize-1;
64  mMin=iMin;
65  mMax=iMax;
66  mMaxMinusMin=iMax-iMin;
67  mTableSizeM1DivMaxMinusMin=TFLOAT(iTableSize-1)/(iMax-iMin); //Two divides??
68  mTableSizeDivMaxMinusMin=TFLOAT(iTableSize)/(iMax-iMin);
69  mNumTables=iNumTables;
70  }
71 
85  DFLOAT DoTableLookupExtraFast(const TFLOAT* const iTable, DFLOAT iValue) const;
86  void DoTableLookupExtraFastMulti(const TFLOAT* iTable, DFLOAT iValue, DFLOAT* oValues) const;
87 
88  void DoTableLookupExtraFast(const TFLOAT* const iTable, const TFLOAT* const inpBuf, DFLOAT* const outBuf, int blockSize);
89 
90  TFLOAT GetMin() { return mMin; };
91  TFLOAT GetMaxMinusMin() { return mMaxMinusMin; };
92 
93 private:
94 
95  TFLOAT mTableSizeM1;
96  int mIntTableSizeM1;
97  TFLOAT mTableSizeM1DivMaxMinusMin;
98  TFLOAT mMin;
99  TFLOAT mMax;
100  TFLOAT mMaxMinusMin;
101  TFLOAT mTableSize;
102  TFLOAT mTableSizeDivMaxMinusMin;
103  int mNumTables; //This is used for multi-element lookups
104 };
105 
106 #include AAX_ALIGN_FILE_BEGIN
107 #include AAX_ALIGN_FILE_RESET
108 #include AAX_ALIGN_FILE_END
109 
110 // Template implementation
112 
113 #endif // AAX_FASTINTERPOLATEDTABLELOOKUP_H
Quantization utilities.
Definition: AAX_FastInterpolatedTableLookup.h:42
void DoTableLookupExtraFastMulti(const TFLOAT *iTable, DFLOAT iValue, DFLOAT *oValues) const
Definition: AAX_FastInterpolatedTableLookup.hpp:42
void SetParameters(int iTableSize, TFLOAT iMin=0.0, TFLOAT iMax=1.0, int iNumTables=1)
Set the table lookup parameters.
Definition: AAX_FastInterpolatedTableLookup.h:59
TFLOAT GetMaxMinusMin()
Definition: AAX_FastInterpolatedTableLookup.h:91
DFLOAT DoTableLookupExtraFast(const TFLOAT *const iTable, DFLOAT iValue) const
Perform an extra fast table lookup :)
Definition: AAX_FastInterpolatedTableLookup.hpp:23
TFLOAT GetMin()
Definition: AAX_FastInterpolatedTableLookup.h:90