/*
  This file is part of libtdepim.

  Original compface:
  Copyright (c) James Ashton - Sydney University - June 1990.

  Additions for KDE:
  Copyright (c) 2004 Jakob Schröter <js@camaya.net>

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Library General Public
  License as published by the Free Software Foundation; either
  version 2 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Library General Public License for more details.

  You should have received a copy of the GNU Library General Public License
  along with this library; see the file COPYING.LIB.  If not, write to
  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  Boston, MA 02110-1301, USA.
*/

#ifndef __KXFACE_H
#define __KXFACE_H


#include <tqobject.h>
#include <setjmp.h>

#include <tdepimmacros.h>

// #define WIDTH 48
// #define HEIGHT WIDTH

/* total number of pixels and digits */
// #define PIXELS (WIDTH * HEIGHT)
// #define WORD unsigned char
// #define MAXWORDS ((PIXELS * 2 + BITSPERWORD - 1) / BITSPERWORD)
// #define BITSPERWORD 8


typedef struct guesses
{
  char g_00[1<<12];
  char g_01[1<<7];
  char g_02[1<<2];
  char g_10[1<<9];
  char g_20[1<<6];
  char g_30[1<<8];
  char g_40[1<<10];
  char g_11[1<<5];
  char g_21[1<<3];
  char g_31[1<<5];
  char g_41[1<<6];
  char g_12[1<<1];
  char g_22[1<<0];
  char g_32[1<<2];
  char g_42[1<<2];
} Guesses;

static const Guesses G =
{
  {
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1,
    0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1,
    0, 0, 0,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    0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 
    0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
  },
  {
    0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 
    0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 
  },
  {
    0, 0, 0, 1, 0, 1, 1, 1, 
  },
  {
    0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 
    0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 
  },
  {
    0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 
    0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 
    0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 
    0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
  },
  {
    0, 1, 
  },
  {
    0, 
  },
  {
    0, 0, 0, 1, 
  },
  {
    0, 0, 0, 1, 
  }
};

typedef struct prob
{
  int p_range;
  int p_offset;
} Prob;



static const Prob levels[4][3] = {
  {{1, 255},  {251, 0}, {4, 251}},	/* Top of tree almost always grey */
  {{1, 255},  {200, 0}, {55, 200}},
  {{33, 223}, {159, 0}, {64, 159}},
  {{131, 0},  {0, 0},   {125, 131}}	/* Grey disallowed at bottom */
};

static const Prob freqs[16] = {
  {0, 0},    {38, 0},   {38, 38},  {13, 152},
  {38, 76},  {13, 165}, {13, 178}, {6, 230},
  {38, 114}, {13, 191}, {13, 204}, {6, 236},
  {13, 217}, {6, 242},  {5, 248},  {3, 253}
};

static const char HexDigits[] = "0123456789ABCDEF";


class TQImage;
class TQString;

namespace KPIM {

  class KDE_EXPORT KXFace : public TQObject
  {
    Q_OBJECT
  TQ_OBJECT

    public:
      KXFace();
      virtual ~KXFace();

      /**
       * generates the xface string from @p image
       */
      TQString fromImage(const TQImage &image);

      /**
       * creates a pixmap from @p xface
       */
      TQImage toImage(const TQString &xface);


    private:
      static const int WIDTH = 48;
      static const int HEIGHT = WIDTH;
      static const int PIXELS = (WIDTH * HEIGHT);
      static const int BITSPERWORD = 8;
      static const int MAXWORDS = ((PIXELS * 2 + BITSPERWORD - 1) / BITSPERWORD);

      int NumProbs;
      int status;
      int compface_xbitmap;

      char F[PIXELS];
      Prob *ProbBuf[PIXELS * 2];

      jmp_buf comp_env;

      typedef struct bigint
      {
        int b_words;
        unsigned char b_word[MAXWORDS];
      } BigInt;

      BigInt B;

      void RevPush(const Prob *p);
      void BigPush(Prob *p);
      int  BigPop(register const Prob *p);
      void BigDiv(register unsigned char a, register unsigned char *r);
      void BigMul(register unsigned char a);
      void BigAdd(unsigned char a);
      void BigClear();

      TQCString WriteFace();
      void UnCompAll(char *fbuf);
      void UnCompress(register char *f, register int wid, register int hei, register int lev);
      void BigWrite(register char *fbuf);
      void BigRead(register char *fbuf);
      void ReadFace(char *fbuf);
      void GenFace();
      void UnGenFace();
      void Gen(register char *f);
      void PopGreys(char *f, int wid, int hei);
      void CompAll(char *fbuf);
      void Compress(register char *f, register int wid, register int hei, register int lev);
      int  AllWhite(char *f, int wid, int hei);
      int  AllBlack(char *f, int wid, int hei);
      int  Same(register char *f, register int wid, register int hei);
      void PushGreys(char *f, int wid, int hei);


  };
} // namespace KPIM
#endif // __KXFACE_H