summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Mahone <andrew.mahone@gmail.com>2009-04-08 06:25:06 +0000
committerAndrew Mahone <andrew.mahone@gmail.com>2009-04-08 06:25:06 +0000
commit1541c313a08b1674a8a0603146697bee21429839 (patch)
treebeea89f0215cbf6a969f5e6a715f96500e606cab
parent05875e4ce11a807da508eb9e07c0316bcd17846a (diff)
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
-rw-r--r--apps/recorder/resize.c4
-rw-r--r--apps/recorder/resize.h21
2 files changed, 2 insertions, 23 deletions
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)