static RCCResult run(RCCWorker *self, RCCBoolean timedOut, RCCBoolean *newRunCondition) { ScharrProperties *p = self->properties; ScharrState *s = self->memories[0]; RCCPort *in = &self->ports[SCHARR_IN], *out = &self->ports[SCHARR_OUT]; const RCCContainer *c = &self->container; (void)timedOut; if ( (in->input.length>0) && (in->input.length>FRAME_BYTES) ) { return RCC_ERROR; } // End state: just send the zero length message to indicate "done" // This will be unnecessary when EOS indication is fixed // Arrange to send the zero-length message after the last line of last image // This will be unnecessary when EOS indication is fixed if (in->input.length == 0) { self->runCondition = &end; *newRunCondition = 1; out->output.length = 0; c->advance(out, 0); return RCC_DONE; } // Current buffer unsigned cur = s->inLine % HISTORY_SIZE; // First line: do nothing // Second line if(s->inLine == 1) { memset(out->current.data, 0, LINE_BYTES); out->output.length = LINE_BYTES; c->advance(out, LINE_BYTES); } // Middle line else if(s->inLine > 1) { doLine(s->buffers[(cur - 2 + HISTORY_SIZE) % HISTORY_SIZE].data, s->buffers[(cur - 1 + HISTORY_SIZE) % HISTORY_SIZE].data, in->current.data, out->current.data, p->width, p->xderiv); out->output.length = LINE_BYTES; c->advance(out, LINE_BYTES); } // Go to next unsigned prev = (cur - 2 + HISTORY_SIZE) % HISTORY_SIZE; if(s->inLine < HISTORY_SIZE - 1) c->take(in, NULL, &s->buffers[cur]); else c->take(in, &s->buffers[prev], &s->buffers[cur]); s->inLine++; return RCC_OK; }
void Configuration::load(irr::core::stringc file){ std::string line; std::ifstream myfile(file.c_str()); if (myfile.is_open()){ while (std::getline (myfile,line) ) { doLine(irr::core::stringc(line.c_str())); } myfile.close(); }else printf("Unable to open editor.conf\n"); return; }
uint8_t ADMVideoLargeMedian::getFrameNumberNoAlloc(uint32_t frame, uint32_t *len, ADMImage *data, uint32_t *flags) { //uint8_t *dst,*dstu,*dstv,*srcu,*srcv; uint8_t *x1,*x2,*x3,*x4,*x5,*o1; uint32_t stride,page; if(frame>= _info.nb_frames) return 0; ADM_assert(_uncompressed); stride=_info.width; page=(stride*_info.height)>>2; // read uncompressed frame if(!_in->getFrameNumberNoAlloc(frame, len,_uncompressed,flags)) return 0; if(!_param->luma) { memcpy(YPLANE(data),YPLANE(_uncompressed),page*4); } else { memcpy(YPLANE(data),YPLANE(_uncompressed),stride*2); memcpy(YPLANE(data)+page*4-stride*2,YPLANE(_uncompressed)+page*4-2*stride,2*stride); o1=YPLANE(data)+stride*2;; x1=YPLANE(_uncompressed); x2=x1+stride; x3=x2+stride; x4=x3+stride; x5=x4+stride; // Luma for(int32_t y=2;y<(int32_t)(_info.height)-2;y++) { doLine(x1,x2,x3,x4,x5,o1,stride); x1=x2; x2=x3; x3=x4; x4=x5; x5+=stride; o1+=stride; } } stride>>=1; if(!_param->chroma) { memcpy(UPLANE(data),UPLANE(_uncompressed),page*2); } else { // first and last line memcpy(UPLANE(data),UPLANE(_uncompressed),stride*2); memcpy(UPLANE(data)+page-stride*2,UPLANE(_uncompressed)+page-2*stride,2*stride); // chroma u o1=UPLANE(data)+stride*2; x1=UPLANE(_uncompressed); x2=x1+stride; x3=x2+stride; x4=x3+stride; x5=x4+stride; for(int32_t y=2;y<(int32_t)(_info.height>>1)-2;y++) { doLine(x1,x2,x3,x4,x5,o1,stride); x1=x2; x2=x3; x3=x4; x4=x5; x5+=stride; o1+=stride; } // chroma V // first and last line memcpy(VPLANE(data),VPLANE(_uncompressed),stride*2); memcpy(VPLANE(data)+page-2*stride,VPLANE(_uncompressed)+page-2*stride,2*stride); o1=VPLANE(data)+stride*2; x1=VPLANE(_uncompressed); x2=x1+stride; x3=x2+stride; x4=x3+stride; x5=x4+stride; for(int32_t y=2;y<(int32_t)(_info.height>>1)-2;y++) { doLine(x1,x2,x3,x4,x5,o1,stride); x1=x2; x2=x3; x3=x4; x4=x5; x5+=stride; o1+=stride; } } data->copyInfo(_uncompressed); return 1; }
void insert_AtRBTree(RBTree * tree, FILE * configFile){ /* Initialize the Tree */ initTree(tree); n_nodes = 0; n_files = 0; max_word = 0; FILE *textFile; int i, k, numFile; char * linea_path = malloc(sizeof(char) * MAXLINEA); if (linea_path == NULL){ printf("No he pogut reservar la memòria\n"); exit(1); } char * path = malloc(sizeof(char) * MAXLINEA); if (path == NULL){ printf("No he pogut reservar la memòria\n"); exit(1); } char * linea_file = malloc(sizeof(char) * MAXLINEA); if (linea_file == NULL){ printf("No he pogut reservar la memòria\n"); exit(1); } char * subcadena = malloc(sizeof(char) * MAXWORD); if (subcadena == NULL){ printf("No he pogut reservar la memòria\n"); exit(1); } /* Get the first line of the file of paths.*/ fgets(linea_path, MAXLINEA, configFile); n_files = atoi(linea_path); numFile = 0; /* In this bucle we are going to read all the path files. */ while(fgets(linea_path, MAXLINEA, configFile) != NULL && numFile < n_files){ /* Reinitialize the var path */ memset(path, 0, MAXLINEA); k = 0; while(linea_path[k] != 10){ /* Here we copy the path file line without the last character LF (new line) code ASCII */ path[k] = linea_path[k]; k ++; } textFile = fopen(path, "r"); /* Initialize the table hash */ List *tablaHash; tablaHash = malloc(sizeof(List) * SIZE); if (tablaHash == NULL){ printf("No he pogut reservar la memòria\n"); exit(1); } /* Every table hash position we initialize it with the linked list */ for(i = 0; i < SIZE; i++){ initList(&tablaHash[i]); } /* In this bucle of every path file, we are going to treat every line of the file. */ printf("Procesant fitxer %d\n", numFile); fflush(stdout); while(fgets(linea_file, MAXLINEA, textFile)){ doLine(tablaHash, linea_file, subcadena); } /* We close the text file*/ fclose(textFile); fromHash_toRBTree(tree, tablaHash, numFile); /*Release memory for the hash table. */ for(i = 0; i < SIZE; i++){ deleteList(&tablaHash[i]); } free(tablaHash); numFile ++; } free(linea_path); free(path); free(linea_file); free(subcadena); }
int main(int argc, char *argv[]) { char **p; char *arg0, *infileName; FILE *inf, *outf; char line[1000], line2[1000]; char *id; char *chp; char *content; char *contact=""; char *join; char *join1, *join2; char *spanner, *variation, *variationEvidence, *comment, *evaluation, *remark; char lineType[100]; //int i,j; if (argc != 2) { usage(); } else { infileName = argv[1]; fprintf(stdout, "<HTML><HEAD><TITLE>Non-standard Join Certificates</TITLE>\n"); fprintf(stdout, "<META http-equiv=Content-Type content=\"text/html; charset=windows-1252\">\n"); fprintf(stdout, "<META content=\"MSHTML 6.00.2800.1106\" name=GENERATOR></HEAD>\n"); fprintf(stdout, "<BODY><FONT face=Arial>\n"); fprintf(stdout, "<FONT face=Arial>\n"); fprintf(stdout, "<TABLE cellspacing=3 cols=9 border cellPadding=2\n"); fprintf(stdout, " <TR BGCOLOR=#fffee8><TH>Accession 1</TH>\n"); fprintf(stdout, " <TH>Accession 2</TH>\n"); fprintf(stdout, " <TH>Spanner</TH>\n"); fprintf(stdout, " <TH>Variation</TH>\n"); fprintf(stdout, " <TH>Variation Evidence</TH>\n"); fprintf(stdout, " <TH>Comment</TH>\n"); fprintf(stdout, " <TH>Evaluation</TH>\n"); fprintf(stdout, " <TH>Remark</TH>\n"); fprintf(stdout, " <TH>Contact</TH>\n"); fprintf(stdout, " </TR>\n"); outf = fopen("cert.tab", "w"); if ((inf = fopen(infileName, "r")) == NULL) { fprintf(stderr, "Can't open file %s.\n", infileName); exit(8); } while (fgets(line, 1000, inf) != NULL) { content = doLine("CONTACT: ", line); if (content != NULL) { contact = strdup(content); fgets(line, 1000, inf); fgets(line, 1000, inf); } join = doLine("JOIN: ", line); if (join != NULL) { join1 = join; join2 = strstr(join, " "); *join2 = '\0'; join2++; join1 = strdup(join1); join2 = strdup(join2); fgets(line, 1000, inf); } else { fprintf(stderr, "No JOIN!\n"); exit(1); } spanner=variation=variationEvidence=comment=evaluation = remark= strdup("  "); again: content = doLine2(line, lineType); if (strcmp(lineType, "VARIATION") == 0) { variation = content; } content = doLine2(line, lineType); if (strcmp(lineType, "SPANNER") == 0) { spanner = content; } content = doLine2(line, lineType); if (strcmp(lineType, "VARIATION EVIDENCE") == 0) { variationEvidence = content; } content = doLine2(line, lineType); if (strcmp(lineType, "REMARK") == 0) { remark = content; } content = doLine2(line, lineType); if (strcmp(lineType, "COMMENT") == 0) { comment = content; } content = doLine2(line, lineType); if (strcmp(lineType, "EVALUATION") == 0) { evaluation = content; } fgets(line, 1000, inf); if (strlen(line) > 3) { goto again; } else { printf("<TR>"); printf("<TD>%s</TD>", join1); printf("<TD>%s</TD>", join2); printf("<TD>%s</TD>", spanner); printf("<TD>%s</TD>", variation); printf("<TD>%s</TD>", variationEvidence); printf("<TD>%s</TD>", comment); printf("<TD>%s</TD>", evaluation); printf("<TD>%s</TD>", remark); printf("<TD><A HREF=\"mailto:%s\">%s</A></TD>", contact, contact); printf("</TR>\n"); fprintf(outf, "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", join1, join2, spanner, evaluation, variation, variationEvidence, contact, remark, comment); } } } /*else { fprintf(stderr, "Usage: hgCert certificate.txt >certificate.html\n\n"); return(1); } */ fprintf(stdout, "</body></html>\n"); fclose(outf); return(0); }
uint8_t AVDMFastVideoConvolution::getFrameNumberNoAlloc(uint32_t frame, uint32_t *len, ADMImage *data, uint32_t *flags) { //uint8_t *dst,*dstu,*dstv,*srcu,*srcv; uint8_t *x1,*x2,*x3,*o1; uint32_t stride,page; if(frame>= _info.nb_frames) return 0; ADM_assert(_uncompressed); stride=_info.width; page=(stride*_info.height)>>2; // read uncompressed frame if(!_in->getFrameNumberNoAlloc(frame, len,_uncompressed,flags)) return 0; if(!_param->luma) { memcpy(YPLANE(data),YPLANE(_uncompressed),page*4); } else { o1=YPLANE(data)+stride; x1=YPLANE(_uncompressed); x2=x1+stride; x3=x2+stride; // first and last line memcpy(YPLANE(data),YPLANE(_uncompressed),stride); memcpy(YPLANE(data)+page*4-stride,YPLANE(_uncompressed)+page*4-stride,stride); // Luma for(int32_t y=1;y<(int32_t)_info.height-1;y++) { doLine(x1,x2,x3,o1,stride); x1=x2; x2=x3; x3+=stride; o1+=stride; } } // chroma u & v if(!_param->chroma) { memcpy(UPLANE(data),UPLANE(_uncompressed),page); memcpy(VPLANE(data),VPLANE(_uncompressed),page); } else { stride>>=1; // chroma u o1=UPLANE(data)+stride; x1=UPLANE(_uncompressed); x2=x1+stride; x3=x2+stride; // first and last line memcpy(UPLANE(data),UPLANE(_uncompressed),stride); memcpy(UPLANE(data)+page-stride,UPLANE(_uncompressed)+page-stride,stride); // Luma for(int32_t y=1;y<(int32_t)(_info.height>>1)-1;y++) { doLine(x1,x2,x3,o1,stride); x1=x2; x2=x3; x3+=stride; o1+=stride; } // chroma V o1=VPLANE(data)+stride; x1=VPLANE(_uncompressed); x2=x1+stride; x3=x2+stride; // first and last line memcpy(VPLANE(data),VPLANE(_uncompressed),stride); memcpy(VPLANE(data)+page-stride,VPLANE(_uncompressed)+page-stride,stride); // Luma for(int32_t y=1;y<(int32_t)(_info.height>>1)-1;y++) { doLine(x1,x2,x3,o1,stride); x1=x2; x2=x3; x3+=stride; o1+=stride; } } data->copyInfo(_uncompressed); return 1; }