• Status Closed
  • Percent Complete
  • Task Type Patches
  • Category
  • Assigned To No-one
  • Operating System
  • Severity Low
  • Priority Very Low
  • Reported Version
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by amiconn - 2004-04-05
Last edited by amiconn - 2004-05-04

FS#2127 - Faster & smaller recording routines

This patch contains 2 changes to the recording routines:

(1) There are recorder models with different
active/inactive levels of the PR pin to request data
from the MAS. The original routines use 2 different
loops to account for that (in drain_dma_buffer() and

This patch unifies these 2 different loops by using xor
to toggle the PR pin within the loops and setting the
correct initial "inactive" value in mpeg_init(). This

- no speed gain or loss
- 178 bytes less code in total
- 102 bytes less code in IRAM

These modified C routines are used if you uncomment the
#define PREFER_C_RECORDING at the top.

(2) Optimized transfer loops in assembler. These do not
"wait at least 5 cycles before the data is read" but
always wait for the PRTW level change. That delivers:

- approx. 50% speedup (sorry I cannot measure this)
- another 32 bytes less code in total
- another 4 bytes less code in IRAM

I did a test recording of > 2 hrs at 44.1 kHz, stereo,
Q=7 and did not get any incomplete frames and no
audible glitches.

The xor toggling of PR is not protected from accidental
changes by other parts of Rockbox since both Linus and
I agree that this would be too defensive coding style.

Closed by  amiconn
2004-05-04 12:13
Reason for closing:  Accepted

Ptach updated to adapt to the latest changes in mpeg.c


Available keyboard shortcuts


Task Details

Task Editing