From: Pablo d'A. <da...@us...> - 2006-03-04 23:15:40
|
Update of /cvsroot/hugin/hugin/src/foreign/vigra_impex In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25215/vigra_impex Modified Files: Tag: vigra140-branch imageinfo.cxx jpeg.cxx png.cxx vigra_impex.vcproj Log Message: some more fixes for icc profile support. seems to work now. Index: jpeg.cxx =================================================================== RCS file: /cvsroot/hugin/hugin/src/foreign/vigra_impex/jpeg.cxx,v retrieving revision 1.3.2.2 retrieving revision 1.3.2.3 diff -u -d -r1.3.2.2 -r1.3.2.3 --- jpeg.cxx 4 Mar 2006 02:08:28 -0000 1.3.2.2 +++ jpeg.cxx 4 Mar 2006 23:15:36 -0000 1.3.2.3 @@ -34,6 +34,11 @@ /* OTHER DEALINGS IN THE SOFTWARE. */ /* */ /************************************************************************/ +/* Modifications by Pablo d'Angelo + * as of 4 March 2006: + * - Added support for x and y resolution fields. + * - Added ICC support. + */ #ifdef HasJPEG @@ -359,7 +364,7 @@ : file( filename.c_str(), "w" ), #endif scanline(0), quality(-1), - finalized(false) + finalized(false), iccProfileLength(0), iccProfilePtr(0) { // setup setjmp() error handling info.err = jpeg_std_error( ( jpeg_error_mgr * ) &err ); @@ -423,8 +428,8 @@ if (setjmp(err.buf)) vigra_fail( "error in jpeg_start_compress()" ); jpeg_start_compress( &info, TRUE ); - - if (iccProfilePtr && iccProfileLength) { + + if (iccProfilePtr && iccProfileLength) { write_icc_profile(&info, iccProfilePtr, iccProfileLength); } } Index: imageinfo.cxx =================================================================== RCS file: /cvsroot/hugin/hugin/src/foreign/vigra_impex/imageinfo.cxx,v retrieving revision 1.3.2.3 retrieving revision 1.3.2.4 diff -u -d -r1.3.2.3 -r1.3.2.4 --- imageinfo.cxx 4 Mar 2006 13:23:49 -0000 1.3.2.3 +++ imageinfo.cxx 4 Mar 2006 23:15:36 -0000 1.3.2.4 @@ -387,13 +387,18 @@ int quality = -1; std::istringstream compstream(comp.c_str()); compstream >> quality; + + // FIXME: dangelo: This code might lead to strange effects (setting an invalid compression mode), + // if other formats also support a numerical compression parameter. if ( quality != -1 ) { + // hmm, not very great... enc->setCompressionType( "JPEG", quality ); - return enc; + // FIXME: dangelo: why return here? the other flags below should also be set. + //return enc; + } else { + // leave any other compression type to the codec + enc->setCompressionType(comp); } - - // leave any other compression type to the codec - enc->setCompressionType(comp); } std::string pixel_type = info.getPixelType(); @@ -413,7 +418,7 @@ enc->setYResolution(info.getYResolution()); enc->setPosition(info.getPosition()); - if (info.getICCProfile().isValid() > 0) { + if (info.getICCProfile().isValid()) { enc->setICCProfile(info.getICCProfile().getSize(), info.getICCProfile().getPtr()); } Index: png.cxx =================================================================== RCS file: /cvsroot/hugin/hugin/src/foreign/vigra_impex/png.cxx,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -u -d -r1.2.2.2 -r1.2.2.3 --- png.cxx 4 Mar 2006 02:08:28 -0000 1.2.2.2 +++ png.cxx 4 Mar 2006 23:15:36 -0000 1.2.2.3 @@ -322,14 +322,9 @@ png_uint_32 profileLen; if (info->valid & PNG_INFO_iCCP) { png_get_iCCP(png, info, &dummyName, &dummyCompType, &profilePtr, &profileLen) ; - std::cout << "got PNG ICC profile, length: " << profileLen << std::endl; iccProfilePtr = (unsigned char *) profilePtr; iccProfileLength = profileLen; - } else { - std::cout << "PngDecoderImpl: No icc profile found\n"; } -#else - std::cout << "PngDecoderImpl.. PNG version too old, cannot read ICC profile\n"; #endif #if 0 @@ -599,12 +594,7 @@ // set icc profile if (iccProfileLength > 0) { png_set_iCCP(png, info, "ICC", 0, (char *) iccProfilePtr, iccProfileLength); - std::cout << "PngEncoderImpl: writing icc profile, length " << iccProfileLength; - } else { - std::cout << "PngEncoderImpl: No icc profile found\n"; } -#else - std::cout << "PngEncoderImpl.. PNG version too old, cannot write ICC profile\n"; #endif // write the info struct Index: vigra_impex.vcproj =================================================================== RCS file: /cvsroot/hugin/hugin/src/foreign/vigra_impex/vigra_impex.vcproj,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -u -d -r1.7 -r1.7.2.1 --- vigra_impex.vcproj 5 May 2005 21:31:32 -0000 1.7 +++ vigra_impex.vcproj 4 Mar 2006 23:15:36 -0000 1.7.2.1 @@ -152,6 +152,9 @@ RelativePath=".\gif.cxx"> </File> <File + RelativePath=".\iccjpeg.c"> + </File> + <File RelativePath=".\imageinfo.cxx"> </File> <File |