removed get_row_run_lengths().

Wed, 12 Mar 2003 06:02:46 +0000

author
eric
date
Wed, 12 Mar 2003 06:02:46 +0000
changeset 96
25c6b1a63f93
parent 95
851a04fa5324
child 97
f2e13c2ff575

removed get_row_run_lengths().

bitblt.c file | annotate | diff | revisions
bitblt.h file | annotate | diff | revisions
     1.1 --- a/bitblt.c	Tue Mar 11 11:14:39 2003 +0000
     1.2 +++ b/bitblt.c	Wed Mar 12 06:02:46 2003 +0000
     1.3 @@ -4,7 +4,7 @@
     1.4   *      will be compressed using ITU-T T.6 (G4) fax encoding.
     1.5   *
     1.6   * bitblt routines
     1.7 - * $Id: bitblt.c,v 1.13 2003/02/23 09:40:41 eric Exp $
     1.8 + * $Id: bitblt.c,v 1.14 2003/03/11 22:02:46 eric Exp $
     1.9   * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com>
    1.10   *
    1.11   * This program is free software; you can redistribute it and/or modify
    1.12 @@ -726,87 +726,3 @@
    1.13  }
    1.14  
    1.15  
    1.16 -int32_t get_row_run_lengths (Bitmap *src,
    1.17 -			     int32_t y,
    1.18 -			     int32_t min_x, int32_t max_x,
    1.19 -			     int32_t max_runs,
    1.20 -			     run_t *runs)
    1.21 -{
    1.22 -  uint8_t *byte_ptr;
    1.23 -  uint8_t byte;
    1.24 -  int bit_pos;
    1.25 -
    1.26 -  uint32_t byte_cnt;
    1.27 -  int last_bits;
    1.28 -  bool last_flag = 0;
    1.29 -
    1.30 -  uint8_t pol = 0x00;  /* 0x00 = counting zeros (white),
    1.31 -			  0xff = counting ones (black) */
    1.32 -  int32_t left = 0;  /* left x coordinate of current run, relative */
    1.33 -
    1.34 -  uint32_t rl;
    1.35 -  int32_t i = 0;
    1.36 -
    1.37 -  /* adjust coordinate system */
    1.38 -  y -= src->rect.min.y;
    1.39 -  min_x -= src->rect.min.x;
    1.40 -  max_x -= src->rect.min.x;
    1.41 -
    1.42 -  byte_ptr = (uint8_t *) (src->bits + y * src->row_words);
    1.43 -  byte_cnt = (max_x / 8) + 1 - (min_x / 8);
    1.44 -  last_bits = max_x % 8;
    1.45 -
    1.46 -  rl = 0;
    1.47 -  pol = 0x00;  /* initially count white pixels */
    1.48 -
    1.49 -  byte_ptr += min_x / 8;
    1.50 -  bit_pos = min_x % 8;
    1.51 -  byte = *(byte_ptr++);
    1.52 -
    1.53 -  /* is the first byte also the last? */
    1.54 -  if (--byte_cnt == 0)
    1.55 -    {
    1.56 -      byte <<= (7 - last_bits);	  /* last byte may be partial */
    1.57 -      bit_pos += (7 - last_bits);
    1.58 -      last_flag = 1;
    1.59 -    }
    1.60 -
    1.61 -  for (;;)
    1.62 -    {
    1.63 -      int b2 = rle_tab [bit_pos] [pol ^ byte];
    1.64 -      rl += b2;
    1.65 -      bit_pos += b2;
    1.66 -      if (bit_pos == 8)
    1.67 -	{
    1.68 -	  if (last_flag)
    1.69 -	    {
    1.70 -	      if (rl)
    1.71 -		{
    1.72 -		  runs [i].value = pol;
    1.73 -		  runs [i].left = left;
    1.74 -		  runs [i++].width = rl;
    1.75 -		}
    1.76 -	      return (i);
    1.77 -	    }
    1.78 -	  bit_pos = 0;
    1.79 -	  byte = *(byte_ptr++);
    1.80 -	  if (--byte_cnt == 0)
    1.81 -	    {
    1.82 -	      byte <<= (7 - last_bits);	  /* last byte may be partial */
    1.83 -	      bit_pos += (7 - last_bits);
    1.84 -	      last_flag = 1;
    1.85 -	    }
    1.86 -	}
    1.87 -      else
    1.88 -	{
    1.89 -	  runs [i].value = pol;
    1.90 -	  runs [i].left = left;
    1.91 -	  runs [i++].width = rl;
    1.92 -	  left += rl;
    1.93 -	  if (i == max_runs)
    1.94 -	    return (-i);
    1.95 -	  rl = 0;
    1.96 -	  pol ^= 0xff;
    1.97 -	}
    1.98 -    }
    1.99 -}
     2.1 --- a/bitblt.h	Tue Mar 11 11:14:39 2003 +0000
     2.2 +++ b/bitblt.h	Wed Mar 12 06:02:46 2003 +0000
     2.3 @@ -4,7 +4,7 @@
     2.4   *      will be compressed using ITU-T T.6 (G4) fax encoding.
     2.5   *
     2.6   * bitblt routines
     2.7 - * $Id: bitblt.h,v 1.14 2003/03/10 05:08:25 eric Exp $
     2.8 + * $Id: bitblt.h,v 1.15 2003/03/11 22:02:46 eric Exp $
     2.9   * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com>
    2.10   *
    2.11   * This program is free software; you can redistribute it and/or modify
    2.12 @@ -103,34 +103,4 @@
    2.13  void reverse_bits (uint8_t *p, int byte_count);
    2.14  
    2.15  
    2.16 -/*
    2.17 - * get_row_run_lengths counts the runs of 0 and 1 bits in row
    2.18 - * y of a bitmap, from min_x through max_x inclusive.  The run lengths
    2.19 - * will be stored in the run_length array.  The first entry will be
    2.20 - * the length of a zero run (which length may be zero, if the first
    2.21 - * bit is a one).  The next entry will the be the length of a run of
    2.22 - * ones, and they will alternate from there, with even entries representing
    2.23 - * runs of zeros, and odd entries representing runs of ones.
    2.24 - *
    2.25 - * max_runs should be set to the maximum number of run lengths that
    2.26 - * can be stored in the run_length array.
    2.27 - *
    2.28 - * Returns the actual number of runs counted, or -max_runs if there
    2.29 - * was not enough room in the array.
    2.30 - */
    2.31 -
    2.32 -typedef struct
    2.33 -{
    2.34 -  bool value;
    2.35 -  int32_t left;
    2.36 -  uint32_t width;
    2.37 -} run_t;
    2.38 -
    2.39 -int32_t get_row_run_lengths (Bitmap *src,
    2.40 -			     int32_t y,
    2.41 -			     int32_t min_x, int32_t max_x,
    2.42 -			     int32_t max_runs,
    2.43 -			     run_t *runs);
    2.44 -
    2.45 -
    2.46  void bitblt_write_g4 (Bitmap *bitmap, FILE *f);