📄 fiplay.c
字号:
/*++
Copyright (c) 2001 Sunplus Technology Co., Ltd.
Module Name:
fijpg.c
Abstract:
Module that related to jpeg file creating
Environment:
Keil C51 Compiler
Revision History:
09/07/2001 William Yeo created
--*/
//=============================================================================
//Header file
//=============================================================================
// WWW1 start
#include "general.h"
#include "cardimpt.h"
#include "cardlink.h"
#include "ficon.h"
#include "fifunc.h"
#include "exifhdr.h"
#include "exiffunc.h"
#include "exifvar.h"
// WWW1 end
#include "playback.h"
//patch4.5@ada@modify for pictures whose width is not the times of 8 and 16 begin
extern UCHAR L1_ScaleImage(ULONG SrcAddr, USHORT SrcHsize, USHORT SrcVsize,ULONG DstAddr, USHORT DstHsize, USHORT DstVsize, ULONG TempAddr);
extern UCHAR L1_ScaleImageOneDim(UCHAR Type,ULONG SrcAddr, USHORT SrcHsize, USHORT SrcVsize,ULONG DstAddr, USHORT DstHsize, USHORT DstVsize);
//patch4.5@ada@modify for pictures whose width is not the times of 8 and 16 end
//herb for Playback bug @03/04/21 start
extern UCHAR reset_display;
extern xdata UCHAR avi_play;
extern xdata UCHAR SmallSizeAvi;
//herb for Playback bug @03/04/21 end
#define k_scale 0
//=============================================================================
//Symbol
//=============================================================================
//-----------------------------------------------------------------------------
//Constant
//-----------------------------------------------------------------------------
extern code UCHAR Text_Exif[];
//-----------------------------------------------------------------------------
//Variable
//-----------------------------------------------------------------------------
//=============================================================================
//Program
//=============================================================================
#if (PLAYBACK_OPTION)
//-----------------------------------------------------------------------------
//File_PlayExifFile
//-----------------------------------------------------------------------------
/*++
Routine Description:
Arguments:
none
Return Value:
none
--*/
//patch3.2@ada@0401 For EXIF
//patch4.2@yichang@0520 for recording image width/height
BYTE File_PlayExifFile(UCHAR *name, USHORT startCluster, ULONG DramAddr, USHORT *ImgWidth, USHORT *ImgHeight, UCHAR *DateTime, BIT ShowThumb) USING_0 //ada@0116
{
UCHAR sts = TRUE;
USHORT fHandle = TRUE;
USHORT TempHeight;
USHORT TempWidth;
//version4.0@ada@0513 for DPOF
USHORT FileIndex;
UCHAR tmp1,tmp2;
struct Exif_Decompress_Parameter ImagePara;
struct Exif_Decompress_Parameter ThumbPara;
//Other information
//Image information
ImagePara.Height = 0;
ImagePara.Width = 0;
ImagePara.Size = 0;
ImagePara.Addr = 0;
ImagePara.DataType = 0;
//Thumbnail information
ThumbPara.Height = 0;
ThumbPara.Width = 0;
ThumbPara.Size = 0;
ThumbPara.Addr = 0;
ThumbPara.DataType = 0;
DRI_MCU_Num = 0;
NeedReadMoreHeader = 0;
SETMODE_ChangeCameraMode(K_MODE_IDLE);
fHandle = File_Open(name, K_DOS_ReadFile, startCluster);
if (fHandle)
{
if (ShowThumb)
{
sts = M_Card_File_Read(fHandle,K_DOS_DstDram,(G_DOS_FileSize >> 4),DramAddr,0); //Extract only 1/8 of the whole file
}
else
{
sts = M_Card_File_Read(fHandle,K_DOS_DstDram,G_DOS_FileSize,DramAddr,0);
}
if (sts)
{
sts = EXIFHDR_Parsing_ExifFile(DramAddr,ShowThumb,DateTime,&ImagePara,&ThumbPara);
//Check if read enough header
if ((sts == FALSE) && (ShowThumb) && (NeedReadMoreHeader))
{ //yichang@0508 for 320x240 JPG
sts = M_Card_File_Read(fHandle,K_DOS_DstDram,(G_DOS_FileSize >> 1),DramAddr,0); //Extract only 1/8 of the whole file
if (sts)
{
sts = EXIFHDR_Parsing_ExifFile(DramAddr,ShowThumb,DateTime,&ImagePara,&ThumbPara);
}
NeedReadMoreHeader = 0;
}
File_Close(fHandle, name, K_DOS_ReadFile, 0);
//patch4.2@yichang@0520 for recording image width/height
*ImgWidth = ImagePara.Width;
*ImgHeight = ImagePara.Height;
//patch4.5@ada@modify for pictures whose width is not the times of 8 and 16 begin
if (ShowThumb)//For thumbnail
{
if (Jpeg_Exif_Format == K_EXIF_IMAGE_FORMAT)//EXIF
{
if (sts)
{
if (ThumbPara.DataType == K_File_DataType_YUV411)//YUV411
{
if (((ThumbPara.Width % 16) == 0x00) && ((ThumbPara.Height % 16) == 0x00))
{
//patch5.0@richie@sdram mapping begin
L2_DeCompress(ThumbPara.Addr, ThumbPara.Width, ThumbPara.Height, K_SDRAM_ImagePlaybackBufAddr, 0x00, 0x05, DRI_MCU_Num);
L2_TransYUV420toYUV422(K_SDRAM_ImagePlaybackBufAddr, ThumbPara.Width, ThumbPara.Height);
if(G_Playback_Mode == K_PLAYBACK_MODE_NINE)
{
if ((ThumbPara.Width != G_TmbWidth) || (ThumbPara.Height != G_TmbHeight))
{
L1_ScaleImage(K_SDRAM_ImagePlaybackBufAddr, ThumbPara.Width, ThumbPara.Height, K_SDRAM_ImagePlaybackBufAddr, G_TmbWidth, G_TmbHeight, K_SDRAM_ImagePlaybackGeneralBufAddr);
}
}
//patch5.0@richie@sdram mapping end
}
else
{
if ((ThumbPara.Width % 16) != 0x00)
{
TempWidth = (((ThumbPara.Width + 16) >> 4) << 4);
}
else
{
TempWidth = ThumbPara.Width;
}
if ((ThumbPara.Height % 16) != 0x00)
{
TempHeight = (((ThumbPara.Height + 16) >> 4) << 4);
}
else
{
TempHeight = ThumbPara.Height;
}
//patch5.0@richie@sdram mapping begin
L2_DeCompress(ThumbPara.Addr, TempWidth, TempHeight, K_SDRAM_ImagePlaybackBufAddr, 0x00, 0x05, DRI_MCU_Num);
L2_TransYUV420toYUV422(K_SDRAM_ImagePlaybackBufAddr, TempWidth, TempHeight);
if(G_Playback_Mode == K_PLAYBACK_MODE_NINE)
{
if ((TempWidth != G_TmbWidth) || (TempHeight != G_TmbHeight))
{
L1_ScaleImage(K_SDRAM_ImagePlaybackBufAddr, TempWidth, TempHeight, K_SDRAM_ImagePlaybackBufAddr, G_TmbWidth, G_TmbHeight, K_SDRAM_ImagePlaybackGeneralBufAddr);
}
}
//patch5.0@richie@sdram mapping end
}
}
else//YUV422 format or other YUV format
{
if (ThumbPara.DataType == K_File_DataType_YUV422)//YUV422
{
if (((ThumbPara.Width % 8) == 0x00) && ((ThumbPara.Height % 8) == 0x00))
{
//patch5.0@richie@sdram mapping begin
L2_DeCompress(ThumbPara.Addr, ThumbPara.Width, ThumbPara.Height, K_SDRAM_ImagePlaybackBufAddr , 0x00, 0x04, DRI_MCU_Num);
if (G_Playback_Mode == K_PLAYBACK_MODE_NINE)
{
if ((ThumbPara.Width != G_TmbWidth) || (ThumbPara.Height != G_TmbHeight))
{
L1_ScaleImage(K_SDRAM_ImagePlaybackBufAddr, ThumbPara.Width, ThumbPara.Height, K_SDRAM_ImagePlaybackBufAddr, G_TmbWidth, G_TmbHeight, K_SDRAM_ImagePlaybackGeneralBufAddr);
}
}
//patch5.0@richie@sdram mapping end
}
else
{
//patch4.5.2@ada@Fix the bug to play non-uniform size image begin
//if ((ThumbPara.Width % 8) != 0x00)
//{
// TempWidth = (((ThumbPara.Width + 8) >> 3) << 3);
//}
if ((ThumbPara.Width % 16) != 0x00)
{
TempWidth = (((ThumbPara.Width + 16) >> 4) << 4);
}
//patch4.5.2@ada@Fix the bug to play non-uniform size image end
else
{
TempWidth = ThumbPara.Width;
}
if ((ThumbPara.Height % 8) != 0x00)
{
TempHeight = (((ThumbPara.Height + 8) >> 3) << 3);
}
else
{
TempHeight = ThumbPara.Height;
}
//patch5.0@richie@sdram mapping begin
L2_DeCompress(ThumbPara.Addr, TempWidth, TempHeight, K_SDRAM_ImagePlaybackBufAddr , 0x00, 0x04, DRI_MCU_Num);
if (G_Playback_Mode == K_PLAYBACK_MODE_NINE)
{
if ((TempWidth != G_TmbWidth) || (TempHeight != G_TmbHeight))
{
L1_ScaleImage(K_SDRAM_ImagePlaybackBufAddr, TempWidth, TempHeight, K_SDRAM_ImagePlaybackBufAddr, G_TmbWidth, G_TmbHeight, K_SDRAM_ImagePlaybackGeneralBufAddr);
}
}
//patch5.0@richie@sdram mapping end
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -