10c1bc742181ded4930842b46e9507372f0b1b963James Dong;//
278e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;// Copyright (C) 2007-2008 ARM Limited
378e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;//
478e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;// Licensed under the Apache License, Version 2.0 (the "License");
578e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;// you may not use this file except in compliance with the License.
678e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;// You may obtain a copy of the License at
778e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;//
878e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;//      http://www.apache.org/licenses/LICENSE-2.0
978e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;//
1078e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;// Unless required by applicable law or agreed to in writing, software
1178e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;// distributed under the License is distributed on an "AS IS" BASIS,
1278e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1378e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;// See the License for the specific language governing permissions and
1478e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;// limitations under the License.
1578e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;//
1678e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;//
170c1bc742181ded4930842b46e9507372f0b1b963James Dong;//
180c1bc742181ded4930842b46e9507372f0b1b963James Dong;// File Name:  armVCM4P10_InterpolateLuma_DiagCopy_unsafe_s.s
190c1bc742181ded4930842b46e9507372f0b1b963James Dong;// OpenMAX DL: v1.0.2
200c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Revision:   9641
210c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Date:       Thursday, February 7, 2008
220c1bc742181ded4930842b46e9507372f0b1b963James Dong;//
230c1bc742181ded4930842b46e9507372f0b1b963James Dong;//
240c1bc742181ded4930842b46e9507372f0b1b963James Dong;//
250c1bc742181ded4930842b46e9507372f0b1b963James Dong;//
260c1bc742181ded4930842b46e9507372f0b1b963James Dong
270c1bc742181ded4930842b46e9507372f0b1b963James Dong        INCLUDE omxtypes_s.h
280c1bc742181ded4930842b46e9507372f0b1b963James Dong        INCLUDE armCOMM_s.h
290c1bc742181ded4930842b46e9507372f0b1b963James Dong
300c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_VARIANTS ARM1136JS
310c1bc742181ded4930842b46e9507372f0b1b963James Dong
320c1bc742181ded4930842b46e9507372f0b1b963James Dong        EXPORT armVCM4P10_InterpolateLuma_HorDiagCopy_unsafe
330c1bc742181ded4930842b46e9507372f0b1b963James Dong        EXPORT armVCM4P10_InterpolateLuma_VerDiagCopy_unsafe
340c1bc742181ded4930842b46e9507372f0b1b963James Dong
350c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Functions:
360c1bc742181ded4930842b46e9507372f0b1b963James Dong;//     armVCM4P10_InterpolateLuma_HorDiagCopy_unsafe and
370c1bc742181ded4930842b46e9507372f0b1b963James Dong;//     armVCM4P10_InterpolateLuma_VerDiagCopy_unsafe
380c1bc742181ded4930842b46e9507372f0b1b963James Dong;//
390c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Implements re-arrangement of data from temporary buffer to a buffer pointed by pBuf.
400c1bc742181ded4930842b46e9507372f0b1b963James Dong;// This will do the convertion of data from 16 bit to 8 bit and it also
410c1bc742181ded4930842b46e9507372f0b1b963James Dong;// remove offset and check for saturation.
420c1bc742181ded4930842b46e9507372f0b1b963James Dong;//
430c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Registers used as input for this function
440c1bc742181ded4930842b46e9507372f0b1b963James Dong;// r0,r1,r7 where r0 is input pointer and r2 its step size, r7 is output pointer
450c1bc742181ded4930842b46e9507372f0b1b963James Dong;//
460c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Registers preserved for top level function
470c1bc742181ded4930842b46e9507372f0b1b963James Dong;// r4,r5,r6,r8,r9,r14
480c1bc742181ded4930842b46e9507372f0b1b963James Dong;//
490c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Registers modified by the function
500c1bc742181ded4930842b46e9507372f0b1b963James Dong;// r7,r10,r11,r12
510c1bc742181ded4930842b46e9507372f0b1b963James Dong;//
520c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Output registers
530c1bc742181ded4930842b46e9507372f0b1b963James Dong;// r0 - pointer to the destination location
540c1bc742181ded4930842b46e9507372f0b1b963James Dong;// r1 - step size to this destination location
550c1bc742181ded4930842b46e9507372f0b1b963James Dong
560c1bc742181ded4930842b46e9507372f0b1b963James Dong
570c1bc742181ded4930842b46e9507372f0b1b963James DongDEBUG_ON    SETL {FALSE}
580c1bc742181ded4930842b46e9507372f0b1b963James Dong
590c1bc742181ded4930842b46e9507372f0b1b963James DongMASK            EQU 0x80808080  ;// Mask is used to implement (a+b+1)/2
600c1bc742181ded4930842b46e9507372f0b1b963James Dong
610c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Declare input registers
620c1bc742181ded4930842b46e9507372f0b1b963James Dong
630c1bc742181ded4930842b46e9507372f0b1b963James DongpSrc0           RN 0
640c1bc742181ded4930842b46e9507372f0b1b963James DongsrcStep0        RN 1
650c1bc742181ded4930842b46e9507372f0b1b963James Dong
660c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Declare other intermediate registers
670c1bc742181ded4930842b46e9507372f0b1b963James DongTemp1           RN 4
680c1bc742181ded4930842b46e9507372f0b1b963James DongTemp2           RN 5
690c1bc742181ded4930842b46e9507372f0b1b963James DongTemp3           RN 10
700c1bc742181ded4930842b46e9507372f0b1b963James DongTemp4           RN 11
710c1bc742181ded4930842b46e9507372f0b1b963James DongpBuf            RN 7
720c1bc742181ded4930842b46e9507372f0b1b963James Dongr0x0fe00fe0     RN 6
730c1bc742181ded4930842b46e9507372f0b1b963James Dongr0x00ff00ff     RN 12
740c1bc742181ded4930842b46e9507372f0b1b963James DongCount           RN 14
750c1bc742181ded4930842b46e9507372f0b1b963James DongValueA0         RN 10
760c1bc742181ded4930842b46e9507372f0b1b963James DongValueA1         RN 11
770c1bc742181ded4930842b46e9507372f0b1b963James Dong
780c1bc742181ded4930842b46e9507372f0b1b963James Dong    IF ARM1136JS
790c1bc742181ded4930842b46e9507372f0b1b963James Dong
800c1bc742181ded4930842b46e9507372f0b1b963James Dong
810c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Function header
820c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_START armVCM4P10_InterpolateLuma_HorDiagCopy_unsafe, r6
830c1bc742181ded4930842b46e9507372f0b1b963James Dong
840c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Code start
850c1bc742181ded4930842b46e9507372f0b1b963James Dong        MOV         Count, #4
860c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDR         r0x0fe00fe0, =0x0fe00fe0
870c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDR         r0x00ff00ff, =0x00ff00ff
880c1bc742181ded4930842b46e9507372f0b1b963James DongLoopStart1
890c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDR         Temp4, [pSrc0, #12]
900c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDR         Temp3, [pSrc0, #8]
910c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDR         Temp2, [pSrc0, #4]
920c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDR       Temp1, [pSrc0], srcStep0
930c1bc742181ded4930842b46e9507372f0b1b963James Dong        UQSUB16     Temp4, Temp4, r0x0fe00fe0
940c1bc742181ded4930842b46e9507372f0b1b963James Dong        UQSUB16     Temp3, Temp3, r0x0fe00fe0
950c1bc742181ded4930842b46e9507372f0b1b963James Dong        UQSUB16     Temp2, Temp2, r0x0fe00fe0
960c1bc742181ded4930842b46e9507372f0b1b963James Dong        UQSUB16     Temp1, Temp1, r0x0fe00fe0
970c1bc742181ded4930842b46e9507372f0b1b963James Dong        USAT16      Temp4, #13, Temp4
980c1bc742181ded4930842b46e9507372f0b1b963James Dong        USAT16      Temp3, #13, Temp3
990c1bc742181ded4930842b46e9507372f0b1b963James Dong        USAT16      Temp2, #13, Temp2
1000c1bc742181ded4930842b46e9507372f0b1b963James Dong        USAT16      Temp1, #13, Temp1
1010c1bc742181ded4930842b46e9507372f0b1b963James Dong        AND         Temp4, r0x00ff00ff, Temp4, LSR #5
1020c1bc742181ded4930842b46e9507372f0b1b963James Dong        AND         Temp3, r0x00ff00ff, Temp3, LSR #5
1030c1bc742181ded4930842b46e9507372f0b1b963James Dong        AND         Temp2, r0x00ff00ff, Temp2, LSR #5
1040c1bc742181ded4930842b46e9507372f0b1b963James Dong        AND         Temp1, r0x00ff00ff, Temp1, LSR #5
1050c1bc742181ded4930842b46e9507372f0b1b963James Dong        ORR         ValueA1, Temp3, Temp4, LSL #8
1060c1bc742181ded4930842b46e9507372f0b1b963James Dong        ORR         ValueA0, Temp1, Temp2, LSL #8
1070c1bc742181ded4930842b46e9507372f0b1b963James Dong        SUBS        Count, Count, #1
1080c1bc742181ded4930842b46e9507372f0b1b963James Dong        STRD        ValueA0, [pBuf], #8
1090c1bc742181ded4930842b46e9507372f0b1b963James Dong        BGT         LoopStart1
1100c1bc742181ded4930842b46e9507372f0b1b963James DongEnd1
1110c1bc742181ded4930842b46e9507372f0b1b963James Dong        SUB        pSrc0, pBuf, #32
1120c1bc742181ded4930842b46e9507372f0b1b963James Dong        MOV        srcStep0, #8
1130c1bc742181ded4930842b46e9507372f0b1b963James Dong
1140c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_END
1150c1bc742181ded4930842b46e9507372f0b1b963James Dong
1160c1bc742181ded4930842b46e9507372f0b1b963James Dong
1170c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Function header
1180c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_START armVCM4P10_InterpolateLuma_VerDiagCopy_unsafe, r6
1190c1bc742181ded4930842b46e9507372f0b1b963James Dong
1200c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Code start
1210c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDR         r0x0fe00fe0, =0x0fe00fe0
1220c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDR         r0x00ff00ff, =0x00ff00ff
1230c1bc742181ded4930842b46e9507372f0b1b963James Dong        MOV         Count, #2
1240c1bc742181ded4930842b46e9507372f0b1b963James Dong
1250c1bc742181ded4930842b46e9507372f0b1b963James DongLoopStart
1260c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDR         Temp4, [pSrc0, #12]
1270c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDR         Temp3, [pSrc0, #8]
1280c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDR         Temp2, [pSrc0, #4]
1290c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDR       Temp1, [pSrc0], srcStep0
1300c1bc742181ded4930842b46e9507372f0b1b963James Dong
1310c1bc742181ded4930842b46e9507372f0b1b963James Dong        UQSUB16     Temp4, Temp4, r0x0fe00fe0
1320c1bc742181ded4930842b46e9507372f0b1b963James Dong        UQSUB16     Temp3, Temp3, r0x0fe00fe0
1330c1bc742181ded4930842b46e9507372f0b1b963James Dong        UQSUB16     Temp2, Temp2, r0x0fe00fe0
1340c1bc742181ded4930842b46e9507372f0b1b963James Dong        UQSUB16     Temp1, Temp1, r0x0fe00fe0
1350c1bc742181ded4930842b46e9507372f0b1b963James Dong
1360c1bc742181ded4930842b46e9507372f0b1b963James Dong        USAT16      Temp4, #13, Temp4
1370c1bc742181ded4930842b46e9507372f0b1b963James Dong        USAT16      Temp3, #13, Temp3
1380c1bc742181ded4930842b46e9507372f0b1b963James Dong        USAT16      Temp2, #13, Temp2
1390c1bc742181ded4930842b46e9507372f0b1b963James Dong        USAT16      Temp1, #13, Temp1
1400c1bc742181ded4930842b46e9507372f0b1b963James Dong
1410c1bc742181ded4930842b46e9507372f0b1b963James Dong        AND         Temp4, r0x00ff00ff, Temp4, LSR #5
1420c1bc742181ded4930842b46e9507372f0b1b963James Dong        AND         Temp3, r0x00ff00ff, Temp3, LSR #5
1430c1bc742181ded4930842b46e9507372f0b1b963James Dong        AND         Temp2, r0x00ff00ff, Temp2, LSR #5
1440c1bc742181ded4930842b46e9507372f0b1b963James Dong        AND         Temp1, r0x00ff00ff, Temp1, LSR #5
1450c1bc742181ded4930842b46e9507372f0b1b963James Dong        ORR         ValueA1, Temp3, Temp4, LSL #8        ;// [d2 c2 d0 c0]
1460c1bc742181ded4930842b46e9507372f0b1b963James Dong        ORR         ValueA0, Temp1, Temp2, LSL #8        ;// [b2 a2 b0 a0]
1470c1bc742181ded4930842b46e9507372f0b1b963James Dong
1480c1bc742181ded4930842b46e9507372f0b1b963James Dong        PKHBT       Temp1, ValueA0, ValueA1, LSL #16     ;// [d0 c0 b0 a0]
1490c1bc742181ded4930842b46e9507372f0b1b963James Dong
1500c1bc742181ded4930842b46e9507372f0b1b963James Dong        STR         Temp1, [pBuf], #8
1510c1bc742181ded4930842b46e9507372f0b1b963James Dong        PKHTB       Temp2, ValueA1, ValueA0, ASR #16     ;// [d2 c2 b2 a2]
1520c1bc742181ded4930842b46e9507372f0b1b963James Dong        STR         Temp2, [pBuf], #-4
1530c1bc742181ded4930842b46e9507372f0b1b963James Dong
1540c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDR         Temp4, [pSrc0, #12]
1550c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDR         Temp3, [pSrc0, #8]
1560c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDR         Temp2, [pSrc0, #4]
1570c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDR       Temp1, [pSrc0], srcStep0
1580c1bc742181ded4930842b46e9507372f0b1b963James Dong
1590c1bc742181ded4930842b46e9507372f0b1b963James Dong        UQSUB16     Temp4, Temp4, r0x0fe00fe0
1600c1bc742181ded4930842b46e9507372f0b1b963James Dong        UQSUB16     Temp3, Temp3, r0x0fe00fe0
1610c1bc742181ded4930842b46e9507372f0b1b963James Dong        UQSUB16     Temp2, Temp2, r0x0fe00fe0
1620c1bc742181ded4930842b46e9507372f0b1b963James Dong        UQSUB16     Temp1, Temp1, r0x0fe00fe0
1630c1bc742181ded4930842b46e9507372f0b1b963James Dong
1640c1bc742181ded4930842b46e9507372f0b1b963James Dong        USAT16      Temp4, #13, Temp4
1650c1bc742181ded4930842b46e9507372f0b1b963James Dong        USAT16      Temp3, #13, Temp3
1660c1bc742181ded4930842b46e9507372f0b1b963James Dong        USAT16      Temp2, #13, Temp2
1670c1bc742181ded4930842b46e9507372f0b1b963James Dong        USAT16      Temp1, #13, Temp1
1680c1bc742181ded4930842b46e9507372f0b1b963James Dong
1690c1bc742181ded4930842b46e9507372f0b1b963James Dong        AND         Temp4, r0x00ff00ff, Temp4, LSR #5
1700c1bc742181ded4930842b46e9507372f0b1b963James Dong        AND         Temp3, r0x00ff00ff, Temp3, LSR #5
1710c1bc742181ded4930842b46e9507372f0b1b963James Dong        AND         Temp2, r0x00ff00ff, Temp2, LSR #5
1720c1bc742181ded4930842b46e9507372f0b1b963James Dong        AND         Temp1, r0x00ff00ff, Temp1, LSR #5
1730c1bc742181ded4930842b46e9507372f0b1b963James Dong        ORR         ValueA1, Temp3, Temp4, LSL #8        ;// [d2 c2 d0 c0]
1740c1bc742181ded4930842b46e9507372f0b1b963James Dong        ORR         ValueA0, Temp1, Temp2, LSL #8        ;// [b2 a2 b0 a0]
1750c1bc742181ded4930842b46e9507372f0b1b963James Dong
1760c1bc742181ded4930842b46e9507372f0b1b963James Dong        PKHBT       Temp1, ValueA0, ValueA1, LSL #16     ;// [d0 c0 b0 a0]
1770c1bc742181ded4930842b46e9507372f0b1b963James Dong        SUBS        Count, Count, #1
1780c1bc742181ded4930842b46e9507372f0b1b963James Dong        STR         Temp1, [pBuf], #8
1790c1bc742181ded4930842b46e9507372f0b1b963James Dong        PKHTB       Temp2, ValueA1, ValueA0, ASR #16     ;// [d2 c2 b2 a2]
1800c1bc742181ded4930842b46e9507372f0b1b963James Dong        STR         Temp2, [pBuf], #4
1810c1bc742181ded4930842b46e9507372f0b1b963James Dong
1820c1bc742181ded4930842b46e9507372f0b1b963James Dong        BGT         LoopStart
1830c1bc742181ded4930842b46e9507372f0b1b963James DongEnd2
1840c1bc742181ded4930842b46e9507372f0b1b963James Dong        SUB         pSrc0, pBuf, #32-8
1850c1bc742181ded4930842b46e9507372f0b1b963James Dong        MOV         srcStep0, #4
1860c1bc742181ded4930842b46e9507372f0b1b963James Dong
1870c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_END
1880c1bc742181ded4930842b46e9507372f0b1b963James Dong
1890c1bc742181ded4930842b46e9507372f0b1b963James Dong    ENDIF
1900c1bc742181ded4930842b46e9507372f0b1b963James Dong
1910c1bc742181ded4930842b46e9507372f0b1b963James Dong    END
19278e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar
193