Home | History | Annotate | Download | only in libpixelflinger
      1 /*
      2 **
      3 ** Copyright 2006, The Android Open Source Project
      4 **
      5 ** Licensed under the Apache License, Version 2.0 (the "License");
      6 ** you may not use this file except in compliance with the License.
      7 ** You may obtain a copy of the License at
      8 **
      9 **     http://www.apache.org/licenses/LICENSE-2.0
     10 **
     11 ** Unless required by applicable law or agreed to in writing, software
     12 ** distributed under the License is distributed on an "AS IS" BASIS,
     13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14 ** See the License for the specific language governing permissions and
     15 ** limitations under the License.
     16 */
     17 
     18 
     19     .text
     20     .align
     21 
     22     .global rotate90CW_4x4_16v6
     23 
     24 // Rotates 90deg CW a 4x4 block of 16bpp pixels using ARMv6
     25 // src and dst must be 4 pixels-aligned (2-pixels aligned might
     26 // actually work)
     27 //
     28 // The code below is complicated by ARM's little endianness.
     29 
     30 rotate90CW_4x4_16v6:
     31     // r0 = dst
     32     // r1 = src
     33     // r2 = dst stride in pixels
     34     // r3 = src stride in pixels
     35 
     36     stmfd   sp!, {r4,r5, r6,r7, r8,r9, r10,r11, lr}
     37     add     r14, r3, r3
     38     add     r12, r2, r2
     39 
     40     ldrd    r2, r3, [r1], r14
     41     ldrd    r4, r5, [r1], r14
     42     ldrd    r6, r7, [r1], r14
     43     ldrd    r8, r9, [r1]
     44 
     45     pkhbt   r10, r8, r6, lsl #16
     46     pkhbt   r11, r4, r2, lsl #16
     47     strd    r10, r11, [r0], r12
     48 
     49     pkhtb   r10, r6, r8, asr #16
     50     pkhtb   r11, r2, r4, asr #16
     51 
     52     strd    r10, r11, [r0], r12
     53     pkhbt   r10, r9, r7, lsl #16
     54     pkhbt   r11, r5, r3, lsl #16
     55 
     56     strd    r10, r11, [r0], r12
     57 
     58     pkhtb   r10, r7, r9, asr #16
     59     pkhtb   r11, r3, r5, asr #16
     60     strd    r10, r11, [r0]
     61 
     62     ldmfd   sp!, {r4,r5, r6,r7, r8,r9, r10,r11, pc}
     63