- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Do you know a function or a code like the function CopyReplicateBorder in the library of image processing to obtain the fast copy with the borders replication of an one-dimensional array Ipp32f ?
Thanks in advance
G.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Gilles.
You can either use ippiCopyReplicateBorder_32f_C1R for 1d vector too or use pipeline of ippsSet_32f+ippsCopy_32f functions. See details in code below:
#include <stdio.h>
#include "ipp.h"
#define LEN 16
#define BRD 4
IppStatus CopyReplicateBorder(const Ipp32f* pSrc, int srcLen,
Ipp32f* pDst, int dstLen, int left)
{
#define MIN(A,B) ((A)<(B))?(A):(B)
ippsSet_32f(pSrc[0], pDst, MIN(left,dstLen));
dstLen -= left;
if (dstLen > 0) {
pDst += left;
ippsCopy_32f(pSrc, pDst, MIN(srcLen, dstLen));
dstLen -= srcLen;
}
if (dstLen > 0) {
pDst += srcLen;
ippsSet_32f(pSrc[srcLen-1], pDst, dstLen);
}
}
int main()
{
Ipp32f pSrc[LEN];
Ipp32f pDst[LEN+2*BRD];
int n;
for (n = 0; n < LEN; n++) {
pSrc[n] = n + 1;
}
#if 1
IppiSize srcroi = {LEN , 1};
IppiSize dstroi = {LEN + 2 * BRD, 1};
int topBorderHeight = 0;
int leftBorderWidth = BRD;
ippiCopyReplicateBorder_32f_C1R(
pSrc, LEN*sizeof(Ipp32f), srcroi,
pDst,(LEN+2*BRD) * sizeof(Ipp32f), dstroi,
topBorderHeight, leftBorderWidth);
#else
CopyReplicateBorder(pSrc,LEN,pDst, LEN+2*BRD, BRD);
#endif
printf("pSrc:\n");
for (n = 0; n < LEN; n++) {
printf("%.2f ", pSrc[n]);
}
printf("\n");
printf("pDst:\n");
for (n = 0; n < LEN+2*BRD; n++) {
printf("%.2f ", pDst[n]);
}
printf("\n");
return 0;
}
Andrey B.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for reaching out to us.
>>Do you know a function or a code like the function CopyReplicateBorder in the library of image processing?
Please refer the below link which might help you.
If this is not what you are looking for, Kindly provide us details more specific on the functionality so that we could assist you.
Best Regards,
Shanmukh.SS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Shanmukh,
As explained, my input is a pointer to an 1D array of float (Ipp32f), not of image type. But, it seems as a "Pointer to the source image ROI" is not be different from a pointer to an array, is it ?
I will try to use CopyReplicateBoder with a vector of float as input data.
Thanks
Gilles
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Gilles.
You can either use ippiCopyReplicateBorder_32f_C1R for 1d vector too or use pipeline of ippsSet_32f+ippsCopy_32f functions. See details in code below:
#include <stdio.h>
#include "ipp.h"
#define LEN 16
#define BRD 4
IppStatus CopyReplicateBorder(const Ipp32f* pSrc, int srcLen,
Ipp32f* pDst, int dstLen, int left)
{
#define MIN(A,B) ((A)<(B))?(A):(B)
ippsSet_32f(pSrc[0], pDst, MIN(left,dstLen));
dstLen -= left;
if (dstLen > 0) {
pDst += left;
ippsCopy_32f(pSrc, pDst, MIN(srcLen, dstLen));
dstLen -= srcLen;
}
if (dstLen > 0) {
pDst += srcLen;
ippsSet_32f(pSrc[srcLen-1], pDst, dstLen);
}
}
int main()
{
Ipp32f pSrc[LEN];
Ipp32f pDst[LEN+2*BRD];
int n;
for (n = 0; n < LEN; n++) {
pSrc[n] = n + 1;
}
#if 1
IppiSize srcroi = {LEN , 1};
IppiSize dstroi = {LEN + 2 * BRD, 1};
int topBorderHeight = 0;
int leftBorderWidth = BRD;
ippiCopyReplicateBorder_32f_C1R(
pSrc, LEN*sizeof(Ipp32f), srcroi,
pDst,(LEN+2*BRD) * sizeof(Ipp32f), dstroi,
topBorderHeight, leftBorderWidth);
#else
CopyReplicateBorder(pSrc,LEN,pDst, LEN+2*BRD, BRD);
#endif
printf("pSrc:\n");
for (n = 0; n < LEN; n++) {
printf("%.2f ", pSrc[n]);
}
printf("\n");
printf("pDst:\n");
for (n = 0; n < LEN+2*BRD; n++) {
printf("%.2f ", pDst[n]);
}
printf("\n");
return 0;
}
Andrey B.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page