Skip to content

Commit

Permalink
Minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
TexZK committed Mar 31, 2024
1 parent 370c630 commit 33847d9
Show file tree
Hide file tree
Showing 15 changed files with 30 additions and 62 deletions.
11 changes: 7 additions & 4 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Here are some ideas that came to my mind.
* 4-slot operators. → **DONE!**
* rhythm mode. → **DONE!**

* Add most of the possible *YMF262* static operator configurations for unit tests.
* Add most of the possible *YMF262* static operator configurations for unit tests. → **DEFERRED:** sticking to AdPlug reference scores
* Single-note scores.
* 4-slot operators.
* Rhythm mode.
Expand All @@ -33,7 +33,7 @@ Here are some ideas that came to my mind.

* Take queuing away from _YMF262_ instances.
* Make as CPU-independent utility class.
* Make default length 64.
* Make default length 1024.
* Make length and pointers configurable.
* Queue status accessors.

Expand All @@ -50,19 +50,22 @@ Here are some ideas that came to my mind.

* Add _YM7128B_.
* All CPU architectures.
* _x86 SSE2_
* _x86 SSE4.1_ → **DONE!**
* _x86 AVX_
* _x86 AVX2_
* _ARM NEON_ → **TBV: RPi5 & BBB**
* _ARM NEON_ → **DONE!**
* Stick to the closest fixed point models. → **DONE!**
* C++ wrappers.

* Add _TDA8425_.
* All CPU architectures.
* _x86 SSE_
* _x86 SSE4.1_ → **DONE!**
* _x86 AVX_
* _x86 AVX2_ → **DONE!**
* _ARM NEON_ → **TBV: RPi5 & BBB**
* _x86 FMA_
* _ARM NEON_ → **DONE!**
* _float32_ model. → **DONE!**
* _int16_ mode.
* C++ wrappers.
Expand Down
1 change: 1 addition & 0 deletions include/aymo_tda8425_none.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ along with AYMO. If not, see <https://www.gnu.org/licenses/>.
#define _include_aymo_tda8425_none_h

#include "aymo_cpu.h"
#include "aymo_tda8425_common.h"

#include "TDA8425_emu.h"

Expand Down
2 changes: 1 addition & 1 deletion include/aymo_tda8425_x86_avx2.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ along with AYMO. If not, see <https://www.gnu.org/licenses/>.
#define _include_aymo_tda8425_x86_avx2_h

#include "aymo_cpu.h"
#include "aymo_tda8425_common.h"

#include <stddef.h>
#include <stdint.h>

#ifdef AYMO_CPU_SUPPORT_X86_AVX2

Expand Down
2 changes: 1 addition & 1 deletion include/aymo_tda8425_x86_sse41.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ along with AYMO. If not, see <https://www.gnu.org/licenses/>.
#define _include_aymo_tda8425_x86_sse41_h

#include "aymo_cpu.h"
#include "aymo_tda8425_common.h"

#include <stddef.h>
#include <stdint.h>

#ifdef AYMO_CPU_SUPPORT_X86_SSE41

Expand Down
1 change: 0 additions & 1 deletion include/aymo_ym7128_arm_neon.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ along with AYMO. If not, see <https://www.gnu.org/licenses/>.
#include "aymo_ym7128_common.h"

#include <stddef.h>
#include <stdint.h>

#ifdef AYMO_CPU_SUPPORT_ARM_NEON

Expand Down
2 changes: 0 additions & 2 deletions include/aymo_ym7128_none.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ along with AYMO. If not, see <https://www.gnu.org/licenses/>.

#include "YM7128B_emu.h"

#include <stdint.h>

AYMO_CXX_EXTERN_C_BEGIN


Expand Down
1 change: 0 additions & 1 deletion include/aymo_ym7128_x86_sse41.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ along with AYMO. If not, see <https://www.gnu.org/licenses/>.
#include "aymo_ym7128_common.h"

#include <stddef.h>
#include <stdint.h>

#ifdef AYMO_CPU_SUPPORT_X86_SSE41

Expand Down
5 changes: 0 additions & 5 deletions include/meson.build
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@

aymo_headers = [ # TODO
'aymo.h',
'aymo_score.h',
'aymo_score_dro.h',
'aymo_score_imf.h',
'aymo_ymf262.h',
]

