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

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

?? jpeg.c

?? 這是針對 Linux (i386)平臺的 minigui 3.6.2 開發包(MiniGUI-Processes 運行模式)。
?? C
字號:
/*** $Id: jpeg.c,v 1.9 2004/08/03 11:01:57 panweiguo Exp $** ** jpg.c: Low-level JPEG file read/save routines.** ** Copyright (C) 2003 Feynman Software.** Copyright (C) 2000 ~ 2002 Wei Yongming**** Current maintainer: Wei Yongming**** Create date: 2000/08/29*//*** 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*//* * JPEG decompression routine * * JPEG support must be enabled (see README.txt in contrib/jpeg) * * SOME FINE POINTS: (from libjpeg) * In the below code, we ignored the return value of jpeg_read_scanlines, * which is the number of scanlines actually read.  We could get away with * this because we asked for only one line at a time and we weren't using * a suspending data source.  See libjpeg.doc for more info. * * We cheated a bit by calling alloc_sarray() after jpeg_start_decompress(); * we should have done it beforehand to ensure that the space would be * counted against the JPEG max_memory setting.  In some systems the above * code would risk an out-of-memory error.  However, in general we don't * know the output image dimensions before jpeg_start_decompress(), unless we * call jpeg_calc_output_dimensions().  See libjpeg.doc for more about this. * * Scanlines are returned in the same order as they appear in the JPEG file, * which is standardly top-to-bottom.  If you must emit data bottom-to-top, * you can use one of the virtual arrays provided by the JPEG memory manager * to invert the data.  See wrbmp.c for an example. * * As with compression, some operating modes may require temporary files. * On some systems you may need to set up a signal handler to ensure that * temporary files are deleted if the program is interrupted.  See libjpeg.doc. */#include <stdio.h>#include <stdlib.h>#include <string.h>#include "common.h"#include "gdi.h"#include "readbmp.h"#ifdef _JPG_FILE_SUPPORT#include <jpeglib.h>#include <jerror.h>#define SIZEOF(object)       ((size_t) sizeof(object))/* Expanded data source object for stdio input */typedef struct {  struct jpeg_source_mgr pub;        /* public fields */  MG_RWops *infile;                /* source stream */  JOCTET * buffer;                /* start of buffer */  boolean start_of_file;        /* have we gotten any data yet? */} my_source_mgr;typedef my_source_mgr * my_src_ptr;#define INPUT_BUF_SIZE  4096        /* choose an efficiently fread'able size *//* * Initialize source --- called by jpeg_read_header * before any data is actually read. */static void init_source (j_decompress_ptr cinfo){  my_src_ptr src = (my_src_ptr) cinfo->src;  /* We reset the empty-input-file flag for each image,   * but we don't clear the input buffer.   * This is correct behavior for reading a series of images from one source.   */  src->start_of_file = TRUE;}/* * Fill the input buffer --- called whenever buffer is emptied. */static boolean fill_input_buffer (j_decompress_ptr cinfo){  my_src_ptr src = (my_src_ptr) cinfo->src;  size_t nbytes;  nbytes = MGUI_RWread ((MG_RWops*) src->infile, src->buffer, 1, INPUT_BUF_SIZE);  if (nbytes <= 0) {    if (src->start_of_file)        /* Treat empty input file as fatal error */      ERREXIT(cinfo, JERR_INPUT_EMPTY);    WARNMS(cinfo, JWRN_JPEG_EOF);    /* Insert a fake EOI marker */    src->buffer[0] = (JOCTET) 0xFF;    src->buffer[1] = (JOCTET) JPEG_EOI;    nbytes = 2;  }  src->pub.next_input_byte = src->buffer;  src->pub.bytes_in_buffer = nbytes;  src->start_of_file = FALSE;  return TRUE;}/* * Skip data --- used to skip over a potentially large amount of * uninteresting data (such as an APPn marker). */static void skip_input_data (j_decompress_ptr cinfo, long num_bytes){  my_src_ptr src = (my_src_ptr) cinfo->src;  /* Just a dumb implementation for now.  Could use fseek() except   * it doesn't work on pipes.  Not clear that being smart is worth   * any trouble anyway --- large skips are infrequent.   */  if (num_bytes > 0) {    while (num_bytes > (long) src->pub.bytes_in_buffer) {      num_bytes -= (long) src->pub.bytes_in_buffer;      (void) fill_input_buffer(cinfo);      /* note we assume that fill_input_buffer will never return FALSE,       * so suspension need not be handled.       */    }    src->pub.next_input_byte += (size_t) num_bytes;    src->pub.bytes_in_buffer -= (size_t) num_bytes;  }}/* * An additional method that can be provided by data source modules is the * resync_to_restart method for error recovery in the presence of RST markers. * For the moment, this source module just uses the default resync method * provided by the JPEG library.  That method assumes that no backtracking * is possible. *//* * Terminate source --- called by jpeg_finish_decompress * after all data has been read.  Often a no-op. * * NB: *not* called by jpeg_abort or jpeg_destroy; surrounding * application must deal with any cleanup that should happen even * for error exit. */static void term_source (j_decompress_ptr cinfo){  /* no work necessary here */}/* * Prepare for input from a stdio stream. * The caller must have already opened the stream, and is responsible * for closing it after finishing decompression. */void my_jpeg_data_src (j_decompress_ptr cinfo, MG_RWops* infile){  my_src_ptr src;  /* The source object and input buffer are made permanent so that a series   * of JPEG images can be read from the same file by calling jpeg_stdio_src   * only before the first one.  (If we discarded the buffer at the end of   * one image, we'd likely lose the start of the next one.)   * This makes it unsafe to use this manager and a different source   * manager serially with the same JPEG object.  Caveat programmer.   */  if (cinfo->src == NULL) {        /* first time for this JPEG object? */    cinfo->src = (struct jpeg_source_mgr *)      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,                                  SIZEOF(my_source_mgr));    src = (my_src_ptr) cinfo->src;    src->buffer = (JOCTET *)      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,                                  INPUT_BUF_SIZE * SIZEOF(JOCTET));  }  src = (my_src_ptr) cinfo->src;  src->pub.init_source = init_source;  src->pub.fill_input_buffer = fill_input_buffer;  src->pub.skip_input_data = skip_input_data;  src->pub.resync_to_restart = jpeg_resync_to_restart; /* use default method */  src->pub.term_source = term_source;  src->infile = infile;  src->pub.bytes_in_buffer = 0; /* forces fill_input_buffer on first read */  src->pub.next_input_byte = NULL; /* until buffer loaded */}int __mg_load_jpg (MG_RWops *area, MYBITMAP* bmp, RGB* pal){    int i;    int ret = ERR_BMP_LOAD;    /* image load error*/    unsigned char magic[5];    /* This struct contains the JPEG decompression parameters     * and pointers to working space      * (which is allocated as needed by the JPEG library).     */    struct jpeg_decompress_struct cinfo;    struct jpeg_error_mgr jerr;#if 0    if (area->type != RWAREA_TYPE_STDIO)        return ERR_BMP_ERROR_SOURCE;        /* first determine if JPEG file since decoder will error if not */    fseek(fp, 0L, 0);    if(!fread(magic, 2, 1, fp))        return ERR_BMP_IMAGE_TYPE;        /* not JPEG image*/    if (magic[0] != 0xFF || magic[1] != 0xD8)        return ERR_BMP_IMAGE_TYPE;        /* not JPEG image*/    fread(magic, 4, 1, fp);    fread(magic, 4, 1, fp);    if (strncmp(magic, "JFIF", 4) != 0)        return ERR_BMP_IMAGE_TYPE;        /* not JPEG image*/    fseek(fp, 0L, 0);#else    if (!MGUI_RWread (area, magic, 2, 1))        return ERR_BMP_IMAGE_TYPE;        /* not JPEG image*/    if (magic[0] != 0xFF || magic[1] != 0xD8)        return ERR_BMP_IMAGE_TYPE;        /* not JPEG image*/    MGUI_RWread (area, magic, 4, 1);    MGUI_RWread (area, magic, 4, 1);    magic [4] = '\0';    if (strncmp(magic, "JFIF", 4) != 0 && strncmp(magic, "Exif", 4) != 0)        return ERR_BMP_IMAGE_TYPE;        /* not JPEG image*/    MGUI_RWseek (area, -10, SEEK_CUR);#endif    /* Step 1: allocate and initialize JPEG decompression object */    /* We set up the normal JPEG error routines. */    cinfo.err = jpeg_std_error (&jerr);    /* Now we can initialize the JPEG decompression object. */    jpeg_create_decompress (&cinfo);    /* Step 2: specify data source */    my_jpeg_data_src (&cinfo, area);    /* Step 3: read file parameters with jpeg_read_header() */    jpeg_read_header (&cinfo, TRUE);    /* Step 4: set parameters for decompression */    cinfo.out_color_space = (bmp->flags & MYBMP_LOAD_GRAYSCALE) ? JCS_GRAYSCALE: JCS_RGB;    cinfo.quantize_colors = FALSE;    if (!(bmp->flags & MYBMP_LOAD_GRAYSCALE)) {        if (bmp->depth <= 8) {            cinfo.quantize_colors = TRUE;                /* Get system palette */            cinfo.actual_number_of_colors = 0x01 << bmp->depth;                /* Allocate jpeg colormap space */            cinfo.colormap = (*cinfo.mem->alloc_sarray)                ((j_common_ptr) &cinfo, JPOOL_IMAGE,                       (JDIMENSION)cinfo.actual_number_of_colors,                (JDIMENSION)3);            /* Set colormap from system palette */            for(i = 0; i < cinfo.actual_number_of_colors; ++i)            {                cinfo.colormap[0][i] = pal[i].r >> 2;                cinfo.colormap[1][i] = pal[i].g >> 2;                cinfo.colormap[2][i] = pal[i].b >> 2;            }        }    }    else {        /* Grayscale output asked */        cinfo.quantize_colors = TRUE;        cinfo.out_color_space = JCS_GRAYSCALE;        cinfo.desired_number_of_colors = 256;        for (i = 0; i < 256; i++) {            pal [i].r = i;            pal [i].g = i;            pal [i].b = i;        }    }    jpeg_calc_output_dimensions (&cinfo);    ret = ERR_BMP_MEM;    if (bmp->flags & MYBMP_LOAD_GRAYSCALE) {        bmp->depth = 8;    }    else {        bmp->flags |= MYBMP_TYPE_RGB;        if (cinfo.output_components == 3)            bmp->flags |= MYBMP_RGBSIZE_3;        else if (cinfo.output_components == 4)            bmp->flags |= MYBMP_RGBSIZE_4;        else            bmp->flags = MYBMP_TYPE_NORMAL;        bmp->depth = cinfo.output_components * 8;    }    bmp->w = cinfo.output_width;    bmp->h = cinfo.output_height;    bmp->frames = 1;    bmpComputePitch (bmp->depth, bmp->w, &bmp->pitch, TRUE);    bmp->flags = MYBMP_TYPE_NORMAL | MYBMP_FLOW_DOWN;    bmp->bits = malloc(bmp->pitch * bmp->h);    if (!bmp->bits) goto err;    /* Step 5: Start decompressor */    jpeg_start_decompress (&cinfo);    /* Step 6: while (scan lines remain to be read) */    while (cinfo.output_scanline < cinfo.output_height) {        JSAMPROW rowptr[1];        BYTE* bits;        bits = bmp->bits + cinfo.output_scanline * bmp->pitch;        rowptr[0] = (JSAMPROW)(bits);        jpeg_read_scanlines (&cinfo, rowptr, 1);    }    ret = ERR_BMP_OK;err:    /* Step 7: Finish decompression */    jpeg_finish_decompress (&cinfo);    /* Step 8: Release JPEG decompression object */    jpeg_destroy_decompress (&cinfo);    /* May want to check to see whether any corrupt-data     * warnings occurred (test whether jerr.pub.num_warnings is nonzero).     */    return ret;}BOOL __mg_check_jpg (MG_RWops* fp){    unsigned char magic [5];    if (!MGUI_RWread (fp, magic, 2, 1))        return FALSE;        /* not JPEG image*/    if (magic[0] != 0xFF || magic[1] != 0xD8)        return FALSE;        /* not JPEG image*/    MGUI_RWread (fp, magic, 4, 1);    MGUI_RWread (fp, magic, 4, 1);    magic [4] = '\0';    if (strncmp(magic, "JFIF", 4) != 0 && strncmp(magic, "Exif", 4) != 0)        return FALSE;        /* not JPEG image*/    return TRUE;}#endif /* _JPG_FILE_SUPPORT */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧美一区二区在线观看| 午夜精品123| 亚洲成人一区在线| 国产综合久久久久久久久久久久| 色综合天天性综合| 久久中文字幕电影| 天天操天天综合网| 97久久精品人人爽人人爽蜜臀| 日韩欧美一二三四区| 亚洲综合在线电影| 国产69精品久久99不卡| 日韩一区二区麻豆国产| 悠悠色在线精品| 成人国产精品免费观看| 2021久久国产精品不只是精品| 亚洲国产精品欧美一二99| 国产九色sp调教91| 日韩午夜精品视频| 青青草视频一区| 欧美日韩国产高清一区二区三区 | 亚洲国产成人av网| 91视频免费看| 国产精品久久国产精麻豆99网站| 精彩视频一区二区三区| 欧美精品99久久久**| 亚洲一卡二卡三卡四卡无卡久久| 波多野结衣中文一区| 日本一区二区免费在线| 国产一区二区福利视频| 精品国产麻豆免费人成网站| 久久精品国产在热久久| 欧美成人艳星乳罩| 国内精品免费**视频| wwwwxxxxx欧美| 国产一区二区伦理片| 久久综合久久99| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | 久久嫩草精品久久久精品 | 亚洲国产精品一区二区久久恐怖片 | 国产一区二区伦理| 久久久久久久免费视频了| 国产福利精品一区| 国产精品久久久久久妇女6080| 成人av中文字幕| 亚洲美女淫视频| 在线免费不卡电影| 亚洲成人精品在线观看| 欧美一级搡bbbb搡bbbb| 激情文学综合丁香| 亚洲国产精品精华液2区45| 成人黄色一级视频| 一区二区三区不卡在线观看| 欧美影视一区在线| 久久国产剧场电影| 国产情人综合久久777777| av日韩在线网站| 亚洲成人资源在线| 精品对白一区国产伦| 99国产精品久| 日本aⅴ免费视频一区二区三区 | 国产精品99久久久久久有的能看| www亚洲一区| 色综合久久久久网| 免费av成人在线| 欧美国产激情二区三区| 欧美日韩三级一区二区| 国产一区二区毛片| 亚洲国产精品一区二区久久 | 国产成人av影院| 亚洲人成伊人成综合网小说| 欧美精品丝袜中出| 国产一区二区在线电影| 亚洲另类色综合网站| 精品国产免费一区二区三区四区| www.成人在线| 久久国产精品第一页| 一区二区视频在线| 久久综合国产精品| 欧美日韩亚洲另类| 成人av午夜影院| 久久国产婷婷国产香蕉| 一区二区日韩电影| 欧美国产综合一区二区| 欧美一级片在线| 色偷偷久久人人79超碰人人澡| 精品一区二区成人精品| 亚洲尤物视频在线| 国产精品九色蝌蚪自拍| 久久亚洲一区二区三区四区| 欧美日韩视频在线观看一区二区三区| 国产福利电影一区二区三区| 久久精品久久精品| 日韩精品久久久久久| 亚洲一区二区三区中文字幕在线| 国产精品视频观看| 久久一日本道色综合| 欧美zozozo| 在线播放中文一区| 欧美图片一区二区三区| 97久久精品人人做人人爽50路| 国产成人精品www牛牛影视| 国产在线视频一区二区三区| 婷婷国产在线综合| 亚洲chinese男男1069| 亚洲精选视频在线| 综合分类小说区另类春色亚洲小说欧美 | 精品一区二区三区视频在线观看| 亚洲一区二区三区视频在线| 亚洲精品乱码久久久久久久久| 国产日韩精品一区二区三区在线| www一区二区| 久久婷婷一区二区三区| 久久久久久久国产精品影院| 久久综合色之久久综合| 久久先锋影音av鲁色资源网| 久久久综合精品| 久久久国产综合精品女国产盗摄| 欧美xxxxxxxxx| 久久尤物电影视频在线观看| 精品人伦一区二区色婷婷| 亚洲精品一区二区三区影院| 久久久久久久电影| 国产精品入口麻豆九色| 亚洲人成影院在线观看| 亚洲一区二区三区四区五区黄| 亚洲一区在线观看免费观看电影高清| 亚洲三级小视频| 亚洲一区二区视频在线观看| 三级久久三级久久| 另类调教123区| 国产成人免费xxxxxxxx| 91麻豆免费看| 欧美日韩一区二区在线观看| 7777精品伊人久久久大香线蕉的| 日韩一级视频免费观看在线| 久久精品男人天堂av| 自拍偷拍欧美激情| 午夜精品久久久久久久| 国产曰批免费观看久久久| 成人福利视频网站| 欧美三区免费完整视频在线观看| 日韩一级免费一区| 国产精品色在线观看| 亚洲男人电影天堂| 男人的天堂久久精品| 国产99久久久久| 欧美偷拍一区二区| 国产婷婷色一区二区三区四区| 一区二区三区四区不卡视频| 麻豆精品一区二区三区| aaa国产一区| 91精品国产麻豆国产自产在线 | 国产福利精品导航| 欧美日韩中文字幕一区| 欧美精品一区二区精品网| 中文字幕视频一区| 久久av中文字幕片| 色综合久久久久网| 亚洲精品一线二线三线| 亚洲丶国产丶欧美一区二区三区| 精品无码三级在线观看视频| 色呦呦网站一区| 国产午夜精品福利| 亚洲成a人片综合在线| 粉嫩在线一区二区三区视频| 欧美人牲a欧美精品| 国产精品久久久久7777按摩| 欧美bbbbb| 欧美视频日韩视频在线观看| 久久免费美女视频| 婷婷开心激情综合| 在线观看www91| 国产精品美女久久久久久久久| 青青草97国产精品免费观看无弹窗版 | 韩国欧美国产1区| 91黄色免费网站| 国产精品美女久久久久aⅴ| 日韩av电影一区| 欧美日韩高清一区二区不卡| 亚洲欧美区自拍先锋| 国产精品一区在线观看你懂的| 7777精品伊人久久久大香线蕉经典版下载 | 久久久国产一区二区三区四区小说| 亚洲大型综合色站| 色综合久久综合中文综合网| 国产精品毛片大码女人| 国产一区二区三区四区五区入口| 欧美精品视频www在线观看| 亚洲国产日韩av| 在线看一区二区| 一个色妞综合视频在线观看| 91老司机福利 在线| 国产精品私房写真福利视频| 国产精品综合久久| 精品区一区二区| 激情伊人五月天久久综合| 亚洲精品一区二区三区四区高清| 免费观看成人鲁鲁鲁鲁鲁视频| 欧美一级片在线观看| 久久精品72免费观看|