1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-25 00:02:13 +00:00

mp_image: forward AV_FRAME_DATA_DOVI_RPU_BUFFER side data

When available, and ignored if `vf=format:dolbyvision=no`.
This commit is contained in:
quietvoid 2023-02-13 21:04:04 -05:00 committed by Niklas Haas
parent 2955a0759c
commit 0d82afbc7f
3 changed files with 13 additions and 1 deletions

View File

@ -154,8 +154,10 @@ static void vf_format_process(struct mp_filter *f)
mp_image_params_guess_csp(&img->params);
}
if (!priv->opts->dovi)
if (!priv->opts->dovi) {
av_buffer_unref(&img->dovi);
av_buffer_unref(&img->dovi_buf);
}
if (!priv->opts->film_grain)
av_buffer_unref(&img->film_grain);

View File

@ -210,6 +210,7 @@ static void mp_image_destructor(void *ptr)
av_buffer_unref(&mpi->a53_cc);
av_buffer_unref(&mpi->dovi);
av_buffer_unref(&mpi->film_grain);
av_buffer_unref(&mpi->dovi_buf);
for (int n = 0; n < mpi->num_ff_side_data; n++)
av_buffer_unref(&mpi->ff_side_data[n].buf);
talloc_free(mpi->ff_side_data);
@ -346,6 +347,7 @@ struct mp_image *mp_image_new_ref(struct mp_image *img)
ref_buffer(&ok, &new->a53_cc);
ref_buffer(&ok, &new->dovi);
ref_buffer(&ok, &new->film_grain);
ref_buffer(&ok, &new->dovi_buf);
new->ff_side_data = talloc_memdup(NULL, new->ff_side_data,
new->num_ff_side_data * sizeof(new->ff_side_data[0]));
@ -389,6 +391,7 @@ struct mp_image *mp_image_new_dummy_ref(struct mp_image *img)
new->a53_cc = NULL;
new->dovi = NULL;
new->film_grain = NULL;
new->dovi_buf = NULL;
new->num_ff_side_data = 0;
new->ff_side_data = NULL;
return new;
@ -539,6 +542,7 @@ void mp_image_copy_attributes(struct mp_image *dst, struct mp_image *src)
}
assign_bufref(&dst->icc_profile, src->icc_profile);
assign_bufref(&dst->dovi, src->dovi);
assign_bufref(&dst->dovi_buf, src->dovi_buf);
assign_bufref(&dst->film_grain, src->film_grain);
assign_bufref(&dst->a53_cc, src->a53_cc);
}
@ -1024,6 +1028,10 @@ struct mp_image *mp_image_from_av_frame(struct AVFrame *src)
if (rpu->disable_residual_flag)
dst->dovi = sd->buf;
}
sd = av_frame_get_side_data(src, AV_FRAME_DATA_DOVI_RPU_BUFFER);
if (sd)
dst->dovi_buf = sd->buf;
#endif
sd = av_frame_get_side_data(src, AV_FRAME_DATA_FILM_GRAIN_PARAMS);

View File

@ -112,6 +112,8 @@ typedef struct mp_image {
struct AVBufferRef *dovi;
// Film grain data, if any
struct AVBufferRef *film_grain;
// Dolby Vision RPU buffer, if any
struct AVBufferRef *dovi_buf;
// Other side data we don't care about.
struct mp_ff_side_data *ff_side_data;
int num_ff_side_data;