[FFmpeg-cvslog] checkasm/h264dsp: add missing pixel_mask values

2024-05-14 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue May 14 23:17:30 
2024 -0300| [8670615743eb36d7b3e9b522266518796df7ec54] | committer: James Almer

checkasm/h264dsp: add missing pixel_mask values

Fixes "runtime error: index 4 out of bounds for type 'uint32_t [3]'" errors
after commit 4ced36744ee0bea5fb7a20d1b2926c588f89ea0b.

Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8670615743eb36d7b3e9b522266518796df7ec54
---

 tests/checkasm/h264dsp.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/checkasm/h264dsp.c b/tests/checkasm/h264dsp.c
index 30ac81e71e..cb180cc44f 100644
--- a/tests/checkasm/h264dsp.c
+++ b/tests/checkasm/h264dsp.c
@@ -27,17 +27,17 @@
 #include "libavutil/intreadwrite.h"
 #include "libavutil/mem_internal.h"
 
-static const uint32_t pixel_mask[3] = { 0x, 0x01ff01ff, 0x03ff03ff };
+static const uint32_t pixel_mask[5] = { 0x, 0x01ff01ff, 0x03ff03ff, 
0x0fff0fff, 0x3fff3fff };
 static const uint32_t pixel_mask_lf[3] = { 0xff0fff0f, 0x01ff000f, 0x03ff000f 
};
 
 #define SIZEOF_PIXEL ((bit_depth + 7) / 8)
 #define SIZEOF_COEF  (2 * ((bit_depth + 7) / 8))
 #define PIXEL_STRIDE 16
 
