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

📄 jpegdec.h

📁 ct952 source code use for Digital Frame Photo
💻 H
📖 第 1 页 / 共 2 页
字号:
//tommy1.50: adjust for modifications on CT909S' JPU HEIWID_SRC and HEIWID_DST registers#define TRANS_HEIWID_REG(width,height)      (((width) << 16) | (height))// calculate value for JPU's stripe register//tommy1.50: adjust for modifications on CT909S' JPU STRIPE_RW register#define GET_STRIPE(src)                     (((src) + 15) >> 4)#define GET_STRIPE_UV(src)                  (((src) +  7) >> 3)#define TRANS_STRIPE_REG(src,dst)           ((GET_STRIPE(src)    << 16) | (GET_STRIPE(dst)))#define TRANS_STRIPE_REG_UV(src,dst)        ((GET_STRIPE_UV(src) << 16) | (GET_STRIPE_UV(dst)))// calculate starting address of write data for flip & rotate operation (of YUV420)// translation expression is from D400/Raiden.// block address * 8 = byte address////tommy1.50: adjust for modifications on CT909S' JPU STRIPE definition//tommy2.03: update FR_OFFSET expressions (for SAMPLE420 format only)#define TRANS_FR_OFFSET_Y(width,x,y)        (((((y) >> 4) * (GET_STRIPE(width) << 6)) + ((y) % 16) + (((x) >> 2) << 4)) << 2)//version1: use Y's width & height (use real width)#define TRANS_FR_OFFSET_UV(width,x,y)       ((((((y) >> 1) >> 4) * (GET_STRIPE_UV(width >> 1) << 6)) + (((y) >> 1) % 16) + ((((x) >> 1) >> 3) << 6) + (((((x) >> 1) % 8) >> 2) << 4)) << 2)//version2: use UV's actual width & height (but use real width)#define TRANS_FR_OFFSET_UV2(width,x,y)      (((((y) >> 4) * (GET_STRIPE_UV(width >> 1) << 6)) + ((y) % 16) + (((x) >> 3) << 6) + ((((x) % 8) >> 2) << 4)) << 2) //#ifdef CT909P_IC_SYSTEM#if defined(CT909P_IC_SYSTEM ) || defined(CT909G_IC_SYSTEM)#define GET_SCALE_FACTOR(src,dst,uv)            (((((src)) - ((src) < (dst))) << 13) / (((dst)) - ((src) < (dst))))//senshong:Because 909p jpu has one bug that can cause jpu infinite operate//So we calculate horizontal step that must use ((src -1)<<13)/(dst -1) formula#define GET_SCALE_FACTOR2(src,dst)              ((((src) - 1) << 13) / ((dst) - 1))#define TRANS_HVSC_REG(srcW,srcH,dstW,dstH,uv)  ((GET_SCALE_FACTOR(srcH,dstH,uv) << 16) | (GET_SCALE_FACTOR2(srcW,dstW)))#else// calculate a 32-bit word of veritical & horizontal steps for JPU's HVSC factor register.////#define GET_SCALE_FACTOR(src,dst,uv)            (((((src) / ((uv) + 1)) - ((src) < (dst))) << 13) / (((dst) / ((uv) + 1)) - ((src) < (dst))))#define GET_SCALE_FACTOR(src,dst,uv)            (((((src)) - ((src) < (dst))) << 13) / (((dst)) - ((src) < (dst))))#define TRANS_HVSC_REG(srcW,srcH,dstW,dstH,uv)  ((GET_SCALE_FACTOR(srcH,dstH,uv) << 16) | (GET_SCALE_FACTOR(srcW,dstW,uv)))//senshong2.51:909P has be fixed for jpu scale down defect//#ifndef CT909P_IC_SYSTEM//tommy2.11: fix for JPU scale down defect#ifdef PATCH_CT909S_JPU_SCALE_DOWN    #define GET_SCALE_FACTOR2(src,dst)              ((((src) - 1) << 13) / ((dst) - 1))    //#define GET_SCALE_FACTOR2(src,dst,uv)              (((((src) /((uv)+1)) - 1) << 13) / (((dst) / ((uv) + 1)) - 1))    //tommy2.11: patch for horizontal only    #define TRANS_HVSC_REG2(srcW,srcH,dstW,dstH,uv) ((GET_SCALE_FACTOR(srcH,dstH,uv) << 16) | (GET_SCALE_FACTOR2(srcW,dstW)))    #define FIX_JPU_SCALE_DEFECT(srcW,srcH,dstW,dstH,uv)    if ((srcW) > (dstW))                                                                    \                                                            {                                                                                       \                                                                DWORD check_value = (((srcW) << 13) / (dstW)) * ((dstW) - 1);                       \                                                                if ((0x6000 == (check_value & 0x6000)) && (0 != (check_value & 0x1fff)))            \                                                                {                                                                                   \                                                                    REG_JPU_HVSC_FACTOR = TRANS_HVSC_REG2(srcW, srcH, dstW, dstH, uv);              \                                                                }                                                                                   \                                                            }    #define FIX_JPU_SCALE_DEFFECT_H_STEP(srcW,dstW,HStep)			if ((srcW) > (dstW))                                                            \                                                            {                                                                                       \                                                                DWORD check_value = (((srcW) << 13) / (dstW)) * ((dstW) - 1);                       \                                                                if ((0x6000 == (check_value & 0x6000)) && (0 != (check_value & 0x1fff)))            \                                                                {                                                                                   \                                                                    HStep = GET_SCALE_FACTOR2(srcW,dstW);											\                                                                }                                                                                   \                                                            }//tommy2.16: error message removed. DBG_Printf(DBG_THREAD_DECODER, DBG_INFO_PRINTF, "PATCH: H part of HVSC_FACTOR.");#else   //PATCH_CT909S_JPU_SCALE_DOWN    //#define FIX_JPU_SCALE_DEFECT(srcW,srcH,dstW,dstH,uv)        #define FIX_JPU_SCALE_DEFECT(srcW,srcH,dstW,dstH)    #endif  //PATCH_CT909S_JPU_SCALE_DOWN#endif//#ifdef CT909P_IC_SYSTEM//tommy1.50: support CT909S#define MACRO_RESET_JPU()       REG_PLAT_RESET_CONTROL_ENABLE  = PLAT_RESET_VPU_ENABLE;     \                                REG_PLAT_RESET_CONTROL_DISABLE = PLAT_RESET_VPU_DISABLE;// --------------------// local declarations// --------------------// sampling types//#define SAMPLE420			0#define SAMPLE440			1#define SAMPLE422			2#define SAMPLE444			3#define SAMPLE400			4// flip & rotate types//#define FR_ORIGINAL			0#define FR_R90				1#define FR_R180				2#define FR_R270				3#define FR_FH				4#define FR_FH_R90			5#define FR_FH_R180			6#define FR_FH_R270			7// block parts//#define BLOCK_Y				0#define BLOCK_UV			1#define BLOCK_ALL			2// parse type#define  JPEG_PARSE_TYPE_NORMAL		0#define  JPEG_PARSE_TYPE_THUMBNAIL	1#define  JPEG_PARSE_TYPE_THUMB_ENCODE      2#define  JPEG_PARSE_TYPE_THUMB_BACKGROUND 3#define	 JPEG_SLIDESHOW_ENCODE_NONE	0#define	 JPEG_SLIDESHOW_ENCODE	1// local function prototypes//// JPEG Decoder entrance for eCos threadVOID JPEG_ThreadMain(DWORD data);VOID JPEG_ThreadExit(WORD data);VOID JPEG_ThreadInit(VOID);// JPU PARTVOID _JPEGDEC_InitJPU(VOID);WORD _JPEGDEC_RunJPU(VOID);DWORD _JPEGDEC_GetBlockSize(WORD width, WORD height, WORD uv);DWORD _JPEGDEC_GetDispFrameOffset(WORD x, WORD y, WORD uv);DWORD _JPEGDEC_GetNormFrameOffset(WORD width, WORD x, WORD y, WORD uv);VOID _JPEGDEC_ClearBuffBeforeOperate(WORD wMatchingRule, WORD bFrameBuffer);// JPEG Decoder wrapperWORD _JPEGDEC_Decode(PJPEGDECODE pDecode);WORD _JPEGDEC_Operate(PJPEGSCALING pScaling);WORD _JPEGDEC_PresetFrameBuf(WORD wBuffer, URECT *pRect, DWORD dwColor);//tommy2.15: dedicated structure for JPUUTIL API and 16M solutiontypedef struct tagJPU_OPZONE{    WORD    wPosCoordH;    WORD    wPosCoordV;    WORD    wWidth;    WORD    wHeight;    WORD    wFrameStripe;} JPU_OPZONE, *PJPU_OPZONE;typedef struct tagJPEG_ENCODE_INFO{    DWORD dwPicAddrY;    DWORD dwPicAddrUV;    DWORD dwPoolAddrSt;    DWORD dwPoolLength;    WORD wPicWidth;    WORD wPicHeight;    WORD wPicCoordH;    WORD wPicCoordV;    WORD wPicStrip;    WORD wExifWidth;    WORD wExifHeight;    CHAR cExifDate[11];}JPEG_ENCODE_INFO, *PJPEG_ENCODE_INFO;WORD _JPUUTIL_FillColor(DWORD dwDestAddress, PJPU_OPZONE pDestination, DWORD wFillColor, WORD wFillOp, WORD wYuvType);//WORD _JPUUTIL_ScaleAndFlipRotate(DWORD dwSrcAddress, DWORD dwDestAddress, WORD wFrType, PJPU_OPZONE pSource, PJPU_OPZONE pDestination, WORD wYuvType);DWORD _JPUUTIL_GetDispFrameOffset_SCFR(PJPU_OPZONE pzone, WORD type_yuv, WORD type_fr);WORD _JPUUTIL_Scale(DWORD dwSrcAddress, DWORD dwDestAddress, PJPU_OPZONE pSource, PJPU_OPZONE pDestination, WORD wYuvType);WORD _JPUUTIL_FlipRotate(DWORD dwSrcAddress, DWORD dwDestAddress, DWORD dwtagaddress, WORD wFrType, PJPU_OPZONE pSource, PJPU_OPZONE pDestination, WORD wYuvType);VOID JPEGDEC_EffectConfigure(BYTE wEffectConfigure);VOID JPEGDEC_CopyPictureToDisplayBuffer(BYTE bBufferSet);BYTE JPEGDEC_TransformOperation(BYTE bPreviousResult, WORD bCurrentOperation);WORD _JPUUTIL_FlipRotateAndCopyPic(DWORD dwSrcAddress, DWORD dwDestAddress, WORD wFrType, PJPU_OPZONE pSource, PJPU_OPZONE pDestination);VOID JPEG_DisplayFullScreen(WORD wIsFullScreen);//VOID JPEGDEC_ReportYUVAddr(PDWORD dwYAddr, PDWORD dwUVAddr,PWORD wPicWidth, PWORD wPicHeight, PDWORD dwPool, PDWORD dwPoolLength);VOID JPEGDEC_ReportEncodedInfo(PJPEG_ENCODE_INFO pEncodedInfo);VOID JPEGDEC_ConfigProcessor(WORD wConfigProcessor);DWORD JPEGDEC_QueryEmptyBuffer(VOID);VOID JPEGDEC_SlideShowEncodeMode(WORD wSlideShowEncode);VOID JPEGDEC_SrcPicOffset(WORD wOffsetH, WORD wOffsetV);VOID JPEGDEC_QuerySrcPicSize(PWORD pwSrcPicWidth,PWORD pwSrcPicHeight);#ifdef SUPPORT_MOTION_JPEGVOID JPEGDEC_MjpegFrameBufferConfigure(DWORD dwFramebufferStart, DWORD dwFramebufferEnd,WORD wDecoderMode);DWORD _JPEGDEC_CheckPlayCommand(DWORD dwType);VOID JPEGDEC_UpdatePictureInfo(VOID);#endifVOID JPEGDEC_ColorTransform(DWORD dwFrameAddrY,DWORD dwFrameAddrUV,PJPU_OPZONE pDest_zone);VOID JPEGDEC_EnableColorTransform(WORD wEnableTransform);DWORD JPUUTIL_FillBlock(WORD wDispIndex,WORD wCoordH,WORD wCoordV,WORD wPicWidth, WORD wPicHeight ,WORD wBlockType);DWORD JPUUTIL_FillBlockColor(WORD wDispIndex,WORD wCoordH,WORD wCoordV,WORD wPicWidth, WORD wPicHeight,DWORD dwFillColor);//#define _JPUUTIL_COORD_TO_BYTEOFFSET_Y(coord_x, coord_y)    (((((coord_y) >> 4) * 180) + ((coord_x) >> 2)) << 6) + (((coord_y) % 16) << 2)//#define _JPUUTIL_COORD_TO_BYTEOFFSET_UV(coord_x, coord_y)   (((((coord_y) >> 5) * 180) + (((coord_x) >> 4) << 2) + ((((coord_x) >> 1) % 8) >> 2)) << 6) + ((((coord_y) >> 1) % 16) << 2)#define _JPUUTIL_COORD_TO_BYTEOFFSET_Y(coord_x, coord_y, disp_width)    (((((coord_y) >> 4) * (((disp_width) >> 3) << 1)) + ((coord_x) >> 2)) << 6) + (((coord_y) % 16) << 2)#define _JPUUTIL_COORD_TO_BYTEOFFSET_UV(coord_x, coord_y, disp_width)   (((((coord_y) >> 5) * (((disp_width) >> 3) << 1)) + (((coord_x) >> 4) << 2) + ((((coord_x) >> 1) % 8) >> 2)) << 6) + ((((coord_y) >> 1) % 16) << 2)#ifdef __cplusplus}#endif //__cplusplus#endif //__JPEG_DECODER_H__// END OF FILE (jpegdec.h)

⌨️ 快捷键说明

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