Convert rga format to buffer specified location

#define imcvtcolorEX(src, dst, sfmt, dfmt, nposX,nposY, ...) \
    ({ \
        IM_STATUS ret = IM_STATUS_SUCCESS; \
        int args[] = {__VA_ARGS__}; \
        int argc = sizeof(args)/sizeof(int); \
        if (argc == 0) { \
            ret = imcvtcolorEX_t(src, dst, sfmt, dfmt, nposX,nposY,IM_COLOR_SPACE_DEFAULT, 1); \
        } else if (argc == 1){ \
            ret = imcvtcolorEX_t(src, dst, sfmt, dfmt, nposX,nposY, args[0], 1); \
        } else if (argc == 2){ \
            ret = imcvtcolorEX_t(src, dst, sfmt, dfmt, nposX,nposY, args[0], args[1]); \
        } else { \
            ret = IM_STATUS_INVALID_PARAM; \
            printf("invalid parameter\n"); \
        } \
        ret; \
    })

IM_API IM_STATUS imcvtcolorEX_t(rga_buffer_t src, rga_buffer_t dst, int sfmt, int dfmt, int nposX,int nposY, int mode, int sync);
IM_API IM_STATUS imcvtcolorEX_t(rga_buffer_t src, rga_buffer_t dst, int sfmt, int dfmt, int nposX,int nposY, int mode, int sync){
    int usage = 0;
    IM_STATUS ret = IM_STATUS_NOERROR;

    rga_buffer_t pat;

    im_rect srect;
    im_rect drect;
    im_rect prect;

    empty_structure(NULL, NULL, &pat, &srect, &drect, &prect);

    src.format = sfmt;
    dst.format = dfmt;

    dst.color_space_mode = mode;

    if (sync == 0)
        usage |= IM_SYNC;


	srect.x = 0 ;
    srect.y = 0;
	srect.width = src.width ;
    srect.height = src.height;
    drect.x = nposX;
    drect.y = nposY;
    drect.width = dst.width;
    drect.height = dst.height;

    ret = improcess(src, dst, pat, srect, drect, prect, usage);

    return ret;
}

 

Guess you like

Origin blog.csdn.net/sunxiaopengsun/article/details/113779888