quan.asm

来自「利用G.723协议在DSP实现音频信号的压缩与解压缩实验」· 汇编 代码 · 共 56 行

ASM
56
字号


;/*
; * quan()
; *
; * quantizes the input val against the table of size short integers.
; * It returns i if table[i - 1] <= val < table[i].
; *
; * Using linear search for simple coding.
; */
;static int
;quan(
;	int		val,
;	short		*table,
;	int		size)
;{
;	int		i;
;
;	for (i = 0; i < size; i++)
;		if (val < *table++)
;			break;
;	return (i);
;}
;-----------------------------------------------------
       ; B=val, AR3=table
             .title   "quan.asm"  
             .include "g723_global.asm"         
             .include "g723_stat.asm"
var_val      .set     0
             .text
quan:
        frame  #-1
        nop
        nop
        stl   B, *SP(var_val)
        stm   #15-1, AR4
        mvmm  AR3, AR5
         
cmp: 
        sub   *AR5+, B
        bc    end_cmp, BLT  
        ld    *SP(var_val), B  
        banz  cmp, *AR4-
end_cmp
        nop
        nop
        ldm   AR4, B
        nop
        nop      
        sub   #14, B
        neg   B
        frame  #1
        ret     ;B=i ;AR3=table
            
             .end       

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?