178e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;//
278e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;// Copyright (C) 2007-2008 ARM Limited
378e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;//
478e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;// Licensed under the Apache License, Version 2.0 (the "License");
578e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;// you may not use this file except in compliance with the License.
678e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;// You may obtain a copy of the License at
778e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;//
878e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;//      http://www.apache.org/licenses/LICENSE-2.0
978e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;//
1078e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;// Unless required by applicable law or agreed to in writing, software
1178e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;// distributed under the License is distributed on an "AS IS" BASIS,
1278e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1378e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;// See the License for the specific language governing permissions and
1478e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;// limitations under the License.
1578e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;//
160c1bc742181ded4930842b46e9507372f0b1b963James Dong;/**
170c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
180c1bc742181ded4930842b46e9507372f0b1b963James Dong; * File Name:  omxVCM4P2_QuantInvInter_I_s.s
190c1bc742181ded4930842b46e9507372f0b1b963James Dong; * OpenMAX DL: v1.0.2
200c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Revision:   9641
210c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Date:       Thursday, February 7, 2008
220c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
230c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
240c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
250c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
260c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Description:
270c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Contains modules for inter reconstruction
280c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
290c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
300c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
310c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
320c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
330c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Function: omxVCM4P2_QuantInvInter_I
340c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
350c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Description:
360c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Performs inverse quantization on intra/inter coded block.
370c1bc742181ded4930842b46e9507372f0b1b963James Dong; * This function supports bits_per_pixel = 8. Mismatch control
380c1bc742181ded4930842b46e9507372f0b1b963James Dong; * is performed for the first MPEG-4 mode inverse quantization method.
390c1bc742181ded4930842b46e9507372f0b1b963James Dong; * The output coefficients are clipped to the range: [-2048, 2047].
400c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Mismatch control is performed for the first inverse quantization method.
410c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
420c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Remarks:
430c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
440c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Parameters:
450c1bc742181ded4930842b46e9507372f0b1b963James Dong; * [in] pSrcDst          pointer to the input (quantized) intra/inter block. Must be 16-byte aligned.
460c1bc742181ded4930842b46e9507372f0b1b963James Dong; * [in] QP              quantization parameter (quantiser_scale)
470c1bc742181ded4930842b46e9507372f0b1b963James Dong; * [in] videoComp      (Intra version only.) Video component type of the
480c1bc742181ded4930842b46e9507372f0b1b963James Dong; *                  current block. Takes one of the following flags:
490c1bc742181ded4930842b46e9507372f0b1b963James Dong; *                  OMX_VC_LUMINANCE, OMX_VC_CHROMINANCE,
500c1bc742181ded4930842b46e9507372f0b1b963James Dong; *                  OMX_VC_ALPHA.
510c1bc742181ded4930842b46e9507372f0b1b963James Dong; * [in] shortVideoHeader a flag indicating presence of short_video_header;
520c1bc742181ded4930842b46e9507372f0b1b963James Dong; *                       shortVideoHeader==1 selects linear intra DC mode,
530c1bc742181ded4930842b46e9507372f0b1b963James Dong; *                  and shortVideoHeader==0 selects nonlinear intra DC mode.
540c1bc742181ded4930842b46e9507372f0b1b963James Dong; * [out]    pSrcDst      pointer to the output (dequantized) intra/inter block.  Must be 16-byte aligned.
550c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
560c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Return Value:
570c1bc742181ded4930842b46e9507372f0b1b963James Dong; * OMX_Sts_NoErr - no error
580c1bc742181ded4930842b46e9507372f0b1b963James Dong; * OMX_Sts_BadArgErr - bad arguments
590c1bc742181ded4930842b46e9507372f0b1b963James Dong; *    - If pSrcDst is NULL or is not 16-byte aligned.
600c1bc742181ded4930842b46e9507372f0b1b963James Dong; *      or
610c1bc742181ded4930842b46e9507372f0b1b963James Dong; *    - If QP <= 0.
620c1bc742181ded4930842b46e9507372f0b1b963James Dong; *      or
630c1bc742181ded4930842b46e9507372f0b1b963James Dong; *    - videoComp is none of OMX_VC_LUMINANCE, OMX_VC_CHROMINANCE and OMX_VC_ALPHA.
640c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
650c1bc742181ded4930842b46e9507372f0b1b963James Dong; */
660c1bc742181ded4930842b46e9507372f0b1b963James Dong
670c1bc742181ded4930842b46e9507372f0b1b963James Dong   INCLUDE omxtypes_s.h
680c1bc742181ded4930842b46e9507372f0b1b963James Dong   INCLUDE armCOMM_s.h
690c1bc742181ded4930842b46e9507372f0b1b963James Dong
700c1bc742181ded4930842b46e9507372f0b1b963James Dong   M_VARIANTS ARM1136JS
710c1bc742181ded4930842b46e9507372f0b1b963James Dong
720c1bc742181ded4930842b46e9507372f0b1b963James Dong
730c1bc742181ded4930842b46e9507372f0b1b963James Dong
740c1bc742181ded4930842b46e9507372f0b1b963James Dong     IF ARM1136JS
750c1bc742181ded4930842b46e9507372f0b1b963James Dong
760c1bc742181ded4930842b46e9507372f0b1b963James Dong;//Input Arguments
770c1bc742181ded4930842b46e9507372f0b1b963James DongpSrcDst            RN 0
780c1bc742181ded4930842b46e9507372f0b1b963James DongQP                 RN 1
790c1bc742181ded4930842b46e9507372f0b1b963James Dong
800c1bc742181ded4930842b46e9507372f0b1b963James Dong;//Local Variables
810c1bc742181ded4930842b46e9507372f0b1b963James DongReturn             RN 0
820c1bc742181ded4930842b46e9507372f0b1b963James DongCount              RN 4
830c1bc742181ded4930842b46e9507372f0b1b963James DongtempVal21          RN 2
840c1bc742181ded4930842b46e9507372f0b1b963James DongtempVal43          RN 3
850c1bc742181ded4930842b46e9507372f0b1b963James DongQP1                RN 5
860c1bc742181ded4930842b46e9507372f0b1b963James DongX2                 RN 6
870c1bc742181ded4930842b46e9507372f0b1b963James DongX3                 RN 14
880c1bc742181ded4930842b46e9507372f0b1b963James DongResult1            RN 8
890c1bc742181ded4930842b46e9507372f0b1b963James DongResult2            RN 9
900c1bc742181ded4930842b46e9507372f0b1b963James Dongtwo                RN 7
910c1bc742181ded4930842b46e9507372f0b1b963James Dong
920c1bc742181ded4930842b46e9507372f0b1b963James Dong    M_START omxVCM4P2_QuantInvInter_I,r9
930c1bc742181ded4930842b46e9507372f0b1b963James Dong
940c1bc742181ded4930842b46e9507372f0b1b963James Dong        MOV      Count,#64
950c1bc742181ded4930842b46e9507372f0b1b963James Dong        TST      QP,#1
960c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDRD     tempVal21,[pSrcDst]      ;// Loads first two values of pSrcDst to tempVal21,
970c1bc742181ded4930842b46e9507372f0b1b963James Dong                                          ;// next two values to tempVal43
980c1bc742181ded4930842b46e9507372f0b1b963James Dong        SUBEQ    QP1,QP,#1                ;// QP1=QP if QP is odd , QP1=QP-1 if QP is even
990c1bc742181ded4930842b46e9507372f0b1b963James Dong        MOVNE    QP1,QP
1000c1bc742181ded4930842b46e9507372f0b1b963James Dong        MOV      two,#2
1010c1bc742181ded4930842b46e9507372f0b1b963James Dong
1020c1bc742181ded4930842b46e9507372f0b1b963James Dong
1030c1bc742181ded4930842b46e9507372f0b1b963James Dong
1040c1bc742181ded4930842b46e9507372f0b1b963James DongLoop
1050c1bc742181ded4930842b46e9507372f0b1b963James Dong
1060c1bc742181ded4930842b46e9507372f0b1b963James Dong
1070c1bc742181ded4930842b46e9507372f0b1b963James Dong        SMULBB   X2,tempVal21,two         ;// X2= first val(lower 16 bits of tampVal21)*2
1080c1bc742181ded4930842b46e9507372f0b1b963James Dong        CMP      X2,#0
1090c1bc742181ded4930842b46e9507372f0b1b963James Dong
1100c1bc742181ded4930842b46e9507372f0b1b963James Dong        RSBLT    X2,X2,#0                 ;// X2=absoluteval(first val)
1110c1bc742181ded4930842b46e9507372f0b1b963James Dong        SMLABBNE X2,QP,X2,QP1             ;// X2=2*absval(first val)*QP+QP if QP is odd
1120c1bc742181ded4930842b46e9507372f0b1b963James Dong                                          ;// X2=2*absval(first val)*QP+QP-1 if QP is even
1130c1bc742181ded4930842b46e9507372f0b1b963James Dong        SMULTB   X3,tempVal21,two         ;// X3= second val(top 16 bits of tampVal21)*2
1140c1bc742181ded4930842b46e9507372f0b1b963James Dong        RSBLT    X2,X2,#0
1150c1bc742181ded4930842b46e9507372f0b1b963James Dong
1160c1bc742181ded4930842b46e9507372f0b1b963James Dong        CMP      X3,#0
1170c1bc742181ded4930842b46e9507372f0b1b963James Dong
1180c1bc742181ded4930842b46e9507372f0b1b963James Dong        RSBLT    X3,X3,#0
1190c1bc742181ded4930842b46e9507372f0b1b963James Dong        SMLABBNE X3,QP,X3,QP1
1200c1bc742181ded4930842b46e9507372f0b1b963James Dong
1210c1bc742181ded4930842b46e9507372f0b1b963James Dong        RSBLT    X3,X3,#0
1220c1bc742181ded4930842b46e9507372f0b1b963James Dong        PKHBT    Result1,X2,X3,LSL #16    ;// Result1[0-15]=X2[0-15],Result1[16-31]=X3[16-31]
1230c1bc742181ded4930842b46e9507372f0b1b963James Dong        SMULBB   X2,tempVal43,two         ;// X2= first val(lower 16 bits of tampVal43)*2
1240c1bc742181ded4930842b46e9507372f0b1b963James Dong        SSAT16   Result1,#12,Result1      ;// clip to range [-2048,2047]
1250c1bc742181ded4930842b46e9507372f0b1b963James Dong        CMP      X2,#0
1260c1bc742181ded4930842b46e9507372f0b1b963James Dong
1270c1bc742181ded4930842b46e9507372f0b1b963James Dong
1280c1bc742181ded4930842b46e9507372f0b1b963James Dong
1290c1bc742181ded4930842b46e9507372f0b1b963James Dong        RSBLE    X2,X2,#0
1300c1bc742181ded4930842b46e9507372f0b1b963James Dong        SMLABBNE X2,QP,X2,QP1
1310c1bc742181ded4930842b46e9507372f0b1b963James Dong        SMULTB   X3,tempVal43,two         ;// X2= first val(top 16 bits of tampVal21)*2
1320c1bc742181ded4930842b46e9507372f0b1b963James Dong        RSBLT    X2,X2,#0
1330c1bc742181ded4930842b46e9507372f0b1b963James Dong        CMP      X3,#0
1340c1bc742181ded4930842b46e9507372f0b1b963James Dong
1350c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDRD     tempVal21,[pSrcDst,#8]   ;// Load next four Values to tempVal21,tempVal43
1360c1bc742181ded4930842b46e9507372f0b1b963James Dong
1370c1bc742181ded4930842b46e9507372f0b1b963James Dong        RSBLT    X3,X3,#0
1380c1bc742181ded4930842b46e9507372f0b1b963James Dong        SMLABBNE X3,QP,X3,QP1
1390c1bc742181ded4930842b46e9507372f0b1b963James Dong        RSBLT    X3,X3,#0
1400c1bc742181ded4930842b46e9507372f0b1b963James Dong        PKHBT    Result2,X2,X3,LSL #16    ;// Result2[0-15]=X2[0-15],Result2[16-31]=X3[0-15]
1410c1bc742181ded4930842b46e9507372f0b1b963James Dong        SSAT16   Result2,#12,Result2      ;// clip to range [-2048,2047]
1420c1bc742181ded4930842b46e9507372f0b1b963James Dong
1430c1bc742181ded4930842b46e9507372f0b1b963James Dong        SUBS     Count,Count,#4           ;// Decrement Count by 4 and continue if it has not reached 0
1440c1bc742181ded4930842b46e9507372f0b1b963James Dong        STRD     Result1,[pSrcDst],#8     ;// Store Double words and increment the pointer to point the next store address
1450c1bc742181ded4930842b46e9507372f0b1b963James Dong
1460c1bc742181ded4930842b46e9507372f0b1b963James Dong
1470c1bc742181ded4930842b46e9507372f0b1b963James Dong
1480c1bc742181ded4930842b46e9507372f0b1b963James Dong        BGT      Loop
1490c1bc742181ded4930842b46e9507372f0b1b963James Dong
1500c1bc742181ded4930842b46e9507372f0b1b963James Dong        MOV      Return,#OMX_Sts_NoErr
1510c1bc742181ded4930842b46e9507372f0b1b963James Dong
1520c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_END
1530c1bc742181ded4930842b46e9507372f0b1b963James Dong        ENDIF
1540c1bc742181ded4930842b46e9507372f0b1b963James Dong        END
1550c1bc742181ded4930842b46e9507372f0b1b963James Dong
156