高压缩图像
我正在尝试做一个“远程桌面查看器”。 为此,我需要发送用户的桌面 - 这是套接字的大量信息......(特别是如果分辨率很高并且信息可以接近 5.3MB(1680X1050))
所以我开始使用 GZIP 流和 5.3 进行压缩MB 变成了 500KB,然后我添加了自己的压缩算法(我认为它称为 RLE) - 获取附近的像素并以 1)有 256 >>> 的格式编写它。 3 = 32 种颜色(红、蓝、绿各一种)并写出一行中有多少个像素具有相同的颜色。 + GZIP。
这使得压缩平均为 60~65KB - 最高可达 200KB,如果屏幕全白,压缩率也可以低于 5000。
现在 - 我想(尚未实现)关于传递每个帧之间的差异 - 对于每一行,我写下差异(像素之间)的开始位置以及差异有多长。 好吧,它可以提供帮助 - 也许我可以平均每帧获得 30KB。但对于套接字来说就很多了。
有没有人成功地解决过这个问题? (当然还有如何......)
I'm trying to do a "remote desktop viewer".
For this I need to send the user's desktop - and it's alot of infomation for sockets...(especially if the resolution is high and the information can approach to 5.3MB (1680X1050))
So I started to compress with GZIP stream and the 5.3MB became 500KB, then I added my own compress algorithm (I think it called RLE) - taking near pixels and write it in format that 1) have 256 >> 3 = 32 colors(for red,blue,green each) and write how many pixels in a row have the same color. + GZIP.
That brought the compression to be in average 60~65KB - up to 200KB and it can be also under 5000 if the screen is totally white.
Now - I thought (and haven't implemented yet) about passing the difference between each frame - for each line I write where the difference(between the pixels) is starting and how long is the difference.
well, it can help - maybe I could get 30KB for each frame in average. but for sockets it's alot.
has anyone ever succeed to fit with this problem? (and how of course...)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有一些用于压缩图像的标准算法:例如JPEG。
进一步的优化是了解有关图像的一些信息:例如在桌面上,Windows“开始”按钮、各种应用程序图标以及标题栏上的小部件等项目都是标准的:因此您可以发送它们的像素值,而不是发送它们的像素值。他们的逻辑标识符。
是的,人们已经成功地解决了这个问题:编写远程桌面软件(包括开源 VNC)的人们。
There are standard algorithms for compressing images: e.g. JPEG.
A further optimization is to know something about the image: for example on a desktop, items like the Windows Start button, and various application icons, and widgets on the title bar, are standard: so instead of sending their pixels values, you can send their logical identifiers.
Yes people have succeeded with this problem: people who write remote desktop software, including the open source VNC.
您可能希望查看 VNC。
大多数 VNC 服务器实现几种不同形式的压缩。
You may wish to review the source code of a VNC.
Most VNC servers implement several different forms of compression.