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

IppResize with changing Src Roi + fixed destination Roi without full tear down


Is it possible to have the Source Roi changing on every processing cycle but the Destination Size to be fixed  without requiring a full reinitialization of all setup parameters. Ideally we want our wrapper class to the IPP resizer to allocate the maximum memory up front for Src and then use the Src ROI to control what part of the image is resized to a standard destination size. We are trying to avoid full build tear down cycles every loop

All the examples we see of tiled processing specify the Destination tile size and that automatically computes the source Roi. Our case requires us to specify the Src Roi ie a constantly changing scale factor

Is this possible ?


0 Kudos
2 Replies

Here's the code of what we are doing. Wanted to see if the Init() functions could be pulled out


   SIZE& SrcSz = Src.GetSz();
    SIZE& DstSz = Dst.GetSz();
    m_SrcSz = { SrcRoi.width, SrcRoi.height };
    m_DstSz = {, };
    I32 specSize = 0, initSize = 0, bufSize = 0;

    IppiPoint DstOffset = { 0, 0 };
    IppiPoint SrcOffset = { SrcRoi.startx, SrcRoi.starty };
    IppStatus Status = ippStsNoErr;
    Ipp8u* pInitBuf = 0;
    Status = ippiResizeGetSize_8u(m_SrcSz, m_DstSz, TranslateInter(Rp.Interp), 0, &specSize, &initSize);
    m_pSpec = (IppiResizeSpec_32f*)ippsMalloc_8u(specSize);
    if (Rp.Interp == SUPER) {
        Status = ippiResizeSuperInit_8u(m_SrcSz, m_DstSz, m_pSpec);
    } else  if (Rp.Interp == LANCZOS) {
        pInitBuf = ippsMalloc_8u(initSize);
        Status = ippiResizeLanczosInit_8u(m_SrcSz, m_DstSz, Rp.LanczosLobe, m_pSpec, pInitBuf);
    } else  if (Rp.Interp == CUBIC) {
        pInitBuf = ippsMalloc_8u(initSize);
        Status = ippiResizeCubicInit_8u(m_SrcSz, m_DstSz, Rp.Cubic[0], Rp.Cubic[1], m_pSpec, pInitBuf);
    } else  if (Rp.Interp == NEAREST) {
        Status = ippiResizeSuperInit_8u(m_SrcSz, m_DstSz, m_pSpec);
    } else {
        return false;
    if (pInitBuf != NULL) ippsFree(pInitBuf); pInitBuf = NULL;
    if (Status != ippStsNoErr) return false;
    m_Params = Rp;

    ippiResizeGetBufferSize_8u(m_pSpec, m_DstSz, 1, &bufSize);
    m_pResizeBuffer  = ippsMalloc_8u(bufSize);

    U8* pSrc = (U8*)Src.GetPixels();
    I32 SrcStep = Src.GetStride();
    U8* pDst = (U8*)Dst.GetPixels();
    I32 DstStep = Dst.GetStride();
    U8* pS = pSrc+ SrcOffset.x + SrcOffset.y* SrcStep;
    IppiBorderType border = ippBorderInMem;
    if (m_Params.Interp == LANCZOS) {
        Status = ippiResizeLanczos_8u_C1R(pS, SrcStep, pDst, DstStep, DstOffset, m_DstSz, border, 0, m_pSpec, m_pResizeBuffer);
    } else if (m_Params.Interp == CUBIC) {
        Status = ippiResizeCubic_8u_C1R(pS, SrcStep, pDst, DstStep, DstOffset, m_DstSz, border, 0, m_pSpec, m_pResizeBuffer);
    } else if (m_Params.Interp == SUPER) {
        Status = ippiResizeSuper_8u_C1R(pS, SrcStep, pDst, DstStep, DstOffset, m_DstSz, m_pSpec, m_pResizeBuffer);

    m_Inited = true;
    if (Status != ippStsNoErr) return false;
    return true;

0 Kudos

Hi Nikhil,

No, it's impossible to avoid Init usage while you change Src ROI because you have to recalculate the coefficients also (and it's done in Init function).

Best regards,


0 Kudos