[Libva] [PATCH Libva-intel-driver 4/4] Add the csc conversion from YV16 to NV12

Wu, Zhiwen zhiwen.wu at intel.com
Mon Mar 17 22:43:44 PDT 2014


 I had an old version of this patch which contains the following snippets, and tested it on my baytraili platform.

            if (fourcc == VA_FOURCC('Y', 'V', '1', '6')) {
                width[1] = obj_image->image.width / 2;
                height[1] = obj_image->image.height;
                width[2] = obj_image->image.width / 2;
                height[2] = obj_image->image.height;
            }

Yesterday, I found the previous version of this patch miss the snippets, so I noted the patch maker. Today, I found he had added the missing part, so I blindly +1 for this patch without careful review and retesting. Sorry.  

>-----Original Message-----
>From: Gwenole Beauchesne [mailto:gb.devel at gmail.com]
>Sent: Tuesday, March 18, 2014 1:06 PM
>To: Wu, Zhiwen
>Cc: Zhao, Yakui; libva at lists.freedesktop.org
>Subject: Re: [Libva] [PATCH Libva-intel-driver 4/4] Add the csc conversion from
>YV16 to NV12
>
>Hi,
>
>2014-03-18 1:44 GMT+01:00 Wu, Zhiwen <zhiwen.wu at intel.com>:
>> Looks good to me, tested on baytraili.
>
>Interesting, how? The patch doesn't do what it tells to do in several places:
>
>>>-----Original Message-----
>>>From: Libva [mailto:libva-bounces at lists.freedesktop.org] On Behalf Of
>>>Zhao Yakui
>>>Sent: Monday, March 17, 2014 5:08 PM
>>>To: libva at lists.freedesktop.org
>>>Subject: [Libva] [PATCH Libva-intel-driver 4/4] Add the csc conversion
>>>from YV16 to NV12
>>>
>>>V1->V2: Follow Zhiwen's comment to add the missing code when the
>>>V1->source is
>>>YV16 image instead of YV16 surface.
>>>
>>>Reviewed-by: Wind Yuan <feng.yuan at intel.com>
>>>Tested-by:  Wind Yuan <feng.yuan at intel.com>
>>>Signed-off-by: Zhao Yakui <yakui.zhao at intel.com>
>>>---
>>> src/gen8_post_processing.c |  8 ++++++++  src/i965_post_processing.c
>>>| 23
>>>+++++++++++++++++++++--
>>> 2 files changed, 29 insertions(+), 2 deletions(-)
>>>
>>>diff --git a/src/gen8_post_processing.c b/src/gen8_post_processing.c
>>>index
>>>f34392c..a5b3b90 100644
>>>--- a/src/gen8_post_processing.c
>>>+++ b/src/gen8_post_processing.c
>>>@@ -496,8 +496,10 @@
>>>gen8_pp_set_media_rw_message_surface(VADriverContextP ctx, struct
>>>i965_post_proc
>>>     dri_bo *bo;
>>>     int fourcc = pp_get_surface_fourcc(ctx, surface);
>>>     const int U = (fourcc == VA_FOURCC('Y', 'V', '1', '2') ||
>>>+                   fourcc == VA_FOURCC('Y', 'V', '1', '6') ||
>>>                    fourcc == VA_FOURCC('I', 'M', 'C', '1')) ? 2 : 1;
>>>     const int V = (fourcc == VA_FOURCC('Y', 'V', '1', '2') ||
>>>+                   fourcc == VA_FOURCC('Y', 'V', '1', '6') ||
>>>                    fourcc == VA_FOURCC('I', 'M', 'C', '1')) ? 1 : 2;
>>>     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')); @@ -564,6 +566,12 @@
>>>gen8_pp_set_media_rw_message_surface(VADriverContextP ctx, struct
>>>i965_post_proc
>>>             height[2] = obj_image->image.height / 2;
>>>             pitch[2] = obj_image->image.pitches[V];
>>>             offset[2] = obj_image->image.offsets[V];
>>>+            if (fourcc == VA_FOURCC('V', 'V', '1', '6')) {
>>>+                width[1] = obj_image->image.width / 2;
>>>+                height[1] = obj_image->image.height;
>>>+                width[2] = obj_image->image.width / 2;
>>>+                height[2] = obj_image->image.height;
>>>+            }
>>>         }
>>>     }
>
>This is wrong, why VV16? Besides, Haihao mentioned to use a proper constant.
>You would have avoided this error.
>
>>>diff --git a/src/i965_post_processing.c b/src/i965_post_processing.c
>>>index
>>>936c1a6..3242257 100755
>>>--- a/src/i965_post_processing.c
>>>+++ b/src/i965_post_processing.c
>>>@@ -1764,8 +1764,12 @@
>>>pp_set_media_rw_message_surface(VADriverContextP ctx, struct
>>>i965_post_processin
>>>     dri_bo *bo;
>>>     int fourcc = pp_get_surface_fourcc(ctx, surface);
>>>     const int Y = 0;
>>>-    const int U = fourcc == VA_FOURCC('Y', 'V', '1', '2') ? 2 : 1;
>>>-    const int V = fourcc == VA_FOURCC('Y', 'V', '1', '2') ? 1 : 2;
>>>+    const int U = ((fourcc == VA_FOURCC('Y', 'V', '1', '2')) ||
>>>+                   (fourcc == VA_FOURCC('Y', 'V', '1', '6')))
>>>+                   ? 2 : 1;
>>>+    const int V = ((fourcc == VA_FOURCC('Y', 'V', '1', '2')) ||
>>>+                   (fourcc == VA_FOURCC('Y', 'V', '1', '6')))
>>>+                   ? 1 : 2;
>>>     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')); @@ -1832,6 +1836,12 @@
>>>pp_set_media_rw_message_surface(VADriverContextP ctx, struct
>>>i965_post_processin
>>>             height[2] = obj_image->image.height / 2;
>>>             pitch[2] = obj_image->image.pitches[2];
>>>             offset[2] = obj_image->image.offsets[2];
>>>+            if (fourcc == VA_FOURCC('V', 'V', '1', '6')) {
>>>+                width[1] = obj_image->image.width / 2;
>>>+                height[1] = obj_image->image.height;
>>>+                width[2] = obj_image->image.width / 2;
>>>+                height[2] = obj_image->image.height;
>>>+            }
>>>         }
>>>     }
>
>Same here.
>
>>>@@ -1875,8 +1885,10 @@
>>>gen7_pp_set_media_rw_message_surface(VADriverContextP ctx, struct
>>>i965_post_proc
>>>     dri_bo *bo;
>>>     int fourcc = pp_get_surface_fourcc(ctx, surface);
>>>     const int U = (fourcc == VA_FOURCC('Y', 'V', '1', '2') ||
>>>+                   fourcc == VA_FOURCC('V', 'V', '1', '6') ||
>>>                    fourcc == VA_FOURCC('I', 'M', 'C', '1')) ? 2 : 1;
>>>     const int V = (fourcc == VA_FOURCC('Y', 'V', '1', '2') ||
>>>+                   fourcc == VA_FOURCC('V', 'V', '1', '6') ||
>>>                    fourcc == VA_FOURCC('I', 'M', 'C', '1')) ? 1 : 2;
>
>Here.
>
>>>     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')); @@ -1942,6 +1954,12 @@
>>>gen7_pp_set_media_rw_message_surface(VADriverContextP ctx, struct
>>>i965_post_proc
>>>             height[2] = obj_image->image.height / 2;
>>>             pitch[2] = obj_image->image.pitches[V];
>>>             offset[2] = obj_image->image.offsets[V];
>>>+            if (fourcc == VA_FOURCC('V', 'V', '1', '6')) {
>>>+                width[1] = obj_image->image.width / 2;
>>>+                height[1] = obj_image->image.height;
>>>+                width[2] = obj_image->image.width / 2;
>>>+                height[2] = obj_image->image.height;
>>>+            }
>>>         }
>>>     }
>
>And here again.
>
>>>
>>>@@ -5230,6 +5248,7 @@ i965_image_processing(VADriverContextP ctx,
>>>         case VA_FOURCC('4', '2', '2', 'V'):
>>>         case VA_FOURCC('4', '1', '1', 'P'):
>>>         case VA_FOURCC('4', '4', '4', 'P'):
>>>+        case VA_FOURCC('Y', 'V', '1', '6'):
>>>             status = i965_image_pl3_processing(ctx,
>>>                                                src_surface,
>>>                                                src_rect,
>>>--
>>>1.8.2-rc2
>>>
>>>_______________________________________________
>>>Libva mailing list
>>>Libva at lists.freedesktop.org
>>>http://lists.freedesktop.org/mailman/listinfo/libva
>> _______________________________________________
>> Libva mailing list
>> Libva at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/libva


More information about the Libva mailing list