osd.h

来自「代码有点长,需细心阅读,仅供影音视听类产品的开发人员参考」· C头文件 代码 · 共 172 行

H
172
字号
#ifndef __OSD_H
#define __OSD_H

//#define OSD_SPLIT
extern const char _OsdMessegeFont1[][2][18];

#if 0
typedef struct
{
    int     color_table_update:1;
    int     region_h_size:7;
    int     shade_level:4;
    int     reserved_0:1;
    int     high_color_mode:1;
    int     start_row:9;
    int     start_column:9;
    int     link_address:16;
    int     color_resolution:1;
    int     region_v_size:9;
    int     pixel_resolution:1;
    int     blend_level:4;
    int     force_transparency:1;
}
t_osd_header;

typedef struct
{
    unsigned Y:6 __attribute__ ((packed));
    unsigned Cb:4 __attribute__ ((packed));
    unsigned Cr:4 __attribute__ ((packed));
    unsigned blend_factor:2 __attribute__ ((packed));
}
t_osd_palette_entry;
#endif


#define OsdColor(Y,U,V,B)   ( (UINT16)(((BYTE)(Y)>>2)<<10) \
                | (UINT16)(((BYTE)(U)>>4)<<6) \
                | (UINT16)(((BYTE)(V)>>4)<<2) \
                | (UINT16)((BYTE)(B)&0x03) )


#ifdef OSD_SPLIT
#define __osd_header_hi(CLU,HSize,Shade,HighColor,Row,Column) \
    (   ((UINT32)((CLU)       & 0x0001) << 31)  \
      | ((UINT32)((HSize)     & 0x007f) << 24)  \
      | ((UINT32)((Shade)     & 0x000f) << 20)  \
      | ((UINT32)((HighColor) & 0x0001) << 18)  \
      | ((UINT32)(0x0001) << 19)    \
      | ((UINT32)((Row)       & 0x01ff) << 9)   \
      | ((UINT32)((Column)    & 0x01ff) << 0) )
#else
#define __osd_header_hi(CLU,HSize,Shade,HighColor,Row,Column) \
    (   ((UINT32)((CLU)       & 0x0001) << 31)  \
      | ((UINT32)((HSize)     & 0x007f) << 24)  \
      | ((UINT32)((Shade)     & 0x000f) << 20)  \
      | ((UINT32)((HighColor) & 0x0001) << 18)  \
      | ((UINT32)((Row)       & 0x01ff) << 9)   \
      | ((UINT32)((Column)    & 0x01ff) << 0) )
#endif

#define __osd_header_lo(Link,ColorRes,VSize,PixelRes,Blend) \
        (   ((UINT32)((Link)      & 0xffff) << 16)  \
          | ((UINT32)((ColorRes)  & 0x0001) << 15)  \
      | ((UINT32)((VSize)     & 0x01ff) << 6)   \
      | ((UINT32)((PixelRes)  & 0x0001) << 5)   \
      | ((UINT32)((Blend)     & 0x000f) << 1) )

#define OSD_CLUT_UPDATE 1
#define OSD_CLUT_REMAIN 0

/*
**  CLUT type
**          HIGH_COLOR  COLOR_RESOLUTION
**  4-color     0       1
**  16-color    0       0
**  256-color   1       0
**  reserved    1       1
**
*/
#define OSD_CLUT_4  1
#define OSD_CLUT_16 0
#define OSD_CLUT_256    2
#define OSD_CLUT_HIGH   3

#define osd_header_hi(CLU, HSize, VSize, Row, Column, PixelRes, ClutType, Shade, Blend, Link) \
    __osd_header_hi(CLU,HSize,Shade,(ClutType)>>1,Row,Column)

#define osd_header_lo(CLU, HSize, VSize, Row, Column, PixelRes, ClutType, Shade, Blend, Link) \
    __osd_header_lo(Link,(ClutType)&0x01,VSize,PixelRes,Blend)

#define LINK_NULL   (0xffff)

#define __palette(Y,Cb,Cr,BlendFactor) \
    (\
       (((UINT32)(Y)     & 0x3f)<<10)   \
     | (((UINT32)(Cb)    & 0x0f)<<6)    \
     | (((UINT32)(Cr)    & 0x0f)<<2)    \
         | (((UINT32)(BlendFactor) & 0x03)) \
)

/*
*(Blend,Fill)///jhuang
*(X,0):blending_level active
*(X,1):force to fill color,no blending
*/
#define __palette2(Y,Cb,Cr,Blend,Fill) \
    (\
       (((UINT32)(Y)     & 0x3f)<<10)   \
     | (((UINT32)(Cb)    & 0x0f)<<6)    \
     | (((UINT32)(Cr)    & 0x0f)<<2)    \
         | ((Blend) ? 0x02 : 0x00)      \
         | ((Fill)  ? 0x01 : 0x00)      \
)

#define __paletteF(Y,B,R,BlendFactor) \
    __palette((Y)>>2, (B)>>4, (R)>>4, (BlendFactor))

#define __palette2F(Y,B,R,Blend,Fill) \
    __palette2((Y)>>2, (B)>>4, (R)>>4, (Blend), (Fill))

/************Standard Color:NEW MAP************
**  COLOR   Y   Cb  Cr
**
**  WHITE   0xEB    0x80    0x80
**  YELLOW  0xD2    0x10    0x92
**  CYAN    0xAA    0xA6    0x10
**  GREEN   0x91    0x36    0x22
**  MAGENTA 0x6A    0xcA    0xDE
**  RED     0x51    0x5A    0x6E
**  BLUE    0x29    0xF0    0x6E
**  BLACK   0x10    0x80    0x80
**
*/
#define STD_BLACK   __palette2F(0x10, 0x80, 0x80,1,0)   //Std. BLACK:Normal Font,Background
#define STD_GREEN   __palette2F(0x91, 0x36, 0x22,1,1)   //Std. GREEN:Hilight Font,Foreground
#define STD_MAGENTA __palette2F(0x6A, 0xCA, 0xDE,1,0)   //Std. MAGENTA:Menu Page Title Background
#define STD_WHITE   __palette2F(0xEB, 0x80, 0x80,1,1)   //Std. WHITE:Normal Font,Foreground


#define MOD_GREEN   __palette2F(0x70, 0x3a, 0x48, 1, 1) //Mod. GREEN
#define MOD_BLACK   __palette2F(0x10, 0x80, 0x80,1,1)   //Mod. BLACK
/************OLD MAP************
**  COLOR   Y   Cr  Cb
**
**  WHITE   0xEB    0x80    0x80
**  CYAN    0xa2    0x8e    0x2c
**  YELLOW  0x83    0x2c    0x9c
**  GREEN   0x70    0x3a    0x48
**  MAGENTA 0x54    0xc6    0xb8
**  BLUE        0x41    0xd4    0x64
**  RED     0x23    0x72    0xd4
**  BLACK   0x10    0x80    0x80
**
*/
enum
{
    REGION0 = 0,
    REGION1,                                            //1
    REGION2,                                            //2
    REGION3,                                            //3
    REGION4,
    REGION5,
    REGION6,
    REGION7,
};

enum
{
    STR_OS_NULL = 0,                            //NULL
    STR_OS_NODISC,                              //1        //礚盒
    STR_OS_NO,                                      //2        //眤

⌨️ 快捷键说明

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