[Mesa-dev] [PATCH 06/11] st/va: add copy function for yv12 image to nv12 surface

Christian König deathsimple at vodafone.de
Thu Jul 14 07:56:01 UTC 2016


Am 14.07.2016 um 00:51 schrieb Boyuan Zhang:
> Add function to copy from yv12 image to nv12 surface for VAAPI putimage call. Existing function only work for copying from yv12 surface to nv12 image.
>
> Signed-off-by: Boyuan Zhang <boyuan.zhang at amd.com>

Two nitpicks here, the subject should read "vl/util: ..." and the coding 
style below.

> ---
>   src/gallium/auxiliary/util/u_video.h | 22 ++++++++++++++++++++++
>   1 file changed, 22 insertions(+)
>
> diff --git a/src/gallium/auxiliary/util/u_video.h b/src/gallium/auxiliary/util/u_video.h
> index 9196afc..6e835d8 100644
> --- a/src/gallium/auxiliary/util/u_video.h
> +++ b/src/gallium/auxiliary/util/u_video.h
> @@ -130,6 +130,28 @@ 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) {

"}" and "else if" should be on the same line.

Christian.

> +	   bool odd = false;
> +	   for (int k = 0; k < (offset[1]/2) ; k++){
> +		   if (odd == false) {
> +               dest[k] = src[field][k/2];
> +               odd = true;
> +		   }
> +		   else {
> +               dest[k] = src[field+1][k/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,



More information about the mesa-dev mailing list