libobs: Fix full range min/max output

The minimum and maximum color range values were not being set by the
video_format_get_parameters function when full range was in use; I
assume it's because the expected min/max values of full range is
{0.0, 0.0, 0.0} and {1.0, 1.0, 1.0}, so I'm just making it so that it
sets those values if using full range.

Way to replicate the issue (windows):
1.) Create a win-dshow device capture source
2.) Select a device and set it to a YUV color format to enable YUV color
conversion
3.) Select "Full Range" in the color range property.
4.) Restart OBS, the device will then start up, but will display green
due to the fact that the min/max range values were never set, and are
left at their default value of 0.
This commit is contained in:
jp9000 2015-04-09 10:14:51 -07:00
parent 095159c23a
commit 4e54c89f9c

View file

@ -174,6 +174,9 @@ static void initialize_matrices()
static bool matrices_initialized = false;
#endif
static const float full_min[3] = {0.0f, 0.0f, 0.0f};
static const float full_max[3] = {1.0f, 1.0f, 1.0f};
bool video_format_get_parameters(enum video_colorspace color_space,
enum video_range_type range, float matrix[16],
float range_min[3], float range_max[3])
@ -195,8 +198,13 @@ bool video_format_get_parameters(enum video_colorspace color_space,
memcpy(matrix, format_info[i].matrix[full_range],
sizeof(float) * 16);
if (range == VIDEO_RANGE_FULL)
if (range == VIDEO_RANGE_FULL) {
if (range_min)
memcpy(range_min, full_min, sizeof(float) * 3);
if (range_max)
memcpy(range_max, full_max, sizeof(float) * 3);
return true;
}
if (range_min)
memcpy(range_min, format_info[i].float_range_min,