summaryrefslogtreecommitdiffstats
path: root/video/filter
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-06-29 21:30:10 +0200
committerwm4 <wm4@nowhere>2017-06-29 21:30:10 +0200
commit300f6a334498059f28ec63406112348c7e00fa64 (patch)
tree955e8139ad77c0423c4db6780f35524c961664c9 /video/filter
parentaf5a71f52ec9191aa20b602e3764d225b5d5029d (diff)
downloadmpv-300f6a334498059f28ec63406112348c7e00fa64.tar.bz2
mpv-300f6a334498059f28ec63406112348c7e00fa64.tar.xz
video: drop some more IMGFMT aliases
For vo_opengl and vo_direct3d, these are supported in a generic way. For vf_vapoursynth, we could probably map its VSFormat struct in a generic way, but for now do some bullshit. vf_eq.c actually loses support for these formats. We could add generic support too (anything that has 8 bit planes will work), but why bother. The filter is deprecated anyway.
Diffstat (limited to 'video/filter')
-rw-r--r--video/filter/vf_eq.c4
-rw-r--r--video/filter/vf_vapoursynth.c75
2 files changed, 52 insertions, 27 deletions
diff --git a/video/filter/vf_eq.c b/video/filter/vf_eq.c
index 9be749a1de..6344cef0e0 100644
--- a/video/filter/vf_eq.c
+++ b/video/filter/vf_eq.c
@@ -364,11 +364,7 @@ int query_format (vf_instance_t *vf, unsigned fmt)
switch (fmt) {
case IMGFMT_Y8:
case IMGFMT_444P:
- case IMGFMT_422P:
- case IMGFMT_440P:
case IMGFMT_420P:
- case IMGFMT_411P:
- case IMGFMT_410P:
return vf_next_query_format (vf, fmt);
}
diff --git a/video/filter/vf_vapoursynth.c b/video/filter/vf_vapoursynth.c
index 33a586c024..b9aed339aa 100644
--- a/video/filter/vf_vapoursynth.c
+++ b/video/filter/vf_vapoursynth.c
@@ -97,44 +97,73 @@ struct script_driver {
struct mpvs_fmt {
VSPresetFormat vs;
- int mp;
+ int bits, cw, ch;
};
static const struct mpvs_fmt mpvs_fmt_table[] = {
- {pfYUV420P8, IMGFMT_420P},
- {pfYUV422P8, IMGFMT_422P},
- {pfYUV444P8, IMGFMT_444P},
- {pfYUV410P8, IMGFMT_410P},
- {pfYUV411P8, IMGFMT_411P},
- {pfYUV440P8, IMGFMT_440P},
- {pfYUV420P9, IMGFMT_420P9},
- {pfYUV422P9, IMGFMT_422P9},
- {pfYUV444P9, IMGFMT_444P9},
- {pfYUV420P10, IMGFMT_420P10},
- {pfYUV422P10, IMGFMT_422P10},
- {pfYUV444P10, IMGFMT_444P10},
- {pfYUV420P16, IMGFMT_420P16},
- {pfYUV422P16, IMGFMT_422P16},
- {pfYUV444P16, IMGFMT_444P16},
+ {pfYUV420P8, 8, 2, 2},
+ {pfYUV420P9, 9, 2, 2},
+ {pfYUV420P10, 10, 2, 2},
+ {pfYUV420P16, 16, 2, 2},
+ {pfYUV422P8, 8, 2, 1},
+ {pfYUV422P9, 9, 2, 1},
+ {pfYUV422P10, 10, 2, 1},
+ {pfYUV422P16, 16, 2, 1},
+ {pfYUV410P8, 8, 4, 4},
+ {pfYUV411P8, 8, 4, 1},
+ {pfYUV440P8, 8, 1, 2},
+ {pfYUV444P8, 8, 1, 1},
+ {pfYUV444P9, 9, 1, 1},
+ {pfYUV444P10, 10, 1, 1},
+ {pfYUV444P16, 16, 1, 1},
{pfNone}
};
+static bool compare_fmt(int imgfmt, const struct mpvs_fmt *vs)
+{
+ struct mp_regular_imgfmt rfmt;
+ if (!mp_get_regular_imgfmt(&rfmt, imgfmt))
+ return false;
+ if (rfmt.component_pad > 0)
+ return false;
+ if (rfmt.chroma_w != vs->cw || rfmt.chroma_h != vs->ch)
+ return false;
+ if (rfmt.component_size * 8 - rfmt.component_pad != vs->bits)
+ return false;
+ if (rfmt.num_planes != 3)
+ return false;
+ for (int n = 0; n < 3; n++) {
+ if (rfmt.planes[n].num_components != 1)
+ return false;
+ if (rfmt.planes[n].components[0] != n + 1)
+ return false;
+ }
+ return true;
+}
+
static VSPresetFormat mp_to_vs(int imgfmt)
{
- for (int n = 0; mpvs_fmt_table[n].mp; n++) {
- if (mpvs_fmt_table[n].mp == imgfmt)
- return mpvs_fmt_table[n].vs;
+ for (int n = 0; mpvs_fmt_table[n].bits; n++) {
+ const struct mpvs_fmt *vsentry = &mpvs_fmt_table[n];
+ if (compare_fmt(imgfmt, vsentry))
+ return vsentry->vs;
}
return pfNone;
}
static int mp_from_vs(VSPresetFormat vs)
{
- for (int n = 0; mpvs_fmt_table[n].mp; n++) {
- if (mpvs_fmt_table[n].vs == vs)
- return mpvs_fmt_table[n].mp;
+ for (int n = 0; mpvs_fmt_table[n].bits; n++) {
+ const struct mpvs_fmt *vsentry = &mpvs_fmt_table[n];
+ if (vsentry->vs == vs) {
+ for (int imgfmt = IMGFMT_START; imgfmt < IMGFMT_END; imgfmt++) {
+ if (compare_fmt(imgfmt, vsentry))
+ return imgfmt;
+ }
+ break;
+ }
}
- return pfNone;
+ return 0;
}
static void copy_mp_to_vs_frame_props_map(struct vf_priv_s *p, VSMap *map,