Re: [FFmpeg-devel] [PATCH] avformat/rtmpproto: Pass rw_timeout to underlying transport protocol

2023-11-22 Thread Zhao Zhili



> On Nov 15, 2023, at 21:24, Zhao Zhili  wrote:
> 
> From: Zhao Zhili 
> 
> Signed-off-by: Zhao Zhili 
> ---
> libavformat/rtmpproto.c | 3 +++
> 1 file changed, 3 insertions(+)
> 
> diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
> index 98718bc6da..a0c6195eb2 100644
> --- a/libavformat/rtmpproto.c
> +++ b/libavformat/rtmpproto.c
> @@ -2635,6 +2635,9 @@ static int rtmp_open(URLContext *s, const char *uri, 
> int flags, AVDictionary **o
> 
> if (rt->listen_timeout > 0)
> rt->listen = 1;
> +/* Pass rw_timeout to underlying transport protocol */
> +if (s->rw_timeout > 0)
> +av_dict_set_int(opts, "rw_timeout", s->rw_timeout, 0);

OK, I made a mistake. Since ffurl_open_whitelist copy from parent automatically,
this is a NOP. Will revert this commit.

> 
> rt->is_input = !(flags & AVIO_FLAG_WRITE);
> 
> -- 
> 2.42.0
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

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

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


Re: [FFmpeg-devel] [PATCH] doc/git-howto: use less weird username for git URL

2023-11-22 Thread J. Dekker


Michael Niedermayer  writes:

> Signed-off-by: Michael Niedermayer 
> ---
>  doc/git-howto.texi | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)


Most people probably use git@ already, seems to be more common practice
in general. Both users map to the same id on the server so would make
sense to update the documentation to recommend the more conventional
one.

Pushed.

-- 
jd

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

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


Re: [FFmpeg-devel] [PATCH] avformat/rtmpproto: Pass rw_timeout to underlying transport protocol

2023-11-22 Thread Martin Storsjö

On Wed, 22 Nov 2023, Zhao Zhili wrote:





On Nov 15, 2023, at 21:24, Zhao Zhili  wrote:

From: Zhao Zhili 

