Ejemplo n.º 1
0
static POST_ERROR Post_update_condition(void)
{
    POST_ERROR error = POST_SUCCESS;

    unsigned int PreHozRatio, PreVerRatio;
    unsigned int MainHozShift, MainVerShift;

    POST_MSG((_T("[POST]++Post_update_condition()\n\r")));

    error = Post_get_prescaler_shiftvalue(&MainHozShift, g_PostConfig.SrcWidth, g_PostConfig.DstWidth);
    if (error == POST_SUCCESS)
    {
        PreHozRatio = (1<<MainHozShift);
        error = Post_get_prescaler_shiftvalue(&MainVerShift, g_PostConfig.SrcHeight, g_PostConfig.DstHeight);
        if (error == POST_SUCCESS)
        {
            PreVerRatio = (1<<MainVerShift);
            g_pPostReg->PreScale_Ratio = PRESCALE_V_RATIO(PreVerRatio) | PRESCALE_H_RATIO(PreHozRatio);
            g_pPostReg->PreScaleImgSize = PRESCALE_WIDTH(g_PostConfig.SrcWidth/PreHozRatio) | PRESCALE_HEIGHT(g_PostConfig.SrcHeight/PreVerRatio);
            g_pPostReg->SRCImgSize = SRC_WIDTH(g_PostConfig.SrcWidth) | SRC_HEIGHT(g_PostConfig.SrcHeight);
            g_pPostReg->MainScale_H_Ratio = MAINSCALE_H_RATIO((g_PostConfig.SrcWidth<<8)/(g_PostConfig.DstWidth<<MainHozShift));
            g_pPostReg->MainScale_V_Ratio = MAINSCALE_V_RATIO((g_PostConfig.SrcHeight<<8)/(g_PostConfig.DstHeight<<MainVerShift));
            g_pPostReg->DSTImgSize = DST_WIDTH(g_PostConfig.DstWidth) | DST_HEIGHT(g_PostConfig.DstHeight);
            g_pPostReg->PreScale_SHFactor = PRESCALE_SHFACTOR(10-(MainHozShift+MainVerShift));
        }
    }

    POST_MSG((_T("[POST]--Post_update_condition() : %d\n\r"), error));

    return error;
}
static TVSC_ERROR TVSC_update_condition(void)
{
	TVSC_ERROR error = TVSC_SUCCESS;

	unsigned int PreHozRatio, PreVerRatio;
	unsigned int MainHozShift, MainVerShift;

	TVSC_MSG((_T("[TVSC]++TVSC_update_condition()\n\r")));

	error = TVSC_get_prescaler_horizontal_value(&PreHozRatio, &MainHozShift);
	if (error == TVSC_SUCCESS)
	{
		error = TVSC_get_prescaler_vertical_value(&PreVerRatio, &MainVerShift);
		if (error == TVSC_SUCCESS)
		{
			g_pTVSCReg->PreScale_Ratio = PRESCALE_V_RATIO(PreVerRatio) | PRESCALE_H_RATIO(PreHozRatio);
			g_pTVSCReg->PreScaleImgSize = PRESCALE_WIDTH(g_TVSCConfig.SrcWidth/PreHozRatio) | PRESCALE_HEIGHT(g_TVSCConfig.SrcHeight/PreVerRatio);
			g_pTVSCReg->SRCImgSize = SRC_WIDTH(g_TVSCConfig.SrcWidth) | SRC_HEIGHT(g_TVSCConfig.SrcHeight);
			g_pTVSCReg->MainScale_H_Ratio = MAINSCALE_H_RATIO((g_TVSCConfig.SrcWidth<<8)/(g_TVSCConfig.DstWidth<<MainHozShift));
			g_pTVSCReg->MainScale_V_Ratio = MAINSCALE_V_RATIO((g_TVSCConfig.SrcHeight<<8)/(g_TVSCConfig.DstHeight<<MainVerShift));
			g_pTVSCReg->DSTImgSize = DST_WIDTH(g_TVSCConfig.DstWidth) | DST_HEIGHT(g_TVSCConfig.DstHeight);
			g_pTVSCReg->PreScale_SHFactor = PRESCALE_SHFACTOR(10-(MainHozShift+MainVerShift));
		}
	}

	TVSC_MSG((_T("[TVSC]--TVSC_update_condition() : %d\n\r"), error));

	return error;
}