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_DecodeVLCZigzag_Inter_s.s
190c1bc742181ded4930842b46e9507372f0b1b963James Dong; * OpenMAX DL: v1.0.2
200c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Revision:   12290
210c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Date:       Wednesday, April 9, 2008
220c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
230c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
240c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
250c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
260c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Description:
270c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Contains modules for zigzag scanning and VLC decoding
280c1bc742181ded4930842b46e9507372f0b1b963James Dong; * for inter block.
290c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
300c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
310c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
320c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Function: omxVCM4P2_DecodeVLCZigzag_Inter
330c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
340c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Description:
350c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Performs VLC decoding and inverse zigzag scan for one inter coded block.
360c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
370c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Remarks:
380c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
390c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Parameters:
400c1bc742181ded4930842b46e9507372f0b1b963James Dong; * [in]    ppBitStream        pointer to the pointer to the current byte in
410c1bc742181ded4930842b46e9507372f0b1b963James Dong; *                    the bitstream buffer
420c1bc742181ded4930842b46e9507372f0b1b963James Dong; * [in]    pBitOffset        pointer to the bit position in the byte pointed
430c1bc742181ded4930842b46e9507372f0b1b963James Dong; *                    to by *ppBitStream. *pBitOffset is valid within    [0-7].
440c1bc742181ded4930842b46e9507372f0b1b963James Dong; * [in] shortVideoHeader     binary flag indicating presence of short_video_header;
450c1bc742181ded4930842b46e9507372f0b1b963James Dong; *                           escape modes 0-3 are used if shortVideoHeader==0,
460c1bc742181ded4930842b46e9507372f0b1b963James Dong; *                           and escape mode 4 is used when shortVideoHeader==1.
470c1bc742181ded4930842b46e9507372f0b1b963James Dong; * [out]    ppBitStream        *ppBitStream is updated after the block is
480c1bc742181ded4930842b46e9507372f0b1b963James Dong; *                    decoded, so that it points to the current byte
490c1bc742181ded4930842b46e9507372f0b1b963James Dong; *                    in the bit stream buffer
500c1bc742181ded4930842b46e9507372f0b1b963James Dong; * [out]    pBitOffset        *pBitOffset is updated so that it points to the
510c1bc742181ded4930842b46e9507372f0b1b963James Dong; *                    current bit position in the byte pointed by
520c1bc742181ded4930842b46e9507372f0b1b963James Dong; *                    *ppBitStream
530c1bc742181ded4930842b46e9507372f0b1b963James Dong; * [out]    pDst            pointer to the coefficient buffer of current
540c1bc742181ded4930842b46e9507372f0b1b963James Dong; *                    block. Must be 16-byte aligned
550c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
560c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Return Value:
570c1bc742181ded4930842b46e9507372f0b1b963James Dong; * OMX_Sts_BadArgErr - bad arguments
580c1bc742181ded4930842b46e9507372f0b1b963James Dong; *   -At least one of the following pointers is NULL: ppBitStream, *ppBitStream, pBitOffset, pDst, or
590c1bc742181ded4930842b46e9507372f0b1b963James Dong; *   -pDst is not 16-byte aligned, or
600c1bc742181ded4930842b46e9507372f0b1b963James Dong; *   -*pBitOffset exceeds [0,7].
610c1bc742181ded4930842b46e9507372f0b1b963James Dong; * OMX_Sts_Err - status error
620c1bc742181ded4930842b46e9507372f0b1b963James Dong; *   -At least one mark bit is equal to zero
630c1bc742181ded4930842b46e9507372f0b1b963James Dong; *   -Encountered an illegal stream code that cannot be found in the VLC table
640c1bc742181ded4930842b46e9507372f0b1b963James Dong; *   -Encountered and illegal code in the VLC FLC table
650c1bc742181ded4930842b46e9507372f0b1b963James Dong; *   -The number of coefficients is greater than 64
660c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
670c1bc742181ded4930842b46e9507372f0b1b963James Dong; */
680c1bc742181ded4930842b46e9507372f0b1b963James Dong
690c1bc742181ded4930842b46e9507372f0b1b963James Dong
700c1bc742181ded4930842b46e9507372f0b1b963James Dong      INCLUDE omxtypes_s.h
710c1bc742181ded4930842b46e9507372f0b1b963James Dong      INCLUDE armCOMM_s.h
720c1bc742181ded4930842b46e9507372f0b1b963James Dong      INCLUDE armCOMM_BitDec_s.h
730c1bc742181ded4930842b46e9507372f0b1b963James Dong
740c1bc742181ded4930842b46e9507372f0b1b963James Dong
750c1bc742181ded4930842b46e9507372f0b1b963James Dong      M_VARIANTS ARM1136JS
760c1bc742181ded4930842b46e9507372f0b1b963James Dong
770c1bc742181ded4930842b46e9507372f0b1b963James Dong
780c1bc742181ded4930842b46e9507372f0b1b963James Dong
790c1bc742181ded4930842b46e9507372f0b1b963James Dong
800c1bc742181ded4930842b46e9507372f0b1b963James Dong
810c1bc742181ded4930842b46e9507372f0b1b963James Dong     IF ARM1136JS
820c1bc742181ded4930842b46e9507372f0b1b963James Dong
830c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Import various tables needed for the function
840c1bc742181ded4930842b46e9507372f0b1b963James Dong
850c1bc742181ded4930842b46e9507372f0b1b963James Dong
860c1bc742181ded4930842b46e9507372f0b1b963James Dong        IMPORT          armVCM4P2_InterVlcL0L1             ;// Contains optimized and packed VLC Tables for both Last =1 and last=0
870c1bc742181ded4930842b46e9507372f0b1b963James Dong                                                               ;// Packed in Run:Level:Last format
880c1bc742181ded4930842b46e9507372f0b1b963James Dong        IMPORT          armVCM4P2_InterL0L1LMAX            ;// Contains LMAX table entries with both Last=0 and Last=1
890c1bc742181ded4930842b46e9507372f0b1b963James Dong        IMPORT          armVCM4P2_InterL0L1RMAX            ;// Contains RMAX table entries with both Last=0 and Last=1
900c1bc742181ded4930842b46e9507372f0b1b963James Dong        IMPORT          armVCM4P2_aClassicalZigzagScan     ;// contains classical Zigzag table entries with double the original values
910c1bc742181ded4930842b46e9507372f0b1b963James Dong        IMPORT          armVCM4P2_DecodeVLCZigzag_AC_unsafe
920c1bc742181ded4930842b46e9507372f0b1b963James Dong
930c1bc742181ded4930842b46e9507372f0b1b963James Dong
940c1bc742181ded4930842b46e9507372f0b1b963James Dong
950c1bc742181ded4930842b46e9507372f0b1b963James Dong;//Input Arguments
960c1bc742181ded4930842b46e9507372f0b1b963James Dong
970c1bc742181ded4930842b46e9507372f0b1b963James DongppBitStream          RN 0
980c1bc742181ded4930842b46e9507372f0b1b963James DongpBitOffset           RN 1
990c1bc742181ded4930842b46e9507372f0b1b963James DongpDst                 RN 2
1000c1bc742181ded4930842b46e9507372f0b1b963James DongshortVideoHeader     RN 3
1010c1bc742181ded4930842b46e9507372f0b1b963James Dong
1020c1bc742181ded4930842b46e9507372f0b1b963James Dong;//Local Variables
1030c1bc742181ded4930842b46e9507372f0b1b963James Dong
1040c1bc742181ded4930842b46e9507372f0b1b963James DongReturn               RN 0
1050c1bc742181ded4930842b46e9507372f0b1b963James Dong
1060c1bc742181ded4930842b46e9507372f0b1b963James DongpVlcTableL0L1        RN 4
1070c1bc742181ded4930842b46e9507372f0b1b963James DongpLMAXTableL0L1       RN 4
1080c1bc742181ded4930842b46e9507372f0b1b963James DongpRMAXTableL0L1       RN 4
1090c1bc742181ded4930842b46e9507372f0b1b963James DongpZigzagTable         RN 4
1100c1bc742181ded4930842b46e9507372f0b1b963James DongCount                RN 6
1110c1bc742181ded4930842b46e9507372f0b1b963James Dong
1120c1bc742181ded4930842b46e9507372f0b1b963James Dong
1130c1bc742181ded4930842b46e9507372f0b1b963James Dong
1140c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Allocate stack memory to store the VLC,Zigzag,LMAX and RMAX tables
1150c1bc742181ded4930842b46e9507372f0b1b963James Dong
1160c1bc742181ded4930842b46e9507372f0b1b963James Dong
1170c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_ALLOC4        ppVlcTableL0L1,4
1180c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_ALLOC4        ppLMAXTableL0L1,4
1190c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_ALLOC4        ppRMAXTableL0L1,4
1200c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_ALLOC4        ppZigzagTable,4
1210c1bc742181ded4930842b46e9507372f0b1b963James Dong
1220c1bc742181ded4930842b46e9507372f0b1b963James Dong
1230c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_START omxVCM4P2_DecodeVLCZigzag_Inter,r12
1240c1bc742181ded4930842b46e9507372f0b1b963James Dong
1250c1bc742181ded4930842b46e9507372f0b1b963James Dong
1260c1bc742181ded4930842b46e9507372f0b1b963James Dong
1270c1bc742181ded4930842b46e9507372f0b1b963James Dong
1280c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDR             pZigzagTable, =armVCM4P2_aClassicalZigzagScan       ;// Load zigzag table
1290c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STR           pZigzagTable,ppZigzagTable                              ;// Store zigzag table on stack to pass as argument to unsafe function
1300c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDR             pVlcTableL0L1, =armVCM4P2_InterVlcL0L1              ;// Load optimized VLC table with both L=0 and L=1 entries
1310c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STR           pVlcTableL0L1,ppVlcTableL0L1                            ;// Store optimized VLC table address on stack
1320c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDR             pLMAXTableL0L1, =armVCM4P2_InterL0L1LMAX            ;// Load Interleaved L=0 and L=1 LMAX Tables
1330c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STR           pLMAXTableL0L1,ppLMAXTableL0L1                          ;// Store LMAX table address on stack
1340c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDR             pRMAXTableL0L1, =armVCM4P2_InterL0L1RMAX            ;// Load Interleaved L=0 and L=1 RMAX Tables
1350c1bc742181ded4930842b46e9507372f0b1b963James Dong        MOV             Count,#0                                                ;// set start=0
1360c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STR           pRMAXTableL0L1,ppRMAXTableL0L1                          ;// store RMAX table address on stack
1370c1bc742181ded4930842b46e9507372f0b1b963James Dong
1380c1bc742181ded4930842b46e9507372f0b1b963James Dong
1390c1bc742181ded4930842b46e9507372f0b1b963James Dong        BL              armVCM4P2_DecodeVLCZigzag_AC_unsafe                 ;// call Unsafe Function for VLC Zigzag Decoding
1400c1bc742181ded4930842b46e9507372f0b1b963James Dong
1410c1bc742181ded4930842b46e9507372f0b1b963James Dong
1420c1bc742181ded4930842b46e9507372f0b1b963James Dong
1430c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_END
1440c1bc742181ded4930842b46e9507372f0b1b963James Dong        ENDIF
1450c1bc742181ded4930842b46e9507372f0b1b963James Dong
1460c1bc742181ded4930842b46e9507372f0b1b963James Dong        END
147