mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-08 13:22:53 +02:00
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 1652f2492f
,
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>
This commit is contained in:
parent
398467f519
commit
fb548fba04
@ -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),
|
||||
|
@ -275,15 +275,16 @@ transcode(){
|
||||
stream_remux(){
|
||||
src_fmt=$1
|
||||
srcfile=$2
|
||||
enc_fmt=$3
|
||||
stream_maps=$4
|
||||
final_decode=$5
|
||||
ffprobe_opts=$6
|
||||
src_opts=$3
|
||||
enc_fmt=$4
|
||||
stream_maps=$5
|
||||
final_decode=$6
|
||||
ffprobe_opts=$7
|
||||
encfile="${outdir}/${test}.${enc_fmt}"
|
||||
test $keep -ge 1 || cleanfiles="$cleanfiles $encfile"
|
||||
tsrcfile=$(target_path $srcfile)
|
||||
tencfile=$(target_path $encfile)
|
||||
ffmpeg -f $src_fmt -i $tsrcfile $stream_maps -codec copy $FLAGS \
|
||||
ffmpeg -f $src_fmt $src_opts -i $tsrcfile $stream_maps -codec copy $FLAGS \
|
||||
-f $enc_fmt -y $tencfile || return
|
||||
ffmpeg $DEC_OPTS -i $tencfile $ENC_OPTS $FLAGS $final_decode \
|
||||
-f framecrc - || return
|
||||
|
@ -9,8 +9,8 @@ FATE_ENHANCED_FLVENC_FFMPEG-$(call REMUX, FLV IVF, FLV_DEMUXER VP9_PARSER) += fa
|
||||
fate-enhanced-flv-vp9: CMD = transcode ivf $(TARGET_SAMPLES)/vp9-test-vectors/vp90-2-05-resize.ivf\
|
||||
flv "-c copy" "-c copy"
|
||||
|
||||
FATE_ENHANCED_FLVENC_FFMPEG-$(call REMUX, FLV IVF, FLV_DEMUXER AV1_PARSER) += fate-enhanced-flv-av1
|
||||
fate-enhanced-flv-av1: CMD = stream_remux ivf $(TARGET_SAMPLES)/av1/seq_hdr_op_param_info.ivf\
|
||||
FATE_ENHANCED_FLVENC_FFMPEG-$(call REMUX, FLV IVF, FLV_DEMUXER AV1_DECODER AV1_PARSER) += fate-enhanced-flv-av1
|
||||
fate-enhanced-flv-av1: CMD = stream_remux ivf $(TARGET_SAMPLES)/av1/seq_hdr_op_param_info.ivf "-c:v av1" \
|
||||
flv "-c copy" "-c copy"
|
||||
|
||||
FATE_FFMPEG_FFPROBE += $(FATE_FLVENC_FFMPEG_FFPROBE-yes)
|
||||
|
@ -70,9 +70,9 @@ fate-lavf-wtv: CMD = lavf_container "" "-c:a mp2 -threads 1"
|
||||
FATE_AVCONV += $(FATE_LAVF_CONTAINER)
|
||||
fate-lavf-container fate-lavf: $(FATE_LAVF_CONTAINER)
|
||||
|
||||
FATE_LAVF_CONTAINER_FATE-$(call ALLYES, IVF_DEMUXER AV1_PARSER MOV_MUXER) += av1.mp4
|
||||
FATE_LAVF_CONTAINER_FATE-$(call ALLYES, IVF_DEMUXER AV1_DECODER AV1_PARSER MOV_MUXER) += av1.mp4
|
||||
FATE_LAVF_CONTAINER_FATE-$(call ALLYES, IVF_DEMUXER AV1_DECODER AV1_PARSER MATROSKA_MUXER) += av1.mkv
|
||||
FATE_LAVF_CONTAINER_FATE-$(call ALLYES, EVC_DEMUXER EVC_PARSER MOV_MUXER) += evc.mp4
|
||||
FATE_LAVF_CONTAINER_FATE-$(call ALLYES, IVF_DEMUXER AV1_PARSER MATROSKA_MUXER) += av1.mkv
|
||||
FATE_LAVF_CONTAINER_FATE-$(call ALLYES, H264_DEMUXER H264_PARSER MOV_MUXER) += h264.mp4
|
||||
FATE_LAVF_CONTAINER_FATE-$(call ALLYES, MATROSKA_DEMUXER OGG_MUXER) += vp3.ogg
|
||||
FATE_LAVF_CONTAINER_FATE-$(call ALLYES, MATROSKA_DEMUXER OGV_MUXER) += vp8.ogg
|
||||
@ -86,8 +86,8 @@ FATE_LAVF_CONTAINER_FATE = $(FATE_LAVF_CONTAINER_FATE-yes:%=fate-lavf-fate-%)
|
||||
$(FATE_LAVF_CONTAINER_FATE): REF = $(SRC_PATH)/tests/ref/lavf-fate/$(@:fate-lavf-fate-%=%)
|
||||
$(FATE_LAVF_CONTAINER_FATE): $(AREF) $(VREF)
|
||||
|
||||
fate-lavf-fate-av1.mp4: CMD = lavf_container_fate "av1-test-vectors/av1-1-b8-05-mv.ivf" "" "-c:v copy"
|
||||
fate-lavf-fate-av1.mkv: CMD = lavf_container_fate "av1-test-vectors/av1-1-b8-05-mv.ivf" "" "-c:v copy"
|
||||
fate-lavf-fate-av1.mp4: CMD = lavf_container_fate "av1-test-vectors/av1-1-b8-05-mv.ivf" "-c:v av1" "-c:v copy"
|
||||
fate-lavf-fate-av1.mkv: CMD = lavf_container_fate "av1-test-vectors/av1-1-b8-05-mv.ivf" "-c:v av1" "-c:v copy"
|
||||
fate-lavf-fate-evc.mp4: CMD = lavf_container_fate "evc/akiyo_cif.evc" "" "-c:v copy"
|
||||
fate-lavf-fate-h264.mp4: CMD = lavf_container_fate "h264/intra_refresh.h264" "" "-c:v copy"
|
||||
fate-lavf-fate-vp3.ogg: CMD = lavf_container_fate "vp3/coeff_level64.mkv" "-idct auto"
|
||||
|
@ -1,7 +1,7 @@
|
||||
# This tests that a 16-bit pcm_dvd stream is correctly remuxed in mpegps
|
||||
FATE_MPEGPS-$(call DEMMUX, MPEGPS, MPEG1SYSTEM) += fate-mpegps-remuxed-pcm-demux
|
||||
fate-mpegps-remuxed-pcm-demux: $(SAMPLES)/mpegps/pcm_aud.mpg
|
||||
fate-mpegps-remuxed-pcm-demux: CMD = stream_remux "mpeg" "$(TARGET_SAMPLES)/mpegps/pcm_aud.mpg" "mpeg" "-map 0:a:0" "-codec copy"
|
||||
fate-mpegps-remuxed-pcm-demux: CMD = stream_remux "mpeg" "$(TARGET_SAMPLES)/mpegps/pcm_aud.mpg" "mpeg" "" "-map 0:a:0" "-codec copy"
|
||||
|
||||
FATE_SAMPLES_FFMPEG += $(FATE_MPEGPS-yes)
|
||||
fate-mpegps: $(FATE_MPEGPS-yes)
|
||||
|
@ -3,7 +3,7 @@
|
||||
#media_type 0: video
|
||||
#codec_id 0: av1
|
||||
#dimensions 0: 300x300
|
||||
#sar 0: 1/1
|
||||
#sar 0: 0/1
|
||||
0, 0, 0, 48000, 12691, 0xf0adcc79
|
||||
0, 48000, 48000, 48000, 4975, 0x1742a45f, F=0x0
|
||||
0, 96000, 96000, 48000, 928, 0x7408be1a, F=0x0
|
||||
|
@ -1,3 +1,3 @@
|
||||
ba198efa114b4db3c9f772728f84978b *tests/data/lavf-fate/lavf.av1.mkv
|
||||
55656 tests/data/lavf-fate/lavf.av1.mkv
|
||||
d875b42964dd55c8cea2e2752379d327 *tests/data/lavf-fate/lavf.av1.mkv
|
||||
55660 tests/data/lavf-fate/lavf.av1.mkv
|
||||
tests/data/lavf-fate/lavf.av1.mkv CRC=0x7c27cc15
|
||||
|
@ -1,3 +1,3 @@
|
||||
d6afef355cf1bcf1a71b9cfb98c32fba *tests/data/lavf-fate/lavf.av1.mp4
|
||||
55976 tests/data/lavf-fate/lavf.av1.mp4
|
||||
194cd796f3d28a890b516b2507f57180 *tests/data/lavf-fate/lavf.av1.mp4
|
||||
55960 tests/data/lavf-fate/lavf.av1.mp4
|
||||
tests/data/lavf-fate/lavf.av1.mp4 CRC=0x7c27cc15
|
||||
|
Loading…
Reference in New Issue
Block a user