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.

float variable value in source code differ from memory view



Dear All,

I am trying to run MELP code on DSK 6713 ( processing a buffer of recorded speech of about 6 seconds duration),

and I noticed something weird, that the codebook for vector quantization of e.g Fourier magnitudes in the code is as:

  float fsvq_cb[2560]={

0.822998, 1.496297, 0.584847, 1.313507, 0.846008, ..... };

whereas when I view it in memory using 32-Bit Floating Point format it is as follows:

0.9507092

1.6661

0.6152163

1.285847

0.7630396

....

which are approximately close to each other, can you explain why this difference, because for other initialized variables such as window coefficients the numbers are the same in the code and the memory view.

  • Sarah,

    Welcome to the TI E2E forum. I hope you will find many good answers here and in the TI.com documents and in the TI Wiki Pages. Be sure to search those for helpful information and to browse for the questions others may have asked on similar topics.

    When I pasted your fsvq_cb declaration into a test C file, built it, loaded it into the C6713 simulator, and ran it, I found the exact same values in the memory browser window and the variables display as are in the source file. I did not see the distorted values that you report above.

    My guess is that you have a resolution issue, such as using a 16-bit float instead of a 32-bit float. But that does not completely make sense based on what you are seeing. This probably needs to be considered in the Compiler Forum, where this will be moved.

    Regards,
    RandyP

  • Dear RandyP,

    Thank you for your reply, I tried to move the whole code book (fsvq_cb variable) from the file fsvq_cb.c to the file containing the main function and I could get correct values that are identical at the code and the memory view! Any suggestions explaining why when it was on a separate file the values differ ?

    Regards,

    Sarah

  • Those values are very wrong.  For instance, the displayed value for the first array entry is more than 15% in error.

    I can't guess at what the problem is; in particular, I can't imagine why moving it between files helped.  If you could post a reproducible test case, I could investigate this.  Otherwise, I'll need you to investigate it.

    Could you post a screenshot of the memory window displaying the first few entries of fsvq_cb in the "bad" case, showing the memory formatted as hexadecimal integers?

    What version of the C6000 compiler are you using (this is not the same as the CCS version)?

    What command-line options are you using?  In particular, is this big- or little-endian?

  • Hi,

    Thank you for your reply, the screen shot is shown above. Regarding CCS I am using v3.1.0 and the compiler version is 5.1.0. Little Endian is used.

    I am sorry I want to correct that in the main file I made a copy ( fsvq_cb2[2560] ) not moved the original variable and this resulted in identical values, but moving it results in distorted values too.  When I modified the code to use fsvq_cb2 and leave fsvq_cb as an unused variable, the distortion is now in fsvq_cb2 and fsvq_cb is correct. What confuses me is that I make a break point and view the memory just after the program starts, so that the initialized variables should be untouched, beside I have not made any modifications to the core of MELP.

    Regards

  • I cannot reproduce the problem.

    Your screenshot verifies that the memory actually contains the bad values CCS claims that it contains, so I think that rules out a CCS memory window bug.

    What exact command-line options are you using?

    To proceed further, I'm going to need a reproducable test case.  Please post the first few lines of the defintion of fsvq_cb, exactly as it appears in the source code.  Please cut-and-paste, don't re-type it.