AWARE [SYSTEMS] Imaging expertise for the Delphi developer
AWare Systems, Imaging expertise for the Delphi developer, Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
May 2004

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



Valid HTML 4.01!



Thread

2004.05.28 06:26 "Tiff JPEG compression quality factor", by Albert Adell
2004.05.28 12:18 "Re: Tiff JPEG compression quality factor", by Frank Warmerdam
2004.05.28 17:32 "Re: Tiff JPEG compression quality factor", by Phillip Crews
2004.06.01 08:27 "Re: Tiff JPEG compression quality factor", by Albert Adell
2004.06.01 18:04 "Re: Tiff JPEG compression quality factor", by Phillip Crews
2004.06.23 07:15 "Tiff JPEG compression quality factor", by Albert Adell
2004.05.28 14:35 "Re: Tiff JPEG compression quality factor", by Bob Friesenhahn

2004.06.23 07:15 "Tiff JPEG compression quality factor", by Albert Adell

Hi Philip,

I have modified the method JPEGSetupDecode in tiff_jpeg.c file, in order
to calculate the Q-factor.
I have acceded to the JPEG struct at this function and I am able to apply
the Q-factor computation.

JPEGSetupDecode(TIFF* tif)
{
	...

	/* Read JPEGTables if it is present */
	if (TIFFFieldSet(tif,FIELD_JPEGTABLES)) {
		TIFFjpeg_tables_src(sp, tif);
		if(TIFFjpeg_read_header(sp,FALSE) !=
JPEG_HEADER_TABLES_ONLY) {
			TIFFError("JPEGSetupDecode", "Bogus JPEGTables
field");
			return (0);
		}

		//$$$ QualityFactor begin
		q = sp->cinfo.d.quant_tbl_ptrs[0]->quantval[6];
		if (q > 51)
			q = (50 * 51 + q / 2) / q;
		else
			q = (5126 - 50 * q) / 51;
		sp->jpegquality=q;
		//$$$ QualityFactor end
	}

	...
}

This method is automaticaly called when reading a tile or a strip but I
suppose that is more interesting if it could be calculated before. I put
the JPEGSetupCode explicit call after an Open call and it seems that
works!

Thanks for the qFactor computation its a nice aproximation.

Thanks a lot,

	Albert Adell

________________________________________________________________________

Albert Adell Fernández              Desenvolupament Fotogrametria Digital
Institut Cartografic de Catalunya   Passeig Santa Madrona 45-51
E-08004 Barcelona                   www http://www.icc.es
_________________________________________________________________________