* [FFmpeg-devel] [PATCH] lavfi/vf_vpp_qsv: only add the given output sw format to output pad
@ 2023-03-27 6:23 Xiang, Haihao
2023-03-29 4:34 ` Xiang, Haihao
0 siblings, 1 reply; 2+ messages in thread
From: Xiang, Haihao @ 2023-03-27 6:23 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Haihao Xiang
From: Haihao Xiang <haihao.xiang@intel.com>
Otherwise the output format is not changed when output is in system
memory. For example, the output format is still p010le in the following
case:
$ ffmpeg -qsv_device /dev/dri/renderD128 -f lavfi -i testsrc -vf
"format=p010le,vpp_qsv=extra_hw_frames=8:format=nv12" -f null -
...
Output #0, null, to 'pipe:':
Metadata:
encoder : Lavf60.4.100
Stream #0:0: Video: wrapped_avframe, p010le(tv, progressive), 320x240
[SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 25 fps, 25 tbn
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
---
libavfilter/vf_vpp_qsv.c | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c
index 76f0bc3df1..334a86551b 100644
--- a/libavfilter/vf_vpp_qsv.c
+++ b/libavfilter/vf_vpp_qsv.c
@@ -714,7 +714,8 @@ static const AVOption vpp_options[] = {
static int vpp_query_formats(AVFilterContext *ctx)
{
- int ret;
+ VPPContext *vpp = ctx->priv;
+ int ret, i = 0;
static const enum AVPixelFormat in_pix_fmts[] = {
AV_PIX_FMT_YUV420P,
AV_PIX_FMT_NV12,
@@ -727,17 +728,25 @@ static int vpp_query_formats(AVFilterContext *ctx)
AV_PIX_FMT_QSV,
AV_PIX_FMT_NONE
};
- static const enum AVPixelFormat out_pix_fmts[] = {
- AV_PIX_FMT_NV12,
- AV_PIX_FMT_P010,
- AV_PIX_FMT_QSV,
- AV_PIX_FMT_NONE
- };
+ static enum AVPixelFormat out_pix_fmts[4];
ret = ff_formats_ref(ff_make_format_list(in_pix_fmts),
&ctx->inputs[0]->outcfg.formats);
if (ret < 0)
return ret;
+
+ /* User specifies the output format */
+ if (vpp->out_format == AV_PIX_FMT_NV12 ||
+ vpp->out_format == AV_PIX_FMT_P010)
+ out_pix_fmts[i++] = vpp->out_format;
+ else {
+ out_pix_fmts[i++] = AV_PIX_FMT_NV12;
+ out_pix_fmts[i++] = AV_PIX_FMT_P010;
+ }
+
+ out_pix_fmts[i++] = AV_PIX_FMT_QSV;
+ out_pix_fmts[i++] = AV_PIX_FMT_NONE;
+
return ff_formats_ref(ff_make_format_list(out_pix_fmts),
&ctx->outputs[0]->incfg.formats);
}
--
2.34.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] 2+ messages in thread
* Re: [FFmpeg-devel] [PATCH] lavfi/vf_vpp_qsv: only add the given output sw format to output pad
2023-03-27 6:23 [FFmpeg-devel] [PATCH] lavfi/vf_vpp_qsv: only add the given output sw format to output pad Xiang, Haihao
@ 2023-03-29 4:34 ` Xiang, Haihao
0 siblings, 0 replies; 2+ messages in thread
From: Xiang, Haihao @ 2023-03-29 4:34 UTC (permalink / raw)
To: ffmpeg-devel
On Ma, 2023-03-27 at 14:23 +0800, Xiang, Haihao wrote:
> From: Haihao Xiang <haihao.xiang@intel.com>
>
> Otherwise the output format is not changed when output is in system
> memory. For example, the output format is still p010le in the following
> case:
>
> $ ffmpeg -qsv_device /dev/dri/renderD128 -f lavfi -i testsrc -vf
> "format=p010le,vpp_qsv=extra_hw_frames=8:format=nv12" -f null -
> ...
> Output #0, null, to 'pipe:':
> Metadata:
> encoder : Lavf60.4.100
> Stream #0:0: Video: wrapped_avframe, p010le(tv, progressive), 320x240
> [SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 25 fps, 25 tbn
>
> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
> ---
> libavfilter/vf_vpp_qsv.c | 23 ++++++++++++++++-------
> 1 file changed, 16 insertions(+), 7 deletions(-)
>
> diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c
> index 76f0bc3df1..334a86551b 100644
> --- a/libavfilter/vf_vpp_qsv.c
> +++ b/libavfilter/vf_vpp_qsv.c
> @@ -714,7 +714,8 @@ static const AVOption vpp_options[] = {
>
> static int vpp_query_formats(AVFilterContext *ctx)
> {
> - int ret;
> + VPPContext *vpp = ctx->priv;
> + int ret, i = 0;
> static const enum AVPixelFormat in_pix_fmts[] = {
> AV_PIX_FMT_YUV420P,
> AV_PIX_FMT_NV12,
> @@ -727,17 +728,25 @@ static int vpp_query_formats(AVFilterContext *ctx)
> AV_PIX_FMT_QSV,
> AV_PIX_FMT_NONE
> };
> - static const enum AVPixelFormat out_pix_fmts[] = {
> - AV_PIX_FMT_NV12,
> - AV_PIX_FMT_P010,
> - AV_PIX_FMT_QSV,
> - AV_PIX_FMT_NONE
> - };
> + static enum AVPixelFormat out_pix_fmts[4];
>
> ret = ff_formats_ref(ff_make_format_list(in_pix_fmts),
> &ctx->inputs[0]->outcfg.formats);
> if (ret < 0)
> return ret;
> +
> + /* User specifies the output format */
> + if (vpp->out_format == AV_PIX_FMT_NV12 ||
> + vpp->out_format == AV_PIX_FMT_P010)
> + out_pix_fmts[i++] = vpp->out_format;
> + else {
> + out_pix_fmts[i++] = AV_PIX_FMT_NV12;
> + out_pix_fmts[i++] = AV_PIX_FMT_P010;
> + }
> +
> + out_pix_fmts[i++] = AV_PIX_FMT_QSV;
> + out_pix_fmts[i++] = AV_PIX_FMT_NONE;
> +
> return ff_formats_ref(ff_make_format_list(out_pix_fmts),
> &ctx->outputs[0]->incfg.formats);
> }
Will aplly
- 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] 2+ messages in thread
end of thread, other threads:[~2023-03-29 4:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-27 6:23 [FFmpeg-devel] [PATCH] lavfi/vf_vpp_qsv: only add the given output sw format to output pad Xiang, Haihao
2023-03-29 4:34 ` 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