mirror of
https://github.com/webmproject/libwebp.git
synced 2024-11-20 04:18:26 +01:00
add version getters for decoder and encoder
WebPGetDecoderVersion() and WebPGetEncoderVersion() will not return 0.1.2 encoded as 0x000102 dwebp and cwebp also have a new "-version" flag Change-Id: I4fb4b5a8fc4e53681a386ff4b74fffb639fa237a
This commit is contained in:
parent
be4867d2f8
commit
650ffa3bbb
@ -594,6 +594,7 @@ static void HelpLong() {
|
||||
printf("\n");
|
||||
printf(" -short ................. condense printed message\n");
|
||||
printf(" -quiet ................. don't print anything.\n");
|
||||
printf(" -version ............... print version number and exit.\n");
|
||||
printf(" -v ..................... verbose, e.g. print encoding/decoding "
|
||||
"times\n");
|
||||
printf("\n");
|
||||
@ -678,6 +679,11 @@ int main(int argc, const char *argv[]) {
|
||||
crop_y = atoi(argv[++c]);
|
||||
crop_w = atoi(argv[++c]);
|
||||
crop_h = atoi(argv[++c]);
|
||||
} else if (!strcmp(argv[c], "-version")) {
|
||||
const int version = WebPGetEncoderVersion();
|
||||
printf("%d.%d.%d\n",
|
||||
(version >> 16) & 0xff, (version >> 8) & 0xff, version & 0xff);
|
||||
return 0;
|
||||
} else if (!strcmp(argv[c], "-quiet")) {
|
||||
quiet = 1;
|
||||
} else if (!strcmp(argv[c], "-preset") && c < argc - 1) {
|
||||
|
@ -205,12 +205,13 @@ typedef enum {
|
||||
|
||||
static void help(const char *s) {
|
||||
printf("Usage: dwebp "
|
||||
"[in_file] [-h] [-v] [-ppm] [-pgm] [-o out_file]\n\n"
|
||||
"[in_file] [-h] [-v] [-ppm] [-pgm] [-version] [-o out_file]\n\n"
|
||||
"Decodes the WebP image file to PNG format [Default]\n"
|
||||
"Use following options to convert into alternate image formats:\n"
|
||||
" -ppm: save the raw RGB samples as color PPM\n"
|
||||
" -pgm: save the raw YUV samples as a grayscale PGM\n"
|
||||
" file with IMC4 layout.\n"
|
||||
" -version: print version number and exit.\n"
|
||||
"Use -v for verbose (e.g. print encoding/decoding times)\n"
|
||||
);
|
||||
}
|
||||
@ -232,6 +233,11 @@ int main(int argc, const char *argv[]) {
|
||||
out_file = argv[++c];
|
||||
} else if (!strcmp(argv[c], "-ppm")) {
|
||||
format = PPM;
|
||||
} else if (!strcmp(argv[c], "-version")) {
|
||||
const int version = WebPGetDecoderVersion();
|
||||
printf("%d.%d.%d\n",
|
||||
(version >> 16) & 0xff, (version >> 8) & 0xff, version & 0xff);
|
||||
return 0;
|
||||
} else if (!strcmp(argv[c], "-pgm")) {
|
||||
format = PGM;
|
||||
} else if (!strcmp(argv[c], "-v")) {
|
||||
|
@ -16,6 +16,12 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
int WebPGetDecoderVersion() {
|
||||
return (DEC_MAJ_VERSION << 16) | (DEC_MIN_VERSION << 8) | DEC_REV_VERSION;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// VP8Decoder
|
||||
|
||||
|
@ -22,6 +22,11 @@ extern "C" {
|
||||
//-----------------------------------------------------------------------------
|
||||
// Various defines and enums
|
||||
|
||||
// version numbers
|
||||
#define DEC_MAJ_VERSION 0
|
||||
#define DEC_MIN_VERSION 1
|
||||
#define DEC_REV_VERSION 2
|
||||
|
||||
#define ONLY_KEYFRAME_CODE // to remove any code related to P-Frames
|
||||
|
||||
// intra prediction modes
|
||||
|
@ -23,6 +23,11 @@ extern "C" {
|
||||
//-----------------------------------------------------------------------------
|
||||
// Various defines and enums
|
||||
|
||||
// version numbers
|
||||
#define ENC_MAJ_VERSION 0
|
||||
#define ENC_MIN_VERSION 1
|
||||
#define ENC_REV_VERSION 2
|
||||
|
||||
// intra prediction modes
|
||||
enum { B_DC_PRED = 0, // 4x4 modes
|
||||
B_TM_PRED = 1,
|
||||
|
@ -27,6 +27,12 @@ extern "C" {
|
||||
|
||||
#define MAX_DIMENSION 16384 // maximum width/height allowed by the spec
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
int WebPGetEncoderVersion() {
|
||||
return (ENC_MAJ_VERSION << 16) | (ENC_MIN_VERSION << 8) | ENC_REV_VERSION;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// WebPPicture
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -18,6 +18,10 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Return the decoder's version number, packed in hexadecimal using 8bits for
|
||||
// each of major/minor/revision. E.g: v2.5.7 is 0x020507.
|
||||
int WebPGetDecoderVersion();
|
||||
|
||||
// Retrieve basic header information: width, height.
|
||||
// This function will also validate the header and return 0 in
|
||||
// case of formatting error.
|
||||
|
@ -22,6 +22,10 @@ extern "C" {
|
||||
|
||||
#define WEBP_ENCODER_ABI_VERSION 0x0001
|
||||
|
||||
// Return the encoder's version number, packed in hexadecimal using 8bits for
|
||||
// each of major/minor/revision. E.g: v2.5.7 is 0x020507.
|
||||
int WebPGetEncoderVersion();
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// One-stop-shop call! No questions asked:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user