在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
芯片精品文章合集(500篇!)    创芯人才网--重磅上线啦!
查看: 6871|回复: 0

求助!关于MIPS浮点数计算优化问题

[复制链接]
发表于 2008-12-9 10:16:13 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
我采用的mips核没有协处理器  处理浮点数运算的时候非常的慢    我在用软件解码滤波缩放一张2000*1500JPEG图片的时候用的时间居然要30秒  我统计出大部分的时间(20秒)是用在几行代码上    希望能有很熟悉MIPS汇编的大牛  能帮忙优化一下或者给一些启示  我把代码贴出来:
//
程序说明如下:
start_y 和 tempstart_y 和i 是UINT型(unsigned int)
NewPositionY 和testProportionHeight和PositionYxiaoshu是float型

也就是下面五行代码  由于调用的次数相当多  而我们的MIPS芯片没有协处理器  所以在下面的汇编代码中会有调用自带的浮点数运算汇编子程序去运算  这五行执行效率相当低  很占用时间  不能不加以优化
start_y = tempstart_y + i;
NewPositionY = (float)start_y*(float)testProportionHeight;
PositionYxiaoshu = NewPositionY - (UINT)NewPositionY;
NewPositionY = ( 2*PositionYxiaoshu>1 )?( NewPositionY + 1 ) : ( NewPositionY );
NewPositionY = (UINT)NewPositionY;
//下面是在调试状态下 五行代码和它们的汇编语言

start_y = tempstart_y + i;

0x80083148  storeBlock+0x114: 8fa100cc    lw    r1, 0xcc(sp)
0x8008314c  storeBlock+0x118: 8fac0030    lw    r12, 0x30(sp)
0x80083150  storeBlock+0x11c: 0c02b260    jal    __utof (0x800ac980)
0x80083154  storeBlock+0x120: 002c2021    addu  r4, r1, r12

NewPositionY = (float)start_y*(float)testProportionHeight;

0x80083158  storeBlock+0x124: 00402025    or    r4, r2, zero
0x8008315c  storeBlock+0x128: 0c02b63f    jal    __fmul (0x800ad8fc)
0x80083160  storeBlock+0x12c: 8fa500f4    lw    r5, 0xf4(sp)
0x80083164  storeBlock+0x130: 0040f025    or    r30, r2, zero

PositionYxiaoshu = NewPositionY - (UINT)NewPositionY;

0x80083168  storeBlock+0x134: 0c02b33a    jal    __ftou (0x800acce8)
0x8008316c  storeBlock+0x138: 03c02025    or    r4, r30, zero
0x80083170  storeBlock+0x13c: 0c02b260    jal    __utof (0x800ac980)
0x80083174  storeBlock+0x140: 00402025    or    r4, r2, zero
0x80083178  storeBlock+0x144: 03c02025    or    r4, r30, zero
0x8008317c  storeBlock+0x148: 0c02b689    jal    __fsub (0x800ada24)
0x80083180  storeBlock+0x14c: 00402825    or    r5, r2, zero
0x80083184  storeBlock+0x150: 0040a825    or    r21, r2, zero

NewPositionY = ( 2*PositionYxiaoshu>1 )?( NewPositionY + 1 ) : ( NewPositionY );

0x80083188  storeBlock+0x154: 02a02825    or    r5, r21, zero
0x8008318c  storeBlock+0x158: 0c02b63f    jal    __fmul (0x800ad8fc)
0x80083190  storeBlock+0x15c: 8fa400d4    lw    r4, 0xd4(sp)
0x80083194  storeBlock+0x160: 3c033f80    lui    r3, 0x3f80
0x80083198  storeBlock+0x164: 0062182a    slt    r3, r3, r2
0x8008319c  storeBlock+0x168: 10600005    beq    r3, zero, storeBlock+0x180 (0x800831b4)
0x800831a0  storeBlock+0x16c: 00000000    nop
0x800831a4  storeBlock+0x170: 03c02025    or    r4, r30, zero
0x800831a8  storeBlock+0x174: 0c02b68b    jal    __fadd (0x800ada2c)
0x800831ac  storeBlock+0x178: 8fa500d0    lw    r5, 0xd0(sp)
0x800831b0  storeBlock+0x17c: 0040f025    or    r30, r2, zero

NewPositionY = (UINT)NewPositionY;

0x800831b4  storeBlock+0x180: 0c02b33a    jal    __ftou (0x800acce8)
0x800831b8  storeBlock+0x184: 03c02025    or    r4, r30, zero
0x800831bc  storeBlock+0x188: 0c02b260    jal    __utof (0x800ac980)
0x800831c0  storeBlock+0x18c: 00402025    or    r4, r2, zero
0x800831c4  storeBlock+0x190: 0040f025    or    r30, r2, zero
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /3 下一条

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-4-20 18:07 , Processed in 0.023959 second(s), 10 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表