2009年3月18日 星期三

PAL NTSC 詳解和 Focus的設定












PAL 864x625x50Hz = 27,000,000
NTSC 858x525x59.94 ~= 27,000,000


PAL-M (a broadcast standard) however should not be confused with "PAL-60" (a video playback system )

跟PAL-M不一樣, PAL-60 是一種 Video Playback System 而不是一廣播標準
由上圖可知 PAL 的 chrominance subcarrier 為4.43MHz
( 正確值是 4.43361875 MHz ) (NTSC是3.579545 MHz)
在focus 453的 PAL register 設定
CHR_FREQ default 0xCB8A092A
27MHz x 0xCB8A092A / 2^32 = 4.4336187487933
得證


HNDP1 是在 Sync Pulse 的後面 ( Back porch )
HNDP2 是在 Active Area的後面 (H-pulse delay, Front Porch)

而VNDP剛好相反
VNDP1 在 Vertical Sync Pulse 前面, Active Area 的後面
VNDP2 在 Vertical Sync Pulse 後面

Back porch refers to the portion in each scan line of a video signal between the end (rising edge) of the horizontal sync pulse and the start of active video. It is used to restore the black level reference in analog video.

In television broadcasting, the front porch is a brief (about 1.5 microsecond) period inserted between the end of each transmitted line of picture and the leading edge of the next line sync pulse. Its purpose was to allow voltage levels to stabilise in older televisions, preventing interference between picture lines.


在 Focus 453, High Resolution 時 MISC register 的 UIM_DEC bit要設成1, 會先把horizontal line
prescale 一半。

要使用Downscaler 時, 注意 Bypass register CAC_Bypass 和 HDS_Bypass 要設定0

2009年3月11日 星期三

To do list

1. Compile GNASH (0.8.5) in Windows & Evaluate performance
2. Compile GNASH WINCE MIPS version.

2009年3月5日 星期四

查找 nk.bin 裡的檔案

viewbin -o nk.bin | findstr /i "elo".

2009年2月24日 星期二

.NET Compact Framework 程式效能檢查方法

很簡單 只要設定
[HKEY_LOCAL_MACHINE\Software\Microsoft\.NETCompactFramework\PerfMonitor]
"Counters"=dword:1

就好了

之後Run .NET Program 然後會在根目錄下產生 "AppName".stat 這個檔案
就可以分析了

設定的code

C#


// Call this method with True to 
// turn on the peformance counters,
// or with False to turn them off.
private void SetPerfCounters(bool perfOn)
{
// Specify values for setting the registry.
string userRoot = "HKEY_LOCAL_MACHINE";
string subkey = "SOFTWARE\\Microsoft\\.NETCompactFramework\\PerfMonitor";
string keyName = userRoot + "\\" + subkey;

int PCset;
if(perfOn == true)
PCset = 1;
else
PCset = 0;

// Set the the registry value.
try
{
Registry.SetValue(keyName, "Counters", PCset);
if(perfOn == true)
MessageBox.Show("Performance Counters On");
else
MessageBox.Show("Performance Counters Off");
}
catch(System.Exception ex)
{
MessageBox.Show(ex.Message);
}
}

WINCE Power Management

我做的專案 會在6分鐘之後 沒有聲音
經調查之後發現是Power Management 關掉聲音

詳細看了一下registry setting 及 Document 後
發現重點如下


[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\Timeouts]
; @CESYSGEN IF PM_PM_DEFAULT_PDD
"ACUserIdle"=dword:3c ; in seconds
"ACSystemIdle"=dword:12c ; in seconds
"ACSuspend"=dword:0 ; in seconds
"BattUserIdle"=dword:3c ; in seconds
"BattSystemIdle"=dword:b4 ; in seconds
"BattSuspend"=dword:12c ; in seconds


如上, 系統經過 ACUserIdle 秒數之後沒動作 會進入 UserIdle模式
如又經過 ACSystemIdle 秒數沒動作 會進入 SystemIdle

在機器上 就是經過 6分鐘 ( 0x3c + 0x12c 秒)之後關掉聲音


還有 WINCE 的Power Managment 有三種方式
只能選擇其一 以避免衝突

GWES, Power Manager, User Control

GWES 是 WinCE 4.1前所用的方式
所以要用 Power Manager 管理的話 必需把 GWES相關設定關掉
如下 ( Registry Default)

; Set GWES registry keys so that it's not fighting with the PM about
; when to suspend the system. Setting DisableGwesPowerOff to a non-
; zero value tells GWES to ignore the settings of the BattPowerOff,
; ExtPowerOff, and WakeupPowerOff values.
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power]
"DisableGwesPowerOff"=dword:1

所以解法就是
在 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\Timeouts] 下
"ACUserIdle"=dword:0


// Reset Timer
You can reset the system state transition timers by creating a named auto-reset event called _T("PowerManager/ReloadActivityTimeouts") and calling SetEvent on the handle of that event. This informs the Power Manager to read transition timer settings again from the Timeouts registry key.


2008年12月25日 星期四

計算發動率

// Coverage.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include


int _tmain(int argc, _TCHAR* argv[])
{

const int Range = 6000;
int Lasting = 1500;
const int TotalTest = 20000;
const int TotalProc = 3;

unsigned char* valueArray;
valueArray = (unsigned char*)malloc(Range);

int totalCount = 0;
for ( int k = 0; k < TotalTest; k++ )
{
int r;
memset( valueArray, 0, Range );
srand( GetTickCount() + rand());
for ( int i = 0; i < TotalProc; i++ )
{
r = rand() % Range;

/*
if ( i == 3 )
Lasting = 1000;
else
Lasting = 1500;
*/


for ( int j = 0; j < Lasting; j++ )
valueArray[(r+j)%Range] = 0xAA;
}
int count = 0;
for ( int i = 0; i < Range; i++ )
if ( valueArray[i] == 0xAA )
count++;

wprintf(L" %d / %d\r\n", count, Range);
totalCount += count;
}

free( valueArray );
wprintf( L" Average %d coverage %f\r\n", totalCount / TotalTest, (double)totalCount / TotalTest /Range );
Sleep(15000);
return 0;
}

2008年11月26日 星期三

計算各部位的差異

Total 頭、頸、肩膀、披風、胸、手腕、手套、腰帶、褲子、鞋子、戒指x2、飾品x2
主武、副武、投擲
共17個部位

1‧