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 840B24346F for ; Wed, 12 Oct 2022 13:09:34 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8A3F268BD38; Wed, 12 Oct 2022 16:09:16 +0300 (EEST) Received: from mail-oi1-f174.google.com (mail-oi1-f174.google.com [209.85.167.174]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8856868BD37 for ; Wed, 12 Oct 2022 16:09:09 +0300 (EEST) Received: by mail-oi1-f174.google.com with SMTP id y72so12320323oia.3 for ; Wed, 12 Oct 2022 06:09:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=DwD8Sg5Hh6Yr5hhj7OE4eJIuFMh2IAlYbym+5tbtpC4=; b=fKmmq3c7w2gKQ9vGr2ZblqqAUMI3IT997c2RzmtPTBszE/VBkaxamhrn33ZzQ8SSW/ hX/nm3A9nIoujaK7wj46rt8OlmFa0klXumwxpb34YTUzI3nyom11wNA0nHTKWyNl9OLp E2O4c2tJMVdPDYYjJGMVpe7R6KZdi49NNCBfFhREpO82qjXBueXUpEVPPt7mHDu+Qval ex7IJEVvlTp0nSM9nhcXm7SeRirAVVddAFpy5awEhH3DIVc+pQj15x441PEeCKNR72q2 HPwOyQcCPZMnx4Q3EKBvPVwhsAUw7jgKzQLwnAjmQRZHI3L6ay1acJ1CjvutdTcWjNGW jkFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DwD8Sg5Hh6Yr5hhj7OE4eJIuFMh2IAlYbym+5tbtpC4=; b=Kl79XNvHKoWOkjcN2dxe3KpE9KRzXz0AM5v0PhL6IomvcgGnxoMNE9DI/WmqcqSuRl PBqhJ6GHi3ar2atjSMUDw1IAWasxhmzZzDMiT3Ct0ofF8gANJh2nwVk0iyQbSEkGvlxD vNima9ev/Hp443vIhkd3+hjhGKzyVhrTbCoA2TIeUDvOaoeZdjFEzpT7syuv0Fbo8crU g4G2zT8olL87Dsc5YDcbMunBqYqy8ajg1oUO5jb14seWgwPOjVT4VoepMFMy/Qj4kGbJ VVLm19xQ4R3RlVd+W6/QoAP5SCx3j64QPeIABGgTNgpsbHX+PmHq2SposJ9hC2ZQq4Gn MlSw== X-Gm-Message-State: ACrzQf0Js5ZYhTJSUSWhvBCbCCXzKde9nodn91pR2avW2zkFvPtU2syF ar4IeDQMOy9P2uPstB1JYW2OWAU778E= X-Google-Smtp-Source: AMsMyM6XuDxb+FD+40HjKVsgwXSmS3xhWKM7XSJhcnEVohIzthiKQ1p3KZDb1xD345yYwu9W8pZ6sQ== X-Received: by 2002:a05:6808:18a9:b0:354:b872:8a0 with SMTP id bi41-20020a05680818a900b00354b87208a0mr2015884oib.197.1665580147543; Wed, 12 Oct 2022 06:09:07 -0700 (PDT) Received: from localhost.localdomain ([191.97.187.183]) by smtp.gmail.com with ESMTPSA id ch15-20020a0568081c0f00b0035028730c90sm6664092oib.1.2022.10.12.06.09.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Oct 2022 06:09:06 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Wed, 12 Oct 2022 10:08:28 -0300 Message-Id: <20221012130829.2392-3-jamrial@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221012130829.2392-1-jamrial@gmail.com> References: <20221012130829.2392-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/4] avcodec/librav1e: support AV_CODEC_CAP_ENCODER_RECON_FRAME 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 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: This bumps the minimum required version to 0.5.0 Signed-off-by: James Almer --- configure | 2 +- libavcodec/librav1e.c | 37 ++++++++++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 84641fd03e..96479d48d6 100755 --- a/configure +++ b/configure @@ -6674,7 +6674,7 @@ enabled libopus && { enabled libplacebo && require_pkg_config libplacebo "libplacebo >= 4.192.0" libplacebo/vulkan.h pl_vulkan_create enabled libpulse && require_pkg_config libpulse libpulse pulse/pulseaudio.h pa_context_new enabled librabbitmq && require_pkg_config librabbitmq "librabbitmq >= 0.7.1" amqp.h amqp_new_connection -enabled librav1e && require_pkg_config librav1e "rav1e >= 0.4.0" rav1e.h rav1e_context_new +enabled librav1e && require_pkg_config librav1e "rav1e >= 0.5.0" rav1e.h rav1e_context_new enabled librist && require_pkg_config librist "librist >= 0.2.7" librist/librist.h rist_receiver_create enabled librsvg && require_pkg_config librsvg librsvg-2.0 librsvg-2.0/librsvg/rsvg.h rsvg_handle_render_cairo enabled librtmp && require_pkg_config librtmp librtmp librtmp/rtmp.h RTMP_Socket diff --git a/libavcodec/librav1e.c b/libavcodec/librav1e.c index 604115476c..130417622a 100644 --- a/libavcodec/librav1e.c +++ b/libavcodec/librav1e.c @@ -23,6 +23,7 @@ #include #include "libavutil/internal.h" +#include "libavutil/imgutils.h" #include "libavutil/avassert.h" #include "libavutil/base64.h" #include "libavutil/common.h" @@ -538,6 +539,40 @@ retry: pkt->pts = pkt->dts = *((int64_t *) rpkt->opaque); av_free(rpkt->opaque); + + if (avctx->flags & AV_CODEC_FLAG_RECON_FRAME) { + AVCodecInternal *avci = avctx->internal; + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); + ptrdiff_t linesizes[4]; + size_t sizes[4]; + + av_frame_unref(avci->recon_frame); + + avci->recon_frame->format = avctx->pix_fmt; + avci->recon_frame->width = avctx->width; + avci->recon_frame->height = avctx->height; + + ret = av_frame_get_buffer(avci->recon_frame, 0); + if (ret < 0) { + rav1e_packet_unref(rpkt); + return ret; + } + + for (int i = 0; i < 4; i++) + linesizes[i] = avci->recon_frame->linesize[i]; + + ret = av_image_fill_plane_sizes(sizes, avctx->pix_fmt, avctx->height, linesizes); + if (ret < 0) { + rav1e_packet_unref(rpkt); + return ret; + } + + for (int i = 0; i < desc->nb_components; i++) { + rav1e_frame_extract_plane(rpkt->rec, i, avci->recon_frame->data[i], + sizes[i], linesizes[i], desc->comp[i].step); + } + } + rav1e_packet_unref(rpkt); return 0; @@ -601,7 +636,7 @@ const FFCodec ff_librav1e_encoder = { .defaults = librav1e_defaults, .p.pix_fmts = librav1e_pix_fmts, .p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_OTHER_THREADS | - AV_CODEC_CAP_DR1, + AV_CODEC_CAP_DR1 | AV_CODEC_CAP_ENCODER_RECON_FRAME, .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_AUTO_THREADS, .p.wrapper_name = "librav1e", -- 2.37.3 _______________________________________________ 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".