10c1bc742181ded4930842b46e9507372f0b1b963James Dong;//
20c1bc742181ded4930842b46e9507372f0b1b963James Dong;//
30c1bc742181ded4930842b46e9507372f0b1b963James Dong;// File Name:  omxVCM4P10_FilterDeblockingChroma_HorEdge_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
140c1bc742181ded4930842b46e9507372f0b1b963James Dong        INCLUDE omxtypes_s.h
150c1bc742181ded4930842b46e9507372f0b1b963James Dong        INCLUDE armCOMM_s.h
160c1bc742181ded4930842b46e9507372f0b1b963James Dong
170c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_VARIANTS ARM1136JS
180c1bc742181ded4930842b46e9507372f0b1b963James Dong
190c1bc742181ded4930842b46e9507372f0b1b963James Dong
200c1bc742181ded4930842b46e9507372f0b1b963James Dong        IF ARM1136JS
210c1bc742181ded4930842b46e9507372f0b1b963James Dong
220c1bc742181ded4930842b46e9507372f0b1b963James DongMASK_0      EQU 0x00000000
230c1bc742181ded4930842b46e9507372f0b1b963James DongMASK_1      EQU 0x01010101
240c1bc742181ded4930842b46e9507372f0b1b963James DongLOOP_COUNT  EQU 0x50000000
250c1bc742181ded4930842b46e9507372f0b1b963James Dong
260c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Declare input registers
270c1bc742181ded4930842b46e9507372f0b1b963James Dong
280c1bc742181ded4930842b46e9507372f0b1b963James DongpSrcDst     RN 0
290c1bc742181ded4930842b46e9507372f0b1b963James DongsrcdstStep  RN 1
300c1bc742181ded4930842b46e9507372f0b1b963James DongpAlphaArg   RN 2
310c1bc742181ded4930842b46e9507372f0b1b963James DongpBetaArg    RN 3
320c1bc742181ded4930842b46e9507372f0b1b963James Dong
330c1bc742181ded4930842b46e9507372f0b1b963James DongpThresholds RN 6
340c1bc742181ded4930842b46e9507372f0b1b963James DongpBS         RN 9
350c1bc742181ded4930842b46e9507372f0b1b963James DongpQ0         RN 0
360c1bc742181ded4930842b46e9507372f0b1b963James DongbS          RN 10
370c1bc742181ded4930842b46e9507372f0b1b963James Dong
380c1bc742181ded4930842b46e9507372f0b1b963James Dongalpha       RN 6
390c1bc742181ded4930842b46e9507372f0b1b963James Dongalpha0      RN 6
400c1bc742181ded4930842b46e9507372f0b1b963James Dongalpha1      RN 8
410c1bc742181ded4930842b46e9507372f0b1b963James Dong
420c1bc742181ded4930842b46e9507372f0b1b963James Dongbeta        RN 7
430c1bc742181ded4930842b46e9507372f0b1b963James Dongbeta0       RN 7
440c1bc742181ded4930842b46e9507372f0b1b963James Dongbeta1       RN 9
450c1bc742181ded4930842b46e9507372f0b1b963James Dong
460c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Declare Local/Temporary variables
470c1bc742181ded4930842b46e9507372f0b1b963James Dong
480c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Pixels
490c1bc742181ded4930842b46e9507372f0b1b963James Dongp_0         RN 3
500c1bc742181ded4930842b46e9507372f0b1b963James Dongp_1         RN 5
510c1bc742181ded4930842b46e9507372f0b1b963James Dongq_0         RN 8
520c1bc742181ded4930842b46e9507372f0b1b963James Dongq_1         RN 9
530c1bc742181ded4930842b46e9507372f0b1b963James Dong
540c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Filtering
550c1bc742181ded4930842b46e9507372f0b1b963James Dong
560c1bc742181ded4930842b46e9507372f0b1b963James Dongdp0q0       RN 12
570c1bc742181ded4930842b46e9507372f0b1b963James Dongdp1p0       RN 12
580c1bc742181ded4930842b46e9507372f0b1b963James Dongdq1q0       RN 12
590c1bc742181ded4930842b46e9507372f0b1b963James Dong
600c1bc742181ded4930842b46e9507372f0b1b963James Dongap0q0       RN 4
610c1bc742181ded4930842b46e9507372f0b1b963James Dongfilt        RN 2
620c1bc742181ded4930842b46e9507372f0b1b963James Dong
630c1bc742181ded4930842b46e9507372f0b1b963James Dongm00         RN 14
640c1bc742181ded4930842b46e9507372f0b1b963James Dongm01         RN 11
650c1bc742181ded4930842b46e9507372f0b1b963James Dong
660c1bc742181ded4930842b46e9507372f0b1b963James DongpQ0         RN 0
670c1bc742181ded4930842b46e9507372f0b1b963James DongStep        RN 1
680c1bc742181ded4930842b46e9507372f0b1b963James Dong
690c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Output
700c1bc742181ded4930842b46e9507372f0b1b963James Dong
710c1bc742181ded4930842b46e9507372f0b1b963James DongP_0         RN 6
720c1bc742181ded4930842b46e9507372f0b1b963James DongQ_0         RN 7
730c1bc742181ded4930842b46e9507372f0b1b963James Dong
740c1bc742181ded4930842b46e9507372f0b1b963James Dong;//Declarations for bSLT4 kernel
750c1bc742181ded4930842b46e9507372f0b1b963James Dong
760c1bc742181ded4930842b46e9507372f0b1b963James DongtC          RN 12
770c1bc742181ded4930842b46e9507372f0b1b963James DongtC0         RN 5
780c1bc742181ded4930842b46e9507372f0b1b963James DongtC1         RN 12
790c1bc742181ded4930842b46e9507372f0b1b963James Dongpos         RN 5
800c1bc742181ded4930842b46e9507372f0b1b963James Dongneg         RN 9
810c1bc742181ded4930842b46e9507372f0b1b963James Dong
820c1bc742181ded4930842b46e9507372f0b1b963James Dong;//Declarations for bSGE4 kernel
830c1bc742181ded4930842b46e9507372f0b1b963James Dong
840c1bc742181ded4930842b46e9507372f0b1b963James Dong
850c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Miscellanous
860c1bc742181ded4930842b46e9507372f0b1b963James DongXY          RN 8
870c1bc742181ded4930842b46e9507372f0b1b963James Dong
880c1bc742181ded4930842b46e9507372f0b1b963James Donga           RN 10
890c1bc742181ded4930842b46e9507372f0b1b963James Dongt1          RN 10
900c1bc742181ded4930842b46e9507372f0b1b963James Dongt2          RN 12
910c1bc742181ded4930842b46e9507372f0b1b963James Dongt3          RN 14
920c1bc742181ded4930842b46e9507372f0b1b963James Dongt4          RN 6
930c1bc742181ded4930842b46e9507372f0b1b963James Dongt5          RN 5
940c1bc742181ded4930842b46e9507372f0b1b963James Dong
950c1bc742181ded4930842b46e9507372f0b1b963James Dong
960c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Allocate stack memory
970c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_ALLOC4 ppThresholds,4
980c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_ALLOC8 pAlphaBeta0,8
990c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_ALLOC8 pAlphaBeta1,8
1000c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_ALLOC8 pXYBS,4
1010c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_ALLOC4 ppBS,4
1020c1bc742181ded4930842b46e9507372f0b1b963James Dong
1030c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Function header
1040c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_START omxVCM4P10_FilterDeblockingChroma_HorEdge_I, r11
1050c1bc742181ded4930842b46e9507372f0b1b963James Dong
1060c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;//Input arguments on the stack
1070c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_ARG   ppThresholdsArg, 4
1080c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_ARG   ppBSArg, 4
1090c1bc742181ded4930842b46e9507372f0b1b963James Dong
1100c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDRB    alpha1, [pAlphaArg,#1]
1110c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDRB    beta1,  [pBetaArg,#1]
1120c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDR   pThresholds, ppThresholdsArg
1130c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDR     a,=MASK_1
1140c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDRB    beta0,  [pBetaArg]
1150c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STR   pThresholds, ppThresholds
1160c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDRB    alpha0, [pAlphaArg]
1170c1bc742181ded4930842b46e9507372f0b1b963James Dong
1180c1bc742181ded4930842b46e9507372f0b1b963James Dong        MUL     alpha1, alpha1, a
1190c1bc742181ded4930842b46e9507372f0b1b963James Dong        MUL     beta1, beta1, a
1200c1bc742181ded4930842b46e9507372f0b1b963James Dong        MUL     alpha0, alpha0, a
1210c1bc742181ded4930842b46e9507372f0b1b963James Dong        MUL     beta0, beta0, a
1220c1bc742181ded4930842b46e9507372f0b1b963James Dong
1230c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STRD  alpha1, beta1, pAlphaBeta1
1240c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDR   pBS, ppBSArg
1250c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STRD  alpha0, beta0, pAlphaBeta0
1260c1bc742181ded4930842b46e9507372f0b1b963James Dong
1270c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDR     XY,=LOOP_COUNT
1280c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STRD  XY, pBS, pXYBS
1290c1bc742181ded4930842b46e9507372f0b1b963James Dong
1300c1bc742181ded4930842b46e9507372f0b1b963James Dong        SUB     pQ0, pQ0, srcdstStep, LSL #1
1310c1bc742181ded4930842b46e9507372f0b1b963James DongLoopY
1320c1bc742181ded4930842b46e9507372f0b1b963James DongLoopX
1330c1bc742181ded4930842b46e9507372f0b1b963James Dong;//---------------Load Pixels-------------------
1340c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDRH    bS, [pBS], #2
1350c1bc742181ded4930842b46e9507372f0b1b963James Dong
1360c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STR   pBS, ppBS
1370c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDR   p_1, [pQ0],srcdstStep
1380c1bc742181ded4930842b46e9507372f0b1b963James Dong
1390c1bc742181ded4930842b46e9507372f0b1b963James Dong        CMP     bS, #0
1400c1bc742181ded4930842b46e9507372f0b1b963James Dong
1410c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDR   p_0, [pQ0],srcdstStep
1420c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDR   q_0, [pQ0],srcdstStep
1430c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDR   q_1, [pQ0]
1440c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDR     m01, =MASK_1                ;//  01010101 mask
1450c1bc742181ded4930842b46e9507372f0b1b963James Dong        BEQ     NoFilterBS0
1460c1bc742181ded4930842b46e9507372f0b1b963James Dong
1470c1bc742181ded4930842b46e9507372f0b1b963James Dong
1480c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// p_0 = [r3p0 r2p0 r1p0 r0p0]
1490c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// p_1 = [r3p1 r2p1 r1p1 r0p1]
1500c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// q_0 = [r3q0 r2q0 r1q0 r0q0]
1510c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// q_1 = [r3q1 r2q1 r1q1 r0q1]
1520c1bc742181ded4930842b46e9507372f0b1b963James Dong
1530c1bc742181ded4930842b46e9507372f0b1b963James Dong;//--------------Filtering Decision -------------------
1540c1bc742181ded4930842b46e9507372f0b1b963James Dong        MOV     m00, #MASK_0                ;//  00000000 mask
1550c1bc742181ded4930842b46e9507372f0b1b963James Dong
1560c1bc742181ded4930842b46e9507372f0b1b963James Dong        MOV     filt, m01
1570c1bc742181ded4930842b46e9507372f0b1b963James Dong        TST     bS, #0xff00
1580c1bc742181ded4930842b46e9507372f0b1b963James Dong        MOVEQ   filt, filt, LSR #16
1590c1bc742181ded4930842b46e9507372f0b1b963James Dong        TST     bS, #0xff
1600c1bc742181ded4930842b46e9507372f0b1b963James Dong        MOVEQ   filt, filt, LSL #16
1610c1bc742181ded4930842b46e9507372f0b1b963James Dong        TST     bS, #4
1620c1bc742181ded4930842b46e9507372f0b1b963James Dong
1630c1bc742181ded4930842b46e9507372f0b1b963James Dong
1640c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Check |p0-q0|<Alpha
1650c1bc742181ded4930842b46e9507372f0b1b963James Dong        USUB8   dp0q0, p_0, q_0
1660c1bc742181ded4930842b46e9507372f0b1b963James Dong        USUB8   a, q_0, p_0
1670c1bc742181ded4930842b46e9507372f0b1b963James Dong        SEL     ap0q0, a, dp0q0
1680c1bc742181ded4930842b46e9507372f0b1b963James Dong        USUB8   a, ap0q0, alpha
1690c1bc742181ded4930842b46e9507372f0b1b963James Dong        SEL     filt, m00, filt
1700c1bc742181ded4930842b46e9507372f0b1b963James Dong
1710c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Check |p1-p0|<Beta
1720c1bc742181ded4930842b46e9507372f0b1b963James Dong        USUB8   dp1p0, p_1, p_0
1730c1bc742181ded4930842b46e9507372f0b1b963James Dong        USUB8   a, p_0, p_1
1740c1bc742181ded4930842b46e9507372f0b1b963James Dong        SEL     a, a, dp1p0
1750c1bc742181ded4930842b46e9507372f0b1b963James Dong        USUB8   a, a, beta
1760c1bc742181ded4930842b46e9507372f0b1b963James Dong        SEL     filt, m00, filt
1770c1bc742181ded4930842b46e9507372f0b1b963James Dong
1780c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Check |q1-q0|<Beta
1790c1bc742181ded4930842b46e9507372f0b1b963James Dong        USUB8   dq1q0, q_1, q_0
1800c1bc742181ded4930842b46e9507372f0b1b963James Dong        USUB8   a, q_0, q_1
1810c1bc742181ded4930842b46e9507372f0b1b963James Dong        SEL     a, a, dq1q0
1820c1bc742181ded4930842b46e9507372f0b1b963James Dong        USUB8   a, a, beta
1830c1bc742181ded4930842b46e9507372f0b1b963James Dong        SEL     filt, m00, filt
1840c1bc742181ded4930842b46e9507372f0b1b963James Dong
1850c1bc742181ded4930842b46e9507372f0b1b963James Dong        BEQ     bSLT4
1860c1bc742181ded4930842b46e9507372f0b1b963James Dong;//-------------------Filter--------------------
1870c1bc742181ded4930842b46e9507372f0b1b963James DongbSGE4
1880c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;//---------bSGE4 Execution---------------
1890c1bc742181ded4930842b46e9507372f0b1b963James Dong        CMP     filt, #0
1900c1bc742181ded4930842b46e9507372f0b1b963James Dong
1910c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDR   pThresholds, ppThresholds
1920c1bc742181ded4930842b46e9507372f0b1b963James Dong
1930c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Compute P0b
1940c1bc742181ded4930842b46e9507372f0b1b963James Dong        UHADD8  t1, p_0, q_1
1950c1bc742181ded4930842b46e9507372f0b1b963James Dong        BEQ     NoFilterFilt0
1960c1bc742181ded4930842b46e9507372f0b1b963James Dong        MVN     t2, p_1
1970c1bc742181ded4930842b46e9507372f0b1b963James Dong        UHSUB8  t1, t1, t2
1980c1bc742181ded4930842b46e9507372f0b1b963James Dong        USUB8   t2, filt, m01
1990c1bc742181ded4930842b46e9507372f0b1b963James Dong        EOR     t1, t1, m01, LSL #7
2000c1bc742181ded4930842b46e9507372f0b1b963James Dong
2010c1bc742181ded4930842b46e9507372f0b1b963James Dong        ADD     pThresholds,pThresholds, #2
2020c1bc742181ded4930842b46e9507372f0b1b963James Dong
2030c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Compute Q0b
2040c1bc742181ded4930842b46e9507372f0b1b963James Dong        UHADD8  t2, q_0, p_1
2050c1bc742181ded4930842b46e9507372f0b1b963James Dong        MVN     t3, q_1
2060c1bc742181ded4930842b46e9507372f0b1b963James Dong        UHSUB8  t2, t2, t3
2070c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STR   pThresholds, ppThresholds
2080c1bc742181ded4930842b46e9507372f0b1b963James Dong        SEL     P_0, t1, p_0
2090c1bc742181ded4930842b46e9507372f0b1b963James Dong        EOR     t2, t2, m01, LSL #7
2100c1bc742181ded4930842b46e9507372f0b1b963James Dong        SEL     Q_0, t2, q_0
2110c1bc742181ded4930842b46e9507372f0b1b963James Dong
2120c1bc742181ded4930842b46e9507372f0b1b963James Dong        SUB     pQ0, pQ0, srcdstStep, LSL #1
2130c1bc742181ded4930842b46e9507372f0b1b963James Dong        B       StoreResultAndExit
2140c1bc742181ded4930842b46e9507372f0b1b963James Dong
2150c1bc742181ded4930842b46e9507372f0b1b963James Dong;//---------- Exit of LoopX --------------
2160c1bc742181ded4930842b46e9507372f0b1b963James Dong;//---- for the case of no filtering -----
2170c1bc742181ded4930842b46e9507372f0b1b963James Dong
2180c1bc742181ded4930842b46e9507372f0b1b963James DongNoFilterFilt0
2190c1bc742181ded4930842b46e9507372f0b1b963James DongNoFilterBS0
2200c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDR   pThresholds, ppThresholds
2210c1bc742181ded4930842b46e9507372f0b1b963James Dong        SUB     pQ0, pQ0, srcdstStep, LSL #1
2220c1bc742181ded4930842b46e9507372f0b1b963James Dong        SUB     pQ0, pQ0, srcdstStep
2230c1bc742181ded4930842b46e9507372f0b1b963James Dong        ADD     pQ0, pQ0, #4
2240c1bc742181ded4930842b46e9507372f0b1b963James Dong        ADD     pThresholds, pThresholds, #2
2250c1bc742181ded4930842b46e9507372f0b1b963James Dong
2260c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Load counter for LoopX
2270c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDRD  XY, pBS, pXYBS
2280c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STR   pThresholds, ppThresholds
2290c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDRD  alpha, beta, pAlphaBeta0
2300c1bc742181ded4930842b46e9507372f0b1b963James Dong
2310c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Align the pointer
2320c1bc742181ded4930842b46e9507372f0b1b963James Dong        ADDS    XY, XY, XY
2330c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STR   XY, pXYBS
2340c1bc742181ded4930842b46e9507372f0b1b963James Dong        BCC     LoopY
2350c1bc742181ded4930842b46e9507372f0b1b963James Dong        B       ExitLoopY
2360c1bc742181ded4930842b46e9507372f0b1b963James Dong
2370c1bc742181ded4930842b46e9507372f0b1b963James DongbSLT4
2380c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;//---------bSLT4 Execution---------------
2390c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDR   pThresholds, ppThresholds
2400c1bc742181ded4930842b46e9507372f0b1b963James Dong        CMP     filt, #0
2410c1bc742181ded4930842b46e9507372f0b1b963James Dong
2420c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Since beta <= 18 and alpha <= 255 we know
2430c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// -254 <= p0-q0 <= 254
2440c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;//  -17 <= q1-q0 <= 17
2450c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;//  -17 <= p1-p0 <= 17
2460c1bc742181ded4930842b46e9507372f0b1b963James Dong
2470c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// delta = Clip3( -tC, tC, ((((q0-p0)<<2) + (p1-q1) + 4)>>3))
2480c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;//
2490c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;//    Calculate A = (((q0-p0)<<2) + (p1-q1) + 4)>>3
2500c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;//                = (4*q0 - 4*p0 + p1 - q1 + 4)>>3
2510c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;//                = ((p1-p0) - (q1-q0) - 3*(p0-q0) + 4)>>3
2520c1bc742181ded4930842b46e9507372f0b1b963James Dong
2530c1bc742181ded4930842b46e9507372f0b1b963James Dong        USUB8   t1, p_1, p_0
2540c1bc742181ded4930842b46e9507372f0b1b963James Dong        USUB8   t2, q_1, q_0
2550c1bc742181ded4930842b46e9507372f0b1b963James Dong        BEQ     NoFilterFilt0
2560c1bc742181ded4930842b46e9507372f0b1b963James Dong
2570c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDRB    tC0, [pThresholds],#1
2580c1bc742181ded4930842b46e9507372f0b1b963James Dong        SSUB8   t1, t1, t2
2590c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDRB    tC1, [pThresholds],#1
2600c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STR   pThresholds, ppThresholds
2610c1bc742181ded4930842b46e9507372f0b1b963James Dong        UHSUB8  t4, p_0, q_0
2620c1bc742181ded4930842b46e9507372f0b1b963James Dong        ORR     tC, tC0, tC1, LSL #16
2630c1bc742181ded4930842b46e9507372f0b1b963James Dong        USUB8   t5, p_0, q_0
2640c1bc742181ded4930842b46e9507372f0b1b963James Dong        AND     t5, t5, m01
2650c1bc742181ded4930842b46e9507372f0b1b963James Dong        SHSUB8  t1, t1, t5
2660c1bc742181ded4930842b46e9507372f0b1b963James Dong        ORR     tC, tC, LSL #8
2670c1bc742181ded4930842b46e9507372f0b1b963James Dong        SSUB8   t1, t1, t5
2680c1bc742181ded4930842b46e9507372f0b1b963James Dong        SHSUB8  t1, t1, t4
2690c1bc742181ded4930842b46e9507372f0b1b963James Dong        UQADD8  tC, tC, m01
2700c1bc742181ded4930842b46e9507372f0b1b963James Dong        SADD8   t1, t1, m01
2710c1bc742181ded4930842b46e9507372f0b1b963James Dong        USUB8   t5, filt, m01
2720c1bc742181ded4930842b46e9507372f0b1b963James Dong        SHSUB8  t1, t1, t4
2730c1bc742181ded4930842b46e9507372f0b1b963James Dong        SEL     tC, tC, m00
2740c1bc742181ded4930842b46e9507372f0b1b963James Dong
2750c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Split into positive and negative part and clip
2760c1bc742181ded4930842b46e9507372f0b1b963James Dong
2770c1bc742181ded4930842b46e9507372f0b1b963James Dong        SSUB8   t1, t1, m00
2780c1bc742181ded4930842b46e9507372f0b1b963James Dong        SEL     pos, t1, m00
2790c1bc742181ded4930842b46e9507372f0b1b963James Dong        USUB8   neg, pos, t1
2800c1bc742181ded4930842b46e9507372f0b1b963James Dong        USUB8   t3, pos, tC
2810c1bc742181ded4930842b46e9507372f0b1b963James Dong        SEL     pos, tC, pos
2820c1bc742181ded4930842b46e9507372f0b1b963James Dong        USUB8   t3, neg, tC
2830c1bc742181ded4930842b46e9507372f0b1b963James Dong        SEL     neg, tC, neg
2840c1bc742181ded4930842b46e9507372f0b1b963James Dong        UQADD8  P_0, p_0, pos
2850c1bc742181ded4930842b46e9507372f0b1b963James Dong        UQSUB8  Q_0, q_0, pos
2860c1bc742181ded4930842b46e9507372f0b1b963James Dong        UQSUB8  P_0, P_0, neg
2870c1bc742181ded4930842b46e9507372f0b1b963James Dong        UQADD8  Q_0, Q_0, neg
2880c1bc742181ded4930842b46e9507372f0b1b963James Dong
2890c1bc742181ded4930842b46e9507372f0b1b963James Dong        SUB     pQ0, pQ0, srcdstStep, LSL #1
2900c1bc742181ded4930842b46e9507372f0b1b963James Dong
2910c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Choose to store the filtered
2920c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// value or the original pixel
2930c1bc742181ded4930842b46e9507372f0b1b963James Dong        USUB8   t1, filt, m01
2940c1bc742181ded4930842b46e9507372f0b1b963James Dong        SEL     P_0, P_0, p_0
2950c1bc742181ded4930842b46e9507372f0b1b963James Dong        SEL     Q_0, Q_0, q_0
2960c1bc742181ded4930842b46e9507372f0b1b963James Dong
2970c1bc742181ded4930842b46e9507372f0b1b963James DongStoreResultAndExit
2980c1bc742181ded4930842b46e9507372f0b1b963James Dong
2990c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;//---------Store result---------------
3000c1bc742181ded4930842b46e9507372f0b1b963James Dong
3010c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// P_0 = [r0p0 r1p0 r2p0 r3p0]
3020c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Q_0 = [r0q0 r1q0 r2q0 r3q0]
3030c1bc742181ded4930842b46e9507372f0b1b963James Dong
3040c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STR   P_0, [pQ0], srcdstStep
3050c1bc742181ded4930842b46e9507372f0b1b963James Dong        STR     Q_0, [pQ0], #4
3060c1bc742181ded4930842b46e9507372f0b1b963James Dong
3070c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDRD  XY, pBS, pXYBS
3080c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDRD  alpha, beta, pAlphaBeta0
3090c1bc742181ded4930842b46e9507372f0b1b963James Dong
3100c1bc742181ded4930842b46e9507372f0b1b963James Dong        SUB     pQ0, pQ0, srcdstStep, LSL #1
3110c1bc742181ded4930842b46e9507372f0b1b963James Dong
3120c1bc742181ded4930842b46e9507372f0b1b963James Dong        ADDS    XY, XY, XY
3130c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STR   XY, pXYBS
3140c1bc742181ded4930842b46e9507372f0b1b963James Dong        BCC     LoopX
3150c1bc742181ded4930842b46e9507372f0b1b963James Dong
3160c1bc742181ded4930842b46e9507372f0b1b963James Dong;//-------- Common Exit of LoopY -----------------
3170c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Align the pointers
3180c1bc742181ded4930842b46e9507372f0b1b963James Dong
3190c1bc742181ded4930842b46e9507372f0b1b963James DongExitLoopY
3200c1bc742181ded4930842b46e9507372f0b1b963James Dong        ADD     pBS, pBS, #4
3210c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDRD  alpha, beta, pAlphaBeta1
3220c1bc742181ded4930842b46e9507372f0b1b963James Dong        SUB     pQ0, pQ0, #8
3230c1bc742181ded4930842b46e9507372f0b1b963James Dong        ADD     pQ0, pQ0, srcdstStep, LSL #2
3240c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STRD  alpha, beta, pAlphaBeta0
3250c1bc742181ded4930842b46e9507372f0b1b963James Dong
3260c1bc742181ded4930842b46e9507372f0b1b963James Dong        BNE     LoopY
3270c1bc742181ded4930842b46e9507372f0b1b963James Dong        MOV     r0, #OMX_Sts_NoErr
3280c1bc742181ded4930842b46e9507372f0b1b963James Dong
3290c1bc742181ded4930842b46e9507372f0b1b963James Dong;//-----------------End Filter--------------------
3300c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_END
3310c1bc742181ded4930842b46e9507372f0b1b963James Dong
3320c1bc742181ded4930842b46e9507372f0b1b963James Dong    ENDIF
3330c1bc742181ded4930842b46e9507372f0b1b963James Dong
3340c1bc742181ded4930842b46e9507372f0b1b963James Dong        END
3350c1bc742181ded4930842b46e9507372f0b1b963James Dong
3360c1bc742181ded4930842b46e9507372f0b1b963James Dong
337