This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit b392d75cf72cca90b5476e0c1b2e0876f3aff4ab
Author:     James Almer <[email protected]>
AuthorDate: Mon Dec 22 21:53:47 2025 -0300
Commit:     James Almer <[email protected]>
CommitDate: Wed Dec 24 12:23:37 2025 -0300

    avcodec/lcevcdec: avoid copying the input frame
    
    Based on the lcevc filter implementation.
    
    Signed-off-by: James Almer <[email protected]>
---
 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,37 +63,17 @@ static int alloc_base_frame(void *logctx, FFLCEVCContext 
*lcevc,
     desc.sampleAspectRatioNum  = frame->sample_aspect_ratio.num;
     desc.sampleAspectRatioDen  = frame->sample_aspect_ratio.den;
 
-    /* Allocate LCEVC Picture */
-    res = LCEVC_AllocPicture(lcevc->decoder, &desc, picture);
-    if (res != LCEVC_Success) {
-        return AVERROR_EXTERNAL;
+    for (int i = 0; i < AV_VIDEO_MAX_PLANES; i++) {
+        planes[i].firstSample = frame->data[i];
+        planes[i].rowByteStride = frame->linesize[i];
     }
-    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)
+    /* Allocate LCEVC Picture */
+    res = LCEVC_AllocPictureExternal(lcevc->decoder, &desc, NULL, planes, 
picture);
+    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;
 }
 

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to