[FFmpeg-devel] [PATCH 4/4] avcodec/pngdec: use memcpy instead of byte loops for P frames.

Benoit Fouet benoit.fouet at free.fr
Wed Dec 3 14:26:15 CET 2014


Hi,

----- Mail original -----
> Rely on the way memcpy is optimized for one's system instead of
> looping
> on a byte buffer for buffer copies to handle P frames.
> ---
>  libavcodec/pngdec.c | 30 +++++++++++++++---------------
>  1 file changed, 15 insertions(+), 15 deletions(-)
> 
> diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
> index 7e7b285..8b004bd 100644
> --- a/libavcodec/pngdec.c
> +++ b/libavcodec/pngdec.c
> @@ -844,15 +844,14 @@ static int decode_fctl_chunk(AVCodecContext
> *avctx, PNGDecContext *s,
>  
>  static void handle_p_frame_png(PNGDecContext *s, AVFrame *p)
>  {
> -    int i, j;
> +    int j;
>      uint8_t *pd      = p->data[0];
>      uint8_t *pd_last = s->last_picture.f->data[0];
>      int ls = FFMIN(av_image_get_linesize(p->format, s->width, 0),
>      s->width * s->bpp);
>  
>      ff_thread_await_progress(&s->last_picture, INT_MAX, 0);
>      for (j = 0; j < s->height; j++) {
> -        for (i = 0; i < ls; i++)
> -            pd[i] += pd_last[i];
> +        memcpy(pd, pd_last, ls);
> 

Ouch... Reverted locally...

-- 
Ben


More information about the ffmpeg-devel mailing list