diff options
author | Andrew Mahone <andrew.mahone@gmail.com> | 2009-04-08 06:25:06 +0000 |
---|---|---|
committer | Andrew Mahone <andrew.mahone@gmail.com> | 2009-04-08 06:25:06 +0000 |
commit | 1541c313a08b1674a8a0603146697bee21429839 (patch) | |
tree | beea89f0215cbf6a969f5e6a715f96500e606cab | |
parent | 05875e4ce11a807da508eb9e07c0316bcd17846a (diff) | |
download | rockbox-1541c313a08b1674a8a0603146697bee21429839.tar.gz rockbox-1541c313a08b1674a8a0603146697bee21429839.zip |
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.c | 4 | ||||
-rw-r--r-- | apps/recorder/resize.h | 21 |
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) | |||
253 | /* Set up rounding and scale factors */ | 253 | /* Set up rounding and scale factors */ |
254 | ctx->divisor *= ctx->src->height; | 254 | ctx->divisor *= ctx->src->height; |
255 | ctx->round = ctx->divisor >> 1; | 255 | ctx->round = ctx->divisor >> 1; |
256 | ctx->divisor = (((ctx->divisor >> 1) + SC_NUM) / ctx->divisor) << SC_FIX; | 256 | ctx->divisor = 1 + (-((ctx->divisor + 1) >> 1)) / ctx->divisor; |
257 | mul = 0; | 257 | mul = 0; |
258 | oy = rset->rowstart; | 258 | oy = rset->rowstart; |
259 | oye = 0; | 259 | oye = 0; |
@@ -451,7 +451,7 @@ static inline bool scale_v_linear(struct rowset *rset, | |||
451 | /* Set up scale and rounding factors, the divisor is bm->height - 1 */ | 451 | /* Set up scale and rounding factors, the divisor is bm->height - 1 */ |
452 | ctx->divisor *= (ctx->bm->height - 1); | 452 | ctx->divisor *= (ctx->bm->height - 1); |
453 | ctx->round = ctx->divisor >> 1; | 453 | ctx->round = ctx->divisor >> 1; |
454 | ctx->divisor = (((ctx->divisor >> 1) + SC_NUM) / ctx->divisor) << SC_FIX; | 454 | ctx->divisor = 1 + (-((ctx->divisor + 1) >> 1)) / ctx->divisor; |
455 | /* Set up our two temp buffers. The names are generic because they'll be | 455 | /* Set up our two temp buffers. The names are generic because they'll be |
456 | swapped each time a new input row is read | 456 | swapped each time a new input row is read |
457 | */ | 457 | */ |
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 @@ | |||
44 | #define HAVE_UPSCALER 1 | 44 | #define HAVE_UPSCALER 1 |
45 | 45 | ||
46 | #if defined(CPU_COLDFIRE) | 46 | #if defined(CPU_COLDFIRE) |
47 | #define SC_NUM 0x80000000U | ||
48 | #define SC_MUL_INIT \ | 47 | #define SC_MUL_INIT \ |
49 | unsigned long macsr_st = coldfire_get_macsr(); \ | 48 | unsigned long macsr_st = coldfire_get_macsr(); \ |
50 | coldfire_set_macsr(EMAC_UNSIGNED); | 49 | coldfire_set_macsr(EMAC_UNSIGNED); |
@@ -101,32 +100,12 @@ static inline unsigned sc_mul32(unsigned a, unsigned b) | |||
101 | #define SC_MUL_END | 100 | #define SC_MUL_END |
102 | #endif | 101 | #endif |
103 | 102 | ||
104 | #ifndef SC_SHIFT | ||
105 | #define SC_SHIFT 32 | ||
106 | #endif | ||
107 | |||
108 | #if SC_SHIFT == 24 | ||
109 | #define SC_NUM 0x1000000U | ||
110 | #define SC_FIX 0 | ||
111 | |||
112 | #ifndef SC_MUL | ||
113 | #define SC_MUL(x, y) ((x) * (y) >> 24) | ||
114 | #define SC_MUL_INIT | ||
115 | #define SC_MUL_END | ||
116 | #endif | ||
117 | |||
118 | #else /* SC_SHIFT == 32 */ | ||
119 | #define SC_NUM 0x80000000U | ||
120 | #define SC_FIX 1 | ||
121 | |||
122 | #ifndef SC_MUL | 103 | #ifndef SC_MUL |
123 | #define SC_MUL(x, y) ((x) * (uint64_t)(y) >> 32) | 104 | #define SC_MUL(x, y) ((x) * (uint64_t)(y) >> 32) |
124 | #define SC_MUL_INIT | 105 | #define SC_MUL_INIT |
125 | #define SC_MUL_END | 106 | #define SC_MUL_END |
126 | #endif | 107 | #endif |
127 | 108 | ||
128 | #endif | ||
129 | |||
130 | struct img_part { | 109 | struct img_part { |
131 | int len; | 110 | int len; |
132 | #if !defined(HAVE_LCD_COLOR) | 111 | #if !defined(HAVE_LCD_COLOR) |