Revision 6e0d8c06

View differences:

ffmpeg.c
106 106
static int video_qmax = 31;
107 107
static int video_lmin = 2*FF_QP2LAMBDA;
108 108
static int video_lmax = 31*FF_QP2LAMBDA;
109
static int video_mb_qmin = 2;
110
static int video_mb_qmax = 31;
109
static int video_mb_lmin = 2*FF_QP2LAMBDA;
110
static int video_mb_lmax = 31*FF_QP2LAMBDA;
111 111
static int video_qdiff = 3;
112 112
static int video_lelim = 0;
113 113
static int video_celim = 0;
......
2490 2490
static void opt_qmin(const char *arg)
2491 2491
{
2492 2492
    video_qmin = atoi(arg);
2493
    if (video_qmin < 0 ||
2493
    if (video_qmin < 1 ||
2494 2494
        video_qmin > 31) {
2495 2495
        fprintf(stderr, "qmin must be >= 1 and <= 31\n");
2496 2496
        exit(1);
......
2500 2500
static void opt_qmax(const char *arg)
2501 2501
{
2502 2502
    video_qmax = atoi(arg);
2503
    if (video_qmax < 0 ||
2503
    if (video_qmax < 1 ||
2504 2504
        video_qmax > 31) {
2505 2505
        fprintf(stderr, "qmax must be >= 1 and <= 31\n");
2506 2506
        exit(1);
2507 2507
    }
2508 2508
}
2509 2509

  
2510
static void opt_mb_qmin(const char *arg)
2510
static void opt_mb_lmin(const char *arg)
2511 2511
{
2512
    video_mb_qmin = atoi(arg);
2513
    if (video_mb_qmin < 0 ||
2514
        video_mb_qmin > 31) {
2515
        fprintf(stderr, "qmin must be >= 1 and <= 31\n");
2512
    video_mb_lmin = atof(arg)*FF_QP2LAMBDA;
2513
    if (video_mb_lmin < 1 ||
2514
        video_mb_lmin > FF_LAMBDA_MAX) {
2515
        fprintf(stderr, "mblmin must be >= 1 and <= %d\n", FF_LAMBDA_MAX / FF_QP2LAMBDA);
2516 2516
        exit(1);
2517 2517
    }
2518 2518
}
2519 2519

  
2520
static void opt_mb_qmax(const char *arg)
2520
static void opt_mb_lmax(const char *arg)
2521 2521
{
2522
    video_mb_qmax = atoi(arg);
2523
    if (video_mb_qmax < 0 ||
2524
        video_mb_qmax > 31) {
2525
        fprintf(stderr, "qmax must be >= 1 and <= 31\n");
2522
    video_mb_lmax = atof(arg)*FF_QP2LAMBDA;
2523
    if (video_mb_lmax < 1 ||
2524
        video_mb_lmax > FF_LAMBDA_MAX) {
2525
        fprintf(stderr, "mblmax must be >= 1 and <= %d\n", FF_LAMBDA_MAX / FF_QP2LAMBDA);
2526 2526
        exit(1);
2527 2527
    }
2528 2528
}
......
3227 3227
                video_enc->rc_qsquish = video_qsquish;
3228 3228
                video_enc->luma_elim_threshold = video_lelim;
3229 3229
                video_enc->chroma_elim_threshold = video_celim;
3230
                video_enc->mb_qmin = video_mb_qmin;
3231
                video_enc->mb_qmax = video_mb_qmax;
3230
                video_enc->mb_lmin = video_mb_lmin;
3231
                video_enc->mb_lmax = video_mb_lmax;
3232 3232
                video_enc->max_qdiff = video_qdiff;
3233 3233
                video_enc->qblur = video_qblur;
3234 3234
                video_enc->qcompress = video_qcomp;
......
3947 3947
    { "qmax", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_qmax}, "max video quantiser scale (VBR)", "q" },
3948 3948
    { "lmin", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_lmin}, "min video lagrange factor (VBR)", "lambda" },
3949 3949
    { "lmax", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_lmax}, "max video lagrange factor (VBR)", "lambda" },
3950
    { "mbqmin", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_mb_qmin}, "min macroblock quantiser scale (VBR)", "q" },
3951
    { "mbqmax", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_mb_qmax}, "max macroblock quantiser scale (VBR)", "q" },
3950
    { "mblmin", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_mb_lmin}, "min macroblock quantiser scale (VBR)", "q" },
3951
    { "mblmax", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_mb_lmax}, "max macroblock quantiser scale (VBR)", "q" },
3952 3952
    { "qdiff", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_qdiff}, "max difference between the quantiser scale (VBR)", "q" },
3953 3953
    { "qblur", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_qblur}, "video quantiser scale blur (VBR)", "blur" },
3954 3954
    { "qsquish", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_qsquish}, "how to keep quantiser between qmin and qmax (0 = clip, 1 = use differentiable function)", "squish" },
libavcodec/avcodec.h
17 17

  
18 18
#define FFMPEG_VERSION_INT     0x000409
19 19
#define FFMPEG_VERSION         "0.4.9-pre1"
20
#define LIBAVCODEC_BUILD       4741
20
#define LIBAVCODEC_BUILD       4742
21 21

  
22 22
#define LIBAVCODEC_VERSION_INT FFMPEG_VERSION_INT
23 23
#define LIBAVCODEC_VERSION     FFMPEG_VERSION
......
1276 1276
    
1277 1277
    /**
1278 1278
     * minimum MB quantizer.
1279
     * - encoding: set by user.
1279
     * - encoding: unused
1280 1280
     * - decoding: unused
1281 1281
     */
1282 1282
    int mb_qmin;
1283 1283

  
1284 1284
    /**
1285 1285
     * maximum MB quantizer.
1286
     * - encoding: set by user.
1286
     * - encoding: unused
1287 1287
     * - decoding: unused
1288 1288
     */
1289 1289
    int mb_qmax;
......
1758 1758
     * - decoding: unused
1759 1759
     */
1760 1760
    float border_masking;
1761

  
1762
    /**
1763
     * minimum MB lagrange multipler.
1764
     * - encoding: set by user.
1765
     * - decoding: unused
1766
     */
1767
    int mb_lmin;
1768

  
1769
    /**
1770
     * maximum MB lagrange multipler.
1771
     * - encoding: set by user.
1772
     * - decoding: unused
1773
     */
1774
    int mb_lmax;
1761 1775
} AVCodecContext;
1762 1776

  
1763 1777

  
libavcodec/ratecontrol.c
506 506
    float cplx_sum= 0.0;
507 507
    float cplx_tab[s->mb_num];
508 508
    float bits_tab[s->mb_num];
509
    const int qmin= s->avctx->lmin;
510
    const int qmax= s->avctx->lmax;
509
    const int qmin= s->avctx->mb_lmin;
510
    const int qmax= s->avctx->mb_lmax;
511 511
    Picture * const pic= &s->current_picture;
512 512
    const int mb_width = s->mb_width;
513 513
    const int mb_height = s->mb_height;
libavcodec/utils.c
430 430
    s->bit_rate_tolerance= s->bit_rate*10;
431 431
    s->qmin= 2;
432 432
    s->qmax= 31;
433
    s->mb_qmin= 2;
434
    s->mb_qmax= 31;
433
    s->mb_lmin= FF_QP2LAMBDA * 2;
434
    s->mb_lmax= FF_QP2LAMBDA * 31;
435 435
    s->rc_eq= "tex^qComp";
436 436
    s->qcompress= 0.5;
437 437
    s->max_qdiff= 3;

Also available in: Unified diff