From d11de2b9fdb99fbfeac603e77c490f8147939ec2 Mon Sep 17 00:00:00 2001 From: Vladislav Mikhalin Date: Sun, 23 Feb 2025 15:19:10 +0300 Subject: [PATCH] normalize floating point output --- C/src/decoder.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/C/src/decoder.c b/C/src/decoder.c index 09aeb01..6a922b2 100644 --- a/C/src/decoder.c +++ b/C/src/decoder.c @@ -7,6 +7,7 @@ #include "unpack.h" #include "utility.h" #include +#include static At9Status DecodeFrame(Frame* frame, BitReaderCxt* br); static void ImdctBlock(Block* block); @@ -140,7 +141,7 @@ void PcmFloatToF32(Frame* frame, float* pcmOut, int nointerleave) { for (int smpl = 0; smpl < sampleCount; smpl++, i++) { - pcmOut[i] = (float)channels[ch]->Pcm[smpl]; + pcmOut[i] = (float)(channels[ch]->Pcm[smpl] / SHRT_MAX); } } } @@ -150,7 +151,7 @@ void PcmFloatToF32(Frame* frame, float* pcmOut, int nointerleave) { for (int ch = 0; ch < channelCount; ch++, i++) { - pcmOut[i] = (float)channels[ch]->Pcm[smpl]; + pcmOut[i] = (float)(channels[ch]->Pcm[smpl] / SHRT_MAX); } } }