diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2020-07-15 19:40:55 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2020-07-24 21:20:13 +0000 |
commit | 092c340a2062fa98b7387fc5fd63578ddae7d0b6 (patch) | |
tree | 98ec96946eeb2ae709cb0528cc6998e21bb9b290 /apps/recorder/resize.c | |
parent | 17f7cc92c258bc456a27c3e7c5a19c9409851879 (diff) | |
download | rockbox-092c340a2062fa98b7387fc5fd63578ddae7d0b6.tar.gz rockbox-092c340a2062fa98b7387fc5fd63578ddae7d0b6.zip |
[1/4] Remove SH support and all archos targets
This removes all code specific to SH targets
Change-Id: I7980523785d2596e65c06430f4638eec74a06061
Diffstat (limited to 'apps/recorder/resize.c')
-rw-r--r-- | apps/recorder/resize.c | 91 |
1 files changed, 0 insertions, 91 deletions
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 @@ | |||
63 | #endif | 63 | #endif |
64 | #include <jpeg_load.h> | 64 | #include <jpeg_load.h> |
65 | 65 | ||
66 | #if CONFIG_CPU == SH7034 | ||
67 | /* 16*16->32 bit multiplication is a single instrcution on the SH1 */ | ||
68 | #define MULUQ(a, b) ((uint32_t) (((uint16_t) (a)) * ((uint16_t) (b)))) | ||
69 | #define MULQ(a, b) ((int32_t) (((int16_t) (a)) * ((int16_t) (b)))) | ||
70 | #else | ||
71 | #define MULUQ(a, b) ((a) * (b)) | 66 | #define MULUQ(a, b) ((a) * (b)) |
72 | #define MULQ(a, b) ((a) * (b)) | 67 | #define MULQ(a, b) ((a) * (b)) |
73 | #endif | ||
74 | 68 | ||
75 | #ifdef HAVE_LCD_COLOR | 69 | #ifdef HAVE_LCD_COLOR |
76 | #define CHANNEL_BYTES (sizeof(struct uint32_argb)/sizeof(uint32_t)) | 70 | #define CHANNEL_BYTES (sizeof(struct uint32_argb)/sizeof(uint32_t)) |
@@ -151,18 +145,6 @@ int recalc_dimension(struct dim *dst, struct dim *src) | |||
151 | "movclr.l %%acc" #num ", %0" \ | 145 | "movclr.l %%acc" #num ", %0" \ |
152 | : "=d" (dest) \ | 146 | : "=d" (dest) \ |
153 | ) | 147 | ) |
154 | #elif defined(CPU_SH) | ||
155 | /* calculate the 32-bit product of unsigned 16-bit op1 and op2 */ | ||
156 | static inline int32_t mul_s16_s16(int16_t op1, int16_t op2) | ||
157 | { | ||
158 | return (int32_t)(op1 * op2); | ||
159 | } | ||
160 | |||
161 | /* calculate the 32-bit product of signed 16-bit op1 and op2 */ | ||
162 | static inline uint32_t mul_u16_u16(uint16_t op1, uint16_t op2) | ||
163 | { | ||
164 | return (uint32_t)(op1 * op2); | ||
165 | } | ||
166 | #endif | 148 | #endif |
167 | 149 | ||
168 | /* horizontal area average scaler */ | 150 | /* horizontal area average scaler */ |
@@ -171,13 +153,8 @@ static bool scale_h_area(void *out_line_ptr, | |||
171 | { | 153 | { |
172 | SDEBUGF("scale_h_area\n"); | 154 | SDEBUGF("scale_h_area\n"); |
173 | unsigned int ix, ox, oxe, mul; | 155 | unsigned int ix, ox, oxe, mul; |
174 | #if defined(CPU_SH) || defined (TEST_SH_MATH) | ||
175 | const uint32_t h_i_val = ctx->src->width, | ||
176 | h_o_val = ctx->bm->width; | ||
177 | #else | ||
178 | const uint32_t h_i_val = ctx->h_i_val, | 156 | const uint32_t h_i_val = ctx->h_i_val, |
179 | h_o_val = ctx->h_o_val; | 157 | h_o_val = ctx->h_o_val; |
180 | #endif | ||
181 | #ifdef HAVE_LCD_COLOR | 158 | #ifdef HAVE_LCD_COLOR |
182 | struct uint32_argb rgbvalacc = { 0, 0, 0, 0 }, | 159 | struct uint32_argb rgbvalacc = { 0, 0, 0, 0 }, |
183 | rgbvaltmp = { 0, 0, 0, 0 }, | 160 | rgbvaltmp = { 0, 0, 0, 0 }, |
@@ -298,15 +275,6 @@ static bool scale_h_area(void *out_line_ptr, | |||
298 | mul = h_o_val - oxe; | 275 | mul = h_o_val - oxe; |
299 | MAC(tmp, mul, 0); | 276 | MAC(tmp, mul, 0); |
300 | MAC_OUT(acc, 0); | 277 | MAC_OUT(acc, 0); |
301 | #elif defined(CPU_SH) | ||
302 | /* SH-1 16x16->32 math */ | ||
303 | /* add saved partial pixel from start of area */ | ||
304 | acc = mul_u16_u16(acc, h_o_val) + mul_u16_u16(tmp, mul); | ||
305 | |||
306 | /* get new pixel , then add its partial coverage to this area */ | ||
307 | tmp = *(part->buf); | ||
308 | mul = h_o_val - oxe; | ||
309 | acc += mul_u16_u16(tmp, mul); | ||
310 | #else | 278 | #else |
311 | /* generic C math */ | 279 | /* generic C math */ |
312 | /* add saved partial pixel from start of area */ | 280 | /* add saved partial pixel from start of area */ |
@@ -317,10 +285,8 @@ static bool scale_h_area(void *out_line_ptr, | |||
317 | mul = h_o_val - oxe; | 285 | mul = h_o_val - oxe; |
318 | acc += tmp * mul; | 286 | acc += tmp * mul; |
319 | #endif /* CPU */ | 287 | #endif /* CPU */ |
320 | #if !(defined(CPU_SH) || defined(TEST_SH_MATH)) | ||
321 | /* round, divide, and either store or accumulate to output row */ | 288 | /* round, divide, and either store or accumulate to output row */ |
322 | acc = (acc + (1 << 21)) >> 22; | 289 | acc = (acc + (1 << 21)) >> 22; |
323 | #endif | ||
324 | if (accum) | 290 | if (accum) |
325 | { | 291 | { |
326 | acc += out_line[ox]; | 292 | acc += out_line[ox]; |
@@ -346,13 +312,8 @@ static bool scale_h_area(void *out_line_ptr, | |||
346 | static inline bool scale_v_area(struct rowset *rset, struct scaler_context *ctx) | 312 | static inline bool scale_v_area(struct rowset *rset, struct scaler_context *ctx) |
347 | { | 313 | { |
348 | uint32_t mul, oy, iy, oye; | 314 | uint32_t mul, oy, iy, oye; |
349 | #if defined(CPU_SH) || defined (TEST_SH_MATH) | ||
350 | const uint32_t v_i_val = ctx->src->height, | ||
351 | v_o_val = ctx->bm->height; | ||
352 | #else | ||
353 | const uint32_t v_i_val = ctx->v_i_val, | 315 | const uint32_t v_i_val = ctx->v_i_val, |
354 | v_o_val = ctx->v_o_val; | 316 | v_o_val = ctx->v_o_val; |
355 | #endif | ||
356 | 317 | ||
357 | /* Set up rounding and scale factors */ | 318 | /* Set up rounding and scale factors */ |
358 | mul = 0; | 319 | mul = 0; |
@@ -409,13 +370,8 @@ static bool scale_h_linear(void *out_line_ptr, struct scaler_context *ctx, | |||
409 | bool accum) | 370 | bool accum) |
410 | { | 371 | { |
411 | unsigned int ix, ox, ixe; | 372 | unsigned int ix, ox, ixe; |
412 | #if defined(CPU_SH) || defined (TEST_SH_MATH) | ||
413 | const uint32_t h_i_val = ctx->src->width - 1, | ||
414 | h_o_val = ctx->bm->width - 1; | ||
415 | #else | ||
416 | const uint32_t h_i_val = ctx->h_i_val, | 373 | const uint32_t h_i_val = ctx->h_i_val, |
417 | h_o_val = ctx->h_o_val; | 374 | h_o_val = ctx->h_o_val; |
418 | #endif | ||
419 | /* type x = x is an ugly hack for hiding an unitialized data warning. The | 375 | /* type x = x is an ugly hack for hiding an unitialized data warning. The |
420 | values are conditionally initialized before use, but other values are | 376 | values are conditionally initialized before use, but other values are |
421 | set such that this will occur before these are used. | 377 | 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, | |||
531 | #if defined(CPU_COLDFIRE) | 487 | #if defined(CPU_COLDFIRE) |
532 | /* Coldfire EMAC math */ | 488 | /* Coldfire EMAC math */ |
533 | MAC(val, h_o_val, 0); | 489 | MAC(val, h_o_val, 0); |
534 | #elif defined(CPU_SH) | ||
535 | /* SH-1 16x16->32 math */ | ||
536 | val = mul_u16_u16(val, h_o_val); | ||
537 | #else | 490 | #else |
538 | /* generic C math */ | 491 | /* generic C math */ |
539 | val = val * h_o_val; | 492 | val = val * h_o_val; |
@@ -552,9 +505,6 @@ static bool scale_h_linear(void *out_line_ptr, struct scaler_context *ctx, | |||
552 | #if defined(CPU_COLDFIRE) | 505 | #if defined(CPU_COLDFIRE) |
553 | /* Coldfire EMAC math */ | 506 | /* Coldfire EMAC math */ |
554 | MAC(inc, ixe, 0); | 507 | MAC(inc, ixe, 0); |
555 | #elif defined(CPU_SH) | ||
556 | /* SH-1 16x16->32 math */ | ||
557 | val += mul_s16_s16(inc, ixe); | ||
558 | #else | 508 | #else |
559 | /* generic C math */ | 509 | /* generic C math */ |
560 | val += inc * ixe; | 510 | val += inc * ixe; |
@@ -565,16 +515,10 @@ static bool scale_h_linear(void *out_line_ptr, struct scaler_context *ctx, | |||
565 | MAC_OUT(val, 0); | 515 | MAC_OUT(val, 0); |
566 | #endif | 516 | #endif |
567 | /* Now multiply the color increment to its proper value */ | 517 | /* Now multiply the color increment to its proper value */ |
568 | #if defined(CPU_SH) | ||
569 | /* SH-1 16x16->32 math */ | ||
570 | inc = mul_s16_s16(inc, h_i_val); | ||
571 | #else | ||
572 | /* generic C math */ | 518 | /* generic C math */ |
573 | inc *= h_i_val; | 519 | inc *= h_i_val; |
574 | #endif | ||
575 | } else | 520 | } else |
576 | val += inc; | 521 | val += inc; |
577 | #if !(defined(CPU_SH) || defined(TEST_SH_MATH)) | ||
578 | /* round and scale values, and accumulate or store to output */ | 522 | /* round and scale values, and accumulate or store to output */ |
579 | if (accum) | 523 | if (accum) |
580 | { | 524 | { |
@@ -582,15 +526,6 @@ static bool scale_h_linear(void *out_line_ptr, struct scaler_context *ctx, | |||
582 | } else { | 526 | } else { |
583 | out_line[ox] = (val + (1 << 21)) >> 22; | 527 | out_line[ox] = (val + (1 << 21)) >> 22; |
584 | } | 528 | } |
585 | #else | ||
586 | /* round and scale values, and accumulate or store to output */ | ||
587 | if (accum) | ||
588 | { | ||
589 | out_line[ox] += val; | ||
590 | } else { | ||
591 | out_line[ox] = val; | ||
592 | } | ||
593 | #endif | ||
594 | #endif | 529 | #endif |
595 | ixe += h_i_val; | 530 | ixe += h_i_val; |
596 | } | 531 | } |
@@ -603,13 +538,8 @@ static inline bool scale_v_linear(struct rowset *rset, | |||
603 | { | 538 | { |
604 | uint32_t iy, iye; | 539 | uint32_t iy, iye; |
605 | int32_t oy; | 540 | int32_t oy; |
606 | #if defined(CPU_SH) || defined (TEST_SH_MATH) | ||
607 | const uint32_t v_i_val = ctx->src->height - 1, | ||
608 | v_o_val = ctx->bm->height - 1; | ||
609 | #else | ||
610 | const uint32_t v_i_val = ctx->v_i_val, | 541 | const uint32_t v_i_val = ctx->v_i_val, |
611 | v_o_val = ctx->v_o_val; | 542 | v_o_val = ctx->v_o_val; |
612 | #endif | ||
613 | /* Set up our buffers, to store the increment and current value for each | 543 | /* Set up our buffers, to store the increment and current value for each |
614 | column, and one temp buffer used to read in new rows. | 544 | column, and one temp buffer used to read in new rows. |
615 | */ | 545 | */ |
@@ -892,9 +822,6 @@ int resize_on_load(struct bitmap *bm, bool dither, struct dim *src, | |||
892 | ctx.bm = bm; | 822 | ctx.bm = bm; |
893 | ctx.src = src; | 823 | ctx.src = src; |
894 | ctx.dither = dither; | 824 | ctx.dither = dither; |
895 | #if defined(CPU_SH) || defined (TEST_SH_MATH) | ||
896 | uint32_t div; | ||
897 | #endif | ||
898 | #if !defined(PLUGIN) | 825 | #if !defined(PLUGIN) |
899 | #if defined(HAVE_LCD_COLOR) && defined(HAVE_JPEG) | 826 | #if defined(HAVE_LCD_COLOR) && defined(HAVE_JPEG) |
900 | ctx.output_row = format_index ? output_row_32_native_fromyuv | 827 | 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, | |||
914 | { | 841 | { |
915 | #endif | 842 | #endif |
916 | ctx.h_scaler = scale_h_area; | 843 | ctx.h_scaler = scale_h_area; |
917 | #if defined(CPU_SH) || defined (TEST_SH_MATH) | ||
918 | div = sw; | ||
919 | #else | ||
920 | uint32_t h_div = (1U << 24) / sw; | 844 | uint32_t h_div = (1U << 24) / sw; |
921 | ctx.h_i_val = sw * h_div; | 845 | ctx.h_i_val = sw * h_div; |
922 | ctx.h_o_val = dw * h_div; | 846 | ctx.h_o_val = dw * h_div; |
923 | #endif | ||
924 | #ifdef HAVE_UPSCALER | 847 | #ifdef HAVE_UPSCALER |
925 | } else { | 848 | } else { |
926 | ctx.h_scaler = scale_h_linear; | 849 | ctx.h_scaler = scale_h_linear; |
927 | #if defined(CPU_SH) || defined (TEST_SH_MATH) | ||
928 | div = dw - 1; | ||
929 | #else | ||
930 | uint32_t h_div = (1U << 24) / (dw - 1); | 850 | uint32_t h_div = (1U << 24) / (dw - 1); |
931 | ctx.h_i_val = (sw - 1) * h_div; | 851 | ctx.h_i_val = (sw - 1) * h_div; |
932 | ctx.h_o_val = (dw - 1) * h_div; | 852 | ctx.h_o_val = (dw - 1) * h_div; |
933 | #endif | ||
934 | } | 853 | } |
935 | #endif | 854 | #endif |
936 | #ifdef CPU_COLDFIRE | 855 | #ifdef CPU_COLDFIRE |
@@ -941,27 +860,17 @@ int resize_on_load(struct bitmap *bm, bool dither, struct dim *src, | |||
941 | if (sh > dh) | 860 | if (sh > dh) |
942 | #endif | 861 | #endif |
943 | { | 862 | { |
944 | #if defined(CPU_SH) || defined (TEST_SH_MATH) | ||
945 | div *= sh; | ||
946 | ctx.recip = ((uint32_t)(-div)) / div + 1; | ||
947 | #else | ||
948 | uint32_t v_div = (1U << 22) / sh; | 863 | uint32_t v_div = (1U << 22) / sh; |
949 | ctx.v_i_val = sh * v_div; | 864 | ctx.v_i_val = sh * v_div; |
950 | ctx.v_o_val = dh * v_div; | 865 | ctx.v_o_val = dh * v_div; |
951 | #endif | ||
952 | ret = scale_v_area(rset, &ctx); | 866 | ret = scale_v_area(rset, &ctx); |
953 | } | 867 | } |
954 | #ifdef HAVE_UPSCALER | 868 | #ifdef HAVE_UPSCALER |
955 | else | 869 | else |
956 | { | 870 | { |
957 | #if defined(CPU_SH) || defined (TEST_SH_MATH) | ||
958 | div *= dh - 1; | ||
959 | ctx.recip = ((uint32_t)(-div)) / div + 1; | ||
960 | #else | ||
961 | uint32_t v_div = (1U << 22) / dh; | 871 | uint32_t v_div = (1U << 22) / dh; |
962 | ctx.v_i_val = (sh - 1) * v_div; | 872 | ctx.v_i_val = (sh - 1) * v_div; |
963 | ctx.v_o_val = (dh - 1) * v_div; | 873 | ctx.v_o_val = (dh - 1) * v_div; |
964 | #endif | ||
965 | ret = scale_v_linear(rset, &ctx); | 874 | ret = scale_v_linear(rset, &ctx); |
966 | } | 875 | } |
967 | #endif | 876 | #endif |