From 30ca30c0a16a7ee034d9e05280ba221427d48ba1 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 21 Jan 2015 18:33:47 +0100 Subject: vf_scale: replace ancient fallback image format selection If video output and VO don't support the same format, a conversion filter needs to be insert. Since a VO can support multiple formats, and the filter chain also can deal with multiple formats, you basically have to pick from a huge matrix of possible conversions. The old MPlayer code had a quite naive algorithm: it first checked whether any conversion from the list of preferred conversions matched, and if not, it was falling back on checking a hardcoded list of output formats (more or less sorted by quality). This had some unintended side- effects, like not using obvious "replacement" formats, selecting the wrong colorspace, selecting a bit depth that is too high or too low, and more. Use avcodec_find_best_pix_fmt_of_list() provided by FFmpeg instead. This function was made for this purpose, and should select the "best" format. Libav provides a similar function, but with a different name - there is a function with the same name in FFmpeg, but it has different semantics (I'm not sure if Libav or FFmpeg fucked up here). This also removes handling of VFCAP_CSP_SUPPORTED vs. VFCAP_CSP_SUPPORTED_BY_HW, which has no meaning anymore, except possibly for filter chains with multiple scale filters. Fixes #1494. --- video/img_format.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'video/img_format.h') diff --git a/video/img_format.h b/video/img_format.h index d9da81f2f9..b93e0fe974 100644 --- a/video/img_format.h +++ b/video/img_format.h @@ -239,4 +239,6 @@ char **mp_imgfmt_name_list(void); int mp_imgfmt_find_yuv_planar(int xs, int ys, int planes, int component_bits); +int mp_imgfmt_select_best(int dst1, int dst2, int src); + #endif /* MPLAYER_IMG_FORMAT_H */ -- cgit v1.2.3