Import files tiff and yuv(raw)

This commit is contained in:
Jamaika1 2020-12-29 03:08:45 +01:00 committed by GitHub
parent b897e2cb36
commit d2ed36431e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 15 deletions

View File

@ -187,7 +187,7 @@ static void decode_help_display(void)
"\n"
" -ImgDir <directory> \n"
" Image file Directory path \n"
" -OutFor <PBM|PGM|PPM|PNM|PAM|PGX|PNG|BMP|TIF|RAW|RAWL|TGA>\n"
" -OutFor <PBM|PGM|PPM|PNM|PAM|PGX|PNG|BMP|TIF|TIFF|RAW|YUV|RAWL|TGA>\n"
" REQUIRED only if -ImgDir is used\n"
" Output format for decompressed images.\n");
fprintf(stdout, " -i <compressed file>\n"
@ -427,8 +427,8 @@ int load_images(dircnt_t *dirptr, char *imgdirpath)
int get_file_format(const char *filename)
{
unsigned int i;
static const char *extension[] = {"pgx", "pnm", "pgm", "ppm", "bmp", "tif", "raw", "rawl", "tga", "png", "j2k", "jp2", "jpt", "j2c", "jpc" };
static const int format[] = { PGX_DFMT, PXM_DFMT, PXM_DFMT, PXM_DFMT, BMP_DFMT, TIF_DFMT, RAW_DFMT, RAWL_DFMT, TGA_DFMT, PNG_DFMT, J2K_CFMT, JP2_CFMT, JPT_CFMT, J2K_CFMT, J2K_CFMT };
static const char *extension[] = {"pgx", "pnm", "pgm", "ppm", "bmp", "tif", "tiff", "raw", "yuv", "rawl", "tga", "png", "j2k", "jp2", "jpt", "j2c", "jpc" };
static const int format[] = { PGX_DFMT, PXM_DFMT, PXM_DFMT, PXM_DFMT, BMP_DFMT, TIF_DFMT, TIF_DFMT, RAW_DFMT, RAW_DFMT, RAWL_DFMT, TGA_DFMT, PNG_DFMT, J2K_CFMT, JP2_CFMT, JPT_CFMT, J2K_CFMT, J2K_CFMT };
const char * ext = strrchr(filename, '.');
if (ext == NULL) {
return -1;
@ -628,24 +628,17 @@ int parse_cmdline_decoder(int argc, char **argv,
parameters->cod_format = get_file_format(outfile);
switch (parameters->cod_format) {
case PGX_DFMT:
break;
case PXM_DFMT:
break;
case BMP_DFMT:
break;
case TIF_DFMT:
break;
case RAW_DFMT:
break;
case RAWL_DFMT:
break;
case TGA_DFMT:
break;
case PNG_DFMT:
break;
default:
fprintf(stderr,
"Unknown output format image %s [only *.png, *.pnm, *.pgm, *.ppm, *.pgx, *.bmp, *.tif, *.raw or *.tga]!!\n",
"Unknown output format image %s [only *.png, *.pnm, *.pgm, *.ppm, *.pgx, *.bmp, *.tif(f), *.raw, *.yuv or *.tga]!!\n",
outfile);
return 1;
}
@ -692,7 +685,7 @@ int parse_cmdline_decoder(int argc, char **argv,
break;
default:
fprintf(stderr,
"Unknown output format image %s [only *.png, *.pnm, *.pgm, *.ppm, *.pgx, *.bmp, *.tif, *.raw or *.tga]!!\n",
"Unknown output format image %s [only *.png, *.pnm, *.pgm, *.ppm, *.pgx, *.bmp, *.tif(f), *.raw, *.yuv or *.tga]!!\n",
outformat);
return 1;
break;
@ -903,7 +896,7 @@ int parse_cmdline_decoder(int argc, char **argv,
fprintf(stderr,
"[ERROR] When -ImgDir is used, -OutFor <FORMAT> must be used.\n");
fprintf(stderr, "Only one format allowed.\n"
"Valid format are PGM, PPM, PNM, PGX, BMP, TIF, RAW and TGA.\n");
"Valid format are PGM, PPM, PNM, PGX, BMP, TIF, TIFF, RAW, YUV, and TGA.\n");
return 1;
}
if (!((parameters->outfile[0] == 0))) {
@ -1705,7 +1698,7 @@ int main(int argc, char **argv)
}
break;
#ifdef OPJ_HAVE_LIBTIFF
case TIF_DFMT: /* TIFF */
case TIF_DFMT: /* TIF(F) */
if (imagetotif(image, parameters.outfile)) {
fprintf(stderr, "[ERROR] Outfile %s not generated\n", parameters.outfile);
failed = 1;
@ -1716,7 +1709,7 @@ int main(int argc, char **argv)
#endif /* OPJ_HAVE_LIBTIFF */
case RAW_DFMT: /* RAW */
if (imagetoraw(image, parameters.outfile)) {
fprintf(stderr, "[ERROR] Error generating raw file. Outfile %s not generated\n",
fprintf(stderr, "[ERROR] Error generating raw/yuv file. Outfile %s not generated\n",
parameters.outfile);
failed = 1;
} else if (!(parameters.quiet)) {