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

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

?? rdjpgcom.c

?? 這是JPEG解碼、編碼的源代碼
?? C
字號(hào):
/*
 * rdjpgcom.c
 *
 * Copyright (C) 1994-1995, Thomas G. Lane.
 * This file is part of the Independent JPEG Group's software.
 * For conditions of distribution and use, see the accompanying README file.
 *
 * This file contains a very simple stand-alone application that displays
 * the text in COM (comment) markers in a JFIF file.
 * This may be useful as an example of the minimum logic needed to parse
 * JPEG markers.
 */

#define JPEG_CJPEG_DJPEG	/* to get the command-line config symbols */
#include "jinclude.h"		/* get auto-config symbols, <stdio.h> */

#include <ctype.h>		/* to declare isupper(), tolower() */
#ifdef USE_SETMODE
#include <fcntl.h>		/* to declare setmode()'s parameter macros */
/* If you have setmode() but not <io.h>, just delete this line: */
#include <io.h>			/* to declare setmode() */
#endif

#ifdef USE_CCOMMAND		/* command-line reader for Macintosh */
#ifdef __MWERKS__
#include <SIOUX.h>              /* Metrowerks needs this */
#include <console.h>		/* ... and this */
#endif
#ifdef THINK_C
#include <console.h>		/* Think declares it here */
#endif
#endif

#ifdef DONT_USE_B_MODE		/* define mode parameters for fopen() */
#define READ_BINARY	"r"
#else
#define READ_BINARY	"rb"
#endif

#ifndef EXIT_FAILURE		/* define exit() codes if not provided */
#define EXIT_FAILURE  1
#endif
#ifndef EXIT_SUCCESS
#ifdef VMS
#define EXIT_SUCCESS  1		/* VMS is very nonstandard */
#else
#define EXIT_SUCCESS  0
#endif
#endif


/*
 * These macros are used to read the input file.
 * To reuse this code in another application, you might need to change these.
 */

static FILE * infile;		/* input JPEG file */

/* Return next input byte, or EOF if no more */
#define NEXTBYTE()  getc(infile)


/* Error exit handler */
#define ERREXIT(msg)  (fprintf(stderr, "%s\n", msg), exit(EXIT_FAILURE))


/* Read one byte, testing for EOF */
static int
read_1_byte (void)
{
  int c;

  c = NEXTBYTE();
  if (c == EOF)
    ERREXIT("Premature EOF in JPEG file");
  return c;
}

/* Read 2 bytes, convert to unsigned int */
/* All 2-byte quantities in JPEG markers are MSB first */
static unsigned int
read_2_bytes (void)
{
  int c1, c2;

  c1 = NEXTBYTE();
  if (c1 == EOF)
    ERREXIT("Premature EOF in JPEG file");
  c2 = NEXTBYTE();
  if (c2 == EOF)
    ERREXIT("Premature EOF in JPEG file");
  return (((unsigned int) c1) << 8) + ((unsigned int) c2);
}


/*
 * JPEG markers consist of one or more 0xFF bytes, followed by a marker
 * code byte (which is not an FF).  Here are the marker codes of interest
 * in this program.  (See jdmarker.c for a more complete list.)
 */

#define M_SOF0  0xC0		/* Start Of Frame N */
#define M_SOF1  0xC1		/* N indicates which compression process */
#define M_SOF2  0xC2		/* Only SOF0-SOF2 are now in common use */
#define M_SOF3  0xC3
#define M_SOF5  0xC5		/* NB: codes C4 and CC are NOT SOF markers */
#define M_SOF6  0xC6
#define M_SOF7  0xC7
#define M_SOF9  0xC9
#define M_SOF10 0xCA
#define M_SOF11 0xCB
#define M_SOF13 0xCD
#define M_SOF14 0xCE
#define M_SOF15 0xCF
#define M_SOI   0xD8		/* Start Of Image (beginning of datastream) */
#define M_EOI   0xD9		/* End Of Image (end of datastream) */
#define M_SOS   0xDA		/* Start Of Scan (begins compressed data) */
#define M_COM   0xFE		/* COMment */


/*
 * Find the next JPEG marker and return its marker code.
 * We expect at least one FF byte, possibly more if the compressor used FFs
 * to pad the file.
 * There could also be non-FF garbage between markers.  The treatment of such
 * garbage is unspecified; we choose to skip over it but emit a warning msg.
 * NB: this routine must not be used after seeing SOS marker, since it will
 * not deal correctly with FF/00 sequences in the compressed image data...
 */

