📄 softidct.h
字号:
/*****************************************************************************
*
* This program is free software ; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id: softidct.h 545 2006-01-07 22:26:35Z picard $
*
* The Core Pocket Media Player
* Copyright (c) 2004-2005 Gabor Kovacs
*
****************************************************************************/
#ifndef __SOFTIDCT_H
#define __SOFTIDCT_H
#define SOFTIDCT_ID FOURCC('S','I','D','C')
// duplicate softidct for optimized mips code...
#define MPEG4IDCT_ID FOURCC('M','P','I','D')
#define MSMPEG4IDCT_ID FOURCC('M','S','I','D')
void SoftIDCT_Init();
void SoftIDCT_Done();
// IMPORTANT:
// MIPS version of all CopyBlock and AddBlock doesn't support general DstPitch, it's fixed to SrcPitch
// ARM version of AddBlock doesn't support general DstPitch, it's fixed to 8 bytes
// non MIPS64 version of CopyMBlock can be used only in Copy() (no source alignment)
#define EDGE 32
#define MAXBUF 5
typedef void(STDCALL *copyblock)(uint8_t*,uint8_t*,int,int);
typedef void(STDCALL *addblock)(uint8_t*,uint8_t*,int);
typedef void (*drawgmc)(void*,uint8_t*,int);
//#if defined(ARM) && defined(TARGET_PALMOS)
//#define FREESCALE_MX1
//#endif
#ifndef MIPS64
#define CONFIG_IDCT_LOWRES
#endif
#if defined(ARM) || defined(_M_IX86)
#define CONFIG_IDCT_SWAP
#endif
typedef struct softidct
{
idct IDCT;
copyblock AllCopyBlock[2][4]; //[Rounding][x][y]
#if !defined(MIPS64) && !defined(MIPS32)
addblock AddBlock[4]; //[x][y]
#endif
idctintra Intra8x8;
#if !defined(MIPS64)
idctinter Inter8x8[2];
drawgmc DrawGMC;
#endif
#if defined(CONFIG_IDCT_SWAP)
idctcopy Copy16x16Swap[3]; // pixelformat
idctprocess ProcessSwap[3]; // pixelformat
idctintra Intra8x8Swap;
#if !defined(MIPS64)
idctinter Inter8x8Swap[2];
#endif
#endif
int CurrPitch;
int* Ptr;
uint8_t* DstPtr;
uint8_t* RefPtr[2];
uint8_t* RefMin[2];
uint8_t* RefMax[2];
const int* MVBack;
const int* MVFwd;
copyblock CopyBlock[4];
#if defined(CONFIG_IDCT_LOWRES)
const copyblock* CopyBlock4x4;
#endif
#ifdef MIPS64
const copyblock* CopyMBlock;
#endif
idctinter inter8x8uv;
struct
{
pin Pin;
packetprocess Process;
packetformat Format;
} Out;
bool_t NeedLast;
int Mode;
int BufWidth; //16 aligned and edge added
int BufHeight; //16 aligned and edge added
int BufSize;
int BufWidthUV;
int YToU;
int UVX2;
int UVY2;
bool_t Rounding;
int Shift;
int OutWidth;
int OutHeight;
int BufferWidth;
int BufferHeight;
int ShowCurr;
int ShowNext;
int MaxCount;
int BufCount; //IDCT_BUFFERCOUNT + LastTemp
int LastTemp; //last buffer is temporary
uint8_t* Buffer[MAXBUF]; //aligned to 32bytes (example MIPSVR41XX cache hack needs cache block alignement)
block _Buffer[MAXBUF];
int BufFrameNo[MAXBUF];
bool_t BufBorder[MAXBUF];
int BufAlloc[MAXBUF];
#ifdef MIPS64
int NextIRQ;
bool_t KMode;
#endif
uint8_t* Dst;
uint8_t* Ref[2];
int Tab[6]; //inc[12] 4:1:1 2:1:1 1:1:1
uint8_t *Tmp; //aligned 8x8 or 16x16 temp buffer
#ifdef FREESCALE_MX1
int* MX1;
uint8_t* MX1Dst;
int MX1Pitch;
void (*MX1Pop)(struct softidct*);
#endif
uint8_t _Tmp[16+256];
int ModeSupported;
uint8_t* CodeBegin;
uint8_t* CodeEnd;
size_t CodePage;
copyblock QPELCopyBlockM;
idctinter QPELInter;
idctmcomp QPELMComp8x8;
idctmcomp QPELMComp16x16;
idctinter Inter8x8GMC;
} softidct;
extern void Copy420(softidct* p,int x,int y,int Forward);
extern void Process420(softidct* p,int x,int y);
extern void Process422(softidct* p,int x,int y);
extern void Process444(softidct* p,int x,int y);
extern void Copy420Half(softidct* p,int x,int y,int Forward);
extern void Process420Half(softidct* p,int x,int y);
extern void Process422Half(softidct* p,int x,int y);
extern void Process444Half(softidct* p,int x,int y);
extern void Process420Quarter(softidct* p,int x,int y);
extern void Process422Quarter(softidct* p,int x,int y);
extern void Process444Quarter(softidct* p,int x,int y);
extern void Copy420Swap(softidct* p,int x,int y,int Forward);
extern void Process420Swap(softidct* p,int x,int y);
extern void Process422Swap(softidct* p,int x,int y);
extern void Process444Swap(softidct* p,int x,int y);
extern void SoftMComp8x8(softidct* p,const int* MVBack,const int* MVFwd);
extern void SoftMComp16x16(softidct* p,const int* MVBack,const int* MVFwd);
extern void Intra8x8(softidct* p,idct_block_t* Data,int Length,int ScanType);
extern void Inter8x8Back(softidct* p,idct_block_t* Block,int Length);
extern void Inter8x8BackFwd(softidct* p,idct_block_t* Block,int Length);
extern void Inter8x8QPEL(softidct* p,idct_block_t* Data,int Length);
extern void Inter8x8GMC(softidct* p,idct_block_t* Data,int Length);
extern void Intra8x8Half(softidct* p,idct_block_t* Data,int Length,int ScanType);
extern void Inter8x8BackHalf(softidct* p,idct_block_t* Block,int Length);
extern void Inter8x8BackFwdHalf(softidct* p,idct_block_t* Block,int Length);
extern void Intra8x8Quarter(softidct* p,idct_block_t* Data,int Length,int ScanType);
extern void SoftMComp8x8Swap(softidct* p,const int* MVBack,const int* MVFwd);
extern void SoftMComp16x16Swap(softidct* p,const int* MVBack,const int* MVFwd);
extern void Intra8x8Swap(softidct* p,idct_block_t* Data,int Length,int ScanType);
extern void Inter8x8BackSwap(softidct* p,idct_block_t* Block,int Length);
extern void Inter8x8BackFwdSwap(softidct* p,idct_block_t* Block,int Length);
// !MIPS64 source stride = 8
// MIPS64 source stride = dest stride
extern void STDCALL IDCT_Block4x8(idct_block_t *Block, uint8_t *Dest, int DestStride, const uint8_t *Src);
extern void STDCALL IDCT_Block8x8(idct_block_t *Block, uint8_t *Dest, int DestStride, const uint8_t *Src);
extern void STDCALL IDCT_Const8x8(int v,uint8_t * Dst,int DstStride,uint8_t * Src);
extern void STDCALL IDCT_Block4x4(idct_block_t *Block, uint8_t *Dest, int DestStride, const uint8_t *Src);
extern void STDCALL IDCT_Block2x2(idct_block_t *Block, uint8_t *Dest, int DestStride, const uint8_t *Src);
extern void STDCALL IDCT_Block4x8Swap(idct_block_t *Block, uint8_t *Dest, int DestStride, const uint8_t *Src);
extern void STDCALL IDCT_Block8x8Swap(idct_block_t *Block, uint8_t *Dest, int DestStride, const uint8_t *Src);
extern void STDCALL IDCT_Const4x4(int v,uint8_t * Dst,int DstStride,uint8_t * Src);
extern void STDCALL CopyBlock(uint8_t * Src, uint8_t * Dst, int SrcPitch, int DstPitch);
extern void STDCALL CopyBlockHor(uint8_t * Src, uint8_t * Dst, int SrcPitch, int DstPitch);
extern void STDCALL CopyBlockVer(uint8_t * Src, uint8_t * Dst, int SrcPitch, int DstPitch);
extern void STDCALL CopyBlockHorVer(uint8_t * Src, uint8_t * Dst, int SrcPitch, int DstPitch);
extern void STDCALL CopyBlockHorRound(uint8_t * Src, uint8_t * Dst, int SrcPitch, int DstPitch);
extern void STDCALL CopyBlockVerRound(uint8_t * Src, uint8_t * Dst, int SrcPitch, int DstPitch);
extern void STDCALL CopyBlockHorVerRound(uint8_t * Src, uint8_t * Dst, int SrcPitch, int DstPitch);
extern void STDCALL CopyBlockM(uint8_t * Src, uint8_t * Dst, int SrcPitch, int DstPitch);
extern const addblock TableAddBlock4x4[16];
extern void STDCALL CopyBlock4x4_00(uint8_t * Src, uint8_t * Dst, int SrcPitch, int DstPitch);
extern void STDCALL CopyBlock4x4_01(uint8_t * Src, uint8_t * Dst, int SrcPitch, int DstPitch);
extern void STDCALL CopyBlock4x4_02(uint8_t * Src, uint8_t * Dst, int SrcPitch, int DstPitch);
extern void STDCALL CopyBlock4x4_03(uint8_t * Src, uint8_t * Dst, int SrcPitch, int DstPitch);
extern void STDCALL CopyBlock4x4_10(uint8_t * Src, uint8_t * Dst, int SrcPitch, int DstPitch);
extern void STDCALL CopyBlock4x4_11(uint8_t * Src, uint8_t * Dst, int SrcPitch, int DstPitch);
extern void STDCALL CopyBlock4x4_12(uint8_t * Src, uint8_t * Dst, int SrcPitch, int DstPitch);
extern void STDCALL CopyBlock4x4_13(uint8_t * Src, uint8_t * Dst, int SrcPitch, int DstPitch);
extern void STDCALL CopyBlock4x4_20(uint8_t * Src, uint8_t * Dst, int SrcPitch, int DstPitch);
extern void STDCALL CopyBlock4x4_21(uint8_t * Src, uint8_t * Dst, int SrcPitch, int DstPitch);
extern void STDCALL CopyBlock4x4_22(uint8_t * Src, uint8_t * Dst, int SrcPitch, int DstPitch);
extern void STDCALL CopyBlock4x4_23(uint8_t * Src, uint8_t * Dst, int SrcPitch, int DstPitch);
extern void STDCALL CopyBlock4x4_30(uint8_t * Src, uint8_t * Dst, int SrcPitch, int DstPitch);
extern void STDCALL CopyBlock4x4_31(uint8_t * Src, uint8_t * Dst, int SrcPitch, int DstPitch);
extern void STDCALL CopyBlock4x4_32(uint8_t * Src, uint8_t * Dst, int SrcPitch, int DstPitch);
extern void STDCALL CopyBlock4x4_33(uint8_t * Src, uint8_t * Dst, int SrcPitch, int DstPitch);
extern void STDCALL CopyBlock4x4_01R(uint8_t * Src, uint8_t * Dst, int SrcPitch, int DstPitch);
extern void STDCALL CopyBlock4x4_02R(uint8_t * Src, uint8_t * Dst, int SrcPitch, int DstPitch);
extern void STDCALL CopyBlock4x4_03R(uint8_t * Src, uint8_t * Dst, int SrcPitch, int DstPitch);
extern void STDCALL CopyBlock4x4_10R(uint8_t * Src, uint8_t * Dst, int SrcPitch, int DstPitch);
extern void STDCALL CopyBlock4x4_11R(uint8_t * Src, uint8_t * Dst, int SrcPitch, int DstPitch);
extern void STDCALL CopyBlock4x4_12R(uint8_t * Src, uint8_t * Dst, int SrcPitch, int DstPitch);
extern void STDCALL CopyBlock4x4_13R(uint8_t * Src, uint8_t * Dst, int SrcPitch, int DstPitch);
extern void STDCALL CopyBlock4x4_20R(uint8_t * Src, uint8_t * Dst, int SrcPitch, int DstPitch);
extern void STDCALL CopyBlock4x4_21R(uint8_t * Src, uint8_t * Dst, int SrcPitch, int DstPitch);
extern void STDCALL CopyBlock4x4_22R(uint8_t * Src, uint8_t * Dst, int SrcPitch, int DstPitch);
extern void STDCALL CopyBlock4x4_23R(uint8_t * Src, uint8_t * Dst, int SrcPitch, int DstPitch);
extern void STDCALL CopyBlock4x4_30R(uint8_t * Src, uint8_t * Dst, int SrcPitch, int DstPitch);
extern void STDCALL CopyBlock4x4_31R(uint8_t * Src, uint8_t * Dst, int SrcPitch, int DstPitch);
extern void STDCALL CopyBlock4x4_32R(uint8_t * Src, uint8_t * Dst, int SrcPitch, int DstPitch);
extern void STDCALL CopyBlock4x4_33R(uint8_t * Src, uint8_t * Dst, int SrcPitch, int DstPitch);
#ifdef MMX
#define CopyBlock8x8 CopyBlock
#define CopyBlock16x16 CopyBlockM
#endif
#ifndef MIPS64
#define SoftMComp16x16Swap SoftMComp8x8Swap
#define SoftMComp16x16 SoftMComp8x8
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -