[Libva] [PATCH Libva-intel-driver 3/4] VEBOX: Use the VA_FOURCC_ABCD constant to replace the VA_FOURCC(A, B, C, D)
Zhao Yakui
yakui.zhao at intel.com
Wed Mar 19 23:24:42 PDT 2014
This is helpful to avoid the typo error when using VA_FOURCC(A, B, C, D).
Signed-off-by: Zhao Yakui <yakui.zhao at intel.com>
--
src/gen75_vpp_vebox.c | 83 ++++++++++++++++++++++++--------------------------
1 file changed, 41 insertions(+), 42 deletions(-)
---
src/gen75_vpp_vebox.c | 83 +++++++++++++++++++++++++--------------------------
1 file changed, 41 insertions(+), 42 deletions(-)
diff --git a/src/gen75_vpp_vebox.c b/src/gen75_vpp_vebox.c
index 5757419..bc81b0b 100644
--- a/src/gen75_vpp_vebox.c
+++ b/src/gen75_vpp_vebox.c
@@ -93,8 +93,8 @@ VAStatus vpp_surface_scaling(VADriverContextP ctx,
VAStatus va_status = VA_STATUS_SUCCESS;
int flags = I965_PP_FLAG_AVS;
- assert(src_obj_surf->fourcc == VA_FOURCC('N','V','1','2'));
- assert(dst_obj_surf->fourcc == VA_FOURCC('N','V','1','2'));
+ assert(src_obj_surf->fourcc == VA_FOURCC_NV12);
+ assert(dst_obj_surf->fourcc == VA_FOURCC_NV12);
VARectangle src_rect, dst_rect;
src_rect.x = 0;
@@ -385,11 +385,11 @@ void hsw_veb_iecp_csc_table(VADriverContextP ctx, struct intel_vebox_context *pr
return;
}
- if(proc_ctx->fourcc_input == VA_FOURCC('R','G','B','A') &&
- (proc_ctx->fourcc_output == VA_FOURCC('N','V','1','2') ||
- proc_ctx->fourcc_output == VA_FOURCC('Y','V','1','2') ||
- proc_ctx->fourcc_output == VA_FOURCC('Y','V','Y','2') ||
- proc_ctx->fourcc_output == VA_FOURCC('A','Y','U','V'))) {
+ if(proc_ctx->fourcc_input == VA_FOURCC_RGBA &&
+ (proc_ctx->fourcc_output == VA_FOURCC_NV12 ||
+ proc_ctx->fourcc_output == VA_FOURCC_YV12 ||
+ proc_ctx->fourcc_output == VA_FOURCC_YVY2 ||
+ proc_ctx->fourcc_output == VA_FOURCC_AYUV)) {
tran_coef[0] = 0.257;
tran_coef[1] = 0.504;
@@ -406,12 +406,11 @@ void hsw_veb_iecp_csc_table(VADriverContextP ctx, struct intel_vebox_context *pr
u_coef[2] = 128 * 4;
is_transform_enabled = 1;
- }else if((proc_ctx->fourcc_input == VA_FOURCC('N','V','1','2') ||
- proc_ctx->fourcc_input == VA_FOURCC('Y','V','1','2') ||
- proc_ctx->fourcc_input == VA_FOURCC('Y','U','Y','2') ||
- proc_ctx->fourcc_input == VA_FOURCC('A','Y','U','V'))&&
- proc_ctx->fourcc_output == VA_FOURCC('R','G','B','A')) {
-
+ }else if((proc_ctx->fourcc_input == VA_FOURCC_NV12 ||
+ proc_ctx->fourcc_input == VA_FOURCC_YV12 ||
+ proc_ctx->fourcc_input == VA_FOURCC_YUY2 ||
+ proc_ctx->fourcc_input == VA_FOURCC_AYUV) &&
+ proc_ctx->fourcc_output == VA_FOURCC_RGBA) {
tran_coef[0] = 1.164;
tran_coef[1] = 0.000;
tran_coef[2] = 1.569;
@@ -747,7 +746,7 @@ void hsw_veb_resource_prepare(VADriverContextP ctx,
}
if(obj_surf_in->bo == NULL){
- input_fourcc = VA_FOURCC('N','V','1','2');
+ input_fourcc = VA_FOURCC_NV12;
input_sampling = SUBSAMPLE_YUV420;
input_tiling = 0;
i965_check_alloc_surface_bo(ctx, obj_surf_in, input_tiling, input_fourcc, input_sampling);
@@ -759,7 +758,7 @@ void hsw_veb_resource_prepare(VADriverContextP ctx,
}
if(obj_surf_out->bo == NULL){
- output_fourcc = VA_FOURCC('N','V','1','2');
+ output_fourcc = VA_FOURCC_NV12;
output_sampling = SUBSAMPLE_YUV420;
output_tiling = 0;
i965_check_alloc_surface_bo(ctx, obj_surf_out, output_tiling, output_fourcc, output_sampling);
@@ -1006,17 +1005,17 @@ int hsw_veb_pre_format_convert(VADriverContextP ctx,
}
/* convert the following format to NV12 format */
- if(obj_surf_input->fourcc == VA_FOURCC('Y','V','1','2') ||
- obj_surf_input->fourcc == VA_FOURCC('I','4','2','0') ||
- obj_surf_input->fourcc == VA_FOURCC('I','M','C','1') ||
- obj_surf_input->fourcc == VA_FOURCC('I','M','C','3') ||
- obj_surf_input->fourcc == VA_FOURCC('R','G','B','A')){
+ if(obj_surf_input->fourcc == VA_FOURCC_YV12 ||
+ obj_surf_input->fourcc == VA_FOURCC_I420 ||
+ obj_surf_input->fourcc == VA_FOURCC_IMC1 ||
+ obj_surf_input->fourcc == VA_FOURCC_IMC3 ||
+ obj_surf_input->fourcc == VA_FOURCC_RGBA){
proc_ctx->format_convert_flags |= PRE_FORMAT_CONVERT;
- } else if(obj_surf_input->fourcc == VA_FOURCC('A','Y','U','V') ||
- obj_surf_input->fourcc == VA_FOURCC('Y','U','Y','2') ||
- obj_surf_input->fourcc == VA_FOURCC('N','V','1','2')){
+ } else if(obj_surf_input->fourcc == VA_FOURCC_AYUV ||
+ obj_surf_input->fourcc == VA_FOURCC_YV12 ||
+ obj_surf_input->fourcc == VA_FOURCC_NV12){
// nothing to do here
} else {
/* not support other format as input */
@@ -1037,7 +1036,7 @@ int hsw_veb_pre_format_convert(VADriverContextP ctx,
if (obj_surf_input_vebox) {
proc_ctx->surface_input_vebox_object = obj_surf_input_vebox;
- i965_check_alloc_surface_bo(ctx, obj_surf_input_vebox, 1, VA_FOURCC('N','V','1','2'), SUBSAMPLE_YUV420);
+ i965_check_alloc_surface_bo(ctx, obj_surf_input_vebox, 1, VA_FOURCC_NV12, SUBSAMPLE_YUV420);
}
}
@@ -1045,16 +1044,16 @@ int hsw_veb_pre_format_convert(VADriverContextP ctx,
}
/* create one temporary NV12 surfaces for conversion*/
- if(obj_surf_output->fourcc == VA_FOURCC('Y','V','1','2') ||
- obj_surf_output->fourcc == VA_FOURCC('I','4','2','0') ||
- obj_surf_output->fourcc == VA_FOURCC('I','M','C','1') ||
- obj_surf_output->fourcc == VA_FOURCC('I','M','C','3') ||
- obj_surf_output->fourcc == VA_FOURCC('R','G','B','A')) {
+ if(obj_surf_output->fourcc == VA_FOURCC_YV12 ||
+ obj_surf_output->fourcc == VA_FOURCC_I420 ||
+ obj_surf_output->fourcc == VA_FOURCC_IMC1 ||
+ obj_surf_output->fourcc == VA_FOURCC_IMC3 ||
+ obj_surf_output->fourcc == VA_FOURCC_RGBA) {
proc_ctx->format_convert_flags |= POST_FORMAT_CONVERT;
- } else if(obj_surf_output->fourcc == VA_FOURCC('A','Y','U','V') ||
- obj_surf_output->fourcc == VA_FOURCC('Y','U','Y','2') ||
- obj_surf_output->fourcc == VA_FOURCC('N','V','1','2')){
+ } else if(obj_surf_output->fourcc == VA_FOURCC_AYUV ||
+ obj_surf_output->fourcc == VA_FOURCC_YUY2 ||
+ obj_surf_output->fourcc == VA_FOURCC_NV12){
/* Nothing to do here */
} else {
/* not support other format as input */
@@ -1076,7 +1075,7 @@ int hsw_veb_pre_format_convert(VADriverContextP ctx,
if (obj_surf_output_vebox) {
proc_ctx->surface_output_vebox_object = obj_surf_output_vebox;
- i965_check_alloc_surface_bo(ctx, obj_surf_output_vebox, 1, VA_FOURCC('N','V','1','2'), SUBSAMPLE_YUV420);
+ i965_check_alloc_surface_bo(ctx, obj_surf_output_vebox, 1, VA_FOURCC_NV12, SUBSAMPLE_YUV420);
}
}
}
@@ -1095,7 +1094,7 @@ int hsw_veb_pre_format_convert(VADriverContextP ctx,
if (obj_surf_output_vebox) {
proc_ctx->surface_output_scaled_object = obj_surf_output_vebox;
- i965_check_alloc_surface_bo(ctx, obj_surf_output_vebox, 1, VA_FOURCC('N','V','1','2'), SUBSAMPLE_YUV420);
+ i965_check_alloc_surface_bo(ctx, obj_surf_output_vebox, 1, VA_FOURCC_NV12, SUBSAMPLE_YUV420);
}
}
}
@@ -1125,7 +1124,7 @@ int hsw_veb_post_format_convert(VADriverContextP ctx,
} else if(proc_ctx->format_convert_flags & POST_SCALING_CONVERT) {
/* scaling, convert and copy NV12 to YV12/IMC3/IMC2/RGBA output*/
- assert(obj_surface->fourcc == VA_FOURCC('N','V','1','2'));
+ assert(obj_surface->fourcc == VA_FOURCC_NV12);
/* first step :surface scaling */
vpp_surface_scaling(ctx,proc_ctx->surface_output_scaled_object, obj_surface);
@@ -1133,13 +1132,13 @@ int hsw_veb_post_format_convert(VADriverContextP ctx,
/* second step: color format convert and copy to output */
obj_surface = proc_ctx->surface_output_object;
- if(obj_surface->fourcc == VA_FOURCC('N','V','1','2') ||
- obj_surface->fourcc == VA_FOURCC('Y','V','1','2') ||
- obj_surface->fourcc == VA_FOURCC('I','4','2','0') ||
- obj_surface->fourcc == VA_FOURCC('Y','U','Y','2') ||
- obj_surface->fourcc == VA_FOURCC('I','M','C','1') ||
- obj_surface->fourcc == VA_FOURCC('I','M','C','3') ||
- obj_surface->fourcc == VA_FOURCC('R','G','B','A')) {
+ if(obj_surface->fourcc == VA_FOURCC_NV12 ||
+ obj_surface->fourcc == VA_FOURCC_YV12 ||
+ obj_surface->fourcc == VA_FOURCC_I420 ||
+ obj_surface->fourcc == VA_FOURCC_YUY2 ||
+ obj_surface->fourcc == VA_FOURCC_IMC1 ||
+ obj_surface->fourcc == VA_FOURCC_IMC3 ||
+ obj_surface->fourcc == VA_FOURCC_RGBA) {
vpp_surface_convert(ctx, proc_ctx->surface_output_object, proc_ctx->surface_output_scaled_object);
}else {
assert(0);
--
1.8.2-rc2
More information about the Libva
mailing list