[FFmpeg-devel] [PATCH v1] avfilter/f_select: yuv will use Y plane only for scenecut detect
lance.lmwang at gmail.com
lance.lmwang at gmail.com
Sat Aug 10 19:02:03 EEST 2019
From: Limin Wang <lance.lmwang at gmail.com>
It'll improve about +0.1 threshold for scenecut detect
Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
---
libavfilter/f_select.c | 5 ++++-
tests/ref/fate/filter-metadata-scenedetect | 16 ++++++++--------
2 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c
index 5c7372c..bd40b3b 100644
--- a/libavfilter/f_select.c
+++ b/libavfilter/f_select.c
@@ -148,6 +148,7 @@ typedef struct SelectContext {
double var_values[VAR_VARS_NB];
int bitdepth;
int nb_planes;
+ int is_yuv;
ptrdiff_t width[4];
ptrdiff_t height[4];
int do_scene_detect; ///< 1 if the expression requires scene detection variables, 0 otherwise
@@ -211,7 +212,9 @@ static int config_input(AVFilterLink *inlink)
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
select->bitdepth = desc->comp[0].depth;
- select->nb_planes = av_pix_fmt_count_planes(inlink->format);
+ select->is_yuv = !(desc->flags & AV_PIX_FMT_FLAG_RGB);
+ select->nb_planes = select->is_yuv ? 1 : av_pix_fmt_count_planes(inlink->format);
+
for (int plane = 0; plane < select->nb_planes; plane++) {
ptrdiff_t line_size = av_image_get_linesize(inlink->format, inlink->w, plane);
int vsub = desc->log2_chroma_h;
diff --git a/tests/ref/fate/filter-metadata-scenedetect b/tests/ref/fate/filter-metadata-scenedetect
index 7ce2d67..36c033b 100644
--- a/tests/ref/fate/filter-metadata-scenedetect
+++ b/tests/ref/fate/filter-metadata-scenedetect
@@ -1,11 +1,11 @@
pkt_pts=1620|tag:lavfi.scene_score=1.000000
-pkt_pts=4140|tag:lavfi.scene_score=0.668643
-pkt_pts=5800|tag:lavfi.scene_score=0.996721
-pkt_pts=6720|tag:lavfi.scene_score=0.357390
-pkt_pts=8160|tag:lavfi.scene_score=0.886268
-pkt_pts=9760|tag:lavfi.scene_score=0.926219
-pkt_pts=14080|tag:lavfi.scene_score=0.650033
+pkt_pts=4140|tag:lavfi.scene_score=0.923403
+pkt_pts=5800|tag:lavfi.scene_score=1.000000
+pkt_pts=6720|tag:lavfi.scene_score=0.475643
+pkt_pts=8160|tag:lavfi.scene_score=1.000000
+pkt_pts=9760|tag:lavfi.scene_score=1.000000
+pkt_pts=14080|tag:lavfi.scene_score=0.874623
pkt_pts=15700|tag:lavfi.scene_score=1.000000
-pkt_pts=18500|tag:lavfi.scene_score=0.316402
-pkt_pts=20040|tag:lavfi.scene_score=0.269509
+pkt_pts=18500|tag:lavfi.scene_score=0.422509
+pkt_pts=20040|tag:lavfi.scene_score=0.352360
pkt_pts=21760|tag:lavfi.scene_score=1.000000
--
2.6.4
More information about the ffmpeg-devel
mailing list