LibVideo: Set CodingIndependentCodePoints in its member functions

This moves the setting of code points in CICP structs to member
functions completely so that the code having to set these code points
can be much cleaner.
This commit is contained in:
Zaggy1024 2022-10-29 17:39:45 -05:00 committed by Andreas Kling
commit 3720f66bb1
Notes: sideshowbarker 2024-07-17 05:02:35 +09:00
3 changed files with 42 additions and 27 deletions

View file

@ -4,6 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "LibVideo/Color/CodingIndependentCodePoints.h"
#include <LibCore/ArgsParser.h>
#include <LibCore/ElapsedTimer.h>
#include <LibGUI/Application.h>
@ -90,8 +91,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto frame = frame_result.release_value();
auto& cicp = frame->cicp();
video_track.color_format.replace_code_points_if_specified(cicp);
cicp.default_code_points_if_unspecified(Video::ColorPrimaries::BT709, Video::TransferCharacteristics::BT709, Video::MatrixCoefficients::BT709);
cicp.adopt_specified_values(video_track.color_format.to_cicp());
cicp.default_code_points_if_unspecified({ Video::ColorPrimaries::BT709, Video::TransferCharacteristics::BT709, Video::MatrixCoefficients::BT709, Video::ColorRange::Studio });
auto convert_result = frame->output_to_bitmap(image);
if (convert_result.is_error()) {