Re: [FFmpeg-devel] [PATCH] af_afir: RISC-V V fcmul_add
Okay, I have updated these issues in the patch. Rémi Denis-Courmont 于2023年11月13日周一 23:35写道: >Hi, > > Le maanantaina 13. marraskuuta 2023, 11.43.01 EET flow gg a écrit : > > Sorry for the long delay in responding. > > No problem. Working with T-Head C910 (or C920?) cores is very tedious. I > gave > up on that and switched over to Kendryte K230 (based on C908) now. > > > How is the modified patch now? > > It looks better, but some minute improvements are still possible. > > > no longer using register stride(learn from your code) and have switched > to > > shNadd instead. > > > > (using m4 and m2 as they are slightly faster than m8 and m4) > > > > benchmark: > > fcmul_add_c: 2179 > > fcmul_add_rvv_f32: 1652 > > > diff --git a/libavfilter/af_afirdsp.h b/libavfilter/af_afirdsp.h > > index 4208501393..d2d1e909c1 100644 > > --- a/libavfilter/af_afirdsp.h > > +++ b/libavfilter/af_afirdsp.h > > @@ -34,6 +34,7 @@ typedef struct AudioFIRDSPContext { > > } AudioFIRDSPContext; > > > > void ff_afir_init_x86(AudioFIRDSPContext *s); > > +void ff_afir_init_riscv(AudioFIRDSPContext *s); > > Nit: please stick to alphabetical order like most similar code. > > > > > static void fcmul_add_c(float *sum, const float *t, const float *c, > > ptrdiff_t len) > > { > > @@ -76,6 +77,8 @@ static av_unused void ff_afir_init(AudioFIRDSPContext > > *dsp) > > > > #if ARCH_X86 > > ff_afir_init_x86(dsp); > > +#elif ARCH_RISCV > > +ff_afir_init_riscv(dsp); > > Ditto. > > > #endif > > } > > > > diff --git a/libavfilter/riscv/Makefile b/libavfilter/riscv/Makefile > > new file mode 100644 > > index 00..0b968a9c0d > > --- /dev/null > > +++ b/libavfilter/riscv/Makefile > > @@ -0,0 +1,2 @@ > > +OBJS += riscv/af_afir_init.o > > +RVV-OBJS += riscv/af_afir_rvv.o > > diff --git a/libavfilter/riscv/af_afir_init.c > > b/libavfilter/riscv/af_afir_init.c new file mode 100644 > > index 00..13df8341e7 > > --- /dev/null > > +++ b/libavfilter/riscv/af_afir_init.c > > @@ -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 > > + > > +#include "config.h" > > +#include "libavutil/attributes.h" > > +#include "libavutil/cpu.h" > > +#include "libavfilter/af_afirdsp.h" > > + > > +void ff_fcmul_add_rvv(float *sum, const float *t, const float *c, > > + ptrdiff_t len); > > + > > +av_cold void ff_afir_init_riscv(AudioFIRDSPContext *s) > > +{ > > +#if HAVE_RVV > > +int flags = av_get_cpu_flags(); > > + > > +if (flags & AV_CPU_FLAG_RVV_F32) > > You need to check for Zba as well here. I doubt that we'll see hardware > with V > and without Zba in real life, but for the sake of correctness... > > > +s->fcmul_add = ff_fcmul_add_rvv; > > +#endif > > +} > > diff --git a/libavfilter/riscv/af_afir_rvv.S > > b/libavfilter/riscv/af_afir_rvv.S new file mode 100644 > > index 00..078cac8e7e > > --- /dev/null > > +++ b/libavfilter/riscv/af_afir_rvv.S > > @@ -0,0 +1,61 @@ > > +/* > > + * 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 "libavutil/riscv/asm.S" > > + > > +// void ff_fcmul_add(float *sum, const float *t, const float *c, int > len) > > +func ff_fcmul_add_rvv, zve32f > > +li
Re: [FFmpeg-devel] [PATCH] af_afir: RISC-V V fcmul_add
Okay, I have updated these issues in the patch. Rémi Denis-Courmont 于2023年11月13日周一 23:35写道: >Hi, > > Le maanantaina 13. marraskuuta 2023, 11.43.01 EET flow gg a écrit : > > Sorry for the long delay in responding. > > No problem. Working with T-Head C910 (or C920?) cores is very tedious. I > gave > up on that and switched over to Kendryte K230 (based on C908) now. > > > How is the modified patch now? > > It looks better, but some minute improvements are still possible. > > > no longer using register stride(learn from your code) and have switched > to > > shNadd instead. > > > > (using m4 and m2 as they are slightly faster than m8 and m4) > > > > benchmark: > > fcmul_add_c: 2179 > > fcmul_add_rvv_f32: 1652 > > > diff --git a/libavfilter/af_afirdsp.h b/libavfilter/af_afirdsp.h > > index 4208501393..d2d1e909c1 100644 > > --- a/libavfilter/af_afirdsp.h > > +++ b/libavfilter/af_afirdsp.h > > @@ -34,6 +34,7 @@ typedef struct AudioFIRDSPContext { > > } AudioFIRDSPContext; > > > > void ff_afir_init_x86(AudioFIRDSPContext *s); > > +void ff_afir_init_riscv(AudioFIRDSPContext *s); > > Nit: please stick to alphabetical order like most similar code. > > > > > static void fcmul_add_c(float *sum, const float *t, const float *c, > > ptrdiff_t len) > > { > > @@ -76,6 +77,8 @@ static av_unused void ff_afir_init(AudioFIRDSPContext > > *dsp) > > > > #if ARCH_X86 > > ff_afir_init_x86(dsp); > > +#elif ARCH_RISCV > > +ff_afir_init_riscv(dsp); > > Ditto. > > > #endif > > } > > > > diff --git a/libavfilter/riscv/Makefile b/libavfilter/riscv/Makefile > > new file mode 100644 > > index 00..0b968a9c0d > > --- /dev/null > > +++ b/libavfilter/riscv/Makefile > > @@ -0,0 +1,2 @@ > > +OBJS += riscv/af_afir_init.o > > +RVV-OBJS += riscv/af_afir_rvv.o > > diff --git a/libavfilter/riscv/af_afir_init.c > > b/libavfilter/riscv/af_afir_init.c new file mode 100644 > > index 00..13df8341e7 > > --- /dev/null > > +++ b/libavfilter/riscv/af_afir_init.c > > @@ -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 > > + > > +#include "config.h" > > +#include "libavutil/attributes.h" > > +#include "libavutil/cpu.h" > > +#include "libavfilter/af_afirdsp.h" > > + > > +void ff_fcmul_add_rvv(float *sum, const float *t, const float *c, > > + ptrdiff_t len); > > + > > +av_cold void ff_afir_init_riscv(AudioFIRDSPContext *s) > > +{ > > +#if HAVE_RVV > > +int flags = av_get_cpu_flags(); > > + > > +if (flags & AV_CPU_FLAG_RVV_F32) > > You need to check for Zba as well here. I doubt that we'll see hardware > with V > and without Zba in real life, but for the sake of correctness... > > > +s->fcmul_add = ff_fcmul_add_rvv; > > +#endif > > +} > > diff --git a/libavfilter/riscv/af_afir_rvv.S > > b/libavfilter/riscv/af_afir_rvv.S new file mode 100644 > > index 00..078cac8e7e > > --- /dev/null > > +++ b/libavfilter/riscv/af_afir_rvv.S > > @@ -0,0 +1,61 @@ > > +/* > > + * 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 "libavutil/riscv/asm.S" > > + > > +// void ff_fcmul_add(float *sum, const float *t, const float *c, int > len) > > +func ff_fcmul_add_rvv, zve32f > > +li
[FFmpeg-devel] [PATCH 2/2] tools/general_assembly: update to conform to new rules
--- tools/general_assembly.pl | 64 ++- 1 file changed, 57 insertions(+), 7 deletions(-) diff --git a/tools/general_assembly.pl b/tools/general_assembly.pl index e59ce0f350..4c3208ccac 100755 --- a/tools/general_assembly.pl +++ b/tools/general_assembly.pl @@ -7,8 +7,11 @@ use POSIX qw(strftime); use Encode qw(decode); use Data::Dumper; use Getopt::Long; +use Digest::SHA; +use utf8; -binmode(STDOUT, ":utf8"); +use DateTime; +use DateTime::Format::ISO8601; sub trim { my $s = shift; $s =~ s/^\s+|\s+$//g; return $s }; @@ -18,6 +21,7 @@ sub print_help { print " --names Print only the names\n"; print " --emails Print only the email addresses\n"; print " --full Print both names and email addresses (default)\n"; +print " --date YY-MM-DD Generate the GA for a given date, defaults to current system time\n"; print " -h, --help Show this help message\n"; exit; } @@ -25,6 +29,7 @@ sub print_help { my $print_full = 1; my $print_names = 0; my $print_emails = 0; +my $date = DateTime->now()->iso8601; my $help = 0; GetOptions( @@ -32,6 +37,7 @@ GetOptions( "names" => \$print_names, "emails" => \$print_emails, "help" => \$help, +"date=s" => \$date, "h" => \$help, ); @@ -41,7 +47,40 @@ if ($print_names || $print_emails) { $print_full = 0; } -my @shortlog = split /\n/, decode('UTF-8', `git log --pretty=format:"%aN <%aE>" --since="last 36 months" | sort | uniq -c | sort -r`, Encode::FB_CROAK); +sub get_date_range { +my ($now) = @_; + +# date on which the GA update rule was established, and the voter list +# was extraordinarily updated; cf.: +# * http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2023-October/316054.html +# Message-Id <169818211998.11195.16532637803201641...@lain.khirnov.net> +# * http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2023-November/316618.html +# Message-Id <5efcab06-8510-4226-bf18-68820c7c6...@betaapp.fastmail.com> +my $date_ga_rule = DateTime->new(year => 2023, month => 11, day => 06); +# date when the regular update rule is first applied +my $date_first_regular = DateTime->new(year => 2024); + +if ($now->is_between($date_ga_rule, $date_first_regular)) { +return ($date_ga_rule->clone()->set_year($date_ga_rule->year - 3), $date_ga_rule); +} + +if ($now < $date_ga_rule) { +print STDERR "GA before $date_ga_rule is not well-defined, be very careful with the output\n"; +} + +my $cur_year_jan = $now->clone()->truncate(to => "year"); +my $cur_year_jul = $cur_year_jan->clone()->set_month(7); +my $date_until= $now > $cur_year_jul ? $cur_year_jul : $cur_year_jan; +my $date_since= $date_until->clone()->set_year($date_until->year - 3); + +return ($date_since, $date_until); +} + +my ($since, $until) = get_date_range(DateTime::Format::ISO8601->parse_datetime($date)); + +my @shortlog = split /\n/, decode('UTF-8', +`git log --pretty=format:"%aN <%aE>" --since="$since" --until="$until" | sort | uniq -c | sort -r`, +Encode::FB_CROAK); my %assembly = (); foreach my $line (@shortlog) { @@ -53,7 +92,10 @@ foreach my $line (@shortlog) { $name = trim $name; if ($count < 50) { my $true = 0; -my @commits = split /(^|\n)commit [a-z0-9]{40}(\n|$)/, decode('UTF-8', `git log --name-only --use-mailmap --author="$email" --since="last 36 months"`, Encode::FB_CROAK); +my @commits = split /(^|\n)commit [a-z0-9]{40}(\n|$)/, +decode('UTF-8', + `git log --name-only --use-mailmap --author="$email" --since="$since" --until="$until"`, + Encode::FB_CROAK); foreach my $commit (@commits) { $true++; # if ($commit =~ /\n[\w\/]+\.(c|h|S|asm|texi)/); } @@ -66,14 +108,22 @@ foreach my $line (@shortlog) { $assembly{$name} = $email; } -printf("# %s %s", strftime("%Y-%m-%d", localtime), decode('UTF-8', `git rev-parse HEAD`, Encode::FB_CROAK)); +# generate the output string +my @out_lines; foreach my $name (sort keys %assembly) { my $email = $assembly{$name}; +my $val; if ($print_full) { -printf("%s <%s>\n", $name, $email); +$val = sprintf("%s <%s>", $name, $email); } elsif ($print_names) { -printf("%s\n", $name); +$val = $name; } elsif ($print_emails) { -printf("%s\n", $email); +$val = $email; } +push(@out_lines, ($val)); } +my $out_str = join("\n", @out_lines) . "\n"; +utf8::encode($out_str); + +printf("# GA for $since/$until; %d people; SHA256:%s\n%s", + scalar @out_lines, Digest::SHA::sha256_hex($out_str), $out_str); -- 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...@ffmpe
[FFmpeg-devel] [PATCH 1/2] tools/general_assembly: make the script executable
--- tools/general_assembly.pl | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 tools/general_assembly.pl diff --git a/tools/general_assembly.pl b/tools/general_assembly.pl old mode 100644 new mode 100755 -- 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] [PATCH] configure: fix linker error due to missing dependency
Add av1_parser to av1_decoder to fix undefined reference to 'ff_av1_framerate'. To reproduce: ./configure --disable-everything --disable-autodetect --enable-encoder=av1 Signed-off-by: Michael Riedl --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 055d558c5a8..a2d19dbd578 100755 --- a/configure +++ b/configure @@ -2816,7 +2816,7 @@ asv1_encoder_select="aandcttables bswapdsp fdctdsp pixblockdsp" asv2_decoder_select="blockdsp bswapdsp idctdsp" asv2_encoder_select="aandcttables bswapdsp fdctdsp pixblockdsp" atrac1_decoder_select="sinewin" -av1_decoder_select="cbs_av1 atsc_a53" +av1_decoder_select="cbs_av1 atsc_a53 av1_parser" bink_decoder_select="blockdsp hpeldsp" binkaudio_dct_decoder_select="wma_freqs" binkaudio_rdft_decoder_select="wma_freqs" -- 2.39.2 ___ 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] avformat/rtmpproto: Pass rw_timeout to underlying transport protocol
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); 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] [PATCH 1/2] avformat/flvenc: support enhanced flv PacketTypeMetadata
From: Zhu Pengfei <411294...@qq.com> Signed-off-by: Zhu Pengfei <411294...@qq.com> --- libavformat/flvenc.c | 158 +++ 1 file changed, 158 insertions(+) diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index f6d10f331c..615a072928 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -24,6 +24,7 @@ #include "libavutil/intfloat.h" #include "libavutil/avassert.h" #include "libavutil/mathematics.h" +#include "libavutil/mastering_display_metadata.h" #include "libavcodec/codec_desc.h" #include "libavcodec/mpeg4audio.h" #include "avio.h" @@ -124,6 +125,7 @@ typedef struct FLVContext { int flags; int64_t last_ts[FLV_STREAM_TYPE_NB]; +int write_metadata_pkt; } FLVContext; static int get_audio_flags(AVFormatContext *s, AVCodecParameters *par) @@ -478,6 +480,161 @@ static void write_metadata(AVFormatContext *s, unsigned int ts) avio_wb32(pb, flv->metadata_totalsize + 11); } +static void flv_write_metadata_packet_if_needed(AVFormatContext *s, AVCodecParameters *par, unsigned int ts) +{ +AVIOContext *pb = s->pb; +FLVContext *flv = s->priv_data; +AVContentLightMetadata *lightMetadata = NULL; +AVMasteringDisplayMetadata *displayMetadata = NULL; +const int flags_size = 5; +int64_t metadata_size_pos = 0; +int64_t total_size = 0; +const AVPacketSideData *side_data = NULL; + +if (flv->write_metadata_pkt) { +return; +} + +side_data = av_packet_side_data_get(par->coded_side_data, par->nb_coded_side_data, +AV_PKT_DATA_CONTENT_LIGHT_LEVEL); +if (side_data) +lightMetadata = (AVContentLightMetadata *)side_data->data; + +side_data = av_packet_side_data_get(par->coded_side_data, par->nb_coded_side_data, + AV_PKT_DATA_MASTERING_DISPLAY_METADATA); +if (side_data) +displayMetadata = (AVMasteringDisplayMetadata *)side_data->data; + +if (!lightMetadata && !displayMetadata) { +return; +} + +/* +* Reference Enhancing FLV +* https://github.com/veovera/enhanced-rtmp/blob/main/enhanced-rtmp.pdf +* */ +avio_w8(pb, FLV_TAG_TYPE_VIDEO); //写入Video /Audio tag type +metadata_size_pos = avio_tell(pb); +avio_wb24(pb, 0 + flags_size); +put_timestamp(pb, ts); //ts = pkt->dts, gen +avio_wb24(pb, flv->reserved); + +if (par->codec_id == AV_CODEC_ID_HEVC) { +avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeMetadata| FLV_FRAME_VIDEO_INFO_CMD); // ExVideoTagHeader mode with PacketTypeMetadata +avio_write(pb, "hvc1", 4); +} else if (par->codec_id == AV_CODEC_ID_AV1 || par->codec_id == AV_CODEC_ID_VP9) { +avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeMetadata| FLV_FRAME_VIDEO_INFO_CMD); +avio_write(pb, par->codec_id == AV_CODEC_ID_AV1 ? "av01" : "vp09", 4); +} else { +return; +} + +avio_w8(pb, AMF_DATA_TYPE_STRING); +put_amf_string(pb, "colorInfo"); + +avio_w8(pb, AMF_DATA_TYPE_OBJECT); + +put_amf_string(pb, "colorConfig"); // colorConfig + +/* mixed array (hash) with size and string/type/data tuples */ +avio_w8(pb, AMF_DATA_TYPE_MIXEDARRAY); + +avio_wb32(pb, 0); // write array count + +if (par->color_trc != AVCOL_TRC_UNSPECIFIED && +par->color_trc < AVCOL_TRC_NB) { +put_amf_string(pb, "transferCharacteristics"); // color_trc +put_amf_double(pb, par->color_trc); +} + +if (par->color_space != AVCOL_SPC_UNSPECIFIED && +par->color_space < AVCOL_SPC_NB) { +put_amf_string(pb, "matrixCoefficients"); // colorspace +put_amf_double(pb, par->color_space); +} + +if (par->color_primaries != AVCOL_PRI_UNSPECIFIED && +par->color_primaries < AVCOL_PRI_NB) { +put_amf_string(pb, "colorPrimaries"); // color_primaries +put_amf_double(pb, par->color_primaries); +} + +put_amf_string(pb, ""); +avio_w8(pb, AMF_END_OF_OBJECT); // array end of object + +if (lightMetadata) { +put_amf_string(pb, "hdrCll"); + +/* mixed array (hash) with size and string/type/data tuples */ +avio_w8(pb, AMF_DATA_TYPE_MIXEDARRAY); + +avio_wb32(pb, 0); // write array count + +put_amf_string(pb, "maxFall"); +put_amf_double(pb, lightMetadata->MaxFALL); + +put_amf_string(pb, "maxCLL"); +put_amf_double(pb, lightMetadata->MaxCLL); + +// array end of object +put_amf_string(pb, ""); +avio_w8(pb, AMF_END_OF_OBJECT); +} + +if (displayMetadata && (displayMetadata->has_primaries || displayMetadata->has_luminance)) { +put_amf_string(pb, "hdrMdcv"); + +/* mixed array (hash) with size and string/type/data tuples */ +avio_w8(pb, AMF_DATA_TYPE_MIXEDARRAY); +avio_wb32(pb, 0); // write array count + +if (displayMetadata->has_primaries) { +put_amf_string(pb, "redX"); +put_amf_double
[FFmpeg-devel] [PATCH 2/2] avformat/flvdec: support enhanced flv PacketTypeMetadata
From: Zhu Pengfei <411294...@qq.com> Signed-off-by: Zhu Pengfei <411294...@qq.com> --- libavformat/flvdec.c | 171 ++- 1 file changed, 170 insertions(+), 1 deletion(-) diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index e25b5bd163..46bb0825ca 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -34,6 +34,7 @@ #include "libavutil/intfloat.h" #include "libavutil/intreadwrite.h" #include "libavutil/mathematics.h" +#include "libavutil/mastering_display_metadata.h" #include "avformat.h" #include "demux.h" #include "internal.h" @@ -45,6 +46,28 @@ #define MAX_DEPTH 16 ///< arbitrary limit to prevent unbounded recursion +typedef struct FLVMasteringMeta { +double r_x; +double r_y; +double g_x; +double g_y; +double b_x; +double b_y; +double white_x; +double white_y; +double max_luminance; +double min_luminance; +} FLVMasteringMeta; + +typedef struct FLVMetaVideoColor { +uint64_t matrix_coefficients; +uint64_t transfer_characteristics; +uint64_t primaries; +uint64_t max_cll; +uint64_t max_fall; +FLVMasteringMeta mastering_meta; +} FLVMetaVideoColor; + typedef struct FLVContext { const AVClass *class; ///< Class for private options. int trust_metadata; ///< configure streams according onMetaData @@ -80,6 +103,8 @@ typedef struct FLVContext { int64_t time_offset; int64_t time_pos; +FLVMetaVideoColor *metaVideoColor; +int meta_color_info_flag; } FLVContext; /* AMF date type */ @@ -524,6 +549,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, FLVContext *flv = s->priv_data; AVIOContext *ioc; AMFDataType amf_type; +FLVMetaVideoColor *meta_video_color = flv->metaVideoColor; char str_val[1024]; double num_val; amf_date date; @@ -655,6 +681,36 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, } else if (!strcmp(key, "height") && vpar) { vpar->height = num_val; } +} else if (!strcmp(key, "colorPrimaries") && meta_video_color) { +meta_video_color->primaries = num_val; +} else if (!strcmp(key, "transferCharacteristics") && meta_video_color) { +meta_video_color->transfer_characteristics = num_val; +} else if (!strcmp(key, "matrixCoefficients") && meta_video_color) { +meta_video_color->matrix_coefficients = num_val; +} else if (!strcmp(key, "maxFall") && meta_video_color) { +meta_video_color->max_fall = num_val; +} else if (!strcmp(key, "maxCLL") && meta_video_color) { +meta_video_color->max_cll = num_val; +} else if (!strcmp(key, "redX") && meta_video_color) { +meta_video_color->mastering_meta.r_x = num_val; +} else if (!strcmp(key, "redY") && meta_video_color) { +meta_video_color->mastering_meta.r_y = num_val; +} else if (!strcmp(key, "greenX") && meta_video_color) { +meta_video_color->mastering_meta.g_x = num_val; +} else if (!strcmp(key, "greenY") && meta_video_color) { +meta_video_color->mastering_meta.g_y = num_val; +} else if (!strcmp(key, "blueX") && meta_video_color) { +meta_video_color->mastering_meta.b_x = num_val; +} else if (!strcmp(key, "blueY") && meta_video_color) { +meta_video_color->mastering_meta.b_y = num_val; +} else if (!strcmp(key, "whitePointX") && meta_video_color) { +meta_video_color->mastering_meta.white_x = num_val; +} else if (!strcmp(key, "whitePointY") && meta_video_color) { +meta_video_color->mastering_meta.white_y = num_val; +} else if (!strcmp(key, "maxLuminance") && meta_video_color) { +meta_video_color->mastering_meta.max_luminance = num_val; +} else if (!strcmp(key, "minLuminance") && meta_video_color) { +meta_video_color->mastering_meta.min_luminance = num_val; } } if (amf_type == AMF_DATA_TYPE_STRING) { @@ -824,6 +880,7 @@ static int flv_read_close(AVFormatContext *s) av_freep(&flv->new_extradata[i]); av_freep(&flv->keyframe_times); av_freep(&flv->keyframe_filepositions); +av_freep(&flv->metaVideoColor); return 0; } @@ -1028,6 +1085,104 @@ static int resync(AVFormatContext *s) return AVERROR_EOF; } +static int flv_parse_video_color_info(AVFormatContext *s, AVStream *st, int64_t next_pos) +{ +FLVContext *flv = s->priv_data; +AMFDataType type; +AVIOContext *ioc; +char buffer[32]; +ioc = s->pb; + +// first object needs to be "colorIn
Re: [FFmpeg-devel] [PATCH] af_afir: RISC-V V fcmul_add
Le keskiviikkona 15. marraskuuta 2023, 10.59.55 EET flow gg a écrit : > Okay, I have updated these issues in the patch. It does not assemble but I can fix it locally. The narrowing shift trickery require Zve64x, or rather Zve64f in this case. The performance improvement is much better on newer hardware: fcmul_add_c: 4891.2 fcmul_add_rvv_f64: 2399.5 FWIW, VLSEG2E32.V remains slightly worse than with shifting: fcmul_add_c: 4891.2 fcmul_add_rvv_f32: 2877.5 -- 雷米‧德尼-库尔蒙 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".
Re: [FFmpeg-devel] [PATCH] avcodec/decode: guard against NULL hw_frames_ctx
On Tue, 2023-11-14 at 19:32 +0100, Hendrik Leppkes wrote: > On Tue, Nov 14, 2023 at 7:23 PM Dmitry Rogozhkin > wrote: > > > > Gurd against segfault running VLC decoding under msys2 [1]: > > > > Thread 33 received signal SIGSEGV, Segmentation fault. > > [Switching to Thread 37728.0xadd0] > > ff_hwaccel_frame_priv_alloc (avctx=0x6447b00, > > hwaccel_picture_private=0x65dfd00) > > at libavcodec/decode.c:1848 > > 1848frames_ctx = (AVHWFramesContext *)avctx->hw_frames_ctx- > > >data; > > (gdb) bt > > at libavcodec/decode.c:1848 > > at libavcodec/h264_slice.c:208 > > first_slice=1) at libavcodec/h264_slice.c:1599 > > at libavcodec/h264_slice.c:2130 > > at libavcodec/h264dec.c:652 > > got_frame=0x646e4b0, avpkt=0x64522c0) at > > libavcodec/h264dec.c:1048 > > > > (gdb) p avctx > > $1 = (AVCodecContext *) 0x6447b00 > > (gdb) p avctx->hw_frames_ctx > > $2 = (AVBufferRef *) 0x0 > > > > See[1]: https://github.com/msys2/MINGW-packages/pull/19050 > > Fixes: be07145109 ("avcodec: add AVHWAccel.free_frame_priv > > callback") > > CC: Lynne > > CC: Christoph Reiter > > Signed-off-by: Dmitry Rogozhkin > > --- > > libavcodec/decode.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/libavcodec/decode.c b/libavcodec/decode.c > > index ad39021..3caaeec 100644 > > --- a/libavcodec/decode.c > > +++ b/libavcodec/decode.c > > @@ -1845,9 +1845,9 @@ int > > ff_hwaccel_frame_priv_alloc(AVCodecContext *avctx, void > > **hwaccel_picture_pr > > > > av_assert0(!*hwaccel_picture_private); > > > > -frames_ctx = (AVHWFramesContext *)avctx->hw_frames_ctx->data; > > +frames_ctx = (AVHWFramesContext *) avctx->hw_frames_ctx ? > > avctx->hw_frames_ctx->data : NULL; > > *hwaccel_picture_private = ff_refstruct_alloc_ext(hwaccel- > > >frame_priv_data_size, 0, > > - frames_ctx- > > >device_ctx, > > + frames_ctx ? > > frames_ctx->device_ctx : NULL, > >hwaccel- > > >free_frame_priv); > > The free_frame_priv callback is not usable when no context is > available. The code should be updated to check if the hwaccel has a > free_frame_priv callback and then require a frames_ctx to be set and > otherwise error out (instead of crashing), and if free_frame_priv is > not set, then it can allocate a buffer without these requirements. Thank you for feedback. I hope I have fixed this and sent v2 update yesterday. Can you, please, help review again? > > - Hendrik > ___ > 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 v3] avcodec/vp8: Export `vp8_token_update_probs` variable
Hi, On Mon, Nov 13, 2023 at 8:43 AM Ronald S. Bultje wrote: > Hi, > > On Mon, Nov 13, 2023 at 2:55 AM Dai, Jianhui J < > jianhui.j.dai-at-intel@ffmpeg.org> wrote: > >> Oh, this is the preceding patch of: >> `[FFmpeg-devel,v6] avcodec/cbs_vp8: Add support for VP8 codec bitstream` >> >> Probably, I need merge these two together. >> > > It's ok like this, for me. I'll let this sit for 48 hours for others to > comment. After that, I will merge (both patches) for you later this week if > no other review comments come in. > Both patches pushed. Ronald ___ 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/flacdsp: add LPC test
--- tests/checkasm/flacdsp.c | 28 1 file changed, 28 insertions(+) diff --git a/tests/checkasm/flacdsp.c b/tests/checkasm/flacdsp.c index 51a0e0060b..589a3fe834 100644 --- a/tests/checkasm/flacdsp.c +++ b/tests/checkasm/flacdsp.c @@ -54,6 +54,27 @@ static void check_decorrelate(uint8_t **ref_dst, uint8_t **ref_src, uint8_t **ne bench_new(new_dst, (int32_t **)new_src, channels, BUF_SIZE / sizeof(int32_t), 8); } +static void check_lpc(FLACDSPContext *c) +{ +int pred_order = (rnd() % 32) + 1; +int qlevel = rnd() % 16; +LOCAL_ALIGNED_16(int32_t, coeffs, [32]); +LOCAL_ALIGNED_16(int32_t, dst0, [BUF_SIZE]); +LOCAL_ALIGNED_16(int32_t, dst1, [BUF_SIZE]); + +declare_func(void, int32_t *, const int[32], int, int, int); + +for (int i = 0; i < BUF_SIZE; i++) +dst0[i] = rnd(); + +memcpy(dst1, dst0, BUF_SIZE * sizeof (int32_t)); +call_ref(dst0, coeffs, pred_order, qlevel, BUF_SIZE); +call_new(dst1, coeffs, pred_order, qlevel, BUF_SIZE); +if (memcmp(dst0, dst1, BUF_SIZE * sizeof (int32_t)) != 0) + fail(); +bench_new(dst1, coeffs, pred_order, qlevel, BUF_SIZE); +} + void checkasm_check_flacdsp(void) { LOCAL_ALIGNED_16(uint8_t, ref_dst, [BUF_SIZE*MAX_CHANNELS]); @@ -88,4 +109,11 @@ void checkasm_check_flacdsp(void) } report("decorrelate"); + +if (check_func(h.lpc16, "flac_lpc_16")) +check_lpc(&h); +if (check_func(h.lpc32, "flac_lpc_32")) +check_lpc(&h); + +report("lpc"); } -- 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".
Re: [FFmpeg-devel] [PATCH] checkasm/flacdsp: add LPC test
Le keskiviikkona 15. marraskuuta 2023, 18.21.34 EET Rémi Denis-Courmont a écrit : > --- > tests/checkasm/flacdsp.c | 28 > 1 file changed, 28 insertions(+) > > diff --git a/tests/checkasm/flacdsp.c b/tests/checkasm/flacdsp.c > index 51a0e0060b..589a3fe834 100644 > --- a/tests/checkasm/flacdsp.c > +++ b/tests/checkasm/flacdsp.c > @@ -54,6 +54,27 @@ static void check_decorrelate(uint8_t **ref_dst, uint8_t > **ref_src, uint8_t **ne bench_new(new_dst, (int32_t **)new_src, channels, > BUF_SIZE / sizeof(int32_t), 8); } > > +static void check_lpc(FLACDSPContext *c) > +{ > +int pred_order = (rnd() % 32) + 1; > +int qlevel = rnd() % 16; > +LOCAL_ALIGNED_16(int32_t, coeffs, [32]); > +LOCAL_ALIGNED_16(int32_t, dst0, [BUF_SIZE]); > +LOCAL_ALIGNED_16(int32_t, dst1, [BUF_SIZE]); > + > +declare_func(void, int32_t *, const int[32], int, int, int); Hmmph, nevermind, forgot to initialise the coefficients. > + > +for (int i = 0; i < BUF_SIZE; i++) > +dst0[i] = rnd(); > + > +memcpy(dst1, dst0, BUF_SIZE * sizeof (int32_t)); > +call_ref(dst0, coeffs, pred_order, qlevel, BUF_SIZE); > +call_new(dst1, coeffs, pred_order, qlevel, BUF_SIZE); > +if (memcmp(dst0, dst1, BUF_SIZE * sizeof (int32_t)) != 0) > + fail(); > +bench_new(dst1, coeffs, pred_order, qlevel, BUF_SIZE); > +} > + > void checkasm_check_flacdsp(void) > { > LOCAL_ALIGNED_16(uint8_t, ref_dst, [BUF_SIZE*MAX_CHANNELS]); > @@ -88,4 +109,11 @@ void checkasm_check_flacdsp(void) > } > > report("decorrelate"); > + > +if (check_func(h.lpc16, "flac_lpc_16")) > +check_lpc(&h); > +if (check_func(h.lpc32, "flac_lpc_32")) > +check_lpc(&h); > + > +report("lpc"); > } -- Rémi Denis-Courmont 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".
Re: [FFmpeg-devel] [PATCH v6] fftools/ffplay: add hwaccel decoding support
Regarding to build error target Windows gpl-shared https://github.com/BtbN/FFmpeg-Builds/actions/runs/6877007331/job/18704121033#step:5:11349 I have sent an MR to libplacebo https://github.com/haasn/libplacebo/pull/222 ___ 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] riscv: fix builds without Zbb support
--- libavutil/riscv/asm.S | 5 + 1 file changed, 5 insertions(+) diff --git a/libavutil/riscv/asm.S b/libavutil/riscv/asm.S index 6ca74f263a..0a9e2e0d3f 100644 --- a/libavutil/riscv/asm.S +++ b/libavutil/riscv/asm.S @@ -92,6 +92,11 @@ shnadd 3, \rd, \rs1, \rs2 .endm #endif +#if !defined (__riscv_zbb) +.macro min rd, rs1, rs2 +.insn r OP, 4, 5, \rd, \rs1, \rs2 +.endm +#endif /* Convenience macro to load a Vector type (vtype) as immediate */ .macro lvtypei rd, e, m=m1, tp=tu, mp=mu -- 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] [PATCH 1/2] checkasm/flacdsp: add LPC test
--- tests/checkasm/flacdsp.c | 32 1 file changed, 32 insertions(+) diff --git a/tests/checkasm/flacdsp.c b/tests/checkasm/flacdsp.c index 51a0e0060b..4d69cbe507 100644 --- a/tests/checkasm/flacdsp.c +++ b/tests/checkasm/flacdsp.c @@ -54,6 +54,28 @@ static void check_decorrelate(uint8_t **ref_dst, uint8_t **ref_src, uint8_t **ne bench_new(new_dst, (int32_t **)new_src, channels, BUF_SIZE / sizeof(int32_t), 8); } +static void check_lpc(FLACDSPContext *c, int pred_order) +{ +int qlevel = rnd() % 16; +LOCAL_ALIGNED_16(int32_t, coeffs, [32]); +LOCAL_ALIGNED_16(int32_t, dst0, [BUF_SIZE]); +LOCAL_ALIGNED_16(int32_t, dst1, [BUF_SIZE]); + +declare_func(void, int32_t *, const int[32], int, int, int); + +for (int i = 0; i < 32; i++) +coeffs[i] = rnd(); +for (int i = 0; i < BUF_SIZE; i++) +dst0[i] = rnd(); + +memcpy(dst1, dst0, BUF_SIZE * sizeof (int32_t)); +call_ref(dst0, coeffs, pred_order, qlevel, BUF_SIZE); +call_new(dst1, coeffs, pred_order, qlevel, BUF_SIZE); +if (memcmp(dst0, dst1, BUF_SIZE * sizeof (int32_t)) != 0) + fail(); +bench_new(dst1, coeffs, pred_order, qlevel, BUF_SIZE); +} + void checkasm_check_flacdsp(void) { LOCAL_ALIGNED_16(uint8_t, ref_dst, [BUF_SIZE*MAX_CHANNELS]); @@ -72,6 +94,7 @@ void checkasm_check_flacdsp(void) { AV_SAMPLE_FMT_S16, 16 }, { AV_SAMPLE_FMT_S32, 32 }, }; +static const signed char pred_orders[] = { 13, 16, 29, 32 }; FLACDSPContext h; int i, j; @@ -88,4 +111,13 @@ void checkasm_check_flacdsp(void) } report("decorrelate"); + +for (int i = 0; i < sizeof (pred_orders); i++) { +if (check_func(h.lpc16, "flac_lpc_16_%d", pred_orders[i])) +check_lpc(&h, pred_orders[i]); +if (check_func(h.lpc32, "flac_lpc_32_%d", pred_orders[i])) +check_lpc(&h, pred_orders[i]); +} + +report("lpc"); } -- 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] [PATCH 2/2] lavc/flacdsp: R-V V LPC32
The entire set of 32 coefficients and corresponding past 32 samples can fit in a single vector (with LMUL=8) exactly, but... since widening double the needed vector sizes, we still end up too short with 128-bit vectors. This adds a very simple version for future 256+-bit hardware, and for pred_orders values up to 16, and a bit more involved loop for for 128-bit hardware with pred_orders between 17 and 32. With 128-bit hardware, the benchmarks look like this: flac_lpc_32_13_c: 30152.0 flac_lpc_32_13_rvv_i32: 10244.7 flac_lpc_32_16_c: 37314.2 flac_lpc_32_16_rvv_i32: 10126.2 flac_lpc_32_29_c: 61910.0 flac_lpc_32_29_rvv_i32: 14495.2 flac_lpc_32_32_c: 68204.0 flac_lpc_32_32_rvv_i32: 13273.7 --- libavcodec/riscv/flacdsp_init.c | 12 +++ libavcodec/riscv/flacdsp_rvv.S | 57 + 2 files changed, 69 insertions(+) diff --git a/libavcodec/riscv/flacdsp_init.c b/libavcodec/riscv/flacdsp_init.c index 73d431cb77..f60f98ea31 100644 --- a/libavcodec/riscv/flacdsp_init.c +++ b/libavcodec/riscv/flacdsp_init.c @@ -22,8 +22,13 @@ #include "libavutil/attributes.h" #include "libavutil/cpu.h" +#include "libavutil/riscv/cpu.h" #include "libavcodec/flacdsp.h" +void ff_flac_lpc32_rvv(int32_t *decoded, const int coeffs[32], + int pred_order, int qlevel, int len); +void ff_flac_lpc32_rvv_simple(int32_t *decoded, const int coeffs[32], + int pred_order, int qlevel, int len); void ff_flac_decorrelate_indep2_16_rvv(uint8_t **out, int32_t **in, int channels, int len, int shift); void ff_flac_decorrelate_indep4_16_rvv(uint8_t **out, int32_t **in, @@ -60,6 +65,13 @@ av_cold void ff_flacdsp_init_riscv(FLACDSPContext *c, enum AVSampleFormat fmt, int flags = av_get_cpu_flags(); if ((flags & AV_CPU_FLAG_RVV_I32) && (flags & AV_CPU_FLAG_RVB_ADDR)) { +int vlenb = ff_get_rv_vlenb(); + +if (vlenb == 16) +c->lpc32 = ff_flac_lpc32_rvv; +else if (vlenb > 16) +c->lpc32 = ff_flac_lpc32_rvv_simple; + switch (fmt) { case AV_SAMPLE_FMT_S16: switch (channels) { diff --git a/libavcodec/riscv/flacdsp_rvv.S b/libavcodec/riscv/flacdsp_rvv.S index 12b456f7da..b1724f5500 100644 --- a/libavcodec/riscv/flacdsp_rvv.S +++ b/libavcodec/riscv/flacdsp_rvv.S @@ -21,6 +21,63 @@ #include "libavutil/riscv/asm.S" #if (__riscv_xlen == 64) +func ff_flac_lpc32_rvv, zve32x +addit2, a2, -16 +ble t2, zero, ff_flac_lpc32_rvv_simple +vsetivli zero, 1, e64, m1, ta, ma +vmv.s.x v0, zero +vsetvli zero, a2, e32, m8, ta, ma +vle32.v v8, (a1) +sub a4, a4, a2 +vle32.v v16, (a0) +sh2add a0, a2, a0 +1: +vsetvli zero, a2, e32, m4, ta, ma +vwmul.vv v24, v8, v16 +vsetvli zero, t2, e32, m4, tu, ma +vwmacc.vv v24, v12, v20 +vsetvli zero, a2, e64, m8, ta, ma +vredsum.vs v24, v24, v0 +lw t0, (a0) +addia4, a4, -1 +vmv.x.s t1, v24 +vsetvli zero, a2, e32, m8, ta, ma +sra t1, t1, a3 +add t0, t0, t1 +vslide1down.vx v16, v16, t0 +sw t0, (a0) +addia0, a0, 4 +bneza4, 1b + +ret +endfunc + +func ff_flac_lpc32_rvv_simple, zve32x +vsetivli zero, 1, e64, m1, ta, ma +vmv.s.x v0, zero +vsetvli zero, a2, e32, m4, ta, ma +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 +vredsum.vs v24, v24, v0 +lw t0, (a0) +addia4, a4, -1 +vmv.x.s t1, v24 +vsetvli zero, zero, e32, m4, ta, ma +sra t1, t1, a3 +add t0, t0, t1 +vslide1down.vx v16, v16, t0 +sw t0, (a0) +addia0, a0, 4 +bneza4, 1b + +ret +endfunc + func ff_flac_decorrelate_indep2_16_rvv, zve32x ld a0, (a0) ld a2, 8(a1) -- 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".
Re: [FFmpeg-devel] [PATCH v6] avcodec/cbs_vp8: Add support for VP8 codec bitstream
Hi, On Sun, Nov 12, 2023 at 8:53 PM Dai, Jianhui J < jianhui.j.dai-at-intel@ffmpeg.org> wrote: > TESTS: ffmpeg -i fate-suite/vp8/frame_size_change.webm -vcodec copy > -bsf:v trace_headers -f null - > (I've merged this already.) I don't think a fate test was added to prevent regressions. Would that be useful? (I didn't see one for the other trace_headers like vp9 or av1, so it's possible the answer is "no".) Ronald ___ 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/2] checkasm/flacdsp: add LPC test
On 11/15/2023 3:02 PM, Rémi Denis-Courmont wrote: --- tests/checkasm/flacdsp.c | 32 1 file changed, 32 insertions(+) diff --git a/tests/checkasm/flacdsp.c b/tests/checkasm/flacdsp.c index 51a0e0060b..4d69cbe507 100644 --- a/tests/checkasm/flacdsp.c +++ b/tests/checkasm/flacdsp.c @@ -54,6 +54,28 @@ static void check_decorrelate(uint8_t **ref_dst, uint8_t **ref_src, uint8_t **ne bench_new(new_dst, (int32_t **)new_src, channels, BUF_SIZE / sizeof(int32_t), 8); } +static void check_lpc(FLACDSPContext *c, int pred_order) c is unused. +{ +int qlevel = rnd() % 16; +LOCAL_ALIGNED_16(int32_t, coeffs, [32]); +LOCAL_ALIGNED_16(int32_t, dst0, [BUF_SIZE]); +LOCAL_ALIGNED_16(int32_t, dst1, [BUF_SIZE]); + +declare_func(void, int32_t *, const int[32], int, int, int); + +for (int i = 0; i < 32; i++) +coeffs[i] = rnd(); +for (int i = 0; i < BUF_SIZE; i++) +dst0[i] = rnd(); + +memcpy(dst1, dst0, BUF_SIZE * sizeof (int32_t)); +call_ref(dst0, coeffs, pred_order, qlevel, BUF_SIZE); +call_new(dst1, coeffs, pred_order, qlevel, BUF_SIZE); +if (memcmp(dst0, dst1, BUF_SIZE * sizeof (int32_t)) != 0) + fail(); +bench_new(dst1, coeffs, pred_order, qlevel, BUF_SIZE); Not sure if it matters, but dst1 is already trashed by call_new(). +} + void checkasm_check_flacdsp(void) { LOCAL_ALIGNED_16(uint8_t, ref_dst, [BUF_SIZE*MAX_CHANNELS]); @@ -72,6 +94,7 @@ void checkasm_check_flacdsp(void) { AV_SAMPLE_FMT_S16, 16 }, { AV_SAMPLE_FMT_S32, 32 }, }; +static const signed char pred_orders[] = { 13, 16, 29, 32 }; FLACDSPContext h; int i, j; @@ -88,4 +111,13 @@ void checkasm_check_flacdsp(void) } report("decorrelate"); + +for (int i = 0; i < sizeof (pred_orders); i++) { i is already defined. Also, use FF_ARRAY_ELEMS(pred_orders), so it doesn't depend on char being 1 byte. +if (check_func(h.lpc16, "flac_lpc_16_%d", pred_orders[i])) +check_lpc(&h, pred_orders[i]); +if (check_func(h.lpc32, "flac_lpc_32_%d", pred_orders[i])) +check_lpc(&h, pred_orders[i]); +} + +report("lpc"); } LGTM otherwise. ___ 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/2] checkasm/flacdsp: add LPC test
Le keskiviikkona 15. marraskuuta 2023, 21.14.26 EET James Almer a écrit : > On 11/15/2023 3:02 PM, Rémi Denis-Courmont wrote: > > --- > > > > tests/checkasm/flacdsp.c | 32 > > 1 file changed, 32 insertions(+) > > > > diff --git a/tests/checkasm/flacdsp.c b/tests/checkasm/flacdsp.c > > index 51a0e0060b..4d69cbe507 100644 > > --- a/tests/checkasm/flacdsp.c > > +++ b/tests/checkasm/flacdsp.c > > @@ -54,6 +54,28 @@ static void check_decorrelate(uint8_t **ref_dst, > > uint8_t **ref_src, uint8_t **ne> > > bench_new(new_dst, (int32_t **)new_src, channels, BUF_SIZE / > > sizeof(int32_t), 8);> > > } > > > > +static void check_lpc(FLACDSPContext *c, int pred_order) > > c is unused. > > > +{ > > +int qlevel = rnd() % 16; > > +LOCAL_ALIGNED_16(int32_t, coeffs, [32]); > > +LOCAL_ALIGNED_16(int32_t, dst0, [BUF_SIZE]); > > +LOCAL_ALIGNED_16(int32_t, dst1, [BUF_SIZE]); > > + > > +declare_func(void, int32_t *, const int[32], int, int, int); > > + > > +for (int i = 0; i < 32; i++) > > +coeffs[i] = rnd(); > > +for (int i = 0; i < BUF_SIZE; i++) > > +dst0[i] = rnd(); > > + > > +memcpy(dst1, dst0, BUF_SIZE * sizeof (int32_t)); > > +call_ref(dst0, coeffs, pred_order, qlevel, BUF_SIZE); > > +call_new(dst1, coeffs, pred_order, qlevel, BUF_SIZE); > > +if (memcmp(dst0, dst1, BUF_SIZE * sizeof (int32_t)) != 0) > > + fail(); > > +bench_new(dst1, coeffs, pred_order, qlevel, BUF_SIZE); > > Not sure if it matters, but dst1 is already trashed by call_new(). Yeah I know. I could allocate a third buffer. AFAICT, the only parameter that should affect the benchmarks is pred-order (which indeed affects the result on both x86 and RVV). So that the extra code to preserve dst seemed pointless? > > > +} > > + > > > > void checkasm_check_flacdsp(void) > > { > > > > LOCAL_ALIGNED_16(uint8_t, ref_dst, [BUF_SIZE*MAX_CHANNELS]); > > > > @@ -72,6 +94,7 @@ void checkasm_check_flacdsp(void) > > > > { AV_SAMPLE_FMT_S16, 16 }, > > { AV_SAMPLE_FMT_S32, 32 }, > > > > }; > > > > +static const signed char pred_orders[] = { 13, 16, 29, 32 }; > > > > FLACDSPContext h; > > int i, j; > > > > @@ -88,4 +111,13 @@ void checkasm_check_flacdsp(void) > > > > } > > > > report("decorrelate"); > > > > + > > +for (int i = 0; i < sizeof (pred_orders); i++) { > > i is already defined. Also, use FF_ARRAY_ELEMS(pred_orders), so it > doesn't depend on char being 1 byte. > > > +if (check_func(h.lpc16, "flac_lpc_16_%d", pred_orders[i])) > > +check_lpc(&h, pred_orders[i]); > > +if (check_func(h.lpc32, "flac_lpc_32_%d", pred_orders[i])) > > +check_lpc(&h, pred_orders[i]); > > +} > > + > > +report("lpc"); > > > > } > > LGTM otherwise. > ___ > 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". -- 雷米‧德尼-库尔蒙 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".
Re: [FFmpeg-devel] [PATCH 1/2] checkasm/flacdsp: add LPC test
On 11/15/2023 4:19 PM, Rémi Denis-Courmont wrote: Le keskiviikkona 15. marraskuuta 2023, 21.14.26 EET James Almer a écrit : On 11/15/2023 3:02 PM, Rémi Denis-Courmont wrote: --- tests/checkasm/flacdsp.c | 32 1 file changed, 32 insertions(+) diff --git a/tests/checkasm/flacdsp.c b/tests/checkasm/flacdsp.c index 51a0e0060b..4d69cbe507 100644 --- a/tests/checkasm/flacdsp.c +++ b/tests/checkasm/flacdsp.c @@ -54,6 +54,28 @@ static void check_decorrelate(uint8_t **ref_dst, uint8_t **ref_src, uint8_t **ne> bench_new(new_dst, (int32_t **)new_src, channels, BUF_SIZE / sizeof(int32_t), 8);> } +static void check_lpc(FLACDSPContext *c, int pred_order) c is unused. +{ +int qlevel = rnd() % 16; +LOCAL_ALIGNED_16(int32_t, coeffs, [32]); +LOCAL_ALIGNED_16(int32_t, dst0, [BUF_SIZE]); +LOCAL_ALIGNED_16(int32_t, dst1, [BUF_SIZE]); + +declare_func(void, int32_t *, const int[32], int, int, int); + +for (int i = 0; i < 32; i++) +coeffs[i] = rnd(); +for (int i = 0; i < BUF_SIZE; i++) +dst0[i] = rnd(); + +memcpy(dst1, dst0, BUF_SIZE * sizeof (int32_t)); +call_ref(dst0, coeffs, pred_order, qlevel, BUF_SIZE); +call_new(dst1, coeffs, pred_order, qlevel, BUF_SIZE); +if (memcmp(dst0, dst1, BUF_SIZE * sizeof (int32_t)) != 0) + fail(); +bench_new(dst1, coeffs, pred_order, qlevel, BUF_SIZE); Not sure if it matters, but dst1 is already trashed by call_new(). Yeah I know. I could allocate a third buffer. AFAICT, the only parameter that should affect the benchmarks is pred-order (which indeed affects the result on both x86 and RVV). So that the extra code to preserve dst seemed pointless? I guess it's pointless in this case, yeah, but I know that some other dsp functions ended up with different benchmark results if the contents of a buffer were bogus (Which afaik is why when being filled with rnd() they are also clipped with a mask). +} + void checkasm_check_flacdsp(void) { LOCAL_ALIGNED_16(uint8_t, ref_dst, [BUF_SIZE*MAX_CHANNELS]); @@ -72,6 +94,7 @@ void checkasm_check_flacdsp(void) { AV_SAMPLE_FMT_S16, 16 }, { AV_SAMPLE_FMT_S32, 32 }, }; +static const signed char pred_orders[] = { 13, 16, 29, 32 }; FLACDSPContext h; int i, j; @@ -88,4 +111,13 @@ void checkasm_check_flacdsp(void) } report("decorrelate"); + +for (int i = 0; i < sizeof (pred_orders); i++) { i is already defined. Also, use FF_ARRAY_ELEMS(pred_orders), so it doesn't depend on char being 1 byte. +if (check_func(h.lpc16, "flac_lpc_16_%d", pred_orders[i])) +check_lpc(&h, pred_orders[i]); +if (check_func(h.lpc32, "flac_lpc_32_%d", pred_orders[i])) +check_lpc(&h, pred_orders[i]); +} + +report("lpc"); } LGTM otherwise. ___ 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] [PATCHv3] checkasm/flacdsp: add LPC test
--- tests/checkasm/flacdsp.c | 32 1 file changed, 32 insertions(+) diff --git a/tests/checkasm/flacdsp.c b/tests/checkasm/flacdsp.c index 51a0e0060b..b308237db1 100644 --- a/tests/checkasm/flacdsp.c +++ b/tests/checkasm/flacdsp.c @@ -54,6 +54,28 @@ static void check_decorrelate(uint8_t **ref_dst, uint8_t **ref_src, uint8_t **ne bench_new(new_dst, (int32_t **)new_src, channels, BUF_SIZE / sizeof(int32_t), 8); } +static void check_lpc(int pred_order) +{ +int qlevel = rnd() % 16; +LOCAL_ALIGNED_16(int32_t, coeffs, [32]); +LOCAL_ALIGNED_16(int32_t, dst0, [BUF_SIZE]); +LOCAL_ALIGNED_16(int32_t, dst1, [BUF_SIZE]); + +declare_func(void, int32_t *, const int[32], int, int, int); + +for (int i = 0; i < 32; i++) +coeffs[i] = rnd(); +for (int i = 0; i < BUF_SIZE; i++) +dst0[i] = rnd(); + +memcpy(dst1, dst0, BUF_SIZE * sizeof (int32_t)); +call_ref(dst0, coeffs, pred_order, qlevel, BUF_SIZE); +call_new(dst1, coeffs, pred_order, qlevel, BUF_SIZE); +if (memcmp(dst0, dst1, BUF_SIZE * sizeof (int32_t)) != 0) + fail(); +bench_new(dst1, coeffs, pred_order, qlevel, BUF_SIZE); +} + void checkasm_check_flacdsp(void) { LOCAL_ALIGNED_16(uint8_t, ref_dst, [BUF_SIZE*MAX_CHANNELS]); @@ -72,6 +94,7 @@ void checkasm_check_flacdsp(void) { AV_SAMPLE_FMT_S16, 16 }, { AV_SAMPLE_FMT_S32, 32 }, }; +static const signed char pred_orders[] = { 13, 16, 29, 32 }; FLACDSPContext h; int i, j; @@ -88,4 +111,13 @@ void checkasm_check_flacdsp(void) } report("decorrelate"); + +for (i = 0; i < FF_ARRAY_ELEMS(pred_orders); i++) +if (check_func(h.lpc16, "flac_lpc_16_%d", pred_orders[i])) +check_lpc(pred_orders[i]); +for (i = 0; i < FF_ARRAY_ELEMS(pred_orders); i++) +if (check_func(h.lpc32, "flac_lpc_32_%d", pred_orders[i])) +check_lpc(pred_orders[i]); + +report("lpc"); } -- 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".
Re: [FFmpeg-devel] [PATCHv3] checkasm/flacdsp: add LPC test
On 11/15/2023 4:24 PM, Rémi Denis-Courmont wrote: --- tests/checkasm/flacdsp.c | 32 1 file changed, 32 insertions(+) diff --git a/tests/checkasm/flacdsp.c b/tests/checkasm/flacdsp.c index 51a0e0060b..b308237db1 100644 --- a/tests/checkasm/flacdsp.c +++ b/tests/checkasm/flacdsp.c @@ -54,6 +54,28 @@ static void check_decorrelate(uint8_t **ref_dst, uint8_t **ref_src, uint8_t **ne bench_new(new_dst, (int32_t **)new_src, channels, BUF_SIZE / sizeof(int32_t), 8); } +static void check_lpc(int pred_order) +{ +int qlevel = rnd() % 16; +LOCAL_ALIGNED_16(int32_t, coeffs, [32]); +LOCAL_ALIGNED_16(int32_t, dst0, [BUF_SIZE]); +LOCAL_ALIGNED_16(int32_t, dst1, [BUF_SIZE]); + +declare_func(void, int32_t *, const int[32], int, int, int); + +for (int i = 0; i < 32; i++) +coeffs[i] = rnd(); +for (int i = 0; i < BUF_SIZE; i++) +dst0[i] = rnd(); + +memcpy(dst1, dst0, BUF_SIZE * sizeof (int32_t)); +call_ref(dst0, coeffs, pred_order, qlevel, BUF_SIZE); +call_new(dst1, coeffs, pred_order, qlevel, BUF_SIZE); +if (memcmp(dst0, dst1, BUF_SIZE * sizeof (int32_t)) != 0) + fail(); +bench_new(dst1, coeffs, pred_order, qlevel, BUF_SIZE); +} + void checkasm_check_flacdsp(void) { LOCAL_ALIGNED_16(uint8_t, ref_dst, [BUF_SIZE*MAX_CHANNELS]); @@ -72,6 +94,7 @@ void checkasm_check_flacdsp(void) { AV_SAMPLE_FMT_S16, 16 }, { AV_SAMPLE_FMT_S32, 32 }, }; +static const signed char pred_orders[] = { 13, 16, 29, 32 }; FLACDSPContext h; int i, j; @@ -88,4 +111,13 @@ void checkasm_check_flacdsp(void) } report("decorrelate"); + +for (i = 0; i < FF_ARRAY_ELEMS(pred_orders); i++) +if (check_func(h.lpc16, "flac_lpc_16_%d", pred_orders[i])) +check_lpc(pred_orders[i]); +for (i = 0; i < FF_ARRAY_ELEMS(pred_orders); i++) +if (check_func(h.lpc32, "flac_lpc_32_%d", pred_orders[i])) +check_lpc(pred_orders[i]); + +report("lpc"); } 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".
[FFmpeg-devel] [PATCH] lavc/flacdsp: R-V V LPC16 function
In this case, the inner loop computing the scalar product can be reduced to just one multiplication and one sum even with 128-bit vectors. The result is a lot simpler, but also brings more modest performance gains: flac_lpc_16_13_c: 15241.0 flac_lpc_16_13_rvv_i32: 11230.0 flac_lpc_16_16_c: 17884.0 flac_lpc_16_16_rvv_i32: 12125.7 flac_lpc_16_29_c: 27847.7 flac_lpc_16_29_rvv_i32: 10494.0 flac_lpc_16_32_c: 30051.5 flac_lpc_16_32_rvv_i32: 10355.0 --- libavcodec/riscv/flacdsp_init.c | 17 - libavcodec/riscv/flacdsp_rvv.S | 23 +++ 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/libavcodec/riscv/flacdsp_init.c b/libavcodec/riscv/flacdsp_init.c index f60f98ea31..6cfb50ead8 100644 --- a/libavcodec/riscv/flacdsp_init.c +++ b/libavcodec/riscv/flacdsp_init.c @@ -25,6 +25,8 @@ #include "libavutil/riscv/cpu.h" #include "libavcodec/flacdsp.h" +void ff_flac_lpc16_rvv(int32_t *decoded, const int coeffs[32], + int pred_order, int qlevel, int len); void ff_flac_lpc32_rvv(int32_t *decoded, const int coeffs[32], int pred_order, int qlevel, int len); void ff_flac_lpc32_rvv_simple(int32_t *decoded, const int coeffs[32], @@ -61,16 +63,20 @@ void ff_flac_decorrelate_ms_32_rvv(uint8_t **out, int32_t **in, av_cold void ff_flacdsp_init_riscv(FLACDSPContext *c, enum AVSampleFormat fmt, int channels) { -#if HAVE_RVV && (__riscv_xlen >= 64) +#if HAVE_RVV int flags = av_get_cpu_flags(); if ((flags & AV_CPU_FLAG_RVV_I32) && (flags & AV_CPU_FLAG_RVB_ADDR)) { int vlenb = ff_get_rv_vlenb(); -if (vlenb == 16) -c->lpc32 = ff_flac_lpc32_rvv; -else if (vlenb > 16) -c->lpc32 = ff_flac_lpc32_rvv_simple; +if (vlenb >= 16) { +c->lpc16 = ff_flac_lpc16_rvv; +# if (__riscv_xlen >= 64) +if (vlenb > 16) +c->lpc32 = ff_flac_lpc32_rvv_simple; +else +c->lpc32 = ff_flac_lpc32_rvv; +} switch (fmt) { case AV_SAMPLE_FMT_S16: @@ -111,6 +117,7 @@ av_cold void ff_flacdsp_init_riscv(FLACDSPContext *c, enum AVSampleFormat fmt, c->decorrelate[2] = ff_flac_decorrelate_rs_32_rvv; c->decorrelate[3] = ff_flac_decorrelate_ms_32_rvv; break; +# endif } } #endif diff --git a/libavcodec/riscv/flacdsp_rvv.S b/libavcodec/riscv/flacdsp_rvv.S index b1724f5500..2a0b50f7a9 100644 --- a/libavcodec/riscv/flacdsp_rvv.S +++ b/libavcodec/riscv/flacdsp_rvv.S @@ -20,6 +20,29 @@ #include "libavutil/riscv/asm.S" +func ff_flac_lpc16_rvv, zve32x +vsetvli zero, a2, e32, m8, ta, ma +vle32.v v8, (a1) +sub a4, a4, a2 +vle32.v v16, (a0) +sh2add a0, a2, a0 +vmv.s.x v0, zero +1: +vmul.vv v24, v8, v16 +lw t0, (a0) +vredsum.vs v24, v24, v0 +addia4, a4, -1 +vmv.x.s t1, v24 +sra t1, t1, a3 +add t0, t0, t1 +vslide1down.vx v16, v16, t0 +sw t0, (a0) +addia0, a0, 4 +bneza4, 1b + +ret +endfunc + #if (__riscv_xlen == 64) func ff_flac_lpc32_rvv, zve32x addit2, a2, -16 -- 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] [PATCH] lavc/llviddsp: R-V V add_bytes
add_bytes_c: 2077.2 add_bytes_rvv_i32: 105.0 --- libavcodec/lossless_videodsp.c | 2 ++ libavcodec/lossless_videodsp.h | 1 + libavcodec/riscv/Makefile| 2 ++ libavcodec/riscv/llviddsp_init.c | 38 libavcodec/riscv/llviddsp_rvv.S | 36 ++ 5 files changed, 79 insertions(+) create mode 100644 libavcodec/riscv/llviddsp_init.c create mode 100644 libavcodec/riscv/llviddsp_rvv.S diff --git a/libavcodec/lossless_videodsp.c b/libavcodec/lossless_videodsp.c index 359606981c..876decb1e6 100644 --- a/libavcodec/lossless_videodsp.c +++ b/libavcodec/lossless_videodsp.c @@ -121,6 +121,8 @@ void ff_llviddsp_init(LLVidDSPContext *c) #if ARCH_PPC ff_llviddsp_init_ppc(c); +#elif ARCH_RISCV +ff_llviddsp_init_riscv(c); #elif ARCH_X86 ff_llviddsp_init_x86(c); #endif diff --git a/libavcodec/lossless_videodsp.h b/libavcodec/lossless_videodsp.h index da4baa1414..5309ce4be7 100644 --- a/libavcodec/lossless_videodsp.h +++ b/libavcodec/lossless_videodsp.h @@ -40,6 +40,7 @@ typedef struct LLVidDSPContext { } LLVidDSPContext; void ff_llviddsp_init(LLVidDSPContext *llviddsp); +void ff_llviddsp_init_riscv(LLVidDSPContext *llviddsp); void ff_llviddsp_init_x86(LLVidDSPContext *llviddsp); void ff_llviddsp_init_ppc(LLVidDSPContext *llviddsp); diff --git a/libavcodec/riscv/Makefile b/libavcodec/riscv/Makefile index d34dc77458..8f2a519827 100644 --- a/libavcodec/riscv/Makefile +++ b/libavcodec/riscv/Makefile @@ -28,6 +28,8 @@ OBJS-$(CONFIG_IDCTDSP) += riscv/idctdsp_init.o RVV-OBJS-$(CONFIG_IDCTDSP) += riscv/idctdsp_rvv.o OBJS-$(CONFIG_LLAUDDSP) += riscv/llauddsp_init.o RVV-OBJS-$(CONFIG_LLAUDDSP) += riscv/llauddsp_rvv.o +OBJS-$(CONFIG_LLVIDDSP) += riscv/llviddsp_init.o +RVV-OBJS-$(CONFIG_LLVIDDSP) += riscv/llviddsp_rvv.o OBJS-$(CONFIG_OPUS_DECODER) += riscv/opusdsp_init.o RVV-OBJS-$(CONFIG_OPUS_DECODER) += riscv/opusdsp_rvv.o OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_init.o \ diff --git a/libavcodec/riscv/llviddsp_init.c b/libavcodec/riscv/llviddsp_init.c new file mode 100644 index 00..f042eeab32 --- /dev/null +++ b/libavcodec/riscv/llviddsp_init.c @@ -0,0 +1,38 @@ +/* + * Copyright © 2023 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 "libavutil/attributes.h" +#include "libavutil/cpu.h" +#include "libavcodec/lossless_videodsp.h" + +void ff_llvid_add_bytes_rvv(uint8_t *, uint8_t *src, ptrdiff_t w); + +av_cold void ff_llviddsp_init_riscv(LLVidDSPContext *c) +{ +#if HAVE_RVV +int flags = av_get_cpu_flags(); + +if (flags & AV_CPU_FLAG_RVV_I32) { +c->add_bytes = ff_llvid_add_bytes_rvv; +} +#endif +} diff --git a/libavcodec/riscv/llviddsp_rvv.S b/libavcodec/riscv/llviddsp_rvv.S new file mode 100644 index 00..a4814837b9 --- /dev/null +++ b/libavcodec/riscv/llviddsp_rvv.S @@ -0,0 +1,36 @@ +/* + * Copyright © 2023 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 "libavutil/riscv/asm.S" + +func ff_llvid_add_bytes_rvv, zve32x +1: +vsetvli t0, a2, e8, m8, ta, ma +vle8.v v0, (a1) +sub a2, a2, t0 +vle8.v v8, (a0) +add a1, t0, a1 +vadd.vv v8, v0, v8 +vse8.v v8, (a0) +add a0, t0, a0 +bneza2, 1b + +ret +endfunc -- 2.42.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscri
Re: [FFmpeg-devel] [PATCH v2 0/6] WebRTC sub-second live streaming support
On Tue, Nov 14, 2023 at 01:59:48PM +0100, Michael Riedl wrote: > On 11/14/23 11:05, Tomas Härdin wrote: > > This patchset is missing tests. I know that we for some reason don't > > really have tests for protocols, but I feel the issue is worthwhile to > > bring up. I've worked a bit with WebRTC recently and it's fiddly, so > > it'd be nice to have some automated thing that keeps track of which > > WebRTC implementations this works with. Or maybe this is better handled > > with an external project, testing which implementations interoperate? > > > I agree that having automated tests would be useful for stability in the > future. > I tested the patchset with both SRS and Millicast, and it worked well. > > For automated testing, we could use FATE, but it needs an extra server with > protection and someone to keep it updated. Testing with paid services like > Millicast is tricky. > > Another option is an external project for WebRTC testing, but the challenge is > keeping it maintained and compatible with changes in implementations. > > External services might update their software, causing issues with tests. We > would need a plan for dealing with that. > > For paid services like Millicast, we need to figure out who pays for the > tests. > Understanding the costs is essential if we want to use paid services for > testing. > > I'd like to hear your thoughts on these points and how you would propose to > proceed with adding tests for protocols like WebRTC. simple, add server support for this to FFmpeg. FATE is run in cases without network access (for example googles ossfuzz setup i belives does not permit the fuzzed code to access external things IIRC) The practice of implementing only one end of a protocol is honestly wrong. And if there is no usable free server, then even more so. thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If you drop bombs on a foreign country and kill a hundred thousand innocent people, expect your government to call the consequence "unprovoked inhuman terrorist attacks" and use it to justify dropping more bombs and killing more people. The technology changed, the idea is old. 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] af_afir: RISC-V V fcmul_add
Okay, I have modified them to 64 and added some descriptions. Rémi Denis-Courmont 于2023年11月15日周三 23:06写道: > Le keskiviikkona 15. marraskuuta 2023, 10.59.55 EET flow gg a écrit : > > Okay, I have updated these issues in the patch. > > It does not assemble but I can fix it locally. The narrowing shift > trickery > require Zve64x, or rather Zve64f in this case. > > The performance improvement is much better on newer hardware: > fcmul_add_c: 4891.2 > fcmul_add_rvv_f64: 2399.5 > > FWIW, VLSEG2E32.V remains slightly worse than with shifting: > fcmul_add_c: 4891.2 > fcmul_add_rvv_f32: 2877.5 > > -- > 雷米‧德尼-库尔蒙 > 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". > From 6b88fbf9b94c098841197c9fcb467006177ee4c6 Mon Sep 17 00:00:00 2001 From: sunyuechi Date: Fri, 3 Nov 2023 10:35:53 +0800 Subject: [PATCH] af_afir: RISC-V V fcmul_add Segmented loads are slow, so here we use unit-strided load and narrowing shifts. c910: fcmul_add_c: 2179 fcmul_add_rvv_f64: 1652 c908: fcmul_add_c: 4891.2 fcmul_add_rvv_f64: 2399.5 --- libavfilter/af_afirdsp.h | 5 ++- libavfilter/riscv/Makefile | 2 ++ libavfilter/riscv/af_afir_init.c | 42 libavfilter/riscv/af_afir_rvv.S | 55 4 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 libavfilter/riscv/Makefile create mode 100644 libavfilter/riscv/af_afir_init.c create mode 100644 libavfilter/riscv/af_afir_rvv.S diff --git a/libavfilter/af_afirdsp.h b/libavfilter/af_afirdsp.h index 4208501393..827e067a9b 100644 --- a/libavfilter/af_afirdsp.h +++ b/libavfilter/af_afirdsp.h @@ -33,6 +33,7 @@ typedef struct AudioFIRDSPContext { ptrdiff_t len); } AudioFIRDSPContext; +void ff_afir_init_riscv(AudioFIRDSPContext *s); void ff_afir_init_x86(AudioFIRDSPContext *s); static void fcmul_add_c(float *sum, const float *t, const float *c, ptrdiff_t len) @@ -74,7 +75,9 @@ static av_unused void ff_afir_init(AudioFIRDSPContext *dsp) dsp->fcmul_add = fcmul_add_c; dsp->dcmul_add = dcmul_add_c; -#if ARCH_X86 +#if ARCH_RISCV +ff_afir_init_riscv(dsp); +#elif ARCH_X86 ff_afir_init_x86(dsp); #endif } diff --git a/libavfilter/riscv/Makefile b/libavfilter/riscv/Makefile new file mode 100644 index 00..0b968a9c0d --- /dev/null +++ b/libavfilter/riscv/Makefile @@ -0,0 +1,2 @@ +OBJS += riscv/af_afir_init.o +RVV-OBJS += riscv/af_afir_rvv.o diff --git a/libavfilter/riscv/af_afir_init.c b/libavfilter/riscv/af_afir_init.c new file mode 100644 index 00..52aa18c126 --- /dev/null +++ b/libavfilter/riscv/af_afir_init.c @@ -0,0 +1,42 @@ +/* + * 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 + +#include "config.h" +#include "libavutil/attributes.h" +#include "libavutil/cpu.h" +#include "libavfilter/af_afirdsp.h" + +void ff_fcmul_add_rvv(float *sum, const float *t, const float *c, + ptrdiff_t len); + +av_cold void ff_afir_init_riscv(AudioFIRDSPContext *s) +{ +#if HAVE_RVV +int flags = av_get_cpu_flags(); + +if (flags & AV_CPU_FLAG_RVV_F64) { +if (flags & AV_CPU_FLAG_RVB_ADDR) { +s->fcmul_add = ff_fcmul_add_rvv; +} +} +#endif +} diff --git a/libavfilter/riscv/af_afir_rvv.S b/libavfilter/riscv/af_afir_rvv.S new file mode 100644 index 00..04ec2e50d8 --- /dev/null +++ b/libavfilter/riscv/af_afir_rvv.S @@ -0,0 +1,55 @@ +/* + * 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
[FFmpeg-devel] [PATCH 1/2] avcodec/qsv: add sps pps header when frame->key_frame is true
The key_frame currently doesn't set extra header into frames when using qsv encoders. Signed-off-by: reito --- libavcodec/qsvenc.c | 31 +++ 1 file changed, 31 insertions(+) diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index a0144b0760..2bd85a2f91 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -2365,6 +2365,28 @@ static int update_pic_timing_sei(AVCodecContext *avctx, QSVEncContext *q) return updated; } +static int set_sps_pps_encode_ctrl(AVCodecContext *avctx, const AVFrame *frame, + mfxEncodeCtrl *enc_ctrl) +{ +mfxExtInsertHeaders *insert_headers = NULL; + +if (frame->key_frame) { +av_log(avctx, AV_LOG_DEBUG, "Insert SPS PPS Header because of key_frame == 1\n"); +insert_headers = av_mallocz(sizeof(*insert_headers)); +if (!insert_headers) +return AVERROR(ENOMEM); +insert_headers->Header.BufferId = MFX_EXTBUFF_INSERT_HEADERS; +insert_headers->Header.BufferSz = sizeof(*insert_headers); +insert_headers->SPS = MFX_CODINGOPTION_ON; +insert_headers->PPS = MFX_CODINGOPTION_ON; + +enc_ctrl->ExtParam[enc_ctrl->NumExtParam] = (mfxExtBuffer *)insert_headers; +enc_ctrl->NumExtParam++; +} + +return 0; +} + static int encode_frame(AVCodecContext *avctx, QSVEncContext *q, const AVFrame *frame) { @@ -2434,6 +2456,15 @@ static int encode_frame(AVCodecContext *avctx, QSVEncContext *q, if (ret < 0) goto free; } + +if ((avctx->codec_id == AV_CODEC_ID_H264 || + avctx->codec_id == AV_CODEC_ID_H265) && +enc_ctrl && QSV_RUNTIME_VERSION_ATLEAST(q->ver, 1, 34)) { +ret = set_sps_pps_encode_ctrl(avctx, frame, enc_ctrl); +if (ret < 0) +goto free; +} + if ((avctx->codec_id == AV_CODEC_ID_H264 || avctx->codec_id == AV_CODEC_ID_H265) && q->skip_frame != MFX_SKIPFRAME_NO_SKIP && -- 2.38.1.windows.1 -- 这封电子邮件已由 Avast 防病毒软件检查过病毒。 www.avast.com ___ 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/2] avcodec/amd: fix pict_type, match it with amf & ffmpeg. add sps pps when frame->keyframe
The frame->key_frame currently doesn't set extra header into frames when using amf encoders. The frame->pict_type is not set to amf picture type, now we force it. Signed-off-by: reito --- libavcodec/amfenc.c | 52 + 1 file changed, 52 insertions(+) diff --git a/libavcodec/amfenc.c b/libavcodec/amfenc.c index 061859f85c..076fecb760 100644 --- a/libavcodec/amfenc.c +++ b/libavcodec/amfenc.c @@ -696,6 +696,58 @@ int ff_amf_receive_packet(AVCodecContext *avctx, AVPacket *avpkt) break; } +// Override Picture Type for Frame +if (avctx->codec->id == AV_CODEC_ID_H264) { +switch (frame->pict_type) { +case AV_PICTURE_TYPE_I: +AMF_ASSIGN_PROPERTY_INT64(res, surface, AMF_VIDEO_ENCODER_FORCE_PICTURE_TYPE, AMF_VIDEO_ENCODER_PICTURE_TYPE_I); +break; +case AV_PICTURE_TYPE_P: +AMF_ASSIGN_PROPERTY_INT64(res, surface, AMF_VIDEO_ENCODER_FORCE_PICTURE_TYPE, AMF_VIDEO_ENCODER_PICTURE_TYPE_P); +break; +case AV_PICTURE_TYPE_B: +AMF_ASSIGN_PROPERTY_INT64(res, surface, AMF_VIDEO_ENCODER_FORCE_PICTURE_TYPE, AMF_VIDEO_ENCODER_PICTURE_TYPE_B); +break; +case AV_PICTURE_TYPE_S: +AMF_ASSIGN_PROPERTY_INT64(res, surface, AMF_VIDEO_ENCODER_FORCE_PICTURE_TYPE, AMF_VIDEO_ENCODER_PICTURE_TYPE_SKIP); +break; +default: +AMF_ASSIGN_PROPERTY_INT64(res, surface, AMF_VIDEO_ENCODER_FORCE_PICTURE_TYPE, AMF_VIDEO_ENCODER_PICTURE_TYPE_NONE); +break; +} +// Keyframe overrides previous assignment. +if (frame->key_frame) { +av_log(ctx, AV_LOG_DEBUG, "IDR,AUD,PPS and SPS set - h264\n"); +AMF_ASSIGN_PROPERTY_INT64(res, surface, AMF_VIDEO_ENCODER_INSERT_SPS, 1); +AMF_ASSIGN_PROPERTY_INT64(res, surface, AMF_VIDEO_ENCODER_INSERT_PPS, 1); +AMF_ASSIGN_PROPERTY_INT64(res, surface, AMF_VIDEO_ENCODER_FORCE_PICTURE_TYPE, AMF_VIDEO_ENCODER_PICTURE_TYPE_IDR); +} +} else if (avctx->codec->id == AV_CODEC_ID_HEVC) { +switch (frame->pict_type) { +case AV_PICTURE_TYPE_I: +AMF_ASSIGN_PROPERTY_INT64(res, surface, AMF_VIDEO_ENCODER_HEVC_FORCE_PICTURE_TYPE, AMF_VIDEO_ENCODER_HEVC_PICTURE_TYPE_I); +break; +case AV_PICTURE_TYPE_P: +AMF_ASSIGN_PROPERTY_INT64(res, surface, AMF_VIDEO_ENCODER_HEVC_FORCE_PICTURE_TYPE, AMF_VIDEO_ENCODER_HEVC_PICTURE_TYPE_P); +break; +case AV_PICTURE_TYPE_B: +av_log(ctx, AV_LOG_WARNING, "Ignoring B-Frame, unsupported by AMD AMF H.265 Encoder."); +break; +case AV_PICTURE_TYPE_S: +AMF_ASSIGN_PROPERTY_INT64(res, surface, AMF_VIDEO_ENCODER_HEVC_FORCE_PICTURE_TYPE, AMF_VIDEO_ENCODER_HEVC_PICTURE_TYPE_SKIP); +break; +default: +AMF_ASSIGN_PROPERTY_INT64(res, surface, AMF_VIDEO_ENCODER_HEVC_FORCE_PICTURE_TYPE, AMF_VIDEO_ENCODER_HEVC_PICTURE_TYPE_NONE); +break; +} +// Keyframe overrides previous assignment. +if (frame->key_frame) { +av_log(ctx, AV_LOG_DEBUG, "IDR,PPS and SPS set - h265\n"); +AMF_ASSIGN_PROPERTY_INT64(res, surface, AMF_VIDEO_ENCODER_HEVC_INSERT_HEADER, 1); +AMF_ASSIGN_PROPERTY_INT64(res, surface, AMF_VIDEO_ENCODER_HEVC_FORCE_PICTURE_TYPE, AMF_VIDEO_ENCODER_HEVC_PICTURE_TYPE_IDR); +} +} + // submit surface res = ctx->encoder->pVtbl->SubmitInput(ctx->encoder, (AMFData*)surface); if (res == AMF_INPUT_FULL) { // handle full queue -- 2.38.1.windows.1 -- 这封电子邮件已由 Avast 防病毒软件检查过病毒。 www.avast.com ___ 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".