1 ;/** 2 ; * 3 ; * File Name: omxVCM4P2_DecodeVLCZigzag_IntraDCVLC_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 zigzag scanning and VLC decoding 14 ; * for inter block. 15 ; * 16 ; * 17 ; * 18 ; * Function: omxVCM4P2_DecodeVLCZigzag_Inter 19 ; * 20 ; * Description: 21 ; * Performs VLC decoding and inverse zigzag scan for one intra coded block. 22 ; * 23 ; * Remarks: 24 ; * 25 ; * Parameters: 26 ; * [in] ppBitStream pointer to the pointer to the current byte in 27 ; * the bitstream buffer 28 ; * [in] pBitOffset pointer to the bit position in the byte pointed 29 ; * to by *ppBitStream. *pBitOffset is valid within [0-7]. 30 ; * [in] shortVideoHeader binary flag indicating presence of short_video_header; 31 ; * escape modes 0-3 are used if shortVideoHeader==0, 32 ; * and escape mode 4 is used when shortVideoHeader==1. 33 ; * [out] ppBitStream *ppBitStream is updated after the block is 34 ; * decoded, so that it points to the current byte 35 ; * in the bit stream buffer 36 ; * [out] pBitOffset *pBitOffset is updated so that it points to the 37 ; * current bit position in the byte pointed by 38 ; * *ppBitStream 39 ; * [out] pDst pointer to the coefficient buffer of current 40 ; * block. Must be 16-byte aligned 41 ; * 42 ; * Return Value: 43 ; * OMX_Sts_BadArgErr - bad arguments 44 ; * -At least one of the following pointers is NULL: ppBitStream, *ppBitStream, pBitOffset, pDst, or 45 ; * -pDst is not 16-byte aligned, or 46 ; * -*pBitOffset exceeds [0,7]. 47 ; * OMX_Sts_Err - status error 48 ; * -At least one mark bit is equal to zero 49 ; * -Encountered an illegal stream code that cannot be found in the VLC table 50 ; * -Encountered and illegal code in the VLC FLC table 51 ; * -The number of coefficients is greater than 64 52 ; * 53 ; */ 54 55 56 INCLUDE omxtypes_s.h 57 INCLUDE armCOMM_s.h 58 INCLUDE armCOMM_BitDec_s.h 59 60 61 M_VARIANTS ARM1136JS 62 63 64 65 66 67 IF ARM1136JS :LOR: CortexA8 68 69 70 ;// Import various tables needed for the function 71 72 73 IMPORT armVCM4P2_IntraVlcL0L1 ;// Contains optimized and packed VLC Tables for both Last =1 and last=0 74 ;// Packed in Run:Level:Last format 75 IMPORT armVCM4P2_IntraL0L1LMAX ;// Contains LMAX table entries with both Last=0 and Last=1 76 IMPORT armVCM4P2_IntraL0L1RMAX ;// Contains RMAX table entries with both Last=0 and Last=1 77 IMPORT armVCM4P2_aClassicalZigzagScan ;// contains CLassical, Horizontal, Vertical Zigzag table entries with double the original values 78 IMPORT armVCM4P2_aIntraDCLumaChromaIndex ;// Contains Optimized DCLuma and DCChroma Index table Entries 79 80 81 IMPORT armVCM4P2_DecodeVLCZigzag_AC_unsafe 82 83 ;//Input Arguments 84 85 ppBitStream RN 0 86 pBitOffset RN 1 87 pDst RN 2 88 PredDir RN 3 89 shortVideoHeader RN 3 90 videoComp RN 5 91 ;//Local Variables 92 93 Return RN 0 94 95 pDCLumaChromaIndex RN 4 96 pDCChromaIndex RN 7 97 pVlcTableL0L1 RN 4 98 pLMAXTableL0L1 RN 4 99 pRMAXTableL0L1 RN 4 100 pZigzagTable RN 4 101 Count RN 6 102 DCValueSize RN 6 103 powOfSize RN 7 104 temp1 RN 5 105 106 107 ;// Scratch Registers 108 109 RBitStream RN 8 110 RBitBuffer RN 9 111 RBitCount RN 10 112 113 T1 RN 11 114 T2 RN 12 115 DCVal RN 14 116 117 118 ;// Allocate stack memory to store optimized VLC,Zigzag, RMAX, LMAX Table Addresses 119 120 M_ALLOC4 ppVlcTableL0L1,4 121 M_ALLOC4 ppLMAXTableL0L1,4 122 M_ALLOC4 ppRMAXTableL0L1,4 123 M_ALLOC4 ppZigzagTable,4 124 M_ALLOC4 pDCCoeff,4 125 126 127 128 M_START omxVCM4P2_DecodeVLCZigzag_IntraDCVLC,r12 129 130 M_ARG shortVideoHeaderonStack,4 ;// Pointer to argument on stack 131 M_ARG videoComponstack,4 ;// Pointer to argument on stack 132 133 134 ;// Decode DC Coefficient 135 136 137 LDR pDCLumaChromaIndex, =armVCM4P2_aIntraDCLumaChromaIndex ;// Load Optimized VLC Table for Luminance and Chrominance 138 139 ;// Initializing the Bitstream Macro 140 141 M_BD_INIT0 ppBitStream, pBitOffset, RBitStream, RBitBuffer, RBitCount 142 M_LDR videoComp,videoComponstack 143 M_BD_INIT1 T1, T2, T2 144 ADD pDCLumaChromaIndex,pDCLumaChromaIndex,videoComp, LSL #6 145 M_BD_INIT2 T1, T2, T2 146 147 148 M_BD_VLD DCValueSize,T1,T2,pDCLumaChromaIndex,4,2 ;// VLC Decode using optimized Luminance and Chrominance VLC Table 149 150 151 152 153 DecodeDC 154 155 CMP DCValueSize,#12 156 BGT ExitError 157 158 CMP DCValueSize,#0 159 MOVEQ DCVal,#0 ;// If DCValueSize is zero then DC coeff =0 160 BEQ ACDecode ;// Branch to perform AC Coeff Decoding 161 162 M_BD_VREAD16 DCVal,DCValueSize,T1,T2 ;// Get DC Value From Bit stream 163 164 165 MOV powOfSize,#1 166 LSL powOfSize,DCValueSize ;// powOfSize=pow(2,DCValueSize) 167 CMP DCVal,powOfSize,LSR #1 ;// Compare DCVal with powOfSize/2 168 ADDLT DCVal,DCVal,#1 169 SUBLT DCVal,DCVal,powOfSize ;// If Lessthan powOfSize/2 DCVal=DCVal-powOfSize+1 170 ;// Else DCVal= fetchbits from bit stream 171 172 CheckDCValueSize 173 174 CMP DCValueSize,#8 ;// If DCValueSize greater than 8 check marker bit 175 176 BLE ACDecode 177 178 M_BD_READ8 temp1,1,T1 179 TEQ temp1,#0 ;// If Marker bit is zero Exit with an Error Message 180 BEQ ExitError 181 182 183 184 ;// Decode AC Coefficient 185 186 ACDecode 187 188 M_STR DCVal,pDCCoeff ;// Store Decoded DC Coeff on Stack 189 M_BD_FINI ppBitStream,pBitOffset ;// Terminating the Bit stream Macro 190 191 LDR pZigzagTable, =armVCM4P2_aClassicalZigzagScan ;// Load Zigzag talbe address 192 ADD pZigzagTable, pZigzagTable, PredDir, LSL #6 ;// Modify the Zigzag table adress based on PredDir 193 194 M_STR pZigzagTable,ppZigzagTable ;// Store zigzag table on stack 195 LDR pVlcTableL0L1, =armVCM4P2_IntraVlcL0L1 ;// Load Optimized VLC Table With both Last=0 and Last=1 Entries 196 M_STR pVlcTableL0L1,ppVlcTableL0L1 ;// Store Optimized VLC Table on stack 197 LDR pLMAXTableL0L1, =armVCM4P2_IntraL0L1LMAX ;// Load LMAX Table 198 M_STR pLMAXTableL0L1,ppLMAXTableL0L1 ;// Store LMAX table on stack 199 LDR pRMAXTableL0L1, =armVCM4P2_IntraL0L1RMAX ;// Load RMAX Table 200 MOV Count,#1 ;// Set Start =1 201 202 M_STR pRMAXTableL0L1,ppRMAXTableL0L1 ;// Store RMAX Table on Stack 203 204 205 M_LDR shortVideoHeader,shortVideoHeaderonStack ;// Load the Input Argument From Stack 206 207 BL armVCM4P2_DecodeVLCZigzag_AC_unsafe ;// Call the Unsafe Function 208 209 M_LDR DCVal,pDCCoeff ;// Get the Decoded DC Value From Stack 210 STRH DCVal,[pDst] ;// Store the DC Value 211 B ExitOK 212 213 214 215 ExitError 216 217 M_BD_FINI ppBitStream,pBitOffset ;// Terminating the Bit Stream Macro in case of an Error 218 MOV Return,#OMX_Sts_Err ;// Exit with an Error Message 219 ExitOK 220 221 M_END 222 ENDIF 223 224 END 225