test: Fix python encoder/decoder standalone tools

This commit is contained in:
Antoine SOULIER
2022-07-29 15:01:39 +02:00
parent cea08e9840
commit 2332274508
3 changed files with 3 additions and 3 deletions
-3
View File
@@ -170,9 +170,6 @@ if __name__ == "__main__":
if len(data) != 2:
break
if nframes >= 1000:
break
(frame_nbytes,) = struct.unpack('=H', data)
print('Decoding frame %d' % nframes, end='\r')
+2
View File
@@ -159,6 +159,8 @@ if __name__ == "__main__":
(sr_hz, pcm) = wavfile.read(args.wav_file.name)
if sr_hz not in (8000, 16000, 24000, 320000, 48000):
raise ValueError('Unsupported input samplerate: %d' % sr_hz)
if pcm.ndim != 1:
raise ValueError('Only single channel wav file supported')
### Setup ###
+1
View File
@@ -312,6 +312,7 @@ class SpectrumAnalysis(SpectrumQuantization):
b.write_uint((self.lastnz >> 1) - 1, nbits_lastnz)
b.write_uint(self.lsb_mode, 1)
b.write_uint(self.g_idx, 8)
def encode(self, bits):