⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 imxbmclib.c

📁 可以了解TI的DSP iMX的用法。适用DSP54X
💻 C
字号:
static short imxenc_band_scale(
	short *input1_ptr,	  /* starting address of 1st input */
	short *input2_ptr,	  /* starting address of 2nd input */
	short *output_ptr,	  /* starting address of output */
	short input1_width,  /* width/columns of 1st input */
	short input1_height,	/* height/rows of 1st input */
	short input2_width,  /* width/columns of 2nd input */
	short input2_height,	/* height/rows of 2nd input */
	short output_width,  /* width/columns of output */
	short output_height,	/* height/rows of output */
	short mat1_width,    /* computation width of 1st input */
	short mat1_height,   /* computation height of 1st input */
	short mat2_width,    /* computation width of 2nd input */
	short mat2_height,   /* computation height of 2nd input */
	short input1_type,   /* short/byte signed/unsigned */
	short input2_type,   /* short/byte signed/unsigned */
	short output_type,   /* short/byte */
	short round_shift,   /* shifting parameter */
	short *cmdptr
)
{
	short lpend1, lpend2, lpend3, lpend4, cmdlen;
	short data_inc1, data_inc2, data_inc3, data_inc4;
	short data_inc_mask1, data_inc_mask2, data_inc_mask3;
	short coef_inc1, coef_inc2, coef_inc3, coef_inc4;
	short coef_inc_mask1, coef_inc_mask2, coef_inc_mask3;
	short outp_inc1, outp_inc2, outp_inc3, outp_inc4;
	short outp_inc_mask1, outp_inc_mask2, outp_inc_mask3;
	short dpoints, cpoints, opoints;
	short acclp, acc_mode, coeff_unsigned;
	short operation = 0;
   
	short nummac, hblks, vblks;

	coeff_unsigned = determine_coef_uns(input1_type, input2_type,
										input1_ptr, input2_ptr);

	input1_type = input1_type & iMXTYPE_SIZEMASK;
	input2_type = input2_type & iMXTYPE_SIZEMASK;
	output_type = output_type & iMXTYPE_SIZEMASK;

	nummac = (mat2_width & 0x3) ? 1 : 4;
	hblks  = input1_width / mat1_width;
	vblks  = input1_height / mat1_height;

	lpend4 = (mat2_height - 1);
	lpend3 = (mat2_width/nummac - 1);
	lpend2 = (hblks - 1);
	lpend1 = (vblks * mat1_height - 1);

	data_inc4 = input1_type;
	data_inc3 = -(lpend4 * input1_type);
	data_inc2 = input1_type;
	data_inc1 = ((input1_width - hblks * mat1_width + 1) * input1_type); 

	data_inc_mask1 = 7;
	data_inc_mask2 = 3;
	data_inc_mask3 = 1;

	coef_inc4 = 0;
	coef_inc3 = (input2_width * input2_type);
	coef_inc2 = -((lpend4 * input2_width - nummac) * input2_type);
	coef_inc1 = -((lpend4 * input2_width + mat2_width - nummac) *input2_type); 
		   
	coef_inc_mask1 = 3;
	coef_inc_mask2 = 1;
	coef_inc_mask3 = 0;

	outp_inc4 = 0;
	outp_inc3 = 0; 
	outp_inc2 = (nummac * output_type);
	outp_inc1 = ((output_width - hblks * mat2_width + nummac) * output_type); 

	outp_inc_mask1 = 7;
	outp_inc_mask2 = 1;
	outp_inc_mask3 = 0;

	acclp = 2;
	acc_mode = 0;

	dpoints = 1;
	cpoints = nummac;
	opoints = nummac;

	cmdlen = imx_enc(
		acc_mode, operation,
		lpend1, lpend2, lpend3, lpend4,
		input1_ptr, input2_ptr, output_ptr,
		data_inc1, data_inc2, data_inc3, data_inc4,
		data_inc_mask1, data_inc_mask2, data_inc_mask3,
		coef_inc1, coef_inc2, coef_inc3, coef_inc4,
		coef_inc_mask1, coef_inc_mask2, coef_inc_mask3,
		outp_inc1, outp_inc2, outp_inc3, outp_inc4,
		outp_inc_mask1, outp_inc_mask2, outp_inc_mask3,
		dpoints, cpoints, opoints,
		input1_type, input2_type, output_type,
		acclp, round_shift, coeff_unsigned, cmdptr);

	return (cmdlen);
}

short imxenc_scaleup(
	short *band0_inpptr,   /* starting address of band 0 input  */
	short *band1_inpptr,   /* starting address of band 0 input  */
	short *band2_inpptr,   /* starting address of band 0 input  */
	short *coeff_ptr,      /* starting address of coefficient   */
	short *band0_oupptr,   /* starting address of band 0 output */
	short *band1_oupptr,   /* starting address of band 1 output */
	short *band2_oupptr,   /* starting address of band 2 output */
	short dir,             /* scale up direction 0: X direction
	                                             1: Y direction */
	short bandnum,         /* band number for scaling up */
	short input_width,     /* width/columns of input */
	short input_height,		 /* height/rows of input */
	short coeff_width,		 /* width/columns of coefficient */
	short coeff_height,		 /* height/rows of coefficient */
	short output_width,		 /* width/columns of output */
	short output_height,	 /* height/rows of output */
	short mat1_width,		   /* computation width of 1st input */
	short mat1_height,		 /* computation height of 1st input */
	short mat2_width,		   /* computation width of 2nd input */
	short mat2_height,		 /* computation height of 2nd input */
	short input1_type,		 /* short/byte signed/unsigned */
	short input2_type,		 /* short/byte signed/unsigned */
	short output_type,		 /* short/byte */
	short round_shift, 	   /* shifting parameter */
	short *cmdptr
)
{
	short *mat1;
	short *mat2;

	short cmdlen = 0;

	if (dir == 0)  /* X dirction */
	{
		mat1 = coeff_ptr;

		/* Band 0 scaling */
		mat2 = band0_inpptr;
		cmdlen += imxenc_band_scale(
			mat1, mat2, band0_oupptr,
			input_width, input_height,
			coeff_width, coeff_height,
			output_width, output_height,
			mat1_width, mat1_height,
			mat2_width, mat2_height,
			iMXTYPE_SHORT, iMXTYPE_SHORT, iMXTYPE_SHORT,
			round_shift, cmdptr+cmdlen);

		if (bandnum == 1)
			return(cmdlen);

		/* Band 1 scaling */
		mat2 = band1_inpptr;
		cmdlen += imxenc_band_scale(
			mat1, mat2, band1_oupptr,
			input_width, input_height,
			coeff_width, coeff_height,
			output_width, output_height,
			mat1_width, mat1_height,
			mat2_width, mat2_height,
			iMXTYPE_SHORT, iMXTYPE_SHORT, iMXTYPE_SHORT,
			round_shift, cmdptr+cmdlen);

		/* Band 2 scaling */
		mat2 = band2_inpptr;
		cmdlen += imxenc_band_scale(
			mat1, mat2, band2_oupptr,
			input_width, input_height,
			coeff_width, coeff_height,
			output_width, output_height,
			mat1_width, mat1_height,
			mat2_width, mat2_height,
			iMXTYPE_SHORT, iMXTYPE_SHORT, iMXTYPE_SHORT,
			round_shift, cmdptr+cmdlen);
	}

	return (cmdlen);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -