Capsim Block Documentation
This star inputs an image and creates sub images. The sub images are sequentially output.
| Port | Type | Name | |
|---|---|---|---|
| 0 | image_t | x |
| Port | Type | Name | |
|---|---|---|---|
| 0 | image_t | y |
| 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 |
| Num | Type | Name | Initial Value | Description |
|---|---|---|---|---|
| 0 | int | widthOffset | 0 | |
| 1 | int | heightOffset | 0 |
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; |
|---|
SET_CELL_SIZE_IN(0,sizeof(image_t));
SET_CELL_SIZE_OUT(0,sizeof(image_t));
|
|---|
/*
* 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);
|
|---|
/* Capsim (r) Text Mode Kernel (TMK) Star Library (Blocks)
Copyright (C) 1989-2002 XCAD 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://capsimtmk.sourceforge.net
XCAD Corporation
Raleigh, North Carolina */
|
|---|
/* imgbreakup.s */
/***********************************************************************
imgbreakup()
************************************************************************
This star inputs an image and creates sub images.
The sub images are sequentially output.
|
|---|