diff options
Diffstat (limited to 'apps/recorder/resize.c')
-rw-r--r-- | apps/recorder/resize.c | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/apps/recorder/resize.c b/apps/recorder/resize.c index 6e5e9c4efb..99ccc84d55 100644 --- a/apps/recorder/resize.c +++ b/apps/recorder/resize.c | |||
@@ -59,19 +59,6 @@ | |||
59 | #define DEBUGF(...) | 59 | #define DEBUGF(...) |
60 | #endif | 60 | #endif |
61 | 61 | ||
62 | #ifndef PLUGIN | ||
63 | #define API(x) x | ||
64 | #else | ||
65 | #define API(x) rb->x | ||
66 | |||
67 | static const struct plugin_api *rb; | ||
68 | |||
69 | void resize_init(const struct plugin_api *api) | ||
70 | { | ||
71 | rb = api; | ||
72 | } | ||
73 | #endif | ||
74 | |||
75 | /* calculate the maximum dimensions which will preserve the aspect ration of | 62 | /* calculate the maximum dimensions which will preserve the aspect ration of |
76 | src while fitting in the constraints passed in dst, and store result in dst, | 63 | src while fitting in the constraints passed in dst, and store result in dst, |
77 | returning 0 if rounding and 1 if not rounding. | 64 | returning 0 if rounding and 1 if not rounding. |
@@ -154,7 +141,7 @@ static bool scale_h_area(void *out_line_ptr, | |||
154 | oxe = 0; | 141 | oxe = 0; |
155 | mul = 0; | 142 | mul = 0; |
156 | /* give other tasks a chance to run */ | 143 | /* give other tasks a chance to run */ |
157 | API(yield)(); | 144 | yield(); |
158 | for (ix = 0; ix < (unsigned int)ctx->src->width; ix++) | 145 | for (ix = 0; ix < (unsigned int)ctx->src->width; ix++) |
159 | { | 146 | { |
160 | oxe += ctx->bm->width; | 147 | oxe += ctx->bm->width; |
@@ -257,11 +244,11 @@ static inline bool scale_v_area(struct rowset *rset, struct scaler_context *ctx) | |||
257 | #ifdef HAVE_LCD_COLOR | 244 | #ifdef HAVE_LCD_COLOR |
258 | uint32_t *rowacc = (uint32_t *) ctx->buf, | 245 | uint32_t *rowacc = (uint32_t *) ctx->buf, |
259 | *rowtmp = rowacc + 3 * ctx->bm->width; | 246 | *rowtmp = rowacc + 3 * ctx->bm->width; |
260 | API(memset)((void *)ctx->buf, 0, ctx->bm->width * 2 * sizeof(struct uint32_rgb)); | 247 | memset((void *)ctx->buf, 0, ctx->bm->width * 2 * sizeof(struct uint32_rgb)); |
261 | #else | 248 | #else |
262 | uint32_t *rowacc = (uint32_t *) ctx->buf, | 249 | uint32_t *rowacc = (uint32_t *) ctx->buf, |
263 | *rowtmp = rowacc + ctx->bm->width; | 250 | *rowtmp = rowacc + ctx->bm->width; |
264 | API(memset)((void *)ctx->buf, 0, ctx->bm->width * 2 * sizeof(uint32_t)); | 251 | memset((void *)ctx->buf, 0, ctx->bm->width * 2 * sizeof(uint32_t)); |
265 | #endif | 252 | #endif |
266 | SDEBUGF("scale_v_area\n"); | 253 | SDEBUGF("scale_v_area\n"); |
267 | /* zero the accumulator and temp rows */ | 254 | /* zero the accumulator and temp rows */ |
@@ -298,9 +285,9 @@ static inline bool scale_v_area(struct rowset *rset, struct scaler_context *ctx) | |||
298 | ctx->output_row(oy, (void*)rowacc, ctx); | 285 | ctx->output_row(oy, (void*)rowacc, ctx); |
299 | /* clear accumulator row, store partial coverage for next row */ | 286 | /* clear accumulator row, store partial coverage for next row */ |
300 | #ifdef HAVE_LCD_COLOR | 287 | #ifdef HAVE_LCD_COLOR |
301 | API(memset)((void *)rowacc, 0, ctx->bm->width * sizeof(uint32_t) * 3); | 288 | memset((void *)rowacc, 0, ctx->bm->width * sizeof(uint32_t) * 3); |
302 | #else | 289 | #else |
303 | API(memset)((void *)rowacc, 0, ctx->bm->width * sizeof(uint32_t)); | 290 | memset((void *)rowacc, 0, ctx->bm->width * sizeof(uint32_t)); |
304 | #endif | 291 | #endif |
305 | mul = oye; | 292 | mul = oye; |
306 | oy += rset->rowstep; | 293 | oy += rset->rowstep; |
@@ -346,7 +333,7 @@ static bool scale_h_linear(void *out_line_ptr, struct scaler_context *ctx, | |||
346 | /* The error is set so that values are initialized on the first pass. */ | 333 | /* The error is set so that values are initialized on the first pass. */ |
347 | ixe = ctx->bm->width - 1; | 334 | ixe = ctx->bm->width - 1; |
348 | /* give other tasks a chance to run */ | 335 | /* give other tasks a chance to run */ |
349 | API(yield)(); | 336 | yield(); |
350 | for (ox = 0; ox < (uint32_t)ctx->bm->width; ox++) | 337 | for (ox = 0; ox < (uint32_t)ctx->bm->width; ox++) |
351 | { | 338 | { |
352 | #ifdef HAVE_LCD_COLOR | 339 | #ifdef HAVE_LCD_COLOR |
@@ -630,7 +617,7 @@ int resize_on_load(struct bitmap *bm, bool dither, struct dim *src, | |||
630 | 0 : needed]; | 617 | 0 : needed]; |
631 | #endif | 618 | #endif |
632 | #if CONFIG_CODEC == SWCODEC | 619 | #if CONFIG_CODEC == SWCODEC |
633 | len = (unsigned int)API(align_buffer)(PUN_PTR(void**, &buf), len, | 620 | len = (unsigned int)align_buffer(PUN_PTR(void**, &buf), len, |
634 | sizeof(uint32_t)); | 621 | sizeof(uint32_t)); |
635 | #endif | 622 | #endif |
636 | if (needed > len) | 623 | if (needed > len) |
@@ -659,7 +646,7 @@ int resize_on_load(struct bitmap *bm, bool dither, struct dim *src, | |||
659 | 646 | ||
660 | struct scaler_context ctx; | 647 | struct scaler_context ctx; |
661 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | 648 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ |
662 | API(cpu_boost)(true); | 649 | cpu_boost(true); |
663 | #endif | 650 | #endif |
664 | ctx.store_part = store_part; | 651 | ctx.store_part = store_part; |
665 | ctx.args = args; | 652 | ctx.args = args; |
@@ -698,7 +685,7 @@ int resize_on_load(struct bitmap *bm, bool dither, struct dim *src, | |||
698 | ret = scale_v_linear(rset, &ctx); | 685 | ret = scale_v_linear(rset, &ctx); |
699 | #endif | 686 | #endif |
700 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | 687 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ |
701 | API(cpu_boost)(false); | 688 | cpu_boost(false); |
702 | #endif | 689 | #endif |
703 | if (!ret) | 690 | if (!ret) |
704 | return 0; | 691 | return 0; |