Skip to content

Commit

Permalink
Clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
awxkee committed Nov 25, 2024
1 parent 52ca84d commit 454265a
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 59 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Tests performed on the image 5763x3842

| | time(NEON) | Time(AVX) |
|------------------------|:----------:|:---------:|
| utils RGB->YUV 4:2:0 | 3.48ms | 3.64ms |
| utils RGB->YUV 4:2:0 | 3.48ms | 3.53ms |
| libyuv RGB->YUV 4:2:0 | 3.58ms | 33.87ms |
| utils RGBA->YUV 4:2:0 | 4.32ms | 5.47ms |
| libyuv RGBA->YUV 4:2:0 | 4.87ms | 23.48ms |
Expand Down
24 changes: 12 additions & 12 deletions src/avx2/rgb_to_nv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ unsafe fn avx2_rgba_to_nv_impl<
if chroma_subsampling == YuvChromaSubsampling::Yuv444 {
let cb_l = _mm256_max_epi16(
_mm256_min_epi16(
(_mm256_add_epi16(
_mm256_add_epi16(
uv_bias,
_mm256_add_epi16(
_mm256_add_epi16(
Expand All @@ -222,14 +222,14 @@ unsafe fn avx2_rgba_to_nv_impl<
),
_mm256_mulhrs_epi16(b_low, v_cb_b),
),
)),
),
i_cap_uv,
),
i_bias_y,
);
let cr_l = _mm256_max_epi16(
_mm256_min_epi16(
(_mm256_add_epi16(
_mm256_add_epi16(
uv_bias,
_mm256_add_epi16(
_mm256_add_epi16(
Expand All @@ -238,14 +238,14 @@ unsafe fn avx2_rgba_to_nv_impl<
),
_mm256_mulhrs_epi16(b_low, v_cr_b),
),
)),
),
i_cap_uv,
),
i_bias_y,
);
let cb_h = _mm256_max_epi16(
_mm256_min_epi16(
(_mm256_add_epi16(
_mm256_add_epi16(
uv_bias,
_mm256_add_epi16(
_mm256_add_epi16(
Expand All @@ -254,14 +254,14 @@ unsafe fn avx2_rgba_to_nv_impl<
),
_mm256_mulhrs_epi16(b_high, v_cb_b),
),
)),
),
i_cap_uv,
),
i_bias_y,
);
let cr_h = _mm256_max_epi16(
_mm256_min_epi16(
(_mm256_add_epi16(
_mm256_add_epi16(
uv_bias,
_mm256_add_epi16(
_mm256_add_epi16(
Expand All @@ -270,7 +270,7 @@ unsafe fn avx2_rgba_to_nv_impl<
),
_mm256_mulhrs_epi16(b_high, v_cr_b),
),
)),
),
i_cap_uv,
),
i_bias_y,
Expand All @@ -295,7 +295,7 @@ unsafe fn avx2_rgba_to_nv_impl<
let b1 = _mm256_avg_epu16(b_low, b_high);
let cb = _mm256_max_epi16(
_mm256_min_epi16(
(_mm256_add_epi16(
_mm256_add_epi16(
uv_bias,
_mm256_add_epi16(
_mm256_add_epi16(
Expand All @@ -304,14 +304,14 @@ unsafe fn avx2_rgba_to_nv_impl<
),
_mm256_mulhrs_epi16(b1, v_cb_b),
),
)),
),
i_cap_uv,
),
i_bias_y,
);
let cr = _mm256_max_epi16(
_mm256_min_epi16(
(_mm256_add_epi16(
_mm256_add_epi16(
uv_bias,
_mm256_add_epi16(
_mm256_add_epi16(
Expand All @@ -320,7 +320,7 @@ unsafe fn avx2_rgba_to_nv_impl<
),
_mm256_mulhrs_epi16(b1, v_cr_b),
),
)),
),
i_cap_uv,
),
i_bias_y,
Expand Down
28 changes: 14 additions & 14 deletions src/sse/rgb_to_nv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,21 +169,21 @@ unsafe fn sse_rgba_to_nv_row_impl<

let y_l = _mm_max_epi16(
_mm_min_epi16(
(_mm_add_epi16(
_mm_add_epi16(
y_bias,
_mm_add_epi16(
_mm_add_epi16(_mm_mulhrs_epi16(r_low, v_yr), _mm_mulhrs_epi16(g_low, v_yg)),
_mm_mulhrs_epi16(b_low, v_yb),
),
)),
),
i_cap_y,
),
i_bias_y,
);

let y_h = _mm_max_epi16(
_mm_min_epi16(
(_mm_add_epi16(
_mm_add_epi16(
y_bias,
_mm_add_epi16(
_mm_add_epi16(
Expand All @@ -192,7 +192,7 @@ unsafe fn sse_rgba_to_nv_row_impl<
),
_mm_mulhrs_epi16(b_high, v_yb),
),
)),
),
i_cap_y,
),
i_bias_y,
Expand All @@ -204,7 +204,7 @@ unsafe fn sse_rgba_to_nv_row_impl<
if chroma_subsampling == YuvChromaSubsampling::Yuv444 {
let cb_l = _mm_max_epi16(
_mm_min_epi16(
(_mm_add_epi16(
_mm_add_epi16(
uv_bias,
_mm_add_epi16(
_mm_add_epi16(
Expand All @@ -213,7 +213,7 @@ unsafe fn sse_rgba_to_nv_row_impl<
),
_mm_mulhrs_epi16(b_low, v_cb_b),
),
)),
),
i_cap_uv,
),
i_bias_y,
Expand All @@ -236,7 +236,7 @@ unsafe fn sse_rgba_to_nv_row_impl<
);
let cb_h = _mm_max_epi16(
_mm_min_epi16(
(_mm_add_epi16(
_mm_add_epi16(
uv_bias,
_mm_add_epi16(
_mm_add_epi16(
Expand All @@ -245,14 +245,14 @@ unsafe fn sse_rgba_to_nv_row_impl<
),
_mm_mulhrs_epi16(b_high, v_cb_b),
),
)),
),
i_cap_uv,
),
i_bias_y,
);
let cr_h = _mm_max_epi16(
_mm_min_epi16(
(_mm_add_epi16(
_mm_add_epi16(
uv_bias,
_mm_add_epi16(
_mm_add_epi16(
Expand All @@ -261,7 +261,7 @@ unsafe fn sse_rgba_to_nv_row_impl<
),
_mm_mulhrs_epi16(b_high, v_cr_b),
),
)),
),
i_cap_uv,
),
i_bias_y,
Expand Down Expand Up @@ -292,7 +292,7 @@ unsafe fn sse_rgba_to_nv_row_impl<

let cbk = _mm_max_epi16(
_mm_min_epi16(
(_mm_add_epi16(
_mm_add_epi16(
uv_bias,
_mm_add_epi16(
_mm_add_epi16(
Expand All @@ -301,15 +301,15 @@ unsafe fn sse_rgba_to_nv_row_impl<
),
_mm_mulhrs_epi16(b1, v_cb_b),
),
)),
),
i_cap_uv,
),
i_bias_y,
);

let crk = _mm_max_epi16(
_mm_min_epi16(
(_mm_add_epi16(
_mm_add_epi16(
uv_bias,
_mm_add_epi16(
_mm_add_epi16(
Expand All @@ -318,7 +318,7 @@ unsafe fn sse_rgba_to_nv_row_impl<
),
_mm_mulhrs_epi16(b1, v_cr_b),
),
)),
),
i_cap_uv,
),
i_bias_y,
Expand Down
8 changes: 4 additions & 4 deletions src/sse/rgb_to_y.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,21 +128,21 @@ unsafe fn sse_rgb_to_y_impl<const ORIGIN_CHANNELS: u8>(

let y_l = _mm_max_epi16(
_mm_min_epi16(
(_mm_add_epi16(
_mm_add_epi16(
y_bias,
_mm_add_epi16(
_mm_add_epi16(_mm_mulhrs_epi16(r_low, v_yr), _mm_mulhrs_epi16(g_low, v_yg)),
_mm_mulhrs_epi16(b_low, v_yb),
),
)),
),
i_cap_y,
),
i_bias_y,
);

let y_h = _mm_max_epi16(
_mm_min_epi16(
(_mm_add_epi16(
_mm_add_epi16(
y_bias,
_mm_add_epi16(
_mm_add_epi16(
Expand All @@ -151,7 +151,7 @@ unsafe fn sse_rgb_to_y_impl<const ORIGIN_CHANNELS: u8>(
),
_mm_mulhrs_epi16(b_high, v_yb),
),
)),
),
i_cap_y,
),
i_bias_y,
Expand Down
Loading

0 comments on commit 454265a

Please sign in to comment.