Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
0cb3989
lavc/decode: pass AVHWAccel instead of AVCodecHWConfigInternal to hwa…
elenril Apr 28, 2023
0b9a8ea
lavc/decode: stop duplicating code from hwaccel_uninit()
elenril Apr 28, 2023
1fa18d3
lavc/pthread_frame: add support for thread-safe hwaccels
elenril Apr 28, 2023
9499f9b
lavc/decode: allow to allocate hwaccel_priv_data early
cyanreg May 11, 2023
32a50ee
h2645_vui: expose aspect_ratio_idc
cyanreg Dec 13, 2022
99522ca
h2645_vui: expose aspect_ratio_info_present_flag
cyanreg Dec 13, 2022
8cb591f
h264_ps: expose pps_id
cyanreg Mar 18, 2022
951d2dc
h264_ps: set pic_scaling_matrix_present_flag
cyanreg Mar 18, 2022
235a8bd
h264_ps: comment pic_order_present better
cyanreg Nov 23, 2022
090bc75
h264_ps: expose max_dec_frame_buffering
cyanreg Dec 13, 2022
8b497fd
h264_ps: expose bit rate and CPB size fields
cyanreg Dec 13, 2022
0967f19
h264_ps: expose scaling_matrix_present_mask
cyanreg Dec 15, 2022
c912a3a
hevc_ps: expose SPS and VPS headers
cyanreg Dec 7, 2022
1586250
hevc_ps: expose pps_id
cyanreg Dec 7, 2022
537a1a5
hevc_ps: expose vps_id
cyanreg Dec 7, 2022
eb7eb73
hevc_ps: expose pps_extension_present_flag
cyanreg Dec 7, 2022
1de1dd9
hevcdec: expose bits_used_for_short_term_rps
cyanreg Dec 7, 2022
79096b8
hevc_ps: expose log2_diff_max_min_transform_block_size
cyanreg Dec 7, 2022
dc3cf31
hevc_ps: expose rps fields
cyanreg Dec 13, 2022
9c6e79c
hevc_ps: expose vui_present flag
cyanreg Feb 28, 2023
82483e3
hevc_ps: expose sublayer_ordering_info_flag
cyanreg Feb 28, 2023
6833f33
hevc_ps: expose conformance_window_flag
cyanreg Feb 28, 2023
97272ef
hevc_ps: expose sps_extension_present_flag
cyanreg Feb 28, 2023
a0dd9b2
lavu: add 12-bit 2-plane 422 and 444 pixel formats
cyanreg Feb 25, 2023
7af2b9d
lsws: add in/out support for the new 12-bit 2-plane 422 and 444 pixfmts
cyanreg Feb 25, 2023
4b2ebe5
hwcontext_vulkan: initialize and require instance version 1.3
cyanreg Nov 23, 2022
ab17abf
hwcontext_vulkan: enable support for YCbCr samplers
cyanreg Nov 23, 2022
d9bfe10
hwcontext_vulkan: enable VK_KHR_synchronization2 if supported
cyanreg Mar 13, 2022
576cc95
hwcontext_vulkan: use portability subset if available
cyanreg Apr 29, 2023
ea5603d
hwcontext_vulkan: support threadsafe queue and frame operations
cyanreg Mar 15, 2022
b5a7e11
hwcontext_vulkan: remove contiguous memory hack
cyanreg Nov 23, 2022
cb5f616
hwcontext_vulkan: rename and expand vk_pixfmt_map to append VK_NULL_F…
cyanreg Nov 23, 2022
3a76069
hwcontext_vulkan: fix minor type issue in VulkanQueueCtx.buf_deps_all…
cyanreg Dec 13, 2022
c1cbce5
hwcontext_vulkan: report nonCoherentAtomSize
cyanreg Dec 28, 2022
326a2af
hwcontext_vulkan: add support for descriptor buffers
cyanreg Feb 17, 2023
bb54999
hwcontext_vulkan: do not require libdrm to map VAAPI devices
cyanreg Mar 14, 2023
e34dbce
hwcontext_vulkan: use VK_EXT_physical_device_drm to derive DRM to Vulkan
cyanreg Mar 14, 2023
289fc3e
hwcontext_vulkan: add functions for video decoding
cyanreg Nov 23, 2022
3c48a14
hwcontext_vulkan: support PREP_MODE_DECODING in prepare_frame()
cyanreg Nov 23, 2022
16c9152
hwcontext_vulkan: load query-related functions
cyanreg Feb 17, 2023
3619c3d
hwcontext_vulkan: enable GPU-assisted validation when debugging
cyanreg Mar 14, 2023
b8d33f1
vulkan: lock queues before submitting operations
cyanreg Nov 23, 2022
a35d93b
vulkan: define VK_NO_PROTOTYPES
cyanreg Nov 23, 2022
55f9a62
vulkan: add additional error codes
cyanreg Nov 23, 2022
2cc5373
vulkan: fix comment statement about exec_queue blocking
cyanreg Mar 10, 2022
4e8af95
vulkan: add pNext argument to ff_vk_create_buf()
cyanreg Mar 17, 2022
4f1e99f
vulkan: add ff_vk_qf_fill()
cyanreg Nov 23, 2022
995d951
vulkan: add ff_vk_image_create()
cyanreg Nov 23, 2022
b0a8d73
vulkan: expose ff_vk_alloc_mem()
cyanreg Nov 23, 2022
146400a
vulkan: support ignoring memory properties when allocating
cyanreg Nov 29, 2022
231c785
vulkan: allow alloc pNext in ff_vk_create_buf
cyanreg Dec 15, 2022
5a01b0f
vulkan: do not wait for device idle when destroying buffers
cyanreg Dec 15, 2022
65a433f
vulkan: add size tracking to buffer structs
cyanreg Dec 16, 2022
bc1070f
vulkan: use device properties 2 and add a convenience loader function
cyanreg Dec 19, 2022
f552235
vulkan: minor indent fix, add support for synchronous submission/waiting
cyanreg Dec 22, 2022
cafa199
vulkan: add support for queries
cyanreg Dec 22, 2022
9141845
vulkan: add support for retrieving queue, query and video properties
cyanreg Dec 22, 2022
3f8f097
vulkan: return current queue index from ff_vk_qf_rotate()
cyanreg Dec 28, 2022
c35232b
vulkan: rewrite to support all necessary features
cyanreg Dec 29, 2022
b03572e
vulkan: add ff_vk_count_images()
cyanreg Jan 11, 2023
cb7c7fe
vulkan: enable forcing of full subgroups
cyanreg Mar 5, 2023
27b5286
vulkan: make GLSL macro functions semicolumn-safe
cyanreg Mar 24, 2023
083d7e2
hwcontext_vulkan: rewrite to support multiplane surfaces
cyanreg Jan 11, 2023
7bdf679
hwcontext_vulkan: remove linear+host_visible "fast" path
cyanreg Feb 18, 2023
272473e
hwcontext_vulkan: don't change properties if prepare_frame fails
cyanreg Feb 17, 2023
d4f97cd
hwcontext_vulkan: remove duplicate code, port to use generic vulkan u…
cyanreg Mar 2, 2023
5c149a4
hwcontext_vulkan: enable additional device properties
cyanreg Mar 14, 2023
1b3dae9
lavfi: add lavfi-only Vulkan infrastructure
cyanreg Feb 17, 2023
400e08d
avgblur_vulkan: port for the rewrite
cyanreg Feb 17, 2023
30a310f
blend_vulkan: port for the rewrite
cyanreg Feb 17, 2023
c0a9c53
chromaber_vulkan: port for the rewrite
cyanreg Feb 17, 2023
ba23cb9
flip_vulkan: port for the rewrite
cyanreg Feb 17, 2023
d8b78eb
gblur_vulkan: port for the rewrite
cyanreg Feb 17, 2023
c229186
overlay_vulkan: port for the rewrite
cyanreg Feb 17, 2023
37763d6
scale_vulkan: port for the rewrite
cyanreg Feb 17, 2023
fabd4a8
transpose_vulkan: port for the rewrite
cyanreg Feb 17, 2023
1226c20
lavfi: add bwdif_vulkan
cyanreg Feb 26, 2023
1fd7328
avcodec: add AVHWAccel.free_frame_priv callback
cyanreg Mar 10, 2022
5c4566a
avcodec: add AVHWAccel.flush callback
cyanreg Jan 6, 2023
da3294d
libavcodec: add Vulkan common video code
cyanreg Dec 18, 2022
ccd967a
libavcodec: add Vulkan common video decoding code
cyanreg Jan 16, 2023
7075fe5
h264dec: add Vulkan hwaccel
cyanreg Dec 14, 2022
b878ed6
hevcdec: add Vulkan hwaccel
cyanreg Dec 14, 2022
41ca03a
hwcontext_vulkan: add PREP_MODE_ENCODING
cyanreg Dec 28, 2022
4577bc1
hwcontext_vulkan: add encoding functions
cyanreg Jan 11, 2023
f2b5946
libavcodec: add Vulkan common encoding code
cyanreg Dec 18, 2022
c10b73d
lavc: add h264_vulkan encoder
cyanreg Jan 11, 2023
ac8b71b
av1: set skip mode frames properly
airlied Feb 27, 2023
a6e4bcf
cbs_av1: expose tile col/row starts in SBs
cyanreg Feb 23, 2023
0a2c71c
av1dec: add Vulkan hwaccel
cyanreg Feb 17, 2023
b42939e
lavfi: add color_vulkan filter
cyanreg Feb 22, 2023
c118100
tools/cl2c: change to tools/source2c and allow non-OpenCL source files
cyanreg Mar 18, 2023
0df998b
vulkan: add support for the atomic float ops extension
cyanreg Apr 13, 2023
e541496
lavfi: add nlmeans_vulkan filter
cyanreg Apr 13, 2023
a0c78db
vulkan_h264: reject end_frame being called without start_frame
cyanreg May 20, 2023
13b1baa
avfilter/vf_libplacebo: forward queue locking primitives
haasn Jan 30, 2023
16855d3
avfilter/vf_libplacebo: bump max vk version
haasn Apr 24, 2023
2da8e59
avutil/hwcontext_vulkan: add libplacebo required features
haasn Apr 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,6 @@ External library support:
--disable-securetransport disable Secure Transport, needed for TLS support
on OSX if openssl and gnutls are not used [autodetect]
--enable-vapoursynth enable VapourSynth demuxer [no]
--disable-vulkan disable Vulkan code [autodetect]
--disable-xlib disable xlib [autodetect]
--disable-zlib disable zlib [autodetect]

