mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:27:45 +00:00
LibAudio: Use size_t in loops
This is more idiomatic :^)
This commit is contained in:
parent
f3aa87c436
commit
442aa48a61
1 changed files with 5 additions and 5 deletions
|
@ -740,17 +740,17 @@ Vector<i32> FlacLoaderPlugin::decode_residual(Vector<i32>& decoded, FlacSubframe
|
||||||
{
|
{
|
||||||
u8 residual_mode = bit_input.read_bits_big_endian(2);
|
u8 residual_mode = bit_input.read_bits_big_endian(2);
|
||||||
u8 partition_order = bit_input.read_bits_big_endian(4);
|
u8 partition_order = bit_input.read_bits_big_endian(4);
|
||||||
u32 partitions = 1 << partition_order;
|
size_t partitions = 1 << partition_order;
|
||||||
|
|
||||||
if (residual_mode == FlacResidualMode::Rice4Bit) {
|
if (residual_mode == FlacResidualMode::Rice4Bit) {
|
||||||
// decode a single Rice partition with four bits for the order k
|
// decode a single Rice partition with four bits for the order k
|
||||||
for (u32 i = 0; i < partitions; ++i) {
|
for (size_t i = 0; i < partitions; ++i) {
|
||||||
auto rice_partition = decode_rice_partition(4, partitions, i, subframe, bit_input);
|
auto rice_partition = decode_rice_partition(4, partitions, i, subframe, bit_input);
|
||||||
decoded.extend(move(rice_partition));
|
decoded.extend(move(rice_partition));
|
||||||
}
|
}
|
||||||
} else if (residual_mode == FlacResidualMode::Rice5Bit) {
|
} else if (residual_mode == FlacResidualMode::Rice5Bit) {
|
||||||
// five bits equivalent
|
// five bits equivalent
|
||||||
for (u32 i = 0; i < partitions; ++i) {
|
for (size_t i = 0; i < partitions; ++i) {
|
||||||
auto rice_partition = decode_rice_partition(5, partitions, i, subframe, bit_input);
|
auto rice_partition = decode_rice_partition(5, partitions, i, subframe, bit_input);
|
||||||
decoded.extend(move(rice_partition));
|
decoded.extend(move(rice_partition));
|
||||||
}
|
}
|
||||||
|
@ -782,11 +782,11 @@ ALWAYS_INLINE Vector<i32> FlacLoaderPlugin::decode_rice_partition(u8 partition_t
|
||||||
// escape code for unencoded binary partition
|
// escape code for unencoded binary partition
|
||||||
if (k == (1 << partition_type) - 1) {
|
if (k == (1 << partition_type) - 1) {
|
||||||
u8 unencoded_bps = bit_input.read_bits_big_endian(5);
|
u8 unencoded_bps = bit_input.read_bits_big_endian(5);
|
||||||
for (u32 r = 0; r < residual_sample_count; ++r) {
|
for (size_t r = 0; r < residual_sample_count; ++r) {
|
||||||
rice_partition[r] = bit_input.read_bits_big_endian(unencoded_bps);
|
rice_partition[r] = bit_input.read_bits_big_endian(unencoded_bps);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (u32 r = 0; r < residual_sample_count; ++r) {
|
for (size_t r = 0; r < residual_sample_count; ++r) {
|
||||||
rice_partition[r] = decode_unsigned_exp_golomb(k, bit_input);
|
rice_partition[r] = decode_unsigned_exp_golomb(k, bit_input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue