Skip to content

Commit 647d862

Browse files
committed
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.
1 parent fcdb58e commit 647d862

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

src/libavcodec/from_lavc_vid_conv.c

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3162,25 +3162,23 @@ av_to_uv_convert(const av_to_uv_convert_t *convert,
31623162
int
31633163
from_lavc_pf_priority(struct pixfmt_desc internal, codec_t ugc)
31643164
{
3165-
switch (ugc) {
3166-
case UYVY:
3167-
case VUYA:
3168-
case RG48:
3169-
case RGB:
3170-
case RGBA:
3171-
case R10k:
3172-
case R12L:
3173-
case v210:
3174-
case Y416:
3175-
break;
3176-
default:
3165+
bool found_a_conversion = false;
3166+
for (unsigned i = 0; i < ARR_COUNT(av_to_uv_conversions); i++) {
3167+
if (av_to_uv_conversions[i].uv_codec == ugc) {
3168+
found_a_conversion = true;
3169+
break;
3170+
}
3171+
}
3172+
if (!found_a_conversion) {
31773173
return VDEC_PRIO_NA;
31783174
}
31793175
if (internal.depth == 0) { // unspecified internal format
31803176
return VDEC_PRIO_LOW;
31813177
}
3182-
return codec_is_a_rgb(ugc) == internal.rgb ? VDEC_PRIO_NORMAL
3183-
: VDEC_PRIO_NOT_PREFERRED;
3178+
/// @todo what about returning lower prio if
3179+
/// !pixdesc_equals(av_pixfmt_get_desc(av_to_uv_conversion.av_codec),
3180+
/// internal)
3181+
return VDEC_PRIO_NORMAL;
31843182
}
31853183

31863184
#pragma GCC diagnostic pop

0 commit comments

Comments
 (0)