forked from mindspore-Ecosystem/mindspore
fix lite_cv bug for codex_c++ warning
This commit is contained in:
parent
993a129a44
commit
e4ce2e34dc
|
@ -130,7 +130,7 @@ static void ResizeBilinear3C(const unsigned char *src, int src_width, int src_he
|
||||||
for (int k = 0; k < dst_width * 3; k++) {
|
for (int k = 0; k < dst_width * 3; k++) {
|
||||||
int16_t t0 = (int16_t)((y_weight[0] * (int16_t)(*row0_ptr0++)) >> 16);
|
int16_t t0 = (int16_t)((y_weight[0] * (int16_t)(*row0_ptr0++)) >> 16);
|
||||||
int16_t t1 = (int16_t)((y_weight[1] * (int16_t)(*row1_ptr1++)) >> 16);
|
int16_t t1 = (int16_t)((y_weight[1] * (int16_t)(*row1_ptr1++)) >> 16);
|
||||||
*dst_ptr++ = (unsigned char)((t0 + t1 + 2) >> 2);
|
*dst_ptr++ = static_cast<unsigned char>((t0 + t1 + 2) >> 2);
|
||||||
}
|
}
|
||||||
y_weight += 2;
|
y_weight += 2;
|
||||||
}
|
}
|
||||||
|
@ -202,7 +202,7 @@ static void ResizeBilinear1C(const unsigned char *src, int src_width, int src_he
|
||||||
for (int k = 0; k < dst_width; k++) {
|
for (int k = 0; k < dst_width; k++) {
|
||||||
int16_t t0 = (int16_t)((y_weight[0] * (int16_t)(*row0_ptr0++)) >> 16);
|
int16_t t0 = (int16_t)((y_weight[0] * (int16_t)(*row0_ptr0++)) >> 16);
|
||||||
int16_t t1 = (int16_t)((y_weight[1] * (int16_t)(*row1_ptr1++)) >> 16);
|
int16_t t1 = (int16_t)((y_weight[1] * (int16_t)(*row1_ptr1++)) >> 16);
|
||||||
*dst_ptr++ = (unsigned char)((t0 + t1 + 2) >> 2);
|
*dst_ptr++ = static_cast<unsigned char>((t0 + t1 + 2) >> 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
y_weight += 2;
|
y_weight += 2;
|
||||||
|
@ -873,7 +873,8 @@ std::vector<int> ApplyNms(const std::vector<std::vector<float>> &all_boxes, std:
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Pixel_Type>
|
template <typename Pixel_Type>
|
||||||
bool ImplementAffine(LiteMat &src, LiteMat &out_img, double M[6], std::vector<size_t> &dsize, Pixel_Type borderValue) {
|
bool ImplementAffine(LiteMat &src, LiteMat &out_img, const double M[6], std::vector<size_t> &dsize,
|
||||||
|
Pixel_Type borderValue) {
|
||||||
if (dsize.size() != 2 || CheckZero(dsize)) {
|
if (dsize.size() != 2 || CheckZero(dsize)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -912,11 +913,11 @@ bool ImplementAffine(LiteMat &src, LiteMat &out_img, double M[6], std::vector<si
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Affine(LiteMat &src, LiteMat &out_img, double M[6], std::vector<size_t> dsize, UINT8_C1 borderValue) {
|
bool Affine(LiteMat &src, LiteMat &out_img, const double M[6], std::vector<size_t> dsize, UINT8_C1 borderValue) {
|
||||||
return ImplementAffine(src, out_img, M, dsize, borderValue);
|
return ImplementAffine(src, out_img, M, dsize, borderValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Affine(LiteMat &src, LiteMat &out_img, double M[6], std::vector<size_t> dsize, UINT8_C3 borderValue) {
|
bool Affine(LiteMat &src, LiteMat &out_img, const double M[6], std::vector<size_t> dsize, UINT8_C3 borderValue) {
|
||||||
return ImplementAffine(src, out_img, M, dsize, borderValue);
|
return ImplementAffine(src, out_img, M, dsize, borderValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,10 +91,10 @@ bool Split(const LiteMat &src, std::vector<LiteMat> &mv);
|
||||||
bool Merge(const std::vector<LiteMat> &mv, LiteMat &dst);
|
bool Merge(const std::vector<LiteMat> &mv, LiteMat &dst);
|
||||||
|
|
||||||
/// \brief Apply affine transformation for 1 channel image
|
/// \brief Apply affine transformation for 1 channel image
|
||||||
bool Affine(LiteMat &src, LiteMat &out_img, double M[6], std::vector<size_t> dsize, UINT8_C1 borderValue);
|
bool Affine(LiteMat &src, LiteMat &out_img, const double M[6], std::vector<size_t> dsize, UINT8_C1 borderValue);
|
||||||
|
|
||||||
/// \brief Apply affine transformation for 3 channel image
|
/// \brief Apply affine transformation for 3 channel image
|
||||||
bool Affine(LiteMat &src, LiteMat &out_img, double M[6], std::vector<size_t> dsize, UINT8_C3 borderValue);
|
bool Affine(LiteMat &src, LiteMat &out_img, const double M[6], std::vector<size_t> dsize, UINT8_C3 borderValue);
|
||||||
|
|
||||||
/// \brief Get default anchor boxes for Faster R-CNN, SSD, YOLO etc
|
/// \brief Get default anchor boxes for Faster R-CNN, SSD, YOLO etc
|
||||||
std::vector<std::vector<float>> GetDefaultBoxes(const BoxesConfig config);
|
std::vector<std::vector<float>> GetDefaultBoxes(const BoxesConfig config);
|
||||||
|
|
|
@ -26,6 +26,7 @@ LiteMat::LiteMat() {
|
||||||
channel_ = 0;
|
channel_ = 0;
|
||||||
c_step_ = 0;
|
c_step_ = 0;
|
||||||
dims_ = 0;
|
dims_ = 0;
|
||||||
|
size_ = 0;
|
||||||
data_type_ = LDataType::UINT8;
|
data_type_ = LDataType::UINT8;
|
||||||
ref_count_ = 0;
|
ref_count_ = 0;
|
||||||
}
|
}
|
||||||
|
@ -199,7 +200,10 @@ void *LiteMat::AlignMalloc(unsigned int size) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LiteMat::AlignFree(void *ptr) { (void)free(reinterpret_cast<void **>(ptr)[-1]); }
|
void LiteMat::AlignFree(void *ptr) {
|
||||||
|
(void)free(reinterpret_cast<void **>(ptr)[-1]);
|
||||||
|
ptr = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
inline void LiteMat::InitElemSize(LDataType data_type) { elem_size_ = data_type.SizeInBytes(); }
|
inline void LiteMat::InitElemSize(LDataType data_type) { elem_size_ = data_type.SizeInBytes(); }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue