comparison rv34.c @ 8504:3bfb7a2ea222 libavcodec

It turned out that RV30 uses motion vectors for forward motion B-frame macroblocks to predict motion vectors for backward motion B-frame macroblocks and vice versa.
author kostya
date Mon, 29 Dec 2008 10:20:03 +0000
parents 8621deaff8dc
children d6bab465b82c
comparison
equal deleted inserted replaced
8503:7c82ed8d4824 8504:3bfb7a2ea222
562 static void rv34_pred_mv_rv3(RV34DecContext *r, int block_type, int dir) 562 static void rv34_pred_mv_rv3(RV34DecContext *r, int block_type, int dir)
563 { 563 {
564 MpegEncContext *s = &r->s; 564 MpegEncContext *s = &r->s;
565 int mv_pos = s->mb_x * 2 + s->mb_y * 2 * s->b8_stride; 565 int mv_pos = s->mb_x * 2 + s->mb_y * 2 * s->b8_stride;
566 int A[2] = {0}, B[2], C[2]; 566 int A[2] = {0}, B[2], C[2];
567 int i, j; 567 int i, j, k;
568 int mx, my; 568 int mx, my;
569 int avail_index = avail_indexes[0]; 569 int avail_index = avail_indexes[0];
570 570
571 if(r->avail_cache[avail_index - 1]){ 571 if(r->avail_cache[avail_index - 1]){
572 A[0] = s->current_picture_ptr->motion_val[0][mv_pos-1][0]; 572 A[0] = s->current_picture_ptr->motion_val[0][mv_pos-1][0];
595 my = mid_pred(A[1], B[1], C[1]); 595 my = mid_pred(A[1], B[1], C[1]);
596 mx += r->dmv[0][0]; 596 mx += r->dmv[0][0];
597 my += r->dmv[0][1]; 597 my += r->dmv[0][1];
598 for(j = 0; j < 2; j++){ 598 for(j = 0; j < 2; j++){
599 for(i = 0; i < 2; i++){ 599 for(i = 0; i < 2; i++){
600 s->current_picture_ptr->motion_val[0][mv_pos + i + j*s->b8_stride][0] = mx; 600 for(k = 0; k < 2; k++){
601 s->current_picture_ptr->motion_val[0][mv_pos + i + j*s->b8_stride][1] = my; 601 s->current_picture_ptr->motion_val[k][mv_pos + i + j*s->b8_stride][0] = mx;
602 } 602 s->current_picture_ptr->motion_val[k][mv_pos + i + j*s->b8_stride][1] = my;
603 } 603 }
604 if(block_type == RV34_MB_B_BACKWARD || block_type == RV34_MB_B_FORWARD) 604 }
605 fill_rectangle(s->current_picture_ptr->motion_val[!dir][mv_pos], 2, 2, s->b8_stride, 0, 4); 605 }
606 } 606 }
607 607
608 static const int chroma_coeffs[3] = { 0, 3, 5 }; 608 static const int chroma_coeffs[3] = { 0, 3, 5 };
609 609
610 /** 610 /**