Commit d3c6ad0b authored by Laurent Aimar's avatar Laurent Aimar

Do not load a filter for J4xy -> I4xy in vout_display.

 It's not perfect, as they do not have the same dynamic, but it costs a lot
of CPU for something not that visible.
 If an option is wanted, it is easy to add.
parent fad6ff80
......@@ -364,10 +364,19 @@ static void VoutDisplayCreateRender(vout_display_t *vd)
v_dst.i_sar_num = 0;
v_dst.i_sar_den = 0;
const bool convert = memcmp(&v_src, &v_dst, sizeof(v_src)) != 0;
video_format_t v_dst_cmp = v_dst;
if ((v_src.i_chroma == VLC_CODEC_J420 && v_dst.i_chroma == VLC_CODEC_I420) ||
(v_src.i_chroma == VLC_CODEC_J422 && v_dst.i_chroma == VLC_CODEC_I422) ||
(v_src.i_chroma == VLC_CODEC_J440 && v_dst.i_chroma == VLC_CODEC_I440) ||
(v_src.i_chroma == VLC_CODEC_J444 && v_dst.i_chroma == VLC_CODEC_I444))
v_dst_cmp.i_chroma = v_src.i_chroma;
const bool convert = memcmp(&v_src, &v_dst_cmp, sizeof(v_src)) != 0;
if (!convert)
return;
msg_Err(vd, "A filter to adapt decoder to display is needed");
osys->filters = filter_chain_New(vd, "video filter2", false,
FilterAllocationInit,
FilterAllocationClean, NULL);
......@@ -379,13 +388,18 @@ static void VoutDisplayCreateRender(vout_display_t *vd)
/* */
es_format_t dst;
es_format_InitFromVideo(&dst, &v_dst);
filter_chain_Reset(osys->filters, &src, &dst);
filter_t *filter;
for (int i = 0; i < 1 + (v_dst_cmp.i_chroma != v_dst.i_chroma); i++) {
msg_Err(vd, "A filter to adapt decoder to display is needed");
filter_t *filter = filter_chain_AppendFilter(osys->filters,
NULL, NULL, &src, &dst);
es_format_InitFromVideo(&dst, i == 0 ? &v_dst : &v_dst_cmp);
filter_chain_Reset(osys->filters, &src, &dst);
filter = filter_chain_AppendFilter(osys->filters,
NULL, NULL, &src, &dst);
if (filter)
break;
}
if (!filter)
{
msg_Err(vd, "VoutDisplayCreateRender FAILED");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment