Skip to content

AFNI/NIfTI Server

Sections
Personal tools
You are here: Home » AFNI » Documentation

Doxygen Source Code Documentation


Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search  

jcapistd.c File Reference

#include "jinclude.h"
#include "jpeglib.h"

Go to the source code of this file.


Defines

#define JPEG_INTERNALS

Functions

 jpeg_start_compress (j_compress_ptr cinfo, boolean write_all_tables)
 jpeg_write_scanlines (j_compress_ptr cinfo, JSAMPARRAY scanlines, JDIMENSION num_lines)
 jpeg_write_raw_data (j_compress_ptr cinfo, JSAMPIMAGE data, JDIMENSION num_lines)

Define Documentation

#define JPEG_INTERNALS
 

Definition at line 17 of file jcapistd.c.


Function Documentation

jpeg_start_compress j_compress_ptr    cinfo,
boolean    write_all_tables
 

Definition at line 38 of file jcapistd.c.

References CSTATE_RAW_OK, CSTATE_SCANNING, CSTATE_START, jpeg_compress_struct::dest, ERREXIT1, jinit_compress_master(), jpeg_suppress_tables(), jpeg_compress_struct::master, jpeg_compress_struct::next_scanline, jpeg_compress_struct::raw_data_in, and write_all_tables.

Referenced by write_JPEG_file().

00039 {
00040   if (cinfo->global_state != CSTATE_START)
00041     ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
00042 
00043   if (write_all_tables)
00044     jpeg_suppress_tables(cinfo, FALSE); /* mark all tables to be written */
00045 
00046   /* (Re)initialize error mgr and destination modules */
00047   (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo);
00048   (*cinfo->dest->init_destination) (cinfo);
00049   /* Perform master selection of active modules */
00050   jinit_compress_master(cinfo);
00051   /* Set up for the first pass */
00052   (*cinfo->master->prepare_for_pass) (cinfo);
00053   /* Ready for application to drive first pass through jpeg_write_scanlines
00054    * or jpeg_write_raw_data.
00055    */
00056   cinfo->next_scanline = 0;
00057   cinfo->global_state = (cinfo->raw_data_in ? CSTATE_RAW_OK : CSTATE_SCANNING);
00058 }

jpeg_write_raw_data j_compress_ptr    cinfo,
JSAMPIMAGE    data,
JDIMENSION    num_lines
 

Definition at line 120 of file jcapistd.c.

References jpeg_comp_master::call_pass_startup, jpeg_compress_struct::coef, CSTATE_RAW_OK, ERREXIT, ERREXIT1, jpeg_compress_struct::image_height, JDIMENSION, JSAMPIMAGE, jpeg_compress_struct::master, jpeg_compress_struct::max_v_samp_factor, jpeg_compress_struct::next_scanline, num_lines, and WARNMS.

00122 {
00123   JDIMENSION lines_per_iMCU_row;
00124 
00125   if (cinfo->global_state != CSTATE_RAW_OK)
00126     ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
00127   if (cinfo->next_scanline >= cinfo->image_height) {
00128     WARNMS(cinfo, JWRN_TOO_MUCH_DATA);
00129     return 0;
00130   }
00131 
00132   /* Call progress monitor hook if present */
00133   if (cinfo->progress != NULL) {
00134     cinfo->progress->pass_counter = (long) cinfo->next_scanline;
00135     cinfo->progress->pass_limit = (long) cinfo->image_height;
00136     (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
00137   }
00138 
00139   /* Give master control module another chance if this is first call to
00140    * jpeg_write_raw_data.  This lets output of the frame/scan headers be
00141    * delayed so that application can write COM, etc, markers between
00142    * jpeg_start_compress and jpeg_write_raw_data.
00143    */
00144   if (cinfo->master->call_pass_startup)
00145     (*cinfo->master->pass_startup) (cinfo);
00146 
00147   /* Verify that at least one iMCU row has been passed. */
00148   lines_per_iMCU_row = cinfo->max_v_samp_factor * DCTSIZE;
00149   if (num_lines < lines_per_iMCU_row)
00150     ERREXIT(cinfo, JERR_BUFFER_SIZE);
00151 
00152   /* Directly compress the row. */
00153   if (! (*cinfo->coef->compress_data) (cinfo, data)) {
00154     /* If compressor did not consume the whole row, suspend processing. */
00155     return 0;
00156   }
00157 
00158   /* OK, we processed one iMCU row. */
00159   cinfo->next_scanline += lines_per_iMCU_row;
00160   return lines_per_iMCU_row;
00161 }

jpeg_write_scanlines j_compress_ptr    cinfo,
JSAMPARRAY    scanlines,
JDIMENSION    num_lines
 

Definition at line 77 of file jcapistd.c.

References jpeg_comp_master::call_pass_startup, CSTATE_SCANNING, ERREXIT1, jpeg_compress_struct::image_height, JDIMENSION, JSAMPARRAY, jpeg_compress_struct::main, jpeg_compress_struct::master, jpeg_compress_struct::next_scanline, num_lines, scanlines, and WARNMS.

Referenced by write_JPEG_file().

00079 {
00080   JDIMENSION row_ctr, rows_left;
00081 
00082   if (cinfo->global_state != CSTATE_SCANNING)
00083     ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
00084   if (cinfo->next_scanline >= cinfo->image_height)
00085     WARNMS(cinfo, JWRN_TOO_MUCH_DATA);
00086 
00087   /* Call progress monitor hook if present */
00088   if (cinfo->progress != NULL) {
00089     cinfo->progress->pass_counter = (long) cinfo->next_scanline;
00090     cinfo->progress->pass_limit = (long) cinfo->image_height;
00091     (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
00092   }
00093 
00094   /* Give master control module another chance if this is first call to
00095    * jpeg_write_scanlines.  This lets output of the frame/scan headers be
00096    * delayed so that application can write COM, etc, markers between
00097    * jpeg_start_compress and jpeg_write_scanlines.
00098    */
00099   if (cinfo->master->call_pass_startup)
00100     (*cinfo->master->pass_startup) (cinfo);
00101 
00102   /* Ignore any extra scanlines at bottom of image. */
00103   rows_left = cinfo->image_height - cinfo->next_scanline;
00104   if (num_lines > rows_left)
00105     num_lines = rows_left;
00106 
00107   row_ctr = 0;
00108   (*cinfo->main->process_data) (cinfo, scanlines, &row_ctr, num_lines);
00109   cinfo->next_scanline += row_ctr;
00110   return row_ctr;
00111 }
 

Powered by Plone

This site conforms to the following standards: