1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

Merge commit '4b6b1082a73907c7c3de2646c6398bc61320f2c6'

* commit '4b6b1082a73907c7c3de2646c6398bc61320f2c6':
  lavc: Deprecate avctx.me_method

Conflicts:
	doc/encoders.texi
	libavcodec/avcodec.h
	libavcodec/libx264.c
	libavcodec/motion_est.c
	libavcodec/options_table.h
	libavcodec/version.h

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2015-07-27 21:03:20 +02:00
commit 0b6f092ed3
13 changed files with 211 additions and 104 deletions

View File

@ -645,7 +645,9 @@ typedef struct AVCodecDescriptor {
/**
* @ingroup lavc_encoding
* motion estimation type.
* @deprecated use codec private option instead
*/
#if FF_API_MOTION_EST
enum Motion_Est_ID {
ME_ZERO = 1, ///< no search, that is use 0,0 vector whenever one is needed
ME_FULL,
@ -658,6 +660,7 @@ enum Motion_Est_ID {
ME_TESA, ///< transformed exhaustive search algorithm
ME_ITER=50, ///< iterative search
};
#endif
/**
* @ingroup lavc_decoding
@ -1485,14 +1488,13 @@ typedef struct AVCodecContext {
*/
enum AVPixelFormat pix_fmt;
#if FF_API_MOTION_EST
/**
* Motion estimation algorithm used for video coding.
* 1 (zero), 2 (full), 3 (log), 4 (phods), 5 (epzs), 6 (x1), 7 (hex),
* 8 (umh), 9 (iter), 10 (tesa) [7, 8, 10 are x264 specific, 9 is snow specific]
* - encoding: MUST be set by user.
* - decoding: unused
* This option does nothing
* @deprecated use codec private options instead
*/
int me_method;
attribute_deprecated int me_method;
#endif
/**
* If non NULL, 'draw_horiz_band' is called by the libavcodec

View File

@ -81,6 +81,7 @@ typedef struct X264Context {
char *stats;
int nal_hrd;
int avcintra_class;
int motion_est;
char *x264_params;
} X264Context;
@ -470,17 +471,6 @@ static av_cold int X264_init(AVCodecContext *avctx)
if (avctx->chromaoffset)
x4->params.analyse.i_chroma_qp_offset = avctx->chromaoffset;
if (avctx->me_method == ME_EPZS)
x4->params.analyse.i_me_method = X264_ME_DIA;
else if (avctx->me_method == ME_HEX)
x4->params.analyse.i_me_method = X264_ME_HEX;
else if (avctx->me_method == ME_UMH)
x4->params.analyse.i_me_method = X264_ME_UMH;
else if (avctx->me_method == ME_FULL)
x4->params.analyse.i_me_method = X264_ME_ESA;
else if (avctx->me_method == ME_TESA)
x4->params.analyse.i_me_method = X264_ME_TESA;
if (avctx->gop_size >= 0)
x4->params.i_keyint_max = avctx->gop_size;
if (avctx->max_b_frames >= 0)
@ -633,6 +623,25 @@ static av_cold int X264_init(AVCodecContext *avctx)
if (x4->nal_hrd >= 0)
x4->params.i_nal_hrd = x4->nal_hrd;
if (x4->motion_est >= 0) {
x4->params.analyse.i_me_method = x4->motion_est;
#if FF_API_MOTION_EST
FF_DISABLE_DEPRECATION_WARNINGS
} else {
if (avctx->me_method == ME_EPZS)
x4->params.analyse.i_me_method = X264_ME_DIA;
else if (avctx->me_method == ME_HEX)
x4->params.analyse.i_me_method = X264_ME_HEX;
else if (avctx->me_method == ME_UMH)
x4->params.analyse.i_me_method = X264_ME_UMH;
else if (avctx->me_method == ME_FULL)
x4->params.analyse.i_me_method = X264_ME_ESA;
else if (avctx->me_method == ME_TESA)
x4->params.analyse.i_me_method = X264_ME_TESA;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
}
if (x4->profile)
if (x264_param_apply_profile(&x4->params, x4->profile) < 0) {
int i;
@ -854,6 +863,12 @@ static const AVOption options[] = {
{ "vbr", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = X264_NAL_HRD_VBR}, INT_MIN, INT_MAX, VE, "nal-hrd" },
{ "cbr", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = X264_NAL_HRD_CBR}, INT_MIN, INT_MAX, VE, "nal-hrd" },
{ "avcintra-class","AVC-Intra class 50/100/200", OFFSET(avcintra_class),AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 200 , VE},
{ "motion-est", "Set motion estimation method", OFFSET(motion_est), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, X264_ME_TESA, VE, "motion-est"},
{ "dia", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = X264_ME_DIA }, INT_MIN, INT_MAX, VE, "motion-est" },
{ "hex", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = X264_ME_HEX }, INT_MIN, INT_MAX, VE, "motion-est" },
{ "umh", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = X264_ME_UMH }, INT_MIN, INT_MAX, VE, "motion-est" },
{ "esa", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = X264_ME_ESA }, INT_MIN, INT_MAX, VE, "motion-est" },
{ "tesa", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = X264_ME_TESA }, INT_MIN, INT_MAX, VE, "motion-est" },
{ "x264-params", "Override the x264 configuration using a :-separated list of key=value parameters", OFFSET(x264_params), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE },
{ NULL },
};
@ -876,7 +891,9 @@ static const AVCodecDefault x264_defaults[] = {
{ "trellis", "-1" },
{ "nr", "-1" },
{ "me_range", "-1" },
#if FF_API_MOTION_EST
{ "me_method", "-1" },
#endif
{ "subq", "-1" },
{ "b_strategy", "-1" },
{ "keyint_min", "-1" },

View File

@ -53,6 +53,7 @@ typedef struct XavsContext {
int direct_pred;
int aud;
int fast_pskip;
int motion_est;
int mbtree;
int mixed_refs;
@ -269,6 +270,8 @@ static av_cold int XAVS_init(AVCodecContext *avctx)
x4->params.analyse.i_direct_mv_pred = x4->direct_pred;
if (x4->fast_pskip >= 0)
x4->params.analyse.b_fast_pskip = x4->fast_pskip;
if (x4->motion_est >= 0)
x4->params.analyse.i_me_method = x4->motion_est;
if (x4->mixed_refs >= 0)
x4->params.analyse.b_mixed_references = x4->mixed_refs;
if (x4->b_bias != INT_MIN)
@ -276,6 +279,32 @@ static av_cold int XAVS_init(AVCodecContext *avctx)
if (x4->cplxblur >= 0)
x4->params.rc.f_complexity_blur = x4->cplxblur;
#if FF_API_MOTION_EST
FF_DISABLE_DEPRECATION_WARNINGS
if (x4->motion_est < 0) {
switch (avctx->me_method) {
case ME_EPZS:
x4->params.analyse.i_me_method = XAVS_ME_DIA;
break;
case ME_HEX:
x4->params.analyse.i_me_method = XAVS_ME_HEX;
break;
case ME_UMH:
x4->params.analyse.i_me_method = XAVS_ME_UMH;
break;
case ME_FULL:
x4->params.analyse.i_me_method = XAVS_ME_ESA;
break;
case ME_TESA:
x4->params.analyse.i_me_method = XAVS_ME_TESA;
break;
default:
x4->params.analyse.i_me_method = XAVS_ME_HEX;
}
}
FF_ENABLE_DEPRECATION_WARNINGS
#endif
x4->params.i_bframe = avctx->max_b_frames;
/* cabac is not included in AVS JiZhun Profile */
x4->params.b_cabac = 0;
@ -312,26 +341,6 @@ static av_cold int XAVS_init(AVCodecContext *avctx)
x4->params.i_fps_den = avctx->time_base.num;
x4->params.analyse.inter = XAVS_ANALYSE_I8x8 |XAVS_ANALYSE_PSUB16x16| XAVS_ANALYSE_BSUB16x16;
switch (avctx->me_method) {
case ME_EPZS:
x4->params.analyse.i_me_method = XAVS_ME_DIA;
break;
case ME_HEX:
x4->params.analyse.i_me_method = XAVS_ME_HEX;
break;
case ME_UMH:
x4->params.analyse.i_me_method = XAVS_ME_UMH;
break;
case ME_FULL:
x4->params.analyse.i_me_method = XAVS_ME_ESA;
break;
case ME_TESA:
x4->params.analyse.i_me_method = XAVS_ME_TESA;
break;
default:
x4->params.analyse.i_me_method = XAVS_ME_HEX;
}
x4->params.analyse.i_me_range = avctx->me_range;
x4->params.analyse.i_subpel_refine = avctx->me_subpel_quality;
@ -422,6 +431,13 @@ static const AVOption options[] = {
{ "mbtree", "Use macroblock tree ratecontrol.", OFFSET(mbtree), AV_OPT_TYPE_INT, {.i64 = -1 }, -1, 1, VE},
{ "mixed-refs", "One reference per partition, as opposed to one reference per macroblock", OFFSET(mixed_refs), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 1, VE },
{ "fast-pskip", NULL, OFFSET(fast_pskip), AV_OPT_TYPE_INT, {.i64 = -1 }, -1, 1, VE},
{ "motion-est", "Set motion estimation method", OFFSET(motion_est), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, XAVS_ME_TESA, VE, "motion-est"},
{ "dia", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = XAVS_ME_DIA }, INT_MIN, INT_MAX, VE, "motion-est" },
{ "hex", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = XAVS_ME_HEX }, INT_MIN, INT_MAX, VE, "motion-est" },
{ "umh", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = XAVS_ME_UMH }, INT_MIN, INT_MAX, VE, "motion-est" },
{ "esa", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = XAVS_ME_ESA }, INT_MIN, INT_MAX, VE, "motion-est" },
{ "tesa", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = XAVS_ME_TESA }, INT_MIN, INT_MAX, VE, "motion-est" },
{ NULL },
};