static int
next_marker (void)
{
  int c;
  int discarded_bytes = 0;

  /* Find 0xFF byte; count and skip any non-FFs. */
  c = read_1_byte();
  while (c != 0xFF) {
    discarded_bytes++;
    c = read_1_byte();
  }
  /* Get marker code byte, swallowing any duplicate FF bytes.  Extra FFs
   * are legal as pad bytes, so don't count them in discarded_bytes.
   */
  do {
    c = read_1_byte();
  } while (c == 0xFF);

  if (discarded_bytes != 0) {
    fprintf(stderr, "Warning: garbage data found in JPEG file\n");
  }

  return c;
}


/*
 * Read the initial marker, which should be SOI.
 * For a JFIF file, the first two bytes of the file should be literally
 * 0xFF M_SOI.  To be more general, we could use next_marker, but if the
 * input file weren't actually JPEG at all, next_marker might read the whole
 * file and then return a misleading error message...
 */

static int
first_marker (void)
{
  int c1, c2;

  c1 = NEXTBYTE();
  c2 = NEXTBYTE();
  if (c1 != 0xFF || c2 != M_SOI)
    ERREXIT("Not a JPEG file");
  return c2;
}


/*
 * Most types of marker are followed by a variable-length parameter segment.
 * This routine skips over the parameters for any marker we don't otherwise
 * want to process.
 * Note that we MUST skip the parameter segment explicitly in order not to
 * be fooled by 0xFF bytes that might appear within the parameter segment;
 * such bytes do NOT introduce new markers.
 */

static void
skip_variable (void)
/* Skip over an unknown or uninteresting variable-length marker */
{
  unsigned int length;

  /* Get the marker parameter length count */
  length = read_2_bytes();
  /* Length includes itself, so must be at least 2 */
  if (length < 2)
    ERREXIT("Erroneous JPEG marker length");
  length -= 2;
  /* Skip over the remaining bytes */
  while (length > 0) {
    (void) read_1_byte();
    length--;
  }
}


/*
 * Process a COM marker.
 * We want to print out the marker contents as legible text;
 * we must guard against random junk and varying newline representations.
 */

static void
process_COM (void)
{
  unsigned int length;
  int ch;
  int lastch = 0;

  /* Get the marker parameter length count */
  length = read_2_bytes();
  /* Length includes itself, so must be at least 2 */
  if (length < 2)
    ERREXIT("Erroneous JPEG marker length");
  length -= 2;

  while (length > 0) {
    ch = read_1_byte();
    /* Emit the character in a readable form.
     * Nonprintables are converted to \nnn form,
     * while \ is converted to \\.
     * Newlines in CR, CR/LF, or LF form will be printed as one newline.
     */
    if (ch == '\r') {
      printf("\n");
    } else if (ch == '\n') {
      if (lastch != '\r')
	printf("\n");
    } else if (ch == '\\') {
      printf("\\\\");
    } else if (isprint(ch)) {
      putc(ch, stdout);
    } else {
      printf("\\%03o", ch);
    }
    lastch = ch;
    length--;
  }
  printf("\n");
}


/*
 * Process a SOFn marker.
 * This code is only needed if you want to know the image dimensions...
 */

