@@ -132,8 +132,7 @@ LoadInterleaved4PromoteN(D d, const SrcT* ptr, size_t count);
132132template <class D , typename DstT, typename VecMathT, typename VecAlphaLaneT>
133133inline void
134134StoreInterleaved4RgbAlphaPassthrough (D d, DstT* ptr, VecMathT r, VecMathT g,
135- VecMathT b,
136- VecAlphaLaneT a_passthrough);
135+ VecMathT b, VecAlphaLaneT a_passthrough);
137136
138137// -----------------------------------------------------------------------
139138// Load and Promote
@@ -267,8 +266,8 @@ PromoteVec(D d, VecT v)
267266 return hn::Mul (v_promoted, hn::Set (d, (MathT)(1.0 / 4294967295.0 )));
268267 } else if constexpr (std::is_same_v<SrcT, int32_t >) {
269268 auto v_promoted = hn::ConvertTo (d, v);
270- auto v_norm = hn::Mul (v_promoted,
271- hn::Set (d, (MathT)(1.0 / 2147483647.0 )));
269+ auto v_norm = hn::Mul (v_promoted,
270+ hn::Set (d, (MathT)(1.0 / 2147483647.0 )));
272271 return hn::Max (v_norm, hn::Set (d, (MathT)-1.0 ));
273272 } else if constexpr (std::is_same_v<SrcT, uint64_t >) {
274273 auto d_u32 = hn::Rebind<uint32_t , D>();
@@ -551,10 +550,10 @@ DemoteVec(D d, VecT v)
551550 auto d_u8 = hn::Rebind<uint8_t , D>();
552551 return hn::DemoteTo (d_u8, v_i16);
553552 } else if constexpr (std::is_same_v<DstT, int8_t >) {
554- VecD v_denorm = hn::Mul ((VecD)v, hn::Set (d, (MathT)127.0 ));
555- auto is_neg = hn::Lt (v_denorm, hn::Zero (d));
556- auto v_bias = hn::IfThenElse (is_neg, hn::Set (d, (MathT)-0.5 ),
557- hn::Set (d, (MathT)0.5 ));
553+ VecD v_denorm = hn::Mul ((VecD)v, hn::Set (d, (MathT)127.0 ));
554+ auto is_neg = hn::Lt (v_denorm, hn::Zero (d));
555+ auto v_bias = hn::IfThenElse (is_neg, hn::Set (d, (MathT)-0.5 ),
556+ hn::Set (d, (MathT)0.5 ));
558557 VecD v_rounded = hn::Add (v_denorm, v_bias);
559558 VecD v_clamped = hn::Max (v_rounded, hn::Set (d, (MathT)-128.0 ));
560559 v_clamped = hn::Min (v_clamped, hn::Set (d, (MathT)127.0 ));
@@ -576,10 +575,10 @@ DemoteVec(D d, VecT v)
576575 auto d_u16 = hn::Rebind<uint16_t , D>();
577576 return hn::DemoteTo (d_u16, vi32);
578577 } else if constexpr (std::is_same_v<DstT, int16_t >) {
579- VecD v_denorm = hn::Mul ((VecD)v, hn::Set (d, (MathT)32767.0 ));
580- auto is_neg = hn::Lt (v_denorm, hn::Zero (d));
581- auto v_bias = hn::IfThenElse (is_neg, hn::Set (d, (MathT)-0.5 ),
582- hn::Set (d, (MathT)0.5 ));
578+ VecD v_denorm = hn::Mul ((VecD)v, hn::Set (d, (MathT)32767.0 ));
579+ auto is_neg = hn::Lt (v_denorm, hn::Zero (d));
580+ auto v_bias = hn::IfThenElse (is_neg, hn::Set (d, (MathT)-0.5 ),
581+ hn::Set (d, (MathT)0.5 ));
583582 VecD v_rounded = hn::Add (v_denorm, v_bias);
584583 VecD v_clamped = hn::Max (v_rounded, hn::Set (d, (MathT)-32768.0 ));
585584 v_clamped = hn::Min (v_clamped, hn::Set (d, (MathT)32767.0 ));
@@ -595,10 +594,10 @@ DemoteVec(D d, VecT v)
595594 auto d_u32 = hn::Rebind<uint32_t , D>();
596595 return hn::ConvertTo (d_u32, v_clamped);
597596 } else if constexpr (std::is_same_v<DstT, int32_t >) {
598- VecD v_denorm = hn::Mul ((VecD)v, hn::Set (d, (MathT)2147483647.0 ));
599- auto is_neg = hn::Lt (v_denorm, hn::Zero (d));
600- auto v_bias = hn::IfThenElse (is_neg, hn::Set (d, (MathT)-0.5 ),
601- hn::Set (d, (MathT)0.5 ));
597+ VecD v_denorm = hn::Mul ((VecD)v, hn::Set (d, (MathT)2147483647.0 ));
598+ auto is_neg = hn::Lt (v_denorm, hn::Zero (d));
599+ auto v_bias = hn::IfThenElse (is_neg, hn::Set (d, (MathT)-0.5 ),
600+ hn::Set (d, (MathT)0.5 ));
602601 VecD v_rounded = hn::Add (v_denorm, v_bias);
603602 VecD v_clamped = hn::Max (v_rounded, hn::Set (d, (MathT)-2147483648.0 ));
604603 v_clamped = hn::Min (v_clamped, hn::Set (d, (MathT)2147483647.0 ));
@@ -932,15 +931,15 @@ RunHwyTernaryCmd(Rtype* r, const ABCtype* a, const ABCtype* b, const ABCtype* c,
932931// / covers the full pixel).
933932template <typename Rtype, typename Atype, typename Btype, typename OpFunc>
934933inline bool
935- hwy_binary_perpixel_op (ImageBuf& R, const ImageBuf& A, const ImageBuf& B, ROI roi,
936- int nthreads, OpFunc op)
934+ hwy_binary_perpixel_op (ImageBuf& R, const ImageBuf& A, const ImageBuf& B,
935+ ROI roi, int nthreads, OpFunc op)
937936{
938937 auto Rv = HwyPixels (R);
939938 auto Av = HwyPixels (A);
940939 auto Bv = HwyPixels (B);
941940 ImageBufAlgo::parallel_image (roi, nthreads, [&, op](ROI roi) {
942941 const int nchannels = RoiNChannels (roi);
943- const size_t n = static_cast <size_t >(roi.width ())
942+ const size_t n = static_cast <size_t >(roi.width ())
944943 * static_cast <size_t >(nchannels);
945944 for (int y = roi.ybegin ; y < roi.yend ; ++y) {
946945 Rtype* r_row = RoiRowPtr<Rtype>(Rv, y, roi);
@@ -967,7 +966,7 @@ hwy_ternary_perpixel_op(ImageBuf& R, const ImageBuf& A, const ImageBuf& B,
967966 auto Cv = HwyPixels (C);
968967 ImageBufAlgo::parallel_image (roi, nthreads, [&, op](ROI roi) {
969968 const int nchannels = RoiNChannels (roi);
970- const size_t n = static_cast <size_t >(roi.width ())
969+ const size_t n = static_cast <size_t >(roi.width ())
971970 * static_cast <size_t >(nchannels);
972971 for (int y = roi.ybegin ; y < roi.yend ; ++y) {
973972 Rtype* r_row = RoiRowPtr<Rtype>(Rv, y, roi);
@@ -994,7 +993,7 @@ hwy_binary_native_int_perpixel_op(ImageBuf& R, const ImageBuf& A,
994993 auto Bv = HwyPixels (B);
995994 ImageBufAlgo::parallel_image (roi, nthreads, [&, op](ROI roi) {
996995 const int nchannels = RoiNChannels (roi);
997- const size_t n = static_cast <size_t >(roi.width ())
996+ const size_t n = static_cast <size_t >(roi.width ())
998997 * static_cast <size_t >(nchannels);
999998 for (int y = roi.ybegin ; y < roi.yend ; ++y) {
1000999 T* r_row = RoiRowPtr<T>(Rv, y, roi);
@@ -1063,9 +1062,9 @@ hwy_binary_perpixel_op_rgba_rgb_roi(ImageBuf& R, const ImageBuf& A,
10631062
10641063 ImageBufAlgo::parallel_image (roi4, nthreads, [&, op](ROI roi4) {
10651064 for (int y = roi4.ybegin ; y < roi4.yend ; ++y) {
1066- Rtype* r_row = RoiRowPtr<Rtype>(Rv, y, roi4);
1067- const Atype* a_row = RoiRowPtr<Atype>(Av, y, roi4);
1068- const Btype* b_row = RoiRowPtr<Btype>(Bv, y, roi4);
1065+ Rtype* r_row = RoiRowPtr<Rtype>(Rv, y, roi4);
1066+ const Atype* a_row = RoiRowPtr<Atype>(Av, y, roi4);
1067+ const Btype* b_row = RoiRowPtr<Btype>(Bv, y, roi4);
10691068 const size_t npixels = static_cast <size_t >(roi4.width ());
10701069
10711070 size_t x = 0 ;
@@ -1081,8 +1080,8 @@ hwy_binary_perpixel_op_rgba_rgb_roi(ImageBuf& R, const ImageBuf& A,
10811080 auto d_dstlane = hn::Rebind<DstLaneT, decltype (d)>();
10821081 hn::Vec<decltype (d_dstlane)> dr, dg, db, da;
10831082 hn::LoadInterleaved4 (d_dstlane,
1084- reinterpret_cast <const DstLaneT*>(
1085- r_row + off),
1083+ reinterpret_cast <const DstLaneT*>(r_row
1084+ + off),
10861085 dr, dg, db, da);
10871086 (void )dr;
10881087 (void )dg;
@@ -1097,11 +1096,11 @@ hwy_binary_perpixel_op_rgba_rgb_roi(ImageBuf& R, const ImageBuf& A,
10971096
10981097 const size_t remaining = npixels - x;
10991098 if (remaining > 0 ) {
1100- const size_t off = x * 4 ;
1101- auto [ar, ag, ab, aa]
1102- = LoadInterleaved4PromoteN (d, a_row + off, remaining);
1103- auto [br, bg, bb, ba]
1104- = LoadInterleaved4PromoteN (d, b_row + off, remaining);
1099+ const size_t off = x * 4 ;
1100+ auto [ar, ag, ab, aa] = LoadInterleaved4PromoteN (d, a_row + off,
1101+ remaining);
1102+ auto [br, bg, bb, ba] = LoadInterleaved4PromoteN (d, b_row + off,
1103+ remaining);
11051104 (void )aa;
11061105 (void )ba;
11071106 auto rr = op (d, ar, br);
@@ -1170,8 +1169,8 @@ hwy_ternary_perpixel_op_rgba_rgb_roi(ImageBuf& R, const ImageBuf& A,
11701169 auto d_dstlane = hn::Rebind<DstLaneT, decltype (d)>();
11711170 hn::Vec<decltype (d_dstlane)> dr, dg, db, da;
11721171 hn::LoadInterleaved4 (d_dstlane,
1173- reinterpret_cast <const DstLaneT*>(
1174- r_row + off),
1172+ reinterpret_cast <const DstLaneT*>(r_row
1173+ + off),
11751174 dr, dg, db, da);
11761175 (void )dr;
11771176 (void )dg;
@@ -1186,13 +1185,13 @@ hwy_ternary_perpixel_op_rgba_rgb_roi(ImageBuf& R, const ImageBuf& A,
11861185
11871186 const size_t remaining = npixels - x;
11881187 if (remaining > 0 ) {
1189- const size_t off = x * 4 ;
1190- auto [ar, ag, ab, aa]
1191- = LoadInterleaved4PromoteN (d, a_row + off, remaining);
1192- auto [br, bg, bb, ba]
1193- = LoadInterleaved4PromoteN (d, b_row + off, remaining);
1194- auto [cr, cg, cb, ca]
1195- = LoadInterleaved4PromoteN (d, c_row + off, remaining);
1188+ const size_t off = x * 4 ;
1189+ auto [ar, ag, ab, aa] = LoadInterleaved4PromoteN (d, a_row + off,
1190+ remaining);
1191+ auto [br, bg, bb, ba] = LoadInterleaved4PromoteN (d, b_row + off,
1192+ remaining);
1193+ auto [cr, cg, cb, ca] = LoadInterleaved4PromoteN (d, c_row + off,
1194+ remaining);
11961195 (void )aa;
11971196 (void )ba;
11981197 (void )ca;
@@ -1246,7 +1245,7 @@ hwy_binary_native_int_perpixel_op_rgba_rgb_roi(ImageBuf& R, const ImageBuf& A,
12461245 T* r_row = RoiRowPtr<T>(Rv, y, roi4);
12471246 const T* a_row = RoiRowPtr<T>(Av, y, roi4);
12481247 const T* b_row = RoiRowPtr<T>(Bv, y, roi4);
1249- size_t i = 0 ;
1248+ size_t i = 0 ;
12501249 for (; i + lanes <= n; i += lanes) {
12511250 auto va = hn::Load (d, a_row + i);
12521251 auto vb = hn::Load (d, b_row + i);
0 commit comments