-#define randomize_buffers()  \
+#define randomize_buffers(idx)   \
 do { \
 int x, y;\
-uint32_t mask = pixel_mask[bit_depth - 8];   \
+uint32_t mask = pixel_mask[(idx)];   \
 for (y = 0; y < sz; y++) {   \
 for (x = 0; x < PIXEL_STRIDE; x += 4) {  \
 AV_WN32A(src + y * PIXEL_STRIDE + x, rnd() & mask);  \
@@ -189,7 +189,7 @@ static void check_idct(void)
 bit_depth = depths[i];
 ff_h264dsp_init(, bit_depth, 1);
 for (sz = 4; sz <= 8; sz += 4) {
-randomize_buffers();
+randomize_buffers(i);
 
 if (sz == 4)
 dct4x4(coef, bit_depth);
@@ -277,7 +277,7 @@ static void check_idct_multiple(void)
 int offset = (block_y * 16 + block_x) * SIZEOF_PIXEL;
 int nnz = rnd() % 3;
 
-randomize_buffers();
+randomize_buffers(bit_depth - 8);
 if (sz == 4)
 dct4x4(coef, bit_depth);
 else

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] fate/checkasm: test vvc_alf

2024-05-14 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue May 14 22:58:21 
2024 -0300| [e9741f1a6bc2c3be05e818b1d5d2cb6f6e1d857a] | committer: James Almer

fate/checkasm: test vvc_alf

Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e9741f1a6bc2c3be05e818b1d5d2cb6f6e1d857a
---

 tests/fate/checkasm.mak | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/fate/checkasm.mak b/tests/fate/checkasm.mak
index 9b5e2b0d98..d021e124d1 100644
--- a/tests/fate/checkasm.mak
+++ b/tests/fate/checkasm.mak
@@ -59,6 +59,7 @@ FATE_CHECKASM = fate-checkasm-aacencdsp   
  \
 fate-checkasm-vorbisdsp \
 fate-checkasm-vp8dsp\
 fate-checkasm-vp9dsp\
+fate-checkasm-vvc_alf   \
 fate-checkasm-vvc_mc\
 
 $(FATE_CHECKASM): tests/checkasm/checkasm$(EXESUF)

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/jpeg2000dec: remove ST=3 case

2024-05-14 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Fri 
May 10 16:07:04 2024 +0200| [4ed4f9a6c0a99c823706bfc4bb4df53f963f2f5a] | 
committer: Michael Niedermayer

avcodec/jpeg2000dec: remove ST=3 case

Fixes: CID1460979 Logically dead code

Sponsored-by: Sovereign Tech Fund
Reviewed-by: Tomas Härdin 
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4ed4f9a6c0a99c823706bfc4bb4df53f963f2f5a
---

 libavcodec/jpeg2000dec.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 28bf6be2fe..135537b52f 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -835,9 +835,6 @@ static int get_tlm(Jpeg2000DecoderContext *s, int n)
 case 2:
 bytestream2_get_be16(>g);
 break;
-case 3:
-bytestream2_get_be32(>g);
-break;
 }
 if (SP == 0) {
 bytestream2_get_be16(>g);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/qsvdec: Check av_image_get_buffer_size() for failure

2024-05-14 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Mon 
May 13 02:05:56 2024 +0200| [8789c550faf4587527faf0bd4f6c6c5c64a04ae2] | 
committer: Michael Niedermayer

avcodec/qsvdec: Check av_image_get_buffer_size() for failure

Fixes: CID1477406 Improper use of negative value

Sponsored-by: Sovereign Tech Fund
Reviewed-by: "Xiang, Haihao" 
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8789c550faf4587527faf0bd4f6c6c5c64a04ae2
---

 libavcodec/qsvdec.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index ed0bfe4c8b..a51ddace62 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -379,9 +379,12 @@ static int qsv_decode_init_context(AVCodecContext *avctx, 
QSVContext *q, mfxVide
 
 q->frame_info = param->mfx.FrameInfo;
 
-if (!avctx->hw_frames_ctx)
-q->pool = av_buffer_pool_init(av_image_get_buffer_size(avctx->pix_fmt,
-FFALIGN(avctx->width, 128), FFALIGN(avctx->height, 64), 
1), av_buffer_allocz);
+if (!avctx->hw_frames_ctx) {
+ret = av_image_get_buffer_size(avctx->pix_fmt, FFALIGN(avctx->width, 
128), FFALIGN(avctx->height, 64), 1);
+if (ret < 0)
+return ret;
+q->pool = av_buffer_pool_init(ret, av_buffer_allocz);
+}
 return 0;
 }
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avfilter/vf_geq: fix interpolation with 1 pixel width/height

2024-05-14 Thread Marton Balint
ffmpeg | branch: master | Marton Balint  | Thu May  9 00:17:53 
2024 +0200| [b0093ab8a3d34bf2fefd6665464cc343a9ef0d53] | committer: Marton 
Balint

avfilter/vf_geq: fix interpolation with 1 pixel width/height

Fixes ticket #9740.

Signed-off-by: Marton Balint 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b0093ab8a3d34bf2fefd6665464cc343a9ef0d53
---

 libavfilter/vf_geq.c | 20 
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/libavfilter/vf_geq.c b/libavfilter/vf_geq.c
index dbe50e5250..0efbce4d4f 100644
--- a/libavfilter/vf_geq.c
+++ b/libavfilter/vf_geq.c
@@ -112,8 +112,12 @@ static inline double getpix(void *priv, double x, double 
y, int plane)
 return 0;
 
 if (geq->interpolation == INTERP_BILINEAR) {
-xi = x = av_clipd(x, 0, w - 2);
-yi = y = av_clipd(y, 0, h - 2);
+int xn, yn;
+
+xi = x = av_clipd(x, 0, w - 1);
+yi = y = av_clipd(y, 0, h - 1);
+xn = FFMIN(xi + 1, w - 1);
+yn = FFMIN(yi + 1, h - 1);
 
 x -= xi;
 y -= yi;
@@ -122,17 +126,17 @@ static inline double getpix(void *priv, double x, double 
y, int plane)
 const uint16_t *src16 = (const uint16_t*)src;
 linesize /= 2;
 
-return (1-y)*((1-x)*src16[xi +  yi* linesize] + x*src16[xi + 1 
+  yi* linesize])
-  +   y *((1-x)*src16[xi + (yi+1) * linesize] + x*src16[xi + 1 
+ (yi+1) * linesize]);
+return (1-y)*((1-x)*src16[xi + yi * linesize] + x*src16[xn + yi * 
linesize])
+  +   y *((1-x)*src16[xi + yn * linesize] + x*src16[xn + yn * 
linesize]);
 } else if (geq->bps == 32) {
 const float *src32 = (const float*)src;
 linesize /= 4;
 
-return (1-y)*((1-x)*src32[xi +  yi* linesize] + x*src32[xi + 1 
+  yi* linesize])
-  +   y *((1-x)*src32[xi + (yi+1) * linesize] + x*src32[xi + 1 
+ (yi+1) * linesize]);
+return (1-y)*((1-x)*src32[xi + yi * linesize] + x*src32[xn + yi * 
linesize])
+  +   y *((1-x)*src32[xi + yn * linesize] + x*src32[xn + yn * 
linesize]);
 } else if (geq->bps == 8) {
-return (1-y)*((1-x)*src[xi +  yi* linesize] + x*src[xi + 1 +  
yi* linesize])
-  +   y *((1-x)*src[xi + (yi+1) * linesize] + x*src[xi + 1 + 
(yi+1) * linesize]);
+return (1-y)*((1-x)*src[xi + yi * linesize] + x*src[xn + yi * 
linesize])
+  +   y *((1-x)*src[xi + yn * linesize] + x*src[xn + yn * 
linesize]);
 }
 } else {
 xi = av_clipd(x, 0, w - 1);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avfilter/blend: use a per-thread AVExpr

2024-05-14 Thread Marton Balint
ffmpeg | branch: master | Marton Balint  | Thu May  9 00:07:26 
2024 +0200| [64330e365b97d9b8304a9d3d306581b6c14a773b] | committer: Marton 
Balint

avfilter/blend: use a per-thread AVExpr

Otherwise expression state is accessed and changed from multiple threads.

Fixes ticket #10987.

Signed-off-by: Marton Balint 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=64330e365b97d9b8304a9d3d306581b6c14a773b
---

 libavfilter/blend.h|  3 ++-
 libavfilter/vf_blend.c | 35 ++-
 2 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/libavfilter/blend.h b/libavfilter/blend.h
index 52c1b777c2..e6636839db 100644
--- a/libavfilter/blend.h
+++ b/libavfilter/blend.h
@@ -72,12 +72,13 @@ enum BlendMode {
 typedef struct SliceParams {
 double *values;
 int starty;
+AVExpr *e;
 } SliceParams;
 
 typedef struct FilterParams {
 enum BlendMode mode;
 double opacity;
-AVExpr *e;
+AVExpr **e;
 char *expr_str;
 void (*blend)(const uint8_t *top, ptrdiff_t top_linesize,
   const uint8_t *bottom, ptrdiff_t bottom_linesize,
diff --git a/libavfilter/vf_blend.c b/libavfilter/vf_blend.c
index 9ee8901e45..5ea6df2e75 100644
--- a/libavfilter/vf_blend.c
+++ b/libavfilter/vf_blend.c
@@ -47,6 +47,7 @@ typedef struct BlendContext {
 FilterParams params[4];
 int tblend;
 AVFrame *prev_frame;/* only used with tblend */
+int nb_threads;
 } BlendContext;
 
 static const char *const var_names[] = {   "X",   "Y",   "W",   "H",   "SW",   
"SH",   "T",   "N",   "A",   "B",   "TOP",   "BOTTOM",NULL };
@@ -139,7 +140,7 @@ static void blend_expr_## name(const uint8_t *_top, 
ptrdiff_t top_linesize,
 double *values = sliceparam->values;   
\
 int starty = sliceparam->starty;   
\
 type *dst = (type*)_dst;   
\
-AVExpr *e = param->e;  
\
+AVExpr *e = sliceparam->e; 
\
 int y, x;  
\
 dst_linesize /= div;   
\
 top_linesize /= div;   
\
@@ -173,7 +174,7 @@ static int filter_slice(AVFilterContext *ctx, void *arg, 
int jobnr, int nb_jobs)
 const uint8_t *bottom = td->bottom->data[td->plane];
 uint8_t *dst= td->dst->data[td->plane];
 double values[VAR_VARS_NB];
-SliceParams sliceparam = {.values = [0], .starty = slice_start};
+SliceParams sliceparam = {.values = [0], .starty = slice_start, .e 
= td->param->e ? td->param->e[jobnr] : NULL};
 
 values[VAR_N]  = td->inlink->frame_count_out;
 values[VAR_T]  = td->dst->pts == AV_NOPTS_VALUE ? NAN : td->dst->pts * 
av_q2d(td->inlink->time_base);
@@ -221,7 +222,7 @@ static AVFrame *blend_frame(AVFilterContext *ctx, AVFrame 
*top_buf,
   .inlink = inlink };
 
 ff_filter_execute(ctx, filter_slice, , NULL,
-  FFMIN(outh, ff_filter_get_nb_threads(ctx)));
+  FFMIN(outh, s->nb_threads));
 }
 
 if (!s->tblend)
@@ -250,6 +251,7 @@ static av_cold int init(AVFilterContext *ctx)
 BlendContext *s = ctx->priv;
 
 s->tblend = !strcmp(ctx->filter->name, "tblend");
+s->nb_threads = ff_filter_get_nb_threads(ctx);
 
 s->fs.on_event = blend_frame_for_dualinput;
 return 0;
@@ -284,8 +286,14 @@ static av_cold void uninit(AVFilterContext *ctx)
 ff_framesync_uninit(>fs);
 av_frame_free(>prev_frame);
 
-for (i = 0; i < FF_ARRAY_ELEMS(s->params); i++)
-av_expr_free(s->params[i].e);
+for (i = 0; i < FF_ARRAY_ELEMS(s->params); i++) {
+if (s->params[i].e) {
+for (int j = 0; j < s->nb_threads; j++)
+av_expr_free(s->params[i].e[j]);
+av_freep(>params[i].e);
+}
+}
+
 }
 
 static int config_params(AVFilterContext *ctx)
@@ -309,10 +317,19 @@ static int config_params(AVFilterContext *ctx)
 return AVERROR(ENOMEM);
 }
 if (param->expr_str) {
-ret = av_expr_parse(>e, param->expr_str, var_names,
-NULL, NULL, NULL, NULL, 0, ctx);
-if (ret < 0)
-return ret;
+if (!param->e) {
+param->e = av_calloc(s->nb_threads, sizeof(*param->e));
+if (!param->e)
+return AVERROR(ENOMEM);
+}
+for (int i = 0; i < s->nb_threads; i++) {
+av_expr_free(param->e[i]);
+param->e[i] = NULL;
+ret = av_expr_parse(>e[i], param->expr_str, var_names,
+NULL, NULL, NULL, NULL, 0, ctx);
+if (ret < 0)
+return 

[FFmpeg-cvslog] avfilter/blend: put slice parameters to a single struct

2024-05-14 Thread Marton Balint
ffmpeg | branch: master | Marton Balint  | Wed May  8 23:05:27 
2024 +0200| [a69a0b689c3c4e1e0bbf4c17716a25e14332a250] | committer: Marton 
Balint

avfilter/blend: put slice parameters to a single struct

This should make future extensibility easier.

Signed-off-by: Marton Balint 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a69a0b689c3c4e1e0bbf4c17716a25e14332a250
---

 libavfilter/blend.h | 7 ++-
 libavfilter/blend_modes.c   | 2 +-
 libavfilter/vf_blend.c  | 7 +--
 libavfilter/vf_blend_init.h | 4 ++--
 libavfilter/x86/vf_blend_init.c | 2 +-
 5 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/libavfilter/blend.h b/libavfilter/blend.h
index b046e062bc..52c1b777c2 100644
--- a/libavfilter/blend.h
+++ b/libavfilter/blend.h
@@ -69,6 +69,11 @@ enum BlendMode {
 BLEND_NB
 };
 
+typedef struct SliceParams {
+double *values;
+int starty;
+} SliceParams;
+
 typedef struct FilterParams {
 enum BlendMode mode;
 double opacity;
@@ -78,7 +83,7 @@ typedef struct FilterParams {
   const uint8_t *bottom, ptrdiff_t bottom_linesize,
   uint8_t *dst, ptrdiff_t dst_linesize,
   ptrdiff_t width, ptrdiff_t height,
-  struct FilterParams *param, double *values, int starty);
+  struct FilterParams *param, SliceParams *sliceparam);
 } FilterParams;
 
 void ff_blend_init_x86(FilterParams *param, int depth);
diff --git a/libavfilter/blend_modes.c b/libavfilter/blend_modes.c
index 65c5e6f890..def5ae8e0d 100644
--- a/libavfilter/blend_modes.c
+++ b/libavfilter/blend_modes.c
@@ -91,7 +91,7 @@ static void fn0(NAME)(const uint8_t *_top, ptrdiff_t 
top_linesize, \
  const uint8_t *_bottom, ptrdiff_t bottom_linesize,   \
  uint8_t *_dst, ptrdiff_t dst_linesize,   \
  ptrdiff_t width, ptrdiff_t height,   \
- FilterParams *param, double *values, int starty) \
+ FilterParams *param, SliceParams *sliceparam)\
 {  
 \
 const PIXEL *top = (const PIXEL *)_top;
 \
 const PIXEL *bottom = (const PIXEL *)_bottom;  
 \
diff --git a/libavfilter/vf_blend.c b/libavfilter/vf_blend.c
index 6b52647966..9ee8901e45 100644
--- a/libavfilter/vf_blend.c
+++ b/libavfilter/vf_blend.c
@@ -132,10 +132,12 @@ static void blend_expr_## name(const uint8_t *_top, 
ptrdiff_t top_linesize,
const uint8_t *_bottom, ptrdiff_t 
bottom_linesize,\
uint8_t *_dst, ptrdiff_t dst_linesize,  
  \
ptrdiff_t width, ptrdiff_t height,  
\
-   FilterParams *param, double *values, int 
starty) \
+   FilterParams *param, SliceParams *sliceparam)   
\
 {  
\
 const type *top = (const type*)_top;   
\
 const type *bottom = (const type*)_bottom; 
\
+double *values = sliceparam->values;   
\
+int starty = sliceparam->starty;   
\
 type *dst = (type*)_dst;   
\
 AVExpr *e = param->e;  
\
 int y, x;  
\
@@ -171,6 +173,7 @@ static int filter_slice(AVFilterContext *ctx, void *arg, 
int jobnr, int nb_jobs)
 const uint8_t *bottom = td->bottom->data[td->plane];
 uint8_t *dst= td->dst->data[td->plane];
 double values[VAR_VARS_NB];
+SliceParams sliceparam = {.values = [0], .starty = slice_start};
 
 values[VAR_N]  = td->inlink->frame_count_out;
 values[VAR_T]  = td->dst->pts == AV_NOPTS_VALUE ? NAN : td->dst->pts * 
av_q2d(td->inlink->time_base);
@@ -185,7 +188,7 @@ static int filter_slice(AVFilterContext *ctx, void *arg, 
int jobnr, int nb_jobs)
  td->bottom->linesize[td->plane],
  dst + slice_start * td->dst->linesize[td->plane],
  td->dst->linesize[td->plane],
- td->w, height, td->param, [0], slice_start);
+ td->w, height, td->param, );
 return 0;
 }
 
