From b8aa2edb3cdada80d461b08ba581b0c1644ad006 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Fri, 31 Jul 2015 10:50:24 +0200 Subject: [PATCH] Video dec: for RGB(A) choose shift-changing dec Avoid cross-decoding (eg. RGBA->RGB, RGB->RGBA) if device supports both codecs. Ideally, avoiding this results in using merely memcpy (if shifts match). --- src/rtp/video_decoders.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/rtp/video_decoders.cpp b/src/rtp/video_decoders.cpp index 36c087131..9013951ac 100644 --- a/src/rtp/video_decoders.cpp +++ b/src/rtp/video_decoders.cpp @@ -992,13 +992,16 @@ static codec_t choose_codec_and_decoder(struct state_video_decoder *decoder, str out_codec == DXT5) && decoder->video_mode != VIDEO_NORMAL) continue; /* it is a exception, see NOTES #1 */ - if(desc.color_spec == RGBA || /* another exception - we may change shifts */ - desc.color_spec == RGB) - continue; *decode_line = (decoder_t) memcpy; decoder->decoder_type = LINE_DECODER; + if(desc.color_spec == RGBA || /* another exception - we may change shifts */ + desc.color_spec == RGB) { + *decode_line = desc.color_spec == RGBA ? + vc_copylineRGBA : vc_copylineRGB; + } + goto after_linedecoder_lookup; } }