Signed-off-by: Zhao Zhili 
---
libavformat/rtmpproto.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index 98718bc6da..a0c6195eb2 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -2635,6 +2635,9 @@ static int rtmp_open(URLContext *s, const char *uri, int 
flags, AVDictionary **o

if (rt->listen_timeout > 0)
rt->listen = 1;
+/* Pass rw_timeout to underlying transport protocol */
+if (s->rw_timeout > 0)
+av_dict_set_int(opts, "rw_timeout", s->rw_timeout, 0);


OK, I made a mistake. Since ffurl_open_whitelist copy from parent automatically,
this is a NOP. Will revert this commit.


Thanks! I was just starting to look into this, to confirm this as well, 
but it's good if you've come to the same conclusion already.


It's interesting how we end up with similar changes for this multiple 
times, see https://ffmpeg.org/pipermail/ffmpeg-devel/2023-July/312362.html 
for another similar patch a few months ago, when it should be working 
already.


The fact that so many protocols have similar but vaguely different timeout 
options, each defined as a per-protocol private option, is a bit of a 
mess; that's why this approach, of actually sharing the same variable 
through the URLContext hierarchy, tries to avoid that to some extent.


// Martin

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

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


Re: [FFmpeg-devel] [PATCH] avformat/rtmpproto: Pass rw_timeout to underlying transport protocol

2023-11-22 Thread Zhao Zhili


> On Nov 22, 2023, at 17:33, Martin Storsjö  wrote:
> 
> On Wed, 22 Nov 2023, Zhao Zhili wrote:
> 
>> 
>> 
>>> On Nov 15, 2023, at 21:24, Zhao Zhili  wrote:
>>> 
>>> From: Zhao Zhili 
>>> 
>>> Signed-off-by: Zhao Zhili 
>>> ---
>>> libavformat/rtmpproto.c | 3 +++
>>> 1 file changed, 3 insertions(+)
>>> 
>>> diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
>>> index 98718bc6da..a0c6195eb2 100644
>>> --- a/libavformat/rtmpproto.c
>>> +++ b/libavformat/rtmpproto.c
>>> @@ -2635,6 +2635,9 @@ static int rtmp_open(URLContext *s, const char *uri, 
>>> int flags, AVDictionary **o
>>> 
>>>if (rt->listen_timeout > 0)
>>>rt->listen = 1;
>>> +/* Pass rw_timeout to underlying transport protocol */
>>> +if (s->rw_timeout > 0)
>>> +av_dict_set_int(opts, "rw_timeout", s->rw_timeout, 0);
>> 
>> OK, I made a mistake. Since ffurl_open_whitelist copy from parent 
>> automatically,
>> this is a NOP. Will revert this commit.
> 
> Thanks! I was just starting to look into this, to confirm this as well, but 
> it's good if you've come to the same conclusion already.
> 
> It's interesting how we end up with similar changes for this multiple times, 
> see https://ffmpeg.org/pipermail/ffmpeg-devel/2023-July/312362.html for 
> another similar patch a few months ago, when it should be working already.
> 
> The fact that so many protocols have similar but vaguely different timeout 
> options, each defined as a per-protocol private option, is a bit of a mess; 
> that's why this approach, of actually sharing the same variable through the 
> URLContext hierarchy, tries to avoid that to some extent.

I have taken code from ftp.c as reference:
```
if (s->rw_timeout != -1) {
av_dict_set_int(&opts, "timeout", s->rw_timeout, 0);
} /* if option is not given, don't pass it and let tcp use its own 
default */
```

Now it’s obvious that code comes before 
```
commit fab8156b2f30666adabe227b3d7712fd193873b1
Author: Martin Storsjö
Date:   Sat Feb 28 02:00:50 2015 +0200

avio: Copy URLContext generic options into child URLContexts
```

Should we remove that part from ftp.c?

It worth to note that there is a small difference between rw_timeout and timeout
option for TCP:

1. timeout apply to accept, read and write
2. rw_timeout apply to read and write, but not accept.

What do you think?

> 
> // Martin
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

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

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


Re: [FFmpeg-devel] [PATCH] avformat/rtmpproto: Pass rw_timeout to underlying transport protocol

2023-11-22 Thread Zhao Zhili


> On Nov 22, 2023, at 17:40, Zhao Zhili  wrote:
> 
> 
> 
>> On Nov 22, 2023, at 17:33, Martin Storsjö  wrote:
>> 
>> On Wed, 22 Nov 2023, Zhao Zhili wrote:
>> 
>>> 
>>> 
 On Nov 15, 2023, at 21:24, Zhao Zhili  wrote:
 
 From: Zhao Zhili 
 
 Signed-off-by: Zhao Zhili 
 ---
 libavformat/rtmpproto.c | 3 +++
 1 file changed, 3 insertions(+)
 
 diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
 index 98718bc6da..a0c6195eb2 100644
 --- a/libavformat/rtmpproto.c
 +++ b/libavformat/rtmpproto.c
 @@ -2635,6 +2635,9 @@ static int rtmp_open(URLContext *s, const char *uri, 
 int flags, AVDictionary **o
 
   if (rt->listen_timeout > 0)
   rt->listen = 1;
 +/* Pass rw_timeout to underlying transport protocol */
 +if (s->rw_timeout > 0)
 +av_dict_set_int(opts, "rw_timeout", s->rw_timeout, 0);
>>> 
>>> OK, I made a mistake. Since ffurl_open_whitelist copy from parent 
>>> automatically,
>>> this is a NOP. Will revert this commit.
>> 
>> Thanks! I was just starting to look into this, to confirm this as well, but 
>> it's good if you've come to the same conclusion already.
>> 
>> It's interesting how we end up with similar changes for this multiple times, 
>> see https://ffmpeg.org/pipermail/ffmpeg-devel/2023-July/312362.html for 
>> another similar patch a few months ago, when it should be working already.
>> 
>> The fact that so many protocols have similar but vaguely different timeout 
>> options, each defined as a per-protocol private option, is a bit of a mess; 
>> that's why this approach, of actually sharing the same variable through the 
>> URLContext hierarchy, tries to avoid that to some extent.
> 
> I have taken code from ftp.c as reference:
> ```
>if (s->rw_timeout != -1) {
>av_dict_set_int(&opts, "timeout", s->rw_timeout, 0);
>} /* if option is not given, don't pass it and let tcp use its own 
> default */
> ```
> 
> Now it’s obvious that code comes before 
> ```
> commit fab8156b2f30666adabe227b3d7712fd193873b1
> Author: Martin Storsjö
> Date:   Sat Feb 28 02:00:50 2015 +0200
> 
>avio: Copy URLContext generic options into child URLContexts
> ```
> 
> Should we remove that part from ftp.c?
> 
> It worth to note that there is a small difference between rw_timeout and 
> timeout
> option for TCP:
> 
> 1. timeout apply to accept, read and write
> 2. rw_timeout apply to read and write, but not accept.

I mean connect.

> 
> What do you think?
> 
>> 
>> // Martin
>> 
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org 
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>> 
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-requ...@ffmpeg.org  
>> with subject "unsubscribe".
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org 
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org  with 
> subject "unsubscribe".

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

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


Re: [FFmpeg-devel] [PATCH] avformat/rtmpproto: Pass rw_timeout to underlying transport protocol

2023-11-22 Thread Martin Storsjö

On Wed, 22 Nov 2023, Zhao Zhili wrote:


I have taken code from ftp.c as reference:
```
   if (s->rw_timeout != -1) {
   av_dict_set_int(&opts, "timeout", s->rw_timeout, 0);
   } /* if option is not given, don't pass it and let tcp use its own 
default */
```


Ah, I see!

Now it’s obvious that code comes before 
```

commit fab8156b2f30666adabe227b3d7712fd193873b1
Author: Martin Storsjö
Date:   Sat Feb 28 02:00:50 2015 +0200

   avio: Copy URLContext generic options into child URLContexts
```

Should we remove that part from ftp.c?

It worth to note that there is a small difference between rw_timeout and timeout
option for TCP:

1. timeout apply to accept, read and write
2. rw_timeout apply to read and write, but not accept.

What do you think?


Hmm, I'm not entirely sure.

I wonder if it would be best to change the tcp protocol to apply the 
rw_timeout option for connect timeout as well (open_timeout). With so many 
different options on different levels, that all do almost the same but 
with subtle differences (as for which cases it applies to), it's really 
hard to use them properly.


It's kinda problematic if a user searches for a way to make sure that the 
protocol always would abort if things stall, at any point, for more than X 
seconds, the user finds and picks one option, and it only applies in some 
case but not others.


But changing existing behaviours can of course always break someone as 
well... Although I haven't looked through all the protocols and their 
individual uses of options for this, so I'm not sure how much potential 
breakage there would be if we'd try to unify it.


Then again, I also see that it's quite possible for someone to want to set 
one kind of timeout for open but a different one for stalling once the 
connection has been opened.



So overall, I don't have a firm settled opinion on this matter right now. 
But anything to unify the code, reducing the amount of per-protocol 
setting of almost similar but slightly different options, would be good. 
And ideally using less per-protocol code and more of the common shared 
framework within e.g. URLContext.


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

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


[FFmpeg-devel] [PATCH] ac3dsp: RISC-V V float_to_fixed24

2023-11-22 Thread flow gg
c910
float_to_fixed24_c: 208.2
float_to_fixed24_rvv_f32: 71.5
From 69da974fd0febaa74db4dd551b05172caeefb846 Mon Sep 17 00:00:00 2001
From: sunyuechi 
Date: Wed, 22 Nov 2023 14:57:29 +0800
Subject: [PATCH] lavc/ac3dsp: R-V V float_to_fixed24

c910
float_to_fixed24_c: 208.2
float_to_fixed24_rvv_f32: 71.5
---
 libavcodec/riscv/Makefile  |  3 ++-
 libavcodec/riscv/ac3dsp_init.c |  5 +
 libavcodec/riscv/ac3dsp_rvv.S  | 40 ++
 3 files changed, 47 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/riscv/ac3dsp_rvv.S

diff --git a/libavcodec/riscv/Makefile b/libavcodec/riscv/Makefile
index 8f2a519827..ac7b7c2929 100644
--- a/libavcodec/riscv/Makefile
+++ b/libavcodec/riscv/Makefile
@@ -1,7 +1,8 @@
 OBJS-$(CONFIG_AAC_DECODER) += riscv/aacpsdsp_init.o riscv/sbrdsp_init.o
 RVV-OBJS-$(CONFIG_AAC_DECODER) += riscv/aacpsdsp_rvv.o riscv/sbrdsp_rvv.o
 OBJS-$(CONFIG_AC3DSP) += riscv/ac3dsp_init.o \
- riscv/ac3dsp_rvb.o
+ riscv/ac3dsp_rvb.o \
+ riscv/ac3dsp_rvv.o
 OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_init.o
 RVV-OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_rvv.o
 OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_init.o \
diff --git a/libavcodec/riscv/ac3dsp_init.c b/libavcodec/riscv/ac3dsp_init.c
index 20f294f1de..de82d1c7a7 100644
--- a/libavcodec/riscv/ac3dsp_init.c
+++ b/libavcodec/riscv/ac3dsp_init.c
@@ -26,6 +26,7 @@
 #include "libavcodec/ac3dsp.h"
 
 void ff_extract_exponents_rvb(uint8_t *exp, int32_t *coef, int nb_coefs);
+void ff_float_to_fixed24_rvv(int32_t *dst, const float *src, unsigned int len);
 
 av_cold void ff_ac3dsp_init_riscv(AC3DSPContext *c)
 {
@@ -35,4 +36,8 @@ av_cold void ff_ac3dsp_init_riscv(AC3DSPContext *c)
 if (flags & AV_CPU_FLAG_RVB_BASIC)
 c->extract_exponents = ff_extract_exponents_rvb;
 }
+
+if (flags & AV_CPU_FLAG_RVV_F32) {
+c->float_to_fixed24 = ff_float_to_fixed24_rvv;
+}
 }
diff --git a/libavcodec/riscv/ac3dsp_rvv.S b/libavcodec/riscv/ac3dsp_rvv.S
new file mode 100644
index 00..4d8ab060e7
--- /dev/null
+++ b/libavcodec/riscv/ac3dsp_rvv.S
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2023 Institue of Software Chinese Academy of Sciences (ISCAS).
+ *
+ * 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 "libavutil/riscv/asm.S"
+
+func ff_float_to_fixed24_rvv, zve32f
+lit1, 1 << 24
+fcvt.s.w  f0, t1
+1:
+vsetvli   t0, a2, e32, m4, ta, ma
+vle32.v   v0, (a1)
+slli  t3, t0, 2
+vfmul.vf  v0, v0, f0
+vfcvt.x.f.v   v0, v0
+add   a1, a1, t3
+vse32.v   v0, (a0)
+add   a0, a0, t3
+sub   a2, a2, t0
+bgtz  a2, 1b
+
+ret
+endfunc
-- 
2.43.0

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

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


Re: [FFmpeg-devel] [PATCH 1/6] lavc/aarch64: new optimization for 8-bit hevc_pel_bi_pixels

2023-11-22 Thread Logan.Lyu

Hi Michael,

Thank you for reply.

I can't reproduce the error you mentioned...

I can apply patches to the ffmpeg master branch normally using 'git 
apply xxx.patch/.eml' or 'git am xxx.patch/.eml'.


By the way, I create these patches by /'git format-patch -s -o "../" 
--add-header "X-Unsent: 1" --suffix .eml --to ffmpeg-devel@ffmpeg.org -6 
--filename-max-length=100' /to generate .eml file.  And /'git 
format-patch  -4 --filename-max-length=100' /to generate .patch file as 
attachment to prevent encoding format problems in email files. These 
command should be OK, right?


Can you try these patches again? If the error still occurs, please tell 
me how it occurred then I will fixed it.



在 2023/11/20 4:42, Michael Niedermayer 写道:

On Sat, Nov 18, 2023 at 10:06:37AM +0800, Logan.Lyu wrote:

put_hevc_pel_bi_pixels4_8_c: 54.7
put_hevc_pel_bi_pixels4_8_neon: 43.0
put_hevc_pel_bi_pixels6_8_c: 94.7
put_hevc_pel_bi_pixels6_8_neon: 37.0
put_hevc_pel_bi_pixels8_8_c: 171.0
put_hevc_pel_bi_pixels8_8_neon: 24.0
put_hevc_pel_bi_pixels12_8_c: 354.0
put_hevc_pel_bi_pixels12_8_neon: 68.7
put_hevc_pel_bi_pixels16_8_c: 588.2
put_hevc_pel_bi_pixels16_8_neon: 77.5
put_hevc_pel_bi_pixels24_8_c: 1670.7
put_hevc_pel_bi_pixels24_8_neon: 173.0
put_hevc_pel_bi_pixels32_8_c: 2267.7
put_hevc_pel_bi_pixels32_8_neon: 281.2
put_hevc_pel_bi_pixels48_8_c: 5787.5
put_hevc_pel_bi_pixels48_8_neon: 673.5
put_hevc_pel_bi_pixels64_8_c: 9897.0
put_hevc_pel_bi_pixels64_8_neon: 1159.5

Co-Authored-By: J. Dekker
Signed-off-by: Logan Lyu
---
  libavcodec/aarch64/hevcdsp_epel_neon.S| 179 ++
  libavcodec/aarch64/hevcdsp_init_aarch64.c |  10 +-
  2 files changed, 187 insertions(+), 2 deletions(-)

diff --git a/libavcodec/aarch64/hevcdsp_epel_neon.S
b/libavcodec/aarch64/hevcdsp_epel_neon.S
index 708b903b00..74165273d7 100644
--- a/libavcodec/aarch64/hevcdsp_epel_neon.S
+++ b/libavcodec/aarch64/hevcdsp_epel_neon.S
@@ -244,6 +244,185 @@ function ff_hevc_put_hevc_pel_pixels64_8_neon,
export=1

error: corrupt patch at line 194

[...]


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

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

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

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


Re: [FFmpeg-devel] [PATCH 1/6] lavc/aarch64: new optimization for 8-bit hevc_pel_bi_pixels

2023-11-22 Thread Martin Storsjö via ffmpeg-devel

On Wed, 22 Nov 2023, Logan.Lyu wrote:


I can't reproduce the error you mentioned...

I can apply patches to the ffmpeg master branch normally using 'git 
apply xxx.patch/.eml' or 'git am xxx.patch/.eml'.


I guess you have emails that haven't been through the complete delivery 
chain, while some later party might have rewritten things.


By the way, I create these patches by /'git format-patch -s -o "../" 
--add-header "X-Unsent: 1" --suffix .eml --to ffmpeg-devel@ffmpeg.org -6 
--filename-max-length=100' /to generate .eml file.  And /'git 
format-patch  -4 --filename-max-length=100' /to generate .patch file as 
attachment to prevent encoding format problems in email files. These 
command should be OK, right?


That's right for generating the patch files. I guess the problem here 
isn't about the patch files themselves, but the email delivery of them.


Can you try these patches again? If the error still occurs, please tell 
me how it occurred then I will fixed it.


I also tried applying them now with "git am", and I got this:

Applying: lavc/aarch64: new optimization for 8-bit hevc_pel_bi_pixels
error: corrupt patch at line 194
Patch failed at 0001 lavc/aarch64: new optimization for 8-bit hevc_pel_bi_pixels
hint: Use 'git am --show-current-patch=diff' to see the failed patch

Thus, same issue here.

In earlier iterations, the patches have arrived correctly when you have 
sent them as attachments, instead of when sending them as plain inline 
patches with git send-email.


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

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


Re: [FFmpeg-devel] [PATCH 2/3] swscale/utils: correctly return from sws_init_single_context

2023-11-22 Thread Niklas Haas
On Tue, 14 Nov 2023 23:52:50 +0100 Michael Niedermayer  
wrote:
> would this result in overall cleaner code or do you see some problems
> with this ?
> 
> Given the messi-ness that the always setting results in i would maybe
> suggest to explore this and see if this is cleaner.
> 
> Its conceptually not wrong that if parameters change that init should
> be redone.

I gave this a try, but doing it internally is very tricky for a number
of reasons and does not present obvious advantages over requiring the
user to free+reinit if they wish to change range. So, the best long-term
solution here would be to simply remove srcRange/dstRange from the
signature of sws_setColorspaceDetails.

vf_scale is the only current user of this API inside ffmpeg itself, and
after the YUVJ removal series this call is no longer needed at all. (All
range setup happens at filter init time with filter range negotiation)

I think merging this series as-is represents the best short-term fix to
the existing fundamental issues with this design. But if you want to
rewrite all of swscale init code to allow graceful re-init on range
change, be my guest.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 2/3] swscale/utils: correctly return from sws_init_single_context

2023-11-22 Thread Michael Niedermayer
Hi

On Wed, Nov 22, 2023 at 01:45:05PM +0100, Niklas Haas wrote:
> On Tue, 14 Nov 2023 23:52:50 +0100 Michael Niedermayer 
>  wrote:
> > would this result in overall cleaner code or do you see some problems
> > with this ?
> > 
> > Given the messi-ness that the always setting results in i would maybe
> > suggest to explore this and see if this is cleaner.
> > 
> > Its conceptually not wrong that if parameters change that init should
> > be redone.
> 
> I gave this a try, but doing it internally is very tricky for a number
> of reasons

ok


> and does not present obvious advantages over requiring the
> user to free+reinit if they wish to change range. So, the best long-term
> solution here would be to simply remove srcRange/dstRange from the
> signature of sws_setColorspaceDetails.

this doesnt feel right

logic should be:

1. alloc struct
2. set all details for everything
3. init
4+ use
n free


or some API with
convert between 2 frames and have a automatically cached and managed context
where all details are either in the metadata of the frames itself or given to
the function

The whole idea of adjusting some details which could affect the required
codepath without init is fishy unless everything can be adjusted that way
and its the normal way of initing things

So IMHO

first lets figure out how this should be in the long run (moving to a
clean API and clean implemenattion)

and then find out how to move towards that in small steps that achieves
teh short term goals quickly

I dont like trying to achieve the short term goal with messy code
and the long term unrelated.
Because i have to maintain this and so i will not agree to something
that moves us away from a clean long term result

That said, if you must change the API, change the API, that i do not
mind

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] ac3dsp: RISC-V V float_to_fixed24

2023-11-22 Thread Rémi Denis-Courmont
Hi,

How did you test it? As per 
http://ffmpeg.org/pipermail/ffmpeg-devel/2023-June/310720.html we still don't 
have a FATE instance set up with the RISC-V Vector extension. The only testing 
consists of my manual runs of checkasm on a K230 board. (We *do* have Zba and 
Zbb now though, hence the existing extract_exponents()).

Also:
- This does not seem according to the C ABI. AFAIK `unsigned` is sign-extended.
- ALU right before dependent conditional branch should be avoided.
- SHxADD can be used advantageously.


Le 22 novembre 2023 14:00:07 GMT+02:00, flow gg  a écrit :
>c910
>float_to_fixed24_c: 208.2
>float_to_fixed24_rvv_f32: 71.5
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] ac3dsp: RISC-V V float_to_fixed24

2023-11-22 Thread flow gg
> How did you test it?

I wrote a test, but it was a bit rough, so I want to modify it before
submitting. I've added it to this reply.

> This does not seem according to the C ABI. AFAIK `unsigned` is
sign-extended.

I'm a bit confused... because this passed in the tests I wrote in qemu.
Maybe there's a problem with my test?

> ALU right before dependent conditional branch should be avoided.

Should the sub be moved forward? I've modified it.

> SHxADD can be used advantageously.

Okay, I've made the modification

Rémi Denis-Courmont  于2023年11月22日周三 21:41写道:

> Hi,
>
> How did you test it? As per
> http://ffmpeg.org/pipermail/ffmpeg-devel/2023-June/310720.html we still
> don't have a FATE instance set up with the RISC-V Vector extension. The
> only testing consists of my manual runs of checkasm on a K230 board. (We
> *do* have Zba and Zbb now though, hence the existing extract_exponents()).
>
> Also:
> - This does not seem according to the C ABI. AFAIK `unsigned` is
> sign-extended.
> - ALU right before dependent conditional branch should be avoided.
> - SHxADD can be used advantageously.
>
>
> Le 22 novembre 2023 14:00:07 GMT+02:00, flow gg  a
> écrit :
> >c910
> >float_to_fixed24_c: 208.2
> >float_to_fixed24_rvv_f32: 71.5
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>
From 3e790fdccd780257f464aa8f8a56a37321ddd429 Mon Sep 17 00:00:00 2001
From: sunyuechi 
Date: Wed, 22 Nov 2023 14:57:29 +0800
Subject: [PATCH] lavc/ac3dsp: R-V V float_to_fixed24

c910
float_to_fixed24_c: 208.2
float_to_fixed24_rvv_f32: 71.5
---
 libavcodec/riscv/Makefile  |  3 ++-
 libavcodec/riscv/ac3dsp_init.c |  5 +
 libavcodec/riscv/ac3dsp_rvv.S  | 39 ++
 3 files changed, 46 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/riscv/ac3dsp_rvv.S

diff --git a/libavcodec/riscv/Makefile b/libavcodec/riscv/Makefile
index 8f2a519827..ac7b7c2929 100644
--- a/libavcodec/riscv/Makefile
+++ b/libavcodec/riscv/Makefile
@@ -1,7 +1,8 @@
 OBJS-$(CONFIG_AAC_DECODER) += riscv/aacpsdsp_init.o riscv/sbrdsp_init.o
 RVV-OBJS-$(CONFIG_AAC_DECODER) += riscv/aacpsdsp_rvv.o riscv/sbrdsp_rvv.o
 OBJS-$(CONFIG_AC3DSP) += riscv/ac3dsp_init.o \
- riscv/ac3dsp_rvb.o
+ riscv/ac3dsp_rvb.o \
+ riscv/ac3dsp_rvv.o
 OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_init.o
 RVV-OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_rvv.o
 OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_init.o \
diff --git a/libavcodec/riscv/ac3dsp_init.c b/libavcodec/riscv/ac3dsp_init.c
index 20f294f1de..de82d1c7a7 100644
--- a/libavcodec/riscv/ac3dsp_init.c
+++ b/libavcodec/riscv/ac3dsp_init.c
@@ -26,6 +26,7 @@
 #include "libavcodec/ac3dsp.h"
 
 void ff_extract_exponents_rvb(uint8_t *exp, int32_t *coef, int nb_coefs);
+void ff_float_to_fixed24_rvv(int32_t *dst, const float *src, unsigned int len);
 
 av_cold void ff_ac3dsp_init_riscv(AC3DSPContext *c)
 {
@@ -35,4 +36,8 @@ av_cold void ff_ac3dsp_init_riscv(AC3DSPContext *c)
 if (flags & AV_CPU_FLAG_RVB_BASIC)
 c->extract_exponents = ff_extract_exponents_rvb;
 }
+
+if (flags & AV_CPU_FLAG_RVV_F32) {
+c->float_to_fixed24 = ff_float_to_fixed24_rvv;
+}
 }
diff --git a/libavcodec/riscv/ac3dsp_rvv.S b/libavcodec/riscv/ac3dsp_rvv.S
new file mode 100644
index 00..c0e2880e28
--- /dev/null
+++ b/libavcodec/riscv/ac3dsp_rvv.S
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2023 Institue of Software Chinese Academy of Sciences (ISCAS).
+ *
+ * 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 "libavutil/riscv/asm.S"
+
+func ff_float_to_fixed24_rvv, zve32f
+lit1, 1 << 24
+fcvt.s.w  f0, t1
+1:
+vsetvli   t0, a2, e32, m4, ta, ma
+sub   a2, a2, t0
+vle32.v   v0, (a1)
+vfmul.vf  v0, v0, f0
+vfcvt.x.f.v   v0, v0
+sh2adda1, t0, a1
+vse32.v   v0, (a0)
+sh2adda0, t0, a0
+bgtz  a2, 1b
+
+ret
+end

Re: [FFmpeg-devel] [PATCH] ac3dsp: RISC-V V float_to_fixed24

2023-11-22 Thread flow gg
qemu-riscv64 -cpu rv64,v=true,g=true,c=true,zba=true,vlen=128 checkasm
--test=ac3dsp

flow gg  于2023年11月22日周三 22:30写道:

> > How did you test it?
>
> I wrote a test, but it was a bit rough, so I want to modify it before
> submitting. I've added it to this reply.
>
> > This does not seem according to the C ABI. AFAIK `unsigned` is
> sign-extended.
>
> I'm a bit confused... because this passed in the tests I wrote in qemu.
> Maybe there's a problem with my test?
>
> > ALU right before dependent conditional branch should be avoided.
>
> Should the sub be moved forward? I've modified it.
>
> > SHxADD can be used advantageously.
>
> Okay, I've made the modification
>
> Rémi Denis-Courmont  于2023年11月22日周三 21:41写道:
>
>> Hi,
>>
>> How did you test it? As per
>> http://ffmpeg.org/pipermail/ffmpeg-devel/2023-June/310720.html we still
>> don't have a FATE instance set up with the RISC-V Vector extension. The
>> only testing consists of my manual runs of checkasm on a K230 board. (We
>> *do* have Zba and Zbb now though, hence the existing extract_exponents()).
>>
>> Also:
>> - This does not seem according to the C ABI. AFAIK `unsigned` is
>> sign-extended.
>> - ALU right before dependent conditional branch should be avoided.
>> - SHxADD can be used advantageously.
>>
>>
>> Le 22 novembre 2023 14:00:07 GMT+02:00, flow gg  a
>> écrit :
>> >c910
>> >float_to_fixed24_c: 208.2
>> >float_to_fixed24_rvv_f32: 71.5
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] ac3dsp: RISC-V V float_to_fixed24

2023-11-22 Thread Rémi Denis-Courmont


Le 22 novembre 2023 16:30:44 GMT+02:00, flow gg  a écrit :
>> How did you test it?
>
>I wrote a test, but it was a bit rough, so I want to modify it before
>submitting. I've added it to this reply.
>
>> This does not seem according to the C ABI. AFAIK `unsigned` is
>sign-extended.
>
>I'm a bit confused... because this passed in the tests I wrote in qemu.
>Maybe there's a problem with my test?

You probably didn't test sizes between 2^31 and 2^32-1. This might not even be 
feasible in QEMU.

Ideally the prototype would use size_t, then the problem wouldn't exist.

>
>> ALU right before dependent conditional branch should be avoided.
>
>Should the sub be moved forward? I've modified it.
>
>> SHxADD can be used advantageously.
>
>Okay, I've made the modification
>
>Rémi Denis-Courmont  于2023年11月22日周三 21:41写道:
>
>> Hi,
>>
>> How did you test it? As per
>> http://ffmpeg.org/pipermail/ffmpeg-devel/2023-June/310720.html we still
>> don't have a FATE instance set up with the RISC-V Vector extension. The
>> only testing consists of my manual runs of checkasm on a K230 board. (We
>> *do* have Zba and Zbb now though, hence the existing extract_exponents()).
>>
>> Also:
>> - This does not seem according to the C ABI. AFAIK `unsigned` is
>> sign-extended.
>> - ALU right before dependent conditional branch should be avoided.
>> - SHxADD can be used advantageously.
>>
>>
>> Le 22 novembre 2023 14:00:07 GMT+02:00, flow gg  a
>> écrit :
>> >c910
>> >float_to_fixed24_c: 208.2
>> >float_to_fixed24_rvv_f32: 71.5
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] ac3dsp: RISC-V V float_to_fixed24

2023-11-22 Thread flow gg
Thank you for your guidance, I finally understand..  How about choosing
manual zero-extension for rv64? I modified the patch.

#if (__riscv_xlen == 64)
slli a2, a2, 32
srli a2, a2, 32
#endif

Rémi Denis-Courmont  于2023年11月22日周三 22:51写道:

>
>
> Le 22 novembre 2023 16:30:44 GMT+02:00, flow gg  a
> écrit :
> >> How did you test it?
> >
> >I wrote a test, but it was a bit rough, so I want to modify it before
> >submitting. I've added it to this reply.
> >
> >> This does not seem according to the C ABI. AFAIK `unsigned` is
> >sign-extended.
> >
> >I'm a bit confused... because this passed in the tests I wrote in qemu.
> >Maybe there's a problem with my test?
>
> You probably didn't test sizes between 2^31 and 2^32-1. This might not
> even be feasible in QEMU.
>
> Ideally the prototype would use size_t, then the problem wouldn't exist.
>
> >
> >> ALU right before dependent conditional branch should be avoided.
> >
> >Should the sub be moved forward? I've modified it.
> >
> >> SHxADD can be used advantageously.
> >
> >Okay, I've made the modification
> >
> >Rémi Denis-Courmont  于2023年11月22日周三 21:41写道:
> >
> >> Hi,
> >>
> >> How did you test it? As per
> >> http://ffmpeg.org/pipermail/ffmpeg-devel/2023-June/310720.html we still
> >> don't have a FATE instance set up with the RISC-V Vector extension. The
> >> only testing consists of my manual runs of checkasm on a K230 board. (We
> >> *do* have Zba and Zbb now though, hence the existing
> extract_exponents()).
> >>
> >> Also:
> >> - This does not seem according to the C ABI. AFAIK `unsigned` is
> >> sign-extended.
> >> - ALU right before dependent conditional branch should be avoided.
> >> - SHxADD can be used advantageously.
> >>
> >>
> >> Le 22 novembre 2023 14:00:07 GMT+02:00, flow gg 
> a
> >> écrit :
> >> >c910
> >> >float_to_fixed24_c: 208.2
> >> >float_to_fixed24_rvv_f32: 71.5
> >> ___
> >> ffmpeg-devel mailing list
> >> ffmpeg-devel@ffmpeg.org
> >> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >>
> >> To unsubscribe, visit link above, or email
> >> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> >>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>
From d709519219138b746ff622b15bb004b27eed7333 Mon Sep 17 00:00:00 2001
From: sunyuechi 
Date: Wed, 22 Nov 2023 14:57:29 +0800
Subject: [PATCH] lavc/ac3dsp: R-V V float_to_fixed24

c910
float_to_fixed24_c: 208.2
float_to_fixed24_rvv_f32: 71.5
---
 libavcodec/riscv/Makefile  |  3 ++-
 libavcodec/riscv/ac3dsp_init.c |  5 
 libavcodec/riscv/ac3dsp_rvv.S  | 45 ++
 3 files changed, 52 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/riscv/ac3dsp_rvv.S

diff --git a/libavcodec/riscv/Makefile b/libavcodec/riscv/Makefile
index 8f2a519827..ac7b7c2929 100644
--- a/libavcodec/riscv/Makefile
+++ b/libavcodec/riscv/Makefile
@@ -1,7 +1,8 @@
 OBJS-$(CONFIG_AAC_DECODER) += riscv/aacpsdsp_init.o riscv/sbrdsp_init.o
 RVV-OBJS-$(CONFIG_AAC_DECODER) += riscv/aacpsdsp_rvv.o riscv/sbrdsp_rvv.o
 OBJS-$(CONFIG_AC3DSP) += riscv/ac3dsp_init.o \
- riscv/ac3dsp_rvb.o
+ riscv/ac3dsp_rvb.o \
+ riscv/ac3dsp_rvv.o
 OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_init.o
 RVV-OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_rvv.o
 OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_init.o \
diff --git a/libavcodec/riscv/ac3dsp_init.c b/libavcodec/riscv/ac3dsp_init.c
index 20f294f1de..de82d1c7a7 100644
--- a/libavcodec/riscv/ac3dsp_init.c
+++ b/libavcodec/riscv/ac3dsp_init.c
@@ -26,6 +26,7 @@
 #include "libavcodec/ac3dsp.h"
 
 void ff_extract_exponents_rvb(uint8_t *exp, int32_t *coef, int nb_coefs);
+void ff_float_to_fixed24_rvv(int32_t *dst, const float *src, unsigned int len);
 
 av_cold void ff_ac3dsp_init_riscv(AC3DSPContext *c)
 {
@@ -35,4 +36,8 @@ av_cold void ff_ac3dsp_init_riscv(AC3DSPContext *c)
 if (flags & AV_CPU_FLAG_RVB_BASIC)
 c->extract_exponents = ff_extract_exponents_rvb;
 }
+
+if (flags & AV_CPU_FLAG_RVV_F32) {
+c->float_to_fixed24 = ff_float_to_fixed24_rvv;
+}
 }
diff --git a/libavcodec/riscv/ac3dsp_rvv.S b/libavcodec/riscv/ac3dsp_rvv.S
new file mode 100644
index 00..4d4a566659
--- /dev/null
+++ b/libavcodec/riscv/ac3dsp_rvv.S
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2023 Institue of Software Chinese Academy of Sciences (ISCAS).
+ *
+ * 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 wil

Re: [FFmpeg-devel] [PATCH] ac3dsp: RISC-V V float_to_fixed24

2023-11-22 Thread James Almer

On 11/22/2023 1:37 PM, flow gg wrote:

Thank you for your guidance, I finally understand..  How about choosing
manual zero-extension for rv64? I modified the patch.

#if (__riscv_xlen == 64)
 slli a2, a2, 32
 srli a2, a2, 32
#endif


Please, don't top post.

I think it will be better to change the prototype to use ptrdiff_t for 
len, as it's done in other dps functions.




Rémi Denis-Courmont  于2023年11月22日周三 22:51写道:




Le 22 novembre 2023 16:30:44 GMT+02:00, flow gg  a
écrit :

How did you test it?


I wrote a test, but it was a bit rough, so I want to modify it before
submitting. I've added it to this reply.


This does not seem according to the C ABI. AFAIK `unsigned` is

sign-extended.

I'm a bit confused... because this passed in the tests I wrote in qemu.
Maybe there's a problem with my test?


You probably didn't test sizes between 2^31 and 2^32-1. This might not
even be feasible in QEMU.

