color: input colorspace auto-detection, HDR export tags, LGG/white balance nodes, more LUT formats, waveform parade
- media color primaries/transfer tags now flow from the FFmpeg probe through VideoParams into Footage::get_colorspace_to_use(); precedence is user override > media tags > project default - export nclc tags derive from the output colorspace (PQ/HLG/BT.2020, P3, sRGB, Rec.601, Rec.709) instead of hardcoded BT.709 - new OCIO Color Grading (Log) node (lift/gamma/gain) and White Balance node (kelvin temperature + tint, HDR-safe) - LUT whitelist extended to 9 OCIO-supported formats - waveform scope gains an RGB parade mode (GPU and software paths) - tests updated for the new colorspace precedence
This commit is contained in:
@@ -118,3 +118,86 @@ TEST(CodecFFmpegEncoder, EncodePngVideoAndProbeBack)
|
||||
fb_probe_close(probe);
|
||||
fb_probe_free(&probe);
|
||||
}
|
||||
|
||||
TEST(CodecFFmpegEncoder, ColorTagsForColorspace)
|
||||
{
|
||||
int primaries = 0, trc = 0, matrix = 0;
|
||||
|
||||
ASSERT_TRUE(olive::FFmpegEncoder::get_color_tags_for_colorspace(
|
||||
QStringLiteral("Rec.2020 PQ"), &primaries, &trc, &matrix));
|
||||
EXPECT_EQ(primaries, fb_color_primaries_bt2020);
|
||||
EXPECT_EQ(trc, fb_color_trc_pq);
|
||||
EXPECT_EQ(matrix, fb_col_spc_b_t2020_ncl);
|
||||
|
||||
ASSERT_TRUE(olive::FFmpegEncoder::get_color_tags_for_colorspace(
|
||||
QStringLiteral("Rec.2020 HLG"), &primaries, &trc, &matrix));
|
||||
EXPECT_EQ(primaries, fb_color_primaries_bt2020);
|
||||
EXPECT_EQ(trc, fb_color_trc_hlg);
|
||||
EXPECT_EQ(matrix, fb_col_spc_b_t2020_ncl);
|
||||
|
||||
ASSERT_TRUE(olive::FFmpegEncoder::get_color_tags_for_colorspace(
|
||||
QStringLiteral("sRGB OETF"), &primaries, &trc, &matrix));
|
||||
EXPECT_EQ(primaries, fb_color_primaries_bt709);
|
||||
EXPECT_EQ(trc, fb_color_trc_srgb);
|
||||
EXPECT_EQ(matrix, fb_col_spc_b_t709);
|
||||
|
||||
ASSERT_TRUE(olive::FFmpegEncoder::get_color_tags_for_colorspace(
|
||||
QStringLiteral("Rec.709 OETF"), &primaries, &trc, &matrix));
|
||||
EXPECT_EQ(primaries, fb_color_primaries_bt709);
|
||||
EXPECT_EQ(trc, fb_color_trc_bt709);
|
||||
EXPECT_EQ(matrix, fb_col_spc_b_t709);
|
||||
|
||||
// Unknown/linear spaces must not guess tags
|
||||
EXPECT_FALSE(olive::FFmpegEncoder::get_color_tags_for_colorspace(
|
||||
QStringLiteral("Linear"), &primaries, &trc, &matrix));
|
||||
}
|
||||
|
||||
TEST(CodecFFmpegEncoder, WritesHdrColorTags)
|
||||
{
|
||||
QTemporaryDir dir;
|
||||
ASSERT_TRUE(dir.isValid());
|
||||
const QString path = dir.filePath(QStringLiteral("hdr_test.mkv"));
|
||||
|
||||
olive::EncodingParams params;
|
||||
params.set_filename(path);
|
||||
olive::VideoParams video_params(64, 64, olive::core::PixelFormat::u8,
|
||||
olive::VideoParams::k_rgba_channel_count);
|
||||
video_params.set_frame_rate(olive::core::Rational(30, 1));
|
||||
params.enable_video(video_params, olive::ExportCodec::k_codec_h264);
|
||||
params.set_video_pix_fmt(QStringLiteral("yuv420p"));
|
||||
params.set_color_transform(
|
||||
olive::ColorTransform(QStringLiteral("Rec.2020 PQ")));
|
||||
|
||||
olive::FFmpegEncoder encoder(params);
|
||||
ASSERT_TRUE(encoder.open()) << encoder.get_error().toStdString();
|
||||
|
||||
for (int f = 0; f < 3; f++) {
|
||||
olive::FramePtr frame = olive::Frame::create();
|
||||
frame->set_video_params(video_params);
|
||||
ASSERT_TRUE(frame->allocate());
|
||||
memset(frame->data(), 128, frame->allocated_size());
|
||||
ASSERT_TRUE(encoder.write_frame(frame, olive::core::Rational(f, 30)))
|
||||
<< encoder.get_error().toStdString();
|
||||
}
|
||||
encoder.close();
|
||||
|
||||
FBProbe *probe = fb_probe_create();
|
||||
ASSERT_NE(probe, nullptr);
|
||||
ASSERT_EQ(fb_probe_open(probe, path.toUtf8().constData()), 0);
|
||||
|
||||
bool found_video = false;
|
||||
const int stream_count = fb_probe_get_stream_count(probe);
|
||||
for (int i = 0; i < stream_count; i++) {
|
||||
FBStreamInfo info;
|
||||
if (fb_probe_get_stream_info(probe, i, &info) == 0 &&
|
||||
info.codec_type == fb_media_type_video) {
|
||||
found_video = true;
|
||||
EXPECT_EQ(info.color_primaries, fb_color_primaries_bt2020);
|
||||
EXPECT_EQ(info.color_trc, fb_color_trc_pq);
|
||||
}
|
||||
}
|
||||
EXPECT_TRUE(found_video);
|
||||
|
||||
fb_probe_close(probe);
|
||||
fb_probe_free(&probe);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user