mirror of
https://github.com/Tencent/ncnn.git
synced 2026-10-28 11:47:38 +08:00
memcpy optimize copy_cut_border/copy_make_boder (#179)
* memcpy optimize copy_cut_border/copy_make_boder * copy small border memcpy may slow * remove unuse line * code style
This commit is contained in:
+9
-20
@@ -348,10 +348,8 @@ static void copy_make_border_image(const Mat& src, Mat& dst, int top, int left,
|
||||
{
|
||||
outptr[x] = v;
|
||||
}
|
||||
for (; x < (left + src.w); x++)
|
||||
{
|
||||
outptr[x] = ptr[x - left];
|
||||
}
|
||||
memcpy(outptr + left, ptr, src.w * sizeof(float));
|
||||
x += src.w;
|
||||
for (; x < w; x++)
|
||||
{
|
||||
outptr[x] = v;
|
||||
@@ -381,10 +379,8 @@ static void copy_make_border_image(const Mat& src, Mat& dst, int top, int left,
|
||||
{
|
||||
outptr[x] = ptr[0];
|
||||
}
|
||||
for (; x < (left + src.w); x++)
|
||||
{
|
||||
outptr[x] = ptr[x - left];
|
||||
}
|
||||
memcpy(outptr + left, ptr, src.w * sizeof(float));
|
||||
x += src.w;
|
||||
for (; x < w; x++)
|
||||
{
|
||||
outptr[x] = ptr[src.w - 1];
|
||||
@@ -399,10 +395,8 @@ static void copy_make_border_image(const Mat& src, Mat& dst, int top, int left,
|
||||
{
|
||||
outptr[x] = ptr[0];
|
||||
}
|
||||
for (; x < (left + src.w); x++)
|
||||
{
|
||||
outptr[x] = ptr[x - left];
|
||||
}
|
||||
memcpy(outptr + left, ptr, src.w * sizeof(float));
|
||||
x += src.w;
|
||||
for (; x < w; x++)
|
||||
{
|
||||
outptr[x] = ptr[src.w - 1];
|
||||
@@ -419,10 +413,8 @@ static void copy_make_border_image(const Mat& src, Mat& dst, int top, int left,
|
||||
{
|
||||
outptr[x] = ptr[0];
|
||||
}
|
||||
for (; x < (left + src.w); x++)
|
||||
{
|
||||
outptr[x] = ptr[x - left];
|
||||
}
|
||||
memcpy(outptr + left, ptr, src.w * sizeof(float));
|
||||
x += src.w;
|
||||
for (; x < w; x++)
|
||||
{
|
||||
outptr[x] = ptr[src.w - 1];
|
||||
@@ -481,10 +473,7 @@ static void copy_cut_border_image(const Mat& src, Mat& dst, int top, int left)
|
||||
|
||||
for (int y = 0; y < h; y++)
|
||||
{
|
||||
for (int x = 0; x < w; x++)
|
||||
{
|
||||
outptr[x] = ptr[x];
|
||||
}
|
||||
memcpy(outptr, ptr, w*sizeof(float));
|
||||
outptr += w;
|
||||
ptr += src.w;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user