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

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

?? rdjpgcom.c

?? JPEG source code converts the image into compressed format
?? C
字號:
/*
 * rdjpgcom.c
 *
 * Copyright (C) 1994-1997, 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
#ifdef VMS			/* VMS is very nonstandard */
#define READ_BINARY	"rb", "ctx=stm"
#else				/* standard ANSI-compliant case */
#define READ_BINARY	"rb"
#endif
#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_APP0	0xE0		/* Application-specific marker, type N */
#define M_APP12	0xEC		/* (we don't bother to list all 16 APPn's) */
#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 non-text 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) {
      /* Note that marker codes 0xC4, 0xC8, 0xCC are not, and must not be,
       * treated as SOFn.  C4 in particular is actually DHT.
       */
    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;

    case M_APP12:
      /* Some digital camera makers put useful textual information into
       * APP12 markers, so we print those out too when in -verbose mode.
       */
      if (verbose) {
	printf("APP12 contains:\n");
	process_COM();
      } else
	skip_variable();
      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 */
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩三区在线观看| 一区二区高清视频在线观看| 欧美高清在线视频| 欧美日本精品一区二区三区| 国产日韩欧美a| 日韩精品一二三四| 在线这里只有精品| 欧美国产精品一区二区三区| 日韩极品在线观看| 欧美色精品天天在线观看视频| 91香蕉视频在线| 色婷婷国产精品综合在线观看| 99精品欧美一区二区三区小说 | 99久久免费精品| 精品国产亚洲一区二区三区在线观看| 欧美大白屁股肥臀xxxxxx| 亚洲欧美激情视频在线观看一区二区三区| 中文在线一区二区| 一区二区三区日本| 成人性生交大片免费看视频在线| 91丨九色丨国产丨porny| caoporen国产精品视频| 精品99久久久久久| 全国精品久久少妇| 3751色影院一区二区三区| 亚洲欧美一区二区三区极速播放| 亚洲电影激情视频网站| 色综合久久中文综合久久牛| 国产精品视频在线看| 国产九色精品成人porny| 日韩一区二区三区在线| 日韩国产在线观看| 欧美日韩精品久久久| 亚洲va欧美va天堂v国产综合| 精品伊人久久久久7777人| 5858s免费视频成人| 奇米色一区二区| 日韩一区二区在线看片| 男女男精品视频网| 精品av久久707| 国产高清不卡一区| 欧美国产乱子伦| 99久久精品国产导航| 亚洲精品国产一区二区精华液| 天堂蜜桃91精品| 欧美一区二区三区电影| 蜜臀av性久久久久av蜜臀妖精 | 一区二区视频在线| 日本精品免费观看高清观看| 亚洲一区二区三区在线| 欧美日韩国产高清一区| 视频精品一区二区| 欧美大黄免费观看| 成人av在线资源网| 亚洲一区二区三区四区在线免费观看| 久久99国内精品| 久久久精品影视| 91在线精品一区二区| 又紧又大又爽精品一区二区| 欧美日韩午夜在线| 国产乱国产乱300精品| 欧美日韩国产免费一区二区| 九九视频精品免费| 亚洲欧美综合另类在线卡通| 欧洲亚洲国产日韩| 国精产品一区一区三区mba桃花| 日本福利一区二区| 蜜桃久久久久久| 国产精品高潮呻吟| 欧美狂野另类xxxxoooo| 国产成a人亚洲精| 一区二区三区91| 国产亚洲婷婷免费| 国产在线日韩欧美| 亚洲一区视频在线| 久久精品人人做人人爽人人| 在线精品视频一区二区| 国内精品伊人久久久久av一坑| 日韩午夜在线播放| 色综合久久久久久久久久久| 免费成人美女在线观看| 国产精品国产三级国产三级人妇| 福利91精品一区二区三区| 午夜伊人狠狠久久| 欧美日本韩国一区二区三区视频| 亚洲成人一二三| 国产精品区一区二区三区| 欧美日韩一区精品| 91原创在线视频| 国产激情视频一区二区三区欧美 | 精品一区二区在线免费观看| 综合自拍亚洲综合图不卡区| 欧美大片在线观看| 制服丝袜亚洲色图| 欧美亚洲国产一区在线观看网站| 一区二区三区高清| 国产日韩在线不卡| 欧美电影免费观看完整版| 91黄视频在线观看| 99久久精品国产观看| 国产精品99久久久久久似苏梦涵 | 不卡欧美aaaaa| 一区二区三区四区不卡在线 | 亚洲成av人片在线观看| 国产欧美日韩卡一| 一本到高清视频免费精品| 国产成人免费视| 国产乱人伦偷精品视频不卡| 亚洲欧洲www| 国产三级一区二区| 久久无码av三级| 日本丰满少妇一区二区三区| 成人h动漫精品一区二区| 成人精品鲁一区一区二区| 国产精品一二三在| 国产不卡免费视频| 成人免费不卡视频| 成人免费视频一区二区| 成人综合日日夜夜| eeuss鲁一区二区三区| zzijzzij亚洲日本少妇熟睡| 成人av网址在线观看| 成人性视频免费网站| 日日夜夜精品视频天天综合网| 国产三级一区二区| 国产午夜精品久久| 欧美丰满高潮xxxx喷水动漫| 欧美高清你懂得| 91精品国产综合久久久久久久久久| 国产不卡视频在线播放| 成人毛片视频在线观看| 99国产精品久久久久| 色香蕉久久蜜桃| 欧美精品自拍偷拍| 精品欧美一区二区在线观看| 久久一夜天堂av一区二区三区| 精品视频一区 二区 三区| 欧美亚洲日本国产| 91丨porny丨蝌蚪视频| 欧美性猛交xxxx乱大交退制版 | 在线观看视频91| 欧美精品国产精品| 欧美精品一区二区三区蜜臀| 国产精品久久久久久久久久久免费看| 欧美一区二区三区的| 久久久国际精品| 91精品国产日韩91久久久久久| 91性感美女视频| 高清在线不卡av| 日本韩国精品一区二区在线观看| www.日韩av| 欧美日韩国产色站一区二区三区| 99精品视频一区二区| 91麻豆精品国产91久久久久| 久久久久久久久蜜桃| 亚洲综合在线五月| 国内精品视频一区二区三区八戒| 日本一不卡视频| 国产成人免费视频网站| 国产精品一区二区男女羞羞无遮挡| 日本不卡在线视频| jlzzjlzz欧美大全| 99久免费精品视频在线观看| 欧美理论在线播放| 国产精品乱人伦| 国产精品国产三级国产aⅴ入口 | 国产成人福利片| 欧美综合亚洲图片综合区| 精品福利视频一区二区三区| 亚洲人成精品久久久久| 韩国v欧美v亚洲v日本v| 在线观看精品一区| 欧美精品123区| 一区在线中文字幕| 久久精品国产一区二区三 | 亚洲大型综合色站| 成人免费视频app| 精品国产伦一区二区三区观看体验| 日韩欧美国产一二三区| 亚洲男人都懂的| 粉嫩av一区二区三区粉嫩 | 91精品国产高清一区二区三区蜜臀| 欧美久久高跟鞋激| 亚洲免费高清视频在线| 狠狠色综合日日| 555www色欧美视频| www久久久久| 日本不卡的三区四区五区| 欧美午夜精品久久久久久超碰| 欧美一级二级三级蜜桃| 26uuu色噜噜精品一区二区| 爽爽淫人综合网网站| 国产精品一线二线三线| 日韩一区二区三区在线观看| 亚洲v中文字幕| 国产v综合v亚洲欧| 久久久蜜桃精品| 激情都市一区二区| 欧美大黄免费观看| 激情另类小说区图片区视频区|