#10285 closed defect (duplicate)

scale_qsv filter for resolutions not 32x32 aligned results in in green lines on bottom or right

Reported by: Steve Browne Owned by:
Priority: normal Component: avcodec
Version: 5.1.2 Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
When using an h264_qsv decoder with an hwdevice context and scaling via the scale_qsv filter if the input resolution is not 32x32 aligned you'll get green on the bottom or right depending on which dimension was not divisible by 32. This happens because qsv_decode_preinit in qsvdec.c will set the dimensions of the hwframes context to the 32 pixel aligned values. However, when the surfaces are initialized in qsv_init_surface of hwcontext_qsv.c it assumes the width/height represent the unaligned dimensions and tries to use them as the CropW/CropH to account for that. There doesn't appear to be any other good way to get the unaligned dimensions at this point. I'm not sure why those dimensions need to be aligned in the hwcontext rather than just aligning them wherever that is needed which qsv_init_surface tries to align by 16 already. Basically I think the alignment can just go away at that level otherwise it probably needs another field to keep track of the unaligned value.

How to reproduce:
Use an input video with a resolution not 32x32 aligned. For instance my input video was 3840x2160.
Create an h264_qsv AVCodecContext with an hwdevice context.
Create an avfilter graph to scale the video. Mine for example used a graph description of "scale_qsv=w=768:h=432" and a Input filter of "video_size=3840x2160:pix_fmt=114:time_base=1/90000:pixel_aspect=0/1"
Decode the video then send the frame to the filter graph and get the output

Change History (1)

comment:1 by Steve Browne, 13 months ago

Resolution: duplicate
Status: newclosed

Looks like this is a duplicate of #9378. I should have searched more first.

I also found someone else experiencing this on stack overflow:
https://stackoverflow.com/questions/60778078/ffmpeg-h264-qsv-green-line-at-bottom-of-video

Note: See TracTickets for help on using tickets.