📄 mpeg2_vld_inter_n.sa
字号:
* ------------------------------------------------------------------------- ** Run-Level "normal" code decode: run=0, level=1* ------------------------------------------------------------------------- * EXTU top0h, 25, 31, neg ; extract sign bit MV at6h, top0h ; now update * ------------------------------------------------------------------------- ** De-quantization* ------------------------------------------------------------------------- * MVK 3, level2[neg] MVK -3, level2 LDH *Wptr++, W MPY qscl, W, qW MPY qW, level2, level4[neg] ADD level4, const31, level4 ; add rounding constant SSHL level4, 15, level5 ; saturate SHR level5, shift_12Q4, level6 AND level6, mask_12Q4, level_f ADD sum, level_f, sum ; for mismatch contol ADD Zptr, 1, Zptr STH level_f, *outi* ========================================================================= ** Decode AC coefficients* ========================================================================= *ac_loop_init: NORM top0h:top0l, nrmac_loop: .trip 1 * ------------------------------------------------------------------------- ** Length computation* ------------------------------------------------------------------------- * SHL top0h:top0l, nrm, at1h:at1l ; all leading 0s/1s SHL nrm, 4, at2 ; sub-table index ADD len_tbl_adr, at2, at3 SHRU at1h:at1l, const36, at4h:at4l ; 4 extra bits LDBU *at3[at4l], len ; get length SUB const32, len, len_c* ------------------------------------------------------------------------- ** advance bitstream * ------------------------------------------------------------------------- * SHL top0h:top0l, len, at6h:at6l NORM at6h:at6l, nrm ; hi8:lo32 SHRU top1, len_c, at7 SHRU top0h:top0l, 8, empty:top0_bk MV at6h, top0h ADD at6l, at7, top0l ADD bptr, len, bptr1 CMPGT bptr1, const31, test2 [test2] MV word1, word1_rw[test2] MV word2, word1[test2] LDW *A5++, word2 AND bptr1, const31, bptr SUB const32, bptr, bptr_cmpl SHL word1, bptr, at8 SHRU word2, bptr_cmpl, at9 ADD at8, at9, top1 * ------------------------------------------------------------------------- ** Run-Level escape code decode * ------------------------------------------------------------------------- * SUB len, const24, no_esc EXTU top0_bk, 6, 26, run EXT top0_bk, 12, 20, level* ------------------------------------------------------------------------- ** Run-Level "normal" code decode* ------------------------------------------------------------------------- * SUB len, 5, rld_left CMPLT len, 5, test3[test3] ZERO rld_left SHL len, 5, t2 SHL top0_bk, rld_left, t3 ; align last 5 bits to MSB SHRU t3, 27, t3 ; keep last 5 bits inc sign ADD t2, t3, t4 ; add to sub-table index ADD t4, t4, t4b ; entries are half-words[no_esc] LDB *rld_table_adr[t4b], level ; access[no_esc] LDB *rld_table_adr_1[t4b], run ; A_rld_table_adr+1* ------------------------------------------------------------------------- * CMPGT run, const63, eob_err* ------------------------------------------------------------------------- ** De-quantization* ------------------------------------------------------------------------- * CMPLT level, 0, sign MPY level, 2, level2[!sign] ADD level2, 1, level3[sign] SUB level2, 1, level3[!eob_err] LDH *++Wptr[run], W [!eob_err] ADD Wptr, 2, Wptr [!eob_err] CMPGT Wptr, Wptr_end, eob_err MPY qscl, W, qW MPY qW, level3, level4[sign] ADD level4, const31, level4 ; add rounding constant SSHL level4, 15, level5 ; saturate SHR level5, shift_12Q4, level6 AND level6, mask_12Q4, level_f [!eob_err] ADD sum, level_f, sum ; for mismatch contol[!eob_err] LDB *++Zptr[run], Z ADD Zptr, 1, Zptr [!eob_err] STH level_f, *+outi[Z][!eob_err] B ac_loop* ========================================================================= ** Block loop: * ========================================================================= *mismatch: ADD outi, const128, outi ; start of next 8x8 block* ------------------------------------------------------------------------- ** Mismatch control: if sum is even, toggle last bit of last coefficient* ------------------------------------------------------------------------- * AND mism_bit, sum, odd [!odd] LDH *-outi[1], last_coeff[!odd] XOR mism_bit, last_coeff, last_coeff [!odd] STH last_coeff, *-outi[1] CMPGT run, const65, fault[!fault]CMPGT Wptr, Wptr_end,fault[fault] B exitcont:[cnt] BDEC block_loop, cnt* ========================================================================= ** Exit: update bistream pointer* ========================================================================= *exit: SUB A5, bsbuf, byte_diff SHR byte_diff, 2, next_wptr SHRU top0h:top0l, 8, empty1:top0 SHL top0l, 24, e0 SHRU top1, 8, e1 ADD e0, e1, top1 SUB bptr, 8, bptr CMPLT bptr, 0, lz[lz] MV word1, word2[lz] MV word1_rw, word1[lz] ADD bptr, const32, bptr[lz] SUBAW A5, 1, A5[lz] SUB A5, bsbuf, byte_diff[lz] SHR byte_diff, 2, next_wptr STW next_wptr, *+Mpeg2v[1] STW bptr, *+Mpeg2v[2] STW word1, *+Mpeg2v[3] STW word2, *+Mpeg2v[4] STW top0, *+Mpeg2v[5] STW top1, *+Mpeg2v[6] STW fault, *+Mpeg2v[12] ZERO amr_config MVC amr_config, AMR MVC csr_bk, CSR ; restore interrupts .endproc* ========================================================================= ** End of file: ti_mpeg2_vld_inter ** ------------------------------------------------------------------------- ** Copyright (c) 2001 Texas Instruments, Incorporated. ** All Rights Reserved. ** ========================================================================= *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -