imgbreakup

Capsim Block Documentation

Short Description

This star inputs an image and creates sub images. The sub images are sequentially output.

Top
Input Connections
Port Type Name
0 image_t x
Top
Output Connections
Port Type Name
0 image_t y
Top
Parameters
Num Description Type Name Default Value
0 Sub image width int subWidth 8
1 Sub image height int subHeight 8
2 Levels (for inverse) int levels 256
Top
States
Num Type Name Initial Value Description
0 int widthOffset 0
1 int heightOffset 0
Top

Declarations


 

	int no_samples;
	int i,j,k;
	float	temp;
	dsp_floatMatrix_t	matrix;
	dsp_floatMatrix_Pt	matrix_P;
	dsp_floatMatrix_Pt	subMatrix_P;
	int	pwidth;
	int	pheight;
	float**		mat_PP;
	image_t	img;
	dsp_floatMatrix_Pt Dsp_SubMatrix();
	int	done;



Top

Initialization Code



 

	SET_CELL_SIZE_IN(0,sizeof(image_t));
    SET_CELL_SIZE_OUT(0,sizeof(image_t));




Top

Main Code



 

/*
 * collect the image
 */
for (no_samples = MIN_AVAIL(); no_samples > 0; --no_samples) {
	IT_IN(0);
	img=x(0);
	pheight=img.height;
	pwidth=img.width;
	mat_PP=img.image_PP;

	widthOffset=0;
	heightOffset=0;

	/*
	 * package as a matrix structure
	 */
	matrix.matrix_PP=mat_PP;
	matrix.width=pwidth;
	matrix.height=pheight;
	done=0;
	while (!done) {
	     matrix_P=Dsp_SubMatrix(&matrix,subWidth,subHeight,
			widthOffset,heightOffset);

	     if(matrix_P == NULL) {
		fprintf(stderr,"imgbreakup: allocation failure\n");
		return(4);
	     }

             if(IT_OUT(0) ){
		    KrnOverflow("imgbreakup",0);
		    return(99);
	     }

	     img.image_PP=matrix_P->matrix_PP;
	     img.width=matrix_P->width;
	     img.height=matrix_P->height;

	     y(0) = img;
	     widthOffset += subWidth;
	     if(widthOffset >= pwidth) {
			heightOffset += subHeight;
			widthOffset =0;
	     }

	     if(heightOffset >= pheight)
			done=1;
	}
			
}
return(0);




Top

Wrapup Code



 





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



 

/* imgbreakup.s */
/***********************************************************************
                             imgbreakup()
************************************************************************
This star inputs an image and creates sub images.
The sub images are sequentially output.

imgbreakup


This star inputs an image and creates sub images. The sub images are sequentially output.


Programmer:  	Sasan Ardalan	
Date: 		August 15, 1993

*/