PR #22841 opened by mkver
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22841
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22841.patch


>From a52e451ba4ece4af16a28cec1977ecfdf7c77b04 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <[email protected]>
Date: Thu, 16 Apr 2026 22:45:20 +0200
Subject: [PATCH] avcodec/cavs: Don't allocate block separately

Signed-off-by: Andreas Rheinhardt <[email protected]>
---
 libavcodec/cavs.c | 5 +----
 libavcodec/cavs.h | 2 +-
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/libavcodec/cavs.c b/libavcodec/cavs.c
index 4db6892452..034819d5c7 100644
--- a/libavcodec/cavs.c
+++ b/libavcodec/cavs.c
@@ -770,11 +770,10 @@ int ff_cavs_init_top_lines(AVSContext *h)
     h->col_mv        = av_calloc(h->mb_width * h->mb_height,
                                  4 * sizeof(*h->col_mv));
     h->col_type_base = av_mallocz(h->mb_width * h->mb_height);
-    h->block         = av_mallocz(64 * sizeof(int16_t));
 
     if (!h->top_qp || !h->top_mv[0] || !h->top_mv[1] || !h->top_pred_Y ||
         !h->top_border_y || !h->top_border_u || !h->top_border_v ||
-        !h->col_mv || !h->col_type_base || !h->block) {
+        !h->col_mv || !h->col_type_base) {
         av_freep(&h->top_qp);
         av_freep(&h->top_mv[0]);
         av_freep(&h->top_mv[1]);
@@ -784,7 +783,6 @@ int ff_cavs_init_top_lines(AVSContext *h)
         av_freep(&h->top_border_v);
         av_freep(&h->col_mv);
         av_freep(&h->col_type_base);
-        av_freep(&h->block);
         return AVERROR(ENOMEM);
     }
     return 0;
@@ -850,7 +848,6 @@ av_cold int ff_cavs_end(AVCodecContext *avctx)
     av_freep(&h->top_border_v);
     av_freep(&h->col_mv);
     av_freep(&h->col_type_base);
-    av_freep(&h->block);
     av_freep(&h->edge_emu_buffer);
     return 0;
 }
diff --git a/libavcodec/cavs.h b/libavcodec/cavs.h
index d3a88ca403..944ede7036 100644
--- a/libavcodec/cavs.h
+++ b/libavcodec/cavs.h
@@ -223,6 +223,7 @@ typedef struct AVSContext {
     int qp_fixed;
     int pic_qp_fixed;
     int cbp;
+    DECLARE_ALIGNED(32, int16_t, block)[64];
     uint8_t permutated_scantable[64];
 
     /** intra prediction is done with un-deblocked samples
@@ -244,7 +245,6 @@ typedef struct AVSContext {
     uint8_t *edge_emu_buffer;
 
     int got_keyframe;
-    int16_t *block;
 } AVSContext;
 
 extern const uint8_t     ff_cavs_chroma_qp[64];
-- 
2.52.0

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

Reply via email to