Expand All @@ -354,6 +353,8 @@ External library support:
--disable-vaapi disable Video Acceleration API (mainly Unix/Intel) code [autodetect]
--disable-vdpau disable Nvidia Video Decode and Presentation API for Unix code [autodetect]
--disable-videotoolbox disable VideoToolbox code [autodetect]
--disable-vulkan disable Vulkan code [autodetect]
--enable-vulkan-encode enable Vulkan encoding code [no]

Toolchain options:
--arch=ARCH select architecture [$arch]
Expand Down Expand Up @@ -1915,6 +1916,7 @@ HWACCEL_LIBRARY_LIST="
mmal
omx
opencl
vulkan_encode
"

DOCUMENT_LIST="
Expand Down Expand Up @@ -2514,6 +2516,7 @@ CONFIG_EXTRA="
vp56dsp
vp8dsp
wma_freqs
vulkan_encode
wmv2dsp
"

Expand Down Expand Up @@ -3020,6 +3023,8 @@ av1_vaapi_hwaccel_deps="vaapi VADecPictureParameterBufferAV1_bit_depth_idx"
av1_vaapi_hwaccel_select="av1_decoder"
av1_vdpau_hwaccel_deps="vdpau VdpPictureInfoAV1"
av1_vdpau_hwaccel_select="av1_decoder"
av1_vulkan_hwaccel_deps="vulkan"
av1_vulkan_hwaccel_select="av1_decoder"
h263_vaapi_hwaccel_deps="vaapi"
h263_vaapi_hwaccel_select="h263_decoder"
h263_videotoolbox_hwaccel_deps="videotoolbox"
Expand All @@ -3038,6 +3043,8 @@ h264_vdpau_hwaccel_deps="vdpau"
h264_vdpau_hwaccel_select="h264_decoder"
h264_videotoolbox_hwaccel_deps="videotoolbox"
h264_videotoolbox_hwaccel_select="h264_decoder"
h264_vulkan_hwaccel_deps="vulkan"
h264_vulkan_hwaccel_select="h264_decoder"
hevc_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_HEVC"
hevc_d3d11va_hwaccel_select="hevc_decoder"
hevc_d3d11va2_hwaccel_deps="d3d11va DXVA_PicParams_HEVC"
Expand All @@ -3052,6 +3059,8 @@ hevc_vdpau_hwaccel_deps="vdpau VdpPictureInfoHEVC"
hevc_vdpau_hwaccel_select="hevc_decoder"
hevc_videotoolbox_hwaccel_deps="videotoolbox"
hevc_videotoolbox_hwaccel_select="hevc_decoder"
hevc_vulkan_hwaccel_deps="vulkan"
hevc_vulkan_hwaccel_select="hevc_decoder"
mjpeg_nvdec_hwaccel_deps="nvdec"
mjpeg_nvdec_hwaccel_select="mjpeg_decoder"
mjpeg_vaapi_hwaccel_deps="vaapi"
Expand Down Expand Up @@ -3133,6 +3142,7 @@ qsvenc_select="qsv"
qsvvpp_select="qsv"
vaapi_encode_deps="vaapi"
v4l2_m2m_deps="linux_videodev2_h sem_timedwait"
vulkan_encode_deps="vulkan"

