History

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.

Lynne committed 1 year ago

Commit caff29d1 parent 23eb49958 files · +123 −42Browse files

Unified · Split

58 files
  1. libavcodec/av1dec.c +2 −1
  2. libavcodec/d3d12va_av1.c +4 −1
  3. libavcodec/d3d12va_h264.c +3 −2
  4. libavcodec/d3d12va_hevc.c +4 −1
  5. libavcodec/d3d12va_mpeg2.c +4 −1
  6. libavcodec/d3d12va_vc1.c +4 −1
  7. libavcodec/d3d12va_vp9.c +4 −1
  8. libavcodec/dxva2_av1.c +1 −0
  9. libavcodec/dxva2_h264.c +1 −0
  10. libavcodec/dxva2_hevc.c +1 −0
  11. libavcodec/dxva2_mpeg2.c +1 −0
  12. libavcodec/dxva2_vc1.c +1 −0
  13. libavcodec/dxva2_vp9.c +1 −0
  14. libavcodec/ffv1dec.c +1 −1
  15. libavcodec/h263dec.c +1 −1
  16. libavcodec/h264dec.c +5 −3
  17. libavcodec/hevc/hevcdec.c +4 −1
  18. libavcodec/hwaccel_internal.h +3 −1
  19. libavcodec/mjpegdec.c +1 −1
  20. libavcodec/mpeg12dec.c +1 −1
  21. libavcodec/nvdec_av1.c +3 −1
  22. libavcodec/nvdec_h264.c +1 −0
  23. libavcodec/nvdec_hevc.c +1 −0
  24. libavcodec/nvdec_mjpeg.c +3 −1
  25. libavcodec/nvdec_mpeg12.c +3 −1
  26. libavcodec/nvdec_mpeg4.c +3 −1
  27. libavcodec/nvdec_vc1.c +3 −1
  28. libavcodec/nvdec_vp8.c +3 −1
  29. libavcodec/nvdec_vp9.c +3 −1
  30. libavcodec/proresdec.c +1 −1
  31. libavcodec/vaapi_av1.c +1 −0
  32. libavcodec/vaapi_h264.c +1 −0
  33. libavcodec/vaapi_hevc.c +1 −0
  34. libavcodec/vaapi_mjpeg.c +1 −0
  35. libavcodec/vaapi_mpeg2.c +4 −1
  36. libavcodec/vaapi_mpeg4.c +4 −1
  37. libavcodec/vaapi_vc1.c +4 −1
  38. libavcodec/vaapi_vp8.c +1 −0
  39. libavcodec/vaapi_vp9.c +1 −0
  40. libavcodec/vaapi_vvc.c +1 −0
  41. libavcodec/vc1dec.c +3 −3
  42. libavcodec/vdpau_av1.c +2 −1
  43. libavcodec/vdpau_h264.c +1 −0
  44. libavcodec/vdpau_hevc.c +1 −0
  45. libavcodec/vdpau_mpeg12.c +1 −0
  46. libavcodec/vdpau_mpeg4.c +1 −0
  47. libavcodec/vdpau_vc1.c +1 −0
  48. libavcodec/vdpau_vp9.c +2 −1
  49. libavcodec/videotoolbox.c +6 −2
  50. libavcodec/videotoolbox_av1.c +1 −0
  51. libavcodec/videotoolbox_vp9.c +1 −0
  52. libavcodec/vp8.c +1 −1
  53. libavcodec/vp9.c +1 −1
  54. libavcodec/vt_internal.h +1 −0
  55. libavcodec/vulkan_av1.c +1 −0
  56. libavcodec/vulkan_h264.c +1 −0
  57. libavcodec/vulkan_hevc.c +1 −0
  58. libavcodec/vvc/dec.c +7 −5
