summaryrefslogtreecommitdiff
path: root/yuvbench/yuvbench_libyuv.c
diff options
context:
space:
mode:
authorhunter@kvog.sh <hunter@kvog.sh>2026-03-02 18:53:11 -0600
committerhunter@kvog.sh <hunter@kvog.sh>2026-03-02 18:53:11 -0600
commit4fb7c337caedc0ecae9b59afbc155ba540ce45df (patch)
treed22e1c8b794433ae783dad43ddff080f6c081286 /yuvbench/yuvbench_libyuv.c
parentbc9b8e5e18674127d4930b12ce8e64dbcace1689 (diff)
yuvbench: libyuv
Diffstat (limited to 'yuvbench/yuvbench_libyuv.c')
-rw-r--r--yuvbench/yuvbench_libyuv.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/yuvbench/yuvbench_libyuv.c b/yuvbench/yuvbench_libyuv.c
new file mode 100644
index 0000000..64da249
--- /dev/null
+++ b/yuvbench/yuvbench_libyuv.c
@@ -0,0 +1,21 @@
+#include "yuvbench.h"
+
+#include <libyuv.h>
+#include <libyuv/convert_argb.h>
+
+static bool yuvbench_libyuv_convert(Ctx* ctx)
+{
+ const uint32_t w = ctx->inp_w;
+ const uint32_t h = ctx->inp_h;
+ const uint8_t* Y = (const uint8_t*)ctx->inp_buf;
+ const uint8_t* Cb = Y + (w * h);
+ const uint8_t* Cr = Cb + (w / 2 * h / 2);
+ return I420ToRAW(Y, w, Cb, w / 2, Cr, w / 2, ctx->out_buf, w * 3, w, h) == 0;
+}
+
+Backend yuvbench_libyuv(void)
+{
+ Backend b = { 0 };
+ b.convert_fn = yuvbench_libyuv_convert;
+ return b;
+}