9a53f7b4b0ec95eb6b6a837e1d46c78259b7f14c
[goodguy/cinelerra.git] / cinelerra-5.1 / thirdparty / src / ffmpeg-4.1.4.patch5
1 diff -u a/libavfilter/formats.c b/libavfilter/formats.c
2 --- a/libavfilter/formats.c     2018-11-02 18:17:29.000000000 -0600
3 +++ b/libavfilter/formats.c     2019-04-09 14:12:01.659501027 -0600
4 @@ -107,11 +107,13 @@
5         possibly causing a lossy conversion elsewhere in the graph.
6         To avoid that, pretend that there are no common formats to force the
7         insertion of a conversion filter. */
8 -    if (type == AVMEDIA_TYPE_VIDEO)
9 -        for (i = 0; i < a->nb_formats; i++)
10 +    if (type == AVMEDIA_TYPE_VIDEO) {
11 +        for (i = 0; i < a->nb_formats; i++) {
12 +            const AVPixFmtDescriptor *adesc = av_pix_fmt_desc_get(a->formats[i]);
13 +            if( !adesc ) continue;
14              for (j = 0; j < b->nb_formats; j++) {
15 -                const AVPixFmtDescriptor *adesc = av_pix_fmt_desc_get(a->formats[i]);
16                  const AVPixFmtDescriptor *bdesc = av_pix_fmt_desc_get(b->formats[j]);
17 +                if( !bdesc ) continue;
18                  alpha2 |= adesc->flags & bdesc->flags & AV_PIX_FMT_FLAG_ALPHA;
19                  chroma2|= adesc->nb_components > 1 && bdesc->nb_components > 1;
20                  if (a->formats[i] == b->formats[j]) {
21 @@ -119,6 +121,8 @@
22                      chroma1|= adesc->nb_components > 1;
23                  }
24              }
25 +        }
26 +    }
27  
28      // If chroma or alpha can be lost through merging then do not merge
29      if (alpha2 > alpha1 || chroma2 > chroma1)