Skip to content

Commit

Permalink
Added rotation sample code.
Browse files Browse the repository at this point in the history
Signed-off-by: Furong Zhang <[email protected]>
  • Loading branch information
FurongZhang committed Mar 23, 2023
1 parent 4cd4308 commit fda8598
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 2 deletions.
29 changes: 29 additions & 0 deletions videoprocess/process_rotation.cfg.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Configuration information for video process test case.
# This application will firstly load yuv frames to one type of surface(NV12/YV12/I420)
# you require. After video processing, the processed content (NV12/YV12/I420 surface)
# will be stored to frames(yv12 format in file).
# Supported features include scaling and implicit format conversion(NV12<->YV12<->I420).
# you can modify this configuration file to set the corresponding parameters.

#1.Source YUV(RGB) file information
SRC_FILE_NAME: ./bigship_1280_720p_25fps_10frames_writer1280x720_noised.nv12
SRC_FRAME_WIDTH: 1280
SRC_FRAME_HEIGHT: 720
SRC_FRAME_FORMAT: NV12

#Note .nv12 files are in NV12 format
SRC_FILE_FORMAT: NV12

#2.Destination YUV(RGB) file information
DST_FILE_NAME: ./scaling_out_720x1280.nv12
DST_FRAME_WIDTH: 720
DST_FRAME_HEIGHT: 1280
DST_FRAME_FORMAT: NV12

DST_FILE_FORMAT: NV12

#3.How many frames to be processed
FRAME_SUM: 1

#4.How to use this template
#./vppscaling_csc process_rotation.cfg.template
19 changes: 17 additions & 2 deletions videoprocess/vppscaling_csc.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2018, Intel Corporation
* Copyright (c) 2009-2023, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
Expand Down Expand Up @@ -1002,7 +1002,8 @@ video_frame_process(VASurfaceID in_surface_id,
memset(&pipeline_param, 0, sizeof(pipeline_param));
pipeline_param.surface = in_surface_id;
pipeline_param.surface_region = &surface_region;
pipeline_param.output_region = &output_region;
pipeline_param.output_region = &output_region;
pipeline_param.rotation_state = VA_ROTATION_90;

va_status = vaCreateBuffer(va_dpy,
context_id,
Expand Down Expand Up @@ -1105,6 +1106,20 @@ vpp_context_create()
1,
&context_id);
CHECK_VASTATUS(va_status, "vaCreateContext");

VABufferID *filters = nullptr;
unsigned int num_filters = 0;
VAProcPipelineCaps pipeline_caps = {};
va_status = vaQueryVideoProcPipelineCaps(va_dpy,
context_id,
filters,
num_filters,
&pipeline_caps);
CHECK_VASTATUS(va_status, "vaQueryVideoProcPipeineCaps");
if (pipeline_caps.rotation_flags & (1 << VA_ROTATION_90)) {
printf("Clockwise rotation by 90 degrees is supported!\n");
}

return va_status;
}

Expand Down

0 comments on commit fda8598

Please sign in to comment.