summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-01-17 15:19:05 +0100
committerwm4 <wm4@nowhere>2020-01-17 15:19:05 +0100
commitad1ae6425196cd6ad6237f96423caa5c8533a2ba (patch)
tree788342b2f9b4ced20b128c17f17f79897577705a
parent044996e1123b17b8f16e7c8995de185944257be5 (diff)
downloadmpv-ad1ae6425196cd6ad6237f96423caa5c8533a2ba.tar.bz2
mpv-ad1ae6425196cd6ad6237f96423caa5c8533a2ba.tar.xz
f_autoconvert: remove subfmt conversion BS
This was used to convert e.g. P010 to NV12 within the filter chain, which hopefully a thing that is not needed anymore. (And has been dead code since the ANGLE "RGB" interop code was removed.)
-rw-r--r--filters/f_autoconvert.c67
-rw-r--r--filters/f_autoconvert.h2
-rw-r--r--filters/f_output_chain.c3
3 files changed, 1 insertions, 71 deletions
diff --git a/filters/f_autoconvert.c b/filters/f_autoconvert.c
index 37a16c9851..5e0caaf321 100644
--- a/filters/f_autoconvert.c
+++ b/filters/f_autoconvert.c
@@ -59,17 +59,6 @@ static const struct mp_filter_info convert_filter = {
.name = "convert",
};
-// For hw decoding: thing which can convert between underlying surface formats.
-// The filter detects the needed target format from struct mp_hwdec_ctx.
-struct subfmt_conv {
- int hw_imgfmt;
- struct mp_filter *(*create)(struct mp_filter *parent);
-};
-
-static const struct subfmt_conv subfmt_converters[] = {
- {0}
-};
-
void mp_autoconvert_clear(struct mp_autoconvert *c)
{
struct priv *p = c->f->priv;
@@ -121,44 +110,6 @@ void mp_autoconvert_add_all_sw_imgfmts(struct mp_autoconvert *c)
}
}
-void mp_autoconvert_add_vo_hwdec_subfmts(struct mp_autoconvert *c,
- struct mp_hwdec_devices *devs)
-{
- struct priv *p = c->f->priv;
- assert(devs);
-
- int prev_format = 0;
-
- for (int n = 0; ; n++) {
- struct mp_hwdec_ctx *ctx = hwdec_devices_get_n(devs, n);
- if (!ctx)
- break;
- if (!ctx->hw_imgfmt || !ctx->supported_formats)
- continue;
- // Very hacky: don't let d3d11-egl-rgb overwrite d3d11-egl
- if (ctx->hw_imgfmt == prev_format)
- continue;
- prev_format = ctx->hw_imgfmt;
- // Stupidity: VOs export imgfmt only, so subfmt is always 0. Remove it
- // to fix it up.
- for (int i = 0; i < p->num_imgfmts; i++) {
- if (p->imgfmts[i] != ctx->hw_imgfmt)
- continue;
-
- int count = p->num_imgfmts;
- MP_TARRAY_REMOVE_AT(p->imgfmts, count, i);
- count = p->num_imgfmts;
- MP_TARRAY_REMOVE_AT(p->subfmts, count, i);
- p->num_imgfmts -= 1;
- break;
- }
- for (int i = 0; ctx->supported_formats[i]; i++)
- mp_autoconvert_add_imgfmt(c, ctx->hw_imgfmt, ctx->supported_formats[i]);
- }
-
- p->vo_convert = true;
-}
-
void mp_autoconvert_add_afmt(struct mp_autoconvert *c, int afmt)
{
struct priv *p = c->f->priv;
@@ -198,13 +149,9 @@ static bool build_image_converter(struct mp_autoconvert *c, struct mp_log *log,
if (!p->num_imgfmts)
return true;
- bool different_subfmt = false;
-
for (int n = 0; n < p->num_imgfmts; n++) {
bool samefmt = img->params.imgfmt == p->imgfmts[n];
bool samesubffmt = img->params.hw_subfmt == p->subfmts[n];
- if (samefmt && !samesubffmt)
- different_subfmt = true;
if (samefmt && (samesubffmt || !p->subfmts[n])) {
if (p->imgparams_set) {
if (!mp_image_params_equal(&p->imgparams, &img->params))
@@ -214,8 +161,6 @@ static bool build_image_converter(struct mp_autoconvert *c, struct mp_log *log,
}
}
- struct mp_stream_info *info = mp_filter_find_stream_info(f);
-
struct mp_filter *conv = mp_filter_create(f, &convert_filter);
mp_filter_add_pin(conv, MP_PIN_IN, "in");
mp_filter_add_pin(conv, MP_PIN_OUT, "out");
@@ -262,18 +207,6 @@ static bool build_image_converter(struct mp_autoconvert *c, struct mp_log *log,
num_fmts = hwupload_fmt ? 1 : 0;
hw_to_sw = false;
}
- } else if (p->vo_convert && different_subfmt && info && info->hwdec_devs) {
- for (int n = 0; subfmt_converters[n].hw_imgfmt; n++) {
- if (subfmt_converters[n].hw_imgfmt == img->imgfmt) {
- mp_info(log, "Using HW sub-conversion.\n");
- filters[2] = subfmt_converters[n].create(conv);
- if (filters[2]) {
- need_sws = false;
- hw_to_sw = false;
- break;
- }
- }
- }
}
int src_fmt = img->imgfmt;
diff --git a/filters/f_autoconvert.h b/filters/f_autoconvert.h
index ae08fd4e51..7cb144aa59 100644
--- a/filters/f_autoconvert.h
+++ b/filters/f_autoconvert.h
@@ -35,7 +35,7 @@ void mp_autoconvert_set_target_image_params(struct mp_autoconvert *c,
// Each call adds to the list of allowed formats. Before the first call, all
// formats are allowed (even non-video).
// subfmt can be used to specify underlying surface formats for hardware formats,
-// otherwise must be 0.
+// otherwise must be 0. (Mismatches lead to conversion errors.)
void mp_autoconvert_add_imgfmt(struct mp_autoconvert *c, int imgfmt, int subfmt);
// Add all sw image formats. The effect is that hardware video image formats are
diff --git a/filters/f_output_chain.c b/filters/f_output_chain.c
index 1a6a910273..9b54f85506 100644
--- a/filters/f_output_chain.c
+++ b/filters/f_output_chain.c
@@ -88,9 +88,6 @@ static void update_output_caps(struct chain *p)
if (allowed_output_formats[n])
mp_autoconvert_add_imgfmt(p->convert, IMGFMT_START + n, 0);
}
-
- if (p->vo->hwdec_devs)
- mp_autoconvert_add_vo_hwdec_subfmts(p->convert, p->vo->hwdec_devs);
}
}