Changeset 3083 for libpipi/trunk
- Timestamp:
- Oct 24, 2008, 2:03:15 PM (12 years ago)
- Location:
- libpipi/trunk/pipi/codec
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libpipi/trunk/pipi/codec/modular.c
r3075 r3083 1 /* 2 * libpipi Pathetic image processing interface library 3 * Copyright (c) 2004-2008 Sam Hocevar <sam@zoy.org> 4 * 2008 Jean-Yves Lamoureux <jylam@lnxscene.org> 5 * All Rights Reserved 6 * 7 * $Id$ 8 * 9 * This library is free software. It comes without any warranty, to 10 * the extent permitted by applicable law. You can redistribute it 11 * and/or modify it under the terms of the Do What The Fuck You Want 12 * To Public License, Version 2, as published by Sam Hocevar. See 13 * http://sam.zoy.org/wtfpl/COPYING for more details. 14 */ 15 16 /* 17 * modular.c: hand-written codecs multiplexer 18 */ 19 1 20 #include "modular.h" 2 21 … … 9 28 int pipi_save_modular(pipi_image_t *img, const char *name) 10 29 { 11 return pipi_save_jpeg(img, name); 30 if(!strncasecmp(&name[strlen(name) - 3], "jpg", 3) || 31 !strncasecmp(&name[strlen(name) - 4], "jpeg", 4) ) 32 return pipi_save_jpeg(img, name); 33 return -1; 12 34 } -
libpipi/trunk/pipi/codec/modular/jpeg.c
r3081 r3083 48 48 if(!fp) goto end; 49 49 50 50 /* Set callbacks */ 51 51 cinfo.err = jpeg_std_error(&jerr); 52 52 jerr.error_exit = error_msg; … … 55 55 jerr.format_message = format_msg; 56 56 57 /* Initialize libjpeg */ 57 58 jpeg_create_decompress(&cinfo); 58 59 cinfo.client_data = 0x0; … … 70 71 } 71 72 73 /* One scanline */ 72 74 image = malloc(cinfo.output_width * cinfo.output_height * 4); 73 75 if(!image) goto end; … … 75 77 scanline = malloc(cinfo.output_width * 3); 76 78 77 /* Read scanlines, converting them to RGBA */ 79 78 80 for(i=0; i < cinfo.output_height; i++) 79 81 { … … 134 136 data = pixels->pixels; 135 137 136 137 138 line = malloc(img->w * 3 * sizeof(unsigned char)); 138 139 if (!line) … … 175 176 ptr++; 176 177 } 177 /* write scanline */178 178 jbuf = (JSAMPROW *) (&line); 179 179 jpeg_write_scanlines(&cinfo, jbuf, 1);
Note: See TracChangeset
for help on using the changeset viewer.