summaryrefslogtreecommitdiffstats
path: root/video/zimg.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-07-14 22:52:27 +0200
committerwm4 <wm4@nowhere>2020-07-15 22:59:17 +0200
commit2a89da0c8548bec624f7f60f0b08d98602c7d394 (patch)
treed898c6ca78a61658041406981f51531510d6f832 /video/zimg.h
parentf1290f709509b950ee9d7131bfcb6e1be901f69d (diff)
downloadmpv-2a89da0c8548bec624f7f60f0b08d98602c7d394.tar.bz2
mpv-2a89da0c8548bec624f7f60f0b08d98602c7d394.tar.xz
zimg: add slice threading and use it by default
This probably makes it much faster (I wouldn't know, I didn't run any benchmarks ). Seems to work as well (although I'm not sure, it's not like I'd perform rigorous tests). The scale_zimg test seems to mysteriously treat color in fully transparent alpha differently, which makes no sense, and isn't visible (but makes the test fail). I can't be bothered with investigating this more. What do you do with failing tests? Correct, you disable them. Or rather, you disable whatever appears to cause them to fail, which is the threading in this case. This change follows mostly the tile_example.cpp. The slice size uses a minimum of 64, which was suggested by the zimg author. Some of this commit is a bit inelegant and weird, such as recomputing the scale factor for every slice, or the way slice_h is managed. Too lazy to make this more elegant. zimg git had a regressio around active_region (which is needed by the slicing), which was fixed in commit 83071706b2e6bc634. Apparently, the bug was never released, so just add a warning to the manpage.
Diffstat (limited to 'video/zimg.h')
-rw-r--r--video/zimg.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/video/zimg.h b/video/zimg.h
index 01e731cc36..a4f1954402 100644
--- a/video/zimg.h
+++ b/video/zimg.h
@@ -20,6 +20,7 @@ struct zimg_opts {
double scaler_chroma_params[2];
int dither;
int fast;
+ int threads;
};
extern const struct zimg_opts zimg_opts_defaults;
@@ -42,6 +43,8 @@ struct mp_zimg_context {
struct m_config_cache *opts_cache;
struct mp_zimg_state **states;
int num_states;
+ struct mp_thread_pool *tp;
+ int current_thread_count;
};
// Allocate a zimg context. Always succeeds. Returns a talloc pointer (use