diff mbox

[FFmpeg-devel,3/3] Map 444 pix fmts to new VdpYCbCr types defined in VDPAU.

Message ID 20190426041339.13914-4-mbonda@nvidia.com
State Superseded
Headers show

Commit Message

ManojGuptaBonda April 26, 2019, 4:13 a.m. UTC
New VdpYCbCr Formats VDP_YCBCR_FORMAT_Y_U_V_444 and,
VDP_YCBCR_FORMAT_Y_UV_444 have been added in VDPAU to be used in
get/putbits for YUV 4:4:4 surfaces. Earlier mapping of
AV_PIX_FMT_YUV444P to VDP_YCBCR_FORMAT_YV12 is not valid.

Hence this Change maps AV_PIX_FMT_YUV444P to VDP_YCBCR_FORMAT_Y_U_V_444
to access the YUV 4:4:4 surface via read-back API's of VDPAU.
---
 libavutil/hwcontext_vdpau.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

James Almer April 26, 2019, 1:42 p.m. UTC | #1
On 4/26/2019 1:13 AM, ManojGuptaBonda wrote:
> New VdpYCbCr Formats VDP_YCBCR_FORMAT_Y_U_V_444 and,
> VDP_YCBCR_FORMAT_Y_UV_444 have been added in VDPAU to be used in
> get/putbits for YUV 4:4:4 surfaces. Earlier mapping of
> AV_PIX_FMT_YUV444P to VDP_YCBCR_FORMAT_YV12 is not valid.
> 
> Hence this Change maps AV_PIX_FMT_YUV444P to VDP_YCBCR_FORMAT_Y_U_V_444
> to access the YUV 4:4:4 surface via read-back API's of VDPAU.
> ---
>  libavutil/hwcontext_vdpau.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/libavutil/hwcontext_vdpau.c b/libavutil/hwcontext_vdpau.c
> index c11c3cfdab..786a51f802 100644
> --- a/libavutil/hwcontext_vdpau.c
> +++ b/libavutil/hwcontext_vdpau.c
> @@ -73,8 +73,8 @@ static const VDPAUPixFmtMap pix_fmts_422[] = {
>  };
>  
>  static const VDPAUPixFmtMap pix_fmts_444[] = {
> -    { VDP_YCBCR_FORMAT_YV12, AV_PIX_FMT_YUV444P },
> -    { 0,                     AV_PIX_FMT_NONE,   },
> +    { VDP_YCBCR_FORMAT_Y_U_V_444, AV_PIX_FMT_YUV444P },

No need for an #ifdef here and below, like in the previous patch?

> +    { 0,                          AV_PIX_FMT_NONE,   },
>  };
>  
>  static const struct {
> @@ -349,7 +349,7 @@ static int vdpau_transfer_data_from(AVHWFramesContext *ctx, AVFrame *dst,
>          return AVERROR(EINVAL);
>      }
>  
> -    if (vdpau_format == VDP_YCBCR_FORMAT_YV12)
> +    if ((vdpau_format == VDP_YCBCR_FORMAT_YV12) || (vdpau_format == VDP_YCBCR_FORMAT_Y_U_V_444))
>          FFSWAP(void*, data[1], data[2]);
>  
>      err = priv->get_data(surf, vdpau_format, data, linesize);
> @@ -400,7 +400,7 @@ static int vdpau_transfer_data_to(AVHWFramesContext *ctx, AVFrame *dst,
>          return AVERROR(EINVAL);
>      }
>  
> -    if (vdpau_format == VDP_YCBCR_FORMAT_YV12)
> +    if ((vdpau_format == VDP_YCBCR_FORMAT_YV12) || (vdpau_format == VDP_YCBCR_FORMAT_Y_U_V_444))
>          FFSWAP(const void*, data[1], data[2]);
>  
>      err = priv->put_data(surf, vdpau_format, data, linesize);
>
Michael Niedermayer April 26, 2019, 6:47 p.m. UTC | #2
On Fri, Apr 26, 2019 at 09:43:38AM +0530, ManojGuptaBonda wrote:
> New VdpYCbCr Formats VDP_YCBCR_FORMAT_Y_U_V_444 and,
> VDP_YCBCR_FORMAT_Y_UV_444 have been added in VDPAU to be used in
> get/putbits for YUV 4:4:4 surfaces. Earlier mapping of
> AV_PIX_FMT_YUV444P to VDP_YCBCR_FORMAT_YV12 is not valid.
> 
> Hence this Change maps AV_PIX_FMT_YUV444P to VDP_YCBCR_FORMAT_Y_U_V_444
> to access the YUV 4:4:4 surface via read-back API's of VDPAU.
> ---
>  libavutil/hwcontext_vdpau.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

breaks build

CC	libavutil/hwcontext_vdpau.o
libavutil/hwcontext_vdpau.c:76:7: error: ‘VDP_YCBCR_FORMAT_Y_U_V_444’ undeclared here (not in a function)
     { VDP_YCBCR_FORMAT_Y_U_V_444, AV_PIX_FMT_YUV444P },
       ^
libavutil/hwcontext_vdpau.c: In function ‘vdpau_transfer_data_from’:
libavutil/hwcontext_vdpau.c:352:62: warning: comparison between pointer and integer [enabled by default]
     if ((vdpau_format == VDP_YCBCR_FORMAT_YV12) || (vdpau_format == VDP_YCBCR_FORMAT_Y_U_V_444))
                                                              ^
libavutil/hwcontext_vdpau.c: In function ‘vdpau_transfer_data_to’:
libavutil/hwcontext_vdpau.c:403:62: warning: comparison between pointer and integer [enabled by default]
     if ((vdpau_format == VDP_YCBCR_FORMAT_YV12) || (vdpau_format == VDP_YCBCR_FORMAT_Y_U_V_444))
                                                              ^
make: *** [libavutil/hwcontext_vdpau.o] Error 1
make: Target `all' not remade because of errors.

[...]
ManojGuptaBonda May 3, 2019, 7:38 p.m. UTC | #3
Sorry for the delayed reply. 
Yes #if is needed in this patch too, to avoid build break incase system is having 
 vdpau.h earlier to libvdpau-1.2 
thanks for pointing it out.

Thanks,
ManojGupta.
> -----Original Message-----

> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of James

> Almer

> Sent: Friday, April 26, 2019 7:13 PM

> To: ffmpeg-devel@ffmpeg.org

> Subject: Re: [FFmpeg-devel] [PATCH 3/3] Map 444 pix fmts to new VdpYCbCr

> types defined in VDPAU.

> 

> On 4/26/2019 1:13 AM, ManojGuptaBonda wrote:

> > New VdpYCbCr Formats VDP_YCBCR_FORMAT_Y_U_V_444 and,

> > VDP_YCBCR_FORMAT_Y_UV_444 have been added in VDPAU to be used in

> > get/putbits for YUV 4:4:4 surfaces. Earlier mapping of

> > AV_PIX_FMT_YUV444P to VDP_YCBCR_FORMAT_YV12 is not valid.

> >

> > Hence this Change maps AV_PIX_FMT_YUV444P to

> > VDP_YCBCR_FORMAT_Y_U_V_444 to access the YUV 4:4:4 surface via read-

> back API's of VDPAU.

> > ---

> >  libavutil/hwcontext_vdpau.c | 8 ++++----

> >  1 file changed, 4 insertions(+), 4 deletions(-)

> >

> > diff --git a/libavutil/hwcontext_vdpau.c b/libavutil/hwcontext_vdpau.c

> > index c11c3cfdab..786a51f802 100644

> > --- a/libavutil/hwcontext_vdpau.c

> > +++ b/libavutil/hwcontext_vdpau.c

> > @@ -73,8 +73,8 @@ static const VDPAUPixFmtMap pix_fmts_422[] = {  };

> >

> >  static const VDPAUPixFmtMap pix_fmts_444[] = {

> > -    { VDP_YCBCR_FORMAT_YV12, AV_PIX_FMT_YUV444P },

> > -    { 0,                     AV_PIX_FMT_NONE,   },

> > +    { VDP_YCBCR_FORMAT_Y_U_V_444, AV_PIX_FMT_YUV444P },

> 

> No need for an #ifdef here and below, like in the previous patch?

> 

> > +    { 0,                          AV_PIX_FMT_NONE,   },

> >  };

> >

> >  static const struct {

> > @@ -349,7 +349,7 @@ static int

> vdpau_transfer_data_from(AVHWFramesContext *ctx, AVFrame *dst,

> >          return AVERROR(EINVAL);

> >      }

> >

> > -    if (vdpau_format == VDP_YCBCR_FORMAT_YV12)

> > +    if ((vdpau_format == VDP_YCBCR_FORMAT_YV12) || (vdpau_format ==

> > + VDP_YCBCR_FORMAT_Y_U_V_444))

> >          FFSWAP(void*, data[1], data[2]);

> >

> >      err = priv->get_data(surf, vdpau_format, data, linesize); @@

> > -400,7 +400,7 @@ static int vdpau_transfer_data_to(AVHWFramesContext

> *ctx, AVFrame *dst,

> >          return AVERROR(EINVAL);

> >      }

> >

> > -    if (vdpau_format == VDP_YCBCR_FORMAT_YV12)

> > +    if ((vdpau_format == VDP_YCBCR_FORMAT_YV12) || (vdpau_format ==

> > + VDP_YCBCR_FORMAT_Y_U_V_444))

> >          FFSWAP(const void*, data[1], data[2]);

> >

> >      err = priv->put_data(surf, vdpau_format, data, linesize);

> >

> 

> _______________________________________________

> ffmpeg-devel mailing list

> ffmpeg-devel@ffmpeg.org

> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

> 

> To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org

> with subject "unsubscribe".


-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
diff mbox

Patch

diff --git a/libavutil/hwcontext_vdpau.c b/libavutil/hwcontext_vdpau.c
index c11c3cfdab..786a51f802 100644
--- a/libavutil/hwcontext_vdpau.c
+++ b/libavutil/hwcontext_vdpau.c
@@ -73,8 +73,8 @@  static const VDPAUPixFmtMap pix_fmts_422[] = {
 };
 
 static const VDPAUPixFmtMap pix_fmts_444[] = {
-    { VDP_YCBCR_FORMAT_YV12, AV_PIX_FMT_YUV444P },
-    { 0,                     AV_PIX_FMT_NONE,   },
+    { VDP_YCBCR_FORMAT_Y_U_V_444, AV_PIX_FMT_YUV444P },
+    { 0,                          AV_PIX_FMT_NONE,   },
 };
 
 static const struct {
@@ -349,7 +349,7 @@  static int vdpau_transfer_data_from(AVHWFramesContext *ctx, AVFrame *dst,
         return AVERROR(EINVAL);
     }
 
-    if (vdpau_format == VDP_YCBCR_FORMAT_YV12)
+    if ((vdpau_format == VDP_YCBCR_FORMAT_YV12) || (vdpau_format == VDP_YCBCR_FORMAT_Y_U_V_444))
         FFSWAP(void*, data[1], data[2]);
 
     err = priv->get_data(surf, vdpau_format, data, linesize);
@@ -400,7 +400,7 @@  static int vdpau_transfer_data_to(AVHWFramesContext *ctx, AVFrame *dst,
         return AVERROR(EINVAL);
     }
 
-    if (vdpau_format == VDP_YCBCR_FORMAT_YV12)
+    if ((vdpau_format == VDP_YCBCR_FORMAT_YV12) || (vdpau_format == VDP_YCBCR_FORMAT_Y_U_V_444))
         FFSWAP(const void*, data[1], data[2]);
 
     err = priv->put_data(surf, vdpau_format, data, linesize);