Ideally the prototype would use size_t, then the problem wouldn't exist.




ALU right before dependent conditional branch should be avoided.


Should the sub be moved forward? I've modified it.


SHxADD can be used advantageously.


Okay, I've made the modification

Rémi Denis-Courmont  于2023年11月22日周三 21:41写道:


Hi,

How did you test it? As per
http://ffmpeg.org/pipermail/ffmpeg-devel/2023-June/310720.html we still
don't have a FATE instance set up with the RISC-V Vector extension. The
only testing consists of my manual runs of checkasm on a K230 board. (We
*do* have Zba and Zbb now though, hence the existing

extract_exponents()).


Also:
- This does not seem according to the C ABI. AFAIK `unsigned` is
sign-extended.
- ALU right before dependent conditional branch should be avoided.
- SHxADD can be used advantageously.


Le 22 novembre 2023 14:00:07 GMT+02:00, flow gg 

a

écrit :

c910
float_to_fixed24_c: 208.2
float_to_fixed24_rvv_f32: 71.5

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

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


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

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


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

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

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

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


Re: [FFmpeg-devel] [PATCH] ac3dsp: RISC-V V float_to_fixed24

2023-11-22 Thread James Almer

On 11/22/2023 11:30 AM, flow gg wrote:

How did you test it?


I wrote a test, but it was a bit rough, so I want to modify it before
submitting. I've added it to this reply.




From 08a012d86db51275fd2cda8dd7ad47cc1f1481ce Mon Sep 17 00:00:00 2001
From: sunyuechi 
Date: Wed, 22 Nov 2023 14:57:29 +0800
Subject: [PATCH] lavc/ac3dsp: R-V V float_to_fixed24

---
 tests/checkasm/Makefile   |  1 +
 tests/checkasm/ac3dsp.c   | 88 +++
 tests/checkasm/checkasm.c |  3 ++
 tests/checkasm/checkasm.h |  1 +
 4 files changed, 93 insertions(+)
 create mode 100644 tests/checkasm/ac3dsp.c

diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile
index 8bc241d29b..8c714c2a07 100644
--- a/tests/checkasm/Makefile
+++ b/tests/checkasm/Makefile
@@ -5,6 +5,7 @@ AVCODECOBJS-$(CONFIG_BLOCKDSP)  += blockdsp.o
 AVCODECOBJS-$(CONFIG_BSWAPDSP)  += bswapdsp.o
 AVCODECOBJS-$(CONFIG_FMTCONVERT)+= fmtconvert.o
 AVCODECOBJS-$(CONFIG_G722DSP)   += g722dsp.o
+AVCODECOBJS-$(CONFIG_AC3DSP)+= ac3dsp.o
 AVCODECOBJS-$(CONFIG_H264CHROMA)+= h264chroma.o
 AVCODECOBJS-$(CONFIG_H264DSP)   += h264dsp.o
 AVCODECOBJS-$(CONFIG_H264PRED)  += h264pred.o
