summaryrefslogtreecommitdiff
path: root/libavcodec/h264.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2008-08-04 23:06:45 +0000
committerMichael Niedermayer <michaelni@gmx.at>2008-08-04 23:06:45 +0000
commitf0538030da89735b9eb0bda5e11b5de70cc99c5c (patch)
treebaf6c215e2000047558f7acbc629f6aa2a1b329a /libavcodec/h264.c
parent301e1057b85802640aa98f331680bb50ef373e92 (diff)
downloadffmpeg-f0538030da89735b9eb0bda5e11b5de70cc99c5c.tar.gz
Port col_parity code from spatial mode to temporal mode,
I also love it if people duplicate code and fix one but not the other. Originally committed as revision 14543 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r--libavcodec/h264.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 9eda1f0347..2f09f7f2ec 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -1185,12 +1185,12 @@ static inline void pred_direct_motion(H264Context * const h, int *mb_type){
else
*mb_type |= MB_TYPE_8x8;
}else{
- /* field to frame scaling */
- /* col_mb_y = (mb_y&~1) + (topAbsDiffPOC < bottomAbsDiffPOC ? 0 : 1)
- * but in MBAFF, top and bottom POC are equal */
- int dy = (s->mb_y&1) ? 1 : 2;
+ int cur_poc = s->current_picture_ptr->poc;
+ int *col_poc = h->ref_list[1]->field_poc;
+ int col_parity = FFABS(col_poc[0] - cur_poc) >= FFABS(col_poc[1] - cur_poc);
+ int dy = 2*col_parity - (s->mb_y&1);
mb_types_col[0] =
- mb_types_col[1] = h->ref_list[1][0].mb_type[pair_xy+s->mb_stride];
+ mb_types_col[1] = h->ref_list[1][0].mb_type[pair_xy + col_parity*s->mb_stride];
l1ref0 += dy*h->b8_stride;
l1ref1 += dy*h->b8_stride;
l1mv0 += 2*dy*h->b_stride;