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_IntraACVLC_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 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 intra 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_IntraVlcL0L1 ;// 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_IntraL0L1LMAX ;// Contains LMAX table entries with both Last=0 and Last=1 890c1bc742181ded4930842b46e9507372f0b1b963James Dong IMPORT armVCM4P2_IntraL0L1RMAX ;// 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;//Input Arguments 940c1bc742181ded4930842b46e9507372f0b1b963James Dong 950c1bc742181ded4930842b46e9507372f0b1b963James DongppBitStream RN 0 960c1bc742181ded4930842b46e9507372f0b1b963James DongpBitOffset RN 1 970c1bc742181ded4930842b46e9507372f0b1b963James DongpDst RN 2 980c1bc742181ded4930842b46e9507372f0b1b963James DongPredDir RN 3 990c1bc742181ded4930842b46e9507372f0b1b963James DongshortVideoHeader RN 3 1000c1bc742181ded4930842b46e9507372f0b1b963James Dong 1010c1bc742181ded4930842b46e9507372f0b1b963James Dong;//Local Variables 1020c1bc742181ded4930842b46e9507372f0b1b963James Dong 1030c1bc742181ded4930842b46e9507372f0b1b963James DongReturn RN 0 1040c1bc742181ded4930842b46e9507372f0b1b963James Dong 1050c1bc742181ded4930842b46e9507372f0b1b963James DongpVlcTableL0L1 RN 4 1060c1bc742181ded4930842b46e9507372f0b1b963James DongpLMAXTableL0L1 RN 4 1070c1bc742181ded4930842b46e9507372f0b1b963James DongpRMAXTableL0L1 RN 4 1080c1bc742181ded4930842b46e9507372f0b1b963James DongpZigzagTable RN 4 1090c1bc742181ded4930842b46e9507372f0b1b963James DongCount RN 6 1100c1bc742181ded4930842b46e9507372f0b1b963James Dong 1110c1bc742181ded4930842b46e9507372f0b1b963James Dong 1120c1bc742181ded4930842b46e9507372f0b1b963James Dong 1130c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Allocate stack memory to store optimized VLC,Zigzag, RMAX, LMAX Table Addresses 1140c1bc742181ded4930842b46e9507372f0b1b963James Dong 1150c1bc742181ded4930842b46e9507372f0b1b963James Dong M_ALLOC4 ppVlcTableL0L1,4 1160c1bc742181ded4930842b46e9507372f0b1b963James Dong M_ALLOC4 ppLMAXTableL0L1,4 1170c1bc742181ded4930842b46e9507372f0b1b963James Dong M_ALLOC4 ppRMAXTableL0L1,4 1180c1bc742181ded4930842b46e9507372f0b1b963James Dong M_ALLOC4 ppZigzagTable,4 1190c1bc742181ded4930842b46e9507372f0b1b963James Dong 1200c1bc742181ded4930842b46e9507372f0b1b963James Dong 1210c1bc742181ded4930842b46e9507372f0b1b963James Dong M_START omxVCM4P2_DecodeVLCZigzag_IntraACVLC,r12 1220c1bc742181ded4930842b46e9507372f0b1b963James Dong 1230c1bc742181ded4930842b46e9507372f0b1b963James Dong M_ARG shortVideoHeaderonStack,4 ;// pointer to Input Argument on stack 1240c1bc742181ded4930842b46e9507372f0b1b963James Dong 1250c1bc742181ded4930842b46e9507372f0b1b963James Dong LDR pZigzagTable, =armVCM4P2_aClassicalZigzagScan ;// Load Address of the Zigzag table 1260c1bc742181ded4930842b46e9507372f0b1b963James Dong ADD pZigzagTable, pZigzagTable, PredDir, LSL #6 ;// Loading Different type of zigzag tables based on PredDir 1270c1bc742181ded4930842b46e9507372f0b1b963James Dong 1280c1bc742181ded4930842b46e9507372f0b1b963James Dong M_STR pZigzagTable,ppZigzagTable ;// Store Zigzag table address on stack 1290c1bc742181ded4930842b46e9507372f0b1b963James Dong LDR pVlcTableL0L1, =armVCM4P2_IntraVlcL0L1 ;// Load optimized packed VLC Table with both L=0 and L=1 entries 1300c1bc742181ded4930842b46e9507372f0b1b963James Dong M_STR pVlcTableL0L1,ppVlcTableL0L1 ;// Store VLC Table address on stack 1310c1bc742181ded4930842b46e9507372f0b1b963James Dong LDR pLMAXTableL0L1, =armVCM4P2_IntraL0L1LMAX ;// Load LMAX Table 1320c1bc742181ded4930842b46e9507372f0b1b963James Dong M_STR pLMAXTableL0L1,ppLMAXTableL0L1 ;// Store LMAX Table address on Stack 1330c1bc742181ded4930842b46e9507372f0b1b963James Dong LDR pRMAXTableL0L1, =armVCM4P2_IntraL0L1RMAX ;// Load RMAX Table 1340c1bc742181ded4930842b46e9507372f0b1b963James Dong MOV Count,#0 ;// Set Start=0 1350c1bc742181ded4930842b46e9507372f0b1b963James Dong 1360c1bc742181ded4930842b46e9507372f0b1b963James Dong M_STR pRMAXTableL0L1,ppRMAXTableL0L1 ;// Store RMAX Table address on stack 1370c1bc742181ded4930842b46e9507372f0b1b963James Dong 1380c1bc742181ded4930842b46e9507372f0b1b963James Dong 1390c1bc742181ded4930842b46e9507372f0b1b963James Dong 1400c1bc742181ded4930842b46e9507372f0b1b963James Dong M_LDR shortVideoHeader,shortVideoHeaderonStack ;// get the Input Argument from stack 1410c1bc742181ded4930842b46e9507372f0b1b963James Dong 1420c1bc742181ded4930842b46e9507372f0b1b963James Dong BL armVCM4P2_DecodeVLCZigzag_AC_unsafe ;// Call Unsafe Function 1430c1bc742181ded4930842b46e9507372f0b1b963James Dong 1440c1bc742181ded4930842b46e9507372f0b1b963James Dong 1450c1bc742181ded4930842b46e9507372f0b1b963James Dong 1460c1bc742181ded4930842b46e9507372f0b1b963James Dong 1470c1bc742181ded4930842b46e9507372f0b1b963James Dong M_END 1480c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 1490c1bc742181ded4930842b46e9507372f0b1b963James Dong 1500c1bc742181ded4930842b46e9507372f0b1b963James Dong END 151