[FFmpeg-devel] [PATCH v1 3/5] avcodec/v210enc: define DEFINE_V210_PLANAR_FUNC to remove duplicate function
Limin Wang
lance.lmwang at gmail.com
Sat Aug 31 10:27:13 EEST 2019
On Fri, Aug 30, 2019 at 08:16:31PM +0200, Michael Niedermayer wrote:
> 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
>
OK, I'll update it also.
> thx
>
> [...]
>
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> The worst form of inequality is to try to make unequal things equal.
> -- Aristotle
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-devel
mailing list