Skip to content

Commit cd8a0a3

Browse files
committed
Merge pull request #1771 from seiko2plus:changeUnvMultiply16
2 parents 334e8b2 + 6305349 commit cd8a0a3

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

modules/xphoto/src/grayworld_white_balance.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ void calculateChannelSums(uint &sumB, uint &sumG, uint &sumR, uchar *src_data, i
130130
v_expand(v_max_val, v_max1, v_max2);
131131

132132
// Calculate masks
133-
v_m1 = ~((v_max1 - v_min1) * v_255 > v_thresh * v_max1);
134-
v_m2 = ~((v_max2 - v_min2) * v_255 > v_thresh * v_max2);
133+
v_m1 = ~(v_mul_wrap(v_max1 - v_min1, v_255) > v_mul_wrap(v_thresh, v_max1));
134+
v_m2 = ~(v_mul_wrap(v_max2 - v_min2, v_255) > v_mul_wrap(v_thresh, v_max2));
135135

136136
// Apply masks
137137
v_iB1 = (v_iB1 & v_m1) + (v_iB2 & v_m2);
@@ -282,12 +282,12 @@ void applyChannelGains(InputArray _src, OutputArray _dst, float gainB, float gai
282282
v_expand(v_inR, v_sR1, v_sR2);
283283

284284
// Multiply by gains
285-
v_sB1 = (v_sB1 * v_gainB) >> 8;
286-
v_sB2 = (v_sB2 * v_gainB) >> 8;
287-
v_sG1 = (v_sG1 * v_gainG) >> 8;
288-
v_sG2 = (v_sG2 * v_gainG) >> 8;
289-
v_sR1 = (v_sR1 * v_gainR) >> 8;
290-
v_sR2 = (v_sR2 * v_gainR) >> 8;
285+
v_sB1 = v_mul_wrap(v_sB1, v_gainB) >> 8;
286+
v_sB2 = v_mul_wrap(v_sB2, v_gainB) >> 8;
287+
v_sG1 = v_mul_wrap(v_sG1, v_gainG) >> 8;
288+
v_sG2 = v_mul_wrap(v_sG2, v_gainG) >> 8;
289+
v_sR1 = v_mul_wrap(v_sR1, v_gainR) >> 8;
290+
v_sR2 = v_mul_wrap(v_sR2, v_gainR) >> 8;
291291

292292
// Pack into vectors of v_uint8x16
293293
v_store_interleave(&dst_data[i], v_pack(v_sB1, v_sB2), v_pack(v_sG1, v_sG2), v_pack(v_sR1, v_sR2));

0 commit comments

Comments
 (0)