diff --git a/libavcodec/h261.c b/libavcodec/h261.c index d4ad97cbef6f760e354b9b772839f05908f03fd2..ca8f29716e7093967b763cbee1c489a95bf4361a 100644 --- a/libavcodec/h261.c +++ b/libavcodec/h261.c @@ -57,14 +57,17 @@ typedef struct H261Context{ int gob_start_code_skipped; // 1 if gob start code is already read before gob header is read }H261Context; -void ff_h261_loop_filter(H261Context * h){ - MpegEncContext * const s = &h->s; +void ff_h261_loop_filter(MpegEncContext *s){ + H261Context * h= (H261Context*)s; const int linesize = s->linesize; const int uvlinesize= s->uvlinesize; uint8_t *dest_y = s->dest[0]; uint8_t *dest_cb= s->dest[1]; uint8_t *dest_cr= s->dest[2]; - + + if(!(IS_FIL (h->mtype))) + return; + s->dsp.h261_loop_filter(dest_y , linesize); s->dsp.h261_loop_filter(dest_y + 8, linesize); s->dsp.h261_loop_filter(dest_y + 8 * linesize , linesize); @@ -256,6 +259,7 @@ static int h261_decode_mb_skipped(H261Context *h, int mba1, int mba2 ) s->mv[0][0][0] = 0; s->mv[0][0][1] = 0; s->mb_skiped = 1; + h->mtype &= ~MB_TYPE_H261_FIL; MPV_decode_mb(s, s->block); } @@ -388,10 +392,6 @@ intra: MPV_decode_mb(s, s->block); - if(IS_FIL (h->mtype)){ - ff_h261_loop_filter(h); - } - return SLICE_OK; } diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index c27e8fe1a3b4e232d1dc7fceffc4264e6853cb18..2269609b1de1fc605ba2bac92a1802ba9851233f 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -2608,6 +2608,9 @@ if(s->quarter_sample) pix_op[s->chroma_x_shift][uvdxy](dest_cb, ptr_cb, uvlinesize, h >> s->chroma_y_shift); pix_op[s->chroma_x_shift][uvdxy](dest_cr, ptr_cr, uvlinesize, h >> s->chroma_y_shift); } + if(s->out_format == FMT_H261){ + ff_h261_loop_filter(s); + } } /* apply one mpeg motion vector to the three components */ @@ -2704,6 +2707,7 @@ static always_inline void mpeg_motion_lowres(MpegEncContext *s, pix_op[lowres](dest_cb, ptr_cb, uvlinesize, h >> s->chroma_y_shift, uvsx, uvsy); pix_op[lowres](dest_cr, ptr_cr, uvlinesize, h >> s->chroma_y_shift, uvsx, uvsy); } + //FIXME h261 lowres loop filter } //FIXME move to dsputil, avg variant, 16x16 version diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 19aa1bca2eccb6b3c447c9a89801d22559774912..49252aa9a23a5e21463072726eb37e6cdad4e301 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -863,6 +863,9 @@ extern const int16_t ff_mpeg4_default_non_intra_matrix[64]; extern const uint8_t ff_h263_chroma_qscale_table[32]; extern const uint8_t ff_h263_loop_filter_strength[32]; +/* h261.c */ +void ff_h261_loop_filter(MpegEncContext *s); + /* h263.c, h263dec.c */ int ff_h263_decode_init(AVCodecContext *avctx);