fix: fixed 1616 to float32 conversion

This commit is contained in:
Martin Riedl 2024-12-28 19:15:43 +01:00
parent c96343ad39
commit d88090f541
Signed by: martinr92
GPG key ID: FB68DA65516A804C

View file

@ -14,7 +14,9 @@
package gomp4 package gomp4
import "encoding/binary" import (
"encoding/binary"
)
type Fixed88 struct { type Fixed88 struct {
b []byte b []byte
@ -63,7 +65,7 @@ func (fixed Fixed1616) ToFloat32() float32 {
b := binary.BigEndian.Uint16(fixed.b[2:4]) b := binary.BigEndian.Uint16(fixed.b[2:4])
result += float32(a) result += float32(a)
result += float32(b) / 100_000 // max of uint16 is 65535 result += float32(b) / 65535 // max of uint16 is 65535
return result return result
} }