37 #define LINE_LENGTH 720
38 #define FRAME_LENGTH 486
40 #define LINE_LENGTH 720
41 #define FRAME_LENGTH 576
44 #define shifty(val) y4=y3;y3=y2;y2=y1;y1=y0;y0=(val)
45 #define shiftu(val) u4=u3;u3=u2;u2=u1;u1=u0;u0=(val)
46 #define shiftv(val) v4=v3;v3=v2;v2=v1;v1=v0;v0=(val)
48 void read_image(), send_image();
66 register int i, xrun, maxy;
67 int minx, maxx, miny, yrun, px, py;
73 "% c%- P%-incx!dincy!d p%-posx!dposy!d o%-outfile!s infile%s\n(\
74 \t-c\tCenter image in Abekas frame.\n\
75 \t-p\tPosition image at given position.\n\
76 \t-P\tIncrementally position image by given offset.)",
79 &pflag
, &px
, &py
, &oflag
, &out_fname
, &infname
) == 0 )
86 if ( cflag + pflag + Pflag > 1 ) {
87 fprintf( stderr,
"%s: specify exactly one of -c -p -P\n",
hdr.cmd );
98 fprintf( stderr,
"%s: rle image too big for Abekas\n",
hdr.cmd);
137 maxx = minx + xrun - 1;
138 maxy = miny + yrun - 1;
143 read_image( yrun, scanbuf, minx, maxy, xrun );
144 send_image( outfile );
150 read_image ( yrun, scanbuf, minx, maxy, xrun )
153 int minx, maxy, xrun;
155 register int line, upsidedowny;
157 for( line = 0; line < yrun; line++ ) {
159 upsidedowny = maxy - line;
161 if ( ( upsidedowny >
FRAME_LENGTH-1 ) || ( upsidedowny < 0 ) )
172 send_image ( outfile )
176 register unsigned char *bp;
179 register int r, g, b;
181 int y0=0, y1=0, y2=0, y3=0, y4=0;
182 int u0=0, u1=0, u2=0, u3=0, u4=0;
183 int v0=0, v1=0, v2=0, v3=0, v4=0;
198 if ( *sr || *sg || *sb )
205 r = (*sr++ * 8000000) / 255;
206 g = (*sg++ * 8000000) / 255;
207 b = (*sb++ * 8000000) / 255;
214 shifty( ( r / 33445 + g / 17036 + b / 87719) * 1000000 );
215 shiftu( (-r / 59312 - g / 30202 + b / 20012) * 1000000 );
216 shiftv( ( r / 20012 - g / 23895 - b / 123001) * 1000000 );
229 u = ( (u0 / 66832) + (u1 / 45434)
230 +(u2 / 38382) + (u3 / 45434)
231 +(u4 / 66832)) * 224 / 80000;
239 y = (-(y0 / 176243) + (y1 / 531067)
240 +(y1 / 9295) + (y3 / 531067)
241 -(y4 / 176243)) * 219 / 80000;
249 v = ( (v0 / 66832) + (v1 / 45434)
250 +(v2 / 38382) + (v3 / 45434)
251 +(v4 / 66832)) * 224 / 80000;
254 if ( *sr || *sg || *sb )
256 r = (*sr++ * 8000000) / 255;
257 g = (*sg++ * 8000000) / 255;
258 b = (*sb++ * 8000000) / 255;
260 shifty( ( r / 33445 + g / 17036 + b / 87719) * 1000000 );
261 shiftu( (-r / 59312 - g / 30202 + b / 20012) * 1000000 );
262 shiftv( ( r / 20012 - g / 23895 - b / 123001) * 1000000 );
270 y = (-(y0 / 176243) + (y1 / 531067)
271 +(y1 / 9295) + (y3 / 531067)
272 -(y4 / 176243)) * 219 / 80000;
276 fwrite( buf, 1, bp - buf, outfile );
FILE * rle_open_f(char *prog_name, char *file_name, char *mode)
void rle_names(rle_hdr *the_hdr, const char *pgmname, const char *fname, int img_num)
char * cmd_name(char **argv)
void main(int argc, char **argv)
int rle_getrow(rle_hdr *the_hdr, scanline)
rle_pixel scanred[486][720]
int scanargs(int argc, char **argv, const char *format,...)
void rle_get_setup_ok(rle_hdr *the_hdr, const char *prog_name, const char *file_name)
#define RLE_CLR_BIT(glob, bit)
rle_pixel scangrn[486][720]
rle_pixel scanblu[486][720]
rle_hdr * rle_hdr_init(rle_hdr *the_hdr)