-
-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
util/libav: do not bail on MEL-only RPUs w/EL #286
base: master
Are you sure you want to change the base?
Conversation
We can still map DV metadata that indicates enhancement layer usage (!disable_residual_flag, Profile 7 and 4) for MEL-only bitstreams, which is indicated by trivial NLQ parameters.
diff --git a/src/include/libplacebo/utils/libav_internal.h b/src/include/libplacebo/utils/libav_internal.h
index a754e98b..928d37f6 100644
--- a/src/include/libplacebo/utils/libav_internal.h
+++ b/src/include/libplacebo/utils/libav_internal.h
@@ -925,14 +925,14 @@ 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
+ 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
}
PL_LIBAV_API void pl_frame_map_avdovi_metadata(struct pl_frame *out_frame, which makes it awkward with |
// Helper function to check if Dolby Vision metadata can be mapped. | ||
// Returns true if the `AVDOVIRpuDataHeader` `disable_residual_flag` field is | ||
// not zero or if the NLQ parameters are trivial. | ||
PL_LIBAV_API bool pl_can_map_avdovi_metadata(const AVDOVIMetadata *metadata); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pl_map_avdovi_metadata
could map more metadata, but without pl_dovi_metadata
use. This could be pl_is_dovi_metadata_needed
or something and pl_map_avdovi_metadata
could take NULL if the former function returns false. This would allow to still make RPU values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pl_map_avdovi_metadata could take NULL if the former function returns false. This would allow to still make RPU values.
Sorry, I don't follow — how? If we're talking about that av_dovi_find_level()
block from your diff above, it still needs the AVDOVIMetadata *
, no? Or are we talking about some hypothetical yet-unwritten code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pl_map_avdovi_metadata(&color, &repr, NULL, &metadata);
I'm talking about output parameter, when we decide not to use pl_dovi_metadata
, but still populate max_pq
and avg_pq
. This is how pl_map_avframe_ex()
works.
We can still map DV metadata that indicates enhancement layer usage (!disable_residual_flag, Profile 7 and 4) for MEL-only bitstreams, which is indicated by trivial NLQ parameters.