- if(s->picture.pict_type == AV_PICTURE_TYPE_P){
- s->m.avctx= s->avctx;
- s->m.current_picture_ptr= &s->m.current_picture;
- s->m.last_picture_ptr = &s->m.last_picture;
- s->m.last_picture.f.data[0] = ref_plane;
- s->m.linesize=
- s->m.last_picture.f.linesize[0] =
- s->m.new_picture.f.linesize[0] =
- s->m.current_picture.f.linesize[0] = stride;
- s->m.width= width;
- s->m.height= height;
- s->m.mb_width= block_width;
- s->m.mb_height= block_height;
- s->m.mb_stride= s->m.mb_width+1;
- s->m.b8_stride= 2*s->m.mb_width+1;
- s->m.f_code=1;
- s->m.pict_type= s->picture.pict_type;
- s->m.me_method= s->avctx->me_method;
- s->m.me.scene_change_score=0;
- s->m.flags= s->avctx->flags;
-// s->m.out_format = FMT_H263;
-// s->m.unrestricted_mv= 1;
-
- s->m.lambda= s->picture.quality;
- s->m.qscale= (s->m.lambda*139 + FF_LAMBDA_SCALE*64) >> (FF_LAMBDA_SHIFT + 7);
- s->m.lambda2= (s->m.lambda*s->m.lambda + FF_LAMBDA_SCALE/2) >> FF_LAMBDA_SHIFT;
-
- if(!s->motion_val8[plane]){
- s->motion_val8 [plane]= av_mallocz((s->m.b8_stride*block_height*2 + 2)*2*sizeof(int16_t));
- s->motion_val16[plane]= av_mallocz((s->m.mb_stride*(block_height + 2) + 1)*2*sizeof(int16_t));
+ if (s->pict_type == AV_PICTURE_TYPE_P) {
+ s->m.avctx = s->avctx;
+ s->m.current_picture_ptr = &s->m.current_picture;
+ s->m.last_picture_ptr = &s->m.last_picture;
+ s->m.last_picture.f->data[0] = ref_plane;
+ s->m.linesize =
+ s->m.last_picture.f->linesize[0] =
+ s->m.new_picture.f->linesize[0] =
+ s->m.current_picture.f->linesize[0] = stride;
+ s->m.width = width;
+ s->m.height = height;
+ s->m.mb_width = block_width;
+ s->m.mb_height = block_height;
+ s->m.mb_stride = s->m.mb_width + 1;
+ 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;
+ s->m.lambda = s->quality;
+ s->m.qscale = s->m.lambda * 139 +
+ FF_LAMBDA_SCALE * 64 >>
+ FF_LAMBDA_SHIFT + 7;
+ s->m.lambda2 = s->m.lambda * s->m.lambda +
+ FF_LAMBDA_SCALE / 2 >>
+ FF_LAMBDA_SHIFT;
+
+ if (!s->motion_val8[plane]) {
+ s->motion_val8[plane] = av_mallocz((s->m.b8_stride *
+ block_height * 2 + 2) *
+ 2 * sizeof(int16_t));
+ s->motion_val16[plane] = av_mallocz((s->m.mb_stride *
+ (block_height + 2) + 1) *
+ 2 * sizeof(int16_t));
+ if (!s->motion_val8[plane] || !s->motion_val16[plane])
+ return AVERROR(ENOMEM);