- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[bash]void f0r_update2(f0r_instance_t instance, double time, const uint32_t* inframe1, const uint32_t* inframe2, const uint32_t* inframe3, uint32_t* outframe) { assert(instance); composition_instance_t* inst = (composition_instance_t*)instance; unsigned int w = inst->width; //this is in pixels unsigned int h = inst->height; //this is in pixels unsigned char *ps1, *ps2, *pd, *pd_end; ps1 = (unsigned char *)inframe2; ps2 = (unsigned char *)inframe1; pd = (unsigned char *)outframe; pd_end = pd + ( w * h * 4 ); IppiSize sz = {w, h}; IppiRect rect = {0, 0, w*4, w*4}; ippiRemap_8u_AC4R((const Ipp8u *) inframe1, sz, w*4, rect, (const Ipp32f *) inframe2, w*h, (const Ipp32f *) inframe3, w*h, (Ipp8u *) outframe, w*4, sz, IPPI_INTER_NN); }[/bash]
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The problem may be the parameter of ippiRemaps, especially this one
IppiRectrect={0,0,w*4,w*4};
itseems notw*4 and w*4. in general, if with the wholeimage, it should be {0, 0, w, h}, (AC4 mean 4channel, the memory layout are RGBA,RGBA,RGBA...).
and otherparameters, like w*4 may notcorrect too ifinput framehaspadded at image border.
and if inframe1, inframe2, inframe3 are same inputtype, may be have same width in bytes, additionally change inframe2, inframe3to 32f*, the stride is 4, so w*hmaynot correct too.
You may readthe article Descriptor Codes and Parameters for ippi Functions tocheck theseparamters and get correct result.
BestWishes,
Ying
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Also, I can't change the function parameters, unfortunately as it is part of frei0r. However, I did something similar with the AlphaComp function so I know the casting works.
Since this is a part of frei0r, I also know for a fact that there is not image padding as frei0r is particular about that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello m,
Yes, ippiRect is in pixel, not in bytes.
You mentioned, "I can't change the function parameters and However, I did something similar with the AlphaComp function so I know the casting works", Can you provide the details, like what is the inframe1 and inframe2, imframe3?
I attached one smallsample code for your reference, youmay try them andalign/modify all of parameters of ippiRemapwithyour external parameter.
for example,
constuint32_t*inframe1, // but the value in the memory space should be RGBARGBA
constuint32_t*inframe2,// the value in the memory space should be x-coordinates
constuint32_t*inframe3, // the value in the memory space should be y coordinates
You can cast them to IPP 8u* or IPP32f*, butthexMapStep, yMapStepseems not correct . why are they w*h, could be w*h*sizeof(Ipp32f)?
/ Image_Transpose.cpp: Transpose a image or rotate image with 90 or 270 degree
#include
#include
#include
#include "ipp.h"
int LOOP=1000;
using namespace std;
int main()
{
int SRC_WIDTH= 512;
int SRC_HEIGHT=512;
//Destination image size
int TARGET_WIDTH =SRC_HEIGHT;
int TARGET_HEIGHT =SRC_WIDTH;
//Create Map coordinate ( dst(x,y) = src( y,x), Rotate 90 degree)
int nTableSize= SRC_HEIGHT * SRC_WIDTH;
float* pXTable = (float*) malloc(sizeof(float)*nTableSize);
float* pYTable = (float*) malloc(sizeof(float)*nTableSize);
for( int iMap=0; iMap
{
pXTable[iMap*TARGET_WIDTH+jMap] = iMap;
pYTable[iMap*TARGET_WIDTH+jMap] = jMap;
}
/* Performs image transpose by IPPRemap */
const IppLibraryVersion* lib = ippiGetLibVersion();
printf(" IPP version:%s %s %d.%d.%d.%d\n",lib->Name, lib->Version,lib->major,lib->minor, lib->majorBuild, lib->build);
IppiRect roiRect={0,0, SRC_WIDTH,SRC_HEIGHT};
IppiSize srcSize={ SRC_WIDTH, SRC_HEIGHT};
IppiSize dstSize={ SRC_HEIGHT, SRC_WIDTH};
int dstwidthStep ;
int srcwidthStep;
Ipp8u* pSrcImg=ippiMalloc_8u_C3(SRC_WIDTH, SRC_HEIGHT, &srcwidthStep);
ippiImageJaehne_8u_C3R(pSrcImg,srcwidthStep, srcSize);
Ipp8u* pDstImgIPP = ippiMalloc_8u_C3(SRC_HEIGHT,SRC_WIDTH, &dstwidthStep);
double timeCalcIPP = (double)ippGetCpuClocks();
for (int my=0;my
pXTable, sizeof(float)*TARGET_WIDTH,
pYTable, sizeof(float)*TARGET_WIDTH,
(Ipp8u*) pDstImgIPP, dstwidthStep, dstSize,
IPPI_INTER_NN);
timeCalcIPP = (double)ippGetCpuClocks() - timeCalcIPP;
printf( " IPP calculating time = %gms\n", timeCalcIPP/(1.0*1000. * 100.0) );
return 0;
}
build with
g++ -m32 -o ImageTranspose ImageTranspose_ipp.cpp -I/opt/intel/ipp/include -L/opt/intel/ipp/lib/ia32 -lippi_l -lipps_l -lippcore_l -lm
Regards,
Ying
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
instance | the effect instance | |
time | the application time in seconds but with subsecond resolution (e.g. milli-second resolution). The resolution should be at least the inter-frame period of the application. | |
inframe1 | the first incoming video frame (can be zero for sources) | |
inframe2 | the second incoming video frame (can be zero for sources and filters) | |
inframe3 | the third incoming video frame (can be zero for sources, filters and mixer2) | |
outframe | the resulting video frame |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It is not correct to set srcStep =0. If you add the Return Valuesst=ippiRemap , you actaully will get the error : ippStsStepErr. Indicates an error condition if one of the srcStep,dstStep, xMapStep, or yMapStep has a zero or negative value.
Yes,x/ymapsteps shouldbewidth*(sizeof(IPP32f)).
Anyway,it could behelpfultofinding the cause in quick wayif youcan provide usthe real input.
Would you pleasewrite( or print)the dataininframe1/inframe2/inframe3 to some files and attachedthem (by click Add Files)? (Ifthe inputframes are limited for public, you can sendby mark the post Private)
Regards,
Ying

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