-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1.引入开源库sqlite3、turbojpeg。 2.支持写入mp3封面图片。 3.解决下载信息窗口码率下拉列表显示的bug。
- Loading branch information
Showing
46 changed files
with
22,950 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
/* | ||
* cderror.h | ||
* | ||
* This file was part of the Independent JPEG Group's software: | ||
* Copyright (C) 1994-1997, Thomas G. Lane. | ||
* Modified 2009-2017 by Guido Vollbeding. | ||
* libjpeg-turbo Modifications: | ||
* Copyright (C) 2021, D. R. Commander. | ||
* For conditions of distribution and use, see the accompanying README.ijg | ||
* file. | ||
* | ||
* This file defines the error and message codes for the cjpeg/djpeg | ||
* applications. These strings are not needed as part of the JPEG library | ||
* proper. | ||
* Edit this file to add new codes, or to translate the message strings to | ||
* some other language. | ||
*/ | ||
|
||
/* | ||
* To define the enum list of message codes, include this file without | ||
* defining macro JMESSAGE. To create a message string table, include it | ||
* again with a suitable JMESSAGE definition (see jerror.c for an example). | ||
*/ | ||
#ifndef JMESSAGE | ||
#ifndef CDERROR_H | ||
#define CDERROR_H | ||
/* First time through, define the enum list */ | ||
#define JMAKE_ENUM_LIST | ||
#else | ||
/* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */ | ||
#define JMESSAGE(code, string) | ||
#endif /* CDERROR_H */ | ||
#endif /* JMESSAGE */ | ||
|
||
#ifdef JMAKE_ENUM_LIST | ||
|
||
typedef enum { | ||
|
||
#define JMESSAGE(code, string) code, | ||
|
||
#endif /* JMAKE_ENUM_LIST */ | ||
|
||
JMESSAGE(JMSG_FIRSTADDONCODE = 1000, NULL) /* Must be first entry! */ | ||
|
||
#ifdef BMP_SUPPORTED | ||
JMESSAGE(JERR_BMP_BADCMAP, "Unsupported BMP colormap format") | ||
JMESSAGE(JERR_BMP_BADDEPTH, "Only 8-, 24-, and 32-bit BMP files are supported") | ||
JMESSAGE(JERR_BMP_BADHEADER, "Invalid BMP file: bad header length") | ||
JMESSAGE(JERR_BMP_BADPLANES, "Invalid BMP file: biPlanes not equal to 1") | ||
JMESSAGE(JERR_BMP_COLORSPACE, "BMP output must be grayscale or RGB") | ||
JMESSAGE(JERR_BMP_COMPRESSED, "Sorry, compressed BMPs not yet supported") | ||
JMESSAGE(JERR_BMP_EMPTY, "Empty BMP image") | ||
JMESSAGE(JERR_BMP_NOT, "Not a BMP file - does not start with BM") | ||
JMESSAGE(JERR_BMP_OUTOFRANGE, "Numeric value out of range in BMP file") | ||
JMESSAGE(JTRC_BMP, "%ux%u %d-bit BMP image") | ||
JMESSAGE(JTRC_BMP_MAPPED, "%ux%u 8-bit colormapped BMP image") | ||
JMESSAGE(JTRC_BMP_OS2, "%ux%u %d-bit OS2 BMP image") | ||
JMESSAGE(JTRC_BMP_OS2_MAPPED, "%ux%u 8-bit colormapped OS2 BMP image") | ||
#endif /* BMP_SUPPORTED */ | ||
|
||
#ifdef GIF_SUPPORTED | ||
JMESSAGE(JERR_GIF_BUG, "GIF output got confused") | ||
JMESSAGE(JERR_GIF_CODESIZE, "Bogus GIF codesize %d") | ||
JMESSAGE(JERR_GIF_COLORSPACE, "GIF output must be grayscale or RGB") | ||
JMESSAGE(JERR_GIF_EMPTY, "Empty GIF image") | ||
JMESSAGE(JERR_GIF_IMAGENOTFOUND, "Too few images in GIF file") | ||
JMESSAGE(JERR_GIF_NOT, "Not a GIF file") | ||
JMESSAGE(JTRC_GIF, "%ux%ux%d GIF image") | ||
JMESSAGE(JTRC_GIF_BADVERSION, | ||
"Warning: unexpected GIF version number '%c%c%c'") | ||
JMESSAGE(JTRC_GIF_EXTENSION, "Ignoring GIF extension block of type 0x%02x") | ||
JMESSAGE(JTRC_GIF_NONSQUARE, "Caution: nonsquare pixels in input") | ||
JMESSAGE(JWRN_GIF_BADDATA, "Corrupt data in GIF file") | ||
JMESSAGE(JWRN_GIF_CHAR, "Bogus char 0x%02x in GIF file, ignoring") | ||
JMESSAGE(JWRN_GIF_ENDCODE, "Premature end of GIF image") | ||
JMESSAGE(JWRN_GIF_NOMOREDATA, "Ran out of GIF bits") | ||
#endif /* GIF_SUPPORTED */ | ||
|
||
#ifdef PPM_SUPPORTED | ||
JMESSAGE(JERR_PPM_COLORSPACE, "PPM output must be grayscale or RGB") | ||
JMESSAGE(JERR_PPM_NONNUMERIC, "Nonnumeric data in PPM file") | ||
JMESSAGE(JERR_PPM_NOT, "Not a PPM/PGM file") | ||
JMESSAGE(JERR_PPM_OUTOFRANGE, "Numeric value out of range in PPM file") | ||
JMESSAGE(JTRC_PGM, "%ux%u PGM image") | ||
JMESSAGE(JTRC_PGM_TEXT, "%ux%u text PGM image") | ||
JMESSAGE(JTRC_PPM, "%ux%u PPM image") | ||
JMESSAGE(JTRC_PPM_TEXT, "%ux%u text PPM image") | ||
#endif /* PPM_SUPPORTED */ | ||
|
||
#ifdef TARGA_SUPPORTED | ||
JMESSAGE(JERR_TGA_BADCMAP, "Unsupported Targa colormap format") | ||
JMESSAGE(JERR_TGA_BADPARMS, "Invalid or unsupported Targa file") | ||
JMESSAGE(JERR_TGA_COLORSPACE, "Targa output must be grayscale or RGB") | ||
JMESSAGE(JTRC_TGA, "%ux%u RGB Targa image") | ||
JMESSAGE(JTRC_TGA_GRAY, "%ux%u grayscale Targa image") | ||
JMESSAGE(JTRC_TGA_MAPPED, "%ux%u colormapped Targa image") | ||
#else | ||
JMESSAGE(JERR_TGA_NOTCOMP, "Targa support was not compiled") | ||
#endif /* TARGA_SUPPORTED */ | ||
|
||
JMESSAGE(JERR_BAD_CMAP_FILE, | ||
"Color map file is invalid or of unsupported format") | ||
JMESSAGE(JERR_TOO_MANY_COLORS, | ||
"Output file format cannot handle %d colormap entries") | ||
JMESSAGE(JERR_UNGETC_FAILED, "ungetc failed") | ||
#ifdef TARGA_SUPPORTED | ||
JMESSAGE(JERR_UNKNOWN_FORMAT, | ||
"Unrecognized input file format --- perhaps you need -targa") | ||
#else | ||
JMESSAGE(JERR_UNKNOWN_FORMAT, "Unrecognized input file format") | ||
#endif | ||
JMESSAGE(JERR_UNSUPPORTED_FORMAT, "Unsupported output file format") | ||
|
||
#ifdef JMAKE_ENUM_LIST | ||
|
||
JMSG_LASTADDONCODE | ||
} ADDON_MESSAGE_CODE; | ||
|
||
#undef JMAKE_ENUM_LIST | ||
#endif /* JMAKE_ENUM_LIST */ | ||
|
||
/* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ | ||
#undef JMESSAGE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
/* | ||
* cdjpeg.h | ||
* | ||
* This file was part of the Independent JPEG Group's software: | ||
* Copyright (C) 1994-1997, Thomas G. Lane. | ||
* Modified 2019 by Guido Vollbeding. | ||
* libjpeg-turbo Modifications: | ||
* Copyright (C) 2017, 2019, 2021, D. R. Commander. | ||
* For conditions of distribution and use, see the accompanying README.ijg | ||
* file. | ||
* | ||
* This file contains common declarations for the sample applications | ||
* cjpeg and djpeg. It is NOT used by the core JPEG library. | ||
*/ | ||
|
||
#define JPEG_CJPEG_DJPEG /* define proper options in jconfig.h */ | ||
#define JPEG_INTERNAL_OPTIONS /* cjpeg.c,djpeg.c need to see xxx_SUPPORTED */ | ||
#include "jinclude.h" | ||
#include "jpeglib.h" | ||
#include "jerror.h" /* get library error codes too */ | ||
#include "cderror.h" /* get application-specific error codes */ | ||
|
||
|
||
/* | ||
* Object interface for cjpeg's source file decoding modules | ||
*/ | ||
|
||
typedef struct cjpeg_source_struct *cjpeg_source_ptr; | ||
|
||
struct cjpeg_source_struct { | ||
void (*start_input) (j_compress_ptr cinfo, cjpeg_source_ptr sinfo); | ||
JDIMENSION (*get_pixel_rows) (j_compress_ptr cinfo, cjpeg_source_ptr sinfo); | ||
void (*finish_input) (j_compress_ptr cinfo, cjpeg_source_ptr sinfo); | ||
|
||
FILE *input_file; | ||
|
||
JSAMPARRAY buffer; | ||
JDIMENSION buffer_height; | ||
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION | ||
JDIMENSION max_pixels; | ||
#endif | ||
}; | ||
|
||
|
||
/* | ||
* Object interface for djpeg's output file encoding modules | ||
*/ | ||
|
||
typedef struct djpeg_dest_struct *djpeg_dest_ptr; | ||
|
||
struct djpeg_dest_struct { | ||
/* start_output is called after jpeg_start_decompress finishes. | ||
* The color map will be ready at this time, if one is needed. | ||
*/ | ||
void (*start_output) (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo); | ||
/* Emit the specified number of pixel rows from the buffer. */ | ||
void (*put_pixel_rows) (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, | ||
JDIMENSION rows_supplied); | ||
/* Finish up at the end of the image. */ | ||
void (*finish_output) (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo); | ||
/* Re-calculate buffer dimensions based on output dimensions (for use with | ||
partial image decompression.) If this is NULL, then the output format | ||
does not support partial image decompression (BMP, in particular, cannot | ||
support partial decompression because it uses an inversion buffer to write | ||
the image in bottom-up order.) */ | ||
void (*calc_buffer_dimensions) (j_decompress_ptr cinfo, | ||
djpeg_dest_ptr dinfo); | ||
|
||
|
||
/* Target file spec; filled in by djpeg.c after object is created. */ | ||
FILE *output_file; | ||
|
||
/* Output pixel-row buffer. Created by module init or start_output. | ||
* Width is cinfo->output_width * cinfo->output_components; | ||
* height is buffer_height. | ||
*/ | ||
JSAMPARRAY buffer; | ||
JDIMENSION buffer_height; | ||
}; | ||
|
||
|
||
/* | ||
* cjpeg/djpeg may need to perform extra passes to convert to or from | ||
* the source/destination file format. The JPEG library does not know | ||
* about these passes, but we'd like them to be counted by the progress | ||
* monitor. We use an expanded progress monitor object to hold the | ||
* additional pass count. | ||
*/ | ||
|
||
struct cdjpeg_progress_mgr { | ||
struct jpeg_progress_mgr pub; /* fields known to JPEG library */ | ||
int completed_extra_passes; /* extra passes completed */ | ||
int total_extra_passes; /* total extra */ | ||
JDIMENSION max_scans; /* abort if the number of scans exceeds this | ||
value and the value is non-zero */ | ||
boolean report; /* whether or not to report progress */ | ||
/* last printed percentage stored here to avoid multiple printouts */ | ||
int percent_done; | ||
}; | ||
|
||
typedef struct cdjpeg_progress_mgr *cd_progress_ptr; | ||
|
||
|
||
/* Module selection routines for I/O modules. */ | ||
|
||
EXTERN(cjpeg_source_ptr) jinit_read_bmp(j_compress_ptr cinfo, | ||
boolean use_inversion_array); | ||
EXTERN(djpeg_dest_ptr) jinit_write_bmp(j_decompress_ptr cinfo, boolean is_os2, | ||
boolean use_inversion_array); | ||
EXTERN(cjpeg_source_ptr) jinit_read_gif(j_compress_ptr cinfo); | ||
EXTERN(djpeg_dest_ptr) jinit_write_gif(j_decompress_ptr cinfo, boolean is_lzw); | ||
EXTERN(cjpeg_source_ptr) jinit_read_ppm(j_compress_ptr cinfo); | ||
EXTERN(djpeg_dest_ptr) jinit_write_ppm(j_decompress_ptr cinfo); | ||
EXTERN(cjpeg_source_ptr) jinit_read_targa(j_compress_ptr cinfo); | ||
EXTERN(djpeg_dest_ptr) jinit_write_targa(j_decompress_ptr cinfo); | ||
|
||
/* cjpeg support routines (in rdswitch.c) */ | ||
|
||
EXTERN(boolean) read_quant_tables(j_compress_ptr cinfo, char *filename, | ||
boolean force_baseline); | ||
EXTERN(boolean) read_scan_script(j_compress_ptr cinfo, char *filename); | ||
EXTERN(boolean) set_quality_ratings(j_compress_ptr cinfo, char *arg, | ||
boolean force_baseline); | ||
EXTERN(boolean) set_quant_slots(j_compress_ptr cinfo, char *arg); | ||
EXTERN(boolean) set_sample_factors(j_compress_ptr cinfo, char *arg); | ||
|
||
/* djpeg support routines (in rdcolmap.c) */ | ||
|
||
EXTERN(void) read_color_map(j_decompress_ptr cinfo, FILE *infile); | ||
|
||
/* common support routines (in cdjpeg.c) */ | ||
|
||
EXTERN(void) start_progress_monitor(j_common_ptr cinfo, | ||
cd_progress_ptr progress); | ||
EXTERN(void) end_progress_monitor(j_common_ptr cinfo); | ||
EXTERN(boolean) keymatch(char *arg, const char *keyword, int minchars); | ||
EXTERN(FILE *) read_stdin(void); | ||
EXTERN(FILE *) write_stdout(void); | ||
|
||
/* miscellaneous useful macros */ | ||
|
||
#ifdef DONT_USE_B_MODE /* define mode parameters for fopen() */ | ||
#define READ_BINARY "r" | ||
#define WRITE_BINARY "w" | ||
#else | ||
#define READ_BINARY "rb" | ||
#define WRITE_BINARY "wb" | ||
#endif | ||
|
||
#ifndef EXIT_FAILURE /* define exit() codes if not provided */ | ||
#define EXIT_FAILURE 1 | ||
#endif | ||
#ifndef EXIT_SUCCESS | ||
#define EXIT_SUCCESS 0 | ||
#endif | ||
#ifndef EXIT_WARNING | ||
#define EXIT_WARNING 2 | ||
#endif | ||
|
||
#define IsExtRGB(cs) \ | ||
(cs == JCS_RGB || (cs >= JCS_EXT_RGB && cs <= JCS_EXT_ARGB)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* cmyk.h | ||
* | ||
* Copyright (C) 2017-2018, D. R. Commander. | ||
* For conditions of distribution and use, see the accompanying README.ijg | ||
* file. | ||
* | ||
* This file contains convenience functions for performing quick & dirty | ||
* CMYK<->RGB conversion. This algorithm is suitable for testing purposes | ||
* only. Properly converting between CMYK and RGB requires a color management | ||
* system. | ||
*/ | ||
|
||
#ifndef CMYK_H | ||
#define CMYK_H | ||
|
||
#include <jinclude.h> | ||
#define JPEG_INTERNALS | ||
#include <jpeglib.h> | ||
|
||
|
||
/* Fully reversible */ | ||
|
||
INLINE | ||
LOCAL(void) | ||
rgb_to_cmyk(JSAMPLE r, JSAMPLE g, JSAMPLE b, JSAMPLE *c, JSAMPLE *m, | ||
JSAMPLE *y, JSAMPLE *k) | ||
{ | ||
double ctmp = 1.0 - ((double)r / 255.0); | ||
double mtmp = 1.0 - ((double)g / 255.0); | ||
double ytmp = 1.0 - ((double)b / 255.0); | ||
double ktmp = MIN(MIN(ctmp, mtmp), ytmp); | ||
|
||
if (ktmp == 1.0) ctmp = mtmp = ytmp = 0.0; | ||
else { | ||
ctmp = (ctmp - ktmp) / (1.0 - ktmp); | ||
mtmp = (mtmp - ktmp) / (1.0 - ktmp); | ||
ytmp = (ytmp - ktmp) / (1.0 - ktmp); | ||
} | ||
*c = (JSAMPLE)(255.0 - ctmp * 255.0 + 0.5); | ||
*m = (JSAMPLE)(255.0 - mtmp * 255.0 + 0.5); | ||
*y = (JSAMPLE)(255.0 - ytmp * 255.0 + 0.5); | ||
*k = (JSAMPLE)(255.0 - ktmp * 255.0 + 0.5); | ||
} | ||
|
||
|
||
/* Fully reversible only for C/M/Y/K values generated with rgb_to_cmyk() */ | ||
|
||
INLINE | ||
LOCAL(void) | ||
cmyk_to_rgb(JSAMPLE c, JSAMPLE m, JSAMPLE y, JSAMPLE k, JSAMPLE *r, JSAMPLE *g, | ||
JSAMPLE *b) | ||
{ | ||
*r = (JSAMPLE)((double)c * (double)k / 255.0 + 0.5); | ||
*g = (JSAMPLE)((double)m * (double)k / 255.0 + 0.5); | ||
*b = (JSAMPLE)((double)y * (double)k / 255.0 + 0.5); | ||
} | ||
|
||
|
||
#endif /* CMYK_H */ |
Oops, something went wrong.