Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#3407 closed enhancement (fixed)

tiff/geotiff support : number precision is not sufficient in double to string conversion

Reported by: LeRatier Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: tif
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

In libavcodec/tiff.c, the double values of the GEOTIFF format are converted to string thru the double2str() function.

This function is truncating double to 6 digits (ie the printf("%f") default), leading to critical precision loss when using the result on the decoder side

An easy patch would be to modify the "%f%s" of the snprintf in a "%.15g%s" for example.

Change History (4)

comment:1 by Carl Eugen Hoyos, 11 years ago

Keywords: tif added; tiff geotiff removed

If you want to report an issue here, please provide a sample and complete, uncut ffmpeg -i output for the sample.
If you already have a fix for the issue, please send a patch made with git format-patch to the ffmpeg-devel mailing list.

comment:2 by LeRatier, 11 years ago

Patch creation in progress.
By the way, same issue in int ff_tadd_doubles_metadata(int count, const char *name, const char *sep,

GetByteContext *gb, int le, AVDictionary metadata)

the %f is not sufficient to retrieve the real precision of the input numbers.

comment:3 by Carl Eugen Hoyos, 11 years ago

Resolution: fixed
Status: newclosed

Your patch was committed, could you add a sample that allows to reproduce the problem you had?

comment:4 by LeRatier, 11 years ago

The source picture i am working on are confidential, so i cannot add them directly as samples. Anyway, i think it is a global issue, maybe present in other double metadatas : as soon as you convert a double value to a string, you should use something like %.15g instead of the default %f, that truncate the number at 6 digits.

Note: See TracTickets for help on using tickets.