aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/f_select.c
diff options
context:
space:
mode:
authorLimin Wang <lance.lmwang@gmail.com>2019-08-13 09:39:47 +0800
committerMarton Balint <cus@passwd.hu>2019-08-17 17:15:19 +0200
commitad3ef00ce513beee3e22a910e75f40d324a6a7ad (patch)
tree2fab6eaac4b665489e9688863b0741b1e03f5755 /libavfilter/f_select.c
parentc294f38c91f440880ffd28fda0eeb1154431ab7e (diff)
downloadffmpeg-ad3ef00ce513beee3e22a910e75f40d324a6a7ad.tar.gz
avfilter/f_select: yuv will use Y plane only for scenecut detect
At the moment scene change detection score uses all planes to detect scene changes. In this regard this is similar how the frozen frames detection works. However, in classic encoding scene change detection typically only uses the Y plane. We might get more resonable scores for scene change if we also use only the Y plane for calculating the score if the pixel format is YUV. Although this will require additional work once packed YUV formats are added, because for the moment the generic scene sad score calculation has no way to ignore some components in a packed format. Signed-off-by: Limin Wang <lance.lmwang@gmail.com> Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavfilter/f_select.c')
-rw-r--r--libavfilter/f_select.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c
index 5c7372c976..755e10a399 100644
--- a/libavfilter/f_select.c
+++ b/libavfilter/f_select.c
@@ -209,9 +209,13 @@ static int config_input(AVFilterLink *inlink)
{
SelectContext *select = inlink->dst->priv;
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
+ int is_yuv = !(desc->flags & AV_PIX_FMT_FLAG_RGB) &&
+ (desc->flags & AV_PIX_FMT_FLAG_PLANAR) &&
+ desc->nb_components >= 3;
select->bitdepth = desc->comp[0].depth;
- select->nb_planes = av_pix_fmt_count_planes(inlink->format);
+ select->nb_planes = 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;