imgserin

Capsim Block Documentation

Short Description

This star inputs rows and creates an image and outputs it to the image buffer

Top
Input Connections
Port Type Name
0 float x
Top
Output Connections
Port Type Name
0 image_t y
Top
Parameters
Num Description Type Name Default Value
0 Image Width int pwidth 1
1 Image Height int pheight 1
Top
States
Num Type Name Initial Value Description
0 float** mat_PP
1 int pointCount 0
2 int numberRowsInput 0
3 int widthOutput 0
4 int heightOutput 0
Top

Declarations


 

	int no_samples;
	int i,j;
	int	factor;
	image_t	img;



Top

Initialization Code



 

	mat_PP = (float**)calloc(pheight+1,sizeof(float*));
	if(mat_PP == NULL) {
		fprintf(stderr,"Could not allocate in imgserin.\n");
		return(4);
	}
	for(i=0; i
    
Top

Main Code



 

/*
 * if the image has been inputted and is ready to be outputted, then
 * output either a row at a time or a column at a time on 
 * each visit
 */
if(numberRowsInput == pheight) {
	
	   {
	   	/* 
	    	 * now, output real  samples		
	     	 */
		if(IT_OUT(0)) {
			KrnOverflow("imgserin",0);
			return(99);
		}
		img.image_PP=mat_PP;
		img.width=pwidth;
		img.height=pheight;
		y(0) = img;
			
	   }
	/*
	 * reset and collect another matrix again
	 */
	pointCount = 0;
	numberRowsInput=0;
       	widthOutput = 0;
       	heightOutput = 0;
   	return(0);
}
/*
 * collect the image
 */
for (no_samples = MIN_AVAIL(); no_samples > 0; --no_samples) {
	j=pointCount;
	IT_IN(0);
	mat_PP[numberRowsInput][j]=x(0);
	pointCount++;


			

	/* 
	 * Get enough points				
	 */
	if(pointCount == pwidth ) {
		numberRowsInput++;
		pointCount =0;
		if(numberRowsInput == pheight) {
			return(0);
		}
	}
}
return(0);




Top

Wrapup Code



 

	/* 
	 * free up allocated space      
	 */
#if 0
        for(i=0; i
    
Top

License



/*  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
*/


Top

Description



 

/* imgserin.s */
/***********************************************************************
                             imgserin()
************************************************************************
This star inputs rows and creates an  image and
outputs it to the image buffer

imgserin


This star inputs rows and creates an  image and
outputs it to the image buffer


Programmer:  	Sasan Ardalan	
Date: 		April 15, 1988

*/