📄 ac_vld_decode_n.sa
字号:
; Make copy of data_word_val in B_data_word_cpy ; ; Speculatively load 5 bytes in temp0.....temp4 ; ; Left justify values to form 40 bit result ; ; Increment numberval to indicate 1 Run level pair detcetd ; ; Speculatively compute possible offsets by extracting offsets ; ; from data_word_val and data_word_cpy. ; ; Based on the lmbd value choose the offset for this code ; ; Read run, sze and length of the codeword ; ; Compute level using run, sze and length information ; ; Store run, level values out. ; ; Add to the accumulating sum run+1 values and check < 63 ; ; Shift out the extracted codeword from data_word_val and ; ; shift the 40 bit buffer by appropriate amount to paste ; ; into bit-stream. Detecet the number of complete bytes pasted ; ; increment data_pointer. ; ; Repeat loop. ; ;--------------------------------------------------------------------;LOOP: ;---------------------------------------------------------------------; ; Check for EOB occurrence in the datastream using B_EOB_MASK ; ; Compare result with A_EOB_CODE and set EOB flag ; ;---------------------------------------------------------------------; AND B_data_word_cpy, B_EOB_MASK, B_EOB_VAL ; CMPEQ B_EOB_VAL, A_EOB_CODE, B_EOB ; ;---------------------------------------------------------------------; ; Get the LMBD zero value in the bit_stream ; ; Perform operation on copy of VLD buffer as well to cut recurrence ; ;---------------------------------------------------------------------; LMBD 0, B_data_word_cpy, B_lmbd_val ; LMBD 0, A_data_word_val, A_lmbd_val ; ;---------------------------------------------------------------------; ; Obtain 5 bytes starting from data_pointer into temp0...temp4 ; ; Shift these to form a left justified sequence of bytes. These ; ; shifted values will be added later to form a 40 bit buffer ; ; temp_word that will keep filling the depleted VLD buffer ; ; _val. Also increment numberval indicating 1 run-level pair ; ; has been detected ; ;---------------------------------------------------------------------; LDBU *A_data_pointer, A_new_hi ; LDNW *B_data_pnt_cpy, A_temp_l ; SWAP4 A_temp_l, A_temp_swap_l ; ROTL A_temp_swap_l, 16, A_new_lo ; ADD B_numberval, 1, B_numberval ; SHRU A_data_word_val, 26, B_t02_ofs ; EXTU B_data_word_cpy, 3,26, B_ofs ; EXTU B_data_word_cpy, 5,25, B_t68_ofs ; EXTU B_data_word_cpy, 8,24, B_t9x_ofs ; CMPLTU A_lmbd_val, 3, A_st3 ; CMPGTU B_lmbd_val, 5, B_st5 ; CMPGTU A_lmbd_val, 8, A_st8 ;[A_st3] SUBAW B_t02_ofs, 14, B_ofs ;[B_st5] MV B_t68_ofs, B_ofs ;[A_st8] MV B_t9x_ofs, B_ofs ; ;---------------------------------------------------------------------; ; Once the offset has been figured out, load run,size and length of ; ; codeword by using offset. size_val gives the actual size of the ; ; Huffman codeword and the length of the extra bits that constitute ; ; level is obtained by subtracting this from the length of the ; ; codeword. Subtract 32 from the length of the extra bits and use ; ; to right justify the extra bits. Detect the sign and perform ; ; level value computation. Store off run-val and level_val ; ;---------------------------------------------------------------------; LDBU *+B_run_tbl[B_ofs], B_run_val ; LDBU *+B_sze_tbl[B_ofs], B_size_val ; LDBU *+B_shf_tbl[B_ofs], A_len_cw ; MV A_len_cw, B_len_cw ; SUB A_len_cw, B_size_val, A_len_val ; SHL B_data_word_cpy, A_len_val, A_temp_ac ; SHR A_temp_ac, 31, B_sgn ; ADD B_sgn, 1, B_Neg_AC ; SUB A_const_32, B_size_val, A_shift ; SHRU A_temp_ac, A_shift, A_level_val ; ADD A_level_val, B_Neg_AC, A_level_val ; SHL B_Neg_AC, B_size_val, B_Neg_s ; SUB A_level_val, B_Neg_s, A_level_val ; STH B_run_val, *A_run++[2] ; STH A_level_val, *B_level++[2] ; ;---------------------------------------------------------------------; ;Maintain accumulating sum of run+1 values and check if < 62. If it ; ;is greater set EOB. Shift out the detected codeword and set bit-po ; ;val to the bit location from the left from which pasting can occur ; ;Add shifted temprary bytes to form 40 bit buffer. Add 8 to the bit ; ;pos_val and shift and paste into bit-stream. Dtect the number of ; ;complete bytes pasted and use this to increment data_pointer. ; ; Perform this operation on both data_word_val and data_word_cpy ; ;---------------------------------------------------------------------; ADD B_run_val, 1, B_run_temp ; ADD B_num_coeffs, B_run_temp, B_num_coeffs ; CMPGT B_num_coeffs, B_K_62, B_st1 ; OR B_st1, B_EOB, B_EOB ; SUB A_bit_pos_val, A_len_cw, A_bit_pos_val ; SUB A_shift_new, A_len_cw, A_shift_new ; SHL A_data_word_val, A_len_cw, A_data_word_val ; MV A_data_word_val, B_data_word_cpy_s ; SUB A_const_32, A_bit_pos_val, A_bytes ; SHRU A_bytes, 3, A_num_bytes ; ADD A_used_bytes_val, A_num_bytes, A_used_bytes_val ; ADD A_data_pointer, A_num_bytes, A_data_pointer ; ADD B_data_pnt_cpy, A_num_bytes, B_data_pnt_cpy ; SHRU A_new_hi:A_new_lo, A_shift_new, A_data_sh:A_data_sl; OR A_data_word_val, A_data_sl, A_data_word_val ; MV A_data_sl, B_data_sl OR B_data_word_cpy_s, B_data_sl, B_data_word_cpy ; MPY A_num_bytes, 8, A_num_bytes ; ADD A_bit_pos_val, A_num_bytes, A_bit_pos_val ; ADD A_shift_new, A_num_bytes, A_shift_new ;[!B_EOB] B LOOP ; ;----------------------------------------------------------------------; ; Variables used to store status of VLD from one call to another ; ; B_numberval: # of run_level pairs found ; ; A_bit_pos_val: present bit-position in stream ; ; A_used_bytes_val: # of bytes consumed ; ; A_data_pointer: present data_pointer ; ; A_data_word_val: status word or VLD buffer ; ; ; ; Error check: (num_coeffs > 63)? 1:0 ; ;----------------------------------------------------------------------; SUB B_numberval, 1, B_store ; STB B_store, *B_num_of_rles ; STB A_bit_pos_val, *A_bit_position ; STW A_used_bytes_val, *B_used_up_bytes ; STW A_data_word_val, *B_data_word ; STW A_data_pointer, *A_data_ptr ; MVK 63, B_K_63 ; ZERO B_st1 ; CMPGT B_num_coeffs, B_K_63, B_st1 ; .return B_st1 ; .endproc ;* ========================================================================= ** End of file: ac_vld_decode_n.sa ** ------------------------------------------------------------------------- ** Copyright (c) 2001 Texas Instruments, Incorporated. ** All Rights Reserved. ** ========================================================================= *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -