transpose

Capsim Block Documentation

Short Description

This star inputs an image and transposes it.

Top
Input Connections
Port Type Name
0 float x
Top
Output Connections
Port Type Name
0 float y
Top
Parameters
Num Description Type Name Default Value
0 Image Width int width 1
1 Image Height int height 1
2 Operation: 0=Transpose, 1= flip int operation 0
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;



Top

Initialization Code



 

	mat_PP = (float**)calloc(height+1,sizeof(float*));
	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 == height) {
	    switch(operation) {
	        case 0:
	
		   if(widthOutput >= width) { 
			/*
			 * reset and collect another matrix again
			 */
			pointCount = 0;
			numberRowsInput=0;
        		widthOutput = 0;
        		heightOutput = 0;
			break;
		   }
		   for (i=0; i 0; --no_samples) {
	j=pointCount;
	IT_IN(0);
	mat_PP[numberRowsInput][j]=x(0);
	pointCount++;


			

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




Top

Wrapup Code



 

	/* free up allocated space	*/
	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



 

/* transpose.s */
/***********************************************************************
                             transpose()
************************************************************************
This star inputs an image and transposes it.

transpose


This star inputs an image and transposes it.


Programmer:  	Sasan Ardalan	
Date: 		April 15, 1988

*/