You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
avcodec/mpegvideo: Redo resetting intra table entry
All callers check the corresponding entry of MpegEncContext.mbintra_table and if set (indicating that the intra tables might have been written to when decodeing a intra MB, so that they are "dirty"), call ff_clean_intra_table_entries(), which resets them to default values and resets the mbintra_table entry. Move resetting to the callers (via an inline function that also performs the checks). This currently has the advantage that the additional load of the mbintra_table ptr can be avoided. It will also allow to simplify ff_clean_intra_table_entries() (by using block_index[4] and [5]). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@ -44,4 +44,12 @@ void ff_h263_init_rl_inter(void);
|
||||
void ff_h263_update_motion_val(MpegEncContext * s);
|
||||
void ff_h263_loop_filter(MpegEncContext * s);
|
||||
|
||||
static inline void ff_h263_clean_intra_table_entries(MpegEncContext *s, int xy)
|
||||
{
|
||||
if (s->mbintra_table[xy]) {
|
||||
s->mbintra_table[xy] = 0;
|
||||
ff_clean_intra_table_entries(s);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* AVCODEC_H263_H */
|
||||
|
@ -260,8 +260,7 @@ static int decode_slice(MpegEncContext *s)
|
||||
if (s->h263_pred || s->h263_aic) {
|
||||
int mb_xy = s->mb_y * s->mb_stride + s->mb_x;
|
||||
if (!s->mb_intra) {
|
||||
if (s->mbintra_table[mb_xy])
|
||||
ff_clean_intra_table_entries(s);
|
||||
ff_h263_clean_intra_table_entries(s, mb_xy);
|
||||
} else
|
||||
s->mbintra_table[mb_xy] = 1;
|
||||
}
|
||||
|
@ -1073,8 +1073,7 @@ try_again:
|
||||
mot_val[1 + stride] =
|
||||
mot_val[3 + stride] = my;
|
||||
|
||||
if (s->mbintra_table[xy])
|
||||
ff_clean_intra_table_entries(s);
|
||||
ff_h263_clean_intra_table_entries(s, xy);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1103,8 +1102,7 @@ try_again:
|
||||
mot_val[1 + stride] =
|
||||
mot_val[3 + stride] = 0;
|
||||
} else {
|
||||
if (s->mbintra_table[xy])
|
||||
ff_clean_intra_table_entries(s);
|
||||
ff_h263_clean_intra_table_entries(s, xy);
|
||||
|
||||
if (s->pict_type == AV_PICTURE_TYPE_S &&
|
||||
ctx->vol_sprite_usage == GMC_SPRITE &&
|
||||
|
@ -508,8 +508,6 @@ void ff_clean_intra_table_entries(MpegEncContext *s)
|
||||
/* ac pred */
|
||||
memset(s->ac_val[1][xy], 0, 16 * sizeof(int16_t));
|
||||
memset(s->ac_val[2][xy], 0, 16 * sizeof(int16_t));
|
||||
|
||||
s->mbintra_table[xy]= 0;
|
||||
}
|
||||
|
||||
void ff_init_block_index(MpegEncContext *s){ //FIXME maybe rename
|
||||
|
@ -3559,8 +3559,11 @@ static int encode_thread(AVCodecContext *c, void *arg){
|
||||
if (s->c.mb_intra /* && I,P,S_TYPE */) {
|
||||
s->p_mv_table[xy][0]=0;
|
||||
s->p_mv_table[xy][1]=0;
|
||||
} else if ((s->c.h263_pred || s->c.h263_aic) && s->c.mbintra_table[xy])
|
||||
ff_clean_intra_table_entries(&s->c);
|
||||
#if CONFIG_H263_ENCODER
|
||||
} else if (s->c.h263_pred || s->c.h263_aic) {
|
||||
ff_h263_clean_intra_table_entries(&s->c, xy);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (s->c.avctx->flags & AV_CODEC_FLAG_PSNR) {
|
||||
int w= 16;
|
||||
|
Reference in New Issue
Block a user