Diego Biurrun <[email protected]> writes:
> ---
> libavcodec/dsputil.h | 28 ++++++++++++++--------------
> libavutil/intreadwrite.h | 27 +++++++++++++++++++++++++++
> 2 files changed, 41 insertions(+), 14 deletions(-)
>
> diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h
> index 7fdbf6f..324713c 100644
> --- a/libavcodec/dsputil.h
> +++ b/libavcodec/dsputil.h
> @@ -662,7 +662,7 @@ static inline void copy_block2(uint8_t *dst, const
> uint8_t *src, int dstStride,
> int i;
> for(i=0; i<h; i++)
> {
> - AV_WN16(dst , AV_RN16(src ));
> + AV_COPY16U(dst, src);
> dst+=dstStride;
> src+=srcStride;
> }
I'd prefer that you split the addition of the macros from patches
converting code to use them. It makes the interesting part much easier
to spot in the patch.
[...]
> diff --git a/libavutil/intreadwrite.h b/libavutil/intreadwrite.h
> index 01eb278..e11ad09 100644
> --- a/libavutil/intreadwrite.h
> +++ b/libavutil/intreadwrite.h
> @@ -462,6 +462,33 @@ union unaligned_16 { uint16_t l; }
> __attribute__((packed)) av_alias;
> # define AV_WN64A(p, v) AV_WNA(64, p, v)
> #endif
>
> +/*
> + * The AV_COPYxxU macros are suitable for copying data from unaligned
> + * memory locations.
> + */
to/from
> +#define AV_COPYU(n, d, s) AV_WN##n((d), AV_RN##n(s));
No need for () around things passed as arguments.
> +#ifndef AV_COPY16U
> +# define AV_COPY16U(d, s) AV_COPYU(16, d, s)
> +#endif
> +
> +#ifndef AV_COPY32U
> +# define AV_COPY32U(d, s) AV_COPYU(32, d, s)
> +#endif
> +
> +#ifndef AV_COPY64U
> +# define AV_COPY64U(d, s) AV_COPYU(64, d, s)
> +#endif
> +
> +#ifndef AV_COPY128U
> +# define AV_COPY128U(d, s) \
> + do { \
> + AV_COPY64U(d, s); \
> + AV_COPY64U((char*)(d) + 8, (char*)(s) + 8); \
> + } while(0)
> +#endif
Space between type and * please, and source should be const.
--
Måns Rullgård
[email protected]
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel