From 1aa24df74c052a73175c43e57d35b4835e537ec8 Mon Sep 17 00:00:00 2001 From: Vittorio Giovara Date: Mon, 28 Sep 2015 11:40:09 +0200 Subject: lavu: Deprecate AVFrame.error[] These field are difficult to interpret, and are provided by a single encoder (mpegvideoenc). In general they do not belong to a structure containing raw data only, so remove them from AVFrame. Mpegvideoenc now uses a private field in Picture for its internal computations. Signed-off-by: Vittorio Giovara --- libavcodec/mpegvideo_enc.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'libavcodec/mpegvideo_enc.c') diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 862d07f978..e5ff3ed70e 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1482,6 +1482,12 @@ FF_DISABLE_DEPRECATION_WARNINGS av_frame_copy_props(s->avctx->coded_frame, s->current_picture.f); FF_ENABLE_DEPRECATION_WARNINGS #endif +#if FF_API_ERROR_FRAME +FF_DISABLE_DEPRECATION_WARNINGS + memcpy(s->current_picture.f->error, s->current_picture.encoding_error, + sizeof(s->current_picture.encoding_error)); +FF_ENABLE_DEPRECATION_WARNINGS +#endif } static void update_noise_reduction(MpegEncContext *s) @@ -1688,8 +1694,8 @@ vbv_retry: ff_write_pass1_stats(s); for (i = 0; i < 4; i++) { - s->current_picture_ptr->f->error[i] = s->current_picture.f->error[i]; - avctx->error[i] += s->current_picture_ptr->f->error[i]; + s->current_picture_ptr->encoding_error[i] = s->current_picture.encoding_error[i]; + avctx->error[i] += s->current_picture_ptr->encoding_error[i]; } if (s->avctx->flags & AV_CODEC_FLAG_PASS1) @@ -2590,7 +2596,7 @@ static int encode_thread(AVCodecContext *c, void *arg){ /* note: quant matrix value (8) is implied here */ s->last_dc[i] = 128 << s->intra_dc_precision; - s->current_picture.f->error[i] = 0; + s->current_picture.encoding_error[i] = 0; } s->mb_skip_run = 0; memset(s->last_mv, 0, sizeof(s->last_mv)); @@ -3148,13 +3154,13 @@ static int encode_thread(AVCodecContext *c, void *arg){ if(s->mb_x*16 + 16 > s->width ) w= s->width - s->mb_x*16; if(s->mb_y*16 + 16 > s->height) h= s->height- s->mb_y*16; - s->current_picture.f->error[0] += sse( + s->current_picture.encoding_error[0] += sse( s, s->new_picture.f->data[0] + s->mb_x*16 + s->mb_y*s->linesize*16, s->dest[0], w, h, s->linesize); - s->current_picture.f->error[1] += sse( + s->current_picture.encoding_error[1] += sse( s, s->new_picture.f->data[1] + s->mb_x*8 + s->mb_y*s->uvlinesize*chr_h, s->dest[1], w>>1, h>>s->chroma_y_shift, s->uvlinesize); - s->current_picture.f->error[2] += sse( + s->current_picture.encoding_error[2] += sse( s, s->new_picture.f->data[2] + s->mb_x*8 + s->mb_y*s->uvlinesize*chr_h, s->dest[2], w>>1, h>>s->chroma_y_shift, s->uvlinesize); } @@ -3207,9 +3213,9 @@ static void merge_context_after_encode(MpegEncContext *dst, MpegEncContext *src) MERGE(misc_bits); MERGE(er.error_count); MERGE(padding_bug_score); - MERGE(current_picture.f->error[0]); - MERGE(current_picture.f->error[1]); - MERGE(current_picture.f->error[2]); + MERGE(current_picture.encoding_error[0]); + MERGE(current_picture.encoding_error[1]); + MERGE(current_picture.encoding_error[2]); if(dst->avctx->noise_reduction){ for(i=0; i<64; i++){ -- cgit v1.2.3