Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#9705 closed defect (invalid)

Wrong value is written to *.pgm file

Reported by: Michael Koch Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

If a function in the geq filter evaluates to 'nan', this result is silently changed to zero when writing to a *.pgm file. That's not correct. Either there should be an error message, or the maximum possible value (65535) could be written to indicate that there was a problem.

Can be reproduced as follows:

ffmpeg -f lavfi -i nullsrc=size=2x2 -vf format=pix_fmts=gray16le,geq='sqrt(-1)' -frames 1 -y test.pgm

Check the output file with a hex editor. It contains '00 00' for the pixel values.

Change History (5)

comment:1 by Elon Musk, 4 years ago

Resolution: invalid
Status: newclosed

Using 0 is better.

in reply to:  1 comment:2 by Michael Koch, 4 years ago

Replying to Elon Musk:

Using 0 is better.

Why is 0 better? I'm making *.pgm files for the remap filter. In this case 0 is a valid output value. 65535 is not, and would force remap to use the "fill" color. It's very difficult to debug complicated functions if a wrong result is written to the output file and no error message is thrown.

comment:3 by Elon Musk, 4 years ago

Well, you could write video filter that would map such float values to arbitrary values.

comment:4 by Elon Musk, 4 years ago

Also, do your homework, geq can make use of isnan() function so you can do your own mapping inside geq filter.

comment:5 by Michael Koch, 4 years ago

A good function should never have 'nan' as the result. But during debugging it sometimes happens that something is wrong in the function. In this case it's better to throw an error message, instead of silently converting 'nan' to zero.
For debugging it would also be helpful to print the geq filters input variables X and Y in the error message.

Note: See TracTickets for help on using tickets.