mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-21 14:40:22 +00:00
video dec: change chosen disp pixfmt from compress
Use compare_pixfmt for codec sorting resulting in different selection,
eg:
uv -t testcard:codec=R10k -c libavcodec:encoder=libx265:yuv -d dummy:codec=decklink
Used to end with v210 (compressed properties was 10-bit YUV 4:4:4;
internal codec detected as Y416). Now it ends with R12L - note that this
is still not optimal as it should be rather R10k. For GL it even ends up
with RG48.
The previous behavior can be triggered by `--conv-policy cds`.
refer to GH-295
This commit is contained in:
@@ -1008,21 +1008,11 @@ static vector<pair<codec_t, codec_t>> video_decoder_order_output_codecs(codec_t
|
||||
remaining.push_back(codec);
|
||||
}
|
||||
if (comp_int_fmt != VIDEO_CODEC_NONE) {
|
||||
// sort - first codec of the same color space as internal (YUV
|
||||
// is implicitly !RGB), then the other
|
||||
// inside those 2 groups, sort nearest higher first, then downwardly the lower bit depts
|
||||
sort(remaining.begin(), remaining.end(), [comp_int_fmt](const codec_t &a, const codec_t &b) {
|
||||
if (codec_is_a_rgb(a) != codec_is_a_rgb(b)) { // RGB and YUV (or vice versa)
|
||||
return codec_is_a_rgb(a) == codec_is_a_rgb(comp_int_fmt);
|
||||
}
|
||||
// either a or b is lower than comp_int_fmt bit depth - sort higher bit depth first
|
||||
if (get_bits_per_component(a) < get_bits_per_component(comp_int_fmt) ||
|
||||
get_bits_per_component(b) < get_bits_per_component(comp_int_fmt)) {
|
||||
return get_bits_per_component(a) > get_bits_per_component(b);
|
||||
}
|
||||
// both are equal or higher - sort lower bit depth first
|
||||
return get_bits_per_component(a) < get_bits_per_component(b);
|
||||
|
||||
struct pixfmt_desc src_desc = get_pixfmt_desc(comp_int_fmt);
|
||||
struct pixfmt_desc desc_a = get_pixfmt_desc(a);
|
||||
struct pixfmt_desc desc_b = get_pixfmt_desc(b);
|
||||
return compare_pixdesc(&desc_a, &desc_b, &src_desc) < 0;
|
||||
});
|
||||
}
|
||||
for (auto & c : remaining) {
|
||||
|
||||
Reference in New Issue
Block a user