libavcodec/av1dec.c+2−1
@@ -1389,7 +1389,8 @@ static int av1_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame) · 1388 unmodified lines
13891389 s->cur_frame.temporal_id = header->temporal_id;
13901390
13911391 if (avctx->hwaccel && s->cur_frame.f) {
1392− ret = FF_HW_CALL(avctx, start_frame, unit->data, unit->data_size);
1392+ ret = FF_HW_CALL(avctx, start_frame, s->pkt->buf,
1393+ unit->data, unit->data_size);
13931394 if (ret < 0) {
13941395 av_log(avctx, AV_LOG_ERROR, "HW accel start frame fail.\n");
13951396 goto end;
libavcodec/d3d12va_av1.c+4−1
@@ -45,7 +45,10 @@ typedef struct AV1DecodePictureContext { · 44 unmodified lines
4545 unsigned bitstream_size;
4646 } AV1DecodePictureContext;
4747
48−static int d3d12va_av1_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
48+static int d3d12va_av1_start_frame(AVCodecContext *avctx,
49+ av_unused const AVBufferRef *buffer_ref,
50+ av_unused const uint8_t *buffer,
51+ av_unused uint32_t size)
4952 {
5053 const AV1DecContext *h = avctx->priv_data;
5154 AV1DecodePictureContext *ctx_pic = h->cur_frame.hwaccel_picture_private;
libavcodec/d3d12va_h264.c+3−2
@@ -50,8 +50,9 @@ static void fill_slice_short(DXVA_Slice_H264_Short *slice, · 49 unmodified lines
5050 }
5151
5252 static int d3d12va_h264_start_frame(AVCodecContext *avctx,
53− av_unused const uint8_t *buffer,
54− av_unused uint32_t size)
53+ av_unused const AVBufferRef *buffer_ref,
54+ av_unused const uint8_t *buffer,
55+ av_unused uint32_t size)
5556 {
5657 const H264Context *h = avctx->priv_data;
5758 H264DecodePictureContext *ctx_pic = h->cur_pic_ptr->hwaccel_picture_private;
libavcodec/d3d12va_hevc.c+4−1
@@ -49,7 +49,10 @@ static void fill_slice_short(DXVA_Slice_HEVC_Short *slice, unsigned position, un · 48 unmodified lines
4949 slice->wBadSliceChopping = 0;
5050 }
5151
52−static int d3d12va_hevc_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
52+static int d3d12va_hevc_start_frame(AVCodecContext *avctx,
53+ av_unused const AVBufferRef *buffer_ref,
54+ av_unused const uint8_t *buffer,
55+ av_unused uint32_t size)
5356 {
5457 const HEVCContext *h = avctx->priv_data;
5558 D3D12VADecodeContext *ctx = D3D12VA_DECODE_CONTEXT(avctx);
libavcodec/d3d12va_mpeg2.c+4−1
@@ -40,7 +40,10 @@ typedef struct D3D12DecodePictureContext { · 39 unmodified lines
4040 unsigned bitstream_size;
4141 } D3D12DecodePictureContext;
4242
43−static int d3d12va_mpeg2_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
43+static int d3d12va_mpeg2_start_frame(AVCodecContext *avctx,
44+ av_unused const AVBufferRef *buffer_ref,
45+ av_unused const uint8_t *buffer,
46+ av_unused uint32_t size)
4447 {
4548 const MpegEncContext *s = avctx->priv_data;
4649 D3D12VADecodeContext *ctx = D3D12VA_DECODE_CONTEXT(avctx);
libavcodec/d3d12va_vc1.c+4−1
@@ -41,7 +41,10 @@ typedef struct D3D12DecodePictureContext { · 40 unmodified lines
4141 unsigned bitstream_size;
4242 } D3D12DecodePictureContext;
4343
44−static int d3d12va_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
44+static int d3d12va_vc1_start_frame(AVCodecContext *avctx,
45+ av_unused const AVBufferRef *buffer_ref,
46+ av_unused const uint8_t *buffer,
47+ av_unused uint32_t size)
4548 {
4649 const VC1Context *v = avctx->priv_data;
4750 D3D12VADecodeContext *ctx = D3D12VA_DECODE_CONTEXT(avctx);
libavcodec/d3d12va_vp9.c+4−1
@@ -45,7 +45,10 @@ static void fill_slice_short(DXVA_Slice_VPx_Short *slice, unsigned position, uns · 44 unmodified lines
4545 slice->wBadSliceChopping = 0;
4646 }
4747
48−static int d3d12va_vp9_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
48+static int d3d12va_vp9_start_frame(AVCodecContext *avctx,
49+ av_unused const AVBufferRef *buffer_ref,
50+ av_unused const uint8_t *buffer,
51+ av_unused uint32_t size)
4952 {
5053 const VP9SharedContext *h = avctx->priv_data;
5154 D3D12VADecodeContext *ctx = D3D12VA_DECODE_CONTEXT(avctx);
libavcodec/dxva2_av1.c+1−0
@@ -272,6 +272,7 @@ int ff_dxva2_av1_fill_picture_parameters(const AVCodecContext *avctx, AVDXVACont · 271 unmodified lines
272272 }
273273
274274 static int dxva2_av1_start_frame(AVCodecContext *avctx,
275+ av_unused const AVBufferRef *buffer_ref,
275276 av_unused const uint8_t *buffer,
276277 av_unused uint32_t size)
277278 {
libavcodec/dxva2_h264.c+1−0
@@ -444,6 +444,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx, · 443 unmodified lines
444444
445445
446446 static int dxva2_h264_start_frame(AVCodecContext *avctx,
447+ av_unused const AVBufferRef *buffer_ref,
447448 av_unused const uint8_t *buffer,
448449 av_unused uint32_t size)
449450 {
libavcodec/dxva2_hevc.c+1−0
@@ -363,6 +363,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx, · 362 unmodified lines
363363
364364
365365 static int dxva2_hevc_start_frame(AVCodecContext *avctx,
366+ av_unused const AVBufferRef *buffer_ref,
366367 av_unused const uint8_t *buffer,
367368 av_unused uint32_t size)
368369 {
libavcodec/dxva2_mpeg2.c+1−0
@@ -257,6 +257,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx, · 256 unmodified lines
257257 }
258258
259259 static int dxva2_mpeg2_start_frame(AVCodecContext *avctx,
260+ av_unused const AVBufferRef *buffer_ref,
260261 av_unused const uint8_t *buffer,
261262 av_unused uint32_t size)
262263 {
libavcodec/dxva2_vc1.c+1−0
@@ -315,6 +315,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx, · 314 unmodified lines
315315 }
316316
317317 static int dxva2_vc1_start_frame(AVCodecContext *avctx,
318+ av_unused const AVBufferRef *buffer_ref,
318319 av_unused const uint8_t *buffer,
319320 av_unused uint32_t size)
320321 {
libavcodec/dxva2_vp9.c+1−0
@@ -254,6 +254,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx, · 253 unmodified lines
254254
255255
256256 static int dxva2_vp9_start_frame(AVCodecContext *avctx,
257+ av_unused const AVBufferRef *buffer_ref,
257258 av_unused const uint8_t *buffer,
258259 av_unused uint32_t size)
259260 {
libavcodec/ffv1dec.c+1−1
@@ -742,7 +742,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe, · 741 unmodified lines
742742
743743 /* Start */
744744 if (hwaccel) {
745− ret = hwaccel->start_frame(avctx, avpkt->data, avpkt->size);
745+ ret = hwaccel->start_frame(avctx, avpkt->buf, avpkt->data, avpkt->size);
746746 if (ret < 0)
747747 return ret;
748748 }
libavcodec/h263dec.c+1−1
@@ -561,7 +561,7 @@ retry: · 560 unmodified lines
561561 ff_thread_finish_setup(avctx);
562562
563563 if (avctx->hwaccel) {
564− ret = FF_HW_CALL(avctx, start_frame,
564+ ret = FF_HW_CALL(avctx, start_frame, NULL,
565565 s->gb.buffer, s->gb.buffer_end - s->gb.buffer);
566566 if (ret < 0 )
567567 return ret;
libavcodec/h264dec.c+5−3
@@ -587,7 +587,8 @@ static void debug_green_metadata(const H264SEIGreenMetaData *gm, void *logctx) · 586 unmodified lines
587587 }
588588 }
589589
590−static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size)
590+static int decode_nal_units(H264Context *h, AVBufferRef *buf_ref,
591+ const uint8_t *buf, int buf_size)
591592 {
592593 AVCodecContext *const avctx = h->avctx;
593594 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) · 74 unmodified lines
668669 }
669670
670671 if (h->avctx->hwaccel &&
671− (ret = FF_HW_CALL(h->avctx, start_frame, buf, buf_size)) < 0)
672+ (ret = FF_HW_CALL(h->avctx, start_frame, buf_ref,
673+ buf, buf_size)) < 0)
672674 goto end;
673675 }
674676
@@ -1053,7 +1055,7 @@ static int h264_decode_frame(AVCodecContext *avctx, AVFrame *pict, · 378 unmodified lines
10531055 avctx->err_recognition, avctx);
10541056 }
10551057
1056− buf_index = decode_nal_units(h, buf, buf_size);
1058+ buf_index = decode_nal_units(h, avpkt->buf, buf, buf_size);
10571059 if (buf_index < 0)
10581060 return AVERROR_INVALIDDATA;
10591061
libavcodec/hevc/hevcdec.c+4−1
@@ -3401,7 +3401,10 @@ static int hevc_frame_start(HEVCContext *s, HEVCLayerContext *l, · 3400 unmodified lines
34013401 goto fail;
34023402
34033403 if (s->avctx->hwaccel) {
3404− ret = FF_HW_CALL(s->avctx, start_frame, NULL, 0);
3404+ AVCodecInternal *avci = s->avctx->internal;
3405+ AVPacket *avpkt = avci->in_pkt;
3406+ ret = FF_HW_CALL(s->avctx, start_frame,
3407+ avpkt->buf, NULL, 0);
34053408 if (ret < 0)
34063409 goto fail;
34073410 }
libavcodec/hwaccel_internal.h+3−1
@@ -52,11 +52,13 @@ typedef struct FFHWAccel { · 51 unmodified lines
5252 * Otherwise, this means the whole frame is available at this point.
5353 *
5454 * @param avctx the codec context
55+ * @param buf_ref the frame data buffer reference (optional)
5556 * @param buf the frame data buffer base
5657 * @param buf_size the size of the frame in bytes
5758 * @return zero if successful, a negative value otherwise
5859 */
59− int (*start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size);
60+ int (*start_frame)(AVCodecContext *avctx, const AVBufferRef *buf_ref,
61+ const uint8_t *buf, uint32_t buf_size);
6062
6163 /**
6264 * Callback for parameter data (SPS/PPS/VPS etc).
libavcodec/mjpegdec.c+1−1
@@ -808,7 +808,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s) · 807 unmodified lines
808808 if (!s->hwaccel_picture_private)
809809 return AVERROR(ENOMEM);
810810
811− ret = hwaccel->start_frame(s->avctx, s->raw_image_buffer,
811+ ret = hwaccel->start_frame(s->avctx, NULL, s->raw_image_buffer,
812812 s->raw_image_buffer_size);
813813 if (ret < 0)
814814 return ret;
libavcodec/mpeg12dec.c+1−1
@@ -1361,7 +1361,7 @@ static int mpeg_field_start(Mpeg1Context *s1, const uint8_t *buf, int buf_size) · 1360 unmodified lines
13611361 }
13621362
13631363 if (avctx->hwaccel) {
1364− if ((ret = FF_HW_CALL(avctx, start_frame, buf, buf_size)) < 0)
1364+ if ((ret = FF_HW_CALL(avctx, start_frame, NULL, buf, buf_size)) < 0)
13651365 return ret;
13661366 } else if (s->codec_tag == MKTAG('V', 'C', 'R', '2')) {
13671367 // Exchange UV
libavcodec/nvdec_av1.c+3−1
@@ -39,7 +39,9 @@ static int get_bit_depth_from_seq(const AV1RawSequenceHeader *seq) · 38 unmodified lines
3939 return 8;
4040 }
4141
42−static int nvdec_av1_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
42+static int nvdec_av1_start_frame(AVCodecContext *avctx,
43+ const AVBufferRef *buffer_ref,
44+ const uint8_t *buffer, uint32_t size)
4345 {
4446 const AV1DecContext *s = avctx->priv_data;
4547 const AV1RawSequenceHeader *seq = s->raw_seq;
libavcodec/nvdec_h264.c+1−0
@@ -47,6 +47,7 @@ static void dpb_add(const H264Context *h, CUVIDH264DPBENTRY *dst, const H264Pict · 46 unmodified lines
4747 }
4848
4949 static int nvdec_h264_start_frame(AVCodecContext *avctx,
50+ const AVBufferRef *buffer_ref,
5051 const uint8_t *buffer, uint32_t size)
5152 {
5253 const H264Context *h = avctx->priv_data;
libavcodec/nvdec_hevc.c+1−0
@@ -70,6 +70,7 @@ static void fill_scaling_lists(CUVIDHEVCPICPARAMS *ppc, const HEVCContext *s) · 69 unmodified lines
7070 }
7171
7272 static int nvdec_hevc_start_frame(AVCodecContext *avctx,
73+ const AVBufferRef *buffer_ref,
7374 const uint8_t *buffer, uint32_t size)
7475 {
7576 const HEVCContext *s = avctx->priv_data;
libavcodec/nvdec_mjpeg.c+3−1
@@ -27,7 +27,9 @@ · 26 unmodified lines
2727 #include "decode.h"
2828 #include "hwaccel_internal.h"
2929
30−static int nvdec_mjpeg_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
30+static int nvdec_mjpeg_start_frame(AVCodecContext *avctx,
31+ const AVBufferRef *buffer_ref,
32+ const uint8_t *buffer, uint32_t size)
3133 {
3234 MJpegDecodeContext *s = avctx->priv_data;
3335
libavcodec/nvdec_mpeg12.c+3−1
@@ -30,7 +30,9 @@ · 29 unmodified lines
3030 #include "nvdec.h"
3131 #include "decode.h"
3232
33−static int nvdec_mpeg12_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
33+static int nvdec_mpeg12_start_frame(AVCodecContext *avctx,
34+ const AVBufferRef *buffer_ref,
35+ const uint8_t *buffer, uint32_t size)
3436 {
3537 MpegEncContext *s = avctx->priv_data;
3638
libavcodec/nvdec_mpeg4.c+3−1
@@ -28,7 +28,9 @@ · 27 unmodified lines
2828 #include "decode.h"
2929 #include "hwaccel_internal.h"
3030
31−static int nvdec_mpeg4_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
31+static int nvdec_mpeg4_start_frame(AVCodecContext *avctx,
32+ const AVBufferRef *buffer_ref,
33+ const uint8_t *buffer, uint32_t size)
3234 {
3335 Mpeg4DecContext *m = avctx->priv_data;
3436 MpegEncContext *s = &m->m;
libavcodec/nvdec_vc1.c+3−1
@@ -29,7 +29,9 @@ · 28 unmodified lines
2929 #include "decode.h"
3030 #include "vc1.h"
3131
32−static int nvdec_vc1_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
32+static int nvdec_vc1_start_frame(AVCodecContext *avctx,
33+ const AVBufferRef *buffer_ref,
34+ const uint8_t *buffer, uint32_t size)
3335 {
3436 VC1Context *v = avctx->priv_data;
3537 MpegEncContext *s = &v->s;
libavcodec/nvdec_vp8.c+3−1
@@ -32,7 +32,9 @@ static unsigned char safe_get_ref_idx(VP8Frame *frame) · 31 unmodified lines
3232 return frame ? ff_nvdec_get_ref_idx(frame->tf.f) : 255;
3333 }
3434
35−static int nvdec_vp8_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
35+static int nvdec_vp8_start_frame(AVCodecContext *avctx,
36+ const AVBufferRef *buffer_ref,
37+ const uint8_t *buffer, uint32_t size)
3638 {
3739 VP8Context *h = avctx->priv_data;
3840
libavcodec/nvdec_vp9.c+3−1
@@ -29,7 +29,9 @@ · 28 unmodified lines
2929 #include "internal.h"
3030 #include "vp9shared.h"
3131
32−static int nvdec_vp9_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
32+static int nvdec_vp9_start_frame(AVCodecContext *avctx,
33+ const AVBufferRef *buffer_ref,
34+ const uint8_t *buffer, uint32_t size)
3335 {
3436 VP9SharedContext *h = avctx->priv_data;
3537 const AVPixFmtDescriptor *pixdesc = av_pix_fmt_desc_get(avctx->sw_pix_fmt);
libavcodec/proresdec.c+1−1
@@ -793,7 +793,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame, · 792 unmodified lines
793793
794794 if (HWACCEL_MAX && avctx->hwaccel) {
795795 const FFHWAccel *hwaccel = ffhwaccel(avctx->hwaccel);
796− ret = hwaccel->start_frame(avctx, NULL, 0);
796+ ret = hwaccel->start_frame(avctx, avpkt->buf, avpkt->data, avpkt->size);
797797 if (ret < 0)
798798 return ret;
799799 ret = hwaccel->decode_slice(avctx, avpkt->data, avpkt->size);
libavcodec/vaapi_av1.c+1−0
@@ -108,6 +108,7 @@ static av_cold int vaapi_av1_decode_uninit(AVCodecContext *avctx) · 107 unmodified lines
108108
109109
110110 static int vaapi_av1_start_frame(AVCodecContext *avctx,
111+ av_unused const AVBufferRef *buffer_ref,
111112 av_unused const uint8_t *buffer,
112113 av_unused uint32_t size)
113114 {
libavcodec/vaapi_h264.c+1−0
@@ -232,6 +232,7 @@ static void fill_vaapi_plain_pred_weight_table(const H264Context *h, · 231 unmodified lines
232232
233233 /** Initialize and start decoding a frame with VA API. */
234234 static int vaapi_h264_start_frame(AVCodecContext *avctx,
235+ av_unused const AVBufferRef *buffer_ref,
235236 av_unused const uint8_t *buffer,
236237 av_unused uint32_t size)
237238 {
libavcodec/vaapi_hevc.c+1−0
@@ -122,6 +122,7 @@ static void fill_vaapi_reference_frames(const HEVCContext *h, const HEVCLayerCon · 121 unmodified lines
122122 }
123123
124124 static int vaapi_hevc_start_frame(AVCodecContext *avctx,
125+ av_unused const AVBufferRef *buffer_ref,
125126 av_unused const uint8_t *buffer,
126127 av_unused uint32_t size)
127128 {
libavcodec/vaapi_mjpeg.c+1−0
@@ -24,6 +24,7 @@ · 23 unmodified lines
2424 #include "mjpegdec.h"
2525
2626 static int vaapi_mjpeg_start_frame(AVCodecContext *avctx,
27+ av_unused const AVBufferRef *buffer_ref,
2728 av_unused const uint8_t *buffer,
2829 av_unused uint32_t size)
2930 {
libavcodec/vaapi_mpeg2.c+4−1
@@ -39,7 +39,10 @@ static inline int mpeg2_get_is_frame_start(const MpegEncContext *s) · 38 unmodified lines
3939 return s->first_field || s->picture_structure == PICT_FRAME;
4040 }
4141
42−static int vaapi_mpeg2_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
42+static int vaapi_mpeg2_start_frame(AVCodecContext *avctx,
43+ av_unused const AVBufferRef *buffer_ref,
44+ av_unused const uint8_t *buffer,
45+ av_unused uint32_t size)
4346 {
4447 const MpegEncContext *s = avctx->priv_data;
4548 VAAPIDecodePicture *pic = s->cur_pic.ptr->hwaccel_picture_private;
libavcodec/vaapi_mpeg4.c+4−1
@@ -45,7 +45,10 @@ static int mpeg4_get_intra_dc_vlc_thr(Mpeg4DecContext *s) · 44 unmodified lines
4545 return 0;
4646 }
4747
48−static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
48+static int vaapi_mpeg4_start_frame(AVCodecContext *avctx,
49+ av_unused const AVBufferRef *buffer_ref,
50+ av_unused const uint8_t *buffer,
51+ av_unused uint32_t size)
4952 {
5053 Mpeg4DecContext *ctx = avctx->priv_data;
5154 MpegEncContext *s = &ctx->m;
libavcodec/vaapi_vc1.c+4−1
@@ -249,7 +249,10 @@ static inline void vc1_pack_bitplanes(uint8_t *bitplane, int n, const uint8_t *f · 248 unmodified lines
249249 bitplane[bitplane_index] = (bitplane[bitplane_index] << 4) | v;
250250 }
251251
252−static int vaapi_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
252+static int vaapi_vc1_start_frame(AVCodecContext *avctx,
253+ av_unused const AVBufferRef *buffer_ref,
254+ av_unused const uint8_t *buffer,
255+ av_unused uint32_t size)
253256 {
254257 const VC1Context *v = avctx->priv_data;
255258 const MpegEncContext *s = &v->s;
libavcodec/vaapi_vp8.c+1−0
@@ -32,6 +32,7 @@ static VASurfaceID vaapi_vp8_surface_id(VP8Frame *vf) · 31 unmodified lines
3232 }
3333
3434 static int vaapi_vp8_start_frame(AVCodecContext *avctx,
35+ av_unused const AVBufferRef *buffer_ref,
3536 av_unused const uint8_t *buffer,
3637 av_unused uint32_t size)
3738 {
libavcodec/vaapi_vp9.c+1−0
@@ -35,6 +35,7 @@ static VASurfaceID vaapi_vp9_surface_id(const VP9Frame *vf) · 34 unmodified lines
3535 }
3636
3737 static int vaapi_vp9_start_frame(AVCodecContext *avctx,
38+ av_unused const AVBufferRef *buffer_ref,
3839 av_unused const uint8_t *buffer,
3940 av_unused uint32_t size)
4041 {
libavcodec/vaapi_vvc.c+1−0
@@ -80,6 +80,7 @@ static void fill_vaapi_reference_frames(const VVCFrameContext *h, VAPictureParam · 79 unmodified lines
8080 }
8181
8282 static int vaapi_vvc_start_frame(AVCodecContext *avctx,
83+ av_unused const AVBufferRef *buffer_ref,
8384 av_unused const uint8_t *buffer,
8485 av_unused uint32_t size)
8586 {
libavcodec/vc1dec.c+3−3
@@ -1087,7 +1087,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict, · 1086 unmodified lines
10871087 if (v->field_mode && buf_start_second_field) {
10881088 // decode first field
10891089 s->picture_structure = PICT_BOTTOM_FIELD - v->tff;
1090− ret = hwaccel->start_frame(avctx, buf_start,
1090+ ret = hwaccel->start_frame(avctx, avpkt->buf, buf_start,
10911091 buf_start_second_field - buf_start);
10921092 if (ret < 0)
10931093 goto err;
@@ -1142,7 +1142,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict, · 48 unmodified lines
11421142 }
11431143 v->s.cur_pic.ptr->f->pict_type = v->s.pict_type;
11441144
1145− ret = hwaccel->start_frame(avctx, buf_start_second_field,
1145+ ret = hwaccel->start_frame(avctx, avpkt->buf, buf_start_second_field,
11461146 (buf + buf_size) - buf_start_second_field);
11471147 if (ret < 0)
11481148 goto err;
@@ -1185,7 +1185,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict, · 36 unmodified lines
11851185 goto err;
11861186 } else {
11871187 s->picture_structure = PICT_FRAME;
1188− ret = hwaccel->start_frame(avctx, buf_start,
1188+ ret = hwaccel->start_frame(avctx, avpkt->buf, buf_start,
11891189 (buf + buf_size) - buf_start);
11901190 if (ret < 0)
11911191 goto err;
libavcodec/vdpau_av1.c+2−1
@@ -41,7 +41,8 @@ static int get_bit_depth_from_seq(const AV1RawSequenceHeader *seq) · 40 unmodified lines
4141 }
4242
4343 static int vdpau_av1_start_frame(AVCodecContext *avctx,
44− const uint8_t *buffer, uint32_t size)
44+ const AVBufferRef *buffer_ref,
45+ const uint8_t *buffer, uint32_t size)
4546 {
4647 AV1DecContext *s = avctx->priv_data;
4748 const AV1RawSequenceHeader *seq = s->raw_seq;
libavcodec/vdpau_h264.c+1−0
@@ -118,6 +118,7 @@ static void vdpau_h264_set_reference_frames(AVCodecContext *avctx) · 117 unmodified lines
118118 }
119119
120120 static int vdpau_h264_start_frame(AVCodecContext *avctx,
121+ const AVBufferRef *buffer_ref,
121122 const uint8_t *buffer, uint32_t size)
122123 {
123124 H264Context * const h = avctx->priv_data;
libavcodec/vdpau_hevc.c+1−0
@@ -32,6 +32,7 @@ · 31 unmodified lines
3232
3333
3434 static int vdpau_hevc_start_frame(AVCodecContext *avctx,
35+ const AVBufferRef *buffer_ref,
3536 const uint8_t *buffer, uint32_t size)
3637 {
3738 HEVCContext *h = avctx->priv_data;
libavcodec/vdpau_mpeg12.c+1−0
@@ -32,6 +32,7 @@ · 31 unmodified lines
3232 #include "vdpau_internal.h"
3333
3434 static int vdpau_mpeg_start_frame(AVCodecContext *avctx,
35+ const AVBufferRef *buffer_ref,
3536 const uint8_t *buffer, uint32_t size)
3637 {
3738 MpegEncContext * const s = avctx->priv_data;
libavcodec/vdpau_mpeg4.c+1−0
@@ -30,6 +30,7 @@ · 29 unmodified lines
3030 #include "vdpau_internal.h"
3131
3232 static int vdpau_mpeg4_start_frame(AVCodecContext *avctx,
33+ const AVBufferRef *buffer_ref,
3334 const uint8_t *buffer, uint32_t size)
3435 {
3536 Mpeg4DecContext *ctx = avctx->priv_data;
libavcodec/vdpau_vc1.c+1−0
@@ -32,6 +32,7 @@ · 31 unmodified lines
3232 #include "vdpau_internal.h"
3333
3434 static int vdpau_vc1_start_frame(AVCodecContext *avctx,
35+ const AVBufferRef *buffer_ref,
3536 const uint8_t *buffer, uint32_t size)
3637 {
3738 VC1Context * const v = avctx->priv_data;
libavcodec/vdpau_vp9.c+2−1
@@ -29,7 +29,8 @@ · 28 unmodified lines
2929 #include "vdpau_internal.h"
3030
3131 static int vdpau_vp9_start_frame(AVCodecContext *avctx,
32− const uint8_t *buffer, uint32_t size)
32+ const AVBufferRef *buffer_ref,
33+ const uint8_t *buffer, uint32_t size)
3334 {
3435 VP9Context *s = avctx->priv_data;
3536 VP9SharedContext *h = &(s->s);
libavcodec/videotoolbox.c+6−2
@@ -415,6 +415,7 @@ CFDataRef ff_videotoolbox_hvcc_extradata_create(AVCodecContext *avctx) · 414 unmodified lines
415415 }
416416
417417 int ff_videotoolbox_h264_start_frame(AVCodecContext *avctx,
418+ const AVBufferRef *buffer_ref,
418419 const uint8_t *buffer,
419420 uint32_t size)
420421 {
@@ -1084,6 +1085,7 @@ static int videotoolbox_h264_end_frame(AVCodecContext *avctx) · 663 unmodified lines
10841085 }
10851086
10861087 static int videotoolbox_hevc_start_frame(AVCodecContext *avctx,
1088+ const AVBufferRef *buffer_ref,
10871089 const uint8_t *buffer,
10881090 uint32_t size)
10891091 {
@@ -1127,6 +1129,7 @@ static int videotoolbox_hevc_end_frame(AVCodecContext *avctx) · 37 unmodified lines
11271129 }
11281130
11291131 static int videotoolbox_mpeg_start_frame(AVCodecContext *avctx,
1132+ const AVBufferRef *buffer_ref,
11301133 const uint8_t *buffer,
11311134 uint32_t size)
11321135 {
@@ -1151,8 +1154,9 @@ static int videotoolbox_mpeg_end_frame(AVCodecContext *avctx) · 18 unmodified lines
11511154 }
11521155
11531156 static int videotoolbox_prores_start_frame(AVCodecContext *avctx,
1154− const uint8_t *buffer,
1155− uint32_t size)
1157+ const AVBufferRef *buffer_ref,
1158+ const uint8_t *buffer,
1159+ uint32_t size)
11561160 {
11571161 return 0;
11581162 }
libavcodec/videotoolbox_av1.c+1−0
@@ -63,6 +63,7 @@ CFDataRef ff_videotoolbox_av1c_extradata_create(AVCodecContext *avctx) · 62 unmodified lines
6363
6464
6565 static int videotoolbox_av1_start_frame(AVCodecContext *avctx,
66+ const AVBufferRef *buffer_ref,
6667 const uint8_t *buffer,
6768 uint32_t size)
6869 {
libavcodec/videotoolbox_vp9.c+1−0
@@ -104,6 +104,7 @@ CFDataRef ff_videotoolbox_vpcc_extradata_create(AVCodecContext *avctx) · 103 unmodified lines
104104 }
105105
106106 static int videotoolbox_vp9_start_frame(AVCodecContext *avctx,
107+ const AVBufferRef *buffer_ref,
107108 const uint8_t *buffer,
108109 uint32_t size)
109110 {
libavcodec/vp8.c+1−1
@@ -2729,7 +2729,7 @@ int vp78_decode_frame(AVCodecContext *avctx, AVFrame *rframe, int *got_frame, · 2728 unmodified lines
27292729
27302730 if (!is_vp7 && avctx->hwaccel) {
27312731 const FFHWAccel *hwaccel = ffhwaccel(avctx->hwaccel);
2732− ret = hwaccel->start_frame(avctx, avpkt->data, avpkt->size);
2732+ ret = hwaccel->start_frame(avctx, avpkt->buf, avpkt->data, avpkt->size);
27332733 if (ret < 0)
27342734 goto err;
27352735
libavcodec/vp9.c+1−1
@@ -1618,7 +1618,7 @@ static int vp9_decode_frame(AVCodecContext *avctx, AVFrame *frame, · 1617 unmodified lines
16181618
16191619 if (avctx->hwaccel) {
16201620 const FFHWAccel *hwaccel = ffhwaccel(avctx->hwaccel);
1621− ret = hwaccel->start_frame(avctx, NULL, 0);
1621+ ret = hwaccel->start_frame(avctx, pkt->buf, pkt->data, pkt->size);
16221622 if (ret < 0)
16231623 return ret;
16241624 ret = hwaccel->decode_slice(avctx, pkt->data, pkt->size);
libavcodec/vt_internal.h+1−0
@@ -61,6 +61,7 @@ int ff_videotoolbox_buffer_append(VTContext *vtctx, · 60 unmodified lines
6161 uint32_t size);
6262 int ff_videotoolbox_uninit(AVCodecContext *avctx);
6363 int ff_videotoolbox_h264_start_frame(AVCodecContext *avctx,
64+ const AVBufferRef *buffer_ref,
6465 const uint8_t *buffer,
6566 uint32_t size);
6667 int ff_videotoolbox_h264_decode_slice(AVCodecContext *avctx,
libavcodec/vulkan_av1.c+1−0
@@ -245,6 +245,7 @@ static int vk_av1_create_params(AVCodecContext *avctx, AVBufferRef **buf, · 244 unmodified lines
245245 }
246246
247247 static int vk_av1_start_frame(AVCodecContext *avctx,
248+ av_unused const AVBufferRef *buffer_ref,
248249 av_unused const uint8_t *buffer,
249250 av_unused uint32_t size)
250251 {
libavcodec/vulkan_h264.c+1−0
@@ -359,6 +359,7 @@ static int vk_h264_create_params(AVCodecContext *avctx, AVBufferRef **buf) · 358 unmodified lines
359359 }
360360
361361 static int vk_h264_start_frame(AVCodecContext *avctx,
362+ av_unused const AVBufferRef *buffer_ref,
362363 av_unused const uint8_t *buffer,
363364 av_unused uint32_t size)
364365 {
libavcodec/vulkan_hevc.c+1−0
@@ -709,6 +709,7 @@ static int vk_hevc_create_params(AVCodecContext *avctx, AVBufferRef **buf) · 708 unmodified lines
709709 }
710710
711711 static int vk_hevc_start_frame(AVCodecContext *avctx,
712+ av_unused const AVBufferRef *buffer_ref,
712713 av_unused const uint8_t *buffer,
713714 av_unused uint32_t size)
714715 {
libavcodec/vvc/dec.c+7−5
@@ -831,7 +831,8 @@ static int frame_setup(VVCFrameContext *fc, VVCContext *s) · 830 unmodified lines
831831 return 0;
832832 }
833833
834−static int decode_slice(VVCContext *s, VVCFrameContext *fc, const H2645NAL *nal, const CodedBitstreamUnit *unit)
834+static int decode_slice(VVCContext *s, VVCFrameContext *fc, AVBufferRef *buf_ref,
835+ const H2645NAL *nal, const CodedBitstreamUnit *unit)
835836 {
836837 int ret;
837838 SliceContext *sc;
@@ -860,7 +861,7 @@ static int decode_slice(VVCContext *s, VVCFrameContext *fc, const H2645NAL *nal, · 22 unmodified lines
860861
861862 if (s->avctx->hwaccel) {
862863 if (is_first_slice) {
863− ret = FF_HW_CALL(s->avctx, start_frame, NULL, 0);
864+ ret = FF_HW_CALL(s->avctx, start_frame, buf_ref, NULL, 0);
864865 if (ret < 0)
865866 return ret;
866867 }
@@ -876,7 +877,8 @@ static int decode_slice(VVCContext *s, VVCFrameContext *fc, const H2645NAL *nal, · 9 unmodified lines
876877 return 0;
877878 }
878879
879−static int decode_nal_unit(VVCContext *s, VVCFrameContext *fc, const H2645NAL *nal, const CodedBitstreamUnit *unit)
880+static int decode_nal_unit(VVCContext *s, VVCFrameContext *fc, AVBufferRef *buf_ref,
881+ const H2645NAL *nal, const CodedBitstreamUnit *unit)
880882 {
881883 int ret;
882884
@@ -902,7 +904,7 @@ static int decode_nal_unit(VVCContext *s, VVCFrameContext *fc, const H2645NAL *n · 19 unmodified lines
902904 case VVC_IDR_N_LP:
903905 case VVC_CRA_NUT:
904906 case VVC_GDR_NUT:
905− ret = decode_slice(s, fc, nal, unit);
907+ ret = decode_slice(s, fc, buf_ref, nal, unit);
906908 if (ret < 0)
907909 return ret;
908910 break;
@@ -940,7 +942,7 @@ static int decode_nal_units(VVCContext *s, VVCFrameContext *fc, AVPacket *avpkt) · 31 unmodified lines
940942 if (unit->type == VVC_EOB_NUT || unit->type == VVC_EOS_NUT) {
941943 s->last_eos = 1;
942944 } else {
943− ret = decode_nal_unit(s, fc, nal, unit);
945+ ret = decode_nal_unit(s, fc, avpkt->buf, nal, unit);
944946 if (ret < 0) {
945947 av_log(s->avctx, AV_LOG_WARNING,
946948 "Error parsing NAL unit #%d.\n", i);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t