bilateral_cuda_filter_deps="ffnvcodec"
bilateral_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
Expand Down Expand Up @@ -3185,6 +3195,7 @@ h264_qsv_encoder_select="atsc_a53 qsvenc"
h264_rkmpp_decoder_deps="rkmpp"
h264_rkmpp_decoder_select="h264_mp4toannexb_bsf"
h264_vaapi_encoder_select="atsc_a53 cbs_h264 vaapi_encode"
h264_vulkan_encoder_select="cbs_h264 vulkan_encode"
h264_v4l2m2m_decoder_deps="v4l2_m2m h264_v4l2_m2m"
h264_v4l2m2m_decoder_select="h264_mp4toannexb_bsf"
h264_v4l2m2m_encoder_deps="v4l2_m2m h264_v4l2_m2m"
Expand Down Expand Up @@ -3640,7 +3651,9 @@ blend_vulkan_filter_deps="vulkan spirv_compiler"
boxblur_filter_deps="gpl"
boxblur_opencl_filter_deps="opencl gpl"
bs2b_filter_deps="libbs2b"
bwdif_vulkan_filter_deps="vulkan spirv_compiler"
chromaber_vulkan_filter_deps="vulkan spirv_compiler"
color_vulkan_filter_deps="vulkan spirv_compiler"
colorkey_opencl_filter_deps="opencl"
colormatrix_filter_deps="gpl"
convolution_opencl_filter_deps="opencl"
Expand Down Expand Up @@ -3697,6 +3710,7 @@ minterpolate_filter_select="scene_sad"
mptestsrc_filter_deps="gpl"
negate_filter_deps="lut_filter"
nlmeans_opencl_filter_deps="opencl"
nlmeans_vulkan_filter_deps="vulkan spirv_compiler"
nnedi_filter_deps="gpl"
ocr_filter_deps="libtesseract"
ocv_filter_deps="libopencv"
Expand Down Expand Up @@ -7040,8 +7054,8 @@ enabled crystalhd && check_lib crystalhd "stdint.h libcrystalhd/libcrystalhd_if.
"in maintaining it."

