Capsim Block Documentation
ead a binary image. On each visit a row is read from file. An image sample is output.
Num | Type | Name | Initial Value | Description |
---|---|---|---|---|
0 | int | obufs | ||
1 | int | fd | ||
2 | int | numberRowsRead | 0 | |
3 | char* | buff | ||
4 | float** | mat_PP |
int i,j,k; float x; int n; image_t img; |
---|
if((fd = open(file_name,0)) == -1) { fprintf(stderr,"rdbinimage: cannot open file\n"); return(1); /* file cannot be opened */ } if( (obufs = NO_OUTPUT_BUFFERS()) < 1 ) { fprintf(stderr,"rdbinimage: no output buffers\n"); return(2); } fprintf(stderr,"Image width= %d, height = %d \n",pwidth,pheight); numberRowsRead =0; buff = (char *) calloc(pwidth,sizeof(char)); if(buff == NULL) { fprintf(stderr,"rdbinimage: can't allocate space\n"); return(3); } for(i=0; i |
---|
while(numberRowsRead < pheight) { /* * output a row */ n= read(fd,buff,pwidth); /* * * increment time on output buffer(s) * and output a sample */ for (k = 0; k< n; k++) mat_PP[numberRowsRead][k]=buff[k]; if(numberRowsRead == pheight-1) { for(j=0; j |
---|
/* free up allocated space */ close(fd); free(buff); return(0); |
---|
/* Capsim (r) Text Mode Kernel (TMK) Star Library (Blocks) Copyright (C) 1989-2017 Silicon DSP Corporation This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA http://www.silicondsp.com Silicon DSP Corporation Las Vegas, Nevada */ |
---|
/************************************************************* imgrdbin() *************************************************************** Description: Read a binary image. On each visit a row is read from file. An image sample is output. Auto fan-out. |
---|