From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 2B45B4AC03 for ; Tue, 23 Dec 2025 00:58:37 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'oHc34yaxECPumGwWkrsZdW8BwUguZUz91zHkWtnJkqw=', expected b'WrTJbuyeuWUuEhis1eBeLhtnN2k3mY++dkFe12M+IrM=')) header.d=ffmpeg.org header.i=@ffmpeg.org header.a=rsa-sha256 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1766451494; h=mime-version : to : date : message-id : reply-to : subject : list-id : list-archive : list-archive : list-help : list-owner : list-post : list-subscribe : list-unsubscribe : from : cc : content-type : content-transfer-encoding : from; bh=oHc34yaxECPumGwWkrsZdW8BwUguZUz91zHkWtnJkqw=; b=Bopz43fQj+gpTaMD3MpYhdn3KutX5a2s9UsefKxNnHgZzIGgiOqvY4yaWpjqg+ax3KrNT TF7HgNCXQyDuiN2zahk+vNlQ/c1RJAIT9oDDy+0rxNKKDajvloi/UJjUFZiBUcKU7kOHMdF 3GmGQ4k3yL3HkIZhcOa+JYE21/KlO5JD1l21ByBrG5W6jc187iAOY5NYZQOzw+T0MAyk8gq kkTFZoWHmijFqYSUpzHGDn41Gb7Mkt9cXo/MzGYQMNKAAgz34m0fWan0m7/hI9gStl1bPgJ 3hTKlCwU6M/p89ssVFVmmbgJW5zlXnVtRofSBF8lT4tNusD8KEobutrQYjtA== Received: from [172.20.0.2] (unknown [172.19.0.4]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 9226C690AC5; Tue, 23 Dec 2025 02:58:14 +0200 (EET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1766451485; b=mv7AtHzrXdkG9L7sMTivdXo3MV54o17R6rDMkB9nmyjYIaVQ9vzc20YprymgBcV3aewJ1 +mzcVGD0WIsI1a6M63oVbgOad2sJILfIlbong1xqyvao34w4m+Nt9V//BwTqYX4D0atCsr7 ii/QLxDb4QLW22pRYxSSdKeaqPGKcIec1u5iDoP8uSRqhPVOzWPO7G2pQLPwYUDPZ3dYLb6 //Drbyjep2jOj15mZ7BNbImP+Gwi6kn2LN3T1uWho5EsmXk61wyqebBsfBisPXM07BsDnt8 1h98/rBdNJn9FocOCJFCLSDWEVvlfX1HyYz1FxQIslh4ozJilHxyldKsDYJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1766451485; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=yhmgkBGjZbLtBB4pQAJ0j95J9v89SobsvtyGo3NFvsM=; b=peCX7Ijbhxo+Jj+0Xmbh4QMSGCq4Gp7Yhg60OImIstgmxarIBtbr/1daPka5iJKCbqjx0 +ST/DsonOWPGcmiI7l/OCSb7m7fz0uiOvBHKMcFVFyicd953QGbXYIvIXyi7lzMYsFhYV/H /kr3H2VmLw0L3PihJempJxtp4d8ptiVvN1Gg03AfSGFGzmXk3Ht+Hd25lfvvtqXvzNSf/sf +49WQZYDNdMB4op3UJkgJfXuvTlRjT7vG6LEk5SSwTeXa3aHpfuRZMnKq8BBEsLzAJfBf2O ILWEE7YTkUtAS+1EbfGfdRZ6yakNnEao+4cg6gViQD77e2XRrDn06Lvc370w== ARC-Authentication-Results: i=1; ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none; dmarc=pass header.from=ffmpeg.org policy.dmarc=quarantine Authentication-Results: ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none (Message is not ARC signed); dmarc=pass (Used From Domain Record) header.from=ffmpeg.org policy.dmarc=quarantine DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1766451473; h=content-type : mime-version : content-transfer-encoding : from : to : reply-to : subject : date : from; bh=WrTJbuyeuWUuEhis1eBeLhtnN2k3mY++dkFe12M+IrM=; b=5HDBMXbit7voiTm1pZCG7qpEKlHiA7FzX+ZIgLYexRqblC7PgNn+zCJ5n2j+nMWPobeLq obrmavyYs9FIErJ6U9aCAEA7pxRgrByKijN4Z27mrZTF4RfUB0m3wfHTbbp/ANYLPs90Qw9 FBZNVs6Hxmev/4/Lh7tzuevzXiWJKVDMFbTilFp+ae4xc3hK0GQjG4d0WvmMiGw2SXXfaxb IHVBffvCTxFm9d8AWncRjzMcvA9vMvd1tLgVbLhZ+9aufAbGM/JZMTpQqkFSfIQ9JxFSI/Q 2eS27k9FFx2UkWiL03eHDfc6Rvqxc+OcRPH7SqbS4krvOENC+BAnILMZ7JqA== Received: from 55ca25703178 (code.ffmpeg.org [188.245.149.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id C41B7690A87 for ; Tue, 23 Dec 2025 02:57:53 +0200 (EET) MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Date: Tue, 23 Dec 2025 00:57:53 -0000 Message-ID: <176645147407.60.3938499789465820490@2cb04c0e5124> Message-ID-Hash: Q6V6IYDCPW37A2CXKAHWKJZHZ4JN7NO5 X-Message-ID-Hash: Q6V6IYDCPW37A2CXKAHWKJZHZ4JN7NO5 X-MailFrom: code@ffmpeg.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-ffmpeg-devel.ffmpeg.org-0; header-match-ffmpeg-devel.ffmpeg.org-1; header-match-ffmpeg-devel.ffmpeg.org-2; header-match-ffmpeg-devel.ffmpeg.org-3; emergency; member-moderation X-Mailman-Version: 3.3.10 Precedence: list Reply-To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PATCH] avcodec/lcevcdec: fix input dimensions for the base picture (PR #21269) List-Id: FFmpeg development discussions and patches Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: James Almer via ffmpeg-devel Cc: James Almer Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Archived-At: List-Archive: List-Post: PR #21269 opened by James Almer (jamrial) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21269 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21269.patch >>From 6bef7777d6651328b80d70490ac1456eeb466657 Mon Sep 17 00:00:00 2001 From: James Almer Date: Mon, 22 Dec 2025 21:53:47 -0300 Subject: [PATCH 1/3] avcodec/lcevcdec: avoid copying the input frame Based on the lcevc filter implementation. Signed-off-by: James Almer --- libavcodec/lcevcdec.c | 37 +++++++------------------------------ 1 file changed, 7 insertions(+), 30 deletions(-) diff --git a/libavcodec/lcevcdec.c b/libavcodec/lcevcdec.c index f55f55a03f..bccd524bf5 100644 --- a/libavcodec/lcevcdec.c +++ b/libavcodec/lcevcdec.c @@ -49,10 +49,7 @@ static int alloc_base_frame(void *logctx, FFLCEVCContext *lcevc, { LCEVC_PictureDesc desc; LCEVC_ColorFormat fmt = map_format(frame->format); - LCEVC_PictureLockHandle lock; - uint8_t *data[4] = { NULL }; - int linesizes[4] = { 0 }; - uint32_t planes; + LCEVC_PicturePlaneDesc planes[AV_VIDEO_MAX_PLANES] = { 0 }; LCEVC_ReturnCode res; res = LCEVC_DefaultPictureDesc(&desc, fmt, frame->width, frame->height); @@ -66,36 +63,16 @@ static int alloc_base_frame(void *logctx, FFLCEVCContext *lcevc, desc.sampleAspectRatioNum = frame->sample_aspect_ratio.num; desc.sampleAspectRatioDen = frame->sample_aspect_ratio.den; + for (int i = 0; i < AV_VIDEO_MAX_PLANES; i++) { + planes[i].firstSample = frame->data[i]; + planes[i].rowByteStride = frame->linesize[i]; + } + /* Allocate LCEVC Picture */ - res = LCEVC_AllocPicture(lcevc->decoder, &desc, picture); + res = LCEVC_AllocPictureExternal(lcevc->decoder, &desc, NULL, planes, picture); if (res != LCEVC_Success) { return AVERROR_EXTERNAL; } - res = LCEVC_LockPicture(lcevc->decoder, *picture, LCEVC_Access_Write, &lock); - if (res != LCEVC_Success) - return AVERROR_EXTERNAL; - - res = LCEVC_GetPicturePlaneCount(lcevc->decoder, *picture, &planes); - if (res != LCEVC_Success) - return AVERROR_EXTERNAL; - - for (unsigned i = 0; i < planes; i++) { - LCEVC_PicturePlaneDesc plane; - - res = LCEVC_GetPictureLockPlaneDesc(lcevc->decoder, lock, i, &plane); - if (res != LCEVC_Success) - return AVERROR_EXTERNAL; - - data[i] = plane.firstSample; - linesizes[i] = plane.rowByteStride; - } - - av_image_copy2(data, linesizes, frame->data, frame->linesize, - frame->format, frame->width, frame->height); - - res = LCEVC_UnlockPicture(lcevc->decoder, lock); - if (res != LCEVC_Success) - return AVERROR_EXTERNAL; return 0; } -- 2.49.1 >>From 6921861dd18345e762d59f1ee4b9d61683b3db32 Mon Sep 17 00:00:00 2001 From: James Almer Date: Mon, 22 Dec 2025 21:54:43 -0300 Subject: [PATCH 2/3] avcodec/lcevcdec: fix input dimensions for the base picture Fixes crashes with some samples. Signed-off-by: James Almer --- libavcodec/lcevcdec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/lcevcdec.c b/libavcodec/lcevcdec.c index bccd524bf5..179ebdd708 100644 --- a/libavcodec/lcevcdec.c +++ b/libavcodec/lcevcdec.c @@ -50,9 +50,11 @@ static int alloc_base_frame(void *logctx, FFLCEVCContext *lcevc, LCEVC_PictureDesc desc; LCEVC_ColorFormat fmt = map_format(frame->format); LCEVC_PicturePlaneDesc planes[AV_VIDEO_MAX_PLANES] = { 0 }; + int width = frame->width - frame->crop_left - frame->crop_right; + int height = frame->height - frame->crop_top - frame->crop_bottom; LCEVC_ReturnCode res; - res = LCEVC_DefaultPictureDesc(&desc, fmt, frame->width, frame->height); + res = LCEVC_DefaultPictureDesc(&desc, fmt, width, height); if (res != LCEVC_Success) return AVERROR_EXTERNAL; -- 2.49.1 >>From f2e0eb48594e83c3dbd026358afaabc9b9ed552c Mon Sep 17 00:00:00 2001 From: James Almer Date: Mon, 22 Dec 2025 21:56:09 -0300 Subject: [PATCH 3/3] avcodec/lcevcdec: free pictures on error Signed-off-by: James Almer --- libavcodec/lcevcdec.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/libavcodec/lcevcdec.c b/libavcodec/lcevcdec.c index 179ebdd708..4f6d793625 100644 --- a/libavcodec/lcevcdec.c +++ b/libavcodec/lcevcdec.c @@ -126,8 +126,10 @@ static int lcevc_send_frame(void *logctx, FFLCEVCFrame *frame_ctx, const AVFrame return ret; res = LCEVC_SendDecoderBase(lcevc->decoder, in->pts, picture, -1, NULL); - if (res != LCEVC_Success) + if (res != LCEVC_Success) { + LCEVC_FreePicture(lcevc->decoder, picture); return AVERROR_EXTERNAL; + } memset(&picture, 0, sizeof(picture)); ret = alloc_enhanced_frame(logctx, frame_ctx, &picture); @@ -135,8 +137,10 @@ static int lcevc_send_frame(void *logctx, FFLCEVCFrame *frame_ctx, const AVFrame return ret; res = LCEVC_SendDecoderPicture(lcevc->decoder, picture); - if (res != LCEVC_Success) + if (res != LCEVC_Success) { + LCEVC_FreePicture(lcevc->decoder, picture); return AVERROR_EXTERNAL; + } return 0; } @@ -154,8 +158,10 @@ static int generate_output(void *logctx, FFLCEVCFrame *frame_ctx, AVFrame *out) return AVERROR_EXTERNAL; res = LCEVC_GetPictureDesc(lcevc->decoder, picture, &desc); - if (res != LCEVC_Success) + if (res != LCEVC_Success) { + LCEVC_FreePicture(lcevc->decoder, picture); return AVERROR_EXTERNAL; + } out->crop_top = desc.cropTop; out->crop_bottom = desc.cropBottom; -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org