1;//
2;// Copyright (C) 2007-2008 ARM Limited
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; *
18; * File Name:  omxVCM4P2_QuantInvInter_I_s.s
19; * OpenMAX DL: v1.0.2
20; * Revision:   12290
21; * Date:       Wednesday, April 9, 2008
22; *
23; *
24; *
25; *
26; * Description:
27; * Contains modules for inter reconstruction
28; *
29; *
30; *
31; *
32; *
33; * Function: omxVCM4P2_QuantInvInter_I
34; *
35; * Description:
36; * Performs inverse quantization on intra/inter coded block.
37; * This function supports bits_per_pixel = 8. Mismatch control
38; * is performed for the first MPEG-4 mode inverse quantization method.
39; * The output coefficients are clipped to the range: [-2048, 2047].
40; * Mismatch control is performed for the first inverse quantization method.
41; *
42; * Remarks:
43; *
44; * Parameters:
45; * [in] pSrcDst          pointer to the input (quantized) intra/inter block. Must be 16-byte aligned.
46; * [in] QP              quantization parameter (quantiser_scale)
47; * [in] videoComp      (Intra version only.) Video component type of the
48; *                  current block. Takes one of the following flags:
49; *                  OMX_VC_LUMINANCE, OMX_VC_CHROMINANCE,
50; *                  OMX_VC_ALPHA.
51; * [in] shortVideoHeader a flag indicating presence of short_video_header;
52; *                       shortVideoHeader==1 selects linear intra DC mode,
53; *                  and shortVideoHeader==0 selects nonlinear intra DC mode.
54; * [out]    pSrcDst      pointer to the output (dequantized) intra/inter block.  Must be 16-byte aligned.
55; *
56; * Return Value:
57; * OMX_Sts_NoErr - no error
58; * OMX_Sts_BadArgErr - bad arguments
59; *    - If pSrcDst is NULL or is not 16-byte aligned.
60; *      or
61; *    - If QP <= 0.
62; *      or
63; *    - videoComp is none of OMX_VC_LUMINANCE, OMX_VC_CHROMINANCE and OMX_VC_ALPHA.
64; *
65; */
66
67   INCLUDE omxtypes_s.h
68   INCLUDE armCOMM_s.h
69
70   M_VARIANTS CortexA8
71
72     IF CortexA8
73
74
75;//Input Arguments
76pSrcDst            RN 0
77QP                 RN 1
78
79
80;//Local Variables
81Count              RN 3
82doubleQP           RN 4
83Return             RN 0
84;// Neon registers
85
86
87dQP10              DN D0.S32[0]
88qQP1               QN Q0.S32
89
90dQP1               DN D0.S16
91dMinusQP1          DN D1.S16
92
93dCoeff0            DN D2.S16
94dCoeff1            DN D3.S16
95
96qResult0           QN Q3.S32
97dResult0           DN D7.S16
98qSign0             QN Q3.S32
99dSign0             DN D6.S16
100
101qResult1           QN Q4.S32
102dResult1           DN D8.S16
103qSign1             QN Q4.S32
104dSign1             DN D8.S16
105
106d2QP0              DN D10.S32[0]
107q2QP0              QN Q5.S32
108d2QP               DN D10.S16
109
110dZero0             DN D11.S16
111dZero1             DN D12.S16
112dConst0            DN D13.S16
113
114
115     M_START omxVCM4P2_QuantInvInter_I,r4,d13
116
117
118
119         ADD      doubleQP,QP,QP                   ;// doubleQP= 2*QP
120         VMOV     d2QP0,doubleQP
121         VDUP     q2QP0,d2QP0                      ;// Move doubleQP in to a scalar
122         TST      QP,#1
123         VLD1     {dCoeff0,dCoeff1},[pSrcDst]      ;// Load first 8 values to Coeff0,Coeff1
124         SUBEQ    QP,QP,#1
125         VMOV     dQP10,QP                         ;// If QP is even then QP1=QP-1 else QP1=QP
126         MOV      Count,#64
127         VDUP     qQP1,dQP10                       ;// Duplicate tempResult with QP1
128         VSHRN    d2QP,q2QP0,#0
129         VEOR     dConst0,dConst0,dConst0
130         VSHRN    dQP1,qQP1,#0                     ;// QP1 truncated to 16 bits
131         VSUB     dMinusQP1,dConst0,dQP1           ;// dMinusQP1=-QP1
132
133Loop
134
135        ;//Performing Inverse Quantization
136
137         VCLT     dSign0,dCoeff0, #0               ;// Compare Coefficient 0 against 0
138         VCLT     dSign1,dCoeff1, #0               ;// Compare Coefficient 1 against 0
139         VCEQ     dZero0,dCoeff0,#0                ;// Compare Coefficient 0 against zero
140         VBSL     dSign0,dMinusQP1,dQP1            ;// dSign0 = -QP1 if Coeff0< 0 else QP1
141         VCEQ     dZero1,dCoeff1,#0                ;// Compare Coefficient 1 against zero
142         VBSL     dSign1,dMinusQP1,dQP1            ;// dSign1 = -QP1 if Coeff1< 0 else QP1
143         VMOVL    qSign0,dSign0                    ;// Sign extend qSign0 to 32 bits
144         VMOVL    qSign1,dSign1
145         VMLAL    qResult0,dCoeff0,d2QP            ;// qResult0[i]= qCoeff0[i]+qCoeff0[i]*(-2) if Coeff <0
146                                                   ;// qResult0[i]= qCoeff0[i]                 if Coeff >=0
147         VMLAL    qResult1,dCoeff1,d2QP            ;// qResult1[i]= qCoeff1[i]+qCoeff1[i]*(-2) if Coeff <0
148                                                   ;// qResult1[i]= qCoeff1[i]                 if Coeff >=0
149         ;// Clip Result to [-2048,2047]
150
151         VQSHL    qResult0,qResult0,#20            ;// clip to [-2048,2047]
152         VQSHL    qResult1,qResult1,#20
153
154         VSHR     qResult0,qResult0,#4
155         VSHR     qResult1,qResult1,#4
156         VSHRN    dResult0,qResult0,#16            ;// Narrow the clipped Value to Halfword
157         VSHRN    dResult1,qResult1,#16
158         VBIT     dResult0,dConst0,dZero0
159         VBIT     dResult1,dConst0,dZero1
160
161         VST1     {dResult0,dResult1},[pSrcDst]!   ;// Store the result
162         SUBS     Count,Count,#8
163         VLD1     {dCoeff0,dCoeff1},[pSrcDst]
164
165
166         BGT      Loop
167
168         MOV      Return,#OMX_Sts_NoErr
169
170
171         M_END
172         ENDIF
173
174
175        END
176
177