📄 h263_vld_h.asm
字号:
* The code word used in this context refers to the run, level ** associated with each Huffman code word that is decoded and not ** to the Huffman code word itself. ** ** Last(1/0) RUNVALUE LEVEL ** 14 13....8 7....0 ** ** Each code word thus has a pad of 2 bits and is stored as a half ** word ** ** Example: ** ** 1) Code: 0000 0000 110s Run: 0 Level: 11 ** ** Clearly for this code f5 the first 5 bits from the left are zero. ** first 12 bits from the left are extracted in idx1. If the upper ** 5 bits are zero then idx1 can have a maximum value of upto 127. ** In this case this value will be either 13 or 14 depending on the ** sign bit. ** ** 0 000000 001011 -------------> 0x0b ** ** The length table is a set of values constructed as follows. The ** code words are taken and divided into two categories for this ** purpose: ** Class 1: Codes 00000xxxxx...00011xxxxx ** Class 2: Codes 001xxxxx...1xxxxx ** Therfore it can be seen that under class 2 there can be a set of ** 32 codes and under class 1 there are 60 enties that the given ** code table maps into. Therfore there are a total of 32 entries. ** This can be seen by way of example: ** ** Code at Index: 50 of the Table 16 in H.263 spec ** ** Run: 19 Level: 1 Code: 0000 1110 1s and falls under Class 1 ** When the 9 left most bits are examined this gives us 29. The ** 29th entry in the length table gives us the length of the code ** word as 10. ** ** Similarly a code at Index 40 of the Table 16 in H.263 spec ** ** Run: 10 Level: 1 Code: 0010110s. This comes under Class 2 and ** hence the 5 left most bits are extracted to give an index of 5 ** The code lengths for these class of codes is stored with an ** implicit offset of 60 and hence this code's length is actually ** stored at location 65. The 65 th entry from the length table is ** 8 and corresponds to the length of the code. ** ** The entries in the Zig-Zag table are expected to be in the range ** 0 .. 63, with no repeated entries. The VLD starts reading the ** Zig-Zag table at zz[1], and under normal circumstances will not ** read past element zz[63]. However, when an invalid bitstream is ** encountered, elements as high as zz[126] may be accessed. See ** the MEMORY NOTE below for more information. ** ** ASSUMPTIONS ** Speculative reads are OK. See MEMORY NOTE below. ** ** Short (as in, invalid due to truncation) bitstreams are followed ** by sentinel values to halt VLD with an error condition, to prevent ** underflow. ** ** MEMORY NOTE ** The VLD routine will read up to two full words beyond the final ** position of the bitstream word pointer, as part of its lookahead. ** The user must ensure that two words of valid memory exist there. ** ** Speculative reads are performed to each of the following arrays: ** (Ranges are in bytes, and are inclusive.) ** ** Table/Array Valid Range Accessed Range ** ** Zig-Zag Table 0..63 0..127 ** Length Table 0..91 0..511 ** Coef/Run Table 0..607 0..607 ** ** The user should ensure that valid (eg. CPU readable) memory ** exists in the required ranges past the end of each table. ** ** Alternately, to ensure that these reads do not reduce cache ** effectiveness and do not access invalid memory, the following ** table layout is recommended, as it causes all speculative reads ** to land inside other valid table entries: ** ** Bytes 0 .. 63 'zz' Zig-Zag table ** Bytes 64 .. 159 'len' Huffman-code Length table ** Bytes 160 .. 767 'tab' Huffman-code Coefficient/Run Table ** ** No bank conflicts occur in this code at any time. ** ** TECHNIQUES ** The branch back to the main code and the small set of ** operations therin are scheduled right within the kernel to ** minimize code size and increase execution speed. ** ** NOTES ** The input bitstream must be "word order", meaning that it is ** accessed with word-wide memory accesses. ** ** This code is fully interruptible and does not mask interrupts. ** ** CYCLES ** cycles = 12 * N + 30, including 6 cycles of call overhead. ** (N is the number of symbols in the block, including EOB.) ** ** For N = 15, cycles = 210. ** For N = 25, cycles = 330. ** ** CODESIZE ** 312 bytes. ** ** ------------------------------------------------------------------------- ** Copyright (c) 2000 Texas Instruments, Incorporated. ** All Rights Reserved. ** ========================================================================= * .sect ".text:hand" .global _h263_vld_asm_h263_vld_asm:* =============== SYMBOLIC REGISTER ASSIGNMENTS: ARGUMENTS =============== * .asg A4, A_bufPtr ; Ptr to ptr to buffer .asg B4, B_bitPtr ; Ptr to bit-pointer .asg A6, A_tab ; VLD code table ptr .asg B6, B_len ; VLD length table ptr .asg A8, A_Q ; Q value for IQuant .asg B8, B_dq ; Delta-Q value for IQ .asg A10, A_zz_in ; Zig-zag table ptr .asg B10, B_idct ; IDCT block pointer .asg A12, A_inter ; INTER vs INTRA flag .asg B3, B_ret ; Return address .asg A4, A_err_ret ; Error code return val* ===================== SYMBOLIC REGISTER ASSIGNMENTS ===================== * .asg A0, A_EOB ; End of Block flag .asg A1, A_s_tmp ; Sign bit temp-val .asg A1, A_tmp ; Shift amt for sign-bit .asg A1, A_err ; Error code .asg A2, A_err_ ; Error code .asg A2, A_s ; Sign bit .asg A2, A_nbit ; Number of bits (copy) .asg A3, A_zz_end ; End of zig-zag tbl. .asg A5, A_bit25 ; Constant: 1 << 25 .asg A7, A_levelQ ; Inv. Quant'd level .asg A9, A_idx_ ; Table index .asg A9, A_level ; Decoded level .asg A16, A_idx ; Table index .asg A16, A_lrl ; Last/Run/Lvl from tbl .asg A17, A_vld_buf ; Top 32 bits of stream
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -