Rockbox

Tasklist

FS#12871 - rockbox play ogg_vorbis data has noise when enable the macro CPU_ARM

Attached to Project: Rockbox
Opened by ligd (ligd_user) - Thursday, 13 June 2013, 09:30 GMT
Last edited by MichaelGiacomelli (saratoga) - Sunday, 12 January 2014, 21:10 GMT
Task Type Bugs
Category Codecs
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Release 3.12
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

in the file fft-ffmpeg_arm.h
in the function XNPROD31_R, use the t5 and t6 as input data while ouput data,
there maybe has a error.

static inline FFTComplex* TRANSFORM_W01( FFTComplex* z, int n, const FFTSample* w )
{
register FFTSample t1,t2 asm("r5"),t5 asm("r6"),t6 asm("r7"),r_re asm("r8"),r_im asm("r9");

/* load wre,wim into t5,t6 */
asm volatile( "ldmia %[w], {%[wre], %[wim]}\n\t":[wre] "=r" (t5), [wim] "=r" (t6):[w] "r" (w));
z += n*2; /* z[o2] -- 2n * 2 since complex numbers */
asm volatile( "ldmia %[my_z], {%[r_re],%[r_im]}\n\t":[r_re] "=r" (r_re), [r_im] "=r" (r_im):[my_z] "r" (z));
XPROD31_R(r_re, r_im, t5 /*wre*/, t6 /*wim*/, t1,t2);

z += n; /* z[o3] */
asm volatile( "ldmia %[my_z], {%[r_re],%[r_im]}\n\t":[r_re] "=r" (r_re), [r_im] "=r" (r_im):[my_z] "r" (z));
XNPROD31_R(r_re, r_im, t5 /*wre*/, t6 /*wim*/, t5,t6);
}

I suggest use like this, maybe a butter way, but I am not sure:
static inline FFTComplex* TRANSFORM_W01( FFTComplex* z, int n, const FFTSample* w )
{
register FFTSample t1, t3, t4, t2 asm("r5"),t5 asm("r6"),t6 asm("r7"),r_re asm("r8"),r_im asm("r9");

/* load wre,wim into t5,t6 */
asm volatile( "ldmia %[w], {%[wre], %[wim]}\n\t":[wre] "=r" (t3), [wim] "=r" (t4):[w] "r" (w));
z += n*2; /* z[o2] -- 2n * 2 since complex numbers */
asm volatile( "ldmia %[my_z], {%[r_re],%[r_im]}\n\t":[r_re] "=r" (r_re), [r_im] "=r" (r_im):[my_z] "r" (z));
XPROD31_R(r_re, r_im, t3 /*wre*/, t4 /*wim*/, t1,t2);

z += n; /* z[o3] */
asm volatile( "ldmia %[my_z], {%[r_re],%[r_im]}\n\t":[r_re] "=r" (r_re), [r_im] "=r" (r_im):[my_z] "r" (z));
XNPROD31_R(r_re, r_im, t3 /*wre*/, t4 /*wim*/, t5,t6);
}
This task depends upon

Closed by  MichaelGiacomelli (saratoga)
Sunday, 12 January 2014, 21:10 GMT
Reason for closing:  Not a Bug
Comment by MichaelGiacomelli (saratoga) - Thursday, 13 June 2013, 15:49 GMT
Which device are you testing on?
Comment by MichaelGiacomelli (saratoga) - Thursday, 13 June 2013, 16:36 GMT
I just tested x86 and AMSv2 with ASM enabled and the output is identical to 16 bits precision for our vorbis_128k track.

Is this problem specific to one track?
Is it specific to one device?
Have you made any changes to the source code?

Also, if possible please use diff to post code changes. Its very difficult to parse assembly changes otherwise :)


Comment by ligd (ligd_user) - Friday, 14 June 2013, 02:04 GMT
1. I merged all the code which related with vorbis decoding to my project;
2. If I don't include the file "fft-ffmpeg_arm.h" in mdct.c, then the vorbis will use C code to decoding vorbis, it can work normal;
3. Otherwise, I include the file "fft-ffmpeg_arm.h" in mdct.c, the vorbis will use assembly, it will has noise;
4. My project is work on arm926EJ-S single core, compiler is arm-none-eabi-gcc;

The attached file is the diff.

Location:
file: fft-ffmpeg_arm.h
function: TRANSFORM_W01
   1.txt (0.7 KiB)
Comment by MichaelGiacomelli (saratoga) - Friday, 14 June 2013, 02:12 GMT
So about a million different things could be wrong :)

First verify that your compiler can successfully compile our version of the code by using it to compile our codeclib's command line interface:

configure > (pick any target) > (W) Warble Codec Tool
make

Assuming the binary you get decodes correctly, I guess you'll have to go through your changes one by one and try to figure out what is wrong.
Comment by ligd (ligd_user) - Friday, 14 June 2013, 10:51 GMT
Maybe this problem is caused by compiler, I'm working on it.
Comment by ligd (ligd_user) - Friday, 21 June 2013, 03:38 GMT
I have find the root_cause, it is my platform's error, cause the embedded assemble error when compile, please close this bug.
Comment by MichaelGiacomelli (saratoga) - Friday, 21 June 2013, 15:09 GMT
What was the problem with your platform? Is it something we could have prevented?

Loading...