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