Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

DMIP and more How-to's

renegr
New Contributor I
373 Views

Hi,

until now I was not really sure whether overhead of tiled image processing around IPP can increase IPP's performance even more. I did not have enough time to wrote something like DMIP to test it. So I was very happy to read the article in Dr. Dobbs journal.

I'm now very enthusiastic to implement our algorithms with DMIP - unfortunately the examples mostly show the same usages.

What I would like to request are examples on

  • how to implement a resize node
  • how to implement a rotation node and - if the rotation angle changes, do I have to recompile the graph?
  • how to give an input image size to the graph and query for the destination image size (width/height)
  • what to do to make the compiler use the inplace algorithm (e.g. I have a pipeline Ipp16u/1ch->Node1->Ipp16u/3ch->Node2->Ipp16u/3ch->Node3->Ipp16u/3ch

It is clear that Node1 can't be processed inline but I don't know why on my Node2/Node3 the inplace function is not called. Of course Node2 and 3 are not Filter kernel nodes, just per pixel processing.

Thanks in advance

Renegr

0 Kudos
8 Replies
renegr
New Contributor I
373 Views
I forgot to mention that I've set the inplace member of Node for Node2 and Node3 to 1
0 Kudos
renegr
New Contributor I
373 Views

Strange warning when calling Image::CopyBorder "Image right border 2 is less than required right border 4294232 in Image 00..."

[cpp]IppiSize roi = { 64, 64 };
Image Srce( ipp16u, ippC1, roi, 2, 2, 2, 2);
Src = Copy( Image( buffer1, ipp16u, ippC1, roi, roi.width*2));
idmStatus stat = Src.CopyBorder( ippBorderMirror, 2, 2, 2, 2);
[/cpp]

0 Kudos
Vladimir_Dudnik
Employee
373 Views

Hello,

thanks for your interest to DMIP. Could you please share a graph you try to implement with DMIP so we can better understand what happens?

Note, DMIP does not support yet geometric operation, lke Resize. It is something we want to add in future.

Regards,
Vladimir

0 Kudos
renegr
New Contributor I
373 Views

The code's very simple, just for debugging purposes

[bash]class CCMSTransform : public Node_1_1
{
public:
  const char* ObjectName(void) { return "CMSTransform"; };

  CCMSTransform()
  {
    inplace[0] = 1;
    canOMP = 1;
  }

  bool SrcType()
  {
    return (paramCompile.srcChan[0] == ippC3) && (paramCompile.srcType[0] == ipp8u || paramCompile.srcType[0] == ipp16u);
  }

  bool DstType()
  {
    paramCompile.dstChan[0] = paramCompile.srcChan[0];
    paramCompile.dstType[0] = paramCompile.srcType[0];
    return true;
  }

  idmStatus Do(int maxNumThread, int idThread)
  {
    IppiSize roi;
    int shift=0;
    idmStatus idmStat = SetOMPRoi( paramCompile.srcRoi.width, paramExecute.sliceHeight, roi, shift, maxNumThread, idThread);
    if (idmStat != idmOK)
      return idmFatalError;
    else if (roi.height == 0) // slices for last threads can be empty
      return idmOK;
    return idmOK;
  }

  idmStatus DoInplace(int maxNumThread, int idThread)
  {
    maxNumThread;
    idThread;
    return idmOK;
  }
};


Graph gr;
IppiSize roi = { 64, 64 };
Image* Src = new Image( ipp16u, ippC1, roi, 2, 2, 2, 2);
*Src = Copy( Image( buffer1, ipp16u, ippC1, roi, roi.width*2));
idmStatus stat = Src->CopyBorder( ippBorderMirror, 2, 2, 2, 2);
Image* Dst = new Image( buffer2, ipp16u, ippC3, roi, roi.width*2*3);
SrcNode srcNode; srcNode.Init( Src); srcNode.SetStatus( idmTemporary);
DstNode dstNode; dstNode.Init( Dst); dstNode.SetStatus( idmTemporary);
CCMSTransform trans; trans.SetStatus( idmTemporary);

int iSrc = gr.Add( &srcNode);
int iCMS = gr.Add( &trans);
int iDst = gr.Add( &dstNode);

stat = gr.Link( iSrc, 0, iCMS, 0);
stat = gr.Link( iCMS, 0, iDst, 0);

stat = gr.Compile( 64);
stat = gr.Execute();
[/bash]

The breakpoint in DoInplace is never reached.

One comment, the SrcNode implementation seems to copy the source image into a temporary pointer instead of directly using the src image pointer (SrcNode::paramCompile::pSrc[0] != SrcNode::paramCompile::pDst[0]).


0 Kudos
Igor_B_Intel1
Employee
373 Views

Strange warning when calling Image::CopyBorder "Image right border 2 is less than required right border 4294232 in Image 00..."

You miss one default parameter in Image member-function call:

idmStatus CopyBorder(IppiBorderType borderType=ippBorderRepl, Scalar borderValue=0,

int top=0, int bot=0, int lef=0, int rig=0);

In that case first value is treated as borderValue and 'rig' isn't equal to 2.

Igor

0 Kudos
Igor_B_Intel1
Employee
373 Views

One comment, the SrcNode implementation seems to copy the source image into a temporary pointer instead of directly using the src image pointer

Creation or not creation of the small temporary buffer after src node depends on:

1. How alighned image data pointer and step.

2. Does image contains prepared sufficien for the next operation border.

All od these produce some restrictions on inplace operations after src nodes. In your case I see src image C1 and dst image C3 (so I guess your custom node is going to change color chanels number). Such operation cannot be inplace cause src buffer size is less than dst.

By the way: your graph cannot be compiled. To get it workable set:

paramCompile.dstType[0] = ippC3 in Dstype method instead of copiing from srcType whith is ippC1.

Igor

0 Kudos
Igor_B_Intel1
Employee
373 Views

Forgorthree thing what I did to get your example workable:

1.

[bash]
bool SrcType()   
  {   
    return (paramCompile.srcChan[0] == ippC1) && (paramCompile.srcType[0] == ipp8u || paramCompile.srcType[0] ==   
ipp16u);   
  } [/bash]
[bash][/bash]
[bash]2. Change status to idmNormal from idmTemporary.[/bash]
[bash]3. Implement Copy method.[/bash]
[bash][/bash]
[bash][/bash]
0 Kudos
renegr
New Contributor I
373 Views

Thanks for your answer and sorry for my bad example code. Within my code I had an additional convert node changing the image type from IppC1 to IppC3 so what is inputted into the CCMSTransform node already is IppC3.

The source image is 16byte aligned and has a step as a multiple of 64. Normally I don't use borders, that was just a test. So the source image IMO is correctly aligned (or not?).

My code compiled perfectly and also execute. It just doesn't it with the DoInplace function. Even if I implement a Copy function and set the state to idmNormal and set inplace[0] = 1 the DoInplace function is not called

0 Kudos
Reply