View File

@ -77,6 +77,7 @@ struct xvid_context {
int ssim; /**< SSIM information display mode */
int ssim_acc; /**< SSIM accuracy. 0: accurate. 4: fast. */
int gmc;
int me_quality; /**< Motion estimation quality. 0: fast 6: best. */
};
/**
@ -392,26 +393,45 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx)
/* Decide which ME quality setting to use */
x->me_flags = 0;
switch (avctx->me_method) {
case ME_FULL: /* Quality 6 */
switch (x->me_quality) {
case 6:
case 5:
x->me_flags |= XVID_ME_EXTSEARCH16 |
XVID_ME_EXTSEARCH8;
case ME_EPZS: /* Quality 4 */
case 4:
case 3:
x->me_flags |= XVID_ME_ADVANCEDDIAMOND8 |
XVID_ME_HALFPELREFINE8 |
XVID_ME_CHROMA_PVOP |
XVID_ME_CHROMA_BVOP;
case ME_LOG: /* Quality 2 */
case ME_PHODS:
case ME_X1:
case 2:
case 1:
x->me_flags |= XVID_ME_ADVANCEDDIAMOND16 |
XVID_ME_HALFPELREFINE16;
case ME_ZERO: /* Quality 0 */
default:
#if FF_API_MOTION_EST
FF_DISABLE_DEPRECATION_WARNINGS
break;
default:
switch (avctx->me_method) {
case ME_FULL: /* Quality 6 */
x->me_flags |= XVID_ME_EXTSEARCH16 |
XVID_ME_EXTSEARCH8;
case ME_EPZS: /* Quality 4 */
x->me_flags |= XVID_ME_ADVANCEDDIAMOND8 |
XVID_ME_HALFPELREFINE8 |
XVID_ME_CHROMA_PVOP |
XVID_ME_CHROMA_BVOP;
case ME_LOG: /* Quality 2 */
case ME_PHODS:
case ME_X1:
x->me_flags |= XVID_ME_ADVANCEDDIAMOND16 |
XVID_ME_HALFPELREFINE16;
case ME_ZERO: /* Quality 0 */
default:
break;
}
FF_ENABLE_DEPRECATION_WARNINGS
#endif
}
/* Decide how we should decide blocks */
@ -863,6 +883,7 @@ static const AVOption options[] = {
{ "frame", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 2 }, INT_MIN, INT_MAX, VE, "ssim" },
{ "ssim_acc", "SSIM accuracy", OFFSET(ssim_acc), AV_OPT_TYPE_INT, { .i64 = 2 }, 0, 4, VE },
{ "gmc", "use GMC", OFFSET(gmc), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },
{ "me_quality", "Motion estimation quality", OFFSET(me_quality), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 6, VE },
{ NULL },
};

