[FFmpeg-devel] [PATCH] avutils/vulkan: hwmap, respect src frame resolution

Xu, Guangxin guangxin.xu at intel.com
Fri Jan 22 06:14:49 EET 2021



> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces at ffmpeg.org> On Behalf Of
> Lynne
> Sent: Friday, January 22, 2021 11:37 AM
> To: FFmpeg development discussions and patches <ffmpeg-
> devel at ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH] avutils/vulkan: hwmap, respect src
> frame resolution
> 
> Jan 21, 2021, 05:35 by guangxin.xu at intel.com:
> 
> > fixes http://trac.ffmpeg.org/ticket/9055
> >
> > The hw decoder may allocate a large frame from AVHWFramesContext,
> and adjust width and height based on bitstream.
> > We need to use resolution from src frame instead of AVHWFramesContext.
> >
> > test command:
> > ffmpeg -loglevel debug -hide_banner -hwaccel vaapi -init_hw_device
> > vaapi=va:/dev/dri/renderD128 -hwaccel_device va -
> hwaccel_output_format
> > vaapi -init_hw_device vulkan=vulk -filter_hw_device vulk -i
> > 1920x1080.264 -c:v libx264 -r:v 30 -profile:v high -preset veryfast
> > -vf "hwmap,chromaber_vulkan=0:0,hwdownload,format=nv12" -map 0 -y
> > vaapiouts.mkv
> >
> > expected:
> > No green bar at bottom.
> > ---
> >  libavutil/hwcontext_vulkan.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/libavutil/hwcontext_vulkan.c
> > b/libavutil/hwcontext_vulkan.c index d4ff4ae307..f6d0cae8ae 100644
> > --- a/libavutil/hwcontext_vulkan.c
> > +++ b/libavutil/hwcontext_vulkan.c
> > @@ -2009,7 +2009,7 @@ static inline VkFormat
> > drm_to_vulkan_fmt(uint32_t drm_fourcc)  }
> >
> >  static int vulkan_map_from_drm_frame_desc(AVHWFramesContext
> *hwfc, AVVkFrame **frame,
> > -                                          AVDRMFrameDescriptor *desc)
> > +                                          const AVFrame *src,
> > + AVDRMFrameDescriptor *desc)
> >  {
> >  int err = 0;
> >  VkResult ret;
> > @@ -2085,7 +2085,7 @@ static int
> > vulkan_map_from_drm_frame_desc(AVHWFramesContext *hwfc,
> AVVkFrame **f
> > };
> >
> >  get_plane_wh(&create_info.extent.width, &create_info.extent.height,
> > -                     hwfc->sw_format, hwfc->width, hwfc->height, i);
> > +                     hwfc->sw_format, src->width, src->height, i);
> >
> >  for (int j = 0; j < planes; j++) {
> >  plane_data[j].offset     = desc->layers[i].planes[j].offset;
> > @@ -2246,7 +2246,7 @@ static int
> vulkan_map_from_drm(AVHWFramesContext
> > *hwfc, AVFrame *dst,  AVVkFrame *f;  VulkanMapping *map = NULL;
> >
> > -    err = vulkan_map_from_drm_frame_desc(hwfc, &f,
> > +    err = vulkan_map_from_drm_frame_desc(hwfc, &f, src,
> >  (AVDRMFrameDescriptor *)src->data[0]);  if (err)  return err;
> >
> 
> Thanks, pushed with a small style nit.
Great! thanks.
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email ffmpeg-devel-request at ffmpeg.org
> with subject "unsubscribe".


More information about the ffmpeg-devel mailing list