1 --- a/libavfilter/formats.c
2 +++ b/libavfilter/formats.c
4 possibly causing a lossy conversion elsewhere in the graph.
5 To avoid that, pretend that there are no common formats to force the
6 insertion of a conversion filter. */
7 - if (type == AVMEDIA_TYPE_VIDEO)
8 + if (type == AVMEDIA_TYPE_VIDEO) {
9 for (i = 0; i < a->nb_formats; i++) {
10 const AVPixFmtDescriptor *const adesc = av_pix_fmt_desc_get(a->formats[i]);
11 + if( !adesc ) continue;
12 for (j = 0; j < b->nb_formats; j++) {
13 const AVPixFmtDescriptor *bdesc = av_pix_fmt_desc_get(b->formats[j]);
14 + if( !bdesc ) continue;
15 alpha2 |= adesc->flags & bdesc->flags & AV_PIX_FMT_FLAG_ALPHA;
16 chroma2|= adesc->nb_components > 1 && bdesc->nb_components > 1;
17 if (a->formats[i] == b->formats[j]) {
24 // If chroma or alpha can be lost through merging then do not merge
25 if (alpha2 > alpha1 || chroma2 > chroma1)