/* SIERRA : Lookup table for Sierra-filter error distribution dithering.
** The Sierra filter is laid out like this:
**
**                X  5  3   (X is the current pixel, and each number is
**          2  4  5  4  2   the fraction of pixel error distributed to
**             2  3  2      the pixel at that relative location)
**
** For each error value, add 255 to get the first index into the sierra[]
** array and the five values at that point are the errors: first the value
** for the 4s in the pattern above, then the 3s, the 2s, and the two 5s.
** These last two are different because one has been tweeked so that the
** fractions add up properly.  Many thanks to Frankie Sierra of Livermore,
** CA for this filter.
*/

#ifndef UTYPEDEFS
  #include "typedefs"
#endif
GLOBAL S8 sierra[512][5]
#ifdef MAIN_MODULE
= {
  -32,-24,-15,-41,-42,-32,-24,-15,-41,-41,-32,-24,-15,-40,-41,-32,-24,-15,-40,
  -40,-32,-23,-15,-40,-41,-32,-23,-15,-40,-40,-31,-23,-15,-40,-41,-31,-23,-15,
  -40,-40,-31,-23,-15,-39,-40,-31,-23,-15,-39,-39,-30,-23,-15,-39,-40,-30,-23,
  -15,-39,-39,-30,-22,-15,-39,-40,-30,-22,-15,-39,-39,-30,-22,-15,-38,-39,-30,
  -22,-15,-38,-38,-30,-22,-14,-39,-40,-30,-22,-14,-39,-39,-30,-22,-14,-38,-39,
  -30,-22,-14,-38,-38,-30,-22,-14,-37,-38,-29,-22,-14,-38,-38,-29,-22,-14,-37,
  -38,-29,-22,-14,-37,-37,-29,-21,-14,-37,-38,-29,-21,-14,-37,-37,-29,-21,-14,
  -36,-37,-28,-21,-14,-37,-37,-28,-21,-14,-36,-37,-28,-21,-14,-36,-36,-28,-21,
  -14,-35,-36,-28,-21,-14,-35,-35,-28,-21,-13,-36,-37,-28,-21,-13,-36,-36,-28,
  -21,-13,-35,-36,-28,-21,-13,-35,-35,-28,-20,-13,-35,-36,-28,-20,-13,-35,-35,
  -27,-20,-13,-35,-36,-27,-20,-13,-35,-35,-27,-20,-13,-34,-35,-27,-20,-13,-34,
  -34,-26,-20,-13,-34,-35,-26,-20,-13,-34,-34,-26,-19,-13,-34,-35,-26,-19,-13,
  -34,-34,-26,-19,-13,-33,-34,-26,-19,-13,-33,-33,-26,-19,-12,-34,-35,-26,-19,
  -12,-34,-34,-26,-19,-12,-33,-34,-26,-19,-12,-33,-33,-26,-19,-12,-32,-33,-25,
  -19,-12,-33,-33,-25,-19,-12,-32,-33,-25,-19,-12,-32,-32,-25,-18,-12,-32,-33,
  -25,-18,-12,-32,-32,-25,-18,-12,-31,-32,-24,-18,-12,-32,-32,-24,-18,-12,-31,
  -32,-24,-18,-12,-31,-31,-24,-18,-12,-30,-31,-24,-18,-12,-30,-30,-24,-18,-11,
  -31,-32,-24,-18,-11,-31,-31,-24,-18,-11,-30,-31,-24,-18,-11,-30,-30,-24,-17,
  -11,-30,-31,-24,-17,-11,-30,-30,-23,-17,-11,-30,-31,-23,-17,-11,-30,-30,-23,
  -17,-11,-29,-30,-23,-17,-11,-29,-29,-22,-17,-11,-29,-30,-22,-17,-11,-29,-29,
  -22,-16,-11,-29,-30,-22,-16,-11,-29,-29,-22,-16,-11,-28,-29,-22,-16,-11,-28,
  -28,-22,-16,-10,-29,-30,-22,-16,-10,-29,-29,-22,-16,-10,-28,-29,-22,-16,-10,
  -28,-28,-22,-16,-10,-27,-28,-21,-16,-10,-28,-28,-21,-16,-10,-27,-28,-21,-16,
  -10,-27,-27,-21,-15,-10,-27,-28,-21,-15,-10,-27,-27,-21,-15,-10,-26,-27,-20,
  -15,-10,-27,-27,-20,-15,-10,-26,-27,-20,-15,-10,-26,-26,-20,-15,-10,-25,-26,
  -20,-15,-10,-25,-25,-20,-15,-9,-26,-27,-20,-15,-9,-26,-26,-20,-15,-9,-25,-26,
  -20,-15,-9,-25,-25,-20,-14,-9,-25,-26,-20,-14,-9,-25,-25,-19,-14,-9,-25,-26,
  -19,-14,-9,-25,-25,-19,-14,-9,-24,-25,-19,-14,-9,-24,-24,-18,-14,-9,-24,-25,
  -18,-14,-9,-24,-24,-18,-13,-9,-24,-25,-18,-13,-9,-24,-24,-18,-13,-9,-23,-24,
  -18,-13,-9,-23,-23,-18,-13,-8,-24,-25,-18,-13,-8,-24,-24,-18,-13,-8,-23,-24,
  -18,-13,-8,-23,-23,-18,-13,-8,-22,-23,-17,-13,-8,-23,-23,-17,-13,-8,-22,-23,
  -17,-13,-8,-22,-22,-17,-12,-8,-22,-23,-17,-12,-8,-22,-22,-17,-12,-8,-21,-22,
  -16,-12,-8,-22,-22,-16,-12,-8,-21,-22,-16,-12,-8,-21,-21,-16,-12,-8,-20,-21,
  -16,-12,-8,-20,-20,-16,-12,-7,-21,-22,-16,-12,-7,-21,-21,-16,-12,-7,-20,-21,
  -16,-12,-7,-20,-20,-16,-11,-7,-20,-21,-16,-11,-7,-20,-20,-15,-11,-7,-20,-21,
  -15,-11,-7,-20,-20,-15,-11,-7,-19,-20,-15,-11,-7,-19,-19,-14,-11,-7,-19,-20,
  -14,-11,-7,-19,-19,-14,-10,-7,-19,-20,-14,-10,-7,-19,-19,-14,-10,-7,-18,-19,
  -14,-10,-7,-18,-18,-14,-10,-6,-19,-20,-14,-10,-6,-19,-19,-14,-10,-6,-18,-19,
  -14,-10,-6,-18,-18,-14,-10,-6,-17,-18,-13,-10,-6,-18,-18,-13,-10,-6,-17,-18,
  -13,-10,-6,-17,-17,-13,-9,-6,-17,-18,-13,-9,-6,-17,-17,-13,-9,-6,-16,-17,-12,
  -9,-6,-17,-17,-12,-9,-6,-16,-17,-12,-9,-6,-16,-16,-12,-9,-6,-15,-16,-12,-9,
  -6,-15,-15,-12,-9,-5,-16,-17,-12,-9,-5,-16,-16,-12,-9,-5,-15,-16,-12,-9,-5,
  -15,-15,-12,-8,-5,-15,-16,-12,-8,-5,-15,-15,-11,-8,-5,-15,-16,-11,-8,-5,-15,
  -15,-11,-8,-5,-14,-15,-11,-8,-5,-14,-14,-10,-8,-5,-14,-15,-10,-8,-5,-14,-14,
  -10,-7,-5,-14,-15,-10,-7,-5,-14,-14,-10,-7,-5,-13,-14,-10,-7,-5,-13,-13,-10,
  -7,-4,-14,-15,-10,-7,-4,-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,11,8,5,14,14,11,8,5,14,15,11,8,5,15,15,11,8,5,15,
  16,12,8,5,15,15,12,8,5,15,16,12,9,5,15,15,12,9,5,15,16,12,9,5,16,16,12,9,5,
  16,17,12,9,6,15,15,12,9,6,15,16,12,9,6,16,16,12,9,6,16,17,12,9,6,17,17,13,9,
  6,16,17,13,9,6,17,17,13,9,6,17,18,13,10,6,17,17,13,10,6,17,18,13,10,6,18,18,
  14,10,6,17,18,14,10,6,18,18,14,10,6,18,19,14,10,6,19,19,14,10,6,19,20,14,10,
  7,18,18,14,10,7,18,19,14,10,7,19,19,14,10,7,19,20,14,11,7,19,19,14,11,7,19,
  20,15,11,7,19,19,15,11,7,19,20,15,11,7,20,20,15,11,7,20,21,16,11,7,20,20,16,
  11,7,20,21,16,12,7,20,20,16,12,7,20,21,16,12,7,21,21,16,12,7,21,22,16,12,8,
  20,20,16,12,8,20,21,16,12,8,21,21,16,12,8,21,22,16,12,8,22,22,17,12,8,21,22,
  17,12,8,22,22,17,12,8,22,23,17,13,8,22,22,17,13,8,22,23,17,13,8,23,23,18,13,
  8,22,23,18,13,8,23,23,18,13,8,23,24,18,13,8,24,24,18,13,8,24,25,18,13,9,23,
  23,18,13,9,23,24,18,13,9,24,24,18,13,9,24,25,18,14,9,24,24,18,14,9,24,25,19,
  14,9,24,24,19,14,9,24,25,19,14,9,25,25,19,14,9,25,26,20,14,9,25,25,20,14,9,
  25,26,20,15,9,25,25,20,15,9,25,26,20,15,9,26,26,20,15,9,26,27,20,15,10,25,25,
  20,15,10,25,26,20,15,10,26,26,20,15,10,26,27,20,15,10,27,27,21,15,10,26,27,
  21,15,10,27,27,21,15,10,27,28,21,16,10,27,27,21,16,10,27,28,21,16,10,28,28,
  22,16,10,27,28,22,16,10,28,28,22,16,10,28,29,22,16,10,29,29,22,16,10,29,30,
  22,16,11,28,28,22,16,11,28,29,22,16,11,29,29,22,16,11,29,30,22,17,11,29,29,
  22,17,11,29,30,23,17,11,29,29,23,17,11,29,30,23,17,11,30,30,23,17,11,30,31,
  24,17,11,30,30,24,17,11,30,31,24,18,11,30,30,24,18,11,30,31,24,18,11,31,31,
  24,18,11,31,32,24,18,12,30,30,24,18,12,30,31,24,18,12,31,31,24,18,12,31,32,
  24,18,12,32,32,25,18,12,31,32,25,18,12,32,32,25,18,12,32,33,25,19,12,32,32,
  25,19,12,32,33,25,19,12,33,33,26,19,12,32,33,26,19,12,33,33,26,19,12,33,34,
  26,19,12,34,34,26,19,12,34,35,26,19,13,33,33,26,19,13,33,34,26,19,13,34,34,
  26,19,13,34,35,26,20,13,34,34,26,20,13,34,35,27,20,13,34,34,27,20,13,34,35,
  27,20,13,35,35,27,20,13,35,36,28,20,13,35,35,28,20,13,35,36,28,21,13,35,35,
  28,21,13,35,36,28,21,13,36,36,28,21,13,36,37,28,21,14,35,35,28,21,14,35,36,
  28,21,14,36,36,28,21,14,36,37,28,21,14,37,37,29,21,14,36,37,29,21,14,37,37,
  29,21,14,37,38,29,22,14,37,37,29,22,14,37,38,29,22,14,38,38,30,22,14,37,38,
  30,22,14,38,38,30,22,14,38,39,30,22,14,39,39,30,22,14,39,40,30,22,15,38,38,
  30,22,15,38,39,30,22,15,39,39,30,22,15,39,40,30,23,15,39,39,30,23,15,39,40,
  31,23,15,39,39,31,23,15,39,40,31,23,15,40,40,31,23,15,40,41,32,23,15,40,40,
  32,23,15,40,41,32,24,15,40,40,32,24,15,40,41,32,24,15,41,41,32,24,15,41,42,0,
  0,0,0,0 }
#endif
;

