summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-10-20 15:17:33 +0200
committerwm4 <wm4@nowhere>2019-10-20 16:16:28 +0200
commit5dc78b61f5dfa5c27a627d798fd867e728d2be70 (patch)
tree19c883256eb1562387bf8425471dc5788d572fdb
parent64c8dd5964a7ae3056e3f70100ea187eb26bec1a (diff)
downloadmpv-5dc78b61f5dfa5c27a627d798fd867e728d2be70.tar.bz2
mpv-5dc78b61f5dfa5c27a627d798fd867e728d2be70.tar.xz
vf_fingerprint: remove single-plane optimization
According to the zimg author, YUV->GREY conversion does not even read the chroma planes, as long as no matrix conversion is involved. Since we try to avoid the latter anyway by forcing the source parameters on the target image, passing only the Y plane will not help with anything. An unscientific test seems to confirm this, so remove this. This would probably help with libswscale (I didn't test this), but on the other hand, libswscale will rarely be used in cases where we can extract the Y plane. (Except nv12, which should probably be added to the zimg wrapper's unpacking.)
-rw-r--r--video/filter/vf_fingerprint.c32
1 files changed, 1 insertions, 31 deletions
diff --git a/video/filter/vf_fingerprint.c b/video/filter/vf_fingerprint.c
index b65400000d..91ca2b6a83 100644
--- a/video/filter/vf_fingerprint.c
+++ b/video/filter/vf_fingerprint.c
@@ -66,8 +66,6 @@ struct priv {
struct mp_zimg_context *zimg;
struct print_entry entries[PRINT_ENTRY_NUM];
int num_entries;
- int last_imgfmt, last_w, last_h;
- int gray_plane_imgfmt;
bool fallback_warning;
};
@@ -79,29 +77,8 @@ static void f_reset(struct mp_filter *f)
for (int n = 0; n < p->num_entries; n++)
talloc_free(p->entries[n].print);
p->num_entries = 0;
-}
-
-static void reinit_fmt(struct mp_filter *f, struct mp_image *mpi)
-{
- struct priv *p = f->priv;
-
- if (mpi->imgfmt == p->last_imgfmt &&
- mpi->w == p->last_w &&
- mpi->h == p->last_h)
- return;
- p->last_imgfmt = mpi->imgfmt;
- p->last_w = mpi->w;
- p->last_h = mpi->h;
- p->gray_plane_imgfmt = 0;
p->fallback_warning = false;
-
- if (mpi->fmt.flags & (MP_IMGFLAG_YUV_NV | MP_IMGFLAG_YUV_P)) {
- // Try to pass only the first plane, in the hope that it might be
- // faster.
- p->gray_plane_imgfmt =
- mp_imgfmt_find(0, 0, 1, mpi->fmt.component_bits, MP_IMGFLAG_YUV_P);
- }
}
static void f_process(struct mp_filter *f)
@@ -123,20 +100,13 @@ static void f_process(struct mp_filter *f)
struct mp_image *mpi = frame.data;
- reinit_fmt(f, mpi);
-
// Try to achieve minimum conversion, even if it makes the fingerprints less
// "portable" across source video.
p->scaled->params.color = mpi->params.color;
// Make output always full range; no reason to lose precision.
p->scaled->params.color.levels = MP_CSP_LEVELS_PC;
- struct mp_image src = *mpi;
-
- if (p->gray_plane_imgfmt)
- mp_image_setfmt(&src, p->gray_plane_imgfmt);
-
- if (!mp_zimg_convert(p->zimg, p->scaled, &src)) {
+ if (!mp_zimg_convert(p->zimg, p->scaled, mpi)) {
if (!p->fallback_warning) {
MP_WARN(f, "Falling back to libswscale.\n");
p->fallback_warning = true;