xmos / lib_src

Sample rate conversion library
Other
16 stars 20 forks source link

High precision fs_rate_ratio #80

Closed shuchitak closed 1 year ago

shuchitak commented 1 year ago

Changes to save the rate ratio in 64 bits (q4.60 format). This shows a big improvement in SNR in the simulator environment indicating that provided the rates are calculated accurately, storing the ratio in 64bits improves the SNR by a lot.

Attaching plot from @andrewdewhurst's simulation, where the plot on the left has the rate ratio stored in 4.60 format while the plot on the right has it stored in 4.28 format. Channel=0, IP=44, OP=48, FDEV=1, XSIM

shuchitak commented 1 year ago

Nicely done and a useful improvement. Only thing I was wondering was why have high/low parts instead of a single 64b word?

Saving high and low separately allows for minimum change in the src code. The high can still be used for calculating things like max allowed deviation etc. From the API point of view, we expose a uint64 rate ratio, just saving it as high and low internally.