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 1/3] avfilter/vf_zscale: remove some unneeded initializations
@ 2022-07-07 22:29 Marton Balint
  2022-07-07 22:29 ` [FFmpeg-devel] [PATCH 2/3] avfilter/vf_zscale: simplify and fix slice_params calculations Marton Balint
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Marton Balint @ 2022-07-07 22:29 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Marton Balint

Signed-off-by: Marton Balint <cus@passwd.hu>
---
 libavfilter/vf_zscale.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/libavfilter/vf_zscale.c b/libavfilter/vf_zscale.c
index 44cb4b9c61..6861eef278 100644
--- a/libavfilter/vf_zscale.c
+++ b/libavfilter/vf_zscale.c
@@ -149,12 +149,6 @@ static av_cold int init(AVFilterContext *ctx)
 {
     ZScaleContext *s = ctx->priv;
     int ret;
-    int i;
-    for (i = 0; i < MAX_THREADS; i++) {
-        s->tmp[i] = NULL;
-        s->graph[i] = NULL;
-        s->alpha_graph[i] = NULL;
-    }
     zimg_image_format_default(&s->src_format, ZIMG_API_VERSION);
     zimg_image_format_default(&s->dst_format, ZIMG_API_VERSION);
     zimg_image_format_default(&s->src_format_tmp, ZIMG_API_VERSION);
-- 
2.35.3

_______________________________________________
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] 5+ messages in thread

* [FFmpeg-devel] [PATCH 2/3] avfilter/vf_zscale: simplify and fix slice_params calculations
  2022-07-07 22:29 [FFmpeg-devel] [PATCH 1/3] avfilter/vf_zscale: remove some unneeded initializations Marton Balint
@ 2022-07-07 22:29 ` Marton Balint
  2022-07-07 22:29 ` [FFmpeg-devel] [PATCH 3/3] avfilter/vf_zscake: enable AVX512 zscale functions Marton Balint
  2022-07-10 20:46 ` [FFmpeg-devel] [PATCH 1/3] avfilter/vf_zscale: remove some unneeded initializations Marton Balint
  2 siblings, 0 replies; 5+ messages in thread
From: Marton Balint @ 2022-07-07 22:29 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Marton Balint

Do not insist on a fixed slice height, because that can still cause overflows
in corner cases as described in this comment:

https://github.com/sekrit-twc/zimg/issues/177#issuecomment-1157734233

Signed-off-by: Marton Balint <cus@passwd.hu>
---
 libavfilter/vf_zscale.c | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/libavfilter/vf_zscale.c b/libavfilter/vf_zscale.c
index 6861eef278..8e50457c6b 100644
--- a/libavfilter/vf_zscale.c
+++ b/libavfilter/vf_zscale.c
@@ -227,22 +227,12 @@ static int query_formats(AVFilterContext *ctx)
 
 static void slice_params(ZScaleContext *s, int out_h, int in_h)
 {
-    int slice_size;
-
-    slice_size = (out_h + (s->nb_threads / 2)) / s->nb_threads;
-    if (slice_size % 2)
-        slice_size += 1;
     s->out_slice_start[0] = 0;
-    s->out_slice_end[0] = FFMIN(out_h, slice_size);
-    for (int i = 1; i < s->nb_threads - 1; i++) {
-        s->out_slice_start[i] = s->out_slice_end[i-1];
-        s->out_slice_end[i] = s->out_slice_start[i] + slice_size;
-    }
-
-    if (s->nb_threads > 1) {
-        s->out_slice_start[s->nb_threads - 1] = s->out_slice_end[s->nb_threads - 2];
-        s->out_slice_end[s->nb_threads - 1] = out_h;
+    for (int i = 1; i < s->nb_threads; i++) {
+        int slice_end = out_h * i / s->nb_threads;
+        s->out_slice_end[i - 1] = s->out_slice_start[i] = FFALIGN(slice_end, 2);
     }
+    s->out_slice_end[s->nb_threads - 1] = out_h;
 
     for (int i = 0; i < s->nb_threads; i++) {
         s->in_slice_start[i] = s->out_slice_start[i] * in_h / (double)out_h;
-- 
2.35.3

_______________________________________________
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] 5+ messages in thread

* [FFmpeg-devel] [PATCH 3/3] avfilter/vf_zscake: enable AVX512 zscale functions
  2022-07-07 22:29 [FFmpeg-devel] [PATCH 1/3] avfilter/vf_zscale: remove some unneeded initializations Marton Balint
  2022-07-07 22:29 ` [FFmpeg-devel] [PATCH 2/3] avfilter/vf_zscale: simplify and fix slice_params calculations Marton Balint
@ 2022-07-07 22:29 ` Marton Balint
  2022-07-10 20:46 ` [FFmpeg-devel] [PATCH 1/3] avfilter/vf_zscale: remove some unneeded initializations Marton Balint
  2 siblings, 0 replies; 5+ messages in thread
From: Marton Balint @ 2022-07-07 22:29 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Marton Balint

Signed-off-by: Marton Balint <cus@passwd.hu>
---
 libavfilter/vf_zscale.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_zscale.c b/libavfilter/vf_zscale.c
index 8e50457c6b..91166dcbcb 100644
--- a/libavfilter/vf_zscale.c
+++ b/libavfilter/vf_zscale.c
@@ -837,7 +837,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
         s->first_time = 0;
 
         s->params.dither_type = s->dither;
-        s->params.cpu_type = ZIMG_CPU_AUTO;
+        s->params.cpu_type = ZIMG_CPU_AUTO_64B;
         s->params.resample_filter = s->filter;
         s->params.resample_filter_uv = s->filter;
         s->params.nominal_peak_luminance = s->nominal_peak_luminance;
@@ -851,7 +851,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
             zimg_graph_builder_params_default(&s->alpha_params, ZIMG_API_VERSION);
 
             s->alpha_params.dither_type = s->dither;
-            s->alpha_params.cpu_type = ZIMG_CPU_AUTO;
+            s->alpha_params.cpu_type = ZIMG_CPU_AUTO_64B;
             s->alpha_params.resample_filter = s->filter;
 
             s->alpha_src_format.width = in->width;
-- 
2.35.3

_______________________________________________
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] 5+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/3] avfilter/vf_zscale: remove some unneeded initializations
  2022-07-07 22:29 [FFmpeg-devel] [PATCH 1/3] avfilter/vf_zscale: remove some unneeded initializations Marton Balint
  2022-07-07 22:29 ` [FFmpeg-devel] [PATCH 2/3] avfilter/vf_zscale: simplify and fix slice_params calculations Marton Balint
  2022-07-07 22:29 ` [FFmpeg-devel] [PATCH 3/3] avfilter/vf_zscake: enable AVX512 zscale functions Marton Balint
@ 2022-07-10 20:46 ` Marton Balint
  2022-07-10 21:51   ` Paul B Mahol
  2 siblings, 1 reply; 5+ messages in thread
From: Marton Balint @ 2022-07-10 20:46 UTC (permalink / raw)
  To: FFmpeg development discussions and patches



On Fri, 8 Jul 2022, Marton Balint wrote:

> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
> libavfilter/vf_zscale.c | 6 ------
> 1 file changed, 6 deletions(-)
>
> diff --git a/libavfilter/vf_zscale.c b/libavfilter/vf_zscale.c
> index 44cb4b9c61..6861eef278 100644
> --- a/libavfilter/vf_zscale.c
> +++ b/libavfilter/vf_zscale.c
> @@ -149,12 +149,6 @@ static av_cold int init(AVFilterContext *ctx)
> {
>     ZScaleContext *s = ctx->priv;
>     int ret;
> -    int i;
> -    for (i = 0; i < MAX_THREADS; i++) {
> -        s->tmp[i] = NULL;
> -        s->graph[i] = NULL;
> -        s->alpha_graph[i] = NULL;
> -    }
>     zimg_image_format_default(&s->src_format, ZIMG_API_VERSION);
>     zimg_image_format_default(&s->dst_format, ZIMG_API_VERSION);
>     zimg_image_format_default(&s->src_format_tmp, ZIMG_API_VERSION);
> --

Will apply the series.

Regards,
Marton

> 2.35.3
>
> _______________________________________________
> 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".
>
_______________________________________________
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] 5+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/3] avfilter/vf_zscale: remove some unneeded initializations
  2022-07-10 20:46 ` [FFmpeg-devel] [PATCH 1/3] avfilter/vf_zscale: remove some unneeded initializations Marton Balint
@ 2022-07-10 21:51   ` Paul B Mahol
  0 siblings, 0 replies; 5+ messages in thread
From: Paul B Mahol @ 2022-07-10 21:51 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

This was not critical at all, please revert.
_______________________________________________
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] 5+ messages in thread

end of thread, other threads:[~2022-07-10 21:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-07 22:29 [FFmpeg-devel] [PATCH 1/3] avfilter/vf_zscale: remove some unneeded initializations Marton Balint
2022-07-07 22:29 ` [FFmpeg-devel] [PATCH 2/3] avfilter/vf_zscale: simplify and fix slice_params calculations Marton Balint
2022-07-07 22:29 ` [FFmpeg-devel] [PATCH 3/3] avfilter/vf_zscake: enable AVX512 zscale functions Marton Balint
2022-07-10 20:46 ` [FFmpeg-devel] [PATCH 1/3] avfilter/vf_zscale: remove some unneeded initializations Marton Balint
2022-07-10 21:51   ` Paul B Mahol

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