| 478 | | if ( p_sys->b_strict_rc ) |
|---|
| | 475 | |
|---|
| | 476 | if ( p_sys->f_i_quant_factor != 0.0 ) |
|---|
| | 477 | p_context->i_quant_factor = p_sys->f_i_quant_factor; |
|---|
| | 478 | |
|---|
| | 479 | p_context->noise_reduction = p_sys->i_noise_reduction; |
|---|
| | 480 | |
|---|
| | 481 | if ( p_sys->b_mpeg4_matrix ) |
|---|
| | 482 | { |
|---|
| | 483 | p_context->intra_matrix = mpeg4_default_intra_matrix; |
|---|
| | 484 | p_context->inter_matrix = mpeg4_default_non_intra_matrix; |
|---|
| | 485 | } |
|---|
| | 486 | |
|---|
| | 487 | if ( p_sys->b_pre_me ) |
|---|
| | 488 | { |
|---|
| | 489 | p_context->pre_me = 1; |
|---|
| | 490 | p_context->me_pre_cmp = FF_CMP_CHROMA; |
|---|
| | 491 | } |
|---|
| | 492 | |
|---|
| | 493 | if ( p_sys->b_interlace ) |
|---|
| | 494 | { |
|---|
| | 495 | if ( p_context->height <= 280 ) |
|---|
| | 496 | { |
|---|
| | 497 | if ( p_context->height != 16 || p_context->width != 16 ) |
|---|
| | 498 | msg_Warn( p_enc, |
|---|
| | 499 | "disabling interlaced video because height=%d <= 280", |
|---|
| | 500 | p_context->height ); |
|---|
| | 501 | } |
|---|
| | 502 | else |
|---|
| | 503 | { |
|---|
| | 504 | p_context->flags |= CODEC_FLAG_INTERLACED_DCT; |
|---|
| | 505 | if ( p_sys->b_interlace_me ) |
|---|
| | 506 | p_context->flags |= CODEC_FLAG_INTERLACED_ME; |
|---|
| | 507 | } |
|---|
| | 508 | } |
|---|
| | 509 | |
|---|
| | 510 | if ( p_sys->b_trellis ) |
|---|
| | 511 | p_context->flags |= CODEC_FLAG_TRELLIS_QUANT; |
|---|
| | 512 | |
|---|
| | 513 | if ( p_sys->i_qmin > 0 && p_sys->i_qmin == p_sys->i_qmax ) |
|---|
| | 514 | p_context->flags |= CODEC_FLAG_QSCALE; |
|---|
| | 515 | |
|---|
| | 516 | if ( p_enc->i_threads >= 1 ) |
|---|
| | 517 | p_context->thread_count = p_enc->i_threads; |
|---|
| | 518 | |
|---|
| | 519 | if( p_sys->i_vtolerance > 0 ) |
|---|
| | 520 | p_context->bit_rate_tolerance = p_sys->i_vtolerance; |
|---|
| | 521 | |
|---|
| | 522 | /* usually if someone sets bitrate, he likes more to get that bitrate |
|---|
| | 523 | * over quality should help 'normal' user to get asked bitrate |
|---|
| | 524 | */ |
|---|
| | 525 | if( p_enc->fmt_out.i_bitrate > 0 && p_sys->i_qmax == 0 && p_sys->i_qmin == 0 ) |
|---|
| | 526 | { |
|---|
| | 527 | p_sys->i_qmax = 51; |
|---|
| | 528 | p_sys->i_qmin = 3; |
|---|
| | 529 | } |
|---|
| | 530 | |
|---|
| | 531 | if( p_sys->i_qmin > 0 ) |
|---|
| | 532 | { |
|---|
| | 533 | p_context->mb_qmin = p_context->qmin = p_sys->i_qmin; |
|---|
| | 534 | p_context->mb_lmin = p_context->lmin = p_sys->i_qmin * FF_QP2LAMBDA; |
|---|
| | 535 | } |
|---|
| | 536 | if( p_sys->i_qmax > 0 ) |
|---|
| | 537 | { |
|---|
| | 538 | p_context->mb_qmax = p_context->qmax = p_sys->i_qmax; |
|---|
| | 539 | p_context->mb_lmax = p_context->lmax = p_sys->i_qmax * FF_QP2LAMBDA; |
|---|
| | 540 | } |
|---|
| | 541 | p_context->max_qdiff = 3; |
|---|
| | 542 | |
|---|
| | 543 | p_context->mb_decision = p_sys->i_hq; |
|---|
| | 544 | |
|---|
| | 545 | if( p_sys->i_quality ) |
|---|
| | 546 | { |
|---|
| | 547 | p_context->flags |= CODEC_FLAG_QSCALE; |
|---|
| | 548 | p_context->global_quality = p_sys->i_quality; |
|---|
| | 549 | } |
|---|
| | 550 | else |
|---|
| 489 | | |
|---|
| 490 | | if ( p_sys->f_i_quant_factor != 0.0 ) |
|---|
| 491 | | p_context->i_quant_factor = p_sys->f_i_quant_factor; |
|---|
| 492 | | |
|---|
| 493 | | p_context->noise_reduction = p_sys->i_noise_reduction; |
|---|
| 494 | | |
|---|
| 495 | | if ( p_sys->b_mpeg4_matrix ) |
|---|
| 496 | | { |
|---|
| 497 | | p_context->intra_matrix = mpeg4_default_intra_matrix; |
|---|
| 498 | | p_context->inter_matrix = mpeg4_default_non_intra_matrix; |
|---|
| 499 | | } |
|---|
| 500 | | |
|---|
| 501 | | if ( p_sys->b_pre_me ) |
|---|
| 502 | | { |
|---|
| 503 | | p_context->pre_me = 1; |
|---|
| 504 | | p_context->me_pre_cmp = FF_CMP_CHROMA; |
|---|
| 505 | | } |
|---|
| 506 | | |
|---|
| 507 | | if ( p_sys->b_interlace ) |
|---|
| 508 | | { |
|---|
| 509 | | if ( p_context->height <= 280 ) |
|---|
| 510 | | { |
|---|
| 511 | | if ( p_context->height != 16 || p_context->width != 16 ) |
|---|
| 512 | | msg_Warn( p_enc, |
|---|
| 513 | | "disabling interlaced video because height=%d <= 280", |
|---|
| 514 | | p_context->height ); |
|---|
| 515 | | } |
|---|
| 516 | | else |
|---|
| 517 | | { |
|---|
| 518 | | p_context->flags |= CODEC_FLAG_INTERLACED_DCT; |
|---|
| 519 | | if ( p_sys->b_interlace_me ) |
|---|
| 520 | | p_context->flags |= CODEC_FLAG_INTERLACED_ME; |
|---|
| 521 | | } |
|---|
| 522 | | } |
|---|
| 523 | | |
|---|
| 524 | | if ( p_sys->b_trellis ) |
|---|
| 525 | | p_context->flags |= CODEC_FLAG_TRELLIS_QUANT; |
|---|
| 526 | | |
|---|
| 527 | | if ( p_sys->i_qmin > 0 && p_sys->i_qmin == p_sys->i_qmax ) |
|---|
| 528 | | p_context->flags |= CODEC_FLAG_QSCALE; |
|---|
| 529 | | |
|---|
| 530 | | if ( p_enc->i_threads >= 1 ) |
|---|
| 531 | | p_context->thread_count = p_enc->i_threads; |
|---|
| 532 | | |
|---|
| 533 | | if( p_sys->i_vtolerance > 0 ) |
|---|
| 534 | | p_context->bit_rate_tolerance = p_sys->i_vtolerance; |
|---|
| 535 | | |
|---|
| 536 | | /* usually if someone sets bitrate, he likes more to get that bitrate |
|---|
| 537 | | * over quality should help 'normal' user to get asked bitrate |
|---|
| 538 | | */ |
|---|
| 539 | | if( p_enc->fmt_out.i_bitrate > 0 && p_sys->i_qmax == 0 && p_sys->i_qmin == 0 ) |
|---|
| 540 | | { |
|---|
| 541 | | p_sys->i_qmax = 51; |
|---|
| 542 | | p_sys->i_qmin = 3; |
|---|
| 543 | | } |
|---|
| 544 | | |
|---|
| 545 | | if( p_sys->i_qmin > 0 ) |
|---|
| 546 | | { |
|---|
| 547 | | p_context->mb_qmin = p_context->qmin = p_sys->i_qmin; |
|---|
| 548 | | p_context->mb_lmin = p_context->lmin = p_sys->i_qmin * FF_QP2LAMBDA; |
|---|
| 549 | | } |
|---|
| 550 | | if( p_sys->i_qmax > 0 ) |
|---|
| 551 | | { |
|---|
| 552 | | p_context->mb_qmax = p_context->qmax = p_sys->i_qmax; |
|---|
| 553 | | p_context->mb_lmax = p_context->lmax = p_sys->i_qmax * FF_QP2LAMBDA; |
|---|
| 554 | | } |
|---|
| 555 | | p_context->max_qdiff = 3; |
|---|
| 556 | | |
|---|
| 557 | | p_context->mb_decision = p_sys->i_hq; |
|---|
| 558 | | |
|---|
| 559 | | if( p_sys->i_quality ) |
|---|
| 560 | | { |
|---|
| 561 | | p_context->flags |= CODEC_FLAG_QSCALE; |
|---|
| 562 | | p_context->global_quality = p_sys->i_quality; |
|---|
| 563 | | } |
|---|