Unified · Split
| @@ -89,13 +89,13 @@ int ff_flv_decode_picture_header(H263DecContext *const h) · 88 unmodified lines | ||
| 89 | 89 | skip_bits1(&h->gb); /* deblocking flag */ |
| 90 | 90 | h->c.chroma_qscale = h->c.qscale = get_bits(&h->gb, 5); |
| 91 | 91 | |
| 92 | − h->c.h263_long_vectors = 0; | |
| 92 | + h->h263_long_vectors = 0; | |
| 93 | 93 | |
| 94 | 94 | /* PEI */ |
| 95 | 95 | if (skip_1stop_8data_bits(&h->gb) < 0) |
| 96 | 96 | return AVERROR_INVALIDDATA; |
| 97 | 97 | |
| 98 | − if (h->c.ehc_mode) | |
| 98 | + if (h->ehc_mode) | |
| 99 | 99 | h->c.avctx->sample_aspect_ratio= (AVRational){1,2}; |
| 100 | 100 | |
| 101 | 101 | if (h->c.avctx->debug & FF_DEBUG_PICT_INFO) { |
| @@ -157,7 +157,7 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx) · 156 unmodified lines | ||
| 157 | 157 | |
| 158 | 158 | if (avctx->codec_tag == AV_RL32("L263") || avctx->codec_tag == AV_RL32("S263")) |
| 159 | 159 | if (avctx->extradata_size == 56 && avctx->extradata[0] == 1) |
| 160 | − s->ehc_mode = 1; | |
| 160 | + h->ehc_mode = 1; | |
| 161 | 161 | |
| 162 | 162 | /* for H.263, we allocate the images after having read the header */ |
| 163 | 163 | if (avctx->codec->id != AV_CODEC_ID_H263 && |
| @@ -279,7 +279,7 @@ static int decode_slice(H263DecContext *const h) · 115 unmodified lines | ||
| 279 | 279 | ff_er_add_slice(&h->c.er, h->c.resync_mb_x, h->c.resync_mb_y, |
| 280 | 280 | h->c.mb_x, h->c.mb_y, ER_MB_END & part_mask); |
| 281 | 281 | |
| 282 | − h->c.padding_bug_score--; | |
| 282 | + h->padding_bug_score--; | |
| 283 | 283 | |
| 284 | 284 | if (++h->c.mb_x >= h->c.mb_width) { |
| 285 | 285 | h->c.mb_x = 0; |
| @@ -324,7 +324,7 @@ static int decode_slice(H263DecContext *const h) · 38 unmodified lines | ||
| 324 | 324 | get_bits_left(&h->gb) >= 48 && |
| 325 | 325 | show_bits(&h->gb, 24) == 0x4010 && |
| 326 | 326 | !h->c.data_partitioning) |
| 327 | − h->c.padding_bug_score += 32; | |
| 327 | + h->padding_bug_score += 32; | |
| 328 | 328 | |
| 329 | 329 | /* try to detect the padding bug */ |
| 330 | 330 | if (h->c.codec_id == AV_CODEC_ID_MPEG4 && |
| @@ -336,18 +336,18 @@ static int decode_slice(H263DecContext *const h) · 5 unmodified lines | ||
| 336 | 336 | const int bits_left = h->gb.size_in_bits - bits_count; |
| 337 | 337 | |
| 338 | 338 | if (bits_left == 0) { |
| 339 | − h->c.padding_bug_score += 16; | |
| 339 | + h->padding_bug_score += 16; | |
| 340 | 340 | } else if (bits_left != 1) { |
| 341 | 341 | int v = show_bits(&h->gb, 8); |
| 342 | 342 | v |= 0x7F >> (7 - (bits_count & 7)); |
| 343 | 343 | |
| 344 | 344 | if (v == 0x7F && bits_left <= 8) |
| 345 | − h->c.padding_bug_score--; | |
| 345 | + h->padding_bug_score--; | |
| 346 | 346 | else if (v == 0x7F && ((get_bits_count(&h->gb) + 8) & 8) && |
| 347 | 347 | bits_left <= 16) |
| 348 | − h->c.padding_bug_score += 4; | |
| 348 | + h->padding_bug_score += 4; | |
| 349 | 349 | else |
| 350 | − h->c.padding_bug_score++; | |
| 350 | + h->padding_bug_score++; | |
| 351 | 351 | } |
| 352 | 352 | } |
| 353 | 353 | |
| @@ -359,7 +359,7 @@ static int decode_slice(H263DecContext *const h) · 5 unmodified lines | ||
| 359 | 359 | show_bits(&h->gb, 8) == 0 && |
| 360 | 360 | !h->c.data_partitioning) { |
| 361 | 361 | |
| 362 | − h->c.padding_bug_score += 32; | |
| 362 | + h->padding_bug_score += 32; | |
| 363 | 363 | } |
| 364 | 364 | |
| 365 | 365 | if (h->c.codec_id == AV_CODEC_ID_H263 && |
| @@ -367,12 +367,12 @@ static int decode_slice(H263DecContext *const h) · 1 unmodified line | ||
| 367 | 367 | get_bits_left(&h->gb) >= 64 && |
| 368 | 368 | AV_RB64(h->gb.buffer_end - 8) == 0xCDCDCDCDFC7F0000) { |
| 369 | 369 | |
| 370 | − h->c.padding_bug_score += 32; | |
| 370 | + h->padding_bug_score += 32; | |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | if (h->c.workaround_bugs & FF_BUG_AUTODETECT) { |
| 374 | 374 | if ( |
| 375 | − (h->c.padding_bug_score > -2 && !h->c.data_partitioning)) | |
| 375 | + (h->padding_bug_score > -2 && !h->c.data_partitioning)) | |
| 376 | 376 | h->c.workaround_bugs |= FF_BUG_NO_PADDING; |
| 377 | 377 | else |
| 378 | 378 | h->c.workaround_bugs &= ~FF_BUG_NO_PADDING; |
| @@ -410,7 +410,7 @@ static int decode_slice(H263DecContext *const h) · 31 unmodified lines | ||
| 410 | 410 | |
| 411 | 411 | av_log(h->c.avctx, AV_LOG_ERROR, |
| 412 | 412 | "slice end not reached but screenspace end (%d left %06X, score= %d)\n", |
| 413 | − get_bits_left(&h->gb), show_bits(&h->gb, 24), h->c.padding_bug_score); | |
| 413 | + get_bits_left(&h->gb), show_bits(&h->gb, 24), h->padding_bug_score); | |
| 414 | 414 | |
| 415 | 415 | ff_er_add_slice(&h->c.er, h->c.resync_mb_x, h->c.resync_mb_y, h->c.mb_x, h->c.mb_y, |
| 416 | 416 | ER_MB_END & part_mask); |
| @@ -432,10 +432,10 @@ int ff_h263_decode_frame(AVCodecContext *avctx, AVFrame *pict, · 15 unmodified lines | ||
| 432 | 432 | /* no supplementary picture */ |
| 433 | 433 | if (buf_size == 0) { |
| 434 | 434 | /* special case for last picture */ |
| 435 | − if ((!h->c.low_delay || h->c.skipped_last_frame) && h->c.next_pic.ptr) { | |
| 435 | + if ((!h->c.low_delay || h->skipped_last_frame) && h->c.next_pic.ptr) { | |
| 436 | 436 | if ((ret = av_frame_ref(pict, h->c.next_pic.ptr->f)) < 0) |
| 437 | 437 | return ret; |
| 438 | − if (h->c.skipped_last_frame) { | |
| 438 | + if (h->skipped_last_frame) { | |
| 439 | 439 | /* If the stream ended with an NVOP, we output the last frame |
| 440 | 440 | * in display order, but with the props from the last input |
| 441 | 441 | * packet so that the stream's end time is correct. */ |
| @@ -549,7 +549,7 @@ int ff_h263_decode_frame(AVCodecContext *avctx, AVFrame *pict, · 107 unmodified lines | ||
| 549 | 549 | if ((ret = ff_mpv_frame_start(s, avctx)) < 0) |
| 550 | 550 | return ret; |
| 551 | 551 | |
| 552 | − if (!h->c.divx_packed) | |
| 552 | + if (!h->divx_packed) | |
| 553 | 553 | ff_thread_finish_setup(avctx); |
| 554 | 554 | |
| 555 | 555 | if (avctx->hwaccel) { |
| @@ -50,6 +50,26 @@ typedef struct H263DecContext { · 49 unmodified lines | ||
| 50 | 50 | |
| 51 | 51 | GetBitContext gb; |
| 52 | 52 | |
| 53 | + int pb_frame; ///< PB-frame mode (0 = none, 1 = base, 2 = improved) | |
| 54 | + | |
| 55 | + /* motion compensation */ | |
| 56 | + int h263_long_vectors; ///< use horrible H.263v1 long vector mode | |
| 57 | + | |
| 58 | + /* H.263 specific */ | |
| 59 | + int ehc_mode; | |
| 60 | + | |
| 61 | + /* H.263+ specific */ | |
| 62 | + int custom_pcf; | |
| 63 | + | |
| 64 | + /* MPEG-4 specific */ | |
| 65 | + int padding_bug_score; ///< used to detect the VERY common padding bug in MPEG-4 | |
| 66 | + int skipped_last_frame; | |
| 67 | + int divx_packed; ///< divx specific, used to workaround (many) bugs in divx5 | |
| 68 | + | |
| 69 | + /* RV10 specific */ | |
| 70 | + int rv10_version; ///< RV10 version: 0 or 3 | |
| 71 | + int rv10_first_dc_coded[3]; | |
| 72 | + | |
| 53 | 73 | int (*decode_mb)(struct H263DecContext *h); |
| 54 | 74 | |
| 55 | 75 | GetBitContext last_resync_gb; ///< used to search for the next resync marker |
| @@ -60,14 +60,14 @@ int ff_intel_h263_decode_picture_header(H263DecContext *const h) · 59 unmodified lines | ||
| 60 | 60 | |
| 61 | 61 | h->c.pict_type = AV_PICTURE_TYPE_I + get_bits1(&h->gb); |
| 62 | 62 | |
| 63 | − h->c.h263_long_vectors = get_bits1(&h->gb); | |
| 63 | + h->h263_long_vectors = get_bits1(&h->gb); | |
| 64 | 64 | |
| 65 | 65 | if (get_bits1(&h->gb) != 0) { |
| 66 | 66 | av_log(h->c.avctx, AV_LOG_ERROR, "SAC not supported\n"); |
| 67 | 67 | return -1; /* SAC: off */ |
| 68 | 68 | } |
| 69 | 69 | h->c.obmc = get_bits1(&h->gb); |
| 70 | − h->c.pb_frame = get_bits1(&h->gb); | |
| 70 | + h->pb_frame = get_bits1(&h->gb); | |
| 71 | 71 | |
| 72 | 72 | if (format < 6) { |
| 73 | 73 | h->c.width = ff_h263_format[format][0]; |
| @@ -86,7 +86,7 @@ int ff_intel_h263_decode_picture_header(H263DecContext *const h) · 12 unmodified lines | ||
| 86 | 86 | if (get_bits1(&h->gb)) |
| 87 | 87 | av_log(h->c.avctx, AV_LOG_ERROR, "Bad value for reserved field\n"); |
| 88 | 88 | if (get_bits1(&h->gb)) |
| 89 | − h->c.pb_frame = 2; | |
| 89 | + h->pb_frame = 2; | |
| 90 | 90 | if (get_bits(&h->gb, 5)) |
| 91 | 91 | av_log(h->c.avctx, AV_LOG_ERROR, "Bad value for reserved field\n"); |
| 92 | 92 | if (get_bits(&h->gb, 5) != 1) |
| @@ -110,7 +110,7 @@ int ff_intel_h263_decode_picture_header(H263DecContext *const h) · 17 unmodified lines | ||
| 110 | 110 | h->c.chroma_qscale = h->c.qscale = get_bits(&h->gb, 5); |
| 111 | 111 | skip_bits1(&h->gb); /* Continuous Presence Multipoint mode: off */ |
| 112 | 112 | |
| 113 | − if (h->c.pb_frame) { | |
| 113 | + if (h->pb_frame) { | |
| 114 | 114 | skip_bits(&h->gb, 3); //temporal reference for B-frame |
| 115 | 115 | skip_bits(&h->gb, 2); //dbquant |
| 116 | 116 | } |
| @@ -85,7 +85,7 @@ void ff_h263_show_pict_info(H263DecContext *const h, int h263_plus) · 84 unmodified lines | ||
| 85 | 85 | h->gb.size_in_bits, 1-h->c.no_rounding, |
| 86 | 86 | h->c.obmc ? " AP" : "", |
| 87 | 87 | h->c.umvplus ? " UMV" : "", |
| 88 | − h->c.h263_long_vectors ? " LONG" : "", | |
| 88 | + h->h263_long_vectors ? " LONG" : "", | |
| 89 | 89 | h263_plus ? " +" : "", |
| 90 | 90 | h->c.h263_aic ? " AIC" : "", |
| 91 | 91 | h->c.alt_inter_vlc ? " AIV" : "", |
| @@ -295,7 +295,7 @@ int ff_h263_decode_motion(H263DecContext *const h, int pred, int f_code) · 203 unmodified lines | ||
| 295 | 295 | val += pred; |
| 296 | 296 | |
| 297 | 297 | /* modulo decoding */ |
| 298 | − if (!h->c.h263_long_vectors) { | |
| 298 | + if (!h->h263_long_vectors) { | |
| 299 | 299 | val = sign_extend(val, 5 + f_code); |
| 300 | 300 | } else { |
| 301 | 301 | /* horrible H.263 long vector mode */ |
| @@ -545,10 +545,10 @@ static int h263_decode_block(H263DecContext *const h, int16_t block[64], · 243 unmodified lines | ||
| 545 | 545 | } else if (h->c.mb_intra) { |
| 546 | 546 | /* DC coef */ |
| 547 | 547 | if (CONFIG_RV10_DECODER && h->c.codec_id == AV_CODEC_ID_RV10) { |
| 548 | − if (h->c.rv10_version == 3 && h->c.pict_type == AV_PICTURE_TYPE_I) { | |
| 548 | + if (h->rv10_version == 3 && h->c.pict_type == AV_PICTURE_TYPE_I) { | |
| 549 | 549 | int component = (n <= 3 ? 0 : n - 4 + 1); |
| 550 | 550 | level = h->c.last_dc[component]; |
| 551 | − if (h->c.rv10_first_dc_coded[component]) { | |
| 551 | + if (h->rv10_first_dc_coded[component]) { | |
| 552 | 552 | int diff = ff_rv_decode_dc(h, n); |
| 553 | 553 | if (diff < 0) |
| 554 | 554 | return -1; |
| @@ -556,7 +556,7 @@ static int h263_decode_block(H263DecContext *const h, int16_t block[64], · 1 unmodified line | ||
| 556 | 556 | level = level & 0xff; /* handle wrap round */ |
| 557 | 557 | h->c.last_dc[component] = level; |
| 558 | 558 | } else { |
| 559 | − h->c.rv10_first_dc_coded[component] = 1; | |
| 559 | + h->rv10_first_dc_coded[component] = 1; | |
| 560 | 560 | } |
| 561 | 561 | } else { |
| 562 | 562 | level = get_bits(&h->gb, 8); |
| @@ -816,8 +816,8 @@ int ff_h263_decode_mb(H263DecContext *const h) · 253 unmodified lines | ||
| 816 | 816 | if (h->c.mb_intra) |
| 817 | 817 | goto intra; |
| 818 | 818 | |
| 819 | − if (h->c.pb_frame && get_bits1(&h->gb)) | |
| 820 | − pb_mv_count = h263_get_modb(&h->gb, h->c.pb_frame, &cbpb); | |
| 819 | + if (h->pb_frame && get_bits1(&h->gb)) | |
| 820 | + pb_mv_count = h263_get_modb(&h->gb, h->pb_frame, &cbpb); | |
| 821 | 821 | cbpy = get_vlc2(&h->gb, ff_h263_cbpy_vlc, CBPY_VLC_BITS, 1); |
| 822 | 822 | |
| 823 | 823 | if (cbpy < 0) { |
| @@ -1029,8 +1029,8 @@ intra: · 205 unmodified lines | ||
| 1029 | 1029 | }else |
| 1030 | 1030 | h->c.ac_pred = 0; |
| 1031 | 1031 | |
| 1032 | − if (h->c.pb_frame && get_bits1(&h->gb)) | |
| 1033 | − pb_mv_count = h263_get_modb(&h->gb, h->c.pb_frame, &cbpb); | |
| 1032 | + if (h->pb_frame && get_bits1(&h->gb)) | |
| 1033 | + pb_mv_count = h263_get_modb(&h->gb, h->pb_frame, &cbpb); | |
| 1034 | 1034 | cbpy = get_vlc2(&h->gb, ff_h263_cbpy_vlc, CBPY_VLC_BITS, 1); |
| 1035 | 1035 | if(cbpy<0){ |
| 1036 | 1036 | av_log(h->c.avctx, AV_LOG_ERROR, "I cbpy damaged at %d %d\n", |
| @@ -1042,7 +1042,7 @@ intra: · 5 unmodified lines | ||
| 1042 | 1042 | h263_decode_dquant(h); |
| 1043 | 1043 | } |
| 1044 | 1044 | |
| 1045 | − pb_mv_count += !!h->c.pb_frame; | |
| 1045 | + pb_mv_count += !!h->pb_frame; | |
| 1046 | 1046 | } |
| 1047 | 1047 | |
| 1048 | 1048 | while(pb_mv_count--){ |
| @@ -1057,7 +1057,7 @@ intra: · 8 unmodified lines | ||
| 1057 | 1057 | cbp+=cbp; |
| 1058 | 1058 | } |
| 1059 | 1059 | |
| 1060 | − if (h->c.pb_frame && h263_skip_b_part(h, cbpb) < 0) | |
| 1060 | + if (h->pb_frame && h263_skip_b_part(h, cbpb) < 0) | |
| 1061 | 1061 | return -1; |
| 1062 | 1062 | if (h->c.obmc && !h->c.mb_intra) { |
| 1063 | 1063 | if (h->c.pict_type == AV_PICTURE_TYPE_P && |
| @@ -1146,7 +1146,7 @@ int ff_h263_decode_picture_header(H263DecContext *const h) · 82 unmodified lines | ||
| 1146 | 1146 | |
| 1147 | 1147 | h->c.pict_type = AV_PICTURE_TYPE_I + get_bits1(&h->gb); |
| 1148 | 1148 | |
| 1149 | − h->c.h263_long_vectors = get_bits1(&h->gb); | |
| 1149 | + h->h263_long_vectors = get_bits1(&h->gb); | |
| 1150 | 1150 | |
| 1151 | 1151 | if (get_bits1(&h->gb) != 0) { |
| 1152 | 1152 | av_log(h->c.avctx, AV_LOG_ERROR, "H.263 SAC not supported\n"); |
| @@ -1154,7 +1154,7 @@ int ff_h263_decode_picture_header(H263DecContext *const h) · 1 unmodified line | ||
| 1154 | 1154 | } |
| 1155 | 1155 | h->c.obmc = get_bits1(&h->gb); /* Advanced prediction mode */ |
| 1156 | 1156 | |
| 1157 | − h->c.pb_frame = get_bits1(&h->gb); | |
| 1157 | + h->pb_frame = get_bits1(&h->gb); | |
| 1158 | 1158 | h->c.chroma_qscale = h->c.qscale = get_bits(&h->gb, 5); |
| 1159 | 1159 | skip_bits1(&h->gb); /* Continuous Presence Multipoint mode: off */ |
| 1160 | 1160 | |
| @@ -1174,7 +1174,7 @@ int ff_h263_decode_picture_header(H263DecContext *const h) · 13 unmodified lines | ||
| 1174 | 1174 | /* OPPTYPE */ |
| 1175 | 1175 | format = get_bits(&h->gb, 3); |
| 1176 | 1176 | ff_dlog(h->c.avctx, "ufep=1, format: %d\n", format); |
| 1177 | − h->c.custom_pcf = get_bits1(&h->gb); | |
| 1177 | + h->custom_pcf = get_bits1(&h->gb); | |
| 1178 | 1178 | h->c.umvplus = get_bits1(&h->gb); /* Unrestricted Motion Vector */ |
| 1179 | 1179 | if (get_bits1(&h->gb) != 0) { |
| 1180 | 1180 | av_log(h->c.avctx, AV_LOG_ERROR, "Syntax-based Arithmetic Coding (SAC) not supported\n"); |
| @@ -1210,7 +1210,7 @@ int ff_h263_decode_picture_header(H263DecContext *const h) · 29 unmodified lines | ||
| 1210 | 1210 | switch (h->c.pict_type) { |
| 1211 | 1211 | case 0: h->c.pict_type = AV_PICTURE_TYPE_I; break; |
| 1212 | 1212 | case 1: h->c.pict_type = AV_PICTURE_TYPE_P; break; |
| 1213 | − case 2: h->c.pict_type = AV_PICTURE_TYPE_P; h->c.pb_frame = 3; break; | |
| 1213 | + case 2: h->c.pict_type = AV_PICTURE_TYPE_P; h->pb_frame = 3; break; | |
| 1214 | 1214 | case 3: h->c.pict_type = AV_PICTURE_TYPE_B; break; |
| 1215 | 1215 | case 7: h->c.pict_type = AV_PICTURE_TYPE_I; break; //ZYGO |
| 1216 | 1216 | default: |
| @@ -1251,13 +1251,13 @@ int ff_h263_decode_picture_header(H263DecContext *const h) · 34 unmodified lines | ||
| 1251 | 1251 | height = ff_h263_format[format][1]; |
| 1252 | 1252 | h->c.avctx->sample_aspect_ratio = (AVRational){12,11}; |
| 1253 | 1253 | } |
| 1254 | − h->c.avctx->sample_aspect_ratio.den <<= h->c.ehc_mode; | |
| 1254 | + h->c.avctx->sample_aspect_ratio.den <<= h->ehc_mode; | |
| 1255 | 1255 | if ((width == 0) || (height == 0)) |
| 1256 | 1256 | return -1; |
| 1257 | 1257 | h->c.width = width; |
| 1258 | 1258 | h->c.height = height; |
| 1259 | 1259 | |
| 1260 | − if (h->c.custom_pcf) { | |
| 1260 | + if (h->custom_pcf) { | |
| 1261 | 1261 | h->c.avctx->framerate.num = 1800000; |
| 1262 | 1262 | h->c.avctx->framerate.den = 1000 + get_bits1(&h->gb); |
| 1263 | 1263 | h->c.avctx->framerate.den *= get_bits(&h->gb, 7); |
| @@ -1273,7 +1273,7 @@ int ff_h263_decode_picture_header(H263DecContext *const h) · 9 unmodified lines | ||
| 1273 | 1273 | } |
| 1274 | 1274 | } |
| 1275 | 1275 | |
| 1276 | − if (h->c.custom_pcf) | |
| 1276 | + if (h->custom_pcf) | |
| 1277 | 1277 | skip_bits(&h->gb, 2); //extended Temporal reference |
| 1278 | 1278 | |
| 1279 | 1279 | if (ufep) { |
| @@ -1315,9 +1315,9 @@ int ff_h263_decode_picture_header(H263DecContext *const h) · 35 unmodified lines | ||
| 1315 | 1315 | |
| 1316 | 1316 | h->c.gob_index = H263_GOB_HEIGHT(h->c.height); |
| 1317 | 1317 | |
| 1318 | − if (h->c.pb_frame) { | |
| 1318 | + if (h->pb_frame) { | |
| 1319 | 1319 | skip_bits(&h->gb, 3); /* Temporal reference for B-pictures */ |
| 1320 | − if (h->c.custom_pcf) | |
| 1320 | + if (h->custom_pcf) | |
| 1321 | 1321 | skip_bits(&h->gb, 2); //extended Temporal reference |
| 1322 | 1322 | skip_bits(&h->gb, 2); /* Quantization information for B-pictures */ |
| 1323 | 1323 | } |
| @@ -3031,7 +3031,7 @@ static int decode_user_data(Mpeg4DecContext *ctx, GetBitContext *gb) · 3030 unmodified lines | ||
| 3031 | 3031 | if (e >= 2) { |
| 3032 | 3032 | ctx->divx_version = ver; |
| 3033 | 3033 | ctx->divx_build = build; |
| 3034 | − h->c.divx_packed = e == 3 && last == 'p'; | |
| 3034 | + h->divx_packed = e == 3 && last == 'p'; | |
| 3035 | 3035 | } |
| 3036 | 3036 | |
| 3037 | 3037 | /* libavcodec detection */ |
| @@ -3132,7 +3132,7 @@ void ff_mpeg4_workaround_bugs(AVCodecContext *avctx) · 94 unmodified lines | ||
| 3132 | 3132 | h->c.workaround_bugs |= FF_BUG_QPEL_CHROMA2; |
| 3133 | 3133 | |
| 3134 | 3134 | if (ctx->xvid_build <= 3U) |
| 3135 | − h->c.padding_bug_score = 256 * 256 * 256 * 64; | |
| 3135 | + h->padding_bug_score = 256 * 256 * 256 * 64; | |
| 3136 | 3136 | |
| 3137 | 3137 | if (ctx->xvid_build <= 1U) |
| 3138 | 3138 | h->c.workaround_bugs |= FF_BUG_QPEL_CHROMA; |
| @@ -3170,7 +3170,7 @@ void ff_mpeg4_workaround_bugs(AVCodecContext *avctx) · 31 unmodified lines | ||
| 3170 | 3170 | if (ctx->divx_version >= 0) |
| 3171 | 3171 | h->c.workaround_bugs |= FF_BUG_DIRECT_BLOCKSIZE; |
| 3172 | 3172 | if (ctx->divx_version == 501 && ctx->divx_build == 20020416) |
| 3173 | − h->c.padding_bug_score = 256 * 256 * 256 * 64; | |
| 3173 | + h->padding_bug_score = 256 * 256 * 256 * 64; | |
| 3174 | 3174 | |
| 3175 | 3175 | if (ctx->divx_version < 500U) |
| 3176 | 3176 | h->c.workaround_bugs |= FF_BUG_EDGE; |
| @@ -3199,7 +3199,7 @@ void ff_mpeg4_workaround_bugs(AVCodecContext *avctx) · 22 unmodified lines | ||
| 3199 | 3199 | av_log(h->c.avctx, AV_LOG_DEBUG, |
| 3200 | 3200 | "bugs: %X lavc_build:%d xvid_build:%d divx_version:%d divx_build:%d %s\n", |
| 3201 | 3201 | h->c.workaround_bugs, ctx->lavc_build, ctx->xvid_build, |
| 3202 | − ctx->divx_version, ctx->divx_build, h->c.divx_packed ? "p" : ""); | |
| 3202 | + ctx->divx_version, ctx->divx_build, h->divx_packed ? "p" : ""); | |
| 3203 | 3203 | |
| 3204 | 3204 | if (CONFIG_MPEG4_DECODER && ctx->xvid_build >= 0 && |
| 3205 | 3205 | avctx->idct_algo == FF_IDCT_AUTO && !h->c.studio_profile) { |
| @@ -3313,7 +3313,7 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb, · 107 unmodified lines | ||
| 3313 | 3313 | if (get_bits1(gb) != 1) { |
| 3314 | 3314 | if (h->c.avctx->debug & FF_DEBUG_PICT_INFO) |
| 3315 | 3315 | av_log(h->c.avctx, AV_LOG_ERROR, "vop not coded\n"); |
| 3316 | − h->c.skipped_last_frame = 1; | |
| 3316 | + h->skipped_last_frame = 1; | |
| 3317 | 3317 | return FRAME_SKIPPED; |
| 3318 | 3318 | } |
| 3319 | 3319 | if (ctx->new_pred) |
| @@ -3740,14 +3740,14 @@ int ff_mpeg4_decode_picture_header(H263DecContext *const h) · 420 unmodified lines | ||
| 3740 | 3740 | { |
| 3741 | 3741 | Mpeg4DecContext *const ctx = h263_to_mpeg4(h); |
| 3742 | 3742 | |
| 3743 | − h->c.skipped_last_frame = 0; | |
| 3743 | + h->skipped_last_frame = 0; | |
| 3744 | 3744 | |
| 3745 | 3745 | if (ctx->bitstream_buffer) { |
| 3746 | 3746 | int buf_size = get_bits_left(&h->gb) / 8U; |
| 3747 | 3747 | int bitstream_buffer_size = ctx->bitstream_buffer->size; |
| 3748 | 3748 | const uint8_t *buf = h->gb.buffer; |
| 3749 | 3749 | |
| 3750 | − if (h->c.divx_packed) { | |
| 3750 | + if (h->divx_packed) { | |
| 3751 | 3751 | for (int i = 0; i < buf_size - 3; i++) { |
| 3752 | 3752 | if (buf[i] == 0 && buf[i+1] == 0 && buf[i+2] == 1) { |
| 3753 | 3753 | if (buf[i+3] == 0xB0) { |
| @@ -3759,7 +3759,7 @@ int ff_mpeg4_decode_picture_header(H263DecContext *const h) · 5 unmodified lines | ||
| 3759 | 3759 | } |
| 3760 | 3760 | } |
| 3761 | 3761 | ctx->bitstream_buffer->size = 0; |
| 3762 | − if (bitstream_buffer_size && (h->c.divx_packed || buf_size <= MAX_NVOP_SIZE)) {// divx 5.01+/xvid frame reorder | |
| 3762 | + if (bitstream_buffer_size && (h->divx_packed || buf_size <= MAX_NVOP_SIZE)) {// divx 5.01+/xvid frame reorder | |
| 3763 | 3763 | int ret = init_get_bits8(&h->gb, ctx->bitstream_buffer->data, |
| 3764 | 3764 | bitstream_buffer_size); |
| 3765 | 3765 | if (ret < 0) |
| @@ -3780,7 +3780,7 @@ int ff_mpeg4_frame_end(AVCodecContext *avctx, const AVPacket *pkt) · 14 unmodified lines | ||
| 3780 | 3780 | av_assert1(!ctx->bitstream_buffer || !ctx->bitstream_buffer->size); |
| 3781 | 3781 | |
| 3782 | 3782 | /* divx 5.01+ bitstream reorder stuff */ |
| 3783 | − if (h->c.divx_packed) { | |
| 3783 | + if (h->divx_packed) { | |
| 3784 | 3784 | int current_pos = ctx->bitstream_buffer && h->gb.buffer == ctx->bitstream_buffer->data ? 0 : (get_bits_count(&h->gb) >> 3); |
| 3785 | 3785 | int startcode_found = 0; |
| 3786 | 3786 | uint8_t *buf = pkt->data; |
| @@ -3907,7 +3907,7 @@ static int mpeg4_update_thread_context(AVCodecContext *dst, · 120 unmodified lines | ||
| 3907 | 3907 | s->enhancement_type = s1->enhancement_type; |
| 3908 | 3908 | s->scalability = s1->scalability; |
| 3909 | 3909 | s->intra_dc_threshold = s1->intra_dc_threshold; |
| 3910 | − s->h.c.divx_packed = s1->h.c.divx_packed; | |
| 3910 | + s->h.divx_packed = s1->h.divx_packed; | |
| 3911 | 3911 | s->divx_version = s1->divx_version; |
| 3912 | 3912 | s->divx_build = s1->divx_build; |
| 3913 | 3913 | s->xvid_build = s1->xvid_build; |
| @@ -3919,7 +3919,9 @@ static int mpeg4_update_thread_context(AVCodecContext *dst, · 5 unmodified lines | ||
| 3919 | 3919 | s->cplx_estimation_trash_p = s1->cplx_estimation_trash_p; |
| 3920 | 3920 | s->cplx_estimation_trash_b = s1->cplx_estimation_trash_b; |
| 3921 | 3921 | s->rgb = s1->rgb; |
| 3922 | − s->h.c.skipped_last_frame = s1->h.c.skipped_last_frame; | |
| 3922 | + | |
| 3923 | + s->h.skipped_last_frame = s1->h.skipped_last_frame; | |
| 3924 | + s->h.padding_bug_score = s1->h.padding_bug_score; // FIXME: racy | |
| 3923 | 3925 | |
| 3924 | 3926 | memcpy(s->sprite_shift, s1->sprite_shift, sizeof(s1->sprite_shift)); |
| 3925 | 3927 | memcpy(s->sprite_traj, s1->sprite_traj, sizeof(s1->sprite_traj)); |
| @@ -3930,11 +3932,11 @@ static int mpeg4_update_thread_context(AVCodecContext *dst, · 4 unmodified lines | ||
| 3930 | 3932 | static int mpeg4_update_thread_context_for_user(AVCodecContext *dst, |
| 3931 | 3933 | const AVCodecContext *src) |
| 3932 | 3934 | { |
| 3933 | − MpegEncContext *m = dst->priv_data; | |
| 3934 | − const MpegEncContext *m1 = src->priv_data; | |
| 3935 | + H263DecContext *const h = dst->priv_data; | |
| 3936 | + const H263DecContext *const h1 = src->priv_data; | |
| 3935 | 3937 | |
| 3936 | − m->quarter_sample = m1->quarter_sample; | |
| 3937 | − m->divx_packed = m1->divx_packed; | |
| 3938 | + h->c.quarter_sample = h1->c.quarter_sample; | |
| 3939 | + h->divx_packed = h1->divx_packed; | |
| 3938 | 3940 | |
| 3939 | 3941 | return 0; |
| 3940 | 3942 | } |
| @@ -4054,10 +4056,10 @@ static av_cold int mpeg4_close(AVCodecContext *avctx) · 113 unmodified lines | ||
| 4054 | 4056 | return ff_mpv_decode_close(avctx); |
| 4055 | 4057 | } |
| 4056 | 4058 | |
| 4057 | −#define OFFSET(x) offsetof(MpegEncContext, x) | |
| 4059 | +#define OFFSET(x) offsetof(H263DecContext, x) | |
| 4058 | 4060 | #define FLAGS AV_OPT_FLAG_EXPORT | AV_OPT_FLAG_READONLY |
| 4059 | 4061 | static const AVOption mpeg4_options[] = { |
| 4060 | − {"quarter_sample", "1/4 subpel MC", OFFSET(quarter_sample), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, FLAGS}, | |
| 4062 | + {"quarter_sample", "1/4 subpel MC", OFFSET(c.quarter_sample), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, FLAGS}, | |
| 4061 | 4063 | {"divx_packed", "divx style packed b frames", OFFSET(divx_packed), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, FLAGS}, |
| 4062 | 4064 | {NULL} |
| 4063 | 4065 | }; |
| @@ -86,7 +86,6 @@ typedef struct MpegEncContext { · 85 unmodified lines | ||
| 86 | 86 | int width, height;///< picture size. must be a multiple of 16 |
| 87 | 87 | enum OutputFormat out_format; ///< output format |
| 88 | 88 | int h263_pred; ///< use MPEG-4/H.263 ac/dc predictions |
| 89 | − int pb_frame; ///< PB-frame mode (0 = none, 1 = base, 2 = improved) | |
| 90 | 89 | |
| 91 | 90 | /* the following codec id fields are deprecated in favor of codec_id */ |
| 92 | 91 | int h263_flv; ///< use flv H.263 header |
| @@ -138,7 +137,6 @@ typedef struct MpegEncContext { · 45 unmodified lines | ||
| 138 | 137 | */ |
| 139 | 138 | MPVWorkPicture cur_pic; |
| 140 | 139 | |
| 141 | − int skipped_last_frame; | |
| 142 | 140 | int last_dc[3]; ///< last DC values for MPEG-1 |
| 143 | 141 | int16_t *dc_val_base; |
| 144 | 142 | const uint8_t *y_dc_scale_table; ///< qscale -> y_dc_scale table |
| @@ -163,9 +161,6 @@ typedef struct MpegEncContext { · 18 unmodified lines | ||
| 163 | 161 | int pict_type; ///< AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ... |
| 164 | 162 | int droppable; |
| 165 | 163 | |
| 166 | − /* motion compensation */ | |
| 167 | − int h263_long_vectors; ///< use horrible H.263v1 long vector mode | |
| 168 | − | |
| 169 | 164 | BlockDSPContext bdsp; |
| 170 | 165 | H264ChromaContext h264chroma; |
| 171 | 166 | HpelDSPContext hdsp; |
| @@ -224,7 +219,6 @@ typedef struct MpegEncContext { · 52 unmodified lines | ||
| 224 | 219 | /* H.263 specific */ |
| 225 | 220 | int gob_index; |
| 226 | 221 | int obmc; ///< overlapped block motion compensation |
| 227 | − int ehc_mode; | |
| 228 | 222 | |
| 229 | 223 | /* H.263+ specific */ |
| 230 | 224 | int umvplus; ///< == H.263+ && unrestricted_mv |
| @@ -233,7 +227,6 @@ typedef struct MpegEncContext { · 2 unmodified lines | ||
| 233 | 227 | int alt_inter_vlc; ///< alternative inter vlc |
| 234 | 228 | int modified_quant; |
| 235 | 229 | int loop_filter; |
| 236 | − int custom_pcf; | |
| 237 | 230 | |
| 238 | 231 | /* MPEG-4 specific */ |
| 239 | 232 | int studio_profile; |
| @@ -250,14 +243,6 @@ typedef struct MpegEncContext { · 10 unmodified lines | ||
| 250 | 243 | int data_partitioning; ///< data partitioning flag from header |
| 251 | 244 | int partitioned_frame; ///< is current frame partitioned |
| 252 | 245 | int low_delay; ///< no reordering needed / has no B-frames |
| 253 | − int padding_bug_score; ///< used to detect the VERY common padding bug in MPEG-4 | |
| 254 | − | |
| 255 | − /* divx specific, used to workaround (many) bugs in divx5 */ | |
| 256 | − int divx_packed; | |
| 257 | − | |
| 258 | − /* RV10 specific */ | |
| 259 | − int rv10_version; ///< RV10 version: 0 or 3 | |
| 260 | − int rv10_first_dc_coded[3]; | |
| 261 | 246 | |
| 262 | 247 | /* MSMPEG4 specific */ |
| 263 | 248 | int slice_height; ///< in macroblocks |
| @@ -108,7 +108,6 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst, · 107 unmodified lines | ||
| 108 | 108 | |
| 109 | 109 | // Error/bug resilience |
| 110 | 110 | s->workaround_bugs = s1->workaround_bugs; |
| 111 | − s->padding_bug_score = s1->padding_bug_score; | |
| 112 | 111 | |
| 113 | 112 | // MPEG-4 timing info |
| 114 | 113 | memcpy(&s->last_time_base, &s1->last_time_base, |
| @@ -73,7 +73,7 @@ static int nvdec_mpeg4_start_frame(AVCodecContext *avctx, · 72 unmodified lines | ||
| 73 | 73 | .quant_type = m->mpeg_quant, |
| 74 | 74 | .quarter_sample = s->quarter_sample, |
| 75 | 75 | .short_video_header = avctx->codec->id == AV_CODEC_ID_H263, |
| 76 | − .divx_flags = s->divx_packed ? 5 : 0, | |
| 76 | + .divx_flags = m->h.divx_packed ? 5 : 0, | |
| 77 | 77 | |
| 78 | 78 | .vop_coding_type = s->pict_type - AV_PICTURE_TYPE_I, |
| 79 | 79 | .vop_coded = 1, |
| @@ -127,7 +127,7 @@ static int rv10_decode_picture_header(H263DecContext *const h) · 126 unmodified lines | ||
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (h->c.pict_type == AV_PICTURE_TYPE_I) { |
| 130 | − if (h->c.rv10_version == 3) { | |
| 130 | + if (h->rv10_version == 3) { | |
| 131 | 131 | /* specific MPEG like DC coding not used */ |
| 132 | 132 | h->c.last_dc[0] = get_bits(&h->gb, 8); |
| 133 | 133 | h->c.last_dc[1] = get_bits(&h->gb, 8); |
| @@ -369,7 +369,7 @@ static av_cold int rv10_decode_init(AVCodecContext *avctx) · 235 unmodified lines | ||
| 369 | 369 | rv->orig_width = avctx->coded_width; |
| 370 | 370 | rv->orig_height = avctx->coded_height; |
| 371 | 371 | |
| 372 | − h->c.h263_long_vectors = avctx->extradata[3] & 1; | |
| 372 | + h->h263_long_vectors = avctx->extradata[3] & 1; | |
| 373 | 373 | rv->sub_id = AV_RB32A(avctx->extradata + 4); |
| 374 | 374 | if (avctx->codec_id == AV_CODEC_ID_RV20) { |
| 375 | 375 | h->c.modified_quant = 1; |
| @@ -382,7 +382,7 @@ static av_cold int rv10_decode_init(AVCodecContext *avctx) · 6 unmodified lines | ||
| 382 | 382 | |
| 383 | 383 | switch (major_ver) { |
| 384 | 384 | case 1: |
| 385 | − h->c.rv10_version = micro_ver ? 3 : 1; | |
| 385 | + h->rv10_version = micro_ver ? 3 : 1; | |
| 386 | 386 | h->c.obmc = micro_ver == 2; |
| 387 | 387 | break; |
| 388 | 388 | case 2: |
| @@ -475,9 +475,9 @@ static int rv10_decode_packet(AVCodecContext *avctx, const uint8_t *buf, · 86 unmodified lines | ||
| 475 | 475 | |
| 476 | 476 | ff_set_qscale(&h->c, h->c.qscale); |
| 477 | 477 | |
| 478 | − h->c.rv10_first_dc_coded[0] = 0; | |
| 479 | − h->c.rv10_first_dc_coded[1] = 0; | |
| 480 | − h->c.rv10_first_dc_coded[2] = 0; | |
| 478 | + h->rv10_first_dc_coded[0] = 0; | |
| 479 | + h->rv10_first_dc_coded[1] = 0; | |
| 480 | + h->rv10_first_dc_coded[2] = 0; | |
| 481 | 481 | ff_init_block_index(&h->c); |
| 482 | 482 | |
| 483 | 483 | /* decode each macroblock */ |