Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.apple2.programmer > #1385

Re: Preview - BMP2DHR - BMP to DHGR - full screens and sprites

Newsgroups comp.sys.apple2.programmer
Date 2014-11-02 21:36 -0800
References <lruo22$cj9$1@speranza.aioe.org> <lte14e$gv7$1@speranza.aioe.org>
Message-ID <b67bf454-0719-48f4-8874-e660f7138351@googlegroups.com> (permalink)
Subject Re: Preview - BMP2DHR - BMP to DHGR - full screens and sprites
From BLuRry <brendan.robert@gmail.com>

Show all headers | View raw


On Sunday, August 24, 2014 7:48:08 PM UTC-5, Bill Buckels wrote:
> The other things that I noted is Psycho-Visual is working well except 
> sometimes not in the red range in an unbalanced photo which favours darker 
> red.

Changing your distance algorithm can make some difference but it really just kind of depends on what you're using it for.  I use one that is weighted heavily towards red and green taking the red level more into account as we tend to notice changed in red hues much moreso than the others.

    public static double distance(int c1[], int c2[]) {
        double rmean = ( c1[0] + c2[1] ) / 2.0;
        double r = c1[0] - c2[0];
        double g = c1[1] - c2[1];
        double b = c1[2] - c2[2];
        double weightR = 2.0 + rmean/256.0;
        double weightG = 4.0;
        double weightB = 2.0 + (255.0-rmean)/256.0;
        return Math.sqrt(weightR*(r*r) + weightG*(g*g) + weightB*(b*b)) / 1.73167;
    }

> 
> And lastly I noticed that implemenations that clip the error when it runs 
> positive over 255 or negative results in poor qulity for the same reason 
> that Atkinson's diffusion suffers... so remember if you are diffusion errors 
> especially over 3 rows, careful about clipping. The error is sytill the 
> errors until your error and your color match which ain't never gonna happen 
> even on a solid.

I had the same problem too --  and I just changed my code from using scratch images (which are locked in the 8-bit per channel RGB color scale) to int[y][x][col] arrays so that I can better diffuse extremely high amounts of error when the colors aren't aligning well.  Before this, the dither would pick solid orange (even in dhr) for pure red.  Now it is dithering orange/black.  The important thing is that lights and darks aren't quite as blown-out anymore after making this change.  It's not extremely noticeable but I think it is making a difference.

I'm still cleaning up my code but you can find it here: https://github.com/badvision/lawless-legends/blob/master/OutlawEditor/src/main/java/org/badvision/outlaweditor/apple/ImageDitherEngine.java

The routine is kind of hard to read but basically there is a partial scanline of converted pixels generated (using the JACE NTSC routines) and the algorithm picks the bit values based on how the bits affect the pixels around the bit being flipped.  The idea is that this not only picks up 560-pixel details in HGR but it also can decide to do other interesting things to get better conversions...  Still a work in progress but coming a long way from where I started in Apple Game Server!

Back to comp.sys.apple2.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Preview - BMP2DHR - BMP to DHGR - full screens and sprites "Bill Buckels" <bbuckels@mts.net> - 2014-08-06 21:25 -0500
  Re: Preview - BMP2DHR - BMP to DHGR - full screens and sprites "Bill Buckels" <bbuckels@mts.net> - 2014-08-24 19:48 -0500
    Re: Preview - BMP2DHR - BMP to DHGR - full screens and sprites "Bill Buckels" <bbuckels@mts.net> - 2014-08-24 21:57 -0500
      Re: Preview - BMP2DHR - BMP to DHGR - full screens and sprites "Bill Buckels" <bbuckels@mts.net> - 2014-08-26 07:23 -0500
        Re: Preview - BMP2DHR - BMP to DHGR - full screens and sprites Michael J. Mahon <mjmahon@aol.com> - 2014-08-26 15:30 -0500
          Re: Preview - BMP2DHR - BMP to DHGR - full screens and sprites Martin Doherty <martindoherty377@gmail.com> - 2014-08-26 13:58 -0700
            Re: Preview - BMP2DHR - BMP to DHGR - full screens and sprites Michael J. Mahon <mjmahon@aol.com> - 2014-08-26 19:01 -0500
        Re: Preview - BMP2DHR - BMP to DHGR - full screens and sprites David Schmidt <schmidtd@my-deja.com> - 2014-08-26 17:14 -0400
          Re: Preview - BMP2DHR - BMP to DHGR - full screens and sprites "Bill Buckels" <bbuckels@mts.net> - 2014-08-26 17:43 -0500
            Re: Preview - BMP2DHR - BMP to DHGR - full screens and sprites Michael J. Mahon <mjmahon@aol.com> - 2014-08-26 19:01 -0500
              Re: Preview - BMP2DHR - BMP to DHGR - full screens and sprites David Schmidt <schmidtd@my-deja.com> - 2014-08-26 21:11 -0400
        Re: Preview - BMP2DHR - BMP to DHGR - full screens and sprites awanderin <awanderin@gmail.com> - 2014-08-27 00:09 -0600
          Re: Preview - BMP2DHR - BMP to DHGR - full screens and sprites "Bill Buckels" <bbuckels@mts.net> - 2014-08-27 18:13 -0500
        Re: Preview - BMP2DHR - BMP to DHGR - full screens and sprites Polymorph <mike.a.stephens@gmail.com> - 2014-08-26 23:48 -0700
          Re: Preview - BMP2DHR - BMP to DHGR - full screens and sprites "Bill Buckels" <bbuckels@mts.net> - 2014-08-27 18:20 -0500
      Re: Preview - BMP2DHR - BMP to DHGR - full screens and sprites gids.rs@sasktel.net - 2014-11-06 07:52 -0800
        Re: Preview - BMP2DHR - BMP to DHGR - full screens and sprites "Bill Buckels" <bbuckels@mts.net> - 2014-11-08 05:04 -0600
          Re: Preview - BMP2DHR - BMP to DHGR - full screens and sprites gids.rs@sasktel.net - 2014-11-08 21:36 -0800
    Re: Preview - BMP2DHR - BMP to DHGR - full screens and sprites BLuRry <brendan.robert@gmail.com> - 2014-11-02 21:36 -0800
    Re: Preview - BMP2DHR - BMP to DHGR - full screens and sprites michael.pohoreski@gmail.com - 2015-01-01 08:06 -0800
  Re: Preview - BMP2DHR - BMP to DHGR - full screens and sprites "Bill Buckels" <bbuckels@mts.net> - 2014-08-30 21:06 -0500
  Re: Preview - BMP2DHR - BMP to DHGR - full screens and sprites "Bill Buckels" <bbuckels@mts.net> - 2014-09-01 03:50 -0500

csiph-web