diff options
author | Kacper Michajłow <kasper93@gmail.com> | 2024-02-10 23:46:04 +0100 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2024-03-09 05:58:52 +0000 |
commit | 391261f7576ff2abc738cf8d566bdc8aad267f1f (patch) | |
tree | aeee31dab84ead2dd19370668e5d924fe1820e9f /video | |
parent | 120b0ac4125859fc5bfb555e73ffd4f8905fe881 (diff) | |
download | mpv-391261f7576ff2abc738cf8d566bdc8aad267f1f.tar.bz2 mpv-391261f7576ff2abc738cf8d566bdc8aad267f1f.tar.xz |
mp_image: add mp_image_params_static_equal for finer comparision
In case of dynamic HDR metadata is present.
Diffstat (limited to 'video')
-rw-r--r-- | video/filter/refqueue.c | 2 | ||||
-rw-r--r-- | video/filter/vf_gpu.c | 6 | ||||
-rw-r--r-- | video/mp_image.c | 11 | ||||
-rw-r--r-- | video/mp_image.h | 2 | ||||
-rw-r--r-- | video/out/gpu/video.c | 4 | ||||
-rw-r--r-- | video/out/vo_gpu_next.c | 6 | ||||
-rw-r--r-- | video/vdpau_mixer.c | 2 |
7 files changed, 26 insertions, 7 deletions
diff --git a/video/filter/refqueue.c b/video/filter/refqueue.c index 3cfe3c61ff..f5124087c6 100644 --- a/video/filter/refqueue.c +++ b/video/filter/refqueue.c @@ -333,7 +333,7 @@ bool mp_refqueue_can_output(struct mp_refqueue *q) if (!q->in_format || !!q->in_format->hwctx != !!img->hwctx || (img->hwctx && img->hwctx->data != q->in_format->hwctx->data) || - !mp_image_params_equal(&q->in_format->params, &img->params)) + !mp_image_params_static_equal(&q->in_format->params, &img->params)) { q->next = img; q->eof = true; diff --git a/video/filter/vf_gpu.c b/video/filter/vf_gpu.c index dba4b3204f..e19faaef42 100644 --- a/video/filter/vf_gpu.c +++ b/video/filter/vf_gpu.c @@ -166,12 +166,14 @@ static struct mp_image *gpu_render_frame(struct mp_filter *f, struct mp_image *i bool need_reconfig = m_config_cache_update(priv->vo_opts_cache); - if (!mp_image_params_equal(&priv->img_params, &in->params)) { - priv->img_params = in->params; + if (!mp_image_params_static_equal(&priv->img_params, &in->params)) { gl_video_config(priv->renderer, &in->params); need_reconfig = true; } + if (!mp_image_params_equal(&priv->img_params, &in->params)) + priv->img_params = in->params; + if (need_reconfig) { struct mp_rect src, dst; struct mp_osd_res osd; diff --git a/video/mp_image.c b/video/mp_image.c index f9decfa579..33a784741f 100644 --- a/video/mp_image.c +++ b/video/mp_image.c @@ -844,6 +844,17 @@ bool mp_image_params_equal(const struct mp_image_params *p1, mp_rect_equals(&p1->crop, &p2->crop); } +bool mp_image_params_static_equal(const struct mp_image_params *p1, + const struct mp_image_params *p2) +{ + // Compare only static video parameters, excluding dynamic metadata. + struct mp_image_params a = *p1; + struct mp_image_params b = *p2; + a.repr.dovi = b.repr.dovi = NULL; + a.color.hdr = b.color.hdr = (struct pl_hdr_metadata){0}; + return mp_image_params_equal(&a, &b); +} + // Set most image parameters, but not image format or size. // Display size is used to set the PAR. void mp_image_set_attributes(struct mp_image *image, diff --git a/video/mp_image.h b/video/mp_image.h index 9658efd433..3a6130a24d 100644 --- a/video/mp_image.h +++ b/video/mp_image.h @@ -177,6 +177,8 @@ bool mp_image_crop_valid(const struct mp_image_params *p); bool mp_image_params_valid(const struct mp_image_params *p); bool mp_image_params_equal(const struct mp_image_params *p1, const struct mp_image_params *p2); +bool mp_image_params_static_equal(const struct mp_image_params *p1, + const struct mp_image_params *p2); void mp_image_params_get_dsize(const struct mp_image_params *p, int *d_w, int *d_h); diff --git a/video/out/gpu/video.c b/video/out/gpu/video.c index 1de9ae8cd5..fe6ec1cdde 100644 --- a/video/out/gpu/video.c +++ b/video/out/gpu/video.c @@ -3193,7 +3193,7 @@ static void gl_video_interpolate_frame(struct gl_video *p, struct vo_frame *t, struct mp_image *f = t->frames[i]; uint64_t f_id = t->frame_id + i; - if (!mp_image_params_equal(&f->params, &p->real_image_params)) + if (!mp_image_params_static_equal(&f->params, &p->real_image_params)) continue; if (f_id > p->surfaces[p->surface_idx].id) { @@ -4016,7 +4016,7 @@ void gl_video_config(struct gl_video *p, struct mp_image_params *params) unmap_overlay(p); unref_current_image(p); - if (!mp_image_params_equal(&p->real_image_params, params)) { + if (!mp_image_params_static_equal(&p->real_image_params, params)) { uninit_video(p); p->real_image_params = *params; p->image_params = *params; diff --git a/video/out/vo_gpu_next.c b/video/out/vo_gpu_next.c index 8fb24c39b1..0139cfd3e1 100644 --- a/video/out/vo_gpu_next.c +++ b/video/out/vo_gpu_next.c @@ -494,7 +494,11 @@ static bool hwdec_reconfig(struct priv *p, struct ra_hwdec *hwdec, const struct mp_image_params *par) { if (p->hwdec_mapper) { - if (mp_image_params_equal(par, &p->hwdec_mapper->src_params)) { + if (mp_image_params_static_equal(par, &p->hwdec_mapper->src_params)) { + p->hwdec_mapper->src_params.repr.dovi = par->repr.dovi; + p->hwdec_mapper->dst_params.repr.dovi = par->repr.dovi; + p->hwdec_mapper->src_params.color.hdr = par->color.hdr; + p->hwdec_mapper->dst_params.color.hdr = par->color.hdr; return p->hwdec_mapper; } else { ra_hwdec_mapper_free(&p->hwdec_mapper); diff --git a/video/vdpau_mixer.c b/video/vdpau_mixer.c index 5adb3b4ec3..e062dcc06c 100644 --- a/video/vdpau_mixer.c +++ b/video/vdpau_mixer.c @@ -277,7 +277,7 @@ int mp_vdpau_mixer_render(struct mp_vdpau_mixer *mixer, CHECK_VDP_ERROR(mixer, "Error when calling vdp_video_surface_get_parameters"); if (!mixer->initialized || !opts_equal(opts, &mixer->opts) || - !mp_image_params_equal(&video->params, &mixer->image_params) || + !mp_image_params_static_equal(&video->params, &mixer->image_params) || mixer->current_w != s_w || mixer->current_h != s_h || mixer->current_chroma_type != s_chroma_type) { |