Skip to content

Commit

Permalink
utils/libav: read dovi L1 metadata in pl_map_avdovi_metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
kasper93 authored and haasn committed May 23, 2024
1 parent 2052ae5 commit 9e1257c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/include/libplacebo/utils/libav_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,9 @@ PL_LIBAV_API void pl_map_avdovi_metadata(struct pl_color_space *color,
{
const AVDOVIRpuDataHeader *header;
const AVDOVIColorMetadata *dovi_color;
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(59, 12, 100)
const AVDOVIDmData *dovi_ext;
#endif
if (!color || !repr || !dovi)
return;

Expand All @@ -909,6 +912,13 @@ PL_LIBAV_API void pl_map_avdovi_metadata(struct pl_color_space *color,
pl_hdr_rescale(PL_HDR_PQ, PL_HDR_NITS, dovi_color->source_min_pq / 4095.0f);
color->hdr.max_luma =
pl_hdr_rescale(PL_HDR_PQ, PL_HDR_NITS, dovi_color->source_max_pq / 4095.0f);

#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(59, 12, 100)
if ((dovi_ext = av_dovi_find_level(metadata, 1))) {
color->hdr.max_pq_y = dovi_ext->l1.max_pq / 4095.0f;
color->hdr.avg_pq_y = dovi_ext->l1.avg_pq / 4095.0f;
}
#endif
}
}

Expand Down

0 comments on commit 9e1257c

Please sign in to comment.