Results 1 to 3 of 3

Thread: Fighting BMPreduce on ZPAQ

  1. #1
    Member toi007's Avatar
    Join Date
    Jun 2011
    Location
    Lisbon
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Fighting BMPreduce on ZPAQ

    I made a BlitzBasic test since im not a programmer that uses YUV to compress to similar to 256Kb colors, diferent from the 32Kb color of BMPreduce, that give Half of the BMP compression of a BMP with -mbmp_j4 c of ZPAQ
    My mode give 5% better but needs to be converted from BMX to remade.bmp
    do give it a test
    its just for 1024x768 bmp jpg png files
    the correct filename most be inserted
    theres few instructions
    to compress a bmx file put -mbmp_j4 c filename.bmx.zpaq filename.bmx
    to convert from the bmx file to remade.bmp just type the filename.bmx on the BMP2BMXYUV.exe

    theres the files 30Mb of samples in zip
    http://www.compressordeimagens.com/BMP2BMXYUV.zip

    if some members do give feedback... better!
    Last edited by toi007; 11th August 2011 at 01:39. Reason: format error

  2. #2
    Expert
    Matt Mahoney's Avatar
    Join Date
    May 2008
    Location
    Melbourne, Florida, USA
    Posts
    3,255
    Thanks
    306
    Thanked 779 Times in 486 Posts
    toi007 is referring to a lossy filter to improve BMP compression. "bmpreduce" is a similar program I wrote that discards the low bits. It is designed to work with the ZPAQ model bmp_j4.cfg, which uses a color transform (b,g,r) -> (g,b-g,r-g). My program uses the same transform and then discards the low 2 bits of g and the low 3 bits of the other two components, then converts back. Usually there is no noticeable difference in the image.

    410,668 lena.bmp.zpaq
    167,537 lena.bmpreduce.bmp.zpaq

    Code:
    // Lossy BMP filter v2
    // Usage: bmpreduce input.bmp output.bmp
    
    #include <stdio.h>
    #include <stdlib.h>
    
    int main(int argc, char** argv) {
    
      // Open input and output files
      if (argc<3) return printf(
        "To reduce BMP quality: bmpreduce input.bmp output.bmp\n"), 1;
      FILE* in=fopen(argv[1], "rb");
      if (!in) return perror(argv[1]), 1;
      FILE* out=fopen(argv[2], "wb");
      if (!out) return perror(argv[2]), 1;
    
      // Reduce image resolution
      for (int i=0, b, g, r;
          (b=getc(in))!=EOF && (g=getc(in))!=EOF && (r=getc(in))!=EOF; i+=3) {
        if (i>=54) {
          int cr=r-g;
          int cb=b-g;
          g=(g&-4)+2;
          cr=(cr&-8)+4;
          cb=(cb&-8)+4;
          b=cb+g;
          r=cr+g;
          if (b<0) b=0;
          if (b>255) b=255;
          if (r<0) r=0;
          if (r>255) r=255;
        }
        putc(b, out);
        putc(g, out);
        putc(r, out);
      }
      return 0;
    }
    Anyway you can compare for yourself. Image quality is subjective.

  3. #3
    Member toi007's Avatar
    Join Date
    Jun 2011
    Location
    Lisbon
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    I got some improvement on BMX fighting bmpreduce

    after talking with matt mahoney i realize that I had made a good improvement by putting the compression degree on a input as we convert
    but im not a programmer soo i cant make a good speed dos or windows C++ of this.

    Its acepteble of a variation of Jpg but is a hybrid version of a lossy format and the process can be explained to someone of good soul who likes to porgram c++ on diferent formats of images to convert them to the format like bmx but if some other name can be given I accept lots of opinions
    do test this version
    http://www.compressordeimagens.com/BMXLossy10.zip
    I gives somtimes better results than JPG
    Last edited by toi007; 21st October 2011 at 15:49.

Similar Threads

  1. zpaq updates
    By Matt Mahoney in forum Data Compression
    Replies: 2527
    Last Post: 4th May 2019, 13:33
  2. ZPAQ self extracting archives
    By Matt Mahoney in forum Data Compression
    Replies: 31
    Last Post: 17th April 2014, 04:39
  3. ZPAQ 1.05 preview
    By Matt Mahoney in forum Data Compression
    Replies: 11
    Last Post: 30th September 2009, 05:26
  4. zpaq 1.02 update
    By Matt Mahoney in forum Data Compression
    Replies: 11
    Last Post: 10th July 2009, 01:55
  5. ZPAQ pre-release
    By Matt Mahoney in forum Data Compression
    Replies: 54
    Last Post: 23rd March 2009, 03:17

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •