[FFmpeg-cvslog] tests/ref/fate/source: Add exceptions for riscv startcode files

2024-05-19 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Sun May 19 10:47:48 2024 +0200| [d7fdd502d60273d0b1dad06da8ed4bc10efd3578] | 
committer: Andreas Rheinhardt

tests/ref/fate/source: Add exceptions for riscv startcode files

Fixes fate-source.

Reviewed-by: Michael Niedermayer 
Signed-off-by: Andreas Rheinhardt 

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

 tests/ref/fate/source | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/ref/fate/source b/tests/ref/fate/source
index d8d4224145..723e2e06c7 100644
--- a/tests/ref/fate/source
+++ b/tests/ref/fate/source
@@ -5,6 +5,8 @@ libavcodec/ilbcdec.c
 libavcodec/interplayacm.c
 libavcodec/log2_tab.c
 libavcodec/reverse.c
+libavcodec/riscv/startcode_rvb.S
+libavcodec/riscv/startcode_rvv.S
 libavdevice/file_open.c
 libavdevice/reverse.c
 libavfilter/af_arnndn.c

___
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/mpeg4videodec: assert impossible wrap points

2024-05-19 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat 
May 11 22:08:21 2024 +0200| [8fc649b931a3cbc3a2dd9b50b75a9261a2fb4b49] | 
committer: Michael Niedermayer

avcodec/mpeg4videodec: assert impossible wrap points

Helps: CID1473517 Uninitialized scalar variable
Helps: CID1473497 Uninitialized scalar variable

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 

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

 libavcodec/mpeg4videodec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index 6a7a37e817..df1e22207d 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -597,6 +597,8 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext 
*ctx, GetBitContext *g
 ctx->sprite_shift[0]  = alpha + beta + rho - min_ab;
 ctx->sprite_shift[1]  = alpha + beta + rho - min_ab + 2;
 break;
