* commit 'ebfe622bb1ca57cecb932e42926745cba7161913': mpegvideo: drop support for real (non-emulated) edges Conflicts: libavcodec/mpegvideo.c libavcodec/mpegvideo_motion.c libavcodec/wmv2.c If this is slower on a major platform then it should be investigated and potentially reverted. See:tags/n2.2-rc18fc52a5ef9See:3969b4b861Merged-by: Michael Niedermayer <michaelni@gmx.at>
| @@ -1852,32 +1852,6 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx) | |||
| /* called after a frame has been decoded. */ | |||
| void ff_MPV_frame_end(MpegEncContext *s) | |||
| { | |||
| if ((s->er.error_count || !(s->avctx->codec->capabilities&CODEC_CAP_DRAW_HORIZ_BAND)) && | |||
| !s->avctx->hwaccel && | |||
| !(s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) && | |||
| s->unrestricted_mv && | |||
| s->current_picture.reference && | |||
| !s->intra_only && | |||
| !(s->flags & CODEC_FLAG_EMU_EDGE) && | |||
| !s->avctx->lowres | |||
| ) { | |||
| 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->current_picture.f.linesize[0], | |||
| 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->current_picture.f.linesize[1], | |||
| 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->current_picture.f.linesize[2], | |||
| s->h_edge_pos >> hshift, s->v_edge_pos >> vshift, | |||
| EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift, | |||
| EDGE_TOP | EDGE_BOTTOM); | |||
| } | |||
| emms_c(); | |||
| if (s->current_picture.reference) | |||
| @@ -3031,11 +3005,10 @@ void ff_MPV_decode_mb(MpegEncContext *s, int16_t block[12][64]){ | |||
| */ | |||
| void ff_draw_horiz_band(AVCodecContext *avctx, DSPContext *dsp, Picture *cur, | |||
| Picture *last, int y, int h, int picture_structure, | |||
| int first_field, int draw_edges, int low_delay, | |||
| int first_field, int low_delay, | |||
| int v_edge_pos, int h_edge_pos) | |||
| { | |||
| const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); | |||
| int hshift = desc->log2_chroma_w; | |||
| int vshift = desc->log2_chroma_h; | |||
| const int field_pic = picture_structure != PICT_FRAME; | |||
| if(field_pic){ | |||
| @@ -3043,30 +3016,6 @@ void ff_draw_horiz_band(AVCodecContext *avctx, DSPContext *dsp, Picture *cur, | |||
| y <<= 1; | |||
| } | |||
| if (!avctx->hwaccel && | |||
| !(avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) && | |||
| draw_edges && | |||
| cur->reference && | |||
| !(avctx->flags & CODEC_FLAG_EMU_EDGE)) { | |||
| int *linesize = cur->f.linesize; | |||
| int sides = 0, edge_h; | |||
| if (y==0) sides |= EDGE_TOP; | |||
| if (y + h >= v_edge_pos) | |||
| sides |= EDGE_BOTTOM; | |||
| edge_h= FFMIN(h, v_edge_pos - y); | |||
| dsp->draw_edges(cur->f.data[0] + y * linesize[0], | |||
| linesize[0], h_edge_pos, edge_h, | |||
| EDGE_WIDTH, EDGE_WIDTH, sides); | |||
| dsp->draw_edges(cur->f.data[1] + (y >> vshift) * linesize[1], | |||
| linesize[1], h_edge_pos >> hshift, edge_h >> vshift, | |||
| EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift, sides); | |||
| dsp->draw_edges(cur->f.data[2] + (y >> vshift) * linesize[2], | |||
| linesize[2], h_edge_pos >> hshift, edge_h >> vshift, | |||
| EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift, sides); | |||
| } | |||
| h = FFMIN(h, avctx->height - y); | |||
| if(field_pic && first_field && !(avctx->slice_flags&SLICE_FLAG_ALLOW_FIELD)) return; | |||
| @@ -3106,10 +3055,9 @@ void ff_draw_horiz_band(AVCodecContext *avctx, DSPContext *dsp, Picture *cur, | |||
| void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h) | |||
| { | |||
| int draw_edges = s->unrestricted_mv && !s->intra_only; | |||
| ff_draw_horiz_band(s->avctx, &s->dsp, s->current_picture_ptr, | |||
| s->last_picture_ptr, y, h, s->picture_structure, | |||
| s->first_field, draw_edges, s->low_delay, | |||
| s->first_field, s->low_delay, | |||
| s->v_edge_pos, s->h_edge_pos); | |||
| } | |||
| @@ -809,7 +809,7 @@ void ff_MPV_common_init_ppc(MpegEncContext *s); | |||
| void ff_clean_intra_table_entries(MpegEncContext *s); | |||
| void ff_draw_horiz_band(AVCodecContext *avctx, DSPContext *dsp, Picture *cur, | |||
| Picture *last, int y, int h, int picture_structure, | |||
| int first_field, int draw_edges, int low_delay, | |||
| int first_field, int low_delay, | |||
| int v_edge_pos, int h_edge_pos); | |||
| void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h); | |||
| void ff_mpeg_flush(AVCodecContext *avctx); | |||
| @@ -1209,7 +1209,7 @@ static int estimate_best_b_count(MpegEncContext *s) | |||
| c->width = s->width >> scale; | |||
| c->height = s->height >> scale; | |||
| c->flags = CODEC_FLAG_QSCALE | CODEC_FLAG_PSNR | | |||
| CODEC_FLAG_INPUT_PRESERVED /*| CODEC_FLAG_EMU_EDGE*/; | |||
| CODEC_FLAG_INPUT_PRESERVED; | |||
| c->flags |= s->avctx->flags & CODEC_FLAG_QPEL; | |||
| c->mb_decision = s->avctx->mb_decision; | |||
| c->me_cmp = s->avctx->me_cmp; | |||
| @@ -60,15 +60,15 @@ static void gmc1_motion(MpegEncContext *s, | |||
| ptr = ref_picture[0] + src_y * linesize + src_x; | |||
| if ((unsigned)src_x >= FFMAX(s->h_edge_pos - 17, 0) || | |||
| (unsigned)src_y >= FFMAX(s->v_edge_pos - 17, 0)) { | |||
| s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, | |||
| linesize, linesize, | |||
| 17, 17, | |||
| src_x, src_y, | |||
| s->h_edge_pos, s->v_edge_pos); | |||
| ptr = s->edge_emu_buffer; | |||
| } | |||
| if ((unsigned)src_x >= FFMAX(s->h_edge_pos - 17, 0) || | |||
| (unsigned)src_y >= FFMAX(s->v_edge_pos - 17, 0)) { | |||
| s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, | |||
| linesize, linesize, | |||
| 17, 17, | |||
| src_x, src_y, | |||
| s->h_edge_pos, s->v_edge_pos); | |||
| ptr = s->edge_emu_buffer; | |||
| } | |||
| if ((motion_x | motion_y) & 7) { | |||
| s->dsp.gmc1(dest_y, ptr, linesize, 16, | |||
| @@ -104,16 +104,16 @@ static void gmc1_motion(MpegEncContext *s, | |||
| offset = (src_y * uvlinesize) + src_x; | |||
| ptr = ref_picture[1] + offset; | |||
| if ((unsigned)src_x >= FFMAX((s->h_edge_pos >> 1) - 9, 0) || | |||
| (unsigned)src_y >= FFMAX((s->v_edge_pos >> 1) - 9, 0)) { | |||
| s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, | |||
| uvlinesize, uvlinesize, | |||
| 9, 9, | |||
| src_x, src_y, | |||
| s->h_edge_pos >> 1, s->v_edge_pos >> 1); | |||
| ptr = s->edge_emu_buffer; | |||
| emu = 1; | |||
| } | |||
| if ((unsigned)src_x >= FFMAX((s->h_edge_pos >> 1) - 9, 0) || | |||
| (unsigned)src_y >= FFMAX((s->v_edge_pos >> 1) - 9, 0)) { | |||
| s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, | |||
| uvlinesize, uvlinesize, | |||
| 9, 9, | |||
| src_x, src_y, | |||
| s->h_edge_pos >> 1, s->v_edge_pos >> 1); | |||
| ptr = s->edge_emu_buffer; | |||
| emu = 1; | |||
| } | |||
| s->dsp.gmc1(dest_cb, ptr, uvlinesize, 8, | |||
| motion_x & 15, motion_y & 15, 128 - s->no_rounding); | |||
| @@ -209,7 +209,6 @@ static inline int hpel_motion(MpegEncContext *s, | |||
| dxy |= (motion_y & 1) << 1; | |||
| src += src_y * s->linesize + src_x; | |||
| if (s->flags & CODEC_FLAG_EMU_EDGE) { | |||
| if ((unsigned)src_x > FFMAX(s->h_edge_pos - (motion_x & 1) - 8, 0) || | |||
| (unsigned)src_y > FFMAX(s->v_edge_pos - (motion_y & 1) - 8, 0)) { | |||
| s->vdsp.emulated_edge_mc(s->edge_emu_buffer, src, | |||
| @@ -220,7 +219,6 @@ static inline int hpel_motion(MpegEncContext *s, | |||
| src = s->edge_emu_buffer; | |||
| emu = 1; | |||
| } | |||
| } | |||
| pix_op[dxy](dest, src, s->linesize, 8); | |||
| return emu; | |||
| } | |||
| @@ -619,16 +617,14 @@ static void chroma_4mv_motion(MpegEncContext *s, | |||
| offset = src_y * s->uvlinesize + src_x; | |||
| ptr = ref_picture[1] + offset; | |||
| if (s->flags & CODEC_FLAG_EMU_EDGE) { | |||
| if ((unsigned)src_x > FFMAX((s->h_edge_pos >> 1) - (dxy & 1) - 8, 0) || | |||
| (unsigned)src_y > FFMAX((s->v_edge_pos >> 1) - (dxy >> 1) - 8, 0)) { | |||
| s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, | |||
| s->uvlinesize, s->uvlinesize, | |||
| 9, 9, src_x, src_y, | |||
| s->h_edge_pos >> 1, s->v_edge_pos >> 1); | |||
| ptr = s->edge_emu_buffer; | |||
| emu = 1; | |||
| } | |||
| if ((unsigned)src_x > FFMAX((s->h_edge_pos >> 1) - (dxy & 1) - 8, 0) || | |||
| (unsigned)src_y > FFMAX((s->v_edge_pos >> 1) - (dxy >> 1) - 8, 0)) { | |||
| s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, | |||
| s->uvlinesize, s->uvlinesize, | |||
| 9, 9, src_x, src_y, | |||
| s->h_edge_pos >> 1, s->v_edge_pos >> 1); | |||
| ptr = s->edge_emu_buffer; | |||
| emu = 1; | |||
| } | |||
| pix_op[dxy](dest_cb, ptr, s->uvlinesize, 8); | |||
| @@ -779,17 +775,15 @@ static inline void apply_8x8(MpegEncContext *s, | |||
| dxy &= ~12; | |||
| ptr = ref_picture[0] + (src_y * s->linesize) + (src_x); | |||
| if (s->flags & CODEC_FLAG_EMU_EDGE) { | |||
| if ((unsigned)src_x > FFMAX(s->h_edge_pos - (motion_x & 3) - 8, 0) || | |||
| (unsigned)src_y > FFMAX(s->v_edge_pos - (motion_y & 3) - 8, 0)) { | |||
| s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, | |||
| s->linesize, s->linesize, | |||
| 9, 9, | |||
| src_x, src_y, | |||
| s->h_edge_pos, | |||
| s->v_edge_pos); | |||
| ptr = s->edge_emu_buffer; | |||
| } | |||
| if ((unsigned)src_x > FFMAX(s->h_edge_pos - (motion_x & 3) - 8, 0) || | |||
| (unsigned)src_y > FFMAX(s->v_edge_pos - (motion_y & 3) - 8, 0)) { | |||
| s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, | |||
| s->linesize, s->linesize, | |||
| 9, 9, | |||
| src_x, src_y, | |||
| s->h_edge_pos, | |||
| s->v_edge_pos); | |||
| ptr = s->edge_emu_buffer; | |||
| } | |||
| dest = dest_y + ((i & 1) * 8) + (i >> 1) * 8 * s->linesize; | |||
| qpix_op[1][dxy](dest, ptr, s->linesize); | |||
| @@ -739,8 +739,6 @@ static av_cold int wmv9_init(AVCodecContext *avctx) | |||
| int ret; | |||
| v->s.avctx = avctx; | |||
| avctx->flags |= CODEC_FLAG_EMU_EDGE; | |||
| v->s.flags |= CODEC_FLAG_EMU_EDGE; | |||
| if ((ret = ff_vc1_init_common(v)) < 0) | |||
| return ret; | |||
| @@ -1489,8 +1489,6 @@ av_cold int ff_rv34_decode_init(AVCodecContext *avctx) | |||
| s->height = avctx->height; | |||
| r->s.avctx = avctx; | |||
| avctx->flags |= CODEC_FLAG_EMU_EDGE; | |||
| r->s.flags |= CODEC_FLAG_EMU_EDGE; | |||
| avctx->pix_fmt = AV_PIX_FMT_YUV420P; | |||
| avctx->has_b_frames = 1; | |||
| s->low_delay = 0; | |||
| @@ -1299,7 +1299,7 @@ static int svq3_decode_frame(AVCodecContext *avctx, void *data, | |||
| } | |||
| ff_draw_horiz_band(avctx, NULL, s->cur_pic, s->last_pic->f.data[0] ? s->last_pic : NULL, | |||
| 16 * h->mb_y, 16, h->picture_structure, 0, 0, | |||
| 16 * h->mb_y, 16, h->picture_structure, 0, | |||
| h->low_delay, h->mb_height * 16, h->mb_width * 16); | |||
| } | |||
| @@ -5608,8 +5608,6 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) | |||
| avctx->pix_fmt = AV_PIX_FMT_GRAY8; | |||
| avctx->hwaccel = ff_find_hwaccel(avctx); | |||
| v->s.avctx = avctx; | |||
| avctx->flags |= CODEC_FLAG_EMU_EDGE; | |||
| v->s.flags |= CODEC_FLAG_EMU_EDGE; | |||
| if ((ret = ff_vc1_init_common(v)) < 0) | |||
| return ret; | |||
| @@ -117,17 +117,17 @@ void ff_mspel_motion(MpegEncContext *s, | |||
| uvlinesize = s->uvlinesize; | |||
| ptr = ref_picture[0] + (src_y * linesize) + src_x; | |||
| if(src_x<1 || src_y<1 || src_x + 17 >= s->h_edge_pos | |||
| || src_y + h+1 >= v_edge_pos){ | |||
| s->vdsp.emulated_edge_mc(s->edge_emu_buffer, | |||
| ptr - 1 - s->linesize, | |||
| s->linesize, s->linesize, | |||
| 19, 19, | |||
| src_x - 1, src_y - 1, | |||
| s->h_edge_pos, s->v_edge_pos); | |||
| ptr= s->edge_emu_buffer + 1 + s->linesize; | |||
| emu=1; | |||
| } | |||
| if(src_x<1 || src_y<1 || src_x + 17 >= s->h_edge_pos | |||
| || src_y + h+1 >= v_edge_pos){ | |||
| s->vdsp.emulated_edge_mc(s->edge_emu_buffer, | |||
| ptr - 1 - s->linesize, | |||
| s->linesize, s->linesize, | |||
| 19, 19, | |||
| src_x - 1, src_y - 1, | |||
| s->h_edge_pos, s->v_edge_pos); | |||
| ptr= s->edge_emu_buffer + 1 + s->linesize; | |||
| emu=1; | |||
| } | |||
| s->dsp.put_mspel_pixels_tab[dxy](dest_y , ptr , linesize); | |||
| s->dsp.put_mspel_pixels_tab[dxy](dest_y+8 , ptr+8 , linesize); | |||