static void
process_SOFn (int marker)
{
  unsigned int length;
  unsigned int image_height, image_width;
  int data_precision, num_components;
  const char * process;
  int ci;

  length = read_2_bytes();	/* usual parameter length count */

  data_precision = read_1_byte();
  image_height = read_2_bytes();
  image_width = read_2_bytes();
  num_components = read_1_byte();

  switch (marker) {
  case M_SOF0:	process = "Baseline";  break;
  case M_SOF1:	process = "Extended sequential";  break;
  case M_SOF2:	process = "Progressive";  break;
  case M_SOF3:	process = "Lossless";  break;
  case M_SOF5:	process = "Differential sequential";  break;
  case M_SOF6:	process = "Differential progressive";  break;
  case M_SOF7:	process = "Differential lossless";  break;
  case M_SOF9:	process = "Extended sequential, arithmetic coding";  break;
  case M_SOF10:	process = "Progressive, arithmetic coding";  break;
  case M_SOF11:	process = "Lossless, arithmetic coding";  break;
  case M_SOF13:	process = "Differential sequential, arithmetic coding";  break;
  case M_SOF14:	process = "Differential progressive, arithmetic coding"; break;
  case M_SOF15:	process = "Differential lossless, arithmetic coding";  break;
  default:	process = "Unknown";  break;
  }

  printf("JPEG image is %uw * %uh, %d color components, %d bits per sample\n",
	 image_width, image_height, num_components, data_precision);
  printf("JPEG process: %s\n", process);

  if (length != (unsigned int) (8 + num_components * 3))
    ERREXIT("Bogus SOF marker length");

  for (ci = 0; ci < num_components; ci++) {
    (void) read_1_byte();	/* Component ID code */
    (void) read_1_byte();	/* H, V sampling factors */
    (void) read_1_byte();	/* Quantization table number */
  }
}


/*
 * Parse the marker stream until SOS or EOI is seen;
 * display any COM markers.
 * While the companion program wrjpgcom will always insert COM markers before
 * SOFn, other implementations might not, so we scan to SOS before stopping.
 * If we were only interested in the image dimensions, we would stop at SOFn.
 * (Conversely, if we only cared about COM markers, there would be no need
 * for special code to handle SOFn; we could treat it like other markers.)
 */

static int
scan_JPEG_header (int verbose)
{
  int marker;

  /* Expect SOI at start of file */
  if (first_marker() != M_SOI)
    ERREXIT("Expected SOI marker first");

  /* Scan miscellaneous markers until we reach SOS. */
  for (;;) {
    marker = next_marker();
    switch (marker) {
    case M_SOF0:		/* Baseline */
    case M_SOF1:		/* Extended sequential, Huffman */
    case M_SOF2:		/* Progressive, Huffman */
    case M_SOF3:		/* Lossless, Huffman */
    case M_SOF5:		/* Differential sequential, Huffman */
    case M_SOF6:		/* Differential progressive, Huffman */
    case M_SOF7:		/* Differential lossless, Huffman */
    case M_SOF9:		/* Extended sequential, arithmetic */
    case M_SOF10:		/* Progressive, arithmetic */
    case M_SOF11:		/* Lossless, arithmetic */
    case M_SOF13:		/* Differential sequential, arithmetic */
    case M_SOF14:		/* Differential progressive, arithmetic */
    case M_SOF15:		/* Differential lossless, arithmetic */
      if (verbose)
	process_SOFn(marker);
      else
	skip_variable();
      break;

    case M_SOS:			/* stop before hitting compressed data */
      return marker;

    case M_EOI:			/* in case it's a tables-only JPEG stream */
      return marker;

    case M_COM:
      process_COM();
      break;

    default:			/* Anything else just gets skipped */
      skip_variable();		/* we assume it has a parameter count... */
      break;
    }
  } /* end loop */
}


/* Command line parsing code */

static const char * progname;	/* program name for error messages */


static void
usage (void)
/* complain about bad command line */
{
  fprintf(stderr, "rdjpgcom displays any textual comments in a JPEG file.\n");

  fprintf(stderr, "Usage: %s [switches] [inputfile]\n", progname);

  fprintf(stderr, "Switches (names may be abbreviated):\n");
  fprintf(stderr, "  -verbose    Also display dimensions of JPEG image\n");

  exit(EXIT_FAILURE);
}


static int
keymatch (char * arg, const char * keyword, int minchars)
/* Case-insensitive matching of (possibly abbreviated) keyword switches. */
/* keyword is the constant keyword (must be lower case already), */
/* minchars is length of minimum legal abbreviation. */
{
  register int ca, ck;
  register int nmatched = 0;

  while ((ca = *arg++) != '\0') {
    if ((ck = *keyword++) == '\0')
      return 0;			/* arg longer than keyword, no good */
    if (isupper(ca))		/* force arg to lcase (assume ck is already) */
      ca = tolower(ca);
    if (ca != ck)
      return 0;			/* no good */
    nmatched++;			/* count matched characters */
  }
  /* reached end of argument; fail if it's too short for unique abbrev */
  if (nmatched < minchars)
    return 0;
  return 1;			/* A-OK */
}


/*
 * The main program.
 */

