ffmpeg | branch: master | Lynne <d...@lynne.ee> | Thu Mar 13 16:26:40 2025 +0000| [caff29dbb18feeb87cb00fc4c33d20cf01667be0] | committer: Lynne
FFHWAccel: add buffer_ref argument to start_frame This commit adds a reference to the buffer as an argument to start_frame, and adapts all existing code. This allows for asynchronous hardware accelerators to skip copying packet data by referencing it. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=caff29dbb18feeb87cb00fc4c33d20cf01667be0 --- libavcodec/av1dec.c | 3 ++- libavcodec/d3d12va_av1.c | 5 ++++- libavcodec/d3d12va_h264.c | 5 +++-- libavcodec/d3d12va_hevc.c | 5 ++++- libavcodec/d3d12va_mpeg2.c | 5 ++++- libavcodec/d3d12va_vc1.c | 5 ++++- libavcodec/d3d12va_vp9.c | 5 ++++- libavcodec/dxva2_av1.c | 1 + libavcodec/dxva2_h264.c | 1 + libavcodec/dxva2_hevc.c | 1 + libavcodec/dxva2_mpeg2.c | 1 + libavcodec/dxva2_vc1.c | 1 + libavcodec/dxva2_vp9.c | 1 + libavcodec/ffv1dec.c | 2 +- libavcodec/h263dec.c | 2 +- libavcodec/h264dec.c | 8 +++++--- libavcodec/hevc/hevcdec.c | 5 ++++- libavcodec/hwaccel_internal.h | 4 +++- libavcodec/mjpegdec.c | 2 +- libavcodec/mpeg12dec.c | 2 +- libavcodec/nvdec_av1.c | 4 +++- libavcodec/nvdec_h264.c | 1 + libavcodec/nvdec_hevc.c | 1 + libavcodec/nvdec_mjpeg.c | 4 +++- libavcodec/nvdec_mpeg12.c | 4 +++- libavcodec/nvdec_mpeg4.c | 4 +++- libavcodec/nvdec_vc1.c | 4 +++- libavcodec/nvdec_vp8.c | 4 +++- libavcodec/nvdec_vp9.c | 4 +++- libavcodec/proresdec.c | 2 +- libavcodec/vaapi_av1.c | 1 + libavcodec/vaapi_h264.c | 1 + libavcodec/vaapi_hevc.c | 1 + libavcodec/vaapi_mjpeg.c | 1 + libavcodec/vaapi_mpeg2.c | 5 ++++- libavcodec/vaapi_mpeg4.c | 5 ++++- libavcodec/vaapi_vc1.c | 5 ++++- libavcodec/vaapi_vp8.c | 1 + libavcodec/vaapi_vp9.c | 1 + libavcodec/vaapi_vvc.c | 1 + libavcodec/vc1dec.c | 6 +++--- libavcodec/vdpau_av1.c | 3 ++- libavcodec/vdpau_h264.c | 1 + libavcodec/vdpau_hevc.c | 1 + libavcodec/vdpau_mpeg12.c | 1 + libavcodec/vdpau_mpeg4.c | 1 + libavcodec/vdpau_vc1.c | 1 + libavcodec/vdpau_vp9.c | 3 ++- libavcodec/videotoolbox.c | 8 ++++++-- libavcodec/videotoolbox_av1.c | 1 + libavcodec/videotoolbox_vp9.c | 1 + libavcodec/vp8.c | 2 +- libavcodec/vp9.c | 2 +- libavcodec/vt_internal.h | 1 + libavcodec/vulkan_av1.c | 1 + libavcodec/vulkan_h264.c | 1 + libavcodec/vulkan_hevc.c | 1 + libavcodec/vvc/dec.c | 12 +++++++----- 58 files changed, 123 insertions(+), 42 deletions(-) diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c index e6aabe42fb..ed00278ed3 100644 --- a/libavcodec/av1dec.c +++ b/libavcodec/av1dec.c @@ -1389,7 +1389,8 @@ static int av1_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame) s->cur_frame.temporal_id = header->temporal_id; if (avctx->hwaccel && s->cur_frame.f) { - ret = FF_HW_CALL(avctx, start_frame, unit->data, unit->data_size); + ret = FF_HW_CALL(avctx, start_frame, s->pkt->buf, + unit->data, unit->data_size); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "HW accel start frame fail.\n"); goto end; diff --git a/libavcodec/d3d12va_av1.c b/libavcodec/d3d12va_av1.c index 83e7e53a55..fdc7195d12 100644 --- a/libavcodec/d3d12va_av1.c +++ b/libavcodec/d3d12va_av1.c @@ -45,7 +45,10 @@ typedef struct AV1DecodePictureContext { unsigned bitstream_size; } AV1DecodePictureContext; -static int d3d12va_av1_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size) +static int d3d12va_av1_start_frame(AVCodecContext *avctx, + av_unused const AVBufferRef *buffer_ref, + av_unused const uint8_t *buffer, + av_unused uint32_t size) { const AV1DecContext *h = avctx->priv_data; AV1DecodePictureContext *ctx_pic = h->cur_frame.hwaccel_picture_private; diff --git a/libavcodec/d3d12va_h264.c b/libavcodec/d3d12va_h264.c index 9ccbe9d5a8..dec9344aad 100644 --- a/libavcodec/d3d12va_h264.c +++ b/libavcodec/d3d12va_h264.c @@ -50,8 +50,9 @@ static void fill_slice_short(DXVA_Slice_H264_Short *slice, } static int d3d12va_h264_start_frame(AVCodecContext *avctx, - av_unused const uint8_t *buffer, - av_unused uint32_t size) + av_unused const AVBufferRef *buffer_ref, + av_unused const uint8_t *buffer, + av_unused uint32_t size) { const H264Context *h = avctx->priv_data; H264DecodePictureContext *ctx_pic = h->cur_pic_ptr->hwaccel_picture_private; diff --git a/libavcodec/d3d12va_hevc.c b/libavcodec/d3d12va_hevc.c index 26c67dcfbd..e72d49b7d9 100644 --- a/libavcodec/d3d12va_hevc.c +++ b/libavcodec/d3d12va_hevc.c @@ -49,7 +49,10 @@ static void fill_slice_short(DXVA_Slice_HEVC_Short *slice, unsigned position, un slice->wBadSliceChopping = 0; } -static int d3d12va_hevc_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size) +static int d3d12va_hevc_start_frame(AVCodecContext *avctx, + av_unused const AVBufferRef *buffer_ref, + av_unused const uint8_t *buffer, + av_unused uint32_t size) { const HEVCContext *h = avctx->priv_data; D3D12VADecodeContext *ctx = D3D12VA_DECODE_CONTEXT(avctx); diff --git a/libavcodec/d3d12va_mpeg2.c b/libavcodec/d3d12va_mpeg2.c index d2eb77797f..47e453dd5e 100644 --- a/libavcodec/d3d12va_mpeg2.c +++ b/libavcodec/d3d12va_mpeg2.c @@ -40,7 +40,10 @@ typedef struct D3D12DecodePictureContext { unsigned bitstream_size; } D3D12DecodePictureContext; -static int d3d12va_mpeg2_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size) +static int d3d12va_mpeg2_start_frame(AVCodecContext *avctx, + av_unused const AVBufferRef *buffer_ref, + av_unused const uint8_t *buffer, + av_unused uint32_t size) { const MpegEncContext *s = avctx->priv_data; D3D12VADecodeContext *ctx = D3D12VA_DECODE_CONTEXT(avctx); diff --git a/libavcodec/d3d12va_vc1.c b/libavcodec/d3d12va_vc1.c index 73f2cf71ad..e64a8e0630 100644 --- a/libavcodec/d3d12va_vc1.c +++ b/libavcodec/d3d12va_vc1.c @@ -41,7 +41,10 @@ typedef struct D3D12DecodePictureContext { unsigned bitstream_size; } D3D12DecodePictureContext; -static int d3d12va_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size) +static int d3d12va_vc1_start_frame(AVCodecContext *avctx, + av_unused const AVBufferRef *buffer_ref, + av_unused const uint8_t *buffer, + av_unused uint32_t size) { const VC1Context *v = avctx->priv_data; D3D12VADecodeContext *ctx = D3D12VA_DECODE_CONTEXT(avctx); diff --git a/libavcodec/d3d12va_vp9.c b/libavcodec/d3d12va_vp9.c index 68f26d4c61..6f1f933fdd 100644 --- a/libavcodec/d3d12va_vp9.c +++ b/libavcodec/d3d12va_vp9.c @@ -45,7 +45,10 @@ static void fill_slice_short(DXVA_Slice_VPx_Short *slice, unsigned position, uns slice->wBadSliceChopping = 0; } -static int d3d12va_vp9_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size) +static int d3d12va_vp9_start_frame(AVCodecContext *avctx, + av_unused const AVBufferRef *buffer_ref, + av_unused const uint8_t *buffer, + av_unused uint32_t size) { const VP9SharedContext *h = avctx->priv_data; D3D12VADecodeContext *ctx = D3D12VA_DECODE_CONTEXT(avctx); diff --git a/libavcodec/dxva2_av1.c b/libavcodec/dxva2_av1.c index 9a7e0eb3ae..47866ff4c3 100644 --- a/libavcodec/dxva2_av1.c +++ b/libavcodec/dxva2_av1.c @@ -272,6 +272,7 @@ int ff_dxva2_av1_fill_picture_parameters(const AVCodecContext *avctx, AVDXVACont } static int dxva2_av1_start_frame(AVCodecContext *avctx, + av_unused const AVBufferRef *buffer_ref, av_unused const uint8_t *buffer, av_unused uint32_t size) { diff --git a/libavcodec/dxva2_h264.c b/libavcodec/dxva2_h264.c index 0fe4152625..dd9dccbf8c 100644 --- a/libavcodec/dxva2_h264.c +++ b/libavcodec/dxva2_h264.c @@ -444,6 +444,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx, static int dxva2_h264_start_frame(AVCodecContext *avctx, + av_unused const AVBufferRef *buffer_ref, av_unused const uint8_t *buffer, av_unused uint32_t size) { diff --git a/libavcodec/dxva2_hevc.c b/libavcodec/dxva2_hevc.c index d01d1e76e8..85698dfcce 100644 --- a/libavcodec/dxva2_hevc.c +++ b/libavcodec/dxva2_hevc.c @@ -363,6 +363,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx, static int dxva2_hevc_start_frame(AVCodecContext *avctx, + av_unused const AVBufferRef *buffer_ref, av_unused const uint8_t *buffer, av_unused uint32_t size) { diff --git a/libavcodec/dxva2_mpeg2.c b/libavcodec/dxva2_mpeg2.c index d88e782414..7955bcdea2 100644 --- a/libavcodec/dxva2_mpeg2.c +++ b/libavcodec/dxva2_mpeg2.c @@ -257,6 +257,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx, } static int dxva2_mpeg2_start_frame(AVCodecContext *avctx, + av_unused const AVBufferRef *buffer_ref, av_unused const uint8_t *buffer, av_unused uint32_t size) { diff --git a/libavcodec/dxva2_vc1.c b/libavcodec/dxva2_vc1.c index a7b440c0d9..1f5db8156a 100644 --- a/libavcodec/dxva2_vc1.c +++ b/libavcodec/dxva2_vc1.c @@ -315,6 +315,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx, } static int dxva2_vc1_start_frame(AVCodecContext *avctx, + av_unused const AVBufferRef *buffer_ref, av_unused const uint8_t *buffer, av_unused uint32_t size) { diff --git a/libavcodec/dxva2_vp9.c b/libavcodec/dxva2_vp9.c index f4ab91c580..cffa95e1d1 100644 --- a/libavcodec/dxva2_vp9.c +++ b/libavcodec/dxva2_vp9.c @@ -254,6 +254,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx, static int dxva2_vp9_start_frame(AVCodecContext *avctx, + av_unused const AVBufferRef *buffer_ref, av_unused const uint8_t *buffer, av_unused uint32_t size) { diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c index f221af7ad9..6196c15865 100644 --- a/libavcodec/ffv1dec.c +++ b/libavcodec/ffv1dec.c @@ -742,7 +742,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe, /* Start */ if (hwaccel) { - ret = hwaccel->start_frame(avctx, avpkt->data, avpkt->size); + ret = hwaccel->start_frame(avctx, avpkt->buf, avpkt->data, avpkt->size); if (ret < 0) return ret; } diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index 982a56ae05..2d806fc703 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -561,7 +561,7 @@ retry: ff_thread_finish_setup(avctx); if (avctx->hwaccel) { - ret = FF_HW_CALL(avctx, start_frame, + ret = FF_HW_CALL(avctx, start_frame, NULL, s->gb.buffer, s->gb.buffer_end - s->gb.buffer); if (ret < 0 ) return ret; diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c index fd401027d6..d6ba55e76b 100644 --- a/libavcodec/h264dec.c +++ b/libavcodec/h264dec.c @@ -587,7 +587,8 @@ static void debug_green_metadata(const H264SEIGreenMetaData *gm, void *logctx) } } -static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size) +static int decode_nal_units(H264Context *h, AVBufferRef *buf_ref, + const uint8_t *buf, int buf_size) { AVCodecContext *const avctx = h->avctx; int nals_needed = 0; ///< number of NALs that need decoding before the next frame thread starts @@ -668,7 +669,8 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size) } if (h->avctx->hwaccel && - (ret = FF_HW_CALL(h->avctx, start_frame, buf, buf_size)) < 0) + (ret = FF_HW_CALL(h->avctx, start_frame, buf_ref, + buf, buf_size)) < 0) goto end; } @@ -1053,7 +1055,7 @@ static int h264_decode_frame(AVCodecContext *avctx, AVFrame *pict, avctx->err_recognition, avctx); } - buf_index = decode_nal_units(h, buf, buf_size); + buf_index = decode_nal_units(h, avpkt->buf, buf, buf_size); if (buf_index < 0) return AVERROR_INVALIDDATA; diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c index da8fdc5935..20ef821819 100644 --- a/libavcodec/hevc/hevcdec.c +++ b/libavcodec/hevc/hevcdec.c @@ -3401,7 +3401,10 @@ static int hevc_frame_start(HEVCContext *s, HEVCLayerContext *l, goto fail; if (s->avctx->hwaccel) { - ret = FF_HW_CALL(s->avctx, start_frame, NULL, 0); + AVCodecInternal *avci = s->avctx->internal; + AVPacket *avpkt = avci->in_pkt; + ret = FF_HW_CALL(s->avctx, start_frame, + avpkt->buf, NULL, 0); if (ret < 0) goto fail; } diff --git a/libavcodec/hwaccel_internal.h b/libavcodec/hwaccel_internal.h index 77df4e0904..7224406815 100644 --- a/libavcodec/hwaccel_internal.h +++ b/libavcodec/hwaccel_internal.h @@ -52,11 +52,13 @@ typedef struct FFHWAccel { * Otherwise, this means the whole frame is available at this point. * * @param avctx the codec context + * @param buf_ref the frame data buffer reference (optional) * @param buf the frame data buffer base * @param buf_size the size of the frame in bytes * @return zero if successful, a negative value otherwise */ - int (*start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size); + int (*start_frame)(AVCodecContext *avctx, const AVBufferRef *buf_ref, + const uint8_t *buf, uint32_t buf_size); /** * Callback for parameter data (SPS/PPS/VPS etc). diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index bd1b502e50..f3d940671e 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -808,7 +808,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s) if (!s->hwaccel_picture_private) return AVERROR(ENOMEM); - ret = hwaccel->start_frame(s->avctx, s->raw_image_buffer, + ret = hwaccel->start_frame(s->avctx, NULL, s->raw_image_buffer, s->raw_image_buffer_size); if (ret < 0) return ret; diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index c36471a8b3..81cc543424 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -1361,7 +1361,7 @@ static int mpeg_field_start(Mpeg1Context *s1, const uint8_t *buf, int buf_size) } if (avctx->hwaccel) { - if ((ret = FF_HW_CALL(avctx, start_frame, buf, buf_size)) < 0) + if ((ret = FF_HW_CALL(avctx, start_frame, NULL, buf, buf_size)) < 0) return ret; } else if (s->codec_tag == MKTAG('V', 'C', 'R', '2')) { // Exchange UV diff --git a/libavcodec/nvdec_av1.c b/libavcodec/nvdec_av1.c index 6b408edb87..23183ffd9c 100644 --- a/libavcodec/nvdec_av1.c +++ b/libavcodec/nvdec_av1.c @@ -39,7 +39,9 @@ static int get_bit_depth_from_seq(const AV1RawSequenceHeader *seq) return 8; } -static int nvdec_av1_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) +static int nvdec_av1_start_frame(AVCodecContext *avctx, + const AVBufferRef *buffer_ref, + const uint8_t *buffer, uint32_t size) { const AV1DecContext *s = avctx->priv_data; const AV1RawSequenceHeader *seq = s->raw_seq; diff --git a/libavcodec/nvdec_h264.c b/libavcodec/nvdec_h264.c index 1ae3dfd032..48ad5873b8 100644 --- a/libavcodec/nvdec_h264.c +++ b/libavcodec/nvdec_h264.c @@ -47,6 +47,7 @@ static void dpb_add(const H264Context *h, CUVIDH264DPBENTRY *dst, const H264Pict } static int nvdec_h264_start_frame(AVCodecContext *avctx, + const AVBufferRef *buffer_ref, const uint8_t *buffer, uint32_t size) { const H264Context *h = avctx->priv_data; diff --git a/libavcodec/nvdec_hevc.c b/libavcodec/nvdec_hevc.c index e01ce4c782..dd3c6c627c 100644 --- a/libavcodec/nvdec_hevc.c +++ b/libavcodec/nvdec_hevc.c @@ -70,6 +70,7 @@ static void fill_scaling_lists(CUVIDHEVCPICPARAMS *ppc, const HEVCContext *s) } static int nvdec_hevc_start_frame(AVCodecContext *avctx, + const AVBufferRef *buffer_ref, const uint8_t *buffer, uint32_t size) { const HEVCContext *s = avctx->priv_data; diff --git a/libavcodec/nvdec_mjpeg.c b/libavcodec/nvdec_mjpeg.c index 850634bf1a..4bdbde8d3a 100644 --- a/libavcodec/nvdec_mjpeg.c +++ b/libavcodec/nvdec_mjpeg.c @@ -27,7 +27,9 @@ #include "decode.h" #include "hwaccel_internal.h" -static int nvdec_mjpeg_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) +static int nvdec_mjpeg_start_frame(AVCodecContext *avctx, + const AVBufferRef *buffer_ref, + const uint8_t *buffer, uint32_t size) { MJpegDecodeContext *s = avctx->priv_data; diff --git a/libavcodec/nvdec_mpeg12.c b/libavcodec/nvdec_mpeg12.c index 99b2b14f1f..0a24e42a59 100644 --- a/libavcodec/nvdec_mpeg12.c +++ b/libavcodec/nvdec_mpeg12.c @@ -30,7 +30,9 @@ #include "nvdec.h" #include "decode.h" -static int nvdec_mpeg12_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) +static int nvdec_mpeg12_start_frame(AVCodecContext *avctx, + const AVBufferRef *buffer_ref, + const uint8_t *buffer, uint32_t size) { MpegEncContext *s = avctx->priv_data; diff --git a/libavcodec/nvdec_mpeg4.c b/libavcodec/nvdec_mpeg4.c index 80da11b5b1..dae6de41c1 100644 --- a/libavcodec/nvdec_mpeg4.c +++ b/libavcodec/nvdec_mpeg4.c @@ -28,7 +28,9 @@ #include "decode.h" #include "hwaccel_internal.h" -static int nvdec_mpeg4_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) +static int nvdec_mpeg4_start_frame(AVCodecContext *avctx, + const AVBufferRef *buffer_ref, + const uint8_t *buffer, uint32_t size) { Mpeg4DecContext *m = avctx->priv_data; MpegEncContext *s = &m->m; diff --git a/libavcodec/nvdec_vc1.c b/libavcodec/nvdec_vc1.c index fbfba1ecb4..647fe7bef9 100644 --- a/libavcodec/nvdec_vc1.c +++ b/libavcodec/nvdec_vc1.c @@ -29,7 +29,9 @@ #include "decode.h" #include "vc1.h" -static int nvdec_vc1_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) +static int nvdec_vc1_start_frame(AVCodecContext *avctx, + const AVBufferRef *buffer_ref, + const uint8_t *buffer, uint32_t size) { VC1Context *v = avctx->priv_data; MpegEncContext *s = &v->s; diff --git a/libavcodec/nvdec_vp8.c b/libavcodec/nvdec_vp8.c index ff3b3f259c..2faacdfe8c 100644 --- a/libavcodec/nvdec_vp8.c +++ b/libavcodec/nvdec_vp8.c @@ -32,7 +32,9 @@ static unsigned char safe_get_ref_idx(VP8Frame *frame) return frame ? ff_nvdec_get_ref_idx(frame->tf.f) : 255; } -static int nvdec_vp8_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) +static int nvdec_vp8_start_frame(AVCodecContext *avctx, + const AVBufferRef *buffer_ref, + const uint8_t *buffer, uint32_t size) { VP8Context *h = avctx->priv_data; diff --git a/libavcodec/nvdec_vp9.c b/libavcodec/nvdec_vp9.c index e196391c6d..b564687246 100644 --- a/libavcodec/nvdec_vp9.c +++ b/libavcodec/nvdec_vp9.c @@ -29,7 +29,9 @@ #include "internal.h" #include "vp9shared.h" -static int nvdec_vp9_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) +static int nvdec_vp9_start_frame(AVCodecContext *avctx, + const AVBufferRef *buffer_ref, + const uint8_t *buffer, uint32_t size) { VP9SharedContext *h = avctx->priv_data; const AVPixFmtDescriptor *pixdesc = av_pix_fmt_desc_get(avctx->sw_pix_fmt); diff --git a/libavcodec/proresdec.c b/libavcodec/proresdec.c index 01caa611a0..5f917daca1 100644 --- a/libavcodec/proresdec.c +++ b/libavcodec/proresdec.c @@ -793,7 +793,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame, if (HWACCEL_MAX && avctx->hwaccel) { const FFHWAccel *hwaccel = ffhwaccel(avctx->hwaccel); - ret = hwaccel->start_frame(avctx, NULL, 0); + ret = hwaccel->start_frame(avctx, avpkt->buf, avpkt->data, avpkt->size); if (ret < 0) return ret; ret = hwaccel->decode_slice(avctx, avpkt->data, avpkt->size); diff --git a/libavcodec/vaapi_av1.c b/libavcodec/vaapi_av1.c index 7e8f632b8a..b8f5472c14 100644 --- a/libavcodec/vaapi_av1.c +++ b/libavcodec/vaapi_av1.c @@ -108,6 +108,7 @@ static av_cold int vaapi_av1_decode_uninit(AVCodecContext *avctx) static int vaapi_av1_start_frame(AVCodecContext *avctx, + av_unused const AVBufferRef *buffer_ref, av_unused const uint8_t *buffer, av_unused uint32_t size) { diff --git a/libavcodec/vaapi_h264.c b/libavcodec/vaapi_h264.c index 398e92568c..7f00da09fc 100644 --- a/libavcodec/vaapi_h264.c +++ b/libavcodec/vaapi_h264.c @@ -232,6 +232,7 @@ static void fill_vaapi_plain_pred_weight_table(const H264Context *h, /** Initialize and start decoding a frame with VA API. */ static int vaapi_h264_start_frame(AVCodecContext *avctx, + av_unused const AVBufferRef *buffer_ref, av_unused const uint8_t *buffer, av_unused uint32_t size) { diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c index 0c5a829220..878f7965c4 100644 --- a/libavcodec/vaapi_hevc.c +++ b/libavcodec/vaapi_hevc.c @@ -122,6 +122,7 @@ static void fill_vaapi_reference_frames(const HEVCContext *h, const HEVCLayerCon } static int vaapi_hevc_start_frame(AVCodecContext *avctx, + av_unused const AVBufferRef *buffer_ref, av_unused const uint8_t *buffer, av_unused uint32_t size) { diff --git a/libavcodec/vaapi_mjpeg.c b/libavcodec/vaapi_mjpeg.c index 9557cf5f9b..c8b59b8afa 100644 --- a/libavcodec/vaapi_mjpeg.c +++ b/libavcodec/vaapi_mjpeg.c @@ -24,6 +24,7 @@ #include "mjpegdec.h" static int vaapi_mjpeg_start_frame(AVCodecContext *avctx, + av_unused const AVBufferRef *buffer_ref, av_unused const uint8_t *buffer, av_unused uint32_t size) { diff --git a/libavcodec/vaapi_mpeg2.c b/libavcodec/vaapi_mpeg2.c index d4304dfdd1..925f0db1ba 100644 --- a/libavcodec/vaapi_mpeg2.c +++ b/libavcodec/vaapi_mpeg2.c @@ -39,7 +39,10 @@ static inline int mpeg2_get_is_frame_start(const MpegEncContext *s) return s->first_field || s->picture_structure == PICT_FRAME; } -static int vaapi_mpeg2_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size) +static int vaapi_mpeg2_start_frame(AVCodecContext *avctx, + av_unused const AVBufferRef *buffer_ref, + av_unused const uint8_t *buffer, + av_unused uint32_t size) { const MpegEncContext *s = avctx->priv_data; VAAPIDecodePicture *pic = s->cur_pic.ptr->hwaccel_picture_private; diff --git a/libavcodec/vaapi_mpeg4.c b/libavcodec/vaapi_mpeg4.c index 2c9dfbe42f..12bc9bc86a 100644 --- a/libavcodec/vaapi_mpeg4.c +++ b/libavcodec/vaapi_mpeg4.c @@ -45,7 +45,10 @@ static int mpeg4_get_intra_dc_vlc_thr(Mpeg4DecContext *s) return 0; } -static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size) +static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, + av_unused const AVBufferRef *buffer_ref, + av_unused const uint8_t *buffer, + av_unused uint32_t size) { Mpeg4DecContext *ctx = avctx->priv_data; MpegEncContext *s = &ctx->m; diff --git a/libavcodec/vaapi_vc1.c b/libavcodec/vaapi_vc1.c index 7d001882fd..6c25fdb5fa 100644 --- a/libavcodec/vaapi_vc1.c +++ b/libavcodec/vaapi_vc1.c @@ -249,7 +249,10 @@ static inline void vc1_pack_bitplanes(uint8_t *bitplane, int n, const uint8_t *f bitplane[bitplane_index] = (bitplane[bitplane_index] << 4) | v; } -static int vaapi_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size) +static int vaapi_vc1_start_frame(AVCodecContext *avctx, + av_unused const AVBufferRef *buffer_ref, + av_unused const uint8_t *buffer, + av_unused uint32_t size) { const VC1Context *v = avctx->priv_data; const MpegEncContext *s = &v->s; diff --git a/libavcodec/vaapi_vp8.c b/libavcodec/vaapi_vp8.c index 66fdde1f39..b9b1f2aa51 100644 --- a/libavcodec/vaapi_vp8.c +++ b/libavcodec/vaapi_vp8.c @@ -32,6 +32,7 @@ static VASurfaceID vaapi_vp8_surface_id(VP8Frame *vf) } static int vaapi_vp8_start_frame(AVCodecContext *avctx, + av_unused const AVBufferRef *buffer_ref, av_unused const uint8_t *buffer, av_unused uint32_t size) { diff --git a/libavcodec/vaapi_vp9.c b/libavcodec/vaapi_vp9.c index a28fc75a59..7d57f340e0 100644 --- a/libavcodec/vaapi_vp9.c +++ b/libavcodec/vaapi_vp9.c @@ -35,6 +35,7 @@ static VASurfaceID vaapi_vp9_surface_id(const VP9Frame *vf) } static int vaapi_vp9_start_frame(AVCodecContext *avctx, + av_unused const AVBufferRef *buffer_ref, av_unused const uint8_t *buffer, av_unused uint32_t size) { diff --git a/libavcodec/vaapi_vvc.c b/libavcodec/vaapi_vvc.c index 310b56e5a4..908db7bfab 100644 --- a/libavcodec/vaapi_vvc.c +++ b/libavcodec/vaapi_vvc.c @@ -80,6 +80,7 @@ static void fill_vaapi_reference_frames(const VVCFrameContext *h, VAPictureParam } static int vaapi_vvc_start_frame(AVCodecContext *avctx, + av_unused const AVBufferRef *buffer_ref, av_unused const uint8_t *buffer, av_unused uint32_t size) { diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index b9ca38d20d..7ee014d4b6 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -1087,7 +1087,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict, if (v->field_mode && buf_start_second_field) { // decode first field s->picture_structure = PICT_BOTTOM_FIELD - v->tff; - ret = hwaccel->start_frame(avctx, buf_start, + ret = hwaccel->start_frame(avctx, avpkt->buf, buf_start, buf_start_second_field - buf_start); if (ret < 0) goto err; @@ -1142,7 +1142,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict, } v->s.cur_pic.ptr->f->pict_type = v->s.pict_type; - ret = hwaccel->start_frame(avctx, buf_start_second_field, + ret = hwaccel->start_frame(avctx, avpkt->buf, buf_start_second_field, (buf + buf_size) - buf_start_second_field); if (ret < 0) goto err; @@ -1185,7 +1185,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict, goto err; } else { s->picture_structure = PICT_FRAME; - ret = hwaccel->start_frame(avctx, buf_start, + ret = hwaccel->start_frame(avctx, avpkt->buf, buf_start, (buf + buf_size) - buf_start); if (ret < 0) goto err; diff --git a/libavcodec/vdpau_av1.c b/libavcodec/vdpau_av1.c index 0be3222135..b7e7fa8b0c 100644 --- a/libavcodec/vdpau_av1.c +++ b/libavcodec/vdpau_av1.c @@ -41,7 +41,8 @@ static int get_bit_depth_from_seq(const AV1RawSequenceHeader *seq) } static int vdpau_av1_start_frame(AVCodecContext *avctx, - const uint8_t *buffer, uint32_t size) + const AVBufferRef *buffer_ref, + const uint8_t *buffer, uint32_t size) { AV1DecContext *s = avctx->priv_data; const AV1RawSequenceHeader *seq = s->raw_seq; diff --git a/libavcodec/vdpau_h264.c b/libavcodec/vdpau_h264.c index a1961b31f1..51c7e99900 100644 --- a/libavcodec/vdpau_h264.c +++ b/libavcodec/vdpau_h264.c @@ -118,6 +118,7 @@ static void vdpau_h264_set_reference_frames(AVCodecContext *avctx) } static int vdpau_h264_start_frame(AVCodecContext *avctx, + const AVBufferRef *buffer_ref, const uint8_t *buffer, uint32_t size) { H264Context * const h = avctx->priv_data; diff --git a/libavcodec/vdpau_hevc.c b/libavcodec/vdpau_hevc.c index b312adeafc..1a92c32b27 100644 --- a/libavcodec/vdpau_hevc.c +++ b/libavcodec/vdpau_hevc.c @@ -32,6 +32,7 @@ static int vdpau_hevc_start_frame(AVCodecContext *avctx, + const AVBufferRef *buffer_ref, const uint8_t *buffer, uint32_t size) { HEVCContext *h = avctx->priv_data; diff --git a/libavcodec/vdpau_mpeg12.c b/libavcodec/vdpau_mpeg12.c index dc6341b7ed..4d16f18089 100644 --- a/libavcodec/vdpau_mpeg12.c +++ b/libavcodec/vdpau_mpeg12.c @@ -32,6 +32,7 @@ #include "vdpau_internal.h" static int vdpau_mpeg_start_frame(AVCodecContext *avctx, + const AVBufferRef *buffer_ref, const uint8_t *buffer, uint32_t size) { MpegEncContext * const s = avctx->priv_data; diff --git a/libavcodec/vdpau_mpeg4.c b/libavcodec/vdpau_mpeg4.c index 1036890dd9..24ae10b3c3 100644 --- a/libavcodec/vdpau_mpeg4.c +++ b/libavcodec/vdpau_mpeg4.c @@ -30,6 +30,7 @@ #include "vdpau_internal.h" static int vdpau_mpeg4_start_frame(AVCodecContext *avctx, + const AVBufferRef *buffer_ref, const uint8_t *buffer, uint32_t size) { Mpeg4DecContext *ctx = avctx->priv_data; diff --git a/libavcodec/vdpau_vc1.c b/libavcodec/vdpau_vc1.c index 53ff367230..af6973ea6a 100644 --- a/libavcodec/vdpau_vc1.c +++ b/libavcodec/vdpau_vc1.c @@ -32,6 +32,7 @@ #include "vdpau_internal.h" static int vdpau_vc1_start_frame(AVCodecContext *avctx, + const AVBufferRef *buffer_ref, const uint8_t *buffer, uint32_t size) { VC1Context * const v = avctx->priv_data; diff --git a/libavcodec/vdpau_vp9.c b/libavcodec/vdpau_vp9.c index e000d7f6ca..7b3c1ff4d7 100644 --- a/libavcodec/vdpau_vp9.c +++ b/libavcodec/vdpau_vp9.c @@ -29,7 +29,8 @@ #include "vdpau_internal.h" static int vdpau_vp9_start_frame(AVCodecContext *avctx, - const uint8_t *buffer, uint32_t size) + const AVBufferRef *buffer_ref, + const uint8_t *buffer, uint32_t size) { VP9Context *s = avctx->priv_data; VP9SharedContext *h = &(s->s); diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c index a606c29ded..7c88555e0c 100644 --- a/libavcodec/videotoolbox.c +++ b/libavcodec/videotoolbox.c @@ -415,6 +415,7 @@ CFDataRef ff_videotoolbox_hvcc_extradata_create(AVCodecContext *avctx) } int ff_videotoolbox_h264_start_frame(AVCodecContext *avctx, + const AVBufferRef *buffer_ref, const uint8_t *buffer, uint32_t size) { @@ -1084,6 +1085,7 @@ static int videotoolbox_h264_end_frame(AVCodecContext *avctx) } static int videotoolbox_hevc_start_frame(AVCodecContext *avctx, + const AVBufferRef *buffer_ref, const uint8_t *buffer, uint32_t size) { @@ -1127,6 +1129,7 @@ static int videotoolbox_hevc_end_frame(AVCodecContext *avctx) } static int videotoolbox_mpeg_start_frame(AVCodecContext *avctx, + const AVBufferRef *buffer_ref, const uint8_t *buffer, uint32_t size) { @@ -1151,8 +1154,9 @@ static int videotoolbox_mpeg_end_frame(AVCodecContext *avctx) } static int videotoolbox_prores_start_frame(AVCodecContext *avctx, - const uint8_t *buffer, - uint32_t size) + const AVBufferRef *buffer_ref, + const uint8_t *buffer, + uint32_t size) { return 0; } diff --git a/libavcodec/videotoolbox_av1.c b/libavcodec/videotoolbox_av1.c index b4d39194d5..e69ef8f028 100644 --- a/libavcodec/videotoolbox_av1.c +++ b/libavcodec/videotoolbox_av1.c @@ -63,6 +63,7 @@ CFDataRef ff_videotoolbox_av1c_extradata_create(AVCodecContext *avctx) static int videotoolbox_av1_start_frame(AVCodecContext *avctx, + const AVBufferRef *buffer_ref, const uint8_t *buffer, uint32_t size) { diff --git a/libavcodec/videotoolbox_vp9.c b/libavcodec/videotoolbox_vp9.c index da94ff4e54..de7fc0c935 100644 --- a/libavcodec/videotoolbox_vp9.c +++ b/libavcodec/videotoolbox_vp9.c @@ -104,6 +104,7 @@ CFDataRef ff_videotoolbox_vpcc_extradata_create(AVCodecContext *avctx) } static int videotoolbox_vp9_start_frame(AVCodecContext *avctx, + const AVBufferRef *buffer_ref, const uint8_t *buffer, uint32_t size) { diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index 348744efd6..c42170519f 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -2729,7 +2729,7 @@ int vp78_decode_frame(AVCodecContext *avctx, AVFrame *rframe, int *got_frame, if (!is_vp7 && avctx->hwaccel) { const FFHWAccel *hwaccel = ffhwaccel(avctx->hwaccel); - ret = hwaccel->start_frame(avctx, avpkt->data, avpkt->size); + ret = hwaccel->start_frame(avctx, avpkt->buf, avpkt->data, avpkt->size); if (ret < 0) goto err; diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c index 83cd8a1565..fd416eed3a 100644 --- a/libavcodec/vp9.c +++ b/libavcodec/vp9.c @@ -1618,7 +1618,7 @@ static int vp9_decode_frame(AVCodecContext *avctx, AVFrame *frame, if (avctx->hwaccel) { const FFHWAccel *hwaccel = ffhwaccel(avctx->hwaccel); - ret = hwaccel->start_frame(avctx, NULL, 0); + ret = hwaccel->start_frame(avctx, pkt->buf, pkt->data, pkt->size); if (ret < 0) return ret; ret = hwaccel->decode_slice(avctx, pkt->data, pkt->size); diff --git a/libavcodec/vt_internal.h b/libavcodec/vt_internal.h index effa96fc15..b1eb07310a 100644 --- a/libavcodec/vt_internal.h +++ b/libavcodec/vt_internal.h @@ -61,6 +61,7 @@ int ff_videotoolbox_buffer_append(VTContext *vtctx, uint32_t size); int ff_videotoolbox_uninit(AVCodecContext *avctx); int ff_videotoolbox_h264_start_frame(AVCodecContext *avctx, + const AVBufferRef *buffer_ref, const uint8_t *buffer, uint32_t size); int ff_videotoolbox_h264_decode_slice(AVCodecContext *avctx, diff --git a/libavcodec/vulkan_av1.c b/libavcodec/vulkan_av1.c index 4b49723928..ccb88004b5 100644 --- a/libavcodec/vulkan_av1.c +++ b/libavcodec/vulkan_av1.c @@ -245,6 +245,7 @@ static int vk_av1_create_params(AVCodecContext *avctx, AVBufferRef **buf, } static int vk_av1_start_frame(AVCodecContext *avctx, + av_unused const AVBufferRef *buffer_ref, av_unused const uint8_t *buffer, av_unused uint32_t size) { diff --git a/libavcodec/vulkan_h264.c b/libavcodec/vulkan_h264.c index dc8b542e01..73aaed7f6a 100644 --- a/libavcodec/vulkan_h264.c +++ b/libavcodec/vulkan_h264.c @@ -359,6 +359,7 @@ static int vk_h264_create_params(AVCodecContext *avctx, AVBufferRef **buf) } static int vk_h264_start_frame(AVCodecContext *avctx, + av_unused const AVBufferRef *buffer_ref, av_unused const uint8_t *buffer, av_unused uint32_t size) { diff --git a/libavcodec/vulkan_hevc.c b/libavcodec/vulkan_hevc.c index ca2db20ca5..e4a946ae0d 100644 --- a/libavcodec/vulkan_hevc.c +++ b/libavcodec/vulkan_hevc.c @@ -709,6 +709,7 @@ static int vk_hevc_create_params(AVCodecContext *avctx, AVBufferRef **buf) } static int vk_hevc_start_frame(AVCodecContext *avctx, + av_unused const AVBufferRef *buffer_ref, av_unused const uint8_t *buffer, av_unused uint32_t size) { diff --git a/libavcodec/vvc/dec.c b/libavcodec/vvc/dec.c index f860e116ab..0b6443a112 100644 --- a/libavcodec/vvc/dec.c +++ b/libavcodec/vvc/dec.c @@ -831,7 +831,8 @@ static int frame_setup(VVCFrameContext *fc, VVCContext *s) return 0; } -static int decode_slice(VVCContext *s, VVCFrameContext *fc, const H2645NAL *nal, const CodedBitstreamUnit *unit) +static int decode_slice(VVCContext *s, VVCFrameContext *fc, AVBufferRef *buf_ref, + const H2645NAL *nal, const CodedBitstreamUnit *unit) { int ret; SliceContext *sc; @@ -860,7 +861,7 @@ static int decode_slice(VVCContext *s, VVCFrameContext *fc, const H2645NAL *nal, if (s->avctx->hwaccel) { if (is_first_slice) { - ret = FF_HW_CALL(s->avctx, start_frame, NULL, 0); + ret = FF_HW_CALL(s->avctx, start_frame, buf_ref, NULL, 0); if (ret < 0) return ret; } @@ -876,7 +877,8 @@ static int decode_slice(VVCContext *s, VVCFrameContext *fc, const H2645NAL *nal, return 0; } -static int decode_nal_unit(VVCContext *s, VVCFrameContext *fc, const H2645NAL *nal, const CodedBitstreamUnit *unit) +static int decode_nal_unit(VVCContext *s, VVCFrameContext *fc, AVBufferRef *buf_ref, + const H2645NAL *nal, const CodedBitstreamUnit *unit) { int ret; @@ -902,7 +904,7 @@ static int decode_nal_unit(VVCContext *s, VVCFrameContext *fc, const H2645NAL *n case VVC_IDR_N_LP: case VVC_CRA_NUT: case VVC_GDR_NUT: - ret = decode_slice(s, fc, nal, unit); + ret = decode_slice(s, fc, buf_ref, nal, unit); if (ret < 0) return ret; break; @@ -940,7 +942,7 @@ static int decode_nal_units(VVCContext *s, VVCFrameContext *fc, AVPacket *avpkt) if (unit->type == VVC_EOB_NUT || unit->type == VVC_EOS_NUT) { s->last_eos = 1; } else { - ret = decode_nal_unit(s, fc, nal, unit); + ret = decode_nal_unit(s, fc, avpkt->buf, nal, unit); if (ret < 0) { av_log(s->avctx, AV_LOG_WARNING, "Error parsing NAL unit #%d.\n", i); _______________________________________________ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".