svnno****@sourc*****
svnno****@sourc*****
2011年 3月 23日 (水) 21:43:41 JST
Revision: 451 http://sourceforge.jp/projects/swfed/svn/view?view=rev&revision=451 Author: yoya Date: 2011-03-23 21:43:41 +0900 (Wed, 23 Mar 2011) Log Message: ----------- author: yoya zlib compress level を swf_object_t で管理する Modified Paths: -------------- trunk/src/swf_object.c trunk/src/swf_object.h trunk/src/swf_tag_jpeg.c trunk/src/swf_tag_lossless.c -------------- next part -------------- Modified: trunk/src/swf_object.c =================================================================== --- trunk/src/swf_object.c 2011-03-22 17:32:43 UTC (rev 450) +++ trunk/src/swf_object.c 2011-03-23 12:43:41 UTC (rev 451) @@ -31,6 +31,7 @@ swf = (swf_object_t *) calloc(sizeof(*swf), 1); // swf->shape_adjust_mode = 0; + swf->compress_level = Z_DEFAULT_COMPRESSION; return swf; } @@ -174,7 +175,7 @@ old_size = bs->data_len - SWF_HEADER_SIZE; compsize = old_size * 1.001 + 12; // 稀に増える事もあるので new_buff = malloc(compsize); - result = compress(new_buff, &compsize, old_buff_ref, old_size); + result = compress2(new_buff, &compsize, old_buff_ref, old_size, swf->compress_level); if (result != Z_OK) { if (result == Z_MEM_ERROR) { fprintf(stderr, "swf_object_output: compress Z_MEM_ERROR: can't malloc\n"); Modified: trunk/src/swf_object.h =================================================================== --- trunk/src/swf_object.h 2011-03-22 17:32:43 UTC (rev 450) +++ trunk/src/swf_object.h 2011-03-23 12:43:41 UTC (rev 451) @@ -17,6 +17,7 @@ swf_header_movie_t header_movie; swf_tag_t *tag; unsigned shape_adjust_mode; + unsigned compress_level; } swf_object_t; #define SWFED_SHAPE_BITMAP_NONE 0 Modified: trunk/src/swf_tag_jpeg.c =================================================================== --- trunk/src/swf_tag_jpeg.c 2011-03-22 17:32:43 UTC (rev 450) +++ trunk/src/swf_tag_jpeg.c 2011-03-23 12:43:41 UTC (rev 451) @@ -11,6 +11,7 @@ #include "bitstream.h" #include "swf_define.h" #include "swf_tag_jpeg.h" +#include "swf_object.h" // #include "swf_tag.h" #include "swf_jpeg.h" #include "jpeg_segment.h" @@ -289,10 +290,12 @@ unsigned long offset_to_alpha; unsigned long compsize, old_size; int result; - (void) swf; if (tag == NULL) { fprintf(stderr, "swf_tag_jpeg3_output_detail: tag == NULL\n"); } + if (swf == NULL) { + fprintf(stderr, "swf_tag_jpeg3_output_detail: swf == NULL\n"); + } if (length == NULL) { fprintf(stderr, "swf_tag_jpeg3_output_detail: length == NULL\n"); } @@ -306,6 +309,7 @@ old_size = swf_tag_jpeg->alpha_data_len; compsize = old_size * 1.001 + 12; // 稀に増える事もあるので new_buff = malloc(compsize); + // result = compress2(new_buff, &compsize, swf_tag_jpeg->alpha_data, old_size, swf->compress_level); result = compress(new_buff, &compsize, swf_tag_jpeg->alpha_data, old_size); if (result != Z_OK) { if (result == Z_MEM_ERROR) { Modified: trunk/src/swf_tag_lossless.c =================================================================== --- trunk/src/swf_tag_lossless.c 2011-03-22 17:32:43 UTC (rev 450) +++ trunk/src/swf_tag_lossless.c 2011-03-23 12:43:41 UTC (rev 451) @@ -11,6 +11,7 @@ #include "bitstream.h" #include "swf_define.h" #include "swf_tag_lossless.h" +#include "swf_object.h" #include "swf_png.h" #include "swf_gif.h" @@ -230,11 +231,14 @@ unsigned char *tmp_buff = NULL, *old_buff_ref = NULL; unsigned long compsize, old_size; int result; - (void) swf; if (tag == NULL) { fprintf(stderr, "swf_tag_lossless_output_detail: tag == NULL\n"); return NULL; } + if (swf == NULL) { + fprintf(stderr, "swf_tag_lossless_output_detail: swf == NULL\n"); + return NULL; + } if (length == NULL) { fprintf(stderr, "swf_tag_lossless_output_detail: length == NULL\n"); return NULL; @@ -268,7 +272,7 @@ old_size = bitstream_length(bs2); compsize = old_size * 1.001 + 12; // 稀に増える事もあるので tmp_buff = malloc(compsize); - result = compress(tmp_buff, &compsize, old_buff_ref, old_size); + result = compress2(tmp_buff, &compsize, old_buff_ref, old_size, swf->compress_level); if (result != Z_OK) { if (result == Z_MEM_ERROR) { fprintf(stderr, "swf_tag_lossless_output_detail: compress Z_MEM_ERROR: can't malloc\n");