Mercurial > libavcodec.hg
comparison rv34.c @ 6106:7185e3bb0614 libavcodec
RV30 thirdpel motion compensation support
author | kostya |
---|---|
date | Fri, 04 Jan 2008 17:50:45 +0000 |
parents | a2b438bcb1d2 |
children | bc59962f70b9 |
comparison
equal
deleted
inserted
replaced
6105:33674fb857b5 | 6106:7185e3bb0614 |
---|---|
557 } | 557 } |
558 if(block_type == RV34_MB_B_BACKWARD || block_type == RV34_MB_B_FORWARD) | 558 if(block_type == RV34_MB_B_BACKWARD || block_type == RV34_MB_B_FORWARD) |
559 fill_rectangle(cur_pic->motion_val[!dir][mv_pos], 2, 2, s->b8_stride, 0, 4); | 559 fill_rectangle(cur_pic->motion_val[!dir][mv_pos], 2, 2, s->b8_stride, 0, 4); |
560 } | 560 } |
561 | 561 |
562 static const int chroma_coeffs[3] = { 8, 5, 3 }; | |
563 | |
562 /** | 564 /** |
563 * generic motion compensation function | 565 * generic motion compensation function |
564 * | 566 * |
565 * @param r decoder context | 567 * @param r decoder context |
566 * @param block_type type of the current block | 568 * @param block_type type of the current block |
582 int dxy, mx, my, uvmx, uvmy, src_x, src_y, uvsrc_x, uvsrc_y; | 584 int dxy, mx, my, uvmx, uvmy, src_x, src_y, uvsrc_x, uvsrc_y; |
583 int mv_pos = s->mb_x * 2 + s->mb_y * 2 * s->b8_stride + mv_off; | 585 int mv_pos = s->mb_x * 2 + s->mb_y * 2 * s->b8_stride + mv_off; |
584 int is16x16 = 1; | 586 int is16x16 = 1; |
585 | 587 |
586 if(thirdpel){ | 588 if(thirdpel){ |
587 #if 0 /// todo | |
588 int lx, ly; | 589 int lx, ly; |
589 | 590 |
590 mx = s->current_picture_ptr->motion_val[dir][mv_pos][0] / 3; | 591 mx = (s->current_picture_ptr->motion_val[dir][mv_pos][0] + (3 << 24)) / 3 - (1 << 24); |
591 my = s->current_picture_ptr->motion_val[dir][mv_pos][1] / 3; | 592 my = (s->current_picture_ptr->motion_val[dir][mv_pos][1] + (3 << 24)) / 3 - (1 << 24); |
592 lx = ((s->current_picture_ptr->motion_val[dir][mv_pos][0] % 3) + 3) % 3; | 593 lx = (s->current_picture_ptr->motion_val[dir][mv_pos][0] + (3 << 24)) % 3; |
593 ly = ((s->current_picture_ptr->motion_val[dir][mv_pos][1] % 3) + 3) % 3; | 594 ly = (s->current_picture_ptr->motion_val[dir][mv_pos][1] + (3 << 24)) % 3; |
594 dxy = ly*3 + lx; | 595 dxy = ly*4 + lx; |
595 uvmx = | 596 uvmx = chroma_coeffs[(3*(mx&1) + lx) >> 1]; |
596 #endif | 597 uvmy = chroma_coeffs[(3*(my&1) + ly) >> 1]; |
597 mx = s->current_picture_ptr->motion_val[dir][mv_pos][0] >> 2; | |
598 my = s->current_picture_ptr->motion_val[dir][mv_pos][1] >> 2; | |
599 dxy = ((my & 3) << 2) | (mx & 3); | |
600 uvmx = mx & 6; | |
601 uvmy = my & 6; | |
602 }else{ | 598 }else{ |
603 mx = s->current_picture_ptr->motion_val[dir][mv_pos][0] >> 2; | 599 mx = s->current_picture_ptr->motion_val[dir][mv_pos][0] >> 2; |
604 my = s->current_picture_ptr->motion_val[dir][mv_pos][1] >> 2; | 600 my = s->current_picture_ptr->motion_val[dir][mv_pos][1] >> 2; |
605 dxy = ((my & 3) << 2) | (mx & 3); | 601 dxy = ((my & 3) << 2) | (mx & 3); |
606 uvmx = mx & 6; | 602 uvmx = mx & 6; |
653 static void rv34_mc_1mv(RV34DecContext *r, const int block_type, | 649 static void rv34_mc_1mv(RV34DecContext *r, const int block_type, |
654 const int xoff, const int yoff, int mv_off, | 650 const int xoff, const int yoff, int mv_off, |
655 const int width, const int height, int dir) | 651 const int width, const int height, int dir) |
656 { | 652 { |
657 rv34_mc(r, block_type, xoff, yoff, mv_off, width, height, dir, r->rv30, | 653 rv34_mc(r, block_type, xoff, yoff, mv_off, width, height, dir, r->rv30, |
658 r->s.dsp.put_h264_qpel_pixels_tab, r->s.dsp.put_h264_chroma_pixels_tab); | 654 r->rv30 ? r->s.dsp.put_rv30_tpel_pixels_tab |
655 : r->s.dsp.put_h264_qpel_pixels_tab, | |
656 r->s.dsp.put_h264_chroma_pixels_tab); | |
659 } | 657 } |
660 | 658 |
661 static void rv34_mc_2mv(RV34DecContext *r, const int block_type) | 659 static void rv34_mc_2mv(RV34DecContext *r, const int block_type) |
662 { | 660 { |
663 rv34_mc(r, block_type, 0, 0, 0, 2, 2, 0, r->rv30, | 661 rv34_mc(r, block_type, 0, 0, 0, 2, 2, 0, r->rv30, |
664 r->s.dsp.put_h264_qpel_pixels_tab, r->s.dsp.put_h264_chroma_pixels_tab); | 662 r->rv30 ? r->s.dsp.put_rv30_tpel_pixels_tab |
663 : r->s.dsp.put_h264_qpel_pixels_tab, | |
664 r->s.dsp.put_h264_chroma_pixels_tab); | |
665 rv34_mc(r, block_type, 0, 0, 0, 2, 2, 1, r->rv30, | 665 rv34_mc(r, block_type, 0, 0, 0, 2, 2, 1, r->rv30, |
666 r->s.dsp.avg_h264_qpel_pixels_tab, r->s.dsp.avg_h264_chroma_pixels_tab); | 666 r->rv30 ? r->s.dsp.avg_rv30_tpel_pixels_tab |
667 : r->s.dsp.avg_h264_qpel_pixels_tab, | |
668 r->s.dsp.avg_h264_chroma_pixels_tab); | |
667 } | 669 } |
668 | 670 |
669 /** number of motion vectors in each macroblock type */ | 671 /** number of motion vectors in each macroblock type */ |
670 static const int num_mvs[RV34_MB_TYPES] = { 0, 0, 1, 4, 1, 1, 0, 0, 2, 2, 2, 1 }; | 672 static const int num_mvs[RV34_MB_TYPES] = { 0, 0, 1, 4, 1, 1, 0, 0, 2, 2, 2, 1 }; |
671 | 673 |