On Thu, 3 Jul 2014 10:34:10 -0700, Diego Biurrun <[email protected]> wrote: > --- > > Now without blackfin noise and some PPC init fixes. > > Still might or might not benefit from squashing.. > > libavcodec/dsputil.c | 30 -------- > libavcodec/dsputil.h | 6 -- > libavcodec/mpegvideo_enc.c | 24 +++---- > libavcodec/mpegvideoencdsp.c | 31 ++++++++ > libavcodec/mpegvideoencdsp.h | 7 ++ > libavcodec/utils.c | 1 + > libavcodec/x86/Makefile | 1 - > libavcodec/x86/dsputil_init.c | 15 ---- > libavcodec/x86/dsputil_mmx.c | 128 > ---------------------------------- > libavcodec/x86/dsputil_x86.h | 3 - > libavcodec/x86/mpegvideoencdsp_init.c | 99 ++++++++++++++++++++++++++ > 11 files changed, 150 insertions(+), 195 deletions(-) > delete mode 100644 libavcodec/x86/dsputil_mmx.c > > diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c > index 8c4c670..ec73bba 100644 > --- a/libavcodec/dsputil.c > +++ b/libavcodec/dsputil.c > @@ -921,34 +921,6 @@ WRAPPER8_16_SQ(quant_psnr8x8_c, quant_psnr16_c) > WRAPPER8_16_SQ(rd8x8_c, rd16_c) > WRAPPER8_16_SQ(bit8x8_c, bit16_c) > > -/* draw the edges of width 'w' of an image of size width, height */ > -// FIXME: Check that this is OK for MPEG-4 interlaced. > -static void draw_edges_8_c(uint8_t *buf, int wrap, int width, int height, > - int w, int h, int sides) > -{ > - uint8_t *ptr = buf, *last_line; > - int i; > - > - /* left and right */ > - for (i = 0; i < height; i++) { > - memset(ptr - w, ptr[0], w); > - memset(ptr + width, ptr[width - 1], w); > - ptr += wrap; > - } > - > - /* top and bottom + corners */ > - buf -= w; > - last_line = buf + (height - 1) * wrap; > - if (sides & EDGE_TOP) > - for (i = 0; i < h; i++) > - // top > - memcpy(buf - (i + 1) * wrap, buf, width + w + w); > - if (sides & EDGE_BOTTOM) > - for (i = 0; i < h; i++) > - // bottom > - memcpy(last_line + (i + 1) * wrap, last_line, width + w + w); > -} > - > /* init static data */ > av_cold void ff_dsputil_static_init(void) > { > @@ -1023,8 +995,6 @@ av_cold void ff_dsputil_init(DSPContext *c, > AVCodecContext *avctx) > c->nsse[0] = nsse16_c; > c->nsse[1] = nsse8_c; > > - c->draw_edges = draw_edges_8_c; > - > switch (avctx->bits_per_raw_sample) { > case 9: > case 10: > diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h > index 284973e..5a83fe0 100644 > --- a/libavcodec/dsputil.h > +++ b/libavcodec/dsputil.h > @@ -83,12 +83,6 @@ typedef struct DSPContext { > /* (I)DCT */ > void (*fdct)(int16_t *block /* align 16 */); > void (*fdct248)(int16_t *block /* align 16 */); > - > - void (*draw_edges)(uint8_t *buf, int wrap, int width, int height, > - int w, int h, int sides); > -#define EDGE_WIDTH 16 > -#define EDGE_TOP 1 > -#define EDGE_BOTTOM 2 > } DSPContext; > > void ff_dsputil_static_init(void); > diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c > index e3f9e55..27deb5f 100644 > --- a/libavcodec/mpegvideo_enc.c > +++ b/libavcodec/mpegvideo_enc.c > @@ -1391,18 +1391,18 @@ 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->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); > + s->mvedsp.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->mvedsp.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->mvedsp.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(); > diff --git a/libavcodec/mpegvideoencdsp.c b/libavcodec/mpegvideoencdsp.c > index ee6327d..8202034 100644 > --- a/libavcodec/mpegvideoencdsp.c > +++ b/libavcodec/mpegvideoencdsp.c > @@ -18,6 +18,7 @@ > > #include <assert.h> > #include <stdint.h> > +#include <string.h> > > #include "config.h" > #include "libavutil/attributes.h" > @@ -124,6 +125,34 @@ static int pix_norm1_c(uint8_t *pix, int line_size) > return s; > } > > +/* draw the edges of width 'w' of an image of size width, height */ > +// FIXME: Check that this is OK for MPEG-4 interlaced. > +static void draw_edges_8_c(uint8_t *buf, int wrap, int width, int height, > + int w, int h, int sides) > +{ > + uint8_t *ptr = buf, *last_line; > + int i; > + > + /* left and right */ > + for (i = 0; i < height; i++) { > + memset(ptr - w, ptr[0], w); > + memset(ptr + width, ptr[width - 1], w); > + ptr += wrap; > + } > + > + /* top and bottom + corners */ > + buf -= w; > + last_line = buf + (height - 1) * wrap; > + if (sides & EDGE_TOP) > + for (i = 0; i < h; i++) > + // top > + memcpy(buf - (i + 1) * wrap, buf, width + w + w); > + if (sides & EDGE_BOTTOM) > + for (i = 0; i < h; i++) > + // bottom > + memcpy(last_line + (i + 1) * wrap, last_line, width + w + w); > +} > + > av_cold void ff_mpegvideoencdsp_init(MpegvideoEncDSPContext *c, > AVCodecContext *avctx) > { > @@ -138,6 +167,8 @@ av_cold void > ff_mpegvideoencdsp_init(MpegvideoEncDSPContext *c, > c->pix_sum = pix_sum_c; > c->pix_norm1 = pix_norm1_c; > > + c->draw_edges = draw_edges_8_c; > + > if (ARCH_ARM) > ff_mpegvideoencdsp_init_arm(c, avctx); > if (ARCH_PPC) > diff --git a/libavcodec/mpegvideoencdsp.h b/libavcodec/mpegvideoencdsp.h > index dcbeb3c..5754dbf 100644 > --- a/libavcodec/mpegvideoencdsp.h > +++ b/libavcodec/mpegvideoencdsp.h > @@ -26,6 +26,10 @@ > #define BASIS_SHIFT 16 > #define RECON_SHIFT 6 > > +#define EDGE_WIDTH 16
At least EDGE_WIDTH is used in mpegvideo.c, so i think mpegvideo.h would be a more proper place for it. -- Anton Khirnov _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
