Cubic Spline Sound Interpolation [from AntiResonance]
This commit is contained in:
@@ -130,6 +130,7 @@ EXTSYM NoiseData,SoundCompD,Voice0Disable,csounddisable,dssel,spcRamcmp
|
|||||||
EXTSYM cfgecho,Surround,SoundBufEn
|
EXTSYM cfgecho,Surround,SoundBufEn
|
||||||
EXTSYM echobuf
|
EXTSYM echobuf
|
||||||
EXTSYM LowPassFilter
|
EXTSYM LowPassFilter
|
||||||
|
EXTSYM UseCubicSpline
|
||||||
|
|
||||||
NEWSYM DspProcAsmStart
|
NEWSYM DspProcAsmStart
|
||||||
|
|
||||||
@@ -173,7 +174,10 @@ tempstuff db 0
|
|||||||
ALIGN32
|
ALIGN32
|
||||||
|
|
||||||
DSPInterP:
|
DSPInterP:
|
||||||
times 512 dw 0
|
times 1024 dw 0
|
||||||
|
|
||||||
|
|
||||||
|
Gaussian:
|
||||||
dw 1305,1305,1304,1304,1304,1304,1304,1303
|
dw 1305,1305,1304,1304,1304,1304,1304,1303
|
||||||
dw 1303,1303,1302,1302,1301,1300,1300,1299
|
dw 1303,1303,1302,1302,1301,1300,1300,1299
|
||||||
dw 1298,1297,1297,1296,1295,1294,1293,1292
|
dw 1298,1297,1297,1296,1295,1294,1293,1292
|
||||||
@@ -246,6 +250,139 @@ DSPInterP:
|
|||||||
dw 0, 0, 0, 0, 0, 0, 0, 0
|
dw 0, 0, 0, 0, 0, 0, 0, 0
|
||||||
dw 0, 0, 0, 0, 0, 0, 0, 0
|
dw 0, 0, 0, 0, 0, 0, 0, 0
|
||||||
|
|
||||||
|
CubicSpline:
|
||||||
|
dw 0, 0, 0, 0, 0, 0, 0, 0
|
||||||
|
dw 0, -1, -1, -1, -2, -2, -2, -3
|
||||||
|
dw -3, -4, -4, -5, -5, -6, -6, -7
|
||||||
|
dw -8, -8, -9, -10, -10, -11, -12, -13
|
||||||
|
dw -14, -14, -15, -16, -17, -18, -19, -20
|
||||||
|
dw -21, -22, -23, -24, -25, -26, -27, -28
|
||||||
|
dw -29, -30, -31, -32, -33, -34, -35, -37
|
||||||
|
dw -38, -39, -40, -41, -43, -44, -45, -46
|
||||||
|
dw -48, -49, -50, -51, -53, -54, -55, -56
|
||||||
|
dw -58, -59, -60, -62, -63, -64, -66, -67
|
||||||
|
dw -68, -70, -71, -72, -74, -75, -76, -78
|
||||||
|
dw -79, -80, -82, -83, -84, -86, -87, -88
|
||||||
|
dw -90, -91, -92, -93, -95, -96, -97, -99
|
||||||
|
dw -100,-101,-102,-104,-105,-106,-107,-109
|
||||||
|
dw -110,-111,-112,-113,-114,-116,-117,-118
|
||||||
|
dw -119,-120,-121,-122,-123,-124,-125,-126
|
||||||
|
dw -128,-128,-129,-130,-131,-132,-133,-134
|
||||||
|
dw -135,-136,-137,-137,-138,-139,-140,-141
|
||||||
|
dw -141,-142,-143,-143,-144,-144,-145,-146
|
||||||
|
dw -146,-147,-147,-148,-148,-148,-149,-149
|
||||||
|
dw -150,-150,-150,-150,-151,-151,-151,-151
|
||||||
|
dw -151,-151,-151,-151,-151,-151,-151,-151
|
||||||
|
dw -151,-151,-150,-150,-150,-149,-149,-149
|
||||||
|
dw -148,-148,-147,-147,-146,-146,-145,-144
|
||||||
|
dw -144,-143,-142,-141,-140,-139,-138,-137
|
||||||
|
dw -136,-135,-134,-133,-132,-130,-129,-128
|
||||||
|
dw -126,-125,-123,-122,-120,-119,-117,-115
|
||||||
|
dw -113,-112,-110,-108,-106,-104,-102,-100
|
||||||
|
dw -98, -95, -93, -91, -88, -86, -83, -81
|
||||||
|
dw -78, -76, -73, -70, -67, -65, -62, -59
|
||||||
|
dw -56, -53, -50, -46, -43, -40, -36, -33
|
||||||
|
dw -30, -26, -22, -19, -15, -11, -7, -3
|
||||||
|
|
||||||
|
dw 0, 4, 8, 12, 16, 21, 26, 30
|
||||||
|
dw 35, 40, 46, 51, 56, 62, 67, 73
|
||||||
|
dw 79, 85, 91, 97, 103, 109, 116, 122
|
||||||
|
dw 129, 136, 143, 149, 156, 164, 171, 178
|
||||||
|
dw 186, 193, 201, 208, 216, 224, 232, 240
|
||||||
|
dw 248, 256, 264, 273, 281, 289, 298, 307
|
||||||
|
dw 315, 324, 333, 342, 351, 360, 369, 378
|
||||||
|
dw 387, 397, 406, 415, 425, 435, 444, 454
|
||||||
|
dw 464, 473, 483, 493, 503, 513, 523, 533
|
||||||
|
dw 543, 553, 564, 574, 584, 594, 605, 615
|
||||||
|
dw 626, 636, 647, 657, 668, 679, 689, 700
|
||||||
|
dw 711, 721, 732, 743, 754, 765, 776, 787
|
||||||
|
dw 798, 808, 819, 830, 841, 852, 863, 874
|
||||||
|
dw 886, 897, 908, 919, 930, 941, 952, 963
|
||||||
|
dw 974, 985, 996,1008,1019,1030,1041,1052
|
||||||
|
dw 1063,1074,1085,1096,1107,1118,1129,1140
|
||||||
|
dw 1152,1162,1173,1184,1195,1206,1217,1228
|
||||||
|
dw 1239,1250,1261,1271,1282,1293,1303,1314
|
||||||
|
dw 1325,1335,1346,1356,1367,1377,1388,1398
|
||||||
|
dw 1408,1419,1429,1439,1449,1459,1470,1480
|
||||||
|
dw 1490,1499,1509,1519,1529,1539,1548,1558
|
||||||
|
dw 1567,1577,1586,1595,1605,1614,1623,1632
|
||||||
|
dw 1641,1650,1659,1668,1677,1685,1694,1702
|
||||||
|
dw 1711,1719,1727,1736,1744,1752,1760,1768
|
||||||
|
dw 1776,1783,1791,1798,1806,1813,1820,1828
|
||||||
|
dw 1835,1842,1849,1855,1862,1869,1875,1881
|
||||||
|
dw 1888,1894,1900,1906,1912,1918,1923,1929
|
||||||
|
dw 1934,1940,1945,1950,1955,1960,1964,1969
|
||||||
|
dw 1974,1978,1982,1986,1990,1994,1998,2002
|
||||||
|
dw 2005,2008,2012,2015,2018,2021,2023,2026
|
||||||
|
dw 2028,2031,2033,2035,2037,2038,2040,2041
|
||||||
|
dw 2043,2044,2045,2046,2046,2047,2047,2047
|
||||||
|
|
||||||
|
dw 2048,2047,2047,2047,2046,2046,2045,2044
|
||||||
|
dw 2043,2041,2040,2038,2037,2035,2033,2031
|
||||||
|
dw 2028,2026,2023,2021,2018,2015,2012,2008
|
||||||
|
dw 2005,2002,1998,1994,1990,1986,1982,1978
|
||||||
|
dw 1974,1969,1964,1960,1955,1950,1945,1940
|
||||||
|
dw 1934,1929,1923,1918,1912,1906,1900,1894
|
||||||
|
dw 1888,1881,1875,1869,1862,1855,1849,1842
|
||||||
|
dw 1835,1828,1820,1813,1806,1798,1791,1783
|
||||||
|
dw 1776,1768,1760,1752,1744,1736,1727,1719
|
||||||
|
dw 1711,1702,1694,1685,1677,1668,1659,1650
|
||||||
|
dw 1641,1632,1623,1614,1605,1595,1586,1577
|
||||||
|
dw 1567,1558,1548,1539,1529,1519,1509,1499
|
||||||
|
dw 1490,1480,1470,1459,1449,1439,1429,1419
|
||||||
|
dw 1408,1398,1388,1377,1367,1356,1346,1335
|
||||||
|
dw 1325,1314,1303,1293,1282,1271,1261,1250
|
||||||
|
dw 1239,1228,1217,1206,1195,1184,1173,1162
|
||||||
|
dw 1152,1140,1129,1118,1107,1096,1085,1074
|
||||||
|
dw 1063,1052,1041,1030,1019,1008, 996, 985
|
||||||
|
dw 974, 963, 952, 941, 930, 919, 908, 897
|
||||||
|
dw 886, 874, 863, 852, 841, 830, 819, 808
|
||||||
|
dw 798, 787, 776, 765, 754, 743, 732, 721
|
||||||
|
dw 711, 700, 689, 679, 668, 657, 647, 636
|
||||||
|
dw 626, 615, 605, 594, 584, 574, 564, 553
|
||||||
|
dw 543, 533, 523, 513, 503, 493, 483, 473
|
||||||
|
dw 464, 454, 444, 435, 425, 415, 406, 397
|
||||||
|
dw 387, 378, 369, 360, 351, 342, 333, 324
|
||||||
|
dw 315, 307, 298, 289, 281, 273, 264, 256
|
||||||
|
dw 248, 240, 232, 224, 216, 208, 201, 193
|
||||||
|
dw 186, 178, 171, 164, 156, 149, 143, 136
|
||||||
|
dw 129, 122, 116, 109, 103, 97, 91, 85
|
||||||
|
dw 79, 73, 67, 62, 56, 51, 46, 40
|
||||||
|
dw 35, 30, 26, 21, 16, 12, 8, 4
|
||||||
|
|
||||||
|
dw 0, -3, -7, -11, -15, -19, -22, -26
|
||||||
|
dw -30, -33, -36, -40, -43, -46, -50, -53
|
||||||
|
dw -56, -59, -62, -65, -67, -70, -73, -76
|
||||||
|
dw -78, -81, -83, -86, -88, -91, -93, -95
|
||||||
|
dw -98,-100,-102,-104,-106,-108,-110,-112
|
||||||
|
dw -113,-115,-117,-119,-120,-122,-123,-125
|
||||||
|
dw -126,-128,-129,-130,-132,-133,-134,-135
|
||||||
|
dw -136,-137,-138,-139,-140,-141,-142,-143
|
||||||
|
dw -144,-144,-145,-146,-146,-147,-147,-148
|
||||||
|
dw -148,-149,-149,-149,-150,-150,-150,-151
|
||||||
|
dw -151,-151,-151,-151,-151,-151,-151,-151
|
||||||
|
dw -151,-151,-151,-151,-151,-150,-150,-150
|
||||||
|
dw -150,-149,-149,-148,-148,-148,-147,-147
|
||||||
|
dw -146,-146,-145,-144,-144,-143,-143,-142
|
||||||
|
dw -141,-141,-140,-139,-138,-137,-137,-136
|
||||||
|
dw -135,-134,-133,-132,-131,-130,-129,-128
|
||||||
|
dw -128,-126,-125,-124,-123,-122,-121,-120
|
||||||
|
dw -119,-118,-117,-116,-114,-113,-112,-111
|
||||||
|
dw -110,-109,-107,-106,-105,-104,-102,-101
|
||||||
|
dw -100, -99, -97, -96, -95, -93, -92, -91
|
||||||
|
dw -90, -88, -87, -86, -84, -83, -82, -80
|
||||||
|
dw -79, -78, -76, -75, -74, -72, -71, -70
|
||||||
|
dw -68, -67, -66, -64, -63, -62, -60, -59
|
||||||
|
dw -58, -56, -55, -54, -53, -51, -50, -49
|
||||||
|
dw -48, -46, -45, -44, -43, -41, -40, -39
|
||||||
|
dw -38, -37, -35, -34, -33, -32, -31, -30
|
||||||
|
dw -29, -28, -27, -26, -25, -24, -23, -22
|
||||||
|
dw -21, -20, -19, -18, -17, -16, -15, -14
|
||||||
|
dw -14, -13, -12, -11, -10, -10, -9, -8
|
||||||
|
dw -8, -7, -6, -6, -5, -5, -4, -4
|
||||||
|
dw -3, -3, -2, -2, -2, -1, -1, -1
|
||||||
|
dw 0, 0, 0, 0, 0, 0, 0, 0
|
||||||
|
|
||||||
ALIGN32
|
ALIGN32
|
||||||
|
|
||||||
NEWSYM spcWptr, times 16 dd 0 ; SPC Write pointers (point to their own functions)
|
NEWSYM spcWptr, times 16 dd 0 ; SPC Write pointers (point to their own functions)
|
||||||
@@ -370,6 +507,41 @@ NEWSYM conv2speed
|
|||||||
|
|
||||||
|
|
||||||
NEWSYM AdjustFrequency
|
NEWSYM AdjustFrequency
|
||||||
|
cmp byte[UseCubicSpline],1
|
||||||
|
je .cubicspline
|
||||||
|
; Copy from Gaussian to DSPInterP
|
||||||
|
mov ebx,DSPInterP
|
||||||
|
mov edx,DSPInterP+2046
|
||||||
|
mov ecx,512
|
||||||
|
.intrploop
|
||||||
|
xor eax,eax
|
||||||
|
mov ax,[edx+1024]
|
||||||
|
mov [edx],ax
|
||||||
|
mov [ebx],ax
|
||||||
|
add ebx,2
|
||||||
|
sub edx,2
|
||||||
|
loop .intrploop
|
||||||
|
jmp .notgaussian
|
||||||
|
.cubicspline
|
||||||
|
; Copy from CubicSpline to DSPInterP
|
||||||
|
mov ebx,CubicSpline
|
||||||
|
mov edx,DSPInterP
|
||||||
|
mov ecx,1024
|
||||||
|
.intrploopb
|
||||||
|
xor eax,eax
|
||||||
|
mov ax,[ebx]
|
||||||
|
push ebx
|
||||||
|
mov bx,ax
|
||||||
|
sar bx,3
|
||||||
|
sub ax,bx
|
||||||
|
pop ebx
|
||||||
|
mov [edx],ax
|
||||||
|
add ebx,2
|
||||||
|
add edx,2
|
||||||
|
loop .intrploopb
|
||||||
|
.notgaussian
|
||||||
|
|
||||||
|
|
||||||
cmp byte[StereoSound],1
|
cmp byte[StereoSound],1
|
||||||
jne .nostereo8b
|
jne .nostereo8b
|
||||||
cmp byte[SBHDMA],0
|
cmp byte[SBHDMA],0
|
||||||
@@ -452,21 +624,17 @@ NEWSYM InitSPC
|
|||||||
push edx
|
push edx
|
||||||
|
|
||||||
; Mirror Interpolation Table
|
; Mirror Interpolation Table
|
||||||
mov ebx,DSPInterP
|
mov ebx,Gaussian
|
||||||
mov edx,DSPInterP+2046
|
|
||||||
mov ecx,512
|
mov ecx,512
|
||||||
.intrploop
|
.intloop
|
||||||
xor eax,eax
|
mov ax,[ebx]
|
||||||
mov ax,[edx]
|
|
||||||
or ax,ax
|
or ax,ax
|
||||||
jz .nodec
|
jz .nodec
|
||||||
dec ax
|
dec ax
|
||||||
.nodec
|
.nodec
|
||||||
mov [edx],ax
|
|
||||||
mov [ebx],ax
|
mov [ebx],ax
|
||||||
add ebx,2
|
dec ecx
|
||||||
sub edx,2
|
jnz .intloop
|
||||||
loop .intrploop
|
|
||||||
|
|
||||||
call AdjustFrequency
|
call AdjustFrequency
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user