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

📄 dvb_image.c

📁 DVB软件,基于CT216软件的开发源程序.
💻 C
字号:
/**************************************************************************

        (C)Copyright Cheertek Inc.
           K000, all right reserved.

        Date    : 2006.12.14
        Author  : Cheertek (k000)
        Purpose : Image API for UI Layer
****************************************************************************/
#include <stdio.h>
#include "dvb_file.h"
#include "dvb_device.h"
#include "dvb_image.h"
#include "ct_fd.h"
#include "ct_video.h"
#include "ct_osd.h"
#include "ct_tve.h"
#ifdef MPGENC_ENABLE
#include "dvb_mpeg2enc.h"
#endif
#ifdef CT216T_ELGIST_MM
#include "sys_api.h"
#include "mem_api.h"
#include "denc_api.h"
#else
#include "dvb_avio.h"	//(GFG-002)
#endif

/*******************************************************************************************/

#if 0
#define IMG_MSG(p) 		
#else
#define IMG_MSG(p) 		printf p
#endif

#if 1
#define IMG_DBG(p) 		
#else
#define IMG_DBG(p) 		printf p
#endif
/*******************************************************************************************/
#ifdef CT216T_ELGIST_MM
extern u32 gen_point;
#endif

bool8 _bIsReseting = FALSE;
bool8 _bIsThumbnail = FALSE;
bool8 _bIsFinishCalPostPro = FALSE;
bool8 b8HideEncodePro =FALSE;
IMG_INITPARAMETERS stImgInitParameters;
u32	u32ImgBackGroundColor=COLOR_YCbCrCOLOR_BLACK;
static bool8 _b8TrueColor = TRUE;

EN_DVB_IMG_EFFECT_MODE _enEffectMode = EN_DVB_IMG_EFFECT_MODE_NONE;

typedef struct
{  
	EN_IMG_DATA_SRC enDataSrc;
	u32 			u32FillDataHandle;
	u32 			u32DataLen;
	u32 			u32FileHandle;
	u8* 			pu8DataBuff;
} IMAGE_Handle;

/*******************************************************************************************/
//Global variable
#ifdef USB_ENABLE
static EN_DEVICE_TYPE  _enDeviceType = EN_USB_DEVICE;
#else
static EN_DEVICE_TYPE  _enDeviceType = EN_CARDREADER_DEVICE;
#endif
IMAGE_Handle    *_pstImageHandle = NULL;
bool8 			_b8ImgDecodingMode = FALSE;
bool8           _bIsPALMode = TRUE;
u8				_u8ImgCutDecoderIdx = 0;
EN_IMG_FILETYPE	_enImgCutFileType = EN_IMG_FILETYPE_JPG;

EN_IMG_DECODE_STATUS _img_decode_from_fs(u32 u32FileIndex, bool8 bIsThumb);
EN_IMG_DECODE_STATUS _img_decode_from_mem(u32 u32StartAddr, u32 u32Length, bool8 bIsThumb);

EN_DRV_RESULT DVB_IMG_ReadFsData(u8* pu8Puffer,  u32 u32Offset, u32 u32ReadLen);
EN_DRV_RESULT DVB_IMG_ReadArrayData(u8* pu8Puffer,  u32 u32Offset, u32 u32ReadLen);

extern EN_CT_SCAN_MODE DVB_GetVideoScanMode(void);	            //(GFG-002)
extern EN_CT_TVE_OUTPUT_MODE DVB_GetTveOutputFormat(void);    //(GFG-002)

extern bool8 DVB_DEVCTRL_HoldFs(bool8 b8Hold, EN_MEDIA_TYPE enMediaType);



void DVB_IMG_Set_PanelType(EN_PANEL_TYPE u8Panel_Type)
{
   CT_Img_Set_PanelType(u8Panel_Type);
}

EN_PANEL_TYPE DVB_IMG_Get_PanelType(void)
{
   return CT_Img_Get_PanelType();
}

void DVB_IMG_Set_BackGroundColor(u32 u32RGBColor)
{
    extern u32 COMUTL_RGB2YUV(u32 u32RGB);
	u32ImgBackGroundColor = COMUTL_RGB2YUV(u32RGBColor);
}

EN_IMG_FILETYPE DVB_IMG_Get_Filetype(void)
{
	return _enImgCutFileType;
}

