Skip to content

Commit

Permalink
flac: Fix block_size regression
Browse files Browse the repository at this point in the history
  • Loading branch information
wader committed Nov 23, 2021
1 parent e47888e commit 2af08da
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 38 deletions.
1 change: 1 addition & 0 deletions format/flac/flac_frame.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ func frameDecode(d *decode.D, in interface{}) interface{} {
default:
blockSize = 256 * (1 << (blockSizeBits - 8))
}
s.Sym = blockSize
return s
})

Expand Down
2 changes: 1 addition & 1 deletion format/flac/testdata/frame.fqtest
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ $ fq -d flac_frame verbose /frame
0x000|ff f8 |.. | sync: 0b11111111111110 (valid) 0x0-0x1.5 (1.6)
0x000| f8 | . | reserved0: 0 (valid) 0x1.6-0x1.6 (0.1)
0x000| f8 | . | blocking_strategy: "Fixed" (0) 0x1.7-0x1.7 (0.1)
0x000| 79 | y | block_size: 7 (end of header (16 bit)) 0x2-0x2.3 (0.4)
0x000| 79 | y | block_size: 0 (7) (end of header (16 bit)) 0x2-0x2.3 (0.4)
0x000| 79 | y | sample_rate: 44100 (9) 0x2.4-0x2.7 (0.4)
0x000| 08 | . | channel_assignment: 1 (0) (mono) 0x3-0x3.3 (0.4)
0x000| 08 | . | sample_size: 16 (4) 0x3.4-0x3.6 (0.3)
Expand Down
12 changes: 6 additions & 6 deletions format/flac/testdata/mono16.fqtest
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ $ fq -d flac verbose /mono16.flac
0x2070|ff f8 |.. | sync: 0b11111111111110 (valid) 0x2070-0x2071.5 (1.6)
0x2070| f8 | . | reserved0: 0 (valid) 0x2071.6-0x2071.6 (0.1)
0x2070| f8 | . | blocking_strategy: "Fixed" (0) 0x2071.7-0x2071.7 (0.1)
0x2070| c9 | . | block_size: 12 0x2072-0x2072.3 (0.4)
0x2070| c9 | . | block_size: 4096 (12) 0x2072-0x2072.3 (0.4)
0x2070| c9 | . | sample_rate: 44100 (9) 0x2072.4-0x2072.7 (0.4)
0x2070| 08 | . | channel_assignment: 1 (0) (mono) 0x2073-0x2073.3 (0.4)
0x2070| 08 | . | sample_size: 16 (4) 0x2073.4-0x2073.6 (0.3)
Expand All @@ -73,7 +73,7 @@ $ fq -d flac verbose /mono16.flac
0x2070| ff f8 | .. | sync: 0b11111111111110 (valid) 0x207b-0x207c.5 (1.6)
0x2070| f8 | . | reserved0: 0 (valid) 0x207c.6-0x207c.6 (0.1)
0x2070| f8 | . | blocking_strategy: "Fixed" (0) 0x207c.7-0x207c.7 (0.1)
0x2070| c9 | . | block_size: 12 0x207d-0x207d.3 (0.4)
0x2070| c9 | . | block_size: 4096 (12) 0x207d-0x207d.3 (0.4)
0x2070| c9 | . | sample_rate: 44100 (9) 0x207d.4-0x207d.7 (0.4)
0x2070| 08 | . | channel_assignment: 1 (0) (mono) 0x207e-0x207e.3 (0.4)
0x2070| 08 | . | sample_size: 16 (4) 0x207e.4-0x207e.6 (0.3)
Expand Down Expand Up @@ -199,7 +199,7 @@ $ fq -d flac verbose /mono16.flac
0x26d0| ff f8 | .. | sync: 0b11111111111110 (valid) 0x26d8-0x26d9.5 (1.6)
0x26d0| f8 | . | reserved0: 0 (valid) 0x26d9.6-0x26d9.6 (0.1)
0x26d0| f8 | . | blocking_strategy: "Fixed" (0) 0x26d9.7-0x26d9.7 (0.1)
0x26d0| c9 | . | block_size: 12 0x26da-0x26da.3 (0.4)
0x26d0| c9 | . | block_size: 4096 (12) 0x26da-0x26da.3 (0.4)
0x26d0| c9 | . | sample_rate: 44100 (9) 0x26da.4-0x26da.7 (0.4)
0x26d0| 08 | . | channel_assignment: 1 (0) (mono) 0x26db-0x26db.3 (0.4)
0x26d0| 08 | . | sample_size: 16 (4) 0x26db.4-0x26db.6 (0.3)
Expand Down Expand Up @@ -420,7 +420,7 @@ $ fq -d flac verbose /mono16.flac
0x45e0| ff f8 | .. | sync: 0b11111111111110 (valid) 0x45e3-0x45e4.5 (1.6)
0x45e0| f8 | . | reserved0: 0 (valid) 0x45e4.6-0x45e4.6 (0.1)
0x45e0| f8 | . | blocking_strategy: "Fixed" (0) 0x45e4.7-0x45e4.7 (0.1)
0x45e0| c9 | . | block_size: 12 0x45e5-0x45e5.3 (0.4)
0x45e0| c9 | . | block_size: 4096 (12) 0x45e5-0x45e5.3 (0.4)
0x45e0| c9 | . | sample_rate: 44100 (9) 0x45e5.4-0x45e5.7 (0.4)
0x45e0| 08 | . | channel_assignment: 1 (0) (mono) 0x45e6-0x45e6.3 (0.4)
0x45e0| 08 | . | sample_size: 16 (4) 0x45e6.4-0x45e6.6 (0.3)
Expand Down Expand Up @@ -472,7 +472,7 @@ $ fq -d flac verbose /mono16.flac
0x5be0| ff f8 | .. | sync: 0b11111111111110 (valid) 0x5bec-0x5bed.5 (1.6)
0x5be0| f8 | . | reserved0: 0 (valid) 0x5bed.6-0x5bed.6 (0.1)
0x5be0| f8 | . | blocking_strategy: "Fixed" (0) 0x5bed.7-0x5bed.7 (0.1)
0x5be0| c9 | . | block_size: 12 0x5bee-0x5bee.3 (0.4)
0x5be0| c9 | . | block_size: 4096 (12) 0x5bee-0x5bee.3 (0.4)
0x5be0| c9 | . | sample_rate: 44100 (9) 0x5bee.4-0x5bee.7 (0.4)
0x5be0| 08| .| channel_assignment: 1 (0) (mono) 0x5bef-0x5bef.3 (0.4)
0x5be0| 08| .| sample_size: 16 (4) 0x5bef.4-0x5bef.6 (0.3)
Expand Down Expand Up @@ -600,7 +600,7 @@ $ fq -d flac verbose /mono16.flac
0x79a0| ff f8 | .. | sync: 0b11111111111110 (valid) 0x79a2-0x79a3.5 (1.6)
0x79a0| f8 | . | reserved0: 0 (valid) 0x79a3.6-0x79a3.6 (0.1)
0x79a0| f8 | . | blocking_strategy: "Fixed" (0) 0x79a3.7-0x79a3.7 (0.1)
0x79a0| 79 | y | block_size: 7 (end of header (16 bit)) 0x79a4-0x79a4.3 (0.4)
0x79a0| 79 | y | block_size: 0 (7) (end of header (16 bit)) 0x79a4-0x79a4.3 (0.4)
0x79a0| 79 | y | sample_rate: 44100 (9) 0x79a4.4-0x79a4.7 (0.4)
0x79a0| 08 | . | channel_assignment: 1 (0) (mono) 0x79a5-0x79a5.3 (0.4)
0x79a0| 08 | . | sample_size: 16 (4) 0x79a5.4-0x79a5.6 (0.3)
Expand Down
12 changes: 6 additions & 6 deletions format/flac/testdata/mono24.fqtest
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ $ fq -d flac verbose /mono24.flac
0x2090| ff f8 | .. | sync: 0b11111111111110 (valid) 0x209c-0x209d.5 (1.6)
0x2090| f8 | . | reserved0: 0 (valid) 0x209d.6-0x209d.6 (0.1)
0x2090| f8 | . | blocking_strategy: "Fixed" (0) 0x209d.7-0x209d.7 (0.1)
0x2090| c9 | . | block_size: 12 0x209e-0x209e.3 (0.4)
0x2090| c9 | . | block_size: 4096 (12) 0x209e-0x209e.3 (0.4)
0x2090| c9 | . | sample_rate: 44100 (9) 0x209e.4-0x209e.7 (0.4)
0x2090| 0c| .| channel_assignment: 1 (0) (mono) 0x209f-0x209f.3 (0.4)
0x2090| 0c| .| sample_size: 24 (6) 0x209f.4-0x209f.6 (0.3)
Expand All @@ -78,7 +78,7 @@ $ fq -d flac verbose /mono24.flac
0x20a0| ff f8 | .. | sync: 0b11111111111110 (valid) 0x20a8-0x20a9.5 (1.6)
0x20a0| f8 | . | reserved0: 0 (valid) 0x20a9.6-0x20a9.6 (0.1)
0x20a0| f8 | . | blocking_strategy: "Fixed" (0) 0x20a9.7-0x20a9.7 (0.1)
0x20a0| c9 | . | block_size: 12 0x20aa-0x20aa.3 (0.4)
0x20a0| c9 | . | block_size: 4096 (12) 0x20aa-0x20aa.3 (0.4)
0x20a0| c9 | . | sample_rate: 44100 (9) 0x20aa.4-0x20aa.7 (0.4)
0x20a0| 0c | . | channel_assignment: 1 (0) (mono) 0x20ab-0x20ab.3 (0.4)
0x20a0| 0c | . | sample_size: 24 (6) 0x20ab.4-0x20ab.6 (0.3)
Expand Down Expand Up @@ -301,7 +301,7 @@ $ fq -d flac verbose /mono24.flac
0x27e0|ff f8 |.. | sync: 0b11111111111110 (valid) 0x27e0-0x27e1.5 (1.6)
0x27e0| f8 | . | reserved0: 0 (valid) 0x27e1.6-0x27e1.6 (0.1)
0x27e0| f8 | . | blocking_strategy: "Fixed" (0) 0x27e1.7-0x27e1.7 (0.1)
0x27e0| c9 | . | block_size: 12 0x27e2-0x27e2.3 (0.4)
0x27e0| c9 | . | block_size: 4096 (12) 0x27e2-0x27e2.3 (0.4)
0x27e0| c9 | . | sample_rate: 44100 (9) 0x27e2.4-0x27e2.7 (0.4)
0x27e0| 0c | . | channel_assignment: 1 (0) (mono) 0x27e3-0x27e3.3 (0.4)
0x27e0| 0c | . | sample_size: 24 (6) 0x27e3.4-0x27e3.6 (0.3)
Expand Down Expand Up @@ -522,7 +522,7 @@ $ fq -d flac verbose /mono24.flac
0x56f0|f8 |. |
0x56f0|f8 |. | reserved0: 0 (valid) 0x56f0.6-0x56f0.6 (0.1)
0x56f0|f8 |. | blocking_strategy: "Fixed" (0) 0x56f0.7-0x56f0.7 (0.1)
0x56f0| c9 | . | block_size: 12 0x56f1-0x56f1.3 (0.4)
0x56f0| c9 | . | block_size: 4096 (12) 0x56f1-0x56f1.3 (0.4)
0x56f0| c9 | . | sample_rate: 44100 (9) 0x56f1.4-0x56f1.7 (0.4)
0x56f0| 0c | . | channel_assignment: 1 (0) (mono) 0x56f2-0x56f2.3 (0.4)
0x56f0| 0c | . | sample_size: 24 (6) 0x56f2.4-0x56f2.6 (0.3)
Expand Down Expand Up @@ -574,7 +574,7 @@ $ fq -d flac verbose /mono24.flac
0x7cf0| ff f8 | .. | sync: 0b11111111111110 (valid) 0x7cfa-0x7cfb.5 (1.6)
0x7cf0| f8 | . | reserved0: 0 (valid) 0x7cfb.6-0x7cfb.6 (0.1)
0x7cf0| f8 | . | blocking_strategy: "Fixed" (0) 0x7cfb.7-0x7cfb.7 (0.1)
0x7cf0| c9 | . | block_size: 12 0x7cfc-0x7cfc.3 (0.4)
0x7cf0| c9 | . | block_size: 4096 (12) 0x7cfc-0x7cfc.3 (0.4)
0x7cf0| c9 | . | sample_rate: 44100 (9) 0x7cfc.4-0x7cfc.7 (0.4)
0x7cf0| 0c | . | channel_assignment: 1 (0) (mono) 0x7cfd-0x7cfd.3 (0.4)
0x7cf0| 0c | . | sample_size: 24 (6) 0x7cfd.4-0x7cfd.6 (0.3)
Expand Down Expand Up @@ -702,7 +702,7 @@ $ fq -d flac verbose /mono24.flac
0xaab0| ff f8 | .. | sync: 0b11111111111110 (valid) 0xaab2-0xaab3.5 (1.6)
0xaab0| f8 | . | reserved0: 0 (valid) 0xaab3.6-0xaab3.6 (0.1)
0xaab0| f8 | . | blocking_strategy: "Fixed" (0) 0xaab3.7-0xaab3.7 (0.1)
0xaab0| 79 | y | block_size: 7 (end of header (16 bit)) 0xaab4-0xaab4.3 (0.4)
0xaab0| 79 | y | block_size: 0 (7) (end of header (16 bit)) 0xaab4-0xaab4.3 (0.4)
0xaab0| 79 | y | sample_rate: 44100 (9) 0xaab4.4-0xaab4.7 (0.4)
0xaab0| 0c | . | channel_assignment: 1 (0) (mono) 0xaab5-0xaab5.3 (0.4)
0xaab0| 0c | . | sample_size: 24 (6) 0xaab5.4-0xaab5.6 (0.3)
Expand Down

0 comments on commit 2af08da

Please sign in to comment.