安德鲁

[备份].整型的1024倍正余弦查找表.[C]

0
阅读(2000)

 

01 // This is a integer SIN lookup table
02 // Values are (SIN(x) * 1024)
03 short int_sin_array[360] = {
04   0, 17, 35, 53, 71, 89, 107, 124, 142, 160, 
05   177, 195, 212, 230, 247, 265, 282, 299, 316, 333, 
06   350, 366, 383, 400, 416, 432, 448, 464, 480, 496, 
07   512, 527, 542, 557, 572, 587, 601, 616, 630, 644, 
08   658, 671, 685, 698, 711, 724, 736, 748, 760, 772, 
09   784, 795, 806, 817, 828, 838, 848, 858, 868, 877, 
10   886, 895, 904, 912, 920, 928, 935, 942, 949, 955, 
11   962, 968, 973, 979, 984, 989, 993, 997, 1001, 1005, 
12   1008, 1011, 1014, 1016, 1018, 1020, 1021, 1022, 1023, 1023, 
13   1024, 1023, 1023, 1022, 1021, 1020, 1018, 1016, 1014, 1011, 
14   1008, 1005, 1001, 997, 993, 989, 984, 979, 973, 968, 
15   962, 955, 949, 942, 935, 928, 920, 912, 904, 895, 
16   886, 877, 868, 858, 848, 838, 828, 817, 806, 795, 
17   784, 772, 760, 748, 736, 724, 711, 698, 685, 671, 
18   658, 644, 630, 616, 601, 587, 572, 557, 542, 527, 
19   512, 496, 480, 464, 448, 432, 416, 400, 383, 366, 
20   350, 333, 316, 299, 282, 265, 247, 230, 212, 195, 
21   177, 160, 142, 124, 107, 89, 71, 53, 35, 17, 
22   0, -18, -36, -54, -72, -90, -108, -125, -143, -161, 
23   -178, -196, -213, -231, -248, -266, -283, -300, -317, -334, 
24   -351, -367, -384, -401, -417, -433, -449, -465, -481, -497, 
25   -512, -528, -543, -558, -573, -588, -602, -617, -631, -645, 
26   -659, -672, -686, -699, -712, -725, -737, -749, -761, -773, 
27   -785, -796, -807, -818, -829, -839, -849, -859, -869, -878, 
28   -887, -896, -905, -913, -921, -929, -936, -943, -950, -956, 
29   -963, -969, -974, -980, -985, -990, -994, -998, -1002, -1006, 
30   -1009, -1012, -1015, -1017, -1019, -1021, -1022, -1023, -1024, -1024, 
31   -1024, -1024, -1024, -1023, -1022, -1021, -1019, -1017, -1015, -1012, 
32   -1009, -1006, -1002, -998, -994, -990, -985, -980, -974, -969, 
33   -963, -956, -950, -943, -936, -929, -921, -913, -905, -896, 
34   -887, -878, -869, -859, -849, -839, -829, -818, -807, -796, 
35   -785, -773, -761, -749, -737, -725, -712, -699, -686, -672, 
36   -659, -645, -631, -617, -602, -588, -573, -558, -543, -528, 
37   -512, -497, -481, -465, -449, -433, -417, -401, -384, -367, 
38   -351, -334, -317, -300, -283, -266, -248, -231, -213, -196, 
39   -178, -161, -143, -125, -108, -90, -72, -54, -36, -18
40 };
41  
42  
43 // This is a integer COS lookup table
44 // Values are (COS(x) * 1024)
45 short int_cos_array[360] = {
46   1024, 1023, 1023, 1022, 1021, 1020, 1018, 1016, 1014, 1011, 
47   1008, 1005, 1001, 997, 993, 989, 984, 979, 973, 968, 
48   962, 955, 949, 942, 935, 928, 920, 912, 904, 895, 
49   886, 877, 868, 858, 848, 838, 828, 817, 806, 795, 
50   784, 772, 760, 748, 736, 724, 711, 698, 685, 671, 
51   658, 644, 630, 616, 601, 587, 572, 557, 542, 527, 
52   512, 496, 480, 464, 448, 432, 416, 400, 383, 366, 
53   350, 333, 316, 299, 282, 265, 247, 230, 212, 195, 
54   177, 160, 142, 124, 107, 89, 71, 53, 35, 17, 
55   0, -18, -36, -54, -72, -90, -108, -125, -143, -161, 
56   -178, -196, -213, -231, -248, -266, -283, -300, -317, -334, 
57   -351, -367, -384, -401, -417, -433, -449, -465, -481, -497, 
58   -512, -528, -543, -558, -573, -588, -602, -617, -631, -645, 
59   -659, -672, -686, -699, -712, -725, -737, -749, -761, -773, 
60   -785, -796, -807, -818, -829, -839, -849, -859, -869, -878, 
61   -887, -896, -905, -913, -921, -929, -936, -943, -950, -956, 
62   -963, -969, -974, -980, -985, -990, -994, -998, -1002, -1006, 
63   -1009, -1012, -1015, -1017, -1019, -1021, -1022, -1023, -1024, -1024, 
64   -1024, -1024, -1024, -1023, -1022, -1021, -1019, -1017, -1015, -1012, 
65   -1009, -1006, -1002, -998, -994, -990, -985, -980, -974, -969, 
66   -963, -956, -950, -943, -936, -929, -921, -913, -905, -896, 
67   -887, -878, -869, -859, -849, -839, -829, -818, -807, -796, 
68   -785, -773, -761, -749, -737, -725, -712, -699, -686, -672, 
69   -659, -645, -631, -617, -602, -588, -573, -558, -543, -528, 
70   -512, -497, -481, -465, -449, -433, -417, -401, -384, -367, 
71   -351, -334, -317, -300, -283, -266, -248, -231, -213, -196, 
72   -178, -161, -143, -125, -108, -90, -72, -54, -36, -18, 
73   -1, 17, 35, 53, 71, 89, 107, 124, 142, 160, 
74   177, 195, 212, 230, 247, 265, 282, 299, 316, 333, 
75   350, 366, 383, 400, 416, 432, 448, 464, 480, 496, 
76   512, 527, 542, 557, 572, 587, 601, 616, 630, 644, 
77   658, 671, 685, 698, 711, 724, 736, 748, 760, 772, 
78   784, 795, 806, 817, 828, 838, 848, 858, 868, 877, 
79   886, 895, 904, 912, 920, 928, 935, 942, 949, 955, 
80   962, 968, 973, 979, 984, 989, 993, 997, 1001, 1005, 
81   1008, 1011, 1014, 1016, 1018, 1020, 1021, 1022, 1023, 1023
82 };

参考

1 VGA Controller and Nios II Processor Reference Design

..\StratixII_2S60\software\Nios_II_VGA_Reference_Application_2S60\vga_example.h