diff options
Diffstat (limited to 'video')
-rw-r--r-- | video/csputils.c | 16 | ||||
-rw-r--r-- | video/csputils.h | 3 | ||||
-rw-r--r-- | video/decode/dec_video.c | 1 |
3 files changed, 20 insertions, 0 deletions
diff --git a/video/csputils.c b/video/csputils.c index 0c2e847186..8f6a9e351e 100644 --- a/video/csputils.c +++ b/video/csputils.c @@ -100,6 +100,22 @@ const struct m_opt_choice_alternatives mp_chroma_names[] = { {0} }; +void mp_colorspace_merge(struct mp_colorspace *orig, struct mp_colorspace *new) +{ + if (!orig->space) + orig->space = new->space; + if (!orig->levels) + orig->levels = new->levels; + if (!orig->primaries) + orig->primaries = new->primaries; + if (!orig->gamma) + orig->gamma = new->gamma; + if (!orig->nom_peak) + orig->nom_peak = new->nom_peak; + if (!orig->sig_peak) + orig->sig_peak = new->sig_peak; +} + // The short name _must_ match with what vf_stereo3d accepts (if supported). // The long name in comments is closer to the Matroska spec (StereoMode element). // The numeric index matches the Matroska StereoMode value. If you add entries diff --git a/video/csputils.h b/video/csputils.h index 0406ddf35f..9eaafbe75d 100644 --- a/video/csputils.h +++ b/video/csputils.h @@ -125,6 +125,9 @@ struct mp_colorspace { float sig_peak; // signal peak, highest value that occurs in the source }; +// Replaces unknown values in the first struct by those of the second struct +void mp_colorspace_merge(struct mp_colorspace *orig, struct mp_colorspace *new); + struct mp_csp_params { struct mp_colorspace color; // input colorspace enum mp_csp_levels levels_out; // output device diff --git a/video/decode/dec_video.c b/video/decode/dec_video.c index 7e144a72bc..0dc51943bc 100644 --- a/video/decode/dec_video.c +++ b/video/decode/dec_video.c @@ -245,6 +245,7 @@ static void fix_image_params(struct dec_video *d_video, p.stereo_out = opts->video_stereo_mode; // Detect colorspace from resolution. + mp_colorspace_merge(&p.color, &c->color); mp_image_params_guess_csp(&p); d_video->last_format = *params; |