[FFmpeg-devel] [PATCH v1 3/5] avcodec/v210enc: define DEFINE_V210_PLANAR_FUNC to remove duplicate function
Michael Niedermayer
michael at niedermayer.cc
Fri Aug 30 21:16:31 EEST 2019
On Wed, Aug 28, 2019 at 11:45:14PM +0800, lance.lmwang at gmail.com wrote:
> From: Limin Wang <lance.lmwang at gmail.com>
>
> Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
> ---
> libavcodec/v210enc.c | 43 ++++++++++++++++---------------------------
> 1 file changed, 16 insertions(+), 27 deletions(-)
>
> diff --git a/libavcodec/v210enc.c b/libavcodec/v210enc.c
> index 69a2efe..716544a 100644
> --- a/libavcodec/v210enc.c
> +++ b/libavcodec/v210enc.c
> @@ -36,35 +36,24 @@
> dst += 4; \
> } while (0)
>
> -static void v210_planar_pack_8_c(const uint8_t *y, const uint8_t *u,
> - const uint8_t *v, uint8_t *dst,
> - ptrdiff_t width)
> -{
> - uint32_t val;
> - int i;
> -
> - for (i = 0; i < width - 5; i += 6) {
> - WRITE_PIXELS(u, y, v, 8);
> - WRITE_PIXELS(y, u, y, 8);
> - WRITE_PIXELS(v, y, u, 8);
> - WRITE_PIXELS(y, v, y, 8);
> - }
> +#define DEFINE_V210_PLANAR_FUNC(nbits, depth) \
> +static void v210_planar_pack_##depth##_c(const uint##nbits##_t *y, \
> + const uint##nbits##_t *u, const uint##nbits##_t *v, \
> + uint8_t *dst, ptrdiff_t width) \
> +{ \
> + uint32_t val; \
> + int i; \
> + \
> + for (i = 0; i < width - 5; i += 6) { \
> + WRITE_PIXELS(u, y, v, depth); \
> + WRITE_PIXELS(y, u, y, depth); \
> + WRITE_PIXELS(v, y, u, depth); \
> + WRITE_PIXELS(y, v, y, depth); \
> + } \
> }
>
> -static void v210_planar_pack_10_c(const uint16_t *y, const uint16_t *u,
> - const uint16_t *v, uint8_t *dst,
> - ptrdiff_t width)
> -{
> - uint32_t val;
> - int i;
> -
> - for (i = 0; i < width - 5; i += 6) {
> - WRITE_PIXELS(u, y, v, 10);
> - WRITE_PIXELS(y, u, y, 10);
> - WRITE_PIXELS(v, y, u, 10);
> - WRITE_PIXELS(y, v, y, 10);
> - }
> -}
> +DEFINE_V210_PLANAR_FUNC(8, 8);
> +DEFINE_V210_PLANAR_FUNC(16, 10);
same as with the other per depth functions, i think this might be cleaner
in a seperate "template" file
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The worst form of inequality is to try to make unequal things equal.
-- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190830/1308cb83/attachment.sig>
More information about the ffmpeg-devel
mailing list