diff --git a/Userland/Libraries/LibVideo/Color/ColorConverter.cpp b/Userland/Libraries/LibVideo/Color/ColorConverter.cpp index 4a80b014d8..2026c040d6 100644 --- a/Userland/Libraries/LibVideo/Color/ColorConverter.cpp +++ b/Userland/Libraries/LibVideo/Color/ColorConverter.cpp @@ -165,21 +165,6 @@ DecoderErrorOr ColorConverter::create(u8 bit_depth, CodingIndepe // should apply tonemapping as well. // Use a lookup table as with step 3. TransferCharacteristics output_tc = TransferCharacteristics::SRGB; - switch (cicp.transfer_characteristics()) { - case TransferCharacteristics::Unspecified: - break; - case TransferCharacteristics::BT709: - case TransferCharacteristics::BT601: - case TransferCharacteristics::BT2020BitDepth10: - case TransferCharacteristics::BT2020BitDepth12: - // BT.601, BT.709 and BT.2020 have a similar transfer function to sRGB, and other applications - // (Chromium, VLC) seem to keep video output in those transfer characteristics. - output_tc = TransferCharacteristics::BT709; - break; - default: - break; - } - auto to_non_linear_lookup_table = InterpolatedLookupTable::create( [&](float value) { return TransferCharacteristicsConversion::to_non_linear_luminance(value, output_tc); diff --git a/Userland/Libraries/LibVideo/PlaybackManager.cpp b/Userland/Libraries/LibVideo/PlaybackManager.cpp index 244c66e6c3..7d6ca6adc0 100644 --- a/Userland/Libraries/LibVideo/PlaybackManager.cpp +++ b/Userland/Libraries/LibVideo/PlaybackManager.cpp @@ -221,7 +221,22 @@ bool PlaybackManager::decode_and_queue_one_sample() auto& cicp = decoded_frame->cicp(); cicp.adopt_specified_values(frame_sample->container_cicp()); - cicp.default_code_points_if_unspecified({ Video::ColorPrimaries::BT709, Video::TransferCharacteristics::BT709, Video::MatrixCoefficients::BT709, Video::ColorRange::Studio }); + cicp.default_code_points_if_unspecified({ ColorPrimaries::BT709, TransferCharacteristics::BT709, MatrixCoefficients::BT709, ColorRange::Studio }); + + // BT.601, BT.709 and BT.2020 have a similar transfer function to sRGB, so other applications + // (Chromium, VLC) forgo transfer characteristics conversion. We will emulate that behavior by + // handling those as sRGB instead, which causes no transfer function change in the output, + // unless display color management is later implemented. + switch (cicp.transfer_characteristics()) { + case TransferCharacteristics::BT601: + case TransferCharacteristics::BT709: + case TransferCharacteristics::BT2020BitDepth10: + case TransferCharacteristics::BT2020BitDepth12: + cicp.set_transfer_characteristics(TransferCharacteristics::SRGB); + break; + default: + break; + } auto bitmap = TRY_OR_ENQUEUE_ERROR(decoded_frame->to_bitmap()); m_frame_queue->enqueue(FrameQueueItem::frame(bitmap, frame_sample->timestamp()));