mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-21 10:55:51 +02:00
mpegvideo: drop support for real (non-emulated) edges
Several decoders disable those anyway and they are not measurably faster on x86. They might be somewhat faster on other platforms due to missing emu edge SIMD, but the gain is not large enough (and those decoders relevant enough) to justify the added complexity.
This commit is contained in:
parent
952d3187d8
commit
ebfe622bb1
@ -1832,28 +1832,6 @@ FF_DISABLE_DEPRECATION_WARNINGS
|
||||
} else
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif /* FF_API_XVMC */
|
||||
if (s->er.error_count &&
|
||||
!s->avctx->hwaccel &&
|
||||
s->unrestricted_mv &&
|
||||
s->current_picture.reference &&
|
||||
!s->intra_only &&
|
||||
!(s->flags & CODEC_FLAG_EMU_EDGE)) {
|
||||
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->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->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->h_edge_pos >> hshift, s->v_edge_pos >> vshift,
|
||||
EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift,
|
||||
EDGE_TOP | EDGE_BOTTOM);
|
||||
}
|
||||
|
||||
emms_c();
|
||||
|
||||
@ -2318,11 +2296,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){
|
||||
@ -2330,29 +2307,6 @@ void ff_draw_horiz_band(AVCodecContext *avctx, DSPContext *dsp, Picture *cur,
|
||||
y <<= 1;
|
||||
}
|
||||
|
||||
if (!avctx->hwaccel &&
|
||||
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;
|
||||
@ -2392,10 +2346,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,
|
||||
&s->last_picture, 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);
|
||||
}
|
||||
|
||||
|
@ -786,7 +786,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);
|
||||
|
@ -1079,7 +1079,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;
|
||||
|
@ -59,16 +59,14 @@ static void gmc1_motion(MpegEncContext *s,
|
||||
|
||||
ptr = ref_picture[0] + src_y * linesize + src_x;
|
||||
|
||||
if (s->flags & CODEC_FLAG_EMU_EDGE) {
|
||||
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) {
|
||||
@ -105,17 +103,15 @@ static void gmc1_motion(MpegEncContext *s,
|
||||
|
||||
offset = (src_y * 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) - 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);
|
||||
@ -212,7 +208,7 @@ static inline int hpel_motion(MpegEncContext *s,
|
||||
dxy |= (motion_y & 1) << 1;
|
||||
src += src_y * s->linesize + src_x;
|
||||
|
||||
if (s->unrestricted_mv && (s->flags & CODEC_FLAG_EMU_EDGE)) {
|
||||
if (s->unrestricted_mv) {
|
||||
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,
|
||||
@ -622,16 +618,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);
|
||||
|
||||
@ -782,17 +776,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);
|
||||
|
@ -740,8 +740,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;
|
||||
|
@ -444,7 +444,6 @@ static av_cold int rv10_decode_init(AVCodecContext *avctx)
|
||||
s->avctx = avctx;
|
||||
s->out_format = FMT_H263;
|
||||
s->codec_id = avctx->codec_id;
|
||||
avctx->flags |= CODEC_FLAG_EMU_EDGE;
|
||||
|
||||
s->orig_width = s->width = avctx->coded_width;
|
||||
s->orig_height = s->height = avctx->coded_height;
|
||||
|
@ -1481,8 +1481,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;
|
||||
|
@ -1268,7 +1268,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);
|
||||
}
|
||||
|
||||
|
@ -5598,8 +5598,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 (ff_vc1_init_common(v) < 0)
|
||||
return -1;
|
||||
|
@ -117,18 +117,16 @@ void ff_mspel_motion(MpegEncContext *s,
|
||||
uvlinesize = s->uvlinesize;
|
||||
ptr = ref_picture[0] + (src_y * linesize) + src_x;
|
||||
|
||||
if(s->flags&CODEC_FLAG_EMU_EDGE){
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user