Opened 9 years ago

Last modified 2 years ago

#5303 reopened enhancement

Support float in tiff

Reported by: Carl Eugen Hoyos Owned by:
Priority: wish Component: avcodec
Version: git-master Keywords: tif
Cc: ami_stuff@o2.pl Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

http://samples.ffmpeg.org/image-samples/building.tif
http://thread.gmane.org/gmane.comp.video.ffmpeg.libav.user/15090/focus=15110
Gonzalo kindly provided a tiff image containing floating point values.
Depends on ticket #3657

$ ffmpeg -i building.tif
ffmpeg version 3.0.git-dev-dev-486-g6f5048f Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl
  libavutil      55. 19.100 / 55. 19.100
  libavcodec     57. 27.101 / 57. 27.101
  libavformat    57. 28.100 / 57. 28.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 39.100 /  6. 39.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
[tiff @ 0x3d19820] This format is not supported (bpp=128, 4 components)
[tiff_pipe @ 0x3d18280] decoding for stream 0 failed
[tiff_pipe @ 0x3d18280] Could not find codec parameters for stream 0 (Video: tiff, none): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
building.tif: could not find codec parameters
Input #0, tiff_pipe, from 'building.tif':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: tiff, none, 25 tbr, 25 tbn, 25 tbc
At least one output file must be specified

Attachments (1)

float_pattern000_ae.tiff (1.8 MB ) - added by Carl Eugen Hoyos 4 years ago.

Download all attachments as: .zip

Change History (17)

comment:1 by ami_stuff, 9 years ago

I have some samples here which I created in the past (decodes fine with Photoshop).

"32bits_channel_16_bit_half.tif" decodes with ffmpeg, but not correctly.

http://www.datafilehost.com/d/db481cd0

comment:2 by ami_stuff, 9 years ago

Cc: ami_stuff@o2.pl added

comment:3 by ami_stuff, 9 years ago

Also here are some unsupported pbm files by ffmpeg (probably not float):

http://www.datafilehost.com/d/0da82b02

comment:4 by Balling, 4 years ago

Status: newopen

