mirror of
https://github.com/libretro/RetroArch
synced 2025-01-31 06:32:48 +00:00
(video_driver/HDR) Remove unused helper functiosn
This commit is contained in:
parent
ca164d1b0f
commit
cff5ea2a9b
@ -1733,121 +1733,6 @@ void video_driver_set_filtering(unsigned index,
|
||||
index, smooth, ctx_scaling);
|
||||
}
|
||||
|
||||
void video_driver_set_hdr_max_nits(float max_nits)
|
||||
{
|
||||
video_driver_state_t *video_st = &video_driver_st;
|
||||
if ( video_st->poke
|
||||
&& video_st->poke->set_hdr_max_nits)
|
||||
video_st->poke->set_hdr_max_nits(video_st->data, max_nits);
|
||||
}
|
||||
|
||||
void video_driver_set_hdr_paper_white_nits(float paper_white_nits)
|
||||
{
|
||||
video_driver_state_t *video_st = &video_driver_st;
|
||||
if ( video_st->poke
|
||||
&& video_st->poke->set_hdr_paper_white_nits)
|
||||
video_st->poke->set_hdr_paper_white_nits(video_st->data, paper_white_nits);
|
||||
}
|
||||
|
||||
void video_driver_set_hdr_contrast(float contrast)
|
||||
{
|
||||
video_driver_state_t *video_st = &video_driver_st;
|
||||
if ( video_st->poke
|
||||
&& video_st->poke->set_hdr_contrast)
|
||||
video_st->poke->set_hdr_contrast(video_st->data,
|
||||
VIDEO_HDR_MAX_CONTRAST - contrast);
|
||||
}
|
||||
|
||||
void video_driver_set_hdr_expand_gamut(bool expand_gamut)
|
||||
{
|
||||
video_driver_state_t *video_st = &video_driver_st;
|
||||
if ( video_st->poke
|
||||
&& video_st->poke->set_hdr_expand_gamut)
|
||||
video_st->poke->set_hdr_expand_gamut(video_st->data, expand_gamut);
|
||||
}
|
||||
|
||||
/* Use this value as a replacement for anywhere
|
||||
* where a pure white colour value is used in the UI.
|
||||
*
|
||||
* When HDR is turned on 1,1,1,1 should never really
|
||||
* be used as this is peak brightness and could cause
|
||||
* damage to displays over long periods of time
|
||||
* and be quite hard to look at on really bright displays.
|
||||
*
|
||||
* Use paper white instead which is always defined as
|
||||
* 0.5, 0.5, 0.5, 1.0 or in other words is the top of
|
||||
* the old SDR (Standard Dynamic Range) range
|
||||
*/
|
||||
unsigned video_driver_get_hdr_paper_white(void)
|
||||
{
|
||||
/* 0.5, 0.5, 0.5, 1 */
|
||||
if ( video_driver_supports_hdr()
|
||||
&& config_get_ptr()->bools.video_hdr_enable)
|
||||
return 0x7f7f7fff;
|
||||
return 0xffffffff;
|
||||
}
|
||||
|
||||
/* Same as above but returns the white value in floats */
|
||||
float *video_driver_get_hdr_paper_white_float(void)
|
||||
{
|
||||
static float paper_white[4] = { 0.5f, 0.5f, 0.5f, 1.0f};
|
||||
static float sdr_white [4] = { 1.0f, 1.0f, 1.0f, 1.0f};
|
||||
if ( video_driver_supports_hdr()
|
||||
&& config_get_ptr()->bools.video_hdr_enable)
|
||||
return paper_white;
|
||||
return sdr_white;
|
||||
}
|
||||
|
||||
/* This is useful to create a HDR (High Dynamic Range) white
|
||||
* based off of some passed in nit level - say you want a
|
||||
* slightly brighter than paper white value for some parts
|
||||
* of the UI
|
||||
*/
|
||||
float video_driver_get_hdr_luminance(float nits)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
if (video_driver_supports_hdr() && settings->bools.video_hdr_enable)
|
||||
{
|
||||
float luminance = nits /
|
||||
settings->floats.video_hdr_paper_white_nits;
|
||||
return luminance / (1.0f + luminance);
|
||||
}
|
||||
return nits;
|
||||
}
|
||||
|
||||
/* Get reinhard tone mapped colour value for UI elements
|
||||
* when using HDR and its inverse tonemapper - normally don't use
|
||||
* but useful if you want a specific colour to look the same
|
||||
* after inverse tonemapping has been applied */
|
||||
unsigned video_driver_get_hdr_color(unsigned color)
|
||||
{
|
||||
if ( video_driver_supports_hdr()
|
||||
&& config_get_ptr()->bools.video_hdr_enable)
|
||||
{
|
||||
float luminance;
|
||||
float rgb[3];
|
||||
float yxy[3];
|
||||
|
||||
rgb[0] = (float)((color >> 24) & 0xFF) / 255.0f;
|
||||
rgb[1] = (float)((color >> 16) & 0xFF) / 255.0f;
|
||||
rgb[2] = (float)((color >> 8 ) & 0xFF) / 255.0f;
|
||||
|
||||
convert_rgb_to_yxy(rgb, yxy);
|
||||
|
||||
/* TODO: We should probably scale this by average luminance */
|
||||
luminance = yxy[0];
|
||||
yxy[0] = luminance / (1.0f + luminance);
|
||||
|
||||
convert_yxy_to_rgb(rgb, yxy);
|
||||
|
||||
return ( (unsigned)(saturate_value(rgb[0]) * 255.0f) << 24)
|
||||
| ((unsigned)(saturate_value(rgb[1]) * 255.0f) << 16)
|
||||
| ((unsigned)(saturate_value(rgb[2]) * 255.0f) << 8)
|
||||
| (color & 0xFF);
|
||||
}
|
||||
return color;
|
||||
}
|
||||
|
||||
void video_driver_cached_frame_set(const void *data, unsigned width,
|
||||
unsigned height, size_t pitch)
|
||||
{
|
||||
|
@ -930,14 +930,6 @@ void video_driver_unset_hdr_support(void);
|
||||
|
||||
bool video_driver_supports_hdr(void);
|
||||
|
||||
unsigned video_driver_get_hdr_color(unsigned color);
|
||||
|
||||
float video_driver_get_hdr_luminance(float nits);
|
||||
|
||||
unsigned video_driver_get_hdr_paper_white(void);
|
||||
|
||||
float* video_driver_get_hdr_paper_white_float(void);
|
||||
|
||||
bool video_driver_get_next_video_out(void);
|
||||
|
||||
bool video_driver_get_prev_video_out(void);
|
||||
@ -1006,11 +998,6 @@ void * video_driver_read_frame_raw(unsigned *width,
|
||||
|
||||
void video_driver_set_filtering(unsigned index, bool smooth, bool ctx_scaling);
|
||||
|
||||
void video_driver_set_hdr_max_nits(float max_nits);
|
||||
void video_driver_set_hdr_paper_white_nits(float paper_white_nits);
|
||||
void video_driver_set_hdr_contrast(float contrast);
|
||||
void video_driver_set_hdr_expand_gamut(bool expand_gamut);
|
||||
|
||||
const char *video_driver_get_ident(void);
|
||||
|
||||
void video_driver_set_viewport(unsigned width, unsigned height,
|
||||
|
@ -8106,37 +8106,46 @@ static void general_write_handler(rarch_setting_t *setting)
|
||||
case MENU_ENUM_LABEL_VIDEO_HDR_MAX_NITS:
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
video_driver_state_t *video_st = video_state_get_ptr();
|
||||
settings->modified = true;
|
||||
settings->floats.video_hdr_max_nits = roundf(*setting->value.target.fraction);
|
||||
|
||||
video_driver_set_hdr_max_nits(settings->floats.video_hdr_max_nits);
|
||||
if (video_st && video_st->poke && video_st->poke->set_hdr_max_nits)
|
||||
video_st->poke->set_hdr_max_nits(video_st->data, settings->floats.video_hdr_max_nits);
|
||||
}
|
||||
break;
|
||||
case MENU_ENUM_LABEL_VIDEO_HDR_PAPER_WHITE_NITS:
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
video_driver_state_t *video_st = video_state_get_ptr();
|
||||
settings->modified = true;
|
||||
settings->floats.video_hdr_paper_white_nits = roundf(*setting->value.target.fraction);
|
||||
|
||||
video_driver_set_hdr_paper_white_nits(settings->floats.video_hdr_paper_white_nits);
|
||||
|
||||
if (video_st && video_st->poke && video_st->poke->set_hdr_paper_white_nits)
|
||||
video_st->poke->set_hdr_paper_white_nits(video_st->data, settings->floats.video_hdr_paper_white_nits);
|
||||
}
|
||||
break;
|
||||
case MENU_ENUM_LABEL_VIDEO_HDR_CONTRAST:
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
video_driver_state_t *video_st = video_state_get_ptr();
|
||||
settings->modified = true;
|
||||
settings->floats.video_hdr_display_contrast = *setting->value.target.fraction;
|
||||
|
||||
video_driver_set_hdr_contrast(settings->floats.video_hdr_display_contrast);
|
||||
if (video_st && video_st->poke && video_st->poke->set_hdr_contrast)
|
||||
video_st->poke->set_hdr_contrast(video_st->data, VIDEO_HDR_MAX_CONTRAST - settings->floats.video_hdr_display_contrast);
|
||||
}
|
||||
break;
|
||||
case MENU_ENUM_LABEL_VIDEO_HDR_EXPAND_GAMUT:
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
video_driver_state_t *video_st = video_state_get_ptr();
|
||||
settings->modified = true;
|
||||
settings->bools.video_hdr_expand_gamut = *setting->value.target.boolean;
|
||||
|
||||
video_driver_set_hdr_expand_gamut(settings->bools.video_hdr_expand_gamut);
|
||||
if (video_st && video_st->poke && video_st->poke->set_hdr_expand_gamut)
|
||||
video_st->poke->set_hdr_expand_gamut(video_st->data, settings->bools.video_hdr_expand_gamut);
|
||||
}
|
||||
break;
|
||||
case MENU_ENUM_LABEL_INPUT_MAX_USERS:
|
||||
|
Loading…
x
Reference in New Issue
Block a user