diff options
author | Zhao Halley <halley.zhao@intel.com> | 2012-07-19 12:49:08 +0300 |
---|---|---|
committer | Xiang, Haihao <haihao.xiang@intel.com> | 2012-08-10 15:33:33 +0800 |
commit | e5344533c46a8128de4b4e2b501ba043b05f1212 (patch) | |
tree | c6ef8219ec5037f6a7d4ba66b071a53ecfe6c92f | |
parent | 6c8dc8f017c12d16610ffa5fab5e868e3794f67c (diff) | |
download | vaapi-intel-driver-e5344533c46a8128de4b4e2b501ba043b05f1212.tar.gz vaapi-intel-driver-e5344533c46a8128de4b4e2b501ba043b05f1212.tar.bz2 vaapi-intel-driver-e5344533c46a8128de4b4e2b501ba043b05f1212.zip |
distinguish first plane width in pixel or in byte
-rwxr-xr-x | src/i965_post_processing.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/src/i965_post_processing.c b/src/i965_post_processing.c index b3d5f81..bc0d9de 100755 --- a/src/i965_post_processing.c +++ b/src/i965_post_processing.c @@ -1264,7 +1264,12 @@ pp_set_media_rw_message_surface(VADriverContextP ctx, struct i965_post_processin const int UV = 1; int interleaved_uv = fourcc == VA_FOURCC('N', 'V', '1', '2'); int packed_yuv = (fourcc == VA_FOURCC('Y', 'U', 'Y', '2') || fourcc == VA_FOURCC('U', 'Y', 'V', 'Y')); - + int full_packed_format = (fourcc == VA_FOURCC('R', 'G', 'B', 'A') || + fourcc == VA_FOURCC('R', 'G', 'B', 'X') || + fourcc == VA_FOURCC('B', 'G', 'R', 'A') || + fourcc == VA_FOURCC('B', 'G', 'R', 'X')); + int scale_factor_of_1st_plane_width_in_byte = 1; + if (surface->type == I965_SURFACE_TYPE_SURFACE) { obj_surface = SURFACE(surface->id); bo = obj_surface->bo; @@ -1273,8 +1278,12 @@ pp_set_media_rw_message_surface(VADriverContextP ctx, struct i965_post_processin pitch[0] = obj_surface->width; offset[0] = 0; - if (packed_yuv ) { - width[0] = obj_surface->orig_width * 2; + if (full_packed_format) { + scale_factor_of_1st_plane_width_in_byte = 4; + pitch[0] = obj_surface->width * 4; + } + else if (packed_yuv ) { + scale_factor_of_1st_plane_width_in_byte = 2; pitch[0] = obj_surface->width * 2; } else if (interleaved_uv) { @@ -1300,8 +1309,11 @@ pp_set_media_rw_message_surface(VADriverContextP ctx, struct i965_post_processin pitch[0] = obj_image->image.pitches[0]; offset[0] = obj_image->image.offsets[0]; - if (packed_yuv ) { - width[0] = obj_image->image.width * 2; + if (full_packed_format) { + scale_factor_of_1st_plane_width_in_byte = 4; + } + else if (packed_yuv ) { + scale_factor_of_1st_plane_width_in_byte = 2; } else if (interleaved_uv) { width[1] = obj_image->image.width; @@ -1323,10 +1335,10 @@ pp_set_media_rw_message_surface(VADriverContextP ctx, struct i965_post_processin /* Y surface */ i965_pp_set_surface_state(ctx, pp_context, bo, offset[Y], - width[Y] / 4, height[Y], pitch[Y], I965_SURFACEFORMAT_R8_UNORM, + width[Y] *scale_factor_of_1st_plane_width_in_byte / 4, height[Y], pitch[Y], I965_SURFACEFORMAT_R8_UNORM, base_index, is_target); - if (!packed_yuv) { + if (!packed_yuv && !full_packed_format) { if (interleaved_uv) { i965_pp_set_surface_state(ctx, pp_context, bo, offset[UV], |