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

📄 l2_dramimg.c

📁 dz3000_51.0.0.4.rar
💻 C
📖 第 1 页 / 共 3 页
字号:
		factor = ((ULONG)SrcVsize<<16)/DstVsize;
		//PRINT_DRAM("            L2_ScaleUpImage: Vertical factor=%x\n",factor);

		if(factor!=0) {
			XBYTE[0x2770] = 0x17;						// set vertical scaling-up mode
			XBYTE[0x277F] = (UCHAR)(factor);			// assign scaling factor
			XBYTE[0x2780] = (UCHAR)(factor >> 8);		// assign scaling factor

			XBYTE[0x2771] = (UCHAR)(SrcAddr);
			XBYTE[0x2772] = (UCHAR)(SrcAddr >> 8);
	        	XBYTE[0x2773] = (UCHAR)(SrcAddr >> 16);

			XBYTE[0x2774] = (UCHAR)(DstAddr);
			XBYTE[0x2775] = (UCHAR)(DstAddr >> 8);
        		XBYTE[0x2776] = (UCHAR)(DstAddr >> 16);

			XBYTE[0x2777] = (UCHAR)(SrcHsize);
			XBYTE[0x2778] = (UCHAR)(SrcHsize >> 8);
			XBYTE[0x2779] = (UCHAR)(SrcVsize);
			XBYTE[0x277A] = (UCHAR)(SrcVsize >> 8);

			XBYTE[0x277B] = (UCHAR)(SrcHsize);
			XBYTE[0x277C] = (UCHAR)(SrcHsize >> 8);
			XBYTE[0x277D] = (UCHAR)(DstVsize);
			XBYTE[0x277E] = (UCHAR)(DstVsize >> 8);

			XBYTE[0x27A1] = 0x80;						// start operation

			while(!(XBYTE[0x27B0] & 0x80));				// wait operation done
		}

		else {
			L2_CopyImage(SrcAddr, SrcHsize, SrcVsize, 0, 0, SrcHsize, SrcVsize, DstAddr, SrcHsize, DstVsize, 0, 0);
		}

		//PRINT_L2("        L2_ScaleUpImage: Exit\n");
        return L2K_SUCCESS;
}
//patch5.0@richie@sdram mapping end


//-----------------------------------------------------------------------------
//L2_ScaleDownImage
//-----------------------------------------------------------------------------
/*
routine description:
		The function scales down the image stored in the source address
		and the result image is written back to the destination address.
		Free space is needed to store the temporary image after the first
		one-dimensional operation.
arguments:
		SrcAddr	- Source image address (in the DRAM)
		DstAddr	- Destination image address
		SrcHsize- Source image width (in pixels)
		SrcVsize- Source image height
		DstHsize- Destination image width
		DstVsize- Destination image height
		TempAddr- Free space address
return value:
		0x00	- success
		others	- error
*/

UCHAR L2_ScaleDownImage(ULONG SrcAddr, USHORT SrcHsize, USHORT SrcVsize,ULONG DstAddr, USHORT DstHsize, USHORT DstVsize, ULONG TempAddr) USING_0
{
	//PRINT_L2("        L2_ScaleDownImage: Enter\n");

	//Joe@2003.2.25 14:51 modify begin
	//joe delete old code, and add followed one line code
	L1_ScaleImage(SrcAddr, SrcHsize, SrcVsize, DstAddr, DstHsize, DstVsize, TempAddr);
	//Joe@2003.2.25 14:51 modify end

	//PRINT_L2("        L2_ScaleDownImage: Exit\n");
	return L2K_SUCCESS;
}

//patch5.0@richie@sdram mapping begin
//-----------------------------------------------------------------------------
//L2_ScaleDownImage_H
//-----------------------------------------------------------------------------
/*
routine description:
		The function scales down the image stored in the source address
		and the result image is written back to the destination address.
arguments:
		SrcAddr	- Source image address (in the DRAM)
		DstAddr	- Destination image address
		SrcHsize- Source image width (in pixels)
		SrcVsize- Source image height
		DstHsize- Destination image width
return value:
		0x00	- success
		others	- error
*/

