from_lavc_pf_priority: get supported pf from convs

Assume that the output pixel format (ugc) is supported if there is at
least one conversion. This may not be optimal but it is just as it was
until now, we just remove the hard coded list.

Effectively this is just a refactor, except:
- VDEC_PRIO_NOT_PREFERRED now not returned if internal.rgb !=
codec_is_rgb(ugc) - doesn't seem relevant, because the codec is already
probed and ugc determined. So any alternative decompress will need to do
the conversion as well.
This commit is contained in:
Martin Pulec
2025-06-25 16:04:51 +02:00
parent fcdb58e669
commit 647d8627c4

View File

@@ -3162,25 +3162,23 @@ av_to_uv_convert(const av_to_uv_convert_t *convert,
int
from_lavc_pf_priority(struct pixfmt_desc internal, codec_t ugc)
{
switch (ugc) {
case UYVY:
case VUYA:
case RG48:
case RGB:
case RGBA:
case R10k:
case R12L:
case v210:
case Y416:
break;
default:
bool found_a_conversion = false;
for (unsigned i = 0; i < ARR_COUNT(av_to_uv_conversions); i++) {
if (av_to_uv_conversions[i].uv_codec == ugc) {
found_a_conversion = true;
break;
}
}
if (!found_a_conversion) {
return VDEC_PRIO_NA;
}
if (internal.depth == 0) { // unspecified internal format
return VDEC_PRIO_LOW;
}
return codec_is_a_rgb(ugc) == internal.rgb ? VDEC_PRIO_NORMAL
: VDEC_PRIO_NOT_PREFERRED;
/// @todo what about returning lower prio if
/// !pixdesc_equals(av_pixfmt_get_desc(av_to_uv_conversion.av_codec),
/// internal)
return VDEC_PRIO_NORMAL;
}
#pragma GCC diagnostic pop