projects
/
dcpomatic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0a599a0
)
Fix limited value ranges in properties.
author
Carl Hetherington
<cth@carlh.net>
Sun, 8 Nov 2020 22:36:58 +0000
(23:36 +0100)
committer
Carl Hetherington
<cth@carlh.net>
Mon, 16 Nov 2020 00:40:36 +0000
(
01:40
+0100)
src/lib/ffmpeg_content.cc
patch
|
blob
|
history
diff --git
a/src/lib/ffmpeg_content.cc
b/src/lib/ffmpeg_content.cc
index 1fb95535f0e74af738f262f481fc22e380d300e6..03763fc289b0135e91cb764ff736cb9591e2853f 100644
(file)
--- a/
src/lib/ffmpeg_content.cc
+++ b/
src/lib/ffmpeg_content.cc
@@
-540,8
+540,10
@@
FFmpegContent::add_properties (shared_ptr<const Film> film, list<UserProperty>&
video->add_properties (p);
if (_bits_per_pixel) {
video->add_properties (p);
if (_bits_per_pixel) {
- int const sub = 219 * pow (2, _bits_per_pixel.get() - 8);
- int const total = pow (2, _bits_per_pixel.get());
+ /* Assuming there's three components, so bits per pixel component is _bits_per_pixel / 3 */
+ int const lim_start = pow(2, _bits_per_pixel.get() / 3 - 4);
+ int const lim_end = 235 * pow(2, _bits_per_pixel.get() / 3 - 8);
+ int const total = pow(2, _bits_per_pixel.get() / 3);
switch (_color_range.get_value_or(AVCOL_RANGE_UNSPECIFIED)) {
case AVCOL_RANGE_UNSPECIFIED:
switch (_color_range.get_value_or(AVCOL_RANGE_UNSPECIFIED)) {
case AVCOL_RANGE_UNSPECIFIED:
@@
-554,7
+556,7
@@
FFmpegContent::add_properties (shared_ptr<const Film> film, list<UserProperty>&
/// file is limited, so that not all possible values are valid.
p.push_back (
UserProperty (
/// file is limited, so that not all possible values are valid.
p.push_back (
UserProperty (
- UserProperty::VIDEO, _("Colour range"), String::compose
(_("Limited (%1-%2)"), (total - sub) / 2, (total + sub) / 2
)
+ UserProperty::VIDEO, _("Colour range"), String::compose
(_("Limited (%1-%2)"), lim_start, lim_end
)
)
);
break;
)
);
break;