From 2f766b59790ff758e480ca4ff99fcdc4a817c775 Mon Sep 17 00:00:00 2001 From: Li Xiaowei Date: Sun, 6 Jan 2013 15:17:59 +0800 Subject: [PATCH] VPP: Support multi filters for vebox pipeline Signed-off-by: Li Xiaowei --- src/gen75_picture_process.c | 69 ++++++++++++++++++++++++++++----------------- src/gen75_vpp_gpe.c | 15 ++++++---- src/gen75_vpp_vebox.c | 7 ++--- 3 files changed, 54 insertions(+), 37 deletions(-) diff --git a/src/gen75_picture_process.c b/src/gen75_picture_process.c index b9f9c5d..c56ba81 100644 --- a/src/gen75_picture_process.c +++ b/src/gen75_picture_process.c @@ -121,39 +121,56 @@ gen75_proc_picture(VADriverContextP ctx, proc_ctx->surface_render_output = proc_st->current_render_target; assert(proc_ctx->surface_render_output != VA_INVALID_SURFACE); - assert(pipeline_param->num_filters <= 1); - - struct object_surface * obj_surf = SURFACE(proc_ctx->surface_render_output); - if(!obj_surf->bo){ + + struct object_surface * obj_dst_surf = SURFACE(proc_ctx->surface_render_output); + if(!obj_dst_surf->bo){ unsigned int is_tiled = 0; unsigned int fourcc = VA_FOURCC('N','V','1','2'); int sampling = SUBSAMPLE_YUV420; - i965_check_alloc_surface_bo(ctx, obj_surf, is_tiled, fourcc, sampling); + i965_check_alloc_surface_bo(ctx, obj_dst_surf, is_tiled, fourcc, sampling); } - if(pipeline_param->filters == NULL || pipeline_param->num_filters == 0){ - /* implicity surface format coversion and scaling */ - gen75_vpp_fmt_cvt(ctx, profile, codec_state, hw_context); - return; - } + assert(pipeline_param->num_filters <= 4); VABufferID *filter_id = (VABufferID*) pipeline_param->filters; - struct object_buffer * obj_buf = BUFFER((*filter_id) + 0); - VAProcFilterParameterBuffer* filter = - (VAProcFilterParameterBuffer*)obj_buf-> buffer_store->buffer; - - if(filter->type == VAProcFilterNoiseReduction || - filter->type == VAProcFilterDeinterlacing || - filter->type == VAProcFilterColorBalance){ - gen75_vpp_vebox(ctx, proc_ctx); - }else if(filter->type == VAProcFilterSharpening /* || - filter->type == VAProcFilterRotation || - filter->type == VAProcFilterBlending || - filter->type == VAProcFilterSceneChangeDetection*/ ){ - gen75_vpp_gpe(ctx, proc_ctx); - } else { - assert("Error: Not supported filter type! \n"); - } + + if(pipeline_param->num_filters == 0 || pipeline_param->filters == NULL ){ + /* implicity surface format coversion and scaling */ + gen75_vpp_fmt_cvt(ctx, profile, codec_state, hw_context); + }else if(pipeline_param->num_filters == 1) { + struct object_buffer * obj_buf = BUFFER((*filter_id) + 0); + VAProcFilterParameterBuffer* filter = + (VAProcFilterParameterBuffer*)obj_buf-> buffer_store->buffer; + + if(filter->type == VAProcFilterNone){ + gen75_vpp_fmt_cvt(ctx, profile, codec_state, hw_context); + } else if(filter->type == VAProcFilterNoiseReduction || + filter->type == VAProcFilterDeinterlacing || + filter->type == VAProcFilterColorBalance){ + gen75_vpp_vebox(ctx, proc_ctx); + }else if(filter->type == VAProcFilterSharpening){ + struct object_surface *obj_src_surf = SURFACE(proc_ctx->pipeline_param->surface); + assert(obj_src_surf->fourcc == VA_FOURCC('N','V','1','2') && + obj_dst_surf->fourcc == VA_FOURCC('N','V','1','2')); + gen75_vpp_gpe(ctx, proc_ctx); + } + }else if (pipeline_param->num_filters >= 2) { + unsigned int i = 0; + for (i = 0; i < pipeline_param->num_filters; i++){ + struct object_buffer * obj_buf = BUFFER(pipeline_param->filters[i]); + VAProcFilterParameterBuffer* filter = + (VAProcFilterParameterBuffer*)obj_buf-> buffer_store->buffer; + + if (filter->type != VAProcFilterNoiseReduction && + filter->type != VAProcFilterDeinterlacing && + filter->type != VAProcFilterColorBalance && + filter->type != VAProcFilterNone ){ + printf("Do not support multiply filters outside vebox pipeline \n"); + assert(0); + } + } + gen75_vpp_vebox(ctx, proc_ctx); + } } static void diff --git a/src/gen75_vpp_gpe.c b/src/gen75_vpp_gpe.c index 0121771..921726f 100644 --- a/src/gen75_vpp_gpe.c +++ b/src/gen75_vpp_gpe.c @@ -456,14 +456,17 @@ VAStatus gen75_gpe_process_picture(VADriverContextP ctx, VAStatus va_status = VA_STATUS_SUCCESS; struct i965_driver_data *i965 = i965_driver_data(ctx); VAProcPipelineParameterBuffer* pipe = vpp_gpe_ctx->pipeline_param; + VAProcFilterParameterBuffer* filter = NULL; unsigned int i; - assert(pipe->num_filters == 1); - VABufferID *filter_ids = (VABufferID*)pipe->filters ; - struct object_buffer *obj_buf = BUFFER((*(filter_ids + 0))); - VAProcFilterParameterBuffer* filter = - (VAProcFilterParameterBuffer*)obj_buf-> buffer_store->buffer; - + for(i = 0; i < pipe->num_filters; i++){ + struct object_buffer *obj_buf = BUFFER(pipe->filters[i]); + filter = (VAProcFilterParameterBuffer*)obj_buf-> buffer_store->buffer; + if(filter->type == VAProcFilterSharpening){ + break; + } + } + assert(pipe->num_forward_references + pipe->num_backward_references <= 4); vpp_gpe_ctx->surface_input[0] = pipe->surface; diff --git a/src/gen75_vpp_vebox.c b/src/gen75_vpp_vebox.c index 64809c7..c0e36a5 100644 --- a/src/gen75_vpp_vebox.c +++ b/src/gen75_vpp_vebox.c @@ -1101,7 +1101,7 @@ VAStatus gen75_vebox_process_picture(VADriverContextP ctx, unsigned int i; for (i = 0; i < pipe->num_filters; i ++) { - obj_buf = BUFFER((*(filter_ids + i))); + obj_buf = BUFFER(pipe->filters[i]); filter = (VAProcFilterParameterBuffer*)obj_buf-> buffer_store->buffer; if (filter->type == VAProcFilterNoiseReduction) { @@ -1117,10 +1117,7 @@ VAStatus gen75_vebox_process_picture(VADriverContextP ctx, } else if (filter->type == VAProcFilterColorStandard){ proc_ctx->filters_mask |= VPP_IECP_CSC; proc_ctx->filter_iecp_csc = filter; - } else { - /*not supported filter type */ - return VA_STATUS_ERROR_ATTR_NOT_SUPPORTED; - } + } } hsw_veb_pre_format_convert(ctx, proc_ctx); -- 2.7.4