int
main (int argc, char **argv)
{
  int argn;
  char * arg;
  int verbose = 0;

  /* On Mac, fetch a command line. */
#ifdef USE_CCOMMAND
  argc = ccommand(&argv);
#endif

  progname = argv[0];
  if (progname == NULL || progname[0] == 0)
    progname = "rdjpgcom";	/* in case C library doesn't provide it */

  /* Parse switches, if any */
  for (argn = 1; argn < argc; argn++) {
    arg = argv[argn];
    if (arg[0] != '-')
      break;			/* not switch, must be file name */
    arg++;			/* advance over '-' */
    if (keymatch(arg, "verbose", 1)) {
      verbose++;
    } else
      usage();
  }

  /* Open the input file. */
  /* Unix style: expect zero or one file name */
  if (argn < argc-1) {
    fprintf(stderr, "%s: only one input file\n", progname);
    usage();
  }
  if (argn < argc) {
    if ((infile = fopen(argv[argn], READ_BINARY)) == NULL) {
      fprintf(stderr, "%s: can't open %s\n", progname, argv[argn]);
      exit(EXIT_FAILURE);
    }
  } else {
    /* default input file is stdin */
#ifdef USE_SETMODE		/* need to hack file mode? */
    setmode(fileno(stdin), O_BINARY);
#endif
#ifdef USE_FDOPEN		/* need to re-open in binary mode? */
    if ((infile = fdopen(fileno(stdin), READ_BINARY)) == NULL) {
      fprintf(stderr, "%s: can't open stdin\n", progname);
      exit(EXIT_FAILURE);
    }
#else
    infile = stdin;
#endif
  }

  /* Scan the JPEG headers. */
  (void) scan_JPEG_header(verbose);

  /* All done. */
  exit(EXIT_SUCCESS);
  return 0;			/* suppress no-return-value warnings */
}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区三区中文字幕电影| 成人av在线影院| 日韩主播视频在线| 亚洲国产毛片aaaaa无费看| 亚洲乱码国产乱码精品精可以看 | 国产精品久久久久久久久久免费看| 26uuu国产一区二区三区| 欧美xxxxxxxx| 久久久五月婷婷| 精品国产免费视频| 26uuu成人网一区二区三区| 欧美精品一区二区久久婷婷| 久久久www免费人成精品| 国产色产综合产在线视频| 久久久99精品免费观看不卡| 欧美—级在线免费片| 日韩久久一区二区| 亚洲午夜在线电影| 久久精品久久综合| 国产乱一区二区| a级高清视频欧美日韩| 91久久国产最好的精华液| 欧美日韩专区在线| 91精品国产综合久久久久久久久久| 欧美一区日本一区韩国一区| 日韩免费在线观看| 欧美高清一级片在线观看| 亚洲人吸女人奶水| 首页亚洲欧美制服丝腿| 国产一区三区三区| 不卡影院免费观看| 欧美老肥妇做.爰bbww| 日韩欧美在线网站| 国产精品色婷婷| 性欧美大战久久久久久久久| 老司机精品视频一区二区三区| 国产高清一区日本| 色先锋资源久久综合| 91精品久久久久久蜜臀| 国产日产亚洲精品系列| 一区二区三区免费网站| 激情六月婷婷久久| 91天堂素人约啪| 欧美videos中文字幕| 国产精品久久久久桃色tv| 亚洲成人免费电影| 成人深夜在线观看| 51精品秘密在线观看| 国产片一区二区| 天堂资源在线中文精品| 成人免费高清在线观看| 欧美日韩视频在线观看一区二区三区 | 亚洲国产欧美在线人成| 国内不卡的二区三区中文字幕| 色综合天天做天天爱| 26uuu亚洲婷婷狠狠天堂| 亚洲精品成人精品456| 国模少妇一区二区三区| 欧美天堂亚洲电影院在线播放| 久久久亚洲精华液精华液精华液| 亚洲中国最大av网站| 懂色av一区二区夜夜嗨| 欧美精品三级日韩久久| 亚洲天堂成人在线观看| 国产麻豆欧美日韩一区| 欧美一级生活片| 亚洲猫色日本管| 国产成人av资源| 制服丝袜亚洲网站| 亚洲美女少妇撒尿| 粉嫩绯色av一区二区在线观看| 日韩亚洲欧美在线观看| 亚洲综合色婷婷| 99久久99久久综合| 国产午夜精品美女毛片视频| 青椒成人免费视频| 欧美日韩一区二区三区在线| 18成人在线观看| 东方欧美亚洲色图在线| 精品国产免费一区二区三区四区 | 99久久99久久久精品齐齐| www日韩大片| 日韩综合一区二区| 色欧美日韩亚洲| 亚洲欧美日本韩国| 成人精品一区二区三区四区| 国产丝袜在线精品| 国产精品亚洲综合一区在线观看| 日韩欧美国产精品| 美女诱惑一区二区| 91精品国产一区二区三区香蕉| 亚洲超碰97人人做人人爱| 日本电影亚洲天堂一区| ...xxx性欧美| 99综合电影在线视频| 中文子幕无线码一区tr| 成人网页在线观看| 国产精品久久久久9999吃药| 成人午夜视频网站| 国产精品久久三| 9i看片成人免费高清| 日韩久久一区二区| 日本国产一区二区| 一区二区三区毛片| 欧美在线免费观看亚洲| 亚洲网友自拍偷拍| 4438成人网| 久久国产成人午夜av影院| 欧美电影免费观看高清完整版在| 久久国产尿小便嘘嘘| 欧美精品一区二区三区高清aⅴ| 国产精品影视天天线| 欧美国产精品专区| 一本色道久久综合狠狠躁的推荐| 国产精品成人午夜| 91久久香蕉国产日韩欧美9色| 亚洲一区二区偷拍精品| 欧美日本精品一区二区三区| 三级欧美韩日大片在线看| 日韩精品一区二区三区在线 | 欧美性猛片aaaaaaa做受| 亚洲va韩国va欧美va| 欧美一区二区三区视频免费播放| 看电视剧不卡顿的网站| 国产日韩v精品一区二区| av在线播放不卡| 亚洲成av人片一区二区梦乃| 日韩视频免费观看高清完整版| 久久国产精品色| 日本一区二区高清| 欧美性猛片aaaaaaa做受| 久久国产成人午夜av影院| 国产精品卡一卡二卡三| 欧美性受xxxx黑人xyx性爽| 久久99国产精品久久99果冻传媒| 国产精品日日摸夜夜摸av| 色8久久人人97超碰香蕉987| 日韩精品一区第一页| 久久久精品天堂| 在线一区二区三区四区| 美女任你摸久久| 亚洲欧洲无码一区二区三区| 91精品一区二区三区在线观看| 国产一区二区三区免费观看| 日韩伦理av电影| 欧美电影免费观看高清完整版| 99国内精品久久| 蜜桃av一区二区| 亚洲三级在线免费| 日韩你懂的在线观看| 色婷婷国产精品综合在线观看| 男人的天堂久久精品| 国产精品高潮呻吟| 日韩欧美综合在线| 91麻豆免费观看| 激情图区综合网| 亚洲午夜精品一区二区三区他趣| 久久免费午夜影院| 欧美影院一区二区三区| 国产成人三级在线观看| 亚洲第一在线综合网站| 国产精品久久久久影院老司| 日韩欧美精品在线视频| 99re亚洲国产精品| 国产一区美女在线| 日韩中文欧美在线| 成人免费在线观看入口| 精品国产乱码久久久久久夜甘婷婷 | 成人黄色小视频| 六月婷婷色综合| 丝袜美腿一区二区三区| 亚洲精品欧美专区| 欧美极品xxx| 精品第一国产综合精品aⅴ| 欧美性色黄大片| 色欲综合视频天天天| 国产高清在线精品| 国内外精品视频| 日韩国产在线观看| 亚洲综合网站在线观看| 国产精品久99| 亚洲国产精品av| www激情久久| 欧美成人精精品一区二区频| 欧美人狂配大交3d怪物一区| 91福利在线观看| 99久久久无码国产精品| 成人免费高清在线观看| 国产电影一区二区三区| 精品夜夜嗨av一区二区三区| 日韩精品欧美成人高清一区二区| 国产精品久久久久精k8| 欧美激情中文不卡| 国产欧美综合在线观看第十页| 久久色.com| 久久一区二区三区四区| 欧美va亚洲va香蕉在线| 日韩精品中午字幕| 欧美成人性战久久| 精品国产91久久久久久久妲己 |