mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
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.
This commit is contained in:
10
video/d3d.c
10
video/d3d.c
@@ -112,15 +112,6 @@ AVBufferRef *d3d11_wrap_device_ref(ID3D11Device *device)
|
|||||||
return device_ref;
|
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,
|
static struct AVBufferRef *d3d11_create_standalone(struct mpv_global *global,
|
||||||
struct mp_log *plog, struct hwcontext_create_dev_params *params)
|
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 = {
|
const struct hwcontext_fns hwcontext_fns_d3d11 = {
|
||||||
.av_hwdevice_type = AV_HWDEVICE_TYPE_D3D11VA,
|
.av_hwdevice_type = AV_HWDEVICE_TYPE_D3D11VA,
|
||||||
.complete_image_params = d3d11_complete_image_params,
|
|
||||||
.refine_hwframes = d3d11_refine_hwframes,
|
.refine_hwframes = d3d11_refine_hwframes,
|
||||||
.create_dev = d3d11_create_standalone,
|
.create_dev = d3d11_create_standalone,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -349,7 +349,6 @@ static void vf_d3d11vpp_process(struct mp_filter *vf)
|
|||||||
|
|
||||||
p->out_params.hw_subfmt = IMGFMT_NV12;
|
p->out_params.hw_subfmt = IMGFMT_NV12;
|
||||||
p->out_format = DXGI_FORMAT_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;
|
p->require_filtering = p->params.hw_subfmt != p->out_params.hw_subfmt;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,12 +75,6 @@ struct hwcontext_create_dev_params {
|
|||||||
// All entries are strictly optional.
|
// All entries are strictly optional.
|
||||||
struct hwcontext_fns {
|
struct hwcontext_fns {
|
||||||
int av_hwdevice_type;
|
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.
|
// Fill in special format-specific requirements.
|
||||||
void (*refine_hwframes)(struct AVBufferRef *hw_frames_ctx);
|
void (*refine_hwframes)(struct AVBufferRef *hw_frames_ctx);
|
||||||
// Returns a AVHWDeviceContext*. Used for copy hwdecs.
|
// Returns a AVHWDeviceContext*. Used for copy hwdecs.
|
||||||
|
|||||||
@@ -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));
|
mp_snprintf_cat(b, bs, " %s", mp_imgfmt_to_name(p->imgfmt));
|
||||||
if (p->hw_subfmt)
|
if (p->hw_subfmt)
|
||||||
mp_snprintf_cat(b, bs, "[%s]", mp_imgfmt_to_name(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",
|
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_names, p->color.space),
|
||||||
m_opt_choice_str(mp_csp_prim_names, p->color.primaries),
|
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 &&
|
return p1->imgfmt == p2->imgfmt &&
|
||||||
p1->hw_subfmt == p2->hw_subfmt &&
|
p1->hw_subfmt == p2->hw_subfmt &&
|
||||||
p1->hw_flags == p2->hw_flags &&
|
|
||||||
p1->w == p2->w && p1->h == p2->h &&
|
p1->w == p2->w && p1->h == p2->h &&
|
||||||
p1->p_w == p2->p_w && p1->p_h == p2->p_h &&
|
p1->p_w == p2->p_w && p1->p_h == p2->p_h &&
|
||||||
mp_colorspace_equal(p1->color, p2->color) &&
|
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) {
|
if (dst->hwctx) {
|
||||||
AVHWFramesContext *fctx = (void *)dst->hwctx->data;
|
AVHWFramesContext *fctx = (void *)dst->hwctx->data;
|
||||||
dst->params.hw_subfmt = pixfmt2imgfmt(fctx->sw_format);
|
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);
|
struct mp_image *res = mp_image_new_ref(dst);
|
||||||
|
|||||||
@@ -52,18 +52,12 @@ struct mp_spherical_params {
|
|||||||
float ref_angles[3]; // yaw/pitch/roll, refer to AVSphericalMapping
|
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.
|
// Describes image parameters that usually stay constant.
|
||||||
// New fields can be added in the future. Code changing the parameters should
|
// 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.
|
// usually copy the whole struct, so that fields added later will be preserved.
|
||||||
struct mp_image_params {
|
struct mp_image_params {
|
||||||
enum mp_imgfmt imgfmt; // pixel format
|
enum mp_imgfmt imgfmt; // pixel format
|
||||||
enum mp_imgfmt hw_subfmt; // underlying format for some hwaccel pixfmts
|
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 w, h; // image dimensions
|
||||||
int p_w, p_h; // define pixel aspect ratio (undefined: 0/0)
|
int p_w, p_h; // define pixel aspect ratio (undefined: 0/0)
|
||||||
struct mp_colorspace color;
|
struct mp_colorspace color;
|
||||||
|
|||||||
Reference in New Issue
Block a user