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 E9ECD410AA for ; Wed, 12 Oct 2022 13:09:43 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A727768BD48; Wed, 12 Oct 2022 16:09:17 +0300 (EEST) Received: from mail-oa1-f48.google.com (mail-oa1-f48.google.com [209.85.160.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 49AF068BC9A for ; Wed, 12 Oct 2022 16:09:11 +0300 (EEST) Received: by mail-oa1-f48.google.com with SMTP id 586e51a60fabf-132fb4fd495so19358182fac.12 for ; Wed, 12 Oct 2022 06:09:11 -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=wyCg6k1YxXbr2bpsHm9dopKjsjnk7hUFWkBtyWEzeNw=; b=F3FCvfPa30yGUxNzbSmW3sAdGw5ohRwpv9NVQNCFfRHjFg7aGD7aUMI9HUvMteTkx/ J9wSmW8gYtAtPHUv5Mv3gvYThTO/4hGxVRWyi2ZRjF3lkEdQx31nXsoWl/rmiHlMD+ID nGG0Ol4Yzaq6Rc2LoM6+K4XHcgPGL9tYxiDsoRU75e07m+p60XdbT2Sh8Xtc5VKusJKq mjT0k+roZB/j/LKDHA7uTXQwqhC9OOgKnR9uXEj/8RSORLW19N+VWQOJvPmhUH2VrRfc ishm6aPhAq49bB69F8h5B7/l8oQ9IqAsAEpKIbcxUkAQQzvfSqFnbYPA+9bEeAXu3u4G eWWw== 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=wyCg6k1YxXbr2bpsHm9dopKjsjnk7hUFWkBtyWEzeNw=; b=Ag/5GQQWu3vnR4Cl4wl3aZc4TxooBzzjjDmxmjTuVhp6E8Cl/HvM+MH5cVlJysuZMb 8aNRnKDb1vdVMqWL/V6I8OcOJPaxoFpMfY/ZNEjMqIz9ieOd6yb0Y8hYwe2ILBvUL37t mbBGmTYqhrMO2LYhZmfYuVaIrnowRcNXyX/4ZH0UMEn3MRt7mafevhWN7G1p/YPqZXKX gxtSLHXqqEO3IugjxYuEs0vJ3Swr4Cj1kAURpZzqjIPgBCAJAmA7zJS5sjUMVRV/o7kj mXOObz6TFwXGBm9kRB34hf/Qb2FXqG+Obaq90KPhgPl0dLnJcBfZhKBqtTWavIM3aRlr gnfQ== X-Gm-Message-State: ACrzQf3YBmS50Ser94+OGSIxheVObRyqDUPDudBxbj9wyUBxYJjMxAhp F6jsoWASpnrWxuHoeSJz4Ef7OaBll2Y= X-Google-Smtp-Source: AMsMyM70cg5O73JifO3M4K+3Mz3LI0UBZ44vUvk8VbRC4ba2ivq4TEisdHTPf7Ijwq2u+LbTB6z+Vw== X-Received: by 2002:a05:6870:f10f:b0:132:5c4f:5998 with SMTP id k15-20020a056870f10f00b001325c4f5998mr2444945oac.118.1665580149542; Wed, 12 Oct 2022 06:09:09 -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.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Oct 2022 06:09:08 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Wed, 12 Oct 2022 10:08:29 -0300 Message-Id: <20221012130829.2392-4-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 4/4] avcodec/librav1e: use lavu image helpers where adequate 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: Signed-off-by: James Almer --- libavcodec/librav1e.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/libavcodec/librav1e.c b/libavcodec/librav1e.c index 130417622a..284af34ec4 100644 --- a/libavcodec/librav1e.c +++ b/libavcodec/librav1e.c @@ -437,6 +437,8 @@ static int librav1e_receive_packet(AVCodecContext *avctx, AVPacket *pkt) if (frame->buf[0]) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format); + ptrdiff_t linesizes[4]; + size_t sizes[4]; int64_t *pts = av_malloc(sizeof(int64_t)); if (!pts) { @@ -453,12 +455,20 @@ static int librav1e_receive_packet(AVCodecContext *avctx, AVPacket *pkt) return AVERROR(ENOMEM); } + for (int i = 0; i < 4; i++) + linesizes[i] = frame->linesize[i]; + + ret = av_image_fill_plane_sizes(sizes, frame->format, frame->height, linesizes); + if (ret < 0) { + rav1e_frame_unref(rframe); + av_frame_unref(frame); + av_freep(&pts); + return ret; + } + for (int i = 0; i < desc->nb_components; i++) { - int shift = i ? desc->log2_chroma_h : 0; - int bytes = desc->comp[0].depth == 8 ? 1 : 2; - rav1e_frame_fill_plane(rframe, i, frame->data[i], - (frame->height >> shift) * frame->linesize[i], - frame->linesize[i], bytes); + rav1e_frame_fill_plane(rframe, i, frame->data[i], sizes[i], + linesizes[i], desc->comp[i].step); } av_frame_unref(frame); rav1e_frame_set_opaque(rframe, pts, av_free); -- 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".