[FFmpeg-cvslog] swscale/yuv2rgb: prepare LOADCHROMA/PUTFUNC macros for multi-planar rgb
Ramiro Polla
git at videolan.org
Sun Aug 18 23:27:43 EEST 2024
ffmpeg | branch: master | Ramiro Polla <ramiro.polla at gmail.com> | Tue Aug 6 12:51:02 2024 +0200| [24063e7827b897adca7321ddf9621b0a92d4d532] | committer: Ramiro Polla
swscale/yuv2rgb: prepare LOADCHROMA/PUTFUNC macros for multi-planar rgb
This will be used in the upcoming yuv42{0,2}p -> gbrp unscaled
colorspace converters.
There is no difference in performance.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=24063e7827b897adca7321ddf9621b0a92d4d532
---
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];
More information about the ffmpeg-cvslog
mailing list