本文整理汇总了C++中MLIB_IMAGE_CHECK函数的典型用法代码示例。如果您正苦于以下问题:C++ MLIB_IMAGE_CHECK函数的具体用法?C++ MLIB_IMAGE_CHECK怎么用?C++ MLIB_IMAGE_CHECK使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MLIB_IMAGE_CHECK函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: __mlib_ImageGridWarp_Fp
mlib_status
__mlib_ImageGridWarp_Fp(
mlib_image *dst,
const mlib_image *src,
const mlib_f32 *xWarpPos,
const mlib_f32 *yWarpPos,
mlib_d64 postShiftX,
mlib_d64 postShiftY,
mlib_s32 xStart,
mlib_s32 xStep,
mlib_s32 xNumCells,
mlib_s32 yStart,
mlib_s32 yStep,
mlib_s32 yNumCells,
mlib_filter filter,
mlib_edge edge)
{
mlib_type type;
MLIB_IMAGE_CHECK(src);
MLIB_IMAGE_CHECK(dst);
type = mlib_ImageGetType(dst);
if (type != MLIB_FLOAT && type != MLIB_DOUBLE) {
return (MLIB_FAILURE);
}
return mlib_ImageGridWarp_alltypes(dst, src, xWarpPos, yWarpPos,
postShiftX, postShiftY,
xStart, xStep, xNumCells, yStart, yStep, yNumCells, filter, edge);
}
示例2: __mlib_ImageSubsampleAverage_ty_Fp
mlib_status
__mlib_ImageSubsampleAverage_ty_Fp(
mlib_image *dst,
const mlib_image *src,
mlib_d64 xscale,
mlib_d64 yscale,
mlib_s32 ybegin)
{
mlib_type type;
MLIB_IMAGE_CHECK(src);
MLIB_IMAGE_CHECK(dst);
MLIB_IMAGE_TYPE_EQUAL(src, dst);
MLIB_IMAGE_CHAN_EQUAL(src, dst);
if (!(xscale > 0 && xscale <= 1 && yscale > 0 && yscale <= 1)) {
return (MLIB_FAILURE);
}
type = mlib_ImageGetType(dst);
switch (type) {
case MLIB_FLOAT:
return mlib_ImageSubsampleAverage_F32_main(dst, src, xscale,
yscale, ybegin);
case MLIB_DOUBLE:
return mlib_ImageSubsampleAverage_D64_main(dst, src, xscale,
yscale, ybegin);
default:
break;
}
return (MLIB_FAILURE);
}
示例3: __mlib_ImageDiv_Fp
mlib_status
__mlib_ImageDiv_Fp(
mlib_image *dst,
const mlib_image *src1,
const mlib_image *src2)
{
mlib_type type = mlib_ImageGetType(dst);
MLIB_IMAGE_CHECK(dst);
MLIB_IMAGE_CHECK(src1);
MLIB_IMAGE_CHECK(src2);
MLIB_IMAGE_FULL_EQUAL(dst, src1);
MLIB_IMAGE_FULL_EQUAL(dst, src2);
switch (type) {
case MLIB_FLOAT:
mlib_ImageDiv_Fp_F32(dst, src1, src2);
return (MLIB_SUCCESS);
case MLIB_DOUBLE:
mlib_ImageDiv_Fp_D64(dst, src1, src2);
return (MLIB_SUCCESS);
default:
return (MLIB_FAILURE);
}
}
示例4: __mlib_ImageDivConstShift
mlib_status
__mlib_ImageDivConstShift(
mlib_image *dst,
const mlib_image *src,
const mlib_s32 *consts,
mlib_s32 shift)
{
mlib_d64 dalpha[4], dbeta[4], dshift;
mlib_s32 nchan, k;
MLIB_IMAGE_CHECK(dst);
MLIB_IMAGE_CHECK(src);
MLIB_IMAGE_FULL_EQUAL(dst, src);
nchan = mlib_ImageGetChannels(dst);
if (shift < 0 || shift > 31)
return (MLIB_OUTOFRANGE);
dshift = (1u << shift);
for (k = 0; k < nchan; k++) {
dalpha[k] =
(consts[k] == 0) ? 2.0 * MLIB_S32_MAX : dshift / consts[k];
dbeta[k] = 0;
}
return (__mlib_ImageScale2(dst, src, dalpha, dbeta));
}
示例5: __mlib_ImageNotAnd
mlib_status
__mlib_ImageNotAnd(
mlib_image *dst,
const mlib_image *src1,
const mlib_image *src2)
{
MLIB_IMAGE_CHECK(src1);
MLIB_IMAGE_CHECK(src2);
MLIB_IMAGE_CHECK(dst);
if ((mlib_ImageGetType(src1) == MLIB_BYTE) ||
(mlib_ImageGetType(src1) == MLIB_SHORT) ||
(mlib_ImageGetType(src1) == MLIB_USHORT) ||
mlib_ImageGetType(src1) == MLIB_INT) {
return (mlib_v_ImageLogic(dst, src1, src2));
} else if (mlib_ImageGetType(src1) == MLIB_BIT) {
if ((mlib_ImageGetBitOffset(src1) ==
mlib_ImageGetBitOffset(dst)) &&
(mlib_ImageGetBitOffset(src2) ==
mlib_ImageGetBitOffset(dst))) {
return (mlib_v_ImageNotAnd_Bit(dst, src1, src2));
} else {
return (mlib_ImageNotAnd_Bit(dst, src1, src2));
}
} else
return (MLIB_FAILURE);
}
示例6: __mlib_ImageConstNotOr
mlib_status
__mlib_ImageConstNotOr(
mlib_image *dst,
const mlib_image *src,
const mlib_s32 *c)
{
MLIB_IMAGE_CHECK(src);
MLIB_IMAGE_CHECK(dst);
if ((mlib_ImageGetType(src) == MLIB_BYTE) ||
(mlib_ImageGetType(src) == MLIB_SHORT) ||
(mlib_ImageGetType(src) == MLIB_USHORT) ||
mlib_ImageGetType(src) == MLIB_INT) {
return (mlib_v_ImageConstLogic(dst, src, c));
} else if (mlib_ImageGetType(src) == MLIB_BIT) {
if (mlib_ImageGetBitOffset(src) ==
mlib_ImageGetBitOffset(dst)) {
return (mlib_v_ImageConstNotOr_Bit(dst, src, c));
} else {
return (mlib_ImageConstNotOr_Bit(dst, src, c));
}
} else
return (MLIB_FAILURE);
}
示例7: __mlib_ImageSub
mlib_status
__mlib_ImageSub(
mlib_image *dst,
const mlib_image *src1,
const mlib_image *src2)
{
mlib_type dtype;
MLIB_IMAGE_CHECK(dst);
MLIB_IMAGE_CHECK(src1);
MLIB_IMAGE_FULL_EQUAL(dst, src1);
if (src2) {
/* inplace -> NULL here (U16 case @ UltraIII needs it */
MLIB_IMAGE_CHECK(src2);
MLIB_IMAGE_FULL_EQUAL(dst, src2);
}
dtype = mlib_ImageGetType(dst);
if (dtype == MLIB_BYTE)
return (mlib_v_ImageSub_U8(dst, src1, src2));
else if (dtype == MLIB_SHORT)
return (mlib_v_ImageSub_S16(dst, src1, src2));
else if (dtype == MLIB_USHORT)
return (mlib_v_ImageSub_U16(dst, src1, src2));
else if (dtype == MLIB_INT)
return (mlib_v_ImageSub_S32(dst, src1, src2));
else
return (MLIB_FAILURE);
}
示例8: __mlib_ImageCopy
mlib_status
__mlib_ImageCopy(
mlib_image *dst,
const mlib_image *src)
{
mlib_s32 s_offset, d_offset, width, height;
mlib_s32 size, s_stride, d_stride;
mlib_u8 *sa, *da;
mlib_s32 j;
MLIB_IMAGE_CHECK(src);
MLIB_IMAGE_CHECK(dst);
MLIB_IMAGE_TYPE_EQUAL(src, dst);
MLIB_IMAGE_CHAN_EQUAL(src, dst);
MLIB_IMAGE_SIZE_EQUAL(src, dst);
switch (mlib_ImageGetType(dst)) {
case MLIB_BIT:
sa = (mlib_u8 *)mlib_ImageGetData(src);
da = (mlib_u8 *)mlib_ImageGetData(dst);
width = mlib_ImageGetWidth(src) * mlib_ImageGetChannels(src);
height = mlib_ImageGetHeight(src);
if (!mlib_ImageIsNotOneDvector(src) &&
!mlib_ImageIsNotOneDvector(dst)) {
size = height * (width >> 3);
mlib_ImageCopy_na(sa, da, size);
} else {
示例9: __mlib_ImageColorConvert1_Fp
mlib_status
__mlib_ImageColorConvert1_Fp(
mlib_image *dst,
const mlib_image *src,
const mlib_d64 *fmat)
{
mlib_s32 slb, dlb, xsize, ysize;
mlib_type dtype;
void *sa, *da;
MLIB_IMAGE_CHECK(src);
MLIB_IMAGE_CHECK(dst);
MLIB_IMAGE_FULL_EQUAL(dst, src);
MLIB_IMAGE_HAVE_CHAN(dst, 3);
if (fmat == NULL)
return (MLIB_NULLPOINTER);
dtype = mlib_ImageGetType(dst);
xsize = mlib_ImageGetWidth(dst);
ysize = mlib_ImageGetHeight(dst);
slb = mlib_ImageGetStride(src);
dlb = mlib_ImageGetStride(dst);
sa = mlib_ImageGetData(src);
da = mlib_ImageGetData(dst);
if (dtype == MLIB_FLOAT) {
return mlib_ImageColorConvert1_F32(sa, slb / 4,
da, dlb / 4, xsize, ysize, fmat);
} else if (dtype == MLIB_DOUBLE) {
return mlib_ImageColorConvert1_D64(sa, slb / 8,
da, dlb / 8, xsize, ysize, fmat);
} else
return (MLIB_FAILURE);
}
示例10: __mlib_ImageColorRGB2HSL_Fp
mlib_status
__mlib_ImageColorRGB2HSL_Fp(
mlib_image *dst,
const mlib_image *src)
{
/* check for obvious errors */
MLIB_IMAGE_CHECK(src);
MLIB_IMAGE_CHECK(dst);
MLIB_IMAGE_TYPE_EQUAL(dst, src);
MLIB_IMAGE_CHAN_EQUAL(dst, src);
MLIB_IMAGE_HAVE_CHAN(dst, 3);
switch (mlib_ImageGetType(dst)) {
case MLIB_FLOAT:
mlib_ImageColorRGB2HSL_Fp_F32(dst, src);
break;
case MLIB_DOUBLE:
mlib_ImageColorRGB2HSL_Fp_D64(dst, src);
break;
/* discard any other data types */
default:
return (MLIB_FAILURE);
}
return (MLIB_SUCCESS);
}
示例11: __mlib_ImageFlipY_Fp
mlib_status
__mlib_ImageFlipY_Fp(
mlib_image *dst,
const mlib_image *src)
{
MLIB_IMAGE_CHECK(src);
MLIB_IMAGE_CHECK(dst);
MLIB_IMAGE_TYPE_EQUAL(src, dst);
MLIB_IMAGE_CHAN_EQUAL(src, dst);
switch (mlib_ImageGetType(src)) {
case MLIB_FLOAT:
switch (mlib_ImageGetChannels(src)) {
case 1:
mlib_ImageFlipY_S32_1(dst, src);
break;
case 2:
mlib_ImageFlipY_S32_2(dst, src);
break;
case 3:
mlib_ImageFlipY_S32_3(dst, src);
break;
case 4:
mlib_ImageFlipY_S32_4(dst, src);
break;
default:
return (MLIB_FAILURE);
}
break;
case MLIB_DOUBLE:
switch (mlib_ImageGetChannels(src)) {
case 1:
mlib_ImageFlipY_S32_2(dst, src);
break;
case 2:
mlib_ImageFlipY_S32_4(dst, src);
break;
case 3:
mlib_ImageFlipY_D64_3(dst, src);
break;
case 4:
mlib_ImageFlipY_D64_4(dst, src);
break;
default:
return (MLIB_FAILURE);
}
break;
default:
return (MLIB_FAILURE);
}
return (MLIB_SUCCESS);
}
示例12: __mlib_ImageConstMulShift
mlib_status
__mlib_ImageConstMulShift(
mlib_image *dst,
const mlib_image *src,
const mlib_s32 *consts,
mlib_s32 shift)
{
mlib_type type;
void *psrc, *pdst;
mlib_s32 slb, dlb, xsize, ysize, nchan;
mlib_s32 beta[4] = { 0, 0, 0, 0 };
mlib_d64 dalpha[4], dbeta[4], dshift;
mlib_s32 k;
MLIB_IMAGE_CHECK(dst);
MLIB_IMAGE_CHECK(src);
MLIB_IMAGE_FULL_EQUAL(dst, src);
MLIB_IMAGE_GET_ALL_PARAMS(dst, type, nchan, xsize, ysize, dlb, pdst);
slb = mlib_ImageGetStride(src);
psrc = mlib_ImageGetData(src);
if (shift < 0 || shift > 31)
return (MLIB_OUTOFRANGE);
/* branch to ImageScale if possible */
if (type == MLIB_BYTE || type == MLIB_SHORT || type == MLIB_USHORT) {
if (__mlib_ImageScale(dst, src, consts, beta,
shift) == MLIB_SUCCESS)
return (MLIB_SUCCESS);
}
dshift = 1.0 / (1u << shift);
for (k = 0; k < nchan; k++) {
dalpha[k] = consts[k] * dshift;
dbeta[k] = 0;
}
if (type == MLIB_BYTE) {
return (mlib_ImageScale2_U8(dst, src, dalpha, dbeta));
} else if (type == MLIB_SHORT) {
return (mlib_ImageScale2_S16(dst, src, dalpha, dbeta));
} else if (type == MLIB_USHORT) {
return (mlib_ImageScale2_U16(dst, src, dalpha, dbeta));
} else if (type == MLIB_INT) {
return mlib_ImageDConstMul_S32(pdst, psrc, xsize, ysize, nchan,
slb / 4, dlb / 4, dalpha);
}
return (MLIB_FAILURE);
}
示例13: __mlib_ImageXor
mlib_status __mlib_ImageXor(mlib_image *dst,
mlib_image *src1,
mlib_image *src2)
{
MLIB_IMAGE_CHECK(src1);
MLIB_IMAGE_CHECK(src2);
MLIB_IMAGE_CHECK(dst);
return mlib_v_ImageLogic(dst, src1, src2);
}
示例14: __mlib_ImageColorXYZ2RGB
mlib_status
__mlib_ImageColorXYZ2RGB(
mlib_image *dst,
const mlib_image *src)
{
/* CIE XYZ to Rec709 RGB with D64 White Point */
mlib_d64 fmat[9] = { 3.240479, -1.537150, -0.498535,
-0.969256, 1.875992, 0.041566,
0.055648, -0.204043, 1.057311
};
mlib_s32 slb, dlb, xsize, ysize;
mlib_type dtype;
mlib_u8 *psrc, *pdst;
mlib_s32 j;
MLIB_IMAGE_CHECK(dst);
MLIB_IMAGE_CHECK(src);
MLIB_IMAGE_FULL_EQUAL(dst, src);
dtype = mlib_ImageGetType(dst);
xsize = mlib_ImageGetWidth(dst);
ysize = mlib_ImageGetHeight(dst);
dlb = mlib_ImageGetStride(dst);
pdst = (void *)mlib_ImageGetData(dst);
slb = mlib_ImageGetStride(src);
psrc = mlib_ImageGetData(src);
if (dtype == MLIB_BYTE) {
for (j = 0; j < ysize; j++) {
mlib_u8 *ps = psrc,
*pd = pdst, *pend = pdst + 3 * xsize;
#ifdef __SUNPRO_C
#pragma pipeloop(0)
#endif /* __SUNPRO_C */
for (; pd < pend; pd += 3) {
MLIB_CONVERT_U8_1(pd, ps);
ps += 3;
}
psrc += slb;
pdst += dlb;
}
return (MLIB_SUCCESS);
} else {
return (__mlib_ImageColorConvert1(dst, src, fmat));
}
}
示例15: __mlib_ImageSqrShift
mlib_status
__mlib_ImageSqrShift(
mlib_image *dst,
const mlib_image *src,
mlib_s32 shift)
{
mlib_type dtype;
MLIB_IMAGE_CHECK(dst);
MLIB_IMAGE_CHECK(src);
MLIB_IMAGE_FULL_EQUAL(dst, src);
dtype = mlib_ImageGetType(dst);
if (dtype == MLIB_BYTE) {
if ((shift < 4) || (shift > 11)) {
return (MLIB_OUTOFRANGE);
}
}
if (dtype == MLIB_SHORT) {
if ((shift < 1) || (shift > 16)) {
return (MLIB_OUTOFRANGE);
}
}
if (dtype == MLIB_INT) {
if ((shift < -1023) || (shift > 1022)) {
return (MLIB_OUTOFRANGE);
}
}
if (dtype == MLIB_BYTE) {
return (mlib_c_ImageSqrShift_U8(dst, src, shift));
} else {
void *sa = mlib_ImageGetData(src);
void *da = mlib_ImageGetData(dst);
mlib_s32 slb = mlib_ImageGetStride(src);
mlib_s32 dlb = mlib_ImageGetStride(dst);
mlib_s32 nchan = mlib_ImageGetChannels(src);
mlib_s32 xsize = mlib_ImageGetWidth(src) * nchan;
mlib_s32 ysize = mlib_ImageGetHeight(src);
if (dtype == MLIB_SHORT) {
mlib_c_ImageSqrShift_S16((mlib_s16 *)sa, (slb >> 1),
(mlib_s16 *)da, (dlb >> 1), xsize, ysize, shift);
return (MLIB_SUCCESS);
} else if (dtype == MLIB_USHORT) {