comparison cavs.c @ 5244:eeba62cd2181 libavcodec

prepare splitting decoder-only parts into own file: make commonly used functions global
author stefang
date Sat, 07 Jul 2007 07:35:18 +0000
parents dd11d0b32cc9
children dc2579bede07
comparison
equal deleted inserted replaced
5243:dd11d0b32cc9 5244:eeba62cd2181
69 * | 6 | 7 | 69 * | 6 | 7 |
70 * 1 3 | 70 * 1 3 |
71 * --------- 71 * ---------
72 * 72 *
73 */ 73 */
74 static void filter_mb(AVSContext *h, enum mb_t mb_type) { 74 void ff_cavs_filter(AVSContext *h, enum mb_t mb_type) {
75 DECLARE_ALIGNED_8(uint8_t, bs[8]); 75 DECLARE_ALIGNED_8(uint8_t, bs[8]);
76 int qp_avg, alpha, beta, tc; 76 int qp_avg, alpha, beta, tc;
77 int i; 77 int i;
78 78
79 /* save un-deblocked lines */ 79 /* save un-deblocked lines */
321 dest_y, dest_cb, dest_cr, x_offset, y_offset, 321 dest_y, dest_cb, dest_cr, x_offset, y_offset,
322 qpix_op, chroma_op, mv+MV_BWD_OFFS); 322 qpix_op, chroma_op, mv+MV_BWD_OFFS);
323 } 323 }
324 } 324 }
325 325
326 static void inter_pred(AVSContext *h, enum mb_t mb_type) { 326 void ff_cavs_inter(AVSContext *h, enum mb_t mb_type) {
327 if(partition_flags[mb_type] == 0){ // 16x16 327 if(partition_flags[mb_type] == 0){ // 16x16
328 mc_part_std(h, 1, 8, 0, h->cy, h->cu, h->cv, 0, 0, 328 mc_part_std(h, 1, 8, 0, h->cy, h->cu, h->cv, 0, 0,
329 h->s.dsp.put_cavs_qpel_pixels_tab[0], 329 h->s.dsp.put_cavs_qpel_pixels_tab[0],
330 h->s.dsp.put_h264_chroma_pixels_tab[0], 330 h->s.dsp.put_h264_chroma_pixels_tab[0],
331 h->s.dsp.avg_cavs_qpel_pixels_tab[0], 331 h->s.dsp.avg_cavs_qpel_pixels_tab[0],
426 dst->ref = 0; 426 dst->ref = 0;
427 dst->dist = h->dist[0]; 427 dst->dist = h->dist[0];
428 set_mvs(dst, size); 428 set_mvs(dst, size);
429 } 429 }
430 430
431 static void mv_pred(AVSContext *h, enum mv_loc_t nP, enum mv_loc_t nC, 431 void ff_cavs_mv(AVSContext *h, enum mv_loc_t nP, enum mv_loc_t nC,
432 enum mv_pred_t mode, enum block_t size, int ref) { 432 enum mv_pred_t mode, enum block_t size, int ref) {
433 vector_t *mvP = &h->mv[nP]; 433 vector_t *mvP = &h->mv[nP];
434 vector_t *mvA = &h->mv[nP-1]; 434 vector_t *mvA = &h->mv[nP-1];
435 vector_t *mvB = &h->mv[nP-4]; 435 vector_t *mvB = &h->mv[nP-4];
436 vector_t *mvC = &h->mv[nC]; 436 vector_t *mvC = &h->mv[nC];
437 const vector_t *mvP2 = NULL; 437 const vector_t *mvP2 = NULL;
629 h->left_border_u, h->c_stride); 629 h->left_border_u, h->c_stride);
630 h->intra_pred_c[pred_mode_uv](h->cv, &h->top_border_v[h->mbx*10], 630 h->intra_pred_c[pred_mode_uv](h->cv, &h->top_border_v[h->mbx*10],
631 h->left_border_v, h->c_stride); 631 h->left_border_v, h->c_stride);
632 632
633 decode_residual_chroma(h); 633 decode_residual_chroma(h);
634 filter_mb(h,I_8X8); 634 ff_cavs_filter(h,I_8X8);
635 set_mv_intra(h); 635 set_mv_intra(h);
636 return 0; 636 return 0;
637 } 637 }
638 638
639 static void decode_mb_p(AVSContext *h, enum mb_t mb_type) { 639 static void decode_mb_p(AVSContext *h, enum mb_t mb_type) {
641 int ref[4]; 641 int ref[4];
642 642
643 init_mb(h); 643 init_mb(h);
644 switch(mb_type) { 644 switch(mb_type) {
645 case P_SKIP: 645 case P_SKIP:
646 mv_pred(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_PSKIP, BLK_16X16, 0); 646 ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_PSKIP, BLK_16X16, 0);
647 break; 647 break;
648 case P_16X16: 648 case P_16X16:
649 ref[0] = h->ref_flag ? 0 : get_bits1(gb); 649 ref[0] = h->ref_flag ? 0 : get_bits1(gb);
650 mv_pred(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_MEDIAN, BLK_16X16,ref[0]); 650 ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_MEDIAN, BLK_16X16,ref[0]);
651 break; 651 break;
652 case P_16X8: 652 case P_16X8:
653 ref[0] = h->ref_flag ? 0 : get_bits1(gb); 653 ref[0] = h->ref_flag ? 0 : get_bits1(gb);
654 ref[2] = h->ref_flag ? 0 : get_bits1(gb); 654 ref[2] = h->ref_flag ? 0 : get_bits1(gb);
655 mv_pred(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_TOP, BLK_16X8, ref[0]); 655 ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_TOP, BLK_16X8, ref[0]);
656 mv_pred(h, MV_FWD_X2, MV_FWD_A1, MV_PRED_LEFT, BLK_16X8, ref[2]); 656 ff_cavs_mv(h, MV_FWD_X2, MV_FWD_A1, MV_PRED_LEFT, BLK_16X8, ref[2]);
657 break; 657 break;
658 case P_8X16: 658 case P_8X16:
659 ref[0] = h->ref_flag ? 0 : get_bits1(gb); 659 ref[0] = h->ref_flag ? 0 : get_bits1(gb);
660 ref[1] = h->ref_flag ? 0 : get_bits1(gb); 660 ref[1] = h->ref_flag ? 0 : get_bits1(gb);
661 mv_pred(h, MV_FWD_X0, MV_FWD_B3, MV_PRED_LEFT, BLK_8X16, ref[0]); 661 ff_cavs_mv(h, MV_FWD_X0, MV_FWD_B3, MV_PRED_LEFT, BLK_8X16, ref[0]);
662 mv_pred(h, MV_FWD_X1, MV_FWD_C2, MV_PRED_TOPRIGHT, BLK_8X16, ref[1]); 662 ff_cavs_mv(h, MV_FWD_X1, MV_FWD_C2, MV_PRED_TOPRIGHT,BLK_8X16, ref[1]);
663 break; 663 break;
664 case P_8X8: 664 case P_8X8:
665 ref[0] = h->ref_flag ? 0 : get_bits1(gb); 665 ref[0] = h->ref_flag ? 0 : get_bits1(gb);
666 ref[1] = h->ref_flag ? 0 : get_bits1(gb); 666 ref[1] = h->ref_flag ? 0 : get_bits1(gb);
667 ref[2] = h->ref_flag ? 0 : get_bits1(gb); 667 ref[2] = h->ref_flag ? 0 : get_bits1(gb);
668 ref[3] = h->ref_flag ? 0 : get_bits1(gb); 668 ref[3] = h->ref_flag ? 0 : get_bits1(gb);
669 mv_pred(h, MV_FWD_X0, MV_FWD_B3, MV_PRED_MEDIAN, BLK_8X8, ref[0]); 669 ff_cavs_mv(h, MV_FWD_X0, MV_FWD_B3, MV_PRED_MEDIAN, BLK_8X8, ref[0]);
670 mv_pred(h, MV_FWD_X1, MV_FWD_C2, MV_PRED_MEDIAN, BLK_8X8, ref[1]); 670 ff_cavs_mv(h, MV_FWD_X1, MV_FWD_C2, MV_PRED_MEDIAN, BLK_8X8, ref[1]);
671 mv_pred(h, MV_FWD_X2, MV_FWD_X1, MV_PRED_MEDIAN, BLK_8X8, ref[2]); 671 ff_cavs_mv(h, MV_FWD_X2, MV_FWD_X1, MV_PRED_MEDIAN, BLK_8X8, ref[2]);
672 mv_pred(h, MV_FWD_X3, MV_FWD_X0, MV_PRED_MEDIAN, BLK_8X8, ref[3]); 672 ff_cavs_mv(h, MV_FWD_X3, MV_FWD_X0, MV_PRED_MEDIAN, BLK_8X8, ref[3]);
673 } 673 }
674 inter_pred(h, mb_type); 674 ff_cavs_inter(h, mb_type);
675 set_intra_mode_default(h); 675 set_intra_mode_default(h);
676 store_mvs(h); 676 store_mvs(h);
677 if(mb_type != P_SKIP) 677 if(mb_type != P_SKIP)
678 decode_residual_inter(h); 678 decode_residual_inter(h);
679 filter_mb(h,mb_type); 679 ff_cavs_filter(h,mb_type);
680 *h->col_type = mb_type; 680 *h->col_type = mb_type;
681 } 681 }
682 682
683 static void decode_mb_b(AVSContext *h, enum mb_t mb_type) { 683 static void decode_mb_b(AVSContext *h, enum mb_t mb_type) {
684 int block; 684 int block;
695 switch(mb_type) { 695 switch(mb_type) {
696 case B_SKIP: 696 case B_SKIP:
697 case B_DIRECT: 697 case B_DIRECT:
698 if(!(*h->col_type)) { 698 if(!(*h->col_type)) {
699 /* intra MB at co-location, do in-plane prediction */ 699 /* intra MB at co-location, do in-plane prediction */
700 mv_pred(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_BSKIP, BLK_16X16, 1); 700 ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_BSKIP, BLK_16X16, 1);
701 mv_pred(h, MV_BWD_X0, MV_BWD_C2, MV_PRED_BSKIP, BLK_16X16, 0); 701 ff_cavs_mv(h, MV_BWD_X0, MV_BWD_C2, MV_PRED_BSKIP, BLK_16X16, 0);
702 } else 702 } else
703 /* direct prediction from co-located P MB, block-wise */ 703 /* direct prediction from co-located P MB, block-wise */
704 for(block=0;block<4;block++) 704 for(block=0;block<4;block++)
705 mv_pred_direct(h,&h->mv[mv_scan[block]], 705 mv_pred_direct(h,&h->mv[mv_scan[block]],
706 &h->col_mv[(h->mby*h->mb_width+h->mbx)*4 + block]); 706 &h->col_mv[(h->mby*h->mb_width+h->mbx)*4 + block]);
707 break; 707 break;
708 case B_FWD_16X16: 708 case B_FWD_16X16:
709 mv_pred(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_MEDIAN, BLK_16X16, 1); 709 ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_MEDIAN, BLK_16X16, 1);
710 break; 710 break;
711 case B_SYM_16X16: 711 case B_SYM_16X16:
712 mv_pred(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_MEDIAN, BLK_16X16, 1); 712 ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_MEDIAN, BLK_16X16, 1);
713 mv_pred_sym(h, &h->mv[MV_FWD_X0], BLK_16X16); 713 mv_pred_sym(h, &h->mv[MV_FWD_X0], BLK_16X16);
714 break; 714 break;
715 case B_BWD_16X16: 715 case B_BWD_16X16:
716 mv_pred(h, MV_BWD_X0, MV_BWD_C2, MV_PRED_MEDIAN, BLK_16X16, 0); 716 ff_cavs_mv(h, MV_BWD_X0, MV_BWD_C2, MV_PRED_MEDIAN, BLK_16X16, 0);
717 break; 717 break;
718 case B_8X8: 718 case B_8X8:
719 for(block=0;block<4;block++) 719 for(block=0;block<4;block++)
720 sub_type[block] = get_bits(&h->s.gb,2); 720 sub_type[block] = get_bits(&h->s.gb,2);
721 for(block=0;block<4;block++) { 721 for(block=0;block<4;block++) {
722 switch(sub_type[block]) { 722 switch(sub_type[block]) {
723 case B_SUB_DIRECT: 723 case B_SUB_DIRECT:
724 if(!(*h->col_type)) { 724 if(!(*h->col_type)) {
725 /* intra MB at co-location, do in-plane prediction */ 725 /* intra MB at co-location, do in-plane prediction */
726 mv_pred(h, mv_scan[block], mv_scan[block]-3, 726 ff_cavs_mv(h, mv_scan[block], mv_scan[block]-3,
727 MV_PRED_BSKIP, BLK_8X8, 1); 727 MV_PRED_BSKIP, BLK_8X8, 1);
728 mv_pred(h, mv_scan[block]+MV_BWD_OFFS, 728 ff_cavs_mv(h, mv_scan[block]+MV_BWD_OFFS,
729 mv_scan[block]-3+MV_BWD_OFFS, 729 mv_scan[block]-3+MV_BWD_OFFS,
730 MV_PRED_BSKIP, BLK_8X8, 0); 730 MV_PRED_BSKIP, BLK_8X8, 0);
731 } else 731 } else
732 mv_pred_direct(h,&h->mv[mv_scan[block]], 732 mv_pred_direct(h,&h->mv[mv_scan[block]],
733 &h->col_mv[(h->mby*h->mb_width + h->mbx)*4 + block]); 733 &h->col_mv[(h->mby*h->mb_width + h->mbx)*4 + block]);
734 break; 734 break;
735 case B_SUB_FWD: 735 case B_SUB_FWD:
736 mv_pred(h, mv_scan[block], mv_scan[block]-3, 736 ff_cavs_mv(h, mv_scan[block], mv_scan[block]-3,
737 MV_PRED_MEDIAN, BLK_8X8, 1); 737 MV_PRED_MEDIAN, BLK_8X8, 1);
738 break; 738 break;
739 case B_SUB_SYM: 739 case B_SUB_SYM:
740 mv_pred(h, mv_scan[block], mv_scan[block]-3, 740 ff_cavs_mv(h, mv_scan[block], mv_scan[block]-3,
741 MV_PRED_MEDIAN, BLK_8X8, 1); 741 MV_PRED_MEDIAN, BLK_8X8, 1);
742 mv_pred_sym(h, &h->mv[mv_scan[block]], BLK_8X8); 742 mv_pred_sym(h, &h->mv[mv_scan[block]], BLK_8X8);
743 break; 743 break;
744 } 744 }
745 } 745 }
746 for(block=0;block<4;block++) { 746 for(block=0;block<4;block++) {
747 if(sub_type[block] == B_SUB_BWD) 747 if(sub_type[block] == B_SUB_BWD)
748 mv_pred(h, mv_scan[block]+MV_BWD_OFFS, 748 ff_cavs_mv(h, mv_scan[block]+MV_BWD_OFFS,
749 mv_scan[block]+MV_BWD_OFFS-3, 749 mv_scan[block]+MV_BWD_OFFS-3,
750 MV_PRED_MEDIAN, BLK_8X8, 0); 750 MV_PRED_MEDIAN, BLK_8X8, 0);
751 } 751 }
752 break; 752 break;
753 default: 753 default:
754 assert((mb_type > B_SYM_16X16) && (mb_type < B_8X8)); 754 assert((mb_type > B_SYM_16X16) && (mb_type < B_8X8));
755 flags = partition_flags[mb_type]; 755 flags = partition_flags[mb_type];
756 if(mb_type & 1) { /* 16x8 macroblock types */ 756 if(mb_type & 1) { /* 16x8 macroblock types */
757 if(flags & FWD0) 757 if(flags & FWD0)
758 mv_pred(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_TOP, BLK_16X8, 1); 758 ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_TOP, BLK_16X8, 1);
759 if(flags & SYM0) 759 if(flags & SYM0)
760 mv_pred_sym(h, &h->mv[MV_FWD_X0], BLK_16X8); 760 mv_pred_sym(h, &h->mv[MV_FWD_X0], BLK_16X8);
761 if(flags & FWD1) 761 if(flags & FWD1)
762 mv_pred(h, MV_FWD_X2, MV_FWD_A1, MV_PRED_LEFT, BLK_16X8, 1); 762 ff_cavs_mv(h, MV_FWD_X2, MV_FWD_A1, MV_PRED_LEFT, BLK_16X8, 1);
763 if(flags & SYM1) 763 if(flags & SYM1)
764 mv_pred_sym(h, &h->mv[MV_FWD_X2], BLK_16X8); 764 mv_pred_sym(h, &h->mv[MV_FWD_X2], BLK_16X8);
765 if(flags & BWD0) 765 if(flags & BWD0)
766 mv_pred(h, MV_BWD_X0, MV_BWD_C2, MV_PRED_TOP, BLK_16X8, 0); 766 ff_cavs_mv(h, MV_BWD_X0, MV_BWD_C2, MV_PRED_TOP, BLK_16X8, 0);
767 if(flags & BWD1) 767 if(flags & BWD1)
768 mv_pred(h, MV_BWD_X2, MV_BWD_A1, MV_PRED_LEFT, BLK_16X8, 0); 768 ff_cavs_mv(h, MV_BWD_X2, MV_BWD_A1, MV_PRED_LEFT, BLK_16X8, 0);
769 } else { /* 8x16 macroblock types */ 769 } else { /* 8x16 macroblock types */
770 if(flags & FWD0) 770 if(flags & FWD0)
771 mv_pred(h, MV_FWD_X0, MV_FWD_B3, MV_PRED_LEFT, BLK_8X16, 1); 771 ff_cavs_mv(h, MV_FWD_X0, MV_FWD_B3, MV_PRED_LEFT, BLK_8X16, 1);
772 if(flags & SYM0) 772 if(flags & SYM0)
773 mv_pred_sym(h, &h->mv[MV_FWD_X0], BLK_8X16); 773 mv_pred_sym(h, &h->mv[MV_FWD_X0], BLK_8X16);
774 if(flags & FWD1) 774 if(flags & FWD1)
775 mv_pred(h, MV_FWD_X1, MV_FWD_C2, MV_PRED_TOPRIGHT,BLK_8X16, 1); 775 ff_cavs_mv(h,MV_FWD_X1,MV_FWD_C2,MV_PRED_TOPRIGHT,BLK_8X16,1);
776 if(flags & SYM1) 776 if(flags & SYM1)
777 mv_pred_sym(h, &h->mv[MV_FWD_X1], BLK_8X16); 777 mv_pred_sym(h, &h->mv[MV_FWD_X1], BLK_8X16);
778 if(flags & BWD0) 778 if(flags & BWD0)
779 mv_pred(h, MV_BWD_X0, MV_BWD_B3, MV_PRED_LEFT, BLK_8X16, 0); 779 ff_cavs_mv(h, MV_BWD_X0, MV_BWD_B3, MV_PRED_LEFT, BLK_8X16, 0);
780 if(flags & BWD1) 780 if(flags & BWD1)
781 mv_pred(h, MV_BWD_X1, MV_BWD_C2, MV_PRED_TOPRIGHT,BLK_8X16, 0); 781 ff_cavs_mv(h,MV_BWD_X1,MV_BWD_C2,MV_PRED_TOPRIGHT,BLK_8X16,0);
782 } 782 }
783 } 783 }
784 inter_pred(h, mb_type); 784 ff_cavs_inter(h, mb_type);
785 set_intra_mode_default(h); 785 set_intra_mode_default(h);
786 if(mb_type != B_SKIP) 786 if(mb_type != B_SKIP)
787 decode_residual_inter(h); 787 decode_residual_inter(h);
788 filter_mb(h,mb_type); 788 ff_cavs_filter(h,mb_type);
789 } 789 }
790 790
791 /***************************************************************************** 791 /*****************************************************************************
792 * 792 *
793 * slice level 793 * slice level
826 * 826 *
827 * frame level 827 * frame level
828 * 828 *
829 ****************************************************************************/ 829 ****************************************************************************/
830 830
831 static void init_pic(AVSContext *h) { 831 void ff_cavs_init_pic(AVSContext *h) {
832 int i; 832 int i;
833 833
834 /* clear some predictors */ 834 /* clear some predictors */
835 for(i=0;i<=20;i+=4) 835 for(i=0;i<=20;i+=4)
836 h->mv[i] = ff_cavs_un_mv; 836 h->mv[i] = ff_cavs_un_mv;
880 /* release last B frame */ 880 /* release last B frame */
881 if(h->picture.data[0]) 881 if(h->picture.data[0])
882 s->avctx->release_buffer(s->avctx, (AVFrame *)&h->picture); 882 s->avctx->release_buffer(s->avctx, (AVFrame *)&h->picture);
883 883
884 s->avctx->get_buffer(s->avctx, (AVFrame *)&h->picture); 884 s->avctx->get_buffer(s->avctx, (AVFrame *)&h->picture);
885 init_pic(h); 885 ff_cavs_init_pic(h);
886 h->picture.poc = get_bits(&s->gb,8)*2; 886 h->picture.poc = get_bits(&s->gb,8)*2;
887 887
888 /* get temporal distances and MV scaling factors */ 888 /* get temporal distances and MV scaling factors */
889 if(h->pic_type != FF_B_TYPE) { 889 if(h->pic_type != FF_B_TYPE) {
890 h->dist[0] = (h->picture.poc - h->DPB[0].poc + 512) % 512; 890 h->dist[0] = (h->picture.poc - h->DPB[0].poc + 512) % 512;
989 /** 989 /**
990 * some predictions require data from the top-neighbouring macroblock. 990 * some predictions require data from the top-neighbouring macroblock.
991 * this data has to be stored for one complete row of macroblocks 991 * this data has to be stored for one complete row of macroblocks
992 * and this storage space is allocated here 992 * and this storage space is allocated here
993 */ 993 */
994 static void init_top_lines(AVSContext *h) { 994 void ff_cavs_init_top_lines(AVSContext *h) {
995 /* alloc top line of predictors */ 995 /* alloc top line of predictors */
996 h->top_qp = av_malloc( h->mb_width); 996 h->top_qp = av_malloc( h->mb_width);
997 h->top_mv[0] = av_malloc((h->mb_width*2+1)*sizeof(vector_t)); 997 h->top_mv[0] = av_malloc((h->mb_width*2+1)*sizeof(vector_t));
998 h->top_mv[1] = av_malloc((h->mb_width*2+1)*sizeof(vector_t)); 998 h->top_mv[1] = av_malloc((h->mb_width*2+1)*sizeof(vector_t));
999 h->top_pred_Y = av_malloc( h->mb_width*2*sizeof(*h->top_pred_Y)); 999 h->top_pred_Y = av_malloc( h->mb_width*2*sizeof(*h->top_pred_Y));
1029 h->s.avctx->time_base.den = ff_frame_rate_tab[frame_rate_code].num; 1029 h->s.avctx->time_base.den = ff_frame_rate_tab[frame_rate_code].num;
1030 h->s.avctx->time_base.num = ff_frame_rate_tab[frame_rate_code].den; 1030 h->s.avctx->time_base.num = ff_frame_rate_tab[frame_rate_code].den;
1031 h->s.avctx->width = s->width; 1031 h->s.avctx->width = s->width;
1032 h->s.avctx->height = s->height; 1032 h->s.avctx->height = s->height;
1033 if(!h->top_qp) 1033 if(!h->top_qp)
1034 init_top_lines(h); 1034 ff_cavs_init_top_lines(h);
1035 return 0; 1035 return 0;
1036 } 1036 }
1037 1037
1038 static void cavs_flush(AVCodecContext * avctx) { 1038 static void cavs_flush(AVCodecContext * avctx) {
1039 AVSContext *h = avctx->priv_data; 1039 AVSContext *h = avctx->priv_data;
1113 break; 1113 break;
1114 } 1114 }
1115 } 1115 }
1116 } 1116 }
1117 1117
1118 static int cavs_decode_init(AVCodecContext * avctx) { 1118 int ff_cavs_init(AVCodecContext *avctx) {
1119 AVSContext *h = avctx->priv_data; 1119 AVSContext *h = avctx->priv_data;
1120 MpegEncContext * const s = &h->s; 1120 MpegEncContext * const s = &h->s;
1121 1121
1122 MPV_decode_defaults(s); 1122 MPV_decode_defaults(s);
1123 s->avctx = avctx; 1123 s->avctx = avctx;
1144 h->mv[ 7] = ff_cavs_un_mv; 1144 h->mv[ 7] = ff_cavs_un_mv;
1145 h->mv[19] = ff_cavs_un_mv; 1145 h->mv[19] = ff_cavs_un_mv;
1146 return 0; 1146 return 0;
1147 } 1147 }
1148 1148
1149 static int cavs_decode_end(AVCodecContext * avctx) { 1149 int ff_cavs_end(AVCodecContext *avctx) {
1150 AVSContext *h = avctx->priv_data; 1150 AVSContext *h = avctx->priv_data;
1151 1151
1152 av_free(h->top_qp); 1152 av_free(h->top_qp);
1153 av_free(h->top_mv[0]); 1153 av_free(h->top_mv[0]);
1154 av_free(h->top_mv[1]); 1154 av_free(h->top_mv[1]);
1165 AVCodec cavs_decoder = { 1165 AVCodec cavs_decoder = {
1166 "cavs", 1166 "cavs",
1167 CODEC_TYPE_VIDEO, 1167 CODEC_TYPE_VIDEO,
1168 CODEC_ID_CAVS, 1168 CODEC_ID_CAVS,
1169 sizeof(AVSContext), 1169 sizeof(AVSContext),
1170 cavs_decode_init, 1170 ff_cavs_init,
1171 NULL, 1171 NULL,
1172 cavs_decode_end, 1172 ff_cavs_end,
1173 cavs_decode_frame, 1173 cavs_decode_frame,
1174 CODEC_CAP_DR1 | CODEC_CAP_DELAY, 1174 CODEC_CAP_DR1 | CODEC_CAP_DELAY,
1175 .flush= cavs_flush, 1175 .flush= cavs_flush,
1176 }; 1176 };