8 void write_pbm(uint8_t *tp, int w, int h, const char *fmt, ...)
10 va_list ap; va_start(ap, fmt);
11 char fn[256]; vsnprintf(fn, sizeof(fn), fmt, ap);
13 FILE *fp = !strcmp(fn,"-") ? stdout : fopen(fn,"w");
15 fprintf(fp,"P5\n%d %d\n255\n",w,h);
21 int main(int ac, char **av)
23 int ret; setbuf(stdout,0);
26 //db.access(av[1], 34543, 0);
27 if( !db.opened() || db.error() ) exit(1);
29 if( !(ret=db.clip_set.FindId(atoi(av[2]))) ) {
30 int cid = db.clip_set.id();
31 // printf("clip_set %d, frames %d", cid, db.clip_set.Frames());
32 // printf(" prefix %d/suffix %d\n", db.clip_set.Prefix_size(),db.clip_set.Suffix_size());
33 TimelineLoc::ikey_Sequences ikey(db.timeline,cid,0);
34 if( (ret=ikey.Locate()) || (int)db.timeline.Clip_id() != cid ) {
35 printf("missed seq for clip_set %d\n",cid);
38 const char *apath = db.clip_set._Asset_path();
39 const char *cp = strrchr(apath,'/');
40 if( cp ) apath = cp+1;
42 TimelineLoc::rkey_Sequences rkey(db.timeline);
44 if( (int)db.timeline.Clip_id() != cid ) break;
45 //if( fid == (int)db.timeline.Frame_id() ) continue;
46 int seq = db.timeline.Sequence_no();
47 fid = db.timeline.Frame_id();
48 if( (ret=db.video_frame.FindId(fid)) ) {
49 printf("missed frame %d(%d) in clip_set %d\n", seq,fid,cid);
51 printf("%4d %4d %6d %f %f %f %f %f\n", n, seq, db.video_frame.id(),
52 db.video_frame.Frame_mean(), db.video_frame.Frame_std_dev(),
53 db.video_frame.Frame_cx(), db.video_frame.Frame_cy(),
54 db.video_frame.Frame_moment());
57 uint8_t *dat = db.video_frame._Frame_data();
58 write_pbm(dat,w,h,"%s/c%04df%03d.pbm",av[3],cid,n);
61 } while( !(ret=rkey.Next()) );