summaryrefslogtreecommitdiff
path: root/yuvbench/yuvbench.c
diff options
context:
space:
mode:
authorHunter Kvalevog <hunter@kvog.sh>2026-02-26 21:46:32 -0600
committerHunter Kvalevog <hunter@kvog.sh>2026-02-26 21:46:32 -0600
commita288d2b6836d398098098cf69e4f88db7799f49e (patch)
tree72471a450544ec9ec9f575500c2bb62cc9cc9136 /yuvbench/yuvbench.c
parent7633174bd62a47a50e0f7512b3094bd6a7c53b19 (diff)
yuvbench: libswscale
Diffstat (limited to 'yuvbench/yuvbench.c')
-rw-r--r--yuvbench/yuvbench.c49
1 files changed, 33 insertions, 16 deletions
diff --git a/yuvbench/yuvbench.c b/yuvbench/yuvbench.c
index 5ef344c..095104e 100644
--- a/yuvbench/yuvbench.c
+++ b/yuvbench/yuvbench.c
@@ -9,6 +9,9 @@ Backend yuvbench_accelerate(void);
#ifdef YUVBENCH_BAD
Backend yuvbench_bad(void);
#endif
+#ifdef YUVBENCH_SWSCALE
+Backend yuvbench_swscale(void);
+#endif
static struct
{
@@ -18,6 +21,7 @@ static struct
size_t inp_len;
void* out_buf;
size_t out_len;
+ bool show;
} G = { 0 };
static void run_backend(Backend b)
@@ -79,22 +83,25 @@ static void run_backend(Backend b)
printf("max result: %fms\n", ts_max * 1000.0f);
printf("avg result: %fms\n", ts_avg * 1000.0f);
-#if 0 && (defined(__APPLE__) || defined(__linux__))
- // Display last result
- char cmd[512] = { 0 };
- snprintf(cmd, sizeof(cmd), "ffplay -f rawvideo -pixel_format rgb24 -video_size %dx%d -", G.inp_w, G.inp_h);
- FILE* pipe_fp = popen(cmd, "w");
- if (!pipe_fp) {
- printf("Failed to open ffplay: %s\n", strerror(errno));
- abort();
- }
- fwrite(G.out_buf, 1, G.out_len, pipe_fp);
- fflush(pipe_fp);
- if (pclose(pipe_fp) == -1) {
- printf("Failed to close ffplay: %s\n", strerror(errno));
- abort();
- }
+
+ if (G.show) {
+ // Display last result
+#if 1 && (defined(__APPLE__) || defined(__linux__))
+ char cmd[512] = { 0 };
+ snprintf(cmd, sizeof(cmd), "ffplay -hide_banner -f rawvideo -pixel_format rgb24 -video_size %dx%d -", G.inp_w, G.inp_h);
+ FILE* pipe_fp = popen(cmd, "w");
+ if (!pipe_fp) {
+ printf("Failed to open ffplay: %s\n", strerror(errno));
+ abort();
+ }
+ fwrite(G.out_buf, 1, G.out_len, pipe_fp);
+ fflush(pipe_fp);
+ if (pclose(pipe_fp) == -1) {
+ printf("Failed to close ffplay: %s\n", strerror(errno));
+ abort();
+ }
#endif
+ }
}
int main(int argc, char** argv)
@@ -159,6 +166,14 @@ int main(int argc, char** argv)
fread(G.inp_buf, 1, G.inp_len, f);
fclose(f);
}
+
+ // Parse other CLI
+ for (int i = 2; i < argc; ++i) {
+ const char* s = argv[i];
+ if (!strcmp(s, "show")) {
+ G.show = true;
+ }
+ }
printf("Input image is %dx%d YUV 4:2:0\n", G.inp_w, G.inp_h);
printf("Input buffer size: %lu\n", G.inp_len);
// 1x full res luminance plane + 2x half res chroma planes
@@ -176,5 +191,7 @@ int main(int argc, char** argv)
#ifdef YUVBENCH_BAD
run_backend(yuvbench_bad());
#endif
-
+#ifdef YUVBENCH_SWSCALE
+ run_backend(yuvbench_swscale());
+#endif
}