diff options
author | Sirisha Muppavarapu <sirisha.muppavarapu@intel.com> | 2014-03-27 16:01:24 -0700 |
---|---|---|
committer | Xiang, Haihao <haihao.xiang@intel.com> | 2014-03-31 14:40:32 +0800 |
commit | d842f0a3ead81d550d26b1d2fa35e4510b8238af (patch) | |
tree | 3177897628c2a9d9c20f25832a096fea215b113e | |
parent | 708ec2979b52647ce4744d181d964c413e98cc11 (diff) | |
download | libva-d842f0a3ead81d550d26b1d2fa35e4510b8238af.tar.gz |
VPP: Add STDE(Skin tone detection and enhancement) test case.
In this commit, I added a testcase for VPP-STDE feature.
I also made relevant changes to the methods and the config file.
-rw-r--r-- | test/videoprocess/process.cfg | 41 | ||||
-rw-r--r-- | test/videoprocess/videoprocess.cpp | 48 |
2 files changed, 64 insertions, 25 deletions
diff --git a/test/videoprocess/process.cfg b/test/videoprocess/process.cfg index a11a0a4..aac5fef 100644 --- a/test/videoprocess/process.cfg +++ b/test/videoprocess/process.cfg @@ -1,33 +1,37 @@ -#Configuration information for video process test case. -# This application will firstly loads frames(yv12 format in file) 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 including: denoise, deinterlacing, sharpening, color balance, -# blending and implicit format conversion(NV12<->YV12<->I420), each time only one -# kind of processing will be executed in test application, although libva supports -# multiply filters execution in one time. you can modify this configure to set the +# 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: denoise, deinterlacing, sharpening, color balance, skintone +# detection/enhancement, blending and implicit format conversion(NV12<->YV12<->I420). Each +# time only one kind of processing will be executed in test application. Although libva supports +# multiple filters execution in one time. you can modify this configuration file to set the # filter and the corresponding parameters. #1.Source YUV(RGB) file information -SRC_FILE_NAME: /root/clips/YUV/bus_cif.yv12 -SRC_FRAME_WIDTH: 352 -SRC_FRAME_HEIGHT: 288 +#SRC_FILE_NAME: /root/clips/YUV/bus_cif.yv12 +SRC_FILE_NAME: ./kid1.yuv +SRC_FRAME_WIDTH: 1024 +SRC_FRAME_HEIGHT: 768 SRC_FRAME_FORMAT: NV12 +#Note .yv12 files are in YV12 format and .yuv used above for STDE is in I420 format +SRC_FILE_FORMAT: I420 + #2.Destination YUV(RGB) file information -DST_FILE_NAME: ./bus_cif_deinterlacing.yv12 -DST_FRAME_WIDTH: 352 -DST_FRAME_HEIGHT: 288 +DST_FILE_NAME: ./stde_output.yv12 +DST_FRAME_WIDTH: 1024 +DST_FRAME_HEIGHT: 768 DST_FRAME_FORMAT: NV12 #3.How many frames to be processed -FRAME_SUM: 10 +FRAME_SUM: 1 #4.VPP filter type and parameters, the following filters are supported: #(VAProcFilterNone,VAProcFilterNoiseReduction,VAProcFilterDeinterlacing, - # VAProcFilterSharpening,VAProcFilterColorBalance, + # VAProcFilterSharpening,VAProcFilterColorBalance,VAProcFilterSkinToneEnhancement # defalut VAProcFilterNone) -FILTER_TYPE: VAProcFilterDeinterlacing +FILTER_TYPE: VAProcFilterSkinToneEnhancement #5.VPP filter specific parameters. If they are not specified here, #default value will be applied then. @@ -44,7 +48,7 @@ DEINTERLACING_ALGORITHM: VAProcDeinterlacingBob #(VA_DEINTERLACING_BOTTOM_FIELD_FIRST | # VA_DEINTERLACING_BOTTOM_FIELD | - # VA_DEINTERLACING_ONE_FIELD, defalut 0) + # VA_DEINTERLACING_ONE_FIELD, default 0) DEINTERLACING_FLAGS: 0 #5.3 Sharpening parameters @@ -73,4 +77,3 @@ COLOR_BALANCE_SATURATION: 1.0 COLOR_BALANCE_BRIGHTNESS: 20 #(0.0 ~ 10.0, default 1.0) COLOR_BALANCE_CONTRAST: 1.2 - diff --git a/test/videoprocess/videoprocess.cpp b/test/videoprocess/videoprocess.cpp index 855fa14..f979c2a 100644 --- a/test/videoprocess/videoprocess.cpp +++ b/test/videoprocess/videoprocess.cpp @@ -65,6 +65,7 @@ static char g_config_file_name[MAX_LEN]; static char g_src_file_name[MAX_LEN]; static char g_dst_file_name[MAX_LEN]; static char g_filter_type_name[MAX_LEN]; +static char g_src_file_format[10]; static uint32_t g_in_pic_width = 352; static uint32_t g_in_pic_height = 288; @@ -251,9 +252,9 @@ construct_nv12_mask_surface(VASurfaceID surface_id, return VA_STATUS_SUCCESS; } -/* Load yv12 frame to NV12/YV12/I420 surface*/ +/* Load yuv frame to NV12/YV12/I420 surface*/ static VAStatus -upload_yv12_frame_to_yuv_surface(FILE *fp, +upload_yuv_frame_to_yuv_surface(FILE *fp, VASurfaceID surface_id) { VAStatus va_status; @@ -282,8 +283,13 @@ upload_yv12_frame_to_yuv_surface(FILE *fp, } while (n_items != 1); y_src = newImageBuffer; - v_src = newImageBuffer + surface_image.width * surface_image.height; - u_src = newImageBuffer + surface_image.width * surface_image.height * 5 / 4; + if (!strcmp(g_src_file_format, "I420")) { + u_src = newImageBuffer + surface_image.width * surface_image.height; + v_src = newImageBuffer + surface_image.width * surface_image.height * 5 / 4; + } else { + v_src = newImageBuffer + surface_image.width * surface_image.height; + u_src = newImageBuffer + surface_image.width * surface_image.height * 5 / 4; + } y_dst = (unsigned char *)((unsigned char*)surface_p + surface_image.offsets[0]); @@ -495,6 +501,30 @@ denoise_filter_init(VABufferID *filter_param_buf_id) return va_status; } +/* + * This is a method to initialize STDE filter. + * If this filter is called, it is enabled by default. + */ +static VAStatus +skintone_filter_init(VABufferID *filter_param_buf_id) +{ + VAStatus va_status = VA_STATUS_SUCCESS; + VAProcFilterParameterBuffer stde_param; + VABufferID stde_param_buf_id; + + stde_param.type = VAProcFilterSkinToneEnhancement; + stde_param.value = 0; + + va_status = vaCreateBuffer(va_dpy, context_id, + VAProcFilterParameterBufferType, sizeof(stde_param), 1, + &stde_param, &stde_param_buf_id); + CHECK_VASTATUS(va_status,"vaCreateBuffer"); + + *filter_param_buf_id = stde_param_buf_id; + + return va_status; +} + static VAStatus deinterlace_filter_init(VABufferID *filter_param_buf_id) { @@ -745,6 +775,9 @@ video_frame_process(VAProcFilterType filter_type, case VAProcFilterColorBalance: color_balance_filter_init(&filter_param_buf_id); break; + case VAProcFilterSkinToneEnhancement: + skintone_filter_init(&filter_param_buf_id); + break; default : filter_count = 0; break; @@ -993,6 +1026,7 @@ parse_basic_parameters() read_value_uint32(g_config_file_fd, "DST_FRAME_WIDTH", &g_out_pic_width); read_value_uint32(g_config_file_fd, "DST_FRAME_HEIGHT",&g_out_pic_height); read_value_string(g_config_file_fd, "DST_FRAME_FORMAT", str); + read_value_string(g_config_file_fd, "SRC_FILE_FORMAT", g_src_file_format); parse_fourcc_and_format(str, &g_out_fourcc, &g_out_format); read_value_uint32(g_config_file_fd, "FRAME_SUM", &g_frame_count); @@ -1011,6 +1045,8 @@ parse_basic_parameters() g_filter_type = VAProcFilterSharpening; else if (!strcmp(g_filter_type_name, "VAProcFilterColorBalance")) g_filter_type = VAProcFilterColorBalance; + else if (!strcmp(g_filter_type_name, "VAProcFilterSkinToneEnhancement")) + g_filter_type = VAProcFilterSkinToneEnhancement; else if (!strcmp(g_filter_type_name, "VAProcFilterNone")) g_filter_type = VAProcFilterNone; else { @@ -1087,9 +1123,9 @@ int32_t main(int32_t argc, char *argv[]) for (i = 0; i < g_frame_count; i ++){ if (g_blending_enabled) { construct_nv12_mask_surface(g_in_surface_id, g_blending_min_luma, g_blending_max_luma); - upload_yv12_frame_to_yuv_surface(g_src_file_fd, g_out_surface_id); + upload_yuv_frame_to_yuv_surface(g_src_file_fd, g_out_surface_id); } else { - upload_yv12_frame_to_yuv_surface(g_src_file_fd, g_in_surface_id); + upload_yuv_frame_to_yuv_surface(g_src_file_fd, g_in_surface_id); } video_frame_process(g_filter_type, i, g_in_surface_id, g_out_surface_id); |