Skip to content

Commit 9325ad7

Browse files
committed
Bugfixes
1 parent 2ba1f58 commit 9325ad7

File tree

3 files changed

+25
-25
lines changed

3 files changed

+25
-25
lines changed

app/src/main.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,22 +52,22 @@ fn main() {
5252

5353
let mut working_store = transient.to_vec();
5454

55-
let start = Instant::now();
56-
5755
let src_size = ImageSize::new(dimensions.0 as usize, dimensions.1 as usize);
58-
let dst_size = ImageSize::new(dimensions.0 as usize / 2, dimensions.1 as usize / 2);
56+
let dst_size = ImageSize::new(dimensions.0 as usize + 1, dimensions.1 as usize + 1);
5957

6058
let start_mul = Instant::now();
6159

6260
premultiply_rgba8(&mut working_store);
6361

6462
println!("Alpha mul time {:?}", start_mul.elapsed());
6563

64+
let start = Instant::now();
65+
6666
let mut resized = resize_rgba8(
6767
&working_store,
6868
src_size,
6969
dst_size,
70-
ResamplingFunction::Lanczos3,
70+
ResamplingFunction::Bilinear,
7171
)
7272
.unwrap();
7373

@@ -93,14 +93,14 @@ fn main() {
9393
.unwrap();
9494

9595
// let mut src_bytes = transient.as_bytes().to_vec();
96-
// let pixel_type: PixelType = PixelType::U8x3;
96+
// let pixel_type: PixelType = PixelType::U8x4;
9797
// let src_image =
9898
// Image::from_slice_u8(dimensions.0, dimensions.1, &mut src_bytes, pixel_type).unwrap();
99-
// let mut dst_image = Image::new(dimensions.0 / 8, dimensions.1 / 8, pixel_type);
99+
// let mut dst_image = Image::new(dimensions.0 / 2, dimensions.1 / 2, pixel_type);
100100
//
101101
// let mut resizer = Resizer::new();
102102
// unsafe {
103-
// resizer.set_cpu_extensions(CpuExtensions::None);
103+
// resizer.set_cpu_extensions(CpuExtensions::Neon);
104104
// }
105105
//
106106
// let start = Instant::now();
@@ -126,7 +126,7 @@ fn main() {
126126
// dst_image.buffer(),
127127
// dst_image.width(),
128128
// dst_image.height(),
129-
// image::ColorType::Rgb8,
129+
// image::ColorType::Rgba8,
130130
// )
131131
// .unwrap();
132132
}

src/floating_point_vertical.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -413,8 +413,8 @@ pub(crate) fn convolve_column_handler_floating_point<
413413
let weight1 = weights[1].as_();
414414
let offset0 = src_stride * bounds_start + v_start_px;
415415
let offset1 = src_stride * (bounds_start + 1) + v_start_px;
416-
let src_ptr0 = &src[offset0..(offset0 + CHANNELS * 4)];
417-
let src_ptr1 = &src[offset1..(offset1 + CHANNELS * 4)];
416+
let src_ptr0 = &src[offset0..(offset0 + CHANNELS)];
417+
let src_ptr1 = &src[offset1..(offset1 + CHANNELS)];
418418

419419
sums0 = (fast_load_color_group_with_offset!(src_ptr0, CHANNELS, 0, J) * weight0).mul_add(
420420
fast_load_color_group_with_offset!(src_ptr1, CHANNELS, 0, J),
@@ -428,9 +428,9 @@ pub(crate) fn convolve_column_handler_floating_point<
428428
let offset0 = src_stride * bounds_start + v_start_px;
429429
let offset1 = src_stride * (bounds_start + 1) + v_start_px;
430430
let offset2 = src_stride * (bounds_start + 2) + v_start_px;
431-
let src_ptr0 = &src[offset0..(offset0 + CHANNELS * 4)];
432-
let src_ptr1 = &src[offset1..(offset1 + CHANNELS * 4)];
433-
let src_ptr2 = &src[offset2..(offset2 + CHANNELS * 4)];
431+
let src_ptr0 = &src[offset0..(offset0 + CHANNELS)];
432+
let src_ptr1 = &src[offset1..(offset1 + CHANNELS)];
433+
let src_ptr2 = &src[offset2..(offset2 + CHANNELS)];
434434

435435
sums0 = (fast_load_color_group_with_offset!(src_ptr0, CHANNELS, 0, J) * weight0)
436436
.mul_add(
@@ -451,10 +451,10 @@ pub(crate) fn convolve_column_handler_floating_point<
451451
let offset1 = src_stride * (bounds_start + 1) + v_start_px;
452452
let offset2 = src_stride * (bounds_start + 2) + v_start_px;
453453
let offset3 = src_stride * (bounds_start + 3) + v_start_px;
454-
let src_ptr0 = &src[offset0..(offset0 + CHANNELS * 4)];
455-
let src_ptr1 = &src[offset1..(offset1 + CHANNELS * 4)];
456-
let src_ptr2 = &src[offset2..(offset2 + CHANNELS * 4)];
457-
let src_ptr3 = &src[offset3..(offset3 + CHANNELS * 4)];
454+
let src_ptr0 = &src[offset0..(offset0 + CHANNELS)];
455+
let src_ptr1 = &src[offset1..(offset1 + CHANNELS)];
456+
let src_ptr2 = &src[offset2..(offset2 + CHANNELS)];
457+
let src_ptr3 = &src[offset3..(offset3 + CHANNELS)];
458458

459459
sums0 = (fast_load_color_group_with_offset!(src_ptr0, CHANNELS, 0, J) * weight0)
460460
.mul_add(
@@ -483,12 +483,12 @@ pub(crate) fn convolve_column_handler_floating_point<
483483
let offset3 = src_stride * (bounds_start + 3) + v_start_px;
484484
let offset4 = src_stride * (bounds_start + 4) + v_start_px;
485485
let offset5 = src_stride * (bounds_start + 5) + v_start_px;
486-
let src_ptr0 = &src[offset0..(offset0 + CHANNELS * 4)];
487-
let src_ptr1 = &src[offset1..(offset1 + CHANNELS * 4)];
488-
let src_ptr2 = &src[offset2..(offset2 + CHANNELS * 4)];
489-
let src_ptr3 = &src[offset3..(offset3 + CHANNELS * 4)];
490-
let src_ptr4 = &src[offset4..(offset4 + CHANNELS * 4)];
491-
let src_ptr5 = &src[offset5..(offset5 + CHANNELS * 4)];
486+
let src_ptr0 = &src[offset0..(offset0 + CHANNELS)];
487+
let src_ptr1 = &src[offset1..(offset1 + CHANNELS)];
488+
let src_ptr2 = &src[offset2..(offset2 + CHANNELS)];
489+
let src_ptr3 = &src[offset3..(offset3 + CHANNELS)];
490+
let src_ptr4 = &src[offset4..(offset4 + CHANNELS)];
491+
let src_ptr5 = &src[offset5..(offset5 + CHANNELS)];
492492

493493
sums0 = (fast_load_color_group_with_offset!(src_ptr0, CHANNELS, 0, J) * weight0)
494494
.mul_add(

src/sampler.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,13 +263,13 @@ impl ResamplingFunction {
263263
ResamplingFunction::Hermite => ResamplingFilter::new(hermite_spline, 2f32),
264264
ResamplingFunction::BSpline => ResamplingFilter::new(b_spline, 2f32),
265265
ResamplingFunction::Hann => ResamplingFilter::new(hann, 3f32),
266-
ResamplingFunction::Bicubic => ResamplingFilter::new(bicubic_spline, 3f32),
266+
ResamplingFunction::Bicubic => ResamplingFilter::new(bicubic_spline, 2f32),
267267
ResamplingFunction::Lanczos4 => ResamplingFilter::new(lanczos4, 4f32),
268268
ResamplingFunction::Lanczos2 => ResamplingFilter::new(lanczos2, 2f32),
269269
ResamplingFunction::Hamming => ResamplingFilter::new(hamming, 2f32),
270270
ResamplingFunction::Hanning => ResamplingFilter::new(hanning, 2f32),
271271
ResamplingFunction::Welch => ResamplingFilter::new(welch, 2f32),
272-
ResamplingFunction::Quadric => ResamplingFilter::new(quadric, 3f32),
272+
ResamplingFunction::Quadric => ResamplingFilter::new(quadric, 2f32),
273273
ResamplingFunction::Gaussian => ResamplingFilter::new(gaussian, 2f32),
274274
ResamplingFunction::Sphinx => ResamplingFilter::new(sphinx, 2f32),
275275
ResamplingFunction::Bartlett => ResamplingFilter::new(bartlett, 2f32),

0 commit comments

Comments
 (0)