diff -ur a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
|
a
|
b
|
|
| 228 | 228 | s->timecode_frame_start = 0; // default is -1 |
| 229 | 229 | } |
| 230 | 230 | |
| | 231 | if (s->telecine) { |
| | 232 | if (s->frame_rate_index != 1 && s->frame_rate_index != 2) { |
| | 233 | av_log( avctx, AV_LOG_ERROR, "Telecine is only allowed with 24000/1001 or 24 fps input\n" ); |
| | 234 | return AVERROR(EINVAL); |
| | 235 | } |
| | 236 | if (!s->progressive_sequence) { |
| | 237 | av_log( avctx, AV_LOG_ERROR, "Telecine is only allowed with progressive input\n" ); |
| | 238 | return AVERROR(EINVAL); |
| | 239 | } |
| | 240 | } |
| | 241 | |
| 231 | 242 | return 0; |
| 232 | 243 | } |
| 233 | 244 | |
| … |
… |
|
| 275 | 286 | } |
| 276 | 287 | |
| 277 | 288 | put_bits(&s->pb, 4, s->aspect_ratio_info); |
| 278 | | put_bits(&s->pb, 4, s->frame_rate_index); |
| | 289 | put_bits(&s->pb, 4, s->frame_rate_index + (s->telecine ? 3 : 0)); |
| 279 | 290 | |
| 280 | 291 | if (s->avctx->rc_max_rate) { |
| 281 | 292 | v = (s->avctx->rc_max_rate + 399) / 400; |
| … |
… |
|
| 328 | 339 | put_bits(&s->pb, 3, s->avctx->profile); // profile |
| 329 | 340 | put_bits(&s->pb, 4, s->avctx->level); // level |
| 330 | 341 | |
| 331 | | put_bits(&s->pb, 1, s->progressive_sequence); |
| | 342 | put_bits(&s->pb, 1, s->telecine ? 0 : s->progressive_sequence); |
| 332 | 343 | put_bits(&s->pb, 2, s->chroma_format); |
| 333 | 344 | put_bits(&s->pb, 2, s->width >> 12); |
| 334 | 345 | put_bits(&s->pb, 2, s->height >> 12); |
| … |
… |
|
| 463 | 474 | |
| 464 | 475 | s->frame_pred_frame_dct = 1; |
| 465 | 476 | if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO) { |
| | 477 | if (s->telecine) { |
| | 478 | static const int |
| | 479 | tff[4] = { 1, 0, 0, 1 }, |
| | 480 | rff[4] = { 1, 0, 1, 0 }; |
| | 481 | const size_t mod = picture_number & 0x3; |
| | 482 | s->top_field_first = tff[mod]; |
| | 483 | s->repeat_first_field = rff[mod]; |
| | 484 | } |
| 466 | 485 | put_header(s, EXT_START_CODE); |
| 467 | 486 | put_bits(&s->pb, 4, 8); /* pic ext */ |
| 468 | 487 | if (s->pict_type == AV_PICTURE_TYPE_P || |
| … |
… |
|
| 483 | 502 | av_assert0(s->picture_structure == PICT_FRAME); |
| 484 | 503 | put_bits(&s->pb, 2, s->picture_structure); |
| 485 | 504 | if (s->progressive_sequence) |
| 486 | | put_bits(&s->pb, 1, 0); /* no repeat */ |
| | 505 | put_bits(&s->pb, 1, s->telecine ? s->top_field_first : 0); /* no repeat */ |
| 487 | 506 | else |
| 488 | 507 | put_bits(&s->pb, 1, s->current_picture_ptr->f->top_field_first); |
| 489 | 508 | /* XXX: optimize the generation of this flag with entropy measures */ |
| … |
… |
|
| 1175 | 1194 | #undef LEVEL |
| 1176 | 1195 | FF_MPV_COMMON_OPTS |
| 1177 | 1196 | FF_MPEG2_PROFILE_OPTS |
| | 1197 | { "telecine", "Apply 3:2 pulldown (soft telecine)", OFFSET(telecine), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, |
| 1178 | 1198 | { NULL }, |
| 1179 | 1199 | }; |
| 1180 | 1200 | |
diff -ur a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
|
a
|
b
|
|
| 2001 | 2001 | av_log(avctx, AV_LOG_ERROR, |
| 2002 | 2002 | "Internal error, negative bits\n"); |
| 2003 | 2003 | |
| 2004 | | av_assert1(s->repeat_first_field == 0); |
| | 2004 | av_assert1(s->repeat_first_field == 0 || s->telecine); |
| 2005 | 2005 | |
| 2006 | 2006 | vbv_delay = bits * 90000 / avctx->rc_max_rate; |
| 2007 | 2007 | min_delay = (minbits * 90000LL + avctx->rc_max_rate - 1) / |
diff -ur a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
|
a
|
b
|
|
| 582 | 582 | int noise_reduction; |
| 583 | 583 | |
| 584 | 584 | int intra_penalty; |
| | 585 | |
| | 586 | int telecine; |
| 585 | 587 | } MpegEncContext; |
| 586 | 588 | |
| 587 | 589 | /* mpegvideo_enc common options */ |