replace DIV255 with an inline function, the macro version caused unneeded recalculations

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19809 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Andrew Mahone 2009-01-21 05:10:16 +00:00
parent 580d91f097
commit 5d3fd5d5ce

View file

@ -397,8 +397,12 @@ static inline PFreal fcos(int iangle)
return fsin(iangle + (IANGLE_MAX >> 2)); return fsin(iangle + (IANGLE_MAX >> 2));
} }
#define DIV255(val) ((((((val)>>8)+(val))>>8)+(val))>>8) static inline uint32_t div255(uint32_t val)
#define SCALE_VAL(val,out) DIV255((val) * (out) + 127) {
return ((((val >> 8) + val) >> 8) + val) >> 8;
}
#define SCALE_VAL(val,out) div255((val) * (out) + 127)
static void output_row_transposed(uint32_t row, void * row_in, static void output_row_transposed(uint32_t row, void * row_in,
struct scaler_context *ctx) struct scaler_context *ctx)