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.

TMS320C6748: Optimization of Complex

Part Number: TMS320C6748

In my program there is such a piece of code, after my test, it is particularly time-consuming, how should I optimize it?

a[j] = cabsf ( _FCmulcc(data[j], conjf( data[j+1280] ) ) )

cabsf ,_FCmullcc and conjf  are  functions in complex.h.(The compiler I used is 7.4.4)

  • How time-consuming is it? How much time? How are you measuring it?

    How many cycles do you expect this line to take?

    To figure out what you need to optimize, try measuring each of the three function calls separately. You can re-write the code so the three calls are done sequentially instead of on a single line, but accomplish the same result.

    What is this line supposed to do mathematically? I am not familiar with any of these function names, although I have a guess for cabsf.
  • I calculate the number of instruction cycles.I want it to be completed in the shortest possible time.

    Cabsf is used to obtain the modulus of a complex number, _FCmulcc is used to obtain the product of two complex numbers, and conjf is used to obtain the complex conjugate

    for(j=0;j<1536;++j)

    {

          a[j] = cabsf ( _FCmulcc(data[j], conjf( data[j+1280] ) ) )

    }

  • Hello RandyP,
    Could you please clarify, whether those complex manipulation routines as conjf(), _FCmulcc() are implemented as function calls? If so, there is very little room for optimization, as calls break loop pipelining.
    Instead I would propose to stop using complex data types and use have re/im values interleaved in the buffer. Then one have to write his own implementation of complex arithmetic, like instead of complex multiplication of (a+jb) by (c+jd) one have to write y[0] = a*c - b*d; y[1] = ad + bc; And there is a chance this kind of code could be pipelined. Is that reasonable?