From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 1010F4276C for ; Fri, 7 Jan 2022 03:20:54 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CF93768AA82; Fri, 7 Jan 2022 05:20:51 +0200 (EET) Received: from mail-ua1-f44.google.com (mail-ua1-f44.google.com [209.85.222.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2F3D368008C for ; Fri, 7 Jan 2022 05:20:46 +0200 (EET) Received: by mail-ua1-f44.google.com with SMTP id b26so7973828uap.6 for ; Thu, 06 Jan 2022 19:20:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=UsyQEEl21XoGhkw7gq6cc5HYSMXX2iByZAYcADdrReQ=; b=E9hN0z6u30T7buT364bXRXT9kKhYaWAQpvcOLIDqbh7D6UxXvf+xBpE6IAW8af6Kt0 +fN2+c7LD8BnPH7vYiLzb/HQ9B1ZI8ZJGyBg1xpI+6xKnmjlkb8NMBZFv4wdpIhngajY 2TaHaP945Y1rtkDgwbJlivP2mGXD1y4L4FhyGNe2gUmRhU2/5LHHoC3rZo6Cr0j5leOU 4JCHWlQ9DOQcIrKWgclc8Ejf7DUK5x9Q9ulUja3pNcHPLQ3H96oHWLxrIknuEaIXP2V+ +w3CYMlDSKFZOe5mQqwya5TK1ZgsdCrNXlvGxrkB54kuETcCiGhKttPKdqv8dT9LMfH2 3DTw== X-Gm-Message-State: AOAM530O6t8kX7Dmy67GRWCFWNd9Xn4OdVzM3xKvLAQKblGg9Skif1MN yE2n4NYF1zdONoG7fxxPeHAX4l+UutyZXJ8mkkA= X-Google-Smtp-Source: ABdhPJyy3MWup1J24v7E51xtsOn9LzNkf+DVxk5+UtbK+Hs0OsOWKsBKTD0KF9ZTqz0AHfPncdQ8rHVqjRV+aieBcZA= X-Received: by 2002:a67:f793:: with SMTP id j19mr20502901vso.60.1641525643049; Thu, 06 Jan 2022 19:20:43 -0800 (PST) MIME-Version: 1.0 References: <20220103003318.442892-1-aicommander@gmail.com> In-Reply-To: From: Aman Karmani Date: Thu, 6 Jan 2022 19:20:32 -0800 Message-ID: To: Cameron Gutman X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [FFmpeg-devel] [PATCH] lavu/videotoolbox: add support for memory mapping frames X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Sun, Jan 2, 2022 at 6:22 PM Cameron Gutman wrote: > On 1/2/22 19:21, Aman Karmani wrote: > > > > > > On Sun, Jan 2, 2022 at 4:33 PM Cameron Gutman > wrote: > > > > Signed-off-by: Cameron Gutman aicommander@gmail.com>> > > --- > > libavutil/hwcontext_videotoolbox.c | 25 +++++++++++++++++++++++++ > > 1 file changed, 25 insertions(+) > > > > diff --git a/libavutil/hwcontext_videotoolbox.c > b/libavutil/hwcontext_videotoolbox.c > > index 0a8dbe9f33..026127d412 100644 > > --- a/libavutil/hwcontext_videotoolbox.c > > +++ b/libavutil/hwcontext_videotoolbox.c > > @@ -711,6 +711,30 @@ fail: > > return err; > > } > > > > +static int vt_map_from(AVHWFramesContext *hwfc, AVFrame *dst, > > + const AVFrame *src, int flags) > > +{ > > + int err; > > + > > + if (dst->format == AV_PIX_FMT_NONE) > > + dst->format = hwfc->sw_format; > > + else if (dst->format != hwfc->sw_format) > > + return AVERROR(ENOSYS); > > + > > + err = vt_map_frame(hwfc, dst, src, flags); > > + if (err) > > + return err; > > + > > + dst->width = src->width; > > + dst->height = src->height; > > + > > + err = av_frame_copy_props(dst, src); > > + if (err) > > + return err; > > + > > + return 0; > > +} > > + > > static int vt_device_create(AVHWDeviceContext *ctx, const char > *device, > > AVDictionary *opts, int flags) > > { > > @@ -736,6 +760,7 @@ const HWContextType > ff_hwcontext_type_videotoolbox = { > > .transfer_get_formats = vt_transfer_get_formats, > > .transfer_data_to = vt_transfer_data_to, > > .transfer_data_from = vt_transfer_data_from, > > + .map_from = vt_map_from, > > > > > > Thanks for this! > > > > Does this add support for hwdownload filter? Or what's the best way to > test this patch? > > > > Aman > > > > > > I'm calling the C API directly (av_hwframe_map) from my application, but > you can test it > with the command-line tool using something like this: > > ffmpeg -hwaccel videotoolbox -hwaccel_output_format videotoolbox_vld -i > 1280x720.h264 -vf "hwmap,format=nv12" 1280x720.yuv > > Replacing hwmap (which uses map_from) with hwdownload (which uses > transfer_data_from) > yields the same decoded YUV output, as expected. Thanks, I didn't realize hwmap used a different route. Patch applied to master. Aman > > > > Cam > > > > > .pix_fmts = (const enum AVPixelFormat[]){ > AV_PIX_FMT_VIDEOTOOLBOX, AV_PIX_FMT_NONE }, > > }; > > -- > > 2.25.1 > > > > _______________________________________________ > > ffmpeg-devel mailing list > > ffmpeg-devel@ffmpeg.org > > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel < > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel> > > > > To unsubscribe, visit link above, or email > > ffmpeg-devel-request@ffmpeg.org ffmpeg-devel-request@ffmpeg.org> with subject "unsubscribe". > > > _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".