This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Wavelet Functions in C66x IMGLIB

Other Parts Discussed in Thread: TMS320C6657

Hello,

I am trying to use the Image Library for C66x devices. Specifically, I am trying to use a wavelet function (IMG_wave_horz) on the TMS320C6657. However, in the file which contains the main function (IMG_wave_horz_d.c), I try to output the filter coefficients (in the array qmf), and I get random values. This means that I have to set the coefficients myself, right? But the documentation says that the functions uses a D4 wavelet with four vanishing moments. I thought that four vanishing moments implies D8--so which wavelet should I use? Will all the array elements have values, or will half of the array elements be zero (since D4 has only four coefficients)?

My second question relates to the source code. I looked through all the files, but could not find where IMG_wave_horz is actually defined, though I did find the declaration. Where can I look at the function's internals?

Thanks,

Muhammad Ismail Khan

  • Also, I noticed that the filter arrays are of type short. But don't they need to be floating-point values?? Thanks a lot!
  • Moved this thread over keystone forum for appropriate response. Thank you for your patience.
  • Indeed you are right.  When I run the test code (IMG_wave_horz_d.c) I noticed that the coefficient qmf and mqmf are all set to zero. I will submit a request to remedy it to engineering

    Meanwhile here is the description of the function and how to use it from the release documentation. See if this help you

    Best Regards

    Ran

    void  IMG_wave_horz (short *iptr, short *qmf, short *filter, short *optr, int ish_x_dim)

    Function Documentation

    void IMG_wave_horz ( short *  iptr,
    short *  qmf,
    short *  filter,
    short *  optr,
    int  ish_x_dim  
    )

    Description:
    This kernel performs a 1D Periodic Orthogonal Wavelet decomposition. This also performs athe row decomposition in a 2D wavelet transform. An in put signal x[n] is first low pass and high pass filterd and decimated by two. This results in a reference signal r1[n] which is the decimated output obtained by dropping the odd samples of the low pass filtered output and a detail signal d[n] obtained by dropping the odd samples of the high-pass output. A circular convolution algorithm is implemented and hence the wavelet transform is periodic. The reference signal and the detail signal are half the size of the original signal. The reference signal may then be iterated again to perform another scale of multi-resolution analysis.
    Parameters:
    iptr  Input row of data
    qmf  Qmf filter-bank for Low-Pass
    filter  Mirror qmf filter bank for High-pass
    optr  Output row of detailed/reference decimated outputs
    ish_x_dim  Width of the input row
    Algorithm:
    The main idea behind the optimized C code is to issue one set of reads to the x array and to perform low-pass and high pass filtering together and to perfrom the filtering operations together to maximize the number of multiplies. The last 6 elements of the low-pass filter and the first 6 elements of the high pass filter use the same input This is used to appropraitely change the output pointer to the low pass filter after 6 iterations. However for the first six iterations pointer wrap-around can occurr and hence this creates a dependency. Pre-reading those 6 values outside the array prevents the checks that introduce this dependency. In addtion the input data is read as word wide quantities and the low-pass and high-pass filter coefficients are stored in registers allowing for the input loop to be completely unrolled. Thus the intrinsic C code has only one loop. A predication register is used to reset the low-pass output pointer after three iterations. The merging of the loops in this fashion allows for the maximum number of multiplies with the minimum number of reads.
    Assumptions:
    • This kernel places no restrictions on the alignment of its input
    Implementation Notes:
    • This kernel uses the Daubechies D4 filter bank for analysis with 4 vansishing moments. Hence the length of the analyzing low-pass and high pass filters is 8
    • The optimized kernel should not have any bank conflicts
    • This code is compatible with C66x processors
    Benchmarks:
    See IMGLIB_Test_Report.html for cycle and memory information.
  • Thanks a lot Ran! Do you know how long it will take to remedy the function? I ask because I am trying to use it for my senior design project, which is due in two weeks. I need to do Daubechies wavelet decomposition on a digital voltage signal. Should I write my own code or can I continue relying on the library function?

    Ismail

  • It will take time. I added it to the list of things to do.

    Please develop your own code. Look at our source as a starting point

    Regards

    Ran
  • And I think that you can close the thread
  • I understand why the coefficients are not set to any values. The function is is not restricted to Daubechies D4--it is supposed to accept multiple wavelets from the Daubechies family. Zeros are placed on unused array elements in the coefficient array.

    The documentation says that it can take a Daubechies D4 with four vanishing moments. But D4 has two vanishing moments, while D8 has four. There is room for eight coefficients. So what is the Daubechies wavelet with the highest index number (D4 or D8) that can be inputted to the function?

    Thanks.