Skip to content
Snippets Groups Projects
Select Git revision
  • 00ff5ed746a28f9884a18c388b8e49d9fde8baf4
  • master default
  • library-names
  • fix_script_header
  • fix_libdir
  • fix_cmake_hdf5
  • partition
  • cgnsUnstructured
  • partitioning
  • HighOrderBLCurving
  • gmsh_3_0_5
  • gmsh_3_0_4
  • gmsh_3_0_3
  • gmsh_3_0_2
  • gmsh_3_0_1
  • gmsh_3_0_0
  • gmsh_2_16_0
  • gmsh_2_15_0
  • gmsh_2_14_1
  • gmsh_2_14_0
  • gmsh_2_13_2
  • gmsh_2_13_1
  • gmsh_2_12_0
  • gmsh_2_11_0
  • gmsh_2_10_1
  • gmsh_2_10_0
  • gmsh_2_9_3
  • gmsh_2_9_2
  • gmsh_2_9_1
  • gmsh_2_9_0
30 results

CbFile.cpp

Blame
  • Forked from gmsh / gmsh
    Source project has a limited visibility.
    jchuff.c 24.77 KiB
    /*
     * jchuff.c
     *
     * Copyright (C) 1991-1994, 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 Huffman entropy encoding routines.
     *
     * Much of the complexity here has to do with supporting output suspension.
     * If the data destination module demands suspension, we want to be able to
     * back up to the start of the current MCU.  To do this, we copy state
     * variables into local working storage, and update them back to the
     * permanent JPEG objects only upon successful completion of an MCU.
     */
    
    #define JPEG_INTERNALS
    #include "jinclude.h"
    #include "jpeglib.h"
    
    
    /* Derived data constructed for each Huffman table */
    
    typedef struct {
      unsigned int ehufco[256];	/* code for each symbol */
      char ehufsi[256];		/* length of code for each symbol */
      /* If no code has been allocated for a symbol S, ehufsi[S] contains 0 */
    } C_DERIVED_TBL;
    
    /* Expanded entropy encoder object for Huffman encoding.
     *
     * The savable_state subrecord contains fields that change within an MCU,
     * but must not be updated permanently until we complete the MCU.
     */
    
    typedef struct {
      INT32 put_buffer;		/* current bit-accumulation buffer */
      int put_bits;			/* # of bits now in it */
      int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */
    } savable_state;
    
    /* This macro is to work around compilers with missing or broken
     * structure assignment.  You'll need to fix this code if you have
     * such a compiler and you change MAX_COMPS_IN_SCAN.
     */
    
    #ifndef NO_STRUCT_ASSIGN
    #define ASSIGN_STATE(dest,src)  ((dest) = (src))
    #else
    #if MAX_COMPS_IN_SCAN == 4
    #define ASSIGN_STATE(dest,src)  \
    	((dest).put_buffer = (src).put_buffer, \
    	 (dest).put_bits = (src).put_bits, \
    	 (dest).last_dc_val[0] = (src).last_dc_val[0], \
    	 (dest).last_dc_val[1] = (src).last_dc_val[1], \
    	 (dest).last_dc_val[2] = (src).last_dc_val[2], \
    	 (dest).last_dc_val[3] = (src).last_dc_val[3])
    #endif
    #endif
    
    
    typedef struct {
      struct jpeg_entropy_encoder pub; /* public fields */
    
      savable_state saved;		/* Bit buffer & DC state at start of MCU */
    
      /* These fields are NOT loaded into local working state. */
      unsigned int restarts_to_go;	/* MCUs left in this restart interval */
      int next_restart_num;		/* next restart number to write (0-7) */