中间值
数学名词
中间值 (median value),指将试验得到的若干数值以递增(或递减)的次序依次排列时,若数值的数目是奇数,中间的那个值或若数值的数目是偶数,中间两个数值的平均值。
Photoshop【中间值】:滤镜通过混合选区中像素的亮度来减少图像中的杂色。该滤镜通过搜索像素选区的半径范围来查找亮度相近的像素,清除与相邻像素差异太大的像素,并用搜索到的像素的中间亮度值替换中心像素。此滤镜在消除或减少图像中的动感效果时非常有用。
已知有三个16位二进制的数,找出中间大小的数,当有两数相等时,取相等的数
ORG 0000H AJMP MAIN ORG 0030H
MAIN: MOV SP,#60H
;=================================================================
;40H,41H为A1,42H,43H为A2, 44H,45H为A3 中值方入R2和R3中,前高后低
;=================================================================
MMN: MOV 30H,40H MOV 31H,41H MOV 32H,42H MOV 33H,43H LCALL BIJIAOS CJNE R1,#0,NN0 当R1为0时,则A1和A2相等,中值取A1 MOV R2,30H MOV R3,31H RET
NN0: CJNE R1,#1,NN1 R1为1,A1小于A2 MOV 30H,40H MOV 31H,41H MOV 32H,42H MOV 33H,43H LCALL BIJIAOS CJNE R1,#0,SS0 R1为0,则A1和A3相等,中值取A1 MOV R2,40H MOV R3,41H RET
SS0: CJNE R1,#1,SS1 R1等于1,则A1小于A3,A1小于A2 MOV 30H,42H MOV 31H,43H
MOV 32H,44H MOV 33H,45H LCALL BIJIAOS CJNE R1,#1,PP0 R1等于0则A2等于A3,又A1小于A3,A1小于A2,取A2 MOV R2,42H R1等于1则A2小于A3,又A1小于A2,取A2 MOV R3,43H RET
PP0: MOV R2,44H R1等于2或等于0,则A2大于或等于A3,又A3大于A1,取A3 MOV R3,45H RET
SS1: MOV R2,40H R1等于2,A1大于A3,又A1小于A2,取A1 MOV R3,41H RET
NN1: MOV 30H,40H A1大于A2,A1与A3比较 MOV 31H,41H MOV 32H,42H MOV 33H,43H LCALL BIJIAOS CJNE R1,#0,SS2 A1等于A3, 取A1 MOV R2,40H MOV R3,41H RET
SS2: CJNE R1,#1,SS3 A1小于A3, 取A1 MOV R2,40H MOV R3,41H RET
SS3: MOV 30H,42H A1大于A3,A1大于A2,A2与A3比较 MOV 31H,43H MOV 32H,44H MOV 33H,45H LCALL BIJIAOS CJNE R1,#1,PP2 R1等于1,A2小于A3,又A1大于A2,A3,取A3 MOV R2,44H
MOV R3,45H RET
PP2: MOV R2,42H R1不等于1,则A2不小于A3,取A2 MOV R3,43H RET
;===================================================== ;30H,31H为B1,32H,33H为B2
;=====================================================
BIJIAOS:MOV A,30H B1等于B2 R1等于0,小于时R1为1,有大于时R1为2 CJNE A,32H,LOOP0 MOV A,31H CJNE A,33H,LOOP0 MOV R1,#0 RET
LOOP0: JNC LOOP1 MOV R1,#1 RET
LOOP1: MOV R1,#2 RET END
参考资料
最新修订时间:2024-05-21 13:43
目录
概述
参考资料