[FFmpeg-trac] #7565(undetermined:closed): Duplicate framre count in analyze_interlaced_flag option of idet filtrer
FFmpeg
trac at avcodec.org
Sun Dec 2 08:15:16 EET 2018
#7565: Duplicate framre count in analyze_interlaced_flag option of idet filtrer
-------------------------------------+-------------------------------------
Reporter: ponpon | Owner:
Type: defect | Status: closed
Priority: normal | Component:
Version: unspecified | undetermined
Keywords: | Resolution:
Blocking: | needs_more_info
Analyzed by developer: 0 | Blocked By:
| Reproduced by developer: 0
-------------------------------------+-------------------------------------
Comment (by ponpon):
Sorry for not enough explanation.
The parameter, {{{interlaced_flag_accuracy}}}, is used in accuracy that
frames are interlaced or progressive.{{{analyze_interlaced_flag}}} is used
to count down frames to research which they are interlaced or progressive.
I think idet offsets accuracy in
{{{
if (idet->last_type == PROGRESSIVE) {
idet->interlaced_flag_accuracy --;
}}}
and
{{{
} else if (idet->last_type != UNDETERMINED) {
idet->interlaced_flag_accuracy ++;
}}}
and duplicately counts down frames in
{{{
idet->analyze_interlaced_flag --;
}}}
and
{{{
idet->analyze_interlaced_flag --;
}}}
This is because {{{idet->last_type != UNDETERMINED}}} means
{{{idet->last_type == PROGRESSIVE}}}, {{{last_type == TFF}}}, or
{{{idet->last_type == BFF}}}.
Before my patch (speed=77.6x) is faster than after it (69.5x). Does this
means idet terminates researches by double count down? My
misunderstanding?
Source: https://media.xiph.org/video/derf/y4m/football_422_ntsc.y4m
Before the patch
{{{
ffmpeg -i football_422_ntsc.y4m -vf
setfield=tff,idet=intl_thres=1.35:analyze_interlaced_flag=500 -f null -
ffmpeg version N-92499-gfe9b990ec9 Copyright (c) 2000-2018 the FFmpeg
developers
built with clang version 5.0.2 (tags/RELEASE_502/final)
configuration: --prefix= --cc=clang-mp-5.0 --cxx=clang++-mp-5.0
libavutil 56. 23.101 / 56. 23.101
libavcodec 58. 39.100 / 58. 39.100
libavformat 58. 22.100 / 58. 22.100
libavdevice 58. 6.100 / 58. 6.100
libavfilter 7. 46.100 / 7. 46.100
libswscale 5. 4.100 / 5. 4.100
libswresample 3. 4.100 / 3. 4.100
Input #0, yuv4mpegpipe, from 'football_422_ntsc.y4m':
Duration: 00:00:12.00, start: 0.000000, bitrate: 167963 kb/s
Stream #0:0: Video: rawvideo (Y42B / 0x42323459),
yuv422p(progressive), 720x486, SAR 4320:4379 DAR 6400:4379, 30 fps, 30
tbr, 30 tbn, 30 tbc
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> wrapped_avframe (native))
Press [q] to stop, [?] for help
Output #0, null, to 'pipe:':
Metadata:
encoder : Lavf58.22.100
Stream #0:0: Video: wrapped_avframe, yuv422p, 720x486 [SAR 4320:4379
DAR 6400:4379], q=2-31, 200 kb/s, 30 fps, 30 tbn, 30 tbc
Metadata:
encoder : Lavc58.39.100 wrapped_avframe
frame= 360 fps=0.0 q=-0.0 Lsize=N/A time=00:00:12.00 bitrate=N/A
speed=77.6x
video:188kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: unknown
[Parsed_idet_1 @ 0x7fe3dd5004c0] Repeated Fields: Neither: 360 Top:
0 Bottom: 0
[Parsed_idet_1 @ 0x7fe3dd5004c0] Single frame detection: TFF: 0 BFF:
0 Progressive: 342 Undetermined: 18
[Parsed_idet_1 @ 0x7fe3dd5004c0] Multi frame detection: TFF: 0 BFF:
0 Progressive: 360 Undetermined: 0
}}}
Before the patch
{{{
ffmpeg -i football_422_ntsc.y4m -vf
setfield=tff,idet=intl_thres=1.35:analyze_interlaced_flag=500 -f null -
ffmpeg version N-92499-gfe9b990ec9 Copyright (c) 2000-2018 the FFmpeg
developers
built with clang version 5.0.2 (tags/RELEASE_502/final)
configuration: --prefix= --cc=clang-mp-5.0 --cxx=clang++-mp-5.0
libavutil 56. 23.101 / 56. 23.101
libavcodec 58. 39.100 / 58. 39.100
libavformat 58. 22.100 / 58. 22.100
libavdevice 58. 6.100 / 58. 6.100
libavfilter 7. 46.100 / 7. 46.100
libswscale 5. 4.100 / 5. 4.100
libswresample 3. 4.100 / 3. 4.100
Input #0, yuv4mpegpipe, from 'football_422_ntsc.y4m':
Duration: 00:00:12.00, start: 0.000000, bitrate: 167963 kb/s
Stream #0:0: Video: rawvideo (Y42B / 0x42323459),
yuv422p(progressive), 720x486, SAR 4320:4379 DAR 6400:4379, 30 fps, 30
tbr, 30 tbn, 30 tbc
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> wrapped_avframe (native))
Press [q] to stop, [?] for help
Output #0, null, to 'pipe:':
Metadata:
encoder : Lavf58.22.100
Stream #0:0: Video: wrapped_avframe, yuv422p, 720x486 [SAR 4320:4379
DAR 6400:4379], q=2-31, 200 kb/s, 30 fps, 30 tbn, 30 tbc
Metadata:
encoder : Lavc58.39.100 wrapped_avframe
frame= 360 fps=0.0 q=-0.0 Lsize=N/A time=00:00:12.00 bitrate=N/A
speed=69.5x
video:188kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: unknown
[Parsed_idet_1 @ 0x7fb3f3d0ea80] Repeated Fields: Neither: 360 Top:
0 Bottom: 0
[Parsed_idet_1 @ 0x7fb3f3d0ea80] Single frame detection: TFF: 0 BFF:
0 Progressive: 342 Undetermined: 18
[Parsed_idet_1 @ 0x7fb3f3d0ea80] Multi frame detection: TFF: 0 BFF:
0 Progressive: 360 Undetermined: 0
}}}
My patch
{{{
diff --git a/libavfilter/vf_idet.c b/libavfilter/vf_idet.c
index 02ae2edcb9..8c355ee2f9 100644
--- a/libavfilter/vf_idet.c
+++ b/libavfilter/vf_idet.c
@@ -285,12 +285,14 @@ static int filter_frame(AVFilterLink *link, AVFrame
*picref)
if (idet->cur->interlaced_frame) {
idet->cur->interlaced_frame = 0;
filter(ctx);
- if (idet->last_type == PROGRESSIVE) {
- idet->interlaced_flag_accuracy --;
- idet->analyze_interlaced_flag --;
- } else if (idet->last_type != UNDETERMINED) {
- idet->interlaced_flag_accuracy ++;
- idet->analyze_interlaced_flag --;
+ if (idet->last_type != UNDETERMINED) {
+ if (idet->last_type == PROGRESSIVE) {
+ idet->interlaced_flag_accuracy --;
+ idet->analyze_interlaced_flag --;
+ } else {
+ idet->interlaced_flag_accuracy ++;
+ idet->analyze_interlaced_flag --;
+ }
}
if (idet->analyze_interlaced_flag == 1) {
ff_filter_frame(ctx->outputs[0],
av_frame_clone(idet->cur));
}}}
--
Ticket URL: <https://trac.ffmpeg.org/ticket/7565#comment:2>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list