1 @ 2 @ Copyright (C) 2009 The Android Open Source Project 3 @ 4 @ Licensed under the Apache License, Version 2.0 (the "License"); 5 @ you may not use this file except in compliance with the License. 6 @ You may obtain a copy of the License at 7 @ 8 @ http://www.apache.org/licenses/LICENSE-2.0 9 @ 10 @ Unless required by applicable law or agreed to in writing, software 11 @ distributed under the License is distributed on an "AS IS" BASIS, 12 @ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 @ See the License for the specific language governing permissions and 14 @ limitations under the License. 15 @ 16 17 #include "asm_common.S" 18 19 preserve8 20 21 .arm 22 .text 23 24 /* Input / output registers */ 25 #define pStrmData r0 26 #define numBits r1 27 #define readBits r2 28 #define strmBuffSize r3 29 #define pStrmBuffStart r1 30 #define pStrmCurrPos r2 31 #define bitPosInWord r1 32 33 /* Input / output registers */ 34 35 36 37 /*------------------------------------------------------------------------------ 38 39 Function: h264bsdFlushBits 40 41 Functional description: 42 43 Inputs: 44 45 Outputs: 46 47 Returns: 48 49 ------------------------------------------------------------------------------*/ 50 function h264bsdFlushBits, export=1 51 52 LDR readBits, [pStrmData, #0x10] 53 LDR strmBuffSize, [pStrmData, #0xC] 54 55 ADD readBits, readBits, numBits 56 AND bitPosInWord, readBits, #7 57 58 STR readBits, [pStrmData, #0x10] 59 STR bitPosInWord, [pStrmData, #0x8] 60 61 LDR pStrmBuffStart, [pStrmData, #0x0] 62 63 CMP readBits, strmBuffSize, LSL #3 64 65 BHI end_of_stream 66 67 ADD pStrmCurrPos, pStrmBuffStart, readBits, LSR #3 68 STR pStrmCurrPos, [pStrmData, #0x4] 69 MOV r0, #0 70 BX lr 71 72 end_of_stream: 73 MVN r0, #0 74 BX lr 75 76 endfunction 77 78 79