diff --git a/libavfilter/vf_blend_init.h b/libavfilter/vf_blend_init.h
index d24f178032..956e1cb9fc 100644
--- a/libavfilter/vf_blend_init.h
+++ b/libavfilter/vf_blend_init.h
@@ -58,7 +58,7 @@ static void blend_copy ## src##_##depth(const uint8_t *top, 
ptrdiff_t top_linesi
 const uint8_t *bottom, ptrdiff_t bottom_linesize,\
 uint8_t *dst, ptrdiff_t dst_linesize,\
 

[FFmpeg-cvslog] avfilter/vsrc_testsrc: do not round down width and height for color src

2024-05-14 Thread Marton Balint
ffmpeg | branch: master | Marton Balint  | Wed May  8 09:40:57 
2024 +0200| [77fc047bd91eaef615a2c36b93ee23d7d27e7d25] | committer: Marton 
Balint

avfilter/vsrc_testsrc: do not round down width and height for color src

ff_draw_rectangle handles subsampling since 2013.

Fixes ticket #10989.

Signed-off-by: Marton Balint 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=77fc047bd91eaef615a2c36b93ee23d7d27e7d25
---

 libavfilter/vsrc_testsrc.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c
index 41c2e70068..4dc12c8a01 100644
--- a/libavfilter/vsrc_testsrc.c
+++ b/libavfilter/vsrc_testsrc.c
@@ -260,8 +260,6 @@ static int color_config_props(AVFilterLink *inlink)
   inlink->color_range, 0);
 ff_draw_color(>draw, >color, test->color_rgba);
 
-test->w = ff_draw_round_to_sub(>draw, 0, -1, test->w);
-test->h = ff_draw_round_to_sub(>draw, 1, -1, test->h);
 if (av_image_check_size(test->w, test->h, 0, ctx) < 0)
 return AVERROR(EINVAL);
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] lavu/riscv: remove bogus B extension

2024-05-14 Thread Rémi Denis-Courmont
ffmpeg | branch: master | Rémi Denis-Courmont  | Sat May 11 
19:05:06 2024 +0300| [20fbc07af1ebd5a68b8fd1203ceb4cab60bd7328] | committer: 
Rémi Denis-Courmont

lavu/riscv: remove bogus B extension

