📄 img_wave_vert.h64
字号:
* The first line to begin filtering is always obtained from *
* ptr[0], the next from ptr[1] and so on. *
* *
* MEMORY NOTE *
* In order to eliminate bank conflicts succesive lines in the *
* line buffer or the pointers to these lines are seperated by *
* exactly two banks (one word) so that loads to any succesive *
* lines may be parallelized together. *
* *
* This code is a LITTLE ENDIAN implementation. *
* *
* NOTES *
* This code masks interrupts for nearly its entire duration. As a *
* result the code is interrupt tolerant but not interruptible. *
* *
* C CODE *
* void IMG_wave_vert *
* ( *
* const short *restrict *
* *restrict in_data, /* Array of row pointers */ *
* const short *restrict qmf, /* Low pass QMF filter */ *
* const short *restrict mqmf, /* High pass QMF filter */ *
* short *restrict out_ldata, /* Low pass output data */ *
* short *restrict out_hdata, /* High pass output data */ *
* int cols /* Length of rows to process */ *
* ) *
* { *
* const int M = 8; *
* int i, iters, j; *
* int sum_h, sum_l; *
* int prod_h, prod_l; *
* *
* short res_h, res_l; *
* short xdata, hdata, ldata; *
* short *filt_ptr; *
* *
* /* ------------------------------------------------------ */ *
* /* iters: variable for the # of loop iterations. */ *
* /* */ *
* /* Both the low pass and the high pass filters produce */ *
* /* 'iters' points, which is also the width of the input */ *
* /* line. The low-pass filter reads filter coefficients */ *
* /* from qmf and the high pass filter reads filter */ *
* /* coefficients from the conjugate mirror filter. In */ *
* /* addition note that the low-pass filter coefficients */ *
* /* are read in increasing order while the high pass the */ *
* /* filter coefficients are read in the opposite order. */ *
* /* ------------------------------------------------------ */ *
* iters = cols; *
* *
* /* ------------------------------------------------------ */ *
* /* Since the filters have fractional point coefficients, */ *
* /* all math is done using Q15 fixed-point arithmetic. */ *
* /* Qr is the associated round value and is set as */ *
* /* follows: */ *
* /* */ *
* /* #define Qpt 15 */ *
* /* #define Qr 16384 */ *
* /* */ *
* /* Low-Pass filter: ihptr contains 8 pointers which */ *
* /* point to input lines. The filters are placed */ *
* /* vertically and input data is read from 8 seperate */ *
* /* lines. Hence data-reuse is not possible when */ *
* /* traversing horizontally. sum_l is initialized to Qr */ *
* /* and contains the low-pass FIR sum at the end of the */ *
* /* j loop. sum_h contains the accumulator result for */ *
* /* the high pass filter in a similar fashion. M is */ *
* /* assumed to be 8 by all kernels and is # filter taps */ *
* /* for D4. */ *
* /* ------------------------------------------------------ */ *
* *
* for ( i = 0; i < iters; i++) *
* { *
* sum_l = Qr; *
* filt_ptr = qmf; *
* *
* for ( j = 0; j < M; j++) *
* { *
* xdata = in_data[j][i]; *
* ldata = *filt_ptr++; *
* prod_l = xdata * ldata; *
* sum_l += prod_l; *
* } *
* *
* res_l = (sum_l >> Qpt); *
* *out_ldata++ = res_l; *
* } *
* *
* /* ------------------------------------------------------ */ *
* /* High-Pass filter: ihptr contains 8 pointers which */ *
* /* point to input lines. The filters are placed */ *
* /* vertically and input data is read from 8 seperate */ *
* /* lines. Hence data-reuse is not possible when */ *
* /* traversing horizontally. sum_h is initialized to */ *
* /* Qr and contains the low-pass FIR sum at the end of */ *
* /* the j loop. sum_h contains the accumulator result */ *
* /* for the high pass filter in a similar fashion. M */ *
* /* is # filter taps and is assumed to be 8 by all */ *
* /* kernels. */ *
* /* ------------------------------------------------------ */ *
* for ( i = 0; i < iters; i++) *
* { *
* sum_h = Qr; *
* filt_ptr = mqmf + M - 1; *
* *
* for ( j = 0; j < M; j++) *
* { *
* xdata = in_data[j][i]; *
* hdata = *filt_ptr--; *
* prod_h = xdata * hdata; *
* sum_h += prod_h; *
* } *
* *
* res_h = (sum_h >> Qpt); *
* *out_hdata++ = res_h; *
* } *
* } *
* *
* CYCLES *
* cycles = 4*cols + 96 (both lowpass and highpass together) *
* *
* For cols = 256, cycles = 1120. *
* For cols = 512, cycles = 2144. *
* *
* CODESIZE *
* 888 bytes *
* *
* BIBLIOGRAPHY *
* Mallat, Stephane. "A Wavelet Tour of Signal Processing", pg. 309. *
* ------------------------------------------------------------------------- *
* Copyright (c) 2003 Texas Instruments, Incorporated. *
* All Rights Reserved. *
* ========================================================================= *
.global _IMG_wave_vert
* ========================================================================= *
* End of file: img_wave_vert.h64 *
* ------------------------------------------------------------------------- *
* Copyright (c) 2003 Texas Instruments, Incorporated. *
* All Rights Reserved. *
* ========================================================================= *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -