if (CONFIG_H263_ENCODER && s->out_format == FMT_H263)
ff_h263_encode_init(s);
if (CONFIG_MSMPEG4_ENCODER && s->msmpeg4_version)
- ff_msmpeg4_encode_init(s);
+ if ((ret = ff_msmpeg4_encode_init(s)) < 0)
+ return ret;
if ((CONFIG_MPEG1VIDEO_ENCODER || CONFIG_MPEG2VIDEO_ENCODER)
&& s->out_format == FMT_MPEG1)
ff_mpeg1_encode_init(s);
pic_arg->linesize[1] != s->uvlinesize ||
pic_arg->linesize[2] != s->uvlinesize)
direct = 0;
+ if ((s->width & 15) || (s->height & 15))
+ direct = 0;
- av_dlog(s->avctx, "%d %d %td %td\n", pic_arg->linesize[0],
+ ff_dlog(s->avctx, "%d %d %td %td\n", pic_arg->linesize[0],
pic_arg->linesize[1], s->linesize, s->uvlinesize);
i = ff_find_unused_picture(s, direct);
if (direct) {
if ((ret = av_frame_ref(pic->f, pic_arg)) < 0)
return ret;
- if (ff_alloc_picture(s, pic, 1) < 0) {
- return -1;
- }
- } else {
- if (ff_alloc_picture(s, pic, 0) < 0) {
- return -1;
- }
+ }
+ ret = ff_alloc_picture(s, pic, direct);
+ if (ret < 0)
+ return ret;
+ if (!direct) {
if (pic->f->data[0] + INPLACE_OFFSET == pic_arg->data[0] &&
pic->f->data[1] + INPLACE_OFFSET == pic_arg->data[1] &&
pic->f->data[2] + INPLACE_OFFSET == pic_arg->data[2]) {
if (src_stride == dst_stride)
memcpy(dst, src, src_stride * h);
else {
- while (h--) {
- memcpy(dst, src, w);
- dst += dst_stride;
+ int h2 = h;
+ uint8_t *dst2 = dst;
+ while (h2--) {
+ memcpy(dst2, src, w);
+ dst2 += dst_stride;
src += src_stride;
}
}
+ if ((s->width & 15) || (s->height & 15)) {
+ s->mpvencdsp.draw_edges(dst, dst_stride,
+ w, h,
+ 16 >> h_shift,
+ 16 >> v_shift,
+ EDGE_BOTTOM);
+ }
}
}
}
int64_t best_rd = INT64_MAX;
int best_b_count = -1;
+ if (!c)
+ return AVERROR(ENOMEM);
assert(scale >= 0 && scale <= 3);
//emms_c();
int mb_x, mb_y, pdif = 0;
int chr_h= 16>>s->chroma_y_shift;
int i, j;
- MpegEncContext best_s, backup_s;
+ MpegEncContext best_s = { 0 }, backup_s;
uint8_t bit_buf[2][MAX_MB_BYTES];
uint8_t bit_buf2[2][MAX_MB_BYTES];
uint8_t bit_buf_tex[2][MAX_MB_BYTES];
if(CONFIG_H263_ENCODER && s->out_format == FMT_H263)
ff_h263_loop_filter(s);
}
- av_dlog(s->avctx, "MB %d %d bits\n",
+ ff_dlog(s->avctx, "MB %d %d bits\n",
s->mb_x + s->mb_y * s->mb_stride, put_bits_count(&s->pb));
}
}
s->pict_type= AV_PICTURE_TYPE_I;
for(i=0; i<s->mb_stride*s->mb_height; i++)
s->mb_type[i]= CANDIDATE_MB_TYPE_INTRA;
- av_dlog(s, "Scene change detected, encoding as I Frame %d %d\n",
+ ff_dlog(s, "Scene change detected, encoding as I Frame %d %d\n",
s->current_picture.mb_var_sum, s->current_picture.mc_mb_var_sum);
}
ff_msmpeg4_encode_picture_header(s, picture_number);
else if (CONFIG_MPEG4_ENCODER && s->h263_pred)
ff_mpeg4_encode_picture_header(s, picture_number);
- else if (CONFIG_RV10_ENCODER && s->codec_id == AV_CODEC_ID_RV10)
- ff_rv10_encode_picture_header(s, picture_number);
+ else if (CONFIG_RV10_ENCODER && s->codec_id == AV_CODEC_ID_RV10) {
+ ret = ff_rv10_encode_picture_header(s, picture_number);
+ if (ret < 0)
+ return ret;
+ }
else if (CONFIG_RV20_ENCODER && s->codec_id == AV_CODEC_ID_RV20)
ff_rv20_encode_picture_header(s, picture_number);
else if (CONFIG_FLV_ENCODER && s->codec_id == AV_CODEC_ID_FLV1)