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 {
mlib_status mlib_ImageCopy(mlib_image *dst, const mlib_image *src) { mlib_s32 s_offset, d_offset; mlib_s32 size, s_stride, d_stride; mlib_s32 width; /* width in bytes of src and dst */ mlib_s32 height; /* height in lines of src and dst */ 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: width = mlib_ImageGetWidth(dst) * mlib_ImageGetChannels(dst); /* size in bits */ height = mlib_ImageGetHeight(src); sa = (mlib_u8 *) mlib_ImageGetData(src); da = (mlib_u8 *) mlib_ImageGetData(dst); if (!mlib_ImageIsNotOneDvector(src) && !mlib_ImageIsNotOneDvector(dst)) { size = height * (width >> 3); if (!mlib_ImageIsNotAligned8(src) && !mlib_ImageIsNotAligned8(dst) && ((size & 7) == 0)) { mlib_c_ImageCopy_a1((TYPE_64BIT *) sa, (TYPE_64BIT *) da, size >> 3); } else {
mlib_status __mlib_ImageCopy( mlib_image *dst, const mlib_image *src) { /* start point in source */ mlib_u8 *sa; /* start points in destination */ mlib_u8 *da; /* width in bytes of src and dst */ mlib_s32 width; /* height in lines of src and dst */ mlib_s32 height; /* bit offset of src */ mlib_s32 s_offset; /* bit offset of dst */ mlib_s32 d_offset; /* stride in bytes in src */ mlib_s32 stride; /* stride in bytes in dst */ mlib_s32 dstride; /* indices for x, y */ mlib_s32 i, j; mlib_s32 size; 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); width = mlib_ImageGetWidth(dst) * mlib_ImageGetChannels(dst); height = mlib_ImageGetHeight(dst); sa = (mlib_u8 *)mlib_ImageGetData(src); da = (mlib_u8 *)mlib_ImageGetData(dst); switch (mlib_ImageGetType(dst)) { case MLIB_BIT: if (!mlib_ImageIsNotOneDvector(src) && !mlib_ImageIsNotOneDvector(dst)) { size = height * (width >> 3); if ((size & 0x3f) == 0 && !mlib_ImageIsNotAligned64(src) && !mlib_ImageIsNotAligned64(dst)) { mlib_v_ImageCopy_blk(sa, da, size); return (MLIB_SUCCESS); } if (!mlib_ImageIsNotAligned8(src) && !mlib_ImageIsNotAligned8(dst) && ((size & 7) == 0)) { mlib_v_ImageCopy_a1((mlib_d64 *)sa, (mlib_d64 *)da, size >> 3); } else {
mlib_status __mlib_ImageNot( mlib_image *dst, const mlib_image *src) { /* start point in source */ mlib_u8 *sa; /* start points in destination */ mlib_u8 *da; /* width in bytes of src and dst */ mlib_s32 width; /* height in lines of src and dst */ mlib_s32 height; /* stride in bytes in src */ mlib_s32 stride; /* stride in bytes in dst */ mlib_s32 dstride; /* indices for x, y */ mlib_s32 j; mlib_s32 size; mlib_s32 type; MLIB_IMAGE_CHECK(src); MLIB_IMAGE_CHECK(dst); MLIB_IMAGE_SIZE_EQUAL(dst, src); MLIB_IMAGE_TYPE_EQUAL(dst, src); MLIB_IMAGE_CHAN_EQUAL(dst, src); width = mlib_ImageGetWidth(dst) * mlib_ImageGetChannels(dst); height = mlib_ImageGetHeight(dst); sa = (mlib_u8 *)mlib_ImageGetData(src); da = (mlib_u8 *)mlib_ImageGetData(dst); type = mlib_ImageGetType(dst); if ((type != MLIB_BYTE) && (type != MLIB_SHORT) && (type != MLIB_USHORT) && (type != MLIB_BIT) && (type != MLIB_INT)) return (MLIB_FAILURE); if (type != MLIB_BIT) { switch (type) { case MLIB_BYTE: break; case MLIB_SHORT: case MLIB_USHORT: width *= 2; break; case MLIB_INT: width *= 4; break; default: return (MLIB_FAILURE); } size = height * width; if (!mlib_ImageIsNotOneDvector(src) && !mlib_ImageIsNotOneDvector(dst) && ((((mlib_addr)sa ^ (mlib_addr)da) & 7) == 0) && (size > CASHSIZE)) { mlib_s32 tail = 0x40 - ((mlib_addr)da & 0x3F); mlib_v_ImageNot_na(sa, da, tail & 0x3F); sa += tail & 0x3F; da += tail & 0x3F; size -= tail & 0x3F; /* (size >> 6) should be > 1 */ mlib_v_ImageNot_blk(sa, da, size >> 6); sa += size & ~0x3F; da += size & ~0x3F; mlib_v_ImageNot_na(sa, da, size & 0x3F); return (MLIB_SUCCESS); } else {