head 1.12; access; symbols pkgsrc-2013Q2:1.12.0.4 pkgsrc-2013Q2-base:1.12 pkgsrc-2012Q4:1.12.0.2 pkgsrc-2012Q4-base:1.12 pkgsrc-2012Q2:1.11.0.12 pkgsrc-2012Q2-base:1.11 pkgsrc-2012Q1:1.11.0.10 pkgsrc-2012Q1-base:1.11 pkgsrc-2011Q4:1.11.0.8 pkgsrc-2011Q4-base:1.11 pkgsrc-2011Q3:1.11.0.6 pkgsrc-2011Q3-base:1.11 pkgsrc-2011Q2:1.11.0.4 pkgsrc-2011Q2-base:1.11 pkgsrc-2011Q1:1.11.0.2 pkgsrc-2011Q1-base:1.11 pkgsrc-2009Q4:1.6.0.2 pkgsrc-2009Q4-base:1.6 pkgsrc-2008Q4:1.4.0.24 pkgsrc-2008Q4-base:1.4 pkgsrc-2008Q3:1.4.0.22 pkgsrc-2008Q3-base:1.4 cube-native-xorg:1.4.0.20 cube-native-xorg-base:1.4 pkgsrc-2008Q2:1.4.0.18 pkgsrc-2008Q2-base:1.4 cwrapper:1.4.0.16 pkgsrc-2008Q1:1.4.0.14 pkgsrc-2008Q1-base:1.4 pkgsrc-2007Q4:1.4.0.12 pkgsrc-2007Q4-base:1.4 pkgsrc-2007Q3:1.4.0.10 pkgsrc-2007Q3-base:1.4 pkgsrc-2007Q2:1.4.0.8 pkgsrc-2007Q2-base:1.4 pkgsrc-2007Q1:1.4.0.6 pkgsrc-2007Q1-base:1.4 pkgsrc-2006Q4:1.4.0.4 pkgsrc-2006Q4-base:1.4 pkgsrc-2006Q3:1.4.0.2 pkgsrc-2006Q3-base:1.4 pkgsrc-2006Q2:1.3.0.2 pkgsrc-2006Q2-base:1.3 pkgsrc-2006Q1:1.2.0.2 pkgsrc-2006Q1-base:1.2 pkgsrc-2005Q4:1.1.1.1.0.16 pkgsrc-2005Q4-base:1.1.1.1 pkgsrc-2005Q3:1.1.1.1.0.14 pkgsrc-2005Q3-base:1.1.1.1 pkgsrc-2005Q2:1.1.1.1.0.12 pkgsrc-2005Q2-base:1.1.1.1 pkgsrc-2005Q1:1.1.1.1.0.10 pkgsrc-2005Q1-base:1.1.1.1 pkgsrc-2004Q4:1.1.1.1.0.8 pkgsrc-2004Q4-base:1.1.1.1 pkgsrc-2004Q3:1.1.1.1.0.6 pkgsrc-2004Q3-base:1.1.1.1 pkgsrc-2004Q2:1.1.1.1.0.4 pkgsrc-2004Q2-base:1.1.1.1 pkgsrc-2004Q1:1.1.1.1.0.2 pkgsrc-2004Q1-base:1.1.1.1 pkgsrc-base:1.1.1.1 TNF:1.1.1; locks; strict; comment @# @; 1.12 date 2012.07.07.15.49.00; author adam; state dead; branches; next 1.11; 1.11 date 2011.02.10.17.06.27; author wiz; state Exp; branches; next 1.10; 1.10 date 2011.02.10.16.41.56; author wiz; state Exp; branches; next 1.9; 1.9 date 2011.02.07.10.20.10; author wiz; state Exp; branches; next 1.8; 1.8 date 2011.02.06.15.37.21; author wiz; state Exp; branches; next 1.7; 1.7 date 2011.01.24.10.04.21; author wiz; state Exp; branches; next 1.6; 1.6 date 2009.01.08.17.25.31; author wiz; state dead; branches; next 1.5; 1.5 date 2009.01.08.17.21.36; author wiz; state Exp; branches; next 1.4; 1.4 date 2006.08.04.16.43.37; author tron; state Exp; branches; next 1.3; 1.3 date 2006.06.30.18.39.08; author tron; state Exp; branches; next 1.2; 1.2 date 2006.01.25.08.09.12; author xtraeme; state dead; branches; next 1.1; 1.1 date 2004.01.26.12.44.06; author jmmv; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 2004.01.26.12.44.06; author jmmv; state Exp; branches; next ; desc @@ 1.12 log @Changes 2.0.0: * a lot of small patches and fixes @ text @$NetBSD: patch-ac,v 1.11 2011/02/10 17:06:27 wiz Exp $ Fix build with png-1.5, from John Bowler . https://sourceforge.net/tracker/?func=detail&aid=3177485&group_id=5776&atid=105776 --- lavtools/png2yuv.c.orig 2007-11-08 17:31:50.000000000 +0000 +++ lavtools/png2yuv.c @@@@ -49,12 +49,9 @@@@ png2yuv #include "subsample.h" #include "colorspace.h" -//#include "mplexconsts.hh" #define DEFAULT_CHROMA_MODE Y4M_CHROMA_420JPEG -#define MAXPIXELS (2800*1152) /**< Maximum size of final image */ - typedef struct _parameters { char *pngformatstr; @@@@ -70,14 +67,10 @@@@ typedef struct _parameters int ss_mode; /**< subsampling mode (based on ssm_id from subsample.h) */ int new_width; /// new MPEG2 width, in case the original one is uneven + int new_height; /// new MPEG2 width, in case the original one is uneven } parameters_t; -struct _parameters *sh_param; -png_structp png_ptr; -png_infop info_ptr, end_info; -uint8_t *raw0, *raw1, *raw2; /* buffer for RGB first, and then Y/Cb/Cr planes of decoded PNG */ - /* * The User Interface parts */ @@@@ -152,8 +145,6 @@@@ static void parse_commandline(int argc, param->interleave = -1; param->verbose = 1; param->ss_mode = DEFAULT_CHROMA_MODE; - //param->mza_filename = NULL; - //param->make_z_alpha = 0; /* parse options */ for (;;) { @@@@ -240,93 +231,43 @@@@ static void parse_commandline(int argc, } } -void png_separation(png_structp png_ptr, png_row_infop row_info, png_bytep data) -{ - int row_nr = png_ptr->row_number; // internal variable ? - int i, width = row_info->width; - int new_width = sh_param->new_width; - - /* contents of row_info: - * png_uint_32 width width of row - * png_uint_32 rowbytes number of bytes in row - * png_byte color_type color type of pixels - * png_byte bit_depth bit depth of samples - * png_byte channels number of channels (1-4) - * png_byte pixel_depth bits per pixel (depth*channels) - */ - - //mjpeg_debug("PNG YUV transformation callback; color_type is %d row_number %d\n", - // row_info->color_type, row_nr); - - if(row_info->color_type == PNG_COLOR_TYPE_GRAY) // only Z available - { - //mjpeg_debug("Grayscale to YUV, row %d", row_nr); - for (i = 0; i < width; i++) - { - raw0[i + row_nr * new_width] = data[i]; - raw1[i + row_nr * new_width] = data[i]; - raw2[i + row_nr * new_width] = data[i]; - } - return; - } - - if(row_info->color_type == PNG_COLOR_TYPE_RGB) // Z and Alpha available - { - //mjpeg_info("RGB to YUV, row %d", row_nr); - for (i = 0; i < width; i++) - { - raw0[i + row_nr * new_width] = data[i*3]; - raw1[i + row_nr * new_width] = data[i*3 + 1]; - raw2[i + row_nr * new_width] = data[i*3 + 2]; - } - return; - } - - mjpeg_error_exit1("mpegz: UNKNOWN COLOR FORMAT %d in PNG transformation !\n", row_info->color_type); -} - /* * The file handling parts */ /** Reads one PNG file. -@@param process Process the image data (0 for initial parameter determination) +@@param process Process the image data (NULL for initial parameter determination) @@returns -1 on failure, 1 on sucess +@@on success returns RGB data in the second, yuv, parameter */ -int decode_png(const char *pngname, int process, parameters_t *param) +int decode_png(const char *pngname, uint8_t *yuv[], parameters_t *param) { - int num_pass = 1; - int bit_depth, color_type; + png_structp png_ptr; + png_infop info_ptr; FILE *pngfile; - //png_byte hdptr[8]; - - /* Now open this PNG file, and examine its header to retrieve the - YUV4MPEG info that shall be written */ - pngfile = fopen(pngname, "rb"); - if (!pngfile) - { - perror("PNG file open failed:"); - return -1; - } - //fread(hdptr, 1, 8, pngfile); + /* libpng needs two structs - a png_struct and a png_info, there is no + * need to make the third, another png_info, because that is only used + * to store data (such as textual information) that can come after the + * PNG image. This code only cares about the image. + */ + info_ptr = NULL; + pngfile = NULL; + png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + if (!png_ptr) + mjpeg_error_exit1("%s: Could not allocate PNG read struct !", pngname); -#if 0 - bool is_png = !png_sig_cmp(hdptr, 0, 8); - if (!is_png) + /* This needs to be done immediately after creation of the png_struct + * because storage allocation failures will longjmp back to here: + */ + if (setjmp(png_jmpbuf(png_ptr))) { - mjpeg_error("%s is _no_ PNG file !\n"); + png_destroy_read_struct(&png_ptr, &info_ptr, 0); + if (pngfile) (void)fclose(pngfile); + mjpeg_error("%s: Corrupted PNG file !", pngname); return -1; } -#endif - - png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); - if (!png_ptr) - mjpeg_error_exit1("%s: Could not allocate PNG read struct !", pngname); - - png_init_io(png_ptr, pngfile); - //png_set_sig_bytes(png_ptr, 8); info_ptr = png_create_info_struct(png_ptr); if (!info_ptr) @@@@ -336,79 +277,101 @@@@ int decode_png(const char *pngname, int mjpeg_error_exit1("%s: Could not allocate PNG info struct !", pngname); } - end_info = png_create_info_struct(png_ptr); - if (!end_info) + /* Now open this PNG file, and examine its header to retrieve the + YUV4MPEG info that shall be written */ + pngfile = fopen(pngname, "rb"); + if (!pngfile) { - png_destroy_read_struct(&png_ptr, &info_ptr, - (png_infopp)NULL); - mjpeg_error_exit1("%s: Could not allocate PNG end info struct !", pngname); + perror(pngname); + png_error(png_ptr, "PNG file open failed"); } - - if (setjmp(png_jmpbuf(png_ptr))) + + png_init_io(png_ptr, pngfile); + + if (yuv) { - png_destroy_read_struct(&png_ptr, &info_ptr, - &end_info); - mjpeg_error("%s: Corrupted PNG file !", pngname); - return -1; + png_uint_32 nr, input_height, input_width, output_height, output_width; + uint8_t *r, *g, *b; + png_bytepp rows; + + /* The code uses png_read_png to obtain a complete buffered copy of the + * PNG file reduced (or expanded) to 8 bit RGB. This is a little wasteful + * in the case of a non-interlaced image - the code could work row by + * row without buffering the whole image - but the interlaced case is + * almost impossible to handle this way so it is better to be simple and + * correct. + */ +# if PNG_LIBPNG_VER >= 10500 && PNG_LIBPNG_VER < 10502 + /* There is a bug in 1.5 before 1.5.2 which causes png_read_png to + * whine most terribly on interlaced images, this stops it: + */ + (void)png_set_interlace_handling(png_ptr); +# endif + png_read_png(png_ptr, info_ptr, PNG_TRANSFORM_STRIP_16 | + PNG_TRANSFORM_STRIP_ALPHA | PNG_TRANSFORM_EXPAND | + PNG_TRANSFORM_GRAY_TO_RGB /* requires libpng 1.4 or later */, 0); + + /* And return the separated data to the parameters. */ + rows = png_get_rows(png_ptr, info_ptr); + + /* Since the PNG files for the frames are separate the actual PNG file + * that was read could be unrelated - a random width and height. Because + * the output may be interleaved the output height may be twice the input + * PNG height. Because the MPEG code requires an even width the output + * width may be one more than the original frame width. + * + * For the interleaving the PNG data is smashed into the lower half of + * the yuv rows. For the other cases the input data is cropped or + * top-lefted as appropriate. + */ + output_height = param->new_height; + + input_height = png_get_image_height(png_ptr, info_ptr); + if (input_height > output_height) + input_height = output_height; + + output_width = param->new_width; + + input_width = png_get_image_width(png_ptr, info_ptr); + if (input_width > output_width) + input_width = output_width; + + /* Breaking up the RGB data is not hard to do, the separated channels are + * simply packed into the three raw yuv arrays with new_width values per + * row. + */ + r = yuv[0]; + g = yuv[1]; + b = yuv[2]; + for (nr=0; nrwidth, ¶m->height, &bit_depth, - // &color_type, &interlace_type, &compression_type, &filter_type)) - &color_type, NULL, NULL, NULL)) - num_pass = png_set_interlace_handling(png_ptr); else - mjpeg_error_exit1("PNG header reading failed !!\n"); -#if 0 - mjpeg_info("Reading info struct...\n"); - png_read_info(png_ptr, info_ptr); - mjpeg_info("Done...\n"); - - if (png_get_IHDR(png_ptr, info_ptr, ¶m->width, ¶m->height, &bit_depth, - // &color_type, &interlace_type, &compression_type, &filter_type)) - &color_type, NULL, NULL, NULL)) - num_pass = png_set_interlace_handling(png_ptr); - else - mjpeg_error_exit1("PNG header reading failed !!\n"); - - if (process) { - printf("%d passes needed\n\n", num_pass); - - if (bit_depth != 8 && bit_depth != 16) - { - mjpeg_error_exit1("Invalid bit_depth %d, only 8 and 16 bit allowed !!\n", bit_depth); - } - - png_set_strip_16(png_ptr); // always has to strip the 16bit input, MPEG can't handle it - png_set_strip_alpha(png_ptr); // Alpha can't be processed until Z/Alpha is integrated - - printf("\nAllocating row buffer..."); - png_set_read_user_transform_fn(png_ptr, png_separation); - png_bytep row_buf = (png_bytep)png_malloc(png_ptr, - png_get_rowbytes(png_ptr, info_ptr)); - - for (int n=0; n < num_pass; n++) - for (int y=0; y < sh_param->height; y++) - { - printf("Writing row data for pass %d\n", n); - png_read_rows(png_ptr, (png_bytepp)&row_buf, NULL, 1); - } - - png_free(png_ptr, row_buf); - } - png_read_end(png_ptr, info_ptr); -#endif - if (setjmp(png_ptr->jmpbuf)) { - png_destroy_read_struct(&png_ptr, &info_ptr, &end_info); - return 2; + /* Just return the image width and height in *param */ + png_read_info(png_ptr, info_ptr); + + param->width = png_get_image_width(png_ptr, info_ptr); + param->height = png_get_image_height(png_ptr, info_ptr); } + /* Successful exit: */ + png_destroy_read_struct(&png_ptr, &info_ptr, 0); fclose(pngfile); - return 1; } @@@@ -419,13 +382,17 @@@@ int decode_png(const char *pngname, int */ static int init_parse_files(parameters_t *param) { - char pngname[255]; + char pngname[PATH_MAX+1]; /* See POSIX 1003.1 section 2.9.5 */ snprintf(pngname, sizeof(pngname), param->pngformatstr, param->begin); mjpeg_debug("Analyzing %s to get the right pic params", pngname); - if (decode_png(pngname, 0, param) == -1) + /* The first frame (the param->begin frame) determines the height and + * width of the output. Passing NULL instead of yuv (see below) causes + * decode_png to fill in param with the image dimensions. + */ + if (decode_png(pngname, NULL, param) == -1) mjpeg_error_exit1("Reading of %s failed.\n", pngname); mjpeg_info("Image dimensions are %ux%u", @@@@ -455,6 +422,7 @@@@ static int init_parse_files(parameters_t if (!(param->interleave) && (param->interlace != Y4M_ILACE_NONE)) { + /* So the height in 'param' might be twice the PNG input height:*/ param->height *= 2; mjpeg_info("Non-interleaved fields (image height doubled)"); } @@@@ -466,33 +434,29 @@@@ static int init_parse_files(parameters_t static int generate_YUV4MPEG(parameters_t *param) { uint32_t frame; - //size_t pngsize; - char pngname[FILENAME_MAX]; - uint8_t *yuv[3]; /* buffer for Y/U/V planes of decoded PNG */ + uint8_t *yuv[3]; /* Buffers, initially for R,G,B then Y,Cb,Cr */ y4m_stream_info_t streaminfo; y4m_frame_info_t frameinfo; - if ((param->width % 2) == 0) - param->new_width = param->width; - else - { - param->new_width = ((param->width >> 1) + 1) << 1; - printf("Setting new, even image width %d", param->new_width); - } + /* Make the output even, so the output may be one larger than the + * original PNG image width. + */ + param->new_width = param->width + (param->width & 1); + param->new_height = param->height + (param->height & 1); mjpeg_info("Now generating YUV4MPEG stream."); y4m_init_stream_info(&streaminfo); y4m_init_frame_info(&frameinfo); y4m_si_set_width(&streaminfo, param->new_width); - y4m_si_set_height(&streaminfo, param->height); + y4m_si_set_height(&streaminfo, param->new_height); y4m_si_set_interlace(&streaminfo, param->interlace); y4m_si_set_framerate(&streaminfo, param->framerate); y4m_si_set_chroma(&streaminfo, param->ss_mode); - yuv[0] = (uint8_t *)malloc(param->new_width * param->height * sizeof(yuv[0][0])); - yuv[1] = (uint8_t *)malloc(param->new_width * param->height * sizeof(yuv[1][0])); - yuv[2] = (uint8_t *)malloc(param->new_width * param->height * sizeof(yuv[2][0])); + yuv[0] = (uint8_t *)malloc(param->new_width * param->new_height * sizeof(yuv[0][0])); + yuv[1] = (uint8_t *)malloc(param->new_width * param->new_height * sizeof(yuv[1][0])); + yuv[2] = (uint8_t *)malloc(param->new_width * param->new_height * sizeof(yuv[2][0])); y4m_write_stream_header(STDOUT_FILENO, &streaminfo); @@@@ -500,15 +464,13 @@@@ static int generate_YUV4MPEG(parameters_ (frame < param->numframes + param->begin) || (param->numframes == -1); frame++) { - // if (frame < 25) - // else - //snprintf(pngname, sizeof(pngname), param->pngformatstr, frame - 25); + char pngname[PATH_MAX+1]; snprintf(pngname, sizeof(pngname), param->pngformatstr, frame); - raw0 = yuv[0]; - raw1 = yuv[1]; - raw2 = yuv[2]; - if (decode_png(pngname, 1, param) == -1) + /* decode_png reads the PNG into the yuv buffers as r,g,b [0..255] + * values. + */ + if (decode_png(pngname, yuv, param) == -1) { mjpeg_info("Read from '%s' failed: %s", pngname, strerror(errno)); if (param->numframes == -1) @@@@ -523,79 +485,18 @@@@ static int generate_YUV4MPEG(parameters_ } else { -#if 0 - mjpeg_debug("Preparing frame"); - - /* Now open this PNG file, and examine its header to retrieve the - YUV4MPEG info that shall be written */ - - if ((param->interlace == Y4M_ILACE_NONE) || (param->interleave == 1)) - { - mjpeg_info("Processing non-interlaced/interleaved %s.", - pngname, pngsize); - - decode_png(imagedata, 0, 420, yuv[0], yuv[1], yuv[2], - param->width, param->height, param->new_width); - -#if 0 - if (param->make_z_alpha) - { - mjpeg_info("Writing Z/Alpha data.\n"); - za_write(real_z_imagemap, param->width, param->height,z_alpha_fp,frame); - } -#endif - } - else - { - mjpeg_error_exit1("Can't handle interlaced PNG information (yet) since there is no standard for it.\n" - "Use interleaved mode (-L option) to create interlaced material."); - - switch (param->interlace) - { - case Y4M_ILACE_TOP_FIRST: - mjpeg_info("Processing interlaced, top-first %s", pngname); -#if 0 - decode_jpeg_raw(jpegdata, jpegsize, - Y4M_ILACE_TOP_FIRST, - 420, param->width, param->height, - yuv[0], yuv[1], yuv[2]); -#endif - break; - case Y4M_ILACE_BOTTOM_FIRST: - mjpeg_info("Processing interlaced, bottom-first %s", pngname); -#if 0 - decode_jpeg_raw(jpegdata, jpegsize, - Y4M_ILACE_BOTTOM_FIRST, - 420, param->width, param->height, - yuv[0], yuv[1], yuv[2]); -#endif - break; - default: - mjpeg_error_exit1("FATAL logic error?!?"); - break; - } - } -#endif mjpeg_debug("Converting frame to YUV format."); /* Transform colorspace, then subsample (in place) */ - convert_RGB_to_YCbCr(yuv, param->height * param->new_width); - chroma_subsample(param->ss_mode, yuv, param->new_width, param->height); + convert_RGB_to_YCbCr(yuv, param->new_height * param->new_width); + chroma_subsample(param->ss_mode, yuv, param->new_width, param->new_height); mjpeg_debug("Frame decoded, now writing to output stream."); } - + mjpeg_debug("Frame decoded, now writing to output stream."); y4m_write_frame(STDOUT_FILENO, &streaminfo, &frameinfo, yuv); } -#if 0 - if (param->make_z_alpha) - { - za_write_end(z_alpha_fp); - fclose(z_alpha_fp); - } -#endif - y4m_fini_stream_info(&streaminfo); y4m_fini_frame_info(&frameinfo); free(yuv[0]); @@@@ -614,7 +515,6 @@@@ static int generate_YUV4MPEG(parameters_ int main(int argc, char ** argv) { parameters_t param; - sh_param = ¶m; y4m_accept_extensions(1); @@@@ -632,13 +532,3 @@@@ int main(int argc, char ** argv) return 0; } - - - - - - - - - - @ 1.11 log @Add upstream bug report URL. @ text @d1 1 a1 1 $NetBSD: patch-ac,v 1.10 2011/02/10 16:41:56 wiz Exp $ @ 1.10 log @Really fix png support. From John Bowler. Bump PKGREVISION. @ text @d1 1 a1 1 $NetBSD$ d4 1 @ 1.9 log @Fix interlaced png handling (lots of (unnecessary) warnings when running, but works). @ text @d1 1 a1 1 $NetBSD: patch-ac,v 1.8 2011/02/06 15:37:21 wiz Exp $ d3 1 a3 1 Fix build with png-1.5. d7 39 a45 1 @@@@ -240,11 +240,18 @@@@ static void parse_commandline(int argc, d49 2 a50 8 +void read_row_callback(png_structp ptr, png_uint_32 row, int pass) +{ + png_uint_32 *prownumber = png_get_user_transform_ptr(png_ptr); + *prownumber = row; +} + void png_separation(png_structp png_ptr, png_row_infop row_info, png_bytep data) { d52 42 a93 15 + int row_nr; int i, width = row_info->width; int new_width = sh_param->new_width; + png_uint_32 *prow_number; /* contents of row_info: * png_uint_32 width width of row @@@@ -255,6 +262,8 @@@@ void png_separation(png_structp png_ptr, * png_byte pixel_depth bits per pixel (depth*channels) */ + *prow_number = png_get_user_transform_ptr(png_ptr); + row_nr = (*prow_number+1)%png_get_image_height(png_ptr, info_ptr); //mjpeg_debug("PNG YUV transformation callback; color_type is %d row_number %d\n", // row_info->color_type, row_nr); d95 17 a111 2 @@@@ -300,6 +309,7 @@@@ int decode_png(const char *pngname, int int bit_depth, color_type; d113 22 a134 2 //png_byte hdptr[8]; + auto png_uint_32 row_number = 0; d136 12 a147 3 /* Now open this PNG file, and examine its header to retrieve the YUV4MPEG info that shall be written */ @@@@ -352,8 +362,11 @@@@ int decode_png(const char *pngname, int d150 14 d165 95 d261 76 a336 6 + if (process) { + png_set_read_status_fn(png_ptr, read_row_callback); + png_set_user_transform_info(png_ptr, &row_number, 0, 0); png_set_read_user_transform_fn(png_ptr, png_separation); + } png_read_png(png_ptr, info_ptr, PNG_TRANSFORM_STRIP_16 | PNG_TRANSFORM_STRIP_ALPHA, NULL); d338 16 a353 2 if (png_get_IHDR(png_ptr, info_ptr, ¶m->width, ¶m->height, &bit_depth, @@@@ -402,7 +415,7 @@@@ int decode_png(const char *pngname, int d355 135 a489 6 png_read_end(png_ptr, info_ptr); #endif - if (setjmp(png_ptr->jmpbuf)) { + if (setjmp(png_jmpbuf(png_ptr))) { png_destroy_read_struct(&png_ptr, &info_ptr, &end_info); return 2; d491 34 @ 1.8 log @Small improvement to png patch. Non-interlaced pngs now work as inputs. Interlaced not yet. @ text @d1 1 a1 1 $NetBSD: patch-ac,v 1.7 2011/01/24 10:04:21 wiz Exp $ d7 1 a7 10 @@@@ -78,6 +78,8 @@@@ png_structp png_ptr; png_infop info_ptr, end_info; uint8_t *raw0, *raw1, *raw2; /* buffer for RGB first, and then Y/Cb/Cr planes of decoded PNG */ +static int png_row_number = 0; + /* * The User Interface parts */ @@@@ -240,9 +242,13 @@@@ static void parse_commandline(int argc, d13 2 a14 1 + png_row_number++; d20 1 d23 1 d25 4 a28 1 @@@@ -256,28 +262,28 @@@@ void png_separation(png_structp png_ptr, d31 2 d34 1 a34 2 - // row_info->color_type, row_nr); + // row_info->color_type, png_row_number); d36 9 a44 32 if(row_info->color_type == PNG_COLOR_TYPE_GRAY) // only Z available { - //mjpeg_debug("Grayscale to YUV, row %d", row_nr); + //mjpeg_debug("Grayscale to YUV, row %d", png_row_number); for (i = 0; i < width; i++) { - raw0[i + row_nr * new_width] = data[i]; - raw1[i + row_nr * new_width] = data[i]; - raw2[i + row_nr * new_width] = data[i]; + raw0[i + png_row_number * new_width] = data[i]; + raw1[i + png_row_number * new_width] = data[i]; + raw2[i + png_row_number * new_width] = data[i]; } return; } if(row_info->color_type == PNG_COLOR_TYPE_RGB) // Z and Alpha available { - //mjpeg_info("RGB to YUV, row %d", row_nr); + //mjpeg_info("RGB to YUV, row %d", png_row_number); for (i = 0; i < width; i++) { - raw0[i + row_nr * new_width] = data[i*3]; - raw1[i + row_nr * new_width] = data[i*3 + 1]; - raw2[i + row_nr * new_width] = data[i*3 + 2]; + raw0[i + png_row_number * new_width] = data[i*3]; + raw1[i + png_row_number * new_width] = data[i*3 + 1]; + raw2[i + png_row_number * new_width] = data[i*3 + 2]; } return; } @@@@ -352,8 +358,12 @@@@ int decode_png(const char *pngname, int a49 1 + png_row_number = 0; d51 1 a53 1 + png_set_interlace_handling(png_ptr); d57 1 a57 1 @@@@ -402,7 +412,7 @@@@ int decode_png(const char *pngname, int @ 1.7 log @Fix build with png-1.5. @ text @d1 1 a1 1 $NetBSD$ d69 1 a69 1 @@@@ -352,8 +358,10 @@@@ int decode_png(const char *pngname, int d75 1 d79 1 d83 1 a83 1 @@@@ -402,7 +410,7 @@@@ int decode_png(const char *pngname, int @ 1.6 log @Remove unneeded patch. @ text @d1 1 a1 1 $NetBSD: patch-ac,v 1.5 2009/01/08 17:21:36 wiz Exp $ d3 34 a36 8 --- y4mdenoise/Region2D.hh.orig 2005-12-20 20:20:58.000000000 +0100 +++ y4mdenoise/Region2D.hh @@@@ -16,6 +16,7 @@@@ #include "Status_t.h" #include +#include #include d38 15 d54 36 @ 1.5 log @Update to 1.9.0: mpeg2enc works "better". some changes for the libquicktime. maintainance for newer release of other packages the mjpegtools need. @ text @d1 1 a1 1 $NetBSD: patch-ac,v 1.4 2006/08/04 16:43:37 tron Exp $ @ 1.4 log @Regenerate patch file so that Mac OS X's "patch" no longer refused to apply the patch. @ text @d1 1 a1 1 $NetBSD$ d3 2 a4 2 --- y4mdenoise/Region2D.hh.orig 2004-07-18 07:43:01.000000000 +0100 +++ y4mdenoise/Region2D.hh 2006-08-04 17:42:07.000000000 +0100 d10 1 a10 1 @ 1.3 log @Include "assert.h" in "Region2D.hh" to get definition of assert(). This fixes build problems with GCC 4.x. @ text @d4 2 a5 2 +++ y4mdenoise/Region2D.hh 2006-06-30 19:34:47.000000000 +0100 @@@@ -16,7 +16,8 @@@@ a9 1 d12 1 a12 1 // The 2-dimensional region class. Parameterized by the numeric type @ 1.2 log @Update mjpegtools/mplex to 1.8.0. Some changes: * Modularised input handling for MPEG compression tools. * movtar read/write support * MJPEG playback in software, and experimental MJPEG hardware overlay playback (see mjpeg/) * mpeg2enc _much_ improved! @ text @d1 1 a1 1 $NetBSD: patch-ac,v 1.1 2004/01/26 12:44:06 jmmv Exp $ d3 3 a5 4 --- lavtools/audiolib.c.orig Mon Dec 8 13:28:32 2003 +++ lavtools/audiolib.c Sun Jan 25 15:47:33 2004 @@@@ -665,7 +665,9 @@@@ const char *audio_dev_name; d7 4 a10 10 #ifndef FORK_NOT_THREAD +#if !defined(__NetBSD__) || __NetBSD_Version__ >= 106130000 /* 1.6M */ struct sched_param schedparam; +#endif sigset_t blocked_signals; /* Set the capture thread in a reasonable state - cancellation enabled @@@@ -862,7 +864,8 @@@@ memset(buf+nbset*info.fragsize,0,info.fragsize); } a11 5 -#ifndef FORK_NOT_THREAD +#if !defined(FORK_NOT_THREAD) && \ + (!defined(__NetBSD__) || __NetBSD_Version__ >= 106130000) /* 1.6M */ /* Now we're ready to go move to Real-time scheduling... */ schedparam.sched_priority = 1; d13 1 @ 1.1 log @Initial revision @ text @d1 1 a1 1 $NetBSD: patch-ac,v 1.3 2004/01/25 14:50:34 tron Exp $ @ 1.1.1.1 log @Move mjpegtools to the multimedia category (coming from graphics). This is version 1.6.1.93. @ text @@