[FFmpeg-trac] #9595(avutil:new): av_add_q(0/-1, -1/0) returns 1/0 (was: av_add_q(1/-1, -1/0) returns 1/0)

FFmpeg trac at avcodec.org
Tue Jan 11 10:13:07 EET 2022


#9595: av_add_q(0/-1, -1/0) returns 1/0
-------------------------------------+----------------------------------
             Reporter:  namniav      |                    Owner:  (none)
                 Type:  defect       |                   Status:  new
             Priority:  normal       |                Component:  avutil
              Version:  unspecified  |               Resolution:
             Keywords:               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+----------------------------------
Changes (by namniav):

 * summary:  av_add_q(1/-1, -1/0) returns 1/0 => av_add_q(0/-1, -1/0)
     returns 1/0


Old description:

> Summary of the bug:
>
> https://ffmpeg.org/doxygen/4.1/rational_8c_source.html#l00093
>
> av_add_q(1/-1, -1/0) incorrectly returns 1/0.
> Adding -1 to -inf should be -inf, not inf.
>
> Do I have to keep AVRationals in reduced normalized form?

New description:

 Summary of the bug:

 https://ffmpeg.org/doxygen/4.1/rational_8c_source.html#l00093

 av_add_q(0/-1, -1/0) incorrectly returns 1/0.
 Adding 0 to -inf should be -inf, not inf.

 More generally, av_add_q(x/-1, -1/0) should return -inf, not inf.

--
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/9595#comment:1>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list