Exemple #1
0
mlib_status mlib_convMxNnw_u8(mlib_image       *dst,
                              const mlib_image *src,
                              const mlib_s32   *kernel,
                              mlib_s32         kwid,
                              mlib_s32         khgt,
                              mlib_s32         khw,
                              mlib_s32         khh,
                              mlib_s32         discardbits,
                              mlib_s32         cmask)
{
  mlib_s32 nchannel, amask;

  if (mlib_ImageConvVersion(kwid, khgt, discardbits, MLIB_BYTE) == 0)
    return mlib_c_convMxNnw_u8(dst, src, kernel, kwid, khgt, khw, khh,
                               discardbits, cmask);

  nchannel = mlib_ImageGetChannels(src);

  if (nchannel == 1)
    cmask = 1;
  amask = (1 << nchannel) - 1;

  if ((cmask & amask) == amask) {
    return mlib_convMxN_8nw_f(dst, src, kwid, khgt, khw, khh, kernel, discardbits);
  }
  else {
    return mlib_convMxN_8nw_mask(dst, src, kwid, khgt, khw, khh, kernel,
                                 discardbits, cmask);
  }
}
mlib_status
mlib_conv5x5nw_u8(
    mlib_image *dst,
    const mlib_image *src,
    const mlib_s32 *kernel,
    mlib_s32 scalef_expon,
    mlib_s32 cmask)
{
	mlib_s32 nchan, amask;

	if (mlib_ImageConvVersion(5, 5, scalef_expon, MLIB_BYTE) == 0)
		return mlib_c_conv5x5nw_u8(dst, src, kernel, scalef_expon,
		    cmask);

	nchan = mlib_ImageGetChannels(src);
	amask = (1 << nchan) - 1;

	if (((cmask & amask) == amask) && (nchan > 1)) {
		if (nchan == 4) {
			return mlib_v_conv5x5_8nw_4(dst, src, kernel,
			    scalef_expon);
		} else {
			return mlib_convMxN_8nw_f(dst, src, 5, 5, 2, 2, kernel,
			    scalef_expon);
		}
	}

	return (mlib_v_conv5x5_8nw_mask(dst, src, kernel, scalef_expon, cmask));
}