Is the quality of float formats precision in ffmpeg (which are still MUCH worse than in gimp, see https://patchwork.ffmpeg.org/comment/58418/) enough to implement this? Also, if it decodes at all, does it mean the fix is just to recognise it as float (it is BTW no longer opens: "This format is not supported")? How is it done?

Last edited 4 years ago by Balling (previous) (diff)

comment:5 by Elon Musk, 4 years ago

float is float, quality is better than gimp.
If you go from float to float you lose nothing.
fixed to float and float to fixed is different story.

in reply to:  5 comment:6 by Balling, 4 years ago

Replying to richardpl:

fixed to float and float to fixed is different story.

Okay, I did not test quality in GIMP, but if you will go to the comment on the patch (that was accepted in version two 453004fde6fdfeb5506947d253ec768dae1115b8) and you will see it has improved precision of float to fixed IN 16 times, Paul (!), but still looks bad for Mark
https://patchwork.ffmpeg.org/comment/58418/

BTW, some further tiff float samples in Eye of Gnome: https://gitlab.gnome.org/GNOME/eog/-/issues/55

Last edited 4 years ago by Balling (previous) (diff)

comment:7 by Elon Musk, 4 years ago

You are mistaken. If you can reproduce problem with current head version of ffmpeg than report issue here.
Otherwise you are making false conclusions by selectively picking and interpreting information you found on web.

Once more I will tell you that float to float is working perfectly.

It is just fixed to float and inverse of that may have some issues due to nature of different data storage, and that is just because float have more bits to hold data.

comment:8 by pdr0, 4 years ago

Regarding "support float in tiff" -

"float_pattern000_ae.tiff" in the attached 7zip archive is a RGB float (no alpha) 620x240 pattern made of 5* 128x240 patches, -2,-1,0,1,2

ie. RGB (-2,-2,-2) , (-1,-1,-1) , (0,0,0) , (1,1,1), (2,2,2)

gimp imports correctly ("gimp pointer" correctly identifies -2,-1,0,1,2 patches)

Open source programs such as natron, vapoursynth import correctly. Commercial programs, such as ae, ps, nuke,... also import correctly

ffmpeg -i "float_pattern000_ae.tiff"
ffmpeg version N-101185-g029e3c1c70 Copyright (c) 2000-2021 the FFmpeg developer
s
  built with gcc 9.3-win32 (GCC) 20200320
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-conf
ig=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw
32 --enable-gpl --enable-version3 --disable-debug --disable-w32threads --enable-
pthreads --enable-iconv --enable-zlib --enable-libxml2 --enable-libfreetype --en
able-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-opencl -
-enable-libvmaf --disable-vulkan --enable-libvorbis --enable-amf --enable-libaom
 --enable-avisynth --enable-libdav1d --enable-libdavs2 --enable-ffnvcodec --enab
le-cuda-llvm --disable-libglslang --enable-libass --enable-libbluray --enable-li
bmp3lame --enable-libopus --enable-libtheora --enable-libvpx --enable-libwebp --
disable-lv2 --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrw
b --enable-libopenjpeg --enable-librav1e --enable-librubberband --enable-schanne
l --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-lib
twolame --enable-libuavs3d --enable-libvidstab --enable-libx264 --enable-libx265
 --enable-libxavs2 --enable-libxvid --enable-libzimg --extra-cflags=-DLIBTWOLAME
_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-libs=-lgomp
  libavutil      56. 65.100 / 56. 65.100
  libavcodec     58.124.100 / 58.124.100
  libavformat    58. 67.100 / 58. 67.100
  libavdevice    58. 12.100 / 58. 12.100
  libavfilter     7.107.100 /  7.107.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
[tiff @ 000000f2d3966f00] This format is not supported (bpp=96, 3 components)
[tiff_pipe @ 000000f2d3954900] decoding for stream 0 failed
[tiff_pipe @ 000000f2d3954900] Could not find codec parameters for stream 0 (Vid
eo: tiff, none): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (500
0000) options
Input #0, tiff_pipe, from 'float_pattern000_ae.tiff':
  Duration: N/A, bitrate: N/A
  Stream #0:0: Video: tiff, none, 25 fps, 25 tbr, 25 tbn, 25 tbc
At least one output file must be specified

according to exiftool, and mediainfo - this is big endian - specifying the input pix_fmt does not work either

ffmpeg -pix_fmt gbrpf32be -i "float_pattern000_ae.tiff"

comment:9 by Balling, 4 years ago

Once more I will tell you that float to float is working perfectly.

That is what I said too, but I was talking about float to fixed and back, sorry for not being clear. That is what also is present in GIMP.

comment:10 by Elon Musk, 4 years ago

And you claim something without any proof or what?

in reply to:  10 comment:11 by Balling, 4 years ago

Replying to richardpl:

And you claim something without any proof or what?

I assumed you will convert to quantised values, quality of roundtrip float --> quantised --> float is rather bad still. I never played with float to float.

There is a comment that "I am asking that because some of the numbers in some of the code
(i dont remember which) where tuned to give more accurate overall results" on that patch, which may be the last blocking issue there.

by Carl Eugen Hoyos, 4 years ago

Attachment: float_pattern000_ae.tiff added

comment:12 by Balling, 3 years ago

I just learned that float TIFF is used for GeoTIFF (and more complex GPG https://proj.org/specifications/geodetictiffgrids.html) including for EGM (Earth Gravitational Models, nice). For it to work the precision of float to int should be perfect, but of course best programs just use float.

EGM is needed to calculate GNSS (GPS, for example) coordinates for your altitude.

Last edited 3 years ago by Balling (previous) (diff)

comment:15 by Elon Musk, 2 years ago

Resolution: fixed
Status: openclosed

comment:16 by Balling, 2 years ago

Resolution: fixed
Status: closedreopened

[tiff @ 000001d1e0f4eb00] This format is not supported (bpp=32, bppcount=1)

Still not supported. https://github.com/Beep6581/RawTherapee/files/9490364/float32deflate.zip

ffplay float_pattern000_ae.tiff does not work and so is to png to exr convertion. Only .rgb works.

Version 1, edited 2 years ago by Balling (previous) (next) (diff)
Note: See TracTickets for help on using tickets.