if enabled vulkan; then
check_pkg_config_header_only vulkan "vulkan >= 1.2.189" "vulkan/vulkan.h" "defined VK_VERSION_1_2" ||
check_cpp_condition vulkan "vulkan/vulkan.h" "defined(VK_VERSION_1_3) || (defined(VK_VERSION_1_2) && VK_HEADER_VERSION >= 189)"
check_pkg_config_header_only vulkan "vulkan >= 1.3.238" "vulkan/vulkan.h" "defined VK_VERSION_1_3" ||
check_cpp_condition vulkan "vulkan/vulkan.h" "defined(VK_VERSION_1_4) || (defined(VK_VERSION_1_3) && VK_HEADER_VERSION >= 238)"
fi

if enabled x86; then
Expand Down
8 changes: 8 additions & 0 deletions libavcodec/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ OBJS-$(CONFIG_VP3DSP) += vp3dsp.o
OBJS-$(CONFIG_VP56DSP) += vp56dsp.o
OBJS-$(CONFIG_VP8DSP) += vp8dsp.o
OBJS-$(CONFIG_V4L2_M2M) += v4l2_m2m.o v4l2_context.o v4l2_buffers.o v4l2_fmt.o
OBJS-$(CONFIG_VULKAN_ENCODE) += vulkan_encode.o
OBJS-$(CONFIG_WMA_FREQS) += wma_freqs.o
OBJS-$(CONFIG_WMV2DSP) += wmv2dsp.o

