Skip to content

Commit b4ee0d4

Browse files
committed
lavc/qsv: set mjpeg height/width alignment
height/width alignment will be used in submit_frame(), copying to a padded frame as libmfx requires. It is to fix the segment fault issue when encoding some rawvideos. Reproduce: -f rawvideo -video_size 1920x1080 -pix_fmt nv12 -i 1920x1080_blue_sky_nv12.yuv -init_hw_device qsv:hw -c:v mjpeg_qsv -global_quality 80 test.mjpeg Signed-off-by: Zhong Li <zhong.li@intel.com>
1 parent ff90bd4 commit b4ee0d4

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

libavcodec/qsvenc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,10 @@ static int init_video_param_jpeg(AVCodecContext *avctx, QSVEncContext *q)
412412
q->param.mfx.FrameInfo.BitDepthChroma = desc->comp[0].depth;
413413
q->param.mfx.FrameInfo.Shift = desc->comp[0].depth > 8;
414414

415+
q->width_align = q->height_align = 16;
416+
q->param.mfx.FrameInfo.Width = FFALIGN(avctx->width, q->width_align);
417+
q->param.mfx.FrameInfo.Height = FFALIGN(avctx->height, q->height_align);
418+
415419
q->param.mfx.FrameInfo.Width = FFALIGN(avctx->width, 16);
416420
q->param.mfx.FrameInfo.Height = FFALIGN(avctx->height, 16);
417421

0 commit comments

Comments
 (0)