Merge commit '910247f1720c6aae422723c05dac6d0b19f20bec'
* commit '910247f1720c6aae422723c05dac6d0b19f20bec':
  lavc: Deprecate avctx.{inter,intra}_quant_bias
Conflicts:
	libavcodec/mpegvideo_enc.c
	libavcodec/version.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
			
			
This commit is contained in:
		
						commit
						a8ab64d2f7
					
				@ -1761,20 +1761,18 @@ typedef struct AVCodecContext {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    int me_range;
 | 
					    int me_range;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if FF_API_QUANT_BIAS
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * intra quantizer bias
 | 
					     * @deprecated use encoder private option instead
 | 
				
			||||||
     * - encoding: Set by user.
 | 
					 | 
				
			||||||
     * - decoding: unused
 | 
					 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    int intra_quant_bias;
 | 
					    attribute_deprecated int intra_quant_bias;
 | 
				
			||||||
#define FF_DEFAULT_QUANT_BIAS 999999
 | 
					#define FF_DEFAULT_QUANT_BIAS 999999
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * inter quantizer bias
 | 
					     * @deprecated use encoder private option instead
 | 
				
			||||||
     * - encoding: Set by user.
 | 
					 | 
				
			||||||
     * - decoding: unused
 | 
					 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    int inter_quant_bias;
 | 
					    attribute_deprecated int inter_quant_bias;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * slice flags
 | 
					     * slice flags
 | 
				
			||||||
 | 
				
			|||||||
@ -46,6 +46,9 @@
 | 
				
			|||||||
static const AVOption options[] = {
 | 
					static const AVOption options[] = {
 | 
				
			||||||
    { "nitris_compat", "encode with Avid Nitris compatibility",
 | 
					    { "nitris_compat", "encode with Avid Nitris compatibility",
 | 
				
			||||||
        offsetof(DNXHDEncContext, nitris_compat), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },
 | 
					        offsetof(DNXHDEncContext, nitris_compat), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },
 | 
				
			||||||
 | 
					    { "ibias", "intra quant bias",
 | 
				
			||||||
 | 
					        offsetof(DNXHDEncContext, intra_quant_bias), AV_OPT_TYPE_INT,
 | 
				
			||||||
 | 
					        { .i64 = FF_DEFAULT_QUANT_BIAS }, INT_MIN, INT_MAX, VE },
 | 
				
			||||||
    { NULL }
 | 
					    { NULL }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -214,14 +217,14 @@ static av_cold int dnxhd_init_qmat(DNXHDEncContext *ctx, int lbias, int cbias)
 | 
				
			|||||||
            weight_matrix[j] = ctx->cid_table->luma_weight[i];
 | 
					            weight_matrix[j] = ctx->cid_table->luma_weight[i];
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        ff_convert_matrix(&ctx->m, ctx->qmatrix_l, ctx->qmatrix_l16,
 | 
					        ff_convert_matrix(&ctx->m, ctx->qmatrix_l, ctx->qmatrix_l16,
 | 
				
			||||||
                          weight_matrix, ctx->m.intra_quant_bias, 1,
 | 
					                          weight_matrix, ctx->intra_quant_bias, 1,
 | 
				
			||||||
                          ctx->m.avctx->qmax, 1);
 | 
					                          ctx->m.avctx->qmax, 1);
 | 
				
			||||||
        for (i = 1; i < 64; i++) {
 | 
					        for (i = 1; i < 64; i++) {
 | 
				
			||||||
            int j = ctx->m.idsp.idct_permutation[ff_zigzag_direct[i]];
 | 
					            int j = ctx->m.idsp.idct_permutation[ff_zigzag_direct[i]];
 | 
				
			||||||
            weight_matrix[j] = ctx->cid_table->chroma_weight[i];
 | 
					            weight_matrix[j] = ctx->cid_table->chroma_weight[i];
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        ff_convert_matrix(&ctx->m, ctx->qmatrix_c, ctx->qmatrix_c16,
 | 
					        ff_convert_matrix(&ctx->m, ctx->qmatrix_c, ctx->qmatrix_c16,
 | 
				
			||||||
                          weight_matrix, ctx->m.intra_quant_bias, 1,
 | 
					                          weight_matrix, ctx->intra_quant_bias, 1,
 | 
				
			||||||
                          ctx->m.avctx->qmax, 1);
 | 
					                          ctx->m.avctx->qmax, 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for (qscale = 1; qscale <= ctx->m.avctx->qmax; qscale++) {
 | 
					        for (qscale = 1; qscale <= ctx->m.avctx->qmax; qscale++) {
 | 
				
			||||||
@ -355,10 +358,15 @@ static av_cold int dnxhd_encode_init(AVCodecContext *avctx)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    ctx->m.mb_num = ctx->m.mb_height * ctx->m.mb_width;
 | 
					    ctx->m.mb_num = ctx->m.mb_height * ctx->m.mb_width;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (avctx->intra_quant_bias != FF_DEFAULT_QUANT_BIAS)
 | 
					#if FF_API_QUANT_BIAS
 | 
				
			||||||
        ctx->m.intra_quant_bias = avctx->intra_quant_bias;
 | 
					FF_DISABLE_DEPRECATION_WARNINGS
 | 
				
			||||||
 | 
					    if (ctx->intra_quant_bias == FF_DEFAULT_QUANT_BIAS &&
 | 
				
			||||||
 | 
					        avctx->intra_quant_bias != FF_DEFAULT_QUANT_BIAS)
 | 
				
			||||||
 | 
					        ctx->intra_quant_bias = avctx->intra_quant_bias;
 | 
				
			||||||
 | 
					FF_ENABLE_DEPRECATION_WARNINGS
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
    // XXX tune lbias/cbias
 | 
					    // XXX tune lbias/cbias
 | 
				
			||||||
    if ((ret = dnxhd_init_qmat(ctx, ctx->m.intra_quant_bias, 0)) < 0)
 | 
					    if ((ret = dnxhd_init_qmat(ctx, ctx->intra_quant_bias, 0)) < 0)
 | 
				
			||||||
        return ret;
 | 
					        return ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Avid Nitris hardware decoder requires a minimum amount of padding
 | 
					    /* Avid Nitris hardware decoder requires a minimum amount of padding
 | 
				
			||||||
 | 
				
			|||||||
@ -63,6 +63,7 @@ typedef struct DNXHDEncContext {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    int nitris_compat;
 | 
					    int nitris_compat;
 | 
				
			||||||
    unsigned min_padding;
 | 
					    unsigned min_padding;
 | 
				
			||||||
 | 
					    int intra_quant_bias;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    DECLARE_ALIGNED(16, int16_t, blocks)[8][64];
 | 
					    DECLARE_ALIGNED(16, int16_t, blocks)[8][64];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -61,6 +61,10 @@
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if !FF_API_QUANT_BIAS
 | 
				
			||||||
 | 
					#define FF_DEFAULT_QUANT_BIAS 999999
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define FF_SANE_NB_CHANNELS 63U
 | 
					#define FF_SANE_NB_CHANNELS 63U
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define FF_SIGNBIT(x) ((x) >> CHAR_BIT * sizeof(x) - 1)
 | 
					#define FF_SIGNBIT(x) ((x) >> CHAR_BIT * sizeof(x) - 1)
 | 
				
			||||||
 | 
				
			|||||||
@ -593,6 +593,8 @@ typedef struct MpegEncContext {
 | 
				
			|||||||
{"border_mask", "increase the quantizer for macroblocks close to borders", FF_MPV_OFFSET(border_masking), AV_OPT_TYPE_FLOAT, {.dbl = 0 }, -FLT_MAX, FLT_MAX, FF_MPV_OPT_FLAGS},    \
 | 
					{"border_mask", "increase the quantizer for macroblocks close to borders", FF_MPV_OFFSET(border_masking), AV_OPT_TYPE_FLOAT, {.dbl = 0 }, -FLT_MAX, FLT_MAX, FF_MPV_OPT_FLAGS},    \
 | 
				
			||||||
{"lmin", "minimum Lagrange factor (VBR)",                           FF_MPV_OFFSET(lmin), AV_OPT_TYPE_INT, {.i64 =  2*FF_QP2LAMBDA }, 0, INT_MAX, FF_MPV_OPT_FLAGS },            \
 | 
					{"lmin", "minimum Lagrange factor (VBR)",                           FF_MPV_OFFSET(lmin), AV_OPT_TYPE_INT, {.i64 =  2*FF_QP2LAMBDA }, 0, INT_MAX, FF_MPV_OPT_FLAGS },            \
 | 
				
			||||||
{"lmax", "maximum Lagrange factor (VBR)",                           FF_MPV_OFFSET(lmax), AV_OPT_TYPE_INT, {.i64 = 31*FF_QP2LAMBDA }, 0, INT_MAX, FF_MPV_OPT_FLAGS },            \
 | 
					{"lmax", "maximum Lagrange factor (VBR)",                           FF_MPV_OFFSET(lmax), AV_OPT_TYPE_INT, {.i64 = 31*FF_QP2LAMBDA }, 0, INT_MAX, FF_MPV_OPT_FLAGS },            \
 | 
				
			||||||
 | 
					{"ibias", "intra quant bias",                                       FF_MPV_OFFSET(intra_quant_bias), AV_OPT_TYPE_INT, {.i64 = FF_DEFAULT_QUANT_BIAS }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS },   \
 | 
				
			||||||
 | 
					{"pbias", "inter quant bias",                                       FF_MPV_OFFSET(inter_quant_bias), AV_OPT_TYPE_INT, {.i64 = FF_DEFAULT_QUANT_BIAS }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS },   \
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern const AVOption ff_mpv_generic_options[];
 | 
					extern const AVOption ff_mpv_generic_options[];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -677,10 +677,16 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
 | 
				
			|||||||
        return AVERROR(EINVAL);
 | 
					        return AVERROR(EINVAL);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (avctx->intra_quant_bias != FF_DEFAULT_QUANT_BIAS)
 | 
					#if FF_API_QUANT_BIAS
 | 
				
			||||||
 | 
					FF_DISABLE_DEPRECATION_WARNINGS
 | 
				
			||||||
 | 
					    if (s->intra_quant_bias == FF_DEFAULT_QUANT_BIAS &&
 | 
				
			||||||
 | 
					        avctx->intra_quant_bias != FF_DEFAULT_QUANT_BIAS)
 | 
				
			||||||
        s->intra_quant_bias = avctx->intra_quant_bias;
 | 
					        s->intra_quant_bias = avctx->intra_quant_bias;
 | 
				
			||||||
    if (avctx->inter_quant_bias != FF_DEFAULT_QUANT_BIAS)
 | 
					    if (s->inter_quant_bias == FF_DEFAULT_QUANT_BIAS &&
 | 
				
			||||||
 | 
					        avctx->inter_quant_bias != FF_DEFAULT_QUANT_BIAS)
 | 
				
			||||||
        s->inter_quant_bias = avctx->inter_quant_bias;
 | 
					        s->inter_quant_bias = avctx->inter_quant_bias;
 | 
				
			||||||
 | 
					FF_ENABLE_DEPRECATION_WARNINGS
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    av_log(avctx, AV_LOG_DEBUG, "intra_quant_bias = %d inter_quant_bias = %d\n",s->intra_quant_bias,s->inter_quant_bias);
 | 
					    av_log(avctx, AV_LOG_DEBUG, "intra_quant_bias = %d inter_quant_bias = %d\n",s->intra_quant_bias,s->inter_quant_bias);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -304,8 +304,10 @@ static const AVOption avcodec_options[] = {
 | 
				
			|||||||
{"dtg_active_format", NULL, OFFSET(dtg_active_format), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
 | 
					{"dtg_active_format", NULL, OFFSET(dtg_active_format), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
{"me_range", "limit motion vectors range (1023 for DivX player)", OFFSET(me_range), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
 | 
					{"me_range", "limit motion vectors range (1023 for DivX player)", OFFSET(me_range), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
 | 
				
			||||||
 | 
					#if FF_API_QUANT_BIAS
 | 
				
			||||||
{"ibias", "intra quant bias", OFFSET(intra_quant_bias), AV_OPT_TYPE_INT, {.i64 = FF_DEFAULT_QUANT_BIAS }, INT_MIN, INT_MAX, V|E},
 | 
					{"ibias", "intra quant bias", OFFSET(intra_quant_bias), AV_OPT_TYPE_INT, {.i64 = FF_DEFAULT_QUANT_BIAS }, INT_MIN, INT_MAX, V|E},
 | 
				
			||||||
{"pbias", "inter quant bias", OFFSET(inter_quant_bias), AV_OPT_TYPE_INT, {.i64 = FF_DEFAULT_QUANT_BIAS }, INT_MIN, INT_MAX, V|E},
 | 
					{"pbias", "inter quant bias", OFFSET(inter_quant_bias), AV_OPT_TYPE_INT, {.i64 = FF_DEFAULT_QUANT_BIAS }, INT_MIN, INT_MAX, V|E},
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
{"global_quality", NULL, OFFSET(global_quality), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|A|E},
 | 
					{"global_quality", NULL, OFFSET(global_quality), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|A|E},
 | 
				
			||||||
{"coder", NULL, OFFSET(coder_type), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "coder"},
 | 
					{"coder", NULL, OFFSET(coder_type), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "coder"},
 | 
				
			||||||
{"vlc", "variable length coder / Huffman coder", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CODER_TYPE_VLC }, INT_MIN, INT_MAX, V|E, "coder"},
 | 
					{"vlc", "variable length coder / Huffman coder", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CODER_TYPE_VLC }, INT_MIN, INT_MAX, V|E, "coder"},
 | 
				
			||||||
 | 
				
			|||||||
@ -30,7 +30,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#define LIBAVCODEC_VERSION_MAJOR 56
 | 
					#define LIBAVCODEC_VERSION_MAJOR 56
 | 
				
			||||||
#define LIBAVCODEC_VERSION_MINOR  46
 | 
					#define LIBAVCODEC_VERSION_MINOR  46
 | 
				
			||||||
#define LIBAVCODEC_VERSION_MICRO 100
 | 
					#define LIBAVCODEC_VERSION_MICRO 101
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
 | 
					#define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
 | 
				
			||||||
                                               LIBAVCODEC_VERSION_MINOR, \
 | 
					                                               LIBAVCODEC_VERSION_MINOR, \
 | 
				
			||||||
@ -190,5 +190,8 @@
 | 
				
			|||||||
#ifndef FF_API_STREAM_CODEC_TAG
 | 
					#ifndef FF_API_STREAM_CODEC_TAG
 | 
				
			||||||
#define FF_API_STREAM_CODEC_TAG  (LIBAVCODEC_VERSION_MAJOR < 59)
 | 
					#define FF_API_STREAM_CODEC_TAG  (LIBAVCODEC_VERSION_MAJOR < 59)
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef FF_API_QUANT_BIAS
 | 
				
			||||||
 | 
					#define FF_API_QUANT_BIAS        (LIBAVCODEC_VERSION_MAJOR < 59)
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif /* AVCODEC_VERSION_H */
 | 
					#endif /* AVCODEC_VERSION_H */
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user