Ticket #8633: diff

File diff, 3.4 KB (added by SF/robinwatts, 17 years ago)

ARM version of Blit1to2, plus changes to the C to call it

  • SDL_blit_1.

    old new static void Blit1to1(SDL_BlitInfo *info)  
    7777#if ( SDL_BYTEORDER == SDL_LIL_ENDIAN )
    7878#define HI      1
    7979#define LO      0
    8080#else /* ( SDL_BYTEORDER == SDL_BIG_ENDIAN ) */
    8181#define HI      0
    8282#define LO      1
    8383#endif
     84
     85#if defined(ARM)
     86void Blit1to2ARM(Uint8 *src, int srcskip,
     87                 Uint8 *dst, int dstskip,
     88                 int width, int height,
     89                 Uint16 *map);
     90#endif
     91
    8492static void Blit1to2(SDL_BlitInfo *info)
    8593{
     94#if defined(ARM)
     95        Blit1to2ARM(info->s_pixels,
     96                    info->s_skip,
     97                    info->d_pixels,
     98                    info->d_skip,
     99                    info->d_width,
     100                    info->d_height,
     101                    (Uint16 *)info->table);
     102#else
    86103#ifndef USE_DUFFS_LOOP
    87104        int c;
    88105#endif
    89106        int width, height;
    90107        Uint8 *src, *dst;
    91108        Uint16 *map;
    92109        int srcskip, dstskip;
    static void Blit1to2(SDL_BlitInfo *info)  
    185202                                        break;
    186203                        }
    187204                        src += srcskip;
    188205                        dst += dstskip;
    189206                }
    190207        }
    191208#endif /* USE_DUFFS_LOOP */
     209#endif /* ARM */
    192210}
    193211static void Blit1to3(SDL_BlitInfo *info)
    194212{
    195213#ifndef USE_DUFFS_LOOP
    196214        int c;
    197215#endif
    198216        int o;
  • ARM_blit1to2.s

    
          
     
     1@ ARM code version of Blit1to2.
     2@
     3@ @author Robin Watts (robin@wss.co.uk)
     4
     5        .text
     6
     7        .global Blit1to2ARM
     8
     9        @ Reads a width x height block of 8 bpp pixels from srcPtr, looks
     10        @ them up in the palette at map, and stores them as 16bpp pixels
     11        @ at dstPtr. srcPitch and dstPitch give information about how to
     12        @ find the next lines.
     13Blit1to2ARM:
     14        @ r0 = srcPtr
     15        @ r1 = srcPitch
     16        @ r2 = dstPtr
     17        @ r3 = dstPitch
     18        MOV     r12,r13
     19        STMFD   r13!,{r4-r11,r14}
     20        LDMIA   r12,{r4-r6}
     21        @ r4 = width
     22        @ r5 = height
     23        @ r6 = map
     24
     25        CMP     r7,#0
     26        BLE     end
     27        SUBS    r5,r5,#1                @ while (--height)
     28        BLT     end
     29height_loop:
     30        SUBS    r7,r4,#5                @ r7= width_minus_5
     31        BLE     thin
     32width_loop:
     33        @ Have to do at least 6 here
     34        LDRB    r8, [r0],#1             @ r8 = *src++
     35        LDRB    r9, [r0],#1             @ r9 = *src++
     36        LDRB    r10,[r0],#1             @ r10= *src++
     37        LDRB    r11,[r0],#1             @ r11= *src++
     38        LDRB    r12,[r0],#1             @ r12= *src++
     39        LDRB    r14,[r0],#1             @ r14= *src++
     40        ADD     r8, r8, r8              @ r8 = 2*r8
     41        ADD     r9, r9, r9              @ r9 = 2*r9
     42        ADD     r10,r10,r10             @ r10= 2*r10
     43        ADD     r11,r11,r11             @ r11= 2*r11
     44        ADD     r12,r12,r12             @ r12= 2*r12
     45        ADD     r14,r14,r14             @ r14= 2*r14
     46        LDRH    r8, [r6,r8]             @ r8 = map[r8]
     47        LDRH    r9, [r6,r9]             @ r9 = map[r9]
     48        LDRH    r10,[r6,r10]            @ r10= map[r10]
     49        LDRH    r11,[r6,r11]            @ r11= map[r11]
     50        LDRH    r12,[r6,r12]            @ r12= map[r12]
     51        LDRH    r14,[r6,r14]            @ r14= map[r14]
     52        SUBS    r7,r7,#6                @ r7 = width_minus_5 -= 6
     53        STRH    r8, [r2],#2             @ *dstPtr++ = r8
     54        STRH    r9, [r2],#2             @ *dstPtr++ = r9
     55        STRH    r10,[r2],#2             @ *dstPtr++ = r10
     56        STRH    r11,[r2],#2             @ *dstPtr++ = r11
     57        STRH    r12,[r2],#2             @ *dstPtr++ = r12
     58        STRH    r14,[r2],#2             @ *dstPtr++ = r14
     59        BGT     width_loop              @ width_minus_5>0 => 6+ left to do
     60thin:
     61        ADDS    r7,r7,#5                @ r7 = width (width <= 5)
     62        BEQ     end_thin
     63thin_lp:
     64        LDRB    r8,[r0],#1              @ r8 = *src++
     65        SUBS    r7,r7,#1                @ r7 = width--
     66        @ Stall
     67        ADD     r8,r8,r8                @ r8 = 2*r8
     68        LDRH    r8,[r6,r8]              @ r8 = map[r8]
     69        @ Stall
     70        @ Stall
     71        STRH    r8,[r2],#2              @ *dstPtr++ = r8
     72        BGT     thin_lp
     73end_thin:
     74
     75        ADD     r2,r2,r3                @ dstPtr += dstPitch
     76        ADD     r0,r0,r1                @ srcPtr += srcPitch
     77
     78        SUBS    r5,r5,#1
     79        BGE     height_loop
     80
     81end:
     82        LDMFD   r13!,{r4-r11,PC}