UCHAR L2_ScaleDownImage_H(ULONG SrcAddr, USHORT SrcHsize, USHORT SrcVsize,ULONG DstAddr, USHORT DstHsize) USING_0
{
		USHORT factor;

		//PRINT_L2("        L2_ScaleDownImage: Enter\n");
		//PRINT_DRAM("            L2_ScaleDownImage: SrcAddr=%lx, SrcHsize=%d, SrcVsize=%d, DstAddr=%lx, DstHsize=%d, DstVsize=%d, TempAddr=%lx\n",SrcAddr,SrcHsize,SrcVsize,DstAddr,DstHsize,DstVsize,TempAddr);

		factor = ((ULONG)DstHsize<<16)/SrcHsize + 1;
		//PRINT_DRAM("            L2_ScaleDownImage: Horizontal factor=%x\n",factor);

		if(factor!=0) {
			XBYTE[0x2770] = 0x12;						// set horizontal scaling-down mode
			XBYTE[0x277F] = (UCHAR)(factor);				// assign scaling factor
			XBYTE[0x2780] = (UCHAR)(factor >> 8);			// assign scaling factor

			XBYTE[0x2771] = (UCHAR)(SrcAddr);
			XBYTE[0x2772] = (UCHAR)(SrcAddr >> 8);
	        	XBYTE[0x2773] = (UCHAR)(SrcAddr >> 16);

			XBYTE[0x2774] = (UCHAR)(DstAddr);
			XBYTE[0x2775] = (UCHAR)(DstAddr >> 8);
	        	XBYTE[0x2776] = (UCHAR)(DstAddr >> 16);

			XBYTE[0x2777] = (UCHAR)(SrcHsize);
			XBYTE[0x2778] = (UCHAR)(SrcHsize >> 8);
			XBYTE[0x2779] = (UCHAR)(SrcVsize);
			XBYTE[0x277A] = (UCHAR)(SrcVsize >> 8);

			XBYTE[0x277B] = (UCHAR)(DstHsize);
			XBYTE[0x277C] = (UCHAR)(DstHsize >> 8);
			XBYTE[0x277D] = (UCHAR)(SrcVsize);
			XBYTE[0x277E] = (UCHAR)(SrcVsize >> 8);

			XBYTE[0x27A1] = 0x80;						// start operation

			while(!(XBYTE[0x27B0] & 0x80));				// wait operation done
		}
		else {
			L2_CopyImage(SrcAddr, SrcHsize, SrcVsize, 0, 0, SrcHsize, SrcVsize, DstAddr, DstHsize, SrcVsize, 0, 0);
		}

		//PRINT_L2("        L2_ScaleDownImage: Exit\n");
                return L2K_SUCCESS;
}


//-----------------------------------------------------------------------------
//L2_ScaleDownImage_V
//-----------------------------------------------------------------------------
/*
routine description:
		The function scales down the image stored in the source address
		and the result image is written back to the destination address.
arguments:
		SrcAddr	- Source image address (in the DRAM)
		DstAddr	- Destination image address
		SrcHsize- Source image width (in pixels)
		SrcVsize- Source image height
		DstVsize- Destination image height
return value:
		0x00	- success
		others	- error
*/

UCHAR L2_ScaleDownImage_V(ULONG SrcAddr, USHORT SrcHsize, USHORT SrcVsize, ULONG DstAddr,USHORT DstVsize) USING_0
{
		USHORT factor;

		//PRINT_L2("        L2_ScaleDownImage: Enter\n");
		//PRINT_DRAM("            L2_ScaleDownImage: SrcAddr=%lx, SrcHsize=%d, SrcVsize=%d, DstAddr=%lx, DstHsize=%d, DstVsize=%d, TempAddr=%lx\n",SrcAddr,SrcHsize,SrcVsize,DstAddr,DstHsize,DstVsize,TempAddr);

		factor = ((ULONG)DstVsize<<16)/SrcVsize + 1;
		//PRINT_DRAM("            L2_ScaleDownImage: Vertical factor=%x\n",factor);

		if(factor!=0) {
			XBYTE[0x2770] = 0x13;						// set vertical scaling-down mode
			XBYTE[0x277F] = (UCHAR)(factor);			// assign scaling factor
			XBYTE[0x2780] = (UCHAR)(factor >> 8);		// assign scaling factor

			XBYTE[0x2771] = (UCHAR)(SrcAddr);
			XBYTE[0x2772] = (UCHAR)(SrcAddr >> 8);
	        	XBYTE[0x2773] = (UCHAR)(SrcAddr >> 16);

			XBYTE[0x2774] = (UCHAR)(DstAddr);
			XBYTE[0x2775] = (UCHAR)(DstAddr >> 8);
		        XBYTE[0x2776] = (UCHAR)(DstAddr >> 16);

			XBYTE[0x2777] = (UCHAR)(SrcHsize);
			XBYTE[0x2778] = (UCHAR)(SrcHsize >> 8);
			XBYTE[0x2779] = (UCHAR)(SrcVsize);
			XBYTE[0x277A] = (UCHAR)(SrcVsize >> 8);

			XBYTE[0x277B] = (UCHAR)(SrcHsize);
			XBYTE[0x277C] = (UCHAR)(SrcHsize >> 8);
			XBYTE[0x277D] = (UCHAR)(DstVsize);
			XBYTE[0x277E] = (UCHAR)(DstVsize >> 8);


			XBYTE[0x27A1] = 0x80;						// start operation

			while(!(XBYTE[0x27B0] & 0x80));				// wait operation done
		}
		else {
			L2_CopyImage(SrcAddr, SrcHsize, SrcVsize, 0, 0, SrcHsize, SrcVsize, DstAddr, SrcHsize, DstVsize, 0, 0);
		}

		//PRINT_L2("        L2_ScaleDownImage: Exit\n");
                return L2K_SUCCESS;
}
//patch5.0@richie@sdram mapping end

