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    REQUIRE8
18    PRESERVE8
19
20    AREA    |.text|, CODE
21
22    EXPORT h264bsdFlushBits
23
24; Input / output registers
25pStrmData       RN  0
26numBits         RN  1
27readBits        RN  2
28strmBuffSize    RN  3
29pStrmBuffStart  RN  1
30pStrmCurrPos    RN  2
31bitPosInWord    RN  1
32
33; -- NEON 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
51h264bsdFlushBits
52;//    PUSH     {r4-r6,lr}
53
54    LDR readBits, [pStrmData, #0x10]
55    LDR strmBuffSize, [pStrmData, #0xC]
56
57    ADD readBits, readBits, numBits
58    AND bitPosInWord, readBits, #7
59
60    STR readBits, [pStrmData, #0x10]
61    STR bitPosInWord, [pStrmData, #0x8]
62
63    LDR pStrmBuffStart, [pStrmData, #0x0]
64
65    CMP readBits, strmBuffSize, LSL #3
66
67    BHI end_of_stream
68
69    ADD pStrmCurrPos, pStrmBuffStart, readBits, LSR #3
70    STR pStrmCurrPos, [pStrmData, #0x4]
71    MOV r0, #0
72    BX  lr
73;//    POP      {r4-r6,pc}
74
75end_of_stream
76    MVN r0, #0
77    BX  lr
78;//    POP      {r4-r6,pc}
79
80    END
81
82
83