[FFmpeg-cvslog] avcodec/vc1: Don't use MpegEncContext.block
Andreas Rheinhardt
git at videolan.org
Thu Jul 3 21:55:42 EEST 2025
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Mon Jun 16 00:52:25 2025 +0200| [94cfbf02385e00720a8d2261975215ee20254edf] | committer: Andreas Rheinhardt
avcodec/vc1: Don't use MpegEncContext.block
Instead add the necessary blocks directly to VC1Context
(only six are needed, not 12 as ff_mpv_common_init()
currently allocates).
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=94cfbf02385e00720a8d2261975215ee20254edf
---
libavcodec/vc1.h | 4 ++++
libavcodec/vc1_block.c | 28 ++++++++++++++--------------
libavcodec/vc1dec.c | 2 +-
3 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/libavcodec/vc1.h b/libavcodec/vc1.h
index 1be97aebfd..5eee646e31 100644
--- a/libavcodec/vc1.h
+++ b/libavcodec/vc1.h
@@ -31,6 +31,8 @@
#include "vc1_common.h"
#include "vc1dsp.h"
+#include "libavutil/mem_internal.h"
+
#define AC_VLC_BITS 9
/** Sequence quantizer mode */
@@ -399,6 +401,8 @@ typedef struct VC1Context{
int parse_only; ///< Context is used within parser
int resync_marker; ///< could this stream contain resync markers
+
+ DECLARE_ALIGNED_32(int16_t, blocks)[6][64];
} VC1Context;
/**
diff --git a/libavcodec/vc1_block.c b/libavcodec/vc1_block.c
index 0e709f5f08..165d875458 100644
--- a/libavcodec/vc1_block.c
+++ b/libavcodec/vc1_block.c
@@ -1950,22 +1950,22 @@ static int vc1_decode_b_mb(VC1Context *v)
if (i == 1 || i == 3 || s->mb_x)
v->c_avail = v->mb_type[s->block_index[i] - 1];
- ret = vc1_decode_intra_block(v, s->block[i], i, val, mquant,
+ ret = vc1_decode_intra_block(v, v->blocks[i], i, val, mquant,
(i & 4) ? v->codingset2 : v->codingset);
if (ret < 0)
return ret;
if (CONFIG_GRAY && (i > 3) && (s->avctx->flags & AV_CODEC_FLAG_GRAY))
continue;
- v->vc1dsp.vc1_inv_trans_8x8(s->block[i]);
+ v->vc1dsp.vc1_inv_trans_8x8(v->blocks[i]);
if (v->rangeredfrm)
for (j = 0; j < 64; j++)
- s->block[i][j] *= 2;
- s->idsp.put_signed_pixels_clamped(s->block[i],
+ v->blocks[i][j] *= 2;
+ s->idsp.put_signed_pixels_clamped(v->blocks[i],
s->dest[dst_idx] + off,
i & 4 ? s->uvlinesize
: s->linesize);
} else if (val) {
- int pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb,
+ int pat = vc1_decode_p_block(v, v->blocks[i], i, mquant, ttmb,
first_block, s->dest[dst_idx] + off,
(i & 4) ? s->uvlinesize : s->linesize,
CONFIG_GRAY && (i & 4) && (s->avctx->flags & AV_CODEC_FLAG_GRAY), NULL);
@@ -2031,18 +2031,18 @@ static int vc1_decode_b_mb_intfi(VC1Context *v)
if (i == 1 || i == 3 || s->mb_x)
v->c_avail = v->mb_type[s->block_index[i] - 1];
- ret = vc1_decode_intra_block(v, s->block[i], i, val, mquant,
+ ret = vc1_decode_intra_block(v, v->blocks[i], i, val, mquant,
(i & 4) ? v->codingset2 : v->codingset);
if (ret < 0)
return ret;
if (CONFIG_GRAY && (i > 3) && (s->avctx->flags & AV_CODEC_FLAG_GRAY))
continue;
- v->vc1dsp.vc1_inv_trans_8x8(s->block[i]);
+ v->vc1dsp.vc1_inv_trans_8x8(v->blocks[i]);
if (v->rangeredfrm)
for (j = 0; j < 64; j++)
- s->block[i][j] <<= 1;
+ v->blocks[i][j] <<= 1;
off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize);
- s->idsp.put_signed_pixels_clamped(s->block[i],
+ s->idsp.put_signed_pixels_clamped(v->blocks[i],
s->dest[dst_idx] + off,
(i & 4) ? s->uvlinesize
: s->linesize);
@@ -2129,7 +2129,7 @@ static int vc1_decode_b_mb_intfi(VC1Context *v)
val = ((cbp >> (5 - i)) & 1);
off = (i & 4) ? 0 : (i & 1) * 8 + (i & 2) * 4 * s->linesize;
if (val) {
- pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb,
+ pat = vc1_decode_p_block(v, v->blocks[i], i, mquant, ttmb,
first_block, s->dest[dst_idx] + off,
(i & 4) ? s->uvlinesize : s->linesize,
CONFIG_GRAY && (i & 4) && (s->avctx->flags & AV_CODEC_FLAG_GRAY), &block_tt);
@@ -2227,13 +2227,13 @@ static int vc1_decode_b_mb_intfr(VC1Context *v)
if (i == 1 || i == 3 || s->mb_x)
v->c_avail = v->mb_type[s->block_index[i] - 1];
- ret = vc1_decode_intra_block(v, s->block[i], i, val, mquant,
+ ret = vc1_decode_intra_block(v, v->blocks[i], i, val, mquant,
(i & 4) ? v->codingset2 : v->codingset);
if (ret < 0)
return ret;
if (CONFIG_GRAY && i > 3 && (s->avctx->flags & AV_CODEC_FLAG_GRAY))
continue;
- v->vc1dsp.vc1_inv_trans_8x8(s->block[i]);
+ v->vc1dsp.vc1_inv_trans_8x8(v->blocks[i]);
if (i < 4) {
stride_y = s->linesize << fieldtx;
off = (fieldtx) ? ((i & 1) * 8) + ((i & 2) >> 1) * s->linesize : (i & 1) * 8 + 4 * (i & 2) * s->linesize;
@@ -2241,7 +2241,7 @@ static int vc1_decode_b_mb_intfr(VC1Context *v)
stride_y = s->uvlinesize;
off = 0;
}
- s->idsp.put_signed_pixels_clamped(s->block[i],
+ s->idsp.put_signed_pixels_clamped(v->blocks[i],
s->dest[dst_idx] + off,
stride_y);
}
@@ -2430,7 +2430,7 @@ static int vc1_decode_b_mb_intfr(VC1Context *v)
else
off = (i & 4) ? 0 : ((i & 1) * 8 + ((i > 1) * s->linesize));
if (val) {
- pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb,
+ pat = vc1_decode_p_block(v, v->blocks[i], i, mquant, ttmb,
first_block, s->dest[dst_idx] + off,
(i & 4) ? s->uvlinesize : (s->linesize << fieldtx),
CONFIG_GRAY && (i & 4) && (s->avctx->flags & AV_CODEC_FLAG_GRAY), &block_tt);
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 9c942929b5..de6d9ef7a9 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -420,7 +420,7 @@ static av_cold int vc1_decode_init_alloc_tables(VC1Context *v)
return AVERROR(ENOMEM);
}
- ret = ff_intrax8_common_init(s->avctx, &v->x8, s->block[0],
+ ret = ff_intrax8_common_init(s->avctx, &v->x8, v->blocks[0],
s->mb_width, s->mb_height);
if (ret < 0)
return ret;
More information about the ffmpeg-cvslog
mailing list