summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2015-02-13 13:30:34 +0100
committerLars-Dominik Braun <lars@6xq.net>2015-05-02 21:36:45 +0200
commitf1e18b157c28d68ef67dcf7e617226824df1c323 (patch)
tree2c4bab35415dbbe77e50b9d215975dd83398ae99
parent116749bc7e14e0585ad09bf91ab63175bbe40bf8 (diff)
downloadpucket-f1e18b157c28d68ef67dcf7e617226824df1c323.tar.gz
pucket-f1e18b157c28d68ef67dcf7e617226824df1c323.tar.bz2
pucket-f1e18b157c28d68ef67dcf7e617226824df1c323.zip
Drop support for jpeg/netpbm output
-rw-r--r--docstring.c3
-rw-r--r--flam3-animate.c28
-rw-r--r--flam3-render.c28
-rw-r--r--img.h2
-rw-r--r--jpeg.c145
-rw-r--r--wscript6
6 files changed, 6 insertions, 206 deletions
diff --git a/docstring.c b/docstring.c
index 4e72ff9..c992fe8 100644
--- a/docstring.c
+++ b/docstring.c
@@ -64,8 +64,6 @@ static char *the_docstring1 =
"nstrips 1 number of strips, ie render fractions of a frame at once (render only)\n"
"qs 1 quality scale, multiply quality of all frames by this\n"
"ss 1 size scale, multiply size (in pixels) of all frames by this\n"
-"jpeg NA jpeg quality for compression, default is native jpeg default\n"
-"format png jpg or ppm or png\n"
"pixel_aspect 1.0 aspect ratio of pixels (width over height), eg 0.90909 for NTSC\n"
"seed random integer seed for random numbers, defaults to time+pid\n"
"nthreads 0 number of threads to use for render. default auto-detects.\n"
@@ -99,7 +97,6 @@ static char *the_docstring1 =
"print_edit_depth 0 depth to truncate <edit> tag structure. 0 prints all <edit> tags (genome only)\n"
"intpalette unset round palette entries for importing into older Apophysis versions (genome only)\n"
"insert_palette unset insert the palette into the image.\n"
-"enable_jpeg_comments 1 enables comments in the jpeg header (render and animate)\n"
"enable_png_comments 1 enables comments in the png header (render and animate)\n"
"\n"
"earlyclip 0 enables the early clipping of rgb values for better antialiasing and resizing\n"
diff --git a/flam3-animate.c b/flam3-animate.c
index 267064c..eb9eb50 100644
--- a/flam3-animate.c
+++ b/flam3-animate.c
@@ -32,7 +32,7 @@ int main(int argc, char **argv) {
int write_genome = argi("write_genome",0);
double qs = argf("qs", 1.0);
double ss = argf("ss", 1.0);
- char *format = getenv("format");
+ const char *format = "png";
int verbose = argi("verbose", 1);
int transparency = argi("transparency", 0);
int bits = argi("bits", 33);
@@ -96,15 +96,6 @@ int main(int argc, char **argv) {
first_frame = last_frame = frame_time;
}
- if (NULL == format) format = "png";
- if (strcmp(format, "jpg") &&
- strcmp(format, "ppm") &&
- strcmp(format, "png")) {
- fprintf(stderr, "format must be either jpg, ppm, or png, not %s.\n", format);
- exit(1);
- }
-
-
if (pixel_aspect <= 0.0) {
fprintf(stderr, "pixel aspect ratio must be positive, not %g.\n",
pixel_aspect);
@@ -277,22 +268,7 @@ int main(int argc, char **argv) {
sprintf(rtime_string,"%d",stats.render_seconds);
fpc.rtime = rtime_string;
- if (!strcmp(format, "png")) {
-
- write_png(fp, image, cps[0].width, cps[0].height, &fpc, f.bytes_per_channel);
-
- } else if (!strcmp(format, "jpg")) {
-
- write_jpeg(fp, image, cps[0].width, cps[0].height, &fpc);
-
- } else {
- int size = 3 * cps[0].width * cps[0].height;
- fprintf(fp, "P6\n");
- fprintf(fp, "%d %d\n255\n", cps[0].width, cps[0].height);
- if (size != fwrite(image, 1, size, fp)) {
- perror(fname);
- }
- }
+ write_png(fp, image, cps[0].width, cps[0].height, &fpc, f.bytes_per_channel);
/* Free string */
free(fpc.genome);
diff --git a/flam3-render.c b/flam3-render.c
index 47727da..a4f8d93 100644
--- a/flam3-render.c
+++ b/flam3-render.c
@@ -89,7 +89,7 @@ int main(int argc, char **argv) {
randctx savectx;
char *prefix = args("prefix", "");
char *out = args("out", NULL);
- char *format = getenv("format");
+ const char *format = "png";
int verbose = argi("verbose", 1);
int bits = argi("bits", 33);
int bpc = argi("bpc",8);
@@ -133,16 +133,6 @@ int main(int argc, char **argv) {
}
- if (NULL == format) format = "png";
- if (strcmp(format, "jpg") &&
- strcmp(format, "ppm") &&
- strcmp(format, "png")) {
- fprintf(stderr,
- "format must be either jpg, ppm, or png, not %s.\n",
- format);
- exit(1);
- }
-
channels = strcmp(format, "png") ? 3 : 4;
/* Check for 16-bit-per-channel processing */
@@ -322,21 +312,7 @@ int main(int argc, char **argv) {
sprintf(rtime_string,"%d",stats.render_seconds);
fpc.rtime = rtime_string;
- if (!strcmp(format, "png")) {
-
- write_png(fp, image, cps[i].width, real_height, &fpc, f.bytes_per_channel);
-
- } else if (!strcmp(format, "jpg")) {
-
- write_jpeg(fp, (unsigned char *)image, cps[i].width, real_height, &fpc);
-
- } else {
- fprintf(fp, "P6\n");
- fprintf(fp, "%d %d\n255\n", cps[i].width, real_height);
- if (this_size != fwrite((unsigned char *)image, 1, this_size, fp)) {
- perror(fname);
- }
- }
+ write_png(fp, image, cps[i].width, real_height, &fpc, f.bytes_per_channel);
/* Free string */
free(fpc.genome);
diff --git a/img.h b/img.h
index a2693fc..a7ac7de 100644
--- a/img.h
+++ b/img.h
@@ -32,9 +32,7 @@ typedef struct {
} flam3_img_comments;
-void write_jpeg(FILE *file, unsigned char *image, int width, int height, flam3_img_comments *fpc);
void write_png(FILE *file, void *image, int width, int height, flam3_img_comments *fpc, int bpc);
/* returns RGBA pixel array or NULL on failure */
unsigned char *read_png(FILE *file, int *width, int *height);
-unsigned char *read_jpeg(FILE *file, int *width, int *height);
diff --git a/jpeg.c b/jpeg.c
deleted file mode 100644
index 218f1be..0000000
--- a/jpeg.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- FLAM3 - cosmic recursive fractal flames
- Copyright (C) 1992-2009 Spotworks LLC
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <jpeglib.h>
-#include <string.h>
-
-#include "config.h"
-#include "img.h"
-#include "flam3.h"
-#include "private.h"
-
-void
-write_jpeg(FILE *file, unsigned char *image, int width, int height, flam3_img_comments *fpc) {
- struct jpeg_compress_struct info;
- struct jpeg_error_mgr jerr;
- size_t i;
- char *nick = getenv("nick");
- char *url = getenv("url");
- char *id = getenv("id");
- char *ai; /* For argi */
- int jpegcom_enable = argi("enable_jpeg_comments",1);
-
- char nick_string[64], url_string[128], id_string[128];
- char bv_string[64],ni_string[64],rt_string[64];
- char genome_string[65536], ver_string[64];
-
- /* Create the mandatory comment strings */
- snprintf(genome_string,65536,"flam3_genome: %s",fpc->genome);
- snprintf(bv_string,64,"flam3_error_rate: %s",fpc->badvals);
- snprintf(ni_string,64,"flam3_samples: %s",fpc->numiters);
- snprintf(rt_string,64,"flam3_time: %s",fpc->rtime);
- snprintf(ver_string,64,"flam3_version: %s",flam3_version());
-
- info.err = jpeg_std_error(&jerr);
- jpeg_create_compress(&info);
- jpeg_stdio_dest(&info, file);
- info.in_color_space = JCS_RGB;
- info.input_components = 3;
- info.image_width = width;
- info.image_height = height;
- jpeg_set_defaults(&info);
-
- if (getenv("jpeg")) {
- int quality = atoi(getenv("jpeg"));
- jpeg_set_quality(&info, quality, TRUE);
- }
-
- jpeg_start_compress(&info, TRUE);
-
- /* Write comments to jpeg */
- if (jpegcom_enable==1) {
- jpeg_write_marker(&info, JPEG_COM, (unsigned char *)ver_string, (int)strlen(ver_string));
-
- if (0 != nick) {
- snprintf(nick_string,64,"flam3_nickname: %s",nick);
- jpeg_write_marker(&info, JPEG_COM, (unsigned char *)nick_string, (int)strlen(nick_string));
- }
-
- if (0 != url) {
- snprintf(url_string,128,"flam3_url: %s",url);
- jpeg_write_marker(&info, JPEG_COM, (unsigned char *)url_string, (int)strlen(url_string));
- }
-
- if (0 != id) {
- snprintf(id_string,128,"flam3_id: %s",id);
- jpeg_write_marker(&info, JPEG_COM, (unsigned char *)id_string, (int)strlen(id_string));
- }
-
- jpeg_write_marker(&info, JPEG_COM, (unsigned char *)bv_string, (int)strlen(bv_string));
- jpeg_write_marker(&info, JPEG_COM, (unsigned char *)ni_string, (int)strlen(ni_string));
- jpeg_write_marker(&info, JPEG_COM, (unsigned char *)rt_string, (int)strlen(rt_string));
- jpeg_write_marker(&info, JPEG_COM, (unsigned char *)genome_string, (int)strlen(genome_string));
- }
-
- for (i = 0; i < height; i++) {
- JSAMPROW row_pointer[1];
- row_pointer[0] = (unsigned char *) image + (3 * width * i);
- jpeg_write_scanlines(&info, row_pointer, 1);
- }
- jpeg_finish_compress(&info);
- jpeg_destroy_compress(&info);
-}
-
-unsigned char *read_jpeg(FILE *ifp, int *width, int *height) {
- struct jpeg_decompress_struct cinfo;
- struct jpeg_error_mgr jerr;
- int num_scanlines;
- unsigned char *p, *q, *t;
-
- cinfo.err = jpeg_std_error(&jerr);
- jpeg_create_decompress(&cinfo);
- jpeg_stdio_src(&cinfo, ifp);
- (void) jpeg_read_header(&cinfo, TRUE);
- (void) jpeg_start_decompress(&cinfo);
-
- /* or image_width? */
- *width = cinfo.output_width;
- *height = cinfo.output_height;
-
- if (3 != cinfo.output_components) {
- printf("can only read RGB JPEG files, not %d components.\n",
- cinfo.output_components);
- return 0;
- }
- p = q = malloc(4 * *width * *height);
- t = malloc(3 * *width);
-
- while (cinfo.output_scanline < cinfo.output_height) {
- unsigned char *s = t;
- int i;
- num_scanlines = jpeg_read_scanlines(&cinfo, &t, 1);
- for (i = 0; i < *width; i++) {
- p[0] = s[0];
- p[1] = s[1];
- p[2] = s[2];
- p[3] = 255;
- s += 3;
- p += 4;
- }
- }
-
- (void) jpeg_finish_decompress(&cinfo);
- jpeg_destroy_decompress(&cinfo);
-
- free(t);
- return q;
-}
diff --git a/wscript b/wscript
index 8a1f64a..91e636f 100644
--- a/wscript
+++ b/wscript
@@ -11,7 +11,6 @@ def configure(conf):
conf.check_cfg (path='xml2-config', args='--cflags --libs', package='', uselib_store='xml2')
conf.check_cc (lib='xml2', header_name='libxml/parser.h', function_name='xmlParseFile', use='xml2')
conf.check_cc (lib='pthread', uselib_store='pthread')
- conf.check_cc (lib='jpeg', uselib_store='jpeg')
conf.check_cfg (package='libpng', uselib_store='png', args=['--cflags', '--libs'], msg='Checking for library png')
conf.check_cc (lib='amdlibm', header_name='amdlibm.h', mandatory=False, define_name='HAVE_AMDLIBM', uselib_store='amdlibm')
@@ -20,9 +19,8 @@ def configure(conf):
conf.write_config_header ('config.h')
def build(bld):
- bld.stlib (features='c cstlib', source='flam3.c filters.c parser.c variations.c interpolation.c palettes.c jpeg.c png.c xorshift.c docstring.c', target='libflam3', use='xml2 png jpeg pthread', includes='.')
- bld.program (features='c cprogram', source='flam3-render.c', target='flam3-render', use='libflam3 xml2 jpeg png amdlibm pthread', includes='.')
+ bld.stlib (features='c cstlib', source='flam3.c filters.c parser.c variations.c interpolation.c palettes.c png.c xorshift.c docstring.c', target='libflam3', use='xml2 png pthread', includes='.')
+ bld.program (features='c cprogram', source='flam3-render.c', target='flam3-render', use='libflam3 xml2 png amdlibm pthread', includes='.')
bld.program (features='c cprogram', source='flam3-genome.c', target='flam3-genome', use='libflam3 xml2 png amdlibm pthread', includes='.')
bld.program (features='c cprogram', source='flam3-animate.c', target='flam3-animate', use='libflam3 xml2 png amdlibm pthread', includes='.')
- #bld.program (features='c cprogram', source='flam3-convert.c', target='flam3-convert', use='libflam3 xml2 png amdlibm pthread', includes='.')