imgcalc

Capsim Block Documentation

Short Description

Perform a mathematical or logical operation on an image using another image.

Top
Input Connections
Port Type Name
0 image_t x
1 image_t y
Top
Output Connections
Port Type Name
0 image_t z
Top
Parameters
Num Description Type Name Default Value
0 Operation:0=x,1=-,2:*,3:/,4:&,5:|,6:xor,7:cmpl,8:copy int operation 6
1 width offset int widthOffset 0
2 height offset int heightOffset 0
Top
States
Num Type Name Initial Value Description
0 image_t img
1 dsp_floatMatrix_Pt filter_P
Top

Declarations


 

	int no_samples;
	int i,j,k;
	dsp_floatMatrix_t	matrix1;
	dsp_floatMatrix_t	matrix2;



Top

Initialization Code



 

	SET_CELL_SIZE_IN(0,sizeof(image_t));
	SET_CELL_SIZE_IN(1,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) {
	/*
	 * input an image
	 */
	IT_IN(0);
	img=x(0);

	matrix1.height=img.height;
	matrix1.width=img.width;
	matrix1.matrix_PP=img.image_PP;

	IT_IN(1);
	img=y(0);


	matrix2.height=img.height;
	matrix2.width=img.width;
	matrix2.matrix_PP=img.image_PP;

	Dsp_CalculateMatrix(&matrix1,&matrix2,
                operation,widthOffset,heightOffset,256);
        /*
         * Send image out
	 */

	img.width=matrix1.width;
	img.height=matrix1.height;
    	img.image_PP=matrix1.matrix_PP;

	if(IT_OUT(0)) {
				KrnOverflow("imgcalc",0);
				return(99);
	}
	z(0) = img;
	
			
}
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



 

/* imgcalc.s */
/***********************************************************************
                             imgcalc()
************************************************************************
Perform a mathematical or logical operation on an image using another
image.
Buffers:
	Input:
		x
		y
	Output:	
		z
The image on buffer x is replaced with the result of the calculation.
x=f(x,y)
x is output on buffer z.
Image y may be offset in width and height prior to the operation.
Supported Operations:
	0: Multiply 
	1: Add
	2: Subtract
	3: Divide
	4: AND
	5: OR
	6: XOR
	7: Complement
	8: Copy

imgcalc


Perform a mathematical or logical operation on an image using another
image.
Buffers:
	Input:
		x
		y
	Output:	
		z
The image on buffer x is replaced with the result of the calculation.
x=f(x,y)
x is output on buffer z.
Image y may be offset in width and height prior to the operation.
Supported Operations:
	0: Multiply 
	1: Add
	2: Subtract
	3: Divide
	4: AND
	5: OR
	6: XOR
	7: Complement
	8: Copy


Programmer:  	Sasan Ardalan	
Date: 		September 10, 1993

*/