diff --git a/tests/checkasm/ac3dsp.c b/tests/checkasm/ac3dsp.c
new file mode 100644
index 00..ebebe06990
--- /dev/null
+++ b/tests/checkasm/ac3dsp.c
@@ -0,0 +1,88 @@
+#include "checkasm.h"
+#include 
+
+
+#include 
+
+#include "libavutil/common.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
+
+#include "libavcodec/ac3dsp.h"
+
+/**
+ * Convert an array of float in range [-1.0,1.0] to int32_t with range
+ * [-(1<<24),(1<<24)]
+ *
+ * @param dst destination array of int32_t.
+ *constraints: 16-byte aligned
+ * @param src source array of float.
+ *constraints: 16-byte aligned
+ * @param len number of elements to convert.
+ *constraints: multiple of 32 greater than zero
+ */
+// void (*float_to_fixed24)(int32_t *dst, const float *src, unsigned int len);
+
+
+#define randomize_float(buf, len)   \
+do {\
+int i;  \
+for (i = 0; i < len; i++) { \
+float f = (float)rnd() / (UINT_MAX >> 5) - 16.0f;   \
+buf[i] = f; \
+}   \
+} while (0)
+
+#define randomize_int(buf, len, size, bits) \
+do {\
+int i;  \
+for (i = 0; i < len; i++) { \
+uint ## size ## _t r = rnd() & ((1LL << bits) - 1); \
+AV_WN ## size ## A(buf + i, -(1LL << (bits - 1)) + r);  \
+}   \
+} while (0)
+
+static void check_float_to_fixed24(AC3DSPContext *c) {
+#define BUF_SIZE 800


800, if this is meant to be used as len, is not a multiple of 32.


+LOCAL_ALIGNED_32(int32_t, v1, [BUF_SIZE]);
+LOCAL_ALIGNED_32(float, v2, [BUF_SIZE]);
+
+declare_func(void, int32_t *, const float *, unsigned int);
+
+randomize_int(v1, BUF_SIZE, 32, 10);


This is not really used at all. The input is floats, and the output is 
write only.



+randomize_float(v2, BUF_SIZE);
+
+if (check_func(c->float_to_fixed24, "float_to_fixed24")) {
+LOCAL_ALIGNED_32(int32_t, dst, [BUF_SIZE]);
+LOCAL_ALIGNED_32(int32_t, dst2, [BUF_SIZE]);


The requirement is 16 byte alignment.


+
+call_ref(dst, v2, 80);


This should be BUF_SIZE. And 80 is also not a multiple of 32.


+call_new(dst2, v2, 80);
+
+   if (memcmp(dst, dst2, sizeof(*dst) * 10) != 0){


memcmp(dst, dst2, sizeof(dst))


+   puts(">> fail 
");


No puts(), please. This line is also not needed.


+   for(int i = 0 ; i < 10; i++){
+   printf("dst[%d] = %d, 
dst2[%d] = %d\n", i, dst[i], i, dst2[i]);


fprintf(stderr, ...);


+   }
+   puts("");
+
+fail();
+   } else {
+   puts(">> ok 
");


Same.


+   }
+
+bench_new(v1, v2, 80);


bench_new(dst2, v2...


+}
+
+
+   report("float_to_fixed24");
+}
+
+void checkasm_check_ac3dsp(void)
+{
+   AC3DSPContext c;
+   ff_ac3dsp_init(&c);
+
+   check_float_to_fixed24(&c);
+}
diff --git a/tests/checkasm/ch

Re: [FFmpeg-devel] [PATCH] ac3dsp: RISC-V V float_to_fixed24

2023-11-22 Thread flow gg
Wow, thank you for reviewing this. I just wanted to see if the function was
working properly. There are so many bugs in the test code ...
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH v5 4/7] libavcodec/webp: add support for animated WebP decoding

2023-11-22 Thread Thilo Borgmann via ffmpeg-devel

Am 22.11.23 um 03:54 schrieb Cosmin Stejerean via ffmpeg-devel:

On Nov 20, 2023, at 5:14 PM, James Almer  wrote:

On 11/20/2023 4:22 PM, Thilo Borgmann via ffmpeg-devel wrote:
+    if (*got_frame) {
+    if (!(s->vp8x_flags & VP8X_FLAG_ANIMATION)) {
+    // no animation, output the decoded frame
+    av_frame_move_ref(p, s->frame);
+    ret = ff_attach_decode_data(p);
+    if (ret < 0)
+    return ret;

If this frame's buffers were allocated with ff_get_buffer() (or its threaded 
version), then a call to ff_attach_decode_data() is not necessary.

The frame returned by avcodec_receive_frame doesn’t have private_ref set on it, 
and eventually this null private_ref would get propagated to the other frame 
objects (even if allocated with ff_get_buffer) by av_frame_copy_props, and 
later on this would fail the assert that frames returned by codecs with 
AV_CODEC_CAP_DR1 have private_ref set on them.




However this patch is dealing with it in the wrong place, moving 
ff_attach_decode_data to right after avcodec_receive_frame would both make this 
more clear and fix the assert issues (currently there’s an unnecessary call to 
ff_attach_decode_data on an already allocated frame in a code path that doesn’t 
go through vp8_lossy_decode_frame).

I verified that with that change on top of the current patch set it would run 
the webp fate tests cleanly. I’m not sure if this is the best way to properly 
reference a frame that came from avcodec_receive_frame inside of another codec. 
But it does seem to work and a cursory search didn’t reveal a better API for 
this.


Moving ff_attach_decode_data() right after avcodec_receive_frame() solved FATE 
& the asserts even for --assert-level=2.

Will post a v6 according to this soon, unless there's more feedback on the 
buffer creation.

Thanks,
Thilo
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH 1/3] x86/ac3dsp: reduce instruction count inside the float_to_fixed24 loop

2023-11-22 Thread James Almer
Signed-off-by: James Almer 
---
 libavcodec/x86/ac3dsp.asm | 46 +++
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/libavcodec/x86/ac3dsp.asm b/libavcodec/x86/ac3dsp.asm
index a95d359d95..42c8310462 100644
--- a/libavcodec/x86/ac3dsp.asm
+++ b/libavcodec/x86/ac3dsp.asm
@@ -77,16 +77,20 @@ AC3_EXPONENT_MIN
 INIT_XMM sse2
 cglobal float_to_fixed24, 3, 3, 9, dst, src, len
 movaps m0, [pf_1_24]
+shl  lenq, 2
+add  srcq, lenq
+add  dstq, lenq
+neg  lenq
 .loop:
-movaps m1, [srcq]
-movaps m2, [srcq+16 ]
-movaps m3, [srcq+32 ]
-movaps m4, [srcq+48 ]
+movaps m1, [srcq+lenq]
+movaps m2, [srcq+lenq+16 ]
+movaps m3, [srcq+lenq+32 ]
+movaps m4, [srcq+lenq+48 ]
 %ifdef m8
-movaps m5, [srcq+64 ]
-movaps m6, [srcq+80 ]
-movaps m7, [srcq+96 ]
-movaps m8, [srcq+112]
+movaps m5, [srcq+lenq+64 ]
+movaps m6, [srcq+lenq+80 ]
+movaps m7, [srcq+lenq+96 ]
+movaps m8, [srcq+lenq+112]
 %endif
 mulps  m1, m0
 mulps  m2, m0
@@ -108,24 +112,20 @@ cglobal float_to_fixed24, 3, 3, 9, dst, src, len
 cvtps2dq   m7, m7
 cvtps2dq   m8, m8
 %endif
-movdqa  [dstq], m1
-movdqa  [dstq+16 ], m2
-movdqa  [dstq+32 ], m3
-movdqa  [dstq+48 ], m4
+movdqa  [dstq+lenq], m1
+movdqa  [dstq+lenq+16 ], m2
+movdqa  [dstq+lenq+32 ], m3
+movdqa  [dstq+lenq+48 ], m4
 %ifdef m8
-movdqa  [dstq+64 ], m5
-movdqa  [dstq+80 ], m6
-movdqa  [dstq+96 ], m7
-movdqa  [dstq+112], m8
-add  srcq, 128
-add  dstq, 128
-sub  lenq, 32
+movdqa  [dstq+lenq+64 ], m5
+movdqa  [dstq+lenq+80 ], m6
+movdqa  [dstq+lenq+96 ], m7
+movdqa  [dstq+lenq+112], m8
+add  lenq, 128
 %else
-add  srcq, 64
-add  dstq, 64
-sub  lenq, 16
+add  lenq, 64
 %endif
-ja .loop
+jl .loop
 RET
 
 ;--
-- 
2.42.1

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

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


[FFmpeg-devel] [PATCH 2/3] x86/ac3dsp: add ff_float_to_fixed24_avx2()

2023-11-22 Thread James Almer
Signed-off-by: James Almer 
---
 libavcodec/ac3dsp.h  |  4 ++--
 libavcodec/ac3enc_template.c |  2 +-
 libavcodec/x86/ac3dsp.asm| 28 ++--
 libavcodec/x86/ac3dsp_init.c |  4 
 4 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/libavcodec/ac3dsp.h b/libavcodec/ac3dsp.h
index a01bff3d11..25341f3396 100644
--- a/libavcodec/ac3dsp.h
+++ b/libavcodec/ac3dsp.h
@@ -47,9 +47,9 @@ typedef struct AC3DSPContext {
  * [-(1<<24),(1<<24)]
  *
  * @param dst destination array of int32_t.
- *constraints: 16-byte aligned
+ *constraints: 32-byte aligned
  * @param src source array of float.
- *constraints: 16-byte aligned
+ *constraints: 32-byte aligned
  * @param len number of elements to convert.
  *constraints: multiple of 32 greater than zero
  */
diff --git a/libavcodec/ac3enc_template.c b/libavcodec/ac3enc_template.c
index be4ecebc9c..a16faea681 100644
--- a/libavcodec/ac3enc_template.c
+++ b/libavcodec/ac3enc_template.c
@@ -112,7 +112,7 @@ static void apply_channel_coupling(AC3EncodeContext *s)
 {
 LOCAL_ALIGNED_16(CoefType, cpl_coords,  [AC3_MAX_BLOCKS], 
[AC3_MAX_CHANNELS][16]);
 #if AC3ENC_FLOAT
-LOCAL_ALIGNED_16(int32_t, fixed_cpl_coords, [AC3_MAX_BLOCKS], 
[AC3_MAX_CHANNELS][16]);
+LOCAL_ALIGNED_32(int32_t, fixed_cpl_coords, [AC3_MAX_BLOCKS], 
[AC3_MAX_CHANNELS][16]);
 #else
 int32_t (*fixed_cpl_coords)[AC3_MAX_CHANNELS][16] = cpl_coords;
 #endif
diff --git a/libavcodec/x86/ac3dsp.asm b/libavcodec/x86/ac3dsp.asm
index 42c8310462..e31c58e1c1 100644
--- a/libavcodec/x86/ac3dsp.asm
+++ b/libavcodec/x86/ac3dsp.asm
@@ -21,10 +21,10 @@
 
 %include "libavutil/x86/x86util.asm"
 
-SECTION_RODATA
+SECTION_RODATA 32
 
 ; 16777216.0f - used in ff_float_to_fixed24()
-pf_1_24: times 4 dd 0x4B80
+pf_1_24: times 8 dd 0x4B80
 
 ; used in ff_ac3_compute_mantissa_size()
 cextern ac3_bap_bits
@@ -128,6 +128,30 @@ cglobal float_to_fixed24, 3, 3, 9, dst, src, len
 jl .loop
 RET
 
+INIT_YMM avx2
+cglobal float_to_fixed24, 3, 3, 5, dst, src, len
+movaps m0, [pf_1_24]
+shl  lenq, 2
+add  srcq, lenq
+add  dstq, lenq
+neg  lenq
+.loop:
+mulps  m1, m0, [srcq+lenq+mmsize*0]
+mulps  m2, m0, [srcq+lenq+mmsize*1]
+mulps  m3, m0, [srcq+lenq+mmsize*2]
+mulps  m4, m0, [srcq+lenq+mmsize*3]
+cvtps2dq   m1, m1
+cvtps2dq   m2, m2
+cvtps2dq   m3, m3
+cvtps2dq   m4, m4
+movdqa  [dstq+lenq+mmsize*0], m1
+movdqa  [dstq+lenq+mmsize*1], m2
+movdqa  [dstq+lenq+mmsize*2], m3
+movdqa  [dstq+lenq+mmsize*3], m4
+add  lenq, mmsize*4
+jl .loop
+RET
+
 ;--
 ; int ff_ac3_compute_mantissa_size(uint16_t mant_cnt[6][16])
 ;--
diff --git a/libavcodec/x86/ac3dsp_init.c b/libavcodec/x86/ac3dsp_init.c
index 43b3b4ac85..106121b5b9 100644
--- a/libavcodec/x86/ac3dsp_init.c
+++ b/libavcodec/x86/ac3dsp_init.c
@@ -27,6 +27,7 @@
 void ff_ac3_exponent_min_sse2  (uint8_t *exp, int num_reuse_blocks, int 
nb_coefs);
 
 void ff_float_to_fixed24_sse2 (int32_t *dst, const float *src, unsigned int 
len);
+void ff_float_to_fixed24_avx2 (int32_t *dst, const float *src, unsigned int 
len);
 
 int ff_ac3_compute_mantissa_size_sse2(uint16_t mant_cnt[6][16]);
 
@@ -48,6 +49,9 @@ av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c)
 if (!(cpu_flags & AV_CPU_FLAG_ATOM))
 c->extract_exponents = ff_ac3_extract_exponents_ssse3;
 }
+if (EXTERNAL_AVX2_FAST(cpu_flags)) {
+c->float_to_fixed24 = ff_float_to_fixed24_avx2;
+}
 }
 
 #define DOWNMIX_FUNC_OPT(ch, opt)   \
-- 
2.42.1

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

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


[FFmpeg-devel] [PATCH 3/3] avcodec/ac3dsp: make len a size_t in float_to_fixed24

2023-11-22 Thread James Almer
Should simplify asm implementations, and prevent UB on at least win64.

Signed-off-by: James Almer 
---
 libavcodec/ac3dsp.c  | 2 +-
 libavcodec/ac3dsp.h  | 2 +-
 libavcodec/arm/ac3dsp_init_arm.c | 2 +-
 libavcodec/mips/ac3dsp_mips.c| 2 +-
 libavcodec/x86/ac3dsp_init.c | 4 ++--
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavcodec/ac3dsp.c b/libavcodec/ac3dsp.c
index 302b786b15..8397e03d32 100644
--- a/libavcodec/ac3dsp.c
+++ b/libavcodec/ac3dsp.c
@@ -54,7 +54,7 @@ static void ac3_exponent_min_c(uint8_t *exp, int 
num_reuse_blocks, int nb_coefs)
 }
 }
 
