From: fei.w.wang-at-intel.com@ffmpeg.org To: ffmpeg-devel@ffmpeg.org Cc: fei.w.wang@intel.com Subject: [FFmpeg-devel] [PATCH v1 2/2] lavc/qsvdec: Use coded_w/h for frame resolution when use system memory Date: Mon, 20 May 2024 10:05:53 +0800 Message-ID: <20240520020553.1155143-2-fei.w.wang@intel.com> (raw) In-Reply-To: <20240520020553.1155143-1-fei.w.wang@intel.com> From: Fei Wang <fei.w.wang@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@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 _______________________________________________ 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".
next prev parent reply other threads:[~2024-05-20 2:05 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-05-20 2:05 [FFmpeg-devel] [PATCH v1 1/2] lavc/qsvdec: Allow decoders to export crop information fei.w.wang-at-intel.com 2024-05-20 2:05 ` fei.w.wang-at-intel.com [this message] 2024-05-24 2:03 ` Xiang, Haihao
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20240520020553.1155143-2-fei.w.wang@intel.com \ --to=fei.w.wang-at-intel.com@ffmpeg.org \ --cc=fei.w.wang@intel.com \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git