You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
avfilter/formats: Don't unnecessarily reget pixfmt descriptor
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@@ -113,9 +113,9 @@ static int merge_formats_internal(AVFilterFormats *a, AVFilterFormats *b,
|
|||||||
To avoid that, pretend that there are no common formats to force the
|
To avoid that, pretend that there are no common formats to force the
|
||||||
insertion of a conversion filter. */
|
insertion of a conversion filter. */
|
||||||
if (type == AVMEDIA_TYPE_VIDEO)
|
if (type == AVMEDIA_TYPE_VIDEO)
|
||||||
for (i = 0; i < a->nb_formats; i++)
|
for (i = 0; i < a->nb_formats; i++) {
|
||||||
|
const AVPixFmtDescriptor *const adesc = av_pix_fmt_desc_get(a->formats[i]);
|
||||||
for (j = 0; j < b->nb_formats; j++) {
|
for (j = 0; j < b->nb_formats; j++) {
|
||||||
const AVPixFmtDescriptor *adesc = av_pix_fmt_desc_get(a->formats[i]);
|
|
||||||
const AVPixFmtDescriptor *bdesc = av_pix_fmt_desc_get(b->formats[j]);
|
const AVPixFmtDescriptor *bdesc = av_pix_fmt_desc_get(b->formats[j]);
|
||||||
alpha2 |= adesc->flags & bdesc->flags & AV_PIX_FMT_FLAG_ALPHA;
|
alpha2 |= adesc->flags & bdesc->flags & AV_PIX_FMT_FLAG_ALPHA;
|
||||||
chroma2|= adesc->nb_components > 1 && bdesc->nb_components > 1;
|
chroma2|= adesc->nb_components > 1 && bdesc->nb_components > 1;
|
||||||
@@ -124,6 +124,7 @@ static int merge_formats_internal(AVFilterFormats *a, AVFilterFormats *b,
|
|||||||
chroma1|= adesc->nb_components > 1;
|
chroma1|= adesc->nb_components > 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If chroma or alpha can be lost through merging then do not merge
|
// If chroma or alpha can be lost through merging then do not merge
|
||||||
if (alpha2 > alpha1 || chroma2 > chroma1)
|
if (alpha2 > alpha1 || chroma2 > chroma1)
|
||||||
|
Reference in New Issue
Block a user