From 9d4ca76c08aae1e6bffff3e54b424da211bfe369 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 1 Oct 2023 14:33:13 +0200 Subject: [PATCH] fftools/ffmpeg_enc: do not round frame durations prematurely Changes the results of fate-idroq-video-encode and fate-lavf* tests, where different frames now get duplicated by framerate conversion code. --- fftools/ffmpeg_enc.c | 6 +++--- tests/ref/fate/idroq-video-encode | 2 +- tests/ref/lavf/dv_ntsc | 4 ++-- tests/ref/lavf/gxf_ntsc | 6 +++--- tests/ref/lavf/ismv | 6 +++--- tests/ref/lavf/mov | 6 +++--- tests/ref/lavf/mp4 | 6 +++--- tests/ref/lavf/mpg | 4 ++-- tests/ref/lavf/mxf | 6 +++--- 9 files changed, 23 insertions(+), 23 deletions(-) diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c index b40a6211a9..6c00156121 100644 --- a/fftools/ffmpeg_enc.c +++ b/fftools/ffmpeg_enc.c @@ -1030,11 +1030,11 @@ static void video_sync_process(OutputFile *of, OutputStream *ost, *nb_frames = 0; else if (delta > 0.6) e->next_pts = llrint(sync_ipts); - frame->duration = duration; + frame->duration = llrint(duration); break; case VSYNC_DROP: case VSYNC_PASSTHROUGH: - frame->duration = duration; + frame->duration = llrint(duration); e->next_pts = llrint(sync_ipts); break; default: @@ -1112,7 +1112,7 @@ static int do_video_out(OutputFile *of, OutputStream *ost, AVFrame *frame) if (frame) { FrameData *fd = frame_data(frame); - duration = lrintf(frame->duration * av_q2d(frame->time_base) / av_q2d(enc->time_base)); + duration = frame->duration * av_q2d(frame->time_base) / av_q2d(enc->time_base); if (duration <= 0 && fd->frame_rate_filter.num > 0 && fd->frame_rate_filter.den > 0) diff --git a/tests/ref/fate/idroq-video-encode b/tests/ref/fate/idroq-video-encode index bdb6fedf56..f777247efd 100644 --- a/tests/ref/fate/idroq-video-encode +++ b/tests/ref/fate/idroq-video-encode @@ -1 +1 @@ -e9ff61023826fce304350ff6e7c63b2f +6d8303bb56b8da2a63efef323aea235e diff --git a/tests/ref/lavf/dv_ntsc b/tests/ref/lavf/dv_ntsc index 410b6ec254..c6aa6b1fbb 100644 --- a/tests/ref/lavf/dv_ntsc +++ b/tests/ref/lavf/dv_ntsc @@ -1,3 +1,3 @@ -5569626370c7c72d40de2c4559e32856 *tests/data/lavf/lavf.dv_ntsc +d28a4c67aa8e3413458de9ca7e6f00ed *tests/data/lavf/lavf.dv_ntsc 3480000 tests/data/lavf/lavf.dv_ntsc -tests/data/lavf/lavf.dv_ntsc CRC=0xa0088163 +tests/data/lavf/lavf.dv_ntsc CRC=0xaa69ba6a diff --git a/tests/ref/lavf/gxf_ntsc b/tests/ref/lavf/gxf_ntsc index 60efd80462..d74e8d8ba4 100644 --- a/tests/ref/lavf/gxf_ntsc +++ b/tests/ref/lavf/gxf_ntsc @@ -1,3 +1,3 @@ -9a27673c85f1671ba9ff7cd33e5735de *tests/data/lavf/lavf.gxf_ntsc -794660 tests/data/lavf/lavf.gxf_ntsc -tests/data/lavf/lavf.gxf_ntsc CRC=0xdcd39443 +5071abe1fd46a3ca3d669203c6d45883 *tests/data/lavf/lavf.gxf_ntsc +793900 tests/data/lavf/lavf.gxf_ntsc +tests/data/lavf/lavf.gxf_ntsc CRC=0xb73f184e diff --git a/tests/ref/lavf/ismv b/tests/ref/lavf/ismv index ac7f72ba33..bb89412d8c 100644 --- a/tests/ref/lavf/ismv +++ b/tests/ref/lavf/ismv @@ -1,9 +1,9 @@ 48fb8d7a5d19bd60f3a49ccf4b7d6593 *tests/data/lavf/lavf.ismv 313169 tests/data/lavf/lavf.ismv tests/data/lavf/lavf.ismv CRC=0x9d9a638a -d19cd8e310a2e94fe0a0d11c5dc29217 *tests/data/lavf/lavf.ismv -322075 tests/data/lavf/lavf.ismv -tests/data/lavf/lavf.ismv CRC=0xe8130120 +b3ba38e148c00466441627ea04749f63 *tests/data/lavf/lavf.ismv +322247 tests/data/lavf/lavf.ismv +tests/data/lavf/lavf.ismv CRC=0xc5569484 3b6023766845b51b075aed474c00f73c *tests/data/lavf/lavf.ismv 312546 tests/data/lavf/lavf.ismv tests/data/lavf/lavf.ismv CRC=0x9d9a638a diff --git a/tests/ref/lavf/mov b/tests/ref/lavf/mov index 75a0c4892d..cfc64141aa 100644 --- a/tests/ref/lavf/mov +++ b/tests/ref/lavf/mov @@ -1,9 +1,9 @@ 11bd76730274924e02623172b82b5236 *tests/data/lavf/lavf.mov 357539 tests/data/lavf/lavf.mov tests/data/lavf/lavf.mov CRC=0xbb2b949b -6efa586655e3db043cb29668f5216610 *tests/data/lavf/lavf.mov -366621 tests/data/lavf/lavf.mov -tests/data/lavf/lavf.mov CRC=0xa9793231 +9ed9ce9b636f85b62d3c3583ff84691e *tests/data/lavf/lavf.mov +366793 tests/data/lavf/lavf.mov +tests/data/lavf/lavf.mov CRC=0xc75fc595 c80c625ded376602e71d5aa6ac6fdb1c *tests/data/lavf/lavf.mov 356921 tests/data/lavf/lavf.mov tests/data/lavf/lavf.mov CRC=0xbb2b949b diff --git a/tests/ref/lavf/mp4 b/tests/ref/lavf/mp4 index b05fa34d0b..686e4f48f8 100644 --- a/tests/ref/lavf/mp4 +++ b/tests/ref/lavf/mp4 @@ -1,9 +1,9 @@ a6e44724cab1c4b50c49b0fd227b87d3 *tests/data/lavf/lavf.mp4 312477 tests/data/lavf/lavf.mp4 tests/data/lavf/lavf.mp4 CRC=0x9d9a638a -19cbdb02f2f3e35bae779e2323be1b8e *tests/data/lavf/lavf.mp4 -321363 tests/data/lavf/lavf.mp4 -tests/data/lavf/lavf.mp4 CRC=0xe8130120 +0906d4bcb61dd8bcb21a37d6b5b48ea2 *tests/data/lavf/lavf.mp4 +321535 tests/data/lavf/lavf.mp4 +tests/data/lavf/lavf.mp4 CRC=0xc5569484 8ab9dd09f02b6d8146a40fc3c918d979 *tests/data/lavf/lavf.mp4 312021 tests/data/lavf/lavf.mp4 tests/data/lavf/lavf.mp4 CRC=0x9d9a638a diff --git a/tests/ref/lavf/mpg b/tests/ref/lavf/mpg index 332b7114b5..9cf783d26d 100644 --- a/tests/ref/lavf/mpg +++ b/tests/ref/lavf/mpg @@ -1,9 +1,9 @@ 01bbdea588da51ab4a9d1d26f3443c96 *tests/data/lavf/lavf.mpg 372736 tests/data/lavf/lavf.mpg tests/data/lavf/lavf.mpg CRC=0x000e23ae -87b447b78a7d1141b9d41bb3aa50434d *tests/data/lavf/lavf.mpg +67a87970fae5cbd878ad6353aa9138da *tests/data/lavf/lavf.mpg 389120 tests/data/lavf/lavf.mpg -tests/data/lavf/lavf.mpg CRC=0x60ba4ab9 +tests/data/lavf/lavf.mpg CRC=0x9264985a 284f41c914df75c12de01e223d65f87f *tests/data/lavf/lavf.mpg 372736 tests/data/lavf/lavf.mpg tests/data/lavf/lavf.mpg CRC=0x000e23ae diff --git a/tests/ref/lavf/mxf b/tests/ref/lavf/mxf index 3f0c74818a..fdd1ef5c9c 100644 --- a/tests/ref/lavf/mxf +++ b/tests/ref/lavf/mxf @@ -1,9 +1,9 @@ 9ec1ad83b3400de11ca2f70b3b2d4c4d *tests/data/lavf/lavf.mxf 526393 tests/data/lavf/lavf.mxf tests/data/lavf/lavf.mxf CRC=0x8dddfaab -546eb8c864c0d76c6a9d5303701e9031 *tests/data/lavf/lavf.mxf -561721 tests/data/lavf/lavf.mxf -tests/data/lavf/lavf.mxf CRC=0x96ff1b48 +3edfabe839a29f5902969c15ebac6d8d *tests/data/lavf/lavf.mxf +551481 tests/data/lavf/lavf.mxf +tests/data/lavf/lavf.mxf CRC=0xf091e687 5bd0ce691510e6fae969886c32ad7a14 *tests/data/lavf/lavf.mxf 526393 tests/data/lavf/lavf.mxf tests/data/lavf/lavf.mxf CRC=0x8dddfaab