You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
avcodec/hq_hqa: Don't zero in small chunks, don't zero twice
Up until now, hq_decode_block() zeroed every block (of 128 bytes) before decoding a block; yet this is suboptimal for all modes, because all modes need to reset all the blocks they use anyway and so it should be done in one go for all blocks. For the alpha mode (where blocks need not be coded) all blocks are zeroed initially anyway, because decode_block() might not be doing it, so zeroing there again for the coded blocks is a waste. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@ -78,8 +78,6 @@ static int hq_decode_block(HQContext *c, GetBitContext *gb, int16_t block[64],
|
||||
const int32_t *q;
|
||||
int val, pos = 1;
|
||||
|
||||
memset(block, 0, 64 * sizeof(*block));
|
||||
|
||||
if (!is_hqa) {
|
||||
block[0] = get_sbits(gb, 9) * 64;
|
||||
q = hq_quants[qsel][is_chroma][get_bits(gb, 2)];
|
||||
@ -109,6 +107,8 @@ static int hq_decode_mb(HQContext *c, AVFrame *pic,
|
||||
int qgroup, flag;
|
||||
int i, ret;
|
||||
|
||||
memset(c->block, 0, 8 * sizeof(c->block[0]));
|
||||
|
||||
qgroup = get_bits(gb, 4);
|
||||
flag = get_bits1(gb);
|
||||
|
||||
@ -197,8 +197,7 @@ static int hqa_decode_mb(HQContext *c, AVFrame *pic, int qgroup,
|
||||
if (get_bits_left(gb) < 1)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
for (i = 0; i < 12; i++)
|
||||
memset(c->block[i], 0, sizeof(*c->block));
|
||||
memset(c->block, 0, 12 * sizeof(c->block[0]));
|
||||
for (i = 0; i < 12; i++)
|
||||
c->block[i][0] = -128 * (1 << 6);
|
||||
|
||||
|
Reference in New Issue
Block a user