[FFmpeg-cvslog] Remove need for padding in av_memcpy_backptr()

Reimar Döffinger Reimar.Doeffinger at gmx.de
Wed Oct 24 19:53:48 CEST 2012


On Wed, Oct 24, 2012 at 02:14:42PM +0200, Mans Rullgard wrote:
> ffmpeg | branch: master | Mans Rullgard <mans at mansr.com> | Tue Oct 23 18:05:45 2012 +0100| [d82f188504410fdfa446c5682c128c31bb5851a4] | committer: Mans Rullgard
> 
> Remove need for padding in av_memcpy_backptr()
> 
> Signed-off-by: Mans Rullgard <mans at mansr.com>
> 
> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d82f188504410fdfa446c5682c128c31bb5851a4
> ---
> 
>  libavutil/lzo.c |   16 ++++++++--------
>  libavutil/lzo.h |    2 +-
>  2 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/libavutil/lzo.c b/libavutil/lzo.c
> index 101d4f4..c17d32f 100644
> --- a/libavutil/lzo.c
> +++ b/libavutil/lzo.c
> @@ -132,13 +132,14 @@ static inline void memcpy_backptr(uint8_t *dst, int back, int cnt)
>      if (back == 1) {
>          memset(dst, *src, cnt);
>      } else {
> -#ifdef OUTBUF_PADDED
> -        AV_COPY16U(dst,     src);
> -        AV_COPY16U(dst + 2, src + 2);
> -        src += 4;
> -        dst += 4;
> -        cnt -= 4;
> -        if (cnt > 0) {
> +        if (cnt >= 4) {
> +            AV_COPY16U(dst,     src);
> +            AV_COPY16U(dst + 2, src + 2);
> +            src += 4;
> +            dst += 4;
> +            cnt -= 4;
> +        }
> +        if (cnt >= 8) {

Does someone know if there were benchmarking numbers on the Libav list
for this?
It should be obvious that I tried both this and the AV_COPY*U equivalent
back then, and while I don't remember the exact they both made the code
significantly (as in > 2%) slower - for AV_COPY of course only
considering the case where unaligned access is not possible.


More information about the ffmpeg-cvslog mailing list