Filed under Uncategorized by victor | 1 comment
Mac 上的 TextMate 最有名的 feature 就是會幫你補完程式碼,vim 也有個叫 snippetsEmu 的 plugin。好久以前曾經試用過,覺得很難用,而且 coding style 很醜 XD
今天我發現 vim 現在有個叫 snipMate 的 plugin,做的比 snippetsEmu 好很多! 另外,snippetsEmu 也已經一年多沒更新了,snipMate 則比較活躍,也比較令人期待。不多說,直接看作者提供的 screencast 吧:
snipMate.vim Introductory Screencast from Michael Sanders on Vimeo.
除此之外,它的 snippet 還支援 backtick 跟 vim script:
snippet date
`system("date +%Y-%m-%d")`
snippet filename_foo
`filename()`
如果你用 Emacs,可以試試 gugod 提到的 yasnippet。
Filed under Uncategorized by victor | 1 comment
為了做 MULTIMEDIA ANALYSIS AND INDEXING 這門課的 project,我們這組需要從 MPEG video 裡面取出 motion vector(它在 MPEG video 裡的用途是用來做壓縮。一個物體在畫面裡面移動時,其實只需要描述它的位移,而不需整個重新 encode)。
不知道是不是因為大部分的人需要的都是 video 的 frame,而不是 motion vector(其實在解壓縮時只差一步),我 google 了好久都找不到工具可以用。後來發現 ffmpeg 的 ffplay 可以直接把 motion vector 邊撥邊畫出來,但是還是沒辦法 dump 出來。
$ ffplay -vismv 3 xxx.mpg
vismv 那個參數其實是三個 bit,第一個 bit 代表 P-Frame,第二個代表 B-Frame 的 forward motion vector,第三個 bit 則是 B-Frame 的 backward vector。
不過,這只能看。所以我參考 Using libavformat and libavcodec 跟 ffplay 的 source code 寫了一個程式。這個程式可以把 video 每個 frame (除了沒有 motion vector 的 I-Frame)的 motion vector 取出來。如果要改成取第幾個 frame、或是某個 range 之類的,也很好改。
g++ compile 時需要加上 -lavcodec -lavformat 兩個參數,當然也要先裝上 libavcodec 跟 libavformat 兩個 library。有裝 ffmpeg 就會有。
http://victor.csie.org/archive/motion_vector.cpp
Filed under Uncategorized by victor | 2 comments
No English version again. Should I just remove English version from my bog?
Filed under Uncategorized by victor | 0 comments
Filed under Uncategorized by victor | 0 comments
在 Jserv’s blog 上看到一篇文章:
自我複製程式理論依據
提到 zao 的文章: http://s88.dyndns.org/index.php?p=144#more-144 ,他用
Turing Machine 來 prove 並 implement 一個 self-reproduce 的程式。
寫得還不錯