@@ -91,15 +91,6 @@ void ff_h263_update_motion_val(MpegEncContext * s){
s->current_picture.motion_val[0][xy + 1 + wrap][0] = motion_x;
s->current_picture.motion_val[0][xy + 1 + wrap][1] = motion_y;
}
-
- if(s->encoding){ //FIXME encoding MUST be cleaned up
- if (s->mv_type == MV_TYPE_8X8)
- s->current_picture.mb_type[mb_xy] = MB_TYPE_L0 | MB_TYPE_8x8;
- else if(s->mb_intra)
- s->current_picture.mb_type[mb_xy] = MB_TYPE_INTRA;
- else
- s->current_picture.mb_type[mb_xy] = MB_TYPE_L0 | MB_TYPE_16x16;
- }
}
void ff_h263_loop_filter(MpegEncContext * s){
@@ -36,7 +36,7 @@ void ff_init_qscale_tab(MpegEncContext *s);
void ff_clean_h263_qscales(MpegEncContext *s);
void ff_h263_encode_motion(PutBitContext *pb, int val, int f_code);
-
+void ff_h263_update_mb(MpegEncContext *s);
static inline int h263_get_motion_length(int val, int f_code)
{
@@ -688,6 +688,20 @@ void ff_h263_encode_mb(MpegEncContext * s,
}
}
+void ff_h263_update_mb(MpegEncContext *s)
+{
+ const int mb_xy = s->mb_y * s->mb_stride + s->mb_x;
+
+ if (s->mv_type == MV_TYPE_8X8)
+ s->current_picture.mb_type[mb_xy] = MB_TYPE_L0 | MB_TYPE_8x8;
+ else if(s->mb_intra)
+ s->current_picture.mb_type[mb_xy] = MB_TYPE_INTRA;
+ else
+ s->current_picture.mb_type[mb_xy] = MB_TYPE_L0 | MB_TYPE_16x16;
+
+ ff_h263_update_motion_val(s);
+}
+
void ff_h263_encode_motion(PutBitContext *pb, int val, int f_code)
{
int range, bit_size, sign, code, bits;
@@ -3314,7 +3314,7 @@ static int encode_thread(AVCodecContext *c, void *arg){
if (CONFIG_H263_ENCODER &&
s->out_format == FMT_H263 && s->pict_type!=AV_PICTURE_TYPE_B)
- ff_h263_update_motion_val(s);
+ ff_h263_update_mb(s);
if(next_block==0){ //FIXME 16 vs linesize16
s->hdsp.put_pixels_tab[0][0](s->dest[0], s->sc.rd_scratchpad , s->linesize ,16);
@@ -3440,7 +3440,7 @@ static int encode_thread(AVCodecContext *c, void *arg){
if (CONFIG_H263_ENCODER &&
s->out_format == FMT_H263 && s->pict_type!=AV_PICTURE_TYPE_B)
- ff_h263_update_motion_val(s);
+ ff_h263_update_mb(s);
mpv_reconstruct_mb(s, s->block);
}
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/h263.c | 9 --------- libavcodec/h263enc.h | 2 +- libavcodec/ituh263enc.c | 14 ++++++++++++++ libavcodec/mpegvideo_enc.c | 4 ++-- 4 files changed, 17 insertions(+), 12 deletions(-)