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

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

?? jpeg.c

?? libminigui-1.3.0.tar.gz。 miniGUI的庫函數(shù)源代碼!
?? C
字號(hào):
/*** $Id: jpeg.c,v 1.7.8.1 2004/04/30 02:34:44 weiym 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 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 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 */

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色伊人久久综合中文字幕| 日本精品裸体写真集在线观看| 国产精品麻豆一区二区| 91传媒视频在线播放| 国产一区二区三区日韩| 亚洲成人在线网站| 国产精品妹子av| 精品免费国产一区二区三区四区| 色综合久久天天| 国产乱码精品1区2区3区| 亚洲综合色在线| 中文字幕在线免费不卡| 久久久亚洲午夜电影| 欧美一区二区三区四区高清 | 99re这里只有精品视频首页| 美女一区二区在线观看| 亚洲大型综合色站| 亚洲精品中文字幕乱码三区 | 亚洲视频在线一区观看| 久久午夜电影网| 欧美一级精品大片| 欧美另类变人与禽xxxxx| 色综合天天性综合| 成av人片一区二区| 国产精品12区| 欧美优质美女网站| 成人污视频在线观看| 国产毛片一区二区| 国产在线精品免费av| 日韩不卡免费视频| 日日摸夜夜添夜夜添国产精品| 一区二区不卡在线播放 | 99久久精品国产一区二区三区| 国产另类ts人妖一区二区| 精品一区二区三区在线播放视频| 男女男精品视频| 免费高清在线一区| 蜜臀91精品一区二区三区 | 亚洲国产aⅴ成人精品无吗| 亚洲视频网在线直播| 国产精品进线69影院| 1024成人网| 亚洲精品成人在线| 一区二区三区日韩欧美| 亚洲一二三四在线| 五月天欧美精品| 日本欧美在线观看| 久久99最新地址| 国产一区中文字幕| 成人美女在线观看| a4yy欧美一区二区三区| 色88888久久久久久影院野外| 91福利小视频| 91精品国产91久久久久久一区二区 | 91亚洲精品久久久蜜桃网站| 99精品视频免费在线观看| 色国产综合视频| 欧美精品日韩综合在线| 日韩欧美高清dvd碟片| www久久精品| 国产人成亚洲第一网站在线播放| 国产午夜精品美女毛片视频| 国产精品传媒视频| 亚洲一区二区欧美| 久久91精品久久久久久秒播| 国产成人精品在线看| 色综合久久88色综合天天6| 欧美日韩1234| 久久精品人人做人人综合| 国产精品视频观看| 国产精品一区二区不卡| 成人美女视频在线观看18| 在线免费不卡电影| 日韩精品一区二区三区视频播放 | 777午夜精品免费视频| 日韩美一区二区三区| 欧美国产精品久久| 亚洲影视在线播放| 久久成人久久鬼色| 成人av电影在线播放| 欧洲亚洲精品在线| 亚洲精品一区二区三区在线观看 | 激情综合五月天| www.性欧美| 欧美一区二区三区在| 中文字幕二三区不卡| 午夜电影一区二区| 国产精品亚洲а∨天堂免在线| 91久久精品国产91性色tv | 中文字幕视频一区二区三区久| 亚洲第一精品在线| 成人午夜看片网址| 69精品人人人人| 日韩理论电影院| 美美哒免费高清在线观看视频一区二区| 成人精品在线视频观看| 在线播放视频一区| 亚洲欧洲综合另类| 韩国精品一区二区| 7777精品伊人久久久大香线蕉的 | 欧美手机在线视频| 国产嫩草影院久久久久| 日本午夜精品一区二区三区电影| av色综合久久天堂av综合| 欧美成人一区二区三区片免费| 亚洲免费资源在线播放| 国产精品自在欧美一区| 日韩一区二区三区免费看 | 欧美性三三影院| 国产精品网站导航| 激情图片小说一区| 91精品国产欧美日韩| 亚洲国产精品久久人人爱| av电影在线观看完整版一区二区| 26uuu成人网一区二区三区| 日本不卡一区二区| 欧美日韩色一区| 一区二区三区四区精品在线视频| 国产不卡视频在线播放| 精品国产电影一区二区| 奇米色一区二区三区四区| 欧美色视频一区| 一区二区高清在线| 色婷婷av一区二区三区gif| 国产精品超碰97尤物18| 成人午夜视频在线| 国产欧美一区二区三区网站| 国产毛片精品视频| 久久欧美一区二区| 国产一区二区不卡| 久久男人中文字幕资源站| 精品在线免费视频| 久久婷婷久久一区二区三区| 久久国产视频网| 日韩女优av电影| 久久99精品国产91久久来源| 日韩一级片在线播放| 久久激情综合网| 精品国产乱码久久久久久老虎| 奇米888四色在线精品| 91精品国产手机| 色哟哟国产精品| 亚洲欧美经典视频| 在线观看区一区二| 亚洲一区二区视频在线| 日本高清无吗v一区| 亚洲综合偷拍欧美一区色| 欧美日韩激情一区二区| 日韩国产一二三区| 精品久久一区二区| 国产在线不卡一区| 国产精品进线69影院| 欧美中文字幕不卡| 日本vs亚洲vs韩国一区三区 | 欧美一区二区三区视频在线 | 亚洲美女屁股眼交| 色拍拍在线精品视频8848| 亚洲综合av网| 欧美一级日韩一级| 国产美女久久久久| 亚洲欧美在线视频| 欧美日本一区二区| 理论片日本一区| 欧美国产日产图区| 91精品福利在线| 日本伊人色综合网| 欧美极品美女视频| 欧洲一区二区三区免费视频| 美腿丝袜一区二区三区| 欧美激情一区二区三区不卡 | 婷婷国产在线综合| 精品国产一区二区国模嫣然| 床上的激情91.| 亚洲高清视频的网址| 久久综合色8888| 色天天综合色天天久久| 美女久久久精品| 中文字幕一区视频| 欧美一区在线视频| 成人免费的视频| 日韩不卡一区二区| 国产精品免费视频网站| 555夜色666亚洲国产免| 国产成人啪午夜精品网站男同| 亚洲黄色尤物视频| www国产亚洲精品久久麻豆| 色噜噜狠狠一区二区三区果冻| 蜜桃久久久久久| 亚洲精品国产品国语在线app| 日韩欧美一级特黄在线播放| 色综合久久中文综合久久牛| 麻豆精品一区二区| 亚洲黄色免费电影| 国产区在线观看成人精品| 6080亚洲精品一区二区| 99re66热这里只有精品3直播| 精品一区二区三区免费| 亚洲精品一二三| www国产成人| 91.xcao|