lavc: issue hwacc compat warning for any non-4:2:0

Display warning for every non-4:2:0 subsampling (previously was
displayed for 4:2:2 but also 4:4:4 is now normally supported).
This commit is contained in:
Martin Pulec
2022-01-17 13:50:05 +01:00
parent cee4e8ff24
commit 12ee84143f
3 changed files with 7 additions and 7 deletions

View File

@@ -195,16 +195,16 @@ static void print_decoder_error(const char *mod_name, int rc) {
}
}
inline static bool pixfmt_has_422_subsampling(enum AVPixelFormat fmt){
inline static bool pixfmt_has_420_subsampling(enum AVPixelFormat fmt){
const AVPixFmtDescriptor *fmt_desc = av_pix_fmt_desc_get(fmt);
return fmt_desc && !(fmt_desc->flags & AV_PIX_FMT_FLAG_HWACCEL)
&& fmt_desc->log2_chroma_w == 1 && fmt_desc->log2_chroma_h == 0;
}
inline static bool pixfmt_list_has_422_subsasmpling(const enum AVPixelFormat *fmt){
inline static bool pixfmt_list_has_420_subsampling(const enum AVPixelFormat *fmt){
for(const enum AVPixelFormat *it = fmt; *it != AV_PIX_FMT_NONE; it++){
if(pixfmt_has_422_subsampling(*it))
if(pixfmt_has_420_subsampling(*it))
return true;
}

View File

@@ -1241,8 +1241,8 @@ static bool configure_with(struct state_video_compress_libav *s, struct video_de
log_msg(LOG_LEVEL_INFO, "[lavc] Selected pixfmt: %s\n", av_get_pix_fmt_name(pix_fmt));
s->selected_pixfmt = pix_fmt;
if(pixfmt_has_422_subsampling(pix_fmt)){
log_msg(LOG_LEVEL_WARNING, "[lavc] Selected pixfmt has 4:2:2 subsampling, "
if (!pixfmt_has_420_subsampling(pix_fmt)) {
log_msg(LOG_LEVEL_WARNING, "[lavc] Selected pixfmt has not 4:2:0 subsampling, "
"which is usually not supported by hw. decoders\n");
}

View File

@@ -547,9 +547,9 @@ static enum AVPixelFormat get_format_callback(struct AVCodecContext *s __attribu
if (hwaccel && state->out_codec != VIDEO_CODEC_NONE) { // not probing internal format
struct state_libavcodec_decompress *state = (struct state_libavcodec_decompress *) s->opaque;
if(pixfmt_list_has_422_subsasmpling(fmt)){
if (pixfmt_list_has_420_subsampling(fmt)){
log_msg(LOG_LEVEL_WARNING, "[lavd] Hw. acceleration requested "
"but incoming video has 4:2:2 subsampling, "
"but incoming video has not 4:2:0 subsampling, "
"which is usually not supported by hw. accelerators\n");
}
for(const enum AVPixelFormat *it = fmt; *it != AV_PIX_FMT_NONE; it++){