omxVCM4P2_QuantInvInter_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_QuantInvInter_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; * 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 ARM1136JS
71
72
73
74     IF ARM1136JS
75
76;//Input Arguments
77pSrcDst            RN 0
78QP                 RN 1
79
80;//Local Variables
81Return             RN 0
82Count              RN 4
83tempVal21          RN 2
84tempVal43          RN 3
85QP1                RN 5
86X2                 RN 6
87X3                 RN 14
88Result1            RN 8
89Result2            RN 9
90two                RN 7
91
92    M_START omxVCM4P2_QuantInvInter_I,r9
93
94        MOV      Count,#64
95        TST      QP,#1
96        LDRD     tempVal21,[pSrcDst]      ;// Loads first two values of pSrcDst to tempVal21,
97                                          ;// next two values to tempVal43
98        SUBEQ    QP1,QP,#1                ;// QP1=QP if QP is odd , QP1=QP-1 if QP is even
99        MOVNE    QP1,QP
100        MOV      two,#2
101
102
103
104Loop
105
106
107        SMULBB   X2,tempVal21,two         ;// X2= first val(lower 16 bits of tampVal21)*2
108        CMP      X2,#0
109
110        RSBLT    X2,X2,#0                 ;// X2=absoluteval(first val)
111        SMLABBNE X2,QP,X2,QP1             ;// X2=2*absval(first val)*QP+QP if QP is odd
112                                          ;// X2=2*absval(first val)*QP+QP-1 if QP is even
113        SMULTB   X3,tempVal21,two         ;// X3= second val(top 16 bits of tampVal21)*2
114        RSBLT    X2,X2,#0
115
116        CMP      X3,#0
117
118        RSBLT    X3,X3,#0
119        SMLABBNE X3,QP,X3,QP1
120
121        RSBLT    X3,X3,#0
122        PKHBT    Result1,X2,X3,LSL #16    ;// Result1[0-15]=X2[0-15],Result1[16-31]=X3[16-31]
123        SMULBB   X2,tempVal43,two         ;// X2= first val(lower 16 bits of tampVal43)*2
124        SSAT16   Result1,#12,Result1      ;// clip to range [-2048,2047]
125        CMP      X2,#0
126
127
128
129        RSBLE    X2,X2,#0
130        SMLABBNE X2,QP,X2,QP1
131        SMULTB   X3,tempVal43,two         ;// X2= first val(top 16 bits of tampVal21)*2
132        RSBLT    X2,X2,#0
133        CMP      X3,#0
134
135        LDRD     tempVal21,[pSrcDst,#8]   ;// Load next four Values to tempVal21,tempVal43
136
137        RSBLT    X3,X3,#0
138        SMLABBNE X3,QP,X3,QP1
139        RSBLT    X3,X3,#0
140        PKHBT    Result2,X2,X3,LSL #16    ;// Result2[0-15]=X2[0-15],Result2[16-31]=X3[0-15]
141        SSAT16   Result2,#12,Result2      ;// clip to range [-2048,2047]
142
143        SUBS     Count,Count,#4           ;// Decrement Count by 4 and continue if it has not reached 0
144        STRD     Result1,[pSrcDst],#8     ;// Store Double words and increment the pointer to point the next store address
145
146
147
148        BGT      Loop
149
150        MOV      Return,#OMX_Sts_NoErr
151
152        M_END
153        ENDIF
154        END
155
156