On Tue, Jun 28, 2022 at 11:38 PM Soft Works <softwo...@hotmail.com> wrote: > > Hi, > > in colorspace.c, there are two functions with contradicting behavior > regarding reading/writing the max_luminance value from/to > AVMasteringDisplayMetadata. The code seems to be unchanged since > 3 years: > > > 1. ff_determine_signal_peak() > > sd = av_frame_get_side_data(in, AV_FRAME_DATA_MASTERING_DISPLAY_METADATA); > if (!peak && sd) { > AVMasteringDisplayMetadata *metadata = (AVMasteringDisplayMetadata > *)sd->data; > if (metadata->has_luminance) > peak = av_q2d(metadata->max_luminance) / REFERENCE_WHITE; > } > > > 2. ff_update_hdr_metadata() > > sd = av_frame_get_side_data(in, AV_FRAME_DATA_MASTERING_DISPLAY_METADATA); > if (sd) { > AVMasteringDisplayMetadata *metadata = (AVMasteringDisplayMetadata > *)sd->data; > if (metadata->has_luminance) > metadata->max_luminance = av_d2q(peak * REFERENCE_WHITE, 10000); > } > > > The latter function writes the value as an AVRational with a denominator of > 10000, but the former function doesn't multiply the value by 10000. >
These two calls round-trip just fine. The 10000 is not a forced denominator, divisor, or multiplier, it is the maximum denominator it is allowed to use to convert the floating point value to a rational. av_d2q will ensure the value is properly scaled. - Hendrik _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".