Suggested edits

This commit is contained in:
Jonathan Behrens committed 2022-06-26 20:45:21 -07:00
1 parent 8e5c5b44c5
commit 5e7702a874
2 files changed
+5 -3

No files matched your search

+1 -1
View File
@@ -486,11 +486,11 @@ impl Image {
} else if padding.0 > 0 && self.predictor == Predictor::FloatingPoint { } else if padding.0 > 0 && self.predictor == Predictor::FloatingPoint {
// The floating point predictor shuffles the padding bytes into the encoded output, so // The floating point predictor shuffles the padding bytes into the encoded output, so
// this case is handled specially when needed. // this case is handled specially when needed.
let mut encoded = vec![0u8; chunk_dimensions.0 * samples * byte_len];
for row in 0..(chunk_dimensions.1 - padding.1) { for row in 0..(chunk_dimensions.1 - padding.1) {
let row_start = row * output_width * samples; let row_start = row * output_width * samples;
let row_end = row_start + (chunk_dimensions.0 - padding.0) * samples; let row_end = row_start + (chunk_dimensions.0 - padding.0) * samples;
let mut encoded = vec![0u8; chunk_dimensions.0 * samples * byte_len];
reader.read_exact(&mut encoded)?; reader.read_exact(&mut encoded)?;
match buffer.subrange(row_start..row_end) { match buffer.subrange(row_start..row_end) {
DecodingBuffer::F32(buf) => fp_predict_f32(&mut encoded, buf, samples), DecodingBuffer::F32(buf) => fp_predict_f32(&mut encoded, buf, samples),
+4 -2
View File
@@ -416,7 +416,9 @@ fn fix_endianness_and_predict(
DecodingBuffer::I16(buf) => rev_hpredict_nsamp(buf, samples), DecodingBuffer::I16(buf) => rev_hpredict_nsamp(buf, samples),
DecodingBuffer::I32(buf) => rev_hpredict_nsamp(buf, samples), DecodingBuffer::I32(buf) => rev_hpredict_nsamp(buf, samples),
DecodingBuffer::I64(buf) => rev_hpredict_nsamp(buf, samples), DecodingBuffer::I64(buf) => rev_hpredict_nsamp(buf, samples),
DecodingBuffer::F32(_) | DecodingBuffer::F64(_) => unreachable!(), DecodingBuffer::F32(_) | DecodingBuffer::F64(_) => {
unreachable!("Caller should have validated arguments. Please file a bug.")
}
} }
} }
Predictor::FloatingPoint => { Predictor::FloatingPoint => {
@@ -424,7 +426,7 @@ fn fix_endianness_and_predict(
match image { match image {
DecodingBuffer::F32(buf) => fp_predict_f32(&mut buffer_copy, buf, samples), DecodingBuffer::F32(buf) => fp_predict_f32(&mut buffer_copy, buf, samples),
DecodingBuffer::F64(buf) => fp_predict_f64(&mut buffer_copy, buf, samples), DecodingBuffer::F64(buf) => fp_predict_f64(&mut buffer_copy, buf, samples),
_ => unreachable!(), _ => unreachable!("Caller should have validated arguments. Please file a bug."),
} }
} }
Predictor::__NonExhaustive => unreachable!(), Predictor::__NonExhaustive => unreachable!(),