//-----------------------------------------------------------------------------
//L2_SetFixBadPxlThd
//-----------------------------------------------------------------------------
/*
routine description:
        Set the threshold of the edge detection in fixing the bad pixels
arguments:
        Thd             - the threshold value
return value:
        0x00    - success
        others  - error
*/
UCHAR L2_SetFixBadPxlThd(UCHAR Thd)
{
        //PRINT_L2("        L2_SetFixBadPxlThd: Exit\n");

        XBYTE[0x2788] = Thd;

        //PRINT_L2("        L2_SetFixBadPxlThd: Exit\n");
        return L2K_SUCCESS;
}

//-----------------------------------------------------------------------------
//L2_FixOneBadPixel
//-----------------------------------------------------------------------------
/*
routine description:
        Perform one bad pixel correction. The threshold of the edge detection
        is set in the DRAM initialization routine.
arguments:
        Xoff    - The bad pixel location, horizontal offset from left-top corner.
        Yoff    - The bad pixel location, vertical offset from the left-top corner
return value:
        0x00    - success
        others  - error
*/
UCHAR L2_FixOneBadPixel(USHORT Xoff, USHORT Yoff) USING_0
{
        //PRINT_L2("        L2_FixOneBadPixel: Enter\n");
        //PRINT_L2("            L2_FixOneBadPixel: Xoff=%d, Yoff=%d\n",Xoff,Yoff);

        XBYTE[0x2770] = 0x70;                                           // Set bad pixel compensation mode

        XBYTE[0x2781] = (UCHAR)(Xoff);
        XBYTE[0x2782] = (UCHAR)(Xoff >> 8);
        XBYTE[0x2783] = (UCHAR)(Yoff);
        XBYTE[0x2784] = (UCHAR)(Yoff >> 8);

        XBYTE[0x27A1] = 0x80;                                           // start operation

        while(!(XBYTE[0x27B0] & 0x80));                         // wait operation done

        //PRINT_L2("        L2_FixOneBadPixel: Exit\n");
        return L2K_SUCCESS;
}

//-----------------------------------------------------------------------------
//L2_SetStampFontColor
//-----------------------------------------------------------------------------
/*
routine description:
        Set the color of the font when using the function L2_StampOneFont.
arguments:
        Font    -       0: white
                        1: yellow
                        2: cyan
                        3: green
                        4: magenta
                        5: red
                        6: blue
                        7: black
        HalfTone-       0: color of "halftone" attribute is the same as the image
                        1: color of "halftone" attribute is the same as the font
                        2: color of "halftone" attribute is black
        Border  -       0: color of "border" attribute is the same as the image
                        1: color of "border" attribute is the same as the font
                        2: color of "border" attribute is black
return value:
        0x00    - success
        others  - error
*/
UCHAR L2_SetStampFontColor(UCHAR Font, UCHAR HalfTone, UCHAR Border) USING_0
{
        //PRINT_L2("        L2_SetStampFontColor: Enter\n");
        //PRINT_L2("            L2_SetStampFontColor: Font=%bd, HalfTone=%bd, Border=%bd\n",Font,HalfTone,Border);

        if(Font>7 || HalfTone>2 || Border>2 ) return L2K_ERROR_PARAMETER;

        XBYTE[0x2787] = (Font<<4) | (HalfTone<<2) | (Border);

        //PRINT_L2("        L2_SetStampFontColor: Exit\n");
        return L2K_SUCCESS;
}

//-----------------------------------------------------------------------------
//L2_SetStampFontScale
//-----------------------------------------------------------------------------
/*
routine description:
        Set the size of the font when using the function L2_StampOneFont.
arguments:
        scale   - scaling factor
                0: 16x32 original size
                1: x2 scale up
                2: x3 scale up
                3: x4 scale up
return value:
        0x00    - success
        others  - error
*/
UCHAR L2_SetStampFontScale(UCHAR Scale) USING_0
{
        //PRINT_L2("        L2_SetStampFontScale: Enter\n");

        if(Scale<4)
        {
                XBYTE[0x2785] = (Scale-1);

                //PRINT_L2("        L2_SetStampFontScale: Exit\n");
        	return L2K_SUCCESS;
        }
        else
        {
                //PRINT_L2("        L2_SetStampFontScale: Exit\n");
                return L2K_ERROR_PARAMETER;
        }
}

//-----------------------------------------------------------------------------
//L2_StampOneFont
//-----------------------------------------------------------------------------
/*
routine description:
        Stamp one font to the image. The font database is shared with the
        font-based OSD function. Free space is needed to store the
        temporary scaled-up font.
arguments:
        OSDAddr - font-based OSD database address (in the DRAM)
        FontID  - Font index
        Xoff    - Location to stamp the font, horizontal offset from the
                  left-top corner of the image
        Yoff    - Location to stamp the font, vertical offset from the
                  left-top corner of the image
        TempAddr- Free space address
return value:
        0x00    - success
        others  - error
*/

⌨️ 快捷键说明

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