Final 350 project
Dependencies: uzair Camera_LS_Y201 F7_Ethernet LCD_DISCO_F746NG NetworkAPI SDFileSystem mbed
jcinit.c
00001 /* 00002 * jcinit.c 00003 * 00004 * Copyright (C) 1991-1997, Thomas G. Lane. 00005 * Modified 2003-2013 by Guido Vollbeding. 00006 * This file is part of the Independent JPEG Group's software. 00007 * For conditions of distribution and use, see the accompanying README file. 00008 * 00009 * This file contains initialization logic for the JPEG compressor. 00010 * This routine is in charge of selecting the modules to be executed and 00011 * making an initialization call to each one. 00012 * 00013 * Logically, this code belongs in jcmaster.c. It's split out because 00014 * linking this routine implies linking the entire compression library. 00015 * For a transcoding-only application, we want to be able to use jcmaster.c 00016 * without linking in the whole library. 00017 */ 00018 00019 #define JPEG_INTERNALS 00020 #include "jinclude.h" 00021 #include "jpeglib.h" 00022 00023 00024 /* 00025 * Master selection of compression modules. 00026 * This is done once at the start of processing an image. We determine 00027 * which modules will be used and give them appropriate initialization calls. 00028 */ 00029 00030 GLOBAL(void) 00031 jinit_compress_master (j_compress_ptr cinfo) 00032 { 00033 long samplesperrow; 00034 JDIMENSION jd_samplesperrow; 00035 00036 /* For now, precision must match compiled-in value... */ 00037 if (cinfo->data_precision != BITS_IN_JSAMPLE) 00038 ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision); 00039 00040 /* Sanity check on image dimensions */ 00041 if (cinfo->image_height <= 0 || cinfo->image_width <= 0 || 00042 cinfo->input_components <= 0) 00043 ERREXIT(cinfo, JERR_EMPTY_IMAGE); 00044 00045 /* Width of an input scanline must be representable as JDIMENSION. */ 00046 samplesperrow = (long) cinfo->image_width * (long) cinfo->input_components; 00047 jd_samplesperrow = (JDIMENSION) samplesperrow; 00048 if ((long) jd_samplesperrow != samplesperrow) 00049 ERREXIT(cinfo, JERR_WIDTH_OVERFLOW); 00050 00051 /* Initialize master control (includes parameter checking/processing) */ 00052 jinit_c_master_control(cinfo, FALSE /* full compression */); 00053 00054 /* Preprocessing */ 00055 if (! cinfo->raw_data_in) { 00056 jinit_color_converter(cinfo); 00057 jinit_downsampler(cinfo); 00058 jinit_c_prep_controller(cinfo, FALSE /* never need full buffer here */); 00059 } 00060 /* Forward DCT */ 00061 jinit_forward_dct(cinfo); 00062 /* Entropy encoding: either Huffman or arithmetic coding. */ 00063 if (cinfo->arith_code) 00064 jinit_arith_encoder(cinfo); 00065 else { 00066 jinit_huff_encoder(cinfo); 00067 } 00068 00069 /* Need a full-image coefficient buffer in any multi-pass mode. */ 00070 jinit_c_coef_controller(cinfo, 00071 (boolean) (cinfo->num_scans > 1 || cinfo->optimize_coding)); 00072 jinit_c_main_controller(cinfo, FALSE /* never need full buffer here */); 00073 00074 jinit_marker_writer(cinfo); 00075 00076 /* We can now tell the memory manager to allocate virtual arrays. */ 00077 (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo); 00078 00079 /* Write the datastream header (SOI) immediately. 00080 * Frame and scan headers are postponed till later. 00081 * This lets application insert special markers after the SOI. 00082 */ 00083 (*cinfo->marker->write_file_header) (cinfo); 00084 }
Generated on Wed Jul 13 2022 18:56:09 by 1.7.2