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