亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? mb93493video.c

?? mini gui 1.6.8 lib and source
?? C
字號(hào):
/***  $Id: mb93493video.c,v 1.6 2005/04/22 03:33:36 weiym Exp $**  **  Copyright (C) 2004 Feynman Software.*//*** 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*/#include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <sys/types.h>#include <sys/file.h>#include <sys/stat.h>#include <fcntl.h>#include <signal.h>#include <sched.h>#include "common.h"#include "minigui.h"#include "newgal.h"#include "sysvideo.h"#include "pixels_c.h"#include "vdc_init.h"#include "mb93493video.h"#define MB93493VID_DRIVER_NAME    "mb93493"#define VRAM_W                  720     /* width */#define VRAM_H                  576     /* high  */#define VRAM_PIXEL_LEN          2       /* color mode = 16bit/pix */#define LCD_BACKGROUND_COLOR    0x80    /* LCD background color */#define SHOWBUF_LEN             300*1024/* show buffur length */#define VRAM_LEN                (VRAM_W*VRAM_H*VRAM_PIXEL_LEN)#define VRAM_PAGELEN            (VRAM_LEN/2)#define RGB_RMASK               0x7c00#define RGB_GMASK               0x03e0#define RGB_BMASK               0x001f#define RGB_BPP                 16#define RGB_PIXEL_LEN           2unsigned char   *VRAM_addr;     /* point to display memory of VDC */static unsigned char *y_table = NULL;static unsigned char *u_table = NULL;static unsigned char *v_table = NULL;typedef struct _YUV_Package{    unsigned char y0;    unsigned char u;    unsigned char y1;    unsigned char v;} YUV_Package;static inline int _rgb2yuv_y(int r, int g, int b){    return (unsigned char)(( 299*r + 587*g + 114*b)/1000);}// [0, 0x100) => [-436, 436] => [0, 873) => [0, 0x100)static inline int _rgb2yuv_u(int r, int g, int b){    return (unsigned char)((-147*r - 289*g + 436*b + 436*0x100)/873);}// [0, 0x100) => [-615, 615] => [0, 1231) => [0, 0x100)static inline int _rgb2yuv_v(int r, int g, int b){    return (unsigned char)(( 615*r - 515*g - 100*b + 615*0x100)/1231);}static void init_yuv_table(void){    unsigned int i;    int r, g, b;    if(y_table != NULL)        return;    y_table = calloc(1, 2<<15);    if(y_table == NULL)        goto error_free;    u_table = calloc(1, 2<<15);    if(u_table == NULL)        goto error_free;    v_table = calloc(1, 2<<15);    if(v_table == NULL)        goto error_free;    for(i=0; i<(2<<15); i++)    {        r = (i & RGB_RMASK) >> 7;        g = (i & RGB_GMASK) >> 2;        b = (i & RGB_BMASK) << 3;        y_table[i] = _rgb2yuv_y(r, g, b);        u_table[i] = _rgb2yuv_u(r, g, b);        v_table[i] = _rgb2yuv_v(r, g, b);    }    return;error_free:    if(y_table)        free(y_table);    y_table = NULL;    if(u_table)        free(u_table);    u_table = NULL;    if(v_table)        free(v_table);    v_table = NULL;    return;}static inline int rgb2yuv_y(Uint16 rgb){    return y_table[rgb];}static inline int rgb2yuv_u(Uint16 rgb){    return u_table[rgb];}static inline int rgb2yuv_v(Uint16 rgb){    return v_table[rgb];}static BOOL is_suspend;#if 0static sigset_t oldmask;#define BLOCK_ALARM                    \do {                            \    sigset_t newmask;            \    sigemptyset (&newmask);            \    sigaddset (&newmask, SIGALRM);            \    sigprocmask (SIG_BLOCK, &newmask, &oldmask);    \} while (0);#define UNBLOCK_ALARM                    \    sigprocmask (SIG_SETMASK, &oldmask, NULL);#else#define BLOCK_ALARM#define UNBLOCK_ALARM#endif/* Initialization/Query functions */static int MB93493_VideoInit(_THIS, GAL_PixelFormat *vformat);static GAL_Rect **MB93493_ListModes(_THIS, GAL_PixelFormat *format, Uint32 flags);static GAL_Surface *MB93493_SetVideoMode(_THIS, GAL_Surface *current, int width, int height, int bpp, Uint32 flags);static int MB93493_SetColors(_THIS, int firstcolor, int ncolors, GAL_Color *colors);static void MB93493_UpdateRects (_THIS, int numrects, GAL_Rect *rects);static void MB93493_VideoQuit(_THIS);/* Hardware surface functions */static int MB93493_AllocHWSurface(_THIS, GAL_Surface *surface);static void MB93493_FreeHWSurface(_THIS, GAL_Surface *surface);static void* task_do_update (void* data);/* MB93493 driver bootstrap functions */static int MB93493_Available(void){    return (1);}static void MB93493_DeleteDevice(GAL_VideoDevice *device){    pthread_mutex_destroy (&device->hidden->lock);    free(device->hidden);    free(device);}static GAL_VideoDevice *MB93493_CreateDevice(int devindex){    GAL_VideoDevice *device;    if(y_table == NULL)        init_yuv_table();    if(y_table == NULL)    {        GAL_OutOfMemory();        return 0;    }    /* Initialize all variables that we clean on shutdown */    device = (GAL_VideoDevice *)calloc(1, sizeof(GAL_VideoDevice));    if (device == NULL)    {        GAL_OutOfMemory();        return 0;    }    device->hidden = (struct GAL_PrivateVideoData *)calloc(1, (sizeof *device->hidden));    if(device->hidden == NULL)    {        GAL_OutOfMemory();        free(device);        return 0;    }    pthread_mutex_init (&device->hidden->lock, NULL);    /* Set the function pointers */    device->VideoInit = MB93493_VideoInit;    device->ListModes = MB93493_ListModes;    device->SetVideoMode = MB93493_SetVideoMode;    device->CreateYUVOverlay = NULL;    device->SetColors = MB93493_SetColors;    device->VideoQuit = MB93493_VideoQuit;#ifdef _LITE_VERSION    device->RequestHWSurface = NULL;#endif    device->AllocHWSurface = MB93493_AllocHWSurface;    device->CheckHWBlit = NULL;    device->FillHWRect = NULL;    device->SetHWColorKey = NULL;    device->SetHWAlpha = NULL;    device->FreeHWSurface = MB93493_FreeHWSurface;    device->UpdateRects = MB93493_UpdateRects;    device->free = MB93493_DeleteDevice;    return device;}VideoBootStrap MB93493_bootstrap = {    MB93493VID_DRIVER_NAME, "MB93493 YUV framebuffer driver",    MB93493_Available, MB93493_CreateDevice};static int MB93493_VideoInit(_THIS, GAL_PixelFormat *vformat){    fprintf(stderr, "WARNING: You are using the mb93493 video driver!\n");    VRAM_addr = NULL;    if (open_vdc_device(MODE_PAL) != 0) {        fprintf(stderr, "MB93493 NEWGAL Engine: can not open vdc device!\n");        this->hidden->buffer = NULL;        this->hidden->is_opened = FALSE;        return -1;    }    this->hidden->is_opened = TRUE;    is_suspend = FALSE;    this->hidden->dirty = FALSE;    SetRect (&this->hidden->update, 0, 0, 0, 0);    /* Determine the screen depth (use default 8-bit depth) */    /* we change this during the GAL_SetVideoMode implementation... */    vformat->BitsPerPixel = RGB_BPP;    vformat->BytesPerPixel = RGB_PIXEL_LEN;    /* We're done! */    return(0);}static GAL_Rect standard_mode = {0, 0, VRAM_W, VRAM_H};static GAL_Rect mini_mode = {0, 0, VRAM_W/2, VRAM_H/2};static GAL_Rect* modes []  = {    &standard_mode,    &mini_mode,    NULL};static GAL_Rect **MB93493_ListModes(_THIS, GAL_PixelFormat *format, Uint32 flags){    if (format->BitsPerPixel == 16)        return modes;    return NULL;}static GAL_Surface *MB93493_SetVideoMode(_THIS, GAL_Surface *current,                int width, int height, int bpp, Uint32 flags){    int ret;    if ( this->hidden->buffer )        free( this->hidden->buffer );    this->hidden->buffer = NULL;    this->hidden->buffer = calloc (1, width * height * (bpp / 8));    if ( this->hidden->buffer == NULL )        goto error_free;    /* Allocate the new pixel format for the screen */    if ( ! GAL_ReallocFormat (current, bpp, RGB_RMASK, RGB_GMASK, RGB_BMASK, 0) )        goto error_free;    /* Set up the new mode framebuffer */    current->flags = flags & GAL_FULLSCREEN;    this->hidden->w = current->w = width;    this->hidden->h = current->h = height;    current->pitch = current->w * (bpp / 8);    current->pixels = this->hidden->buffer;    if(width == VRAM_W/2)        this->hidden->mode = 1;    ret = pthread_create (&this->hidden->th, NULL, task_do_update, this);    if(ret!=0)        goto error_free;    /* We're done */    return (current);error_free:    fprintf (stderr, "MB93493 NEWGAL Engine: Couldn't init.\n");    if(this->hidden->buffer)        free(this->hidden->buffer);    this->hidden->buffer = 0;    return NULL;}/* We don't actually allow hardware surfaces other than the main one */static int MB93493_AllocHWSurface(_THIS, GAL_Surface *surface){    return (-1);}static void MB93493_FreeHWSurface(_THIS, GAL_Surface *surface){    surface->pixels = NULL;}static int MB93493_SetColors(_THIS, int firstcolor, int ncolors, GAL_Color *colors){    return (1);}static inline void round_rect_to_even (RECT* rc){    if (rc->left % 2) rc->left --;    if (rc->right % 2) rc->right ++;}static inline void update_rgb_to_yuv_packet(Uint16* rgbbuf, YUV_Package* yuv){    yuv->y0 = (unsigned char) rgb2yuv_y(*rgbbuf);    yuv->y1 = (unsigned char) rgb2yuv_y(*(rgbbuf+1));    yuv->u  = (unsigned char) ((rgb2yuv_u(*rgbbuf) + rgb2yuv_u(*(rgbbuf+1)))>>1);    yuv->v  = (unsigned char) ((rgb2yuv_v(*rgbbuf) + rgb2yuv_v(*(rgbbuf+1)))>>1);}static inline void update_rgb_to_yuv_packet_minimode(Uint16* rgbbuf, YUV_Package* yuv){    yuv->y0 = (unsigned char) rgb2yuv_y(*rgbbuf);    yuv->u  = (unsigned char) rgb2yuv_u(*rgbbuf);    yuv->v  = (unsigned char) rgb2yuv_v(*rgbbuf);    yuv->y1 = yuv->y0;}static inline void update_rect_to_yuv_buffer_page(_THIS, RECT* rect, int idx, int mode_alter){    YUV_Package *yuv;    unsigned char* yuvrow;    unsigned char* rgbrow;    int row, col;    int rgb_row_len, yuv_row_len;    int row_alter = (mode_alter == 2)?1:2;    idx %= 2;    rgb_row_len = this->hidden->w*RGB_PIXEL_LEN;    yuv_row_len = VRAM_W*VRAM_PIXEL_LEN;    row = rect->top;    if(mode_alter == 2)    {        if(idx && !(row%2)) row++;        if(!idx && row%2) row++;    }    rgbrow = this->hidden->buffer + rgb_row_len*row;    yuvrow = VRAM_addr + idx*VRAM_PAGELEN + yuv_row_len*row;    if(VRAM_addr == NULL || this->hidden->buffer == NULL)        return;    for(; row<rect->bottom; row+=mode_alter)    {        yuv = (YUV_Package*)(yuvrow + rect->left*VRAM_PIXEL_LEN*row_alter);        for(col=rect->left; col < rect->right; col+=mode_alter)        {            if(mode_alter == 2)                update_rgb_to_yuv_packet((Uint16*)(rgbrow+RGB_PIXEL_LEN*col), yuv);            else                update_rgb_to_yuv_packet_minimode((Uint16*)(rgbrow+RGB_PIXEL_LEN*col), yuv);            //memset(yuv, 0x80, sizeof(YUV_Package));            yuv++;        }        rgbrow += rgb_row_len*mode_alter;        yuvrow += yuv_row_len;    }    vdc_set_data(idx);}static inline void update_rect_to_yuv_buffer(_THIS, RECT* rect){    int mode_alter = 1;    if(this->hidden->mode == 0)        mode_alter = 2;    update_rect_to_yuv_buffer_page(this, rect, 0, mode_alter);    update_rect_to_yuv_buffer_page(this, rect, 1, mode_alter);}static void* task_do_update (void* data){    _THIS;    this = data;    while (this->hidden->buffer && VRAM_addr) {        usleep (10000);    // 10 ms        if (is_suspend)            continue;        if (this->hidden->dirty) {            RECT bound;            pthread_mutex_lock (&this->hidden->lock);            bound = this->hidden->update;            SetRect (&this->hidden->update, 0, 0, 0, 0);            this->hidden->dirty = FALSE;            round_rect_to_even (&bound);            BLOCK_ALARM            update_rect_to_yuv_buffer(this, &bound);            UNBLOCK_ALARM            pthread_mutex_unlock (&this->hidden->lock);        }        else            vdc_set_data(0);    }    return 0;}static void MB93493_UpdateRects (_THIS, int numrects, GAL_Rect *rects){    int i;    RECT bound;    pthread_mutex_lock (&this->hidden->lock);    bound = this->hidden->update;    for (i = 0; i < numrects; i++) {        RECT rc;        SetRect (&rc, rects[i].x, rects[i].y,                         rects[i].x + rects[i].w, rects[i].y + rects[i].h);        if (IsRectEmpty (&bound))            bound = rc;        else            GetBoundRect (&bound, &bound, &rc);    }    if (!IsRectEmpty (&bound)) {        if (IntersectRect (&bound, &bound, &g_rcScr)) {            this->hidden->update = bound;            this->hidden->dirty = TRUE;        }    }    pthread_mutex_unlock (&this->hidden->lock);}static void MB93493_VideoQuit(_THIS){    if (this->hidden->is_opened) {        //close_vdc_device();        VRAM_addr = NULL;        if(this->hidden->buffer)            free(this->hidden->buffer);        this->hidden->buffer = NULL;        this->hidden->is_opened = FALSE;        //pthread_join(this->hidden->th, NULL);    }    if (this->screen->pixels != NULL)    {        free(this->screen->pixels);        this->screen->pixels = NULL;    }}int mb93493_suspend_spi (void){    if (is_suspend)        return -1;    BLOCK_ALARM    is_suspend = TRUE;    return 0;}void mb93493_resume_spi (void){    if (!is_suspend)        return;    is_suspend = FALSE;    UNBLOCK_ALARM    MB93493_UpdateRects (current_video, 1, &standard_mode);}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一级女性全黄久久生活片免费| 精品国产乱码91久久久久久网站| 国产东北露脸精品视频| 蜜臀av一级做a爰片久久| 午夜精品福利久久久| 爽好多水快深点欧美视频| 一区二区三区四区乱视频| 亚洲欧美aⅴ...| 夜夜嗨av一区二区三区中文字幕| 一区二区三区四区激情| 无吗不卡中文字幕| 麻豆91精品91久久久的内涵| 麻豆精品一区二区av白丝在线| 国产成人免费av在线| 岛国一区二区三区| 91蜜桃视频在线| 欧美日韩免费一区二区三区 | 国产一区二区三区av电影| 国内一区二区在线| 成人黄色在线网站| 欧美丝袜自拍制服另类| 日韩免费性生活视频播放| 国产欧美日韩另类一区| 亚洲另类色综合网站| 日韩av一区二区三区| 国内精品第一页| 色婷婷亚洲综合| 欧美一区二区三区不卡| 久久青草欧美一区二区三区| 国产精品乱子久久久久| 同产精品九九九| 国产高清在线精品| 欧美日韩一区二区三区免费看| 精品国内二区三区| 亚洲精品乱码久久久久久| 久久99在线观看| 色综合网站在线| 欧美成人综合网站| 亚洲欧美日韩国产综合| 国内精品伊人久久久久av影院 | 亚洲人成在线播放网站岛国| 日本不卡一区二区三区高清视频| 成人av网址在线观看| 在线综合视频播放| 亚洲免费视频中文字幕| 韩国中文字幕2020精品| 欧美日韩国产电影| 国产精品你懂的在线| 美女视频一区二区| 欧美性一级生活| 中文字幕一区二区三区在线观看| 久久精品国产99久久6| 91黄色激情网站| 国产精品麻豆欧美日韩ww| 久久福利视频一区二区| 欧美日韩中文国产| 亚洲精品成人a在线观看| 成人精品一区二区三区中文字幕| 欧美一区二区视频免费观看| 亚洲成人自拍一区| 91国产精品成人| 亚洲少妇屁股交4| 成人午夜视频在线观看| 欧美成人a∨高清免费观看| 午夜欧美视频在线观看| 在线国产亚洲欧美| 夜夜嗨av一区二区三区网页| 96av麻豆蜜桃一区二区| 1024成人网| 色综合久久久久网| 一区二区三区不卡在线观看| 91小视频免费看| 亚洲欧美一区二区三区孕妇| gogo大胆日本视频一区| 亚洲制服丝袜一区| 在线观看日韩电影| 亚洲一二三级电影| 欧美乱熟臀69xxxxxx| 日本亚洲免费观看| 日韩女优av电影| 国产乱码精品一区二区三 | 久久精品国产成人一区二区三区| 欧美精品在线一区二区三区| 日日骚欧美日韩| 欧美一区二区三区视频在线观看| 日本不卡的三区四区五区| 日韩一区二区影院| 国内久久精品视频| 中文字幕制服丝袜成人av| 91美女片黄在线| 亚洲成a天堂v人片| 精品久久一区二区三区| 国产福利一区二区| 国产精品国产三级国产普通话三级 | 56国语精品自产拍在线观看| 日本在线不卡一区| 中文字幕不卡在线播放| 欧美色综合久久| 极品少妇xxxx精品少妇| 一区在线观看免费| 4hu四虎永久在线影院成人| 国产一区二区美女| 一区二区三区在线播放| 欧美草草影院在线视频| www.爱久久.com| 日一区二区三区| 中文字幕在线播放不卡一区| 欧美精选一区二区| 丁香天五香天堂综合| 亚洲成人一区二区| 国产日韩欧美不卡| 欧美乱妇20p| 不卡免费追剧大全电视剧网站| 亚洲一二三专区| 国产欧美日韩综合精品一区二区| 色综合激情久久| 国产传媒欧美日韩成人| 丝袜美腿亚洲一区二区图片| 国产精品你懂的在线欣赏| 日韩美女一区二区三区四区| 色94色欧美sute亚洲线路一久| 麻豆视频观看网址久久| 亚洲国产一区二区视频| 国产精品免费免费| 欧美大肚乱孕交hd孕妇| 欧美在线免费观看视频| 99国产精品久久久久久久久久久| 精品一区二区在线视频| 亚洲成人第一页| 一区二区日韩电影| 国产精品久久久久久久久搜平片 | 蜜桃av一区二区三区| 亚洲最色的网站| 国产精品久久久爽爽爽麻豆色哟哟| 欧美一区二区三区视频免费播放| 99精品视频一区| 国产.欧美.日韩| 国产精一品亚洲二区在线视频| 蜜臀久久99精品久久久久宅男| 亚洲一区二区三区四区的| 亚洲人妖av一区二区| 国产精品免费看片| 国产精品欧美一区二区三区| 国产欧美一区二区精品婷婷| 亚洲精品一区二区在线观看| 日韩欧美三级在线| 日韩精品一区二区三区中文不卡 | 91视视频在线观看入口直接观看www| 国产激情精品久久久第一区二区| 久久99久久99精品免视看婷婷| 免费观看在线综合| 激情另类小说区图片区视频区| 麻豆国产欧美一区二区三区| 日韩和的一区二区| 捆绑紧缚一区二区三区视频| 久久99国产精品久久99| 国产精品88av| av福利精品导航| 欧美一区二区成人6969| 欧美精品vⅰdeose4hd| 日韩一区二区三区视频在线| 日韩欧美一卡二卡| 国产欧美日韩另类一区| 亚洲色图视频免费播放| 亚洲.国产.中文慕字在线| 日韩高清在线不卡| 国产一区二区三区黄视频 | 精品动漫一区二区三区在线观看| 精品国产91九色蝌蚪| 国产精品天干天干在观线| 国产精品盗摄一区二区三区| 亚洲精品国产第一综合99久久| 五月天亚洲精品| 国产一本一道久久香蕉| 91麻豆精品秘密| 欧美日韩视频专区在线播放| 欧美www视频| 1024成人网| 日本少妇一区二区| 成人国产精品免费观看动漫 | 国内一区二区在线| jlzzjlzz亚洲日本少妇| 欧美精品一二三| 国产欧美一区二区精品性色超碰| 亚洲精品国产a| 久久99国产精品久久99| 色综合天天视频在线观看| 欧美一区在线视频| 国产精品人妖ts系列视频| 亚洲午夜一二三区视频| 处破女av一区二区| 91精品婷婷国产综合久久竹菊| 国产精品第一页第二页第三页| 日本强好片久久久久久aaa| 99国产精品久| 久久青草国产手机看片福利盒子| 亚洲资源在线观看| 国产 日韩 欧美大片| 日韩精品一区二区三区在线播放 | 亚洲成人av中文|