请选择 进入手机版 | 继续访问电脑版

Lazarus中文社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

Lazarus IDE and 组件 下载地址版权申明
查看: 5555|回复: 14

[其它] 分享几个好东西,关于压缩、加密、图形、轻量化

[复制链接]

该用户从未签到

发表于 2014-5-16 11:52:06 | 显示全部楼层 |阅读模式
       出处:http://bouchez.info/delphi.html
       我们先看看主页这段话:
If you hear all around only about Java, JavaScript, Python, Ruby or C#, don’t forget to consider Object Pascal: it is a fast, reliable, modern, complete, efficient, clear and easy language for computer programming!
IMHO, Object Pascal, with the free pascal professional compiler (32 and 64 bit, for different processors and OS), is always in the race.
Just consider how much memory this “new” platforms / languages use, and try to implement a full-text engine such as the one used in Ictus, or try to build an alternative to my Roc client, which needs no installation and is only a 300KB executable with full database and GIS access, without the headaches of C/C++
So I wanted to join the open-source community, and share some of the routines I use every day.

     可以看出作者跟我有这相同的心情,delphi/pascal有着不输C/C++的性能和易用性,却落得如今下次,免不了满心可惜。。。总之,不要忘记还有一个落寞的Object pascal,他一样能做很多事情。。

The proof by the source:

Don't forget to take a look at another project of mine, released in the Synopse web site.
[size=-1]The Synopse SQLite3 database Framework interfaces the SQlite3 database engine into pure Delphi code: database access, User Interface generation, security, i18n and reporting are handled in a safe and fast Client/Server AJAX/RESTful model.

     作者异常牛逼,C、C++、ASM、PASCAL都用上了,估计这些组件都是精品。。



回复

使用道具 举报

该用户从未签到

 楼主 发表于 2014-5-16 11:54:41 | 显示全部楼层
