x86_2 filter com-less

2005-02-28
2012-12-08
  • Nobody/Anonymous

    can anybody rewrite this filter in a plain c or c++?

    i need it for using in a packer stub

     
    • Igor Pavlov

      Igor Pavlov - 2005-02-28

      It's possible. But it requires time. So if you need, you can rewrite it yourself. Or use BCJ filter instead. It's almost the same.

       
    • Nobody/Anonymous

      hi again...
      i'm using BCJ filter...in my exe packer stub..
      it's a nice filter and i'm getting extra compression with it;
      but i've implemented BCJ2...only in packing application and i've noticed extra compression;
      AcroRd32.exe 7.485KB - original
      AcroRd32.exe 2460KB BCJ (67%)
      AcroRd32.exe 2228KB BCJ2 (70%)
      (lzma - default)

      the impact of BJC on my decompressing stub is fine..1kb
      BJC2 it's impossible to be used for light decompressing in actual form...to much dependencies...over 20kb of extra code;

      and more...i don't think i can rewrite BCJ2..it seems to complicated to me ;(  even so..it tooked me 4 days to understand how to use and implement BJC (and BJC2 at compression only...crt less..no memmove,exceptions..in a light space that a unpacker stub requires);

      so i'm asking someone more experienced to help and write a light decompressing version of BJC2 flter;

      10x Igor
      it's a great thing you do here

       
      • Igor Pavlov

        Igor Pavlov - 2005-02-28

        > AcroRd32.exe 7.485KB - original
        AcroRd32.exe 2460KB BCJ (67%)
        AcroRd32.exe 2228KB BCJ2 (70%)
        (lzma - default)

        Probably you use small dictionary. BCJ2 uses 3 stream and 3 dictionaries. But with big dictionary difference must be smaller. And check with other files. AcroRd32.exe is pretty big.

         
    • Nobody/Anonymous

      in my experience the dictionary size doesn't matter to much..at least..after a cerain size...i'm telling this after performing some tests on different exe files,using all combinations;

      the filter is the key;

       
      • Igor Pavlov

        Igor Pavlov - 2005-02-28

        Just check your AReader.exe with 8 MB dictionary.

         
    • Nobody/Anonymous

      well...i'we already tested my packer with all combinations of dictionary size..and all other params;after 8MB dic..it won't pack better no matters how much i increase dic size;

      and the best aditional compression i can get...is by using those filters;

      those sizes i've posted ...it's the best i could get from lzma+filters+dict size and other params handeling;

      CBCJ2 handles "Jmp" instructions..in adition to CBCJ...so i think..this is the key of better compression...not dic size..wich after 8MB doesn't matter

       
      • Igor Pavlov

        Igor Pavlov - 2005-02-28

        So write results here for 8 MB dictionary for
        1) BCJ
        2) BCJ2.

         
    • Nobody/Anonymous

      lzma (bt2 8Mb dic)
      AcroRd32.exe 7.485KB - original
      AcroRd32.exe 2.460KB (67%) using BCJ filter
      AcroRd32.exe 2.228KB  (70%) using BCJ2 filter

       
      • Igor Pavlov

        Igor Pavlov - 2005-03-01

        What command do you use?

         
    • Nobody/Anonymous

      int CLZMACompress::LzmaCompress(LPCTSTR InFileName,DWORD dwInStart,DWORD dwInSize,void *pOutBuffer, DWORD &dwOutSize)
      {
          HRESULT result;
          UInt32 dictionary = 1 << 23;
                     UInt32 posStateBits = 2;
                     UInt32 litContextBits = 4;
                     UInt32 litPosBits = 0;
                     UInt32 algorithm = 2;
                     UInt32 numFastBytes = 128;
          const wchar_t* bt4 = L"bt2";
      ...

       
      • Igor Pavlov

        Igor Pavlov - 2005-03-01

        I mean compress by 7z.exe and write results here.

         
    • Nobody/Anonymous

      well.. ;p
      -m0=BCJ -m1=LZMA:d=23 =>2.456KB

      -m0=BCJ2 -m1=LZMA:d23 -m2=LZMA:d19 -m3=LZMA:d19 mb0:1 -mb0s1:2 -mb0s2:3
      2.476KB

      i didn't known exactly what's with those s1,s2,s3..i belived that are needed as internal buffers or something..;p that's way i was compressing only s0

      anyway...BJC uses Call conversion...do you think If Jmp is implemented the compression will be better?

       
      • Igor Pavlov

        Igor Pavlov - 2005-03-01

        1) AcroRd32.exe 2.228KB (70%) using BCJ2 filter
        2) -m0=BCJ2 -m1=LZMA:d23 -m2=LZMA:d19 -m3=LZMA:d19 mb0:1 -mb0s1:2 -mb0s2:3
        2.476KB

        2.476KB  != 2.228KB

         
    • Nobody/Anonymous

      q.e.d. :)

      well it was my mistake...today i found what's with those extra 3 buffers pushed in BCJ2 filter;
      as i said..i was compressing only s0 after calling BCJ2 filter;

       
    • Nobody/Anonymous

      7-zip version: 4.15 beta

      @ECHO OFF
      7z a -ms=off BCJ.7Z *.exe *.dll *.ocx -m0=bcj -m1=lzma:d22 -mb0:1
      7z a -ms=off BCJ2.7Z *.exe *.dll *.ocx -m0=bcj2 -m1=lzma:d22 -m2=lzma:d18 -m3=lzma:d18 -mb0:1 -mb0s1:2 -mb0s2:3
      7z l BCJ.7Z> TEST.TXT
      7z l BCJ2.7Z>> TEST.TXT

      TEST.TXT:

      Listing archive: BCJ.7z

         Date      Time    Attr         Size   Compressed  Name       
      ------------------- ----- ------------ ------------  ------------
      2005-01-25 16:37:12 ....A       522752       195261  7za.exe    
      2000-10-11 14:05:12 ....A       344064       118512  cdrflt100.dll
      2000-10-06 07:49:08 ....A       471040       200610  Cvcore90.dll
      2004-09-10 21:42:52 ....A       589824       208893  FileMenuTools.exe
      2004-09-28 23:26:52 ....A       217088        81207  flac.exe   
      1999-05-05 22:22:00 ....A       336896        95689  IMGEDIT.OCX
      2000-10-04 21:00:00 ....A       995383       357596  mfc42.dll  
      2004-08-03 20:04:48 ....A      3600384      1125958  pvengine.exe
      2003-09-25 19:02:54 ....A       846336       372698  UPXShell.exe
      2001-01-23 03:39:38 ....A      2498560      1190153  VBE6.DLL   
      ------------------- ----- ------------ ------------  ------------
                                    10422327      3946577  10 files   

      Listing archive: BCJ2.7z

         Date      Time    Attr         Size   Compressed  Name       
      ------------------- ----- ------------ ------------  ------------
      2005-01-25 16:37:12 ....A       522752       191196  7za.exe    
      2000-10-11 14:05:12 ....A       344064       117188  cdrflt100.dll
      2000-10-06 07:49:08 ....A       471040       196814  Cvcore90.dll
      2004-09-10 21:42:52 ....A       589824       206039  FileMenuTools.exe
      2004-09-28 23:26:52 ....A       217088        79709  flac.exe   
      1999-05-05 22:22:00 ....A       336896        95407  IMGEDIT.OCX
      2000-10-04 21:00:00 ....A       995383       349396  mfc42.dll  
      2004-08-03 20:04:48 ....A      3600384      1105121  pvengine.exe
      2003-09-25 19:02:54 ....A       846336       370818  UPXShell.exe
      2001-01-23 03:39:38 ....A      2498560      1114409  VBE6.DLL   
      ------------------- ----- ------------ ------------  ------------
                                    10422327      3826097  10 files   

       
      • Igor Pavlov

        Igor Pavlov - 2005-03-02

        For most files the difference is about 2%.

         

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks