📄 ac_vld_decode_n.sa
字号:
* y) The next set of bytes is being brought in as a 40 bit buffer in * * temp word. To append this variable after bit_pos bits from the * * left one needs to shift 8 + bit_pos_val * * * * z) Increment bit_pos_val by the number of bits in the complete byte * * inserted. For eg. bit_pos = 9 and 2 bytes are inserted then it * * will be incremented by 16 bits to become 25 * * * * Iterate steps k through z while EOB == 0 * * * * Steps to be performed after the loop * * * * a) *num_of_rles = numberval - 1. The number of run-level pairs found * * is numberval - 1. Remember numberval is 1 more because it * * increments for EOB as well. * * * * b) *bit_pos_vld = bit_pos_val; * * Store off the current bit position in the pointer. Status variable * * used for chaining VLD's. * * * * c) *used_up_bytes= used_bytes_val; * * Store off the number of used up bytes in the pointer. Status * * variable for chaining VLD's * * * * d) *data_word = data_word_val; * * Store off the present VLD status word to begin resuming this on * * next pass of the VLD. Status word of the VLD is the most important * * state variable. * * * * e) *data_ptr = data_pointer; * * Store off the pointer from which the next set of 5 bytes need * * to be fetched at the end of the VLD. State variable used for * * chaining VLD calls. * * * * DIAGNOSTICS * * Return value == 1: Incorrect VLD stream in which K > 63 * * Return value == 0: Correct VLD and valid JPEG stream * * * * BIBLIOGRAPHY * * 1) JPEG still image data compression standard by William B * * Pennabaker and Joan L. Mitchell * * 2) CCITT T.81 standard * * * * ------------------------------------------------------------------------- ** Copyright (c) 2002 Texas Instruments, Incorporated. ** All Rights Reserved. ** ========================================================================= * .global _ac_vld_decode_nsa_ac_vld_decode_nsa: .cproc A_data_ptr, B_data_word, A_run_level, B_num_of_rles, A_bit_position, B_used_up_bytes, A_ac_table_luma .no_mdep .reg B_run_tbl, B_sze_tbl, B_sze_const, A_len_val .reg B_shf_tbl, B_shf_const, B_EOB, A_bit_pos_val .reg A_data_word_val, A_data_pointer, B_data_pnt_cpy, B_numberval .reg A_data_s, A_lmbd_val, B_data_word_cpy, B_data_ws .reg A_temp0h:A_temp0l, B_temp1, B_temp2, A_temp3 .reg B_t02_ofs, A_t35_ofs, B_t68_ofs, B_t9x_ofs .reg B_ofs, A_st3, B_st5, A_st8 .reg B_run_val, B_size_val, A_len_cw, A_temp_ac .reg B_sgn, B_Neg_AC, A_shift, A_level_val .reg B_Neg_s, A_bytes, A_num_bytes, B_store .reg A_used_bytes_val, B_data0, A_data1, A_data .reg A_const_32, B_tbl, B_eob_ofs_0, B_eob_ofs_1 .reg A_eob_byte0, B_eob_byte1, A_EOB_CODE, B_ofs_len .reg B_EOB_LEN, B_EOB_MASK, B_EOB_VAL, A_run .reg B_level, A_temp_0h:A_temp_0l, B_len_cw .reg B_temp1l, B_temp2l .reg A_temp3l, A_temp4l, A_K_32 .reg A_data_sh:A_data_sl .reg A_shift_new, A_temp4, A_temp0, B_K_62 .reg B_num_coeffs, B_run_temp, B_st .reg B_K_63, B_st1, B_lmbd_val .reg A_temp_h:A_temp_l, A_temp_swap_l, A_temp_swap_h .reg A_new_hi:A_new_lo, print_int_private, A_data_nptr .reg B_data_word_cpy_s, B_data_sl ;------------------------------------------------------------------; ; A_K_32: constant 32 B_K_62: constant 62 ; ; A_run: pointer to store run values ; ; B_level:pointer to store level values ; ; run and level values are stored in an interleaved run,level ; ; A_ac_table_luma: pointer to AC_VLD_STR that contains run,sze,shf ; ; pointers and EOB length ; ; Prepare pointers to run,sze and shf tables by adding offsets ; ; Read eob_byte0 and eob_byte1, left justify and prepare EOB_CODE ; ; Based on the length of the EOB prepare EOB_MASK ; ; B-numberval: variable to calculate the number of RLES ; ; B_num_coeffs: calculates sum of run+1 values K T.81 spec ; ;------------------------------------------------------------------; MVK 32, A_K_32 ; MVKL 62, B_K_62 ; MVKH 62, B_K_62 ; MV A_run_level, A_run ; ADD A_run_level, 2, B_level ; LDW *+A_ac_table_luma(4), B_run_tbl ; MV B_run_tbl, B_tbl ; ADDAW B_run_tbl, 14, B_run_tbl ; LDW *+A_ac_table_luma(8), B_sze_tbl ; MVK 370, B_sze_const ; ADD B_sze_tbl, B_sze_const, B_sze_tbl ; LDW *+A_ac_table_luma(12), B_shf_tbl ; MVK 684, B_shf_const ; ADD B_shf_tbl, B_shf_const, B_shf_tbl ; LDBU *A_bit_position, A_bit_pos_val ; LDW *B_data_word, A_data_word_val ; LDW *A_data_ptr, A_data_pointer ; LDW *B_used_up_bytes, A_used_bytes_val ; MVK 32, A_const_32 ; MVK 112, B_eob_ofs_0 ; LDBU *+B_tbl[B_eob_ofs_0], A_eob_byte0 ; ADD B_eob_ofs_0, 1, B_eob_ofs_1 ; LDBU *+B_tbl[B_eob_ofs_1], B_eob_byte1 ; SHL A_eob_byte0, 24, A_eob_byte0 ; SHL B_eob_byte1, 16, B_eob_byte1 ; ADD A_eob_byte0, B_eob_byte1, A_EOB_CODE ; ADD B_eob_ofs_0, 4, B_ofs_len ; LDBU *+B_tbl[B_ofs_len], B_EOB_LEN ; ;-----------------------------------------------------------------; ; Techniques to break recurrence in VLD ; ; Maintain two copies of VLD buffer data_word_val and copy ; ; Pre-increment bit_pos_val by 8 and maintain as shift amount ; ; Make indepndent copy of data_pointer so that speculative loads ; ; of bytes may parallelize. ; ;-----------------------------------------------------------------; MVK -1, B_EOB_MASK ; SHRU B_EOB_MASK, B_EOB_LEN, B_EOB_MASK ; NOT B_EOB_MASK, B_EOB_MASK ; ZERO B_numberval ; ZERO B_num_coeffs ; MV A_data_word_val, B_data_word_cpy ; ADD A_bit_pos_val, 8, A_shift_new ; ADD A_data_pointer, 1, B_data_pnt_cpy ; .mptr A_data_pointer, A_ptr+0, 4 .mptr B_data_pnt_cpy, A_ptr+0, 3 .mptr B_run_tbl, A_ptr+0, 1 .mptr B_sze_tbl, A_ptr+0, 1 .mptr B_shf_tbl, A_ptr+0, 1 ;--------------------------------------------------------------------; ; Assume worst-case wherein all accesses can cause bank-conflicts ; ; ; ; LOOP: B_EOB_VAL = A_data_word_val&B_EOB_MASK ; ; A_EOB = B_EOB_VAL == A_EOB_CODE ; ; A_lmbd_val= _lmbd(A_data_word_val) ; ; Make copy of data_pointer in B_data_pnt_cpy ;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -