Revision 176e1762 libavcodec/dnxhdenc.c

View differences:

libavcodec/dnxhdenc.c
24 24
//#define DEBUG
25 25
#define RC_VARIANCE 1 // use variance or ssd for fast rc
26 26

  
27
#include "libavutil/opt.h"
27 28
#include "avcodec.h"
28 29
#include "dsputil.h"
29 30
#include "mpegvideo.h"
30 31
#include "dnxhdenc.h"
31 32

  
33
#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
34

  
35
static const AVOption options[]={
36
    {"nitris_compat", "encode with Avid Nitris compatibility", offsetof(DNXHDEncContext, nitris_compat), FF_OPT_TYPE_INT, 0, 0, 1, VE},
37
{NULL}
38
};
39
static const AVClass class = { "dnxhd", av_default_item_name, options, LIBAVUTIL_VERSION_INT };
40

  
32 41
int dct_quantize_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow);
33 42

  
34 43
#define LAMBDA_FRAC_BITS 10
......
146 155
    if (ctx->m.avctx->mb_decision != FF_MB_DECISION_RD)
147 156
        FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_cmp, ctx->m.mb_num*sizeof(RCCMPEntry), fail);
148 157

  
149
    ctx->frame_bits = (ctx->cid_table->coding_unit_size - 640 - 4) * 8;
158
    ctx->frame_bits = (ctx->cid_table->coding_unit_size - 640 - 4 - ctx->min_padding) * 8;
150 159
    ctx->qscale = 1;
151 160
    ctx->lambda = 2<<LAMBDA_FRAC_BITS; // qscale 2
152 161
    return 0;
......
198 207
    if (dnxhd_init_qmat(ctx, ctx->m.intra_quant_bias, 0) < 0) // XXX tune lbias/cbias
199 208
        return -1;
200 209

  
210
    // Avid Nitris hardware decoder requires a minimum amount of padding in the coding unit payload
211
    if (ctx->nitris_compat)
212
        ctx->min_padding = 1600;
213

  
201 214
    if (dnxhd_init_vlc(ctx) < 0)
202 215
        return -1;
203 216
    if (dnxhd_init_rc(ctx) < 0)
......
858 871
    dnxhd_encode_end,
859 872
    .pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV422P, PIX_FMT_NONE},
860 873
    .long_name = NULL_IF_CONFIG_SMALL("VC3/DNxHD"),
874
    .priv_class = &class,
861 875
};

Also available in: Unified diff