10c1bc742181ded4930842b46e9507372f0b1b963James Dong;//
20c1bc742181ded4930842b46e9507372f0b1b963James Dong;//
30c1bc742181ded4930842b46e9507372f0b1b963James Dong;// File Name:  omxVCM4P10_FilterDeblockingLuma_VerEdge_I_s.s
40c1bc742181ded4930842b46e9507372f0b1b963James Dong;// OpenMAX DL: v1.0.2
50c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Revision:   9641
60c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Date:       Thursday, February 7, 2008
70c1bc742181ded4930842b46e9507372f0b1b963James Dong;//
80c1bc742181ded4930842b46e9507372f0b1b963James Dong;// (c) Copyright 2007-2008 ARM Limited. All Rights Reserved.
90c1bc742181ded4930842b46e9507372f0b1b963James Dong;//
100c1bc742181ded4930842b46e9507372f0b1b963James Dong;//
110c1bc742181ded4930842b46e9507372f0b1b963James Dong;//
120c1bc742181ded4930842b46e9507372f0b1b963James Dong
130c1bc742181ded4930842b46e9507372f0b1b963James Dong        INCLUDE omxtypes_s.h
140c1bc742181ded4930842b46e9507372f0b1b963James Dong        INCLUDE armCOMM_s.h
150c1bc742181ded4930842b46e9507372f0b1b963James Dong
160c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_VARIANTS ARM1136JS
170c1bc742181ded4930842b46e9507372f0b1b963James Dong
180c1bc742181ded4930842b46e9507372f0b1b963James Dong        IMPORT  armVCM4P10_DeblockingLumabSLT4_unsafe
190c1bc742181ded4930842b46e9507372f0b1b963James Dong        IMPORT  armVCM4P10_DeblockingLumabSGE4_unsafe
200c1bc742181ded4930842b46e9507372f0b1b963James Dong
210c1bc742181ded4930842b46e9507372f0b1b963James Dong
220c1bc742181ded4930842b46e9507372f0b1b963James Dong    IF ARM1136JS
230c1bc742181ded4930842b46e9507372f0b1b963James Dong
240c1bc742181ded4930842b46e9507372f0b1b963James DongMASK_0      EQU 0x00000000
250c1bc742181ded4930842b46e9507372f0b1b963James DongMASK_1      EQU 0x01010101
260c1bc742181ded4930842b46e9507372f0b1b963James DongMASK_2      EQU 0xff00ff00
270c1bc742181ded4930842b46e9507372f0b1b963James DongLOOP_COUNT  EQU 0x11110000
280c1bc742181ded4930842b46e9507372f0b1b963James Dong
290c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Declare input registers
300c1bc742181ded4930842b46e9507372f0b1b963James Dong
310c1bc742181ded4930842b46e9507372f0b1b963James DongpSrcDst     RN 0
320c1bc742181ded4930842b46e9507372f0b1b963James DongsrcdstStep  RN 1
330c1bc742181ded4930842b46e9507372f0b1b963James DongpAlphaArg   RN 2
340c1bc742181ded4930842b46e9507372f0b1b963James DongpBetaArg    RN 3
350c1bc742181ded4930842b46e9507372f0b1b963James Dong
360c1bc742181ded4930842b46e9507372f0b1b963James DongpThresholds RN 14
370c1bc742181ded4930842b46e9507372f0b1b963James DongpBS         RN 9
380c1bc742181ded4930842b46e9507372f0b1b963James DongpQ0         RN 0
390c1bc742181ded4930842b46e9507372f0b1b963James DongbS          RN 2
400c1bc742181ded4930842b46e9507372f0b1b963James Dong
410c1bc742181ded4930842b46e9507372f0b1b963James Dongalpha       RN 6
420c1bc742181ded4930842b46e9507372f0b1b963James Dongalpha0      RN 6
430c1bc742181ded4930842b46e9507372f0b1b963James Dongalpha1      RN 8
440c1bc742181ded4930842b46e9507372f0b1b963James Dong
450c1bc742181ded4930842b46e9507372f0b1b963James Dongbeta        RN 7
460c1bc742181ded4930842b46e9507372f0b1b963James Dongbeta0       RN 7
470c1bc742181ded4930842b46e9507372f0b1b963James Dongbeta1       RN 9
480c1bc742181ded4930842b46e9507372f0b1b963James Dong
490c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Declare Local/Temporary variables
500c1bc742181ded4930842b46e9507372f0b1b963James Dong
510c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Pixels
520c1bc742181ded4930842b46e9507372f0b1b963James Dongp_0         RN 3
530c1bc742181ded4930842b46e9507372f0b1b963James Dongp_1         RN 5
540c1bc742181ded4930842b46e9507372f0b1b963James Dongp_2         RN 4
550c1bc742181ded4930842b46e9507372f0b1b963James Dongp_3         RN 2
560c1bc742181ded4930842b46e9507372f0b1b963James Dongq_0         RN 8
570c1bc742181ded4930842b46e9507372f0b1b963James Dongq_1         RN 9
580c1bc742181ded4930842b46e9507372f0b1b963James Dongq_2         RN 10
590c1bc742181ded4930842b46e9507372f0b1b963James Dongq_3         RN 12
600c1bc742181ded4930842b46e9507372f0b1b963James Dong
610c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Unpacking
620c1bc742181ded4930842b46e9507372f0b1b963James Dongmask        RN 11
630c1bc742181ded4930842b46e9507372f0b1b963James Dong
640c1bc742181ded4930842b46e9507372f0b1b963James Dongrow0        RN 2
650c1bc742181ded4930842b46e9507372f0b1b963James Dongrow1        RN 4
660c1bc742181ded4930842b46e9507372f0b1b963James Dongrow2        RN 5
670c1bc742181ded4930842b46e9507372f0b1b963James Dongrow3        RN 3
680c1bc742181ded4930842b46e9507372f0b1b963James Dong
690c1bc742181ded4930842b46e9507372f0b1b963James Dongrow4        RN 8
700c1bc742181ded4930842b46e9507372f0b1b963James Dongrow5        RN 9
710c1bc742181ded4930842b46e9507372f0b1b963James Dongrow6        RN 10
720c1bc742181ded4930842b46e9507372f0b1b963James Dongrow7        RN 12
730c1bc742181ded4930842b46e9507372f0b1b963James Dongrow8        RN 14
740c1bc742181ded4930842b46e9507372f0b1b963James Dongrow9        RN 7
750c1bc742181ded4930842b46e9507372f0b1b963James Dong
760c1bc742181ded4930842b46e9507372f0b1b963James Dongtunpk0      RN 8
770c1bc742181ded4930842b46e9507372f0b1b963James Dongtunpk1      RN 9
780c1bc742181ded4930842b46e9507372f0b1b963James Dongtunpk2      RN 10
790c1bc742181ded4930842b46e9507372f0b1b963James Dongtunpk3      RN 12
800c1bc742181ded4930842b46e9507372f0b1b963James Dongtunpk4      RN 0
810c1bc742181ded4930842b46e9507372f0b1b963James Dong
820c1bc742181ded4930842b46e9507372f0b1b963James Dongtunpk5      RN 1
830c1bc742181ded4930842b46e9507372f0b1b963James Dongtunpk6      RN 14
840c1bc742181ded4930842b46e9507372f0b1b963James Dongtunpk7      RN 2
850c1bc742181ded4930842b46e9507372f0b1b963James Dongtunpk8      RN 5
860c1bc742181ded4930842b46e9507372f0b1b963James Dongtunpk9      RN 6
870c1bc742181ded4930842b46e9507372f0b1b963James Dong
880c1bc742181ded4930842b46e9507372f0b1b963James Dong
890c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Filtering
900c1bc742181ded4930842b46e9507372f0b1b963James Dong
910c1bc742181ded4930842b46e9507372f0b1b963James Dongdp0q0       RN 12
920c1bc742181ded4930842b46e9507372f0b1b963James Dongdp1p0       RN 12
930c1bc742181ded4930842b46e9507372f0b1b963James Dongdq1q0       RN 12
940c1bc742181ded4930842b46e9507372f0b1b963James Dongdp2p0       RN 12
950c1bc742181ded4930842b46e9507372f0b1b963James Dongdq2q0       RN 12
960c1bc742181ded4930842b46e9507372f0b1b963James Dong
970c1bc742181ded4930842b46e9507372f0b1b963James Dongap0q0       RN 1
980c1bc742181ded4930842b46e9507372f0b1b963James Dongfilt        RN 2
990c1bc742181ded4930842b46e9507372f0b1b963James Dong
1000c1bc742181ded4930842b46e9507372f0b1b963James Dongm00         RN 14
1010c1bc742181ded4930842b46e9507372f0b1b963James Dongm01         RN 11
1020c1bc742181ded4930842b46e9507372f0b1b963James Dong
1030c1bc742181ded4930842b46e9507372f0b1b963James Dongapflg       RN 0
1040c1bc742181ded4930842b46e9507372f0b1b963James Dongaqflg       RN 6
1050c1bc742181ded4930842b46e9507372f0b1b963James Dongapqflg      RN 0
1060c1bc742181ded4930842b46e9507372f0b1b963James Dong
1070c1bc742181ded4930842b46e9507372f0b1b963James Dong
1080c1bc742181ded4930842b46e9507372f0b1b963James Dong;//Declarations for bSLT4 kernel
1090c1bc742181ded4930842b46e9507372f0b1b963James Dong
1100c1bc742181ded4930842b46e9507372f0b1b963James DongtC0         RN 7
1110c1bc742181ded4930842b46e9507372f0b1b963James DongptC0        RN 1
1120c1bc742181ded4930842b46e9507372f0b1b963James Dong
1130c1bc742181ded4930842b46e9507372f0b1b963James DongpQ0a        RN 0
1140c1bc742181ded4930842b46e9507372f0b1b963James DongStepa       RN 1
1150c1bc742181ded4930842b46e9507372f0b1b963James Dongmaska       RN 14
1160c1bc742181ded4930842b46e9507372f0b1b963James Dong
1170c1bc742181ded4930842b46e9507372f0b1b963James DongP0a         RN 1
1180c1bc742181ded4930842b46e9507372f0b1b963James DongP1a         RN 8
1190c1bc742181ded4930842b46e9507372f0b1b963James DongQ0a         RN 7
1200c1bc742181ded4930842b46e9507372f0b1b963James DongQ1a         RN 11
1210c1bc742181ded4930842b46e9507372f0b1b963James Dong
1220c1bc742181ded4930842b46e9507372f0b1b963James Dong;//Declarations for bSGE4 kernel
1230c1bc742181ded4930842b46e9507372f0b1b963James Dong
1240c1bc742181ded4930842b46e9507372f0b1b963James DongpQ0b        RN 0
1250c1bc742181ded4930842b46e9507372f0b1b963James DongStepb       RN 1
1260c1bc742181ded4930842b46e9507372f0b1b963James Dongmaskb       RN 14
1270c1bc742181ded4930842b46e9507372f0b1b963James Dong
1280c1bc742181ded4930842b46e9507372f0b1b963James DongP0b         RN 6
1290c1bc742181ded4930842b46e9507372f0b1b963James DongP1b         RN 7
1300c1bc742181ded4930842b46e9507372f0b1b963James DongP2b         RN 1
1310c1bc742181ded4930842b46e9507372f0b1b963James DongP3b         RN 3
1320c1bc742181ded4930842b46e9507372f0b1b963James Dong
1330c1bc742181ded4930842b46e9507372f0b1b963James DongQ0b         RN 9
1340c1bc742181ded4930842b46e9507372f0b1b963James DongQ1b         RN 0
1350c1bc742181ded4930842b46e9507372f0b1b963James DongQ2b         RN 2
1360c1bc742181ded4930842b46e9507372f0b1b963James DongQ3b         RN 3
1370c1bc742181ded4930842b46e9507372f0b1b963James Dong
1380c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Miscellanous
1390c1bc742181ded4930842b46e9507372f0b1b963James DongXY          RN 8
1400c1bc742181ded4930842b46e9507372f0b1b963James Dongt0          RN 3
1410c1bc742181ded4930842b46e9507372f0b1b963James Dongt1          RN 12
1420c1bc742181ded4930842b46e9507372f0b1b963James Dongt2          RN 14
1430c1bc742181ded4930842b46e9507372f0b1b963James Dongt7          RN 7
1440c1bc742181ded4930842b46e9507372f0b1b963James Dongt4          RN 4
1450c1bc742181ded4930842b46e9507372f0b1b963James Dongt5          RN 1
1460c1bc742181ded4930842b46e9507372f0b1b963James Dongt8          RN 6
1470c1bc742181ded4930842b46e9507372f0b1b963James Donga           RN 0
1480c1bc742181ded4930842b46e9507372f0b1b963James Dong
1490c1bc742181ded4930842b46e9507372f0b1b963James Dong
1500c1bc742181ded4930842b46e9507372f0b1b963James Dong
1510c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Allocate stack memory
1520c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_ALLOC4 ppThresholds,4
1530c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_ALLOC4 pQ_3,4
1540c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_ALLOC4 pP_3,4
1550c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_ALLOC8 pAlphaBeta0,8
1560c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_ALLOC8 pAlphaBeta1,8
1570c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_ALLOC8 pXYBS,4
1580c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_ALLOC4 ppBS,4
1590c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_ALLOC8 ppQ0Step,4
1600c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_ALLOC4 pStep,4
1610c1bc742181ded4930842b46e9507372f0b1b963James Dong
1620c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Function header
1630c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_START omxVCM4P10_FilterDeblockingLuma_VerEdge_I, r11
1640c1bc742181ded4930842b46e9507372f0b1b963James Dong
1650c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;//Input arguments on the stack
1660c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_ARG   ppThresholdsArg, 4
1670c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_ARG   ppBSArg, 4
1680c1bc742181ded4930842b46e9507372f0b1b963James Dong
1690c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDR     t4,=MASK_1
1700c1bc742181ded4930842b46e9507372f0b1b963James Dong
1710c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDRB    alpha0, [pAlphaArg]
1720c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDRB    beta0,  [pBetaArg]
1730c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDRB    alpha1, [pAlphaArg,#1]
1740c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDRB    beta1,  [pBetaArg,#1]
1750c1bc742181ded4930842b46e9507372f0b1b963James Dong
1760c1bc742181ded4930842b46e9507372f0b1b963James Dong        MUL     alpha0, alpha0, t4
1770c1bc742181ded4930842b46e9507372f0b1b963James Dong        MUL     beta0, beta0, t4
1780c1bc742181ded4930842b46e9507372f0b1b963James Dong        MUL     alpha1, alpha1, t4
1790c1bc742181ded4930842b46e9507372f0b1b963James Dong        MUL     beta1, beta1, t4
1800c1bc742181ded4930842b46e9507372f0b1b963James Dong
1810c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STRD  alpha0, beta0, pAlphaBeta0
1820c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STRD  alpha1, beta1, pAlphaBeta1
1830c1bc742181ded4930842b46e9507372f0b1b963James Dong
1840c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDR     XY,=LOOP_COUNT
1850c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDR   pBS, ppBSArg
1860c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDR   pThresholds, ppThresholdsArg
1870c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STR   srcdstStep, pStep
1880c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STRD  XY, pBS, pXYBS
1890c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STR   pThresholds, ppThresholds
1900c1bc742181ded4930842b46e9507372f0b1b963James Dong
1910c1bc742181ded4930842b46e9507372f0b1b963James Dong        SUB     pQ0, pQ0, #4
1920c1bc742181ded4930842b46e9507372f0b1b963James DongLoopY
1930c1bc742181ded4930842b46e9507372f0b1b963James Dong;//---------------Load Pixels-------------------
1940c1bc742181ded4930842b46e9507372f0b1b963James Dong
1950c1bc742181ded4930842b46e9507372f0b1b963James Dong;//----------------Pack p0-p3-----------------------
1960c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDR     mask, =MASK_2
1970c1bc742181ded4930842b46e9507372f0b1b963James Dong
1980c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDR   row0, [pQ0], srcdstStep
1990c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDR   row1, [pQ0], srcdstStep
2000c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDR     row2, [pQ0]
2010c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDR     row3, [pQ0, srcdstStep]
2020c1bc742181ded4930842b46e9507372f0b1b963James Dong        SUB     pQ0, pQ0, srcdstStep, LSL #1
2030c1bc742181ded4930842b46e9507372f0b1b963James Dong
2040c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// row0 = [r0p0 r0p1 r0p2 r0p3]
2050c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// row1 = [r1p0 r1p1 r1p2 r1p3]
2060c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// row2 = [r2p0 r2p1 r2p2 r2p3]
2070c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// row3 = [r3p0 r3p1 r3p2 r3p3]
2080c1bc742181ded4930842b46e9507372f0b1b963James Dong
2090c1bc742181ded4930842b46e9507372f0b1b963James Dong        AND     tunpk0, mask, row0
2100c1bc742181ded4930842b46e9507372f0b1b963James Dong        AND     tunpk6, mask, row0, LSL#8
2110c1bc742181ded4930842b46e9507372f0b1b963James Dong        UXTAB16 tunpk0, tunpk0, row1, ROR#8
2120c1bc742181ded4930842b46e9507372f0b1b963James Dong        UXTAB16 tunpk6, tunpk6, row1
2130c1bc742181ded4930842b46e9507372f0b1b963James Dong        AND     tunpk2, mask, row2
2140c1bc742181ded4930842b46e9507372f0b1b963James Dong        AND     tunpk3, mask, row2, LSL#8
2150c1bc742181ded4930842b46e9507372f0b1b963James Dong        UXTAB16 tunpk2, tunpk2, row3, ROR#8
2160c1bc742181ded4930842b46e9507372f0b1b963James Dong        UXTAB16 tunpk3, tunpk3, row3
2170c1bc742181ded4930842b46e9507372f0b1b963James Dong
2180c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// tunpk0 = [r0p0 r1p0 r0p2 r1p2]
2190c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// tunpk6 = [r0p1 r1p1 r0p3 r1p3]
2200c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// tunpk2 = [r2p0 r3p0 r2p2 r3p2]
2210c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// tunpk3 = [r2p1 r3p1 r2p3 r3p3]
2220c1bc742181ded4930842b46e9507372f0b1b963James Dong
2230c1bc742181ded4930842b46e9507372f0b1b963James Dong        PKHTB   p_0, tunpk0, tunpk2, ASR#16
2240c1bc742181ded4930842b46e9507372f0b1b963James Dong        PKHTB   p_1, tunpk6, tunpk3, ASR#16
2250c1bc742181ded4930842b46e9507372f0b1b963James Dong        PKHBT   p_2, tunpk2, tunpk0, LSL#16
2260c1bc742181ded4930842b46e9507372f0b1b963James Dong        PKHBT   p_3, tunpk3, tunpk6, LSL#16
2270c1bc742181ded4930842b46e9507372f0b1b963James Dong
2280c1bc742181ded4930842b46e9507372f0b1b963James Dong
2290c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// p_0 = [r0p0 r1p0 r2p0 r3p0]
2300c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// p_1 = [r0p1 r1p1 r2p1 r3p1]
2310c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// p_2 = [r0p2 r1p2 r2p1 r3p2]
2320c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// p_3 = [r0p3 r1p3 r2p3 r3p3]
2330c1bc742181ded4930842b46e9507372f0b1b963James Dong
2340c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STR   p_3, pP_3
2350c1bc742181ded4930842b46e9507372f0b1b963James Dong
2360c1bc742181ded4930842b46e9507372f0b1b963James Dong;//----------------Pack q0-q3-----------------------
2370c1bc742181ded4930842b46e9507372f0b1b963James DongLoopX
2380c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDRB    bS, [pBS], #4
2390c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STR   pQ0, ppQ0Step
2400c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDR     mask, =MASK_2
2410c1bc742181ded4930842b46e9507372f0b1b963James Dong        CMP     bS, #0
2420c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STR   pBS, ppBS
2430c1bc742181ded4930842b46e9507372f0b1b963James Dong
2440c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDR     row4, [pQ0, #4]!
2450c1bc742181ded4930842b46e9507372f0b1b963James Dong        BEQ.W   NoFilterBS0
2460c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDR   row5, [pQ0, srcdstStep]!
2470c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDR   row6, [pQ0, srcdstStep]!
2480c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDR   row7, [pQ0, srcdstStep]
2490c1bc742181ded4930842b46e9507372f0b1b963James Dong
2500c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// row4 = [r0q3 r0q2 r0q1 r0q0]
2510c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// row5 = [r1q3 r1q2 r1q1 r1q0]
2520c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// row6 = [r2q3 r2q2 r2q1 r2q0]
2530c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// row7 = [r3q3 r3q2 r3q1 r3q0]
2540c1bc742181ded4930842b46e9507372f0b1b963James Dong
2550c1bc742181ded4930842b46e9507372f0b1b963James Dong        AND     tunpk4, mask, row4
2560c1bc742181ded4930842b46e9507372f0b1b963James Dong        CMP     bS, #4
2570c1bc742181ded4930842b46e9507372f0b1b963James Dong        AND     tunpk5, mask, row4, LSL#8
2580c1bc742181ded4930842b46e9507372f0b1b963James Dong        UXTAB16 tunpk4, tunpk4, row5, ROR#8
2590c1bc742181ded4930842b46e9507372f0b1b963James Dong        UXTAB16 tunpk5, tunpk5, row5
2600c1bc742181ded4930842b46e9507372f0b1b963James Dong        AND     tunpk6, mask, row6
2610c1bc742181ded4930842b46e9507372f0b1b963James Dong        AND     tunpk7, mask, row6, LSL#8
2620c1bc742181ded4930842b46e9507372f0b1b963James Dong        UXTAB16 tunpk6, tunpk6, row7, ROR#8
2630c1bc742181ded4930842b46e9507372f0b1b963James Dong        UXTAB16 tunpk7, tunpk7, row7
2640c1bc742181ded4930842b46e9507372f0b1b963James Dong
2650c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// tunpk4 = [r0q0 r1q0 r0q2 r1q2]
2660c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// tunpk5 = [r0q1 r1q1 r0q3 r1q3]
2670c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// tunpk6 = [r2q0 r3q0 r2q2 r3q2]
2680c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// tunpk7 = [r2q1 r3q1 r2q3 r3q3]
2690c1bc742181ded4930842b46e9507372f0b1b963James Dong
2700c1bc742181ded4930842b46e9507372f0b1b963James Dong        PKHTB   q_3, tunpk4, tunpk6, ASR#16
2710c1bc742181ded4930842b46e9507372f0b1b963James Dong        PKHTB   q_2, tunpk5, tunpk7, ASR#16
2720c1bc742181ded4930842b46e9507372f0b1b963James Dong        PKHBT   q_1, tunpk6, tunpk4, LSL#16
2730c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STR   q_3, pQ_3
2740c1bc742181ded4930842b46e9507372f0b1b963James Dong        PKHBT   q_0, tunpk7, tunpk5, LSL#16
2750c1bc742181ded4930842b46e9507372f0b1b963James Dong
2760c1bc742181ded4930842b46e9507372f0b1b963James Dong
2770c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// q_0 = [r0q0 r1q0 r2q0 r3q0]
2780c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// q_1 = [r0q1 r1q1 r2q1 r3q1]
2790c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// q_2 = [r0q2 r1q2 r2q1 r3q2]
2800c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// q_3 = [r0q3 r1q3 r2q3 r3q3]
2810c1bc742181ded4930842b46e9507372f0b1b963James Dong
2820c1bc742181ded4930842b46e9507372f0b1b963James Dong
2830c1bc742181ded4930842b46e9507372f0b1b963James Dong;//--------------Filtering Decision -------------------
2840c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDR     m01, =MASK_1                ;//  01010101 mask
2850c1bc742181ded4930842b46e9507372f0b1b963James Dong        MOV     m00, #MASK_0                ;//  00000000 mask
2860c1bc742181ded4930842b46e9507372f0b1b963James Dong
2870c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Check |p0-q0|<Alpha
2880c1bc742181ded4930842b46e9507372f0b1b963James Dong        USUB8   dp0q0, p_0, q_0
2890c1bc742181ded4930842b46e9507372f0b1b963James Dong        USUB8   a, q_0, p_0
2900c1bc742181ded4930842b46e9507372f0b1b963James Dong        SEL     ap0q0, a, dp0q0
2910c1bc742181ded4930842b46e9507372f0b1b963James Dong        USUB8   a, ap0q0, alpha
2920c1bc742181ded4930842b46e9507372f0b1b963James Dong        SEL     filt, m00, m01
2930c1bc742181ded4930842b46e9507372f0b1b963James Dong
2940c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Check |p1-p0|<Beta
2950c1bc742181ded4930842b46e9507372f0b1b963James Dong        USUB8   dp1p0, p_1, p_0
2960c1bc742181ded4930842b46e9507372f0b1b963James Dong        USUB8   a, p_0, p_1
2970c1bc742181ded4930842b46e9507372f0b1b963James Dong        SEL     a, a, dp1p0
2980c1bc742181ded4930842b46e9507372f0b1b963James Dong        USUB8   a, a, beta
2990c1bc742181ded4930842b46e9507372f0b1b963James Dong        SEL     filt, m00, filt
3000c1bc742181ded4930842b46e9507372f0b1b963James Dong
3010c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Check |q1-q0|<Beta
3020c1bc742181ded4930842b46e9507372f0b1b963James Dong        USUB8   dq1q0, q_1, q_0
3030c1bc742181ded4930842b46e9507372f0b1b963James Dong        USUB8   a, q_0, q_1
3040c1bc742181ded4930842b46e9507372f0b1b963James Dong        SEL     a, a, dq1q0
3050c1bc742181ded4930842b46e9507372f0b1b963James Dong        USUB8   a, a, beta
3060c1bc742181ded4930842b46e9507372f0b1b963James Dong        SEL     filt, m00, filt
3070c1bc742181ded4930842b46e9507372f0b1b963James Dong
3080c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Check ap<Beta
3090c1bc742181ded4930842b46e9507372f0b1b963James Dong        USUB8   dp2p0, p_2, p_0
3100c1bc742181ded4930842b46e9507372f0b1b963James Dong        USUB8   a, p_0, p_2
3110c1bc742181ded4930842b46e9507372f0b1b963James Dong        SEL     a, a, dp2p0
3120c1bc742181ded4930842b46e9507372f0b1b963James Dong        USUB8   a, a, beta
3130c1bc742181ded4930842b46e9507372f0b1b963James Dong        SEL     apflg, m00, filt            ;// apflg = filt && (ap<beta)
3140c1bc742181ded4930842b46e9507372f0b1b963James Dong
3150c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Check aq<Beta
3160c1bc742181ded4930842b46e9507372f0b1b963James Dong        USUB8   dq2q0, q_2, q_0
3170c1bc742181ded4930842b46e9507372f0b1b963James Dong        USUB8   t2, q_0, q_2
3180c1bc742181ded4930842b46e9507372f0b1b963James Dong        SEL     t2, t2, dq2q0
3190c1bc742181ded4930842b46e9507372f0b1b963James Dong        USUB8   t2, t2, beta
3200c1bc742181ded4930842b46e9507372f0b1b963James Dong        MOV     t7,#0
3210c1bc742181ded4930842b46e9507372f0b1b963James Dong
3220c1bc742181ded4930842b46e9507372f0b1b963James Dong
3230c1bc742181ded4930842b46e9507372f0b1b963James Dong        BLT     bSLT4
3240c1bc742181ded4930842b46e9507372f0b1b963James Dong;//-------------------Filter--------------------
3250c1bc742181ded4930842b46e9507372f0b1b963James DongbSGE4
3260c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;//---------bSGE4 Execution---------------
3270c1bc742181ded4930842b46e9507372f0b1b963James Dong        SEL     t1, t7, filt            ;// aqflg = filt && (aq<beta)
3280c1bc742181ded4930842b46e9507372f0b1b963James Dong        CMP     filt, #0
3290c1bc742181ded4930842b46e9507372f0b1b963James Dong        ORR     apqflg, apflg, t1, LSL #1
3300c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDRD  pQ0, srcdstStep, ppQ0Step, EQ
3310c1bc742181ded4930842b46e9507372f0b1b963James Dong        BEQ     NoFilterFilt0
3320c1bc742181ded4930842b46e9507372f0b1b963James Dong
3330c1bc742181ded4930842b46e9507372f0b1b963James Dong        BL      armVCM4P10_DeblockingLumabSGE4_unsafe
3340c1bc742181ded4930842b46e9507372f0b1b963James Dong
3350c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;//---------Store result---------------
3360c1bc742181ded4930842b46e9507372f0b1b963James Dong
3370c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDR     maskb,=MASK_2
3380c1bc742181ded4930842b46e9507372f0b1b963James Dong
3390c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// P0b = [r0p0 r1p0 r2p0 r3p0]
3400c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// P1b = [r0p1 r1p1 r2p1 r3p1]
3410c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// P2b = [r0p2 r1p2 r2p2 r3p2]
3420c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// P3b = [r0p3 r1p3 r2p3 r3p3]
3430c1bc742181ded4930842b46e9507372f0b1b963James Dong
3440c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDR   P3b, pP_3
3450c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STR   Q0b, pP_3
3460c1bc742181ded4930842b46e9507372f0b1b963James Dong
3470c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;//------Pack p0-p3------
3480c1bc742181ded4930842b46e9507372f0b1b963James Dong        AND     tunpk0, maskb, P0b
3490c1bc742181ded4930842b46e9507372f0b1b963James Dong        AND     tunpk2, maskb, P0b, LSL#8
3500c1bc742181ded4930842b46e9507372f0b1b963James Dong        UXTAB16 tunpk0, tunpk0, P1b, ROR#8
3510c1bc742181ded4930842b46e9507372f0b1b963James Dong        UXTAB16 tunpk2, tunpk2, P1b
3520c1bc742181ded4930842b46e9507372f0b1b963James Dong
3530c1bc742181ded4930842b46e9507372f0b1b963James Dong        AND     tunpk3, maskb, P2b
3540c1bc742181ded4930842b46e9507372f0b1b963James Dong        AND     tunpk8, maskb, P2b, LSL#8
3550c1bc742181ded4930842b46e9507372f0b1b963James Dong        UXTAB16 tunpk3, tunpk3, P3b, ROR#8
3560c1bc742181ded4930842b46e9507372f0b1b963James Dong        UXTAB16 tunpk8, tunpk8, P3b
3570c1bc742181ded4930842b46e9507372f0b1b963James Dong
3580c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// tunpk0 = [r0p0 r0p1 r2p0 r2p1]
3590c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// tunpk2 = [r1p0 r1p1 r3p0 r3p1]
3600c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// tunpk3 = [r0p2 r0p3 r2p2 r2p3]
3610c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// tunpk8 = [r1p2 r1p3 r3p2 r3p3]
3620c1bc742181ded4930842b46e9507372f0b1b963James Dong
3630c1bc742181ded4930842b46e9507372f0b1b963James Dong        MOV     p_2, Q1b
3640c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDRD  pQ0b, Stepb, ppQ0Step
3650c1bc742181ded4930842b46e9507372f0b1b963James Dong
3660c1bc742181ded4930842b46e9507372f0b1b963James Dong        PKHTB   row9, tunpk0, tunpk3, ASR#16
3670c1bc742181ded4930842b46e9507372f0b1b963James Dong        PKHBT   row7, tunpk3, tunpk0, LSL#16
3680c1bc742181ded4930842b46e9507372f0b1b963James Dong        PKHTB   row3, tunpk2, tunpk8, ASR#16
3690c1bc742181ded4930842b46e9507372f0b1b963James Dong        PKHBT   row6, tunpk8, tunpk2, LSL#16
3700c1bc742181ded4930842b46e9507372f0b1b963James Dong
3710c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// row9 = [r0p0 r0p1 r0p2 r0p3]
3720c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// row3 = [r1p0 r1p1 r1p2 r1p3]
3730c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// row7 = [r2p0 r2p1 r2p2 r2p3]
3740c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// row6 = [r3p0 r3p1 r3p2 r3p3]
3750c1bc742181ded4930842b46e9507372f0b1b963James Dong
3760c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STR   row9, [pQ0b], Stepb
3770c1bc742181ded4930842b46e9507372f0b1b963James Dong        STR     row7, [pQ0b, Stepb]
3780c1bc742181ded4930842b46e9507372f0b1b963James Dong        STR     row6, [pQ0b, Stepb, LSL #1]
3790c1bc742181ded4930842b46e9507372f0b1b963James Dong        STR     row3, [pQ0b], #4
3800c1bc742181ded4930842b46e9507372f0b1b963James Dong
3810c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDR   Q3b, pQ_3
3820c1bc742181ded4930842b46e9507372f0b1b963James Dong
3830c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Q0b = [r0q0 r1q0 r2q0 r3q0]
3840c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Q1b = [r0q1 r1q1 r2q1 r3q1]
3850c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Q2b = [r0q2 r1q2 r2q2 r3q2]
3860c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Q3b = [r0q3 r1q3 r2q3 r3q3]
3870c1bc742181ded4930842b46e9507372f0b1b963James Dong
3880c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;//------Pack q0-q3------
3890c1bc742181ded4930842b46e9507372f0b1b963James Dong        AND     tunpk0, maskb, p_2
3900c1bc742181ded4930842b46e9507372f0b1b963James Dong        AND     tunpk2, maskb, p_2, LSL#8
3910c1bc742181ded4930842b46e9507372f0b1b963James Dong        UXTAB16 tunpk0, tunpk0, Q0b, ROR#8
3920c1bc742181ded4930842b46e9507372f0b1b963James Dong        UXTAB16 tunpk2, tunpk2, Q0b
3930c1bc742181ded4930842b46e9507372f0b1b963James Dong
3940c1bc742181ded4930842b46e9507372f0b1b963James Dong        AND     tunpk3, maskb, Q3b
3950c1bc742181ded4930842b46e9507372f0b1b963James Dong        AND     tunpk8, maskb, Q3b, LSL#8
3960c1bc742181ded4930842b46e9507372f0b1b963James Dong        UXTAB16 tunpk3, tunpk3, Q2b, ROR#8
3970c1bc742181ded4930842b46e9507372f0b1b963James Dong        UXTAB16 tunpk8, tunpk8, Q2b
3980c1bc742181ded4930842b46e9507372f0b1b963James Dong
3990c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// tunpk0 = [r0q1 r0q0 r2q1 r2q0]
4000c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// tunpk2 = [r1q1 r1q0 r3q1 r3q0]
4010c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// tunpk3 = [r0q3 r0q2 r2q3 r2q2]
4020c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// tunpk8 = [r1q3 r1q2 r3q3 r3q2]
4030c1bc742181ded4930842b46e9507372f0b1b963James Dong
4040c1bc742181ded4930842b46e9507372f0b1b963James Dong        PKHTB   row8, tunpk3, tunpk0, ASR#16
4050c1bc742181ded4930842b46e9507372f0b1b963James Dong        PKHBT   row7, tunpk0, tunpk3, LSL#16
4060c1bc742181ded4930842b46e9507372f0b1b963James Dong        PKHTB   row4, tunpk8, tunpk2, ASR#16
4070c1bc742181ded4930842b46e9507372f0b1b963James Dong        PKHBT   row6, tunpk2, tunpk8, LSL#16
4080c1bc742181ded4930842b46e9507372f0b1b963James Dong
4090c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// row8 = [r0q0 r0q1 r0q2 r0q3]
4100c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// row4 = [r1q0 r1q1 r1q2 r1q3]
4110c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// row7 = [r2q0 r2q1 r2q2 r2q3]
4120c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// row6 = [r3q0 r3q1 r3q2 r3q3]
4130c1bc742181ded4930842b46e9507372f0b1b963James Dong
4140c1bc742181ded4930842b46e9507372f0b1b963James Dong        STR     row4, [pQ0b]
4150c1bc742181ded4930842b46e9507372f0b1b963James Dong        STR     row7, [pQ0b, Stepb]
4160c1bc742181ded4930842b46e9507372f0b1b963James Dong        STR     row6, [pQ0b, Stepb, LSL #1]
4170c1bc742181ded4930842b46e9507372f0b1b963James Dong
4180c1bc742181ded4930842b46e9507372f0b1b963James Dong        SUB     pQ0, pQ0b, Stepb
4190c1bc742181ded4930842b46e9507372f0b1b963James Dong        MOV     p_1, Q2b
4200c1bc742181ded4930842b46e9507372f0b1b963James Dong
4210c1bc742181ded4930842b46e9507372f0b1b963James Dong        STR     row8, [pQ0]
4220c1bc742181ded4930842b46e9507372f0b1b963James Dong
4230c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDRD  XY, pBS, pXYBS
4240c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDR   pThresholds, ppThresholds
4250c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDRD  alpha, beta, pAlphaBeta1
4260c1bc742181ded4930842b46e9507372f0b1b963James Dong
4270c1bc742181ded4930842b46e9507372f0b1b963James Dong        ADDS    XY, XY, XY
4280c1bc742181ded4930842b46e9507372f0b1b963James Dong        ADD     pThresholds, #4
4290c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STR   pThresholds, ppThresholds
4300c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STR   XY, pXYBS
4310c1bc742181ded4930842b46e9507372f0b1b963James Dong        BCC     LoopX
4320c1bc742181ded4930842b46e9507372f0b1b963James Dong        B       ExitLoopY
4330c1bc742181ded4930842b46e9507372f0b1b963James Dong
4340c1bc742181ded4930842b46e9507372f0b1b963James Dong;//---------- Exit of LoopX --------------
4350c1bc742181ded4930842b46e9507372f0b1b963James Dong;//---- for the case of no filtering -----
4360c1bc742181ded4930842b46e9507372f0b1b963James Dong
4370c1bc742181ded4930842b46e9507372f0b1b963James DongNoFilterFilt0
4380c1bc742181ded4930842b46e9507372f0b1b963James Dong        ADD     pQ0, pQ0, #4
4390c1bc742181ded4930842b46e9507372f0b1b963James DongNoFilterBS0
4400c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Load counter for LoopX
4410c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDRD  XY, pBS, pXYBS
4420c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDR   pThresholds, ppThresholds
4430c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDRD  alpha, beta, pAlphaBeta1
4440c1bc742181ded4930842b46e9507372f0b1b963James Dong
4450c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Align the pointer
4460c1bc742181ded4930842b46e9507372f0b1b963James Dong        ADDS    XY, XY, XY
4470c1bc742181ded4930842b46e9507372f0b1b963James Dong        ADD     pThresholds, pThresholds, #4
4480c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STR   pThresholds, ppThresholds
4490c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STR   XY, pXYBS
4500c1bc742181ded4930842b46e9507372f0b1b963James Dong        BCC     LoopY
4510c1bc742181ded4930842b46e9507372f0b1b963James Dong        B       ExitLoopY
4520c1bc742181ded4930842b46e9507372f0b1b963James Dong
4530c1bc742181ded4930842b46e9507372f0b1b963James DongbSLT4
4540c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;//---------bSLT4 Execution---------------
4550c1bc742181ded4930842b46e9507372f0b1b963James Dong        SEL     aqflg, t7, filt            ;// aqflg = filt && (aq<beta)
4560c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDR   ptC0, ppThresholds
4570c1bc742181ded4930842b46e9507372f0b1b963James Dong        CMP     filt, #0
4580c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDRD  pQ0, srcdstStep, ppQ0Step, EQ
4590c1bc742181ded4930842b46e9507372f0b1b963James Dong        BEQ     NoFilterFilt0
4600c1bc742181ded4930842b46e9507372f0b1b963James Dong
4610c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDRB    tC0, [ptC0], #4
4620c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STR   ptC0, ppThresholds
4630c1bc742181ded4930842b46e9507372f0b1b963James Dong
4640c1bc742181ded4930842b46e9507372f0b1b963James Dong        BL      armVCM4P10_DeblockingLumabSLT4_unsafe
4650c1bc742181ded4930842b46e9507372f0b1b963James Dong
4660c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;//---------Store result---------------
4670c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;//--------Pack p1,p0,q1,q0------------
4680c1bc742181ded4930842b46e9507372f0b1b963James Dong
4690c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;//Load destination pointer
4700c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDR     maska,=MASK_2
4710c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STR   Q0a, pP_3
4720c1bc742181ded4930842b46e9507372f0b1b963James Dong        MOV     p_1, q_2
4730c1bc742181ded4930842b46e9507372f0b1b963James Dong
4740c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// P1a = [r0p1 r1p1 r2p1 r3p1]
4750c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// P0a = [r0p0 r1p0 r2p0 r3p0]
4760c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Q0a = [r0q0 r1q0 r2q0 r3q0]
4770c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Q1a = [r0q1 r1q1 r2q1 r3q1]
4780c1bc742181ded4930842b46e9507372f0b1b963James Dong
4790c1bc742181ded4930842b46e9507372f0b1b963James Dong        AND     tunpk1, maska, P0a
4800c1bc742181ded4930842b46e9507372f0b1b963James Dong        AND     tunpk2, maska, P0a, LSL#8
4810c1bc742181ded4930842b46e9507372f0b1b963James Dong        UXTAB16 tunpk1, tunpk1, P1a, ROR#8
4820c1bc742181ded4930842b46e9507372f0b1b963James Dong        UXTAB16 tunpk2, tunpk2, P1a
4830c1bc742181ded4930842b46e9507372f0b1b963James Dong
4840c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDRD  pQ0a, Stepa, ppQ0Step
4850c1bc742181ded4930842b46e9507372f0b1b963James Dong
4860c1bc742181ded4930842b46e9507372f0b1b963James Dong        AND     tunpk9, maska, Q1a
4870c1bc742181ded4930842b46e9507372f0b1b963James Dong        AND     tunpk3, maska, Q1a, LSL#8
4880c1bc742181ded4930842b46e9507372f0b1b963James Dong        UXTAB16 tunpk9, tunpk9, Q0a, ROR#8
4890c1bc742181ded4930842b46e9507372f0b1b963James Dong        UXTAB16 tunpk3, tunpk3, Q0a
4900c1bc742181ded4930842b46e9507372f0b1b963James Dong
4910c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// tunpk1 = [r0p0 r0p1 r2p0 r2p1]
4920c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// tunpk2 = [r1p0 r1p1 r3p0 r3p1]
4930c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// tunpk9 = [r0q1 r0q0 r2q1 r2q0]
4940c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// tunpk3 = [r1q1 r1q0 r3q1 r3q0]
4950c1bc742181ded4930842b46e9507372f0b1b963James Dong
4960c1bc742181ded4930842b46e9507372f0b1b963James Dong        MOV     t4, tunpk1, LSR #16
4970c1bc742181ded4930842b46e9507372f0b1b963James Dong        MOV     t0, tunpk9, LSR #16
4980c1bc742181ded4930842b46e9507372f0b1b963James Dong
4990c1bc742181ded4930842b46e9507372f0b1b963James Dong        STRH    t4,[pQ0a, #2]!          ;//Stores [r0p0 r0p1]
5000c1bc742181ded4930842b46e9507372f0b1b963James Dong        STRH    t0,[pQ0a, #2]           ;//Stores [r0q0 r0q1]
5010c1bc742181ded4930842b46e9507372f0b1b963James Dong
5020c1bc742181ded4930842b46e9507372f0b1b963James Dong        MOV     t4, tunpk2, LSR #16
5030c1bc742181ded4930842b46e9507372f0b1b963James Dong        MOV     t0, tunpk3, LSR #16
5040c1bc742181ded4930842b46e9507372f0b1b963James Dong
5050c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STRH  t4,[pQ0a, Stepa]!       ;//Stores [r1p0 r1p1]
5060c1bc742181ded4930842b46e9507372f0b1b963James Dong        STRH    t0,[pQ0a, #2]           ;//Stores [r1q0 r1q1]
5070c1bc742181ded4930842b46e9507372f0b1b963James Dong
5080c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STRH  tunpk1,[pQ0a, Stepa]!   ;//Stores [r2p0 r2p1]
5090c1bc742181ded4930842b46e9507372f0b1b963James Dong        STRH    tunpk2,[pQ0a, Stepa]    ;//Stores [r3p0 r3p1]
5100c1bc742181ded4930842b46e9507372f0b1b963James Dong        STRH    tunpk9,[pQ0a, #2]!        ;//Stores [r2q0 r2q1]
5110c1bc742181ded4930842b46e9507372f0b1b963James Dong        STRH    tunpk3,[pQ0a, Stepa]    ;//Stores [r3q0 r3q1]
5120c1bc742181ded4930842b46e9507372f0b1b963James Dong
5130c1bc742181ded4930842b46e9507372f0b1b963James Dong        SUB     pQ0, pQ0a, Stepa, LSL #1
5140c1bc742181ded4930842b46e9507372f0b1b963James Dong
5150c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Load counter
5160c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDRD  XY, pBS, pXYBS
5170c1bc742181ded4930842b46e9507372f0b1b963James Dong
5180c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Reload Pixels
5190c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDR   p_0, pQ_3
5200c1bc742181ded4930842b46e9507372f0b1b963James Dong        MOV     p_2, Q1a
5210c1bc742181ded4930842b46e9507372f0b1b963James Dong
5220c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDRD  alpha, beta, pAlphaBeta1
5230c1bc742181ded4930842b46e9507372f0b1b963James Dong
5240c1bc742181ded4930842b46e9507372f0b1b963James Dong        ADDS    XY, XY, XY
5250c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STR   XY, pXYBS
5260c1bc742181ded4930842b46e9507372f0b1b963James Dong        BCC     LoopX
5270c1bc742181ded4930842b46e9507372f0b1b963James Dong
5280c1bc742181ded4930842b46e9507372f0b1b963James Dong;//-------- Common Exit of LoopY -----------------
5290c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Align the pointers
5300c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDR   pThresholds, ppThresholds
5310c1bc742181ded4930842b46e9507372f0b1b963James DongExitLoopY
5320c1bc742181ded4930842b46e9507372f0b1b963James Dong        SUB     pQ0, pQ0, #16
5330c1bc742181ded4930842b46e9507372f0b1b963James Dong        ADD     pQ0, pQ0, srcdstStep, LSL #2
5340c1bc742181ded4930842b46e9507372f0b1b963James Dong        SUB     pBS, pBS, #15
5350c1bc742181ded4930842b46e9507372f0b1b963James Dong        SUB     pThresholds, pThresholds, #15
5360c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STR   pThresholds, ppThresholds
5370c1bc742181ded4930842b46e9507372f0b1b963James Dong
5380c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDRD  alpha, beta, pAlphaBeta0
5390c1bc742181ded4930842b46e9507372f0b1b963James Dong
5400c1bc742181ded4930842b46e9507372f0b1b963James Dong        BNE     LoopY
5410c1bc742181ded4930842b46e9507372f0b1b963James Dong        MOV     r0, #OMX_Sts_NoErr
5420c1bc742181ded4930842b46e9507372f0b1b963James Dong
5430c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_END
5440c1bc742181ded4930842b46e9507372f0b1b963James Dong;//-----------------End Filter--------------------
5450c1bc742181ded4930842b46e9507372f0b1b963James Dong
5460c1bc742181ded4930842b46e9507372f0b1b963James Dong    ENDIF
5470c1bc742181ded4930842b46e9507372f0b1b963James Dong
5480c1bc742181ded4930842b46e9507372f0b1b963James Dong        END
5490c1bc742181ded4930842b46e9507372f0b1b963James Dong
5500c1bc742181ded4930842b46e9507372f0b1b963James Dong