资源简介
Ubuntu交叉编译OpenCV时需要安装的zlib库,亲测可用。
代码片段和文件信息
/*
* cdjpeg.c
*
* Copyright (C) 1991-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 common support routines used by the IJG application
* programs (cjpeg djpeg jpegtran).
*/
#include “cdjpeg.h“ /* Common decls for cjpeg/djpeg applications */
#include /* to declare isupper() tolower() */
#ifdef NEED_SIGNAL_CATCHER
#include /* to declare signal() */
#endif
#ifdef USE_SETMODE
#include /* to declare setmode()‘s parameter macros */
/* If you have setmode() but not just delete this line: */
#include /* to declare setmode() */
#endif
/*
* Signal catcher to ensure that temporary files are removed before aborting.
* NB: for Amiga Manx C this is actually a global routine named _abort();
* we put “#define signal_catcher _abort“ in jconfig.h. Talk about bogus...
*/
#ifdef NEED_SIGNAL_CATCHER
static j_common_ptr sig_cinfo;
void /* must be global for Manx C */
signal_catcher (int signum)
{
if (sig_cinfo != NULL) {
if (sig_cinfo->err != NULL) /* turn off trace output */
sig_cinfo->err->trace_level = 0;
jpeg_destroy(sig_cinfo); /* clean up memory allocation & temp files */
}
exit(EXIT_FAILURE);
}
GLOBAL(void)
enable_signal_catcher (j_common_ptr cinfo)
{
sig_cinfo = cinfo;
#ifdef SIGINT /* not all systems have SIGINT */
signal(SIGINT signal_catcher);
#endif
#ifdef SIGTERM /* not all systems have SIGTERM */
signal(SIGTERM signal_catcher);
#endif
}
#endif
/*
* Optional progress monitor: display a percent-done figure on stderr.
*/
#ifdef PROGRESS_REPORT
METHODDEF(void)
progress_monitor (j_common_ptr cinfo)
{
cd_progress_ptr prog = (cd_progress_ptr) cinfo->progress;
int total_passes = prog->pub.total_passes + prog->total_extra_passes;
int percent_done = (int) (prog->pub.pass_counter*100L/prog->pub.pass_limit);
if (percent_done != prog->percent_done) {
prog->percent_done = percent_done;
if (total_passes > 1) {
fprintf(stderr “\rPass %d/%d: %3d%% “
prog->pub.completed_passes + prog->completed_extra_passes + 1
total_passes percent_done);
} else {
fprintf(stderr “\r %3d%% “ percent_done);
}
fflush(stderr);
}
}
GLOBAL(void)
start_progress_monitor (j_common_ptr cinfo cd_progress_ptr progress)
{
/* Enable progress display unless trace output is on */
if (cinfo->err->trace_level == 0) {
progress->pub.progress_monitor = progress_monitor;
progress->completed_extra_passes = 0;
progress->total_extra_passes = 0;
progress->percent_done = -1;
cinfo->progress = &progress->pub;
}
}
GLOBAL(void)
end_progress_monitor (j_common_ptr cinfo)
{
/* Clear away progress display */
if (cinfo->err->trace_level == 0) {
fprintf(stderr “\r \r“);
fflush(stderr);
}
}
#endif
/*
* Case-insensitive matching of possibly-abbrevi
评论
共有 条评论