23 lines
602 B
Python
23 lines
602 B
Python
# lanczos2 kernel interval -2:0
|
|
# generating 512 point LUT
|
|
# 511 is centerpoint
|
|
|
|
# lanczos defined as sinc(x) * sinc(x/a)
|
|
# a is order (2)
|
|
# sinc(x) = sin(x) / x
|
|
# output format:
|
|
# 0xNNNN, 0xNNNN, 0xNNNN, 0xNNNN, 0xNNNN, 0xNNNN, 0xNNNN, 0xNNNN, 0xNNNN, 0xNNNN, 0xNNNN, 0xNNNN, 0xNNNN, 0xNNNN, 0xNNNN, 0xNNNN,
|
|
# x32 lines
|
|
|
|
import numpy as np
|
|
|
|
for j in range(0, 512, 16):
|
|
lineString = ""
|
|
for k in range(16):
|
|
i = j + k
|
|
x = (i - 511) / 256
|
|
y = np.sinc(x) * np.sinc(x / 2)
|
|
y *= 32767
|
|
lineString += hex(int(y))
|
|
lineString += ", "
|
|
print(lineString) |