From: bogglez <bo...@us...> - 2017-03-09 20:13:48
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 8b2a2967d2d77973b50c5fa01fcb27932f70d522 (commit) via a0d7d05b457a6f29cbea29031eed9d07139d4c33 (commit) via 051aef6358189354a6a9f46687fe0f260af99574 (commit) from c77634aa22982a426e3423693e40a84c7a3b4ff1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 8b2a2967d2d77973b50c5fa01fcb27932f70d522 Author: bogglez <bo...@pr...> Date: Thu Mar 9 21:13:13 2017 +0100 vqenc: handle fread error case commit a0d7d05b457a6f29cbea29031eed9d07139d4c33 Author: bogglez <bo...@pr...> Date: Thu Mar 9 21:12:58 2017 +0100 vqenc: fix pointer to int cast commit 051aef6358189354a6a9f46687fe0f260af99574 Author: bogglez <bo...@pr...> Date: Thu Mar 9 21:12:24 2017 +0100 vqenc: add manpage ----------------------------------------------------------------------- Summary of changes: utils/vqenc/readpng.c | 6 +++-- utils/vqenc/vqenc.1 | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++ utils/vqenc/vqenc.c | 2 +- 3 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 utils/vqenc/vqenc.1 diff --git a/utils/vqenc/readpng.c b/utils/vqenc/readpng.c index 1b93e4c..788f100 100644 --- a/utils/vqenc/readpng.c +++ b/utils/vqenc/readpng.c @@ -25,7 +25,7 @@ void readpng_version_info(void) { } -/* return value = 0 for success, 1 for bad sig, 2 for bad IHDR, 4 for no mem */ +/* return value = 0 for success, 1 for bad sig, 2 for bad IHDR, 3 for io, 4 for no mem */ uint32 readpng_init(FILE *infile) { uint8 sig[8]; @@ -33,7 +33,9 @@ uint32 readpng_init(FILE *infile) { /* first do a quick check that the file really is a PNG image; could * have used slightly more general png_sig_cmp() function instead */ - fread(sig, 1, 8, infile); + if(fread(sig, 8, 1, infile) != 1) { + return 3; + } if(!png_check_sig(sig, 8)) return 1; /* bad signature */ diff --git a/utils/vqenc/vqenc.1 b/utils/vqenc/vqenc.1 new file mode 100644 index 0000000..136338e --- /dev/null +++ b/utils/vqenc/vqenc.1 @@ -0,0 +1,68 @@ +.TH VQENC 1 "Mar 2017" "Version 1.0" +.SH NAME +vqenc \- Compress images using SEGA Dreamcast Vector Quantization +.SH SYNOPSIS +\fBvqenc\fR [\fIOPTION\fR]... [\fIFILE\fR]... + +.SH DESCRIPTION +.B vqenc +is used to compress image files using the SEGA Dreamcast's Vector +Quantization algorithm. +At a small loss of quality this allows for textures of up to an +eighth of the original size, resulting in more and higher +resolution textures. + +.SH OPTIONS +.TP +.BR \-t ", " \-\-twiddle\fR +Arrange pixels in a recursive Z-pattern. +Makes texture filtering faster. +Requires square texture dimensions. + +.TP +.BR \-m ", " \-\-mipmap\fR +Calculate and store recursively smaller versions of the image. +Reduces bandwidth and makes texture filtering faster. +Adds about a third of file size. + +.TP +.BR \-v ", " \-\-verbose\fR +Print more information during processing. + +.TP +.BR \-d ", " \-\-debug\fR +Print much more information. + +.TP +.BR \-q ", " \-\-highq\fR +Allow conversion to take more time to achieve higher quality. + +.TP +.BR \-k ", " \-\-kmg\fR +Convert [\fIFILE\fR] to \fB.kmg\fR format instead of \fB.vq\fR. + +.TP +.BR \-a ", " \-\-alpha\fR +Use 4 bit alpha channel (Dreamcast PVR texture format ARGB4444). + +.TP +.BR \-b ", " \-\-amask\fR +Use 1 bit alpha channel (Dreamcast PVR texture format ARGB1555). + +.SH EXAMPLES + +.EX +.B + vqenc -t -m -q -a image.png +.EE + +.SH AUTHOR +This manual page was initially written by Stefan Galowicz <bo...@pr...>, +for the KOS project. +.TP +The program has been initially written by Jeffrey McBeth in 2002 and was modified +by Dan Potter. + +.SH BUGS +While the SEGA Dreamcast hardware can handle non-square VQ-compressed textures, this +tool is not capable of producing them. diff --git a/utils/vqenc/vqenc.c b/utils/vqenc/vqenc.c index bf07146..6660b93 100644 --- a/utils/vqenc/vqenc.c +++ b/utils/vqenc/vqenc.c @@ -572,7 +572,7 @@ static fquad_t *create_downscaled_map(int res, fquad_t *oneup) { fquad_t *q, *larger, tmp; if(use_debug) { - printf("create_downscaled_map(%d %x)\n", res, (unsigned)oneup); + printf("create_downscaled_map(%d %lx)\n", res, (uintptr_t)oneup); } /* each quad in the lower resolution is an average of hooks/post-receive -- A pseudo Operating System for the Dreamcast. |