LZO:
http://bouchez.info/lzo.html
作者在描述中说得牛逼哄哄,C版的自行下载,Delphi版的我贴出来,C代码在这里已经变成机器码了,调用时use 它就行。

  1. {
  2.      LZO Compression / Decompression library
  3.      =======================================

  4.     * LZO is a portable lossless data compression library written in ANSI C.
  5.     * Reliable and thoroughly tested. High adoption - each second terrabytes of data
  6.       are compressed by LZO. No bugs since the first release back in 1996.
  7.     * Offers pretty fast compression and *extremely* fast decompression.
  8.     * Distributed under the terms of the GNU General Public License (GPL v2+).
  9.       Commercial licenses are available on request.
  10.     * Military-grade stability and robustness.

  11.     LZO implements a number of algorithms with the following features:
  12.         * Decompression is simple and *very* fast.
  13.         * Requires no memory for decompression.
  14.         * Compression is pretty fast.
  15.         * Requires 64 kB of memory for compression.
  16.         * Allows you to dial up extra compression at a speed cost in the compressor.
  17.           The speed of the decompressor is not reduced.
  18.         * Includes compression levels for generating pre-compressed data which
  19.           achieve a quite competitive compression ratio.
  20.         * Algorithm is thread safe.
  21.         * Algorithm is lossless.
  22.         * supports overlapping compression and in-place decompression.

  23.     LZO and the LZO algorithms and implementations are distributed under the terms
  24.     of the GNU General Public License (GPL)

  25.     (c)1996-2008 Markus F.X.J. Oberhumer http://www.oberhumer.com/opensource/lzo
  26.     Delphi adpatation (c)2008 Arnaud Bouchez http://bouchez.info

  27. }

  28. function lzo_compress(var src; srclen: integer; var dst; var dstlen: integer;
  29.   var wrkmem): integer; cdecl; // DD r閏up閞閟 directement sous Win32!
  30. asm                               // fonctionne impecc sous Linux
  31. {$ifdef Win32}
  32.   jmp _compress+$2F0+8+3   // +8=startup code, +3=apr鑣 push ebp; mov ebp,esp
  33. {$else}
  34.   pop ebp
  35.   lea eax,@dest+$2F0
  36.   jmp eax  // startupcode diff閞ent
  37. @dest: {$endif}
  38. DD $83EC8B55,$5653E8C4,$C458B57,$308558B,$FC5589D0,$89F3C283,$458BF855,$F4458918,$8B10558B
  39. DD $F08B0845,$3304C083,$8ADB33C9,$588A0348,$6E1C102,$DB33CB33,$8A05E1C1,$CB330158,$E1C1DB33
  40. DD $33188A05,$C1D98BCB,$CB0305E1,$8105E9C1,$3FFFE1,$EC4D8900,$8BF44D8B,$C8BEC5D,$3BD98B99
  41. DD $7E72085D,$FB2BF88B,$85F07D89,$817376FF,$BFFFF07D,$6A770000,$F07D81,$76000008,$3598A51
  42. DD $7403583A,$EC4D8B49,$7FFE181,$F1810000,$201F,$8BEC4D89,$5D8BF44D,$990C8BEC,$5D3BD98B
  43. DD $8B377208,$89FB2BF8,$FF85F07D,$7D812C76,$BFFFF0,$81237700,$800F07D,$A760000,$3A03598A
  44. DD $2740358,$8B6610EB,$183B6619,$598A0875,$2583A02,$4D8B1874,$EC5D8BF4,$40990489,$FF8453B
  45. DD $1D883,$FF25E900,$5D8BFFFF,$EC7D8BF4,$8BBB0489,$85DE2BD8,$89567EDB,$7D83E85D,$87703E8
  46. DD $8E85D8A,$3AEBFE5A,$12E87D83,$5D8A0B77,$3EB80E8,$EB421A88,$E87D8B29,$420002C6,$8112EF83
  47. DD $FFFF,$81127600,$FFEF,$2C600,$FFFF8142,$77000000,$88DF8BEE,$1E8A421A,$421A8846,$75E84DFF
  48. DD $3C083F5,$4003598A,$75FF583A,$4598A2D,$FF583A40,$598A2475,$583A4005,$8A1B75FF,$3A400659
  49. DD $1275FF58,$4007598A,$75FF583A,$8598A09,$FF583A40,$8B487674,$81CE2BC8,$800F07D,$F18B0000
  50. DD $4DFF2577,$49CE8BF0,$8A05E1C1,$E380F05D,$2E3C107,$A88CB0A,$F04D8B42,$8803E9C1,$F2E9420A
  51. DD $81000000,$4000F07D,$13770000,$8BF04DFF,$2E980CE,$8820C980,$C1E9420A,$81000000,$4000F06D
  52. DD $4D8B0000,$81DE8BF0,$4000E1,$2EB8000,$800BE9C1,$CB0A10C9,$E9420A88,$9C,$83FC7D8B,$2EB09C1
  53. DD $F83B4041,$198A0676,$F474183A,$CE2BC88B,$7D81F18B,$4000F0,$FF1E7700,$FE83F04D,$8B0D7721
  54. DD $2E980CE,$8820C980,$64EB420A,$C621EE83,$EB422002,$F06D813C,$4000,$7709FE83,$F04D8B1B
  55. DD $E181DE8B,$4000,$C102EB80,$C9800BE9,$88CB0A10,$34EB420A,$8B09EE83,$E181F04D,$4000
  56. DD $800BE9C1,$A8810C9,$FFFE8142,$76000000,$FFEE8112,$C6000000,$81420002,$FFFE,$8BEE7700
  57. DD $420A88CE,$80F04D8A,$E1C13FE1,$420A8802,$C1F04D8B,$A8806E9,$3BF08B42,$573F845,$FFFD52E9
  58. DD $10552BFF,$8914458B,$FC458B10,$5E5FC62B,$5DE58B5B,$909090C3,$53EC8B55,$758B5756,$C7D8B10
  59. DD $FF83DE8B,$8B04770D,$8B1BEBC7,$8B521855,$5351144D,$8458B57,$FCE6E850,$C483FFFF,$14558B14
  60. DD $C0851A03,$4D8B6676,$2BCF0308,$8BF33BC8,$3D1175F9,$EE,$D08B0A77,$8811C280,$3FEB4313
  61. DD $7703F883,$FE430805,$F88335EB,$8B0A7712,$3E980C8,$EB430B88,$C6D08B26,$83430003,$FA8112EA
  62. DD $FF,$EA811276,$FF,$430003C6,$FFFA81,$EE770000,$8A431388,$B88470F,$F7754843,$431103C6,$430003C6
  63. DD $430003C6,$458BDE2B,$33188914,$5B5E5FC0,$9090C35D
  64. end;

  65. function lzo_decompress(var src; srclen: integer; var dst; var dstlen: integer): integer; cdecl;
  66. asm
  67. DB $51
  68. DD $458B5653,$C558B08,$F08BD003,$33FC5589,$144D8BD2,$68A1189,$3C10558B,$331C7611,$83C88AC9
  69. DD $8346EFC1,$820F04F9,$1C9,$8846068A,$75494202,$3366EBF7,$460E8AC9,$F10F983,$8D83,$75C98500,$8107EB18
  70. DD $FFC1,$3E804600,$33F47400,$83068AC0,$C8030FC0,$83068B46,$28904C6,$4904C283,$F9832F74,$8B217204,$83028906
  71. DD $C68304C2,$4E98304,$7304F983,$76C985EE,$46068A14,$49420288,$9EBF775,$8846068A,$75494202,$8AC933F7
  72. DD $F983460E,$C12B7310,$828D02E9,$FFFFF7FF,$C933C12B,$C1460E8A,$C12B02E1,$8840088A,$88A420A,$420A8840
  73. DD $288008A,$113E942,$F9830000,$8B207240,$FF428DD9,$8302EBC1,$C32B07E3,$1E8ADB33,$3E3C146,$2B05E9C1
  74. DD $D9E949C3,$83000000,$2F7220F9,$851FE183,$EB1875C9,$FFC18107,$46000000,$74003E80,$8AC033F4,$1FC08306
  75. DD $F46C803,$FBC11EB7,$FF428D02,$C683C32B,$8369EB02,$457210F9,$D98BC28B,$C108E383,$C32B0BE3,$8507E183
  76. DD $EB1875C9,$FFC18107,$46000000,$74003E80,$8ADB33F4,$7C3831E,$F46CB03,$FBC11EB7,$83C32B02,$D03B02C6
  77. DD $9A840F,$2D0000,$EB000040,$2E9C11F,$2BFF428D,$8AC933C1,$E1C1460E,$8AC12B02,$A884008,$88008A42
  78. DD $51EB4202,$7206F983,$2BDA8B37,$4FB83D8,$188B2E7C,$8904C083,$4C2831A,$8B02E983,$831A8918,$C08304C2
  79. DD $4E98304,$7304F983,$76C985EE,$40188A20,$49421A88,$15EBF775,$8840188A,$188A421A,$421A8840,$8840188A
  80. DD $7549421A,$8AC933F7,$E183FE4E,$FC98503,$FFFE4284,$46068AFF,$49420288,$C933F775,$E9460E8A,$FFFFFECA
  81. DD $8B10552B,$10891445,$75FC753B,$EBC03304,$FFF8B80D,$753BFFFF,$830372FC,$5B5E04C0,$90C35D59
  82. end;


  83. // for the following functions, store some more information in the compressed buffer:
  84. // - first integer is the source-uncompressed length, 2nd integer is the compressed length
  85. // - so you can reserve memory for dest before calling lzodecompress(source,dest)

  86. function lzocompress(var source, dest; sourcelen: integer): integer;
  87. var buf: array[word] of byte;
  88.    destB: array [0..2] of integer absolute dest;
  89. begin
  90.   lzo_compress(source,long,destB[2],result,buf);
  91.   destB[0] := sourcelen;
  92.   destB[1] := result;
  93.   inc(result,8); { size srclen+destlen }
  94. end;

  95. function lzodecompress(var source, dest: integer;
  96. var destB: array [0..2] of integer absolute source;
  97. begin
  98.   lzo_decompress(destB[2],destB[1],dest,result);
  99.   assert(result=destB[0]);
  100. end;

复制代码
回复 支持 反对

使用道具 举报

该用户从未签到

 楼主 发表于 2014-5-16 13:35:30 | 显示全部楼层
http://bouchez.info/delphi-bzip.html

Need good compression for your program, better than zip, but standard BZip2 is too slow for you?

Use my source, Luke!

Here are THREE sources/versions for Delphi:
standard C version - .obj linked
fast 100% pascal version - faster than standard C (based on freepascal library code)
fastest full asm and unrolled version

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复 支持 反对

使用道具 举报

该用户从未签到

 楼主 发表于 2014-5-16 13:47:44 | 显示全部楼层
加密组件
ired on using big libraries, like OpenSSL, for secure encryption in your programs?

You just need MyCrypto:
fastest ever 100% Delphi (and asm ;) code
AES cipher (128,192,256 bits keysize)
XOR cipher (32 bits keysize)
SHA1 - 160 bits Secure Hash
SHA256 - 256 bits Secure Hash
MD5 - 128 bits Secure Hash
ADLER32 - pas and asm version of Zip Hash
VIA PADLOCK optional support - native .o code (Linux) or .dll (Win32) - tested on a C7 Dedibox
can use multi-thread code for multi-core CPU
weak password reinforcement
demo program included
Free source code download

Christmas 2009 update:
You can download an updated version within the Synopse SQLite3 database framework.
The unit is named SynCrypto.pas.

Simple to use through:
procedures for working from/to memory/streams
TAesWriteStream (TStream descendant)

Some benchmark (send me yours):
AMD64 TL-56: 40MB/s for AES256 (68MB/s with 2 cores), 62MB/s for SHA256, 3342MB/s for XOR
C7 with Padlock: 2083MB/s for AES256, 468MB/s for SHA256, 1704MB/s for XOR

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复 支持 反对

使用道具 举报

该用户从未签到

 楼主 发表于 2014-5-16 13:51:22 | 显示全部楼层
直接应用SSE CPU指令的Jpeg组件
Delphi (since the version 3, I guess) is shipped with the standard Jpeg library implementation, from the Independent JPEG Group(IJG). It links C-compiled code under Windows, or can link to standard-supplied libjpeg.so from your Linux distribution.

Nowadays, most applications (Dot Net, GDI+ oriented) use Microsoft's standard IPicture component, available as a COM object interface to any language, in any modern Windows system. It not only handles JPEG files, but works with GIF, BMP, and other formats.

At the beginning of this century, Intel released an optimized library for manipulating Jpeg images, the “Intel Jpeg Library” (IJL) . This implementation, on MMX- enabled OB systems, was two or three times faster than Microsoft or IJG implementation. So why don’t we use it?

Here is my attempt to unify IJG and IJL approach: MyJpeg.pas links to the IJG .obj files, and, if the IJL dll is available, will use it. The interesting point is that it defines a “quite” standard TJpegImage class, which exposes most properties of the Borland implementation. So you just have to rename Jpeg to MyJpeg in your uses clause, and your software will gain from the IJL library.

Sometimes, the IJL fails to download pictures - in this case, my TJpegImage object will transparently read it using the standard IJG, which, by definition, never fails.

Officially, “Intel no longer supports this old library and strongly recommends users to check the Intel IPP that will bring more benefits for functionalities and performance”. But this new library is not free to use on Windows, and guess its size? Ten of megabytes, of course, comparing to the 190kB of our old ijl15.dll. So make up your mind, and remember that MyJpeg can make use of IJG code if IJL fails. We won’t need Intel support this time.
Source code is licensed under the MPL.

Note: The IJL15.dll is available with the installer distribution of my MicroPic utility, which makes use of MyJpeg library.

Take a look at my new pure Delphi unit (no .dll required) for reading jpeg images on SSE and SSE2 CPU.

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复 支持 反对

使用道具 举报

该用户从未签到

 楼主 发表于 2014-5-16 13:53:56 | 显示全部楼层
Light VCL
轻量化 VCL
LVCL - 'Light VCL' - as its name states, is a "light" version of the VCL Delphi library. It's compatible with DFM forms: just extract in some directory, put this LVCL directory in your Project/Options/Path/SearchPath directory list (to override standard Borland library), and your .EXE will shrink from 300KB to 30KB... Perfect for some programs (installation, server, background tool...)

That’s no magic, only optimization to the only-needed features of a minimal Delphi application!

Download the full source code for free.
"Christmas 2009" updated version.

Notes about SysUtils.pas:
Some routines are improved/faster than original
Simple but sufficient TThread support
Dates have a fixed format: 'YYYY/MM/DD hh:mm:ss'
format() supports %% %s %d %x %.prec? %index:?
Cross-Platform: Windows or Linux

Notes about Classes/Controls/ExtCtrls/Graphics/Forms:
compatible with the standard .DFM files
only use existing properties in your DFM, otherwise you'll get error on startup
TForm can be easily minimized to tray
Implements TButton, TCheckBox, TEdit, TLabel, TMemo, TBrush, TCanvas, TFont, TPen, TPicture, TImage, TStream, TMemoryStream, TResourceStream, TReader, TList, TStringList

More details are available in the source code.
This source is based on VCL Light by Paul Toth, from which I took the principles and just went further.

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复 支持 反对

使用道具 举报

该用户从未签到

发表于 2014-5-24 17:39:24 | 显示全部楼层
确实牛人,很有用,收藏学习。
回复 支持 反对

使用道具 举报

该用户从未签到

发表于 2014-5-24 17:39:35 | 显示全部楼层
确实牛人,很有用,收藏学习。
回复 支持 反对

使用道具 举报

该用户从未签到

发表于 2014-5-24 17:40:09 | 显示全部楼层
英语看的有的累
回复 支持 反对

使用道具 举报

该用户从未签到

发表于 2014-5-24 23:57:01 | 显示全部楼层

Hprose 全名是高性能远程对象服务引擎。 它是一个新型的轻量级跨语言跨平台面向对象的高性能远程动态通讯中间件。它不但易学易用,而且功能强大。你只需要一点时间学习,就可以用它来轻松构建跨语言跨平台的分布式应用系统。 本项目是 Hprose 的 Delphi/Lazarus 版本实现。

项目地址:https://github.com/hprose/hprose-delphi

国内镜像地址:
https://code.csdn.net/Hprose/hprose-delphi
http://gitcafe.com/hprose/hprose-delphi
回复 支持 反对

使用道具 举报

QQ|手机版|小黑屋|Lazarus中国|Lazarus中文社区 ( 鄂ICP备16006501号-1

GMT+8, 2019-9-19 20:58 , Processed in 0.134370 second(s), 27 queries .

Powered by Discuz! F1.0 Build 20160930

© 2001-2019 Comsenz Inc. & Discuz! Fans

快速回复 返回顶部 返回列表