10c1bc742181ded4930842b46e9507372f0b1b963James Dong;/**
20c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
30c1bc742181ded4930842b46e9507372f0b1b963James Dong; * File Name:  omxVCM4P2_DecodeVLCZigzag_IntraACVLC_s.s
40c1bc742181ded4930842b46e9507372f0b1b963James Dong; * OpenMAX DL: v1.0.2
50c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Revision:   12290
60c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Date:       Wednesday, April 9, 2008
70c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
80c1bc742181ded4930842b46e9507372f0b1b963James Dong; * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved.
90c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
100c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
110c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
120c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Description:
130c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Contains modules for zigzag scanning and VLC decoding
140c1bc742181ded4930842b46e9507372f0b1b963James Dong; * for inter block.
150c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
160c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
170c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
180c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Function: omxVCM4P2_DecodeVLCZigzag_Inter
190c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
200c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Description:
210c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Performs VLC decoding and inverse zigzag scan for one intra coded block.
220c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
230c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Remarks:
240c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
250c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Parameters:
260c1bc742181ded4930842b46e9507372f0b1b963James Dong; * [in]    ppBitStream        pointer to the pointer to the current byte in
270c1bc742181ded4930842b46e9507372f0b1b963James Dong; *                    the bitstream buffer
280c1bc742181ded4930842b46e9507372f0b1b963James Dong; * [in]    pBitOffset        pointer to the bit position in the byte pointed
290c1bc742181ded4930842b46e9507372f0b1b963James Dong; *                    to by *ppBitStream. *pBitOffset is valid within    [0-7].
300c1bc742181ded4930842b46e9507372f0b1b963James Dong; * [in] shortVideoHeader     binary flag indicating presence of short_video_header;
310c1bc742181ded4930842b46e9507372f0b1b963James Dong; *                           escape modes 0-3 are used if shortVideoHeader==0,
320c1bc742181ded4930842b46e9507372f0b1b963James Dong; *                           and escape mode 4 is used when shortVideoHeader==1.
330c1bc742181ded4930842b46e9507372f0b1b963James Dong; * [out]    ppBitStream        *ppBitStream is updated after the block is
340c1bc742181ded4930842b46e9507372f0b1b963James Dong; *                    decoded, so that it points to the current byte
350c1bc742181ded4930842b46e9507372f0b1b963James Dong; *                    in the bit stream buffer
360c1bc742181ded4930842b46e9507372f0b1b963James Dong; * [out]    pBitOffset        *pBitOffset is updated so that it points to the
370c1bc742181ded4930842b46e9507372f0b1b963James Dong; *                    current bit position in the byte pointed by
380c1bc742181ded4930842b46e9507372f0b1b963James Dong; *                    *ppBitStream
390c1bc742181ded4930842b46e9507372f0b1b963James Dong; * [out]    pDst            pointer to the coefficient buffer of current
400c1bc742181ded4930842b46e9507372f0b1b963James Dong; *                    block. Must be 16-byte aligned
410c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
420c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Return Value:
430c1bc742181ded4930842b46e9507372f0b1b963James Dong; * OMX_Sts_BadArgErr - bad arguments
440c1bc742181ded4930842b46e9507372f0b1b963James Dong; *   -At least one of the following pointers is NULL: ppBitStream, *ppBitStream, pBitOffset, pDst, or
450c1bc742181ded4930842b46e9507372f0b1b963James Dong; *   -pDst is not 16-byte aligned, or
460c1bc742181ded4930842b46e9507372f0b1b963James Dong; *   -*pBitOffset exceeds [0,7].
470c1bc742181ded4930842b46e9507372f0b1b963James Dong; * OMX_Sts_Err - status error
480c1bc742181ded4930842b46e9507372f0b1b963James Dong; *   -At least one mark bit is equal to zero
490c1bc742181ded4930842b46e9507372f0b1b963James Dong; *   -Encountered an illegal stream code that cannot be found in the VLC table
500c1bc742181ded4930842b46e9507372f0b1b963James Dong; *   -Encountered and illegal code in the VLC FLC table
510c1bc742181ded4930842b46e9507372f0b1b963James Dong; *   -The number of coefficients is greater than 64
520c1bc742181ded4930842b46e9507372f0b1b963James Dong; *
530c1bc742181ded4930842b46e9507372f0b1b963James Dong; */
540c1bc742181ded4930842b46e9507372f0b1b963James Dong
550c1bc742181ded4930842b46e9507372f0b1b963James Dong
560c1bc742181ded4930842b46e9507372f0b1b963James Dong      INCLUDE omxtypes_s.h
570c1bc742181ded4930842b46e9507372f0b1b963James Dong      INCLUDE armCOMM_s.h
580c1bc742181ded4930842b46e9507372f0b1b963James Dong      INCLUDE armCOMM_BitDec_s.h
590c1bc742181ded4930842b46e9507372f0b1b963James Dong
600c1bc742181ded4930842b46e9507372f0b1b963James Dong
610c1bc742181ded4930842b46e9507372f0b1b963James Dong      M_VARIANTS ARM1136JS
620c1bc742181ded4930842b46e9507372f0b1b963James Dong
630c1bc742181ded4930842b46e9507372f0b1b963James Dong
640c1bc742181ded4930842b46e9507372f0b1b963James Dong
650c1bc742181ded4930842b46e9507372f0b1b963James Dong
660c1bc742181ded4930842b46e9507372f0b1b963James Dong
670c1bc742181ded4930842b46e9507372f0b1b963James Dong     IF ARM1136JS
680c1bc742181ded4930842b46e9507372f0b1b963James Dong
690c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Import various tables needed for the function
700c1bc742181ded4930842b46e9507372f0b1b963James Dong
710c1bc742181ded4930842b46e9507372f0b1b963James Dong
720c1bc742181ded4930842b46e9507372f0b1b963James Dong        IMPORT          armVCM4P2_IntraVlcL0L1             ;// Contains optimized and packed VLC Tables for both Last =1 and last=0
730c1bc742181ded4930842b46e9507372f0b1b963James Dong                                                               ;// Packed in Run:Level:Last format
740c1bc742181ded4930842b46e9507372f0b1b963James Dong        IMPORT          armVCM4P2_IntraL0L1LMAX            ;// Contains LMAX table entries with both Last=0 and Last=1
750c1bc742181ded4930842b46e9507372f0b1b963James Dong        IMPORT          armVCM4P2_IntraL0L1RMAX            ;// Contains RMAX table entries with both Last=0 and Last=1
760c1bc742181ded4930842b46e9507372f0b1b963James Dong        IMPORT          armVCM4P2_aClassicalZigzagScan     ;// contains classical Zigzag table entries with double the original values
770c1bc742181ded4930842b46e9507372f0b1b963James Dong        IMPORT          armVCM4P2_DecodeVLCZigzag_AC_unsafe
780c1bc742181ded4930842b46e9507372f0b1b963James Dong
790c1bc742181ded4930842b46e9507372f0b1b963James Dong;//Input Arguments
800c1bc742181ded4930842b46e9507372f0b1b963James Dong
810c1bc742181ded4930842b46e9507372f0b1b963James DongppBitStream          RN 0
820c1bc742181ded4930842b46e9507372f0b1b963James DongpBitOffset           RN 1
830c1bc742181ded4930842b46e9507372f0b1b963James DongpDst                 RN 2
840c1bc742181ded4930842b46e9507372f0b1b963James DongPredDir              RN 3
850c1bc742181ded4930842b46e9507372f0b1b963James DongshortVideoHeader     RN 3
860c1bc742181ded4930842b46e9507372f0b1b963James Dong
870c1bc742181ded4930842b46e9507372f0b1b963James Dong;//Local Variables
880c1bc742181ded4930842b46e9507372f0b1b963James Dong
890c1bc742181ded4930842b46e9507372f0b1b963James DongReturn               RN 0
900c1bc742181ded4930842b46e9507372f0b1b963James Dong
910c1bc742181ded4930842b46e9507372f0b1b963James DongpVlcTableL0L1        RN 4
920c1bc742181ded4930842b46e9507372f0b1b963James DongpLMAXTableL0L1       RN 4
930c1bc742181ded4930842b46e9507372f0b1b963James DongpRMAXTableL0L1       RN 4
940c1bc742181ded4930842b46e9507372f0b1b963James DongpZigzagTable         RN 4
950c1bc742181ded4930842b46e9507372f0b1b963James DongCount                RN 6
960c1bc742181ded4930842b46e9507372f0b1b963James Dong
970c1bc742181ded4930842b46e9507372f0b1b963James Dong
980c1bc742181ded4930842b46e9507372f0b1b963James Dong
990c1bc742181ded4930842b46e9507372f0b1b963James Dong        ;// Allocate stack memory to store optimized VLC,Zigzag, RMAX, LMAX Table Addresses
1000c1bc742181ded4930842b46e9507372f0b1b963James Dong
1010c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_ALLOC4        ppVlcTableL0L1,4
1020c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_ALLOC4        ppLMAXTableL0L1,4
1030c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_ALLOC4        ppRMAXTableL0L1,4
1040c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_ALLOC4        ppZigzagTable,4
1050c1bc742181ded4930842b46e9507372f0b1b963James Dong
1060c1bc742181ded4930842b46e9507372f0b1b963James Dong
1070c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_START omxVCM4P2_DecodeVLCZigzag_IntraACVLC,r12
1080c1bc742181ded4930842b46e9507372f0b1b963James Dong
1090c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_ARG           shortVideoHeaderonStack,4                             ;// pointer to Input Argument on stack
1100c1bc742181ded4930842b46e9507372f0b1b963James Dong
1110c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDR             pZigzagTable, =armVCM4P2_aClassicalZigzagScan     ;// Load Address of the Zigzag table
1120c1bc742181ded4930842b46e9507372f0b1b963James Dong        ADD             pZigzagTable, pZigzagTable, PredDir, LSL #6           ;// Loading Different type of zigzag tables based on PredDir
1130c1bc742181ded4930842b46e9507372f0b1b963James Dong
1140c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STR           pZigzagTable,ppZigzagTable                            ;// Store Zigzag table address on stack
1150c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDR             pVlcTableL0L1, =armVCM4P2_IntraVlcL0L1            ;// Load optimized packed VLC Table with both L=0 and L=1 entries
1160c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STR           pVlcTableL0L1,ppVlcTableL0L1                          ;// Store VLC Table address on stack
1170c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDR             pLMAXTableL0L1, =armVCM4P2_IntraL0L1LMAX          ;// Load LMAX Table
1180c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STR           pLMAXTableL0L1,ppLMAXTableL0L1                        ;// Store LMAX Table address on Stack
1190c1bc742181ded4930842b46e9507372f0b1b963James Dong        LDR             pRMAXTableL0L1, =armVCM4P2_IntraL0L1RMAX          ;// Load RMAX Table
1200c1bc742181ded4930842b46e9507372f0b1b963James Dong        MOV             Count,#0                                              ;// Set Start=0
1210c1bc742181ded4930842b46e9507372f0b1b963James Dong
1220c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_STR           pRMAXTableL0L1,ppRMAXTableL0L1                        ;// Store RMAX Table address on stack
1230c1bc742181ded4930842b46e9507372f0b1b963James Dong
1240c1bc742181ded4930842b46e9507372f0b1b963James Dong
1250c1bc742181ded4930842b46e9507372f0b1b963James Dong
1260c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_LDR           shortVideoHeader,shortVideoHeaderonStack              ;// get the Input Argument from stack
1270c1bc742181ded4930842b46e9507372f0b1b963James Dong
1280c1bc742181ded4930842b46e9507372f0b1b963James Dong        BL              armVCM4P2_DecodeVLCZigzag_AC_unsafe               ;// Call Unsafe Function
1290c1bc742181ded4930842b46e9507372f0b1b963James Dong
1300c1bc742181ded4930842b46e9507372f0b1b963James Dong
1310c1bc742181ded4930842b46e9507372f0b1b963James Dong
1320c1bc742181ded4930842b46e9507372f0b1b963James Dong
1330c1bc742181ded4930842b46e9507372f0b1b963James Dong        M_END
1340c1bc742181ded4930842b46e9507372f0b1b963James Dong        ENDIF
1350c1bc742181ded4930842b46e9507372f0b1b963James Dong
1360c1bc742181ded4930842b46e9507372f0b1b963James Dong        END
137