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: omxVCCOMM_ExpandFrame_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;// Description: 270c1bc742181ded4930842b46e9507372f0b1b963James Dong;// This function will Expand Frame boundary pixels into Plane 280c1bc742181ded4930842b46e9507372f0b1b963James Dong;// 290c1bc742181ded4930842b46e9507372f0b1b963James Dong;// 300c1bc742181ded4930842b46e9507372f0b1b963James Dong 310c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Include standard headers 320c1bc742181ded4930842b46e9507372f0b1b963James Dong 330c1bc742181ded4930842b46e9507372f0b1b963James Dong INCLUDE omxtypes_s.h 340c1bc742181ded4930842b46e9507372f0b1b963James Dong INCLUDE armCOMM_s.h 350c1bc742181ded4930842b46e9507372f0b1b963James Dong 360c1bc742181ded4930842b46e9507372f0b1b963James Dong M_VARIANTS ARM1136JS 370c1bc742181ded4930842b46e9507372f0b1b963James Dong 380c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Import symbols required from other files 390c1bc742181ded4930842b46e9507372f0b1b963James Dong;// (For example tables) 400c1bc742181ded4930842b46e9507372f0b1b963James Dong 410c1bc742181ded4930842b46e9507372f0b1b963James Dong 420c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Set debugging level 430c1bc742181ded4930842b46e9507372f0b1b963James DongDEBUG_ON SETL {FALSE} 440c1bc742181ded4930842b46e9507372f0b1b963James Dong 450c1bc742181ded4930842b46e9507372f0b1b963James Dong 460c1bc742181ded4930842b46e9507372f0b1b963James Dong 470c1bc742181ded4930842b46e9507372f0b1b963James Dong 480c1bc742181ded4930842b46e9507372f0b1b963James Dong 490c1bc742181ded4930842b46e9507372f0b1b963James Dong 500c1bc742181ded4930842b46e9507372f0b1b963James Dong 510c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Guarding implementation by the processor name 520c1bc742181ded4930842b46e9507372f0b1b963James Dong 530c1bc742181ded4930842b46e9507372f0b1b963James Dong IF ARM1136JS 540c1bc742181ded4930842b46e9507372f0b1b963James Dong 550c1bc742181ded4930842b46e9507372f0b1b963James Dong;//Input Registers 560c1bc742181ded4930842b46e9507372f0b1b963James Dong 570c1bc742181ded4930842b46e9507372f0b1b963James DongpSrcDstPlane RN 0 580c1bc742181ded4930842b46e9507372f0b1b963James DongiFrameWidth RN 1 590c1bc742181ded4930842b46e9507372f0b1b963James DongiFrameHeight RN 2 600c1bc742181ded4930842b46e9507372f0b1b963James DongiExpandPels RN 3 610c1bc742181ded4930842b46e9507372f0b1b963James Dong 620c1bc742181ded4930842b46e9507372f0b1b963James Dong 630c1bc742181ded4930842b46e9507372f0b1b963James Dong;//Output Registers 640c1bc742181ded4930842b46e9507372f0b1b963James Dong 650c1bc742181ded4930842b46e9507372f0b1b963James Dongresult RN 0 660c1bc742181ded4930842b46e9507372f0b1b963James Dong 670c1bc742181ded4930842b46e9507372f0b1b963James Dong;//Local Scratch Registers 680c1bc742181ded4930842b46e9507372f0b1b963James Dong 690c1bc742181ded4930842b46e9507372f0b1b963James DongiPlaneStep RN 4 700c1bc742181ded4930842b46e9507372f0b1b963James DongpTop RN 5 710c1bc742181ded4930842b46e9507372f0b1b963James DongpBottom RN 6 720c1bc742181ded4930842b46e9507372f0b1b963James DongpBottomIndex RN 7 730c1bc742181ded4930842b46e9507372f0b1b963James Dongx RN 8 740c1bc742181ded4930842b46e9507372f0b1b963James Dongy RN 9 750c1bc742181ded4930842b46e9507372f0b1b963James DongtempTop RN 10 760c1bc742181ded4930842b46e9507372f0b1b963James DongtempBot RN 11 770c1bc742181ded4930842b46e9507372f0b1b963James DongColStep RN 12 780c1bc742181ded4930842b46e9507372f0b1b963James DongpLeft RN 5 790c1bc742181ded4930842b46e9507372f0b1b963James DongpRight RN 6 800c1bc742181ded4930842b46e9507372f0b1b963James DongpRightIndex RN 7 810c1bc742181ded4930842b46e9507372f0b1b963James DongtempLeft1 RN 10 820c1bc742181ded4930842b46e9507372f0b1b963James DongtempRight1 RN 11 830c1bc742181ded4930842b46e9507372f0b1b963James DongtempLeft2 RN 14 840c1bc742181ded4930842b46e9507372f0b1b963James DongtempRight2 RN 2 850c1bc742181ded4930842b46e9507372f0b1b963James DongindexY RN 14 860c1bc742181ded4930842b46e9507372f0b1b963James DongRowStep RN 12 870c1bc742181ded4930842b46e9507372f0b1b963James DongexpandTo4bytes RN 1 ;// copy a byte to 4 bytes of a word 880c1bc742181ded4930842b46e9507372f0b1b963James Dong 890c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Allocate stack memory required by the function 900c1bc742181ded4930842b46e9507372f0b1b963James Dong 910c1bc742181ded4930842b46e9507372f0b1b963James Dong 920c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Write function header 930c1bc742181ded4930842b46e9507372f0b1b963James Dong M_START omxVCCOMM_ExpandFrame_I,r11 940c1bc742181ded4930842b46e9507372f0b1b963James Dong 950c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Define stack arguments 960c1bc742181ded4930842b46e9507372f0b1b963James Dong M_ARG iPlaneStepOnStack, 4 970c1bc742181ded4930842b46e9507372f0b1b963James Dong 980c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Load argument from the stack 990c1bc742181ded4930842b46e9507372f0b1b963James Dong M_LDR iPlaneStep, iPlaneStepOnStack 1000c1bc742181ded4930842b46e9507372f0b1b963James Dong 1010c1bc742181ded4930842b46e9507372f0b1b963James Dong MUL pTop,iExpandPels,iPlaneStep 1020c1bc742181ded4930842b46e9507372f0b1b963James Dong MLA pBottom,iFrameHeight,iPlaneStep,pSrcDstPlane 1030c1bc742181ded4930842b46e9507372f0b1b963James Dong SUB x,iFrameWidth,#4 1040c1bc742181ded4930842b46e9507372f0b1b963James Dong MOV indexY,pTop 1050c1bc742181ded4930842b46e9507372f0b1b963James Dong ADD ColStep,indexY,#4 1060c1bc742181ded4930842b46e9507372f0b1b963James Dong SUB pBottomIndex,pBottom,iPlaneStep 1070c1bc742181ded4930842b46e9507372f0b1b963James Dong SUB pTop,pSrcDstPlane,pTop 1080c1bc742181ded4930842b46e9507372f0b1b963James Dong 1090c1bc742181ded4930842b46e9507372f0b1b963James Dong 1100c1bc742181ded4930842b46e9507372f0b1b963James Dong ADD pTop,pTop,x 1110c1bc742181ded4930842b46e9507372f0b1b963James Dong ADD pBottom,pBottom,x 1120c1bc742181ded4930842b46e9507372f0b1b963James Dong 1130c1bc742181ded4930842b46e9507372f0b1b963James Dong ;//------------------------------------------------------------------------ 1140c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// The following improves upon the C implmentation 1150c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// The x and y loops are interchanged: This ensures that the values of 1160c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// pSrcDstPlane [x] and pSrcDstPlane [(iFrameHeight - 1) * iPlaneStep + x] 1170c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// which depend only on loop variable 'x' are loaded once and used in 1180c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// multiple stores in the 'Y' loop 1190c1bc742181ded4930842b46e9507372f0b1b963James Dong ;//------------------------------------------------------------------------ 1200c1bc742181ded4930842b46e9507372f0b1b963James Dong 1210c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// xloop 1220c1bc742181ded4930842b46e9507372f0b1b963James DongExpandFrameTopBotXloop 1230c1bc742181ded4930842b46e9507372f0b1b963James Dong 1240c1bc742181ded4930842b46e9507372f0b1b963James Dong LDR tempTop,[pSrcDstPlane,x] 1250c1bc742181ded4930842b46e9507372f0b1b963James Dong ;//------------------------------------------------------------------------ 1260c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// pSrcDstPlane [(iFrameHeight - 1) * iPlaneStep + x] is simplified as: 1270c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// pSrcDstPlane + (iFrameHeight * iPlaneStep) - iPlaneStep + x == 1280c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// pBottom - iPlaneStep + x == pBottomIndex [x] 1290c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// The value of pBottomIndex is calculated above this 'x' loop 1300c1bc742181ded4930842b46e9507372f0b1b963James Dong ;//------------------------------------------------------------------------ 1310c1bc742181ded4930842b46e9507372f0b1b963James Dong LDR tempBot,[pBottomIndex,x] 1320c1bc742181ded4930842b46e9507372f0b1b963James Dong 1330c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// yloop 1340c1bc742181ded4930842b46e9507372f0b1b963James Dong MOV y,iExpandPels 1350c1bc742181ded4930842b46e9507372f0b1b963James Dong 1360c1bc742181ded4930842b46e9507372f0b1b963James DongExpandFrameTopBotYloop 1370c1bc742181ded4930842b46e9507372f0b1b963James Dong SUBS y,y,#1 1380c1bc742181ded4930842b46e9507372f0b1b963James Dong M_STR tempTop,[pTop],iPlaneStep 1390c1bc742181ded4930842b46e9507372f0b1b963James Dong M_STR tempBot,[pBottom],iPlaneStep 1400c1bc742181ded4930842b46e9507372f0b1b963James Dong BGT ExpandFrameTopBotYloop 1410c1bc742181ded4930842b46e9507372f0b1b963James Dong 1420c1bc742181ded4930842b46e9507372f0b1b963James Dong SUBS x,x,#4 1430c1bc742181ded4930842b46e9507372f0b1b963James Dong SUB pTop,pTop,ColStep 1440c1bc742181ded4930842b46e9507372f0b1b963James Dong SUB pBottom,pBottom,ColStep 1450c1bc742181ded4930842b46e9507372f0b1b963James Dong BGE ExpandFrameTopBotXloop 1460c1bc742181ded4930842b46e9507372f0b1b963James Dong 1470c1bc742181ded4930842b46e9507372f0b1b963James Dong 1480c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// y loop 1490c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// The product is already calculated above : Reuse 1500c1bc742181ded4930842b46e9507372f0b1b963James Dong ;//MUL indexY,iExpandPels,iPlaneStep 1510c1bc742181ded4930842b46e9507372f0b1b963James Dong 1520c1bc742181ded4930842b46e9507372f0b1b963James Dong SUB pSrcDstPlane,pSrcDstPlane,indexY 1530c1bc742181ded4930842b46e9507372f0b1b963James Dong SUB pLeft,pSrcDstPlane,iExpandPels ;// pLeft->points to the top left of the expanded block 1540c1bc742181ded4930842b46e9507372f0b1b963James Dong ADD pRight,pSrcDstPlane,iFrameWidth 1550c1bc742181ded4930842b46e9507372f0b1b963James Dong SUB pRightIndex,pRight,#1 1560c1bc742181ded4930842b46e9507372f0b1b963James Dong 1570c1bc742181ded4930842b46e9507372f0b1b963James Dong ADD y,iFrameHeight,iExpandPels,LSL #1 1580c1bc742181ded4930842b46e9507372f0b1b963James Dong LDR expandTo4bytes,=0x01010101 1590c1bc742181ded4930842b46e9507372f0b1b963James Dong 1600c1bc742181ded4930842b46e9507372f0b1b963James Dong RSB RowStep,iExpandPels,iPlaneStep,LSL #1 1610c1bc742181ded4930842b46e9507372f0b1b963James Dong 1620c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// The Y Loop is unrolled twice 1630c1bc742181ded4930842b46e9507372f0b1b963James DongExpandFrameLeftRightYloop 1640c1bc742181ded4930842b46e9507372f0b1b963James Dong LDRB tempLeft2,[pSrcDstPlane,iPlaneStep] ;// PreLoad the values 1650c1bc742181ded4930842b46e9507372f0b1b963James Dong LDRB tempRight2,[pRightIndex,iPlaneStep] 1660c1bc742181ded4930842b46e9507372f0b1b963James Dong M_LDRB tempLeft1,[pSrcDstPlane],iPlaneStep,LSL #1 ;// PreLoad the values 1670c1bc742181ded4930842b46e9507372f0b1b963James Dong M_LDRB tempRight1,[pRightIndex],iPlaneStep,LSL #1 1680c1bc742181ded4930842b46e9507372f0b1b963James Dong 1690c1bc742181ded4930842b46e9507372f0b1b963James Dong SUB x,iExpandPels,#4 1700c1bc742181ded4930842b46e9507372f0b1b963James Dong MUL tempLeft2,tempLeft2,expandTo4bytes ;// Copy the single byte to 4 bytes 1710c1bc742181ded4930842b46e9507372f0b1b963James Dong MUL tempRight2,tempRight2,expandTo4bytes 1720c1bc742181ded4930842b46e9507372f0b1b963James Dong MUL tempLeft1,tempLeft1,expandTo4bytes ;// Copy the single byte to 4 bytes 1730c1bc742181ded4930842b46e9507372f0b1b963James Dong MUL tempRight1,tempRight1,expandTo4bytes 1740c1bc742181ded4930842b46e9507372f0b1b963James Dong 1750c1bc742181ded4930842b46e9507372f0b1b963James Dong 1760c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// x loop 1770c1bc742181ded4930842b46e9507372f0b1b963James DongExpandFrameLeftRightXloop 1780c1bc742181ded4930842b46e9507372f0b1b963James Dong SUBS x,x,#4 1790c1bc742181ded4930842b46e9507372f0b1b963James Dong STR tempLeft2,[pLeft,iPlaneStep] ;// Store the 4 bytes at one go 1800c1bc742181ded4930842b46e9507372f0b1b963James Dong STR tempRight2,[pRight,iPlaneStep] 1810c1bc742181ded4930842b46e9507372f0b1b963James Dong STR tempLeft1,[pLeft],#4 ;// Store the 4 bytes at one go 1820c1bc742181ded4930842b46e9507372f0b1b963James Dong STR tempRight1,[pRight],#4 1830c1bc742181ded4930842b46e9507372f0b1b963James Dong BGE ExpandFrameLeftRightXloop 1840c1bc742181ded4930842b46e9507372f0b1b963James Dong 1850c1bc742181ded4930842b46e9507372f0b1b963James Dong SUBS y,y,#2 1860c1bc742181ded4930842b46e9507372f0b1b963James Dong ADD pLeft,pLeft,RowStep 1870c1bc742181ded4930842b46e9507372f0b1b963James Dong ADD pRight,pRight,RowStep 1880c1bc742181ded4930842b46e9507372f0b1b963James Dong BGT ExpandFrameLeftRightYloop 1890c1bc742181ded4930842b46e9507372f0b1b963James Dong 1900c1bc742181ded4930842b46e9507372f0b1b963James Dong 1910c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Set return value 1920c1bc742181ded4930842b46e9507372f0b1b963James Dong 1930c1bc742181ded4930842b46e9507372f0b1b963James Dong MOV result,#OMX_Sts_NoErr 1940c1bc742181ded4930842b46e9507372f0b1b963James DongEnd 1950c1bc742181ded4930842b46e9507372f0b1b963James Dong 1960c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Write function tail 1970c1bc742181ded4930842b46e9507372f0b1b963James Dong 1980c1bc742181ded4930842b46e9507372f0b1b963James Dong M_END 1990c1bc742181ded4930842b46e9507372f0b1b963James Dong 2000c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF ;//ARM1136JS 2010c1bc742181ded4930842b46e9507372f0b1b963James Dong 2020c1bc742181ded4930842b46e9507372f0b1b963James Dong 20378e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar END 204