mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avcodec/mpegvideo: Don't use ScanTable where unnecessary
For the intra_[hv]_scantables, only ScanTable.permutated is used, so one only needs to keep that. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
33b838aad6
commit
5ec9d26b2b
@ -544,9 +544,9 @@ static int h263_decode_block(MpegEncContext * s, int16_t * block,
|
||||
i = 0;
|
||||
if (s->ac_pred) {
|
||||
if (s->h263_aic_dir)
|
||||
scan_table = s->intra_v_scantable.permutated; /* left */
|
||||
scan_table = s->permutated_intra_v_scantable; /* left */
|
||||
else
|
||||
scan_table = s->intra_h_scantable.permutated; /* top */
|
||||
scan_table = s->permutated_intra_h_scantable; /* top */
|
||||
}
|
||||
} else if (s->mb_intra) {
|
||||
/* DC coef */
|
||||
|
@ -1327,9 +1327,9 @@ static inline int mpeg4_decode_block(Mpeg4DecContext *ctx, int16_t *block,
|
||||
}
|
||||
if (s->ac_pred) {
|
||||
if (dc_pred_dir == 0)
|
||||
scan_table = s->intra_v_scantable.permutated; /* left */
|
||||
scan_table = s->permutated_intra_v_scantable; /* left */
|
||||
else
|
||||
scan_table = s->intra_h_scantable.permutated; /* top */
|
||||
scan_table = s->permutated_intra_h_scantable; /* top */
|
||||
} else {
|
||||
scan_table = s->intra_scantable.permutated;
|
||||
}
|
||||
@ -3258,13 +3258,17 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb,
|
||||
if (s->alternate_scan) {
|
||||
ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, ff_alternate_vertical_scan);
|
||||
ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_alternate_vertical_scan);
|
||||
ff_init_scantable(s->idsp.idct_permutation, &s->intra_h_scantable, ff_alternate_vertical_scan);
|
||||
ff_init_scantable(s->idsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan);
|
||||
ff_permute_scantable(s->permutated_intra_h_scantable, ff_alternate_vertical_scan,
|
||||
s->idsp.idct_permutation);
|
||||
ff_permute_scantable(s->permutated_intra_v_scantable, ff_alternate_vertical_scan,
|
||||
s->idsp.idct_permutation);
|
||||
} else {
|
||||
ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, ff_zigzag_direct);
|
||||
ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_zigzag_direct);
|
||||
ff_init_scantable(s->idsp.idct_permutation, &s->intra_h_scantable, ff_alternate_horizontal_scan);
|
||||
ff_init_scantable(s->idsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan);
|
||||
ff_permute_scantable(s->permutated_intra_h_scantable, ff_alternate_horizontal_scan,
|
||||
s->idsp.idct_permutation);
|
||||
ff_permute_scantable(s->permutated_intra_v_scantable, ff_alternate_vertical_scan,
|
||||
s->idsp.idct_permutation);
|
||||
}
|
||||
|
||||
/* Skip at this point when only parsing since the remaining
|
||||
@ -3432,13 +3436,17 @@ static int decode_studio_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb)
|
||||
if (s->alternate_scan) {
|
||||
ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, ff_alternate_vertical_scan);
|
||||
ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_alternate_vertical_scan);
|
||||
ff_init_scantable(s->idsp.idct_permutation, &s->intra_h_scantable, ff_alternate_vertical_scan);
|
||||
ff_init_scantable(s->idsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan);
|
||||
ff_permute_scantable(s->permutated_intra_h_scantable, ff_alternate_vertical_scan,
|
||||
s->idsp.idct_permutation);
|
||||
ff_permute_scantable(s->permutated_intra_v_scantable, ff_alternate_vertical_scan,
|
||||
s->idsp.idct_permutation);
|
||||
} else {
|
||||
ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, ff_zigzag_direct);
|
||||
ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_zigzag_direct);
|
||||
ff_init_scantable(s->idsp.idct_permutation, &s->intra_h_scantable, ff_alternate_horizontal_scan);
|
||||
ff_init_scantable(s->idsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan);
|
||||
ff_permute_scantable(s->permutated_intra_h_scantable, ff_alternate_horizontal_scan,
|
||||
s->idsp.idct_permutation);
|
||||
ff_permute_scantable(s->permutated_intra_v_scantable, ff_alternate_vertical_scan,
|
||||
s->idsp.idct_permutation);
|
||||
}
|
||||
|
||||
mpeg4_load_default_matrices(s);
|
||||
|
@ -175,7 +175,7 @@ static inline int decide_ac_pred(MpegEncContext *s, int16_t block[6][64],
|
||||
ac_val1[i + 8] = level;
|
||||
}
|
||||
}
|
||||
st[n] = s->intra_h_scantable.permutated;
|
||||
st[n] = s->permutated_intra_h_scantable;
|
||||
} else {
|
||||
const int xy = s->mb_x - 1 + s->mb_y * s->mb_stride;
|
||||
/* left prediction */
|
||||
@ -197,7 +197,7 @@ static inline int decide_ac_pred(MpegEncContext *s, int16_t block[6][64],
|
||||
ac_val1[i + 8] = block[n][s->idsp.idct_permutation[i]];
|
||||
}
|
||||
}
|
||||
st[n] = s->intra_v_scantable.permutated;
|
||||
st[n] = s->permutated_intra_v_scantable;
|
||||
}
|
||||
|
||||
for (i = 63; i > 0; i--) // FIXME optimize
|
||||
|
@ -357,8 +357,10 @@ av_cold void ff_mpv_idct_init(MpegEncContext *s)
|
||||
ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, ff_zigzag_direct);
|
||||
ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_zigzag_direct);
|
||||
}
|
||||
ff_init_scantable(s->idsp.idct_permutation, &s->intra_h_scantable, ff_alternate_horizontal_scan);
|
||||
ff_init_scantable(s->idsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan);
|
||||
ff_permute_scantable(s->permutated_intra_h_scantable, ff_alternate_horizontal_scan,
|
||||
s->idsp.idct_permutation);
|
||||
ff_permute_scantable(s->permutated_intra_v_scantable, ff_alternate_vertical_scan,
|
||||
s->idsp.idct_permutation);
|
||||
}
|
||||
|
||||
static int init_duplicate_context(MpegEncContext *s)
|
||||
|
@ -82,8 +82,8 @@ typedef struct MpegEncContext {
|
||||
* offsets used in ASM. */
|
||||
|
||||
ScanTable intra_scantable;
|
||||
ScanTable intra_h_scantable;
|
||||
ScanTable intra_v_scantable;
|
||||
uint8_t permutated_intra_h_scantable[64];
|
||||
uint8_t permutated_intra_v_scantable[64];
|
||||
|
||||
struct AVCodecContext *avctx;
|
||||
/* The following pointer is intended for codecs sharing code
|
||||
|
@ -150,9 +150,11 @@ av_cold void ff_msmpeg4_common_init(MpegEncContext *s)
|
||||
|
||||
if(s->msmpeg4_version>=4){
|
||||
ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_wmv1_scantable[1]);
|
||||
ff_init_scantable(s->idsp.idct_permutation, &s->intra_h_scantable, ff_wmv1_scantable[2]);
|
||||
ff_init_scantable(s->idsp.idct_permutation, &s->intra_v_scantable, ff_wmv1_scantable[3]);
|
||||
ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, ff_wmv1_scantable[0]);
|
||||
ff_permute_scantable(s->permutated_intra_h_scantable, ff_wmv1_scantable[2],
|
||||
s->idsp.idct_permutation);
|
||||
ff_permute_scantable(s->permutated_intra_v_scantable, ff_wmv1_scantable[3],
|
||||
s->idsp.idct_permutation);
|
||||
}
|
||||
//Note the default tables are set in common_init in mpegvideo.c
|
||||
|
||||
|
@ -687,9 +687,9 @@ int ff_msmpeg4_decode_block(MpegEncContext * s, int16_t * block,
|
||||
}
|
||||
if (s->ac_pred) {
|
||||
if (dc_pred_dir == 0)
|
||||
scan_table = s->intra_v_scantable.permutated; /* left */
|
||||
scan_table = s->permutated_intra_v_scantable; /* left */
|
||||
else
|
||||
scan_table = s->intra_h_scantable.permutated; /* top */
|
||||
scan_table = s->permutated_intra_h_scantable; /* top */
|
||||
} else {
|
||||
scan_table = s->intra_scantable.permutated;
|
||||
}
|
||||
|
@ -36,12 +36,12 @@ av_cold void ff_wmv2_common_init(MpegEncContext *s)
|
||||
w->wdsp.idct_perm);
|
||||
ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable,
|
||||
ff_wmv1_scantable[1]);
|
||||
ff_init_scantable(s->idsp.idct_permutation, &s->intra_h_scantable,
|
||||
ff_wmv1_scantable[2]);
|
||||
ff_init_scantable(s->idsp.idct_permutation, &s->intra_v_scantable,
|
||||
ff_wmv1_scantable[3]);
|
||||
ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable,
|
||||
ff_wmv1_scantable[0]);
|
||||
ff_permute_scantable(s->permutated_intra_h_scantable, ff_wmv1_scantable[2],
|
||||
s->idsp.idct_permutation);
|
||||
ff_permute_scantable(s->permutated_intra_v_scantable, ff_wmv1_scantable[3],
|
||||
s->idsp.idct_permutation);
|
||||
s->idsp.idct_put = w->wdsp.idct_put;
|
||||
s->idsp.idct_add = w->wdsp.idct_add;
|
||||
s->idsp.idct = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user