From 77fd4dd681be8eb95d8e7b79b66242822f95e4da Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 17 Oct 2019 22:43:14 +0200 Subject: video: remove mp_image_params.hw_flags field This was speculatively added 2 years ago in preparation for something that apparently never happened. The D3D code was added as an "example", but this too was never used/finished. No reason to keep this. --- video/d3d.c | 10 ---------- video/filter/vf_d3d11vpp.c | 1 - video/hwdec.h | 6 ------ video/mp_image.c | 7 ------- video/mp_image.h | 6 ------ 5 files changed, 30 deletions(-) diff --git a/video/d3d.c b/video/d3d.c index b7a644dcfd..dfb999b854 100644 --- a/video/d3d.c +++ b/video/d3d.c @@ -112,15 +112,6 @@ AVBufferRef *d3d11_wrap_device_ref(ID3D11Device *device) return device_ref; } -static void d3d11_complete_image_params(struct mp_image *img) -{ - AVHWFramesContext *hw_frames = (void *)img->hwctx->data; - - // According to hwcontex_d3d11va.h, this means DXGI_FORMAT_420_OPAQUE. - img->params.hw_flags = hw_frames->sw_format == AV_PIX_FMT_YUV420P - ? MP_IMAGE_HW_FLAG_OPAQUE : 0; -} - static struct AVBufferRef *d3d11_create_standalone(struct mpv_global *global, struct mp_log *plog, struct hwcontext_create_dev_params *params) { @@ -152,7 +143,6 @@ static struct AVBufferRef *d3d11_create_standalone(struct mpv_global *global, const struct hwcontext_fns hwcontext_fns_d3d11 = { .av_hwdevice_type = AV_HWDEVICE_TYPE_D3D11VA, - .complete_image_params = d3d11_complete_image_params, .refine_hwframes = d3d11_refine_hwframes, .create_dev = d3d11_create_standalone, }; diff --git a/video/filter/vf_d3d11vpp.c b/video/filter/vf_d3d11vpp.c index 5464019dac..504b881f3f 100644 --- a/video/filter/vf_d3d11vpp.c +++ b/video/filter/vf_d3d11vpp.c @@ -349,7 +349,6 @@ static void vf_d3d11vpp_process(struct mp_filter *vf) p->out_params.hw_subfmt = IMGFMT_NV12; p->out_format = DXGI_FORMAT_NV12; - p->out_params.hw_flags = 0; p->require_filtering = p->params.hw_subfmt != p->out_params.hw_subfmt; } diff --git a/video/hwdec.h b/video/hwdec.h index d951a1cd8c..0aa33a05ba 100644 --- a/video/hwdec.h +++ b/video/hwdec.h @@ -75,12 +75,6 @@ struct hwcontext_create_dev_params { // All entries are strictly optional. struct hwcontext_fns { int av_hwdevice_type; - // Set any mp_image fields that require hwcontext specific code, such as - // fields or flags not present in AVFrame or AVHWFramesContext in a - // portable way. This is called directly after img is converted from an - // AVFrame, with all other fields already set. img.hwctx will be set, and - // use the correct AV_HWDEVICE_TYPE_. - void (*complete_image_params)(struct mp_image *img); // Fill in special format-specific requirements. void (*refine_hwframes)(struct AVBufferRef *hw_frames_ctx); // Returns a AVHWDeviceContext*. Used for copy hwdecs. diff --git a/video/mp_image.c b/video/mp_image.c index 74ca80db21..3ef2b3b6f6 100644 --- a/video/mp_image.c +++ b/video/mp_image.c @@ -643,8 +643,6 @@ char *mp_image_params_to_str_buf(char *b, size_t bs, mp_snprintf_cat(b, bs, " %s", mp_imgfmt_to_name(p->imgfmt)); if (p->hw_subfmt) mp_snprintf_cat(b, bs, "[%s]", mp_imgfmt_to_name(p->hw_subfmt)); - if (p->hw_flags) - mp_snprintf_cat(b, bs, "[0x%x]", p->hw_flags); mp_snprintf_cat(b, bs, " %s/%s/%s/%s/%s", m_opt_choice_str(mp_csp_names, p->color.space), m_opt_choice_str(mp_csp_prim_names, p->color.primaries), @@ -716,7 +714,6 @@ bool mp_image_params_equal(const struct mp_image_params *p1, { return p1->imgfmt == p2->imgfmt && p1->hw_subfmt == p2->hw_subfmt && - p1->hw_flags == p2->hw_flags && p1->w == p2->w && p1->h == p2->h && p1->p_w == p2->p_w && p1->p_h == p2->p_h && mp_colorspace_equal(p1->color, p2->color) && @@ -939,10 +936,6 @@ struct mp_image *mp_image_from_av_frame(struct AVFrame *src) if (dst->hwctx) { AVHWFramesContext *fctx = (void *)dst->hwctx->data; dst->params.hw_subfmt = pixfmt2imgfmt(fctx->sw_format); - const struct hwcontext_fns *fns = - hwdec_get_hwcontext_fns(fctx->device_ctx->type); - if (fns && fns->complete_image_params) - fns->complete_image_params(dst); } struct mp_image *res = mp_image_new_ref(dst); diff --git a/video/mp_image.h b/video/mp_image.h index 0eed3eb43c..1dda20849e 100644 --- a/video/mp_image.h +++ b/video/mp_image.h @@ -52,18 +52,12 @@ struct mp_spherical_params { float ref_angles[3]; // yaw/pitch/roll, refer to AVSphericalMapping }; -enum mp_image_hw_flags { - MP_IMAGE_HW_FLAG_OPAQUE = 1, // an opaque hw format is used - the exact - // format is subject to hwctx internals -}; - // Describes image parameters that usually stay constant. // New fields can be added in the future. Code changing the parameters should // usually copy the whole struct, so that fields added later will be preserved. struct mp_image_params { enum mp_imgfmt imgfmt; // pixel format enum mp_imgfmt hw_subfmt; // underlying format for some hwaccel pixfmts - unsigned hw_flags; // bit mask of mp_image_hw_flags int w, h; // image dimensions int p_w, p_h; // define pixel aspect ratio (undefined: 0/0) struct mp_colorspace color; -- cgit v1.2.3