You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
avcodec/intrax8: Stop setting write-only block_last_index
These values are only used by the mpegvideo unquantize functions, yet these are not active when intrax is in use. Furthermore, given that ff_intrax8_decode_picture() decodes multiple macroblocks in a given call, it makes no sense to return any value (that was in practice the maximum of the indices of all the macroblocks decoded). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@ -480,24 +480,18 @@ static void x8_ac_compensation(IntraX8Context *const w, const int direction,
|
|||||||
|
|
||||||
t = T(1084); // g
|
t = T(1084); // g
|
||||||
B(1, 1) += t;
|
B(1, 1) += t;
|
||||||
|
|
||||||
w->block_last_index[0] = FFMAX(w->block_last_index[0], 7 * 8);
|
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
B(0, 1) -= T(6269);
|
B(0, 1) -= T(6269);
|
||||||
B(0, 3) -= T(708);
|
B(0, 3) -= T(708);
|
||||||
B(0, 5) -= T(172);
|
B(0, 5) -= T(172);
|
||||||
B(0, 7) -= T(73);
|
B(0, 7) -= T(73);
|
||||||
|
|
||||||
w->block_last_index[0] = FFMAX(w->block_last_index[0], 7 * 8);
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
B(1, 0) -= T(6269);
|
B(1, 0) -= T(6269);
|
||||||
B(3, 0) -= T(708);
|
B(3, 0) -= T(708);
|
||||||
B(5, 0) -= T(172);
|
B(5, 0) -= T(172);
|
||||||
B(7, 0) -= T(73);
|
B(7, 0) -= T(73);
|
||||||
|
|
||||||
w->block_last_index[0] = FFMAX(w->block_last_index[0], 7);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#undef B
|
#undef B
|
||||||
@ -599,10 +593,7 @@ static int x8_decode_intra_mb(IntraX8Context *const w, const int chroma)
|
|||||||
|
|
||||||
w->block[0][scantable[pos]] = level;
|
w->block[0][scantable[pos]] = level;
|
||||||
} while (!final);
|
} while (!final);
|
||||||
|
|
||||||
w->block_last_index[0] = pos;
|
|
||||||
} else { // DC only
|
} else { // DC only
|
||||||
w->block_last_index[0] = 0;
|
|
||||||
if (w->flat_dc && ((unsigned) (dc_level + 1)) < 3) { // [-1; 1]
|
if (w->flat_dc && ((unsigned) (dc_level + 1)) < 3) { // [-1; 1]
|
||||||
int32_t divide_quant = !chroma ? w->divide_quant_dc_luma
|
int32_t divide_quant = !chroma ? w->divide_quant_dc_luma
|
||||||
: w->divide_quant_dc_chroma;
|
: w->divide_quant_dc_chroma;
|
||||||
@ -633,7 +624,6 @@ 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) {
|
||||||
// modify block_last[]
|
|
||||||
x8_ac_compensation(w, direction, w->block[0][0]);
|
x8_ac_compensation(w, direction, w->block[0][0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -689,7 +679,6 @@ 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 block_last_index[12],
|
|
||||||
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;
|
||||||
@ -698,7 +687,6 @@ av_cold int ff_intrax8_common_init(AVCodecContext *avctx,
|
|||||||
w->mb_width = mb_width;
|
w->mb_width = mb_width;
|
||||||
w->mb_height = mb_height;
|
w->mb_height = mb_height;
|
||||||
w->block = block;
|
w->block = block;
|
||||||
w->block_last_index = block_last_index;
|
|
||||||
|
|
||||||
// two rows, 2 blocks per cannon mb
|
// two rows, 2 blocks per cannon mb
|
||||||
w->prediction_table = av_mallocz(w->mb_width * 2 * 2);
|
w->prediction_table = av_mallocz(w->mb_width * 2 * 2);
|
||||||
|
@ -38,7 +38,6 @@ typedef struct IntraX8Context {
|
|||||||
WMV2DSPContext wdsp;
|
WMV2DSPContext wdsp;
|
||||||
uint8_t idct_permutation[64];
|
uint8_t idct_permutation[64];
|
||||||
AVCodecContext *avctx;
|
AVCodecContext *avctx;
|
||||||
int *block_last_index; ///< last nonzero coefficient in block
|
|
||||||
int16_t (*block)[64];
|
int16_t (*block)[64];
|
||||||
|
|
||||||
// set by the caller codec
|
// set by the caller codec
|
||||||
@ -77,7 +76,6 @@ typedef struct IntraX8Context {
|
|||||||
* @param avctx pointer to AVCodecContext
|
* @param avctx pointer to AVCodecContext
|
||||||
* @param w pointer to IntraX8Context
|
* @param w pointer to IntraX8Context
|
||||||
* @param block pointer to block array
|
* @param block pointer to block array
|
||||||
* @param block_last_index pointer to index array
|
|
||||||
* @param mb_width macroblock width
|
* @param mb_width macroblock width
|
||||||
* @param mb_height macroblock height
|
* @param mb_height macroblock height
|
||||||
* @return 0 on success, a negative AVERROR value on error
|
* @return 0 on success, a negative AVERROR value on error
|
||||||
@ -85,7 +83,6 @@ 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 block_last_index[12],
|
|
||||||
int mb_width, int mb_height);
|
int mb_width, int mb_height);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -422,8 +422,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,
|
ret = ff_intrax8_common_init(s->avctx, &v->x8, s->block,
|
||||||
s->block, s->block_last_index,
|
|
||||||
s->mb_width, s->mb_height);
|
s->mb_width, s->mb_height);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -575,8 +575,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,
|
return ff_intrax8_common_init(avctx, &w->x8, w->s.block,
|
||||||
w->s.block, w->s.block_last_index,
|
|
||||||
w->s.mb_width, w->s.mb_height);
|
w->s.mb_width, w->s.mb_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user