Skip to content

Commit ed94c7a

Browse files
committed
to_lavc_vid_conv: watch_pixfmt_degrade improved
compare just the in codec and the MIN(intermediate, out_pixfmt) to avoid missleading message `[to_lavc_vid_conv] conversion is reducing subsampling from 4444 to 4440` as eg. in: <#480> if converting R12L to bgra over RGBA - the alpha channel is present just in the intermediate but both ends have 444 without alpha channel.
1 parent f9963c4 commit ed94c7a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/libavcodec/to_lavc_vid_conv.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1620,8 +1620,16 @@ struct to_lavc_vid_conv *to_lavc_vid_conv_init(codec_t in_pixfmt, int width, int
16201620
}
16211621
verbose_msg(MOD_NAME "converting %s to %s over %s\n", get_codec_name(in_pixfmt),
16221622
av_get_pix_fmt_name(out_pixfmt), get_codec_name(s->decoded_codec));
1623-
watch_pixfmt_degrade(MOD_NAME, get_pixfmt_desc(in_pixfmt), get_pixfmt_desc(s->decoded_codec));
1624-
watch_pixfmt_degrade(MOD_NAME, get_pixfmt_desc(s->decoded_codec), av_pixfmt_get_desc(out_pixfmt));
1623+
const struct pixfmt_desc interm_desc =
1624+
get_pixfmt_desc(s->decoded_codec);
1625+
const struct pixfmt_desc out_desc = av_pixfmt_get_desc(out_pixfmt);
1626+
watch_pixfmt_degrade(
1627+
MOD_NAME, get_pixfmt_desc(in_pixfmt),
1628+
(struct pixfmt_desc) {
1629+
.depth = MIN(interm_desc.depth, out_desc.depth),
1630+
.subsampling =
1631+
MIN(interm_desc.subsampling, out_desc.subsampling) });
1632+
16251633
s->decoded = (unsigned char *) malloc(
16261634
(long) vc_get_linesize(width, s->decoded_codec) * height +
16271635
MAX_PADDING);

0 commit comments

Comments
 (0)