The B Bit manipulation extension was not defined to this day, and
probably never will. Instead it was broken down into Zba, Zbb, Zbc and
Zbs with no particular blessed set to make up B.

This removes the bogus field test. Linux never set this bit, nor
(AFAICT) did FreeBSD or any other OS. We can always add it back in the
unlikely event that it gets taken into use.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=20fbc07af1ebd5a68b8fd1203ceb4cab60bd7328
---

 libavutil/riscv/cpu.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/libavutil/riscv/cpu.c b/libavutil/riscv/cpu.c
index 1fe1a397c4..9b57d77502 100644
--- a/libavutil/riscv/cpu.c
+++ b/libavutil/riscv/cpu.c
@@ -91,8 +91,6 @@ int ff_get_cpu_flags_riscv(void)
 ret |= AV_CPU_FLAG_RVF;
 if (hwcap & HWCAP_RV('D'))
 ret |= AV_CPU_FLAG_RVD;
-if (hwcap & HWCAP_RV('B'))
-ret |= AV_CPU_FLAG_RVB_ADDR | AV_CPU_FLAG_RVB_BASIC;
 
 /* The V extension implies all Zve* functional subsets */
 if (hwcap & HWCAP_RV('V'))

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] lavc/vp8dsp: restrict RVI optimisations

2024-05-14 Thread Rémi Denis-Courmont
ffmpeg | branch: master | Rémi Denis-Courmont  | Sat May 11 
18:49:59 2024 +0300| [9d3f561721cd710bf403af991a0e36ccc9e8d8c8] | committer: 
Rémi Denis-Courmont

lavc/vp8dsp: restrict RVI optimisations

They are actually awfully slow if the CPU does not support misaligned
accesses natively, so only use them if misaligned accesses are fast.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9d3f561721cd710bf403af991a0e36ccc9e8d8c8
---

 libavcodec/riscv/vp8dsp_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/riscv/vp8dsp_init.c b/libavcodec/riscv/vp8dsp_init.c
index 39dc9a1b9d..31e8227fa4 100644
--- a/libavcodec/riscv/vp8dsp_init.c
+++ b/libavcodec/riscv/vp8dsp_init.c
@@ -45,7 +45,7 @@ av_cold void ff_vp78dsp_init_riscv(VP8DSPContext *c)
 {
 #if HAVE_RV
 int flags = av_get_cpu_flags();
-if (flags & AV_CPU_FLAG_RVI) {
+if (flags & AV_CPU_FLAG_RV_MISALIGNED) {
 #if __riscv_xlen >= 64
 c->put_vp8_epel_pixels_tab[0][0][0] = ff_put_vp8_pixels16_rvi;
 c->put_vp8_epel_pixels_tab[1][0][0] = ff_put_vp8_pixels8_rvi;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] lavu/riscv: CPU flag for fast misaligned accesses

2024-05-14 Thread Rémi Denis-Courmont
ffmpeg | branch: master | Rémi Denis-Courmont  | Sat May 11 
18:49:24 2024 +0300| [b410439263e1018912581c8ff672e3f0ed800875] | committer: 
Rémi Denis-Courmont

lavu/riscv: CPU flag for fast misaligned accesses

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b410439263e1018912581c8ff672e3f0ed800875
---

 libavutil/cpu.c   | 1 +
 libavutil/cpu.h   | 1 +
 libavutil/riscv/cpu.c | 3 +++
 libavutil/tests/cpu.c | 3 ++-
 tests/checkasm/checkasm.c | 1 +
 5 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/libavutil/cpu.c b/libavutil/cpu.c
index 396eeb38d6..9ac2f01c20 100644
--- a/libavutil/cpu.c
+++ b/libavutil/cpu.c
@@ -193,6 +193,7 @@ int av_parse_cpu_caps(unsigned *flags, const char *s)
 { "zba",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
AV_CPU_FLAG_RVB_ADDR },.unit = "flags" },
 { "zbb",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
AV_CPU_FLAG_RVB_BASIC },   .unit = "flags" },
 { "zvbb", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RV_ZVBB 
},   .unit = "flags" },
+{ "misaligned", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
AV_CPU_FLAG_RV_MISALIGNED },   .unit = "flags" },
 #endif
 { NULL },
 };
diff --git a/libavutil/cpu.h b/libavutil/cpu.h
index cc19828d4b..a25901433e 100644
--- a/libavutil/cpu.h
+++ b/libavutil/cpu.h
@@ -91,6 +91,7 @@
 #define AV_CPU_FLAG_RVB_BASIC(1 << 7) ///< Basic bit-manipulations
 #define AV_CPU_FLAG_RVB_ADDR (1 << 8) ///< Address bit-manipulations
 #define AV_CPU_FLAG_RV_ZVBB  (1 << 9) ///< Vector basic bit-manipulations
