2 * Imagesqueeze - Image codec optimized for photos.
3 * Copyright (C) 2012, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of version 2 of the GNU General Public License
7 * as published by the Free Software Foundation.
10 package eu.svjatoslav.imagesqueeze.codec;
14 final byte[] rangeMap;
17 final byte[] decodedRangeMap;
18 final byte[] decodedMap;
22 public Channel(final int width, final int height) {
23 rangeMap = new byte[width * height];
25 map = new byte[width * height];
27 decodedRangeMap = new byte[width * height];
28 decodedRangeMap[0] = (byte) 255;
30 decodedMap = new byte[width * height];
33 public void printStatistics() {
34 final float bitsPerPixel = (float) bitCount / (float) rangeMap.length;
35 System.out.println((bitCount / 8) + " bytes. " + bitsPerPixel
36 + " bits per pixel.");
41 for (int i = 0; i < decodedMap.length; i++) {
45 for (int i = 0; i < decodedRangeMap.length; i++) {
46 decodedRangeMap[i] = 0;
48 decodedRangeMap[0] = (byte) 255;
50 for (int i = 0; i < map.length; i++) {
54 for (int i = 0; i < rangeMap.length; i++) {