CMSIS-DSP: Added MFCC F16
This first version is not very accurate due to problems with the log.
A coming commit will improve the log accuracy.
Issues #1305 and #1304 also corrected as part of this commit.
diff --git a/CMSIS/DSP/Scripts/mfccdata.py b/CMSIS/DSP/Scripts/mfccdata.py
index 80546d5..69111d2 100755
--- a/CMSIS/DSP/Scripts/mfccdata.py
+++ b/CMSIS/DSP/Scripts/mfccdata.py
@@ -48,7 +48,7 @@
return ("0x%s" % format(struct.unpack('<H', struct.pack('<h', r))[0],'04X'))
def to_f16(v):
- return("(float16_t)%f" % struct.unpack('<e',struct.pack('<e',v)))
+ return("(float16_t)%ff" % struct.unpack('<f',struct.pack('<f',v)))
def to_f32(v):
return("%ff" % struct.unpack('<f',struct.pack('<f',v)))
@@ -214,6 +214,28 @@
#print(configs)
+def checkF16(configs):
+ hasF16 = False
+ for config in configs["dct"]:
+ c=configs["dct"][config]
+ if c["type"]=="f16":
+ hasF16 = True
+ c["hasF16"]=True
+
+ for config in configs["melfilter"]:
+ c=configs["melfilter"][config]
+ if c["type"]=="f16":
+ hasF16 = True
+ c["hasF16"]=True
+
+ for config in configs["window"]:
+ c=configs["window"][config]
+ if c["type"]=="f16":
+ hasF16 = True
+ c["hasF16"]=True
+
+ configs["hasF16"]=hasF16
+
env = Environment(
loader=PackageLoader("mfccdata","mfcctemplates"),
autoescape=select_autoescape(),