From 9f1036c8e8280471337866f57b8f1175806b0c04 Mon Sep 17 00:00:00 2001 From: "Xu, Zhengguo" Date: Tue, 14 May 2024 13:14:01 +0800 Subject: [PATCH] Test vaCreateImage Signed-off-by: Xu, Zhengguo --- decode/test_surface.cpp | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/decode/test_surface.cpp b/decode/test_surface.cpp index 8efd746..849fd55 100644 --- a/decode/test_surface.cpp +++ b/decode/test_surface.cpp @@ -56,7 +56,7 @@ if (va_status != VA_STATUS_SUCCESS) { \ #define CLIP_WIDTH 1920 -#define CLIP_HEIGHT 1080 +#define CLIP_HEIGHT 1920 VADisplay openDriver(char *device_paths) { @@ -88,28 +88,17 @@ int main(int argc, char **argv) va_dpy = openDriver(argv[1]); va_status = vaInitialize(va_dpy, &major_ver, &minor_ver); assert(va_status == VA_STATUS_SUCCESS); - std::vector surfacesPool; - start_time = clock(); - for (uint32_t i = 0; i < 168; i++) - { - VASurfaceID surface_id; - va_status = vaCreateSurfaces( - va_dpy, - VA_RT_FORMAT_YUV420, CLIP_WIDTH, CLIP_HEIGHT, - &surface_id, 1, - NULL, 0 - ); - CHECK_VASTATUS(va_status, "vaCreateSurfaces"); - surfacesPool.push_back(surface_id); - } - end_time = clock(); - execution_time_ms = ((double)(end_time - start_time) * 1000) / CLOCKS_PER_SEC; - printf("168 * 1080p y420 surfaces execution time = %f \n", execution_time_ms); - for (std::vector::iterator it = surfacesPool.begin(); it != surfacesPool.end(); it++) - { - vaDestroySurfaces(va_dpy, &*it, 1); - } + VAImage csc_dst_fourcc_image; + VAImageFormat image_format; + image_format.fourcc = VA_FOURCC_NV12; + image_format.byte_order = VA_LSB_FIRST; + image_format.bits_per_pixel = 16; + + va_status = vaCreateImage(va_dpy, &image_format, + 16, 16384, + &csc_dst_fourcc_image); + CHECK_VASTATUS(va_status, "vaCreateImage"); vaTerminate(va_dpy); va_close_display(va_dpy);