One more load of old article: screen transfer algorithm

Source: Internet
Author: User
Tags pcanywhere

is still an old article written before, from other sites copied Back. This article was written in 07, the thought of childish, especially the late sermon taste particularly serious, for reference only. also, from vista, the operating system has already provided an interface similar to Mirro in the application layer, and the programmer has no need to make any changes.
============================================

Citations page: http://hi.baidu.com/cxmlqkoyadbekqd/item/4f3a361bdf32d28d89a9561b

Lao chen-why Black Hole Remote control of the screen transmission algorithm is the World's first

Http://www.138soft.com/html/tip/1/26.htm

Document Name: Lao chen-why Black Hole Remote control of the screen transmission algorithm is the World's first
Document Category: Delphi Programming article
Document Lao Chen
Release Date: 2007-04-29
Document Notes: Tibetan Whale Court
Views: 243

Why black hole remote control of the screen transmission algorithm is the World's first

<< black hole remote control >> (http://www.138soft.org/) is a long-established free domestic remote control software, and unlike similar products, each new version is to innovate for the purpose, Take substantive action to promote the progress of China's remote control. its screen transfer speed is currently the fastest in the world without the use of virtual screen Drivers.

first, explain the title, why say "world first". If you want to admit that the black hole screen transmission speed is the World's first, then you must first admit that Radmin is the fastest (logical proposition: 1:radmin is the World's first Fast. 2: black holes are faster than radmin. 3: so the black hole is the first in the world). Remote Administrator (http://www.radmin.com/) is a Russian company written by a long-range control software, now the latest version is version 3.0, the use of virtual screen drive Technology. and the version before 3.0 is direct GDI operation ( NT4 can be used under the driver). let's look at an official set of Data:

One: comparison of Radmin and real VNC 4.0 (http://www.radmin.com/products/comparisons/index.php)

123 Tests *                          Radmin 2.2Real VNC 4.0Beziers Screen Saver refreshtest details...                  3371

Official data shows that the Radmin 2.2 is 337 times times faster than real VNC 4.0 in the case of the Bell curve screen Saver.

Ii: comparison of Radmin and other similar products (http://www.radmin.com/products/comparisons/radmin_vs_netop_and_others.php)

123456789 Program name            FPS (Frames Per Second)                        Area size 32x32      Area size 64x64 RADMIN2.260,653,6NetOp Remote Control 8.024,866,6Remote Desktop               34,910,0Remote Assistance            38,210,0PcAnywhere 10.5 3,8512,5RealVNC 4.1.10,190,19Dameware 4.9.0.41,651,66

Three: comparison of Radmin and LapLink gold (http://www.radmin.com/products/comparisons/laplink.php)

123 tests *                            Radmin 2.1 laplink Gold One dragging an icon over desktop     150           1 Code class= "delphi plain" >window minimized/maximized        2             1

This data indicates that Radmin administrator is currently the fastest screen transfer software in the WORLD. in the same network environment and machine conditions, the black hole screen transmission speed faster than it, so the title of this article: why the black hole remote control of the screen transmission algorithm is the World's First.
Let's take a look at why the black hole remotely controls the screen transfer speed so Fast.
In fact, the speed of the screen transmission is determined by several aspects: crawl, compression, and network Transmission. there is nothing to break through in compression and network Transmission. for example, compression, The general principle of compression is to put a large number of the same data with very small data to Represent. for example, there is a set of data a A A A a a a a A The front 10 A is expressed in $. this is the essence of Compression. the general compression algorithm is divided into dictionary compression and tree Compression. the dictionary means, for example, the words mentioned earlier, to find the dictionary, And then restore 10 A. Dictionaries can also be classified into dynamic dictionaries and fixed dictionaries. it can also be divided into whether directly within the compressed file with a dictionary. and tree compression is what we learn in the university, such as binary tree, a bit similar to BMP bitmap and vector image, a picture, you can completely use dots and colors to represent each pixel ( Bitmaps are typically in this format), but if you zoom in on the picture, it becomes blurred. a vector chart is similar to a formula for drawing a picture. this way, even if zoomed in or out, it will not distort. in fact, these explanations of compression above me are not official standard explanations, so ask trained programmers not to delve into , after all, I am just a self-study examination graduate of the Junior college, The theory is not solid. the above statement is based on some of the compression algorithms that I actually get in touch with.
Screen compression generally does not use the dictionary compression algorithm (because the current dictionary algorithm is not specifically for BMP pictures, and the dictionary itself has a certain volume), the current more popular algorithm is actually tree algorithm, and the tree algorithm is essentially a mathematical operation, Math is something that tests the cpu. so why do we compress files when CPU usage is High.
Let's talk about network Transmission. network transmission can be substantially optimized not too much. after all, people generally use the same Winsock library. in addition, assuming that the network speed is only 56KB, you can not optimize the speed of more than 56kb/s.
so, the only thing that can break through the screen transmission is the crawl part. and the core is to send only the change part. in fact, judging the screen changes the fastest is certainly the virtual graphics driver (nt under Mirro driver,9x with DDI HOOK). It works between the display output and the display card, When the screen has not been output, it has been intercepted. interested friends can refer to the example code of the DDK band (assuming that your DDK is installed on the C drive by default, The example is located in the C:ntddksrcvideodisplaysmirror directory).
How can the application layer quickly determine the part of the screen change? We've tried the fast transmission screen in black hole 2002. the specific principle is to first grab the first one, then each back with the previous comparison, and then only send the change part. specific code can be from our homepage http:// Www.138soft.com/download. however, There are many areas that need to be optimized for this example, such as data offload compression to reduce CPU Usage.
In essence, the efficiency is very low each time the whole screen is fetched. what is our purpose? so, we just need to optimize the judgment algorithm. and the algorithm is a lot of, for example, random points, Suppose an 8x8 area, randomly take one of the points, if it changes, Then think of the area as if it had changed. this algorithm essentially handles better than radmin. the black hole uses an algorithm similar to radmin, which is a progressive scan. but more optimizations are Made.
Because I do not understand the disassembly, and radmin itself algorithm encryption is very strong, so can not be analyzed from the anti-assembly point of view. but we could use a different method to prove it. we first use Delphi to write a hook, the code is as Follows:

123456789101112131415161718192021222324252627282930 library HookGDI;{$IMAGEBASE $58800000}usesWindows, madCodeHook;conststrHookHostFile: string = ‘R_server.exe‘;var    BitBltNext: function(DestDC: HDC; X, Y, Width, Height: Integer; SrcDC: HDC;      XSrc, YSrc: Integer; Rop: DWORD): BOOL; stdcall; function BitBltCallback(DestDC: HDC; X, Y, Width, Height: Integer; SrcDC: HDC;    XSrc, YSrc: Integer; Rop: DWORD): BOOL; stdcall;var    CallFile: string;begin    Result := BitBltNext(DestDC, X, Y, Width, Height, SrcDC, XSrc, YSrc, Rop);    CallFile:= GetModuleFileName(0);    if Pos(strHookHostFile, CallFile) > 0 then    begin      TracTxt(Format(‘%s:(Dest:%d,x:%d,y:%d,Width:%d,Height:%d,SrcDC:%d,XSrc:%d,YSrc:%d,Rop:%d)‘,        [‘BitBlt‘, DestDC, X, Y, Width, Height, SrcDC, XSrc, YSrc, Rop])+#$D#$A,‘BitBlt‘);        end;end;begin    HookAPI(‘gdi32.dll‘, ‘BitBlt‘, @BitBltCallback, @BitBltNext);end.

This program is very simple, that is, hook the BitBlt function, when the R_server.exe call the function, the parameters are printed Out. Here's a set of data (800x600 Resolution) we get:
BitBlt: (dest:-1023343793,x:0,y:0,width:800,height:1,srcdc:1426129579,xsrc:0,ysrc:0,rop:13369376)
BitBlt: (dest:-1023343793,x:0,y:0,width:800,height:1,srcdc:1426129579,xsrc:0,ysrc:1,rop:13369376)
BitBlt: (dest:-1023343793,x:0,y:0,width:800,height:1,srcdc:1426129579,xsrc:0,ysrc:2,rop:13369376)
BitBlt: (dest:-1023343793,x:0,y:0,width:800,height:1,srcdc:1426129579,xsrc:0,ysrc:3,rop:13369376)
BitBlt: (dest:-1023343793,x:0,y:0,width:800,height:1,srcdc:1426129579,xsrc:0,ysrc:4,rop:13369376)
BitBlt: (dest:-1023343793,x:0,y:0,width:800,height:1,srcdc:1426129579,xsrc:0,ysrc:5,rop:13369376)
BitBlt: (dest:-1023343793,x:0,y:0,width:800,height:1,srcdc:1426129579,xsrc:0,ysrc:6,rop:13369376)
................................................................................................
BitBlt: (dest:503382584,x:0,y:0,width:800,height:1,srcdc:1426129579,xsrc:0,ysrc:8,rop:13369376)
BitBlt: (dest:503382584,x:0,y:0,width:800,height:1,srcdc:1426129579,xsrc:0,ysrc:28,rop:13369376)
................................................................................................
BitBlt: (dest:1359020403,x:0,y:0,width:800,height:1,srcdc:1426129579,xsrc:0,ysrc:18,rop:13369376)
BitBlt: (dest:1359020403,x:0,y:0,width:800,height:1,srcdc:1426129579,xsrc:0,ysrc:38,rop:13369376)

As can be seen from the above data, Radmin's algorithm essentially starts with the first line, and then scans every 10 lines. what is the role of doing this? if a row changes, then record, scan, and then combine all the changed lines, Calculate and return the changed Area.
Find the direction, the next is simple, write code is OK. and the code is just manual labor, and here is no longer a description.
It may still be asked, so that, at best, the same speed as the radmin, but also to ensure that you judge the same algorithm as Radmin. because progressive scanning is only a directionality issue. what makes you think black holes are faster than radmin? the question is very good. In the case of small screen changes, we still can't reach the same speed as it does. the big screen changes just close to its speed. later we used two optimization techniques. the first trick is the bitmap color. black hole screen transmission has its own research and development algorithm. compared to traditional algorithms, The most obvious is the client under the Windows2000 operating system, if the crawl Server screen desktop background is set to a blank desktop, and the transmission of the use of 256 colors, the transmitted image will be slightly pale. however, This format reduces data by 1/3 compared to radmin and traditional bitmap formats. This results in a significant increase in transmission speed. The second technique is scanning, essentially, windows is mostly rectangular, so, when scanning, if you scan to the title (for example, you open the calculator, a rectangle appears), then the following section must be Changed. so you should scan directly from the current coordinates, To get the area of change immediately. using the above analysis method, you can see that radmin is always a constant scan.
We have completed the development of this algorithm on June 1, 2006, and in 138, we also put a demo video and software that compares with Radmin. at the same time, applied for the computer software Copyright Application Certificate (registration number 2006sr11163). scan copy see http:// Www.138soft.org/BlackHole/arithmetic.htm. is the earliest software to implement this feature. however, it must be pointed out that if the algorithm does not stand on the giant radmin, Then it may be a lot late to realize the Time. although the whole algorithm and radmin have no actual relationship, but its implementation gives us confidence, at the GDI level can also achieve very fast speed.
finally, allow me to say a few words of complaint.
The first is that the foundation is very important. many people say that the things that school teaches are useless and backward. in fact, it is wrong. the algorithm is the soul of the Program. it's hard to imagine a high school student, not having access to data structures, Can write things that are more efficient. maybe it's ok to put together a piece of code. it is very important to write a program that is efficient and stable. otherwise you will not be able to break through if you arrive at a certain level. I've been graduating for about three years, I've written a lot of freeware at School. but after graduating, it took more than a year to re-learn the data structure. even if I went to the bookstore today, I still like to look at something similar to the math olympiad, and for the specific technology realized, but basically did not buy books. fortunately, I read the arts in high school, Give me a great understanding of the Ability.
The second is that the domestic awareness of intellectual property protection is very weak. domestic do share software should know, if your software do well, absolutely no three days, will appear keygen, crack is legal. I once saw in a cracked forum that there was a cripple who, through hard self-study, finally wrote out a shareware, But was soon cracked, he begged everyone in the crack forum not to hack his software, because his source of life is the registration Fee. in fact, This is why China's software technology has not been the core technology of its own reasons. do well, be cracked, or be reversed. Who else is going to study technology? it is said that the disassembly and cracking is conducive to technological progress, which Russia was to catch up with the United States. in fact, Russia is because of the education to catch up with the United states, rather than the so-called crack. this looks at the annual International Mathematical Olympiad winner ( China is also good, but unfortunately, the general genius of Tsinghua University after graduating abroad for other countries to effect, but some usually do not learn how often by the teacher discrimination left to leave for the country dedicated dedication). take radmin, do you think he is based on the anti-compilation of the present results? anything that is innovative, Can not be cracked, the crack is easy to cause dependence. This is why I have not studied the disassembly in Depth. people are inert, many times, people are forced out. if you have the same thing, will you study it yourself? I've learned a lot about That. The math score is not very prominent. each time is 70~80, at that provincial level school really belongs to the downstream level. but every math teacher likes me very much, why? It is very simple, I never listen carefully. before each exam, recite the formula and then go to the examination room, Problem solving is on-the-spot play. Results The teacher saw the way to solve the problem and he said not the same (mathematics is sometimes a disguised test memory, remember the solution of each type of question, and then the exam, this is also the malpractice of examination-oriented education), thought I was learning more than the circumstances of the situation and Innovation. for example, two fractions And then the numerator is big. and I multiply by the numerator and the denominator, if the numerator of a is multiplied by the denominator of b, and the numerator of B is multiplied by the denominator of a, then a must be greater than B. in fact, I was forced, I also want to use the teacher to teach the dissolution method to solve, but I did not listen. The same is true of Software. sometimes, you look at other people's things to see more, do not have their own characteristics.
Some people say that the actual situation in the domestic decision can not catch too strict, or many families do not even use computers, so destined this generation of programmers are sacrificed generation, to the next Generation. we remember when Bill Gates visited china, he exclaimed: "i don't understand why people are willing to spend 3,000 of dollars to buy color TV , but it is not possible to spend hundreds of yuan to buy the operating System. in fact, today, tens of thousands of yuan a square house people buy, How can not register a dozens of piece of software. take the remote control software, We do four years of free software, we have a very deep feeling. do regular remote control, no one can buy. Cracked pcanywhere and so on, it is necessary to spend dozens of more dollars to register your? China has never lacked a genius, just a lack of environment to force them to study. so geniuses like to take shortcuts to hack, and the only talent That's left is slowly disappearing. talent sometimes is a sorrow, Because most geniuses can find lazy shortcuts. and no matter in which industry, to be a really great person, only talent is not possible. that's why there are so many smart people and few successful People.
The third one is the idea of open source. I often see a lot of programs on the forum above, a person published something, the following must be followed by a large number of people called Paste Code. long ago, the programmer was very expensive, later IBM trained a large number, finally turned into 15 yuan can call a big Dozen. until today, still advocating what open source, Engage the open source community (essentially using the Programmer's free labor to fight microsoft). people open source is because one months salary to you a year, full to think lust Ah. sometimes Hou Jin don't understand, why a person hard to study things, You have to give it up for Free. and then again, you're behind. You don't have the open source. if a thing everyone knows, you need a monthly salary of 10,000, he only need 3K. and you know he knows (although you are hard to study out, he spent three minutes to see your open source understand), you think the boss will invite whom? So every time I see those people on the side of the smart stickers, and the other side where the boss of the unscrupulous suppression of wages, in fact, this is not their own to move a stone to hit their feet? is the essence of the business is the interests of the sole purpose, and the Programmer's own interests need to fight. of course, we are not against open source , we've been exposing a lot of code and tricks in the early days, and although it seems to be out of date, it's definitely up to date at the Time. we just want to not be so dry, others are open source is someone else's thing, others also have no obligation and responsibility must be open. if you run to the forum all day, say: Please give the code. then you can never progress. and it is suggested that someone else will help you with your work and you should give him your salary.
finally, some of the so-called "hackers" view. if you have noticed, in fact, 2003 years ~2004 years can be said to be the peak period of China's security research, blossom. each warrior, all kinds of skills emerge. look at today, everywhere is XX training courses, and training content has remained in 2004, The major sites are also outdated moldy tricks. The new things are few and far between. if a thing is tied to money, everything goes bad. There is no progress without communication, but if a thing can be sold, do you think there will be someone to communicate? even if he doesn't love money, he won't sell it, and he will put it away. Never let your things become a money-making tool in the hands of Others. moreover, did not hear the training of what master to come, now and the former master predecessors have not heard who is through the training to become. people who are really studious will naturally go to find information and Research. it's not good to learn, you have to use a gun to force Him.
Good advice is frankness. the best medicine is also mostly bitter. the golden mean can be used in the social sciences. but definitely not for the science. it is more unsuitable for the IT industry. otherwise, the result is "mean". hopefully, the techniques mentioned in this article allow more screen transfer software to reach international STANDARDS. Also hope this article grumble can let the motherland's it community to develop better tomorrow!

One more load of old article: screen transfer algorithm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.