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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? display.c

?? MPEG2編解碼的源代碼.zip
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* display.c, X11 interface                                                 *//* Copyright (C) 1996, MPEG Software Simulation Group. All Rights Reserved. *//* * Disclaimer of Warranty * * These software programs are available to the user without any license fee or * royalty on an "as is" basis.  The MPEG Software Simulation Group disclaims * any and all warranties, whether express, implied, or statuary, including any * implied warranties or merchantability or of fitness for a particular * purpose.  In no event shall the copyright-holder be liable for any * incidental, punitive, or consequential damages of any kind whatsoever * arising from the use of these programs. * * This disclaimer of warranty extends to the user of these programs and user's * customers, employees, agents, transferees, successors, and assigns. * * The MPEG Software Simulation Group does not represent or warrant that the * programs furnished hereunder are free of infringement of any third-party * patents. * * Commercial implementations of MPEG-1 and MPEG-2 video, including shareware, * are subject to royalty fees to patent holders.  Many of these patents are * general enough such that they are unavoidable regardless of implementation * design. * */#ifdef DISPLAY /* the Xlib interface is closely modeled after  * mpeg_play 2.0 by the Berkeley Plateau Research Group  */#include <stdio.h>#include <stdlib.h>#include <X11/Xlib.h>#include <X11/Xutil.h>#include "config.h"#include "global.h"/* private prototypes */static void Display_Image _ANSI_ARGS_((XImage *Ximage_Ptr, unsigned char *Dithered_Image));static void Dither_Frame _ANSI_ARGS_((unsigned char *src[]));static void Dither_Top_Field _ANSI_ARGS_((unsigned char *src[], unsigned char *dst));static void Dither_Bottom_Field _ANSI_ARGS_((unsigned char *src[], unsigned char *dst));static void Dither_Top_Field420 _ANSI_ARGS_((unsigned char *src[],                                      unsigned char *dst));static void Dither_Bottom_Field420 _ANSI_ARGS_((unsigned char *src[],                                      unsigned char *dst));/* local data */static unsigned char *Dithered_Image, *Dithered_Image2;static unsigned char Y_Table[256+16];static unsigned char Cb_Table[128+16];static unsigned char Cr_Table[128+16];/* X11 related variables */static Display *Display_Ptr;static Window Window_Instance;static GC GC_Instance;static XImage *Ximage_Ptr, *Ximage_Ptr2;static unsigned char Pixel[256];#ifdef SH_MEM#include <sys/ipc.h>#include <sys/shm.h>#include <X11/extensions/XShm.h>static int HandleXError _ANSI_ARGS_((Display *dpy, XErrorEvent *event));static void InstallXErrorHandler _ANSI_ARGS_((void));static void DeInstallXErrorHandler _ANSI_ARGS_((void));static int Shmem_Flag;static XShmSegmentInfo Shminfo1, Shminfo2;static int gXErrorFlag;static int CompletionType = -1;static int HandleXError(Dpy, Event)Display *Dpy;XErrorEvent *Event;{  gXErrorFlag = 1;  return 0;}static void InstallXErrorHandler(){  XSetErrorHandler(HandleXError);  XFlush(Display_Ptr);}static void DeInstallXErrorHandler(){  XSetErrorHandler(NULL);  XFlush(Display_Ptr);}#endif/* connect to server, create and map window, * allocate colors and (shared) memory */void Initialize_Display_Process(name)char *name;{  int crv, cbu, cgu, cgv;  int Y, Cb, Cr, R, G, B;  int i;  char dummy;  int screen;  Colormap cmap;  int private;  XColor xcolor;  unsigned int fg, bg;  char *hello = "MPEG-2 Display";  XSizeHints hint;  XVisualInfo vinfo;  XEvent xev;  unsigned long tmp_pixel;  XWindowAttributes xwa;  Display_Ptr = XOpenDisplay(name);  if (Display_Ptr == NULL)    Error("Can not open display\n");  screen = DefaultScreen(Display_Ptr);  hint.x = 200;  hint.y = 200;  hint.width = horizontal_size;  hint.height = vertical_size;  hint.flags = PPosition | PSize;  /* Get some colors */  bg = WhitePixel (Display_Ptr, screen);  fg = BlackPixel (Display_Ptr, screen);  /* Make the window */  if (!XMatchVisualInfo(Display_Ptr, screen, 8, PseudoColor, &vinfo))  {    if (!XMatchVisualInfo(Display_Ptr, screen, 8, GrayScale, &vinfo))      Error("requires 8 bit display\n");  }  Window_Instance = XCreateSimpleWindow (Display_Ptr, DefaultRootWindow (Display_Ptr),             hint.x, hint.y, hint.width, hint.height, 4, fg, bg);  XSelectInput(Display_Ptr, Window_Instance, StructureNotifyMask);  /* Tell other applications about this window */  XSetStandardProperties (Display_Ptr, Window_Instance, hello, hello, None, NULL, 0, &hint);  /* Map window. */  XMapWindow(Display_Ptr, Window_Instance);  /* Wait for map. */  do  {    XNextEvent(Display_Ptr, &xev);  }  while (xev.type != MapNotify || xev.xmap.event != Window_Instance);  XSelectInput(Display_Ptr, Window_Instance, NoEventMask);  /* matrix coefficients */  crv = Inverse_Table_6_9[matrix_coefficients][0];  cbu = Inverse_Table_6_9[matrix_coefficients][1];  cgu = Inverse_Table_6_9[matrix_coefficients][2];  cgv = Inverse_Table_6_9[matrix_coefficients][3];  /* allocate colors */  GC_Instance = DefaultGC(Display_Ptr, screen);  cmap = DefaultColormap(Display_Ptr, screen);  private = 0;  /* color allocation:   * i is the (internal) 8 bit color number, it consists of separate   * bit fields for Y, U and V: i = (yyyyuuvv), we don't use yyyy=0000   * and yyyy=1111, this leaves 32 colors for other applications   *   * the allocated colors correspond to the following Y, U and V values:   * Y:   24, 40, 56, 72, 88, 104, 120, 136, 152, 168, 184, 200, 216, 232   * U,V: -48, -16, 16, 48   *   * U and V values span only about half the color space; this gives   * usually much better quality, although highly saturated colors can   * not be displayed properly   *   * translation to R,G,B is implicitly done by the color look-up table   */  for (i=16; i<240; i++)  {    /* color space conversion */    Y  = 16*((i>>4)&15) + 8;    Cb = 32*((i>>2)&3)  - 48;    Cr = 32*(i&3)       - 48;    Y = 76309 * (Y - 16); /* (255/219)*65536 */    R = Clip[(Y + crv*Cr + 32768)>>16];    G = Clip[(Y - cgu*Cb - cgv*Cr + 32768)>>16];    B = Clip[(Y + cbu*Cb + 32786)>>16];    /* X11 colors are 16 bit */    xcolor.red   = R << 8;    xcolor.green = G << 8;    xcolor.blue  = B << 8;    if (XAllocColor(Display_Ptr, cmap, &xcolor) != 0)      Pixel[i] = xcolor.pixel;    else    {      /* allocation failed, have to use a private colormap */      if (private)        Error("Couldn't allocate private colormap");      private = 1;      if (!Quiet_Flag)        fprintf(stderr, "Using private colormap (%d colors were available).\n",          i-16);      /* Free colors. */      while (--i >= 16)      {        tmp_pixel = Pixel[i]; /* because XFreeColors expects unsigned long */        XFreeColors(Display_Ptr, cmap, &tmp_pixel, 1, 0);      }      /* i is now 15, this restarts the outer loop */      /* create private colormap */      XGetWindowAttributes(Display_Ptr, Window_Instance, &xwa);      cmap = XCreateColormap(Display_Ptr, Window_Instance, xwa.visual, AllocNone);      XSetWindowColormap(Display_Ptr, Window_Instance, cmap);    }  }#ifdef SH_MEM  if (XShmQueryExtension(Display_Ptr))    Shmem_Flag = 1;  else  {    Shmem_Flag = 0;    if (!Quiet_Flag)      fprintf(stderr, "Shared memory not supported\nReverting to normal Xlib\n");  }  if (Shmem_Flag)    CompletionType = XShmGetEventBase(Display_Ptr) + ShmCompletion;  InstallXErrorHandler();  if (Shmem_Flag)  {    Ximage_Ptr = XShmCreateImage(Display_Ptr, None, 8, ZPixmap, NULL,                             &Shminfo1,                             Coded_Picture_Width, Coded_Picture_Height);    if (!progressive_sequence)      Ximage_Ptr2 = XShmCreateImage(Display_Ptr, None, 8, ZPixmap, NULL,                                &Shminfo2,                                Coded_Picture_Width, Coded_Picture_Height);    /* If no go, then revert to normal Xlib calls. */    if (Ximage_Ptr==NULL || (!progressive_sequence && Ximage_Ptr2==NULL))    {      if (Ximage_Ptr!=NULL)        XDestroyImage(Ximage_Ptr);      if (!progressive_sequence && Ximage_Ptr2!=NULL)        XDestroyImage(Ximage_Ptr2);      if (!Quiet_Flag)        fprintf(stderr, "Shared memory error, disabling (Ximage error)\n");      goto shmemerror;    }    /* Success here, continue. */    Shminfo1.shmid = shmget(IPC_PRIVATE,                             Ximage_Ptr->bytes_per_line * Ximage_Ptr->height,                            IPC_CREAT | 0777);    if (!progressive_sequence)      Shminfo2.shmid = shmget(IPC_PRIVATE,                               Ximage_Ptr2->bytes_per_line * Ximage_Ptr2->height,                              IPC_CREAT | 0777);    if (Shminfo1.shmid<0 || (!progressive_sequence && Shminfo2.shmid<0))    {      XDestroyImage(Ximage_Ptr);      if (!progressive_sequence)        XDestroyImage(Ximage_Ptr2);      if (!Quiet_Flag)        fprintf(stderr, "Shared memory error, disabling (seg id error)\n");      goto shmemerror;    }    Shminfo1.shmaddr = (char *) shmat(Shminfo1.shmid, 0, 0);    Shminfo2.shmaddr = (char *) shmat(Shminfo2.shmid, 0, 0);    if (Shminfo1.shmaddr==((char *) -1) ||        (!progressive_sequence && Shminfo2.shmaddr==((char *) -1)))    {      XDestroyImage(Ximage_Ptr);      if (Shminfo1.shmaddr!=((char *) -1))        shmdt(Shminfo1.shmaddr);      if (!progressive_sequence)      {        XDestroyImage(Ximage_Ptr2);        if (Shminfo2.shmaddr!=((char *) -1))          shmdt(Shminfo2.shmaddr);      }      if (!Quiet_Flag)      {        fprintf(stderr, "Shared memory error, disabling (address error)\n");      }      goto shmemerror;    }    Ximage_Ptr->data = Shminfo1.shmaddr;    Dithered_Image = (unsigned char *)Ximage_Ptr->data;    Shminfo1.readOnly = False;    XShmAttach(Display_Ptr, &Shminfo1);    if (!progressive_sequence)    {      Ximage_Ptr2->data = Shminfo2.shmaddr;      Dithered_Image2 = (unsigned char *)Ximage_Ptr2->data;      Shminfo2.readOnly = False;      XShmAttach(Display_Ptr, &Shminfo2);    }    XSync(Display_Ptr, False);    if (gXErrorFlag)    {      /* Ultimate failure here. */      XDestroyImage(Ximage_Ptr);      shmdt(Shminfo1.shmaddr);      if (!progressive_sequence)      {        XDestroyImage(Ximage_Ptr2);        shmdt(Shminfo2.shmaddr);      }      if (!Quiet_Flag)        fprintf(stderr, "Shared memory error, disabling.\n");      gXErrorFlag = 0;      goto shmemerror;    }    else    {      shmctl(Shminfo1.shmid, IPC_RMID, 0);      if (!progressive_sequence)        shmctl(Shminfo2.shmid, IPC_RMID, 0);    }    if (!Quiet_Flag)    {      fprintf(stderr, "Sharing memory.\n");    }  }  else  {shmemerror:    Shmem_Flag = 0;#endif    Ximage_Ptr = XCreateImage(Display_Ptr,None,8,ZPixmap,0,&dummy,                          Coded_Picture_Width,Coded_Picture_Height,8,0);    if (!(Dithered_Image = (unsigned char *)malloc(Coded_Picture_Width*                                                   Coded_Picture_Height)))      Error("malloc failed");    if (!progressive_sequence)    {      Ximage_Ptr2 = XCreateImage(Display_Ptr,None,8,ZPixmap,0,&dummy,                             Coded_Picture_Width,Coded_Picture_Height,8,0);      if (!(Dithered_Image2 = (unsigned char *)malloc(Coded_Picture_Width*                                                      Coded_Picture_Height)))        Error("malloc failed");    }#ifdef SH_MEM  }  DeInstallXErrorHandler();#endif}void Terminate_Display_Process()

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩视频在线第一区| 激情六月婷婷久久| 欧美三日本三级三级在线播放| 成人永久免费视频| 国产日本欧美一区二区| 成人性生交大片免费看在线播放| 国产精品人成在线观看免费 | 亚洲成人激情av| 欧美乱妇20p| 精品亚洲国内自在自线福利| 久久久久久久综合色一本| 99vv1com这只有精品| 亚洲午夜日本在线观看| 日韩欧美国产综合一区| 成人精品国产福利| 亚洲成人一二三| 精品久久99ma| av一区二区三区四区| 亚洲www啪成人一区二区麻豆| 精品国产不卡一区二区三区| 99国产精品久久久久久久久久| 亚洲最大成人综合| 精品国产亚洲一区二区三区在线观看| 国产精品亚洲专一区二区三区| 亚洲乱码国产乱码精品精的特点| 91精品欧美久久久久久动漫| 国产精品77777竹菊影视小说| 亚洲男人的天堂av| 日韩一区二区在线观看视频 | 欧美成人一级视频| 99九九99九九九视频精品| 青娱乐精品视频在线| 国产精品色婷婷久久58| 777奇米四色成人影色区| av影院午夜一区| 蜜臀久久久99精品久久久久久| 亚洲欧洲国产日本综合| 日韩欧美久久一区| 欧美手机在线视频| 99视频一区二区三区| 麻豆国产欧美一区二区三区| 亚洲黄一区二区三区| 久久精品视频网| 4438x亚洲最大成人网| 色久优优欧美色久优优| 国产91富婆露脸刺激对白| 日韩高清在线一区| 亚洲男人天堂一区| 欧美国产日本视频| 日韩欧美成人一区| 欧美日韩久久不卡| 91精彩视频在线| www.性欧美| 国产成人免费视频网站 | 欧美综合天天夜夜久久| 久久天天做天天爱综合色| 欧美日韩精品福利| 欧美自拍丝袜亚洲| 99re成人在线| 成人av电影在线网| 国产成人a级片| 国产一区欧美一区| 欧美亚洲自拍偷拍| av不卡在线观看| 成人午夜av电影| 国产91精品免费| 国产成人av网站| 国产成人无遮挡在线视频| 国产一区二区影院| 国产一本一道久久香蕉| 久久精品国产在热久久| 青椒成人免费视频| 麻豆精品在线播放| 美女免费视频一区二区| 毛片一区二区三区| 久久精品国产亚洲5555| 毛片基地黄久久久久久天堂| 免费成人深夜小野草| 免费人成精品欧美精品| 久久精品国产成人一区二区三区 | 欧美性欧美巨大黑白大战| 91一区在线观看| 91麻豆免费视频| 91福利视频久久久久| 在线一区二区视频| 91精品国产免费| 欧美videos中文字幕| 国产亚洲欧美日韩在线一区| 久久嫩草精品久久久精品| 欧美国产日本韩| 亚洲欧美一区二区三区久本道91| 亚洲精品免费视频| 亚洲成年人影院| 久久精品国产亚洲a| 成人在线综合网| 欧美在线制服丝袜| 日韩欧美国产午夜精品| 国产无一区二区| 亚洲美女在线一区| 日本欧美加勒比视频| 国产福利视频一区二区三区| 不卡的av在线| 欧美日韩国产片| 精品久久久久久最新网址| 国产精品色呦呦| 一本久久a久久精品亚洲| 欧美视频一区二区三区四区| 日韩欧美电影一区| 国产精品久久精品日日| 亚洲成人一区在线| 国产成人免费视频网站| 欧美怡红院视频| 精品伦理精品一区| 伊人一区二区三区| 久久99精品国产91久久来源| av中文一区二区三区| 欧美一区日韩一区| 亚洲欧美日韩国产综合| 美女一区二区三区| 色老综合老女人久久久| 精品久久久三级丝袜| 亚洲综合网站在线观看| 国产在线视频一区二区三区| 91久久人澡人人添人人爽欧美| 欧美成人精品高清在线播放| 一区二区成人在线观看| 国产精品一二一区| 欧美一级免费大片| 亚洲精品日产精品乱码不卡| 国产一区免费电影| 欧美日韩国产中文| 亚洲免费在线播放| 国产成a人无v码亚洲福利| 欧美精品v日韩精品v韩国精品v| 国产精品色哟哟网站| 久久精品久久综合| 欧美日韩精品综合在线| 中文字幕日本不卡| 国产精品亚洲成人| 日韩欧美区一区二| 日韩电影免费一区| 亚洲免费观看高清完整版在线观看熊| 老色鬼精品视频在线观看播放| 欧美天天综合网| 一区二区三区四区在线| 成人av手机在线观看| 国产欧美视频一区二区三区| 久久国产精品露脸对白| 欧美一区午夜视频在线观看| 亚洲成人一区二区在线观看| 91久久精品一区二区| 亚洲欧洲在线观看av| 国产成人免费高清| 久久久久久电影| 国内精品视频一区二区三区八戒| 91精品国产综合久久久久久久 | 国产精品久久久久一区二区三区| 久久99国产精品免费网站| 欧美三级欧美一级| 亚洲激情校园春色| 欧美中文字幕一二三区视频| 亚洲男人的天堂在线aⅴ视频| 91视频在线观看| 亚洲女同ⅹxx女同tv| 91老师片黄在线观看| 一区二区三区国产豹纹内裤在线| 99国产精品一区| 亚洲精选在线视频| 欧美在线小视频| 亚洲第一成人在线| 欧美三级在线视频| 水蜜桃久久夜色精品一区的特点| 欧美亚洲动漫精品| 视频一区国产视频| 欧美一级一区二区| 激情亚洲综合在线| 国产欧美精品国产国产专区| 成人aaaa免费全部观看| 亚洲人成影院在线观看| 欧美丝袜丝交足nylons图片| 日本欧美一区二区| 国产偷国产偷精品高清尤物| av动漫一区二区| 天涯成人国产亚洲精品一区av| 日韩亚洲欧美一区| 国产精品乡下勾搭老头1| 国产精品国产自产拍高清av | 偷偷要91色婷婷| 精品久久一二三区| 国产成人免费av在线| 亚洲精品国产品国语在线app| 欧美三级电影一区| 久久www免费人成看片高清| 国产精品婷婷午夜在线观看| 色综合久久精品| 日韩电影在线观看网站| 国产精品午夜久久| 欧美日韩成人高清| 丁香啪啪综合成人亚洲小说| 亚洲在线观看免费视频|