Expand Down Expand Up @@ -419,6 +420,8 @@ OBJS-$(CONFIG_H264_VAAPI_ENCODER) += vaapi_encode_h264.o h264_levels.o \
OBJS-$(CONFIG_H264_VIDEOTOOLBOX_ENCODER) += videotoolboxenc.o
OBJS-$(CONFIG_H264_V4L2M2M_DECODER) += v4l2_m2m_dec.o
OBJS-$(CONFIG_H264_V4L2M2M_ENCODER) += v4l2_m2m_enc.o
OBJS-$(CONFIG_H264_VULKAN_ENCODER) += vulkan_encode_h264.o h264_levels.o \
h2645data.o
OBJS-$(CONFIG_HAP_DECODER) += hapdec.o hap.o
OBJS-$(CONFIG_HAP_ENCODER) += hapenc.o hap.o
OBJS-$(CONFIG_HCA_DECODER) += hcadec.o
Expand Down Expand Up @@ -982,12 +985,14 @@ OBJS-$(CONFIG_NVDEC) += nvdec.o
OBJS-$(CONFIG_VAAPI) += vaapi_decode.o
OBJS-$(CONFIG_VIDEOTOOLBOX) += videotoolbox.o
OBJS-$(CONFIG_VDPAU) += vdpau.o
OBJS-$(CONFIG_VULKAN) += vulkan.o vulkan_video.o

