omxVCM4P2_QuantInvIntra_I_s.s revision 78e52bfac041d71ce53b5b13c2abf78af742b09d
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_QuantInvIntra_I_s.s
19; * OpenMAX DL: v1.0.2
20; * Revision:   9641
21; * Date:       Thursday, February 7, 2008
22; *
23; *
24; *
25; *
26; * Description:
27; * Contains modules for inter reconstruction
28; *
29; *
30; *
31; *
32; *
33; *
34; * Function: omxVCM4P2_QuantInvIntra_I
35; *
36; * Description:
37; * Performs inverse quantization on intra/inter coded block.
38; * This function supports bits_per_pixel = 8. Mismatch control
39; * is performed for the first MPEG-4 mode inverse quantization method.
40; * The output coefficients are clipped to the range: [-2048, 2047].
41; * Mismatch control is performed for the first inverse quantization method.
42; *
43; * Remarks:
44; *
45; * Parameters:
46; * [in]    pSrcDst        pointer to the input (quantized) intra/inter block. Must be 16-byte aligned.
47; * [in]    QP            quantization parameter (quantiser_scale)
48; * [in]    videoComp          (Intra version only.) Video component type of the
49; *                    current block. Takes one of the following flags:
50; *                    OMX_VC_LUMINANCE, OMX_VC_CHROMINANCE,
51; *                    OMX_VC_ALPHA.
52; * [in]    shortVideoHeader  a flag indicating presence of short_video_header;
53; *                           shortVideoHeader==1 selects linear intra DC mode,
54; *                    and shortVideoHeader==0 selects nonlinear intra DC mode.
55; * [out]    pSrcDst        pointer to the output (dequantized) intra/inter block.  Must be 16-byte aligned.
56; *
57; * Return Value:
58; * OMX_Sts_NoErr - no error
59; * OMX_Sts_BadArgErr - bad arguments
60; *    -    If pSrcDst is NULL or is not 16-byte aligned.
61; *      or
62; *    - If QP <= 0.
63; *      or
64; *    - videoComp is none of OMX_VC_LUMINANCE, OMX_VC_CHROMINANCE and OMX_VC_ALPHA.
65; *
66
67
68   INCLUDE omxtypes_s.h
69   INCLUDE armCOMM_s.h
70
71   M_VARIANTS ARM1136JS
72
73
74   IMPORT        armVCM4P2_DCScaler
75
76
77
78     IF ARM1136JS
79
80;//Input Arguments
81pSrcDst            RN 0
82QP                 RN 1
83videoComp          RN 2
84shortVideoHeader   RN 3
85
86;//Local Variables
87Return             RN 0
88dcScaler           RN 4
89temp               RN 12
90index              RN 6
91
92tempVal21          RN 4
93tempVal43          RN 5
94QP1                RN 6
95X2                 RN 7
96X3                 RN 14
97Result1            RN 8
98Result2            RN 9
99two                RN 10
100Count              RN 11
101
102
103
104
105    M_START omxVCM4P2_QuantInvIntra_I,r11
106
107
108
109        ;// Perform Inverse Quantization for DC coefficient
110
111        TEQ       shortVideoHeader,#0      ;// Test if short Video Header flag =0
112        MOVNE     dcScaler,#8              ;// if shortVideoHeader is non zero dcScaler=8
113        BNE       calDCVal
114        LDR       index, =armVCM4P2_DCScaler
115      ADD       index,index,videoComp,LSL #5
116      LDRB      dcScaler,[index,QP]
117
118
119        ;//M_CalDCScalar  shortVideoHeader,videoComp, QP
120
121calDCVal
122
123        LDRH     temp,[pSrcDst]
124        SMULBB   temp,temp,dcScaler       ;// dcCoeff = dcScaler * Quantized DC coefficient(from memory)
125        SSAT     temp,#12,temp            ;// Saturating to 12 bits
126
127
128        MOV      Count,#64
129        TST      QP,#1
130        LDRD     tempVal21,[pSrcDst]      ;// Loads first two values of pSrcDst to tempVal21,
131                                          ;// next two values to tempVal43
132        SUBEQ    QP1,QP,#1                ;// QP1=QP if QP is odd , QP1=QP-1 if QP is even
133        MOVNE    QP1,QP
134        MOV      two,#2
135
136
137
138
139
140Loop
141
142
143        SMULBB   X2,tempVal21,two         ;// X2= first val(lower 16 bits of tampVal21)*2
144        CMP      X2,#0
145
146        RSBLT    X2,X2,#0                 ;// X2=absoluteval(first val)
147        SMLABBNE X2,QP,X2,QP1             ;// X2=2*absval(first val)*QP+QP if QP is odd
148                                          ;// X2=2*absval(first val)*QP+QP-1 if QP is even
149        SMULTB   X3,tempVal21,two         ;// X3= second val(top 16 bits of tampVal21)*2
150        RSBLT    X2,X2,#0
151
152        CMP      X3,#0
153
154        RSBLT    X3,X3,#0
155        SMLABBNE X3,QP,X3,QP1
156
157        RSBLT    X3,X3,#0
158        PKHBT    Result1,X2,X3,LSL #16    ;// Result1[0-15]=X2[0-15],Result1[16-31]=X3[16-31]
159        SMULBB   X2,tempVal43,two         ;// X2= first val(lower 16 bits of tampVal43)*2
160        SSAT16   Result1,#12,Result1      ;// clip to range [-2048,2047]
161        CMP      X2,#0
162
163
164
165        RSBLE    X2,X2,#0
166        SMLABBNE X2,QP,X2,QP1
167        SMULTB   X3,tempVal43,two         ;// X2= first val(top 16 bits of tampVal21)*2
168        RSBLT    X2,X2,#0
169        CMP      X3,#0
170
171        LDRD     tempVal21,[pSrcDst,#8]   ;// Load next four Values to tempVal21,tempVal43
172
173        RSBLT    X3,X3,#0
174        SMLABBNE X3,QP,X3,QP1
175        RSBLT    X3,X3,#0
176        PKHBT    Result2,X2,X3,LSL #16    ;// Result2[0-15]=X2[0-15],Result2[16-31]=X3[16-31]
177        SSAT16   Result2,#12,Result2      ;// clip to range [-2048,2047]
178
179        SUBS     Count,Count,#4           ;// Decrement Count by 4 and continue if it has not reached 0
180        STRD     Result1,[pSrcDst],#8     ;// Store Double words and increment the pointer to point the next store address
181
182
183
184        BGT      Loop
185
186        SUB      pSrcDst,pSrcDst,#128
187
188        ;// Storing the Inverse Quantized DC coefficient
189
190        STRH     temp,[pSrcDst],#2
191
192
193
194        MOV      Return,#OMX_Sts_NoErr
195
196
197
198
199        M_END
200        ENDIF
201        END
202
203