From 1541c313a08b1674a8a0603146697bee21429839 Mon Sep 17 00:00:00 2001 From: Andrew Mahone Date: Wed, 8 Apr 2009 06:25:06 +0000 Subject: 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 --- apps/recorder/resize.c | 4 ++-- apps/recorder/resize.h | 21 --------------------- 2 files changed, 2 insertions(+), 23 deletions(-) (limited to 'apps') diff --git a/apps/recorder/resize.c b/apps/recorder/resize.c index e75638140b..79be59804a 100644 --- a/apps/recorder/resize.c +++ b/apps/recorder/resize.c @@ -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 */ diff --git a/apps/recorder/resize.h b/apps/recorder/resize.h index 4ea4eaa9a0..dc93585a08 100644 --- a/apps/recorder/resize.h +++ b/apps/recorder/resize.h @@ -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) -- cgit