Lame optimization questions

Erik Friesen <[email protected]> Mon, 28 Aug 2017 09:20:09 -0400
Newsgroups gmane.comp.audio.mp3.lame
Message-ID <CAEuupivapdu89suqycjSdvTXSmFTBQoqrFVezWgp4BiUjNFuhQ@mail.gmail.com>
So I got LAME running on my MZ DA series pic32(200mhz w fpu, 32mb
ddr), with dissapointing results.  With a mono channel at 44.1khz
encoding is quite slow, calculated to around 200% real time.

For a 7680 size input, cycles are around 50,000,000.

Profiling results are:
CYCLES 62275    : snd_pcm_read 7680
CYCLES 241      : @lame_encode_buffer_template
CYCLES 407477   : lame_copy_inbuffer
CYCLES 569180   : Stage 1: vbrpsy_attack_detection
CYCLES 96       : Stage 1: vbrpsy_compute_block_type
CYCLES 1076469  : Stage 1: LONG BLOCK CASE
CYCLES 996      : Stage 1: SHORT BLOCK CASE
CYCLES 4367     : Stage 1: short block pre-echo control
CYCLES 89       : Stage 1: vbrpsy_apply_block_type
CYCLES 560029   : Stage 1: vbrpsy_attack_detection
CYCLES 18       : Stage 1: vbrpsy_compute_block_type
CYCLES 1075629  : Stage 1: LONG BLOCK CASE
CYCLES 757      : Stage 1: SHORT BLOCK CASE
CYCLES 4225     : Stage 1: short block pre-echo control
CYCLES 54       : Stage 1: vbrpsy_apply_block_type
CYCLES 10304    : Stage 1: psychoacoustic model
CYCLES 1669433  : @Stage 2: MDCT
CYCLES 129      : @Stage 3: MS/LR decision
CYCLES 2240782  : @Stage 4: quantization loop
CYCLES 29909    : @Stage 5: bitstream formatting


The shine encoder is around %10 real time.

The same LAME code on the previous hardware(i.mx6 single core on linux
at 1ghz) runs less than 10% CPU. My shoot from the hip calcs say
200mhz without OS should at least be capable of 1/5 performance.

The questions I have:

1. Is there something obvious I am missing on this all?
2. What would be involved realistically to convert LAME to fixed point?
3. If fixed point, would 64 bit fixed point be best?
4. I see shine and lame have calc_xmin. Could the psymodel of lame be
shoehorned to shine?(I know, this isn't shine, but it obviously has
the same author)

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot