From: green-hand-shandong <[email protected]>
Add scale_ascend driving hi_mpi_vpc_resize on ASCEND hardware frames (h264_ascend -output_mode hw pipeline), with w/h/size expressions, bilinear/nearest interpolation and a dedicated output frame pool. 310P specifics encoded here: - VPC picture strides: width 16-aligned bytes (min 32), height 2-aligned (matches the CANN VPC sample; the hwcontext pool follows the same rule so pool buffers and VPC agree) - the synchronous resize path hits HI_ERR_VPC_BUF_FULL on this combination; submit with milli_sec=0 and wait on hi_mpi_vpc_get_process_result instead - the filter must aclrtSetCurrentContext() the device context on every filter thread call; threads are pooled and contexts are thread-bound - same-size requests are not passed through: forwarding decoder-pool frames straight to the encoder races pool teardown at EOS The device context is now exposed via AVAscendDeviceContext.context so filters can bind it; device reset moved to the process-wide last-user in the codecs to avoid resetting under live contexts. Validation (Atlas 300I-Duo, CANN 9.1.0): - decode(hw) -> scale_ascend 640:360 -> hwdownload: PSNR 40.0 dB vs swscale bilinear - decode -> scale_ascend 1280:720 (same size) -> encode: 99/99 frames @ 36 fps end-to-end on NPU - decode -> scale 640:360 -> encode: 99/99 @ 38 fps - full decode matrix regression: 10/10 PASS; hwdownload/hwupload MD5 identical to before Signed-off-by: green-hand-shandong <[email protected]> --- configure | 1 + libavcodec/ascenddec.c | 11 +- libavcodec/ascendenc.c | 39 +++-- libavfilter/Makefile | 3 +- libavfilter/allfilters.c | 1 + libavfilter/vf_scale_ascend.c | 280 ++++++++++++++++++++++++++++++++++ libavutil/hwcontext_ascend.c | 21 +-- libavutil/hwcontext_ascend.h | 9 ++ 8 files changed, 341 insertions(+), 24 deletions(-) create mode 100644 libavfilter/vf_scale_ascend.c diff --git a/configure b/configure index 82112626de..5916c75c93 100755 --- a/configure +++ b/configure @@ -4295,6 +4295,7 @@ libvmaf_cuda_filter_deps="libvmaf libvmaf_cuda ffnvcodec" zmq_filter_deps="libzmq" zoompan_filter_deps="swscale" zscale_filter_deps="libzimg const_nan" +scale_ascend_filter_deps="libascendcl" scale_vaapi_filter_deps="vaapi" scale_vt_filter_deps="videotoolbox VTPixelTransferSessionCreate" scale_vulkan_filter_deps="vulkan spirv_compiler swscale" diff --git a/libavcodec/ascenddec.c b/libavcodec/ascenddec.c index 4b56513ef9..cd395aa905 100644 --- a/libavcodec/ascenddec.c +++ b/libavcodec/ascenddec.c @@ -119,11 +119,13 @@ static int ascend_global_init(void) return 0; } -static void ascend_global_uninit(void) +static void ascend_global_uninit(int device_id) { pthread_mutex_lock(&ascend_global_lock); - if (--ascend_global_ref == 0) + if (--ascend_global_ref == 0) { + aclrtResetDevice(device_id); aclFinalize(); + } pthread_mutex_unlock(&ascend_global_lock); } @@ -171,7 +173,8 @@ static void ascend_release_device(AVCodecContext *avctx) aclrtDestroyContext(ctx->context); ctx->context = NULL; } - aclrtResetDevice(ctx->device_id); + /* Device reset is done by ascend_global_uninit once the last user in + * the process closes: other codecs/hwcontexts may share the device. */ } static av_cold int ascend_channel_create(AVCodecContext *avctx) @@ -688,7 +691,7 @@ static av_cold int ascend_decode_close(AVCodecContext *avctx) } ascend_release_device(avctx); if (ctx->global_inited) { - ascend_global_uninit(); + ascend_global_uninit(ctx->device_id); ctx->global_inited = 0; } diff --git a/libavcodec/ascendenc.c b/libavcodec/ascendenc.c index 594d3c78e1..5c4e60d063 100644 --- a/libavcodec/ascendenc.c +++ b/libavcodec/ascendenc.c @@ -78,11 +78,13 @@ static int ascend_enc_global_init(void) return 0; } -static void ascend_enc_global_uninit(void) +static void ascend_enc_global_uninit(int device_id) { pthread_mutex_lock(&ascend_enc_global_lock); - if (--ascend_enc_global_ref == 0) + if (--ascend_enc_global_ref == 0) { + aclrtResetDevice(device_id); aclFinalize(); + } pthread_mutex_unlock(&ascend_enc_global_lock); } @@ -392,11 +394,31 @@ static int ascend_encode_cb(AVCodecContext *avctx, AVPacket *pkt, } if (frame->format == AV_PIX_FMT_ASCEND) { - fi.v_frame.virt_addr[0] = frame->data[0]; - fi.v_frame.virt_addr[1] = frame->data[1]; - fi.v_frame.width_stride[0] = frame->linesize[0] > 0 ? - frame->linesize[0] : wstride; - fi.v_frame.width_stride[1] = fi.v_frame.width_stride[0]; + /* Copy device-to-device into the staging pool: the source + * frame's DVPP buffer returns to its producer's pool as soon + * as this function returns, while VENC still references it. */ + const int src_stride = frame->linesize[0] > 0 ? + frame->linesize[0] : wstride; + const uint8_t *src = frame->data[0]; + uint8_t *dst = ctx->in_buf[ctx->in_buf_pos]; + + for (int y = 0; y < frame->height; y++) + if (aclrtMemcpy(dst + (size_t)y * wstride, frame->width, + src + (size_t)y * src_stride, frame->width, + ACL_MEMCPY_DEVICE_TO_DEVICE) != 0) + return AVERROR_EXTERNAL; + dst += (size_t)wstride * hstride; + for (int y = 0; y < (frame->height + 1) / 2; y++) + if (aclrtMemcpy(dst + (size_t)y * wstride, frame->width, + frame->data[1] + (size_t)y * src_stride, + frame->width, + ACL_MEMCPY_DEVICE_TO_DEVICE) != 0) + return AVERROR_EXTERNAL; + fi.v_frame.virt_addr[0] = ctx->in_buf[ctx->in_buf_pos]; + fi.v_frame.virt_addr[1] = (void *)((uintptr_t)ctx->in_buf[ctx->in_buf_pos] + + (size_t)wstride * hstride); + fi.v_frame.width_stride[0] = wstride; + fi.v_frame.width_stride[1] = wstride; } else { ret = ascend_upload_frame(avctx, frame); if (ret < 0) @@ -465,8 +487,7 @@ static av_cold int ascend_encode_close(AVCodecContext *avctx) aclrtDestroyContext(ctx->context); ctx->context = NULL; } - aclrtResetDevice(ctx->device_id); - ascend_enc_global_uninit(); + ascend_enc_global_uninit(ctx->device_id); return 0; } diff --git a/libavfilter/Makefile b/libavfilter/Makefile index dc5c083f01..766173d358 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -482,7 +482,8 @@ OBJS-$(CONFIG_SCALE_D3D12_FILTER) += vf_scale_d3d12.o scale_eval.o OBJS-$(CONFIG_SCALE_CUDA_FILTER) += vf_scale_cuda.o scale_eval.o scale_filters.o \ vf_scale_cuda.ptx.o cuda/load_helper.o OBJS-$(CONFIG_SCALE_QSV_FILTER) += vf_vpp_qsv.o -OBJS-$(CONFIG_SCALE_VAAPI_FILTER) += vf_scale_vaapi.o scale_eval.o vaapi_vpp.o +OBJS-$(CONFIG_SCALE_VAAPI_FILTER) += vf_scale_vaapi.o +OBJS-$(CONFIG_SCALE_ASCEND_FILTER) += vf_scale_ascend.o scale_eval.o OBJS-$(CONFIG_SCALE_VT_FILTER) += vf_scale_vt.o scale_eval.o OBJS-$(CONFIG_SCALE_VULKAN_FILTER) += vf_scale_vulkan.o scale_eval.o vulkan.o vulkan_filter.o OBJS-$(CONFIG_SCALE2REF_FILTER) += vf_scale.o scale_eval.o framesync.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index 9f07bf83dc..561560974a 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -453,6 +453,7 @@ extern const FFFilter ff_vf_scale_cuda; extern const FFFilter ff_vf_scale_d3d11; extern const FFFilter ff_vf_scale_d3d12; extern const FFFilter ff_vf_scale_qsv; +extern const FFFilter ff_vf_scale_ascend; extern const FFFilter ff_vf_scale_vaapi; extern const FFFilter ff_vf_scale_vt; extern const FFFilter ff_vf_scale_vulkan; diff --git a/libavfilter/vf_scale_ascend.c b/libavfilter/vf_scale_ascend.c new file mode 100644 index 0000000000..8f75c852c1 --- /dev/null +++ b/libavfilter/vf_scale_ascend.c @@ -0,0 +1,280 @@ +/* + * Ascend NPU (CANN VPC) hardware scaling filter. + * + * Copyright (c) 2026 green-hand-shandong + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include <acl/acl.h> +#include <acl/dvpp/hi_dvpp.h> + +#include "libavutil/hwcontext.h" +#include "libavutil/hwcontext_ascend.h" +#include "libavutil/imgutils.h" +#include "libavutil/mem.h" +#include "libavutil/opt.h" +#include "libavutil/pixdesc.h" + +#include "avfilter.h" +#include "filters.h" +#include "formats.h" +#include "scale_eval.h" +#include "video.h" + +typedef struct ScaleAscendContext { + const AVClass *class; + + int device_id; + int interpolation; /* 0: bilinear, 1: nearest */ + char *w_expr; + char *h_expr; + char *size_str; + + int out_w, out_h; + int passthrough; + + AVBufferRef *frames_ref; + + aclrtContext context; + int dev_id; + aclrtContext dev_context; + hi_vpc_chn vpc_chn; + int vpc_created; +} ScaleAscendContext; + +static int ascend_scale_query_formats(const AVFilterContext *avctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) +{ + return ff_set_common_formats2(avctx, cfg_in, cfg_out, + ff_make_formats_list_singleton(AV_PIX_FMT_ASCEND)); +} + +static int ascend_scale_config_output(AVFilterLink *outlink) +{ + AVFilterContext *avctx = outlink->src; + ScaleAscendContext *ctx = avctx->priv; + AVFilterLink *inlink = avctx->inputs[0]; + FilterLink *in_fl = ff_filter_link(inlink); + FilterLink *out_fl = ff_filter_link(outlink); + AVHWFramesContext *in_frames; + AVHWFramesContext *fctx; + AVAscendDeviceContext *dev; + int ret; + + if (!in_fl->hw_frames_ctx) { + av_log(avctx, AV_LOG_ERROR, "scale_ascend: input frames have no hw context\n"); + return AVERROR(EINVAL); + } + in_frames = (AVHWFramesContext *)in_fl->hw_frames_ctx->data; + if (in_frames->format != AV_PIX_FMT_ASCEND) { + av_log(avctx, AV_LOG_ERROR, "scale_ascend: unsupported input %s\n", + av_get_pix_fmt_name(in_frames->format)); + return AVERROR(EINVAL); + } + + ret = ff_scale_eval_dimensions(ctx, ctx->w_expr, ctx->h_expr, + inlink, outlink, + &ctx->out_w, &ctx->out_h); + if (ret < 0) + return ret; + ff_scale_adjust_dimensions(inlink, &ctx->out_w, &ctx->out_h, + 0, 2, 2); + /* Even at same size the frame must go through VPC: passing frames of + * a foreign pool straight through mixes buffer lifetimes across the + * decoder/encoder pools at stream teardown. */ + ctx->passthrough = 0; + + outlink->w = ctx->out_w; + outlink->h = ctx->out_h; + outlink->format = AV_PIX_FMT_ASCEND; + + av_buffer_unref(&ctx->frames_ref); + ctx->frames_ref = av_hwframe_ctx_alloc(in_frames->device_ref); + if (!ctx->frames_ref) + return AVERROR(ENOMEM); + fctx = (AVHWFramesContext *)ctx->frames_ref->data; + fctx->format = AV_PIX_FMT_ASCEND; + fctx->sw_format = in_frames->sw_format; + fctx->width = ctx->out_w; + fctx->height = ctx->out_h; + fctx->initial_pool_size = 8; + ret = av_hwframe_ctx_init(ctx->frames_ref); + if (ret < 0) { + av_buffer_unref(&ctx->frames_ref); + return ret; + } + out_fl->hw_frames_ctx = av_buffer_ref(ctx->frames_ref); + if (!out_fl->hw_frames_ctx) + return AVERROR(ENOMEM); + + /* VPC channel on the input device: reuse the device's own context + * (the hwdevice already initialized ACL + DVPP); creating a separate + * context here would leave the VPC channel invisible on the device + * context the frames were allocated in. */ + dev = (AVAscendDeviceContext *)((AVHWDeviceContext *)in_frames->device_ref->data)->hwctx; + ctx->context = NULL; /* use the device default via SetDevice */ + + ret = aclrtSetDevice(dev->device_id); + if (ret != 0) { + av_log(avctx, AV_LOG_ERROR, "scale_ascend: aclrtSetDevice failed: %d\n", ret); + return AVERROR_EXTERNAL; + } + + { + hi_vpc_chn_attr attr = { 0 }; + + /* attr is the task queue depth; size it generously since frames + * arrive as fast as the decoder can produce them. */ + attr.attr = 32; + attr.pic_width = FFALIGN(inlink->w, 16); + attr.pic_height = FFALIGN(inlink->h, 16); + ret = hi_mpi_vpc_sys_create_chn(&ctx->vpc_chn, &attr); + if (ret != 0) { + av_log(avctx, AV_LOG_ERROR, "scale_ascend: vpc create_chn failed: 0x%x\n", ret); + return AVERROR_EXTERNAL; + } + ctx->vpc_created = 1; + } + + return 0; +} + +static int ascend_scale_filter_frame(AVFilterLink *inlink, AVFrame *in) +{ + AVFilterContext *avctx = inlink->dst; + AVFilterLink *outlink = avctx->outputs[0]; + ScaleAscendContext *ctx = avctx->priv; + AVFrame *out = NULL; + hi_vpc_pic_info src = { 0 }, dst = { 0 }; + hi_u32 task_id = 0; + int ret; + + if (ctx->passthrough) + return ff_filter_frame(outlink, in); + + out = ff_get_video_buffer(outlink, outlink->w, outlink->h); + if (!out) { + ret = AVERROR(ENOMEM); + goto fail; + } + ret = av_frame_copy_props(out, in); + if (ret < 0) + goto fail; + + src.picture_address = in->data[0]; + src.picture_width = in->width; + src.picture_height = in->height; + src.picture_width_stride = in->linesize[0] > 0 ? in->linesize[0] : + FFALIGN(in->width, 16); + src.picture_height_stride = FFALIGN(in->height, 2); + src.picture_format = HI_PIXEL_FORMAT_YUV_SEMIPLANAR_420; + src.picture_buffer_size = (size_t)src.picture_width_stride * + src.picture_height_stride * 3 / 2; + + dst.picture_address = out->data[0]; + dst.picture_width = out->width; + dst.picture_height = out->height; + dst.picture_width_stride = out->linesize[0] > 0 ? out->linesize[0] : + FFALIGN(out->width, 16); + dst.picture_height_stride = FFALIGN(out->height, 2); + dst.picture_format = HI_PIXEL_FORMAT_YUV_SEMIPLANAR_420; + dst.picture_buffer_size = (size_t)dst.picture_width_stride * + dst.picture_height_stride * 3 / 2; + + /* filter threads are foreign: bind the device context every call. */ + aclrtSetCurrentContext(ctx->dev_context); + ret = hi_mpi_vpc_resize(ctx->vpc_chn, &src, &dst, 0.0, 0.0, + ctx->interpolation, &task_id, 0); + if (ret == 0) + ret = hi_mpi_vpc_get_process_result(ctx->vpc_chn, task_id, 1000); + if (ret != 0) { + av_log(avctx, AV_LOG_ERROR, "scale_ascend: vpc_resize failed: 0x%x\n", ret); + ret = AVERROR_EXTERNAL; + goto fail; + } + + av_frame_free(&in); + return ff_filter_frame(outlink, out); + +fail: + av_frame_free(&in); + av_frame_free(&out); + return ret; +} + +static av_cold int ascend_scale_uninit(AVFilterContext *avctx) +{ + ScaleAscendContext *ctx = avctx->priv; + + if (ctx->vpc_created) { + hi_mpi_vpc_destroy_chn(ctx->vpc_chn); + ctx->vpc_created = 0; + } + av_buffer_unref(&ctx->frames_ref); + return 0; +} + +#define OFFSET(x) offsetof(ScaleAscendContext, x) +#define FLAGS (AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM) +static const AVOption scale_ascend_options[] = { + { "w", "output width expression (-1 to keep)", OFFSET(w_expr), + AV_OPT_TYPE_STRING, { .str = "-1" }, 0, 0, FLAGS }, + { "h", "output height expression (-1 to keep)", OFFSET(h_expr), + AV_OPT_TYPE_STRING, { .str = "-1" }, 0, 0, FLAGS }, + { "s", "output size WxH", OFFSET(size_str), + AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, FLAGS }, + { "interp", "interpolation method", OFFSET(interpolation), + AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, FLAGS, .unit = "interp" }, + { "bilinear", "bilinear", 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, 0, 0, FLAGS, .unit = "interp" }, + { "nearest", "nearest", 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, 0, 0, FLAGS, .unit = "interp" }, + { "device_id", "Ascend NPU device id", OFFSET(device_id), + AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 31, FLAGS }, + { NULL } +}; + +AVFILTER_DEFINE_CLASS(scale_ascend); + +static const AVFilterPad ascend_scale_inputs[] = { + { + .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .filter_frame = &ascend_scale_filter_frame, + }, +}; + +static const AVFilterPad ascend_scale_outputs[] = { + { + .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .config_props = &ascend_scale_config_output, + }, +}; + +const FFFilter ff_vf_scale_ascend = { + .p.name = "scale_ascend", + .p.description = NULL_IF_CONFIG_SMALL("Scale video on Ascend NPU VPC."), + .p.priv_class = &scale_ascend_class, + .p.flags = AVFILTER_FLAG_HWDEVICE, + .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, + .priv_size = sizeof(ScaleAscendContext), + .uninit = &ascend_scale_uninit, + FILTER_INPUTS(ascend_scale_inputs), + FILTER_OUTPUTS(ascend_scale_outputs), + FILTER_QUERY_FUNC2(ascend_scale_query_formats), +}; diff --git a/libavutil/hwcontext_ascend.c b/libavutil/hwcontext_ascend.c index 0ef844b9c5..fcff3d50c6 100644 --- a/libavutil/hwcontext_ascend.c +++ b/libavutil/hwcontext_ascend.c @@ -68,8 +68,10 @@ static int ascend_bytes_per_sample(enum AVPixelFormat sw_fmt) return sw_fmt == AV_PIX_FMT_P010LE ? 2 : 1; } -/* Stride rules of the 310P DVPP: the width stride counts bytes and is - * 16-aligned for 8-bit, 32-aligned for 10-bit; height is 16-aligned. */ +/* Stride rules: VENC/VPC want the width stride in bytes 16-aligned + * (32-min) and the height 2-aligned; VDEC output additionally wants a + * 16-aligned height, so use the max of both (16) there — handled by the + * decoder, this pool only guarantees the VPC/VENC rules. */ static int ascend_width_stride(enum AVPixelFormat sw_fmt, int width) { const int bps = ascend_bytes_per_sample(sw_fmt); @@ -79,7 +81,7 @@ static int ascend_width_stride(enum AVPixelFormat sw_fmt, int width) static int ascend_height_stride(enum AVPixelFormat sw_fmt, int height) { - return FFALIGN(height, 16); + return FFALIGN(height, 2); } static size_t ascend_frame_size(enum AVPixelFormat sw_fmt, int width, int height) @@ -92,7 +94,6 @@ static size_t ascend_frame_size(enum AVPixelFormat sw_fmt, int width, int height typedef struct AscendDeviceContext { AVAscendDeviceContext p; - aclrtContext context; int context_created; int dvpp_inited; int global_inited; @@ -107,7 +108,7 @@ static void ascend_device_uninit(AVHWDeviceContext *hwdev) dev->dvpp_inited = 0; } if (dev->context_created) { - aclrtDestroyContext(dev->context); + aclrtDestroyContext(dev->p.context); dev->context_created = 0; } aclrtResetDevice(dev->p.device_id >= 0 ? dev->p.device_id : 0); @@ -136,14 +137,14 @@ static int ascend_device_init(AVHWDeviceContext *hwdev) dev->p.device_id, ret); goto fail; } - ret = aclrtCreateContext(&dev->context, dev->p.device_id); + ret = aclrtCreateContext(&dev->p.context, dev->p.device_id); if (ret != 0) { av_log(hwdev, AV_LOG_ERROR, "ascend: aclrtCreateContext failed: %d\n", ret); aclrtResetDevice(dev->p.device_id); goto fail; } dev->context_created = 1; - aclrtSetCurrentContext(dev->context); + aclrtSetCurrentContext(dev->p.context); ret = hi_mpi_sys_init(); if (ret != 0) { @@ -230,7 +231,7 @@ static AVBufferRef *ascend_pool_alloc(void *opaque, size_t size) /* Pool growth can happen on foreign threads; bind the device context * for the DVPP allocator. */ - aclrtSetCurrentContext(dev->context); + aclrtSetCurrentContext(dev->p.context); surf = av_mallocz(sizeof(*surf)); if (!surf) @@ -342,7 +343,7 @@ static int ascend_transfer_data_from(AVHWFramesContext *hwfc, /* aclrtMemcpy requires the device context of the calling thread. */ { AscendDeviceContext *dev = hwfc->device_ctx->hwctx; - int arc = aclrtSetCurrentContext(dev->context); + int arc = aclrtSetCurrentContext(dev->p.context); if (arc != 0) av_log(hwfc, AV_LOG_WARNING, "ascend: SetCurrentContext %d\n", arc); } @@ -379,7 +380,7 @@ static int ascend_transfer_data_to(AVHWFramesContext *hwfc, { AscendDeviceContext *dev = hwfc->device_ctx->hwctx; - int arc = aclrtSetCurrentContext(dev->context); + int arc = aclrtSetCurrentContext(dev->p.context); if (arc != 0) av_log(hwfc, AV_LOG_WARNING, "ascend: SetCurrentContext %d\n", arc); } diff --git a/libavutil/hwcontext_ascend.h b/libavutil/hwcontext_ascend.h index 0fb6c2e53e..6a3ddd0a23 100644 --- a/libavutil/hwcontext_ascend.h +++ b/libavutil/hwcontext_ascend.h @@ -19,6 +19,8 @@ #ifndef AVUTIL_HWCONTEXT_ASCEND_H #define AVUTIL_HWCONTEXT_ASCEND_H +#include <acl/acl.h> + #include "pixfmt.h" /** @@ -36,6 +38,13 @@ typedef struct AVAscendDeviceContext { * Ascend NPU device id (-1 = unspecified; defaults to 0 on use). */ int device_id; + + /** + * ACL context created by the device (NULL before av_hwdevice_ctx_init). + * Foreign threads must aclrtSetCurrentContext(this) before ACL/DVPP + * calls touching buffers of this device. + */ + aclrtContext context; } AVAscendDeviceContext; /** -- 2.25.1 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
