summaryrefslogtreecommitdiffstats
path: root/libavcodec/mpegvideo.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/mpegvideo.c')
-rw-r--r--libavcodec/mpegvideo.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 1693b48..bbd2348 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -259,9 +259,13 @@ int MPV_common_init(MpegEncContext *s)
/* MV prediction */
size = (2 * s->mb_width + 2) * (2 * s->mb_height + 2);
CHECKED_ALLOCZ(s->motion_val, size * 2 * sizeof(INT16));
-
- /* 4mv direct mode decoding table */
- CHECKED_ALLOCZ(s->non_b_mv4_table, size * sizeof(UINT8))
+ }
+
+ if(s->codec_id==CODEC_ID_MPEG4){
+ /* 4mv and interlaced direct mode decoding tables */
+ CHECKED_ALLOCZ(s->co_located_type_table, s->mb_num * sizeof(UINT8))
+ CHECKED_ALLOCZ(s->field_mv_table, s->mb_num*2*2 * sizeof(INT16))
+ CHECKED_ALLOCZ(s->field_select_table, s->mb_num*2* sizeof(INT8))
}
if (s->h263_pred || s->h263_plus) {
@@ -350,7 +354,9 @@ void MPV_common_end(MpegEncContext *s)
av_freep(&s->tex_pb_buffer);
av_freep(&s->pb2_buffer);
av_freep(&s->edge_emu_buffer);
- av_freep(&s->non_b_mv4_table);
+ av_freep(&s->co_located_type_table);
+ av_freep(&s->field_mv_table);
+ av_freep(&s->field_select_table);
av_freep(&s->avctx->stats_out);
av_freep(&s->ac_stats);
@@ -1466,20 +1472,32 @@ void MPV_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
const int wrap = s->block_wrap[0];
const int xy = s->block_index[0];
+ const int mb_index= s->mb_x + s->mb_y*s->mb_width;
if(s->mv_type == MV_TYPE_8X8){
- s->non_b_mv4_table[xy]=1;
+ s->co_located_type_table[mb_index]= CO_LOCATED_TYPE_4MV;
} else {
int motion_x, motion_y;
if (s->mb_intra) {
motion_x = 0;
motion_y = 0;
+ if(s->co_located_type_table)
+ s->co_located_type_table[mb_index]= 0;
} else if (s->mv_type == MV_TYPE_16X16) {
motion_x = s->mv[0][0][0];
motion_y = s->mv[0][0][1];
+ if(s->co_located_type_table)
+ s->co_located_type_table[mb_index]= 0;
} else /*if (s->mv_type == MV_TYPE_FIELD)*/ {
+ int i;
motion_x = s->mv[0][0][0] + s->mv[0][1][0];
motion_y = s->mv[0][0][1] + s->mv[0][1][1];
motion_x = (motion_x>>1) | (motion_x&1);
+ for(i=0; i<2; i++){
+ s->field_mv_table[mb_index][i][0]= s->mv[0][i][0];
+ s->field_mv_table[mb_index][i][1]= s->mv[0][i][1];
+ s->field_select_table[mb_index][i]= s->field_select[0][i];
+ }
+ s->co_located_type_table[mb_index]= CO_LOCATED_TYPE_FIELDMV;
}
/* no update if 8X8 because it has been done during parsing */
s->motion_val[xy][0] = motion_x;
@@ -1490,7 +1508,6 @@ void MPV_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
s->motion_val[xy + wrap][1] = motion_y;
s->motion_val[xy + 1 + wrap][0] = motion_x;
s->motion_val[xy + 1 + wrap][1] = motion_y;
- s->non_b_mv4_table[xy]=0;
}
}
OpenPOWER on IntegriCloud