AAC Decoder Optimizations

BuddyCasino
Posts: 262
Joined: Sun Jun 19, 2016 12:00 am

AAC Decoder Optimizations

Postby BuddyCasino » Fri May 12, 2017 5:04 pm

I've got the Fraunhofer fdk-aac decoder running, and its fine for LC but too slow for AAC+ (SBR etc.), even on 240MHz.

There are some optimizations for other archs, but not xtensa:
https://github.com/mstorsjo/fdk-aac/tre ... DK/include

Has anyone done anything in that direction? Which of the architectures with optimizations enabled (aarch64, arm, mips, ppc, x86) is most similar to xtensa?

Also, most of the interesting opcodes seem to be optional - is there a document that tells me which ones are implemented in the ESP32?

EDIT: the ISA options are listed here: /esp-idf/components/esp32/include/xtensa/config/core-isa.h
Will check out the MUL32 and DIV32 opcodes (sadly no HIFI DSP extensions).

Edit 2: looks like two functions is all it takes. This is x86, any takers?

Code: Select all

inline INT fixmul_DD (INT a, const INT b)
{
  INT result;

  asm( "imul %2;\n"
       "shl $1, %0;\n"
            : "=d"(result), "+a"(a)
            : "r"(b) );

  return result;
}


inline INT fixmuldiv2_DD (INT a, const INT b)
{
  INT result;

  asm ( "imul %2;"
             : "=d"(result), "+a"(a)
             : "r"(b) );

  return result;
}

BuddyCasino
Posts: 262
Joined: Sun Jun 19, 2016 12:00 am

Re: AAC Decoder Optimizations

Postby BuddyCasino » Sat May 13, 2017 12:15 am

Everything has to be done by myself. ^_^
Added some assembly optimizations, better but still not fast enough.

Anyone knows how to use the pre-defined intrinsics in /esp32/include/xtensa/tie/*.h? I get a linker error when trying to use them. :-/

BuddyCasino
Posts: 262
Joined: Sun Jun 19, 2016 12:00 am

Re: AAC Decoder Optimizations

Postby BuddyCasino » Sat May 13, 2017 10:48 am

Guess I'll just continue talking to myself. AAC+ works now, but it requires a much larger DMA buffer that matches the 4096 byte buffer from the decoder. Optimizations would therefore still be highly welcome.

ESP_igrr
Posts: 1658
Joined: Tue Dec 01, 2015 8:37 am

Re: AAC Decoder Optimizations

Postby ESP_igrr » Sat May 13, 2017 3:36 pm

Regarding TIEs: these don't work with GCC compiler. Alternative is to use inline assembly.

BuddyCasino
Posts: 262
Joined: Sun Jun 19, 2016 12:00 am

Re: AAC Decoder Optimizations

Postby BuddyCasino » Sat May 13, 2017 3:53 pm

Ok, too bad. At least I learned some assembly along the way. Still can't believe that really worked.

Who is online

Users browsing this forum: Google [Bot] and 34 guests