Home | History | Annotate | Download | only in src
      1 ;//
      2 ;//
      3 ;// File Name:  omxVCCOMM_ExpandFrame_I_s.s
      4 ;// OpenMAX DL: v1.0.2
      5 ;// Revision:   9641
      6 ;// Date:       Thursday, February 7, 2008
      7 ;//
      8 ;// (c) Copyright 2007-2008 ARM Limited. All Rights Reserved.
      9 ;//
     10 ;//
     11 ;//
     12 ;// Description:
     13 ;// This function will Expand Frame boundary pixels into Plane
     14 ;//
     15 ;//
     16 
     17 ;// Include standard headers
     18 
     19         INCLUDE omxtypes_s.h
     20         INCLUDE armCOMM_s.h
     21 
     22         M_VARIANTS ARM1136JS
     23 
     24 ;// Import symbols required from other files
     25 ;// (For example tables)
     26 
     27 
     28 ;// Set debugging level
     29 DEBUG_ON    SETL {FALSE}
     30 
     31 
     32 
     33 
     34 
     35 
     36 
     37 ;// Guarding implementation by the processor name
     38 
     39     IF  ARM1136JS
     40 
     41 ;//Input Registers
     42 
     43 pSrcDstPlane    RN  0
     44 iFrameWidth     RN  1
     45 iFrameHeight    RN  2
     46 iExpandPels     RN  3
     47 
     48 
     49 ;//Output Registers
     50 
     51 result          RN  0
     52 
     53 ;//Local Scratch Registers
     54 
     55 iPlaneStep      RN  4
     56 pTop            RN  5
     57 pBottom         RN  6
     58 pBottomIndex    RN  7
     59 x               RN  8
     60 y               RN  9
     61 tempTop         RN  10
     62 tempBot         RN  11
     63 ColStep         RN  12
     64 pLeft           RN  5
     65 pRight          RN  6
     66 pRightIndex     RN  7
     67 tempLeft1       RN  10
     68 tempRight1      RN  11
     69 tempLeft2       RN  14
     70 tempRight2      RN  2
     71 indexY          RN  14
     72 RowStep         RN  12
     73 expandTo4bytes  RN  1                               ;// copy a byte to 4 bytes of a word
     74 
     75         ;// Allocate stack memory required by the function
     76 
     77 
     78         ;// Write function header
     79         M_START omxVCCOMM_ExpandFrame_I,r11
     80 
     81         ;// Define stack arguments
     82         M_ARG   iPlaneStepOnStack, 4
     83 
     84         ;// Load argument from the stack
     85         M_LDR   iPlaneStep, iPlaneStepOnStack
     86 
     87         MUL     pTop,iExpandPels,iPlaneStep
     88         MLA     pBottom,iFrameHeight,iPlaneStep,pSrcDstPlane
     89         SUB     x,iFrameWidth,#4
     90         MOV     indexY,pTop
     91         ADD     ColStep,indexY,#4
     92         SUB     pBottomIndex,pBottom,iPlaneStep
     93         SUB     pTop,pSrcDstPlane,pTop
     94 
     95 
     96         ADD     pTop,pTop,x
     97         ADD     pBottom,pBottom,x
     98 
     99         ;//------------------------------------------------------------------------
    100         ;// The following improves upon the C implmentation
    101         ;// The x and y loops are interchanged: This ensures that the values of
    102         ;// pSrcDstPlane [x] and pSrcDstPlane [(iFrameHeight - 1) * iPlaneStep + x]
    103         ;// which depend only on loop variable 'x' are loaded once and used in
    104         ;// multiple stores in the 'Y' loop
    105         ;//------------------------------------------------------------------------
    106 
    107         ;// xloop
    108 ExpandFrameTopBotXloop
    109 
    110         LDR     tempTop,[pSrcDstPlane,x]
    111         ;//------------------------------------------------------------------------
    112         ;// pSrcDstPlane [(iFrameHeight - 1) * iPlaneStep + x] is simplified as:
    113         ;// pSrcDstPlane + (iFrameHeight * iPlaneStep) - iPlaneStep + x ==
    114         ;// pBottom - iPlaneStep + x == pBottomIndex [x]
    115         ;// The value of pBottomIndex is calculated above this 'x' loop
    116         ;//------------------------------------------------------------------------
    117         LDR     tempBot,[pBottomIndex,x]
    118 
    119         ;// yloop
    120         MOV     y,iExpandPels
    121 
    122 ExpandFrameTopBotYloop
    123         SUBS    y,y,#1
    124         M_STR   tempTop,[pTop],iPlaneStep
    125         M_STR   tempBot,[pBottom],iPlaneStep
    126         BGT     ExpandFrameTopBotYloop
    127 
    128         SUBS    x,x,#4
    129         SUB     pTop,pTop,ColStep
    130         SUB     pBottom,pBottom,ColStep
    131         BGE     ExpandFrameTopBotXloop
    132 
    133 
    134         ;// y loop
    135         ;// The product is already calculated above : Reuse
    136         ;//MUL     indexY,iExpandPels,iPlaneStep
    137 
    138         SUB     pSrcDstPlane,pSrcDstPlane,indexY
    139         SUB     pLeft,pSrcDstPlane,iExpandPels                  ;// pLeft->points to the top left of the expanded block
    140         ADD     pRight,pSrcDstPlane,iFrameWidth
    141         SUB     pRightIndex,pRight,#1
    142 
    143         ADD     y,iFrameHeight,iExpandPels,LSL #1
    144         LDR     expandTo4bytes,=0x01010101
    145 
    146         RSB     RowStep,iExpandPels,iPlaneStep,LSL #1
    147 
    148         ;// The Y Loop is unrolled twice
    149 ExpandFrameLeftRightYloop
    150         LDRB    tempLeft2,[pSrcDstPlane,iPlaneStep]             ;// PreLoad the values
    151         LDRB    tempRight2,[pRightIndex,iPlaneStep]
    152         M_LDRB  tempLeft1,[pSrcDstPlane],iPlaneStep,LSL #1      ;// PreLoad the values
    153         M_LDRB  tempRight1,[pRightIndex],iPlaneStep,LSL #1
    154 
    155         SUB     x,iExpandPels,#4
    156         MUL     tempLeft2,tempLeft2,expandTo4bytes              ;// Copy the single byte to 4 bytes
    157         MUL     tempRight2,tempRight2,expandTo4bytes
    158         MUL     tempLeft1,tempLeft1,expandTo4bytes              ;// Copy the single byte to 4 bytes
    159         MUL     tempRight1,tempRight1,expandTo4bytes
    160 
    161 
    162         ;// x loop
    163 ExpandFrameLeftRightXloop
    164         SUBS    x,x,#4
    165         STR     tempLeft2,[pLeft,iPlaneStep]                     ;// Store the 4 bytes at one go
    166         STR     tempRight2,[pRight,iPlaneStep]
    167         STR     tempLeft1,[pLeft],#4                             ;// Store the 4 bytes at one go
    168         STR     tempRight1,[pRight],#4
    169         BGE     ExpandFrameLeftRightXloop
    170 
    171         SUBS    y,y,#2
    172         ADD     pLeft,pLeft,RowStep
    173         ADD     pRight,pRight,RowStep
    174         BGT     ExpandFrameLeftRightYloop
    175 
    176 
    177         ;// Set return value
    178 
    179         MOV         result,#OMX_Sts_NoErr
    180 End
    181 
    182         ;// Write function tail
    183 
    184         M_END
    185 
    186     ENDIF                                                    ;//ARM1136JS
    187 
    188 
    189     END