View File

@ -312,11 +312,26 @@ int ff_init_me(MpegEncContext *s){
av_log(s->avctx, AV_LOG_ERROR, "ME_MAP size is too small for SAB diamond\n");
return -1;
}
#if FF_API_MOTION_EST
//special case of snow is needed because snow uses its own iterative ME code
if(s->me_method!=ME_ZERO && s->me_method!=ME_EPZS && s->me_method!=ME_X1 && s->avctx->codec_id != AV_CODEC_ID_SNOW){
av_log(s->avctx, AV_LOG_ERROR, "me_method is only allowed to be set to zero and epzs; for hex,umh,full and others see dia_size\n");
return -1;
FF_DISABLE_DEPRECATION_WARNINGS
if (s->motion_est == FF_ME_EPZS) {
if (s->me_method == ME_ZERO)
s->motion_est = FF_ME_ZERO;
else if (s->me_method == ME_EPZS)
s->motion_est = FF_ME_EPZS;
else if (s->me_method == ME_X1)
s->motion_est = FF_ME_XONE;
else if (s->avctx->codec_id != AV_CODEC_ID_SNOW) {
av_log(s->avctx, AV_LOG_ERROR,
"me_method is only allowed to be set to zero and epzs; "
"for hex,umh,full and others see dia_size\n");
return -1;
}
}
FF_ENABLE_DEPRECATION_WARNINGS
#endif
c->avctx= s->avctx;
@ -891,7 +906,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s,
{
MotionEstContext * const c= &s->me;
uint8_t *pix, *ppix;
int sum, mx, my, dmin;
int sum, mx = 0, my = 0, dmin = 0;
int varc; ///< the variance of the block (sum of squared (p[y][x]-average))
int vard; ///< sum of squared differences with the estimated motion vector
int P[10][2];
@ -923,52 +938,43 @@ void ff_estimate_p_frame_motion(MpegEncContext * s,
pic->mb_var [s->mb_stride * mb_y + mb_x] = (varc+128)>>8;
c->mb_var_sum_temp += (varc+128)>>8;
switch(s->me_method) {
case ME_ZERO:
default:
mx = 0;
my = 0;
dmin = 0;
break;
case ME_X1:
case ME_EPZS:
{
const int mot_stride = s->b8_stride;
const int mot_xy = s->block_index[0];
if (s->motion_est != FF_ME_ZERO) {
const int mot_stride = s->b8_stride;
const int mot_xy = s->block_index[0];
P_LEFT[0] = s->current_picture.motion_val[0][mot_xy - 1][0];
P_LEFT[1] = s->current_picture.motion_val[0][mot_xy - 1][1];
P_LEFT[0] = s->current_picture.motion_val[0][mot_xy - 1][0];
P_LEFT[1] = s->current_picture.motion_val[0][mot_xy - 1][1];
if(P_LEFT[0] > (c->xmax<<shift)) P_LEFT[0] = (c->xmax<<shift);
if (P_LEFT[0] > (c->xmax << shift))
P_LEFT[0] = c->xmax << shift;
if(!s->first_slice_line) {
P_TOP[0] = s->current_picture.motion_val[0][mot_xy - mot_stride ][0];
P_TOP[1] = s->current_picture.motion_val[0][mot_xy - mot_stride ][1];
P_TOPRIGHT[0] = s->current_picture.motion_val[0][mot_xy - mot_stride + 2][0];
P_TOPRIGHT[1] = s->current_picture.motion_val[0][mot_xy - mot_stride + 2][1];
if(P_TOP[1] > (c->ymax<<shift)) P_TOP[1] = (c->ymax<<shift);
if(P_TOPRIGHT[0] < (c->xmin<<shift)) P_TOPRIGHT[0]= (c->xmin<<shift);
if(P_TOPRIGHT[1] > (c->ymax<<shift)) P_TOPRIGHT[1]= (c->ymax<<shift);
if (!s->first_slice_line) {
P_TOP[0] = s->current_picture.motion_val[0][mot_xy - mot_stride ][0];
P_TOP[1] = s->current_picture.motion_val[0][mot_xy - mot_stride ][1];
P_TOPRIGHT[0] = s->current_picture.motion_val[0][mot_xy - mot_stride + 2][0];
P_TOPRIGHT[1] = s->current_picture.motion_val[0][mot_xy - mot_stride + 2][1];
if (P_TOP[1] > (c->ymax << shift))
P_TOP[1] = c->ymax << shift;
if (P_TOPRIGHT[0] < (c->xmin << shift))
P_TOPRIGHT[0] = c->xmin << shift;
if (P_TOPRIGHT[1] > (c->ymax << shift))
P_TOPRIGHT[1] = c->ymax << shift;
P_MEDIAN[0]= mid_pred(P_LEFT[0], P_TOP[0], P_TOPRIGHT[0]);
P_MEDIAN[1]= mid_pred(P_LEFT[1], P_TOP[1], P_TOPRIGHT[1]);
P_MEDIAN[0] = mid_pred(P_LEFT[0], P_TOP[0], P_TOPRIGHT[0]);
P_MEDIAN[1] = mid_pred(P_LEFT[1], P_TOP[1], P_TOPRIGHT[1]);
if(s->out_format == FMT_H263){
c->pred_x = P_MEDIAN[0];
c->pred_y = P_MEDIAN[1];
}else { /* mpeg1 at least */
c->pred_x= P_LEFT[0];
c->pred_y= P_LEFT[1];
}
}else{
c->pred_x= P_LEFT[0];
c->pred_y= P_LEFT[1];
if (s->out_format == FMT_H263) {
c->pred_x = P_MEDIAN[0];
c->pred_y = P_MEDIAN[1];
} else { /* mpeg1 at least */
c->pred_x = P_LEFT[0];
c->pred_y = P_LEFT[1];
}
} else {
c->pred_x = P_LEFT[0];
c->pred_y = P_LEFT[1];
}
dmin = ff_epzs_motion_search(s, &mx, &my, P, 0, 0, s->p_mv_table, (1<<16)>>shift, 0, 16);
break;
}
/* At this point (mx,my) are full-pell and the relative displacement */
@ -1128,7 +1134,7 @@ static int estimate_motion_b(MpegEncContext *s, int mb_x, int mb_y,
int16_t (*mv_table)[2], int ref_index, int f_code)
{
MotionEstContext * const c= &s->me;
int mx, my, dmin;
int mx = 0, my = 0, dmin = 0;
int P[10][2];
const int shift= 1+s->quarter_sample;
const int mot_stride = s->mb_stride;
@ -1143,15 +1149,7 @@ static int estimate_motion_b(MpegEncContext *s, int mb_x, int mb_y,
get_limits(s, 16*mb_x, 16*mb_y);
switch(s->me_method) {
case ME_ZERO:
default:
mx = 0;
my = 0;
dmin = 0;
break;
case ME_X1:
case ME_EPZS:
if (s->motion_est != FF_ME_ZERO) {
P_LEFT[0] = mv_table[mot_xy - 1][0];
P_LEFT[1] = mv_table[mot_xy - 1][1];
@ -1180,8 +1178,6 @@ static int estimate_motion_b(MpegEncContext *s, int mb_x, int mb_y,
}
dmin = ff_epzs_motion_search(s, &mx, &my, P, 0, ref_index, s->p_mv_table, mv_scale, 0, 16);
break;
}
dmin= c->sub_motion_search(s, &mx, &my, dmin, 0, ref_index, 0, 16);
@ -1620,7 +1616,7 @@ void ff_estimate_b_frame_motion(MpegEncContext * s,
/* find best f_code for ME which do unlimited searches */
int ff_get_best_fcode(MpegEncContext * s, int16_t (*mv_table)[2], int type)
{
if(s->me_method>=ME_EPZS){
if (s->motion_est != FF_ME_ZERO) {
int score[8];
int i, y, range= s->avctx->me_range ? s->avctx->me_range : (INT_MAX/2);
uint8_t * fcode_tab= s->fcode_tab;

View File

@ -31,6 +31,10 @@ struct MpegEncContext;
#define MAX_MV 4096
#define FF_ME_ZERO 0
#define FF_ME_EPZS 1
#define FF_ME_XONE 2
/**
* Motion estimation context.
*/

View File

@ -262,7 +262,10 @@ typedef struct MpegEncContext {
int16_t (*b_field_mv_table[2][2][2])[2];///< MV table (4MV per MB) interlaced b-frame encoding
uint8_t (*p_field_select_table[2]);
uint8_t (*b_field_select_table[2][2]);
#if FF_API_MOTION_EST
int me_method; ///< ME algorithm
#endif
int motion_est; ///< ME algorithm
int mv_dir;
#define MV_DIR_FORWARD 1
#define MV_DIR_BACKWARD 2
@ -598,6 +601,10 @@ typedef struct MpegEncContext {
{"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 }, \
{"rc_strategy", "ratecontrol method", FF_MPV_OFFSET(rc_strategy), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 1, FF_MPV_OPT_FLAGS }, \
{"motion_est", "motion estimation algorithm", FF_MPV_OFFSET(motion_est), AV_OPT_TYPE_INT, {.i64 = FF_ME_EPZS }, FF_ME_ZERO, FF_ME_XONE, FF_MPV_OPT_FLAGS, "motion_est" }, \
{ "zero", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FF_ME_ZERO }, 0, 0, FF_MPV_OPT_FLAGS, "motion_est" }, \
{ "epzs", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FF_ME_EPZS }, 0, 0, FF_MPV_OPT_FLAGS, "motion_est" }, \
{ "xone", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FF_ME_XONE }, 0, 0, FF_MPV_OPT_FLAGS, "motion_est" }, \
extern const AVOption ff_mpv_generic_options[];

View File

@ -370,7 +370,11 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
s->intra_only = 0;
}
#if FF_API_MOTION_EST
FF_DISABLE_DEPRECATION_WARNINGS
s->me_method = avctx->me_method;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
/* Fixed QSCALE */
s->fixed_qscale = !!(avctx->flags & CODEC_FLAG_QSCALE);

View File

@ -90,6 +90,7 @@ static const AVOption avcodec_options[] = {
{"showall", "Show all frames before the first keyframe", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG2_SHOW_ALL }, INT_MIN, INT_MAX, V|D, "flags2"},
{"export_mvs", "export motion vectors through frame side data", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG2_EXPORT_MVS}, INT_MIN, INT_MAX, V|D, "flags2"},
{"skip_manual", "do not skip samples and export skip information as frame side data", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG2_SKIP_MANUAL}, INT_MIN, INT_MAX, V|D, "flags2"},
#if FF_API_MOTION_EST
{"me_method", "set motion estimation method", OFFSET(me_method), AV_OPT_TYPE_INT, {.i64 = ME_EPZS }, INT_MIN, INT_MAX, V|E, "me_method"},
{"zero", "zero motion estimation (fastest)", 0, AV_OPT_TYPE_CONST, {.i64 = ME_ZERO }, INT_MIN, INT_MAX, V|E, "me_method" },
{"full", "full motion estimation (slowest)", 0, AV_OPT_TYPE_CONST, {.i64 = ME_FULL }, INT_MIN, INT_MAX, V|E, "me_method" },
@ -103,6 +104,7 @@ static const AVOption avcodec_options[] = {
{"hex", "hex motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_HEX }, INT_MIN, INT_MAX, V|E, "me_method" },
{"umh", "umh motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_UMH }, INT_MIN, INT_MAX, V|E, "me_method" },
{"iter", "iter motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_ITER }, INT_MIN, INT_MAX, V|E, "me_method" },
#endif
{"time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, {.dbl = 0}, INT_MIN, INT_MAX},
{"g", "set the group of picture (GOP) size", OFFSET(gop_size), AV_OPT_TYPE_INT, {.i64 = 12 }, INT_MIN, INT_MAX, V|E},
{"ar", "set audio sampling rate (in Hz)", OFFSET(sample_rate), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, A|D|E},

View File

@ -280,7 +280,20 @@ static int svq1_encode_plane(SVQ1EncContext *s, int plane,
s->m.b8_stride = 2 * s->m.mb_width + 1;
s->m.f_code = 1;
s->m.pict_type = s->pict_type;
#if FF_API_MOTION_EST
FF_DISABLE_DEPRECATION_WARNINGS
s->m.me_method = s->avctx->me_method;
if (s->motion_est == FF_ME_EPZS) {
if (s->avctx->me_method == ME_ZERO)
s->motion_est = FF_ME_ZERO;
else if (s->avctx->me_method == ME_EPZS)
s->motion_est = FF_ME_EPZS;
else if (s->avctx->me_method == ME_X1)
s->motion_est = FF_ME_XONE;
}
FF_ENABLE_DEPRECATION_WARNINGS
#endif
s->m.motion_est = s->motion_est;
s->m.me.scene_change_score = 0;
// s->m.out_format = FMT_H263;
// s->m.unrestricted_mv = 1;
@ -652,12 +665,31 @@ FF_ENABLE_DEPRECATION_WARNINGS
return 0;
}
#define OFFSET(x) offsetof(struct SVQ1EncContext, x)
#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
static const AVOption options[] = {
{ "motion-est", "Motion estimation algorithm", OFFSET(motion_est), AV_OPT_TYPE_INT, { .i64 = FF_ME_EPZS }, FF_ME_ZERO, FF_ME_XONE, VE, "motion-est"},
{ "zero", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FF_ME_ZERO }, 0, 0, FF_MPV_OPT_FLAGS, "motion-est" },
{ "epzs", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FF_ME_EPZS }, 0, 0, FF_MPV_OPT_FLAGS, "motion-est" },
{ "xone", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FF_ME_XONE }, 0, 0, FF_MPV_OPT_FLAGS, "motion-est" },
{ NULL },
};
static const AVClass svq1enc_class = {
.class_name = "svq1enc",
.item_name = av_default_item_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
};
AVCodec ff_svq1_encoder = {
.name = "svq1",
.long_name = NULL_IF_CONFIG_SMALL("Sorenson Vector Quantizer 1 / Sorenson Video 1 / SVQ1"),
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_SVQ1,
.priv_data_size = sizeof(SVQ1EncContext),
.priv_class = &svq1enc_class,
.init = svq1_encode_init,
.encode2 = svq1_encode_frame,
.close = svq1_encode_end,

View File

@ -74,6 +74,8 @@ typedef struct SVQ1EncContext {
uint8_t *scratchbuf;
int motion_est;
int (*ssd_int8_vs_int16)(const int8_t *pix1, const int16_t *pix2,
intptr_t size);
} SVQ1EncContext;

View File

@ -30,7 +30,7 @@
#define LIBAVCODEC_VERSION_MAJOR 56
#define LIBAVCODEC_VERSION_MINOR 55
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_MICRO 101
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
@ -199,5 +199,8 @@
#ifndef FF_API_CODED_FRAME
#define FF_API_CODED_FRAME (LIBAVCODEC_VERSION_MAJOR < 59)
#endif
#ifndef FF_API_MOTION_EST
#define FF_API_MOTION_EST (LIBAVCODEC_VERSION_MAJOR < 59)
#endif
#endif /* AVCODEC_VERSION_H */

View File

@ -227,6 +227,7 @@ AVCodec ff_wmv2_encoder = {
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_WMV2,
.priv_data_size = sizeof(Wmv2Context),
.priv_class = &wmv2_class,
.init = wmv2_encode_init,
.encode2 = ff_mpv_encode_picture,
.close = ff_mpv_encode_end,