Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH v1 1/2] lavc/qsvdec: Allow decoders to export crop information
@ 2024-05-20  2:05 fei.w.wang-at-intel.com
  2024-05-20  2:05 ` [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
  2024-05-24  2:03 ` [FFmpeg-devel] [PATCH v1 1/2] lavc/qsvdec: Allow decoders to export crop information Xiang, Haihao
  0 siblings, 2 replies; 3+ messages in thread
From: fei.w.wang-at-intel.com @ 2024-05-20  2:05 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: fei.w.wang

From: Fei Wang <fei.w.wang@intel.com>

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
---
 libavcodec/qsvdec.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index a51ddace62..12cf630593 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -859,6 +859,10 @@ static int qsv_decode(AVCodecContext *avctx, QSVContext *q,
             else
                 frame->flags &= ~AV_FRAME_FLAG_KEY;
         }
+        frame->crop_left   = outsurf->Info.CropX;
+        frame->crop_top    = outsurf->Info.CropY;
+        frame->crop_right  = outsurf->Info.Width - (outsurf->Info.CropX + outsurf->Info.CropW);
+        frame->crop_bottom = outsurf->Info.Height - (outsurf->Info.CropY + outsurf->Info.CropH);
 
         /* update the surface properties */
         if (avctx->pix_fmt == AV_PIX_FMT_QSV)
@@ -1148,7 +1152,7 @@ const FFCodec ff_##x##_qsv_decoder = { \
     .p.priv_class   = &x##_qsv_class, \
     .hw_configs     = qsv_hw_configs, \
     .p.wrapper_name = "qsv", \
-    .caps_internal  = FF_CODEC_CAP_NOT_INIT_THREADSAFE, \
+    .caps_internal  = FF_CODEC_CAP_NOT_INIT_THREADSAFE | FF_CODEC_CAP_EXPORTS_CROPPING, \
 }; \
 
 #define DEFINE_QSV_DECODER(x, X, bsf_name) DEFINE_QSV_DECODER_WITH_OPTION(x, X, bsf_name, options)
-- 
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".

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [FFmpeg-devel] [PATCH v1 2/2] lavc/qsvdec: Use coded_w/h for frame resolution when use system memory
  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
  2024-05-24  2:03 ` [FFmpeg-devel] [PATCH v1 1/2] lavc/qsvdec: Allow decoders to export crop information Xiang, Haihao
  1 sibling, 0 replies; 3+ messages in thread
From: fei.w.wang-at-intel.com @ 2024-05-20  2:05 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: fei.w.wang

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".

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [FFmpeg-devel] [PATCH v1 1/2] lavc/qsvdec: Allow decoders to export crop information
  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 ` [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
@ 2024-05-24  2:03 ` Xiang, Haihao
  1 sibling, 0 replies; 3+ messages in thread
From: Xiang, Haihao @ 2024-05-24  2:03 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Wang, Fei W

On Ma, 2024-05-20 at 10:05 +0800, fei.w.wang-at-intel.com@ffmpeg.org wrote:
> From: Fei Wang <fei.w.wang@intel.com>
> 
> Signed-off-by: Fei Wang <fei.w.wang@intel.com>
> ---
>  libavcodec/qsvdec.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
> index a51ddace62..12cf630593 100644
> --- a/libavcodec/qsvdec.c
> +++ b/libavcodec/qsvdec.c
> @@ -859,6 +859,10 @@ static int qsv_decode(AVCodecContext *avctx, QSVContext
> *q,
>              else
>                  frame->flags &= ~AV_FRAME_FLAG_KEY;
>          }
> +        frame->crop_left   = outsurf->Info.CropX;
> +        frame->crop_top    = outsurf->Info.CropY;
> +        frame->crop_right  = outsurf->Info.Width - (outsurf->Info.CropX +
> outsurf->Info.CropW);
> +        frame->crop_bottom = outsurf->Info.Height - (outsurf->Info.CropY +
> outsurf->Info.CropH);
>  
>          /* update the surface properties */
>          if (avctx->pix_fmt == AV_PIX_FMT_QSV)
> @@ -1148,7 +1152,7 @@ const FFCodec ff_##x##_qsv_decoder = { \
>      .p.priv_class   = &x##_qsv_class, \
>      .hw_configs     = qsv_hw_configs, \
>      .p.wrapper_name = "qsv", \
> -    .caps_internal  = FF_CODEC_CAP_NOT_INIT_THREADSAFE, \
> +    .caps_internal  = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
> FF_CODEC_CAP_EXPORTS_CROPPING, \
>  }; \
>  
>  #define DEFINE_QSV_DECODER(x, X, bsf_name) DEFINE_QSV_DECODER_WITH_OPTION(x,
> X, bsf_name, options)

patchset LGTM, will apply

Thanks
Haihao


_______________________________________________
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".

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-05-24  2:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [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
2024-05-24  2:03 ` [FFmpeg-devel] [PATCH v1 1/2] lavc/qsvdec: Allow decoders to export crop information Xiang, Haihao

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