|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectat.dms.kjc.sir.EmptyStreamVisitor
at.dms.kjc.sir.linear.LinearReplacer
at.dms.kjc.sir.linear.frequency.FrequencyReplacer
at.dms.kjc.sir.linear.frequency.LEETFrequencyReplacer
public class LEETFrequencyReplacer
Replaces linear filters of sufficient length with a conversion into the frequency
domain, multiplication, and convert the product back into the time domain.
In so doing, this also increases the peek, pop and push rates to take advantage of
the frequency transformation.
$Id: LEETFrequencyReplacer.java,v 1.25 2006/06/14 20:36:19 thies Exp $
Field Summary | |
---|---|
static boolean |
didTransform
Indicates whether or not anything has been transformed to the frequency domain. |
Fields inherited from interface at.dms.kjc.Constants |
---|
CMP_VERSION, JAV_CLASS, JAV_CLONE, JAV_CLONEABLE, JAV_CONSTRUCTOR, JAV_ERROR, JAV_EXCEPTION, JAV_INIT, JAV_LENGTH, JAV_NAME_SEPARATOR, JAV_OBJECT, JAV_OUTER_THIS, JAV_RUNTIME, JAV_RUNTIME_EXCEPTION, JAV_STATIC_INIT, JAV_STRING, JAV_STRINGBUFFER, JAV_THIS, JAV_THROWABLE, OPE_BAND, OPE_BNOT, OPE_BOR, OPE_BSR, OPE_BXOR, OPE_EQ, OPE_GE, OPE_GT, OPE_LE, OPE_LNOT, OPE_LT, OPE_MINUS, OPE_NE, OPE_PERCENT, OPE_PLUS, OPE_POSTDEC, OPE_POSTINC, OPE_PREDEC, OPE_PREINC, OPE_SIMPLE, OPE_SL, OPE_SLASH, OPE_SR, OPE_STAR, TID_ARRAY, TID_BIT, TID_BOOLEAN, TID_BYTE, TID_CHAR, TID_CLASS, TID_DOUBLE, TID_FLOAT, TID_INT, TID_LONG, TID_SHORT, TID_VECTOR, TID_VOID, VECTOR_EMPTY |
Method Summary | |
---|---|
static int |
calculateN(int x)
calculates the appropriate size FFT to perform. |
static boolean |
canReplace(SIRStream str,
LinearAnalyzer lfa)
Returns whether or not we can replace |
float[] |
getRealArray(LinearFilterRepresentation filterRep,
int col,
int size)
Returns an array of floating point numbers that correspond to the real part of the FIR filter's weights. |
JStatement |
makeArrayAddAndPushStatement(JLocalVariable arr1,
JLocalVariable arr2,
JVariableDefinition indexVar)
makes an array push statement of the following form: push(this.arr1[indexVar] + this.arr2[indexVar]); |
JStatement |
makeArrayAssignment(JLocalVariable field,
int index,
float value)
Creates an assignment expression of the form: this.f[index]=value; |
JStatement |
makeArrayAssignment(JLocalVariable field,
JExpression index,
JExpression assignedValue,
String comment)
Creates an assignment expression of the form: this.f[index]=rhs; |
JStatement |
makeArrayAssignment(JLocalVariable field,
JVariableDefinition index,
JExpression assignedValue,
String comment)
Creates an assignment expression of the form: this.f[index]=rhs; |
JStatement |
makeArrayPushStatement(JLocalVariable arr,
JVariableDefinition indexVar)
|
JStatement |
makeConstantForLoop(JVariableDefinition loopVar,
int initVal,
int maxVal,
JStatement forBody)
Generates the a for loop of the form: |
static SIRFilter |
makeDecimatorForFrequencyNode(int freqPush,
int freqPop,
CType type)
Returns a filter that has this behavior: |
JStatement |
makeFrequencyScale(JVariableDefinition fieldToScale,
int filterSize)
An assignment to scale each element in an array by 1/size via a callout. |
JMethodDeclaration |
makeNewInit(LinearFilterRepresentation linearRep,
JVariableDefinition[] weightFields,
JVariableDefinition[] partialFields,
JVariableDefinition inputBufferField,
JVariableDefinition tempBufferField,
JVariableDefinition[] outputBufferFields,
int filterSize,
int x)
Make the init function. |
JMethodDeclaration |
makeNewWork(int functionType,
JVariableDefinition[] weightFields,
JVariableDefinition[] partialFields,
JVariableDefinition inputBufferField,
JVariableDefinition tempBufferField,
JVariableDefinition[] outputBufferFields,
int filterSize,
int x,
int N)
Make both the initWork and the work function (because they are not very different). We make a function that copies N+2(x-1) elements from the input tape into a local array, calls the library function with the local array and the weight field to calcluate the FFT of the input and the weight fields. |
JStatement |
makePartialCopyExpression(JLocalVariable field1,
JExpression index1,
JLocalVariable field2,
JExpression index2)
Makes a copy expression from one array field to another array field of the form this.field1[index1] = this.field2[index2]. |
void |
makePopStatements(JBlock body,
int n)
adds n popFloat() statements to the end of body. |
boolean |
makeReplacement(SIRStream self)
Does the actual work of replacing something that computes a convolution sum with something that does a FFT, multiply, and then IFFT. |
JStatement |
makeTimeToFrequencyConversion(JVariableDefinition fieldToConvert,
int filterSize)
An assignment to convert a field to frequency, via an external callout. |
JVariableDefinition |
makeWeightField(String name,
int arrayLength)
Create the field that we put the filter's frequency response in. |
Methods inherited from class at.dms.kjc.sir.linear.frequency.FrequencyReplacer |
---|
doReplace |
Methods inherited from class at.dms.kjc.sir.EmptyStreamVisitor |
---|
postVisitFeedbackLoop, postVisitPipeline, postVisitSplitJoin, postVisitStream, preVisitStream, visitPhasedFilter |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static boolean didTransform
Method Detail |
---|
public static boolean canReplace(SIRStream str, LinearAnalyzer lfa)
public boolean makeReplacement(SIRStream self)
makeReplacement
in class LinearReplacer
public static SIRFilter makeDecimatorForFrequencyNode(int freqPush, int freqPop, CType type)
for (int i=0; i<freqPush; i++) { push(pop()) } for (int i=0; i<freqPush; i++) { for (int j=0;j<freqPop-1; j++) { pop() } }
public JVariableDefinition makeWeightField(String name, int arrayLength)
public JMethodDeclaration makeNewInit(LinearFilterRepresentation linearRep, JVariableDefinition[] weightFields, JVariableDefinition[] partialFields, JVariableDefinition inputBufferField, JVariableDefinition tempBufferField, JVariableDefinition[] outputBufferFields, int filterSize, int x)
public JStatement makeTimeToFrequencyConversion(JVariableDefinition fieldToConvert, int filterSize)
public JStatement makeFrequencyScale(JVariableDefinition fieldToScale, int filterSize)
public JStatement makeArrayAssignment(JLocalVariable field, int index, float value)
public JStatement makeArrayAssignment(JLocalVariable field, JVariableDefinition index, JExpression assignedValue, String comment)
public JStatement makeArrayAssignment(JLocalVariable field, JExpression index, JExpression assignedValue, String comment)
public JMethodDeclaration makeNewWork(int functionType, JVariableDefinition[] weightFields, JVariableDefinition[] partialFields, JVariableDefinition inputBufferField, JVariableDefinition tempBufferField, JVariableDefinition[] outputBufferFields, int filterSize, int x, int N)
public JStatement makePartialCopyExpression(JLocalVariable field1, JExpression index1, JLocalVariable field2, JExpression index2)
public void makePopStatements(JBlock body, int n)
public JStatement makeArrayAddAndPushStatement(JLocalVariable arr1, JLocalVariable arr2, JVariableDefinition indexVar)
public JStatement makeArrayPushStatement(JLocalVariable arr, JVariableDefinition indexVar)
public float[] getRealArray(LinearFilterRepresentation filterRep, int col, int size)
public JStatement makeConstantForLoop(JVariableDefinition loopVar, int initVal, int maxVal, JStatement forBody)
for(loopVar = initVal; loopVar<maxVal; loopVar++) {loopBody}
public static int calculateN(int x)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |