Skip to content

Commit

Permalink
Round packed signal length up to nearest byte.
Browse files Browse the repository at this point in the history
  • Loading branch information
bemasher committed May 19, 2018
1 parent 19cf823 commit cbd4df4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion decode/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func NewDecoder(cfg PacketConfig) (d Decoder) {
d.sIdxA = make([]int, 0, d.Cfg.BlockSize)
d.sIdxB = make([]int, 0, d.Cfg.BlockSize)

d.packed = make([]byte, (d.Cfg.BlockSize+d.Cfg.PreambleLength)>>3)
d.packed = make([]byte, (d.Cfg.BlockSize+d.Cfg.PreambleLength+7)>>3)

return
}
Expand Down
14 changes: 14 additions & 0 deletions decode/decode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@ func NewPacketConfig(chipLength int) (cfg PacketConfig) {
return
}

func TestSymbolLength(t *testing.T) {
for idx := 7; idx <= 72; idx++ {
d := NewDecoder(NewPacketConfig(idx))
pLen := d.Cfg.BlockSize + d.Cfg.PreambleLength
t.Logf("%d: %d/8 = %0.2f (%d)\n", idx, pLen, float64(pLen)/8.0, len(d.packed))

block := make([]byte, d.Cfg.BlockSize2)
d.Decode(block)
d.Decode(block)
d.Decode(block)
d.Decode(block)
}
}

func BenchmarkMagLUT(b *testing.B) {
d := NewDecoder(NewPacketConfig(72))

Expand Down

0 comments on commit cbd4df4

Please sign in to comment.