2017年7月3日 星期一

GCC compiler option 紀錄


-falign-functions

-falign-functions=n
            
           for istance, -falign-functions=32 aligns functions to the next 32-byte boundary

-falign-labels=n
         
           Align all branch targets 

-falign-loops=n

          Align loops

-falign-jumps=n

          Align branch targets, for branch targets where the targets can only be reached by jumping, no dummy operations need to be executed.

2016年12月13日 星期二

Using as (GNU Assembler)

Using as

GNU  Assembler

 主要很常用來查 Assembler Directives 

https://sourceware.org/binutils/docs-2.22/as/index.html#Top


2015年9月29日 星期二

利用 FFMPEG upscale yuv file

ffmpeg -s:v 352x288 -r 25 -i foreman_cif.yuv -vf scale=1280:720 -c:v rawvideo -pix_fmt yuv420p foreman_cif_720p.yuv

也可用於 downscale.

2015年9月22日 星期二

利用 FFMPEG 比較兩個 yuv file 的 PSNR 與 SSIM

1. 在 FFmpeg 資料夾下 make fate

2. 到 tests 資料夾裡找 tiny_psnr 與 tiny_ssim

3. tiny_psnr <file1> <file2>

2015年3月4日 星期三

FFmpeg transcode 指令

FFMPEG
// List available formats for ffmpeg
ffmpeg -pix_fmts
// Convert raw rgb565 image to png
ffmpeg -vcodec rawvideo -f rawvideo -pix_fmt rgb565 -s 1024x768 -i freescale_1024x768.raw -f image2 -vcodec png screen.png
// Convert png to raw rgb565
ffmpeg -vcodec png -i image.png -vcodec rawvideo -f rawvideo -pix_fmt rgb565 image.raw
// Convert a 720x480 NV12 (YUV 420 semi-planar) image to png
ffmpeg -s 720x480 -pix_fmt nv12 -i image-nv12.yuv -f image2 -pix_fmt rgb24 image-png.png
// Convert a 640x480 uyvy422 image to png
ffmpeg -s 640x480 -pix_fmt uyvy422 -i image-uyvy422.yuv -f image2 -pix_fmt rgb24 image-uyvy422.png



//mux 264 to avi
ffmpeg -f h264 -i <filename>.264 -vcodec copy <filename>.avi

2014年3月11日 星期二

Git 常用指令

1. git status
    可以看到目前 Git 的狀態
2. git add <filename>
    將檔案 filename 加入 staged
3. .gitignore 檔案讓你避免加入一些類型的檔案。格式大致上如下
# 註解,會被忽略。 # 不要追蹤檔名為 .a 結尾的檔案 *.a # 但是要追蹤 lib.a,即使上方已指定忽略所有的 .a 檔案 !lib.a # 只忽略根目錄下的 TODO 檔案。 不包含子目錄下的 TODO /TODO # 忽略build/目錄下所有檔案 build/ # 忽略doc/notes.txt但不包含doc/server/arch.txt doc/*.txt # ignore all .txt files in the doc/ directory doc/**/*.txt

4. git diff
命令比對目前工作目錄及暫存區域後告訴讀者哪些變更尚未被暫存。
5. git diff --staged
    這命令比對暫存區域及最後一個提交。
6. git commit -m "message" 或 git commit -m '可換行' 
7. git rm
    從已被追蹤檔案中移除並且提交
8. git log -p
    列出每次的更新之間差別的內容
9. git log --stat
    列出更新之間差別的內容的大綱
10. git commit --amend (會出現一個文書編輯器)
重新 commit ,例如想要修改上次 commit 或上次commit 漏掉了一些檔案沒 commit 可以用這個
11. git reset HEAD <filename>
將 filename 從 staged 中移除,取消暫存。
12. git checkout <PATH>
將 PATH 以下的檔案都 checkout。復原到最後一次 commit 的狀態。
13. git remote add [shortname] [url]
增加新的遠端儲存庫
14. git fetch [remote-name]
將所有本地端沒有的資料拉下來。僅僅將資料拉到本地端的儲存庫,但沒有合併,跟 git pull 不同。
15. git remote show [remote-name]
      看資訊可以看到remote branch, 跟 local branck track 的情形

16. git reset --hard 某個版本的 hash 編號   # 整個 Repository 恢復到某個版本的狀態

17. git branch 
       看 branch, 加 -d [branch name] 可以刪除 branch
18. git checkout -b [branch_name]
       直接開啟一個 branch_name 的分支並把 head 指向他。
19. git merge [branch_name]
       將 branch_name 分支和到目前 head 指向的分支。


20. git checkout --track origin/serverfix 建立一個 "tracking branch" for remote branch " origin/serverfix "

21. git branch -vv   觀察local branch 跟 remote branch 的關係

22. git reflog
      git reset [sha] 
      可以回復 git reset --hard

23. 查看 git repository 是從哪個地方 clone 的 url 位置
git config --get remote.origin.url

24. git rev-parse --verify HEAD
查看 HEAD 所指的 SHA-1 value

25. git push -u origin new_branch # 建立遠端 branch (將 new_branch 建立到遠端)

2014年2月9日 星期日

int& a = b 的解釋

以下是在 cplusplus 網頁上看到的

int a = b is setting a's VALUE to b's VALUE
int* a = &b is setting a's VALUE to the ADDRESS of b
int& a = b is setting a's ADDRESS to b's ADDRESS (a is a reference to b)

上面話的用我自己的理解來解釋如下
int& a = b 的用法就是說,將 a 的 address 設定為 b 的 address,換居話說 a 幾乎就跟 b 一模一樣。

用 printf 來表示應該如下

================================
第一個 case int a=b

int b = 5;
int a = b
pintf ( a, b, &a, &b ) 可能會有如下結果

(5, 5, 0xdfe0, 0xad06) 兩個 address 不一樣
================================


================================
第二個 case int* a=b

int b = 5;
int *a = b
pintf ( a, b, &a, &b ) 可能會有如下結果

(0xad06, 5, 0xdfe0, 0xad06)     a 的值就是 b 的 address
================================

================================
第三個 case int& a=b

int b = 5;
int &a = b
pintf ( a, b, &a, &b ) 可能會有如下結果

a = 5, b = 5, &a = 0x2a1ae39c, &b = 0x2a1ae39c
a 就是 b 
================================


第三個 case 我有真的打印來看,不會有問題。