[MPlayer-dev-eng] [PATCH] Correct rounding for libavcodec/mpeg12.c

Svante Signell svante.signell at telia.com
Tue Feb 10 13:52:31 CET 2004


For mencoder using libavcodec some .avi files with a frame rate of e.g.
23.976 the function find_frame_rate_index() incorrectly rounds the
calculated frame rate and compares with the standardised rates giving
output as shown below:

videocodec: libavcodec (480x576 fourcc=3267706d [mpg2])
[mpeg2video @ 0x856d480]MPEG1/2 doesnt support 239759/10000 fps
Could not open codec.

The correct value should have been 239760/10000.

Enclosed please find a small patch to libavcodec/mpeg12.c which
correctly rounds the calculations to five significant figures, resulting
in a frame_rate_index() of zero, instead of negative.
(Perhaps even the avctx->frame_rate should be rounded correctly instead,
but I have not looked into this so far. The rounding function can easily
be applied to this case instead.)

I know this patch should be sent to the ffmpeg development list, but
since I'm not subscribed I'll send it here. I hope this is OK with you.

Best regards,
Svante

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mpeg12.c.patch
Type: text/x-patch
Size: 1131 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20040210/79630679/attachment.bin>


More information about the MPlayer-dev-eng mailing list