[Mesa-dev] [PATCH 06/11] vl/util: add copy func for yv12image to nv12surface

Zhang, Boyuan Boyuan.Zhang at amd.com
Mon Jul 18 23:03:55 UTC 2016


Hi Andy,

I just submitted another patch set, most of the issues you reported are solved, please see the information below:

- Giving different frame rate should result different output size. The final result from my side is very close to the CBR I set. Please give a try with different frame rate and bit rate.

- Picture corruption (half height pic) is caused by interlaced setting. Interlace encoding is not supported. However, for transcoding case, VAAPI decode will use interlace mode, which will cause this issue. The temp solution is to use an Environmental Variable to disable interlace when doing transcoding. Please try the following command with the new patch:
DISABLE_INTERLACE=true gst-launch-1.0 filesrc location=~/big_buck_bunny_720p_1mb.mp4 ! qtdemux ! h264parse ! vaapidecode ! vaapih264enc ! filesink location=out.264

- I420 yuv -> nv12 case seems working fine on my side, can you please provide the testing raw file and command you were using? I want to reproduce the issue from my side and try to fix it if possible. Thanks a lot!


Hi Christian,

Besides fixing those issue listed above, I also modified the code based on your suggestions, e.g. adding mutex lock/unlock. Please take a look at the new patch set, and feel free to give any suggestions/comments. Thanks!

Regards,
Boyuan

-----Original Message-----
From: Christian König [mailto:deathsimple at vodafone.de]
Sent: July-18-16 10:15 AM
To: Zhang, Boyuan; mesa-dev at lists.freedesktop.org
Cc: adf.lists at gmail.com
Subject: Re: [PATCH 06/11] vl/util: add copy func for yv12image to nv12surface

Am 16.07.2016 um 00:41 schrieb Boyuan Zhang:
> Add function to copy from yv12 image to nv12 surface for VAAPI putimage call. We need this function in VaPutImage call where copying from yv12 image to nv12 surface for encoding. Existing function can't be used because it only work for copying from yv12 surface to nv12 image in Vaapi.

I think we can keep the patches mostly as they are now, but I would like to get a bit more positive feedback from Andy and maybe others.

E.g. at least we should be able to encode something without crashing on Tonga and other hardware generations as well before we push it upstream.

Regards,
Christian.

>
> Signed-off-by: Boyuan Zhang <boyuan.zhang at amd.com<mailto:boyuan.zhang at amd.com>>
> ---
>   src/gallium/auxiliary/util/u_video.h | 23 +++++++++++++++++++++++
>   1 file changed, 23 insertions(+)
>
> diff --git a/src/gallium/auxiliary/util/u_video.h
> b/src/gallium/auxiliary/util/u_video.h
> index 9196afc..d147295 100644
> --- a/src/gallium/auxiliary/util/u_video.h
> +++ b/src/gallium/auxiliary/util/u_video.h
> @@ -130,6 +130,29 @@ u_copy_yv12_to_nv12(void *const *destination_data,
>   }
>
>   static inline void
> +u_copy_yv12_img_to_nv12_surf(uint8_t *const *src,
> +                             uint8_t *dest,
> +                             int *offset,
> +                             int field) {
> +   if (field == 0) {
> +      for (int i = 0; i < offset[1] ; i++)
> +         dest[i] = src[field][i];
> +   } else if (field == 1) {
> +      bool odd = false;
> +      for (int i = 0; i < (offset[1]/2) ; i++){
> +         if (odd == false) {
> +            dest[i] = src[field][i/2];
> +            odd = true;
> +         } else {
> +            dest[i] = src[field+1][i/2];
> +            odd = false;
> +         }
> +      }
> +   }
> +}
> +
> +static inline void
>   u_copy_swap422_packed(void *const *destination_data,
>                          uint32_t const *destination_pitches,
>                          int src_plane, int src_field,


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160718/b57b8990/attachment.html>


More information about the mesa-dev mailing list