diff --git a/src/libavcodec/lavc_common.c b/src/libavcodec/lavc_common.c index b78138617..d38ee31d4 100644 --- a/src/libavcodec/lavc_common.c +++ b/src/libavcodec/lavc_common.c @@ -288,24 +288,6 @@ void print_decoder_error(const char *mod_name, int rc) { } } -bool pixfmt_has_420_subsampling(enum AVPixelFormat fmt){ - const AVPixFmtDescriptor *fmt_desc = av_pix_fmt_desc_get(fmt); - - return fmt_desc && (fmt_desc->log2_chroma_w == 1 && fmt_desc->log2_chroma_h == 1); -} - -/// @retval true if all pixel formats have either 420 subsampling or are HW accelerated -bool pixfmt_list_has_420_subsampling(const enum AVPixelFormat *fmt){ - for(const enum AVPixelFormat *it = fmt; *it != AV_PIX_FMT_NONE; it++){ - const AVPixFmtDescriptor *fmt_desc = av_pix_fmt_desc_get(*it); - if (!pixfmt_has_420_subsampling(*it) && !(fmt_desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) { - return false; - } - } - - return true; -} - const char *lavc_thread_type_to_str(int thread_type) { static _Thread_local char buf[128]; memset(buf, 0, sizeof buf); diff --git a/src/libavcodec/lavc_common.h b/src/libavcodec/lavc_common.h index a8d5eebf8..888f8230c 100644 --- a/src/libavcodec/lavc_common.h +++ b/src/libavcodec/lavc_common.h @@ -105,9 +105,6 @@ extern "C" { #endif void print_decoder_error(const char *mod_name, int rc); -bool pixfmt_has_420_subsampling(enum AVPixelFormat fmt); -/// @retval true if all pixel formats have either 420 subsampling or are HW accelerated -bool pixfmt_list_has_420_subsampling(const enum AVPixelFormat *fmt); void print_libav_error(int verbosity, const char *msg, int rc); void printf_libav_error(int verbosity, int rc, const char *msg, ...) __attribute__((format (printf, 3, 4))); diff --git a/src/video_decompress/libavcodec.c b/src/video_decompress/libavcodec.c index e9bdf202c..92238db3b 100644 --- a/src/video_decompress/libavcodec.c +++ b/src/video_decompress/libavcodec.c @@ -597,7 +597,7 @@ static enum AVPixelFormat get_format_callback(struct AVCodecContext *s, const en if (hwaccel != NULL) { struct state_libavcodec_decompress *state = (struct state_libavcodec_decompress *) s->opaque; - if (!pixfmt_list_has_420_subsampling(fmt)){ + if (av_pixfmt_get_subsampling(s->sw_pix_fmt) != SUBS_420) { log_msg(LOG_LEVEL_WARNING, "[lavd] Hw. acceleration requested " "but incoming video has not 4:2:0 subsampling, " "which is usually not supported by hw. accelerators\n");