decoder/{dsf,dsdiff}: precalculate bit rate
This commit is contained in:
parent
0da9c91af2
commit
bf49c9e4e2
@ -362,6 +362,7 @@ dsdiff_decode_chunk(DecoderClient &client, InputStream &is,
|
|||||||
unsigned channels, unsigned sample_rate,
|
unsigned channels, unsigned sample_rate,
|
||||||
const offset_type total_bytes)
|
const offset_type total_bytes)
|
||||||
{
|
{
|
||||||
|
const unsigned kbit_rate = channels * sample_rate / 1000;
|
||||||
const offset_type start_offset = is.GetOffset();
|
const offset_type start_offset = is.GetOffset();
|
||||||
|
|
||||||
uint8_t buffer[8192];
|
uint8_t buffer[8192];
|
||||||
@ -408,7 +409,7 @@ dsdiff_decode_chunk(DecoderClient &client, InputStream &is,
|
|||||||
bit_reverse_buffer(buffer, buffer + nbytes);
|
bit_reverse_buffer(buffer, buffer + nbytes);
|
||||||
|
|
||||||
cmd = client.SubmitData(is, buffer, nbytes,
|
cmd = client.SubmitData(is, buffer, nbytes,
|
||||||
channels * sample_rate / 1000);
|
kbit_rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -256,6 +256,7 @@ dsf_decode_chunk(DecoderClient &client, InputStream &is,
|
|||||||
offset_type n_blocks,
|
offset_type n_blocks,
|
||||||
bool bitreverse)
|
bool bitreverse)
|
||||||
{
|
{
|
||||||
|
const unsigned kbit_rate = channels * sample_rate / 1000;
|
||||||
const size_t block_size = channels * DSF_BLOCK_SIZE;
|
const size_t block_size = channels * DSF_BLOCK_SIZE;
|
||||||
const offset_type start_offset = is.GetOffset();
|
const offset_type start_offset = is.GetOffset();
|
||||||
|
|
||||||
@ -291,7 +292,7 @@ dsf_decode_chunk(DecoderClient &client, InputStream &is,
|
|||||||
|
|
||||||
cmd = client.SubmitData(is,
|
cmd = client.SubmitData(is,
|
||||||
interleaved_buffer, block_size,
|
interleaved_buffer, block_size,
|
||||||
channels * sample_rate / 1000);
|
kbit_rate);
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user