From 092c340a2062fa98b7387fc5fd63578ddae7d0b6 Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Wed, 15 Jul 2020 19:40:55 -0400 Subject: [1/4] Remove SH support and all archos targets This removes all code specific to SH targets Change-Id: I7980523785d2596e65c06430f4638eec74a06061 --- apps/recorder/jpeg_load.c | 37 +----- apps/recorder/keyboard.c | 29 +---- apps/recorder/recording.c | 286 ---------------------------------------------- apps/recorder/resize.c | 91 --------------- apps/recorder/resize.h | 56 --------- 5 files changed, 6 insertions(+), 493 deletions(-) (limited to 'apps/recorder') diff --git a/apps/recorder/jpeg_load.c b/apps/recorder/jpeg_load.c index 61ec3bfa0e..16a2f4e3a3 100644 --- a/apps/recorder/jpeg_load.c +++ b/apps/recorder/jpeg_load.c @@ -137,21 +137,7 @@ static struct jpeg jpeg; INLINE unsigned range_limit(int value) { -#if CONFIG_CPU == SH7034 - unsigned tmp; - asm ( /* Note: Uses knowledge that only low byte of result is used */ - "extu.b %[v],%[t] \n" - "cmp/eq %[v],%[t] \n" /* low byte == whole number ? */ - "bt 1f \n" /* yes: no overflow */ - "cmp/pz %[v] \n" /* overflow: positive? */ - "subc %[v],%[v] \n" /* %[r] now either 0 or 0xffffffff */ - "1: \n" - : /* outputs */ - [v]"+r"(value), - [t]"=&r"(tmp) - ); - return value; -#elif defined(CPU_COLDFIRE) +#if defined(CPU_COLDFIRE) /* Note: Uses knowledge that only the low byte of the result is used */ asm ( "cmp.l #255,%[v] \n" /* overflow? */ @@ -232,7 +218,7 @@ INLINE unsigned scale_output(int value) */ #define MULTIPLY(var1, var2) ((var1) * (var2)) -#if defined(CPU_SH) || defined(CPU_COLDFIRE) || \ +#if defined(CPU_COLDFIRE) || \ (defined(CPU_ARM) && ARM_ARCH > 4) #define MULTIPLY16(var,const) (((short) (var)) * ((short) (const))) #else @@ -1687,24 +1673,6 @@ static void search_restart(struct jpeg *p_jpeg) } /* Figure F.12: extend sign bit. */ -#if CONFIG_CPU == SH7034 -/* SH1 lacks a variable-shift instruction */ -#define HUFF_EXTEND(x,s) ((x) < extend_test[s] ? (x) + extend_offset[s] : (x)) - -static const int extend_test[16] = /* entry n is 2**(n-1) */ -{ - 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, - 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 -}; - -static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */ -{ - 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, - ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, - ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, - ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 -}; -#else /* This saves some code and data size, benchmarks about the same on RAM */ #define HUFF_EXTEND(x,s) \ ({ \ @@ -1712,7 +1680,6 @@ static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */ int s__ = s; \ x__ & BIT_N(s__- 1) ? x__ : x__ + (-1 << s__) + 1; \ }) -#endif /* Decode a single value */ #define huff_decode_dc(p_jpeg, tbl, s, r) \ diff --git a/apps/recorder/keyboard.c b/apps/recorder/keyboard.c index 6e91d69b6d..4b19287b7f 100644 --- a/apps/recorder/keyboard.c +++ b/apps/recorder/keyboard.c @@ -27,7 +27,6 @@ #include "settings.h" #include "misc.h" #include "rbunicode.h" -#include "buttonbar.h" #include "logf.h" #include "hangul.h" #include "action.h" @@ -343,15 +342,6 @@ int kbd_input(char* text, int buflen, unsigned short *kbd) viewportmanager_theme_enable(l, false, NULL); } -#ifdef HAVE_BUTTONBAR - struct gui_buttonbar buttonbar; - bool buttonbar_config = global_settings.buttonbar; - - global_settings.buttonbar = true; - gui_buttonbar_init(&buttonbar); - gui_buttonbar_set_display(&buttonbar, &screens[SCREEN_MAIN]); -#endif - /* initialize state */ state.text = text; state.buflen = buflen; @@ -482,12 +472,6 @@ int kbd_input(char* text, int buflen, unsigned short *kbd) #endif } -#ifdef HAVE_BUTTONBAR - /* draw the button bar */ - gui_buttonbar_set(&buttonbar, "Shift", "OK", "Del"); - gui_buttonbar_draw(&buttonbar); -#endif - FOR_NB_SCREENS(l) screens[l].update(); @@ -693,10 +677,6 @@ int kbd_input(char* text, int buflen, unsigned short *kbd) state.changed = 0; } -#ifdef HAVE_BUTTONBAR - global_settings.buttonbar = buttonbar_config; -#endif - if (ret < 0) splash(HZ/2, ID2P(LANG_CANCEL)); @@ -736,7 +716,7 @@ static void kbd_calc_params(struct keyboard_parameters *pm, pm->font_h = font->height; /* check if FONT_UI fits the screen */ - if (2*pm->font_h + 3 + BUTTONBAR_HEIGHT > sc->getheight()) + if (2*pm->font_h + 3 > sc->getheight()) { pm->curfont = FONT_SYSFIXED; font = font_get(FONT_SYSFIXED); @@ -796,13 +776,12 @@ static void kbd_calc_params(struct keyboard_parameters *pm, } recalc_param: #endif - pm->lines = (sc_h - BUTTONBAR_HEIGHT) / pm->font_h - 1; + pm->lines = sc_h / pm->font_h - 1; if (pm->default_lines && pm->lines > pm->default_lines) pm->lines = pm->default_lines; - pm->keyboard_margin = sc_h - BUTTONBAR_HEIGHT - - (pm->lines+1)*pm->font_h; + pm->keyboard_margin = sc_h - (pm->lines+1)*pm->font_h; if (pm->keyboard_margin < 3 && pm->lines > 1) { @@ -840,7 +819,7 @@ recalc_param: #endif #ifdef HAVE_MORSE_INPUT - pm->old_main_y = sc_h - pm->font_h - BUTTONBAR_HEIGHT; + pm->old_main_y = sc_h - pm->font_h; if (state->morse_mode) { int y = pm->main_y; diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index b67436839c..553f815e52 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c @@ -145,11 +145,6 @@ bool in_recording_screen(void) return (rec_status & RCSTAT_IN_RECSCREEN) != 0; } -#if CONFIG_KEYPAD == RECORDER_PAD -static bool f2_rec_screen(void); -static bool f3_rec_screen(void); -#endif - #define MAX_FILE_SIZE 0x7F800000 /* 2 GB - 4 MB */ #ifndef HAVE_REMOTE_LCD @@ -1574,47 +1569,6 @@ bool recording_screen(bool no_source) } break; -#if CONFIG_KEYPAD == RECORDER_PAD - case ACTION_REC_F2: - if(audio_stat != AUDIO_STATUS_RECORD) - { -#if (CONFIG_LED == LED_REAL) - /* led is restored at begin of loop / end of function */ - led(false); -#endif - if (f2_rec_screen()) - { - rec_status |= RCSTAT_HAVE_RECORDED; - done = true; - } - else - update_countdown = 0; /* Update immediately */ - } - break; - - case ACTION_REC_F3: - if(audio_stat & AUDIO_STATUS_RECORD) - { - rec_command(RECORDING_CMD_START_NEWFILE); - last_seconds = 0; - } - else - { -#if (CONFIG_LED == LED_REAL) - /* led is restored at begin of loop / end of function */ - led(false); -#endif - if (f3_rec_screen()) - { - rec_status |= RCSTAT_HAVE_RECORDED; - done = true; - } - else - update_countdown = 0; /* Update immediately */ - } - break; -#endif /* CONFIG_KEYPAD == RECORDER_PAD */ - case SYS_POWEROFF: default_event_handler(SYS_POWEROFF); done = true; @@ -1941,246 +1895,6 @@ rec_abort: return (rec_status & RCSTAT_BEEN_IN_USB_MODE) != 0; } /* recording_screen */ -#if CONFIG_KEYPAD == RECORDER_PAD -static bool f2_rec_screen(void) -{ - static const char* const freq_str[6] = - { - "44.1kHz", - "48kHz", - "32kHz", - "22.05kHz", - "24kHz", - "16kHz" - }; - - bool exit = false; - bool used = false; - int w, h; - char buf[32]; - int button; - struct audio_recording_options rec_options; - - FOR_NB_SCREENS(i) - { - screens[i].set_viewport(NULL); - screens[i].setfont(FONT_SYSFIXED); - screens[i].getstringsize("A",&w,&h); - } - - while (!exit) { - const char* ptr; - - FOR_NB_SCREENS(i) - { - screens[i].clear_display(); - - /* Recording quality */ - screens[i].putsxy(0, LCD_HEIGHT/2 - h*2, - str(LANG_SYSFONT_RECORDING_QUALITY)); - } - - snprintf(buf, sizeof(buf), "%d", global_settings.rec_quality); - FOR_NB_SCREENS(i) - { - screens[i].putsxy(0, LCD_HEIGHT/2-h, buf); - screens[i].mono_bitmap(bitmap_icons_7x8[Icon_FastBackward], - LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8); - } - - /* Frequency */ - snprintf(buf, sizeof buf, "%s:", str(LANG_SYSFONT_RECORDING_FREQUENCY)); - ptr = freq_str[global_settings.rec_frequency]; - FOR_NB_SCREENS(i) - { - screens[i].getstringsize(buf,&w,&h); - screens[i].putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h*2, buf); - screens[i].getstringsize(ptr, &w, &h); - screens[i].putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h, ptr); - screens[i].mono_bitmap(bitmap_icons_7x8[Icon_DownArrow], - LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8); - } - - /* Channel mode */ - switch ( global_settings.rec_channels ) { - case 0: - ptr = str(LANG_SYSFONT_CHANNEL_STEREO); - break; - - case 1: - ptr = str(LANG_SYSFONT_CHANNEL_MONO); - break; - } - - FOR_NB_SCREENS(i) - { - screens[i].getstringsize(str(LANG_SYSFONT_CHANNELS), &w, &h); - screens[i].putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h*2, - str(LANG_SYSFONT_CHANNELS)); - screens[i].getstringsize(str(LANG_SYSFONT_MODE), &w, &h); - screens[i].putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h, - str(LANG_SYSFONT_MODE)); - screens[i].getstringsize(ptr, &w, &h); - screens[i].putsxy(LCD_WIDTH - w, LCD_HEIGHT/2, ptr); - screens[i].mono_bitmap(bitmap_icons_7x8[Icon_FastForward], - LCD_WIDTH/2 + 8, LCD_HEIGHT/2 - 4, 7, 8); - - screens[i].update(); - } - - button = button_get(true); - switch (button) { - case BUTTON_LEFT: - case BUTTON_F2 | BUTTON_LEFT: - global_settings.rec_quality++; - if(global_settings.rec_quality > 7) - global_settings.rec_quality = 0; - used = true; - break; - - case BUTTON_DOWN: - case BUTTON_F2 | BUTTON_DOWN: - global_settings.rec_frequency++; - if(global_settings.rec_frequency > 5) - global_settings.rec_frequency = 0; - used = true; - break; - - case BUTTON_RIGHT: - case BUTTON_F2 | BUTTON_RIGHT: - global_settings.rec_channels++; - if(global_settings.rec_channels > 1) - global_settings.rec_channels = 0; - used = true; - break; - - case BUTTON_F2 | BUTTON_REL: - if ( used ) - exit = true; - used = true; - break; - - case BUTTON_F2 | BUTTON_REPEAT: - used = true; - break; - - default: - if(default_event_handler(button) == SYS_USB_CONNECTED) - return true; - break; - } - } - - rec_init_recording_options(&rec_options); - rec_set_recording_options(&rec_options); - - set_gain(); - - settings_save(); - FOR_NB_SCREENS(i) - screens[i].setfont(FONT_UI); - - return false; -} - -static bool f3_rec_screen(void) -{ - bool exit = false; - bool used = false; - int w, h; - int button; - const char *src_str[] = - { - str(LANG_SYSFONT_RECORDING_SRC_MIC), - str(LANG_SYSFONT_LINE_IN), - str(LANG_SYSFONT_RECORDING_SRC_DIGITAL) - }; - struct audio_recording_options rec_options; - - FOR_NB_SCREENS(i) - { - screens[i].set_viewport(NULL); - screens[i].setfont(FONT_SYSFIXED); - screens[i].getstringsize("A",&w,&h); - } - - while (!exit) { - const char* ptr = src_str[global_settings.rec_source]; - FOR_NB_SCREENS(i) - { - screens[i].clear_display(); - - /* Recording source */ - screens[i].putsxy(0, LCD_HEIGHT/2 - h*2, - str(LANG_SYSFONT_RECORDING_SOURCE)); - - screens[i].getstringsize(ptr, &w, &h); - screens[i].putsxy(0, LCD_HEIGHT/2-h, ptr); - screens[i].mono_bitmap(bitmap_icons_7x8[Icon_FastBackward], - LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8); - } - - /* trigger setup */ - ptr = str(LANG_SYSFONT_RECORD_TRIGGER); - FOR_NB_SCREENS(i) - { - screens[i].getstringsize(ptr,&w,&h); - screens[i].putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h*2, ptr); - screens[i].mono_bitmap(bitmap_icons_7x8[Icon_DownArrow], - LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8); - - screens[i].update(); - } - - button = button_get(true); - switch (button) { - case BUTTON_DOWN: - case BUTTON_F3 | BUTTON_DOWN: -#ifndef SIMULATOR - rectrigger(); - settings_apply_trigger(); -#endif - exit = true; - break; - - case BUTTON_LEFT: - case BUTTON_F3 | BUTTON_LEFT: - global_settings.rec_source++; - if(global_settings.rec_source > AUDIO_SRC_MAX) - global_settings.rec_source = 0; - used = true; - break; - - case BUTTON_F3 | BUTTON_REL: - if ( used ) - exit = true; - used = true; - break; - - case BUTTON_F3 | BUTTON_REPEAT: - used = true; - break; - - default: - if(default_event_handler(button) == SYS_USB_CONNECTED) - return true; - break; - } - } - - rec_init_recording_options(&rec_options); - rec_set_recording_options(&rec_options); - - set_gain(); - - settings_save(); - FOR_NB_SCREENS(i) - screens[i].setfont(FONT_UI); - - return false; -} -#endif /* CONFIG_KEYPAD == RECORDER_PAD */ - #if CONFIG_CODEC == SWCODEC void audio_beep(int duration) { diff --git a/apps/recorder/resize.c b/apps/recorder/resize.c index ac6b7a3120..6f561039c3 100644 --- a/apps/recorder/resize.c +++ b/apps/recorder/resize.c @@ -63,14 +63,8 @@ #endif #include -#if CONFIG_CPU == SH7034 -/* 16*16->32 bit multiplication is a single instrcution on the SH1 */ -#define MULUQ(a, b) ((uint32_t) (((uint16_t) (a)) * ((uint16_t) (b)))) -#define MULQ(a, b) ((int32_t) (((int16_t) (a)) * ((int16_t) (b)))) -#else #define MULUQ(a, b) ((a) * (b)) #define MULQ(a, b) ((a) * (b)) -#endif #ifdef HAVE_LCD_COLOR #define CHANNEL_BYTES (sizeof(struct uint32_argb)/sizeof(uint32_t)) @@ -151,18 +145,6 @@ int recalc_dimension(struct dim *dst, struct dim *src) "movclr.l %%acc" #num ", %0" \ : "=d" (dest) \ ) -#elif defined(CPU_SH) -/* calculate the 32-bit product of unsigned 16-bit op1 and op2 */ -static inline int32_t mul_s16_s16(int16_t op1, int16_t op2) -{ - return (int32_t)(op1 * op2); -} - -/* calculate the 32-bit product of signed 16-bit op1 and op2 */ -static inline uint32_t mul_u16_u16(uint16_t op1, uint16_t op2) -{ - return (uint32_t)(op1 * op2); -} #endif /* horizontal area average scaler */ @@ -171,13 +153,8 @@ static bool scale_h_area(void *out_line_ptr, { SDEBUGF("scale_h_area\n"); unsigned int ix, ox, oxe, mul; -#if defined(CPU_SH) || defined (TEST_SH_MATH) - const uint32_t h_i_val = ctx->src->width, - h_o_val = ctx->bm->width; -#else const uint32_t h_i_val = ctx->h_i_val, h_o_val = ctx->h_o_val; -#endif #ifdef HAVE_LCD_COLOR struct uint32_argb rgbvalacc = { 0, 0, 0, 0 }, rgbvaltmp = { 0, 0, 0, 0 }, @@ -298,15 +275,6 @@ static bool scale_h_area(void *out_line_ptr, mul = h_o_val - oxe; MAC(tmp, mul, 0); MAC_OUT(acc, 0); -#elif defined(CPU_SH) -/* SH-1 16x16->32 math */ - /* add saved partial pixel from start of area */ - acc = mul_u16_u16(acc, h_o_val) + mul_u16_u16(tmp, mul); - - /* get new pixel , then add its partial coverage to this area */ - tmp = *(part->buf); - mul = h_o_val - oxe; - acc += mul_u16_u16(tmp, mul); #else /* generic C math */ /* add saved partial pixel from start of area */ @@ -317,10 +285,8 @@ static bool scale_h_area(void *out_line_ptr, mul = h_o_val - oxe; acc += tmp * mul; #endif /* CPU */ -#if !(defined(CPU_SH) || defined(TEST_SH_MATH)) /* round, divide, and either store or accumulate to output row */ acc = (acc + (1 << 21)) >> 22; -#endif if (accum) { acc += out_line[ox]; @@ -346,13 +312,8 @@ static bool scale_h_area(void *out_line_ptr, static inline bool scale_v_area(struct rowset *rset, struct scaler_context *ctx) { uint32_t mul, oy, iy, oye; -#if defined(CPU_SH) || defined (TEST_SH_MATH) - const uint32_t v_i_val = ctx->src->height, - v_o_val = ctx->bm->height; -#else const uint32_t v_i_val = ctx->v_i_val, v_o_val = ctx->v_o_val; -#endif /* Set up rounding and scale factors */ mul = 0; @@ -409,13 +370,8 @@ static bool scale_h_linear(void *out_line_ptr, struct scaler_context *ctx, bool accum) { unsigned int ix, ox, ixe; -#if defined(CPU_SH) || defined (TEST_SH_MATH) - const uint32_t h_i_val = ctx->src->width - 1, - h_o_val = ctx->bm->width - 1; -#else const uint32_t h_i_val = ctx->h_i_val, h_o_val = ctx->h_o_val; -#endif /* type x = x is an ugly hack for hiding an unitialized data warning. The values are conditionally initialized before use, but other values are set such that this will occur before these are used. @@ -531,9 +487,6 @@ static bool scale_h_linear(void *out_line_ptr, struct scaler_context *ctx, #if defined(CPU_COLDFIRE) /* Coldfire EMAC math */ MAC(val, h_o_val, 0); -#elif defined(CPU_SH) -/* SH-1 16x16->32 math */ - val = mul_u16_u16(val, h_o_val); #else /* generic C math */ val = val * h_o_val; @@ -552,9 +505,6 @@ static bool scale_h_linear(void *out_line_ptr, struct scaler_context *ctx, #if defined(CPU_COLDFIRE) /* Coldfire EMAC math */ MAC(inc, ixe, 0); -#elif defined(CPU_SH) -/* SH-1 16x16->32 math */ - val += mul_s16_s16(inc, ixe); #else /* generic C math */ val += inc * ixe; @@ -565,16 +515,10 @@ static bool scale_h_linear(void *out_line_ptr, struct scaler_context *ctx, MAC_OUT(val, 0); #endif /* Now multiply the color increment to its proper value */ -#if defined(CPU_SH) -/* SH-1 16x16->32 math */ - inc = mul_s16_s16(inc, h_i_val); -#else /* generic C math */ inc *= h_i_val; -#endif } else val += inc; -#if !(defined(CPU_SH) || defined(TEST_SH_MATH)) /* round and scale values, and accumulate or store to output */ if (accum) { @@ -582,15 +526,6 @@ static bool scale_h_linear(void *out_line_ptr, struct scaler_context *ctx, } else { out_line[ox] = (val + (1 << 21)) >> 22; } -#else - /* round and scale values, and accumulate or store to output */ - if (accum) - { - out_line[ox] += val; - } else { - out_line[ox] = val; - } -#endif #endif ixe += h_i_val; } @@ -603,13 +538,8 @@ static inline bool scale_v_linear(struct rowset *rset, { uint32_t iy, iye; int32_t oy; -#if defined(CPU_SH) || defined (TEST_SH_MATH) - const uint32_t v_i_val = ctx->src->height - 1, - v_o_val = ctx->bm->height - 1; -#else const uint32_t v_i_val = ctx->v_i_val, v_o_val = ctx->v_o_val; -#endif /* Set up our buffers, to store the increment and current value for each column, and one temp buffer used to read in new rows. */ @@ -892,9 +822,6 @@ int resize_on_load(struct bitmap *bm, bool dither, struct dim *src, ctx.bm = bm; ctx.src = src; ctx.dither = dither; -#if defined(CPU_SH) || defined (TEST_SH_MATH) - uint32_t div; -#endif #if !defined(PLUGIN) #if defined(HAVE_LCD_COLOR) && defined(HAVE_JPEG) ctx.output_row = format_index ? output_row_32_native_fromyuv @@ -914,23 +841,15 @@ int resize_on_load(struct bitmap *bm, bool dither, struct dim *src, { #endif ctx.h_scaler = scale_h_area; -#if defined(CPU_SH) || defined (TEST_SH_MATH) - div = sw; -#else uint32_t h_div = (1U << 24) / sw; ctx.h_i_val = sw * h_div; ctx.h_o_val = dw * h_div; -#endif #ifdef HAVE_UPSCALER } else { ctx.h_scaler = scale_h_linear; -#if defined(CPU_SH) || defined (TEST_SH_MATH) - div = dw - 1; -#else uint32_t h_div = (1U << 24) / (dw - 1); ctx.h_i_val = (sw - 1) * h_div; ctx.h_o_val = (dw - 1) * h_div; -#endif } #endif #ifdef CPU_COLDFIRE @@ -941,27 +860,17 @@ int resize_on_load(struct bitmap *bm, bool dither, struct dim *src, if (sh > dh) #endif { -#if defined(CPU_SH) || defined (TEST_SH_MATH) - div *= sh; - ctx.recip = ((uint32_t)(-div)) / div + 1; -#else uint32_t v_div = (1U << 22) / sh; ctx.v_i_val = sh * v_div; ctx.v_o_val = dh * v_div; -#endif ret = scale_v_area(rset, &ctx); } #ifdef HAVE_UPSCALER else { -#if defined(CPU_SH) || defined (TEST_SH_MATH) - div *= dh - 1; - ctx.recip = ((uint32_t)(-div)) / div + 1; -#else uint32_t v_div = (1U << 22) / dh; ctx.v_i_val = (sh - 1) * v_div; ctx.v_o_val = (dh - 1) * v_div; -#endif ret = scale_v_linear(rset, &ctx); } #endif diff --git a/apps/recorder/resize.h b/apps/recorder/resize.h index 7e0a991eea..0282a17197 100644 --- a/apps/recorder/resize.h +++ b/apps/recorder/resize.h @@ -43,59 +43,7 @@ #define MAX_SC_STACK_ALLOC 0 #define HAVE_UPSCALER 1 -#if defined(CPU_SH) -/* perform 32x32->40 unsigned multiply, round off and return top 8 bits */ -static inline uint32_t sc_mul_u32_rnd(uint32_t m, uint32_t n) -{ - unsigned r, t1, t2, t3; - unsigned h = 1 << 15; - /* notation: - m = ab, n = cd - final result is (((a *c) << 32) + ((b * c + a * d) << 16) + b * d + - (1 << 31)) >> 32 - */ - asm ( - "swap.w %[m], %[t1]\n\t" /* t1 = ba */ - "mulu %[m], %[n]\n\t" /* b * d */ - "swap.w %[n], %[t3]\n\t" /* t3 = dc */ - "sts macl, %[r]\n\t" /* r = b * d */ - "mulu %[m], %[t3]\n\t" /* b * c */ - "shlr16 %[r]\n\t" - "sts macl, %[t2]\n\t" /* t2 = b * c */ - "mulu %[t1], %[t3]\n\t" /* a * c */ - "add %[t2], %[r]\n\t" - "sts macl, %[t3]\n\t" /* t3 = a * c */ - "mulu %[t1], %[n]\n\t" /* a * d */ - "shll16 %[t3]\n\t" - "sts macl, %[t2]\n\t" /* t2 = a * d */ - "add %[t2], %[r]\n\t" - "add %[t3], %[r]\n\t" /* r = ((b * d) >> 16) + (b * c + a * d) + - ((a * c) << 16) */ - "add %[h], %[r]\n\t" /* round result */ - "shlr16 %[r]\n\t" /* truncate result */ - : /* outputs */ - [r] "=&r"(r), - [t1]"=&r"(t1), - [t2]"=&r"(t2), - [t3]"=&r"(t3) - : /* inputs */ - [h] "r" (h), - [m] "r" (m), - [n] "r" (n) - ); - return r; -} -#elif defined(TEST_SH_MATH) -static inline uint32_t sc_mul_u32_rnd(uint32_t op1, uint32_t op2) -{ - uint64_t tmp = (uint64_t)op1 * op2; - tmp += 1LU << 31; - tmp >>= 32; - return tmp; -} -#else #define SC_OUT(n, c) (((n) + (1 << 23)) >> 24) -#endif #ifndef SC_OUT #define SC_OUT(n, c) (sc_mul_u32_rnd(n, (c)->recip)) #endif @@ -125,14 +73,10 @@ struct uint32_argb { horizontal scaler, and row output */ struct scaler_context { -#if defined(CPU_SH) || defined(TEST_SH_MATH) - uint32_t recip; -#else uint32_t h_i_val; uint32_t h_o_val; uint32_t v_i_val; uint32_t v_o_val; -#endif struct bitmap *bm; struct dim *src; unsigned char *buf; -- cgit v1.2.3