DSP卷積演算法

2021-08-07 20:56:08 字數 3389 閱讀 5053

卷積和(簡稱卷積)是訊號處理中常用的演算法之一。數字卷積運算通常採用兩種方法:線性卷積和圓卷積。為了能使卷積運算在c54x系列dsp上的實現方法,首先要對數字卷積的基本概念作深入了解。使大家從根本上掌握卷積的實現方法,我們以模擬訊號的卷積和數碼訊號的卷積為主,以及他們在c54x系列dsp上的實現方法。

1.卷積的基本原理和公式

卷積和:y(n)= ∑x(m)h(n−m)=x(n)*h(n) m=−∞

對離散系統「卷積和」也是求線性時不變系統輸出響應(零狀態響應)的主要方法。

2.卷積和的運算在圖形的表示

可分為四步:

a) 翻褶 現在亞變數座標m上作出x(m)和h(m),將m=0的垂直軸為軸翻褶成h(-m)。

b) 移位 將h(-m)移位n,即得h(n-m)。當n為正整數時,右移n位。當n為負整數時,左移n位。

c) 相乘 再將h(n-m)和x(m)的相同m值的對應點值相乘。

d) 相加 把以上所有點的對應點的乘積疊加起來,即得y(n)值。

依上法,取n=……,-2,-1,0,1,2,3,……各值,即可得全部y(n)值。

設計總框圖

當程式成功執行通過後,通過**器(xds510或者xds560)與目標板連線,安裝**器驅動,然後load program到目標板,執行,利用**器提供的rtdx可實時檢視儲存器和暫存器變化。

程式流程圖

程式中函式

processing1(int *input2, int *output2)

呼叫形式:processing1(int *input2, int *output2)

引數解釋:intput2、output2為兩個整型指標陣列。

返回值解釋:返回了乙個「tren」,讓主函式的while迴圈保持連續。

功能說明:對輸入的input2 buffer波形進行擷取m點,再以零點的y軸為對稱軸進行翻褶,把生成的波形上的各點的值存入以output2指標開始的一段位址空間中。

processing2(int *output2, int *output3)

呼叫形式:processing2(int *output2, int *output3)

引數解釋:output2、output3為兩個整型指標陣列。

返回值解釋:返回了乙個「tren」,讓主函式的while迴圈保持連續。

功能說明:對輸出的output2 buffer波形進行作n點移位,然後把生成的波形上的各點的值存入以output3指標開始的一段位址空間中。

processing3(int *input1,int *output2,int *output4)

呼叫形式:processing3(int *input1,int *output2,int *output4)

引數解釋:output2、output4、input1為三個整型指標陣列。

返回值解釋:返回了乙個「tren」,讓主函式的while迴圈保持連續。

功能說明:對輸入的input2 buffer波形和輸入的input1 buffer作卷積和運算,然後把生成的波形上的各點的值存入以output4指標開始的一段位址空間中。

processing4(int *input2,int *output1)

呼叫形式:processing4(int *input2,int *output1)

引數解釋:output1、input2為兩個整型指標陣列。

返回值解釋:返回了乙個「tren」,讓主函式的while迴圈保持連續。

功能說明:對輸入的input2 buffer波形擷取m點,然後把生成的波形上的各點的值存入以output1指標開始的一段位址空間中。

程式**

#include 

#include "volume.h"

int in1_buffer[bufsize];

int in2_buffer[bufsize];

int out1_buffer[bufsize];

int out2_buffer[bufsize];

int out3_buffer[bufsize];

int out4_buffer[bufsize*2];

int size = bufsize;

int ain = mingain;

int zhy=0;

int sk=64;

/* functions */

static int step1(int

*output1, int

*output2);

static int step2(int

*output2, int

*output3);

static int step3(int

*input1,int

*output2,int

*output4);

static int step4(int

*input2, int

*output1);

static void dataio1(void);

static void dataio2(void);

void main()

}static int step4(int

*input2,int

*output1)

for(;(size-m)>0;m++)

return(true);

}static int step1(int

*output1,int

*output2)

return(true);

}static int step2(int

*output2, int

*output3)

return(true);

}static int step3(int

*input1,int

*output2,int

*output4)

*output4++ = x;

y++;

}m=sk;

y=sk-1;

w=m-zhy-1;

for(;m>0;m--)

out4_buffer[w]=x;

w++;

}return(true);

} static void dataio1()

static void dataio2()

Sobel邊緣提取演算法 DSP

1 中並作sobel邊緣提取演算法。我們只對攝像頭採集的一塊資料進行sobel邊緣提取。採用一維edma傳送方式,每一次傳送採集的一行中的部分資料 dat copy 函式 在pal制式下,先把一行資料放到nmemtemp陣列中,比如我們要把從144行到432行,從180列到435列的影象進行sobe...

演算法分析 Conv卷積運算元

目錄 什麼是卷積 效能分析 conv3d signed 卷積演算法 上圖展示的是一種很簡單粗暴的卷積演算法,姑且稱之為樸素卷積演算法,演算法的形式化描述如下 輸入 f n,ci,df,df 卷積核k co,ci,dk,dk 輸出 g n,co,dg,dg 用roofline模型 鏈結 可以定義提公升...

定點dsp與浮點dsp的比較

定點運算dsp在應用中已取得了極大的成功,而且仍然是dsp應用的主體。然而,隨著對dsp處理速度與精度 儲存器容量 程式設計的靈活性和方便性要求的不斷提高 自80年代中後期以來,各dsp生產廠家陸續推出了各自的32bit浮點運算dsp。和定點運算dsp相比,浮點運算dsp具有許多優越性 浮點運算ds...