From: Ramiro Polla <ramiro.polla@gmail.com> To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH v2 1/5] swscale/yuv2rgb: prepare LOADCHROMA/PUTFUNC macros for multi-planar rgb Date: Tue, 6 Aug 2024 12:51:02 +0200 Message-ID: <20240806105106.59866-2-ramiro.polla@gmail.com> (raw) In-Reply-To: <20240806105106.59866-1-ramiro.polla@gmail.com> This will be used in the upcoming yuv42{0,2}p -> gbrp unscaled colorspace converters. There is no difference in performance. --- libswscale/yuv2rgb.c | 402 +++++++++++++++++++++---------------------- 1 file changed, 201 insertions(+), 201 deletions(-) diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c index cfbc54abd0..d77660b3a3 100644 --- a/libswscale/yuv2rgb.c +++ b/libswscale/yuv2rgb.c @@ -65,64 +65,64 @@ const int *sws_getCoefficients(int colorspace) return ff_yuv2rgb_coeffs[colorspace]; } -#define LOADCHROMA(pu, pv, i) \ - U = pu[i]; \ - V = pv[i]; \ +#define LOADCHROMA(l, i) \ + U = pu_##l[i]; \ + V = pv_##l[i]; \ r = (void *)c->table_rV[V+YUVRGB_TABLE_HEADROOM]; \ g = (void *)(c->table_gU[U+YUVRGB_TABLE_HEADROOM] + c->table_gV[V+YUVRGB_TABLE_HEADROOM]); \ b = (void *)c->table_bU[U+YUVRGB_TABLE_HEADROOM]; -#define PUTRGB(dst, src, asrc, i, abase) \ - Y = src[2 * i]; \ - dst[2 * i] = r[Y] + g[Y] + b[Y]; \ - Y = src[2 * i + 1]; \ - dst[2 * i + 1] = r[Y] + g[Y] + b[Y]; - -#define PUTRGB24(dst, src, asrc, i, abase) \ - Y = src[2 * i]; \ - dst[6 * i + 0] = r[Y]; \ - dst[6 * i + 1] = g[Y]; \ - dst[6 * i + 2] = b[Y]; \ - Y = src[2 * i + 1]; \ - dst[6 * i + 3] = r[Y]; \ - dst[6 * i + 4] = g[Y]; \ - dst[6 * i + 5] = b[Y]; - -#define PUTBGR24(dst, src, asrc, i, abase) \ - Y = src[2 * i]; \ - dst[6 * i + 0] = b[Y]; \ - dst[6 * i + 1] = g[Y]; \ - dst[6 * i + 2] = r[Y]; \ - Y = src[2 * i + 1]; \ - dst[6 * i + 3] = b[Y]; \ - dst[6 * i + 4] = g[Y]; \ - dst[6 * i + 5] = r[Y]; - -#define PUTRGBA(dst, ysrc, asrc, i, abase) \ - Y = ysrc[2 * i]; \ - dst[2 * i] = r[Y] + g[Y] + b[Y] + ((uint32_t)(asrc[2 * i]) << abase); \ - Y = ysrc[2 * i + 1]; \ - dst[2 * i + 1] = r[Y] + g[Y] + b[Y] + ((uint32_t)(asrc[2 * i + 1]) << abase); - -#define PUTRGB48(dst, src, asrc, i, abase) \ - Y = src[ 2 * i]; \ - dst[12 * i + 0] = dst[12 * i + 1] = r[Y]; \ - dst[12 * i + 2] = dst[12 * i + 3] = g[Y]; \ - dst[12 * i + 4] = dst[12 * i + 5] = b[Y]; \ - Y = src[ 2 * i + 1]; \ - dst[12 * i + 6] = dst[12 * i + 7] = r[Y]; \ - dst[12 * i + 8] = dst[12 * i + 9] = g[Y]; \ - dst[12 * i + 10] = dst[12 * i + 11] = b[Y]; - -#define PUTBGR48(dst, src, asrc, i, abase) \ - Y = src[2 * i]; \ - dst[12 * i + 0] = dst[12 * i + 1] = b[Y]; \ - dst[12 * i + 2] = dst[12 * i + 3] = g[Y]; \ - dst[12 * i + 4] = dst[12 * i + 5] = r[Y]; \ - Y = src[2 * i + 1]; \ - dst[12 * i + 6] = dst[12 * i + 7] = b[Y]; \ - dst[12 * i + 8] = dst[12 * i + 9] = g[Y]; \ - dst[12 * i + 10] = dst[12 * i + 11] = r[Y]; +#define PUTRGB(l, i, abase) \ + Y = py_##l[2 * i]; \ + dst_##l[2 * i] = r[Y] + g[Y] + b[Y]; \ + Y = py_##l[2 * i + 1]; \ + dst_##l[2 * i + 1] = r[Y] + g[Y] + b[Y]; + +#define PUTRGB24(l, i, abase) \ + Y = py_##l[2 * i]; \ + dst_##l[6 * i + 0] = r[Y]; \ + dst_##l[6 * i + 1] = g[Y]; \ + dst_##l[6 * i + 2] = b[Y]; \ + Y = py_##l[2 * i + 1]; \ + dst_##l[6 * i + 3] = r[Y]; \ + dst_##l[6 * i + 4] = g[Y]; \ + dst_##l[6 * i + 5] = b[Y]; + +#define PUTBGR24(l, i, abase) \ + Y = py_##l[2 * i]; \ + dst_##l[6 * i + 0] = b[Y]; \ + dst_##l[6 * i + 1] = g[Y]; \ + dst_##l[6 * i + 2] = r[Y]; \ + Y = py_##l[2 * i + 1]; \ + dst_##l[6 * i + 3] = b[Y]; \ + dst_##l[6 * i + 4] = g[Y]; \ + dst_##l[6 * i + 5] = r[Y]; + +#define PUTRGBA(l, i, abase) \ + Y = py_##l[2 * i]; \ + dst_##l[2 * i] = r[Y] + g[Y] + b[Y] + ((uint32_t)(pa_##l[2 * i]) << abase); \ + Y = py_##l[2 * i + 1]; \ + dst_##l[2 * i + 1] = r[Y] + g[Y] + b[Y] + ((uint32_t)(pa_##l[2 * i + 1]) << abase); + +#define PUTRGB48(l, i, abase) \ + Y = py_##l[ 2 * i]; \ + dst_##l[12 * i + 0] = dst_##l[12 * i + 1] = r[Y]; \ + dst_##l[12 * i + 2] = dst_##l[12 * i + 3] = g[Y]; \ + dst_##l[12 * i + 4] = dst_##l[12 * i + 5] = b[Y]; \ + Y = py_##l[ 2 * i + 1]; \ + dst_##l[12 * i + 6] = dst_##l[12 * i + 7] = r[Y]; \ + dst_##l[12 * i + 8] = dst_##l[12 * i + 9] = g[Y]; \ + dst_##l[12 * i + 10] = dst_##l[12 * i + 11] = b[Y]; + +#define PUTBGR48(l, i, abase) \ + Y = py_##l[2 * i]; \ + dst_##l[12 * i + 0] = dst_##l[12 * i + 1] = b[Y]; \ + dst_##l[12 * i + 2] = dst_##l[12 * i + 3] = g[Y]; \ + dst_##l[12 * i + 4] = dst_##l[12 * i + 5] = r[Y]; \ + Y = py_##l[2 * i + 1]; \ + dst_##l[12 * i + 6] = dst_##l[12 * i + 7] = b[Y]; \ + dst_##l[12 * i + 8] = dst_##l[12 * i + 9] = g[Y]; \ + dst_##l[12 * i + 10] = dst_##l[12 * i + 11] = r[Y]; #define YUV2RGBFUNC(func_name, dst_type, alpha, yuv422) \ static int func_name(SwsContext *c, const uint8_t *src[], \ @@ -183,166 +183,166 @@ const int *sws_getCoefficients(int colorspace) #define YUV420FUNC(func_name, dst_type, alpha, abase, PUTFUNC, dst_delta) \ YUV2RGBFUNC(func_name, dst_type, alpha, 0) \ - LOADCHROMA(pu_1, pv_1, 0); \ - PUTFUNC(dst_1, py_1, pa_1, 0, abase); \ - PUTFUNC(dst_2, py_2, pa_2, 0, abase); \ + LOADCHROMA(1, 0); \ + PUTFUNC(1, 0, abase); \ + PUTFUNC(2, 0, abase); \ \ - LOADCHROMA(pu_1, pv_1, 1); \ - PUTFUNC(dst_2, py_2, pa_2, 1, abase); \ - PUTFUNC(dst_1, py_1, pa_1, 1, abase); \ + LOADCHROMA(1, 1); \ + PUTFUNC(2, 1, abase); \ + PUTFUNC(1, 1, abase); \ \ - LOADCHROMA(pu_1, pv_1, 2); \ - PUTFUNC(dst_1, py_1, pa_1, 2, abase); \ - PUTFUNC(dst_2, py_2, pa_2, 2, abase); \ + LOADCHROMA(1, 2); \ + PUTFUNC(1, 2, abase); \ + PUTFUNC(2, 2, abase); \ \ - LOADCHROMA(pu_1, pv_1, 3); \ - PUTFUNC(dst_2, py_2, pa_2, 3, abase); \ - PUTFUNC(dst_1, py_1, pa_1, 3, abase); \ + LOADCHROMA(1, 3); \ + PUTFUNC(2, 3, abase); \ + PUTFUNC(1, 3, abase); \ ENDYUV2RGBLINE(dst_delta, 0, alpha, 0) \ - LOADCHROMA(pu_1, pv_1, 0); \ - PUTFUNC(dst_1, py_1, pa_1, 0, abase); \ - PUTFUNC(dst_2, py_2, pa_2, 0, abase); \ + LOADCHROMA(1, 0); \ + PUTFUNC(1, 0, abase); \ + PUTFUNC(2, 0, abase); \ \ - LOADCHROMA(pu_1, pv_1, 1); \ - PUTFUNC(dst_2, py_2, pa_2, 1, abase); \ - PUTFUNC(dst_1, py_1, pa_1, 1, abase); \ + LOADCHROMA(1, 1); \ + PUTFUNC(2, 1, abase); \ + PUTFUNC(1, 1, abase); \ ENDYUV2RGBLINE(dst_delta, 1, alpha, 0) \ - LOADCHROMA(pu_1, pv_1, 0); \ - PUTFUNC(dst_1, py_1, pa_1, 0, abase); \ - PUTFUNC(dst_2, py_2, pa_2, 0, abase); \ + LOADCHROMA(1, 0); \ + PUTFUNC(1, 0, abase); \ + PUTFUNC(2, 0, abase); \ ENDYUV2RGBFUNC() #define YUV422FUNC(func_name, dst_type, alpha, abase, PUTFUNC, dst_delta) \ YUV2RGBFUNC(func_name, dst_type, alpha, 1) \ - LOADCHROMA(pu_1, pv_1, 0); \ - PUTFUNC(dst_1, py_1, pa_1, 0, abase); \ + LOADCHROMA(1, 0); \ + PUTFUNC(1, 0, abase); \ \ - LOADCHROMA(pu_2, pv_2, 0); \ - PUTFUNC(dst_2, py_2, pa_2, 0, abase); \ + LOADCHROMA(2, 0); \ + PUTFUNC(2, 0, abase); \ \ - LOADCHROMA(pu_2, pv_2, 1); \ - PUTFUNC(dst_2, py_2, pa_2, 1, abase); \ + LOADCHROMA(2, 1); \ + PUTFUNC(2, 1, abase); \ \ - LOADCHROMA(pu_1, pv_1, 1); \ - PUTFUNC(dst_1, py_1, pa_1, 1, abase); \ + LOADCHROMA(1, 1); \ + PUTFUNC(1, 1, abase); \ \ - LOADCHROMA(pu_1, pv_1, 2); \ - PUTFUNC(dst_1, py_1, pa_1, 2, abase); \ + LOADCHROMA(1, 2); \ + PUTFUNC(1, 2, abase); \ \ - LOADCHROMA(pu_2, pv_2, 2); \ - PUTFUNC(dst_2, py_2, pa_2, 2, abase); \ + LOADCHROMA(2, 2); \ + PUTFUNC(2, 2, abase); \ \ - LOADCHROMA(pu_2, pv_2, 3); \ - PUTFUNC(dst_2, py_2, pa_2, 3, abase); \ + LOADCHROMA(2, 3); \ + PUTFUNC(2, 3, abase); \ \ - LOADCHROMA(pu_1, pv_1, 3); \ - PUTFUNC(dst_1, py_1, pa_1, 3, abase); \ + LOADCHROMA(1, 3); \ + PUTFUNC(1, 3, abase); \ ENDYUV2RGBLINE(dst_delta, 0, alpha, 1) \ - LOADCHROMA(pu_1, pv_1, 0); \ - PUTFUNC(dst_1, py_1, pa_1, 0, abase); \ + LOADCHROMA(1, 0); \ + PUTFUNC(1, 0, abase); \ \ - LOADCHROMA(pu_2, pv_2, 0); \ - PUTFUNC(dst_2, py_2, pa_2, 0, abase); \ + LOADCHROMA(2, 0); \ + PUTFUNC(2, 0, abase); \ \ - LOADCHROMA(pu_2, pv_2, 1); \ - PUTFUNC(dst_2, py_2, pa_2, 1, abase); \ + LOADCHROMA(2, 1); \ + PUTFUNC(2, 1, abase); \ \ - LOADCHROMA(pu_1, pv_1, 1); \ - PUTFUNC(dst_1, py_1, pa_1, 1, abase); \ + LOADCHROMA(1, 1); \ + PUTFUNC(1, 1, abase); \ ENDYUV2RGBLINE(dst_delta, 1, alpha, 1) \ - LOADCHROMA(pu_1, pv_1, 0); \ - PUTFUNC(dst_1, py_1, pa_1, 0, abase); \ + LOADCHROMA(1, 0); \ + PUTFUNC(1, 0, abase); \ \ - LOADCHROMA(pu_2, pv_2, 0); \ - PUTFUNC(dst_2, py_2, pa_2, 0, abase); \ + LOADCHROMA(2, 0); \ + PUTFUNC(2, 0, abase); \ ENDYUV2RGBFUNC() #define YUV420FUNC_DITHER(func_name, dst_type, LOADDITHER, PUTFUNC, dst_delta) \ YUV2RGBFUNC(func_name, dst_type, 0, 0) \ LOADDITHER \ \ - LOADCHROMA(pu_1, pv_1, 0); \ - PUTFUNC(dst_1, py_1, 0, 0); \ - PUTFUNC(dst_2, py_2, 0, 0 + 8); \ + LOADCHROMA(1, 0); \ + PUTFUNC(1, 0, 0); \ + PUTFUNC(2, 0, 0 + 8); \ \ - LOADCHROMA(pu_1, pv_1, 1); \ - PUTFUNC(dst_2, py_2, 1, 2 + 8); \ - PUTFUNC(dst_1, py_1, 1, 2); \ + LOADCHROMA(1, 1); \ + PUTFUNC(2, 1, 2 + 8); \ + PUTFUNC(1, 1, 2); \ \ - LOADCHROMA(pu_1, pv_1, 2); \ - PUTFUNC(dst_1, py_1, 2, 4); \ - PUTFUNC(dst_2, py_2, 2, 4 + 8); \ + LOADCHROMA(1, 2); \ + PUTFUNC(1, 2, 4); \ + PUTFUNC(2, 2, 4 + 8); \ \ - LOADCHROMA(pu_1, pv_1, 3); \ - PUTFUNC(dst_2, py_2, 3, 6 + 8); \ - PUTFUNC(dst_1, py_1, 3, 6); \ + LOADCHROMA(1, 3); \ + PUTFUNC(2, 3, 6 + 8); \ + PUTFUNC(1, 3, 6); \ ENDYUV2RGBLINE(dst_delta, 0, 0, 0) \ LOADDITHER \ \ - LOADCHROMA(pu_1, pv_1, 0); \ - PUTFUNC(dst_1, py_1, 0, 0); \ - PUTFUNC(dst_2, py_2, 0, 0 + 8); \ + LOADCHROMA(1, 0); \ + PUTFUNC(1, 0, 0); \ + PUTFUNC(2, 0, 0 + 8); \ \ - LOADCHROMA(pu_1, pv_1, 1); \ - PUTFUNC(dst_2, py_2, 1, 2 + 8); \ - PUTFUNC(dst_1, py_1, 1, 2); \ + LOADCHROMA(1, 1); \ + PUTFUNC(2, 1, 2 + 8); \ + PUTFUNC(1, 1, 2); \ ENDYUV2RGBLINE(dst_delta, 1, 0, 0) \ LOADDITHER \ \ - LOADCHROMA(pu_1, pv_1, 0); \ - PUTFUNC(dst_1, py_1, 0, 0); \ - PUTFUNC(dst_2, py_2, 0, 0 + 8); \ + LOADCHROMA(1, 0); \ + PUTFUNC(1, 0, 0); \ + PUTFUNC(2, 0, 0 + 8); \ ENDYUV2RGBFUNC() #define YUV422FUNC_DITHER(func_name, dst_type, LOADDITHER, PUTFUNC, dst_delta) \ YUV2RGBFUNC(func_name, dst_type, 0, 1) \ LOADDITHER \ \ - LOADCHROMA(pu_1, pv_1, 0); \ - PUTFUNC(dst_1, py_1, 0, 0); \ + LOADCHROMA(1, 0); \ + PUTFUNC(1, 0, 0); \ \ - LOADCHROMA(pu_2, pv_2, 0); \ - PUTFUNC(dst_2, py_2, 0, 0 + 8); \ + LOADCHROMA(2, 0); \ + PUTFUNC(2, 0, 0 + 8); \ \ - LOADCHROMA(pu_2, pv_2, 1); \ - PUTFUNC(dst_2, py_2, 1, 2 + 8); \ + LOADCHROMA(2, 1); \ + PUTFUNC(2, 1, 2 + 8); \ \ - LOADCHROMA(pu_1, pv_1, 1); \ - PUTFUNC(dst_1, py_1, 1, 2); \ + LOADCHROMA(1, 1); \ + PUTFUNC(1, 1, 2); \ \ - LOADCHROMA(pu_1, pv_1, 2); \ - PUTFUNC(dst_1, py_1, 2, 4); \ + LOADCHROMA(1, 2); \ + PUTFUNC(1, 2, 4); \ \ - LOADCHROMA(pu_2, pv_2, 2); \ - PUTFUNC(dst_2, py_2, 2, 4 + 8); \ + LOADCHROMA(2, 2); \ + PUTFUNC(2, 2, 4 + 8); \ \ - LOADCHROMA(pu_2, pv_2, 3); \ - PUTFUNC(dst_2, py_2, 3, 6 + 8); \ + LOADCHROMA(2, 3); \ + PUTFUNC(2, 3, 6 + 8); \ \ - LOADCHROMA(pu_1, pv_1, 3); \ - PUTFUNC(dst_1, py_1, 3, 6); \ + LOADCHROMA(1, 3); \ + PUTFUNC(1, 3, 6); \ ENDYUV2RGBLINE(dst_delta, 0, 0, 1) \ LOADDITHER \ \ - LOADCHROMA(pu_1, pv_1, 0); \ - PUTFUNC(dst_1, py_1, 0, 0); \ + LOADCHROMA(1, 0); \ + PUTFUNC(1, 0, 0); \ \ - LOADCHROMA(pu_2, pv_2, 0); \ - PUTFUNC(dst_2, py_2, 0, 0 + 8); \ + LOADCHROMA(2, 0); \ + PUTFUNC(2, 0, 0 + 8); \ \ - LOADCHROMA(pu_2, pv_2, 1); \ - PUTFUNC(dst_2, py_2, 1, 2 + 8); \ + LOADCHROMA(2, 1); \ + PUTFUNC(2, 1, 2 + 8); \ \ - LOADCHROMA(pu_1, pv_1, 1); \ - PUTFUNC(dst_1, py_1, 1, 2); \ + LOADCHROMA(1, 1); \ + PUTFUNC(1, 1, 2); \ ENDYUV2RGBLINE(dst_delta, 1, 0, 1) \ LOADDITHER \ \ - LOADCHROMA(pu_1, pv_1, 0); \ - PUTFUNC(dst_1, py_1, 0, 0); \ + LOADCHROMA(1, 0); \ + PUTFUNC(1, 0, 0); \ \ - LOADCHROMA(pu_2, pv_2, 0); \ - PUTFUNC(dst_2, py_2, 0, 0 + 8); \ + LOADCHROMA(2, 0); \ + PUTFUNC(2, 0, 0 + 8); \ ENDYUV2RGBFUNC() #define LOADDITHER16 \ @@ -350,86 +350,86 @@ const int *sws_getCoefficients(int colorspace) const uint8_t *e16 = ff_dither_2x2_4[y & 1]; \ const uint8_t *f16 = ff_dither_2x2_8[(y & 1)^1]; -#define PUTRGB16(dst, src, i, o) \ - Y = src[2 * i]; \ - dst[2 * i] = r[Y + d16[0 + o]] + \ - g[Y + e16[0 + o]] + \ - b[Y + f16[0 + o]]; \ - Y = src[2 * i + 1]; \ - dst[2 * i + 1] = r[Y + d16[1 + o]] + \ - g[Y + e16[1 + o]] + \ - b[Y + f16[1 + o]]; +#define PUTRGB16(l, i, o) \ + Y = py_##l[2 * i]; \ + dst_##l[2 * i] = r[Y + d16[0 + o]] + \ + g[Y + e16[0 + o]] + \ + b[Y + f16[0 + o]]; \ + Y = py_##l[2 * i + 1]; \ + dst_##l[2 * i + 1] = r[Y + d16[1 + o]] + \ + g[Y + e16[1 + o]] + \ + b[Y + f16[1 + o]]; #define LOADDITHER15 \ const uint8_t *d16 = ff_dither_2x2_8[y & 1]; \ const uint8_t *e16 = ff_dither_2x2_8[(y & 1)^1]; -#define PUTRGB15(dst, src, i, o) \ - Y = src[2 * i]; \ - dst[2 * i] = r[Y + d16[0 + o]] + \ - g[Y + d16[1 + o]] + \ - b[Y + e16[0 + o]]; \ - Y = src[2 * i + 1]; \ - dst[2 * i + 1] = r[Y + d16[1 + o]] + \ - g[Y + d16[0 + o]] + \ - b[Y + e16[1 + o]]; +#define PUTRGB15(l, i, o) \ + Y = py_##l[2 * i]; \ + dst_##l[2 * i] = r[Y + d16[0 + o]] + \ + g[Y + d16[1 + o]] + \ + b[Y + e16[0 + o]]; \ + Y = py_##l[2 * i + 1]; \ + dst_##l[2 * i + 1] = r[Y + d16[1 + o]] + \ + g[Y + d16[0 + o]] + \ + b[Y + e16[1 + o]]; #define LOADDITHER12 \ const uint8_t *d16 = ff_dither_4x4_16[y & 3]; -#define PUTRGB12(dst, src, i, o) \ - Y = src[2 * i]; \ - dst[2 * i] = r[Y + d16[0 + o]] + \ - g[Y + d16[0 + o]] + \ - b[Y + d16[0 + o]]; \ - Y = src[2 * i + 1]; \ - dst[2 * i + 1] = r[Y + d16[1 + o]] + \ - g[Y + d16[1 + o]] + \ - b[Y + d16[1 + o]]; +#define PUTRGB12(l, i, o) \ + Y = py_##l[2 * i]; \ + dst_##l[2 * i] = r[Y + d16[0 + o]] + \ + g[Y + d16[0 + o]] + \ + b[Y + d16[0 + o]]; \ + Y = py_##l[2 * i + 1]; \ + dst_##l[2 * i + 1] = r[Y + d16[1 + o]] + \ + g[Y + d16[1 + o]] + \ + b[Y + d16[1 + o]]; #define LOADDITHER8 \ const uint8_t *d32 = ff_dither_8x8_32[yd & 7]; \ const uint8_t *d64 = ff_dither_8x8_73[yd & 7]; -#define PUTRGB8(dst, src, i, o) \ - Y = src[2 * i]; \ - dst[2 * i] = r[Y + d32[0 + o]] + \ - g[Y + d32[0 + o]] + \ - b[Y + d64[0 + o]]; \ - Y = src[2 * i + 1]; \ - dst[2 * i + 1] = r[Y + d32[1 + o]] + \ - g[Y + d32[1 + o]] + \ - b[Y + d64[1 + o]]; +#define PUTRGB8(l, i, o) \ + Y = py_##l[2 * i]; \ + dst_##l[2 * i] = r[Y + d32[0 + o]] + \ + g[Y + d32[0 + o]] + \ + b[Y + d64[0 + o]]; \ + Y = py_##l[2 * i + 1]; \ + dst_##l[2 * i + 1] = r[Y + d32[1 + o]] + \ + g[Y + d32[1 + o]] + \ + b[Y + d64[1 + o]]; #define LOADDITHER4D \ const uint8_t * d64 = ff_dither_8x8_73[yd & 7]; \ const uint8_t *d128 = ff_dither_8x8_220[yd & 7]; \ int acc; -#define PUTRGB4D(dst, src, i, o) \ - Y = src[2 * i]; \ +#define PUTRGB4D(l, i, o) \ + Y = py_##l[2 * i]; \ acc = r[Y + d128[0 + o]] + \ g[Y + d64[0 + o]] + \ b[Y + d128[0 + o]]; \ - Y = src[2 * i + 1]; \ + Y = py_##l[2 * i + 1]; \ acc |= (r[Y + d128[1 + o]] + \ g[Y + d64[1 + o]] + \ b[Y + d128[1 + o]]) << 4; \ - dst[i] = acc; + dst_##l[i] = acc; #define LOADDITHER4DB \ const uint8_t *d64 = ff_dither_8x8_73[yd & 7]; \ const uint8_t *d128 = ff_dither_8x8_220[yd & 7]; -#define PUTRGB4DB(dst, src, i, o) \ - Y = src[2 * i]; \ - dst[2 * i] = r[Y + d128[0 + o]] + \ - g[Y + d64[0 + o]] + \ - b[Y + d128[0 + o]]; \ - Y = src[2 * i + 1]; \ - dst[2 * i + 1] = r[Y + d128[1 + o]] + \ - g[Y + d64[1 + o]] + \ - b[Y + d128[1 + o]]; +#define PUTRGB4DB(l, i, o) \ + Y = py_##l[2 * i]; \ + dst_##l[2 * i] = r[Y + d128[0 + o]] + \ + g[Y + d64[0 + o]] + \ + b[Y + d128[0 + o]]; \ + Y = py_##l[2 * i + 1]; \ + dst_##l[2 * i + 1] = r[Y + d128[1 + o]] + \ + g[Y + d64[1 + o]] + \ + b[Y + d128[1 + o]]; YUV2RGBFUNC(yuv2rgb_c_1_ordered_dither, uint8_t, 0, 0) const uint8_t *d128 = ff_dither_8x8_220[yd & 7]; -- 2.30.2 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2024-08-06 10:51 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-08-06 10:51 [FFmpeg-devel] [PATCH v2 0/5] swscale/yuv2rgb: add yuv42{0, 2}p -> gbrp unscaled colorspace converters Ramiro Polla 2024-08-06 10:51 ` Ramiro Polla [this message] 2024-08-06 10:51 ` [FFmpeg-devel] [PATCH v2 2/5] swscale/yuv2rgb: prepare YUV2RGBFUNC macro for multi-planar rgb Ramiro Polla 2024-08-06 10:51 ` [FFmpeg-devel] [PATCH v2 3/5] swscale/yuv2rgb: add yuv42{0, 2}p -> gbrp unscaled colorspace converters Ramiro Polla 2024-08-06 10:51 ` [FFmpeg-devel] [PATCH v2 4/5] swscale/x86/yuv2rgb: add ssse3 " Ramiro Polla 2024-08-06 10:51 ` [FFmpeg-devel] [PATCH v2 5/5] swscale/aarch64/yuv2rgb: add neon " Ramiro Polla 2024-08-14 12:23 ` Martin Storsjö 2024-08-15 14:32 ` [FFmpeg-devel] [PATCH v2 0/5] swscale/yuv2rgb: add " Ramiro Polla
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20240806105106.59866-2-ramiro.polla@gmail.com \ --to=ramiro.polla@gmail.com \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git