Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ea32a58

Browse files
committedMar 23, 2023
Added rotation sample code.
Signed-off-by: Furong Zhang <[email protected]>
1 parent 4cd4308 commit ea32a58

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed
 
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Configuration information for video process test case.
2+
# This application will firstly load yuv frames to one type of surface(NV12/YV12/I420)
3+
# you require. After video processing, the processed content (NV12/YV12/I420 surface)
4+
# will be stored to frames(yv12 format in file).
5+
# Supported features include scaling and implicit format conversion(NV12<->YV12<->I420).
6+
# you can modify this configuration file to set the corresponding parameters.
7+
8+
#1.Source YUV(RGB) file information
9+
SRC_FILE_NAME: ./bigship_1280_720p_25fps_10frames_writer1280x720_noised.nv12
10+
SRC_FRAME_WIDTH: 1280
11+
SRC_FRAME_HEIGHT: 720
12+
SRC_FRAME_FORMAT: NV12
13+
14+
#Note .nv12 files are in NV12 format
15+
SRC_FILE_FORMAT: NV12
16+
17+
#2.Destination YUV(RGB) file information
18+
DST_FILE_NAME: ./scaling_out_720x1280.nv12
19+
DST_FRAME_WIDTH: 720
20+
DST_FRAME_HEIGHT: 1280
21+
DST_FRAME_FORMAT: NV12
22+
23+
DST_FILE_FORMAT: NV12
24+
25+
#3.How many frames to be processed
26+
FRAME_SUM: 1
27+
28+
#4.How to use this template
29+
#./vppscaling_csc process_rotation.cfg.template

‎videoprocess/vppscaling_csc.cpp

+21-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009-2018, Intel Corporation
2+
* Copyright (c) 2009-2023, Intel Corporation
33
*
44
* Permission is hereby granted, free of charge, to any person obtaining a
55
* copy of this software and associated documentation files (the "Software"),
@@ -74,6 +74,7 @@ static uint32_t g_src_file_fourcc = VA_FOURCC('I', '4', '2', '0');
7474
static uint32_t g_dst_file_fourcc = VA_FOURCC('Y', 'V', '1', '2');
7575

7676
static uint32_t g_frame_count = 0;
77+
static uint32_t g_rotation_angle = 0;
7778

7879
static int8_t
7980
read_value_string(FILE *fp, const char* field_name, char* value)
@@ -1003,6 +1004,10 @@ video_frame_process(VASurfaceID in_surface_id,
10031004
pipeline_param.surface = in_surface_id;
10041005
pipeline_param.surface_region = &surface_region;
10051006
pipeline_param.output_region = &output_region;
1007+
if (g_rotation_angle == 1 )
1008+
{
1009+
pipeline_param.rotation_state = VA_ROTATION_90;
1010+
}
10061011

10071012
va_status = vaCreateBuffer(va_dpy,
10081013
context_id,
@@ -1105,6 +1110,20 @@ vpp_context_create()
11051110
1,
11061111
&context_id);
11071112
CHECK_VASTATUS(va_status, "vaCreateContext");
1113+
1114+
VABufferID *filters = nullptr;
1115+
unsigned int num_filters = 0;
1116+
VAProcPipelineCaps pipeline_caps = {};
1117+
va_status = vaQueryVideoProcPipelineCaps(va_dpy,
1118+
context_id,
1119+
filters,
1120+
num_filters,
1121+
&pipeline_caps);
1122+
CHECK_VASTATUS(va_status, "vaQueryVideoProcPipeineCaps");
1123+
if (pipeline_caps.rotation_flags & (1 << VA_ROTATION_90)) {
1124+
printf("Clockwise rotation by 90 degrees is supported!\n");
1125+
}
1126+
11081127
return va_status;
11091128
}
11101129

@@ -1190,6 +1209,7 @@ parse_basic_parameters()
11901209
parse_fourcc_and_format(str, &g_dst_file_fourcc, NULL);
11911210

11921211
read_value_uint32(g_config_file_fd, "FRAME_SUM", &g_frame_count);
1212+
read_value_uint32(g_config_file_fd, "ROTATION", &g_rotation_angle);
11931213

11941214
if (g_in_pic_width != g_out_pic_width ||
11951215
g_in_pic_height != g_out_pic_height)

0 commit comments

Comments
 (0)
Please sign in to comment.