OBJS-$(CONFIG_AV1_D3D11VA_HWACCEL) += dxva2_av1.o
OBJS-$(CONFIG_AV1_DXVA2_HWACCEL) += dxva2_av1.o
OBJS-$(CONFIG_AV1_NVDEC_HWACCEL) += nvdec_av1.o
OBJS-$(CONFIG_AV1_VAAPI_HWACCEL) += vaapi_av1.o
OBJS-$(CONFIG_AV1_VDPAU_HWACCEL) += vdpau_av1.o
OBJS-$(CONFIG_AV1_VULKAN_HWACCEL) += vulkan_av1.o
OBJS-$(CONFIG_H263_VAAPI_HWACCEL) += vaapi_mpeg4.o
OBJS-$(CONFIG_H263_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o
OBJS-$(CONFIG_H264_D3D11VA_HWACCEL) += dxva2_h264.o
Expand All @@ -997,12 +1002,14 @@ OBJS-$(CONFIG_H264_QSV_HWACCEL) += qsvdec.o
OBJS-$(CONFIG_H264_VAAPI_HWACCEL) += vaapi_h264.o
OBJS-$(CONFIG_H264_VDPAU_HWACCEL) += vdpau_h264.o
OBJS-$(CONFIG_H264_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o
OBJS-$(CONFIG_H264_VULKAN_HWACCEL) += vulkan_decode.o vulkan_h264.o
OBJS-$(CONFIG_HEVC_D3D11VA_HWACCEL) += dxva2_hevc.o
OBJS-$(CONFIG_HEVC_DXVA2_HWACCEL) += dxva2_hevc.o
OBJS-$(CONFIG_HEVC_NVDEC_HWACCEL) += nvdec_hevc.o
OBJS-$(CONFIG_HEVC_QSV_HWACCEL) += qsvdec.o
OBJS-$(CONFIG_HEVC_VAAPI_HWACCEL) += vaapi_hevc.o h265_profile_level.o
OBJS-$(CONFIG_HEVC_VDPAU_HWACCEL) += vdpau_hevc.o h265_profile_level.o
OBJS-$(CONFIG_HEVC_VULKAN_HWACCEL) += vulkan_decode.o vulkan_hevc.o
OBJS-$(CONFIG_MJPEG_NVDEC_HWACCEL) += nvdec_mjpeg.o
OBJS-$(CONFIG_MJPEG_VAAPI_HWACCEL) += vaapi_mjpeg.o
OBJS-$(CONFIG_MPEG1_NVDEC_HWACCEL) += nvdec_mpeg12.o
Expand Down Expand Up @@ -1290,6 +1297,7 @@ SKIPHEADERS-$(CONFIG_XVMC) += xvmc.h
SKIPHEADERS-$(CONFIG_VAAPI) += vaapi_decode.h vaapi_hevc.h vaapi_encode.h
SKIPHEADERS-$(CONFIG_VDPAU) += vdpau.h vdpau_internal.h
SKIPHEADERS-$(CONFIG_VIDEOTOOLBOX) += videotoolbox.h vt_internal.h
SKIPHEADERS-$(CONFIG_VULKAN) += vulkan.h vulkan_video.h vulkan_encode.h vulkan_decode.h vulkan_video_codec_av1std.h vulkan_video_codec_av1std_decode.h
SKIPHEADERS-$(CONFIG_V4L2_M2M) += v4l2_buffers.h v4l2_context.h v4l2_m2m.h
SKIPHEADERS-$(CONFIG_ZLIB) += zlib_wrapper.h

Expand Down
1 change: 1 addition & 0 deletions libavcodec/allcodecs.c
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,7 @@ extern const FFCodec ff_h264_qsv_encoder;
extern const FFCodec ff_h264_v4l2m2m_encoder;
extern const FFCodec ff_h264_vaapi_encoder;
extern const FFCodec ff_h264_videotoolbox_encoder;
extern const FFCodec ff_h264_vulkan_encoder;
extern const FFCodec ff_hevc_amf_encoder;
extern const FFCodec ff_hevc_cuvid_decoder;
extern const FFCodec ff_hevc_mediacodec_decoder;
Expand Down
60 changes: 55 additions & 5 deletions libavcodec/av1dec.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "libavutil/opt.h"
#include "avcodec.h"
#include "av1_parse.h"
#include "decode.h"
#include "av1dec.h"
#include "atsc_a53.h"
#include "bytestream.h"
Expand Down Expand Up @@ -268,8 +269,10 @@ static void skip_mode_params(AV1DecContext *s)
int second_forward_idx, second_forward_hint;
int ref_hint, dist, i;

if (!header->skip_mode_present)
return;
if (header->frame_type == AV1_FRAME_KEY ||
header->frame_type == AV1_FRAME_INTRA_ONLY ||
!header->reference_select || !seq->enable_order_hint)
return;

forward_idx = -1;
backward_idx = -1;
Expand Down Expand Up @@ -446,7 +449,8 @@ static int get_pixel_format(AVCodecContext *avctx)
CONFIG_AV1_D3D11VA_HWACCEL * 2 + \
CONFIG_AV1_NVDEC_HWACCEL + \
CONFIG_AV1_VAAPI_HWACCEL + \
CONFIG_AV1_VDPAU_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)
Expand Down Expand Up @@ -526,6 +530,9 @@ static int get_pixel_format(AVCodecContext *avctx)
#endif
#if CONFIG_AV1_VDPAU_HWACCEL
*fmtp++ = AV_PIX_FMT_VDPAU;
#endif
#if CONFIG_AV1_VULKAN_HWACCEL
*fmtp++ = AV_PIX_FMT_VULKAN;
#endif
break;
case AV_PIX_FMT_YUV420P10:
Expand All @@ -544,6 +551,44 @@ static int get_pixel_format(AVCodecContext *avctx)
#endif
#if CONFIG_AV1_VDPAU_HWACCEL
*fmtp++ = AV_PIX_FMT_VDPAU;
#endif
#if CONFIG_AV1_VULKAN_HWACCEL
*fmtp++ = AV_PIX_FMT_VULKAN;
#endif
break;
case AV_PIX_FMT_YUV420P12:
#if CONFIG_AV1_VULKAN_HWACCEL
*fmtp++ = AV_PIX_FMT_VULKAN;
#endif
break;
case AV_PIX_FMT_YUV422P:
#if CONFIG_AV1_VULKAN_HWACCEL
*fmtp++ = AV_PIX_FMT_VULKAN;
#endif
break;
case AV_PIX_FMT_YUV422P10:
#if CONFIG_AV1_VULKAN_HWACCEL
*fmtp++ = AV_PIX_FMT_VULKAN;
#endif
break;
case AV_PIX_FMT_YUV422P12:
#if CONFIG_AV1_VULKAN_HWACCEL
*fmtp++ = AV_PIX_FMT_VULKAN;
#endif
break;
case AV_PIX_FMT_YUV444P:
#if CONFIG_AV1_VULKAN_HWACCEL
*fmtp++ = AV_PIX_FMT_VULKAN;
#endif
break;
case AV_PIX_FMT_YUV444P10:
#if CONFIG_AV1_VULKAN_HWACCEL
*fmtp++ = AV_PIX_FMT_VULKAN;
#endif
break;
case AV_PIX_FMT_YUV444P12:
#if CONFIG_AV1_VULKAN_HWACCEL
*fmtp++ = AV_PIX_FMT_VULKAN;
#endif
break;
case AV_PIX_FMT_GRAY8:
Expand Down Expand Up @@ -863,8 +908,7 @@ static int av1_frame_alloc(AVCodecContext *avctx, AV1Frame *f)
if (avctx->hwaccel) {
const AVHWAccel *hwaccel = avctx->hwaccel;
if (hwaccel->frame_priv_data_size) {
f->hwaccel_priv_buf =
av_buffer_allocz(hwaccel->frame_priv_data_size);
f->hwaccel_priv_buf = ff_hwaccel_frame_priv_alloc(avctx, hwaccel);
if (!f->hwaccel_priv_buf) {
ret = AVERROR(ENOMEM);
goto fail;
Expand Down Expand Up @@ -1412,6 +1456,9 @@ static void av1_decode_flush(AVCodecContext *avctx)
av_buffer_unref(&itut_t35.payload_ref);

ff_cbs_flush(s->cbc);

if (avctx->hwaccel && avctx->hwaccel->flush)
avctx->hwaccel->flush(avctx);
}

#define OFFSET(x) offsetof(AV1DecContext, x)
Expand Down Expand Up @@ -1464,6 +1511,9 @@ const FFCodec ff_av1_decoder = {
#if CONFIG_AV1_VDPAU_HWACCEL
HWACCEL_VDPAU(av1),
#endif
#if CONFIG_AV1_VULKAN_HWACCEL
HWACCEL_VULKAN(av1),
#endif

NULL
},
Expand Down
5 changes: 2 additions & 3 deletions libavcodec/avcodec.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "decode.h"
#include "encode.h"
#include "frame_thread_encoder.h"
#include "hwconfig.h"
#include "internal.h"
#include "thread.h"

Expand Down Expand Up @@ -459,9 +460,7 @@ av_cold int avcodec_close(AVCodecContext *avctx)

av_buffer_unref(&avci->pool);

if (avctx->hwaccel && avctx->hwaccel->uninit)
avctx->hwaccel->uninit(avctx);
av_freep(&avci->hwaccel_priv_data);
ff_hwaccel_uninit(avctx);

av_bsf_free(&avci->bsf);

Expand Down
19 changes: 19 additions & 0 deletions libavcodec/avcodec.h
Original file line number Diff line number Diff line change
Expand Up @@ -2253,6 +2253,25 @@ typedef struct AVHWAccel {
* that avctx->hwaccel_priv_data is invalid.
*/
int (*frame_params)(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx);

/**
* Copy necessary context variables from a previous thread context to the current one.
* For thread-safe hwaccels only.
*/
int (*update_thread_context)(AVCodecContext *dst, const AVCodecContext *src);

/**
* Callback to free the hwaccel-specific frame data.
*
* @param hwctx a pointer to an AVHWDeviceContext.
* @param data the per-frame hardware accelerator private data to be freed.
*/
void (*free_frame_priv)(void *hwctx, uint8_t *data);

/**
* Callback to flush the hwaccel state.
*/
void (*flush)(AVCodecContext *avctx);
} AVHWAccel;

/**
Expand Down
2 changes: 2 additions & 0 deletions libavcodec/cbs_av1.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ typedef struct AV1RawFrameHeader {
uint8_t uniform_tile_spacing_flag;
uint8_t tile_cols_log2;
uint8_t tile_rows_log2;
uint8_t tile_start_col_sb[AV1_MAX_TILE_COLS];
uint8_t tile_start_row_sb[AV1_MAX_TILE_COLS];
uint8_t width_in_sbs_minus_1[AV1_MAX_TILE_COLS];
uint8_t height_in_sbs_minus_1[AV1_MAX_TILE_ROWS];
uint16_t context_update_tile_id;
Expand Down
10 changes: 10 additions & 0 deletions libavcodec/cbs_av1_syntax_template.c
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,10 @@ static int FUNC(tile_info)(CodedBitstreamContext *ctx, RWContext *rw,

tile_width_sb = (sb_cols + (1 << current->tile_cols_log2) - 1) >>
current->tile_cols_log2;

for (int off = 0, i = 0; off < sb_cols; off += tile_width_sb)
current->tile_start_col_sb[i++] = off;

current->tile_cols = (sb_cols + tile_width_sb - 1) / tile_width_sb;

min_log2_tile_rows = FFMAX(min_log2_tiles - current->tile_cols_log2, 0);
Expand All @@ -634,6 +638,10 @@ static int FUNC(tile_info)(CodedBitstreamContext *ctx, RWContext *rw,

tile_height_sb = (sb_rows + (1 << current->tile_rows_log2) - 1) >>
current->tile_rows_log2;

for (int off = 0, i = 0; off < sb_rows; off += tile_height_sb)
current->tile_start_row_sb[i++] = off;

current->tile_rows = (sb_rows + tile_height_sb - 1) / tile_height_sb;

for (i = 0; i < current->tile_cols - 1; i++)
Expand All @@ -652,6 +660,7 @@ static int FUNC(tile_info)(CodedBitstreamContext *ctx, RWContext *rw,

start_sb = 0;
for (i = 0; start_sb < sb_cols && i < AV1_MAX_TILE_COLS; i++) {
current->tile_start_col_sb[i] = start_sb;
max_width = FFMIN(sb_cols - start_sb, max_tile_width_sb);
ns(max_width, width_in_sbs_minus_1[i], 1, i);
size_sb = current->width_in_sbs_minus_1[i] + 1;
Expand All @@ -669,6 +678,7 @@ static int FUNC(tile_info)(CodedBitstreamContext *ctx, RWContext *rw,

start_sb = 0;
for (i = 0; start_sb < sb_rows && i < AV1_MAX_TILE_ROWS; i++) {
current->tile_start_row_sb[i] = start_sb;
max_height = FFMIN(sb_rows - start_sb, max_tile_height_sb);
ns(max_height, height_in_sbs_minus_1[i], 1, i);
size_sb = current->height_in_sbs_minus_1[i] + 1;
Expand Down
Loading