[FFmpeg-devel] [PATCH] avcodec/pnm: avoid mirroring PFM images vertically

Anton Khirnov anton at khirnov.net
Tue Nov 29 13:14:00 EET 2022


Quoting Leo Izen (2022-11-16 12:43:06)
> PFM (aka Portable FloatMap) encodes its scanlines from bottom-to-top,
> not from top-to-bottom, unlike other NetPBM formats. Without this
> patch, FFmpeg ignores this exception and decodes/encodes PFM images
> mirrored vertically from their proper orientation.
> 
> For reference, see the NetPBM tool pfmtopam, which encodes a .pam
> from a .pfm, using the correct orientation (and which FFmpeg reads
> correctly). Also compare ffplay to magick display, which shows the
> correct orientation as well.
> 
> See: http://www.pauldebevec.com/Research/HDR/PFM/ and see:
> https://netpbm.sourceforge.net/doc/pfm.html for descriptions of this
> image format.
> 
> Signed-off-by: Leo Izen <leo.izen at gmail.com>
> ---
>  libavcodec/pnmdec.c          | 10 ++++++++++
>  libavcodec/pnmenc.c          | 18 ++++++++++--------
>  tests/ref/lavf/gbrpf32be.pfm |  2 +-
>  tests/ref/lavf/gbrpf32le.pfm |  2 +-
>  tests/ref/lavf/grayf32be.pfm |  2 +-
>  tests/ref/lavf/grayf32le.pfm |  2 +-
>  6 files changed, 24 insertions(+), 12 deletions(-)

Looks reasonable, will push soonish.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list