Improve scaler reciprocal precision by 1 bit, and remove unused SC_NUM, SC_FIX, and SC_SHIFT.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20654 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Andrew Mahone 2009-04-08 06:25:06 +00:00
parent 05875e4ce1
commit 1541c313a0
2 changed files with 2 additions and 23 deletions

View file

@ -253,7 +253,7 @@ static inline bool scale_v_area(struct rowset *rset, struct scaler_context *ctx)
/* Set up rounding and scale factors */
ctx->divisor *= ctx->src->height;
ctx->round = ctx->divisor >> 1;
ctx->divisor = (((ctx->divisor >> 1) + SC_NUM) / ctx->divisor) << SC_FIX;
ctx->divisor = 1 + (-((ctx->divisor + 1) >> 1)) / ctx->divisor;
mul = 0;
oy = rset->rowstart;
oye = 0;
@ -451,7 +451,7 @@ static inline bool scale_v_linear(struct rowset *rset,
/* Set up scale and rounding factors, the divisor is bm->height - 1 */
ctx->divisor *= (ctx->bm->height - 1);
ctx->round = ctx->divisor >> 1;
ctx->divisor = (((ctx->divisor >> 1) + SC_NUM) / ctx->divisor) << SC_FIX;
ctx->divisor = 1 + (-((ctx->divisor + 1) >> 1)) / ctx->divisor;
/* Set up our two temp buffers. The names are generic because they'll be
swapped each time a new input row is read
*/

View file

@ -44,7 +44,6 @@
#define HAVE_UPSCALER 1
#if defined(CPU_COLDFIRE)
#define SC_NUM 0x80000000U
#define SC_MUL_INIT \
unsigned long macsr_st = coldfire_get_macsr(); \
coldfire_set_macsr(EMAC_UNSIGNED);
@ -101,32 +100,12 @@ static inline unsigned sc_mul32(unsigned a, unsigned b)
#define SC_MUL_END
#endif
#ifndef SC_SHIFT
#define SC_SHIFT 32
#endif
#if SC_SHIFT == 24
#define SC_NUM 0x1000000U
#define SC_FIX 0
#ifndef SC_MUL
#define SC_MUL(x, y) ((x) * (y) >> 24)
#define SC_MUL_INIT
#define SC_MUL_END
#endif
#else /* SC_SHIFT == 32 */
#define SC_NUM 0x80000000U
#define SC_FIX 1
#ifndef SC_MUL
#define SC_MUL(x, y) ((x) * (uint64_t)(y) >> 32)
#define SC_MUL_INIT
#define SC_MUL_END
#endif
#endif
struct img_part {
int len;
#if !defined(HAVE_LCD_COLOR)