Skip to content

Commit

Permalink
Test vaCreateImage
Browse files Browse the repository at this point in the history
Signed-off-by: Xu, Zhengguo <[email protected]>
  • Loading branch information
Jexu committed May 14, 2024
1 parent e8ac3cc commit 9f1036c
Showing 1 changed file with 11 additions and 22 deletions.
33 changes: 11 additions & 22 deletions decode/test_surface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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<VASurfaceID> 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<VASurfaceID>::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);
Expand Down

0 comments on commit 9f1036c

Please sign in to comment.