Re: [問題] 快速 90/270度 旋轉
※ 引述《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
討論串 (同標題文章)
Programming 近期熱門文章
PTT數位生活區 即時熱門文章