Mercurial > libavcodec.hg
comparison svq3.c @ 6481:493dc59d469a libavcodec
add FF_ prefix to all (frame)_TYPE usage
author | aurel |
---|---|
date | Sun, 09 Mar 2008 23:31:02 +0000 |
parents | 5a882b31308b |
children | 5b3acf9fd50a |
comparison
equal
deleted
inserted
replaced
6480:6f01a499e785 | 6481:493dc59d469a |
---|---|
417 h->top_samples_available = (s->mb_y == 0) ? 0x33FF : 0xFFFF; | 417 h->top_samples_available = (s->mb_y == 0) ? 0x33FF : 0xFFFF; |
418 h->left_samples_available = (s->mb_x == 0) ? 0x5F5F : 0xFFFF; | 418 h->left_samples_available = (s->mb_x == 0) ? 0x5F5F : 0xFFFF; |
419 h->topright_samples_available = 0xFFFF; | 419 h->topright_samples_available = 0xFFFF; |
420 | 420 |
421 if (mb_type == 0) { /* SKIP */ | 421 if (mb_type == 0) { /* SKIP */ |
422 if (s->pict_type == P_TYPE || s->next_picture.mb_type[mb_xy] == -1) { | 422 if (s->pict_type == FF_P_TYPE || s->next_picture.mb_type[mb_xy] == -1) { |
423 svq3_mc_dir_part (s, 16*s->mb_x, 16*s->mb_y, 16, 16, 0, 0, 0, 0, 0, 0); | 423 svq3_mc_dir_part (s, 16*s->mb_x, 16*s->mb_y, 16, 16, 0, 0, 0, 0, 0, 0); |
424 | 424 |
425 if (s->pict_type == B_TYPE) { | 425 if (s->pict_type == FF_B_TYPE) { |
426 svq3_mc_dir_part (s, 16*s->mb_x, 16*s->mb_y, 16, 16, 0, 0, 0, 0, 1, 1); | 426 svq3_mc_dir_part (s, 16*s->mb_x, 16*s->mb_y, 16, 16, 0, 0, 0, 0, 1, 1); |
427 } | 427 } |
428 | 428 |
429 mb_type = MB_TYPE_SKIP; | 429 mb_type = MB_TYPE_SKIP; |
430 } else { | 430 } else { |
481 }else | 481 }else |
482 h->ref_cache[m][scan8[0] - 1 - 1*8] = PART_NOT_AVAILABLE; | 482 h->ref_cache[m][scan8[0] - 1 - 1*8] = PART_NOT_AVAILABLE; |
483 }else | 483 }else |
484 memset (&h->ref_cache[m][scan8[0] - 1*8 - 1], PART_NOT_AVAILABLE, 8); | 484 memset (&h->ref_cache[m][scan8[0] - 1*8 - 1], PART_NOT_AVAILABLE, 8); |
485 | 485 |
486 if (s->pict_type != B_TYPE) | 486 if (s->pict_type != FF_B_TYPE) |
487 break; | 487 break; |
488 } | 488 } |
489 | 489 |
490 /* decode motion vector(s) and form prediction(s) */ | 490 /* decode motion vector(s) and form prediction(s) */ |
491 if (s->pict_type == P_TYPE) { | 491 if (s->pict_type == FF_P_TYPE) { |
492 if(svq3_mc_dir (h, (mb_type - 1), mode, 0, 0) < 0) | 492 if(svq3_mc_dir (h, (mb_type - 1), mode, 0, 0) < 0) |
493 return -1; | 493 return -1; |
494 } else { /* B_TYPE */ | 494 } else { /* FF_B_TYPE */ |
495 if (mb_type != 2) { | 495 if (mb_type != 2) { |
496 if(svq3_mc_dir (h, 0, mode, 0, 0) < 0) | 496 if(svq3_mc_dir (h, 0, mode, 0, 0) < 0) |
497 return -1; | 497 return -1; |
498 } else { | 498 } else { |
499 for (i=0; i < 4; i++) { | 499 for (i=0; i < 4; i++) { |
588 | 588 |
589 cbp = i_mb_type_info[mb_type - 8].cbp; | 589 cbp = i_mb_type_info[mb_type - 8].cbp; |
590 mb_type = MB_TYPE_INTRA16x16; | 590 mb_type = MB_TYPE_INTRA16x16; |
591 } | 591 } |
592 | 592 |
593 if (!IS_INTER(mb_type) && s->pict_type != I_TYPE) { | 593 if (!IS_INTER(mb_type) && s->pict_type != FF_I_TYPE) { |
594 for (i=0; i < 4; i++) { | 594 for (i=0; i < 4; i++) { |
595 memset (s->current_picture.motion_val[0][b_xy + i*h->b_stride], 0, 4*2*sizeof(int16_t)); | 595 memset (s->current_picture.motion_val[0][b_xy + i*h->b_stride], 0, 4*2*sizeof(int16_t)); |
596 } | 596 } |
597 if (s->pict_type == B_TYPE) { | 597 if (s->pict_type == FF_B_TYPE) { |
598 for (i=0; i < 4; i++) { | 598 for (i=0; i < 4; i++) { |
599 memset (s->current_picture.motion_val[1][b_xy + i*h->b_stride], 0, 4*2*sizeof(int16_t)); | 599 memset (s->current_picture.motion_val[1][b_xy + i*h->b_stride], 0, 4*2*sizeof(int16_t)); |
600 } | 600 } |
601 } | 601 } |
602 } | 602 } |
603 if (!IS_INTRA4x4(mb_type)) { | 603 if (!IS_INTRA4x4(mb_type)) { |
604 memset (h->intra4x4_pred_mode[mb_xy], DC_PRED, 8); | 604 memset (h->intra4x4_pred_mode[mb_xy], DC_PRED, 8); |
605 } | 605 } |
606 if (!IS_SKIP(mb_type) || s->pict_type == B_TYPE) { | 606 if (!IS_SKIP(mb_type) || s->pict_type == FF_B_TYPE) { |
607 memset (h->non_zero_count_cache + 8, 0, 4*9*sizeof(uint8_t)); | 607 memset (h->non_zero_count_cache + 8, 0, 4*9*sizeof(uint8_t)); |
608 s->dsp.clear_blocks(h->mb); | 608 s->dsp.clear_blocks(h->mb); |
609 } | 609 } |
610 | 610 |
611 if (!IS_INTRA16x16(mb_type) && (!IS_SKIP(mb_type) || s->pict_type == B_TYPE)) { | 611 if (!IS_INTRA16x16(mb_type) && (!IS_SKIP(mb_type) || s->pict_type == FF_B_TYPE)) { |
612 if ((vlc = svq3_get_ue_golomb (&s->gb)) >= 48){ | 612 if ((vlc = svq3_get_ue_golomb (&s->gb)) >= 48){ |
613 av_log(h->s.avctx, AV_LOG_ERROR, "cbp_vlc=%d\n", vlc); | 613 av_log(h->s.avctx, AV_LOG_ERROR, "cbp_vlc=%d\n", vlc); |
614 return -1; | 614 return -1; |
615 } | 615 } |
616 | 616 |
617 cbp = IS_INTRA(mb_type) ? golomb_to_intra4x4_cbp[vlc] : golomb_to_inter_cbp[vlc]; | 617 cbp = IS_INTRA(mb_type) ? golomb_to_intra4x4_cbp[vlc] : golomb_to_inter_cbp[vlc]; |
618 } | 618 } |
619 if (IS_INTRA16x16(mb_type) || (s->pict_type != I_TYPE && s->adaptive_quant && cbp)) { | 619 if (IS_INTRA16x16(mb_type) || (s->pict_type != FF_I_TYPE && s->adaptive_quant && cbp)) { |
620 s->qscale += svq3_get_se_golomb (&s->gb); | 620 s->qscale += svq3_get_se_golomb (&s->gb); |
621 | 621 |
622 if (s->qscale > 31){ | 622 if (s->qscale > 31){ |
623 av_log(h->s.avctx, AV_LOG_ERROR, "qscale:%d\n", s->qscale); | 623 av_log(h->s.avctx, AV_LOG_ERROR, "qscale:%d\n", s->qscale); |
624 return -1; | 624 return -1; |
857 ); | 857 ); |
858 } | 858 } |
859 | 859 |
860 /* for hurry_up==5 */ | 860 /* for hurry_up==5 */ |
861 s->current_picture.pict_type = s->pict_type; | 861 s->current_picture.pict_type = s->pict_type; |
862 s->current_picture.key_frame = (s->pict_type == I_TYPE); | 862 s->current_picture.key_frame = (s->pict_type == FF_I_TYPE); |
863 | 863 |
864 /* Skip B-frames if we do not have reference frames. */ | 864 /* Skip B-frames if we do not have reference frames. */ |
865 if (s->last_picture_ptr == NULL && s->pict_type == B_TYPE) return 0; | 865 if (s->last_picture_ptr == NULL && s->pict_type == FF_B_TYPE) return 0; |
866 /* Skip B-frames if we are in a hurry. */ | 866 /* Skip B-frames if we are in a hurry. */ |
867 if (avctx->hurry_up && s->pict_type == B_TYPE) return 0; | 867 if (avctx->hurry_up && s->pict_type == FF_B_TYPE) return 0; |
868 /* Skip everything if we are in a hurry >= 5. */ | 868 /* Skip everything if we are in a hurry >= 5. */ |
869 if (avctx->hurry_up >= 5) return 0; | 869 if (avctx->hurry_up >= 5) return 0; |
870 if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==B_TYPE) | 870 if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE) |
871 ||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=I_TYPE) | 871 ||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE) |
872 || avctx->skip_frame >= AVDISCARD_ALL) | 872 || avctx->skip_frame >= AVDISCARD_ALL) |
873 return 0; | 873 return 0; |
874 | 874 |
875 if (s->next_p_frame_damaged) { | 875 if (s->next_p_frame_damaged) { |
876 if (s->pict_type == B_TYPE) | 876 if (s->pict_type == FF_B_TYPE) |
877 return 0; | 877 return 0; |
878 else | 878 else |
879 s->next_p_frame_damaged = 0; | 879 s->next_p_frame_damaged = 0; |
880 } | 880 } |
881 | 881 |
882 if (frame_start (h) < 0) | 882 if (frame_start (h) < 0) |
883 return -1; | 883 return -1; |
884 | 884 |
885 if (s->pict_type == B_TYPE) { | 885 if (s->pict_type == FF_B_TYPE) { |
886 h->frame_num_offset = (h->slice_num - h->prev_frame_num); | 886 h->frame_num_offset = (h->slice_num - h->prev_frame_num); |
887 | 887 |
888 if (h->frame_num_offset < 0) { | 888 if (h->frame_num_offset < 0) { |
889 h->frame_num_offset += 256; | 889 h->frame_num_offset += 256; |
890 } | 890 } |
928 /* TODO: support s->mb_skip_run */ | 928 /* TODO: support s->mb_skip_run */ |
929 } | 929 } |
930 | 930 |
931 mb_type = svq3_get_ue_golomb (&s->gb); | 931 mb_type = svq3_get_ue_golomb (&s->gb); |
932 | 932 |
933 if (s->pict_type == I_TYPE) { | 933 if (s->pict_type == FF_I_TYPE) { |
934 mb_type += 8; | 934 mb_type += 8; |
935 } else if (s->pict_type == B_TYPE && mb_type >= 4) { | 935 } else if (s->pict_type == FF_B_TYPE && mb_type >= 4) { |
936 mb_type += 4; | 936 mb_type += 4; |
937 } | 937 } |
938 if (mb_type > 33 || svq3_decode_mb (h, mb_type)) { | 938 if (mb_type > 33 || svq3_decode_mb (h, mb_type)) { |
939 av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding MB %d %d\n", s->mb_x, s->mb_y); | 939 av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding MB %d %d\n", s->mb_x, s->mb_y); |
940 return -1; | 940 return -1; |
942 | 942 |
943 if (mb_type != 0) { | 943 if (mb_type != 0) { |
944 hl_decode_mb (h); | 944 hl_decode_mb (h); |
945 } | 945 } |
946 | 946 |
947 if (s->pict_type != B_TYPE && !s->low_delay) { | 947 if (s->pict_type != FF_B_TYPE && !s->low_delay) { |
948 s->current_picture.mb_type[s->mb_x + s->mb_y*s->mb_stride] = | 948 s->current_picture.mb_type[s->mb_x + s->mb_y*s->mb_stride] = |
949 (s->pict_type == P_TYPE && mb_type < 8) ? (mb_type - 1) : -1; | 949 (s->pict_type == FF_P_TYPE && mb_type < 8) ? (mb_type - 1) : -1; |
950 } | 950 } |
951 } | 951 } |
952 | 952 |
953 ff_draw_horiz_band(s, 16*s->mb_y, 16); | 953 ff_draw_horiz_band(s, 16*s->mb_y, 16); |
954 } | 954 } |
955 | 955 |
956 MPV_frame_end(s); | 956 MPV_frame_end(s); |
957 | 957 |
958 if (s->pict_type == B_TYPE || s->low_delay) { | 958 if (s->pict_type == FF_B_TYPE || s->low_delay) { |
959 *(AVFrame *) data = *(AVFrame *) &s->current_picture; | 959 *(AVFrame *) data = *(AVFrame *) &s->current_picture; |
960 } else { | 960 } else { |
961 *(AVFrame *) data = *(AVFrame *) &s->last_picture; | 961 *(AVFrame *) data = *(AVFrame *) &s->last_picture; |
962 } | 962 } |
963 | 963 |