[FFmpeg-devel] [PATCH v1 2/2] lavc/qsvdec: Use coded_w/h for frame resolution when use system memory
fei.w.wang at intel.com
fei.w.wang at intel.com
Mon May 20 05:05:53 EEST 2024
From: Fei Wang <fei.w.wang at intel.com>
Fix output mismatch when decode clip with crop(conf_win_*offset in
syntax) info by using system memory:
$ ffmpeg -c:v hevc_qsv -i conf_win_offet.bit -y out.yuv
Signed-off-by: Fei Wang <fei.w.wang at intel.com>
---
libavcodec/qsvdec.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index 12cf630593..6b0492899a 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -133,26 +133,26 @@ static int qsv_get_continuous_buffer(AVCodecContext *avctx, AVFrame *frame,
if (ret < 0)
return ret;
- frame->width = avctx->width;
- frame->height = avctx->height;
+ frame->width = avctx->coded_width;
+ frame->height = avctx->coded_height;
switch (avctx->pix_fmt) {
case AV_PIX_FMT_NV12:
- frame->linesize[0] = FFALIGN(avctx->width, 128);
+ frame->linesize[0] = FFALIGN(avctx->coded_width, 128);
break;
case AV_PIX_FMT_P010:
case AV_PIX_FMT_P012:
case AV_PIX_FMT_YUYV422:
- frame->linesize[0] = 2 * FFALIGN(avctx->width, 128);
+ frame->linesize[0] = 2 * FFALIGN(avctx->coded_width, 128);
break;
case AV_PIX_FMT_Y210:
case AV_PIX_FMT_VUYX:
case AV_PIX_FMT_XV30:
case AV_PIX_FMT_Y212:
- frame->linesize[0] = 4 * FFALIGN(avctx->width, 128);
+ frame->linesize[0] = 4 * FFALIGN(avctx->coded_width, 128);
break;
case AV_PIX_FMT_XV36:
- frame->linesize[0] = 8 * FFALIGN(avctx->width, 128);
+ frame->linesize[0] = 8 * FFALIGN(avctx->coded_width, 128);
break;
default:
av_log(avctx, AV_LOG_ERROR, "Unsupported pixel format.\n");
@@ -169,7 +169,7 @@ static int qsv_get_continuous_buffer(AVCodecContext *avctx, AVFrame *frame,
avctx->pix_fmt == AV_PIX_FMT_P012) {
frame->linesize[1] = frame->linesize[0];
frame->data[1] = frame->data[0] +
- frame->linesize[0] * FFALIGN(avctx->height, 64);
+ frame->linesize[0] * FFALIGN(avctx->coded_height, 64);
}
ret = ff_attach_decode_data(frame);
@@ -380,7 +380,7 @@ static int qsv_decode_init_context(AVCodecContext *avctx, QSVContext *q, mfxVide
q->frame_info = param->mfx.FrameInfo;
if (!avctx->hw_frames_ctx) {
- ret = av_image_get_buffer_size(avctx->pix_fmt, FFALIGN(avctx->width, 128), FFALIGN(avctx->height, 64), 1);
+ ret = av_image_get_buffer_size(avctx->pix_fmt, FFALIGN(avctx->coded_width, 128), FFALIGN(avctx->coded_height, 64), 1);
if (ret < 0)
return ret;
q->pool = av_buffer_pool_init(ret, av_buffer_allocz);
--
2.25.1
More information about the ffmpeg-devel
mailing list