bool8 DVB_IMG_Set_Filetype(EN_IMG_FILETYPE enFiletype)
{
	bool8 bInitResult = FALSE;

//	IMG_DBG(("org dec %d, new dec %d\n", _enImgCutFileType, enFiletype));
	_enImgCutFileType = enFiletype;

	bInitResult = CT_Img_InitialDecoderThread(_enImgCutFileType);

//	IMG_DBG(("init decoder thread result %d\n", bInitResult));

	return bInitResult;
}

EN_DEVICE_TYPE DVB_IMG_GetDeviceType(void)
{
	return _enDeviceType;
}

void DVB_IMG_SetDeviceType(EN_DEVICE_TYPE enDeviceType)
{
	_enDeviceType = enDeviceType;
}

EN_IMG_DECODE_STATUS DVB_IMG_DecodeFromMem(u32 u32StartAddr, u32 u32Length)
{
	EN_IMG_DECODE_STATUS enDecodeStatus = _img_decode_from_mem(u32StartAddr, u32Length, FALSE);
	
	if(enDecodeStatus == EN_IMG_STATUS_SUCCESS)
	{
		CT_Img_Decode(_u8ImgCutDecoderIdx);
	}
	return enDecodeStatus; 
}

EN_IMG_DECODE_STATUS DVB_IMG_DecodeFromFs(u32 u32FileIndex)
{
    EN_IMG_DECODE_STATUS enDecodeStatus = _img_decode_from_fs(u32FileIndex, FALSE);

    if(enDecodeStatus == EN_IMG_STATUS_SUCCESS)
    {
        CT_Img_Decode(_u8ImgCutDecoderIdx);
    }
    return enDecodeStatus;
}

EN_IMG_DECODE_STATUS DVB_IMG_DecodePreviewFromFs(u32 u32FileIndex, u32 u32PosX, u32 u32PosY, u32 u32Width, u32 u32Height)
{
    EN_IMG_DECODE_STATUS enDecodeStatus = _img_decode_from_fs(u32FileIndex, TRUE);

    if(enDecodeStatus == EN_IMG_STATUS_SUCCESS)
    {
        CT_Img_SetImgDisplayPos(_u8ImgCutDecoderIdx, u32PosX, u32PosY, u32Width, u32Height);    
        CT_Img_Decode(_u8ImgCutDecoderIdx);
    }	
    return enDecodeStatus;
}

EN_IMG_DECODE_STATUS DVB_IMG_DecodeOriginalFromFs(u32 u32FileIndex)
{
	EN_IMG_DECODE_STATUS enDecodeStatus = _img_decode_from_fs(u32FileIndex, FALSE);
	DVB_IMG_ZOOMRECT	 stClipRect;
	DVB_IMG_EXIF		 stImgExif;
	u32					 u32PosX, u32PosY;
	
    if(enDecodeStatus == EN_IMG_STATUS_SUCCESS)
    {
		CT_Img_QueryInfo(_u8ImgCutDecoderIdx, IMG_QUERY_CLIP_INFO, &stClipRect);
		CT_Img_QueryInfo(_u8ImgCutDecoderIdx, IMG_QUERY_EXIF_INFO, &stImgExif);
    	
		if ((stImgExif.u32ExifImageWidth < stClipRect.u16Width) &&
			(stImgExif.u32ExifImageHeight < stClipRect.u16Height))
		{
			u32PosX = stClipRect.u16PosX + (stClipRect.u16Width - stImgExif.u32ExifImageWidth) / 2;
			u32PosY = stClipRect.u16PosY + (stClipRect.u16Height - stImgExif.u32ExifImageHeight) / 2;

			CT_Img_SetImgDisplayPos(_u8ImgCutDecoderIdx, u32PosX, u32PosY, stImgExif.u32ExifImageWidth, stImgExif.u32ExifImageHeight);
		}
    	
        CT_Img_Decode(_u8ImgCutDecoderIdx);
    }
    return enDecodeStatus;
}

EN_IMG_DECODE_STATUS DVB_IMG_DecodeThumbFromFs(u32 u32FileIndex, u32 u32PosX, u32 u32PosY, u32 u32Width, u32 u32Height)
{
    // 硂娩ㄏノthumb

⌨️ 快捷键说明

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