diff --git a/tools/imagecon/Makefile b/tools/imagecon/Makefile index 6fd8355..c7ac7bb 100644 --- a/tools/imagecon/Makefile +++ b/tools/imagecon/Makefile @@ -2,70 +2,71 @@ PROGRAM=./out/imagecon OBJS=out/imagecon.o out/png.o out/color.o out/dither.o out/ham.o out/palette.o out/file.o out/sliced_ham.o out/quant.o out/utils.o LIBS=-lpng -limagequant -# test stuff -OUTPUT_BASE=out/mission-beach -REFERENCE_BASE=reference/mission-beach -TEST_IMAGE=../../assets/mission-beach.png -BOB_IMAGE=../../assets/emoji.png -SHARED_BASE=out/shared -BOB_BASE=out/bob -REFERENCE_BOB_BASE=reference/bob -REFERENCE_SHARED_BASE=reference/shared -REFERENCE_SHARED_PALETTE=$(REFERENCE_SHARED_BASE).pal -SHARED_PALETTE=$(SHARED_BASE).pal -USED_PALETTE=$(SHARED_BASE).bin $(SHARED_BASE)-copper-list.s - -EHB_IMAGE=../../assets/gigi.png -EHB_BASE=out/ehb -REFERENCE_EHB_BASE=reference/ehb - -HAM_IMAGE=../../assets/gigi.png -HAM_BASE=out/ham -REFERENCE_HAM_BASE=reference/ham - -DITHERED_HAM_IMAGE=../../assets/gigi.png -DITHERED_HAM_BASE=out/dithered_ham -REFERENCE_DITHERED_HAM_BASE=reference/dithered_ham - include ../../shared/tools.mk -$(USED_PALETTE): $(SHARED_PALETTE) - @echo "testing use-palette" - $(PROGRAM) --input $(TEST_IMAGE),$(BOB_IMAGE) --output $(SHARED_BASE) --use-palette $(SHARED_PALETTE) --output-bitplanes --output-copperlist +# Simple 32 color quantize +32COLOR_QUANT=32color-quant.png +out/$(32COLOR_QUANT).bin: IMAGECON_ARGS=--output-copperlist --output-bitplanes --output-grey-palette --output-palette-asm --colors 32 --quantize --output-palette --output-png -$(SHARED_PALETTE): $(PROGRAM) - -rm -f $(SHARED_PALETTE) - $(PROGRAM) --input $(TEST_IMAGE),$(BOB_IMAGE) --output $(SHARED_BASE) --colors 32 --quantize --output-palette +# Using a previously generated palette +USE_PALETTE=use_palette.png +out/$(USE_PALETTE).bin: IMAGECON_ARGS=--output-bitplanes --output-palette-asm --use-palette out/$(32COLOR_QUANT).pal --output-palette --quantize -$(OUTPUT_BASE).bin: $(PROGRAM) - -rm -f $(OUTPUT_BASE).bin $(OUTPUT_BASE)-copper-list.s $(OUTPUT_BASE)-palette.s - $(PROGRAM) --input $(TEST_IMAGE) --output $(OUTPUT_BASE) --output-copperlist --output-bitplanes --output-grey-palette --output-palette-asm --colors 32 --quantize - $(PROGRAM) --input $(BOB_IMAGE) --output $(BOB_BASE) --output-mask --colors 32 --quantize +# Extra half brite mode +EXTRA_HALF_BRITE=extra_half_brite.png +out/$(EXTRA_HALF_BRITE).bin: IMAGECON_ARGS=--extra-half-brite --output-bitplanes --output-palette-asm --output-palette --quantize --output-copperlist --colors=32 --quantize -$(EHB_BASE).bin: $(EHB_IMAGE) - $(PROGRAM) --input $(EHB_IMAGE) --output $(EHB_BASE) --output-bitplanes --colors 32 --quantize --extra-half-brite --output-copperlist +# HAM mode +HAM_MODE=ham_mode.png +out/$(HAM_MODE).bin: IMAGECON_ARGS=--output-bitplanes --ham --output-palette-asm -$(HAM_BASE).bin: $(HAM_IMAGE) - $(PROGRAM) --input $(HAM_IMAGE) --output $(HAM_BASE) --output-bitplanes --ham --output-palette-asm +# Dithered HAM mode +DITHERED_HAM=dithered_ham.png +out/$(DITHERED_HAM).bin: IMAGECON_ARGS=--dither --output-bitplanes --ham --output-palette-asm -$(DITHERED_HAM_BASE).bin: $(DITHERED_HAM_IMAGE) - $(PROGRAM) --input $(DITHERED_HAM_IMAGE) --output $(DITHERED_HAM_BASE) --dither --output-bitplanes --ham --output-palette-asm +# Laced dithered HAM mode +LACE_MODE=lace.png +out/$(LACE_MODE).bin: IMAGECON_ARGS=--dither --output-bitplanes --ham --output-palette-asm -test: $(PROGRAM) $(OUTPUT_BASE).bin $(SHARED_PALETTE) $(USED_PALETTE) $(EHB_BASE).bin $(HAM_BASE).bin $(DITHERED_HAM_BASE).bin - diff $(OUTPUT_BASE).bin $(REFERENCE_BASE).bin - diff $(OUTPUT_BASE)-copper-list.s $(REFERENCE_BASE)-copper-list.s - diff $(OUTPUT_BASE)-palette.s $(REFERENCE_BASE)-palette.s - diff $(OUTPUT_BASE)-grey.s $(REFERENCE_BASE)-grey.s - diff $(SHARED_PALETTE) $(REFERENCE_SHARED_PALETTE) - diff $(SHARED_BASE).bin $(REFERENCE_SHARED_BASE).bin - diff $(SHARED_BASE)-copper-list.s $(REFERENCE_SHARED_BASE)-copper-list.s - diff $(BOB_BASE)-mask.bin $(REFERENCE_BOB_BASE)-mask.bin - diff $(EHB_BASE).bin $(REFERENCE_EHB_BASE).bin - diff $(EHB_BASE)-copper-list.s $(REFERENCE_EHB_BASE)-copper-list.s - diff $(HAM_BASE)-ham.bin $(REFERENCE_HAM_BASE)-ham.bin - diff $(HAM_BASE)-palette.s $(REFERENCE_HAM_BASE)-palette.s - diff $(DITHERED_HAM_BASE)-ham.bin $(REFERENCE_DITHERED_HAM_BASE)-ham.bin - diff $(DITHERED_HAM_BASE)-palette.s $(REFERENCE_DITHERED_HAM_BASE)-palette.s +# Two images, sharing a palette +SHARED_PALETTE=shared_palette.png + + +# default recipe for converting images +out/%.bin: test-images/% Makefile + $(PROGRAM) --input $< --output out/$* $(IMAGECON_ARGS) + +# special case for shared palette +out/$(SHARED_PALETTE).bin: $(PROGRAM) + $(PROGRAM) --input test-images/$(32COLOR_QUANT),test-images/bob.png --output out/$(SHARED_PALETTE) --colors 32 --quantize --output-palette --output-bitplanes + + +test: $(PROGRAM) out/$(32COLOR_QUANT).bin out/$(USE_PALETTE).bin out/$(SHARED_PALETTE).bin out/$(EXTRA_HALF_BRITE).bin out/$(HAM_MODE).bin out/$(DITHERED_HAM).bin out/$(LACE_MODE).bin + diff out/$(32COLOR_QUANT).bin reference/$(32COLOR_QUANT).bin + diff out/$(32COLOR_QUANT)-copper-list.s reference/$(32COLOR_QUANT)-copper-list.s + diff out/$(32COLOR_QUANT)-grey.s reference/$(32COLOR_QUANT)-grey.s + diff out/$(32COLOR_QUANT)-palette.s reference/$(32COLOR_QUANT)-palette.s + diff out/$(32COLOR_QUANT).pal reference/$(32COLOR_QUANT).pal + diff out/$(32COLOR_QUANT)-converted.png reference/$(32COLOR_QUANT)-converted.png + + diff out/$(USE_PALETTE).bin reference/$(USE_PALETTE).bin + + diff out/$(SHARED_PALETTE).bin reference/$(SHARED_PALETTE).bin + diff out/$(SHARED_PALETTE).pal reference/$(SHARED_PALETTE).pal + + diff out/$(EXTRA_HALF_BRITE).bin reference/$(EXTRA_HALF_BRITE).bin + diff out/$(EXTRA_HALF_BRITE)-copper-list.s reference/$(EXTRA_HALF_BRITE)-copper-list.s + diff out/$(EXTRA_HALF_BRITE)-palette.s reference/$(EXTRA_HALF_BRITE)-palette.s + diff out/$(EXTRA_HALF_BRITE).pal reference/$(EXTRA_HALF_BRITE).pal + + diff out/$(HAM_MODE)-ham.bin reference/$(HAM_MODE)-ham.bin + diff out/$(HAM_MODE)-palette.s reference/$(HAM_MODE)-palette.s + + diff out/$(DITHERED_HAM)-ham.bin reference/$(DITHERED_HAM)-ham.bin + diff out/$(DITHERED_HAM)-palette.s reference/$(DITHERED_HAM)-palette.s + + diff out/$(LACE_MODE)-ham.bin reference/$(LACE_MODE)-ham.bin + diff out/$(LACE_MODE)-palette.s reference/$(LACE_MODE)-palette.s @echo "______ ___ _____ _____ ___________ " @echo "| ___ \/ _ \ / ___/ ___| ___| _ \ " @@ -73,3 +74,4 @@ test: $(PROGRAM) $(OUTPUT_BASE).bin $(SHARED_PALETTE) $(USED_PALETTE) $(EHB_BASE @echo "| __/| _ | \`--. \\\`--. \ __|| | | | " @echo "| | | | | |/\__/ /\__/ / |___| |/ / " @echo "\_| \_| |_/\____/\____/\____/|___/ " + \ No newline at end of file diff --git a/tools/imagecon/imagecon.c b/tools/imagecon/imagecon.c index 42f61b9..43febae 100644 --- a/tools/imagecon/imagecon.c +++ b/tools/imagecon/imagecon.c @@ -12,6 +12,7 @@ imagecon_config_t config = { .outputPaletteGrey = 0, .outputBitplanes = 0, .outputCopperList = 0, + .outputPng = 0, .ehbMode = 0, .hamMode = 0, .hamBruteForce = 0, @@ -38,6 +39,7 @@ usage() " --output-palette-asm\n"\ " --output-grey-palette-asm\n"\ " --output-palette\n"\ + " --output-png\n"\ " --extra-half-brite\n"\ " --ham\n"\ " --ham-brute-force\n"\ @@ -391,6 +393,12 @@ processFile(char* outFilename, imagecon_image_t* ic) palette_output(ic, outFilename); } + if (config.outputPng) { + char pngFilename[255]; + sprintf(pngFilename, "%s-converted.png", outFilename); + png_write(ic, pngFilename); + } + if (config.verbose) { printf("done\n\n"); } @@ -474,6 +482,7 @@ main(int argc, char **argv) {"output-palette-asm", no_argument, &config.outputPaletteAsm, 1}, {"output-grey-palette-asm", no_argument, &config.outputPaletteGrey, 1}, {"output-mask", no_argument, &config.outputMask, 1}, + {"output-png", no_argument, &config.outputPng, 1}, {"extra-half-brite", no_argument, &config.ehbMode, 1}, {"ham", no_argument, &config.hamMode, 1}, {"ham-brute-force", no_argument, &config.hamBruteForce, 1}, @@ -545,7 +554,7 @@ main(int argc, char **argv) if (strchr(inputFile, ',') == 0) { imagecon_image_t ic = {0}; - png_read(inputFile, &ic); + png_read(&ic, inputFile); processFile(outputFile, &ic); } else { char** files; @@ -556,7 +565,7 @@ main(int argc, char **argv) for (int i = 0; i < numFiles; i++) { images[i] = calloc(sizeof(imagecon_image_t), 1); - png_read(files[i], images[i]); + png_read(images[i], files[i]); } imagecon_image_t combined; diff --git a/tools/imagecon/imagecon.h b/tools/imagecon/imagecon.h index 5200f10..96c8703 100644 --- a/tools/imagecon/imagecon.h +++ b/tools/imagecon/imagecon.h @@ -33,6 +33,7 @@ typedef struct { char* overridePalette; int paletteOffset; int quantize; + int outputPng; int verbose; char** argv; } imagecon_config_t; @@ -83,7 +84,10 @@ extern void abort_(const char * s, ...); extern void -png_read(char* file_name, imagecon_image_t* ic); +png_read(imagecon_image_t* ic, char* file_name); + +extern void +png_write(imagecon_image_t* ic, char* file_name); void generateQuantizedImage(imagecon_image_t* ic, int usePalette); diff --git a/tools/imagecon/palette.c b/tools/imagecon/palette.c index b821869..4682cd6 100644 --- a/tools/imagecon/palette.c +++ b/tools/imagecon/palette.c @@ -6,18 +6,29 @@ void palette_loadFile(imagecon_image_t* ic) int paletteIndex; for (paletteIndex = 0; paletteIndex < MAX_PALETTE; paletteIndex++) { - unsigned int c; + char buffer[255]; char* line = fgets(buffer, 255, fp); if (!line) { break; } + +#if 1 + unsigned int c; sscanf(buffer, "%x\n", &c); ic->palette[paletteIndex].r = (c >> 8 & 0xF) << 4; ic->palette[paletteIndex].g = (c >> 4 & 0xF) << 4; ic->palette[paletteIndex].b = (c >> 0 & 0xF) << 4; ic->palette[paletteIndex].a = 255; +#else // 24 bit palette version + sscanf(buffer, "%d %d %d %d\n", + &ic->palette[paletteIndex].r, + &ic->palette[paletteIndex].g, + &ic->palette[paletteIndex].b, + &ic->palette[paletteIndex].a); + +#endif } ic->numColors = paletteIndex; @@ -63,7 +74,11 @@ palette_output(imagecon_image_t* ic, char* outFilename) printf("%02d: hex=%03x r=%03d g=%03d b=%03d a=%03d\n", i , ic->palette[i].r << 8 | ic->palette[i].g << 4 | ic->palette[i].b, ic->palette[i].r, ic->palette[i].g, ic->palette[i].b, ic->palette[i].a); } if (paletteFP) { +#if 1 fprintf(paletteFP, "%03x\n", RGB24TORGB12(ic->palette[i].r) << 8 | RGB24TORGB12(ic->palette[i].g) << 4 | RGB24TORGB12(ic->palette[i].b)); +#else // 24 bit palette + fprintf(paletteFP, "%03d %03d %03d %03d\n", ic->palette[i].r , ic->palette[i].g , ic->palette[i].b, ic->palette[i].a); +#endif } if (paletteAsmFP) { fprintf(paletteAsmFP, "\tlea COLOR%02d(a6),a0\n\tmove.w #$%03x,(a0)\n", i+config.paletteOffset, RGB24TORGB12(ic->palette[i].r) << 8 | RGB24TORGB12(ic->palette[i].g) << 4 | RGB24TORGB12(ic->palette[i].b)); diff --git a/tools/imagecon/png.c b/tools/imagecon/png.c index e9008da..49d75b7 100644 --- a/tools/imagecon/png.c +++ b/tools/imagecon/png.c @@ -22,8 +22,17 @@ _wrapjmp(png_structp png_ptr) if (setjmp(png_jmpbuf(png_ptr))) abort_("Error during init_io"); } + +static inline void +setRGB(png_byte *ptr, amiga_color_t color) +{ + *ptr++ = color.r; + *ptr++ = color.g; + *ptr++ = color.b; +} + void -png_read(char* file_name, imagecon_image_t* ic) +png_read(imagecon_image_t* ic, char* filename) { png_structp png_ptr; png_byte color_type; @@ -33,12 +42,12 @@ png_read(char* file_name, imagecon_image_t* ic) unsigned char header[8]; // 8 is the maximum size that can be checked /* open file and test for it being a png */ - FILE *fp = fopen(file_name, "rb"); + FILE *fp = fopen(filename, "rb"); if (!fp) - abort_("Failed to open %s", file_name); + abort_("Failed to open %s", filename); fread(header, 1, 8, fp); if (png_sig_cmp(header, 0, 8)) - abort_("File %s is not recognized as a PNG file", file_name); + abort_("File %s is not recognized as a PNG file", filename); png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); @@ -124,3 +133,65 @@ png_read(char* file_name, imagecon_image_t* ic) ic->amigaImage = calloc(ic->width*ic->height, 1); ic->dithered = 0; } + + +void +png_write(imagecon_image_t* ic, char* filename) +{ + FILE *fp = file_openWrite(filename); + png_structp png_ptr = NULL; + png_infop info_ptr = NULL; + png_bytep row = NULL; + + png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + + if (png_ptr == NULL) { + abort_("png_write: could not allocate write struct"); + } + + info_ptr = png_create_info_struct(png_ptr); + if (info_ptr == NULL) { + abort_("png_write: could not allocate info struct"); + } + + if (setjmp(png_jmpbuf(png_ptr))) { + abort_("png_write: error during png creation"); + } + + png_init_io(png_ptr, fp); + + // Write header (8 bit colour depth) + png_set_IHDR(png_ptr, info_ptr, ic->width, ic->height, + 8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, + PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); + + // Set title + if (filename != NULL) { + png_text title_text; + title_text.compression = PNG_TEXT_COMPRESSION_NONE; + title_text.key = "Title"; + title_text.text = filename; + png_set_text(png_ptr, info_ptr, &title_text, 1); + } + + png_write_info(png_ptr, info_ptr); + + // Allocate memory for one row (3 bytes per pixel - RGB) + row = (png_bytep) malloc(3 * ic->width * sizeof(png_byte)); + + // Write image data + int x, y; + for (y=0 ; yheight ; y++) { + for (x=0 ; xwidth ; x++) { + setRGB(&(row[x*3]), color_getPalettedPixel(ic, x, y)); + } + png_write_row(png_ptr, row); + } + + // End write + png_write_end(png_ptr, NULL); + + if (info_ptr != NULL) png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1); + if (png_ptr != NULL) png_destroy_write_struct(&png_ptr, (png_infopp)NULL); + if (row != NULL) free(row); +} diff --git a/tools/imagecon/reference/32color-quant.png-converted.png b/tools/imagecon/reference/32color-quant.png-converted.png new file mode 100644 index 0000000..bfb3bb1 Binary files /dev/null and b/tools/imagecon/reference/32color-quant.png-converted.png differ diff --git a/tools/imagecon/reference/mission-beach-copper-list.s b/tools/imagecon/reference/32color-quant.png-copper-list.s similarity index 100% rename from tools/imagecon/reference/mission-beach-copper-list.s rename to tools/imagecon/reference/32color-quant.png-copper-list.s diff --git a/tools/imagecon/reference/mission-beach-grey.s b/tools/imagecon/reference/32color-quant.png-grey.s similarity index 100% rename from tools/imagecon/reference/mission-beach-grey.s rename to tools/imagecon/reference/32color-quant.png-grey.s diff --git a/tools/imagecon/reference/mission-beach-palette.s b/tools/imagecon/reference/32color-quant.png-palette.s similarity index 100% rename from tools/imagecon/reference/mission-beach-palette.s rename to tools/imagecon/reference/32color-quant.png-palette.s diff --git a/tools/imagecon/reference/mission-beach.bin b/tools/imagecon/reference/32color-quant.png.bin similarity index 100% rename from tools/imagecon/reference/mission-beach.bin rename to tools/imagecon/reference/32color-quant.png.bin diff --git a/tools/imagecon/reference/32color-quant.png.pal b/tools/imagecon/reference/32color-quant.png.pal new file mode 100644 index 0000000..879bacf --- /dev/null +++ b/tools/imagecon/reference/32color-quant.png.pal @@ -0,0 +1,32 @@ +36b +48b +363 +ffd +111 +443 +fec +37b +222 +332 +574 +eda +554 +ca5 +59c +684 +a95 +bde +aba +dc9 +9bc +aa8 +8a9 +def +897 +bcc +fff +765 +db6 +486 +6ad +8a4 diff --git a/tools/imagecon/reference/bob-mask.bin b/tools/imagecon/reference/bob-mask.bin deleted file mode 100644 index 2a18bdb..0000000 Binary files a/tools/imagecon/reference/bob-mask.bin and /dev/null differ diff --git a/tools/imagecon/reference/dithered_ham-ham.bin b/tools/imagecon/reference/dithered_ham-ham.bin deleted file mode 100644 index 4d9291a..0000000 Binary files a/tools/imagecon/reference/dithered_ham-ham.bin and /dev/null differ diff --git a/tools/imagecon/reference/dithered_ham.png-ham.bin b/tools/imagecon/reference/dithered_ham.png-ham.bin new file mode 100644 index 0000000..ab46fbd Binary files /dev/null and b/tools/imagecon/reference/dithered_ham.png-ham.bin differ diff --git a/tools/imagecon/reference/ham-palette.s b/tools/imagecon/reference/dithered_ham.png-palette.s similarity index 77% rename from tools/imagecon/reference/ham-palette.s rename to tools/imagecon/reference/dithered_ham.png-palette.s index 42197ea..c880851 100644 --- a/tools/imagecon/reference/ham-palette.s +++ b/tools/imagecon/reference/dithered_ham.png-palette.s @@ -5,31 +5,31 @@ lea COLOR01(a6),a0 move.w #$631,(a0) lea COLOR02(a6),a0 - move.w #$852,(a0) + move.w #$742,(a0) lea COLOR03(a6),a0 - move.w #$210,(a0) - lea COLOR04(a6),a0 move.w #$79a,(a0) + lea COLOR04(a6),a0 + move.w #$210,(a0) lea COLOR05(a6),a0 - move.w #$ea6,(a0) + move.w #$665,(a0) lea COLOR06(a6),a0 - move.w #$c84,(a0) + move.w #$678,(a0) lea COLOR07(a6),a0 - move.w #$a63,(a0) + move.w #$e95,(a0) lea COLOR08(a6),a0 move.w #$552,(a0) lea COLOR09(a6),a0 - move.w #$688,(a0) + move.w #$963,(a0) lea COLOR10(a6),a0 - move.w #$765,(a0) + move.w #$344,(a0) lea COLOR11(a6),a0 - move.w #$455,(a0) + move.w #$987,(a0) lea COLOR12(a6),a0 - move.w #$fb7,(a0) + move.w #$c74,(a0) lea COLOR13(a6),a0 - move.w #$9aa,(a0) + move.w #$fb7,(a0) lea COLOR14(a6),a0 - move.w #$997,(a0) + move.w #$9aa,(a0) lea COLOR15(a6),a0 move.w #$edb,(a0) movem.l (sp)+,d0-a6 diff --git a/tools/imagecon/reference/ehb-copper-list.s b/tools/imagecon/reference/ehb-copper-list.s deleted file mode 100644 index 41fbde4..0000000 --- a/tools/imagecon/reference/ehb-copper-list.s +++ /dev/null @@ -1,32 +0,0 @@ - dc.w $180,$521 - dc.w $182,$852 - dc.w $184,$100 - dc.w $186,$8aa - dc.w $188,$79a - dc.w $18a,$ea6 - dc.w $18c,$e95 - dc.w $18e,$210 - dc.w $190,$631 - dc.w $192,$421 - dc.w $194,$d85 - dc.w $196,$552 - dc.w $198,$642 - dc.w $19a,$799 - dc.w $19c,$952 - dc.w $19e,$741 - dc.w $1a0,$689 - dc.w $1a2,$a63 - dc.w $1a4,$c74 - dc.w $1a6,$664 - dc.w $1a8,$444 - dc.w $1aa,$566 - dc.w $1ac,$331 - dc.w $1ae,$987 - dc.w $1b0,$fb7 - dc.w $1b2,$775 - dc.w $1b4,$787 - dc.w $1b6,$aa8 - dc.w $1b8,$863 - dc.w $1ba,$fc8 - dc.w $1bc,$cca - dc.w $1be,$fec diff --git a/tools/imagecon/reference/ehb.bin b/tools/imagecon/reference/ehb.bin deleted file mode 100644 index 10960b9..0000000 Binary files a/tools/imagecon/reference/ehb.bin and /dev/null differ diff --git a/tools/imagecon/reference/extra_half_brite.png-copper-list.s b/tools/imagecon/reference/extra_half_brite.png-copper-list.s new file mode 100644 index 0000000..d30c74e --- /dev/null +++ b/tools/imagecon/reference/extra_half_brite.png-copper-list.s @@ -0,0 +1,32 @@ + dc.w $180,$36b + dc.w $182,$48b + dc.w $184,$363 + dc.w $186,$ffd + dc.w $188,$111 + dc.w $18a,$443 + dc.w $18c,$fec + dc.w $18e,$37b + dc.w $190,$222 + dc.w $192,$332 + dc.w $194,$574 + dc.w $196,$eda + dc.w $198,$554 + dc.w $19a,$ca5 + dc.w $19c,$59c + dc.w $19e,$684 + dc.w $1a0,$a95 + dc.w $1a2,$bde + dc.w $1a4,$aba + dc.w $1a6,$dc9 + dc.w $1a8,$9bc + dc.w $1aa,$aa8 + dc.w $1ac,$8a9 + dc.w $1ae,$def + dc.w $1b0,$897 + dc.w $1b2,$bcc + dc.w $1b4,$fff + dc.w $1b6,$765 + dc.w $1b8,$db6 + dc.w $1ba,$486 + dc.w $1bc,$6ad + dc.w $1be,$8a4 diff --git a/tools/imagecon/reference/extra_half_brite.png-palette.s b/tools/imagecon/reference/extra_half_brite.png-palette.s new file mode 100644 index 0000000..f062381 --- /dev/null +++ b/tools/imagecon/reference/extra_half_brite.png-palette.s @@ -0,0 +1,67 @@ + movem.l d0-a6,-(sp) + lea CUSTOM,a6 + lea COLOR00(a6),a0 + move.w #$36b,(a0) + lea COLOR01(a6),a0 + move.w #$48b,(a0) + lea COLOR02(a6),a0 + move.w #$363,(a0) + lea COLOR03(a6),a0 + move.w #$ffd,(a0) + lea COLOR04(a6),a0 + move.w #$111,(a0) + lea COLOR05(a6),a0 + move.w #$443,(a0) + lea COLOR06(a6),a0 + move.w #$fec,(a0) + lea COLOR07(a6),a0 + move.w #$37b,(a0) + lea COLOR08(a6),a0 + move.w #$222,(a0) + lea COLOR09(a6),a0 + move.w #$332,(a0) + lea COLOR10(a6),a0 + move.w #$574,(a0) + lea COLOR11(a6),a0 + move.w #$eda,(a0) + lea COLOR12(a6),a0 + move.w #$554,(a0) + lea COLOR13(a6),a0 + move.w #$ca5,(a0) + lea COLOR14(a6),a0 + move.w #$59c,(a0) + lea COLOR15(a6),a0 + move.w #$684,(a0) + lea COLOR16(a6),a0 + move.w #$a95,(a0) + lea COLOR17(a6),a0 + move.w #$bde,(a0) + lea COLOR18(a6),a0 + move.w #$aba,(a0) + lea COLOR19(a6),a0 + move.w #$dc9,(a0) + lea COLOR20(a6),a0 + move.w #$9bc,(a0) + lea COLOR21(a6),a0 + move.w #$aa8,(a0) + lea COLOR22(a6),a0 + move.w #$8a9,(a0) + lea COLOR23(a6),a0 + move.w #$def,(a0) + lea COLOR24(a6),a0 + move.w #$897,(a0) + lea COLOR25(a6),a0 + move.w #$bcc,(a0) + lea COLOR26(a6),a0 + move.w #$fff,(a0) + lea COLOR27(a6),a0 + move.w #$765,(a0) + lea COLOR28(a6),a0 + move.w #$db6,(a0) + lea COLOR29(a6),a0 + move.w #$486,(a0) + lea COLOR30(a6),a0 + move.w #$6ad,(a0) + lea COLOR31(a6),a0 + move.w #$8a4,(a0) + movem.l (sp)+,d0-a6 diff --git a/tools/imagecon/reference/extra_half_brite.png.bin b/tools/imagecon/reference/extra_half_brite.png.bin new file mode 100644 index 0000000..f29ed36 Binary files /dev/null and b/tools/imagecon/reference/extra_half_brite.png.bin differ diff --git a/tools/imagecon/reference/extra_half_brite.png.pal b/tools/imagecon/reference/extra_half_brite.png.pal new file mode 100644 index 0000000..879bacf --- /dev/null +++ b/tools/imagecon/reference/extra_half_brite.png.pal @@ -0,0 +1,32 @@ +36b +48b +363 +ffd +111 +443 +fec +37b +222 +332 +574 +eda +554 +ca5 +59c +684 +a95 +bde +aba +dc9 +9bc +aa8 +8a9 +def +897 +bcc +fff +765 +db6 +486 +6ad +8a4 diff --git a/tools/imagecon/reference/ham-ham.bin b/tools/imagecon/reference/ham-ham.bin deleted file mode 100644 index 0627fb6..0000000 Binary files a/tools/imagecon/reference/ham-ham.bin and /dev/null differ diff --git a/tools/imagecon/reference/ham_mode.png-ham.bin b/tools/imagecon/reference/ham_mode.png-ham.bin new file mode 100644 index 0000000..16c8e9f Binary files /dev/null and b/tools/imagecon/reference/ham_mode.png-ham.bin differ diff --git a/tools/imagecon/reference/dithered_ham-palette.s b/tools/imagecon/reference/ham_mode.png-palette.s similarity index 77% rename from tools/imagecon/reference/dithered_ham-palette.s rename to tools/imagecon/reference/ham_mode.png-palette.s index 42197ea..c880851 100644 --- a/tools/imagecon/reference/dithered_ham-palette.s +++ b/tools/imagecon/reference/ham_mode.png-palette.s @@ -5,31 +5,31 @@ lea COLOR01(a6),a0 move.w #$631,(a0) lea COLOR02(a6),a0 - move.w #$852,(a0) + move.w #$742,(a0) lea COLOR03(a6),a0 - move.w #$210,(a0) - lea COLOR04(a6),a0 move.w #$79a,(a0) + lea COLOR04(a6),a0 + move.w #$210,(a0) lea COLOR05(a6),a0 - move.w #$ea6,(a0) + move.w #$665,(a0) lea COLOR06(a6),a0 - move.w #$c84,(a0) + move.w #$678,(a0) lea COLOR07(a6),a0 - move.w #$a63,(a0) + move.w #$e95,(a0) lea COLOR08(a6),a0 move.w #$552,(a0) lea COLOR09(a6),a0 - move.w #$688,(a0) + move.w #$963,(a0) lea COLOR10(a6),a0 - move.w #$765,(a0) + move.w #$344,(a0) lea COLOR11(a6),a0 - move.w #$455,(a0) + move.w #$987,(a0) lea COLOR12(a6),a0 - move.w #$fb7,(a0) + move.w #$c74,(a0) lea COLOR13(a6),a0 - move.w #$9aa,(a0) + move.w #$fb7,(a0) lea COLOR14(a6),a0 - move.w #$997,(a0) + move.w #$9aa,(a0) lea COLOR15(a6),a0 move.w #$edb,(a0) movem.l (sp)+,d0-a6 diff --git a/tools/imagecon/reference/lace.png-ham.bin b/tools/imagecon/reference/lace.png-ham.bin new file mode 100644 index 0000000..1d582e6 Binary files /dev/null and b/tools/imagecon/reference/lace.png-ham.bin differ diff --git a/tools/imagecon/reference/lace.png-palette.s b/tools/imagecon/reference/lace.png-palette.s new file mode 100644 index 0000000..8810acc --- /dev/null +++ b/tools/imagecon/reference/lace.png-palette.s @@ -0,0 +1,35 @@ + movem.l d0-a6,-(sp) + lea CUSTOM,a6 + lea COLOR00(a6),a0 + move.w #$421,(a0) + lea COLOR01(a6),a0 + move.w #$631,(a0) + lea COLOR02(a6),a0 + move.w #$752,(a0) + lea COLOR03(a6),a0 + move.w #$e96,(a0) + lea COLOR04(a6),a0 + move.w #$89a,(a0) + lea COLOR05(a6),a0 + move.w #$210,(a0) + lea COLOR06(a6),a0 + move.w #$689,(a0) + lea COLOR07(a6),a0 + move.w #$963,(a0) + lea COLOR08(a6),a0 + move.w #$c84,(a0) + lea COLOR09(a6),a0 + move.w #$552,(a0) + lea COLOR10(a6),a0 + move.w #$665,(a0) + lea COLOR11(a6),a0 + move.w #$fb7,(a0) + lea COLOR12(a6),a0 + move.w #$886,(a0) + lea COLOR13(a6),a0 + move.w #$455,(a0) + lea COLOR14(a6),a0 + move.w #$aa8,(a0) + lea COLOR15(a6),a0 + move.w #$edb,(a0) + movem.l (sp)+,d0-a6 diff --git a/tools/imagecon/reference/shared-copper-list.s b/tools/imagecon/reference/shared-copper-list.s deleted file mode 100644 index 9629241..0000000 --- a/tools/imagecon/reference/shared-copper-list.s +++ /dev/null @@ -1,32 +0,0 @@ - dc.w $180,$474 - dc.w $182,$111 - dc.w $184,$feb - dc.w $186,$b85 - dc.w $188,$37b - dc.w $18a,$343 - dc.w $18c,$222 - dc.w $18e,$b85 - dc.w $190,$b85 - dc.w $192,$36b - dc.w $194,$ffd - dc.w $196,$353 - dc.w $198,$48c - dc.w $19a,$ca5 - dc.w $19c,$543 - dc.w $19e,$574 - dc.w $1a0,$abc - dc.w $1a2,$fe9 - dc.w $1a4,$684 - dc.w $1a6,$eca - dc.w $1a8,$bdd - dc.w $1aa,$9aa - dc.w $1ac,$cef - dc.w $1ae,$ba8 - dc.w $1b0,$898 - dc.w $1b2,$fff - dc.w $1b4,$db7 - dc.w $1b6,$765 - dc.w $1b8,$375 - dc.w $1ba,$6ad - dc.w $1bc,$8a4 - dc.w $1be,$587 diff --git a/tools/imagecon/reference/shared.bin b/tools/imagecon/reference/shared.bin deleted file mode 100644 index ff91fd7..0000000 Binary files a/tools/imagecon/reference/shared.bin and /dev/null differ diff --git a/tools/imagecon/reference/shared_palette.png.bin b/tools/imagecon/reference/shared_palette.png.bin new file mode 100644 index 0000000..d35ecd8 Binary files /dev/null and b/tools/imagecon/reference/shared_palette.png.bin differ diff --git a/tools/imagecon/reference/shared.pal b/tools/imagecon/reference/shared_palette.png.pal similarity index 100% rename from tools/imagecon/reference/shared.pal rename to tools/imagecon/reference/shared_palette.png.pal diff --git a/tools/imagecon/reference/use_palette.png-palette.s b/tools/imagecon/reference/use_palette.png-palette.s new file mode 100644 index 0000000..f062381 --- /dev/null +++ b/tools/imagecon/reference/use_palette.png-palette.s @@ -0,0 +1,67 @@ + movem.l d0-a6,-(sp) + lea CUSTOM,a6 + lea COLOR00(a6),a0 + move.w #$36b,(a0) + lea COLOR01(a6),a0 + move.w #$48b,(a0) + lea COLOR02(a6),a0 + move.w #$363,(a0) + lea COLOR03(a6),a0 + move.w #$ffd,(a0) + lea COLOR04(a6),a0 + move.w #$111,(a0) + lea COLOR05(a6),a0 + move.w #$443,(a0) + lea COLOR06(a6),a0 + move.w #$fec,(a0) + lea COLOR07(a6),a0 + move.w #$37b,(a0) + lea COLOR08(a6),a0 + move.w #$222,(a0) + lea COLOR09(a6),a0 + move.w #$332,(a0) + lea COLOR10(a6),a0 + move.w #$574,(a0) + lea COLOR11(a6),a0 + move.w #$eda,(a0) + lea COLOR12(a6),a0 + move.w #$554,(a0) + lea COLOR13(a6),a0 + move.w #$ca5,(a0) + lea COLOR14(a6),a0 + move.w #$59c,(a0) + lea COLOR15(a6),a0 + move.w #$684,(a0) + lea COLOR16(a6),a0 + move.w #$a95,(a0) + lea COLOR17(a6),a0 + move.w #$bde,(a0) + lea COLOR18(a6),a0 + move.w #$aba,(a0) + lea COLOR19(a6),a0 + move.w #$dc9,(a0) + lea COLOR20(a6),a0 + move.w #$9bc,(a0) + lea COLOR21(a6),a0 + move.w #$aa8,(a0) + lea COLOR22(a6),a0 + move.w #$8a9,(a0) + lea COLOR23(a6),a0 + move.w #$def,(a0) + lea COLOR24(a6),a0 + move.w #$897,(a0) + lea COLOR25(a6),a0 + move.w #$bcc,(a0) + lea COLOR26(a6),a0 + move.w #$fff,(a0) + lea COLOR27(a6),a0 + move.w #$765,(a0) + lea COLOR28(a6),a0 + move.w #$db6,(a0) + lea COLOR29(a6),a0 + move.w #$486,(a0) + lea COLOR30(a6),a0 + move.w #$6ad,(a0) + lea COLOR31(a6),a0 + move.w #$8a4,(a0) + movem.l (sp)+,d0-a6 diff --git a/tools/imagecon/reference/use_palette.png.bin b/tools/imagecon/reference/use_palette.png.bin new file mode 100644 index 0000000..3f9dc44 Binary files /dev/null and b/tools/imagecon/reference/use_palette.png.bin differ diff --git a/tools/imagecon/reference/use_palette.png.pal b/tools/imagecon/reference/use_palette.png.pal new file mode 100644 index 0000000..879bacf --- /dev/null +++ b/tools/imagecon/reference/use_palette.png.pal @@ -0,0 +1,32 @@ +36b +48b +363 +ffd +111 +443 +fec +37b +222 +332 +574 +eda +554 +ca5 +59c +684 +a95 +bde +aba +dc9 +9bc +aa8 +8a9 +def +897 +bcc +fff +765 +db6 +486 +6ad +8a4 diff --git a/tools/imagecon/test-images/32color-quant.png b/tools/imagecon/test-images/32color-quant.png new file mode 100644 index 0000000..f2415a8 Binary files /dev/null and b/tools/imagecon/test-images/32color-quant.png differ diff --git a/tools/imagecon/test-images/bob.png b/tools/imagecon/test-images/bob.png new file mode 100644 index 0000000..751549e Binary files /dev/null and b/tools/imagecon/test-images/bob.png differ diff --git a/tools/imagecon/test-images/dithered_ham.png b/tools/imagecon/test-images/dithered_ham.png new file mode 100644 index 0000000..6ff89a4 Binary files /dev/null and b/tools/imagecon/test-images/dithered_ham.png differ diff --git a/tools/imagecon/test-images/extra_half_brite.png b/tools/imagecon/test-images/extra_half_brite.png new file mode 100644 index 0000000..f2415a8 Binary files /dev/null and b/tools/imagecon/test-images/extra_half_brite.png differ diff --git a/tools/imagecon/test-images/ham_mode.png b/tools/imagecon/test-images/ham_mode.png new file mode 100644 index 0000000..6ff89a4 Binary files /dev/null and b/tools/imagecon/test-images/ham_mode.png differ diff --git a/tools/imagecon/test-images/lace.png b/tools/imagecon/test-images/lace.png new file mode 100644 index 0000000..114ec58 Binary files /dev/null and b/tools/imagecon/test-images/lace.png differ diff --git a/tools/imagecon/test-images/use_palette.png b/tools/imagecon/test-images/use_palette.png new file mode 100644 index 0000000..f2415a8 Binary files /dev/null and b/tools/imagecon/test-images/use_palette.png differ