Skip to content

Commit

Permalink
Added HDR data to Media Info Panel.
Browse files Browse the repository at this point in the history
Fixed Pixel Bar resize.
  • Loading branch information
ggarra13 committed Sep 17, 2024
1 parent 25bbfab commit b7c207f
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 56 deletions.
1 change: 1 addition & 0 deletions src/docs/HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ v1.2.8
to bring up the Files Panel.
- Made UI at start up wider to account for new menus and new language
translations.
- Added HDR metadata to Media Information Panel.


v1.2.7
Expand Down
12 changes: 12 additions & 0 deletions src/lib/mrvGL/mrvTimelineViewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ namespace mrv
{
using namespace tl;

std::string TimelineViewport::Private::hdr;
timeline::BackgroundOptions TimelineViewport::Private::backgroundOptions;
EnvironmentMapOptions TimelineViewport::Private::environmentMapOptions;
math::Box2i TimelineViewport::Private::selection =
Expand Down Expand Up @@ -3285,6 +3286,17 @@ namespace mrv
s >> p.displayOptions[0].normalize.maximum;
}
}

i = p.tagData.find("hdr");
if (i != p.tagData.end())
{
if (p.hdr != i->second)
{
p.hdr = i->second;
if (panel::imageInfoPanel)
panel::imageInfoPanel->refresh();
}
}
}

void TimelineViewport::_setVideoRotation(float value) noexcept
Expand Down
2 changes: 2 additions & 0 deletions src/lib/mrvGL/mrvTimelineViewportPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ namespace mrv
static float rotation;
static bool resizeWindow;

static std::string hdr;

timeline::OCIOOptions ocioOptions;
timeline::LUTOptions lutOptions;
std::vector<tl::timeline::ImageOptions> imageOptions;
Expand Down
51 changes: 49 additions & 2 deletions src/lib/mrvPanels/mrvImageInfoPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include <regex>
namespace fs = std::filesystem;

#include <tlCore/HDR.h>

#include <FL/Fl_Pack.H>
#include <FL/Fl_Flex.H>
#include <FL/Fl_Int_Input.H>
Expand Down Expand Up @@ -1540,6 +1542,8 @@ namespace mrv
widget->align(FL_ALIGN_LEFT);
widget->color(colB);
double maxS = maxV;
if (content > 1000000 && maxV <= 1000000)
maxS = 1000000;
if (content > 100000 && maxV <= 100000)
maxS = 1000000;
else if (content > 10000 && maxV <= 10000)
Expand Down Expand Up @@ -1832,6 +1836,7 @@ namespace mrv
std::string colorTRC;
std::string colorSpace;
std::string compression;
std::string HDRdata;
if (!tagData.empty())
{
auto it = tagData.find("Video Codec");
Expand Down Expand Up @@ -1864,6 +1869,11 @@ namespace mrv
{
colorSpace = it->second;
}
it = tagData.find("hdr");
if (it != tagData.end())
{
HDRdata = it->second;
}
}
else
{
Expand Down Expand Up @@ -1983,7 +1993,43 @@ namespace mrv
_("Color Space"), _("Color Transfer Space"),
colorSpace);
}

if (!HDRdata.empty())
{
nlohmann::json json = nlohmann::json::parse(HDRdata);
image::HDRData hdr = json.get<image::HDRData>();


math::Vector2f& v = hdr.primaries[image::HDRPrimaries::Red];
snprintf(buf, 256, "(%g) (%g)", v.x, v.y);
add_text(_("HDR Red Primaries"), _("HDR Red Primaries"), buf);

v = hdr.primaries[image::HDRPrimaries::Green];
snprintf(buf, 256, "(%g) (%g)", v.x, v.y);
add_text(_("HDR Green Primaries"), _("HDR Green Primaries"), buf);

v = hdr.primaries[image::HDRPrimaries::Blue];
snprintf(buf, 256, "(%g) (%g)", v.x, v.y);
add_text(_("HDR Blue Primaries"), _("HDR Blue Primaries"), buf);

v = hdr.primaries[image::HDRPrimaries::White];
snprintf(buf, 256, "(%g) (%g)", v.x, v.y);
add_text(_("HDR White Primaries"), _("HDR White Primaries"), buf);

const math::FloatRange& luminance =
hdr.displayMasteringLuminance;
snprintf(
buf, 256, "min: %g max: %g", luminance.getMin(),
luminance.getMax());
add_text(
_("HDR Display Mastering Luminance"),
_("HDR Display Mastering Luminance"), buf);

snprintf(buf, 256, "%g", hdr.maxCLL);
add_text(_("HDR maxCLL"), _("HDR maxCLL"), buf);

snprintf(buf, 256, "%g", hdr.maxFALL);
add_text(_("HDR maxFALL"), _("HDR maxFALL"), buf);
}
++group;

std::string format;
Expand Down Expand Up @@ -2209,7 +2255,8 @@ namespace mrv
for (const auto& item : tagData)
{
bool skip = false;
if (item.first.substr(0, 5) == "Video" ||
if (item.first == "hdr" ||
item.first.substr(0, 5) == "Video" ||
item.first.substr(0, 5) == "Audio" ||
item.first.substr(0, 19) == "FFmpeg Pixel Format")
{
Expand Down
Loading

0 comments on commit b7c207f

Please sign in to comment.