install_headers(aymo_headers, subdir: 'aymo')
43 changes: 9 additions & 34 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ top_srcdir = meson.current_source_dir()
top_builddir = meson.current_build_dir()

aymo_includes = include_directories('.', 'include')
aymo_public_includes = include_directories('include')

python_exe = find_program('python', 'python3')

Expand Down Expand Up @@ -435,30 +434,6 @@ endif # opt_rtcd
# =====================================================================

sources = {
'AYMO_HEADERS': files(
'include/aymo.h',
'include/aymo_cc.h',
'include/aymo_cpu.h',
'include/aymo_convert.h',
'include/aymo_convert_arm_neon.h',
'include/aymo_convert_none.h',
'include/aymo_convert_x86_avx2.h',
'include/aymo_convert_x86_sse41.h',
'include/aymo_score.h',
'include/aymo_score_dro.h',
'include/aymo_score_imf.h',
'include/aymo_score_raw.h',
'include/aymo_score_ref.h',
'include/aymo_score_vgm.h',
'include/aymo_wave.h',
'include/aymo_ymf262_arm_neon.h',
'include/aymo_ymf262_dummy.h',
'include/aymo_ymf262_none.h',
'include/aymo_ymf262_x86_avx.h',
'include/aymo_ymf262_x86_avx2.h',
'include/aymo_ymf262_x86_sse41.h',
),

'AYMO_SOURCES': files(
'src/aymo.c',
'src/aymo_convert.c',
Expand All @@ -483,43 +458,43 @@ sources = {
'src/aymo_ymf262_none.c',
),

'AYMO_SOURCES_X86': files (
'AYMO_SOURCES_X86': files(
'src/aymo_cpu_x86.c',
),

'AYMO_SOURCES_X86_SSE41': files (
'AYMO_SOURCES_X86_SSE41': files(
'src/aymo_convert_x86_sse41.c',
'src/aymo_tda8425_x86_sse41.c',
'src/aymo_ym7128_x86_sse41.c',
'src/aymo_ymf262_x86_sse41.c',
),

'AYMO_SOURCES_X86_AVX': files (
'AYMO_SOURCES_X86_AVX': files(
'src/aymo_ymf262_x86_avx.c',
),

'AYMO_SOURCES_X86_AVX2': files (
'AYMO_SOURCES_X86_AVX2': files(
'src/aymo_convert_x86_avx2.c',
'src/aymo_tda8425_x86_avx2.c',
'src/aymo_ymf262_x86_avx2.c',
),

'AYMO_SOURCES_ARM': files (
'AYMO_SOURCES_ARM': files(
'src/aymo_cpu_arm.c',
),

'AYMO_SOURCES_ARM_NEON': files (
'AYMO_SOURCES_ARM_NEON': files(
'src/aymo_convert_arm_neon.c',
'src/aymo_tda8425_arm_neon.c',
'src/aymo_ym7128_arm_neon.c',
'src/aymo_ymf262_arm_neon.c',
),

'AYMO_SOURCES_LIBC': files (
'AYMO_SOURCES_LIBC': files(
'src/aymo_file.c',
),

'AYMO_SOURCES_AYMO': files (
'AYMO_SOURCES_AYMO': files(
'src/aymo_empty.c',
),
}
Expand Down Expand Up @@ -692,7 +667,7 @@ summary(

summary(
{
# 'API documentation': doxygen.found(), # TODO: Docygen
# 'API documentation': doxygen.found(), # TODO: Doxygen
'Apps': not opt_apps.disabled(),
'Tests': not opt_tests.disabled(),
},
Expand Down
3 changes: 1 addition & 2 deletions src/aymo_ym7128_arm_neon.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ along with AYMO. If not, see <https://www.gnu.org/licenses/>.
#ifdef AYMO_CPU_SUPPORT_ARM_NEON

#include "aymo_cpu_arm_neon_inline.h"
#include "aymo_ym7128_common.h"
#define AYMO_KEEP_SHORTHANDS
#include "aymo_ym7128_arm_neon.h"

Expand Down Expand Up @@ -227,7 +226,7 @@ void aymo_(process_i16)(struct aymo_(chip)* chip, uint32_t count, const int16_t
vi16x8_t ggrl = vvpacks(ggr, ggl);
vi16x8_t gglr = vext(ggrl, ggrl, 1);
vi16x8_t vlr = vmulhrs(gglr, chip->kv);

vi16x8_t zc = chip->zc;
vi16x8_t zb = chip->zb;
zc = vext(zb, zc, 6); // '543210..'
Expand Down
1 change: 0 additions & 1 deletion src/aymo_ym7128_none.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ You should have received a copy of the GNU Lesser General Public License
along with AYMO. If not, see <https://www.gnu.org/licenses/>.
*/

#include "aymo_ym7128_common.h"
#define AYMO_KEEP_SHORTHANDS
#include "aymo_ym7128_none.h"

Expand Down
6 changes: 3 additions & 3 deletions src/aymo_ymf262_arm_neon.c
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ void aymo_(tick_once)(struct aymo_(chip)* chip)
// Process slot group 1
sgi = 1;
aymo_(sg_update1)(&chip->sg[sgi]);
aymo_(ng_update)(chip, 13);
aymo_(ng_update)(chip, 13);
aymo_(rm_update1_sg1)(chip);
aymo_(ng_update)(chip, (16 - 13));
aymo_(sg_update2)(chip, &chip->sg[sgi]);
Expand Down Expand Up @@ -1491,7 +1491,7 @@ void aymo_(write_C0h)(struct aymo_(chip)* chip, uint16_t address, uint8_t value)
}

if (chip->chip_regs.reg_105h.stereo) {
// TODO
// TODO:
}

if (reg_C0h->cnt != reg_C0h_prev.cnt) {
Expand All @@ -1511,7 +1511,7 @@ void aymo_(write_D0h)(struct aymo_(chip)* chip, uint16_t address, uint8_t value)
}

if (chip->chip_regs.reg_105h.stereo) {
// TODO
// TODO:
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/aymo_ymf262_x86_avx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1402,7 +1402,7 @@ void aymo_(write_C0h)(struct aymo_(chip)* chip, uint16_t address, uint8_t value)
}

if (chip->chip_regs.reg_105h.stereo) {
// TODO
// TODO:
}

if (reg_C0h->cnt != reg_C0h_prev.cnt) {
Expand All @@ -1418,7 +1418,7 @@ void aymo_(write_D0h)(struct aymo_(chip)* chip, uint16_t address, uint8_t value)
*(uint8_t*)(void*)&(chip->ch2x_regs[ch2x].reg_C0h) = value;

if (chip->chip_regs.reg_105h.stereo) {
// TODO
// TODO:
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/aymo_ymf262_x86_avx2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1482,7 +1482,7 @@ void aymo_(write_C0h)(struct aymo_(chip)* chip, uint16_t address, uint8_t value)
}

if (chip->chip_regs.reg_105h.stereo) {
// TODO
// TODO:
}

if (reg_C0h->cnt != reg_C0h_prev.cnt) {
Expand All @@ -1502,7 +1502,7 @@ void aymo_(write_D0h)(struct aymo_(chip)* chip, uint16_t address, uint8_t value)
}

if (chip->chip_regs.reg_105h.stereo) {
// TODO
// TODO:
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/aymo_ymf262_x86_sse41.c
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ void aymo_(tick_once)(struct aymo_(chip)* chip)
// Process slot group 1
sgi = 1;
aymo_(sg_update1)(&chip->sg[sgi]);
aymo_(ng_update)(chip, 13);
aymo_(ng_update)(chip, 13);
aymo_(rm_update1_sg1)(chip);
aymo_(ng_update)(chip, (16 - 13));
aymo_(sg_update2)(chip, &chip->sg[sgi]);
Expand Down Expand Up @@ -1494,7 +1494,7 @@ void aymo_(write_C0h)(struct aymo_(chip)* chip, uint16_t address, uint8_t value)
}

if (chip->chip_regs.reg_105h.stereo) {
// TODO
// TODO:
}

if (reg_C0h->cnt != reg_C0h_prev.cnt) {
Expand All @@ -1514,7 +1514,7 @@ void aymo_(write_D0h)(struct aymo_(chip)* chip, uint16_t address, uint8_t value)
}

if (chip->chip_regs.reg_105h.stereo) {
// TODO
// TODO:
}
}

Expand Down

0 comments on commit 33847d9

Please sign in to comment.