X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fmpegvideo.c;h=00d58dce89bdf3d472703a7f684cbf0b3ff1a561;hb=8c87658fdc657fa0c19c9b507645b03d5295eb49;hp=9eeb20d3b9f237a1aa2ec461adf7ccf0c244728f;hpb=e28130bcaf48281b431ea611a546e7520bb90dda;p=ffmpeg diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 9eeb20d3b9f..00d58dce89b 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -241,7 +241,7 @@ static int alloc_frame_buffer(MpegEncContext *s, Picture *pic) r = avcodec_default_get_buffer2(s->avctx, &pic->f, 0); } - if (r < 0 || !pic->f.data[0]) { + if (r < 0 || !pic->f.buf[0]) { av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (%d %p)\n", r, pic->f.data[0]); return -1; @@ -388,7 +388,7 @@ int ff_alloc_picture(MpegEncContext *s, Picture *pic, int shared) av_assert0(pic->f.data[0]); pic->shared = 1; } else { - av_assert0(!pic->f.data[0]); + av_assert0(!pic->f.buf[0]); if (alloc_frame_buffer(s, pic) < 0) return -1; @@ -717,7 +717,7 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst, if(s->picture) for (i = 0; i < MAX_PICTURE_COUNT; i++) { ff_mpeg_unref_picture(s, &s->picture[i]); - if (s1->picture[i].f.data[0] && + if (s1->picture[i].f.buf[0] && (ret = ff_mpeg_ref_picture(s, &s->picture[i], &s1->picture[i])) < 0) return ret; } @@ -725,7 +725,7 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst, #define UPDATE_PICTURE(pic)\ do {\ ff_mpeg_unref_picture(s, &s->pic);\ - if (s1->pic.f.data[0])\ + if (s1->pic.f.buf[0])\ ret = ff_mpeg_ref_picture(s, &s->pic, &s1->pic);\ else\ ret = update_picture_tables(&s->pic, &s1->pic);\ @@ -1424,7 +1424,7 @@ static inline int pic_is_unused(MpegEncContext *s, Picture *pic) { if (pic == s->last_picture_ptr) return 0; - if (pic->f.data[0] == NULL) + if (pic->f.buf[0] == NULL) return 1; if (pic->needs_realloc && !(pic->reference & DELAYED_PIC_REF)) return 1; @@ -1437,7 +1437,7 @@ static int find_unused_picture(MpegEncContext *s, int shared) if (shared) { for (i = 0; i < MAX_PICTURE_COUNT; i++) { - if (s->picture[i].f.data[0] == NULL && &s->picture[i] != s->last_picture_ptr) + if (s->picture[i].f.buf[0] == NULL && &s->picture[i] != s->last_picture_ptr) return i; } } else { @@ -1518,7 +1518,7 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx) /* 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.data[0]) { + s->last_picture_ptr->f.buf[0]) { ff_mpeg_unref_picture(s, s->last_picture_ptr); } @@ -1543,7 +1543,7 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx) ff_release_unused_pictures(s, 1); if (s->current_picture_ptr && - s->current_picture_ptr->f.data[0] == NULL) { + s->current_picture_ptr->f.buf[0] == NULL) { // we already have a unused image // (maybe it was set before reading the header) pic = s->current_picture_ptr; @@ -1603,13 +1603,13 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx) s->pict_type, s->droppable); if ((s->last_picture_ptr == NULL || - s->last_picture_ptr->f.data[0] == NULL) && + s->last_picture_ptr->f.buf[0] == NULL) && (s->pict_type != AV_PICTURE_TYPE_I || s->picture_structure != PICT_FRAME)) { int h_chroma_shift, v_chroma_shift; av_pix_fmt_get_chroma_sub_sample(s->avctx->pix_fmt, &h_chroma_shift, &v_chroma_shift); - if (s->pict_type == AV_PICTURE_TYPE_B && s->next_picture_ptr && s->next_picture_ptr->f.data[0]) + if (s->pict_type == AV_PICTURE_TYPE_B && s->next_picture_ptr && s->next_picture_ptr->f.buf[0]) av_log(avctx, AV_LOG_DEBUG, "allocating dummy last picture for B frame\n"); else if (s->pict_type != AV_PICTURE_TYPE_I) @@ -1650,7 +1650,7 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx) ff_thread_report_progress(&s->last_picture_ptr->tf, INT_MAX, 1); } if ((s->next_picture_ptr == NULL || - s->next_picture_ptr->f.data[0] == NULL) && + s->next_picture_ptr->f.buf[0] == NULL) && s->pict_type == AV_PICTURE_TYPE_B) { /* Allocate a dummy frame */ i = ff_find_unused_picture(s, 0); @@ -1674,21 +1674,21 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx) #endif if (s->last_picture_ptr) { ff_mpeg_unref_picture(s, &s->last_picture); - if (s->last_picture_ptr->f.data[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.data[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; } av_assert0(s->pict_type == AV_PICTURE_TYPE_I || (s->last_picture_ptr && - s->last_picture_ptr->f.data[0])); + s->last_picture_ptr->f.buf[0])); if (s->picture_structure!= PICT_FRAME) { int i; @@ -2227,12 +2227,11 @@ static inline int hpel_motion_lowres(MpegEncContext *s, if ((unsigned)src_x > FFMAX( h_edge_pos - (!!sx) - w, 0) || (unsigned)src_y > FFMAX((v_edge_pos >> field_based) - (!!sy) - h, 0)) { - s->vdsp.emulated_edge_mc(s->edge_emu_buffer, s->linesize, - src, s->linesize, w + 1, - (h + 1) << field_based, src_x, - src_y << field_based, - h_edge_pos, - v_edge_pos); + s->vdsp.emulated_edge_mc(s->edge_emu_buffer, src, + s->linesize, s->linesize, + w + 1, (h + 1) << field_based, + src_x, src_y << field_based, + h_edge_pos, v_edge_pos); src = s->edge_emu_buffer; emu = 1; } @@ -2330,21 +2329,22 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s, if ((unsigned) src_x > FFMAX( h_edge_pos - (!!sx) - 2 * block_s, 0) || uvsrc_y<0 || (unsigned) src_y > FFMAX((v_edge_pos >> field_based) - (!!sy) - h, 0)) { - s->vdsp.emulated_edge_mc(s->edge_emu_buffer, linesize >> field_based, ptr_y, - linesize >> field_based, 17, 17 + field_based, + s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr_y, + linesize >> field_based, linesize >> field_based, + 17, 17 + field_based, src_x, src_y << field_based, h_edge_pos, v_edge_pos); ptr_y = s->edge_emu_buffer; if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) { uint8_t *uvbuf = s->edge_emu_buffer + 18 * s->linesize; - s->vdsp.emulated_edge_mc(uvbuf, uvlinesize >> field_based, - ptr_cb, uvlinesize >> field_based, 9, - 9 + field_based, + s->vdsp.emulated_edge_mc(uvbuf, ptr_cb, + uvlinesize >> field_based, uvlinesize >> field_based, + 9, 9 + field_based, uvsrc_x, uvsrc_y << field_based, h_edge_pos >> 1, v_edge_pos >> 1); - s->vdsp.emulated_edge_mc(uvbuf + 16, uvlinesize >> field_based, - ptr_cr, uvlinesize >> field_based, 9, - 9 + field_based, + s->vdsp.emulated_edge_mc(uvbuf + 16, ptr_cr, + uvlinesize >> field_based,uvlinesize >> field_based, + 9, 9 + field_based, uvsrc_x, uvsrc_y << field_based, h_edge_pos >> 1, v_edge_pos >> 1); ptr_cb = uvbuf; @@ -2416,8 +2416,10 @@ static inline void chroma_4mv_motion_lowres(MpegEncContext *s, ptr = ref_picture[1] + offset; if ((unsigned) src_x > FFMAX(h_edge_pos - (!!sx) - block_s, 0) || (unsigned) src_y > FFMAX(v_edge_pos - (!!sy) - block_s, 0)) { - s->vdsp.emulated_edge_mc(s->edge_emu_buffer, s->uvlinesize, ptr, s->uvlinesize, - 9, 9, src_x, src_y, h_edge_pos, v_edge_pos); + s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, + s->uvlinesize, s->uvlinesize, + 9, 9, + src_x, src_y, h_edge_pos, v_edge_pos); ptr = s->edge_emu_buffer; emu = 1; } @@ -2427,9 +2429,10 @@ static inline void chroma_4mv_motion_lowres(MpegEncContext *s, ptr = ref_picture[2] + offset; if (emu) { - s->vdsp.emulated_edge_mc(s->edge_emu_buffer, s->uvlinesize, - ptr, s->uvlinesize, 9, 9, - src_x, src_y, h_edge_pos, v_edge_pos); + s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, + s->uvlinesize, s->uvlinesize, + 9, 9, + src_x, src_y, h_edge_pos, v_edge_pos); ptr = s->edge_emu_buffer; } pix_op[op_index](dest_cr, ptr, s->uvlinesize, block_s, sx, sy);