9 int clip(int v) { return v > 255 ? 255 : v < 0 ? 0 : v; }
11 int main(int ac, char **av)
16 //db.access(av[1], 34543, 0);
17 if( !db.opened() || db.error() ) exit(1);
18 int aid = atoi(av[2]);
19 int bid = atoi(av[3]);
21 Video_frameLoc aframe(db.video_frame);
22 Video_frameLoc bframe(db.video_frame);
23 if( aframe.FindId(aid) ) {
24 printf("cant access frame %d\n", aid);
27 if( bframe.FindId(bid) ) {
28 printf("cant access frame %d\n", aid);
32 uint8_t *adat = aframe._Frame_data(), *bdat = bframe._Frame_data();
38 if( !strcmp(av[4],"-") ) {
43 fp = fopen(av[4],"w");
45 fprintf(fp,"P5\n%d %d\n255\n",w,h);
46 uint8_t *ap = adat, *bp = bdat;
47 for( int i=w*h; --i>=0; ++ap, ++bp ) {
52 putc(clip(*ap-*bp+128), fp);
54 if( fp != stdout ) fclose(fp);
62 uint8_t *ap = adat, *bp = bdat;
64 for( int i=w*h; --i>=0; ++ap, ++bp ) {
71 fprintf(sfp, "%d %d\n",n,m);