+#define AV_CPU_FLAG_RV_MISALIGNED (1 <<10) ///< Fast misaligned accesses
 
 /**
  * Return the flags which specify extensions supported by the CPU.
diff --git a/libavutil/riscv/cpu.c b/libavutil/riscv/cpu.c
index 6755f0df69..1fe1a397c4 100644
--- a/libavutil/riscv/cpu.c
+++ b/libavutil/riscv/cpu.c
@@ -52,6 +52,7 @@ int ff_get_cpu_flags_riscv(void)
 struct riscv_hwprobe pairs[] = {
 { RISCV_HWPROBE_KEY_BASE_BEHAVIOR, 0 },
 { RISCV_HWPROBE_KEY_IMA_EXT_0, 0 },
+{ RISCV_HWPROBE_KEY_CPUPERF_0, 0 },
 };
 
 if (__riscv_hwprobe(pairs, FF_ARRAY_ELEMS(pairs), 0, NULL, 0) == 0) {
@@ -76,6 +77,8 @@ int ff_get_cpu_flags_riscv(void)
 if (pairs[1].value & RISCV_HWPROBE_EXT_ZVBB)
 ret |= AV_CPU_FLAG_RV_ZVBB;
 #endif
+if (pairs[2].value & RISCV_HWPROBE_MISALIGNED_FAST)
+ret |= AV_CPU_FLAG_RV_MISALIGNED;
 } else
 #endif
 #if HAVE_GETAUXVAL
diff --git a/libavutil/tests/cpu.c b/libavutil/tests/cpu.c
index 10e620963b..02b98682e3 100644
--- a/libavutil/tests/cpu.c
+++ b/libavutil/tests/cpu.c
@@ -94,7 +94,8 @@ static const struct {
 { AV_CPU_FLAG_RVV_F32,   "zve32f" },
 { AV_CPU_FLAG_RVV_I64,   "zve64x" },
 { AV_CPU_FLAG_RVV_F64,   "zve64d" },
-{ AV_CPU_FLAG_RV_ZVBB,   "zvbb"  },
+{ AV_CPU_FLAG_RV_ZVBB,   "zvbb"   },
+{ AV_CPU_FLAG_RV_MISALIGNED, "misaligned" },
 #endif
 { 0 }
 };
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index ffc89882b1..31ca9f6e2b 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -287,6 +287,7 @@ static const struct {
 { "RVVi64",   "rvv_i64",  AV_CPU_FLAG_RVV_I64 },
 { "RVVf64",   "rvv_f64",  AV_CPU_FLAG_RVV_F64 },
 { "RV_Zvbb",  "rv_zvbb",  AV_CPU_FLAG_RV_ZVBB },
+{ "misaligned", "misaligned", AV_CPU_FLAG_RV_MISALIGNED },
 #elif ARCH_MIPS
 { "MMI",  "mmi",  AV_CPU_FLAG_MMI },
 { "MSA",  "msa",  AV_CPU_FLAG_MSA },

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] lavu/riscv: fallback to raw hwprobe() system call

2024-05-14 Thread Rémi Denis-Courmont
ffmpeg | branch: master | Rémi Denis-Courmont  | Fri May  3 
20:08:03 2024 +0300| [61ec7450ff2c0ac16c5a1e66b14de6daf7b48206] | committer: 
Rémi Denis-Courmont

lavu/riscv: fallback to raw hwprobe() system call

Not all C run-times support this, and even then, it will be a while
before distributions provide recent enough versions thereof.

Since this is a trivial system call wrapper, we might just as well call
the corresponding kernel system call directly where the C run-time lacks
support but the kernel headers are new enough (as is the case on Debian
Unstable at the time of writing). In doing so, we need to add a few more
guards as the first suitable kernel (headers) release did not expose the
V, Zba and Zbb extensions.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=61ec7450ff2c0ac16c5a1e66b14de6daf7b48206
---

 configure |  2 ++
 libavutil/riscv/cpu.c | 20 +++-
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index a909b0689c..275fa59bfd 100755
--- a/configure
+++ b/configure
@@ -2273,6 +2273,7 @@ HAVE_LIST_PUB="
 
 HEADERS_LIST="
 arpa_inet_h
+asm_hwprobe_h
 asm_types_h
 cdio_paranoia_h
 cdio_paranoia_paranoia_h
@@ -5548,6 +5549,7 @@ elif enabled ppc; then
 
 elif enabled riscv; then
 
+check_headers asm/hwprobe.h
 check_headers sys/hwprobe.h
 
 if test_cpp_condition stddef.h "__riscv_zbb"; then
diff --git a/libavutil/riscv/cpu.c b/libavutil/riscv/cpu.c
index 3cf4e25bc9..6755f0df69 100644
--- a/libavutil/riscv/cpu.c
+++ b/libavutil/riscv/cpu.c
@@ -31,12 +31,24 @@
 #endif
 #if HAVE_SYS_HWPROBE_H
 #include 
+#elif HAVE_ASM_HWPROBE_H
+#include 
+#include 
+#include 
+
+static int __riscv_hwprobe(struct riscv_hwprobe *pairs, size_t pair_count,
+   size_t cpu_count, unsigned long *cpus,
+   unsigned int flags)
+{
+return syscall(__NR_riscv_hwprobe, pairs, pair_count, cpu_count, cpus,
+   flags);
+}
 #endif
 
 int ff_get_cpu_flags_riscv(void)
 {
 int ret = 0;
-#if HAVE_SYS_HWPROBE_H
+#if HAVE_SYS_HWPROBE_H || HAVE_ASM_HWPROBE_H
 struct riscv_hwprobe pairs[] = {
 { RISCV_HWPROBE_KEY_BASE_BEHAVIOR, 0 },
 { RISCV_HWPROBE_KEY_IMA_EXT_0, 0 },
@@ -47,13 +59,19 @@ int ff_get_cpu_flags_riscv(void)
 ret |= AV_CPU_FLAG_RVI;
 if (pairs[1].value & RISCV_HWPROBE_IMA_FD)
 ret |= AV_CPU_FLAG_RVF | AV_CPU_FLAG_RVD;
+#ifdef RISCV_HWPROBE_IMA_V
 if (pairs[1].value & RISCV_HWPROBE_IMA_V)
 ret |= AV_CPU_FLAG_RVV_I32 | AV_CPU_FLAG_RVV_I64
  | AV_CPU_FLAG_RVV_F32 | AV_CPU_FLAG_RVV_F64;
+#endif
+#ifdef RISCV_HWPROBE_EXT_ZBA
 if (pairs[1].value & RISCV_HWPROBE_EXT_ZBA)
 ret |= AV_CPU_FLAG_RVB_ADDR;
+#endif
+#ifdef RISCV_HWPROBE_EXT_ZBB
 if (pairs[1].value & RISCV_HWPROBE_EXT_ZBB)
 ret |= AV_CPU_FLAG_RVB_BASIC;
+#endif
 #ifdef RISCV_HWPROBE_EXT_ZVBB
 if (pairs[1].value & RISCV_HWPROBE_EXT_ZVBB)
 ret |= AV_CPU_FLAG_RV_ZVBB;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] checkasm/h264dsp: support checking more idct depths

2024-05-14 Thread J . Dekker
ffmpeg | branch: master | J. Dekker  | Wed Apr 24 16:09:44 
2024 +0200| [4ced36744ee0bea5fb7a20d1b2926c588f89ea0b] | committer: J. Dekker

checkasm/h264dsp: support checking more idct depths

Signed-off-by: J. Dekker 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4ced36744ee0bea5fb7a20d1b2926c588f89ea0b
---

 tests/checkasm/h264dsp.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/checkasm/h264dsp.c b/tests/checkasm/h264dsp.c
index 0f484e3f43..30ac81e71e 100644
--- a/tests/checkasm/h264dsp.c
+++ b/tests/checkasm/h264dsp.c
@@ -173,6 +173,7 @@ static void dct8x8(int16_t *coef, int bit_depth)
 
 static void check_idct(void)
 {
+static const int depths[5] = { 8, 9, 10, 12, 14 };
 LOCAL_ALIGNED_16(uint8_t, src,  [8 * 8 * 2]);
 LOCAL_ALIGNED_16(uint8_t, dst,  [8 * 8 * 2]);
 LOCAL_ALIGNED_16(uint8_t, dst0, [8 * 8 * 2]);
@@ -181,10 +182,11 @@ static void check_idct(void)
 LOCAL_ALIGNED_16(int16_t, subcoef0, [8 * 8 * 2]);
 LOCAL_ALIGNED_16(int16_t, subcoef1, [8 * 8 * 2]);
 H264DSPContext h;
-int bit_depth, sz, align, dc;
+int bit_depth, sz, align, dc, i;
 declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *dst, int16_t *block, int 
stride);
 
-for (bit_depth = 8; bit_depth <= 10; bit_depth++) {
+for (i = 0; i < FF_ARRAY_ELEMS(depths); i++) {
+bit_depth = depths[i];
 ff_h264dsp_init(, bit_depth, 1);
 for (sz = 4; sz <= 8; sz += 4) {
 randomize_buffers();

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avfilter/riscv: build afir only if required

2024-05-14 Thread J . Dekker
ffmpeg | branch: master | J. Dekker  | Wed Apr 24 16:09:43 
2024 +0200| [ca583b22e49b6523f2f8c83da3e2ed0ccaaecacf] | committer: J. Dekker

avfilter/riscv: build afir only if required

Signed-off-by: J. Dekker 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ca583b22e49b6523f2f8c83da3e2ed0ccaaecacf
---

 libavfilter/riscv/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavfilter/riscv/Makefile b/libavfilter/riscv/Makefile
index 0b968a9c0d..277dde2aed 100644
--- a/libavfilter/riscv/Makefile
+++ b/libavfilter/riscv/Makefile
@@ -1,2 +1,2 @@
-OBJS += riscv/af_afir_init.o
-RVV-OBJS += riscv/af_afir_rvv.o
+OBJS-$(CONFIG_AFIR_FILTER)   += riscv/af_afir_init.o
+RVV-OBJS-$(CONFIG_AFIR_FILTER)   += riscv/af_afir_rvv.o

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] x86/vvc/vvcdsp_init: coalesce function initializers

2024-05-14 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue May 14 11:17:54 
2024 -0300| [14aff7e45ec6a78a0e22b7debd9a407c6cfad69b] | committer: James Almer

x86/vvc/vvcdsp_init: coalesce function initializers

Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=14aff7e45ec6a78a0e22b7debd9a407c6cfad69b
---

 libavcodec/x86/vvc/vvcdsp_init.c | 37 +++--
 1 file changed, 15 insertions(+), 22 deletions(-)

diff --git a/libavcodec/x86/vvc/vvcdsp_init.c b/libavcodec/x86/vvc/vvcdsp_init.c
index ce4660d933..0e68971b2c 100644
--- a/libavcodec/x86/vvc/vvcdsp_init.c
+++ b/libavcodec/x86/vvc/vvcdsp_init.c
@@ -318,48 +318,41 @@ void ff_vvc_dsp_init_x86(VVCDSPContext *const c, const 
int bd)
 #if ARCH_X86_64
 const int cpu_flags = av_get_cpu_flags();
 
-if (bd == 8) {
+switch (bd) {
+case 8:
 if (EXTERNAL_SSE4(cpu_flags)) {
 MC_LINK_SSE4(8);
 }
 if (EXTERNAL_AVX2_FAST(cpu_flags)) {
+ALF_INIT(8);
+AVG_INIT(8, avx2);
 MC_LINKS_AVX2(8);
 }
-} else if (bd == 10) {
+break;
+case 10:
 if (EXTERNAL_SSE4(cpu_flags)) {
 MC_LINK_SSE4(10);
 }
 if (EXTERNAL_AVX2_FAST(cpu_flags)) {
+ALF_INIT(10);
+AVG_INIT(10, avx2);
 MC_LINKS_AVX2(10);
 MC_LINKS_16BPC_AVX2(10);
 }
-} else if (bd == 12) {
+break;
+case 12:
 if (EXTERNAL_SSE4(cpu_flags)) {
 MC_LINK_SSE4(12);
 }
 if (EXTERNAL_AVX2_FAST(cpu_flags)) {
+ALF_INIT(12);
+AVG_INIT(12, avx2);
 MC_LINKS_AVX2(12);
 MC_LINKS_16BPC_AVX2(12);
 }
-}
-
-if (EXTERNAL_AVX2(cpu_flags)) {
-switch (bd) {
-case 8:
-ALF_INIT(8);
-AVG_INIT(8, avx2);
-break;
-case 10:
-ALF_INIT(10);
-AVG_INIT(10, avx2);
-break;
-case 12:
-ALF_INIT(12);
-AVG_INIT(12, avx2);
-break;
-default:
-break;
-}
+break;
+default:
+break;
 }
 #endif
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] tests/checkasm/vvc_alf: add check_alf_classify

2024-05-14 Thread Wu Jianhua
ffmpeg | branch: master | Wu Jianhua  | Mon May 13 20:31:06 
2024 +0800| [3fa98f274afa1b51deb4621c50622424df1f55bc] | committer: Nuo Mi

tests/checkasm/vvc_alf: add check_alf_classify

Perforamnce Test (fps):
clip  before  after delta
Tango2_3840x2160_60_10_420_27_LD.266  56  115   105.36%
RitualDance_1920x1080_60_10_420_32_LD.266 272 481   76.83%
RitualDance_1920x1080_60_10_420_37_RA.266 303 426   40.59%

Signed-off-by: Wu Jianhua 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3fa98f274afa1b51deb4621c50622424df1f55bc
---

 tests/checkasm/vvc_alf.c | 47 +++
 1 file changed, 47 insertions(+)

diff --git a/tests/checkasm/vvc_alf.c b/tests/checkasm/vvc_alf.c
index 10469e1528..9526260598 100644
--- a/tests/checkasm/vvc_alf.c
+++ b/tests/checkasm/vvc_alf.c
@@ -121,6 +121,47 @@ static void check_alf_filter(VVCDSPContext *c, const int 
bit_depth)
 }
 }
 
+static void check_alf_classify(VVCDSPContext *c, const int bit_depth)
+{
+LOCAL_ALIGNED_32(int, class_idx0, [SRC_BUF_SIZE]);
+LOCAL_ALIGNED_32(int, transpose_idx0, [SRC_BUF_SIZE]);
+LOCAL_ALIGNED_32(int, class_idx1, [SRC_BUF_SIZE]);
+LOCAL_ALIGNED_32(int, transpose_idx1, [SRC_BUF_SIZE]);
+LOCAL_ALIGNED_32(uint8_t, src0, [SRC_BUF_SIZE]);
+LOCAL_ALIGNED_32(uint8_t, src1, [SRC_BUF_SIZE]);
+LOCAL_ALIGNED_32(int32_t, alf_gradient_tmp, [ALF_GRADIENT_SIZE * 
ALF_GRADIENT_SIZE * ALF_NUM_DIR]);
+
+ptrdiff_t stride = SRC_PIXEL_STRIDE * SIZEOF_PIXEL;
+int offset = (3 * SRC_PIXEL_STRIDE + 3) * SIZEOF_PIXEL;
+
+declare_func_emms(AV_CPU_FLAG_AVX2, void, int *class_idx, int 
*transpose_idx,
+const uint8_t *src, ptrdiff_t src_stride, int width, int height, int 
vb_pos, int *gradient_tmp);
+
+randomize_buffers(src0, src1, SRC_BUF_SIZE);
+
+for (int h = 4; h <= MAX_CTU_SIZE; h += 4) {
+for (int w = 4; w <= MAX_CTU_SIZE; w += 4) {
+const int id_size = w * h / ALF_BLOCK_SIZE / ALF_BLOCK_SIZE * 
sizeof(int);
+const int vb_pos  = MAX_CTU_SIZE - ALF_BLOCK_SIZE;
+if (check_func(c->alf.classify, "vvc_alf_classify_%dx%d_%d", w, h, 
bit_depth)) {
+memset(class_idx0, 0, id_size);
+memset(class_idx1, 0, id_size);
+memset(transpose_idx0, 0, id_size);
+memset(transpose_idx1, 0, id_size);
+call_ref(class_idx0, transpose_idx0, src0 + offset, stride, w, 
h, vb_pos, alf_gradient_tmp);
+
+call_new(class_idx1, transpose_idx1, src1 + offset, stride, w, 
h, vb_pos, alf_gradient_tmp);
+
+if (memcmp(class_idx0, class_idx1, id_size))
+fail();
+if (memcmp(transpose_idx0, transpose_idx1, id_size))
+fail();
+bench_new(class_idx1, transpose_idx1, src1 + offset, stride, 
w, h, vb_pos, alf_gradient_tmp);
+}
+}
+}
+}
+
 void checkasm_check_vvc_alf(void)
 {
 int bit_depth;
@@ -130,4 +171,10 @@ void checkasm_check_vvc_alf(void)
 check_alf_filter(, bit_depth);
 }
 report("alf_filter");
+
+for (bit_depth = 8; bit_depth <= 12; bit_depth += 2) {
+ff_vvc_dsp_init(, bit_depth);
+check_alf_classify(, bit_depth);
+}
+report("alf_classify");
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/x86/vvc: add alf filter luma and chroma avx2 optimizations

2024-05-14 Thread Wu Jianhua
ffmpeg | branch: master | Wu Jianhua  | Mon May 13 20:31:03 
2024 +0800| [ec2a7ef867619c24d5c62a01aae6b09f320e4774] | committer: Nuo Mi

avcodec/x86/vvc: add alf filter luma and chroma avx2 optimizations

ff_vvc_alf_filter_luma_4x4_10_c: 135
ff_vvc_alf_filter_luma_4x4_10_avx2: 54
ff_vvc_alf_filter_luma_4x8_10_c: 268
ff_vvc_alf_filter_luma_4x8_10_avx2: 106
ff_vvc_alf_filter_luma_4x12_10_c: 400
ff_vvc_alf_filter_luma_4x12_10_avx2: 160
ff_vvc_alf_filter_luma_4x16_10_c: 535
ff_vvc_alf_filter_luma_4x16_10_avx2: 213
ff_vvc_alf_filter_luma_4x20_10_c: 646
ff_vvc_alf_filter_luma_4x20_10_avx2: 262
ff_vvc_alf_filter_luma_4x24_10_c: 783
ff_vvc_alf_filter_luma_4x24_10_avx2: 309
ff_vvc_alf_filter_luma_4x28_10_c: 908
ff_vvc_alf_filter_luma_4x28_10_avx2: 361
ff_vvc_alf_filter_luma_4x32_10_c: 1039
ff_vvc_alf_filter_luma_4x32_10_avx2: 412
ff_vvc_alf_filter_luma_8x4_10_c: 260
ff_vvc_alf_filter_luma_8x4_10_avx2: 53
ff_vvc_alf_filter_luma_8x8_10_c: 516
ff_vvc_alf_filter_luma_8x8_10_avx2: 105
ff_vvc_alf_filter_luma_8x12_10_c: 779
ff_vvc_alf_filter_luma_8x12_10_avx2: 157
ff_vvc_alf_filter_luma_8x16_10_c: 1038
ff_vvc_alf_filter_luma_8x16_10_avx2: 210
ff_vvc_alf_filter_luma_8x20_10_c: 1293
ff_vvc_alf_filter_luma_8x20_10_avx2: 259
ff_vvc_alf_filter_luma_8x24_10_c: 1553
ff_vvc_alf_filter_luma_8x24_10_avx2: 309
ff_vvc_alf_filter_luma_8x28_10_c: 1815
ff_vvc_alf_filter_luma_8x28_10_avx2: 361
ff_vvc_alf_filter_luma_8x32_10_c: 2067
ff_vvc_alf_filter_luma_8x32_10_avx2: 419
ff_vvc_alf_filter_luma_12x4_10_c: 390
ff_vvc_alf_filter_luma_12x4_10_avx2: 54
ff_vvc_alf_filter_luma_12x8_10_c: 773
ff_vvc_alf_filter_luma_12x8_10_avx2: 107
ff_vvc_alf_filter_luma_12x12_10_c: 1159
ff_vvc_alf_filter_luma_12x12_10_avx2: 155
ff_vvc_alf_filter_luma_12x16_10_c: 1550
ff_vvc_alf_filter_luma_12x16_10_avx2: 207
ff_vvc_alf_filter_luma_12x20_10_c: 1970
ff_vvc_alf_filter_luma_12x20_10_avx2: 260
ff_vvc_alf_filter_luma_12x24_10_c: 2379
ff_vvc_alf_filter_luma_12x24_10_avx2: 309
ff_vvc_alf_filter_luma_12x28_10_c: 2763
ff_vvc_alf_filter_luma_12x28_10_avx2: 362
ff_vvc_alf_filter_luma_12x32_10_c: 3158
ff_vvc_alf_filter_luma_12x32_10_avx2: 419
ff_vvc_alf_filter_luma_16x4_10_c: 523
ff_vvc_alf_filter_luma_16x4_10_avx2: 53
ff_vvc_alf_filter_luma_16x8_10_c: 1049
ff_vvc_alf_filter_luma_16x8_10_avx2: 103
ff_vvc_alf_filter_luma_16x12_10_c: 1566
ff_vvc_alf_filter_luma_16x12_10_avx2: 159
ff_vvc_alf_filter_luma_16x16_10_c: 2078
ff_vvc_alf_filter_luma_16x16_10_avx2: 211
ff_vvc_alf_filter_luma_16x20_10_c: 2631
ff_vvc_alf_filter_luma_16x20_10_avx2: 259
ff_vvc_alf_filter_luma_16x24_10_c: 3149
ff_vvc_alf_filter_luma_16x24_10_avx2: 316
ff_vvc_alf_filter_luma_16x28_10_c: 3631
ff_vvc_alf_filter_luma_16x28_10_avx2: 359
ff_vvc_alf_filter_luma_16x32_10_c: 4233
ff_vvc_alf_filter_luma_16x32_10_avx2: 428
ff_vvc_alf_filter_luma_20x4_10_c: 649
ff_vvc_alf_filter_luma_20x4_10_avx2: 106
ff_vvc_alf_filter_luma_20x8_10_c: 1294
ff_vvc_alf_filter_luma_20x8_10_avx2: 206
ff_vvc_alf_filter_luma_20x12_10_c: 1936
ff_vvc_alf_filter_luma_20x12_10_avx2: 310
ff_vvc_alf_filter_luma_20x16_10_c: 2594
ff_vvc_alf_filter_luma_20x16_10_avx2: 411
ff_vvc_alf_filter_luma_20x20_10_c: 3234
ff_vvc_alf_filter_luma_20x20_10_avx2: 517
ff_vvc_alf_filter_luma_20x24_10_c: 3894
ff_vvc_alf_filter_luma_20x24_10_avx2: 621
ff_vvc_alf_filter_luma_20x28_10_c: 4542
ff_vvc_alf_filter_luma_20x28_10_avx2: 722
ff_vvc_alf_filter_luma_20x32_10_c: 5205
ff_vvc_alf_filter_luma_20x32_10_avx2: 832
ff_vvc_alf_filter_luma_24x4_10_c: 774
ff_vvc_alf_filter_luma_24x4_10_avx2: 104
ff_vvc_alf_filter_luma_24x8_10_c: 1546
ff_vvc_alf_filter_luma_24x8_10_avx2: 206
ff_vvc_alf_filter_luma_24x12_10_c: 2318
ff_vvc_alf_filter_luma_24x12_10_avx2: 312
ff_vvc_alf_filter_luma_24x16_10_c: 3104
ff_vvc_alf_filter_luma_24x16_10_avx2: 411
ff_vvc_alf_filter_luma_24x20_10_c: 3893
ff_vvc_alf_filter_luma_24x20_10_avx2: 513
ff_vvc_alf_filter_luma_24x24_10_c: 4681
ff_vvc_alf_filter_luma_24x24_10_avx2: 616
ff_vvc_alf_filter_luma_24x28_10_c: 5474
ff_vvc_alf_filter_luma_24x28_10_avx2: 721
ff_vvc_alf_filter_luma_24x32_10_c: 6271
ff_vvc_alf_filter_luma_24x32_10_avx2: 832
ff_vvc_alf_filter_luma_28x4_10_c: 907
ff_vvc_alf_filter_luma_28x4_10_avx2: 103
ff_vvc_alf_filter_luma_28x8_10_c: 1797
ff_vvc_alf_filter_luma_28x8_10_avx2: 206
ff_vvc_alf_filter_luma_28x12_10_c: 2708
ff_vvc_alf_filter_luma_28x12_10_avx2: 309
ff_vvc_alf_filter_luma_28x16_10_c: 3632
ff_vvc_alf_filter_luma_28x16_10_avx2: 413
ff_vvc_alf_filter_luma_28x20_10_c: 4537
ff_vvc_alf_filter_luma_28x20_10_avx2: 519
ff_vvc_alf_filter_luma_28x24_10_c: 5463
ff_vvc_alf_filter_luma_28x24_10_avx2: 616
ff_vvc_alf_filter_luma_28x28_10_c: 6372
ff_vvc_alf_filter_luma_28x28_10_avx2: 719
ff_vvc_alf_filter_luma_28x32_10_c: 7274
ff_vvc_alf_filter_luma_28x32_10_avx2: 823
ff_vvc_alf_filter_luma_32x4_10_c: 1029
ff_vvc_alf_filter_luma_32x4_10_avx2: 104
ff_vvc_alf_filter_luma_32x8_10_c: 2060
ff_vvc_alf_filter_luma_32x8_10_avx2: 206
ff_vvc_alf_filter_luma_32x12_10_c: 3112
ff_vvc_alf_filter_luma_32x12_10_avx2: 307
ff_vvc_alf_filter_luma_32x16_10_c: 4161

[FFmpeg-cvslog] tests/checkasm: add checkasm_check_vvc_alf and check_alf_filter

2024-05-14 Thread Wu Jianhua
ffmpeg | branch: master | Wu Jianhua  | Mon May 13 20:31:04 
2024 +0800| [9ef6e15b04ff721362a75a50c6c2721d182d6bb9] | committer: Nuo Mi

tests/checkasm: add checkasm_check_vvc_alf and check_alf_filter

Signed-off-by: Wu Jianhua 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9ef6e15b04ff721362a75a50c6c2721d182d6bb9
---

 tests/checkasm/Makefile   |   2 +-
 tests/checkasm/checkasm.c |   3 +-
 tests/checkasm/checkasm.h |   1 +
 tests/checkasm/vvc_alf.c  | 133 ++
 4 files changed, 137 insertions(+), 2 deletions(-)

diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile
index b5bb885201..92624aab0a 100644
--- a/tests/checkasm/Makefile
+++ b/tests/checkasm/Makefile
@@ -43,7 +43,7 @@ AVCODECOBJS-$(CONFIG_V210_DECODER)  += v210dec.o
 AVCODECOBJS-$(CONFIG_V210_ENCODER)  += v210enc.o
 AVCODECOBJS-$(CONFIG_VORBIS_DECODER)+= vorbisdsp.o
 AVCODECOBJS-$(CONFIG_VP9_DECODER)   += vp9dsp.o
-AVCODECOBJS-$(CONFIG_VVC_DECODER)   += vvc_mc.o
+AVCODECOBJS-$(CONFIG_VVC_DECODER)   += vvc_alf.o vvc_mc.o
 
 CHECKASMOBJS-$(CONFIG_AVCODEC)  += $(AVCODECOBJS-yes)
 
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index 04f94f9d09..ffc89882b1 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -204,7 +204,8 @@ static const struct {
 { "vorbisdsp", checkasm_check_vorbisdsp },
 #endif
 #if CONFIG_VVC_DECODER
-{ "vvc_mc", checkasm_check_vvc_mc },
+{ "vvc_alf", checkasm_check_vvc_alf },
+{ "vvc_mc",  checkasm_check_vvc_mc  },
 #endif
 #endif
 #if CONFIG_AVFILTER
diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
index 8807a37a43..07fcc751ff 100644
--- a/tests/checkasm/checkasm.h
+++ b/tests/checkasm/checkasm.h
@@ -134,6 +134,7 @@ void checkasm_check_vp8dsp(void);
 void checkasm_check_vp9dsp(void);
 void checkasm_check_videodsp(void);
 void checkasm_check_vorbisdsp(void);
+void checkasm_check_vvc_alf(void);
 void checkasm_check_vvc_mc(void);
 
 struct CheckasmPerf;
diff --git a/tests/checkasm/vvc_alf.c b/tests/checkasm/vvc_alf.c
new file mode 100644
index 00..10469e1528
--- /dev/null
+++ b/tests/checkasm/vvc_alf.c
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2023-2024 Nuo Mi 
+ * Copyright (c) 2023-2024 Wu Jianhua 
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include 
+
+#include "checkasm.h"
+#include "libavcodec/vvc/ctu.h"
+#include "libavcodec/vvc/data.h"
+#include "libavcodec/vvc/dsp.h"
+
+#include "libavutil/common.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/mem_internal.h"
+
+static const uint32_t pixel_mask[3] = { 0x, 0x03ff03ff, 0x0fff0fff };
+
+#define SIZEOF_PIXEL ((bit_depth + 7) / 8)
+#define SRC_PIXEL_STRIDE (MAX_CTU_SIZE + 2 * ALF_PADDING_SIZE)
+#define DST_PIXEL_STRIDE (SRC_PIXEL_STRIDE + 4)
+#define SRC_BUF_SIZE (SRC_PIXEL_STRIDE * (MAX_CTU_SIZE + 3 * 2) * 2) //+3 * 2 
for top and bottom row, *2 for high bit depth
+#define DST_BUF_SIZE (DST_PIXEL_STRIDE * (MAX_CTU_SIZE + 3 * 2) * 2)
+#define LUMA_PARAMS_SIZE (MAX_CTU_SIZE * MAX_CTU_SIZE / ALF_BLOCK_SIZE / 
ALF_BLOCK_SIZE * ALF_NUM_COEFF_LUMA)
+
+#define randomize_buffers(buf0, buf1, size) \
+do {\
+uint32_t mask = pixel_mask[(bit_depth - 8) >> 1];   \
+int k;  \
+for (k = 0; k < size; k += 4) { \
+uint32_t r = rnd() & mask;  \
+AV_WN32A(buf0 + k, r);  \
+AV_WN32A(buf1 + k, r);  \
+}   \
+} while (0)
+
+#define randomize_buffers2(buf, size, filter)   \
+do {\
+int k;  \
+if (filter) {   \
+for (k = 0; k < size; k++) {\
+int8_t r = rnd();   \
+buf[k] = r; \
+}   \
+} else {