Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 35 additions & 22 deletions lite/utils/cv/image_convert.cc
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ inline void nv12_to_bgr(const uint8_t* src, uint8_t* dst, int srcw, int srch) {
ptr_y1 += 2;
ptr_y2 += 2;
ptr_vu += 2;

if (j + 1 < srcw) {
*ptr_bgr2++ = b3;
*ptr_bgr2++ = g3;
Expand Down Expand Up @@ -790,9 +791,11 @@ inline void nv21_to_bgr(const uint8_t* src, uint8_t* dst, int srcw, int srch) {
g3 = g3 < 0 ? 0 : (g3 > 255) ? 255 : g3;
b3 = b3 < 0 ? 0 : (b3 > 255) ? 255 : b3;

*ptr_bgr1++ = b1;
*ptr_bgr1++ = g1;
*ptr_bgr1++ = r1;
if (j + 1 < srcw) {
*ptr_bgr1++ = b1;
*ptr_bgr1++ = g1;
*ptr_bgr1++ = r1;
}

*ptr_bgr2++ = b2;
*ptr_bgr2++ = g2;
Expand All @@ -802,9 +805,11 @@ inline void nv21_to_bgr(const uint8_t* src, uint8_t* dst, int srcw, int srch) {
ptr_y2 += 2;
ptr_vu += 2;

*ptr_bgr2++ = b3;
*ptr_bgr2++ = g3;
*ptr_bgr2++ = r3;
if (j + 1 < srcw) {
*ptr_bgr2++ = b3;
*ptr_bgr2++ = g3;
*ptr_bgr2++ = r3;
}
}
}
LITE_PARALLEL_COMMON_END();
Expand Down Expand Up @@ -1130,10 +1135,12 @@ inline void nv12_to_bgra(const uint8_t* src, uint8_t* dst, int srcw, int srch) {
g3 = g3 < 0 ? 0 : (g3 > 255) ? 255 : g3;
b3 = b3 < 0 ? 0 : (b3 > 255) ? 255 : b3;

*ptr_bgr1++ = b1;
*ptr_bgr1++ = g1;
*ptr_bgr1++ = r1;
*ptr_bgr1++ = 255;
if (j + 1 < srcw) {
*ptr_bgr1++ = b1;
*ptr_bgr1++ = g1;
*ptr_bgr1++ = r1;
*ptr_bgr1++ = 255;
}

*ptr_bgr2++ = b2;
*ptr_bgr2++ = g2;
Expand All @@ -1144,10 +1151,12 @@ inline void nv12_to_bgra(const uint8_t* src, uint8_t* dst, int srcw, int srch) {
ptr_y2 += 2;
ptr_vu += 2;

*ptr_bgr2++ = b3;
*ptr_bgr2++ = g3;
*ptr_bgr2++ = r3;
*ptr_bgr2++ = 255;
if (j + 1 < srcw) {
*ptr_bgr2++ = b3;
*ptr_bgr2++ = g3;
*ptr_bgr2++ = r3;
*ptr_bgr2++ = 255;
}
}
}
LITE_PARALLEL_COMMON_END();
Expand Down Expand Up @@ -1473,10 +1482,12 @@ inline void nv21_to_bgra(const uint8_t* src, uint8_t* dst, int srcw, int srch) {
g3 = g3 < 0 ? 0 : (g3 > 255) ? 255 : g3;
b3 = b3 < 0 ? 0 : (b3 > 255) ? 255 : b3;

*ptr_bgr1++ = b1;
*ptr_bgr1++ = g1;
*ptr_bgr1++ = r1;
*ptr_bgr1++ = 255;
if (j + 1 < srcw) {
*ptr_bgr1++ = b1;
*ptr_bgr1++ = g1;
*ptr_bgr1++ = r1;
*ptr_bgr1++ = 255;
}

*ptr_bgr2++ = b2;
*ptr_bgr2++ = g2;
Expand All @@ -1487,10 +1498,12 @@ inline void nv21_to_bgra(const uint8_t* src, uint8_t* dst, int srcw, int srch) {
ptr_y2 += 2;
ptr_vu += 2;

*ptr_bgr2++ = b3;
*ptr_bgr2++ = g3;
*ptr_bgr2++ = r3;
*ptr_bgr2++ = 255;
if (j + 1 < srcw) {
*ptr_bgr2++ = b3;
*ptr_bgr2++ = g3;
*ptr_bgr2++ = r3;
*ptr_bgr2++ = 255;
}
}
}
LITE_PARALLEL_COMMON_END();
Expand Down