Skip to content

Commit dd5fda2

Browse files
committed
get_ug_codec_to_av: prefer first AV codecs
If earlier codec is convertible, use this. In other words, prefer first codecs, not those most easily convertible. The point is, that the list passed to get_format lavd callback is usually ordered from best codecs so we want to keep it. It also fixes a "regression" from 4c5cf6f (given by the different selection schemes in original and the replacement): uv -t testcard:codec=R12L -c libavcodec:encoder=libsvt_hevc -d dummy \ --param force-lavd-decoder=libde265 -V decoding YUYV, not v210 (from AVPixelFomat AV_PIX_FMT_YUV444P10LE)
1 parent 63043e2 commit dd5fda2

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/libavcodec/from_lavc_vid_conv.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1982,8 +1982,9 @@ av_to_uv_convert_p get_av_to_uv_conversion(int av_codec, codec_t uv_codec) {
19821982
}
19831983

19841984
/**
1985-
* Returns AVPixelFormat matching *ugc. If !*ugc, finds (probes) best UltraGrid codec
1986-
* to which can be one of fmt converted and returns AV_PIX_FMT_NONE.
1985+
* Returns first AVPixelFormat convertible to *ugc. If !*ugc, finds (probes)
1986+
* best UltraGrid codec to which can be one of fmt converted and returns
1987+
* AV_PIX_FMT_NONE.
19871988
*
19881989
* @param[in,out] ugc if zero, probing the codec, if nonzero, only finding matching AVPixelFormat
19891990
* @retval AV_PIX_FMT_NONE if !*ugc
@@ -2002,11 +2003,9 @@ static enum AVPixelFormat get_ug_codec_to_av(const enum AVPixelFormat *fmt, code
20022003
return *fmt_it;
20032004
}
20042005
}
2005-
}
2006-
bool use_native[] = { true, false }; // try native first
2007-
for (const bool *use_native_it = use_native; use_native_it !=
2008-
use_native + sizeof use_native / sizeof use_native[0]; ++use_native_it) {
2009-
for (const enum AVPixelFormat *fmt_it = fmt; *fmt_it != AV_PIX_FMT_NONE; fmt_it++) {
2006+
bool use_native[] = { true, false }; // try native first
2007+
for (const bool *use_native_it = use_native; use_native_it !=
2008+
use_native + sizeof use_native / sizeof use_native[0]; ++use_native_it) {
20102009
//If hwaccel is not enabled skip hw accel pixfmts even if there
20112010
//are convert functions
20122011
const AVPixFmtDescriptor *fmt_desc = av_pix_fmt_desc_get(*fmt_it);

0 commit comments

Comments
 (0)