Arsip: Mencari metoda Capture Screen yang cepat
more 16 years ago
mat_koder
Temen-temen,
Ada yg tahu cara nge-capture Screen yang lebih cepat dari pada metoda GDI API : BitBlt ?.
Dengan BitBlt saya temukan di XP lambat hasilnya jika Hardware Acceleration di-full kan ( keadaan yg mayoritas ditemukan pada instalasi Windows).
Untuk mendapatkan performa yg maksimal , hardware acceleration harus di-set ke minimal ( turned off).
procedure TForm1.Button1Click(Sender: TObject);
var
nScreenWidth, nScreenHeight : integer;
hDesktopWnd : HWND;
hDesktopDC, hCaptureDC : HDC;
hCaptureBitmap : HBITMAP;
val : DWORD;
i: integer;
begin
nScreenWidth := GetSystemMetrics(SM_CXSCREEN);
nScreenHeight := GetSystemMetrics(SM_CYSCREEN);
hDesktopWnd := GetDesktopWindow();
hDesktopDC := GetDC(hDesktopWnd);
hCaptureDC := CreateCompatibleDC(hDesktopDC);
hCaptureBitmap :=CreateCompatibleBitmap(hDesktopDC,
nScreenWidth, nScreenHeight);
SelectObject(hCaptureDC,hCaptureBitmap);
val := GetTickCount;
for i:=1 to 10 do
BitBlt(hCaptureDC,0,0,nScreenWidth,nScreenHeight,
hDesktopDC,0,0,SRCCOPY);
val := GetTickCount-val;
ShowMessage(inttostr(val div 10 ));
ReleaseDC(hDesktopWnd,hDesktopDC);
DeleteDC(hCaptureDC);
DeleteObject(hCaptureBitmap);
end;
Sebagai gambaran , dengan kode di atas pada Full Acceleration, sekali capture membutuhkan 650 ms dibanding 22 ms dengan No Acceleration. Screen di-set pada 1024 x 768.
HW: PIII-550 dengan ATI Rage II.
Sudah dicoba dengan driver bawaan Window maupun dengan driver dari ATI sendiri dengan hasil yg relatif sama.
Ada ngga ya cara yg lebih cepat?
more 16 years ago
DelphiExpert
setahuku kebanyakan akses ke video memory, diperlukan driver (hook) khusus utk keperluan itu.
siapa tahu bisa gunakan hook DLL http://www.codeproject.com/tools/screen_snaper.asp?df=100&forumid=13697&exp=0&select=886956
more 16 years ago
DelphiExpert
It may be a hardware limitation. If the driver reads back from the graphics card then it encounters a hardware bottleneck.
The back channel from the graphics card is really slow for PCI and AGP. PCI express solves that problem.
The speed of screenshotting depends on several things:
(1) Sometimes using 16bpp is faster, sometimes not.
(2) The graphics driver is VERY important!! The NVidia and ATI drivers which ship with XP are awfully slow at screenshotting. Put up to date drivers on your PC and suddenly screenshotting flies.
(3) With newer drivers you should generally set the bitmap's screendepth to the same depth as the screen. This is not always the fastest, but most of the time.
(4) DirectX is another possibility to get the screen content. But I don't think it will be noticably faster than BitBlt.
(5) PCIExpress cards will most likely be 2x - 4x faster than AGP cards.
(6) In XP using 100% video acceleration is slightly slower than 0% for screenshotting.
(7) In 9x using 100% video acceleration is heavily faster than 0% for screenshotting.
more 16 years ago
DelphiExpert
Memang cara tercepat menggunakan BitBlt adalah dengan menonaktifkan hardware acceleration.
Programmatically setting/checking video hardware acceleration level on Windows 2000/XP
Tested the solution to work on Windows 2000 with a Matrox G450 DH and on Windows XP with some ATI graphics adapter. No warranty, but it looks like it is a general solution for XP/2K.
It works as follows:
(1) Find out the position of the current video device, information on this may be found in the registry, here:
\\HKLM\HARDWARE\DEVICEMAP\VIDEO\Device\Video0
There you will find a LPSTR type of entry, pointing to a registry key for the current video device, e.g.
"\Registry\Machine\System\ControlSet001\Services\G400\Device0"
(2) Parse that string, replacing "\Registry\Machine" with HKLM (HKEY_LOCAL_MACHINE) and open the corresponding registry key,
(3) Look for a DWORD value "Acceleration.Level". If the value does not exists, hardware acceleration is set to "Full". Otherwise, "Acceleration.Level" may be one of 0x1 to 0x5, 0x5 meaning "No Acceleration", and 0x1 meaning "All but cursor acceleration" (see "Extended Display Settings").
(4) Set the desired acceleration level, or delete the entry to set "Full" acceleration mode.
(5) Let Windows reload the display settings by using the following code:
const ENUM_CURRENT_SETTINGS = 0;
var devMode: TDevMode; // DEVMODE;
success: Boolean;
begin
success:= EnumDisplaySettings(nil, ENUM_CURRENT_SETTINGS, devMode);
if (success) then
// ChangeDisplaySettings(devMode, CDS_RESET);
end;
First, the current display settings are loaded into the devMode variable, and then, the displayed is forced to perform a reset; at this occasion, the "Acceleration.Level" value is read out from the registry and the new acceleration level is set.
another EnumDisplaySettings sample could be found here http://msdn2.microsoft.com/en-us/library/ms812499.aspx
more 16 years ago
DelphiExpert
ini juga bisa jadi rujukan http://www.xenonaut.com/resources/change_screen_resolution/index.htm
more 16 years ago
DelphiExpert
coba pelajari http://www.tightvnc.org
dia menggunakan driver khusus utk keperluan tsb... called DFMirage driver (mirror driver is a special kind of display drivers).
DFMirage driver allows direct read-only access to screen bits...
more 16 years ago
mat_koder
Screen Capture ini nantinya dipake untuk ngirim tampilan desktop ke pihak laen via network pada komunikasi peer to peer.
Nah masalahnya jika harus nge-disable akselerasi pada waktu aplikasi start dan ngembaliin ke full pada waktu aplikasi selesai kan ribet tuh. Ada sedikit screen blanking yg mengganggu pada waktu perubahan mode akselerasi.
Ntar user jadi terganggu klo aplikasi dijalanin ( efeknya mirip listrik mati sesaat gitu... ).
more 16 years ago
mat_koder
kalo ngikutin caranya aplikasi Remote Desktop yg make driver khusus rasanya jadi kompleks.
Harus nginstall driver dulu dan semakin hari kan Windows OS semakin rewel aja untuk nginstall driver pihak ke3.
Belum lagi harus nulis kode driver dulu.... kan ngga mungkin gunain driver orang laen untuk keperluan sendiri... violating TOS.
Kayanya harus tetep aja pake cara BitBlt yg primitif.... cuman jadinya frame ratenya harus di-kecilin.
more ...
- Pages:
- 1
reply |
Report Obsolete
Last Articles
Last Topic
- PascalTalk #6: (Podcast) Kuliah IT di luar negeri, susah gak sih?
by LuriDarmawan in Tutorial & Community Project more 3 years ago - PascalTalk #5: UX: Research, Design and Engineer
by LuriDarmawan in Tutorial & Community Project more 3 years ago - PascalTalk #4: Obrolan Ringan Seputar IT
by LuriDarmawan in Tutorial & Community Project more 3 years ago - PascalTalk #2: Membuat Sendiri SMART HOME
by LuriDarmawan in Tutorial & Community Project more 3 years ago - PascalTalk #3: RADically Fast and Easy Mobile Apps Development with Delphi
by LuriDarmawan in Tutorial & Community Project more 3 years ago - PascalTalk #1: Pemanfaatan Artificial Intelligence di Masa Covid-19
by LuriDarmawan in Tutorial & Community Project more 3 years ago - Tempat Latihan Posting
by LuriDarmawan in OOT more 4 years ago - Archive
- Looping lagi...
by idhiel in Hal umum tentang Pascal Indonesia more 11 years ago - [ask] koneksi ke ODBC user Dsn saat runtime dengan ado
by halimanh in FireBird more 11 years ago - Validasi menggunakan data tanggal
by mas_kofa in Hal umum tentang Pascal Indonesia more 11 years ago
Random Topic
- tanya cetak detail band Fast Report pada posisi tertentu
by shindo in Hal umum tentang Pascal Indonesia more 16 years ago - autofill pada ie dan beberapa puluh dollar
by thedelphialwaysthedelphi in Tip n Trik Pemrograman more 17 years ago - Delphi2007,ADO,Postgre
by sudrun in Lain-lain more 15 years ago - Firebird Embedded?
by deepblue in FireBird more 17 years ago - Kemampuan maksimal SQL Server 2000
by heriher in MsSQL more 15 years ago - RE: cara membuat vnc di delphi 7
by dadan in Hal umum tentang Pascal Indonesia more 18 years ago - data tidak langsung terupdate di komputer lain
by $tring in Hal umum tentang Pascal Indonesia more 16 years ago - bingung bikin project baru di delphi 2007
by hackinds in Hal umum tentang Pascal Indonesia more 16 years ago - Delphi yang digunakan
by barcode in OOT more 19 years ago - tentang suara
by ImanD in Enginering more 18 years ago