?? image_wave_horz.c
字號:
void IMG_wave_horz
(
const short *restrict in_data, // Row of input pixels //
const short *restrict qmf, // Low-pass QMF filter //
const short *restrict mqmf, // High-pass QMF filter //
short *restrict out_data, // Row of output data //
int cols // Length of input. //
);
{
int i, res, iters;
int j, sum, prod;
short *xptr = in_data;
short *yptr = out_data;
short *x_end = &in_data[cols - 1];
short xdata, hdata;
short *xstart;
short *filt_ptr;
int M = 8;
// ------------------------------------------------- //
// Set our loop trip count and starting x posn. //
// 'xstart' is used in the high-pass filter loop. //
// ------------------------------------------------- //
iters = cols;
xstart = in_data + (cols - M) + 2;
// ------------------------------------------------- //
// Low pass filter. Iterate for cols/2 iterations //
// generating cols/2 low pass sample points with //
// the low-pass quadrature mirror filter. //
// ------------------------------------------------- //
for (i = 0; i < iters; i += 2)
{
// --------------------------------------------- //
// Initialize our sum to the rounding value //
// and reset our pointer. //
// --------------------------------------------- //
sum = Qr;
xptr = in_data + i;
// --------------------------------------------- //
// Iterate over the taps in our QMF. //
// --------------------------------------------- //
for (j = 0; j < M; j++)
{
xdata = *xptr++;
hdata = qmf[j];
prod = xdata * hdata;
sum += prod;
if (xptr > x_end) xptr = in_data;
}
// --------------------------------------------- //
// Adjust the Qpt of our sum and store result. //
// --------------------------------------------- //
res = (sum >> Qpt);
*out_data++ = res;
}
// ------------------------------------------------- //
// High pass filter. Iterate for cols/2 iters //
// generating cols/2 high pass sample points with //
// the high-pass quadrature mirror filter. //
// ------------------------------------------------- //
for (i = 0; i < iters ; i+=2)
{
// --------------------------------------------- //
// Initialize our sum and filter pointer. //
// --------------------------------------------- //
sum = Qr;
filt_ptr = mqmf + (M - 1);
// --------------------------------------------- //
// Set up our data pointer. This is slightly //
// more complicated due to how the data wraps //
// around the edge of the buffer. //
// --------------------------------------------- //
xptr = xstart;
xstart += 2;
if (xstart > x_end) xstart = in_data;
// --------------------------------------------- //
// Iterate over the taps in our QMF. //
// --------------------------------------------- //
for ( j = 0; j < M; j++)
{
xdata = *xptr++;
hdata = *filt_ptr--;
prod = xdata * hdata;
if (xptr > x_end) xptr = in_data;
sum += prod;
}
// --------------------------------------------- //
// Adjust the Qpt of our sum and store result. //
// --------------------------------------------- //
res = (sum >> Qpt);
*out_data++ = res;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -