History

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).

Andreas Rheinhardt committed 1 year ago

Commit 94cfbf01 parent fe2dbb13 files · +19 −15Browse files

Unified · Split

3 files
  1. libavcodec/vc1.h +4 −0
  2. libavcodec/vc1_block.c +14 −14
  3. libavcodec/vc1dec.c +1 −1
libavcodec/vc1.h+4−0
@@ -31,6 +31,8 @@ · 30 unmodified lines
3131 #include "vc1_common.h"
3232 #include "vc1dsp.h"
3333
34+#include "libavutil/mem_internal.h"
35+
3436 #define AC_VLC_BITS 9
3537
3638 /** Sequence quantizer mode */
@@ -399,6 +401,8 @@ typedef struct VC1Context{ · 362 unmodified lines
399401
400402 int parse_only; ///< Context is used within parser
401403 int resync_marker; ///< could this stream contain resync markers
404+
405+ DECLARE_ALIGNED_32(int16_t, blocks)[6][64];
402406 } VC1Context;
403407
404408 /**
libavcodec/vc1_block.c+14−14
@@ -1950,22 +1950,22 @@ static int vc1_decode_b_mb(VC1Context *v) · 1949 unmodified lines
19501950 if (i == 1 || i == 3 || s->mb_x)
19511951 v->c_avail = v->mb_type[s->block_index[i] - 1];
19521952
1953− ret = vc1_decode_intra_block(v, s->block[i], i, val, mquant,
1953+ ret = vc1_decode_intra_block(v, v->blocks[i], i, val, mquant,
19541954 (i & 4) ? v->codingset2 : v->codingset);
19551955 if (ret < 0)
19561956 return ret;
19571957 if (CONFIG_GRAY && (i > 3) && (s->avctx->flags & AV_CODEC_FLAG_GRAY))
19581958 continue;
1959− v->vc1dsp.vc1_inv_trans_8x8(s->block[i]);
1959+ v->vc1dsp.vc1_inv_trans_8x8(v->blocks[i]);
19601960 if (v->rangeredfrm)
19611961 for (j = 0; j < 64; j++)
1962− s->block[i][j] *= 2;
1963− s->idsp.put_signed_pixels_clamped(s->block[i],
1962+ v->blocks[i][j] *= 2;
1963+ s->idsp.put_signed_pixels_clamped(v->blocks[i],
19641964 s->dest[dst_idx] + off,
19651965 i & 4 ? s->uvlinesize
19661966 : s->linesize);
19671967 } else if (val) {
1968− int pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb,
1968+ int pat = vc1_decode_p_block(v, v->blocks[i], i, mquant, ttmb,
19691969 first_block, s->dest[dst_idx] + off,
19701970 (i & 4) ? s->uvlinesize : s->linesize,
19711971 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) · 59 unmodified lines
20312031 if (i == 1 || i == 3 || s->mb_x)
20322032 v->c_avail = v->mb_type[s->block_index[i] - 1];
20332033
2034− ret = vc1_decode_intra_block(v, s->block[i], i, val, mquant,
2034+ ret = vc1_decode_intra_block(v, v->blocks[i], i, val, mquant,
20352035 (i & 4) ? v->codingset2 : v->codingset);
20362036 if (ret < 0)
20372037 return ret;
20382038 if (CONFIG_GRAY && (i > 3) && (s->avctx->flags & AV_CODEC_FLAG_GRAY))
20392039 continue;
2040− v->vc1dsp.vc1_inv_trans_8x8(s->block[i]);
2040+ v->vc1dsp.vc1_inv_trans_8x8(v->blocks[i]);
20412041 if (v->rangeredfrm)
20422042 for (j = 0; j < 64; j++)
2043− s->block[i][j] <<= 1;
2043+ v->blocks[i][j] <<= 1;
20442044 off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize);
2045− s->idsp.put_signed_pixels_clamped(s->block[i],
2045+ s->idsp.put_signed_pixels_clamped(v->blocks[i],
20462046 s->dest[dst_idx] + off,
20472047 (i & 4) ? s->uvlinesize
20482048 : s->linesize);
@@ -2129,7 +2129,7 @@ static int vc1_decode_b_mb_intfi(VC1Context *v) · 80 unmodified lines
21292129 val = ((cbp >> (5 - i)) & 1);
21302130 off = (i & 4) ? 0 : (i & 1) * 8 + (i & 2) * 4 * s->linesize;
21312131 if (val) {
2132− pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb,
2132+ pat = vc1_decode_p_block(v, v->blocks[i], i, mquant, ttmb,
21332133 first_block, s->dest[dst_idx] + off,
21342134 (i & 4) ? s->uvlinesize : s->linesize,
21352135 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) · 91 unmodified lines
22272227 if (i == 1 || i == 3 || s->mb_x)
22282228 v->c_avail = v->mb_type[s->block_index[i] - 1];
22292229
2230− ret = vc1_decode_intra_block(v, s->block[i], i, val, mquant,
2230+ ret = vc1_decode_intra_block(v, v->blocks[i], i, val, mquant,
22312231 (i & 4) ? v->codingset2 : v->codingset);
22322232 if (ret < 0)
22332233 return ret;
22342234 if (CONFIG_GRAY && i > 3 && (s->avctx->flags & AV_CODEC_FLAG_GRAY))
22352235 continue;
2236− v->vc1dsp.vc1_inv_trans_8x8(s->block[i]);
2236+ v->vc1dsp.vc1_inv_trans_8x8(v->blocks[i]);
22372237 if (i < 4) {
22382238 stride_y = s->linesize << fieldtx;
22392239 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) · 1 unmodified line
22412241 stride_y = s->uvlinesize;
22422242 off = 0;
22432243 }
2244− s->idsp.put_signed_pixels_clamped(s->block[i],
2244+ s->idsp.put_signed_pixels_clamped(v->blocks[i],
22452245 s->dest[dst_idx] + off,
22462246 stride_y);
22472247 }
@@ -2430,7 +2430,7 @@ static int vc1_decode_b_mb_intfr(VC1Context *v) · 182 unmodified lines
24302430 else
24312431 off = (i & 4) ? 0 : ((i & 1) * 8 + ((i > 1) * s->linesize));
24322432 if (val) {
2433− pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb,
2433+ pat = vc1_decode_p_block(v, v->blocks[i], i, mquant, ttmb,
24342434 first_block, s->dest[dst_idx] + off,
24352435 (i & 4) ? s->uvlinesize : (s->linesize << fieldtx),
24362436 CONFIG_GRAY && (i & 4) && (s->avctx->flags & AV_CODEC_FLAG_GRAY), &block_tt);
libavcodec/vc1dec.c+1−1
@@ -420,7 +420,7 @@ static av_cold int vc1_decode_init_alloc_tables(VC1Context *v) · 419 unmodified lines
420420 return AVERROR(ENOMEM);
421421 }
422422
423− ret = ff_intrax8_common_init(s->avctx, &v->x8, s->block[0],
423+ ret = ff_intrax8_common_init(s->avctx, &v->x8, v->blocks[0],
424424 s->mb_width, s->mb_height);
425425 if (ret < 0)
426426 return ret;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t