+default:
+av_assert0(0);
 }
 /* try to simplify the situation */
 if (sprite_delta[0][0] == a << ctx->sprite_shift[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] avcodec/vqcdec: Check init_get_bits8() for failure

2024-05-19 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sun 
May 19 00:47:11 2024 +0200| [6a9302739f5b20791eac7f40d9d999f87fd1] | 
committer: Michael Niedermayer

avcodec/vqcdec: Check init_get_bits8() for failure

Fixes: CID1516090 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Reviewed-by: Peter Ross 
Signed-off-by: Michael Niedermayer 

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

 libavcodec/vqcdec.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/vqcdec.c b/libavcodec/vqcdec.c
index 5c6cab3c1a..bb69844327 100644
--- a/libavcodec/vqcdec.c
+++ b/libavcodec/vqcdec.c
@@ -147,10 +147,13 @@ static int decode_vectors(VqcContext * s, const uint8_t * 
buf, int size, int wid
 GetBitContext gb;
 uint8_t * vectors = s->vectors;
 uint8_t * vectors_end = s->vectors + (width * height * 3) / 2;
+int ret;
 
 memset(vectors, 0, 3 * width * height / 2);
 
-init_get_bits8(, buf, size);
+ret = init_get_bits8(, buf, size);
+if (ret < 0)
+return ret;
 
 for (int i = 0; i < 3 * width * height / 2 / 32; i++) {
 uint8_t * dst = vectors;

___
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/vvc/dec: Check init_get_bits8() for failure

2024-05-19 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sun 
May 19 01:21:37 2024 +0200| [4a8506c794d92744514aac26ac9a1b898a7401ab] | 
committer: Michael Niedermayer

avcodec/vvc/dec: Check init_get_bits8() for failure

Fixes: CID1560042 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Reviewed-by: Nuo Mi 
Signed-off-by: Michael Niedermayer 

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

 libavcodec/vvc/dec.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/vvc/dec.c b/libavcodec/vvc/dec.c
index 25cdb39cab..76b1923340 100644
--- a/libavcodec/vvc/dec.c
+++ b/libavcodec/vvc/dec.c
@@ -514,6 +514,7 @@ static int slice_init_entry_points(SliceContext *sc,
 int nb_eps= sh->r->num_entry_points + 1;
 int ctu_addr  = 0;
 GetBitContext gb;
+int ret;
 
 if (sc->nb_eps != nb_eps) {
 eps_free(sc);
@@ -523,7 +524,9 @@ static int slice_init_entry_points(SliceContext *sc,
 sc->nb_eps = nb_eps;
 }
 
-init_get_bits8(, slice->data, slice->data_size);
+ret = init_get_bits8(, slice->data, slice->data_size);
+if (ret < 0)
+return ret;
 for (int i = 0; i < sc->nb_eps; i++)
 {
 EntryPoint *ep = sc->eps + i;

___
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/mscc & mwsc: Check loop counts before use

2024-05-19 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sun 
May 12 00:43:48 2024 +0200| [e35fe3d8b9e345527a05b1ae958ac851fe09f1ed] | 
committer: Michael Niedermayer

avcodec/mscc & mwsc: Check loop counts before use

This could cause timeouts

Fixes: CID1439568 Untrusted loop bound

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 

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

 libavcodec/mscc.c |  6 ++
 libavcodec/mwsc.c | 11 +++
 2 files changed, 17 insertions(+)

diff --git a/libavcodec/mscc.c b/libavcodec/mscc.c
index 26143bfd5e..2d6f6265bf 100644
--- a/libavcodec/mscc.c
+++ b/libavcodec/mscc.c
@@ -54,6 +54,9 @@ static int rle_uncompress(AVCodecContext *avctx, 
GetByteContext *gb, PutByteCont
 unsigned run = bytestream2_get_byte(gb);
 
 if (run) {
+if (bytestream2_get_bytes_left_p(pb) < run * s->bpp)
+return AVERROR_INVALIDDATA;
+
 switch (avctx->bits_per_coded_sample) {
 case 8:
 fill = bytestream2_get_byte(gb);
@@ -102,6 +105,9 @@ static int rle_uncompress(AVCodecContext *avctx, 
GetByteContext *gb, PutByteCont
 
 bytestream2_seek_p(pb, y * avctx->width * s->bpp + x * s->bpp, 
SEEK_SET);
 } else {
+if (bytestream2_get_bytes_left_p(pb) < copy * s->bpp)
+return AVERROR_INVALIDDATA;
+
 for (j = 0; j < copy; j++) {
 switch (avctx->bits_per_coded_sample) {
 case 8:
diff --git a/libavcodec/mwsc.c b/libavcodec/mwsc.c
index 06a151a72a..0d4ee9791a 100644
--- a/libavcodec/mwsc.c
+++ b/libavcodec/mwsc.c
@@ -51,6 +51,10 @@ static int rle_uncompress(GetByteContext *gb, PutByteContext 
*pb, GetByteContext
 
 if (run == 0) {
 run = bytestream2_get_le32(gb);
+
+if (bytestream2_tell_p(pb) + width - w < run)
+return AVERROR_INVALIDDATA;
+
 for (int j = 0; j < run; j++, w++) {
 if (w == width) {
 w = 0;
@@ -62,6 +66,10 @@ static int rle_uncompress(GetByteContext *gb, PutByteContext 
*pb, GetByteContext
 int pos = bytestream2_tell_p(pb);
 
 bytestream2_seek(gbp, pos, SEEK_SET);
+
+if (pos + width - w < fill)
+return AVERROR_INVALIDDATA;
+
 for (int j = 0; j < fill; j++, w++) {
 if (w == width) {
 w = 0;
@@ -73,6 +81,9 @@ static int rle_uncompress(GetByteContext *gb, PutByteContext 
*pb, GetByteContext
 
 intra = 0;
 } else {
+if (bytestream2_tell_p(pb) + width - w < run)
+return AVERROR_INVALIDDATA;
+
 for (int j = 0; j < run; j++, w++) {
 if (w == width) {
 w = 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] avcodec/mpeg12dec: Use 64bit in bit computation

2024-05-19 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat 
May 11 21:04:00 2024 +0200| [4c725df059dd9a5f2071e204924105b3ceb74cbc] | 
committer: Michael Niedermayer

avcodec/mpeg12dec: Use 64bit in bit computation

I dont think this can actually overflow but 64bit seems reasonable to use

Fixes: CID1521983 Unintentional integer overflow

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index a9fe3503db..9fd765f030 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -2734,7 +2734,7 @@ static int ipu_decode_frame(AVCodecContext *avctx, 
AVFrame *frame,
 int ret;
 
 // Check for minimal intra MB size (considering mb header, luma & chroma 
dc VLC, ac EOB VLC)
-if (avpkt->size*8LL < (avctx->width+15)/16 * ((avctx->height+15)/16) * (2 
+ 3*4 + 2*2 + 2*6))
+if (avpkt->size*8LL < (avctx->width+15)/16 * ((avctx->height+15)/16) * 
(2LL + 3*4 + 2*2 + 2*6))
 return AVERROR_INVALIDDATA;
 
 ret = ff_get_buffer(avctx, frame, 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] avcodec/vble: Check av_image_get_buffer_size() for failure

2024-05-19 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat 
May 18 00:32:43 2024 +0200| [dd5379db5d83d8b06654582afe327daa6be678a3] | 
committer: Michael Niedermayer

avcodec/vble: Check av_image_get_buffer_size() for failure

Fixes: CID1461482 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=dd5379db5d83d8b06654582afe327daa6be678a3
---

 libavcodec/vble.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/vble.c b/libavcodec/vble.c
index c5d92bd6f5..4511433a6c 100644
--- a/libavcodec/vble.c
+++ b/libavcodec/vble.c
@@ -187,6 +187,9 @@ static av_cold int vble_decode_init(AVCodecContext *avctx)
 ctx->size = av_image_get_buffer_size(avctx->pix_fmt,
  avctx->width, avctx->height, 1);
 
+if (ctx->size < 0)
+return ctx->size;
+
 ctx->val = av_malloc_array(ctx->size, sizeof(*ctx->val));
 
 if (!ctx->val) {

___
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/mpegvideo_enc: Fix potential overflow in RD

2024-05-19 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sun 
May 12 00:13:58 2024 +0200| [b6b2b01025e016ce29e5add57305384a663edcfc] | 
committer: Michael Niedermayer

avcodec/mpegvideo_enc: Fix potential overflow in RD

Fixes: CID1500285 Unintentional integer overflow

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 

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

 libavcodec/mpegvideo_enc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index b601a1a9e4..73a9082265 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -1433,7 +1433,7 @@ static int estimate_best_b_count(MpegEncContext *s)
 goto fail;
 }
 
-rd += (out_size * lambda2) >> (FF_LAMBDA_SHIFT - 3);
+rd += (out_size * (uint64_t)lambda2) >> (FF_LAMBDA_SHIFT - 3);
 }
 
 /* get the delayed frames */
@@ -1442,7 +1442,7 @@ static int estimate_best_b_count(MpegEncContext *s)
 ret = out_size;
 goto fail;
 }
-rd += (out_size * lambda2) >> (FF_LAMBDA_SHIFT - 3);
+rd += (out_size * (uint64_t)lambda2) >> (FF_LAMBDA_SHIFT - 3);
 
 rd += c->error[0] + c->error[1] + c->error[2];
 

___
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/vp8: Forward return of ff_vpx_init_range_decoder()

2024-05-19 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat 
May 18 03:06:46 2024 +0200| [63feed1519c5e38d6ce146f265c48592236e3abc] | 
committer: Michael Niedermayer

avcodec/vp8: Forward return of ff_vpx_init_range_decoder()

Fixes: CID1507483 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Reviewed-by: "Ronald S. Bultje" 
Signed-off-by: Michael Niedermayer 

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

 libavcodec/vp8.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index 19f32b3400..8e91613068 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -341,9 +341,8 @@ static int setup_partitions(VP8Context *s, const uint8_t 
*buf, int buf_size)
 }
 
 s->coeff_partition_size[i] = buf_size;
-ff_vpx_init_range_decoder(>coeff_partition[i], buf, buf_size);
 
-return 0;
+return ff_vpx_init_range_decoder(>coeff_partition[i], buf, buf_size);
 }
 
 static void vp7_get_quants(VP8Context *s)

___
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/vp3: Replace check by assert

2024-05-19 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat 
May 18 03:16:08 2024 +0200| [1b991e77b9b19392214f6a788541bea5662de337] | 
committer: Michael Niedermayer

avcodec/vp3: Replace check by assert

Fixes: CID1452425 Logically dead code

Sponsored-by: Sovereign Tech Fund
Reviewed-by: Peter Ross 
Signed-off-by: Michael Niedermayer 

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

 libavcodec/vp3.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index 0952760776..d03a1c9dbc 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -2001,8 +2001,7 @@ static int vp4_mc_loop_filter(Vp3DecodeContext *s, int 
plane, int motion_x, int
 x_offset = (-(x + 2) & 7) + 2;
 y_offset = (-(y + 2) & 7) + 2;
 
-if (x_offset > 8 + x_subpel && y_offset > 8 + y_subpel)
-return 0;
+av_assert1(!(x_offset > 8 + x_subpel && y_offset > 8 + y_subpel));
 
 s->vdsp.emulated_edge_mc(loop, motion_source - stride - 1,
  loop_stride, stride,

___
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/smartblur: Added alpha layer support

2024-05-19 Thread Andrea Mastroberti
ffmpeg | branch: master | Andrea Mastroberti <10736...@polimi.it> | Fri May 17 
00:29:01 2024 +0200| [90ce54804a6624c514da8c1fe806c5b133637ac1] | committer: 
Michael Niedermayer

avfilter/smartblur: Added alpha layer support

Signed-off-by: Michael Niedermayer 

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

 doc/filters.texi   | 20 +++-
 libavfilter/version.h  |  2 +-
 libavfilter/vf_smartblur.c | 43 +++
 3 files changed, 55 insertions(+), 10 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 8230661261..f5bf475d13 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -22653,9 +22653,27 @@ whether a pixel should be blurred or not. The option 
value must be an
 integer in the range [-30,30]. A value of 0 will filter all the image,
 a value included in [0,30] will filter flat areas and a value included
 in [-30,0] will filter edges. Default value is @option{luma_threshold}.
+
+@item alpha_radius, ar
+Set the alpha radius. The option value must be a float number in
+the range [0.1,5.0] that specifies the variance of the gaussian filter
+used to blur the image (slower if larger). Default value is 
@option{luma_radius}.
+
+@item alpha_strength, as
+Set the alpha strength. The option value must be a float number
+in the range [-1.0,1.0] that configures the blurring. A value included
+in [0.0,1.0] will blur the image whereas a value included in
+[-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
+
+@item alpha_threshold, at
+Set the alpha threshold used as a coefficient to determine
+whether a pixel should be blurred or not. The option value must be an
+integer in the range [-30,30]. A value of 0 will filter all the image,
+a value included in [0,30] will filter flat areas and a value included
+in [-30,0] will filter edges. Default value is @option{luma_threshold}.
 @end table
 
-If a chroma option is not explicitly set, the corresponding luma value
+If a chroma or alpha option is not explicitly set, the corresponding luma value
 is set.
 
 @section sobel
diff --git a/libavfilter/version.h b/libavfilter/version.h
index 408c700767..d8cd8a2cfb 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -32,7 +32,7 @@
 #include "version_major.h"
 
 #define LIBAVFILTER_VERSION_MINOR   2
-#define LIBAVFILTER_VERSION_MICRO 101
+#define LIBAVFILTER_VERSION_MICRO 102
 
 
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
diff --git a/libavfilter/vf_smartblur.c b/libavfilter/vf_smartblur.c
index ae0ec05b2d..dbbb74339d 100644
--- a/libavfilter/vf_smartblur.c
+++ b/libavfilter/vf_smartblur.c
@@ -54,6 +54,7 @@ typedef struct SmartblurContext {
 const AVClass *class;
 FilterParam  luma;
 FilterParam  chroma;
+FilterParam  alpha;
 int  hsub;
 int  vsub;
 unsigned int sws_flags;
@@ -77,6 +78,13 @@ static const AVOption smartblur_options[] = {
 { "chroma_threshold", "set chroma threshold", OFFSET(chroma.threshold), 
AV_OPT_TYPE_INT,   {.i64=THRESHOLD_MIN-1}, THRESHOLD_MIN-1, THRESHOLD_MAX, 
.flags=FLAGS },
 { "ct",   "set chroma threshold", OFFSET(chroma.threshold), 
AV_OPT_TYPE_INT,   {.i64=THRESHOLD_MIN-1}, THRESHOLD_MIN-1, THRESHOLD_MAX, 
.flags=FLAGS },
 
+{ "alpha_radius","set alpha radius",OFFSET(alpha.radius),
AV_OPT_TYPE_FLOAT, {.dbl=RADIUS_MIN-1}, RADIUS_MIN-1, RADIUS_MAX, .flags=FLAGS 
},
+{ "ar" , "set alpha radius",OFFSET(alpha.radius),
AV_OPT_TYPE_FLOAT, {.dbl=RADIUS_MIN-1}, RADIUS_MIN-1, RADIUS_MAX, .flags=FLAGS 
},
+{ "alpha_strength",  "set alpha strength",  OFFSET(alpha.strength),  
AV_OPT_TYPE_FLOAT, {.dbl=STRENGTH_MIN-1}, STRENGTH_MIN-1, STRENGTH_MAX, 
.flags=FLAGS },
+{ "as",  "set alpha strength",  OFFSET(alpha.strength),  
AV_OPT_TYPE_FLOAT, {.dbl=STRENGTH_MIN-1}, STRENGTH_MIN-1, STRENGTH_MAX, 
.flags=FLAGS },
+{ "alpha_threshold", "set alpha threshold", OFFSET(alpha.threshold), 
AV_OPT_TYPE_INT,   {.i64=THRESHOLD_MIN-1}, THRESHOLD_MIN-1, THRESHOLD_MAX, 
.flags=FLAGS },
+{ "at",  "set alpha threshold", OFFSET(alpha.threshold), 
AV_OPT_TYPE_INT,   {.i64=THRESHOLD_MIN-1}, THRESHOLD_MIN-1, THRESHOLD_MAX, 
.flags=FLAGS },
+
 { NULL }
 };
 
@@ -94,15 +102,24 @@ static av_cold int init(AVFilterContext *ctx)
 if (s->chroma.threshold < THRESHOLD_MIN)
 s->chroma.threshold = s->luma.threshold;
 
-s->luma.quality = s->chroma.quality = 3.0;
+/* make alpha default to luma values, if not explicitly set */
+if (s->alpha.radius < RADIUS_MIN)
+s->alpha.radius = s->luma.radius;
+if (s->alpha.strength < STRENGTH_MIN)
+s->alpha.strength  = s->luma.strength;
+if (s->alpha.threshold < THRESHOLD_MIN)
+s->alpha.threshold = s->luma.threshold;
+
+s->luma.quality = s->chroma.quality = s->alpha.quality = 3.0;
 s->sws_flags = 

[FFmpeg-cvslog] lavc/huffyuvdsp: optimise RVV vtype for add_hfyu_left_pred_bgr32

2024-05-19 Thread Rémi Denis-Courmont
ffmpeg | branch: master | Rémi Denis-Courmont  | Thu May 16 
19:43:38 2024 +0300| [463c573e6b6489c588bee90124d5cf92db8ccaaa] | committer: 
Rémi Denis-Courmont

lavc/huffyuvdsp: optimise RVV vtype for add_hfyu_left_pred_bgr32

T-Head C908:
add_hfyu_left_pred_bgr32_c:   237.5
add_hfyu_left_pred_bgr32_rvv_i32: 173.5 (before)
add_hfyu_left_pred_bgr32_rvv_i32: 110.0 (after)

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

 libavcodec/riscv/huffyuvdsp_init.c | 3 ++-
 libavcodec/riscv/huffyuvdsp_rvv.S  | 6 --
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/libavcodec/riscv/huffyuvdsp_init.c 
b/libavcodec/riscv/huffyuvdsp_init.c
index b49b3dc097..79e93e213f 100644
--- a/libavcodec/riscv/huffyuvdsp_init.c
+++ b/libavcodec/riscv/huffyuvdsp_init.c
@@ -35,7 +35,8 @@ av_cold void ff_huffyuvdsp_init_riscv(HuffYUVDSPContext *c,
 
 if ((flags & AV_CPU_FLAG_RVV_I32) && (flags & AV_CPU_FLAG_RVB_ADDR)) {
 c->add_int16 = ff_add_int16_rvv;
-c->add_hfyu_left_pred_bgr32 = ff_add_hfyu_left_pred_bgr32_rvv;
+if (flags & AV_CPU_FLAG_RVB_BASIC)
+c->add_hfyu_left_pred_bgr32 = ff_add_hfyu_left_pred_bgr32_rvv;
 }
 #endif
 }
diff --git a/libavcodec/riscv/huffyuvdsp_rvv.S 
b/libavcodec/riscv/huffyuvdsp_rvv.S
index 9c4434907d..d334f5c6d0 100644
--- a/libavcodec/riscv/huffyuvdsp_rvv.S
+++ b/libavcodec/riscv/huffyuvdsp_rvv.S
@@ -36,8 +36,10 @@ func ff_add_int16_rvv, zve32x
 ret
 endfunc
 
-func ff_add_hfyu_left_pred_bgr32_rvv, zve32x
-vsetivli zero, 4, e8, m1, ta, ma
+func ff_add_hfyu_left_pred_bgr32_rvv, zve32x, zbb
+vtype_ivli t1, 4, e8, ta, ma
+li  t0, 4
+vsetvl  zero, t0, t1
 vle8.v  v8, (a3)
 sh2add  a2, a2, a1
 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] lavc/flacdsp: optimise RVV vector type for lpc16

2024-05-19 Thread Rémi Denis-Courmont
ffmpeg | branch: master | Rémi Denis-Courmont  | Tue May 14 
22:15:43 2024 +0300| [6ab4b92e82ea585aac44bd0342f841a8ba45bb66] | committer: 
Rémi Denis-Courmont

lavc/flacdsp: optimise RVV vector type for lpc16

This calculates the optimal vector type value at run-time based on the
hardware vector length and the FLAC LPC prediction order. In this
particular case, the additional computation is easily amortised over
the loop iterations:

T-Head C908:
C V before  V after
 1   48.0214.7 95.2
 2   64.7214.2 94.7
 3   79.7213.5 94.5
 4   96.2196.5 94.2 #
 5  111.0195.7118.5
 6  127.0211.2102.0
 7  143.7194.2101.5
 8  175.7193.2101.2 #
 9  176.2224.2126.0
10  191.5192.0125.5
11  224.5191.2124.7
12  223.0190.2124.2
13  239.2189.5123.7
14  253.7188.7139.5
15  286.2188.0122.7
16  284.0187.0122.5 #
17  300.2186.5186.5
18  314.0185.5185.7
19  329.7184.7185.0
20  343.0184.2184.2
21  358.7199.2183.7
22  371.7182.7182.7
23  387.5181.7182.0
24  400.7181.0181.2
25  431.5180.2196.5
26  443.7195.5196.0
27  459.0178.7196.2
28  470.7177.7194.2
29  470.0177.0193.5
30  481.2176.2176.5
31  496.2175.5175.7
32  507.2174.7191.0 #

 # Power of two boundary.

With 128-bit vectors, improvements are expected for the first two
test cases only. For the other two, there is overhead but below noise.
Improvements should be better observable with prediction order of 8
and less, or on hardware with larger vector sizes.

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

 libavcodec/riscv/flacdsp_init.c | 2 +-
 libavcodec/riscv/flacdsp_rvv.S  | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavcodec/riscv/flacdsp_init.c b/libavcodec/riscv/flacdsp_init.c
index 4f1652dbe7..735aec0691 100644
--- a/libavcodec/riscv/flacdsp_init.c
+++ b/libavcodec/riscv/flacdsp_init.c
@@ -71,7 +71,7 @@ av_cold void ff_flacdsp_init_riscv(FLACDSPContext *c, enum 
AVSampleFormat fmt,
 if ((flags & AV_CPU_FLAG_RVV_I32) && (flags & AV_CPU_FLAG_RVB_ADDR)) {
 int vlenb = ff_get_rv_vlenb();
 
-if (vlenb >= 16)
+if ((flags & AV_CPU_FLAG_RVB_BASIC) && vlenb >= 16)
 c->lpc16 = ff_flac_lpc16_rvv;
 
 # if (__riscv_xlen >= 64)
diff --git a/libavcodec/riscv/flacdsp_rvv.S b/libavcodec/riscv/flacdsp_rvv.S
index 6287faa260..e1a20ce8e1 100644
--- a/libavcodec/riscv/flacdsp_rvv.S
+++ b/libavcodec/riscv/flacdsp_rvv.S
@@ -20,8 +20,9 @@
 
 #include "libavutil/riscv/asm.S"
 
-func ff_flac_lpc16_rvv, zve32x
-vsetvli zero, a2, e32, m8, ta, ma
+func ff_flac_lpc16_rvv, zve32x, zbb
+vtype_vli t0, a2, t2, e32, ta, ma
+vsetvl  zero, a2, t0
 vle32.v v8, (a1)
 sub a4, a4, a2
 vle32.v v16, (a0)

___
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/flacdsp: optimise RVV vector type for lpc32

2024-05-19 Thread Rémi Denis-Courmont
ffmpeg | branch: master | Rémi Denis-Courmont  | Wed May 15 
22:56:42 2024 +0300| [233066e85adbb3eb4d385369325a2ad44a625df2] | committer: 
Rémi Denis-Courmont

lavc/flacdsp: optimise RVV vector type for lpc32

This is pretty much the same as for lpc16, though it only improves half
as large prediction orders. With 128-bit vectors, this gives:

   C  V old  V new
1   69.2  181.5   95.5
2  107.7  180.7   95.2
3  145.5  180.0  103.5
4  183.0  179.2  102.7
5  220.7  178.5  128.0
6  257.7  194.0  127.5
7  294.5  193.7  126.7
8  331.0  193.0  126.5

Larger prediction orders see no significant changes at that size.

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

 libavcodec/riscv/flacdsp_init.c | 15 ---
 libavcodec/riscv/flacdsp_rvv.S  | 12 +++-
 2 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/libavcodec/riscv/flacdsp_init.c b/libavcodec/riscv/flacdsp_init.c
index 735aec0691..830ae36534 100644
--- a/libavcodec/riscv/flacdsp_init.c
+++ b/libavcodec/riscv/flacdsp_init.c
@@ -71,17 +71,18 @@ av_cold void ff_flacdsp_init_riscv(FLACDSPContext *c, enum 
AVSampleFormat fmt,
 if ((flags & AV_CPU_FLAG_RVV_I32) && (flags & AV_CPU_FLAG_RVB_ADDR)) {
 int vlenb = ff_get_rv_vlenb();
 
-if ((flags & AV_CPU_FLAG_RVB_BASIC) && vlenb >= 16)
+if ((flags & AV_CPU_FLAG_RVB_BASIC) && vlenb >= 16) {
 c->lpc16 = ff_flac_lpc16_rvv;
 
 # if (__riscv_xlen >= 64)
-if (flags & AV_CPU_FLAG_RVV_I64) {
-if (vlenb > 16)
-c->lpc32 = ff_flac_lpc32_rvv_simple;
-else
-c->lpc32 = ff_flac_lpc32_rvv;
-}
+if (flags & AV_CPU_FLAG_RVV_I64) {
+if (vlenb > 16)
+c->lpc32 = ff_flac_lpc32_rvv_simple;
+else
+c->lpc32 = ff_flac_lpc32_rvv;
+}
 # endif
+}
 
 c->wasted32 = ff_flac_wasted32_rvv;
 
diff --git a/libavcodec/riscv/flacdsp_rvv.S b/libavcodec/riscv/flacdsp_rvv.S
index e1a20ce8e1..2941928465 100644
--- a/libavcodec/riscv/flacdsp_rvv.S
+++ b/libavcodec/riscv/flacdsp_rvv.S
@@ -76,22 +76,24 @@ func ff_flac_lpc32_rvv, zve64x
 ret
 endfunc
 
-func ff_flac_lpc32_rvv_simple, zve64x
-vsetivli zero, 1, e64, m1, ta, ma
+func ff_flac_lpc32_rvv_simple, zve64x, zbb
+vtype_vli t3, a2, t1, e64, ta, ma
+vntypei t2, t3
+vsetvl  zero, a2, t3 // e64
 vmv.s.x v0, zero
-vsetvli zero, a2, e32, m4, ta, ma
+vsetvl  zero, zero, t2 // e32
 vle32.v v8, (a1)
 sub a4, a4, a2
 vle32.v v16, (a0)
 sh2add  a0, a2, a0
 1:
 vwmul.vv v24, v8, v16
-vsetvli zero, zero, e64, m8, ta, ma
+vsetvl  zero, zero, t3 // e64
 vredsum.vs v24, v24, v0
 lw  t0, (a0)
 addia4, a4, -1
 vmv.x.s t1, v24
-vsetvli zero, zero, e32, m4, ta, ma
+vsetvl  zero, zero, t2 // e32
 sra t1, t1, a3
 add t0, t0, t1
 vslide1down.vx v16, v16, t0

___
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: add assembler macros for adjusting vector LMUL

2024-05-19 Thread Rémi Denis-Courmont
ffmpeg | branch: master | Rémi Denis-Courmont  | Tue May 14 
22:15:08 2024 +0300| [ee1526c05fdfb4a96e492b5c8c2950b555ec7bab] | committer: 
Rémi Denis-Courmont

lavu/riscv: add assembler macros for adjusting vector LMUL

vtype_vli computes the VTYPE value with the optimal LMUL for a given
element width, tail and mask policies and a run-time vector length.

vtype_ivli does the same, but with the compile-time constant vector
length.

vwtypei and vntypei can be used to widen or narrow a VTYPE value for
use in mixed-width vector-optimised functions.

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

 libavutil/riscv/asm.S | 166 +++---
 1 file changed, 117 insertions(+), 49 deletions(-)

diff --git a/libavutil/riscv/asm.S b/libavutil/riscv/asm.S
index 14be5055f5..1e6358dcb5 100644
--- a/libavutil/riscv/asm.S
+++ b/libavutil/riscv/asm.S
@@ -96,77 +96,145 @@
 .endm
 #endif
 
-/* Convenience macro to load a Vector type (vtype) as immediate */
-.macro  lvtypei rd, e, m=m1, tp=tu, mp=mu
+#if defined (__riscv_v_elen)
+# define RV_V_ELEN __riscv_v_elen
+#else
+/* Run-time detection of the V extension implies ELEN >= 64. */
+# define RV_V_ELEN 64
+#endif
+#if RV_V_ELEN == 32
+# define VSEW_MAX 2
+#else
+# define VSEW_MAX 3
+#endif
 
-.ifc \e,e8
-.equ ei, 0
+.macro  parse_vtype ew, tp, mp
+.ifc\ew,e8
+.equvsew, 0
 .else
-.ifc \e,e16
-.equ ei, 8
+.ifc\ew,e16
+.equvsew, 1
 .else
-.ifc \e,e32
-.equ ei, 16
+.ifc\ew,e32
+.equvsew, 2
 .else
-.ifc \e,e64
-.equ ei, 24
+.ifc\ew,e64
+.equvsew, 3
 .else
-.error "Unknown element type"
+.error  "Unknown element width \ew"
 .endif
 .endif
 .endif
 .endif
 
-.ifc \m,m1
-.equ mi, 0
-.else
-.ifc \m,m2
-.equ mi, 1
-.else
-.ifc \m,m4
-.equ mi, 2
+.ifc\tp,tu
+.equtp, 0
 .else
-.ifc \m,m8
-.equ mi, 3
+.ifc\tp,ta
+.equtp, 1
 .else
-.ifc \m,mf8
-.equ mi, 5
-.else
-.ifc \m,mf4
-.equ mi, 6
-.else
-.ifc \m,mf2
-.equ mi, 7
-.else
-.error "Unknown multiplier"
-.equ mi, 3
-.endif
-.endif
-.endif
-.endif
-.endif
+.error  "Unknown tail policy \tp"
 .endif
 .endif
 
-.ifc \tp,tu
-.equ tpi, 0
+.ifc\mp,mu
+.eqump, 0
 .else
-.ifc \tp,ta
-.equ tpi, 64
+.ifc\mp,ma
+.eqump, 1
 .else
-.error "Unknown tail policy"
+.error  "Unknown mask policy \mp"
 .endif
 .endif
+.endm
 
-.ifc \mp,mu
-.equ mpi, 0
-.else
-.ifc \mp,ma
-.equ mpi, 128
+/**
+ * Gets the vector type with the smallest suitable LMUL value.
+ * @param[out] rd vector type destination register
+ * @param vl vector length constant
+ * @param ew element width: e8, e16, e32 or e64
+ * @param tp tail policy: tu or ta
+ * @param mp mask policty: mu or ma
+ */
+.macro  vtype_ivli rd, avl, ew, tp=tu, mp=mu
+.if \avl <= 1
+.equlog2vl, 0
+.elseif \avl <= 2
+.equlog2vl, 1
+.elseif \avl <= 4
+.equlog2vl, 2
+.elseif \avl <= 8
+.equlog2vl, 3
+.elseif \avl <= 16
+.equlog2vl, 4
+.elseif \avl <= 32
+.equlog2vl, 5
+.elseif \avl <= 64
+.equlog2vl, 6
+.elseif \avl <= 128
+.equlog2vl, 7
 .else
-.error "Unknown mask policy"
+.error  "Vector length \avl out of range"
 .endif
+parse_vtype \ew, \tp, \mp
+csrr\rd, vlenb
+clz \rd, \rd
+addi\rd, \rd, log2vl + 1 + VSEW_MAX - __riscv_xlen
+max \rd, \rd, zero // VLMUL must be >= VSEW - VSEW_MAX
+.if vsew < VSEW_MAX
+addi\rd, \rd, vsew - VSEW_MAX
+andi\rd, \rd, 7
 .endif
+ori \rd, \rd, (vsew << 3) | (tp << 6) | (mp << 7)
+.endm
+
+/**
+ * Gets the vector type with the smallest suitable LMUL value.
+ * @param[out] rd vector type destination register
+ * @param rs vector length source register
+ * @param[out] tmp temporary register to be clobbered
+ * @param ew element width: e8, e16, e32 or e64
+ * @param tp tail policy: tu or ta
+ * @param mp mask policty: mu or ma
+ */
+.macro  vtype_vli rd, rs, tmp, ew, tp=tu, mp=mu
+parse_vtype \ew, 

[FFmpeg-cvslog] avcodec/vc1_parser: Check init_get_bits8()

2024-05-19 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Fri May 17 22:14:56 2024 +0200| [a7e506fcd8442ee432ae1450ccc4ce212b5c2e1e] | 
committer: Andreas Rheinhardt

avcodec/vc1_parser: Check init_get_bits8()

Addresses Coverity issue #1441935.

Reviewed-by: Michael Niedermayer 
Signed-off-by: Andreas Rheinhardt 

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

 libavcodec/vc1_parser.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/vc1_parser.c b/libavcodec/vc1_parser.c
index ec284dca00..a536a7bcf8 100644
--- a/libavcodec/vc1_parser.c
+++ b/libavcodec/vc1_parser.c
@@ -26,6 +26,7 @@
  */
 
 #include "libavutil/attributes.h"
+#include "libavutil/avassert.h"
 #include "parser.h"
 #include "vc1.h"
 #include "get_bits.h"
@@ -66,7 +67,9 @@ static void vc1_extract_header(AVCodecParserContext *s, 
AVCodecContext *avctx,
 GetBitContext gb;
 int ret;
 vpc->v.s.avctx = avctx;
-init_get_bits8(, buf, buf_size);
+ret = init_get_bits8(, buf, buf_size);
+av_assert1(ret >= 0); // buf_size is bounded by UNESCAPED_THRESHOLD
+
 switch (vpc->prev_start_code) {
 case VC1_CODE_SEQHDR & 0xFF:
 ff_vc1_decode_sequence_header(avctx, >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] avcodec/codec_desc: Mark AVRN, TGQ, PhotoCD, VBN as intra-only

2024-05-19 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Fri May 10 19:33:26 2024 +0200| [95937d6316310015187cbad371b58f54653a9ed1] | 
committer: Andreas Rheinhardt

avcodec/codec_desc: Mark AVRN, TGQ, PhotoCD, VBN as intra-only

Also remove the then redundant assignments of AV_FRAME_FLAG_KEY,
AV_PICTURE_TYPE_I.

Signed-off-by: Andreas Rheinhardt 

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

 libavcodec/avrndec.c| 2 --
 libavcodec/codec_desc.c | 7 ---
 libavcodec/eatgq.c  | 2 --
 libavcodec/photocd.c| 3 ---
 libavcodec/vbndec.c | 3 ---
 5 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/libavcodec/avrndec.c b/libavcodec/avrndec.c
index 97d2824625..02bdfb6516 100644
--- a/libavcodec/avrndec.c
+++ b/libavcodec/avrndec.c
@@ -67,8 +67,6 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p,
 
 if ((ret = ff_get_buffer(avctx, p, 0)) < 0)
 return ret;
-p->pict_type= AV_PICTURE_TYPE_I;
-p->flags |= AV_FRAME_FLAG_KEY;
 
 if(a->interlace) {
 buf += (true_height - avctx->height)*avctx->width;
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 5ae26f5d2b..a28ef68061 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -905,7 +905,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .type  = AVMEDIA_TYPE_VIDEO,
 .name  = "tgq",
 .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts TGQ video"),
-.props = AV_CODEC_PROP_LOSSY,
+.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
 },
 {
 .id= AV_CODEC_ID_TQI,
@@ -1503,6 +1503,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .type  = AVMEDIA_TYPE_VIDEO,
 .name  = "avrn",
 .long_name = NULL_IF_CONFIG_SMALL("Avid AVI Codec"),
+.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
 },
 {
 .id= AV_CODEC_ID_CPIA,
@@ -1820,7 +1821,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .type  = AVMEDIA_TYPE_VIDEO,
 .name  = "photocd",
 .long_name = NULL_IF_CONFIG_SMALL("Kodak Photo CD"),
-.props = AV_CODEC_PROP_LOSSY,
+.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
 },
 {
 .id= AV_CODEC_ID_IPU,
@@ -1869,7 +1870,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .type  = AVMEDIA_TYPE_VIDEO,
 .name  = "vbn",
 .long_name = NULL_IF_CONFIG_SMALL("Vizrt Binary Image"),
-.props = AV_CODEC_PROP_LOSSY,
+.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
 },
 {
 .id= AV_CODEC_ID_JPEGXL,
diff --git a/libavcodec/eatgq.c b/libavcodec/eatgq.c
index 0f0ed3585f..d326c05390 100644
--- a/libavcodec/eatgq.c
+++ b/libavcodec/eatgq.c
@@ -237,8 +237,6 @@ static int tgq_decode_frame(AVCodecContext *avctx, AVFrame 
*frame,
 
 if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
 return ret;
-frame->flags |= AV_FRAME_FLAG_KEY;
-frame->pict_type = AV_PICTURE_TYPE_I;
 
 for (y = 0; y < FFALIGN(avctx->height, 16) >> 4; y++)
 for (x = 0; x < FFALIGN(avctx->width, 16) >> 4; x++)
diff --git a/libavcodec/photocd.c b/libavcodec/photocd.c
index 07e8d460bd..75948d1b42 100644
--- a/libavcodec/photocd.c
+++ b/libavcodec/photocd.c
@@ -331,9 +331,6 @@ static int photocd_decode_frame(AVCodecContext *avctx, 
AVFrame *p,
 if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0)
 return ret;
 
-p->pict_type = AV_PICTURE_TYPE_I;
-p->flags |= AV_FRAME_FLAG_KEY;
-
 bytestream2_init(gb, avpkt->data, avpkt->size);
 
 if (s->resolution < 3) {
diff --git a/libavcodec/vbndec.c b/libavcodec/vbndec.c
index 4a38b02168..a96843f212 100644
--- a/libavcodec/vbndec.c
+++ b/libavcodec/vbndec.c
@@ -151,9 +151,6 @@ static int vbn_decode_frame(AVCodecContext *avctx,
 if (ret < 0)
 goto out;
 
-frame->pict_type = AV_PICTURE_TYPE_I;
-frame->flags |= AV_FRAME_FLAG_KEY;
-
 if (format == VBN_FORMAT_RAW) {
 uint8_t *flipped = frame->data[0] + frame->linesize[0] * 
(frame->height - 1);
 av_image_copy_plane(flipped, -frame->linesize[0], image_buf ? 
image_buf : gb->buffer, linesize, linesize, frame->height);

___
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/yop: Add missing AV_CODEC_CAP_DR1

2024-05-19 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Thu May  9 01:12:00 2024 +0200| [2a00d68c09ea37a0b413c103a0fad915c8ebb067] | 
committer: Andreas Rheinhardt

avcodec/yop: Add missing AV_CODEC_CAP_DR1

This decoder does not do anything fancy any more since
c6303f8d70c25dd6c6e6486c78bf99c9924e2b6b (before that,
it overwrote the frame's linesize) so that it supports
direct rendering. This effectively reverts
d3de3a16d1e428139c1541e55ea483466c1380e7.

Signed-off-by: Andreas Rheinhardt 

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

 libavcodec/yop.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/yop.c b/libavcodec/yop.c
index 1294c5cc00..77b8d6e055 100644
--- a/libavcodec/yop.c
+++ b/libavcodec/yop.c
@@ -274,6 +274,7 @@ const FFCodec ff_yop_decoder = {
 CODEC_LONG_NAME("Psygnosis YOP Video"),
 .p.type = AVMEDIA_TYPE_VIDEO,
 .p.id   = AV_CODEC_ID_YOP,
+.p.capabilities = AV_CODEC_CAP_DR1,
 .priv_data_size = sizeof(YopDecContext),
 .init   = yop_decode_init,
 .close  = yop_decode_close,

___
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: Remove redundant setting of AV_FRAME_FLAG_KEY, AV_PICTURE_TYPE_I

2024-05-19 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Thu May  9 03:34:32 2024 +0200| [df3cdf4c75b802b124ad6d62eb2cd3d9686ea070] | 
committer: Andreas Rheinhardt

avcodec: Remove redundant setting of AV_FRAME_FLAG_KEY, AV_PICTURE_TYPE_I

This is done generically now.

Signed-off-by: Andreas Rheinhardt 

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

 libavcodec/012v.c  | 3 ---
 libavcodec/aic.c   | 2 --
 libavcodec/aliaspixdec.c   | 3 ---
 libavcodec/asvdec.c| 2 --
 libavcodec/avuidec.c   | 3 ---
 libavcodec/bitpacked_dec.c | 3 ---
 libavcodec/bmp.c   | 2 --
 libavcodec/brenderpix.c| 2 --
 libavcodec/cdxl.c  | 2 --
 libavcodec/cljrdec.c   | 2 --
 libavcodec/cllc.c  | 3 ---
 libavcodec/cri.c   | 3 ---
 libavcodec/dds.c   | 2 --
 libavcodec/dnxhddec.c  | 2 --
 libavcodec/dvdec.c | 2 --
 libavcodec/dxtory.c| 2 --
 libavcodec/dxv.c   | 2 --
 libavcodec/fitsdec.c   | 3 ---
 libavcodec/fraps.c | 3 ---
 libavcodec/frwu.c  | 3 ---
 libavcodec/hapdec.c| 2 --
 libavcodec/hdrdec.c| 3 ---
 libavcodec/hq_hqa.c| 3 ---
 libavcodec/hqx.c   | 3 ---
 libavcodec/jpeg2000dec.c   | 2 --
 libavcodec/lagarith.c  | 3 ---
 libavcodec/lcldec.c| 3 ---
 libavcodec/leaddec.c   | 3 ---
 libavcodec/loco.c  | 1 -
 libavcodec/m101.c  | 2 --
 libavcodec/magicyuv.c  | 3 ---
 libavcodec/mdec.c  | 2 --
 libavcodec/mpeg12dec.c | 2 --
 libavcodec/mscc.c  | 3 ---
 libavcodec/msp2dec.c   | 3 ---
 libavcodec/mvcdec.c| 3 ---
 libavcodec/mvha.c  | 2 --
 libavcodec/notchlc.c   | 3 ---
 libavcodec/pgxdec.c| 2 --
 libavcodec/pixlet.c| 2 --
 libavcodec/pnmdec.c| 2 --
 libavcodec/proresdec.c | 2 --
 libavcodec/prosumer.c  | 2 --
 libavcodec/qdrw.c  | 3 ---
 libavcodec/qoidec.c| 3 ---
 libavcodec/r210dec.c   | 2 --
 libavcodec/rawdec.c| 3 ---
 libavcodec/rtv1.c  | 3 ---
 libavcodec/sgidec.c| 2 --
 libavcodec/sgirledec.c | 3 ---
 libavcodec/sheervideo.c| 3 ---
 libavcodec/speedhqdec.c| 1 -
 libavcodec/targa_y216dec.c | 3 ---
 libavcodec/tiff.c  | 1 -
 libavcodec/tmv.c   | 2 --
 libavcodec/truemotion2rt.c | 2 --
 libavcodec/utvideodec.c| 2 --
 libavcodec/v210dec.c   | 3 ---
 libavcodec/v210x.c | 2 --
 libavcodec/v308dec.c   | 3 ---
 libavcodec/v408dec.c   | 3 ---
 libavcodec/v410dec.c   | 3 ---
 libavcodec/vble.c  | 4 
 libavcodec/vcr1.c  | 2 --
 libavcodec/vmixdec.c   | 3 ---
 libavcodec/wbmpdec.c   | 3 ---
 libavcodec/wnv1.c  | 1 -
 libavcodec/xbmdec.c| 3 ---
 libavcodec/xl.c| 2 --
 libavcodec/xpmdec.c| 3 ---
 libavcodec/xwddec.c| 3 ---
 libavcodec/y41pdec.c   | 3 ---
 libavcodec/ylc.c   | 2 --
 libavcodec/yuv4dec.c   | 3 ---
 74 files changed, 184 deletions(-)

diff --git a/libavcodec/012v.c b/libavcodec/012v.c
index fa5eb0f95e..7bb60219cc 100644
--- a/libavcodec/012v.c
+++ b/libavcodec/012v.c
@@ -64,9 +64,6 @@ static int zero12v_decode_frame(AVCodecContext *avctx, 
AVFrame *pic,
 if ((ret = ff_get_buffer(avctx, pic, 0)) < 0)
 return ret;
 
-pic->pict_type = AV_PICTURE_TYPE_I;
-pic->flags |= AV_FRAME_FLAG_KEY;
-
 line_end = avpkt->data + stride;
 for (line = 0; line < avctx->height; line++) {
 uint16_t y_temp[6] = {0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000};
diff --git a/libavcodec/aic.c b/libavcodec/aic.c
index 440c399049..3ff170b414 100644
--- a/libavcodec/aic.c
+++ b/libavcodec/aic.c
@@ -393,8 +393,6 @@ static int aic_decode_frame(AVCodecContext *avctx, AVFrame 
*frame,
 int slice_size;
 
 ctx->frame= frame;
-ctx->frame->pict_type = AV_PICTURE_TYPE_I;
-ctx->frame->flags |= AV_FRAME_FLAG_KEY;
 
 off = FFALIGN(AIC_HDR_SIZE + ctx->num_x_slices * ctx->mb_height * 2, 4);
 
diff --git a/libavcodec/aliaspixdec.c b/libavcodec/aliaspixdec.c
index 72f810d408..50a6b72a0a 100644
--- a/libavcodec/aliaspixdec.c
+++ b/libavcodec/aliaspixdec.c
@@ -69,9 +69,6 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *f,
 if (ret < 0)
 return ret;
 
-f->pict_type = AV_PICTURE_TYPE_I;
-f->flags |= AV_FRAME_FLAG_KEY;
-
 x = 0;
 y = 1;
 out_buf = f->data[0];
diff --git a/libavcodec/asvdec.c b/libavcodec/asvdec.c
index 568881ccd2..5abe279f35 100644
--- a/libavcodec/asvdec.c
+++ b/libavcodec/asvdec.c
@@ -244,8 +244,6 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p,
 
 if ((ret = ff_get_buffer(avctx, p, 0)) < 0)
 return ret;
-p->pict_type = AV_PICTURE_TYPE_I;
-p->flags |= AV_FRAME_FLAG_KEY;
 
 if (avctx->codec_id == AV_CODEC_ID_ASV1) {
 av_fast_padded_malloc(>bitstream_buffer, >bitstream_buffer_size,
diff --git 

[FFmpeg-cvslog] avcodec/decode: Set KEY flag+pict_type generically for intra-only codecs

2024-05-19 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Thu May  9 02:15:01 2024 +0200| [eee88ba0dc67b5beaa31199d5bf1e7fc324e0652] | 
committer: Andreas Rheinhardt

avcodec/decode: Set KEY flag+pict_type generically for intra-only codecs

This commit is the analog of 3f11eac75741888c7b2b6f93c458766f2613bab5
for decoding: It sets the AV_FRAME_FLAG_KEY and (for video decoders)
also pict_type to AV_PICTURE_TYPE_I. It furthermore stops setting
audio frames as always being key frames -- it is wrong for e.g.
TrueHD/MLP. The latter also affects TAK and DFPWM.

The change already improves output for several decoders where
it has been forgotten to set e.g. pict_type like speedhq, wnv1
or tiff. The latter is the reason for the change to the exif-image-tiff
FATE test reference file.

Signed-off-by: Andreas Rheinhardt 

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

 libavcodec/decode.c| 29 +++--
 libavcodec/pthread_frame.c | 17 ++---
 tests/ref/fate/exif-image-tiff |  2 +-
 3 files changed, 42 insertions(+), 6 deletions(-)

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 900b0c07a3..791940648d 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -57,6 +57,20 @@
 typedef struct DecodeContext {
 AVCodecInternal avci;
 
+/**
+ * This is set to AV_FRAME_FLAG_KEY for decoders of intra-only formats
+ * (those whose codec descriptor has AV_CODEC_PROP_INTRA_ONLY set)
+ * to set the flag generically.
+ */
+int intra_only_flag;
+
+/**
+ * This is set to AV_PICTURE_TYPE_I for intra only video decoders
+ * and to AV_PICTURE_TYPE_NONE for other decoders. It is used to set
+ * the AVFrame's pict_type before the decoder receives it.
+ */
+enum AVPictureType initial_pict_type;
+
 /* to prevent infinite loop on errors when draining */
 int nb_draining_errors;
 
@@ -382,6 +396,7 @@ static int discard_samples(AVCodecContext *avctx, AVFrame 
*frame, int64_t *disca
 static inline int decode_simple_internal(AVCodecContext *avctx, AVFrame 
*frame, int64_t *discarded_samples)
 {
 AVCodecInternal   *avci = avctx->internal;
+DecodeContext *dc = decode_ctx(avci);
 AVPacket *const pkt = avci->in_pkt;
 const FFCodec *const codec = ffcodec(avctx->codec);
 int got_frame, consumed;
@@ -409,6 +424,8 @@ static inline int decode_simple_internal(AVCodecContext 
*avctx, AVFrame *frame,
 if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME) {
 consumed = ff_thread_decode_frame(avctx, frame, _frame, pkt);
 } else {
+frame->pict_type = dc->initial_pict_type;
+frame->flags|= dc->intra_only_flag;
 consumed = codec->cb.decode(avctx, frame, _frame, pkt);
 
 if (!(codec->caps_internal & FF_CODEC_CAP_SETS_PKT_DTS))
@@ -598,6 +615,8 @@ static int decode_receive_frame_internal(AVCodecContext 
*avctx, AVFrame *frame)
 av_assert0(!frame->buf[0]);
 
 if (codec->cb_type == FF_CODEC_CB_TYPE_RECEIVE_FRAME) {
+frame->pict_type = dc->initial_pict_type;
+frame->flags|= dc->intra_only_flag;
 ret = codec->cb.receive_frame(avctx, frame);
 emms_c();
 if (!ret) {
@@ -627,8 +646,7 @@ static int decode_receive_frame_internal(AVCodecContext 
*avctx, AVFrame *frame)
 frame->width = avctx->width;
 if (!frame->height)
 frame->height = avctx->height;
-} else
-frame->flags |= AV_FRAME_FLAG_KEY;
+}
 
 ret = fill_frame_props(avctx, frame);
 if (ret < 0) {
@@ -1794,6 +1812,13 @@ int ff_decode_preinit(AVCodecContext *avctx)
 DecodeContext *dc = decode_ctx(avci);
 int ret = 0;
 
+dc->initial_pict_type = AV_PICTURE_TYPE_NONE;
+if (avctx->codec_descriptor->props & AV_CODEC_PROP_INTRA_ONLY) {
+dc->intra_only_flag = AV_FRAME_FLAG_KEY;
+if (avctx->codec_type == AVMEDIA_TYPE_VIDEO)
+dc->initial_pict_type = AV_PICTURE_TYPE_I;
+}
+
 /* if the decoder init function was already called previously,
  * free the already allocated subtitle_header before overwriting it */
 av_freep(>subtitle_header);
diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index 67f09c1f48..982e4a64c5 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -22,13 +22,11 @@
  * @see doc/multithreading.txt
  */
 
-#include "config.h"
-
 #include 
-#include 
 
 #include "avcodec.h"
 #include "avcodec_internal.h"
+#include "codec_desc.h"
 #include "codec_internal.h"
 #include "decode.h"
 #include "hwaccel_internal.h"
@@ -108,6 +106,10 @@ typedef struct PerThreadContext {
 int hwaccel_threadsafe;
 
 atomic_int debug_threads;   ///< Set if the FF_DEBUG_THREADS option is 
set.
+
+/// The following two fields have the same semantics as the DecodeContext 
field
+int intra_only_flag;
+enum AVPictureType 

[FFmpeg-cvslog] avcodec/codec_desc, jvdec: JV is not intra-only

2024-05-19 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Thu May  9 03:07:51 2024 +0200| [41fc62f2e87c8427bdb87b6d90da0935e67e7576] | 
committer: Andreas Rheinhardt

avcodec/codec_desc, jvdec: JV is not intra-only

It reuses the previous frame and does not code unchanged blocks.

Signed-off-by: Andreas Rheinhardt 

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

 libavcodec/codec_desc.c |  2 +-
 libavcodec/jvdec.c  |  2 --
 tests/ref/fate/jv-demux | 14 +++---
 3 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 7dba61dc8b..5ae26f5d2b 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -1095,7 +1095,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .type  = AVMEDIA_TYPE_VIDEO,
 .name  = "jv",
 .long_name = NULL_IF_CONFIG_SMALL("Bitmap Brothers JV video"),
-.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+.props = AV_CODEC_PROP_LOSSY,
 },
 {
 .id= AV_CODEC_ID_DFA,
diff --git a/libavcodec/jvdec.c b/libavcodec/jvdec.c
index 13ede9068a..2b7c9f0d29 100644
--- a/libavcodec/jvdec.c
+++ b/libavcodec/jvdec.c
@@ -215,8 +215,6 @@ static int decode_frame(AVCodecContext *avctx, AVFrame 
*rframe,
 }
 
 if (video_size) {
-s->frame->flags |= AV_FRAME_FLAG_KEY;
-s->frame->pict_type   = AV_PICTURE_TYPE_I;
 #if FF_API_PALETTE_HAS_CHANGED
 FF_DISABLE_DEPRECATION_WARNINGS
 s->frame->palette_has_changed = s->palette_has_changed;
diff --git a/tests/ref/fate/jv-demux b/tests/ref/fate/jv-demux
index b5d3196cf5..22a9217e23 100644
--- a/tests/ref/fate/jv-demux
+++ b/tests/ref/fate/jv-demux
@@ -11,13 +11,13 @@
 0,  0,  0,1,6, 0x000a0003
 1,  0,  0,   131072,   131072, 0x14c664d6
 0,  1,  1,1,  773, 0x11802a51
-0,  2,  2,1,12974, 0xc2e466b7
-0,  3,  3,1,12200, 0x3c0eeb31
-0,  4,  4,1,13339, 0x91d82488
-0,  5,  5,1,13940, 0x064c350a
-0,  6,  6,1,14418, 0x078d2dd2
-0,  7,  7,1,14539, 0x145167ed
-0,  8,  8,1, 2552, 0xcf2b1db7, F=0x3
+0,  2,  2,1,12974, 0xc2e466b7, F=0x0
+0,  3,  3,1,12200, 0x3c0eeb31, F=0x0
+0,  4,  4,1,13339, 0x91d82488, F=0x0
+0,  5,  5,1,13940, 0x064c350a, F=0x0
+0,  6,  6,1,14418, 0x078d2dd2, F=0x0
+0,  7,  7,1,14539, 0x145167ed, F=0x0
+0,  8,  8,1, 2552, 0xcf2b1db7, F=0x2
 1, 131072, 131072, 1764, 1764, 0x30be734d
 1, 132836, 132836, 1764, 1764, 0xa4c873a7
 1, 134600, 134600, 1764, 1764, 0xd5f17443

___
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/mlpdec: Set AV_FRAME_FLAG_KEY explicitly

2024-05-19 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Thu May  9 00:45:31 2024 +0200| [876a25027c59db38e3b7b0e70e3493fa49e76220] | 
committer: Andreas Rheinhardt

avcodec/mlpdec: Set AV_FRAME_FLAG_KEY explicitly

It is currently always set for all audio frames, but this is
wrong (namely for MLP/TrueHD) and will be changed.

Signed-off-by: Andreas Rheinhardt 

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

 libavcodec/mlpdec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
index 305c5d2b36..e85dac36a7 100644
--- a/libavcodec/mlpdec.c
+++ b/libavcodec/mlpdec.c
@@ -1212,6 +1212,7 @@ static int read_access_unit(AVCodecContext *avctx, 
AVFrame *frame,
 goto error;
 m->is_major_sync_unit = 1;
 header_size += m->major_sync_header_size;
+frame->flags |= AV_FRAME_FLAG_KEY;
 }
 
 if (!m->params_valid) {

___
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/vp9_intra: fix another .irp use with LLVM as

2024-05-19 Thread Rémi Denis-Courmont
ffmpeg | branch: master | Rémi Denis-Courmont  | Sat May 18 
18:52:46 2024 +0300| [259c639137826ea7d59361c4d49e40a1a6155fb7] | committer: 
Rémi Denis-Courmont

lavc/vp9_intra: fix another .irp use with LLVM as

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

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

diff --git a/libavcodec/riscv/vp9_intra_rvv.S b/libavcodec/riscv/vp9_intra_rvv.S
index 7b3c22b99a..beeb1ff88c 100644
--- a/libavcodec/riscv/vp9_intra_rvv.S
+++ b/libavcodec/riscv/vp9_intra_rvv.S
@@ -206,7 +206,7 @@ func ff_tm_32x32_rvv, zve32x
 .endr
 
 vsetvli  zero, zero, e8, m2, ta, ma
-.irp n 0, 4, 8, 12, 16, 20, 24, 28
+.irp n, 0, 4, 8, 12, 16, 20, 24, 28
 vnclipu.wi   v\n, v\n, 0
 vse8.v   v\n, (a0)
 add  a0, a0, a1

___
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/vp9_intra: fix .irp use with LLVM as

2024-05-19 Thread Rémi Denis-Courmont
ffmpeg | branch: master | Rémi Denis-Courmont  | Sat May 18 
18:52:46 2024 +0300| [8cea66a73c52572f4ac6c552f654e44e8ba55849] | committer: 
Rémi Denis-Courmont

lavc/vp9_intra: fix .irp use with LLVM as

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

 libavcodec/riscv/vp9_intra_rvv.S | 28 ++--
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/libavcodec/riscv/vp9_intra_rvv.S b/libavcodec/riscv/vp9_intra_rvv.S
index 280c497687..7b3c22b99a 100644
--- a/libavcodec/riscv/vp9_intra_rvv.S
+++ b/libavcodec/riscv/vp9_intra_rvv.S
@@ -124,12 +124,12 @@ func ff_h_32x32_rvv, zve32x
 vsetvli  zero, t0, e8, m2, ta, ma
 
 .rept 2
-.irp n 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30
+.irp n, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30
 lbu  t1, (a2)
 addi a2, a2, -1
 vmv.v.x  v\n, t1
 .endr
-.irp n 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30
+.irp n, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30
 vse8.v   v\n, (a0)
 add  a0, a0, a1
 .endr
@@ -142,12 +142,12 @@ func ff_h_16x16_rvv, zve32x
 addi a2, a2, 15
 vsetivli zero, 16, e8, m1, ta, ma
 
-.irp n 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23
+.irp n, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23
 lbu  t1, (a2)
 addi a2, a2, -1
 vmv.v.x  v\n, t1
 .endr
-.irp n 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22
+.irp n, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22
 vse8.v   v\n, (a0)
 add  a0, a0, a1
 .endr
@@ -160,12 +160,12 @@ func ff_h_8x8_rvv, zve32x
 addi a2, a2, 7
 vsetivli zero, 8, e8, mf2, ta, ma
 
-.irp n 8, 9, 10, 11, 12, 13, 14, 15
+.irp n, 8, 9, 10, 11, 12, 13, 14, 15
 lbu  t1, (a2)
 addi a2, a2, -1
 vmv.v.x  v\n, t1
 .endr
-.irp n 8, 9, 10, 11, 12, 13, 14
+.irp n, 8, 9, 10, 11, 12, 13, 14
 vse8.v   v\n, (a0)
 add  a0, a0, a1
 .endr
@@ -193,7 +193,7 @@ func ff_tm_32x32_rvv, zve32x
 lbu  a4, -1(a3)
 li   t5, 32
 
-.irp offset 31, 23, 15, 7
+.irp offset, 31, 23, 15, 7
 vsetvli  zero, t5, e16, m4, ta, ma
 vle8.v   v8, (a3)
 vzext.vf2v28, v8
@@ -201,7 +201,7 @@ func ff_tm_32x32_rvv, zve32x
 tm_sum4  v0, v4, v8, v12, v28, \offset
 tm_sum4  v16, v20, v24, v28, v28, (\offset-4)
 
-.irp n 0, 4, 8, 12, 16, 20, 24, 28
+.irp n, 0, 4, 8, 12, 16, 20, 24, 28
 vmax.vx  v\n, v\n, zero
 .endr
 
@@ -227,12 +227,12 @@ func ff_tm_16x16_rvv, zve32x
 tm_sum4   v16, v18, v20, v22, v30, 7
 tm_sum4   v24, v26, v28, v30, v30, 3
 
-.irp n 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30
+.irp n, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30
 vmax.vx  v\n, v\n, zero
 .endr
 
 vsetvli  zero, zero, e8, m1, ta, ma
-.irp n 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28
+.irp n, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28
 vnclipu.wi   v\n, v\n, 0
 vse8.v   v\n, (a0)
 add  a0, a0, a1
@@ -252,12 +252,12 @@ func ff_tm_8x8_rvv, zve32x
 tm_sum4  v16, v17, v18, v19, v28, 7
 tm_sum4  v20, v21, v22, v23, v28, 3
 
-.irp n 16, 17, 18, 19, 20, 21, 22, 23
+.irp n, 16, 17, 18, 19, 20, 21, 22, 23
 vmax.vx  v\n, v\n, zero
 .endr
 
 vsetvli  zero, zero, e8, mf2, ta, ma
-.irp n 16, 17, 18, 19, 20, 21, 22
+.irp n, 16, 17, 18, 19, 20, 21, 22
 vnclipu.wi   v\n, v\n, 0
 vse8.v   v\n, (a0)
 add  a0, a0, a1
@@ -276,12 +276,12 @@ func ff_tm_4x4_rvv, zve32x
 
 tm_sum4  v16, v17, v18, v19, v28, 3
 
-.irp n 16, 17, 18, 19
+.irp n, 16, 17, 18, 19
 vmax.vx  v\n, v\n, zero
 .endr
 
 vsetvli  zero, zero, e8, mf4, ta, ma
-.irp n 16, 17, 18
+.irp n, 16, 17, 18
 vnclipu.wi   v\n, v\n, 0
 vse8.v   v\n, (a0)
 add  a0, a0, a1

___
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: fix .irp use with LLVM as

2024-05-19 Thread Rémi Denis-Courmont
ffmpeg | branch: master | Rémi Denis-Courmont  | Sat May 18 
18:52:27 2024 +0300| [cbe51ebf930578a17af0e983f0068bb59939425c] | committer: 
Rémi Denis-Courmont

lavc/vp8dsp: fix .irp use with LLVM as

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

 libavcodec/riscv/vp8dsp_rvv.S | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/riscv/vp8dsp_rvv.S b/libavcodec/riscv/vp8dsp_rvv.S
index 4d7a9f6a2d..0ba9fa443d 100644
--- a/libavcodec/riscv/vp8dsp_rvv.S
+++ b/libavcodec/riscv/vp8dsp_rvv.S
@@ -171,7 +171,7 @@ endconst
 li  t1, 6
 mul t0, t0, t1
 add t0, t0, t2
-.irp n 1,2,3,4
+.irp n,1,2,3,4
 lb  t\n, \n(t0)
 .endr
 .ifc \size,6
@@ -236,7 +236,7 @@ func ff_put_vp8_epel\len\()_\type\()\size\()_rvv, zve32x
 endfunc
 .endm
 
-.irp len 16,8,4
+.irp len,16,8,4
 put_vp8_bilin_h_v \len h a5
 put_vp8_bilin_h_v \len v a6
 put_vp8_bilin_hv \len

___
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/startcode: add R-V Zbb startcode_find_candidate

2024-05-19 Thread Rémi Denis-Courmont
ffmpeg | branch: master | Rémi Denis-Courmont  | Thu May 16 
17:13:22 2024 +0300| [4ad5b9c8db737f3018360e179121fc0a9b7e7d1b] | committer: 
Rémi Denis-Courmont

lavc/startcode: add R-V Zbb startcode_find_candidate

The main loop processes 8 bytes in 5 instructions.
For comparison, the optimal plain strnlen() requires 4 instructions per
byte (6.4x worse): LBU; ADDI; BEQZ; BNE. The current libavcodec C code
involves 5 instructions per byte (8x worse). Actual benchmarks may be
slightly less favourable due to latency from ORC.B to BNE.

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

 libavcodec/h264dsp.c |  2 +
 libavcodec/h264dsp.h |  2 +
 libavcodec/riscv/Makefile|  2 +
 libavcodec/riscv/h264dsp_init.c  | 40 +++
 libavcodec/riscv/startcode_rvb.S | 83 
 libavcodec/riscv/vc1dsp_init.c   |  7 +++-
 6 files changed, 134 insertions(+), 2 deletions(-)

diff --git a/libavcodec/h264dsp.c b/libavcodec/h264dsp.c
index 4d2ee10bab..1ba936be1c 100644
--- a/libavcodec/h264dsp.c
+++ b/libavcodec/h264dsp.c
@@ -158,6 +158,8 @@ av_cold void ff_h264dsp_init(H264DSPContext *c, const int 
bit_depth,
 ff_h264dsp_init_arm(c, bit_depth, chroma_format_idc);
 #elif ARCH_PPC
 ff_h264dsp_init_ppc(c, bit_depth, chroma_format_idc);
+#elif ARCH_RISCV
+ff_h264dsp_init_riscv(c, bit_depth, chroma_format_idc);
 #elif ARCH_X86
 ff_h264dsp_init_x86(c, bit_depth, chroma_format_idc);
 #elif ARCH_MIPS
diff --git a/libavcodec/h264dsp.h b/libavcodec/h264dsp.h
index e0880c4d88..4a9cb1568d 100644
--- a/libavcodec/h264dsp.h
+++ b/libavcodec/h264dsp.h
@@ -125,6 +125,8 @@ void ff_h264dsp_init_arm(H264DSPContext *c, const int 
bit_depth,
  const int chroma_format_idc);
 void ff_h264dsp_init_ppc(H264DSPContext *c, const int bit_depth,
  const int chroma_format_idc);
+void ff_h264dsp_init_riscv(H264DSPContext *c, const int bit_depth,
+   const int chroma_format_idc);
 void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth,
  const int chroma_format_idc);
 void ff_h264dsp_init_mips(H264DSPContext *c, const int bit_depth,
diff --git a/libavcodec/riscv/Makefile b/libavcodec/riscv/Makefile
index f7a3bf76f1..697c10269a 100644
--- a/libavcodec/riscv/Makefile
+++ b/libavcodec/riscv/Makefile
@@ -28,6 +28,7 @@ OBJS-$(CONFIG_JPEG2000_DECODER) += riscv/jpeg2000dsp_init.o
 RVV-OBJS-$(CONFIG_JPEG2000_DECODER) += riscv/jpeg2000dsp_rvv.o
 OBJS-$(CONFIG_H264CHROMA) += riscv/h264_chroma_init_riscv.o
 RVV-OBJS-$(CONFIG_H264CHROMA) += riscv/h264_mc_chroma.o
+OBJS-$(CONFIG_H264DSP) += riscv/h264dsp_init.o
 OBJS-$(CONFIG_HUFFYUV_DECODER) += riscv/huffyuvdsp_init.o
 RVV-OBJS-$(CONFIG_HUFFYUV_DECODER) += riscv/huffyuvdsp_rvv.o
 OBJS-$(CONFIG_IDCTDSP) += riscv/idctdsp_init.o
@@ -51,6 +52,7 @@ OBJS-$(CONFIG_RV34DSP) += riscv/rv34dsp_init.o
 RVV-OBJS-$(CONFIG_RV34DSP) += riscv/rv34dsp_rvv.o
 OBJS-$(CONFIG_RV40_DECODER) += riscv/rv40dsp_init.o
 RVV-OBJS-$(CONFIG_RV40_DECODER) += riscv/rv40dsp_rvv.o
+RV-OBJS-$(CONFIG_STARTCODE) += riscv/startcode_rvb.o
 OBJS-$(CONFIG_SVQ1_ENCODER) += riscv/svqenc_init.o
 RVV-OBJS-$(CONFIG_SVQ1_ENCODER) += riscv/svqenc_rvv.o
 OBJS-$(CONFIG_TAK_DECODER) += riscv/takdsp_init.o
diff --git a/libavcodec/riscv/h264dsp_init.c b/libavcodec/riscv/h264dsp_init.c
new file mode 100644
index 00..60c84734cd
--- /dev/null
+++ b/libavcodec/riscv/h264dsp_init.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright © 2024 Rémi Denis-Courmont.
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser 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 "config.h"
+
+#include 
+
+#include "libavutil/attributes.h"
+#include "libavutil/cpu.h"
+#include "libavcodec/h264dsp.h"
+
+extern int ff_startcode_find_candidate_rvb(const uint8_t *, int);
+
+av_cold void ff_h264dsp_init_riscv(H264DSPContext *dsp, const int bit_depth,
+   const int chroma_format_idc)
+{
+#if HAVE_RV
+int flags = av_get_cpu_flags();
+
+if (flags & AV_CPU_FLAG_RVB_BASIC)
+dsp->startcode_find_candidate = ff_startcode_find_candidate_rvb;
+#endif
+}
diff --git a/libavcodec/riscv/startcode_rvb.S b/libavcodec/riscv/startcode_rvb.S
new file mode 

[FFmpeg-cvslog] lavc/startcode: add R-V V startcode_find_candidate

2024-05-19 Thread Rémi Denis-Courmont
ffmpeg | branch: master | Rémi Denis-Courmont  | Sun May 12 
13:54:33 2024 +0300| [fa47299516d0016e87ec29d974bc3a155b618066] | committer: 
Rémi Denis-Courmont

lavc/startcode: add R-V V startcode_find_candidate

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

 libavcodec/riscv/Makefile|  1 +
 libavcodec/riscv/h264dsp_init.c  |  5 +
 libavcodec/riscv/startcode_rvv.S | 44 
 libavcodec/riscv/vc1dsp_init.c   | 20 ++
 4 files changed, 62 insertions(+), 8 deletions(-)

diff --git a/libavcodec/riscv/Makefile b/libavcodec/riscv/Makefile
index 697c10269a..07d5c2915d 100644
--- a/libavcodec/riscv/Makefile
+++ b/libavcodec/riscv/Makefile
@@ -53,6 +53,7 @@ RVV-OBJS-$(CONFIG_RV34DSP) += riscv/rv34dsp_rvv.o
 OBJS-$(CONFIG_RV40_DECODER) += riscv/rv40dsp_init.o
 RVV-OBJS-$(CONFIG_RV40_DECODER) += riscv/rv40dsp_rvv.o
 RV-OBJS-$(CONFIG_STARTCODE) += riscv/startcode_rvb.o
+RVV-OBJS-$(CONFIG_STARTCODE) += riscv/startcode_rvv.o
 OBJS-$(CONFIG_SVQ1_ENCODER) += riscv/svqenc_init.o
 RVV-OBJS-$(CONFIG_SVQ1_ENCODER) += riscv/svqenc_rvv.o
 OBJS-$(CONFIG_TAK_DECODER) += riscv/takdsp_init.o
diff --git a/libavcodec/riscv/h264dsp_init.c b/libavcodec/riscv/h264dsp_init.c
index 60c84734cd..dbbf3db400 100644
--- a/libavcodec/riscv/h264dsp_init.c
+++ b/libavcodec/riscv/h264dsp_init.c
@@ -27,6 +27,7 @@
 #include "libavcodec/h264dsp.h"
 
 extern int ff_startcode_find_candidate_rvb(const uint8_t *, int);
+extern int ff_startcode_find_candidate_rvv(const uint8_t *, int);
 
 av_cold void ff_h264dsp_init_riscv(H264DSPContext *dsp, const int bit_depth,
const int chroma_format_idc)
@@ -36,5 +37,9 @@ av_cold void ff_h264dsp_init_riscv(H264DSPContext *dsp, const 
int bit_depth,
 
 if (flags & AV_CPU_FLAG_RVB_BASIC)
 dsp->startcode_find_candidate = ff_startcode_find_candidate_rvb;
+# if HAVE_RVV
+if (flags & AV_CPU_FLAG_RVV_I32)
+dsp->startcode_find_candidate = ff_startcode_find_candidate_rvv;
+# endif
 #endif
 }
diff --git a/libavcodec/riscv/startcode_rvv.S b/libavcodec/riscv/startcode_rvv.S
new file mode 100644
index 00..7c43b1d7f3
--- /dev/null
+++ b/libavcodec/riscv/startcode_rvv.S
@@ -0,0 +1,44 @@
+/*
+ * Copyright © 2024 Rémi Denis-Courmont.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ *this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *this list of conditions and the following disclaimer in the documentation
+ *and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "libavutil/riscv/asm.S"
+
+func ff_startcode_find_candidate_rvv, zve32x
+mv   t0, a0
+1:
+vsetvli  t1, a1, e8, m8, ta, ma
+vle8.v   v8, (t0)
+sub  a1, a1, t1
+vmseq.vi v0, v8, 0
+vfirst.m t2, v0
+bgez t2, 2f
+add  t0, t0, t1
+bnez a1, 1b
+2:
+add  t0, t0, t2
+sub  a0, t0, a0
+ret
+endfunc
diff --git a/libavcodec/riscv/vc1dsp_init.c b/libavcodec/riscv/vc1dsp_init.c
index d82f7efbc2..8ef0c1f40f 100644
--- a/libavcodec/riscv/vc1dsp_init.c
+++ b/libavcodec/riscv/vc1dsp_init.c
@@ -34,6 +34,7 @@ void ff_put_pixels8x8_rvi(uint8_t *dst, const uint8_t *src, 
ptrdiff_t line_size,
 void ff_avg_pixels16x16_rvv(uint8_t *dst, const uint8_t *src, ptrdiff_t 
line_size, int rnd);
 void ff_avg_pixels8x8_rvv(uint8_t *dst, const uint8_t *src, ptrdiff_t 
line_size, int rnd);
 int ff_startcode_find_candidate_rvb(const uint8_t *, int);
+int ff_startcode_find_candidate_rvv(const uint8_t *, int);
 
 av_cold void ff_vc1dsp_init_riscv(VC1DSPContext *dsp)
 {
@@ -49,15 +50,18 @@ av_cold void ff_vc1dsp_init_riscv(VC1DSPContext *dsp)
 if (flags & AV_CPU_FLAG_RVB_BASIC)
 dsp->startcode_find_candidate = ff_startcode_find_candidate_rvb;
 # if HAVE_RVV
-if (flags & AV_CPU_FLAG_RVV_I32 && 

[FFmpeg-cvslog] avutil/thread: add support for setting thread name on *bsd and solaris

2024-05-19 Thread Brad Smith
ffmpeg | branch: release/6.1 | Brad Smith  | 
Sun Jan  7 00:55:51 2024 -0500| [66f2cf8958edb55545724f127d3f39ae7b1c024a] | 
committer: Brad Smith

avutil/thread: add support for setting thread name on *bsd and solaris

FreeBSD/DragonFly/Solaris use pthread_setname_np(). OpenBSD uses 
pthread_set_name_np().

Signed-off-by: Brad Smith 
Signed-off-by: Marton Balint 
(cherry picked from commit fd16d8c68cd7b820eda76c407b0645b7cf470efd)
Signed-off-by: Brad Smith 

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

 configure  | 10 ++
 libavutil/thread.h | 14 --
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index a89cfa6d95..9ca9f949b6 100755
--- a/configure
+++ b/configure
@@ -2227,6 +2227,7 @@ HEADERS_LIST="
 opencv2_core_core_c_h
 OpenGL_gl3_h
 poll_h
+pthread_np_h
 sys_param_h
 sys_resource_h
 sys_select_h
@@ -2329,6 +2330,8 @@ SYSTEM_FUNCS="
 posix_memalign
 prctl
 pthread_cancel
+pthread_set_name_np
+pthread_setname_np
 sched_getaffinity
 SecItemImport
 SetConsoleTextAttribute
@@ -6460,6 +6463,7 @@ check_headers malloc.h
 check_headers mftransform.h
 check_headers net/udplite.h
 check_headers poll.h
+check_headers pthread_np.h
 check_headers sys/param.h
 check_headers sys/resource.h
 check_headers sys/select.h
@@ -6625,6 +6629,12 @@ if ! disabled pthreads && ! enabled w32threads && ! 
enabled os2threads; then
 if enabled pthreads; then
 check_builtin sem_timedwait semaphore.h "sem_t *s; sem_init(s,0,0); 
sem_timedwait(s,0); sem_destroy(s)" $pthreads_extralibs
 check_func pthread_cancel $pthreads_extralibs
+hdrs=pthread.h
+if enabled pthread_np_h; then
+hdrs="$hdrs pthread_np.h"
+fi
+check_lib pthread_set_name_np "$hdrs" pthread_set_name_np -lpthread
+check_lib pthread_setname_np "$hdrs" pthread_setname_np -lpthread
 fi
 fi
 
diff --git a/libavutil/thread.h b/libavutil/thread.h
index 2ded498c89..fa74dd2ea7 100644
--- a/libavutil/thread.h
+++ b/libavutil/thread.h
@@ -26,6 +26,8 @@
 
 #if HAVE_PRCTL
 #include 
+#elif (HAVE_PTHREAD_SETNAME_NP || HAVE_PTHREAD_SET_NAME_NP) && 
HAVE_PTHREAD_NP_H
+#include 
 #endif
 
 #include "error.h"
@@ -213,11 +215,19 @@ static inline int ff_thread_once(char *control, void 
(*routine)(void))
 
 static inline int ff_thread_setname(const char *name)
 {
+int ret = 0;
+
 #if HAVE_PRCTL
-return AVERROR(prctl(PR_SET_NAME, name));
+ret = AVERROR(prctl(PR_SET_NAME, name));
+#elif HAVE_PTHREAD_SETNAME_NP
+ret = AVERROR(pthread_setname_np(pthread_self(), name));
+#elif HAVE_PTHREAD_SET_NAME_NP
+pthread_set_name_np(pthread_self(), name);
+#else
+ret = AVERROR(ENOSYS);
 #endif
 
-return AVERROR(ENOSYS);
+return ret;
 }
 
 #endif /* AVUTIL_THREAD_H */

___
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] avutil/thread: fix pthread_setname_np parameters for NetBSD and Apple

2024-05-19 Thread Marton Balint
ffmpeg | branch: release/6.1 | Marton Balint  | Mon Feb  5 
00:31:27 2024 +0100| [2aad37688cedf7675a55137d326c7d931f587138] | committer: 
Brad Smith

avutil/thread: fix pthread_setname_np parameters for NetBSD and Apple

Signed-off-by: Marton Balint 
(cherry picked from commit 71ea90638efa56b4cd006bfa6cfb464d2169692d)
Signed-off-by: Brad Smith 

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

 libavutil/thread.h | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavutil/thread.h b/libavutil/thread.h
index fa74dd2ea7..2c00c7cc35 100644
--- a/libavutil/thread.h
+++ b/libavutil/thread.h
@@ -220,7 +220,13 @@ static inline int ff_thread_setname(const char *name)
 #if HAVE_PRCTL
 ret = AVERROR(prctl(PR_SET_NAME, name));
 #elif HAVE_PTHREAD_SETNAME_NP
+#if defined(__APPLE__)
+ret = AVERROR(pthread_setname_np(name));
+#elif defined(__NetBSD__)
+ret = AVERROR(pthread_setname_np(pthread_self(), "%s", name));
+#else
 ret = AVERROR(pthread_setname_np(pthread_self(), name));
+#endif
 #elif HAVE_PTHREAD_SET_NAME_NP
 pthread_set_name_np(pthread_self(), name);
 #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] avutil/thread: add support for setting thread name on *bsd and solaris

2024-05-19 Thread Brad Smith
ffmpeg | branch: release/6.0 | Brad Smith  | 
Sun Jan  7 00:55:51 2024 -0500| [ce29877f5c05fb90dc2cfb245a3b2202a2db] | 
committer: Brad Smith

avutil/thread: add support for setting thread name on *bsd and solaris

FreeBSD/DragonFly/Solaris use pthread_setname_np(). OpenBSD uses 
pthread_set_name_np().

Signed-off-by: Brad Smith 
Signed-off-by: Marton Balint 
(cherry picked from commit fd16d8c68cd7b820eda76c407b0645b7cf470efd)
Signed-off-by: Brad Smith 

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

 configure  | 10 ++
 libavutil/thread.h | 14 --
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 8010310351..c27f635806 100755
--- a/configure
+++ b/configure
@@ -2191,6 +2191,7 @@ HEADERS_LIST="
 opencv2_core_core_c_h
 OpenGL_gl3_h
 poll_h
+pthread_np_h
 sys_param_h
 sys_resource_h
 sys_select_h
@@ -2293,6 +2294,8 @@ SYSTEM_FUNCS="
 posix_memalign
 prctl
 pthread_cancel
+pthread_set_name_np
+pthread_setname_np
 sched_getaffinity
 SecItemImport
 SetConsoleTextAttribute
@@ -6352,6 +6355,7 @@ check_headers malloc.h
 check_headers mftransform.h
 check_headers net/udplite.h
 check_headers poll.h
+check_headers pthread_np.h
 check_headers sys/param.h
 check_headers sys/resource.h
 check_headers sys/select.h
@@ -6515,6 +6519,12 @@ if ! disabled pthreads && ! enabled w32threads && ! 
enabled os2threads; then
 if enabled pthreads; then
 check_builtin sem_timedwait semaphore.h "sem_t *s; sem_init(s,0,0); 
sem_timedwait(s,0); sem_destroy(s)" $pthreads_extralibs
 check_func pthread_cancel $pthreads_extralibs
+hdrs=pthread.h
+if enabled pthread_np_h; then
+hdrs="$hdrs pthread_np.h"
+fi
+check_lib pthread_set_name_np "$hdrs" pthread_set_name_np -lpthread
+check_lib pthread_setname_np "$hdrs" pthread_setname_np -lpthread
 fi
 fi
 
diff --git a/libavutil/thread.h b/libavutil/thread.h
index 2f5e7e1cb5..5203edf494 100644
--- a/libavutil/thread.h
+++ b/libavutil/thread.h
@@ -26,6 +26,8 @@
 
 #if HAVE_PRCTL
 #include 
+#elif (HAVE_PTHREAD_SETNAME_NP || HAVE_PTHREAD_SET_NAME_NP) && 
HAVE_PTHREAD_NP_H
+#include 
 #endif
 
 #include "error.h"
@@ -194,11 +196,19 @@ static inline int ff_thread_once(char *control, void 
(*routine)(void))
 
 static inline int ff_thread_setname(const char *name)
 {
+int ret = 0;
+
 #if HAVE_PRCTL
-return AVERROR(prctl(PR_SET_NAME, name));
+ret = AVERROR(prctl(PR_SET_NAME, name));
+#elif HAVE_PTHREAD_SETNAME_NP
+ret = AVERROR(pthread_setname_np(pthread_self(), name));
+#elif HAVE_PTHREAD_SET_NAME_NP
+pthread_set_name_np(pthread_self(), name);
+#else
+ret = AVERROR(ENOSYS);
 #endif
 
-return AVERROR(ENOSYS);
+return ret;
 }
 
 #endif /* AVUTIL_THREAD_H */

___
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] avutil/thread: fix pthread_setname_np parameters for NetBSD and Apple

2024-05-19 Thread Marton Balint
ffmpeg | branch: release/6.0 | Marton Balint  | Mon Feb  5 
00:31:27 2024 +0100| [9dbeb1d5d0f4fbc9bdc943c869a6e312f12074a8] | committer: 
Brad Smith

avutil/thread: fix pthread_setname_np parameters for NetBSD and Apple

Signed-off-by: Marton Balint 
(cherry picked from commit 71ea90638efa56b4cd006bfa6cfb464d2169692d)
Signed-off-by: Brad Smith 

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

 libavutil/thread.h | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavutil/thread.h b/libavutil/thread.h
index 5203edf494..8023ad303d 100644
--- a/libavutil/thread.h
+++ b/libavutil/thread.h
@@ -201,7 +201,13 @@ static inline int ff_thread_setname(const char *name)
 #if HAVE_PRCTL
 ret = AVERROR(prctl(PR_SET_NAME, name));
 #elif HAVE_PTHREAD_SETNAME_NP
+#if defined(__APPLE__)
+ret = AVERROR(pthread_setname_np(name));
+#elif defined(__NetBSD__)
+ret = AVERROR(pthread_setname_np(pthread_self(), "%s", name));
+#else
 ret = AVERROR(pthread_setname_np(pthread_self(), name));
+#endif
 #elif HAVE_PTHREAD_SET_NAME_NP
 pthread_set_name_np(pthread_self(), name);
 #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".