< prev index next >

modules/javafx.graphics/src/main/native-iio/libjpeg7/jdtrans.c

Print this page


   1 /*
   2  * jdtrans.c
   3  *
   4  * Copyright (C) 1995-1997, Thomas G. Lane.

   5  * This file is part of the Independent JPEG Group's software.
   6  * For conditions of distribution and use, see the accompanying README file.
   7  *
   8  * This file contains library routines for transcoding decompression,
   9  * that is, reading raw DCT coefficient arrays from an input JPEG file.
  10  * The routines in jdapimin.c will also be needed by a transcoder.
  11  */
  12 
  13 #define JPEG_INTERNALS
  14 #include "jinclude.h"
  15 #include "jpeglib.h"
  16 
  17 
  18 /* Forward declarations */
  19 LOCAL(void) transdecode_master_selection JPP((j_decompress_ptr cinfo));
  20 
  21 
  22 /*
  23  * Read the coefficient arrays from a JPEG file.
  24  * jpeg_read_header must be completed before calling this.


  81   if ((cinfo->global_state == DSTATE_STOPPING ||
  82        cinfo->global_state == DSTATE_BUFIMAGE) && cinfo->buffered_image) {
  83     return cinfo->coef->coef_arrays;
  84   }
  85   /* Oops, improper usage */
  86   ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  87   return NULL;                  /* keep compiler happy */
  88 }
  89 
  90 
  91 /*
  92  * Master selection of decompression modules for transcoding.
  93  * This substitutes for jdmaster.c's initialization of the full decompressor.
  94  */
  95 
  96 LOCAL(void)
  97 transdecode_master_selection (j_decompress_ptr cinfo)
  98 {
  99   /* This is effectively a buffered-image operation. */
 100   cinfo->buffered_image = TRUE;



 101 
 102   /* Entropy decoding: either Huffman or arithmetic coding. */
 103   if (cinfo->arith_code)
 104     ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
 105   else {
 106     jinit_huff_decoder(cinfo);
 107   }
 108 
 109   /* Always get a full-image coefficient buffer. */
 110   jinit_d_coef_controller(cinfo, TRUE);
 111 
 112   /* We can now tell the memory manager to allocate virtual arrays. */
 113   (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo);
 114 
 115   /* Initialize input side of decompressor to consume first scan. */
 116   (*cinfo->inputctl->start_input_pass) (cinfo);
 117 
 118   /* Initialize progress monitoring. */
 119   if (cinfo->progress != NULL) {
 120     int nscans;
   1 /*
   2  * jdtrans.c
   3  *
   4  * Copyright (C) 1995-1997, Thomas G. Lane.
   5  * Modified 2000-2009 by Guido Vollbeding.
   6  * This file is part of the Independent JPEG Group's software.
   7  * For conditions of distribution and use, see the accompanying README file.
   8  *
   9  * This file contains library routines for transcoding decompression,
  10  * that is, reading raw DCT coefficient arrays from an input JPEG file.
  11  * The routines in jdapimin.c will also be needed by a transcoder.
  12  */
  13 
  14 #define JPEG_INTERNALS
  15 #include "jinclude.h"
  16 #include "jpeglib.h"
  17 
  18 
  19 /* Forward declarations */
  20 LOCAL(void) transdecode_master_selection JPP((j_decompress_ptr cinfo));
  21 
  22 
  23 /*
  24  * Read the coefficient arrays from a JPEG file.
  25  * jpeg_read_header must be completed before calling this.


  82   if ((cinfo->global_state == DSTATE_STOPPING ||
  83        cinfo->global_state == DSTATE_BUFIMAGE) && cinfo->buffered_image) {
  84     return cinfo->coef->coef_arrays;
  85   }
  86   /* Oops, improper usage */
  87   ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  88   return NULL;                  /* keep compiler happy */
  89 }
  90 
  91 
  92 /*
  93  * Master selection of decompression modules for transcoding.
  94  * This substitutes for jdmaster.c's initialization of the full decompressor.
  95  */
  96 
  97 LOCAL(void)
  98 transdecode_master_selection (j_decompress_ptr cinfo)
  99 {
 100   /* This is effectively a buffered-image operation. */
 101   cinfo->buffered_image = TRUE;
 102 
 103   /* Compute output image dimensions and related values. */
 104   jpeg_core_output_dimensions(cinfo);
 105 
 106   /* Entropy decoding: either Huffman or arithmetic coding. */
 107   if (cinfo->arith_code)
 108     ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
 109   else {
 110     jinit_huff_decoder(cinfo);
 111   }
 112 
 113   /* Always get a full-image coefficient buffer. */
 114   jinit_d_coef_controller(cinfo, TRUE);
 115 
 116   /* We can now tell the memory manager to allocate virtual arrays. */
 117   (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo);
 118 
 119   /* Initialize input side of decompressor to consume first scan. */
 120   (*cinfo->inputctl->start_input_pass) (cinfo);
 121 
 122   /* Initialize progress monitoring. */
 123   if (cinfo->progress != NULL) {
 124     int nscans;
< prev index next >