void clauses() { for (Index i = 0; i < number_ap; ++i) { const AP::Arithmetical_progression p = ap.next(); for (AP::Arithmetical_progression::const_iterator i = p.begin(); i != p.end(); ++i) out << " " << var(*i); out << eoc(); for (AP::Arithmetical_progression::const_iterator i = p.begin(); i != p.end(); ++i) out << " " << neg(var(*i)); out << eoc(); } }
void clauses() { if (c == 0) return; // excluding "red" for (size_type i = 0; i < number_hyperedges1; ++i, H1.next()) { for (typename hyperedge_type::const_iterator j = H1.current_hyperedge.begin(); j != H1.current_hyperedge.end(); ++j) out << " " << var(*j); out << eoc(); } // excluding "blue" for (size_type i = 0; i < number_hyperedges2; ++i, H2.next()) { for (typename hyperedge_type::const_iterator j = H2.current_hyperedge.begin(); j != H2.current_hyperedge.end(); ++j) out << " " << neg(var(*j)); out << eoc(); } }
void clauses() { typedef typename ArithProg::Arithmetical_progression ap_type; typedef typename ap_type::const_iterator ap_iterator; for (Index i = 0; i < number_ap; ++i) { const ap_type p = ap.next(); for (ap_iterator i = p.begin(); i != p.end(); ++i) out << var(*i) << " "; out << eoc(); } for (Index i = 0; i < number_ap2; ++i) { const ap_type p = ap2.next(); for (ap_iterator i = p.begin(); i != p.end(); ++i) out << neg(var(*i)) << " "; out << eoc(); } }
/* we left off in the write_header procedure. */ static int write_trailer(FILE * file) { unsigned char buffer[30]; unsigned char *p = buffer; int trailersize; /* Indentation below gives DDIF document structure */ eoc(&p); /* Sequence */ eoc(&p); /* Image Data Descriptor */ tag(&p,APPLICATION,PRIM,1); wr_null(&p); /* End Segment */ tag(&p,APPLICATION,PRIM,1); wr_null(&p); /* End Segment */ eoc(&p); /* Document Content */ eoc(&p); /* DDIF Document */ /* End of DDIF document Indentation */ trailersize = p - buffer; if (trailersize >= 30) { fprintf(stderr,"Overran buffer area %d >= 30\n",trailersize); exit(1); } return(fwrite(buffer, 1, trailersize, file) == trailersize); }
int main() { int coreid, i, error = 0; coreid = get_core_id(); // set start value of jrand function next = 1; if (coreid == 0) { int f=0; initialize_aes(); // 1 iterations of enc+dec for (f=0;f<1;f++){ compute_aes(); //check output for (i = 0; i < 16; i++){ if (encoutbuf[i] != check_encoutbuf[i]) { error+=1; /* printf("Error occured in encryption\n",0,0,0,0); */ //printf("encrypted: %d, expected: %d\n",encoutbuf[i],check_encoutbuf[i],0,0); } if (decoutbuf[i] != check_decoutbuf[i]) { error+=1; /* printf("Error occured in decryption\n",0,0,0,0); */ //printf("decrypted: %d, expected: %d\n",decoutbuf[i],check_decoutbuf[i],0,0); } } } int *DEFAULT_RESULT; if (error == 0) { //printf ("OOOOOOK!!!!!!\n",0,0,0,0); DEFAULT_RESULT = (int*)0x10003ffc; *(DEFAULT_RESULT) = 1; } else { //printf ("Not OK!! %d\n",error,0,0,0); DEFAULT_RESULT = (int*)0x10003ffc; *(DEFAULT_RESULT) = error; } } synch_barrier(); eoc(0); }
void print_test_summary() { printf("==== SUMMARY: "); if (g_errors == 0) { printf("OOOOOOK!!!!!!\n"); } else { printf("NOT OK!!!!!\n"); } uart_wait_tx_done(); // signal end of computation eoc(g_errors); }
int main() { /* Variable Definition */ int coreid; int i,j; int start_frame; int index; int time; coreid = get_core_id(); if (coreid == 0) { // initialization NB_BLOB = 0 ; start_frame = 0; for(i=0;i<NFRAME;i++){ // for each frame //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%// //%%%%%%%%%%%%%%% * DATA TRANSFER FROM L2 TO L1 * %%%%%%%%%%%%%%%%%%%%%%%%%%%%%// index = 0; N_pixel = N_pixelL2[i]; reset_timer(); start_timer(); for(j=start_frame; j<start_frame + N_pixel*2; j++){ pixel[index++]=pixelL2[j]; } stop_timer(); printf("FRAME: %d (%d-%d) Transfer Time: %d\n",i,start_frame,j,get_time()); start_frame = j; //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%// //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%// //%%%%%%%%%%%%%%% * PROCESSING * %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%// init_data(); reset_timer(); start_timer(); blob_formation(); stop_timer(); printf("Blob Formation Time: %d\n",get_time(),0,0,0); reset_timer(); start_timer(); prevBlob_filter(); stop_timer(); printf("Filtering prev Blob List Time: %d\n",get_time(),0,0,0); reset_timer(); start_timer(); newBlob_filter(); stop_timer(); printf("Filtering new Blob List Time: %d\n",get_time(),0,0,0); reset_timer(); start_timer(); blob_merge(); stop_timer(); printf("Blob Merging Time: %d\n",get_time(),0,0,0); //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%// //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%// //%%%%%%%%%%%%%%% * CHECKSUM * %%%%%%%%%%%%%%%%%%%%%%%%%%%%%// printf("FRAME = %d\n",i,0,0,0); printf("NB_BLOB = %d\n",NB_BLOB,0,0,0); for(j=0;j<NB_BLOB;j++){ printf("Blob %d: centroid = (%d,%d), weight = %d, ",j,BLOB_LIST[j].xc,BLOB_LIST[j].yc,BLOB_LIST[j].W); printf("xmax = %d, xmin = %d, ymax = %d, ymin = %d\n",BLOB_LIST[j].xmax, BLOB_LIST[j].xmin, BLOB_LIST[j].ymax, BLOB_LIST[j].ymin); if(BLOB_LIST[j].xc == results[(i*B_MAX+j)*6 ]) printf("OK xc!\t",0,0,0,0); else printf("FAIL xc!\t",0,0,0,0); if(BLOB_LIST[j].yc == results[(i*B_MAX+j)*6+1 ]) printf("OK yc!\t",0,0,0,0); else printf("FAIL yc!\t",0,0,0,0); if(BLOB_LIST[j].xmax == results[(i*B_MAX+j)*6+2 ]) printf("OK xmax!\t",0,0,0,0); else printf("FAIL xmax!\t",0,0,0,0); if(BLOB_LIST[j].xmin == results[(i*B_MAX+j)*6+3 ]) printf("OK xmin!\t",0,0,0,0); else printf("FAIL xmin!\t",0,0,0,0); if(BLOB_LIST[j].ymax == results[(i*B_MAX+j)*6+4 ]) printf("OK ymax!\t",0,0,0,0); else printf("FAIL ymax!\t",0,0,0,0); if(BLOB_LIST[j].ymin == results[(i*B_MAX+j)*6+5 ]) printf("OK ymin!\n",0,0,0,0); else printf("FAIL ymin!\n",0,0,0,0); } printf("\n\n",0,0,0,0); //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%// } eoc(0); } }
static int write_header(FILE *file, imageparams *ip) { unsigned char buffer[300]; /* Be careful with the size ! */ unsigned char *p = buffer; int headersize; int bounding_x; int bounding_y; int i; /* Calculate the bounding box from the resolutions */ bounding_x = ((int) (1200 * ((double) (ip->width) / ip->h_res))); bounding_y = ((int) (1200 * ((double) (ip->height) / ip->v_res))); /* This is gross. The entire DDIF grammar is constructed by */ /* hand. The indentation is meant to indicate DDIF document structure */ tag(&p,PRIVATE,CONS,16383); ind(&p); /* DDIF Document */ tag(&p,CONTEXT,CONS, 0); ind(&p); /* Document Descriptor */ tag(&p,CONTEXT,PRIM, 0); wr_int(&p,1); /* Major Version */ tag(&p,CONTEXT,PRIM, 1); wr_int(&p,3); /* Minor Version */ tag(&p,CONTEXT,PRIM, 2); wr_string(&p,"PBM+"); /* Product Indentifier */ tag(&p,CONTEXT,CONS, 3); ind(&p); /* Product Name */ tag(&p,PRIVATE,PRIM, 9); emit_isolatin1(&p,"PBMPLUS Writer V1.0"); eoc(&p); eoc(&p); /* Document Descriptor */ tag(&p,CONTEXT,CONS, 1); ind(&p); /* Document Header */ tag(&p,CONTEXT,CONS, 3); ind(&p); /* Version */ tag(&p,PRIVATE,PRIM, 9); emit_isolatin1(&p,"1.0"); eoc(&p); eoc(&p); /* Document Header */ tag(&p,CONTEXT,CONS, 2); ind(&p); /* Document Content */ tag(&p,APPLICATION,CONS,2); ind(&p); /* Segment Primitive */ eoc(&p); tag(&p,APPLICATION,CONS,2); ind(&p); /* Segment */ tag(&p,CONTEXT,CONS, 3); ind(&p); /* Segment Specific Attributes */ tag(&p,CONTEXT,PRIM, 2); wr_string(&p,"$I"); /* Category */ tag(&p,CONTEXT,CONS,22); ind(&p); /* Image Attributes */ tag(&p,CONTEXT,CONS, 0); ind(&p); /* Image Presentation Attributes */ tag(&p,CONTEXT,PRIM, 1); wr_int(&p,0); /* Pixel Path */ tag(&p,CONTEXT,PRIM, 2); wr_int(&p,270); /* Line Progression */ tag(&p,CONTEXT,CONS, 3); ind(&p); /* Pixel Aspect Ratio */ tag(&p,CONTEXT,PRIM, 0); wr_int(&p,1); /* PP Pixel Dist */ tag(&p,CONTEXT,PRIM, 1); wr_int(&p,1); /* LP Pixel Dist */ eoc(&p); /* Pixel Aspect Ratio */ tag(&p,CONTEXT,PRIM, 4); wr_int(&p,ip->polarity); /* Brightness Polarity */ tag(&p,CONTEXT,PRIM, 5); wr_int(&p,1); /* Grid Type */ tag(&p,CONTEXT,PRIM, 7); wr_int(&p,ip->spectral); /* Spectral Mapping */ tag(&p,CONTEXT,CONS,10); ind(&p); /* Pixel Group Info */ tag(&p,CONTEXT,PRIM, 0); wr_int(&p,1); /* Pixel Group Size */ tag(&p,CONTEXT,PRIM, 1); wr_int(&p,1); /* Pixel Group Order */ eoc(&p); /* Pixel Group Info */ eoc(&p); /* Image Presentation Attributes */ tag(&p,CONTEXT,CONS, 1); ind(&p); /* Component Space Attributes */ tag(&p,CONTEXT,PRIM, 0); wr_int(&p,1); /* Component Space Organization */ tag(&p,CONTEXT,PRIM, 1); wr_int(&p,1); /* Planes per Pixel */ tag(&p,CONTEXT,PRIM, 2); wr_int(&p,1); /* Plane Significance */ tag(&p,CONTEXT,PRIM, 3); wr_int(&p,ip->components); /* Number of Components */ tag(&p,CONTEXT,CONS, 4); ind(&p); /* Bits per Component */ for (i = 0; i < ip->components; i++) { tag(&p,UNIVERSAL,PRIM,2); wr_int(&p,ip->bits_per_component); } eoc(&p); /* Bits per Component */ tag(&p,CONTEXT,CONS, 5); ind(&p); /* Component Quantization Levels */ for (i = 0; i < ip->components; i++) { tag(&p,UNIVERSAL,PRIM,2); wr_int(&p,1 << ip->bits_per_component); } eoc(&p); /* Component Quantization Levels */ eoc(&p); /* Component Space Attributes */ eoc(&p); /* Image Attributes */ tag(&p,CONTEXT,CONS,23); ind(&p); /* Frame Parameters */ tag(&p,CONTEXT,CONS, 1); ind(&p); /* Bounding Box */ tag(&p,CONTEXT,CONS, 0); ind(&p); /* lower-left */ tag(&p,CONTEXT,CONS, 0); ind(&p); /* XCoordinate */ tag(&p,CONTEXT,PRIM, 0); wr_int(&p,0); eoc(&p); /* XCoordinate */ tag(&p,CONTEXT,CONS, 1); ind(&p); /* YCoordinate */ tag(&p,CONTEXT,PRIM, 0); wr_int(&p,0); eoc(&p); /* YCoordinate */ eoc(&p); /* lower left */ tag(&p,CONTEXT,CONS, 1); ind(&p); /* upper right */ tag(&p,CONTEXT,CONS, 0); ind(&p); /* XCoordinate */ tag(&p,CONTEXT,PRIM, 0); wr_int(&p,bounding_x); eoc(&p); /* XCoordinate */ tag(&p,CONTEXT,CONS, 1); ind(&p); /* YCoordinate */ tag(&p,CONTEXT,PRIM, 0); wr_int(&p,bounding_y); eoc(&p); /* YCoordinate */ eoc(&p); /* upper right */ eoc(&p); /* Bounding Box */ tag(&p,CONTEXT,CONS, 4); ind(&p); /* Frame Position */ tag(&p,CONTEXT,CONS, 0); ind(&p); /* XCoordinate */ tag(&p,CONTEXT,PRIM, 0); wr_int(&p,0); eoc(&p); /* XCoordinate */ tag(&p,CONTEXT,CONS, 1); ind(&p); /* YCoordinate */ tag(&p,CONTEXT,PRIM, 0); wr_int(&p,0); eoc(&p); /* YCoordinate */ eoc(&p); /* Frame Position */ eoc(&p); /* Frame Parameters */ eoc(&p); /* Segment Specific Attributes */ eoc(&p); /* Segment */ tag(&p,APPLICATION,CONS,17); ind(&p); /* Image Data Descriptor */ tag(&p,UNIVERSAL,CONS,16); ind(&p); /* Sequence */ tag(&p,CONTEXT,CONS, 0); ind(&p); /* Image Coding Attributes */ tag(&p,CONTEXT,PRIM, 1); wr_int(&p,ip->width); /* Pixels per Line */ tag(&p,CONTEXT,PRIM, 2); wr_int(&p,ip->height); /* Number of Lines */ tag(&p,CONTEXT,PRIM, 3); wr_int(&p,2); /* Compression Type */ tag(&p,CONTEXT,PRIM, 5); wr_int(&p,0); /* Data Offset */ tag(&p,CONTEXT,PRIM, 6); wr_int(&p,ip->bits_per_pixel); /* Pixel Stride */ tag(&p,CONTEXT,PRIM, 7); wr_int(&p,ip->bytes_per_line * 8); /* Scanline Stride */ tag(&p,CONTEXT,PRIM, 8); wr_int(&p,1); /* Bit Order */ tag(&p,CONTEXT,PRIM, 9); wr_int(&p,ip->bits_per_pixel); /* Planebits per Pixel */ tag(&p,CONTEXT,CONS,10); ind(&p); /* Byteorder Info */ tag(&p,CONTEXT,PRIM, 0); wr_int(&p,1); /* Byte Unit */ tag(&p,CONTEXT,PRIM, 1); wr_int(&p,1); /* Byte Order */ eoc(&p); /* Byteorder Info */ tag(&p,CONTEXT,PRIM,11); wr_int(&p,3); /* Data Type */ eoc(&p); /* Image Coding Attributes */ tag(&p,CONTEXT,PRIM, 1); wr_length(&p,ip->bytes_per_line*ip->height); /* Component Plane Data */ /* End of DDIF document Indentation */ headersize = p - buffer; if (headersize >= 300) { fprintf(stderr,"Overran buffer area %d >= 300\n",headersize); exit(1); } return (fwrite(buffer, 1, headersize, file) == headersize); }