You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
avcodec/intrax8: Don't pretend to need more than one int16_t[64]
Intrax8 needs only a single block. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@ -437,7 +437,7 @@ static void x8_ac_compensation(IntraX8Context *const w, const int direction,
|
|||||||
const int dc_level)
|
const int dc_level)
|
||||||
{
|
{
|
||||||
int t;
|
int t;
|
||||||
#define B(x,y) w->block[0][w->idct_permutation[(x) + (y) * 8]]
|
#define B(x,y) w->block[w->idct_permutation[(x) + (y) * 8]]
|
||||||
#define T(x) ((x) * dc_level + 0x8000) >> 16;
|
#define T(x) ((x) * dc_level + 0x8000) >> 16;
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case 0:
|
case 0:
|
||||||
@ -530,7 +530,7 @@ static int x8_decode_intra_mb(IntraX8Context *const w, const int chroma)
|
|||||||
int sign;
|
int sign;
|
||||||
|
|
||||||
av_assert2(w->orient < 12);
|
av_assert2(w->orient < 12);
|
||||||
w->bdsp.clear_block(w->block[0]);
|
w->bdsp.clear_block(w->block);
|
||||||
|
|
||||||
if (chroma)
|
if (chroma)
|
||||||
dc_mode = 2;
|
dc_mode = 2;
|
||||||
@ -591,7 +591,7 @@ static int x8_decode_intra_mb(IntraX8Context *const w, const int chroma)
|
|||||||
if (use_quant_matrix)
|
if (use_quant_matrix)
|
||||||
level = (level * quant_table[pos]) >> 8;
|
level = (level * quant_table[pos]) >> 8;
|
||||||
|
|
||||||
w->block[0][scantable[pos]] = level;
|
w->block[scantable[pos]] = level;
|
||||||
} while (!final);
|
} while (!final);
|
||||||
} else { // DC only
|
} else { // DC only
|
||||||
if (w->flat_dc && ((unsigned) (dc_level + 1)) < 3) { // [-1; 1]
|
if (w->flat_dc && ((unsigned) (dc_level + 1)) < 3) { // [-1; 1]
|
||||||
@ -613,9 +613,9 @@ static int x8_decode_intra_mb(IntraX8Context *const w, const int chroma)
|
|||||||
zeros_only = dc_level == 0;
|
zeros_only = dc_level == 0;
|
||||||
}
|
}
|
||||||
if (!chroma)
|
if (!chroma)
|
||||||
w->block[0][0] = dc_level * w->quant;
|
w->block[0] = dc_level * w->quant;
|
||||||
else
|
else
|
||||||
w->block[0][0] = dc_level * w->quant_dc_chroma;
|
w->block[0] = dc_level * w->quant_dc_chroma;
|
||||||
|
|
||||||
// there is !zero_only check in the original, but dc_level check is enough
|
// there is !zero_only check in the original, but dc_level check is enough
|
||||||
if ((unsigned int) (dc_level + 1) >= 3 && (w->edges & 3) != 3) {
|
if ((unsigned int) (dc_level + 1) >= 3 && (w->edges & 3) != 3) {
|
||||||
@ -624,7 +624,7 @@ static int x8_decode_intra_mb(IntraX8Context *const w, const int chroma)
|
|||||||
* -> 01'10' 10'10' 00'00' 00'01' 01'11' 11'00 => 0x6A017C */
|
* -> 01'10' 10'10' 00'00' 00'01' 01'11' 11'00 => 0x6A017C */
|
||||||
direction = (0x6A017C >> (w->orient * 2)) & 3;
|
direction = (0x6A017C >> (w->orient * 2)) & 3;
|
||||||
if (direction != 3) {
|
if (direction != 3) {
|
||||||
x8_ac_compensation(w, direction, w->block[0][0]);
|
x8_ac_compensation(w, direction, w->block[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -639,7 +639,7 @@ static int x8_decode_intra_mb(IntraX8Context *const w, const int chroma)
|
|||||||
if (!zeros_only)
|
if (!zeros_only)
|
||||||
w->wdsp.idct_add(w->dest[chroma],
|
w->wdsp.idct_add(w->dest[chroma],
|
||||||
w->frame->linesize[!!chroma],
|
w->frame->linesize[!!chroma],
|
||||||
w->block[0]);
|
w->block);
|
||||||
|
|
||||||
block_placed:
|
block_placed:
|
||||||
if (!chroma)
|
if (!chroma)
|
||||||
@ -678,7 +678,7 @@ static void x8_init_block_index(IntraX8Context *w, AVFrame *frame)
|
|||||||
|
|
||||||
av_cold int ff_intrax8_common_init(AVCodecContext *avctx,
|
av_cold int ff_intrax8_common_init(AVCodecContext *avctx,
|
||||||
IntraX8Context *w,
|
IntraX8Context *w,
|
||||||
int16_t (*block)[64],
|
int16_t block[64],
|
||||||
int mb_width, int mb_height)
|
int mb_width, int mb_height)
|
||||||
{
|
{
|
||||||
static AVOnce init_static_once = AV_ONCE_INIT;
|
static AVOnce init_static_once = AV_ONCE_INIT;
|
||||||
|
@ -38,7 +38,7 @@ typedef struct IntraX8Context {
|
|||||||
WMV2DSPContext wdsp;
|
WMV2DSPContext wdsp;
|
||||||
uint8_t idct_permutation[64];
|
uint8_t idct_permutation[64];
|
||||||
AVCodecContext *avctx;
|
AVCodecContext *avctx;
|
||||||
int16_t (*block)[64];
|
int16_t *block;
|
||||||
|
|
||||||
// set by the caller codec
|
// set by the caller codec
|
||||||
IntraX8DSPContext dsp;
|
IntraX8DSPContext dsp;
|
||||||
@ -82,7 +82,7 @@ typedef struct IntraX8Context {
|
|||||||
*/
|
*/
|
||||||
int ff_intrax8_common_init(AVCodecContext *avctx,
|
int ff_intrax8_common_init(AVCodecContext *avctx,
|
||||||
IntraX8Context *w,
|
IntraX8Context *w,
|
||||||
int16_t (*block)[64],
|
int16_t block[64],
|
||||||
int mb_width, int mb_height);
|
int mb_width, int mb_height);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -420,7 +420,7 @@ static av_cold int vc1_decode_init_alloc_tables(VC1Context *v)
|
|||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = ff_intrax8_common_init(s->avctx, &v->x8, s->block,
|
ret = ff_intrax8_common_init(s->avctx, &v->x8, s->block[0],
|
||||||
s->mb_width, s->mb_height);
|
s->mb_width, s->mb_height);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -581,7 +581,7 @@ static av_cold int wmv2_decode_init(AVCodecContext *avctx)
|
|||||||
|
|
||||||
decode_ext_header(w);
|
decode_ext_header(w);
|
||||||
|
|
||||||
return ff_intrax8_common_init(avctx, &w->x8, s->block,
|
return ff_intrax8_common_init(avctx, &w->x8, s->block[0],
|
||||||
s->mb_width, s->mb_height);
|
s->mb_width, s->mb_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user