fix: fixed 1616 to float32 conversion
This commit is contained in:
parent
c96343ad39
commit
d88090f541
1 changed files with 4 additions and 2 deletions
6
Fixed.go
6
Fixed.go
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue