EmuCR Feeds
Email Us

EmuCR:OpenMSX OpenMSX Git (2016/08/29) is complie. OpenMSX is an open source MSX emulator which is free according to the Debian Free Software Guidelines, available under the GNU General Public License.For copyright reasons the emulator cannot be distributed with original BIOS ROM images. OpenMSX includes C-BIOS a minimal implementation of the MSX BIOS, allowing to play quite some games without the need to have an original MSX BIOS ROM image. You can also use your own BIOS ROM image if you please.

OpenMSX Git Changelog:
* [2/2] Permute rows in table
I've written a large comment block in the code, I won't repeat that here. But
very short summary:
This patch tries to reorder the rows in the resample-hq coefficient table so
that rows that are needed after each other (in time) are stored sequentially
in memory.
Like with the previous patch the effect of this patch depends both on the host
system and the emulated configuration. On a i7 system with 8MB L3 cache I
couldn't measure much difference, but on a i5 with 4MB L3 cache I got an
additional 3% speedup (on top of the 4% of last patch).
* [1b/2] Halve hq-resampler table size
The previous patch slightly changed (shifted) the values stored in the 2D table
of shifted sinc functions. This patch exploits some symmetry properties so that
we only need to store half the amount of data.
The size of this table depends on the ratio between the input and output sample
frequency. For resampling PSG (with native frequency 224kHz) to 44.1kHz we need
a table that's over 3MB in size! To resample MSX-MUSIC (native frequency
49.7kHz) the table is slightly over 700kB. So cutting the size of these tables
in half is certainly worth it.
The commit message of the previous patch may have suggested that we only store
half of each row in the table (half of each sinc). But that's not the case (and
not possible because in general a sampled shifted sinc has no (sample-aligned)
symmetry axis). Instead we exploit the property that shifting over 'k' is the
same as shifting the left-right-flipped function over '-k'.
So instead of storing half of each row in the table we store half the amount of
rows. And to re-calculate those dropped rows we read the previous rows in
reverse (both from right-to-left and from bottom-to-top).
Our boosted machine configurations have many different soundchips with
different native sample frequencies (PSG, SCC, MSX-MUSIC, MoonSound-wave and
-FM part). On those machines this patch saves over 3.2MB memory. But also on
simple MSX1 machines this patch saves over 1.5MB.
In some cases this patch also increases execution speed. On a i7 with 8MB L3
cache I couldn't measure any significant speed difference, but on a i5 with
only 4MB L3 cache this patch resulted in a 4% total emulation time speedup (of
course depending on what other parts of the emulation (or even the whole
system) are competing for cache).
* [1a/2] Shift sinc functions over half an index
The 'hq'-resampler uses a large 2D table with pre-calculated (windowed) sinc
functions. This table has 4096 rows and in each row the sinc is shifted over
1/4096th of a 'step' (a step roughly corresponds to the duration of 1 host
sample (e.g. 44100Hz), see source code for more details).
The sinc function is defined as:
sinc(x) := sin(pi * x) / (pi * x)
This is an even function (sinc(x) == sinc(-x)), So in principle we only need to
store one half of the function in the table.
This patch shifts the whole table over 1/8192th of a step. The reason for this
is to better exploit the symmetry that's present in the sinc function. I'll
explain by using a sine wave instead of a sinc, but the mechanism is the same
for both.
Suppose we want to store 8 samples of half a sine wave. One way to do this is
define:
f1(n) := sin(n * pi/8)
Evaluating for n = 0..7 results in:
n : 0 1 2 3 4 5 6 7
f1(n) : 0.000 0.383 0.707 0.924 1.000 0.924 0.707 0.383
Another possibility is:
f2(n) := sin(n * pi/8 + pi/16)
Which results in:
n : 0 1 2 3 4 5 6 7
f2(n) : 0.195 0.556 0.831 0.981 0.981 0.831 0.556 0.195
The table for f1() has 5 distinct value, for f2() there are only 4. Also the
formula to calculate the 2nd half of the table from the 1st half is slightly
simpler for f2() compared to f1().
The effect of this shift is that the resulting sound is delayed by 1/8192th of
a host sample. At 44100Hz that's 3ns, that should be inaudible ;-) BTW check
this excellent video for an explanation of how a sampled audio signal can be
delayed by less than the duration of a single sample:
https://xiph.org/video/vid2.shtml
This patch only shifts the sinc functions. The next patch will actually exploit
the symmetry. That makes this patch _very_ small. But the reason why I still
choose to split it is that this part results in a (very small) change in the
output signal, while all later patches in this series should leave the result
unchanged.

Download: OpenMSX Git (2016/08/29) x86
Download: OpenMSX Git (2016/08/29) x64
Source: Here

Random Related Topic Refresh Related Topic

Random Related Topic Loading...

0 Comments

Post a Comment

Can't post a comment? Try This!