diff options
author | wm4 <nfxjfg@googlemail.com> | 2014-03-31 21:46:29 +0400 |
---|---|---|
committer | Vittorio Giovara <vittorio.giovara@gmail.com> | 2014-04-09 04:12:19 +0400 |
commit | f6774f905fb3cfdc319523ac640be30b14c1bc55 (patch) | |
tree | 6f0db53a2febce58c562d383e1f3f61c9c256275 /libavcodec/mpegvideo_enc.c | |
parent | 60fd7d36c47d62d4c603bf16c213b1a924f5cfcf (diff) |
mpegvideo: operate with pointers to AVFrames instead of whole structs
The most interesting parts are initialization in ff_MPV_common_init() and
uninitialization in ff_MPV_common_end().
ff_mpeg_unref_picture and ff_thread_release_buffer have additional NULL
checks for Picture.f, because these functions can be called on
uninitialized or partially initialized Pictures.
NULL pointer checks are added to ff_thread_release_buffer() stub function.
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Diffstat (limited to 'libavcodec/mpegvideo_enc.c')
-rw-r--r-- | libavcodec/mpegvideo_enc.c | 200 |
1 files changed, 100 insertions, 100 deletions
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index ec49db76ac..4e72a25391 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -687,7 +687,7 @@ av_cold int ff_MPV_encode_init(AVCodecContext *avctx) if (ARCH_X86) ff_MPV_encode_init_x86(s); - s->avctx->coded_frame = &s->current_picture.f; + s->avctx->coded_frame = s->current_picture.f; if (s->msmpeg4_version) { FF_ALLOCZ_OR_GOTO(s->avctx, s->ac_stats, @@ -937,7 +937,7 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg) pic = &s->picture[i]; pic->reference = 3; - if ((ret = av_frame_ref(&pic->f, pic_arg)) < 0) + if ((ret = av_frame_ref(pic->f, pic_arg)) < 0) return ret; if (ff_alloc_picture(s, pic, 1) < 0) { return -1; @@ -954,9 +954,9 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg) return -1; } - 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 (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]) { // empty } else { int h_chroma_shift, v_chroma_shift; @@ -972,7 +972,7 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg) int w = s->width >> h_shift; int h = s->height >> v_shift; uint8_t *src = pic_arg->data[i]; - uint8_t *dst = pic->f.data[i]; + uint8_t *dst = pic->f->data[i]; if (!s->avctx->rc_buffer_size) dst += INPLACE_OFFSET; @@ -989,12 +989,12 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg) } } } - ret = av_frame_copy_props(&pic->f, pic_arg); + ret = av_frame_copy_props(pic->f, pic_arg); if (ret < 0) return ret; - pic->f.display_picture_number = display_picture_number; - pic->f.pts = pts; // we set this here to avoid modifiying pic_arg + pic->f->display_picture_number = display_picture_number; + pic->f->pts = pts; // we set this here to avoid modifiying pic_arg } /* shift buffer entries */ @@ -1013,13 +1013,13 @@ static int skip_check(MpegEncContext *s, Picture *p, Picture *ref) int64_t score64 = 0; for (plane = 0; plane < 3; plane++) { - const int stride = p->f.linesize[plane]; + const int stride = p->f->linesize[plane]; const int bw = plane ? 1 : 2; for (y = 0; y < s->mb_height * bw; y++) { for (x = 0; x < s->mb_width * bw; x++) { int off = p->shared ? 0 : 16; - uint8_t *dptr = p->f.data[plane] + 8 * (x + y * stride) + off; - uint8_t *rptr = ref->f.data[plane] + 8 * (x + y * stride); + uint8_t *dptr = p->f->data[plane] + 8 * (x + y * stride) + off; + uint8_t *rptr = ref->f->data[plane] + 8 * (x + y * stride); int v = s->dsp.frame_skip_cmp[1](s, dptr, rptr, stride, 8); switch (s->avctx->frame_skip_exp) { @@ -1103,19 +1103,19 @@ static int estimate_best_b_count(MpegEncContext *s) pre_input = *pre_input_ptr; if (!pre_input.shared && i) { - pre_input.f.data[0] += INPLACE_OFFSET; - pre_input.f.data[1] += INPLACE_OFFSET; - pre_input.f.data[2] += INPLACE_OFFSET; + pre_input.f->data[0] += INPLACE_OFFSET; + pre_input.f->data[1] += INPLACE_OFFSET; + pre_input.f->data[2] += INPLACE_OFFSET; } s->dsp.shrink[scale](s->tmp_frames[i]->data[0], s->tmp_frames[i]->linesize[0], - pre_input.f.data[0], pre_input.f.linesize[0], + pre_input.f->data[0], pre_input.f->linesize[0], c->width, c->height); s->dsp.shrink[scale](s->tmp_frames[i]->data[1], s->tmp_frames[i]->linesize[1], - pre_input.f.data[1], pre_input.f.linesize[1], + pre_input.f->data[1], pre_input.f->linesize[1], c->width >> 1, c->height >> 1); s->dsp.shrink[scale](s->tmp_frames[i]->data[2], s->tmp_frames[i]->linesize[2], - pre_input.f.data[2], pre_input.f.linesize[2], + pre_input.f->data[2], pre_input.f->linesize[2], c->width >> 1, c->height >> 1); } } @@ -1180,8 +1180,8 @@ static int select_input_picture(MpegEncContext *s) if (/*s->picture_in_gop_number >= s->gop_size ||*/ s->next_picture_ptr == NULL || s->intra_only) { s->reordered_input_picture[0] = s->input_picture[0]; - s->reordered_input_picture[0]->f.pict_type = AV_PICTURE_TYPE_I; - s->reordered_input_picture[0]->f.coded_picture_number = + s->reordered_input_picture[0]->f->pict_type = AV_PICTURE_TYPE_I; + s->reordered_input_picture[0]->f->coded_picture_number = s->coded_picture_number++; } else { int b_frames; @@ -1190,7 +1190,7 @@ static int select_input_picture(MpegEncContext *s) if (s->picture_in_gop_number < s->gop_size && skip_check(s, s->input_picture[0], s->next_picture_ptr)) { // FIXME check that te gop check above is +-1 correct - av_frame_unref(&s->input_picture[0]->f); + av_frame_unref(s->input_picture[0]->f); emms_c(); ff_vbv_update(s, 0); @@ -1201,7 +1201,7 @@ static int select_input_picture(MpegEncContext *s) if (s->flags & CODEC_FLAG_PASS2) { for (i = 0; i < s->max_b_frames + 1; i++) { - int pict_num = s->input_picture[0]->f.display_picture_number + i; + int pict_num = s->input_picture[0]->f->display_picture_number + i; if (pict_num >= s->rc_context.num_entries) break; @@ -1210,7 +1210,7 @@ static int select_input_picture(MpegEncContext *s) break; } - s->input_picture[i]->f.pict_type = + s->input_picture[i]->f->pict_type = s->rc_context.entry[pict_num].new_pict_type; } } @@ -1225,8 +1225,8 @@ static int select_input_picture(MpegEncContext *s) s->input_picture[i]->b_frame_score == 0) { s->input_picture[i]->b_frame_score = get_intra_count(s, - s->input_picture[i ]->f.data[0], - s->input_picture[i - 1]->f.data[0], + s->input_picture[i ]->f->data[0], + s->input_picture[i - 1]->f->data[0], s->linesize) + 1; } } @@ -1253,11 +1253,11 @@ static int select_input_picture(MpegEncContext *s) emms_c(); for (i = b_frames - 1; i >= 0; i--) { - int type = s->input_picture[i]->f.pict_type; + int type = s->input_picture[i]->f->pict_type; if (type && type != AV_PICTURE_TYPE_B) b_frames = i; } - if (s->input_picture[b_frames]->f.pict_type == AV_PICTURE_TYPE_B && + if (s->input_picture[b_frames]->f->pict_type == AV_PICTURE_TYPE_B && b_frames == s->max_b_frames) { av_log(s->avctx, AV_LOG_ERROR, "warning, too many b frames in a row\n"); @@ -1270,24 +1270,24 @@ static int select_input_picture(MpegEncContext *s) } else { if (s->flags & CODEC_FLAG_CLOSED_GOP) b_frames = 0; - s->input_picture[b_frames]->f.pict_type = AV_PICTURE_TYPE_I; + s->input_picture[b_frames]->f->pict_type = AV_PICTURE_TYPE_I; } } if ((s->flags & CODEC_FLAG_CLOSED_GOP) && b_frames && - s->input_picture[b_frames]->f.pict_type == AV_PICTURE_TYPE_I) + s->input_picture[b_frames]->f->pict_type == AV_PICTURE_TYPE_I) b_frames--; s->reordered_input_picture[0] = s->input_picture[b_frames]; - if (s->reordered_input_picture[0]->f.pict_type != AV_PICTURE_TYPE_I) - s->reordered_input_picture[0]->f.pict_type = AV_PICTURE_TYPE_P; - s->reordered_input_picture[0]->f.coded_picture_number = + if (s->reordered_input_picture[0]->f->pict_type != AV_PICTURE_TYPE_I) + s->reordered_input_picture[0]->f->pict_type = AV_PICTURE_TYPE_P; + s->reordered_input_picture[0]->f->coded_picture_number = s->coded_picture_number++; for (i = 0; i < b_frames; i++) { s->reordered_input_picture[i + 1] = s->input_picture[i]; - s->reordered_input_picture[i + 1]->f.pict_type = + s->reordered_input_picture[i + 1]->f->pict_type = AV_PICTURE_TYPE_B; - s->reordered_input_picture[i + 1]->f.coded_picture_number = + s->reordered_input_picture[i + 1]->f->coded_picture_number = s->coded_picture_number++; } } @@ -1295,7 +1295,7 @@ static int select_input_picture(MpegEncContext *s) no_output_pic: if (s->reordered_input_picture[0]) { s->reordered_input_picture[0]->reference = - s->reordered_input_picture[0]->f.pict_type != + s->reordered_input_picture[0]->f->pict_type != AV_PICTURE_TYPE_B ? 3 : 0; ff_mpeg_unref_picture(s, &s->new_picture); @@ -1317,12 +1317,12 @@ no_output_pic: return -1; } - ret = av_frame_copy_props(&pic->f, &s->reordered_input_picture[0]->f); + ret = av_frame_copy_props(pic->f, s->reordered_input_picture[0]->f); if (ret < 0) return ret; /* mark us unused / free shared pic */ - av_frame_unref(&s->reordered_input_picture[0]->f); + av_frame_unref(s->reordered_input_picture[0]->f); s->reordered_input_picture[0]->shared = 0; s->current_picture_ptr = pic; @@ -1330,7 +1330,7 @@ no_output_pic: // input is not a shared pix -> reuse buffer for current_pix s->current_picture_ptr = s->reordered_input_picture[0]; for (i = 0; i < 4; i++) { - s->new_picture.f.data[i] += INPLACE_OFFSET; + s->new_picture.f->data[i] += INPLACE_OFFSET; } } ff_mpeg_unref_picture(s, &s->current_picture); @@ -1338,7 +1338,7 @@ no_output_pic: s->current_picture_ptr)) < 0) return ret; - s->picture_number = s->new_picture.f.display_picture_number; + s->picture_number = s->new_picture.f->display_picture_number; } else { ff_mpeg_unref_picture(s, &s->new_picture); } @@ -1355,15 +1355,15 @@ static void frame_end(MpegEncContext *s) const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); int hshift = desc->log2_chroma_w; int vshift = desc->log2_chroma_h; - s->dsp.draw_edges(s->current_picture.f.data[0], s->linesize, + s->dsp.draw_edges(s->current_picture.f->data[0], s->linesize, s->h_edge_pos, s->v_edge_pos, EDGE_WIDTH, EDGE_WIDTH, EDGE_TOP | EDGE_BOTTOM); - s->dsp.draw_edges(s->current_picture.f.data[1], s->uvlinesize, + s->dsp.draw_edges(s->current_picture.f->data[1], s->uvlinesize, s->h_edge_pos >> hshift, s->v_edge_pos >> vshift, EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift, EDGE_TOP | EDGE_BOTTOM); - s->dsp.draw_edges(s->current_picture.f.data[2], s->uvlinesize, + s->dsp.draw_edges(s->current_picture.f->data[2], s->uvlinesize, s->h_edge_pos >> hshift, s->v_edge_pos >> vshift, EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift, EDGE_TOP | EDGE_BOTTOM); @@ -1372,7 +1372,7 @@ static void frame_end(MpegEncContext *s) emms_c(); s->last_pict_type = s->pict_type; - s->last_lambda_for [s->pict_type] = s->current_picture_ptr->f.quality; + s->last_lambda_for [s->pict_type] = s->current_picture_ptr->f->quality; if (s->pict_type!= AV_PICTURE_TYPE_B) s->last_non_b_pict_type = s->pict_type; @@ -1384,7 +1384,7 @@ static void frame_end(MpegEncContext *s) } } - s->avctx->coded_frame = &s->current_picture_ptr->f; + s->avctx->coded_frame = s->current_picture_ptr->f; } @@ -1416,12 +1416,12 @@ static int frame_start(MpegEncContext *s) /* mark & release old frames */ if (s->pict_type != AV_PICTURE_TYPE_B && s->last_picture_ptr && s->last_picture_ptr != s->next_picture_ptr && - s->last_picture_ptr->f.buf[0]) { + s->last_picture_ptr->f->buf[0]) { ff_mpeg_unref_picture(s, s->last_picture_ptr); } - s->current_picture_ptr->f.pict_type = s->pict_type; - s->current_picture_ptr->f.key_frame = s->pict_type == AV_PICTURE_TYPE_I; + s->current_picture_ptr->f->pict_type = s->pict_type; + s->current_picture_ptr->f->key_frame = s->pict_type == AV_PICTURE_TYPE_I; ff_mpeg_unref_picture(s, &s->current_picture); if ((ret = ff_mpeg_ref_picture(s, &s->current_picture, @@ -1436,14 +1436,14 @@ static int frame_start(MpegEncContext *s) if (s->last_picture_ptr) { ff_mpeg_unref_picture(s, &s->last_picture); - if (s->last_picture_ptr->f.buf[0] && + if (s->last_picture_ptr->f->buf[0] && (ret = ff_mpeg_ref_picture(s, &s->last_picture, s->last_picture_ptr)) < 0) return ret; } if (s->next_picture_ptr) { ff_mpeg_unref_picture(s, &s->next_picture); - if (s->next_picture_ptr->f.buf[0] && + if (s->next_picture_ptr->f->buf[0] && (ret = ff_mpeg_ref_picture(s, &s->next_picture, s->next_picture_ptr)) < 0) return ret; @@ -1453,12 +1453,12 @@ static int frame_start(MpegEncContext *s) int i; for (i = 0; i < 4; i++) { if (s->picture_structure == PICT_BOTTOM_FIELD) { - s->current_picture.f.data[i] += - s->current_picture.f.linesize[i]; + s->current_picture.f->data[i] += + s->current_picture.f->linesize[i]; } - s->current_picture.f.linesize[i] *= 2; - s->last_picture.f.linesize[i] *= 2; - s->next_picture.f.linesize[i] *= 2; + s->current_picture.f->linesize[i] *= 2; + s->last_picture.f->linesize[i] *= 2; + s->next_picture.f->linesize[i] *= 2; } } @@ -1498,7 +1498,7 @@ int ff_MPV_encode_picture(AVCodecContext *avctx, AVPacket *pkt, } /* output? */ - if (s->new_picture.f.data[0]) { + if (s->new_picture.f->data[0]) { if (!pkt->data && (ret = ff_alloc_packet(pkt, s->mb_width*s->mb_height*MAX_MB_BYTES)) < 0) return ret; @@ -1519,7 +1519,7 @@ int ff_MPV_encode_picture(AVCodecContext *avctx, AVPacket *pkt, init_put_bits(&s->thread_context[i]->pb, start, end - start); } - s->pict_type = s->new_picture.f.pict_type; + s->pict_type = s->new_picture.f->pict_type; //emms_c(); ret = frame_start(s); if (ret < 0) @@ -1585,8 +1585,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->f->error[i] = s->current_picture.f->error[i]; + avctx->error[i] += s->current_picture_ptr->f->error[i]; } if (s->flags & CODEC_FLAG_PASS1) @@ -1663,16 +1663,16 @@ vbv_retry: s->total_bits += s->frame_bits; avctx->frame_bits = s->frame_bits; - pkt->pts = s->current_picture.f.pts; + pkt->pts = s->current_picture.f->pts; if (!s->low_delay) { - if (!s->current_picture.f.coded_picture_number) + if (!s->current_picture.f->coded_picture_number) pkt->dts = pkt->pts - s->dts_delta; else pkt->dts = s->reordered_pts; - s->reordered_pts = s->input_picture[0]->f.pts; + s->reordered_pts = s->input_picture[0]->f->pts; } else pkt->dts = pkt->pts; - if (s->current_picture.f.key_frame) + if (s->current_picture.f->key_frame) pkt->flags |= AV_PKT_FLAG_KEY; if (s->mb_info) av_packet_shrink_side_data(pkt, AV_PKT_DATA_H263_MB_INFO, s->mb_info_size); @@ -1850,11 +1850,11 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s, wrap_y = s->linesize; wrap_c = s->uvlinesize; - ptr_y = s->new_picture.f.data[0] + + ptr_y = s->new_picture.f->data[0] + (mb_y * 16 * wrap_y) + mb_x * 16; - ptr_cb = s->new_picture.f.data[1] + + ptr_cb = s->new_picture.f->data[1] + (mb_y * mb_block_height * wrap_c) + mb_x * 8; - ptr_cr = s->new_picture.f.data[2] + + ptr_cr = s->new_picture.f->data[2] + (mb_y * mb_block_height * wrap_c) + mb_x * 8; if (mb_x * 16 + 16 > s->width || mb_y * 16 + 16 > s->height) { @@ -1939,14 +1939,14 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s, if (s->mv_dir & MV_DIR_FORWARD) { ff_MPV_motion(s, dest_y, dest_cb, dest_cr, 0, - s->last_picture.f.data, + s->last_picture.f->data, op_pix, op_qpix); op_pix = s->hdsp.avg_pixels_tab; op_qpix = s->dsp.avg_qpel_pixels_tab; } if (s->mv_dir & MV_DIR_BACKWARD) { ff_MPV_motion(s, dest_y, dest_cb, dest_cr, 1, - s->next_picture.f.data, + s->next_picture.f->data, op_pix, op_qpix); } @@ -2322,18 +2322,18 @@ static int sse_mb(MpegEncContext *s){ if(w==16 && h==16) if(s->avctx->mb_cmp == FF_CMP_NSSE){ - return s->dsp.nsse[0](s, s->new_picture.f.data[0] + s->mb_x*16 + s->mb_y*s->linesize*16, s->dest[0], s->linesize, 16) - +s->dsp.nsse[1](s, s->new_picture.f.data[1] + s->mb_x*8 + s->mb_y*s->uvlinesize*8,s->dest[1], s->uvlinesize, 8) - +s->dsp.nsse[1](s, s->new_picture.f.data[2] + s->mb_x*8 + s->mb_y*s->uvlinesize*8,s->dest[2], s->uvlinesize, 8); + return s->dsp.nsse[0](s, s->new_picture.f->data[0] + s->mb_x*16 + s->mb_y*s->linesize*16, s->dest[0], s->linesize, 16) + +s->dsp.nsse[1](s, s->new_picture.f->data[1] + s->mb_x*8 + s->mb_y*s->uvlinesize*8,s->dest[1], s->uvlinesize, 8) + +s->dsp.nsse[1](s, s->new_picture.f->data[2] + s->mb_x*8 + s->mb_y*s->uvlinesize*8,s->dest[2], s->uvlinesize, 8); }else{ - return s->dsp.sse[0](NULL, s->new_picture.f.data[0] + s->mb_x*16 + s->mb_y*s->linesize*16, s->dest[0], s->linesize, 16) - +s->dsp.sse[1](NULL, s->new_picture.f.data[1] + s->mb_x*8 + s->mb_y*s->uvlinesize*8,s->dest[1], s->uvlinesize, 8) - +s->dsp.sse[1](NULL, s->new_picture.f.data[2] + s->mb_x*8 + s->mb_y*s->uvlinesize*8,s->dest[2], s->uvlinesize, 8); + return s->dsp.sse[0](NULL, s->new_picture.f->data[0] + s->mb_x*16 + s->mb_y*s->linesize*16, s->dest[0], s->linesize, 16) + +s->dsp.sse[1](NULL, s->new_picture.f->data[1] + s->mb_x*8 + s->mb_y*s->uvlinesize*8,s->dest[1], s->uvlinesize, 8) + +s->dsp.sse[1](NULL, s->new_picture.f->data[2] + s->mb_x*8 + s->mb_y*s->uvlinesize*8,s->dest[2], s->uvlinesize, 8); } else - return 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) - +sse(s, s->new_picture.f.data[1] + s->mb_x*8 + s->mb_y*s->uvlinesize*8,s->dest[1], w>>1, h>>1, s->uvlinesize) - +sse(s, s->new_picture.f.data[2] + s->mb_x*8 + s->mb_y*s->uvlinesize*8,s->dest[2], w>>1, h>>1, s->uvlinesize); + return 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) + +sse(s, s->new_picture.f->data[1] + s->mb_x*8 + s->mb_y*s->uvlinesize*8,s->dest[1], w>>1, h>>1, s->uvlinesize) + +sse(s, s->new_picture.f->data[2] + s->mb_x*8 + s->mb_y*s->uvlinesize*8,s->dest[2], w>>1, h>>1, s->uvlinesize); } static int pre_estimate_motion_thread(AVCodecContext *c, void *arg){ @@ -2388,7 +2388,7 @@ static int mb_var_thread(AVCodecContext *c, void *arg){ for(mb_x=0; mb_x < s->mb_width; mb_x++) { int xx = mb_x * 16; int yy = mb_y * 16; - uint8_t *pix = s->new_picture.f.data[0] + (yy * s->linesize) + xx; + uint8_t *pix = s->new_picture.f->data[0] + (yy * s->linesize) + xx; int varc; int sum = s->dsp.pix_sum(pix, s->linesize); @@ -2495,7 +2495,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.f->error[i] = 0; } s->mb_skip_run = 0; memset(s->last_mv, 0, sizeof(s->last_mv)); @@ -3053,14 +3053,14 @@ 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, s->new_picture.f.data[0] + s->mb_x*16 + s->mb_y*s->linesize*16, + s->current_picture.f->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, s->new_picture.f.data[1] + s->mb_x*8 + s->mb_y*s->uvlinesize*chr_h, + s->current_picture.f->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, s->new_picture.f.data[2] + s->mb_x*8 + s->mb_y*s->uvlinesize*chr_h, + s->current_picture.f->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); } if(s->loop_filter){ @@ -3112,9 +3112,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.f->error[0]); + MERGE(current_picture.f->error[1]); + MERGE(current_picture.f->error[2]); if(dst->avctx->noise_reduction){ for(i=0; i<64; i++){ @@ -3131,13 +3131,13 @@ static void merge_context_after_encode(MpegEncContext *dst, MpegEncContext *src) static int estimate_qp(MpegEncContext *s, int dry_run){ if (s->next_lambda){ - s->current_picture_ptr->f.quality = - s->current_picture.f.quality = s->next_lambda; + s->current_picture_ptr->f->quality = + s->current_picture.f->quality = s->next_lambda; if(!dry_run) s->next_lambda= 0; } else if (!s->fixed_qscale) { - s->current_picture_ptr->f.quality = - s->current_picture.f.quality = ff_rate_estimate_qscale(s, dry_run); - if (s->current_picture.f.quality < 0) + s->current_picture_ptr->f->quality = + s->current_picture.f->quality = ff_rate_estimate_qscale(s, dry_run); + if (s->current_picture.f->quality < 0) return -1; } @@ -3160,15 +3160,15 @@ static int estimate_qp(MpegEncContext *s, int dry_run){ s->lambda= s->lambda_table[0]; //FIXME broken }else - s->lambda = s->current_picture.f.quality; + s->lambda = s->current_picture.f->quality; update_qscale(s); return 0; } /* must be called before writing the header */ static void set_frame_distances(MpegEncContext * s){ - assert(s->current_picture_ptr->f.pts != AV_NOPTS_VALUE); - s->time = s->current_picture_ptr->f.pts * s->avctx->time_base.num; + assert(s->current_picture_ptr->f->pts != AV_NOPTS_VALUE); + s->time = s->current_picture_ptr->f->pts * s->avctx->time_base.num; if(s->pict_type==AV_PICTURE_TYPE_B){ s->pb_time= s->pp_time - (s->last_non_b_time - s->time); @@ -3345,12 +3345,12 @@ static int encode_picture(MpegEncContext *s, int picture_number) } //FIXME var duplication - s->current_picture_ptr->f.key_frame = - s->current_picture.f.key_frame = s->pict_type == AV_PICTURE_TYPE_I; //FIXME pic_ptr - s->current_picture_ptr->f.pict_type = - s->current_picture.f.pict_type = s->pict_type; + s->current_picture_ptr->f->key_frame = + s->current_picture.f->key_frame = s->pict_type == AV_PICTURE_TYPE_I; //FIXME pic_ptr + s->current_picture_ptr->f->pict_type = + s->current_picture.f->pict_type = s->pict_type; - if (s->current_picture.f.key_frame) + if (s->current_picture.f->key_frame) s->picture_in_gop_number=0; s->last_bits= put_bits_count(&s->pb); |