10c1bc742181ded4930842b46e9507372f0b1b963James Dong;
20c1bc742181ded4930842b46e9507372f0b1b963James Dong; Copyright (C) 2009 The Android Open Source Project
30c1bc742181ded4930842b46e9507372f0b1b963James Dong;
40c1bc742181ded4930842b46e9507372f0b1b963James Dong; Licensed under the Apache License, Version 2.0 (the "License");
50c1bc742181ded4930842b46e9507372f0b1b963James Dong; you may not use this file except in compliance with the License.
60c1bc742181ded4930842b46e9507372f0b1b963James Dong; You may obtain a copy of the License at
70c1bc742181ded4930842b46e9507372f0b1b963James Dong;
80c1bc742181ded4930842b46e9507372f0b1b963James Dong;      http://www.apache.org/licenses/LICENSE-2.0
90c1bc742181ded4930842b46e9507372f0b1b963James Dong;
100c1bc742181ded4930842b46e9507372f0b1b963James Dong; Unless required by applicable law or agreed to in writing, software
110c1bc742181ded4930842b46e9507372f0b1b963James Dong; distributed under the License is distributed on an "AS IS" BASIS,
120c1bc742181ded4930842b46e9507372f0b1b963James Dong; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
130c1bc742181ded4930842b46e9507372f0b1b963James Dong; See the License for the specific language governing permissions and
140c1bc742181ded4930842b46e9507372f0b1b963James Dong; limitations under the License.
150c1bc742181ded4930842b46e9507372f0b1b963James Dong;
160c1bc742181ded4930842b46e9507372f0b1b963James Dong
170c1bc742181ded4930842b46e9507372f0b1b963James Dong    REQUIRE8
180c1bc742181ded4930842b46e9507372f0b1b963James Dong    PRESERVE8
190c1bc742181ded4930842b46e9507372f0b1b963James Dong
200c1bc742181ded4930842b46e9507372f0b1b963James Dong    AREA    |.text|, CODE
210c1bc742181ded4930842b46e9507372f0b1b963James Dong
220c1bc742181ded4930842b46e9507372f0b1b963James Dong    EXPORT h264bsdWriteMacroblock
230c1bc742181ded4930842b46e9507372f0b1b963James Dong
240c1bc742181ded4930842b46e9507372f0b1b963James Dong; Input / output registers
250c1bc742181ded4930842b46e9507372f0b1b963James Dongimage   RN  0
260c1bc742181ded4930842b46e9507372f0b1b963James Dongdata    RN  1
270c1bc742181ded4930842b46e9507372f0b1b963James Dongwidth   RN  2
280c1bc742181ded4930842b46e9507372f0b1b963James Dongluma    RN  3
290c1bc742181ded4930842b46e9507372f0b1b963James Dongcb      RN  4
300c1bc742181ded4930842b46e9507372f0b1b963James Dongcr      RN  5
310c1bc742181ded4930842b46e9507372f0b1b963James Dongcwidth  RN  6
320c1bc742181ded4930842b46e9507372f0b1b963James Dong
330c1bc742181ded4930842b46e9507372f0b1b963James Dong; -- NEON registers --
340c1bc742181ded4930842b46e9507372f0b1b963James Dong
350c1bc742181ded4930842b46e9507372f0b1b963James DongqRow0   QN  Q0.U8
360c1bc742181ded4930842b46e9507372f0b1b963James DongqRow1   QN  Q1.U8
370c1bc742181ded4930842b46e9507372f0b1b963James DongqRow2   QN  Q2.U8
380c1bc742181ded4930842b46e9507372f0b1b963James DongqRow3   QN  Q3.U8
390c1bc742181ded4930842b46e9507372f0b1b963James DongqRow4   QN  Q4.U8
400c1bc742181ded4930842b46e9507372f0b1b963James DongqRow5   QN  Q5.U8
410c1bc742181ded4930842b46e9507372f0b1b963James DongqRow6   QN  Q6.U8
420c1bc742181ded4930842b46e9507372f0b1b963James DongqRow7   QN  Q7.U8
430c1bc742181ded4930842b46e9507372f0b1b963James DongqRow8   QN  Q8.U8
440c1bc742181ded4930842b46e9507372f0b1b963James DongqRow9   QN  Q9.U8
450c1bc742181ded4930842b46e9507372f0b1b963James DongqRow10  QN  Q10.U8
460c1bc742181ded4930842b46e9507372f0b1b963James DongqRow11  QN  Q11.U8
470c1bc742181ded4930842b46e9507372f0b1b963James DongqRow12  QN  Q12.U8
480c1bc742181ded4930842b46e9507372f0b1b963James DongqRow13  QN  Q13.U8
490c1bc742181ded4930842b46e9507372f0b1b963James DongqRow14  QN  Q14.U8
500c1bc742181ded4930842b46e9507372f0b1b963James DongqRow15  QN  Q15.U8
510c1bc742181ded4930842b46e9507372f0b1b963James Dong
520c1bc742181ded4930842b46e9507372f0b1b963James DongdRow0   DN  D0.U8
530c1bc742181ded4930842b46e9507372f0b1b963James DongdRow1   DN  D1.U8
540c1bc742181ded4930842b46e9507372f0b1b963James DongdRow2   DN  D2.U8
550c1bc742181ded4930842b46e9507372f0b1b963James DongdRow3   DN  D3.U8
560c1bc742181ded4930842b46e9507372f0b1b963James DongdRow4   DN  D4.U8
570c1bc742181ded4930842b46e9507372f0b1b963James DongdRow5   DN  D5.U8
580c1bc742181ded4930842b46e9507372f0b1b963James DongdRow6   DN  D6.U8
590c1bc742181ded4930842b46e9507372f0b1b963James DongdRow7   DN  D7.U8
600c1bc742181ded4930842b46e9507372f0b1b963James DongdRow8   DN  D8.U8
610c1bc742181ded4930842b46e9507372f0b1b963James DongdRow9   DN  D9.U8
620c1bc742181ded4930842b46e9507372f0b1b963James DongdRow10  DN  D10.U8
630c1bc742181ded4930842b46e9507372f0b1b963James DongdRow11  DN  D11.U8
640c1bc742181ded4930842b46e9507372f0b1b963James DongdRow12  DN  D12.U8
650c1bc742181ded4930842b46e9507372f0b1b963James DongdRow13  DN  D13.U8
660c1bc742181ded4930842b46e9507372f0b1b963James DongdRow14  DN  D14.U8
670c1bc742181ded4930842b46e9507372f0b1b963James DongdRow15  DN  D15.U8
680c1bc742181ded4930842b46e9507372f0b1b963James Dong
690c1bc742181ded4930842b46e9507372f0b1b963James Dong;/*------------------------------------------------------------------------------
700c1bc742181ded4930842b46e9507372f0b1b963James Dong;
710c1bc742181ded4930842b46e9507372f0b1b963James Dong;    Function: h264bsdWriteMacroblock
720c1bc742181ded4930842b46e9507372f0b1b963James Dong;
730c1bc742181ded4930842b46e9507372f0b1b963James Dong;        Functional description:
740c1bc742181ded4930842b46e9507372f0b1b963James Dong;            Write one macroblock into the image. Both luma and chroma
750c1bc742181ded4930842b46e9507372f0b1b963James Dong;            components will be written at the same time.
760c1bc742181ded4930842b46e9507372f0b1b963James Dong;
770c1bc742181ded4930842b46e9507372f0b1b963James Dong;        Inputs:
780c1bc742181ded4930842b46e9507372f0b1b963James Dong;            data    pointer to macroblock data to be written, 256 values for
790c1bc742181ded4930842b46e9507372f0b1b963James Dong;                    luma followed by 64 values for both chroma components
800c1bc742181ded4930842b46e9507372f0b1b963James Dong;
810c1bc742181ded4930842b46e9507372f0b1b963James Dong;        Outputs:
820c1bc742181ded4930842b46e9507372f0b1b963James Dong;            image   pointer to the image where the macroblock will be written
830c1bc742181ded4930842b46e9507372f0b1b963James Dong;
840c1bc742181ded4930842b46e9507372f0b1b963James Dong;        Returns:
850c1bc742181ded4930842b46e9507372f0b1b963James Dong;            none
860c1bc742181ded4930842b46e9507372f0b1b963James Dong;
870c1bc742181ded4930842b46e9507372f0b1b963James Dong;------------------------------------------------------------------------------*/
880c1bc742181ded4930842b46e9507372f0b1b963James Dong
890c1bc742181ded4930842b46e9507372f0b1b963James Dongh264bsdWriteMacroblock
900c1bc742181ded4930842b46e9507372f0b1b963James Dong    PUSH    {r4-r6,lr}
910c1bc742181ded4930842b46e9507372f0b1b963James Dong    VPUSH   {q4-q7}
920c1bc742181ded4930842b46e9507372f0b1b963James Dong
930c1bc742181ded4930842b46e9507372f0b1b963James Dong    LDR     width, [image, #4]
940c1bc742181ded4930842b46e9507372f0b1b963James Dong    LDR     luma, [image, #0xC]
950c1bc742181ded4930842b46e9507372f0b1b963James Dong    LDR     cb, [image, #0x10]
960c1bc742181ded4930842b46e9507372f0b1b963James Dong    LDR     cr, [image, #0x14]
970c1bc742181ded4930842b46e9507372f0b1b963James Dong
980c1bc742181ded4930842b46e9507372f0b1b963James Dong
990c1bc742181ded4930842b46e9507372f0b1b963James Dong;   Write luma
1000c1bc742181ded4930842b46e9507372f0b1b963James Dong    VLD1    {qRow0, qRow1}, [data]!
1010c1bc742181ded4930842b46e9507372f0b1b963James Dong    LSL     width, width, #4
1020c1bc742181ded4930842b46e9507372f0b1b963James Dong    VLD1    {qRow2, qRow3}, [data]!
1030c1bc742181ded4930842b46e9507372f0b1b963James Dong    LSR     cwidth, width, #1
1040c1bc742181ded4930842b46e9507372f0b1b963James Dong    VST1    {qRow0}, [luma@128], width
1050c1bc742181ded4930842b46e9507372f0b1b963James Dong    VLD1    {qRow4, qRow5}, [data]!
1060c1bc742181ded4930842b46e9507372f0b1b963James Dong    VST1    {qRow1}, [luma@128], width
1070c1bc742181ded4930842b46e9507372f0b1b963James Dong    VLD1    {qRow6, qRow7}, [data]!
1080c1bc742181ded4930842b46e9507372f0b1b963James Dong    VST1    {qRow2}, [luma@128], width
1090c1bc742181ded4930842b46e9507372f0b1b963James Dong    VLD1    {qRow8, qRow9}, [data]!
1100c1bc742181ded4930842b46e9507372f0b1b963James Dong    VST1    {qRow3}, [luma@128], width
1110c1bc742181ded4930842b46e9507372f0b1b963James Dong    VLD1    {qRow10, qRow11}, [data]!
1120c1bc742181ded4930842b46e9507372f0b1b963James Dong    VST1    {qRow4}, [luma@128], width
1130c1bc742181ded4930842b46e9507372f0b1b963James Dong    VLD1    {qRow12, qRow13}, [data]!
1140c1bc742181ded4930842b46e9507372f0b1b963James Dong    VST1    {qRow5}, [luma@128], width
1150c1bc742181ded4930842b46e9507372f0b1b963James Dong    VLD1    {qRow14, qRow15}, [data]!
1160c1bc742181ded4930842b46e9507372f0b1b963James Dong    VST1    {qRow6}, [luma@128], width
1170c1bc742181ded4930842b46e9507372f0b1b963James Dong
1180c1bc742181ded4930842b46e9507372f0b1b963James Dong    VLD1    {qRow0, qRow1}, [data]! ;cb rows 0,1,2,3
1190c1bc742181ded4930842b46e9507372f0b1b963James Dong    VST1    {qRow7}, [luma@128], width
1200c1bc742181ded4930842b46e9507372f0b1b963James Dong    VLD1    {qRow2, qRow3}, [data]! ;cb rows 4,5,6,7
1210c1bc742181ded4930842b46e9507372f0b1b963James Dong    VST1    {qRow8}, [luma@128], width
1220c1bc742181ded4930842b46e9507372f0b1b963James Dong    VLD1    {qRow4, qRow5}, [data]! ;cr rows 0,1,2,3
1230c1bc742181ded4930842b46e9507372f0b1b963James Dong    VST1    {qRow9}, [luma@128], width
1240c1bc742181ded4930842b46e9507372f0b1b963James Dong    VLD1    {qRow6, qRow7}, [data]! ;cr rows 4,5,6,7
1250c1bc742181ded4930842b46e9507372f0b1b963James Dong    VST1    {qRow10}, [luma@128], width
1260c1bc742181ded4930842b46e9507372f0b1b963James Dong    VST1    {dRow0}, [cb@64], cwidth
1270c1bc742181ded4930842b46e9507372f0b1b963James Dong    VST1    {dRow8}, [cr@64], cwidth
1280c1bc742181ded4930842b46e9507372f0b1b963James Dong    VST1    {qRow11}, [luma@128], width
1290c1bc742181ded4930842b46e9507372f0b1b963James Dong    VST1    {dRow1}, [cb@64], cwidth
1300c1bc742181ded4930842b46e9507372f0b1b963James Dong    VST1    {dRow9}, [cr@64], cwidth
1310c1bc742181ded4930842b46e9507372f0b1b963James Dong    VST1    {qRow12}, [luma@128], width
1320c1bc742181ded4930842b46e9507372f0b1b963James Dong    VST1    {dRow2}, [cb@64], cwidth
1330c1bc742181ded4930842b46e9507372f0b1b963James Dong    VST1    {dRow10}, [cr@64], cwidth
1340c1bc742181ded4930842b46e9507372f0b1b963James Dong    VST1    {qRow13}, [luma@128], width
1350c1bc742181ded4930842b46e9507372f0b1b963James Dong    VST1    {dRow3}, [cb@64], cwidth
1360c1bc742181ded4930842b46e9507372f0b1b963James Dong    VST1    {dRow11}, [cr@64], cwidth
1370c1bc742181ded4930842b46e9507372f0b1b963James Dong    VST1    {qRow14}, [luma@128], width
1380c1bc742181ded4930842b46e9507372f0b1b963James Dong    VST1    {dRow4}, [cb@64], cwidth
1390c1bc742181ded4930842b46e9507372f0b1b963James Dong    VST1    {dRow12}, [cr@64], cwidth
1400c1bc742181ded4930842b46e9507372f0b1b963James Dong    VST1    {qRow15}, [luma]
1410c1bc742181ded4930842b46e9507372f0b1b963James Dong    VST1    {dRow5}, [cb@64], cwidth
1420c1bc742181ded4930842b46e9507372f0b1b963James Dong    VST1    {dRow13}, [cr@64], cwidth
1430c1bc742181ded4930842b46e9507372f0b1b963James Dong    VST1    {dRow6}, [cb@64], cwidth
1440c1bc742181ded4930842b46e9507372f0b1b963James Dong    VST1    {dRow14}, [cr@64], cwidth
1450c1bc742181ded4930842b46e9507372f0b1b963James Dong    VST1    {dRow7}, [cb@64]
1460c1bc742181ded4930842b46e9507372f0b1b963James Dong    VST1    {dRow15}, [cr@64]
1470c1bc742181ded4930842b46e9507372f0b1b963James Dong
1480c1bc742181ded4930842b46e9507372f0b1b963James Dong    VPOP    {q4-q7}
1490c1bc742181ded4930842b46e9507372f0b1b963James Dong    POP     {r4-r6,pc}
1500c1bc742181ded4930842b46e9507372f0b1b963James Dong    END
1510c1bc742181ded4930842b46e9507372f0b1b963James Dong
1520c1bc742181ded4930842b46e9507372f0b1b963James Dong
153