顯示具有 Others 標籤的文章。 顯示所有文章
顯示具有 Others 標籤的文章。 顯示所有文章

10.25.2010

New (?) Blog

終於又可以回到 linux 了。

就跟當初因為 Windows CE 而轉換 blog一樣,這次也要轉換 blog (反正 blogger 新開 blog 不用錢 X)

R40eUbuntu

這麼奇怪的名字是因為當初是 R40e 的維護記錄。後來就當做 linux 相關blog 記錄。


* 希望我以後再也不用更新這個 site 的資料.. (>_<)

6.04.2010

IJG - Inependent JPEG Group

IJG 提供一個JPEG 操作的 library,目前已經到 v8,有持續在 update。

download source code 下來後,看一下 install.txt,裡面有說在各 platform 的 build 方法。
在 Windows VC 的話,分為兩種:
  • 使用 command line
  • 使用 VS 開project
用 VS 開 project 的方法我不會用,project 開起來會 fail,所以我只好用 command line 的方法:
  1. VC command build 用 makefile.vc,config file 用 jconfig.vc
  2. 所以先 copy 一份 jconfig.vc 為 jconfig.h
  3. nmake -f makefile.vc
OK。

要注意,在 VC Command line 下 build,要先 run 過 VC 目錄下的 SETVCVAR.BAT 設好path.


build 好後:
  • cjpeg.exe 是壓縮
  • djpeg.exe 是解壓縮


看makefile.vc 可以看一下 libjpeg 的 source,
依照 compress,decompress分成
CLIBOBJECTS= jcapimin.obj jcapistd.obj jcarith.obj jctrans.obj jcparam.obj \
jdatadst.obj jcinit.obj jcmaster.obj jcmarker.obj jcmainct.obj \
jcprepct.obj jccoefct.obj jccolor.obj jcsample.obj jchuff.obj \
jcdctmgr.obj jfdctfst.obj jfdctflt.obj jfdctint.obj
和
DLIBOBJECTS= jdapimin.obj jdapistd.obj jdarith.obj jdtrans.obj jdatasrc.obj \
jdmaster.obj jdinput.obj jdmarker.obj jdhuff.obj jdmainct.obj \
jdcoefct.obj jdpostct.obj jddctmgr.obj jidctfst.obj jidctflt.obj \
jidctint.obj jdsample.obj jdcolor.obj jquant1.obj jquant2.obj \
jdmerge.obj

只需要 decompress 的就只要 build DLIBOBJECTS 就可以

4.07.2010

some info for java KVM

java KVM 好像變成 J2ME CLDC ,然後又 opensource 變成 phoneME。

所以要 build KVM ,好像要到 sun (現在變成 oracle 了) 的 phoneME Project

