History

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.

Limin Wang committed 7 years ago

Commit ad3ef001 parent c294f382 files · +13 −9Browse files

Showing the changes to libavfilter (1 of 2 files). Show all

Unified · Split

libavfilter/f_select.c+5−1
@@ -209,9 +209,13 @@ static int config_input(AVFilterLink *inlink) · 208 unmodified lines
209{209{
210 SelectContext *select = inlink->dst->priv;210 SelectContext *select = inlink->dst->priv;
211 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);211 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
212 int is_yuv = !(desc->flags & AV_PIX_FMT_FLAG_RGB) &&
213 (desc->flags & AV_PIX_FMT_FLAG_PLANAR) &&
214 desc->nb_components >= 3;
212 215
213 select->bitdepth = desc->comp[0].depth;216 select->bitdepth = desc->comp[0].depth;
214 select->nb_planes = av_pix_fmt_count_planes(inlink->format);217 select->nb_planes = is_yuv ? 1 : av_pix_fmt_count_planes(inlink->format);
218
215 for (int plane = 0; plane < select->nb_planes; plane++) {219 for (int plane = 0; plane < select->nb_planes; plane++) {
216 ptrdiff_t line_size = av_image_get_linesize(inlink->format, inlink->w, plane);220 ptrdiff_t line_size = av_image_get_linesize(inlink->format, inlink->w, plane);
217 int vsub = desc->log2_chroma_h;221 int vsub = desc->log2_chroma_h;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t