From: "Xiang, Haihao" <haihao.xiang-at-intel.com@ffmpeg.org>
To: "ffmpeg-devel@ffmpeg.org" <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH 1/8] lavfi/vf_vpp_qsv: add "a", "dar" and "sar" variables
Date: Thu, 12 Jan 2023 03:58:55 +0000
Message-ID: <e030d24ec15c27ed4b6dfdfdbc25ba7b6deda63c.camel@intel.com> (raw)
In-Reply-To: <20230109071210.1829699-1-haihao.xiang@intel.com>
On Ma, 2023-01-09 at 15:12 +0800, Xiang, Haihao wrote:
> From: Haihao Xiang <haihao.xiang@intel.com>
>
> Also fix the naming style in enum var_name.
>
> This is in preparation for reusing the code for other QSV filters.
>
> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
> ---
> libavfilter/vf_vpp_qsv.c | 49 ++++++++++++++++++++++++----------------
> 1 file changed, 29 insertions(+), 20 deletions(-)
>
> diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c
> index 317ae06c12..8d4227f841 100644
> --- a/libavfilter/vf_vpp_qsv.c
> +++ b/libavfilter/vf_vpp_qsv.c
> @@ -150,18 +150,22 @@ static const char *const var_names[] = {
> "ch",
> "cx",
> "cy",
> + "a", "dar",
> + "sar",
> NULL
> };
>
> enum var_name {
> - VAR_iW, VAR_IN_W,
> - VAR_iH, VAR_IN_H,
> - VAR_oW, VAR_OUT_W, VAR_W,
> - VAR_oH, VAR_OUT_H, VAR_H,
> - CW,
> - CH,
> - CX,
> - CY,
> + VAR_IW, VAR_IN_W,
> + VAR_IH, VAR_IN_H,
> + VAR_OW, VAR_OUT_W, VAR_W,
> + VAR_OH, VAR_OUT_H, VAR_H,
> + VAR_CW,
> + VAR_CH,
> + VAR_CX,
> + VAR_CY,
> + VAR_A, VAR_DAR,
> + VAR_SAR,
> VAR_VARS_NB
> };
>
> @@ -193,39 +197,44 @@ static int eval_expr(AVFilterContext *ctx)
> PASS_EXPR(cx_expr, vpp->cx);
> PASS_EXPR(cy_expr, vpp->cy);
>
> - var_values[VAR_iW] =
> + var_values[VAR_IW] =
> var_values[VAR_IN_W] = ctx->inputs[0]->w;
>
> - var_values[VAR_iH] =
> + var_values[VAR_IH] =
> var_values[VAR_IN_H] = ctx->inputs[0]->h;
>
> + var_values[VAR_A] = (double)var_values[VAR_IN_W] / var_values[VAR_IN_H];
> + var_values[VAR_SAR] = ctx->inputs[0]->sample_aspect_ratio.num ?
> + (double)ctx->inputs[0]->sample_aspect_ratio.num / ctx->inputs[0]-
> >sample_aspect_ratio.den : 1;
> + var_values[VAR_DAR] = var_values[VAR_A] * var_values[VAR_SAR];
> +
> /* crop params */
> - CALC_EXPR(cw_expr, var_values[CW], vpp->crop_w);
> - CALC_EXPR(ch_expr, var_values[CH], vpp->crop_h);
> + CALC_EXPR(cw_expr, var_values[VAR_CW], vpp->crop_w);
> + CALC_EXPR(ch_expr, var_values[VAR_CH], vpp->crop_h);
>
> /* calc again in case cw is relative to ch */
> - CALC_EXPR(cw_expr, var_values[CW], vpp->crop_w);
> + CALC_EXPR(cw_expr, var_values[VAR_CW], vpp->crop_w);
>
> CALC_EXPR(w_expr,
> - var_values[VAR_OUT_W] = var_values[VAR_oW] = var_values[VAR_W],
> + var_values[VAR_OUT_W] = var_values[VAR_OW] = var_values[VAR_W],
> vpp->out_width);
> CALC_EXPR(h_expr,
> - var_values[VAR_OUT_H] = var_values[VAR_oH] = var_values[VAR_H],
> + var_values[VAR_OUT_H] = var_values[VAR_OH] = var_values[VAR_H],
> vpp->out_height);
>
> /* calc again in case ow is relative to oh */
> CALC_EXPR(w_expr,
> - var_values[VAR_OUT_W] = var_values[VAR_oW] = var_values[VAR_W],
> + var_values[VAR_OUT_W] = var_values[VAR_OW] = var_values[VAR_W],
> vpp->out_width);
>
>
> - CALC_EXPR(cx_expr, var_values[CX], vpp->crop_x);
> - CALC_EXPR(cy_expr, var_values[CY], vpp->crop_y);
> + CALC_EXPR(cx_expr, var_values[VAR_CX], vpp->crop_x);
> + CALC_EXPR(cy_expr, var_values[VAR_CY], vpp->crop_y);
>
> /* calc again in case cx is relative to cy */
> - CALC_EXPR(cx_expr, var_values[CX], vpp->crop_x);
> + CALC_EXPR(cx_expr, var_values[VAR_CX], vpp->crop_x);
>
> - if ((vpp->crop_w != var_values[VAR_iW]) || (vpp->crop_h !=
> var_values[VAR_iH]))
> + if ((vpp->crop_w != var_values[VAR_IW]) || (vpp->crop_h !=
> var_values[VAR_IH]))
> vpp->use_crop = 1;
>
> release:
Will apply,
-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".
prev parent reply other threads:[~2023-01-12 3:59 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-09 7:12 Xiang, Haihao
2023-01-09 7:12 ` [FFmpeg-devel] [PATCH 2/8] lavfi/vf_vpp_qsv: handle NULL pointer when evaluating an expression Xiang, Haihao
2023-01-12 4:01 ` Andreas Rheinhardt
2023-01-12 6:20 ` Xiang, Haihao
2023-01-16 4:34 ` Xiang, Haihao
2023-01-09 7:12 ` [FFmpeg-devel] [PATCH 3/8] lavfi/vf_vpp_qsv: allow special values for the output video dimensions Xiang, Haihao
2023-01-09 7:12 ` [FFmpeg-devel] [PATCH 4/8] lavfi/vf_vpp_qsv: add vpp_preinit callback Xiang, Haihao
2023-01-12 4:11 ` Andreas Rheinhardt
2023-01-12 4:44 ` Xiang, Haihao
2023-01-12 4:49 ` Andreas Rheinhardt
2023-01-12 5:41 ` Xiang, Haihao
2023-01-09 7:12 ` [FFmpeg-devel] [PATCH 5/8] lavfi/vf_vpp_qsv: add has_passthrough flag in VPPContext Xiang, Haihao
2023-01-12 4:31 ` Andreas Rheinhardt
2023-01-12 4:53 ` Xiang, Haihao
2023-01-09 7:12 ` [FFmpeg-devel] [PATCH 6/8] lavfi/vf_vpp_qsv: check output format string against NULL pointer Xiang, Haihao
2023-01-09 7:12 ` [FFmpeg-devel] [PATCH 7/8] lavfi/qsvvpp: set output frame durations Xiang, Haihao
2023-01-09 7:12 ` [FFmpeg-devel] [PATCH 8/8] lavfi/qsv: use QSVVPPContext as base context in vf_vpp_qsv/vf_overlay_qsv Xiang, Haihao
2023-01-12 3:58 ` Xiang, Haihao [this message]
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=e030d24ec15c27ed4b6dfdfdbc25ba7b6deda63c.camel@intel.com \
--to=haihao.xiang-at-intel.com@ffmpeg.org \
--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