有一個人 (http://www.cs.kuleuven.be/~davy/phoneme/) 真的太好心了。

不僅把 phoneME for CE 的 build process 寫好patch。
也release 他 build 好的 for KVM for CE : http://www.cs.kuleuven.be/~davy/phoneme/?q=node/10
但是 for CE 的 OS 需要 AYGSHELL.DLL


phoneME for winCE 比較麻煩的好像是 JavaCall 部份。
JavaCall 是有關手機部份的功能。


好心人的網頁有介紹 phoneME 的兩個 edition:
  • phoneME Feature -- 就是 CLDC
  • phoneME Advanced -- 就是 CDC
偉大的0xlab 竟然已經把 phoneme port 到 Android 上...

2.05.2010

音訊檔案處理軟體 Audacity

Audacity 很不錯喔。

原來是 音訊檔的 調整軟體。
可以切割/合併,增大/縮小聲音檔。

也可以產生特定的tone,波形,頻率可以自己產生。

支援 wave, mp3, flac.... 等檔案格式。

而且還是 open source 的喔

ISDB-T TRP file content info

日本 ISDB-T (13 seg) 的 streamming file : *.trp。

由 property 來看:
  • Video : Mpeg4 Video (H264) 320x172 , 14.99fps
  • Audio : AAC 48000Hz sterro 37Kbps

可以用 K lite Codec Pack 新版來看。

* 最新的版本還可以看到:

General
Complete name : G:\log.trp
Format : MPEG-TS
Format profile : No PAT/PMT
File size : 17.8 MiB

Video
ID : 1024 (0x400)
Format : AVC
Format/Info : Advanced Video Codec
Format profile : Baseline@L1.2
Format settings, CABAC : No
Format settings, ReFrames : 1 frame
Width : 320 pixels
Height : 180 pixels
Display aspect ratio : 16:9
Frame rate : 29.970 fps
Resolution : 8 bits
Colorimetry : 4:2:0
Scan type : Progressive

Audio
ID : 1280 (0x500)
Format : MPEG Audio
Video delay : -899ms

再詳細用 Play -- Filter --Audio Filte -- Proerties -- [IN]log.trp/Audio 看:

Filter : Audio Switcher - CLSID : {18C16B08-6497-420E-AD14-22D21C2CEAB7}

- Connected to:

CLSID: {0F40E1E5-4F79-4988-B1A9-CC98794E6B55}
Filter: ffdshow Audio Decoder
Pin: Out

- Connection media type:

Audio: PCM 48000Hz stereo 1536kbps

AM_MEDIA_TYPE:
majortype: MEDIATYPE_Audio {73647561-0000-0010-8000-00AA00389B71}
subtype: MEDIASUBTYPE_PCM {00000001-0000-0010-8000-00AA00389B71}
formattype: FORMAT_WaveFormatEx {05589F81-C356-11CE-BF01-00AA0055595A}
bFixedSizeSamples: 1
bTemporalCompression: 0
lSampleSize: 1
cbFormat: 18

WAVEFORMATEX:
wFormatTag: 0x0001
nChannels: 2
nSamplesPerSec: 48000
nAvgBytesPerSec: 192000
nBlockAlign: 4
wBitsPerSample: 16
cbSize: 0 (extra bytes)

pbFormat:
0000: 01 00 02 00 80 bb 00 00 00 ee 02 00 04 00 10 00 ....€.........
0010: 00 00 ..



用 一樣的 MPC MPEG Filter 來看
[IN] input:

Filter : MPC - Mpeg Splitter (Gabest) - CLSID : {DC257063-045F-4BE2-BD5B-E12279C464F0}

- Connected to:

CLSID: {E436EBB5-524F-11CE-9F53-0020AF0BA770}
Filter: G:\log.trp
Pin: Output

- Connection media type:

Unknown

AM_MEDIA_TYPE:
majortype: MEDIATYPE_Stream {E436EB83-524F-11CE-9F53-0020AF0BA770}
subtype: MEDIASUBTYPE_MPEG2_TRANSPORT {E06D8023-DB46-11CF-B4D1-00805F6CBBEA}
formattype: TIME_FORMAT_NONE {00000000-0000-0000-0000-000000000000}
bFixedSizeSamples: 1
bTemporalCompression: 0
lSampleSize: 1
cbFormat: 0

[OUT] Video

Filter : MPC - Mpeg Splitter (Gabest) - CLSID : {DC257063-045F-4BE2-BD5B-E12279C464F0}

- Connected to:

CLSID: {04FE9017-F873-410E-871E-AB91661A4EF7}
Filter: ffdshow Video Decoder
Pin: In

- Connection media type:

Video: MPEG4 Video (H264) 320x192 14.99fps

AM_MEDIA_TYPE:
majortype: MEDIATYPE_Video {73646976-0000-0010-8000-00AA00389B71}
subtype: Unknown GUID Name {31435641-0000-0010-8000-00AA00389B71}
formattype: FORMAT_MPEG2_VIDEO {E06D80E3-DB46-11CF-B4D1-00805F6CBBEA}
bFixedSizeSamples: 1
bTemporalCompression: 0
lSampleSize: 1
cbFormat: 159

VIDEOINFOHEADER:
rcSource: (0,0)-(0,0)
rcTarget: (0,0)-(0,0)
dwBitRate: 0
dwBitErrorRate: 0
AvgTimePerFrame: 667333

VIDEOINFOHEADER2:
dwInterlaceFlags: 0x00000000
dwCopyProtectFlags: 0x00000000
dwPictAspectRatioX: 320
dwPictAspectRatioY: 192
dwControlFlags: 0x00000000
dwReserved2: 0x00000000

MPEG2VIDEOINFO:
dwStartTimeCode: 0
cbSequenceHeader: 27
dwProfile: 0x00000042
dwLevel: 0x0000000c
dwFlags: 0x00000004

BITMAPINFOHEADER:
biSize: 40
biWidth: 320
biHeight: 192
biPlanes: 0
biBitCount: 0
biCompression: AVC1
biSizeImage: 0
biXPelsPerMeter: 0
biYPelsPerMeter: 0
biClrUsed: 0
biClrImportant: 0

pbFormat:
0000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0020: 00 00 00 00 00 00 00 00 c5 2e 0a 00 00 00 00 00 ...............
0030: 00 00 00 00 00 00 00 00 40 01 00 00 c0 00 00 00 ........@......
0040: 00 00 00 00 00 00 00 00 28 00 00 00 40 01 00 00 ........(...@...
0050: c0 00 00 00 00 00 00 00 41 56 43 31 00 00 00 00 .......AVC1....
0060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0070: 00 00 00 00 1b 00 00 00 42 00 00 00 0c 00 00 00 ........B.......
0080: 04 00 00 00|00 13 67 42 e0 0c b6 81 41 9f 9e 10 ......gB.A.
0090: 00 00 3e 90 00 07 53 08 40 00 04 68 ce 3c 80 ..>..S.@..h<€ - Enumerated media type 0: Set as the current media type


以上的 demuxer 是用 Gabest 的 MPEG Splitter。
這個是 open source project, Wiki : Media Player Classic

相關的Link

2.01.2010

pid and contunuity code in Transport Stream

雖然 Wiki 上寫的 pid 是在 high byte,continuity code 也是在 high byte。
但是實際上做起來:
byte 0 : sync 0x47
byte 1 : pid high and xxx bit
byte 2 : pid low and
byte 3 : continuity code and xxx

pid = ((byte1 << 8) | byte2) & 0x1FFF
cnt = byte3 % 0x0F

1.13.2010

ape.cue to mp3 with tag

要將當初保存的 losses CD 由 ape+cue轉成 有 tag的 mp3好放入 iTune:
  • 先將 ape 轉成 wave
  • 將 wave 壓成 mp3
  • 依照 cue,將 mp3 split成一首一首,並且依照 cue加入 id3tag.
每個用的工具不一樣
  • ape 轉 wave -- ffmpeg
    ffmpeg -i file.ape output.wav
  • wave 轉 mp3 -- lame
    lame -h CDImage.wav CDImage.mp3
  • split and add id3tag - mp3splt
  • mp3splt -T1 -c CDImage.cue  // 使用 id3tag ver 1 -- 其實要看一下 man
就是follow 這一篇 的說明

12.28.2009

地磁

注意事項:
  • 雖然是 1 bytes,但是只有 12 bit 的解析度,high bits (MSB) 都是 0 -- 也就是說,data 都是正值囉。
這一篇 有說,磁棒的形狀細長的話,雙極的磁力比較強。
以下是copy他的說明:

When doing measurements with a gaussmeter, please note that the actual field at the surface of a magnet is at most one half of the rated residual magnetism for that magnetic material. If a rare-earth magnet is rated at 14,000 gauss for example, a bar magnet made from that material will have an actual field of at most 7000 gauss at the north pole and -7000 gauss at the south pole. The readings may be even less than 7000 gauss. If the bar magnet is thin (that is, its length is at least 10 times its diameter) then the field will be close to 7000 gauss. If the bar magnet旧 length is less than 10 times its diameter, the field at either pole will be weaker. For example, if the magnet is in the shape of a cube, the surface field will be 4500 gauss or less. The full 14,000 gauss field can only be created if two bar magnets are in a gap configuration. This means that the magnets are held close together so that one south pole of one magnet is held very close to one north pole of the other. The distance between the magnets (the gap width) must be small compared to the magnet diameters, and each magnet旧 length must be at least 10 times its diameter. Then the field in the gap will be approximately the full value of the magnetic material旧 residual magnetism, which is 14,000 gauss in this example. Magnets that are flat (like a pancake) have a very low surface field. The magnetic pull force between equal magnets or between a magnet and a steel or iron block can be calculated from field strength. This force is approximately [Force in grams] = 0.00016 x [Field on the magnet face in gauss]2 x [Magnet face area in square cm].)
另外這一篇有說,現在地磁的強度,在地球北極(磁南極)是 0.7G (gauss),地球南極是 0.6G。地磁最小的地方是南回歸線,約 0.25G。

  • rang 是 +- 2G,分成 12 bit,所以resolution (sensitivity) 是 1/512 G。
  • 資料寫得非常不清楚,但是由 offset distribution 來看,offset 值是 2048,所以應該都是正的值,0 G 在 2048。
這個網站( http://www.ngdc.noaa.gov/geomagmodels/IGRFWMM.jsp) 可以查世界各城市的磁場強度和傾角。

查到台北地區的資料是:
Lat: 25° 1' 48''
Lon: 121° 30'
Elev: 0.00 m
Declination
+ East - West
Inclination
+ Down - Up
Horizontal Intensity
North Component
+ North - South
East Component
+ East - West
Vertical Component
+ Down - Up
Total Field
12/27/09 - 3° 57' 36° 16' 36,292.4 nT 36,206.2 nT -2500.3 nT 26,633.1 nT 45,016.2 nT
Change per year - 4' per year 0' per year -7.9 nT/year -10.7 nT/year -40.3 nT/year -3.6 nT/year -8.5 nT/year


單位:Wiki說,1 Tesla = 104Gauss

所以Taipei 的地磁通量是 0.45G。

  • 所以 量起來應該是 +- 230
  • Horizontal : 0.36G = 184
  • Vertical : 0.26G = 133



地磁量測 Sensor 通常是利用 AMR (Anisotropoc Magnetorresistive) Sensor:
ref: http://archives.sensorsmag.com/articles/0399/0399_18/main.shtml

大概是利用有磁力的鐵棒,當外部磁力影響,鐵棒變形,電阻改變,所以量測電阻就可以知道外部磁力的大小。

有因為這個鐵棒的磁力會減弱或受大外力作用而改變,所以常常需要重新加磁。

Sensor 也要內建這樣的功能。ref 是說,利用外加線圈在這些鐵棒上,通電產生磁廠就可以。
同時,控制通電的方向,可以變更鐵棒的磁極方向。
  • 這樣的動作叫 SET/RESET - 就是通電


實際量測:
  • X: 23 ~ 263 , rang: 240
  • Y:50 ~ 270, rang: 220
  • Z:

6.15.2009

M2M communicatin - by Camera and Display

machine to machine 2 way communication - in visual.

就是利用 display 和 camera 來溝通。
互相用 camera 拍攝對方的 display,
display 上顯示傳遞到對方的資料。對方就可以經由 camera "讀取" 到。

這個在目前"有 video camera"功能的手機上可以實做。
只需要software 的 effort。不需要而外增加 hardware。

顯示的內榮決定傳輸頻寬,可以利用 2D bar code或是單純的 black-white screen。

4.24.2009

撥接 GPRS..

撥接gprs 上網的動作到現在還是沒變(ref 2005)..

不同的地方就是 baudrate 變了-- 提昇到 115200。

所以在新建 modem 時,就沒得選了,只好先選一個低baudrate 的 (e.g 9600),create 完後,再將 baudrate 改 115200。

另外撥接的號碼也沒變,還是謎的 *99#
啊~不對,以前是 *99***1#
但是兩個號碼都可以..

接下來就要測 bandwidth 了..

3.25.2009

grep : find string in source

還是unix 好用,用 UnixUtil 搜尋 source 中的字串,可以用:

grep -Ir CStaticContainer *

其中..
  • -I 是說,ignore binary file
  • -r 是說,recursive
使用 grep 不能同時指定 file pattern 和 recursive,要配合 find 才行。

但是 xargs 在 Windows 下會有 "cannot fork" 的 error message。

其他:

  • -i 是說,ignore case (大小寫不管)
這一夜的說明很不錯。
http://www.esmerel.com/wagons/rob/grep.html

2.04.2009

經濟退之後 --- 犯罪率要增加了!

糟糕,朱學恆 預知到,接著 犯罪率就要增加了!

他是從台北市 塗鴉 的數量大幅度的增加 判斷的。

這也真的代表那些低區真的很少人在管。