#include "stdio.h"
#include "rle_put.h"
#include "rle.h"
Go to the source code of this file.
|
static int | findruns () |
|
void | rle_putrow (rows, int rowlen, rle_hdr *the_hdr) |
|
void | rle_skiprow (rle_hdr *the_hdr, int nrow) |
|
void | rle_put_init (rle_hdr *the_hdr) |
|
void | rle_put_setup (rle_hdr *the_hdr) |
|
void | DefaultBlockHook (rle_hdr *the_hdr) |
|
void | rle_puteof (rle_hdr *the_hdr) |
|
static int | findruns (rle_pixel *row, int rowlen, int color, int nrun, short *brun) |
|
void | rgb_to_bw (rle_pixel *red_row, rle_pixel *green_row, rle_pixel *blue_row, rle_pixel *bw_row, int rowlen) |
|
#define FASTRUNS /* Faster run finding */ |
#define PBRUN the_hdr->priv.put.brun |
void DefaultBlockHook |
( |
rle_hdr * |
the_hdr | ) |
|
Definition at line 548 of file rle_putrow.c.
553 int i = 0, lower, upper;
557 fprintf( stderr,
"findruns( " );
558 for ( s = 0; s < rowlen; s++ )
559 fprintf( stderr,
"%2x.%s",
row[s], (s % 20 == 19) ?
"\n\t" :
"" );
561 fprintf( stderr,
"\n\t" );
562 fprintf( stderr,
"%d, %d, %d, \n\t", rowlen, color, nrun );
563 for ( j = 0; j < nrun; j++ )
564 fprintf( stderr,
"(%3d,%3d) %s", brun[j][0], brun[j][1],
565 (j % 6 == 5) ?
"\n\t" :
"" );
566 fprintf( stderr,
")\n" );
581 lower = brun[i-1][1] + 1;
586 upper = brun[
i][0] - 1;
589 fprintf( stderr,
"Searching before run %d from %d to %d\n",
593 #if defined(LOCC)&defined(vax)
594 s = upper - skpc( (
char *)
row + lower, upper - lower + 1, color ) + 1;
596 for ( s = lower; s <= upper; s++ )
597 if (
row[s] != color )
603 if ( s > lower + 1 || i == 0 )
606 fprintf( stderr,
"Found new run starting at %d\n", s );
609 for ( j = nrun; j >
i; j-- )
611 brun[j][0] = brun[j-1][0];
612 brun[j][1] = brun[j-1][1];
621 fprintf( stderr,
"Adding to previous run\n" );
625 #if defined(LOCC)&defined(vax)
626 s = upper - locc( (
char *)
row + s, upper - s + 1, color ) + 1;
628 for ( ; s <= upper; s++ )
629 if (
row[s] == color )
635 fprintf( stderr,
"Ends at %d", s - 1 );
637 if ( s >= upper && i < nrun - 1 )
639 brun[
i][1] = brun[i+1][1];
641 for ( j = i + 2; j < nrun; j++ )
643 brun[j-1][0] = brun[j][0];
644 brun[j-1][1] = brun[j][1];
648 fprintf( stderr,
", add to next run" );
652 putc(
'\n', stderr );
Definition at line 680 of file rle_putrow.c.
689 for (x=0; x<rowlen; x++)
693 bw = 0.5 + .30*red_row[
x] + .59*green_row[
x] + .11*blue_row[
x];
void rle_put_init |
( |
rle_hdr * |
the_hdr | ) |
|
Definition at line 415 of file rle_putrow.c.
422 the_hdr->
cmd =
"Urt";
433 if ( the_hdr->
alpha )
struct rle_hdr::@0::@2 put
enum rle_dispatch dispatch
#define RLE_CLR_BIT(glob, bit)
#define RLE_BIT(glob, bit)
void rle_put_setup |
( |
rle_hdr * |
the_hdr | ) |
|
void rle_puteof |
( |
rle_hdr * |
the_hdr | ) |
|
Definition at line 96 of file rle_putrow.c.
Referenced by find_most_used(), and write_rle_data().
114 the_hdr->
priv.
put.nblank += rowlen;
125 (
unsigned)((rowlen/3 + 1) * 2 *
sizeof(
short)) );
128 fprintf( stderr,
"%s: Malloc failed in rle_putrow, writing %s\n",
134 for ( i=0; i < the_hdr->
ncolors; i++ )
135 bits[i] =
RLE_BIT( *the_hdr, i );
136 bits[255] =
RLE_BIT( *the_hdr, -1 );
151 if ( the_hdr->
alpha )
154 for ( i = 0; i < the_hdr->
ncolors; i++ )
162 PBRUN[0][1] = rowlen-1;
169 for (i=0; i<rowlen; i++)
174 if (j > 0 && i -
PBRUN[j-1][1] <= 2)
193 PBRUN[0][1] = rowlen-1;
203 for ( i = nrun - 1; i > 0; i-- )
209 for ( j = i; j < nrun - 1; j++ )
221 if (the_hdr->
priv.
put.nblank > 0)
226 for ( mask = (the_hdr->
alpha ? -1 : 0);
227 mask < the_hdr->ncolors;
230 if ( ! bits[mask & 0xff] )
240 for (j=0; j<nrun; j++)
243 dstart =
PBRUN[j][0];
245 for (i=dstart; i<=dend; i++)
250 if (i > dstart && runval == row[i])
254 if ( ((i - dstart) % 2) == 0)
267 if (runval == row[i])
275 if ( dend - i > 255 )
294 if (runval == row[i])
309 if (runval == row[i])
312 putdata(row + dstart, rstart - dstart);
316 i = dend - skpc( (
char *)row + i, dend + 1 - i,
319 while ( row[++i] == runval && i <= dend)
334 if (runval != row[i])
348 putdata(row + dstart, i - dstart);
352 PBRUN[j+1][0] - dend - 1,
356 if (rowlen - dend > 0)
363 if ( mask != the_hdr->
ncolors - 1 )
#define SkipPixels(n, l, r)
struct rle_hdr::@0::@2 put
#define putrun(val, len, f)
#define SkipBlankLines(n)
#define NewScanLine(flag)
#define putdata(buf, len)
#define RLE_BIT(glob, bit)