Commit 4c433197 authored by Seon-Wook Park's avatar Seon-Wook Park

Be more correct with int types

parent ba0b4023
......@@ -165,9 +165,9 @@ namespace cv { namespace xphoto {
}
// Fixed point arithmetic, mul by 2^8 then shift back 8 bits
unsigned int i_inv1 = inv1 * (1 << 8),
i_inv2 = inv2 * (1 << 8),
i_inv3 = inv3 * (1 << 8);
int i_inv1 = cvRound(inv1 * (1 << 8)),
i_inv2 = cvRound(inv2 * (1 << 8)),
i_inv3 = cvRound(inv3 * (1 << 8));
// Scale input pixel values
uchar* dst_data = dst.ptr<uchar>(0);
......@@ -175,9 +175,9 @@ namespace cv { namespace xphoto {
#if CV_SIMD128
v_uint8x16 v_outB, v_outG, v_outR;
v_uint16x8 v_sB1, v_sB2, v_sG1, v_sG2, v_sR1, v_sR2,
v_invB = v_setall_u16(i_inv1),
v_invG = v_setall_u16(i_inv2),
v_invR = v_setall_u16(i_inv3);
v_invB = v_setall_u16((unsigned short) i_inv1),
v_invG = v_setall_u16((unsigned short) i_inv2),
v_invR = v_setall_u16((unsigned short) i_inv3);
for ( ; i < N3 - 47; i += 48 )
{
......
......@@ -29,6 +29,7 @@ namespace cvtest {
sum1 += src_data[i];
sum2 += src_data[i + 1];
sum3 += src_data[i + 2];
N_good++;
}
// Find inverse of averages
......@@ -48,9 +49,9 @@ namespace cvtest {
}
// Fixed point arithmetic, mul by 2^8 then shift back 8 bits
unsigned int i_inv1 = inv1 * (1 << 8),
i_inv2 = inv2 * (1 << 8),
i_inv3 = inv3 * (1 << 8);
int i_inv1 = cvRound(inv1 * (1 << 8)),
i_inv2 = cvRound(inv2 * (1 << 8)),
i_inv3 = cvRound(inv3 * (1 << 8));
// Scale input pixel values
uchar* dst_data = dst.ptr<uchar>(0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment