aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/av1dec.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2023-09-06 23:01:04 -0300
committerJames Almer <jamrial@gmail.com>2023-09-08 09:42:25 -0300
commitfb548fba04193a418f118d21b261ba05db4f480b (patch)
treef808bebe1ea74a55f4b2d7a1c11e8e5b0c2e3bae /libavcodec/av1dec.c
parent398467f519b3b4e954ac9e6868358c052b407fc5 (diff)
downloadffmpeg-fb548fba04193a418f118d21b261ba05db4f480b.tar.gz
avcodec/av1dec: export pixel format even if no hardware decoder is present
And remove the AVOID_PROBING flag, given it's the last av1 decoder to be tested either way. This fixes a regression introduced in 1652f2492f88434010053289d946dab6a57e4d58, where even if forcing the native av1 decoder, if another decoder was present, like libdav1d or libaom-av1, they'd be used for probing and some fate tests would have different results. Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/av1dec.c')
-rw-r--r--libavcodec/av1dec.c41
1 files changed, 25 insertions, 16 deletions
diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
index ec8401f4e0..8f9c2dfefb 100644
--- a/libavcodec/av1dec.c
+++ b/libavcodec/av1dec.c
@@ -440,20 +440,11 @@ static int get_tiles_info(AVCodecContext *avctx, const AV1RawTileGroup *tile_gro
}
-static int get_pixel_format(AVCodecContext *avctx)
+static enum AVPixelFormat get_sw_pixel_format(AVCodecContext *avctx,
+ const AV1RawSequenceHeader *seq)
{
- AV1DecContext *s = avctx->priv_data;
- const AV1RawSequenceHeader *seq = s->raw_seq;
uint8_t bit_depth;
- int ret;
enum AVPixelFormat pix_fmt = AV_PIX_FMT_NONE;
-#define HWACCEL_MAX (CONFIG_AV1_DXVA2_HWACCEL + \
- CONFIG_AV1_D3D11VA_HWACCEL * 2 + \
- CONFIG_AV1_NVDEC_HWACCEL + \
- CONFIG_AV1_VAAPI_HWACCEL + \
- CONFIG_AV1_VDPAU_HWACCEL + \
- CONFIG_AV1_VULKAN_HWACCEL)
- enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmtp = pix_fmts;
if (seq->seq_profile == 2 && seq->color_config.high_bitdepth)
bit_depth = seq->color_config.twelve_bit ? 12 : 10;
@@ -509,8 +500,22 @@ static int get_pixel_format(AVCodecContext *avctx)
av_log(avctx, AV_LOG_WARNING, "Unknown AV1 pixel format.\n");
}
- av_log(avctx, AV_LOG_DEBUG, "AV1 decode get format: %s.\n",
- av_get_pix_fmt_name(pix_fmt));
+ return pix_fmt;
+}
+
+static int get_pixel_format(AVCodecContext *avctx)
+{
+ AV1DecContext *s = avctx->priv_data;
+ const AV1RawSequenceHeader *seq = s->raw_seq;
+ int ret;
+ enum AVPixelFormat pix_fmt = get_sw_pixel_format(avctx, seq);
+#define HWACCEL_MAX (CONFIG_AV1_DXVA2_HWACCEL + \
+ CONFIG_AV1_D3D11VA_HWACCEL * 2 + \
+ CONFIG_AV1_NVDEC_HWACCEL + \
+ CONFIG_AV1_VAAPI_HWACCEL + \
+ CONFIG_AV1_VDPAU_HWACCEL + \
+ CONFIG_AV1_VULKAN_HWACCEL)
+ enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmtp = pix_fmts;
if (pix_fmt == AV_PIX_FMT_NONE)
return -1;
@@ -609,8 +614,6 @@ static int get_pixel_format(AVCodecContext *avctx)
*fmtp = AV_PIX_FMT_NONE;
ret = ff_thread_get_format(avctx, pix_fmts);
- if (ret < 0)
- return ret;
/**
* check if the HW accel is inited correctly. If not, return un-implemented.
@@ -620,12 +623,16 @@ static int get_pixel_format(AVCodecContext *avctx)
if (!avctx->hwaccel) {
av_log(avctx, AV_LOG_ERROR, "Your platform doesn't support"
" hardware accelerated AV1 decoding.\n");
+ avctx->pix_fmt = AV_PIX_FMT_NONE;
return AVERROR(ENOSYS);
}
s->pix_fmt = pix_fmt;
avctx->pix_fmt = ret;
+ av_log(avctx, AV_LOG_DEBUG, "AV1 decode get format: %s.\n",
+ av_get_pix_fmt_name(avctx->pix_fmt));
+
return 0;
}
@@ -865,6 +872,8 @@ static av_cold int av1_decode_init(AVCodecContext *avctx)
goto end;
}
+ avctx->pix_fmt = get_sw_pixel_format(avctx, seq);
+
end:
ff_cbs_fragment_reset(&s->current_obu);
}
@@ -1518,7 +1527,7 @@ const FFCodec ff_av1_decoder = {
.init = av1_decode_init,
.close = av1_decode_free,
FF_CODEC_RECEIVE_FRAME_CB(av1_receive_frame),
- .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_AVOID_PROBING,
+ .p.capabilities = AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.flush = av1_decode_flush,
.p.profiles = NULL_IF_CONFIG_SMALL(ff_av1_profiles),