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
31#include "vc1_common.h"31#include "vc1_common.h"
32#include "vc1dsp.h"32#include "vc1dsp.h"
33 33
34#include "libavutil/mem_internal.h"
35
34#define AC_VLC_BITS 936#define AC_VLC_BITS 9
35 37
36/** Sequence quantizer mode */38/** Sequence quantizer mode */
@@ -399,6 +401,8 @@ typedef struct VC1Context{ · 362 unmodified lines
399 401
400 int parse_only; ///< Context is used within parser402 int parse_only; ///< Context is used within parser
401 int resync_marker; ///< could this stream contain resync markers403 int resync_marker; ///< could this stream contain resync markers
404
405 DECLARE_ALIGNED_32(int16_t, blocks)[6][64];
402} VC1Context;406} VC1Context;
403 407
404/**408/**
libavcodec/vc1_block.c+14−14
@@ -1950,22 +1950,22 @@ static int vc1_decode_b_mb(VC1Context *v) · 1949 unmodified lines
1950 if (i == 1 || i == 3 || s->mb_x)1950 if (i == 1 || i == 3 || s->mb_x)
1951 v->c_avail = v->mb_type[s->block_index[i] - 1];1951 v->c_avail = v->mb_type[s->block_index[i] - 1];
1952 1952
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,
1954 (i & 4) ? v->codingset2 : v->codingset);1954 (i & 4) ? v->codingset2 : v->codingset);
1955 if (ret < 0)1955 if (ret < 0)
1956 return ret;1956 return ret;
1957 if (CONFIG_GRAY && (i > 3) && (s->avctx->flags & AV_CODEC_FLAG_GRAY))1957 if (CONFIG_GRAY && (i > 3) && (s->avctx->flags & AV_CODEC_FLAG_GRAY))
1958 continue;1958 continue;
1959 v->vc1dsp.vc1_inv_trans_8x8(s->block[i]);1959 v->vc1dsp.vc1_inv_trans_8x8(v->blocks[i]);
1960 if (v->rangeredfrm)1960 if (v->rangeredfrm)
1961 for (j = 0; j < 64; j++)1961 for (j = 0; j < 64; j++)
1962 s->block[i][j] *= 2;1962 v->blocks[i][j] *= 2;
1963 s->idsp.put_signed_pixels_clamped(s->block[i],1963 s->idsp.put_signed_pixels_clamped(v->blocks[i],
1964 s->dest[dst_idx] + off,1964 s->dest[dst_idx] + off,
1965 i & 4 ? s->uvlinesize1965 i & 4 ? s->uvlinesize
1966 : s->linesize);1966 : s->linesize);
1967 } else if (val) {1967 } 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,
1969 first_block, s->dest[dst_idx] + off,1969 first_block, s->dest[dst_idx] + off,
1970 (i & 4) ? s->uvlinesize : s->linesize,1970 (i & 4) ? s->uvlinesize : s->linesize,
1971 CONFIG_GRAY && (i & 4) && (s->avctx->flags & AV_CODEC_FLAG_GRAY), NULL);1971 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
2031 if (i == 1 || i == 3 || s->mb_x)2031 if (i == 1 || i == 3 || s->mb_x)
2032 v->c_avail = v->mb_type[s->block_index[i] - 1];2032 v->c_avail = v->mb_type[s->block_index[i] - 1];
2033 2033
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,
2035 (i & 4) ? v->codingset2 : v->codingset);2035 (i & 4) ? v->codingset2 : v->codingset);
2036 if (ret < 0)2036 if (ret < 0)
2037 return ret;2037 return ret;
2038 if (CONFIG_GRAY && (i > 3) && (s->avctx->flags & AV_CODEC_FLAG_GRAY))2038 if (CONFIG_GRAY && (i > 3) && (s->avctx->flags & AV_CODEC_FLAG_GRAY))
2039 continue;2039 continue;
2040 v->vc1dsp.vc1_inv_trans_8x8(s->block[i]);2040 v->vc1dsp.vc1_inv_trans_8x8(v->blocks[i]);
2041 if (v->rangeredfrm)2041 if (v->rangeredfrm)
2042 for (j = 0; j < 64; j++)2042 for (j = 0; j < 64; j++)
2043 s->block[i][j] <<= 1;2043 v->blocks[i][j] <<= 1;
2044 off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize);2044 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],
2046 s->dest[dst_idx] + off,2046 s->dest[dst_idx] + off,
2047 (i & 4) ? s->uvlinesize2047 (i & 4) ? s->uvlinesize
2048 : s->linesize);2048 : s->linesize);
@@ -2129,7 +2129,7 @@ static int vc1_decode_b_mb_intfi(VC1Context *v) · 80 unmodified lines
2129 val = ((cbp >> (5 - i)) & 1);2129 val = ((cbp >> (5 - i)) & 1);
2130 off = (i & 4) ? 0 : (i & 1) * 8 + (i & 2) * 4 * s->linesize;2130 off = (i & 4) ? 0 : (i & 1) * 8 + (i & 2) * 4 * s->linesize;
2131 if (val) {2131 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,
2133 first_block, s->dest[dst_idx] + off,2133 first_block, s->dest[dst_idx] + off,
2134 (i & 4) ? s->uvlinesize : s->linesize,2134 (i & 4) ? s->uvlinesize : s->linesize,
2135 CONFIG_GRAY && (i & 4) && (s->avctx->flags & AV_CODEC_FLAG_GRAY), &block_tt);2135 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
2227 if (i == 1 || i == 3 || s->mb_x)2227 if (i == 1 || i == 3 || s->mb_x)
2228 v->c_avail = v->mb_type[s->block_index[i] - 1];2228 v->c_avail = v->mb_type[s->block_index[i] - 1];
2229 2229
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,
2231 (i & 4) ? v->codingset2 : v->codingset);2231 (i & 4) ? v->codingset2 : v->codingset);
2232 if (ret < 0)2232 if (ret < 0)
2233 return ret;2233 return ret;
2234 if (CONFIG_GRAY && i > 3 && (s->avctx->flags & AV_CODEC_FLAG_GRAY))2234 if (CONFIG_GRAY && i > 3 && (s->avctx->flags & AV_CODEC_FLAG_GRAY))
2235 continue;2235 continue;
2236 v->vc1dsp.vc1_inv_trans_8x8(s->block[i]);2236 v->vc1dsp.vc1_inv_trans_8x8(v->blocks[i]);
2237 if (i < 4) {2237 if (i < 4) {
2238 stride_y = s->linesize << fieldtx;2238 stride_y = s->linesize << fieldtx;
2239 off = (fieldtx) ? ((i & 1) * 8) + ((i & 2) >> 1) * s->linesize : (i & 1) * 8 + 4 * (i & 2) * s->linesize;2239 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
2241 stride_y = s->uvlinesize;2241 stride_y = s->uvlinesize;
2242 off = 0;2242 off = 0;
2243 }2243 }
2244 s->idsp.put_signed_pixels_clamped(s->block[i],2244 s->idsp.put_signed_pixels_clamped(v->blocks[i],
2245 s->dest[dst_idx] + off,2245 s->dest[dst_idx] + off,
2246 stride_y);2246 stride_y);
2247 }2247 }
@@ -2430,7 +2430,7 @@ static int vc1_decode_b_mb_intfr(VC1Context *v) · 182 unmodified lines
2430 else2430 else
2431 off = (i & 4) ? 0 : ((i & 1) * 8 + ((i > 1) * s->linesize));2431 off = (i & 4) ? 0 : ((i & 1) * 8 + ((i > 1) * s->linesize));
2432 if (val) {2432 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,
2434 first_block, s->dest[dst_idx] + off,2434 first_block, s->dest[dst_idx] + off,
2435 (i & 4) ? s->uvlinesize : (s->linesize << fieldtx),2435 (i & 4) ? s->uvlinesize : (s->linesize << fieldtx),
2436 CONFIG_GRAY && (i & 4) && (s->avctx->flags & AV_CODEC_FLAG_GRAY), &block_tt);2436 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
420 return AVERROR(ENOMEM);420 return AVERROR(ENOMEM);
421 }421 }
422 422
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],
424 s->mb_width, s->mb_height);424 s->mb_width, s->mb_height);
425 if (ret < 0)425 if (ret < 0)
426 return ret;426 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