/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* FUNCTION
* mlib_ImageAffine_u8_1ch_bl
* mlib_ImageAffine_u8_2ch_bl
* mlib_ImageAffine_u8_3ch_bl
* mlib_ImageAffine_u8_4ch_bl
* - image affine transformation with Bilinear filtering
* SYNOPSIS
* mlib_status mlib_ImageAffine_u8_?ch_bl(mlib_s32 *leftEdges,
* mlib_s32 *rightEdges,
* mlib_s32 *xStarts,
* mlib_s32 *yStarts,
* mlib_s32 *sides,
* mlib_u8 *dstData,
* mlib_u8 **lineAddr,
* mlib_s32 dstYStride,
* mlib_s32 is_affine,
* mlib_s32 srcYStride)
*
* ARGUMENTS
* leftEdges array[dstHeight] of xLeft coordinates
* RightEdges array[dstHeight] of xRight coordinates
* xStarts array[dstHeight] of xStart * 65536 coordinates
* yStarts array[dstHeight] of yStart * 65536 coordinates
* sides output array[4]. sides[0] is yStart, sides[1] is yFinish,
* sides[2] is dx * 65536, sides[3] is dy * 65536
* dstData pointer to the first pixel on (yStart - 1) line
* lineAddr array[srcHeight] of pointers to the first pixel on
* the corresponding lines
* dstYStride stride of destination image
* is_affine indicator (Affine - GridWarp)
* srcYStride stride of source image
*
* DESCRIPTION
* The functions step along the lines from xLeft to xRight and apply
* the bilinear filtering.
*
*/
#include "mlib_ImageAffine.h"
/***************************************************************/
/***************************************************************/
/***************************************************************/
#ifdef __sparc /* for SPARC, using floating-point multiplies is faster */
/***************************************************************/
/***************************************************************/
/***************************************************************/
/***************************************************************/
{
CLIP(1);
GET_POINTERS(1);
LOAD(0, 0, 1);
#ifdef __SUNPRO_C
#pragma pipeloop(0)
#endif /* __SUNPRO_C */
COUNT(0);
GET_POINTERS(1);
LOAD(0, 0, 1);
}
COUNT(0);
}
return MLIB_SUCCESS;
}
/***************************************************************/
{
CLIP(2);
GET_POINTERS(2);
LOAD(0, 0, 2);
#ifdef __SUNPRO_C
#pragma pipeloop(0)
#endif /* __SUNPRO_C */
COUNT(0);
COUNT(1);
GET_POINTERS(2);
LOAD(0, 0, 2);
}
COUNT(0);
COUNT(1);
}
return MLIB_SUCCESS;
}
/***************************************************************/
{
CLIP(3);
GET_POINTERS(3);
LOAD(0, 0, 3);
#ifdef __SUNPRO_C
#pragma pipeloop(0)
#endif /* __SUNPRO_C */
COUNT(0);
COUNT(1);
COUNT(2);
GET_POINTERS(3);
LOAD(0, 0, 3);
}
COUNT(0);
COUNT(1);
COUNT(2);
}
return MLIB_SUCCESS;
}
/***************************************************************/
{
CLIP(4);
GET_POINTERS(4);
LOAD(0, 0, 4);
#ifdef __SUNPRO_C
#pragma pipeloop(0)
#endif /* __SUNPRO_C */
COUNT(0);
COUNT(1);
COUNT(2);
COUNT(3);
GET_POINTERS(4);
LOAD(0, 0, 4);
}
COUNT(0);
COUNT(1);
COUNT(2);
COUNT(3);
}
return MLIB_SUCCESS;
}
#else /* for x86, using integer multiplies is faster */
* overflow in multiplies like fdy * (a10 - a00)
*/
/*
#undef MLIB_SHIFT
#define MLIB_SHIFT 15
*/
/***************************************************************/
ySrc = MLIB_POINTER_SHIFT(Y); \
xSrc = X >> MLIB_SHIFT; \
X += dX; \
Y += dY
/***************************************************************/
/***************************************************************/
/***************************************************************/
{
#if MLIB_SHIFT == 15
#endif /* MLIB_SHIFT == 15 */
CLIP(1);
#if MLIB_SHIFT == 15
X = X >> 1;
Y = Y >> 1;
#endif /* MLIB_SHIFT == 15 */
GET_POINTERS(1);
LOAD(0, 0, 1);
#ifdef __SUNPRO_C
#pragma pipeloop(0)
#endif /* __SUNPRO_C */
COUNT(0);
GET_POINTERS(1);
LOAD(0, 0, 1);
}
COUNT(0);
}
return MLIB_SUCCESS;
}
/***************************************************************/
{
#if MLIB_SHIFT == 15
#endif /* MLIB_SHIFT == 15 */
CLIP(2);
#if MLIB_SHIFT == 15
X = X >> 1;
Y = Y >> 1;
#endif /* MLIB_SHIFT == 15 */
GET_POINTERS(2);
LOAD(0, 0, 2);
#ifdef __SUNPRO_C
#pragma pipeloop(0)
#endif /* __SUNPRO_C */
COUNT(0);
COUNT(1);
GET_POINTERS(2);
LOAD(0, 0, 2);
}
COUNT(0);
COUNT(1);
}
return MLIB_SUCCESS;
}
/***************************************************************/
{
#if MLIB_SHIFT == 15
#endif /* MLIB_SHIFT == 15 */
CLIP(3);
#if MLIB_SHIFT == 15
X = X >> 1;
Y = Y >> 1;
#endif /* MLIB_SHIFT == 15 */
GET_POINTERS(3);
LOAD(0, 0, 3);
#ifdef __SUNPRO_C
#pragma pipeloop(0)
#endif /* __SUNPRO_C */
COUNT(0);
COUNT(1);
COUNT(2);
GET_POINTERS(3);
LOAD(0, 0, 3);
}
COUNT(0);
COUNT(1);
COUNT(2);
}
return MLIB_SUCCESS;
}
/***************************************************************/
{
#if MLIB_SHIFT == 15
#endif /* MLIB_SHIFT == 15 */
CLIP(4);
#if MLIB_SHIFT == 15
X = X >> 1;
Y = Y >> 1;
#endif /* MLIB_SHIFT == 15 */
GET_POINTERS(4);
LOAD(0, 0, 4);
#ifdef __SUNPRO_C
#pragma pipeloop(0)
#endif /* __SUNPRO_C */
COUNT(0);
COUNT(1);
COUNT(2);
COUNT(3);
GET_POINTERS(4);
LOAD(0, 0, 4);
}
COUNT(0);
COUNT(1);
COUNT(2);
COUNT(3);
}
return MLIB_SUCCESS;
}
#endif /* __sparc ( for SPARC, using floating-point multiplies is faster ) */
/***************************************************************/