-static void float_to_fixed24_c(int32_t *dst, const float *src, unsigned int 
len)
+static void float_to_fixed24_c(int32_t *dst, const float *src, size_t len)
 {
 const float scale = 1 << 24;
 do {
diff --git a/libavcodec/ac3dsp.h b/libavcodec/ac3dsp.h
index 25341f3396..ec2f598451 100644
--- a/libavcodec/ac3dsp.h
+++ b/libavcodec/ac3dsp.h
@@ -53,7 +53,7 @@ typedef struct AC3DSPContext {
  * @param len number of elements to convert.
  *constraints: multiple of 32 greater than zero
  */
-void (*float_to_fixed24)(int32_t *dst, const float *src, unsigned int len);
+void (*float_to_fixed24)(int32_t *dst, const float *src, size_t len);
 
 /**
  * Calculate bit allocation pointers.
diff --git a/libavcodec/arm/ac3dsp_init_arm.c b/libavcodec/arm/ac3dsp_init_arm.c
index a64aa6ae82..ae989069c9 100644
--- a/libavcodec/arm/ac3dsp_init_arm.c
+++ b/libavcodec/arm/ac3dsp_init_arm.c
@@ -26,7 +26,7 @@
 #include "config.h"
 
 void ff_ac3_exponent_min_neon(uint8_t *exp, int num_reuse_blocks, int 
nb_coefs);
-void ff_float_to_fixed24_neon(int32_t *dst, const float *src, unsigned int 
len);
+void ff_float_to_fixed24_neon(int32_t *dst, const float *src, size_t len);
 void ff_ac3_extract_exponents_neon(uint8_t *exp, int32_t *coef, int nb_coefs);
 void ff_ac3_sum_square_butterfly_int32_neon(int64_t sum[4],
 const int32_t *coef0,
diff --git a/libavcodec/mips/ac3dsp_mips.c b/libavcodec/mips/ac3dsp_mips.c
index a5eaaf8eb2..3ea3acc185 100644
--- a/libavcodec/mips/ac3dsp_mips.c
+++ b/libavcodec/mips/ac3dsp_mips.c
@@ -203,7 +203,7 @@ static void ac3_update_bap_counts_mips(uint16_t 
mant_cnt[16], uint8_t *bap,
 
 #if HAVE_MIPSFPU
 #if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
-static void float_to_fixed24_mips(int32_t *dst, const float *src, unsigned int 
len)
+static void float_to_fixed24_mips(int32_t *dst, const float *src, size_t len)
 {
 const float scale = 1 << 24;
 float src0, src1, src2, src3, src4, src5, src6, src7;
diff --git a/libavcodec/x86/ac3dsp_init.c b/libavcodec/x86/ac3dsp_init.c
index 106121b5b9..baa2bea3a4 100644
--- a/libavcodec/x86/ac3dsp_init.c
+++ b/libavcodec/x86/ac3dsp_init.c
@@ -26,8 +26,8 @@
 
 void ff_ac3_exponent_min_sse2  (uint8_t *exp, int num_reuse_blocks, int 
nb_coefs);
 
-void ff_float_to_fixed24_sse2 (int32_t *dst, const float *src, unsigned int 
len);
-void ff_float_to_fixed24_avx2 (int32_t *dst, const float *src, unsigned int 
len);
+void ff_float_to_fixed24_sse2 (int32_t *dst, const float *src, size_t len);
+void ff_float_to_fixed24_avx2 (int32_t *dst, const float *src, size_t len);
 
 int ff_ac3_compute_mantissa_size_sse2(uint16_t mant_cnt[6][16]);
 
-- 
2.42.1

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

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


Re: [FFmpeg-devel] [PATCH 3/3] avcodec/ac3dsp: make len a size_t in float_to_fixed24

2023-11-22 Thread Rémi Denis-Courmont
Le keskiviikkona 22. marraskuuta 2023, 21.49.13 EET James Almer a écrit :
> Should simplify asm implementations, and prevent UB on at least win64.
> 
> Signed-off-by: James Almer 

This one looks good to me, but I am utterly incompetent for the previous two.

-- 
雷米‧德尼-库尔蒙
http://www.remlab.net/



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

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


[FFmpeg-devel] [PATCH] avfilter/asrc_anullsrc: fix allowed range for sample_rate

2023-11-22 Thread James Almer
Signed-off-by: James Almer 
---
 libavfilter/asrc_anullsrc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavfilter/asrc_anullsrc.c b/libavfilter/asrc_anullsrc.c
index a8887da62d..a48728eaf0 100644
--- a/libavfilter/asrc_anullsrc.c
+++ b/libavfilter/asrc_anullsrc.c
@@ -51,8 +51,8 @@ typedef struct ANullContext {
 static const AVOption anullsrc_options[]= {
 { "channel_layout", "set channel_layout", OFFSET(ch_layout), 
AV_OPT_TYPE_CHLAYOUT, {.str = "stereo"}, 0, 0, FLAGS },
 { "cl", "set channel_layout", OFFSET(ch_layout), 
AV_OPT_TYPE_CHLAYOUT, {.str = "stereo"}, 0, 0, FLAGS },
-{ "sample_rate","set sample rate",OFFSET(sample_rate)   , 
AV_OPT_TYPE_INT, {.i64 = 44100}, 0, 0, FLAGS },
-{ "r",  "set sample rate",OFFSET(sample_rate)   , 
AV_OPT_TYPE_INT, {.i64 = 44100}, 0, 0, FLAGS },
+{ "sample_rate","set sample rate",OFFSET(sample_rate)   , 
AV_OPT_TYPE_INT, {.i64 = 44100}, 1, INT_MAX, FLAGS },
+{ "r",  "set sample rate",OFFSET(sample_rate)   , 
AV_OPT_TYPE_INT, {.i64 = 44100}, 1, INT_MAX, FLAGS },
 { "nb_samples", "set the number of samples per requested frame", 
OFFSET(nb_samples), AV_OPT_TYPE_INT, {.i64 = 1024}, 1, UINT16_MAX, FLAGS },
 { "n",  "set the number of samples per requested frame", 
OFFSET(nb_samples), AV_OPT_TYPE_INT, {.i64 = 1024}, 1, UINT16_MAX, FLAGS },
 { "duration",   "set the audio duration",
OFFSET(duration),   AV_OPT_TYPE_DURATION, {.i64 = -1}, -1, INT64_MAX, FLAGS },
-- 
2.42.1

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

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


[FFmpeg-devel] [PATCH] Fix integer overflow in mov_read_packet().

2023-11-22 Thread Dale Curtis
Fixes https://crbug.com/1499669:
runtime error: signed integer overflow: 9223372036853334272 + 1375731456
cannot be represented in type 'int64_t' (aka 'long')

Signed-off-by: Dale Curtis 
---
 libavformat/mov.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 93f202d204..425ddc6849 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -9023,7 +9023,7 @@ static int mov_read_packet(AVFormatContext *s,
AVPacket *pkt)
 pkt->flags |= AV_PKT_FLAG_DISCARD;
 }
 if (sc->ctts_data && sc->ctts_index < sc->ctts_count) {
-pkt->pts = pkt->dts + sc->dts_shift +
sc->ctts_data[sc->ctts_index].duration;
+pkt->pts = av_sat_add64(pkt->dts, av_sat_add64(sc->dts_shift,
sc->ctts_data[sc->ctts_index].duration));
 /* update ctts context */
 sc->ctts_sample++;
 if (sc->ctts_index < sc->ctts_count &&
--


0001-Fix-integer-overflow-in-mov_read_packet.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] avfilter/asrc_anullsrc: fix allowed range for sample_rate

2023-11-22 Thread Paul B Mahol
LGTM
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] ac3dsp: RISC-V V float_to_fixed24

2023-11-22 Thread flow gg
Hello, I saw the new commit "avcodec/ac3dsp: make len a size_t in
float_to_fixed24."

So I removed the part #if (__riscv_xlen == 64) and restored the patch.
From 3e790fdccd780257f464aa8f8a56a37321ddd429 Mon Sep 17 00:00:00 2001
From: sunyuechi 
Date: Wed, 22 Nov 2023 14:57:29 +0800
Subject: [PATCH] lavc/ac3dsp: R-V V float_to_fixed24

c910
float_to_fixed24_c: 208.2
float_to_fixed24_rvv_f32: 71.5
---
 libavcodec/riscv/Makefile  |  3 ++-
 libavcodec/riscv/ac3dsp_init.c |  5 +
 libavcodec/riscv/ac3dsp_rvv.S  | 39 ++
 3 files changed, 46 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/riscv/ac3dsp_rvv.S

diff --git a/libavcodec/riscv/Makefile b/libavcodec/riscv/Makefile
index 8f2a519827..ac7b7c2929 100644
--- a/libavcodec/riscv/Makefile
+++ b/libavcodec/riscv/Makefile
@@ -1,7 +1,8 @@
 OBJS-$(CONFIG_AAC_DECODER) += riscv/aacpsdsp_init.o riscv/sbrdsp_init.o
 RVV-OBJS-$(CONFIG_AAC_DECODER) += riscv/aacpsdsp_rvv.o riscv/sbrdsp_rvv.o
 OBJS-$(CONFIG_AC3DSP) += riscv/ac3dsp_init.o \
- riscv/ac3dsp_rvb.o
+ riscv/ac3dsp_rvb.o \
+ riscv/ac3dsp_rvv.o
 OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_init.o
 RVV-OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_rvv.o
 OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_init.o \
diff --git a/libavcodec/riscv/ac3dsp_init.c b/libavcodec/riscv/ac3dsp_init.c
index 20f294f1de..de82d1c7a7 100644
--- a/libavcodec/riscv/ac3dsp_init.c
+++ b/libavcodec/riscv/ac3dsp_init.c
@@ -26,6 +26,7 @@
 #include "libavcodec/ac3dsp.h"
 
 void ff_extract_exponents_rvb(uint8_t *exp, int32_t *coef, int nb_coefs);
+void ff_float_to_fixed24_rvv(int32_t *dst, const float *src, unsigned int len);
 
 av_cold void ff_ac3dsp_init_riscv(AC3DSPContext *c)
 {
@@ -35,4 +36,8 @@ av_cold void ff_ac3dsp_init_riscv(AC3DSPContext *c)
 if (flags & AV_CPU_FLAG_RVB_BASIC)
 c->extract_exponents = ff_extract_exponents_rvb;
 }
+
+if (flags & AV_CPU_FLAG_RVV_F32) {
+c->float_to_fixed24 = ff_float_to_fixed24_rvv;
+}
 }
diff --git a/libavcodec/riscv/ac3dsp_rvv.S b/libavcodec/riscv/ac3dsp_rvv.S
new file mode 100644
index 00..c0e2880e28
--- /dev/null
+++ b/libavcodec/riscv/ac3dsp_rvv.S
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2023 Institue of Software Chinese Academy of Sciences (ISCAS).
+ *
+ * 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 "libavutil/riscv/asm.S"
+
+func ff_float_to_fixed24_rvv, zve32f
+lit1, 1 << 24
+fcvt.s.w  f0, t1
+1:
+vsetvli   t0, a2, e32, m4, ta, ma
+sub   a2, a2, t0
+vle32.v   v0, (a1)
+vfmul.vf  v0, v0, f0
+vfcvt.x.f.v   v0, v0
+sh2adda1, t0, a1
+vse32.v   v0, (a0)
+sh2adda0, t0, a0
+bgtz  a2, 1b
+
+ret
+endfunc
-- 
2.43.0

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

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


Re: [FFmpeg-devel] [PATCH 2/3] x86/ac3dsp: add ff_float_to_fixed24_avx2()

2023-11-22 Thread Kieran Kunhya
On Wed, 22 Nov 2023, 19:49 James Almer,  wrote:

> Signed-off-by: James Almer 
> ---
>  libavcodec/ac3dsp.h  |  4 ++--
>  libavcodec/ac3enc_template.c |  2 +-
>  libavcodec/x86/ac3dsp.asm| 28 ++--
>  libavcodec/x86/ac3dsp_init.c |  4 
>  4 files changed, 33 insertions(+), 5 deletions(-)
>

I think this is AVX, I might be wrong but I don't see any AVX2.

Kieran

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

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


[FFmpeg-devel] [PATCH] checkasm/ac3dsp: add float_to_fixed24 test

2023-11-22 Thread flow gg

From 02dd534bd602ba3ec79e51070934949a98f780e2 Mon Sep 17 00:00:00 2001
From: sunyuechi 
Date: Wed, 22 Nov 2023 14:57:29 +0800
Subject: [PATCH] checkasm/ac3dsp: add float_to_fixed24 test

---
 tests/checkasm/Makefile   |  1 +
 tests/checkasm/ac3dsp.c   | 71 +++
 tests/checkasm/checkasm.c |  3 ++
 tests/checkasm/checkasm.h |  1 +
 4 files changed, 76 insertions(+)
 create mode 100644 tests/checkasm/ac3dsp.c

diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile
index 8bc241d29b..53742c93ae 100644
--- a/tests/checkasm/Makefile
+++ b/tests/checkasm/Makefile
@@ -1,5 +1,6 @@
 # libavcodec tests
 # subsystems
+AVCODECOBJS-$(CONFIG_AC3DSP)+= ac3dsp.o
 AVCODECOBJS-$(CONFIG_AUDIODSP)  += audiodsp.o
 AVCODECOBJS-$(CONFIG_BLOCKDSP)  += blockdsp.o
 AVCODECOBJS-$(CONFIG_BSWAPDSP)  += bswapdsp.o
diff --git a/tests/checkasm/ac3dsp.c b/tests/checkasm/ac3dsp.c
new file mode 100644
index 00..2ccfa4a9d1
--- /dev/null
+++ b/tests/checkasm/ac3dsp.c
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2023 Institue of Software Chinese Academy of Sciences (ISCAS).
+ *
+ * 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 "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
+
+#include "libavcodec/ac3dsp.h"
+
+#include "checkasm.h"
+
+#define randomize_float(buf, len)   \
+do {\
+int i;  \
+for (i = 0; i < len; i++) { \
+float f = (float)rnd() / (UINT_MAX >> 5) - 16.0f;   \
+buf[i] = f; \
+}   \
+} while (0)
+
+static void check_float_to_fixed24(AC3DSPContext *c) {
+#define BUF_SIZE 1024
+LOCAL_ALIGNED_32(int32_t, v1, [BUF_SIZE]);
+LOCAL_ALIGNED_32(float, v2, [BUF_SIZE]);
+
+declare_func(void, int32_t *, const float *, unsigned int);
+
+randomize_float(v2, BUF_SIZE);
+
+if (check_func(c->float_to_fixed24, "float_to_fixed24")) {
+LOCAL_ALIGNED_32(int32_t, dst, [BUF_SIZE]);
+LOCAL_ALIGNED_32(int32_t, dst2, [BUF_SIZE]);
+
+call_ref(dst, v2, BUF_SIZE);
+call_new(dst2, v2, BUF_SIZE);
+
+if (memcmp(dst, dst2, sizeof(*dst) * 10) != 0)
+fail();
+
+bench_new(v1, v2, BUF_SIZE);
+}
+
+
+report("float_to_fixed24");
+}
+
+void checkasm_check_ac3dsp(void)
+{
+AC3DSPContext c;
+ff_ac3dsp_init(&c);
+
+check_float_to_fixed24(&c);
+}
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index 708119e7c6..f37c7fad3a 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -78,6 +78,9 @@ static const struct {
 { "aacpsdsp", checkasm_check_aacpsdsp },
 { "sbrdsp",   checkasm_check_sbrdsp },
 #endif
+#if CONFIG_AC3DSP
+{ "ac3dsp", checkasm_check_ac3dsp },
+#endif
 #if CONFIG_ALAC_DECODER
 { "alacdsp", checkasm_check_alacdsp },
 #endif
diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
index cfea868ff1..a4238b1dfa 100644
--- a/tests/checkasm/checkasm.h
+++ b/tests/checkasm/checkasm.h
@@ -43,6 +43,7 @@
 #include "libavutil/timer.h"
 
 void checkasm_check_aacpsdsp(void);
+void checkasm_check_ac3dsp(void);
 void checkasm_check_afir(void);
 void checkasm_check_alacdsp(void);
 void checkasm_check_audiodsp(void);
-- 
2.43.0

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

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


Re: [FFmpeg-devel] [PATCH] ac3dsp: RISC-V V float_to_fixed24

2023-11-22 Thread flow gg
I modified the temporary test and sent it in "[FFmpeg-devel] [PATCH]
checkasm/ac3dsp: add float_to_fixed24 test".

So the test time results have changed, and I updated them in the patch.

c910
  float_to_fixed24_c: 2207.2
  float_to_fixed24_rvv_f32: 696.2

flow gg  于2023年11月22日周三 20:00写道:

> c910
> float_to_fixed24_c: 208.2
> float_to_fixed24_rvv_f32: 71.5
>
From 3e790fdccd780257f464aa8f8a56a37321ddd429 Mon Sep 17 00:00:00 2001
From: sunyuechi 
Date: Wed, 22 Nov 2023 14:57:29 +0800
Subject: [PATCH] lavc/ac3dsp: R-V V float_to_fixed24

c910
  float_to_fixed24_c: 2207.2
  float_to_fixed24_rvv_f32: 696.2
---
 libavcodec/riscv/Makefile  |  3 ++-
 libavcodec/riscv/ac3dsp_init.c |  5 +
 libavcodec/riscv/ac3dsp_rvv.S  | 39 ++
 3 files changed, 46 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/riscv/ac3dsp_rvv.S

diff --git a/libavcodec/riscv/Makefile b/libavcodec/riscv/Makefile
index 8f2a519827..ac7b7c2929 100644
--- a/libavcodec/riscv/Makefile
+++ b/libavcodec/riscv/Makefile
@@ -1,7 +1,8 @@
 OBJS-$(CONFIG_AAC_DECODER) += riscv/aacpsdsp_init.o riscv/sbrdsp_init.o
 RVV-OBJS-$(CONFIG_AAC_DECODER) += riscv/aacpsdsp_rvv.o riscv/sbrdsp_rvv.o
 OBJS-$(CONFIG_AC3DSP) += riscv/ac3dsp_init.o \
- riscv/ac3dsp_rvb.o
+ riscv/ac3dsp_rvb.o \
+ riscv/ac3dsp_rvv.o
 OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_init.o
 RVV-OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_rvv.o
 OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_init.o \
diff --git a/libavcodec/riscv/ac3dsp_init.c b/libavcodec/riscv/ac3dsp_init.c
index 20f294f1de..de82d1c7a7 100644
--- a/libavcodec/riscv/ac3dsp_init.c
+++ b/libavcodec/riscv/ac3dsp_init.c
@@ -26,6 +26,7 @@
 #include "libavcodec/ac3dsp.h"
 
 void ff_extract_exponents_rvb(uint8_t *exp, int32_t *coef, int nb_coefs);
+void ff_float_to_fixed24_rvv(int32_t *dst, const float *src, unsigned int len);
 
 av_cold void ff_ac3dsp_init_riscv(AC3DSPContext *c)
 {
@@ -35,4 +36,8 @@ av_cold void ff_ac3dsp_init_riscv(AC3DSPContext *c)
 if (flags & AV_CPU_FLAG_RVB_BASIC)
 c->extract_exponents = ff_extract_exponents_rvb;
 }
+
+if (flags & AV_CPU_FLAG_RVV_F32) {
+c->float_to_fixed24 = ff_float_to_fixed24_rvv;
+}
 }
diff --git a/libavcodec/riscv/ac3dsp_rvv.S b/libavcodec/riscv/ac3dsp_rvv.S
new file mode 100644
index 00..c0e2880e28
--- /dev/null
+++ b/libavcodec/riscv/ac3dsp_rvv.S
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2023 Institue of Software Chinese Academy of Sciences (ISCAS).
+ *
+ * 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 "libavutil/riscv/asm.S"
+
+func ff_float_to_fixed24_rvv, zve32f
+lit1, 1 << 24
+fcvt.s.w  f0, t1
+1:
+vsetvli   t0, a2, e32, m4, ta, ma
+sub   a2, a2, t0
+vle32.v   v0, (a1)
+vfmul.vf  v0, v0, f0
+vfcvt.x.f.v   v0, v0
+sh2adda1, t0, a1
+vse32.v   v0, (a0)
+sh2adda0, t0, a0
+bgtz  a2, 1b
+
+ret
+endfunc
-- 
2.43.0

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

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