scale2x/scale2x.c
/**
 * Scale by a factor of 2 a row of pixels of 8 bits.
 * This is a very fast MMX implementation.
 * The implementation uses a combination of cmp/and/not operations to
 * completly remove the need of conditional jumps. This trick give the
 * major speed improvement.
 * Also, using the 8 bytes MMX registers more than one pixel are computed
 * at the same time.
 * Before calling this function you must ensure that the currenct CPU supports
 * the MMX instruction set. After calling it you must be sure to call the EMMS
 * instruction before any floating-point operation.
 * The pixels over the left and right borders are assumed of the same color of
 * the pixels on the border.
 * Note that the implementation is optimized to write data sequentially to
 * maximize the bandwidth on video memory.
 * \param src0 Pointer at the first pixel of the previous row.
 * \param src1 Pointer at the first pixel of the current row.
 * \param src2 Pointer at the first pixel of the next row.
 * \param count Length in pixels of the src0, src1 and src2 rows. It must
 * be at least 16 and a multiple of 8.
 * \param dst0 First destination row, double length in pixels.
 * \param dst1 Second destination row, double length in pixels.
 */
Scale by a factor of 2 a row of pixels of 8 bits.
This is a very fast MMX implementation.
The implementation uses a combination of cmp/and/not operations to
completly remove the need of conditional jumps. This trick give the
major speed improvement.
Also, using the 8 bytes MMX registers more than one pixel are computed
at the same time.
Before calling this function you must ensure that the currenct CPU supports
the MMX instruction set. After calling it you must be sure to call the EMMS
instruction before any floating-point operation.
The pixels over the left and right borders are assumed of the same color of
the pixels on the border.
Note that the implementation is optimized to write data sequentially to
maximize the bandwidth on video memory.
\param src0 Pointer at the first pixel of the previous row.
\param src1 Pointer at the first pixel of the current row.
\param src2 Pointer at the first pixel of the next row.
\param count Length in pixels of the src0, src1 and src2 rows. It must
be at least 16 and a multiple of 8.
\param dst0 First destination row, double length in pixels.
\param dst1 Second destination row, double length in pixels.
Scale by a factor of 2 a row of pixels of 8 bits . This is a very fast MMX implementation . The implementation uses a combination of cmp / and / not operations to completly remove the need of conditional jumps . This trick give the major speed improvement . Also using the 8 bytes MMX registers more than one pixel are computed at the same time . Before calling this function you must ensure that the currenct CPU supports the MMX instruction set . After calling it you must be sure to call the EMMS instruction before any floating - point operation . The pixels over the left and right borders are assumed of the same color of the pixels on the border . Note that the implementation is optimized to write data sequentially to maximize the bandwidth on video memory . \ param src0 Pointer at the first pixel of the previous row . \ param src1 Pointer at the first pixel of the current row . \ param src2 Pointer at the first pixel of the next row . \ param count Length in pixels of the src0 src1 and src2 rows . It must be at least 16 and a multiple of 8 . \ param dst0 First destination row double length in pixels . \ param dst1 Second destination row double length in pixels .
void scale2x_8_mmx(scale2x_uint8* dst0, scale2x_uint8* dst1, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count)
{
	if (count % 8 != 0 || count < 16) {
		scale2x_8_def(dst0, dst1, src0, src1, src2, count);
	} else {
		scale2x_8_mmx_border(dst0, src0, src1, src2, count);
		scale2x_8_mmx_border(dst1, src2, src1, src0, count);
	}
}
void scale2x_8_mmx ( scale2x_uint8 * dst0 , scale2x_uint8 * dst1 , const scale2x_uint8 * src0 , const scale2x_uint8 * src1 , const scale2x_uint8 * src2 , unsigned count ) { if ( count % 8 != 0 || count < 16 ) { scale2x_8_def ( dst0 , dst1 , src0 , src1 , src2 , count ) ; } else { scale2x_8_mmx_border ( dst0 , src0 , src1 , src2 , count ) ; scale2x_8_mmx_border ( dst1 , src2 , src1 , src0 , count ) ; } }
Scale by a factor of 2 a row of pixels of 8 bits.
Scale by a factor of 2 a row of pixels of 8 bits .