作者LPH66 (IWH68S0XZ8M89)
看板Programming
标题Re: [问题] 快速 90/270度 旋转
时间Fri Jan 4 02:14:01 2008
※ 引述《cjjj21 (追求平凡的幸福)》之铭言:
: 由於工作的关系需要一个快速的旋转函式...
: 需求是将一块 bitmap buffer 旋转後填到另一块 buffer 上...
: 例如 320x240 的 buffer, 旋转後贴到 240x320 的 buffer 上...
: 一个一个pixel搬的速度实在慢到无法接受...
: 有没有哪位大大知道一些比较快速的演算法?
: 非常感谢!!
个人以为以cpu cache的角度来说
顶多只能加速到一次搬几行/列
因为这几乎等同於矩阵转置
不管是读出方或写入方总要有一个是直的跑下来
而这个地方对cpu cache是最不利的
(因为阵列是row major排列 但直的读下来却相当於column major顺序)
--
'You've sort of made up for it tonight,' said Harry. 'Getting the
sword. Finishing the Horcrux. Saving my life.'
'That makes me sound a lot cooler then I was,' Ron mumbled.
'Stuff like that always sounds cooler then it really was,' said
Harry. 'I've been trying to tell you that for years.'
-- Harry Potter and the Deathly Hollows, P.308
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.112.30.84