Revision ce5e49b0 libavcodec/svq3.c
libavcodec/svq3.c | ||
---|---|---|
438 | 438 |
h->topright_samples_available = 0xFFFF; |
439 | 439 |
|
440 | 440 |
if (mb_type == 0) { /* SKIP */ |
441 |
if (s->pict_type == FF_P_TYPE || s->next_picture.mb_type[mb_xy] == -1) {
|
|
441 |
if (s->pict_type == AV_PICTURE_TYPE_P || s->next_picture.mb_type[mb_xy] == -1) {
|
|
442 | 442 |
svq3_mc_dir_part(s, 16*s->mb_x, 16*s->mb_y, 16, 16, 0, 0, 0, 0, 0, 0); |
443 | 443 |
|
444 |
if (s->pict_type == FF_B_TYPE) {
|
|
444 |
if (s->pict_type == AV_PICTURE_TYPE_B) {
|
|
445 | 445 |
svq3_mc_dir_part(s, 16*s->mb_x, 16*s->mb_y, 16, 16, 0, 0, 0, 0, 1, 1); |
446 | 446 |
} |
447 | 447 |
|
... | ... | |
502 | 502 |
}else |
503 | 503 |
memset(&h->ref_cache[m][scan8[0] - 1*8 - 1], PART_NOT_AVAILABLE, 8); |
504 | 504 |
|
505 |
if (s->pict_type != FF_B_TYPE)
|
|
505 |
if (s->pict_type != AV_PICTURE_TYPE_B)
|
|
506 | 506 |
break; |
507 | 507 |
} |
508 | 508 |
|
509 | 509 |
/* decode motion vector(s) and form prediction(s) */ |
510 |
if (s->pict_type == FF_P_TYPE) {
|
|
510 |
if (s->pict_type == AV_PICTURE_TYPE_P) {
|
|
511 | 511 |
if (svq3_mc_dir(h, (mb_type - 1), mode, 0, 0) < 0) |
512 | 512 |
return -1; |
513 |
} else { /* FF_B_TYPE */
|
|
513 |
} else { /* AV_PICTURE_TYPE_B */
|
|
514 | 514 |
if (mb_type != 2) { |
515 | 515 |
if (svq3_mc_dir(h, 0, mode, 0, 0) < 0) |
516 | 516 |
return -1; |
... | ... | |
609 | 609 |
mb_type = MB_TYPE_INTRA16x16; |
610 | 610 |
} |
611 | 611 |
|
612 |
if (!IS_INTER(mb_type) && s->pict_type != FF_I_TYPE) {
|
|
612 |
if (!IS_INTER(mb_type) && s->pict_type != AV_PICTURE_TYPE_I) {
|
|
613 | 613 |
for (i = 0; i < 4; i++) { |
614 | 614 |
memset(s->current_picture.motion_val[0][b_xy + i*h->b_stride], 0, 4*2*sizeof(int16_t)); |
615 | 615 |
} |
616 |
if (s->pict_type == FF_B_TYPE) {
|
|
616 |
if (s->pict_type == AV_PICTURE_TYPE_B) {
|
|
617 | 617 |
for (i = 0; i < 4; i++) { |
618 | 618 |
memset(s->current_picture.motion_val[1][b_xy + i*h->b_stride], 0, 4*2*sizeof(int16_t)); |
619 | 619 |
} |
... | ... | |
622 | 622 |
if (!IS_INTRA4x4(mb_type)) { |
623 | 623 |
memset(h->intra4x4_pred_mode+h->mb2br_xy[mb_xy], DC_PRED, 8); |
624 | 624 |
} |
625 |
if (!IS_SKIP(mb_type) || s->pict_type == FF_B_TYPE) {
|
|
625 |
if (!IS_SKIP(mb_type) || s->pict_type == AV_PICTURE_TYPE_B) {
|
|
626 | 626 |
memset(h->non_zero_count_cache + 8, 0, 4*9*sizeof(uint8_t)); |
627 | 627 |
s->dsp.clear_blocks(h->mb); |
628 | 628 |
} |
629 | 629 |
|
630 |
if (!IS_INTRA16x16(mb_type) && (!IS_SKIP(mb_type) || s->pict_type == FF_B_TYPE)) {
|
|
630 |
if (!IS_INTRA16x16(mb_type) && (!IS_SKIP(mb_type) || s->pict_type == AV_PICTURE_TYPE_B)) {
|
|
631 | 631 |
if ((vlc = svq3_get_ue_golomb(&s->gb)) >= 48){ |
632 | 632 |
av_log(h->s.avctx, AV_LOG_ERROR, "cbp_vlc=%d\n", vlc); |
633 | 633 |
return -1; |
... | ... | |
635 | 635 |
|
636 | 636 |
cbp = IS_INTRA(mb_type) ? golomb_to_intra4x4_cbp[vlc] : golomb_to_inter_cbp[vlc]; |
637 | 637 |
} |
638 |
if (IS_INTRA16x16(mb_type) || (s->pict_type != FF_I_TYPE && s->adaptive_quant && cbp)) {
|
|
638 |
if (IS_INTRA16x16(mb_type) || (s->pict_type != AV_PICTURE_TYPE_I && s->adaptive_quant && cbp)) {
|
|
639 | 639 |
s->qscale += svq3_get_se_golomb(&s->gb); |
640 | 640 |
|
641 | 641 |
if (s->qscale > 31){ |
... | ... | |
947 | 947 |
|
948 | 948 |
/* for skipping the frame */ |
949 | 949 |
s->current_picture.pict_type = s->pict_type; |
950 |
s->current_picture.key_frame = (s->pict_type == FF_I_TYPE);
|
|
950 |
s->current_picture.key_frame = (s->pict_type == AV_PICTURE_TYPE_I);
|
|
951 | 951 |
|
952 | 952 |
/* Skip B-frames if we do not have reference frames. */ |
953 |
if (s->last_picture_ptr == NULL && s->pict_type == FF_B_TYPE)
|
|
953 |
if (s->last_picture_ptr == NULL && s->pict_type == AV_PICTURE_TYPE_B)
|
|
954 | 954 |
return 0; |
955 |
if ( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == FF_B_TYPE)
|
|
956 |
||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != FF_I_TYPE)
|
|
955 |
if ( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B)
|
|
956 |
||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I)
|
|
957 | 957 |
|| avctx->skip_frame >= AVDISCARD_ALL) |
958 | 958 |
return 0; |
959 | 959 |
|
960 | 960 |
if (s->next_p_frame_damaged) { |
961 |
if (s->pict_type == FF_B_TYPE)
|
|
961 |
if (s->pict_type == AV_PICTURE_TYPE_B)
|
|
962 | 962 |
return 0; |
963 | 963 |
else |
964 | 964 |
s->next_p_frame_damaged = 0; |
... | ... | |
967 | 967 |
if (ff_h264_frame_start(h) < 0) |
968 | 968 |
return -1; |
969 | 969 |
|
970 |
if (s->pict_type == FF_B_TYPE) {
|
|
970 |
if (s->pict_type == AV_PICTURE_TYPE_B) {
|
|
971 | 971 |
h->frame_num_offset = (h->slice_num - h->prev_frame_num); |
972 | 972 |
|
973 | 973 |
if (h->frame_num_offset < 0) { |
... | ... | |
1016 | 1016 |
|
1017 | 1017 |
mb_type = svq3_get_ue_golomb(&s->gb); |
1018 | 1018 |
|
1019 |
if (s->pict_type == FF_I_TYPE) {
|
|
1019 |
if (s->pict_type == AV_PICTURE_TYPE_I) {
|
|
1020 | 1020 |
mb_type += 8; |
1021 |
} else if (s->pict_type == FF_B_TYPE && mb_type >= 4) {
|
|
1021 |
} else if (s->pict_type == AV_PICTURE_TYPE_B && mb_type >= 4) {
|
|
1022 | 1022 |
mb_type += 4; |
1023 | 1023 |
} |
1024 | 1024 |
if (mb_type > 33 || svq3_decode_mb(h, mb_type)) { |
... | ... | |
1030 | 1030 |
ff_h264_hl_decode_mb (h); |
1031 | 1031 |
} |
1032 | 1032 |
|
1033 |
if (s->pict_type != FF_B_TYPE && !s->low_delay) {
|
|
1033 |
if (s->pict_type != AV_PICTURE_TYPE_B && !s->low_delay) {
|
|
1034 | 1034 |
s->current_picture.mb_type[s->mb_x + s->mb_y*s->mb_stride] = |
1035 |
(s->pict_type == FF_P_TYPE && mb_type < 8) ? (mb_type - 1) : -1;
|
|
1035 |
(s->pict_type == AV_PICTURE_TYPE_P && mb_type < 8) ? (mb_type - 1) : -1;
|
|
1036 | 1036 |
} |
1037 | 1037 |
} |
1038 | 1038 |
|
... | ... | |
1041 | 1041 |
|
1042 | 1042 |
MPV_frame_end(s); |
1043 | 1043 |
|
1044 |
if (s->pict_type == FF_B_TYPE || s->low_delay) {
|
|
1044 |
if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) {
|
|
1045 | 1045 |
*(AVFrame *) data = *(AVFrame *) &s->current_picture; |
1046 | 1046 |
} else { |
1047 | 1047 |
*(AVFrame *) data = *(AVFrame *) &s->last_picture; |
Also available in: Unified diff