[FFmpeg-devel] [PATCH] configure: correct lensfun header function check
The function lf_db_new was deprecated in lensfun 09dcd3e7ad in 2017 in favour of lf_db_create. The AVfilter was adjusted in 8b78eb312d but the configure check wasn't changed. lensfun removed lf_db_new declaration in lf 35c0017593 so configure fails to find lensfun. --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index cd66e42850..9262c1b650 100755 --- a/configure +++ b/configure @@ -6776,7 +6776,7 @@ enabled libjxl&& require_pkg_config libjxl "libjxl >= 0.7.0" jxl/dec require_pkg_config libjxl_threads "libjxl_threads >= 0.7.0" jxl/thread_parallel_runner.h JxlThreadParallelRunner enabled libklvanc && require libklvanc libklvanc/vanc.h klvanc_context_create -lklvanc enabled libkvazaar&& require_pkg_config libkvazaar "kvazaar >= 2.0.0" kvazaar.h kvz_api_get -enabled liblensfun&& require_pkg_config liblensfun lensfun lensfun.h lf_db_new +enabled liblensfun&& require_pkg_config liblensfun lensfun lensfun.h lf_db_create if enabled libmfx && enabled libvpl; then die "ERROR: can not use libmfx and libvpl together" -- 2.39.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] configure: remove Bitrig OS
configure: remove Bitrig OS Bitrig has been defunct for 7 years. Signed-off-by: Brad Smith --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 42786719e9..d96b47ebe5 100755 --- a/configure +++ b/configure @@ -5625,7 +5625,7 @@ case $target_os in oss_outdev_extralibs="-lossaudio" enabled gcc || check_ldflags -Wl,-zmuldefs ;; -openbsd|bitrig) +openbsd) disable symver enable section_data_rel_ro striptype="" -- 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".
[FFmpeg-devel] [PATCH] configure: update copyright year
If anyone else wants to do this, it's fine by me. I did promise to let Paul do it this year, but can't get in touch with him. >From 4b85c208eb97f0a72d8286fd07f973d322ece6b5 Mon Sep 17 00:00:00 2001 From: Lynne Date: Mon, 1 Jan 2024 00:00:00 + Subject: [PATCH] configure: update copyright year --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index cd66e42850..65b4659b0a 100755 --- a/configure +++ b/configure @@ -8045,7 +8045,7 @@ cat > $TMPH <___ 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] libavformat/hlsenc.c: Populate OTI using AAC profile in write_codec_attr.
On Sat, Dec 30, 2023 at 8:23 AM Romain Beauxis wrote: > Le jeu. 28 déc. 2023 à 17:26, David Johansen a > écrit : > >> > >> I love this change, but it appears that st->codecpar->profile is always > AV_PROFILE_UNKNOWN when using libfdk_aac as the encoder. Any indications > where I should look for fix that so this can be used with that encoder? > > > > > > It appears that the issue is that profile doesn't default to what's > being used so `--profile:a` has to be set explicitly with libfdk_aac and > then it works. Not sure if that's an issue worth fixing, but if someone > points me to where it needs to be done, then I'd be glad to take a look at > fixing it > > This feels like a second, separate issue to me? > > Maybe we could get these changes in first and then tackle it? > But this is technically a breaking change, because it takes commands/uses that currently work and changes them to no longer include CODECS since the profile value is unknown by default ___ 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 v2 6/7] lavf/codec2: Silence warnings when either muxer/demuxer is disabled
From f64b4a90ea22421db494d87f5904ae8c7294c871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= Date: Wed, 27 Dec 2023 22:52:25 +0100 Subject: [PATCH 6/7] lavf/codec2: Silence warnings when either muxer/demuxer is disabled --- libavformat/codec2.c | 76 +--- 1 file changed, 43 insertions(+), 33 deletions(-) diff --git a/libavformat/codec2.c b/libavformat/codec2.c index 7447109752..8ff14bc72a 100644 --- a/libavformat/codec2.c +++ b/libavformat/codec2.c @@ -49,6 +49,7 @@ typedef struct { int frames_per_packet; } Codec2Context; +#if CONFIG_CODEC2_DEMUXER static int check_version(uint8_t major, uint8_t minor) { //no .c2 files prior to 0.8 or later than 1.X if (major == MIN_MAJOR_VERSION && minor < MIN_MINOR_VERSION) @@ -69,7 +70,9 @@ static int codec2_probe(const AVProbeData *p) //32 bits of identification -> low score return AVPROBE_SCORE_EXTENSION + 1; } +#endif +#if CONFIG_CODEC2_DEMUXER || CONFIG_CODEC2RAW_DEMUXER //Mimics codec2_samples_per_frame() static int codec2_mode_frame_size(AVFormatContext *s, int mode) { @@ -161,6 +164,41 @@ static int codec2_read_header_common(AVFormatContext *s, AVStream *st, int heade return 0; } +static int codec2_read_packet(AVFormatContext *s, AVPacket *pkt) +{ +Codec2Context *c2 = s->priv_data; +AVStream *st = s->streams[0]; +int ret, size, n, block_align, frame_size; + +block_align = st->codecpar->block_align; +frame_size = st->codecpar->frame_size; + +if (block_align <= 0 || frame_size <= 0 || c2->frames_per_packet <= 0) { +return AVERROR(EINVAL); +} + +//try to read desired number of frames, compute n from to actual number of bytes read +size = c2->frames_per_packet * block_align; +ret = av_get_packet(s->pb, pkt, size); +if (ret < 0) { +return ret; +} + +//only set duration - compute_pkt_fields() and ff_pcm_read_seek() takes care of everything else +//tested by spamming the seek functionality in ffplay +n = ret / block_align; +pkt->duration = n * frame_size; + +//un-mark packet as corrupt if size is a multiple of block_align +//this can happen when frames_per_packet > 1 +if (ret % block_align == 0) +pkt->flags &= ~AV_PKT_FLAG_CORRUPT; + +return ret; +} +#endif + +#if CONFIG_CODEC2_DEMUXER static int codec2_read_header(AVFormatContext *s) { AVStream *st = avformat_new_stream(s, NULL); @@ -197,40 +235,9 @@ static int codec2_read_header(AVFormatContext *s) return codec2_read_header_common(s, st, CODEC2_HEADER_SIZE); } +#endif -static int codec2_read_packet(AVFormatContext *s, AVPacket *pkt) -{ -Codec2Context *c2 = s->priv_data; -AVStream *st = s->streams[0]; -int ret, size, n, block_align, frame_size; - -block_align = st->codecpar->block_align; -frame_size = st->codecpar->frame_size; - -if (block_align <= 0 || frame_size <= 0 || c2->frames_per_packet <= 0) { -return AVERROR(EINVAL); -} - -//try to read desired number of frames, compute n from to actual number of bytes read -size = c2->frames_per_packet * block_align; -ret = av_get_packet(s->pb, pkt, size); -if (ret < 0) { -return ret; -} - -//only set duration - compute_pkt_fields() and ff_pcm_read_seek() takes care of everything else -//tested by spamming the seek functionality in ffplay -n = ret / block_align; -pkt->duration = n * frame_size; - -//un-mark packet as corrupt if size is a multiple of block_align -//this can happen when frames_per_packet > 1 -if (ret % block_align == 0) -pkt->flags &= ~AV_PKT_FLAG_CORRUPT; - -return ret; -} - +#if CONFIG_CODEC2_MUXER static int codec2_write_header(AVFormatContext *s) { AVStream *st; @@ -253,7 +260,9 @@ static int codec2_write_header(AVFormatContext *s) return 0; } +#endif +#if CONFIG_CODEC2RAW_DEMUXER static int codec2raw_read_header(AVFormatContext *s) { Codec2Context *c2 = s->priv_data; @@ -280,6 +289,7 @@ static int codec2raw_read_header(AVFormatContext *s) return codec2_read_header_common(s, st, 0); } +#endif //transcoding report2074.c2 to wav went from 7.391s to 5.322s with -frames_per_packet 1000 compared to default, same sha1sum #define FRAMES_PER_PACKET \ -- 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 v2 5/7] lavf/codec2: Multiple of block_align -> not corrupt
From 74302cd9f6f213b81e3bbc8a3547b518db41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= Date: Wed, 27 Dec 2023 22:50:18 +0100 Subject: [PATCH 5/7] lavf/codec2: Multiple of block_align -> not corrupt --- libavformat/codec2.c | 5 + 1 file changed, 5 insertions(+) diff --git a/libavformat/codec2.c b/libavformat/codec2.c index 8299302acc..7447109752 100644 --- a/libavformat/codec2.c +++ b/libavformat/codec2.c @@ -223,6 +223,11 @@ static int codec2_read_packet(AVFormatContext *s, AVPacket *pkt) n = ret / block_align; pkt->duration = n * frame_size; +//un-mark packet as corrupt if size is a multiple of block_align +//this can happen when frames_per_packet > 1 +if (ret % block_align == 0) +pkt->flags &= ~AV_PKT_FLAG_CORRUPT; + return ret; } -- 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 v2 4/7] lavf/codec2: Allow versions between 0.8 and 1.X
From 5a660d91c2f34c4e464212bf3694cdb7bca80f1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= Date: Wed, 27 Dec 2023 17:33:18 +0100 Subject: [PATCH 4/7] lavf/codec2: Allow versions between 0.8 and 1.X --- libavformat/codec2.c | 36 ++-- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/libavformat/codec2.c b/libavformat/codec2.c index 78bc339209..8299302acc 100644 --- a/libavformat/codec2.c +++ b/libavformat/codec2.c @@ -37,8 +37,11 @@ //the lowest version we should ever run across is 0.8 //we may run across later versions as the format evolves -#define EXPECTED_CODEC2_MAJOR_VERSION 0 -#define EXPECTED_CODEC2_MINOR_VERSION 8 +#define MIN_MAJOR_VERSION 0 +#define MIN_MINOR_VERSION 8 +//accept any minor version with major version 1.X +//as of writing the latest release is 1.2.0 +#define MAX_MAJOR_VERSION 1 typedef struct { const AVClass *class; @@ -46,17 +49,20 @@ typedef struct { int frames_per_packet; } Codec2Context; +static int check_version(uint8_t major, uint8_t minor) { +//no .c2 files prior to 0.8 or later than 1.X +if (major == MIN_MAJOR_VERSION && minor < MIN_MINOR_VERSION) +return 1; +if (major > MAX_MAJOR_VERSION) +return 1; +return 0; +} + static int codec2_probe(const AVProbeData *p) { //must start wih C0 DE C2 -if (AV_RB24(p->buf) != CODEC2_MAGIC) { -return 0; -} - -//no .c2 files prior to 0.8 -//be strict about major version while we're at it -if (p->buf[3] != EXPECTED_CODEC2_MAJOR_VERSION || -p->buf[4] < EXPECTED_CODEC2_MINOR_VERSION) { +if (AV_RB24(p->buf) != CODEC2_MAGIC || +check_version(p->buf[3], p->buf[4])) { return 0; } @@ -158,7 +164,8 @@ static int codec2_read_header_common(AVFormatContext *s, AVStream *st, int heade static int codec2_read_header(AVFormatContext *s) { AVStream *st = avformat_new_stream(s, NULL); -int ret, version; +int ret; +uint8_t major, minor; if (!st) { return AVERROR(ENOMEM); @@ -179,9 +186,10 @@ static int codec2_read_header(AVFormatContext *s) return ret; } -version = AV_RB16(st->codecpar->extradata); -if ((version >> 8) != EXPECTED_CODEC2_MAJOR_VERSION) { -avpriv_report_missing_feature(s, "Major version %i", version >> 8); +major = st->codecpar->extradata[0]; +minor = st->codecpar->extradata[1]; +if (check_version(major, minor)) { +avpriv_report_missing_feature(s, "Version %i.%i", major, minor); return AVERROR_PATCHWELCOME; } -- 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 v2 3/7] lavf/codec2: Compute duration from filesize
Previous version accidentally used CODEC2_EXTRADATA_SIZE not CODEC2_HEADER_SIZE /Tomas From 6fda817b2bc237081e6bf6daeff9087b6543647b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= Date: Wed, 27 Dec 2023 16:32:49 +0100 Subject: [PATCH 3/7] lavf/codec2: Compute duration from filesize --- libavformat/codec2.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/libavformat/codec2.c b/libavformat/codec2.c index 1d6ef2a14a..78bc339209 100644 --- a/libavformat/codec2.c +++ b/libavformat/codec2.c @@ -124,9 +124,10 @@ static int codec2_mode_bit_rate(AVFormatContext *s, int mode) return 8 * 8000 * block_align / frame_size; } -static int codec2_read_header_common(AVFormatContext *s, AVStream *st) +static int codec2_read_header_common(AVFormatContext *s, AVStream *st, int header) { int mode = codec2_mode_from_extradata(st->codecpar->extradata); +int64_t sz = avio_size(s->pb); st->codecpar->codec_type= AVMEDIA_TYPE_AUDIO; st->codecpar->codec_id = AV_CODEC_ID_CODEC2; @@ -143,6 +144,12 @@ static int codec2_read_header_common(AVFormatContext *s, AVStream *st) return AVERROR_INVALIDDATA; } +// compute duration from filesize +if (sz >= header) { +int64_t frames = (sz - header) / st->codecpar->block_align; +if (frames <= INT64_MAX / st->codecpar->frame_size) +st->duration = frames * st->codecpar->frame_size; +} avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate); return 0; @@ -180,7 +187,7 @@ static int codec2_read_header(AVFormatContext *s) ffformatcontext(s)->data_offset = CODEC2_HEADER_SIZE; -return codec2_read_header_common(s, st); +return codec2_read_header_common(s, st, CODEC2_HEADER_SIZE); } static int codec2_read_packet(AVFormatContext *s, AVPacket *pkt) @@ -258,7 +265,7 @@ static int codec2raw_read_header(AVFormatContext *s) codec2_make_extradata(st->codecpar->extradata, c2->mode); -return codec2_read_header_common(s, st); +return codec2_read_header_common(s, st, 0); } //transcoding report2074.c2 to wav went from 7.391s to 5.322s with -frames_per_packet 1000 compared to default, same sha1sum -- 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 v2 2/7] lavc/libcodec2: Report actual bitrate used both when decoding and encoding
Without this it looks like the encoder runs at 128 kbit/s /Tomas From 5c913a3eaf5cf8c21edc119870b7fdc8251bd900 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= Date: Fri, 29 Dec 2023 14:09:51 +0100 Subject: [PATCH 2/7] lavc/libcodec2: Report actual bitrate used both when decoding and encoding --- libavcodec/libcodec2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/libcodec2.c b/libavcodec/libcodec2.c index 950d48685e..2e03236b81 100644 --- a/libavcodec/libcodec2.c +++ b/libavcodec/libcodec2.c @@ -72,6 +72,7 @@ static av_cold int libcodec2_init_common(AVCodecContext *avctx, int mode) } codec2_set_natural_or_gray(c2->codec, 1); +avctx->bit_rate = avctx->sample_rate / avctx->frame_size * avctx->block_align * 8; return 0; -- 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 v2 1/7] lavc/codec2utils: Use actual libcodec2 version
Should compile without libcodec2 installed now /Tomas From 098a3b7e78dc0b1bbdfce051de21526f0a886b4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= Date: Wed, 27 Dec 2023 17:32:21 +0100 Subject: [PATCH 1/7] lavc/codec2utils: Use actual libcodec2 version --- libavcodec/codec2utils.h | 17 ++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/libavcodec/codec2utils.h b/libavcodec/codec2utils.h index 6812ae895c..e1314b05b6 100644 --- a/libavcodec/codec2utils.h +++ b/libavcodec/codec2utils.h @@ -23,6 +23,10 @@ #define AVCODEC_CODEC2UTILS_H #include +#include "config.h" +#if CONFIG_LIBCODEC2 +#include +#endif //Highest mode we're willing to use. //Don't want to let users accidentally produce files that can't be decoded in the future. @@ -49,9 +53,16 @@ //Used in codec2raw demuxer and libcodec2 encoder static inline void codec2_make_extradata(uint8_t *ptr, int mode) { -//version 0.8 as of 2017-12-23 (r3386) -ptr[0] = 0; //major -ptr[1] = 8; //minor +#if CONFIG_LIBCODEC2 +ptr[0] = CODEC2_VERSION_MAJOR; +ptr[1] = CODEC2_VERSION_MINOR; +#else +// this codepath is only hit when demuxing raw codec2 with libcodec2 disabled, +// and only relevant when remuxing from raw codec2 to .c2, +// because version information is ignored except when writing the .c2 header +ptr[0] = 1; // version 1.2.0 is the latest we know of +ptr[1] = 2; +#endif ptr[2] = mode; //mode ptr[3] = 0; //flags } -- 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 v2 6/6] Add myself as APC maintainer
From 65f4215a519e457d6a3d6c943d14ebd739083eed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= Date: Tue, 26 Dec 2023 16:45:33 +0100 Subject: [PATCH 6/6] Add myself as APC maintainer --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 9c4683db19..fa98e043c5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -391,6 +391,7 @@ Muxers/Demuxers: aiffenc.c Baptiste Coudurier, Matthieu Bouron alp.c Zane van Iperen amvenc.c Zane van Iperen + apc* Tomas Härdin apm.c Zane van Iperen apngdec.c Benoit Fouet argo_asf.cZane van Iperen -- 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 v2 5/6] lavc: Add ADPCM IMA CRYO APC encoder
From 701eec2a7e742fa0fcc375a6c3784ac012100d0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= Date: Tue, 26 Dec 2023 14:32:20 +0100 Subject: [PATCH 5/6] lavc: Add ADPCM IMA CRYO APC encoder No trellis quantization yet --- Changelog | 1 + doc/general_contents.texi | 2 +- libavcodec/adpcmenc.c | 33 + libavcodec/allcodecs.c | 1 + libavcodec/version.h | 2 +- tests/fate/acodec.mak | 2 ++ tests/ref/acodec/adpcm-ima_apc | 4 7 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 tests/ref/acodec/adpcm-ima_apc diff --git a/Changelog b/Changelog index 31c9e25be6..586ccd1a9c 100644 --- a/Changelog +++ b/Changelog @@ -14,6 +14,7 @@ version : - D3D12VA hardware accelerated H264, HEVC, VP9, AV1, MPEG-2 and VC1 decoding - tiltandshift filter - CRYO APC muxer +- ADPCM IMA APC encoder version 6.1: - libaribcaption decoder diff --git a/doc/general_contents.texi b/doc/general_contents.texi index df31edd060..9f450dc794 100644 --- a/doc/general_contents.texi +++ b/doc/general_contents.texi @@ -1188,7 +1188,7 @@ following image formats are supported: @item ADPCM IMA Acorn Replay @tab @tab X @item ADPCM IMA AMV @tab X @tab X @tab Used in AMV files -@item ADPCM IMA APC @tab @tab X +@item ADPCM IMA APC @tab X @tab X @tab Codec used in games by Cryo Interactive @item ADPCM IMA Cunning Developments @tab @tab X @item ADPCM IMA Electronic Arts EACS @tab @tab X diff --git a/libavcodec/adpcmenc.c b/libavcodec/adpcmenc.c index 7f18fc2daf..7abd71541d 100644 --- a/libavcodec/adpcmenc.c +++ b/libavcodec/adpcmenc.c @@ -74,6 +74,7 @@ typedef struct ADPCMEncodeContext { TrellisNode *node_buf; TrellisNode **nodep_buf; uint8_t *trellis_hash; +int extradata_updated; } ADPCMEncodeContext; #define FREEZE_INTERVAL 128 @@ -157,6 +158,15 @@ static av_cold int adpcm_encode_init(AVCodecContext *avctx) bytestream_put_le16(&extradata, ff_adpcm_AdaptCoeff2[i] * 4); } ) /* End of CASE */ +CASE(ADPCM_IMA_APC, +if (avctx->trellis) { +av_log(avctx, AV_LOG_ERROR, "trellis encoding not implemented for CRYO APC\n"); +return AVERROR_PATCHWELCOME; +} +//extradata will be output in adpcm_encode_frame() +avctx->frame_size = s->block_size * 2 / channels; +avctx->block_align = s->block_size; +) /* End of CASE */ CASE(ADPCM_YAMAHA, avctx->frame_size = s->block_size * 2 / channels; avctx->block_align = s->block_size; @@ -622,6 +632,28 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, dst = avpkt->data; switch(avctx->codec->id) { +CASE(ADPCM_IMA_APC, +//initialize predictors using initial samples +if (!c->extradata_updated) { +uint8_t *side_data = av_packet_new_side_data( +avpkt, AV_PKT_DATA_NEW_EXTRADATA, 8); + +if (!side_data) { +return AVERROR(ENOMEM); +} + +for (int ch = 0; ch < channels; ch++) { +c->status[ch].prev_sample = samples[ch]; +bytestream_put_le32(&side_data, c->status[ch].prev_sample); +} +c->extradata_updated = 1; +} +for (int i = 0; i < frame->nb_samples*channels/2; i++) { +uint8_t l = adpcm_ima_compress_sample(&c->status[0], samples[2*i+0]); +uint8_t r = adpcm_ima_compress_sample(&c->status[st], samples[2*i+1]); +*dst++ = (l<<4) | r; +} +) /* End of CASE */ CASE(ADPCM_IMA_WAV, int blocks = (frame->nb_samples - 1) / 8; @@ -1027,6 +1059,7 @@ ADPCM_ENCODER(ADPCM_IMA_QT, adpcm_ima_qt, sample_fmts_p, 0, ADPCM_ENCODER(ADPCM_IMA_SSI, adpcm_ima_ssi, sample_fmts, AV_CODEC_CAP_SMALL_LAST_FRAME, "ADPCM IMA Simon & Schuster Interactive") ADPCM_ENCODER(ADPCM_IMA_WAV, adpcm_ima_wav, sample_fmts_p, 0, "ADPCM IMA WAV") ADPCM_ENCODER(ADPCM_IMA_WS, adpcm_ima_ws, sample_fmts, AV_CODEC_CAP_SMALL_LAST_FRAME, "ADPCM IMA Westwood") +ADPCM_ENCODER(ADPCM_IMA_APC, adpcm_ima_apc, sample_fmts, 0, "ADPCM IMA CRYO APC") ADPCM_ENCODER(ADPCM_MS, adpcm_ms, sample_fmts, 0, "ADPCM Microsoft") ADPCM_ENCODER(ADPCM_SWF, adpcm_swf, sample_fmts, 0, "ADPCM Shockwave Flash") ADPCM_ENCODER(ADPCM_YAMAHA, adpcm_yamaha, sample_fmts, 0, "ADPCM Yamaha") diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index b0f004e15c..34662a88f3 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -669,6 +669,7 @@ extern const FFCodec ff_adpcm_ima_amv_encoder; extern const FFCodec ff_adpcm_ima_alp_decoder; extern const FFCodec ff_adpcm_ima_alp_encoder; extern const F
[FFmpeg-devel] [PATCH v2 4/6] lavf: Add CRYO APC muxer
From 1fab30dea9528478ccbe78dc68a3933acb8115b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= Date: Tue, 26 Dec 2023 14:32:10 +0100 Subject: [PATCH 4/6] lavf: Add CRYO APC muxer --- Changelog | 1 + doc/general_contents.texi | 2 +- libavformat/Makefile | 1 + libavformat/allformats.c | 1 + libavformat/apcenc.c | 129 ++ libavformat/version.h | 2 +- 6 files changed, 134 insertions(+), 2 deletions(-) create mode 100644 libavformat/apcenc.c diff --git a/Changelog b/Changelog index a638c03250..31c9e25be6 100644 --- a/Changelog +++ b/Changelog @@ -13,6 +13,7 @@ version : - IAMF raw demuxer and muxer - D3D12VA hardware accelerated H264, HEVC, VP9, AV1, MPEG-2 and VC1 decoding - tiltandshift filter +- CRYO APC muxer version 6.1: - libaribcaption decoder diff --git a/doc/general_contents.texi b/doc/general_contents.texi index ec7516dce8..df31edd060 100644 --- a/doc/general_contents.texi +++ b/doc/general_contents.texi @@ -464,7 +464,7 @@ library: @item CRC testing format@tab X @tab @item Creative Voice@tab X @tab X @tab Created for the Sound Blaster Pro. -@item CRYO APC @tab @tab X +@item CRYO APC @tab X @tab X @tab Audio format used in some games by CRYO Interactive Entertainment. @item D-Cinema audio@tab X @tab X @item Deluxe Paint Animation@tab @tab X diff --git a/libavformat/Makefile b/libavformat/Makefile index 581e378d95..f605f4ae69 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -105,6 +105,7 @@ OBJS-$(CONFIG_AMV_MUXER) += amvenc.o OBJS-$(CONFIG_ANM_DEMUXER) += anm.o OBJS-$(CONFIG_APAC_DEMUXER) += apac.o rawdec.o OBJS-$(CONFIG_APC_DEMUXER) += apc.o +OBJS-$(CONFIG_APC_MUXER) += apcenc.o OBJS-$(CONFIG_APE_DEMUXER) += ape.o apetag.o img2.o OBJS-$(CONFIG_APM_DEMUXER) += apm.o OBJS-$(CONFIG_APM_MUXER) += apm.o rawenc.o diff --git a/libavformat/allformats.c b/libavformat/allformats.c index ce6be5f04d..18a33d7448 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -60,6 +60,7 @@ extern const FFOutputFormat ff_amv_muxer; extern const AVInputFormat ff_anm_demuxer; extern const AVInputFormat ff_apac_demuxer; extern const AVInputFormat ff_apc_demuxer; +extern const FFOutputFormat ff_apc_muxer; extern const AVInputFormat ff_ape_demuxer; extern const AVInputFormat ff_apm_demuxer; extern const FFOutputFormat ff_apm_muxer; diff --git a/libavformat/apcenc.c b/libavformat/apcenc.c new file mode 100644 index 00..7c7f3a1f26 --- /dev/null +++ b/libavformat/apcenc.c @@ -0,0 +1,129 @@ +/* + * CRYO APC audio format muxer + * Copyright (c) 2023 Tomas Härdin + * + * 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 "avio_internal.h" +#include "internal.h" +#include "mux.h" + +#define APC_HEADER_SIZE (8*4) + +static int apc_write_header(AVFormatContext *s) +{ +AVCodecParameters *par; +AVStream *st; + +if (s->nb_streams != 1) { +av_log(s, AV_LOG_ERROR, "Must have exactly one stream\n"); +return AVERROR(EINVAL); +} + +st = s->streams[0]; +par = st->codecpar; + +if (par->ch_layout.nb_channels <= 0 || par->ch_layout.nb_channels > 2) { +av_log(s, AV_LOG_ERROR, "Must be mono or stereo\n"); +return AVERROR(EINVAL); +} + +avpriv_set_pts_info(st, 64, 1, par->sample_rate); +// delay writing the actual header until we get extradata from the encoder +return 0; +} + +static int apc_write_header_delayed(AVFormatContext *s, AVPacket *pkt) +{ +AVIOContext *pb = s->pb; +AVCodecParameters *par = s->streams[0]->codecpar; +size_t new_extradata_size = 0, extradata_size; +const uint8_t *new_extradata = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &new_extradata_size), *extradata; + +// prefer updated extradata from the encoder +if (new_extradata) { +extradata_size = new_extradata_size; +extradata = new_extradata; +} else { +extradata_size = par->extradata_size; +extradata = par->extradata; +} + +if (extradata_size
[FFmpeg-devel] [PATCH v2 3/6] Un-mark IMA APC as intra-only, only mark first packet as keyframe
From f652daf2e9bad345c0e98ab058a5e07c3d45d13e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= Date: Tue, 26 Dec 2023 16:30:35 +0100 Subject: [PATCH 3/6] Un-mark IMA APC as intra-only, only mark first packet as keyframe Packets must be decoded in order. There is no way to seek and get a bitexact decode. --- libavcodec/codec_desc.c | 2 +- libavformat/apc.c | 5 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c index 033344304c..45ef4c5091 100644 --- a/libavcodec/codec_desc.c +++ b/libavcodec/codec_desc.c @@ -2431,7 +2431,7 @@ static const AVCodecDescriptor codec_descriptors[] = { .type = AVMEDIA_TYPE_AUDIO, .name = "adpcm_ima_apc", .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA CRYO APC"), -.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, +.props = AV_CODEC_PROP_LOSSY, }, { .id= AV_CODEC_ID_ADPCM_VIMA, diff --git a/libavformat/apc.c b/libavformat/apc.c index 7765c53088..d1891954a8 100644 --- a/libavformat/apc.c +++ b/libavformat/apc.c @@ -75,8 +75,13 @@ static int apc_read_header(AVFormatContext *s) static int apc_read_packet(AVFormatContext *s, AVPacket *pkt) { +int first = avio_tell(s->pb) == 32; if (av_get_packet(s->pb, pkt, MAX_READ_SIZE) <= 0) return AVERROR(EIO); +// each IMA APC packet depends on the one before for bitexact decode +// extradata is used to initialize the decoder +if (first) +pkt->flags |= AV_PKT_FLAG_KEY; pkt->stream_index = 0; return 0; } -- 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 v2 2/6] lavf/apc: Read duration from file
From 2ef5c89c3e3173b26690bad0279fd484a30a6268 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= Date: Tue, 26 Dec 2023 14:31:59 +0100 Subject: [PATCH 2/6] lavf/apc: Read duration from file --- libavformat/apc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/apc.c b/libavformat/apc.c index b8b18c966c..7765c53088 100644 --- a/libavformat/apc.c +++ b/libavformat/apc.c @@ -24,6 +24,7 @@ #include "libavutil/channel_layout.h" #include "avformat.h" #include "demux.h" +#include "internal.h" static int apc_probe(const AVProbeData *p) { @@ -51,8 +52,9 @@ static int apc_read_header(AVFormatContext *s) st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; st->codecpar->codec_id = AV_CODEC_ID_ADPCM_IMA_APC; -avio_rl32(pb); /* number of samples */ +st->duration = avio_rl32(pb); /* number of samples */ st->codecpar->sample_rate = avio_rl32(pb); +avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate); /* initial predictor values for adpcm decoder */ if ((ret = ff_get_extradata(s, st->codecpar, pb, 2 * 4)) < 0) -- 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 v2 1/6] doc/general_contents.texi: Add missing ADPCM IMA APC entry
Addressed some comments and reordered some patches /Tomas From 90954f54d82bd0ceda0400ceb0e92e1affecf3db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= Date: Tue, 26 Dec 2023 15:03:51 +0100 Subject: [PATCH 1/6] doc/general_contents.texi: Add missing ADPCM IMA APC entry --- doc/general_contents.texi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/general_contents.texi b/doc/general_contents.texi index 8b48fed060..ec7516dce8 100644 --- a/doc/general_contents.texi +++ b/doc/general_contents.texi @@ -1188,6 +1188,8 @@ following image formats are supported: @item ADPCM IMA Acorn Replay @tab @tab X @item ADPCM IMA AMV @tab X @tab X @tab Used in AMV files +@item ADPCM IMA APC @tab @tab X +@tab Codec used in games by Cryo Interactive @item ADPCM IMA Cunning Developments @tab @tab X @item ADPCM IMA Electronic Arts EACS @tab @tab X @item ADPCM IMA Electronic Arts SEAD @tab @tab X -- 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".
Re: [FFmpeg-devel] [PATCH 1/4] avfilter/avf_showwaves: Check history_nb_samples
On Sat, Dec 30, 2023 at 03:49:02AM +0100, Michael Niedermayer wrote: > Fixes: out of array access > Fixes: tickets/10756/poc18ffmpeg > > Discovered by Zeng Yunxiang > Signed-off-by: Michael Niedermayer > --- > libavfilter/avf_showwaves.c | 2 ++ > 1 file changed, 2 insertions(+) will apply patchset, so the fixes can go in 6.1.1 thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The real ebay dictionary, page 2 "100% positive feedback" - "All either got their money back or didnt complain" "Best seller ever, very honest" - "Seller refunded buyer after failed scam" 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 3/6] Add CRYO APC muxer
fre 2023-12-29 klockan 18:33 +0100 skrev Michael Niedermayer: > On Thu, Dec 28, 2023 at 11:31:05AM +0100, Tomas Härdin wrote: > > tis 2023-12-26 klockan 23:30 +0100 skrev Michael Niedermayer: > > > Hi > > > > > > On Tue, Dec 26, 2023 at 04:52:47PM +0100, Tomas Härdin wrote: > > > > > > > > > > [...] > > > > + > > > > +static int apc_write_header(AVFormatContext *s) > > > > +{ > > > > + AVIOContext *pb = s->pb; > > > > + AVCodecParameters *par; > > > > + AVStream *st; > > > > + > > > > + if (s->nb_streams != 1) { > > > > + av_log(s, AV_LOG_ERROR, "Must have exactly one > > > > stream\n"); > > > > + return AVERROR(EINVAL); > > > > + } > > > > + > > > > + st = s->streams[0]; > > > > + par = st->codecpar; > > > > + > > > > + if (par->ch_layout.nb_channels <= 0 || par- > > > > > ch_layout.nb_channels > 2) { > > > > + av_log(s, AV_LOG_ERROR, "Must be mono or stereo\n"); > > > > + return AVERROR(EINVAL); > > > > + } > > > > + > > > > + if (par->extradata_size != 0 && par->extradata_size != 8) > > > > { > > > > + av_log(s, AV_LOG_ERROR, > > > > + "Must have exactly 0 or 8 bytes of extradata, got > > > > %i\n", > > > > + par->extradata_size); > > > > + return AVERROR(EINVAL); > > > > + } > > > > + > > > > + ffio_wfourcc(pb, "CRYO"); > > > > + ffio_wfourcc(pb, "_APC"); > > > > + ffio_wfourcc(pb, "1.20"); > > > > > > > + avio_wl32(pb, 0); // number or samples > > > > > > please add to the comment "updated in apc_write_trailer()" > > > > Sure > > > > > > > > +static int apc_write_packet(AVFormatContext *s, AVPacket *pkt) > > > > +{ > > > > + size_t extradata_size = 0; > > > > > > > + const uint8_t *extradata = av_packet_get_side_data( > > > > + pkt, AV_PKT_DATA_NEW_EXTRADATA, &extradata_size); > > > > + > > > > + if (extradata_size == 8) { > > > > + // we got predictors from encoder > > > > + // try to seek back end write them > > > > + int64_t pos = avio_tell(s->pb), err; > > > > + if ((err = avio_seek(s->pb, 20, SEEK_SET)) >= 0) { > > > > + avio_write(s->pb, extradata, extradata_size); > > > > + avio_seek(s->pb, pos, SEEK_SET); > > > > + } else { > > > > + av_log(s, AV_LOG_ERROR, "Got predictors from > > > > encoder > > > > but couldn't seek back to write them\n"); > > > > + // fail since we should always be able to do this > > > > within the avio cache > > > > + // unless the encoder gave us predictors way too > > > > late > > > > for some reason > > > > + return err; > > > > + } > > > > + } > > > > > > I think the encoder should buffer data or use 2 passes > > > if it needs future data. seeking back in the muxer is a bit odd. > > > > > > if it becomes available always in teh first packet then maybe the > > > whole header could be written in the first packet > > > > Good idea. IIRC the issue was that extradata is either given > > immediately (remuxing) or after a single-packet delay (encoding), > > hence > > the check for *new* metadata > > > > > I would suggest, you add APC support to nut. > > > Thats a good test to ensure the packet and extradata is set at > > > the > > > right time > > > for a generic muxer > > > > How would I go about doing that? > > nut mainly needs to be able to map the ffmpeg API CODEC_ID to some > external id > so the codec id needs to be in one of the table nut scans for it I doubt this codec has an official RIFF TwoCC. I see some other IMA codecs in riff.c though. I suspect this would require coordinating with Microsoft, which I feel shouldn't hold up this patchset /Tomas ___ 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] lavc/svq1enc: R-V V ssd_int8_vs_int16
I mistook it, seeing the vector length as the length of the vector register .. I have modified it in this reply. Rémi Denis-Courmont 于2023年12月30日周六 20:15写道: > > > Le 29 décembre 2023 12:57:20 GMT+01:00, flow gg a > écrit : > >C908 > >ssd_int8_vs_int16_c: 207.7 > >ssd_int8_vs_int16_rvv_i32: 28.0 > > At a quick glance, it won't work if the input length is not a multiple of > the vector length. > > Also do you really need to extend accumulators to 32 bits? > ___ > 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 ffa495739e163a402bd580ddbdd54a42e1ef6712 Mon Sep 17 00:00:00 2001 From: sunyuechi Date: Fri, 29 Dec 2023 13:27:31 +0800 Subject: [PATCH 3/3] lavc/svq1enc: R-V V ssd_int8_vs_int16 C908 ssd_int8_vs_int16_c: 207.7 ssd_int8_vs_int16_rvv_i32: 17.7 --- libavcodec/riscv/Makefile | 2 ++ libavcodec/riscv/svqenc_init.c | 41 +++ libavcodec/riscv/svqenc_rvv.S | 44 ++ libavcodec/svq1enc.c | 2 ++ libavcodec/svq1encdsp.h| 1 + 5 files changed, 90 insertions(+) create mode 100644 libavcodec/riscv/svqenc_init.c create mode 100644 libavcodec/riscv/svqenc_rvv.S diff --git a/libavcodec/riscv/Makefile b/libavcodec/riscv/Makefile index 7f253bba12..4e14c3d094 100644 --- a/libavcodec/riscv/Makefile +++ b/libavcodec/riscv/Makefile @@ -46,6 +46,8 @@ RVV-OBJS-$(CONFIG_OPUS_DECODER) += riscv/opusdsp_rvv.o OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_init.o RV-OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_rvi.o RVV-OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_rvv.o +OBJS-$(CONFIG_SVQ1_ENCODER) += riscv/svqenc_init.o +RVV-OBJS-$(CONFIG_SVQ1_ENCODER) += riscv/svqenc_rvv.o OBJS-$(CONFIG_TAK_DECODER) += riscv/takdsp_init.o RVV-OBJS-$(CONFIG_TAK_DECODER) += riscv/takdsp_rvv.o OBJS-$(CONFIG_UTVIDEO_DECODER) += riscv/utvideodsp_init.o diff --git a/libavcodec/riscv/svqenc_init.c b/libavcodec/riscv/svqenc_init.c new file mode 100644 index 00..f4c398960c --- /dev/null +++ b/libavcodec/riscv/svqenc_init.c @@ -0,0 +1,41 @@ +/* + * 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/attributes.h" +#include "libavutil/cpu.h" +#include "libavcodec/svq1encdsp.h" + +int ff_ssd_int8_vs_int16_rvv(const int8_t *pix1, const int16_t *pix2, + intptr_t size); + +av_cold void ff_svq1enc_init_riscv(SVQ1EncDSPContext *c) +{ +#if HAVE_RVV +int flags = av_get_cpu_flags(); + +if (flags & AV_CPU_FLAG_RVV_I32) { +if (flags & AV_CPU_FLAG_RVB_ADDR) { +c->ssd_int8_vs_int16 = ff_ssd_int8_vs_int16_rvv; +} +} +#endif +} diff --git a/libavcodec/riscv/svqenc_rvv.S b/libavcodec/riscv/svqenc_rvv.S new file mode 100644 index 00..985bab81a0 --- /dev/null +++ b/libavcodec/riscv/svqenc_rvv.S @@ -0,0 +1,44 @@ +/* + * 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" + +func ff_ssd_int8_vs_int16_rvv, zve32x +vsetvli t0, zero, e32, m8, ta, ma +vmv.v.x v24, zero +1: +vsetvli t0, a2, e8, m2, tu, ma +vle8.v v0, (a0) +sub a2, a2, t0 +vset
Re: [FFmpeg-devel] [PATCH 1/6] lavc/codec2utils: Use actual libcodec2 version
fre 2023-12-29 klockan 00:30 +0100 skrev Michael Niedermayer: > On Thu, Dec 28, 2023 at 10:21:23PM +0100, Tomas Härdin wrote: > > tor 2023-12-28 klockan 21:29 +0100 skrev Michael Niedermayer: > > > On Thu, Dec 28, 2023 at 07:43:09PM +0100, Tomas Härdin wrote: > > > > libcodec2 has reached 1.X so it's about time the bindings > > > > receive > > > > some > > > > attention. This patchset also includes some much-needed tests. > > > > Where do > > > > I submit files for inclusion in FATE again? They are very small > > > > as > > > > is > > > > to be expected from a codec that runs at 700-3200 bit/s > > > > > > > > /Tomas > > > > > > > codec2utils.h | 6 +++--- > > > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > a79a98f8ffc27ca6d79c9d373957fa0bdc985ef2 0001-lavc- > > > > codec2utils- > > > > Use-actual-libcodec2-version.patch > > > > From 7205e741aaadc354b403010c97f9cd803eec612d Mon Sep 17 > > > > 00:00:00 > > > > 2001 > > > > From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= > > > > Date: Wed, 27 Dec 2023 17:32:21 +0100 > > > > Subject: [PATCH 1/6] lavc/codec2utils: Use actual libcodec2 > > > > version > > > > > > This breaks build here > > > > > > CC libavformat/codec2.o > > > In file included from libavformat/codec2.c:24:0: > > > ./libavcodec/codec2utils.h:26:10: fatal error: codec2/version.h: > > > No > > > such file or directory > > > #include > > > ^~ > > > > What version of libcodec2 are you using? I don't think we can rely > > on > > versions that don't expose version information, which only comes > > about > > because I explicitly told them to please expose it in a header. I > > don't > > think we can even probe version at configure time otherwise. > > > > libcodec2-dev on Debian bookworm works for me > > i think theres no libcodec2* on the box and this header is used > outside > checks for libcodec2* ... Updated patch attached /Tomas From 098a3b7e78dc0b1bbdfce051de21526f0a886b4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= Date: Wed, 27 Dec 2023 17:32:21 +0100 Subject: [PATCH 1/7] lavc/codec2utils: Use actual libcodec2 version --- libavcodec/codec2utils.h | 17 ++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/libavcodec/codec2utils.h b/libavcodec/codec2utils.h index 6812ae895c..e1314b05b6 100644 --- a/libavcodec/codec2utils.h +++ b/libavcodec/codec2utils.h @@ -23,6 +23,10 @@ #define AVCODEC_CODEC2UTILS_H #include +#include "config.h" +#if CONFIG_LIBCODEC2 +#include +#endif //Highest mode we're willing to use. //Don't want to let users accidentally produce files that can't be decoded in the future. @@ -49,9 +53,16 @@ //Used in codec2raw demuxer and libcodec2 encoder static inline void codec2_make_extradata(uint8_t *ptr, int mode) { -//version 0.8 as of 2017-12-23 (r3386) -ptr[0] = 0; //major -ptr[1] = 8; //minor +#if CONFIG_LIBCODEC2 +ptr[0] = CODEC2_VERSION_MAJOR; +ptr[1] = CODEC2_VERSION_MINOR; +#else +// this codepath is only hit when demuxing raw codec2 with libcodec2 disabled, +// and only relevant when remuxing from raw codec2 to .c2, +// because version information is ignored except when writing the .c2 header +ptr[0] = 1; // version 1.2.0 is the latest we know of +ptr[1] = 2; +#endif ptr[2] = mode; //mode ptr[3] = 0; //flags } -- 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".
Re: [FFmpeg-devel] [PATCH 3/3] lavc/svq1enc: R-V V ssd_int8_vs_int16
Le 30 décembre 2023 15:00:53 GMT+01:00, flow gg a écrit : >> At a quick glance, it won't work if the input length is not a multiple of >the vector length. > >Why? You're not handling tails as far as I see. > I tried 1024, 32*3, 32*7 and all passed the test. They're all multiples of the vector length. >> Also do you really need to extend accumulators to 32 bits? > >It won't overflow after the test is changed, so it's not needed anymore. >I have modified it in this reply. > >Rémi Denis-Courmont 于2023年12月30日周六 20:15写道: > >> >> >> Le 29 décembre 2023 12:57:20 GMT+01:00, flow gg a >> écrit : >> >C908 >> >ssd_int8_vs_int16_c: 207.7 >> >ssd_int8_vs_int16_rvv_i32: 28.0 >> >> At a quick glance, it won't work if the input length is not a multiple of >> the vector length. >> >> Also do you really need to extend accumulators to 32 bits? >> ___ >> 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] libavformat/hlsenc.c: Populate OTI using AAC profile in write_codec_attr.
Le jeu. 28 déc. 2023 à 17:26, David Johansen a écrit : >> >> I love this change, but it appears that st->codecpar->profile is always >> AV_PROFILE_UNKNOWN when using libfdk_aac as the encoder. Any indications >> where I should look for fix that so this can be used with that encoder? > > > It appears that the issue is that profile doesn't default to what's being > used so `--profile:a` has to be set explicitly with libfdk_aac and then it > works. Not sure if that's an issue worth fixing, but if someone points me to > where it needs to be done, then I'd be glad to take a look at fixing it This feels like a second, separate issue to me? Maybe we could get these changes in first and then tackle it? -- Romain ___ 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] fftool/ffplay: avoid same name in local variable
> -Original Message- > From: ffmpeg-devel On Behalf Of xufuji456 > via ffmpeg-devel > Sent: 2023年12月30日 16:41 > To: ffmpeg-devel@ffmpeg.org > Cc: xufuji456 <839789...@qq.com> > Subject: [FFmpeg-devel] [PATCH] fftool/ffplay: avoid same name in local > variable > > There is a warning in XCode:"Declaration shadows a local variable" > > Signed-off-by: xufuji456 <839789...@qq.com> > --- > fftools/ffplay.c | 10 +- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/fftools/ffplay.c b/fftools/ffplay.c > index ea5ff31393..17861e60be 100644 > --- a/fftools/ffplay.c > +++ b/fftools/ffplay.c > @@ -1930,11 +1930,11 @@ static int configure_video_filters(AVFilterGraph > *graph, VideoState *is, const c > if (sd) > displaymatrix = (int32_t *)sd->data; > if (!displaymatrix) { > -const AVPacketSideData *sd = > av_packet_side_data_get(is->video_st->codecpar->coded_side_data, > - > is->video_st->codecpar->nb_coded_side_data, > - > AV_PKT_DATA_DISPLAYMATRIX); > -if (sd) > -displaymatrix = (int32_t *)sd->data; > +const AVPacketSideData *psd = > av_packet_side_data_get(is->video_st->codecpar->coded_side_data, > + > is->video_st->codecpar->nb_coded_side_data, > + > AV_PKT_DATA_DISPLAYMATRIX); > +if (psd) > +displaymatrix = (int32_t *)psd->data; > } > theta = get_rotation(displaymatrix); LGTM. The commit message could be reworded like "fix a variable shadowing". ___ 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] checkasm/svqenc: add ssd_int8_vs_int16 test
Thank you, I learned this and updated it in this reply. James Almer 于2023年12月30日周六 22:46写道: > On 12/30/2023 10:59 AM, flow gg wrote: > > Okay, it has been modified in this reply. > > > From d62f363e3aad534c7ead5f3015029b3e7cbbff46 Mon Sep 17 00:00:00 2001 > > From: sunyuechi > > Date: Fri, 29 Dec 2023 13:09:21 +0800 > > Subject: [PATCH 2/3] checkasm/svqenc: add ssd_int8_vs_int16 test > > > > --- > > tests/checkasm/Makefile | 1 + > > tests/checkasm/checkasm.c | 3 ++ > > tests/checkasm/checkasm.h | 1 + > > tests/checkasm/svq1enc.c | 68 +++ > > tests/fate/checkasm.mak | 1 + > > 5 files changed, 74 insertions(+) > > create mode 100644 tests/checkasm/svq1enc.c > > > > diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile > > index 47328b59b9..f507e3 100644 > > --- a/tests/checkasm/Makefile > > +++ b/tests/checkasm/Makefile > > @@ -34,6 +34,7 @@ AVCODECOBJS-$(CONFIG_JPEG2000_DECODER) += > jpeg2000dsp.o > > AVCODECOBJS-$(CONFIG_OPUS_DECODER) += opusdsp.o > > AVCODECOBJS-$(CONFIG_PIXBLOCKDSP) += pixblockdsp.o > > AVCODECOBJS-$(CONFIG_HEVC_DECODER) += hevc_add_res.o > hevc_deblock.o hevc_idct.o hevc_sao.o hevc_pel.o > > +AVCODECOBJS-$(CONFIG_SVQ1_ENCODER) += svq1enc.o > > AVCODECOBJS-$(CONFIG_TAK_DECODER) += takdsp.o > > AVCODECOBJS-$(CONFIG_UTVIDEO_DECODER) += utvideodsp.o > > AVCODECOBJS-$(CONFIG_V210_DECODER) += v210dec.o > > diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c > > index 57613af5f7..ff07d8b18d 100644 > > --- a/tests/checkasm/checkasm.c > > +++ b/tests/checkasm/checkasm.c > > @@ -162,6 +162,9 @@ static const struct { > > #if CONFIG_PIXBLOCKDSP > > { "pixblockdsp", checkasm_check_pixblockdsp }, > > #endif > > +#if CONFIG_SVQ1_ENCODER > > +{ "svq1enc", checkasm_check_svq1enc }, > > +#endif > > #if CONFIG_TAK_DECODER > > { "takdsp", checkasm_check_takdsp }, > > #endif > > diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h > > index d7974772d3..c1f11cfa36 100644 > > --- a/tests/checkasm/checkasm.h > > +++ b/tests/checkasm/checkasm.h > > @@ -82,6 +82,7 @@ void checkasm_check_nlmeans(void); > > void checkasm_check_opusdsp(void); > > void checkasm_check_pixblockdsp(void); > > void checkasm_check_sbrdsp(void); > > +void checkasm_check_svq1enc(void); > > void checkasm_check_synth_filter(void); > > void checkasm_check_sw_gbrp(void); > > void checkasm_check_sw_rgb(void); > > diff --git a/tests/checkasm/svq1enc.c b/tests/checkasm/svq1enc.c > > new file mode 100644 > > index 00..065dd798ca > > --- /dev/null > > +++ b/tests/checkasm/svq1enc.c > > @@ -0,0 +1,68 @@ > > +/* > > + * 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 "libavutil/mem.h" > > +#include "libavutil/mem_internal.h" > > + > > +#include "libavcodec/svq1encdsp.h" > > + > > +#include "checkasm.h" > > + > > +#define BUF_SIZE 1024 > > + > > +#define randomize(buf, len) \ > > +do { \ > > +for (int i = 0; i < len; i++) \ > > +buf[i] = ((rnd() % 65281) - 32641); \ > > +} while (0) > > + > > +static void test_ssd_int8_vs_int16(SVQ1EncDSPContext *s) { > > +declare_func(int, const int8_t *pix1, const int16_t *pix2, intptr_t > size); > > + > > +int r1, r2; > > + > > +if (check_func(s->ssd_int8_vs_int16, "ssd_int8_vs_int16")) { > > +LOCAL_ALIGNED_32(int8_t, p1, [BUF_SIZE]); > > This one should be LOCAL_ALIGNED_4(). See libavcodec/svq1_cb.h > > > +LOCAL_ALIGNED_32(int16_t, p2, [BUF_SIZE]); > > And this one LOCAL_ALIGNED_16(). See encoded_block_levels[] in > libavcodec/svq1enc.c > > > + > > +randomize(p1, BUF_SIZE); > > +randomize(p2, BUF_SIZE); > > + > > +r1 = call_ref(p1, p2, BUF_SIZE); > > +r2 = call_new(p1, p2, BUF_SIZE); > > + > > +if (r1 != r2) { > > +fail(); > > +} > > + > > +bench_new(p1, p2, BUF_SIZE); > > +} > > + > > +report("ssd_int8_vs_int16"); > > + > > +} > > + > > +void checkasm_check_svq1enc(void) > > +{ > > +SVQ1EncDSPContext s = { 0 }; > >
Re: [FFmpeg-devel] [PATCH 2/3] checkasm/svqenc: add ssd_int8_vs_int16 test
On 12/30/2023 10:59 AM, flow gg wrote: Okay, it has been modified in this reply. From d62f363e3aad534c7ead5f3015029b3e7cbbff46 Mon Sep 17 00:00:00 2001 From: sunyuechi Date: Fri, 29 Dec 2023 13:09:21 +0800 Subject: [PATCH 2/3] checkasm/svqenc: add ssd_int8_vs_int16 test --- tests/checkasm/Makefile | 1 + tests/checkasm/checkasm.c | 3 ++ tests/checkasm/checkasm.h | 1 + tests/checkasm/svq1enc.c | 68 +++ tests/fate/checkasm.mak | 1 + 5 files changed, 74 insertions(+) create mode 100644 tests/checkasm/svq1enc.c diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile index 47328b59b9..f507e3 100644 --- a/tests/checkasm/Makefile +++ b/tests/checkasm/Makefile @@ -34,6 +34,7 @@ AVCODECOBJS-$(CONFIG_JPEG2000_DECODER) += jpeg2000dsp.o AVCODECOBJS-$(CONFIG_OPUS_DECODER) += opusdsp.o AVCODECOBJS-$(CONFIG_PIXBLOCKDSP) += pixblockdsp.o AVCODECOBJS-$(CONFIG_HEVC_DECODER) += hevc_add_res.o hevc_deblock.o hevc_idct.o hevc_sao.o hevc_pel.o +AVCODECOBJS-$(CONFIG_SVQ1_ENCODER) += svq1enc.o AVCODECOBJS-$(CONFIG_TAK_DECODER) += takdsp.o AVCODECOBJS-$(CONFIG_UTVIDEO_DECODER) += utvideodsp.o AVCODECOBJS-$(CONFIG_V210_DECODER) += v210dec.o diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index 57613af5f7..ff07d8b18d 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -162,6 +162,9 @@ static const struct { #if CONFIG_PIXBLOCKDSP { "pixblockdsp", checkasm_check_pixblockdsp }, #endif +#if CONFIG_SVQ1_ENCODER +{ "svq1enc", checkasm_check_svq1enc }, +#endif #if CONFIG_TAK_DECODER { "takdsp", checkasm_check_takdsp }, #endif diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h index d7974772d3..c1f11cfa36 100644 --- a/tests/checkasm/checkasm.h +++ b/tests/checkasm/checkasm.h @@ -82,6 +82,7 @@ void checkasm_check_nlmeans(void); void checkasm_check_opusdsp(void); void checkasm_check_pixblockdsp(void); void checkasm_check_sbrdsp(void); +void checkasm_check_svq1enc(void); void checkasm_check_synth_filter(void); void checkasm_check_sw_gbrp(void); void checkasm_check_sw_rgb(void); diff --git a/tests/checkasm/svq1enc.c b/tests/checkasm/svq1enc.c new file mode 100644 index 00..065dd798ca --- /dev/null +++ b/tests/checkasm/svq1enc.c @@ -0,0 +1,68 @@ +/* + * 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 "libavutil/mem.h" +#include "libavutil/mem_internal.h" + +#include "libavcodec/svq1encdsp.h" + +#include "checkasm.h" + +#define BUF_SIZE 1024 + +#define randomize(buf, len) \ +do { \ +for (int i = 0; i < len; i++) \ +buf[i] = ((rnd() % 65281) - 32641); \ +} while (0) + +static void test_ssd_int8_vs_int16(SVQ1EncDSPContext *s) { +declare_func(int, const int8_t *pix1, const int16_t *pix2, intptr_t size); + +int r1, r2; + +if (check_func(s->ssd_int8_vs_int16, "ssd_int8_vs_int16")) { +LOCAL_ALIGNED_32(int8_t, p1, [BUF_SIZE]); This one should be LOCAL_ALIGNED_4(). See libavcodec/svq1_cb.h +LOCAL_ALIGNED_32(int16_t, p2, [BUF_SIZE]); And this one LOCAL_ALIGNED_16(). See encoded_block_levels[] in libavcodec/svq1enc.c + +randomize(p1, BUF_SIZE); +randomize(p2, BUF_SIZE); + +r1 = call_ref(p1, p2, BUF_SIZE); +r2 = call_new(p1, p2, BUF_SIZE); + +if (r1 != r2) { +fail(); +} + +bench_new(p1, p2, BUF_SIZE); +} + +report("ssd_int8_vs_int16"); + +} + +void checkasm_check_svq1enc(void) +{ +SVQ1EncDSPContext s = { 0 }; +ff_svq1enc_init(&s); + +test_ssd_int8_vs_int16(&s); +} diff --git a/tests/fate/checkasm.mak b/tests/fate/checkasm.mak index 9e04b1b3cb..3d775549ee 100644 --- a/tests/fate/checkasm.mak +++ b/tests/fate/checkasm.mak @@ -34,6 +34,7 @@ FATE_CHECKASM = fate-checkasm-aacencdsp \ fate-checkasm-opusdsp \ fate-checkasm-pixblockdsp \ fate-checkasm-sbrdsp\ +fate-checkasm-svq1enc
Re: [FFmpeg-devel] [PATCH 3/3] lavc/svq1enc: R-V V ssd_int8_vs_int16
flow gg 于2023年12月30日周六 22:00写道: > > At a quick glance, it won't work if the input length is not a multiple > of the vector length. > > Why? I tried 1024, 32*3, 32*7 and all passed the test. > > > Also do you really need to extend accumulators to 32 bits? > > It won't overflow after the test is changed, so it's not needed anymore. > I have modified it in this reply. > > Rémi Denis-Courmont 于2023年12月30日周六 20:15写道: > >> >> >> Le 29 décembre 2023 12:57:20 GMT+01:00, flow gg a >> écrit : >> >C908 >> >ssd_int8_vs_int16_c: 207.7 >> >ssd_int8_vs_int16_rvv_i32: 28.0 >> >> At a quick glance, it won't work if the input length is not a multiple of >> the vector length. >> >> Also do you really need to extend accumulators to 32 bits? >> ___ >> 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 7bb35b54a4e578848660b1437b96333dd740cbd3 Mon Sep 17 00:00:00 2001 From: sunyuechi Date: Fri, 29 Dec 2023 13:27:31 +0800 Subject: [PATCH 3/3] lavc/svq1enc: R-V V ssd_int8_vs_int16 C908 ssd_int8_vs_int16_c: 207.7 ssd_int8_vs_int16_rvv_i32: 17.7 --- libavcodec/riscv/Makefile | 2 ++ libavcodec/riscv/svqenc_init.c | 41 +++ libavcodec/riscv/svqenc_rvv.S | 44 ++ libavcodec/svq1enc.c | 2 ++ libavcodec/svq1encdsp.h| 1 + 5 files changed, 90 insertions(+) create mode 100644 libavcodec/riscv/svqenc_init.c create mode 100644 libavcodec/riscv/svqenc_rvv.S diff --git a/libavcodec/riscv/Makefile b/libavcodec/riscv/Makefile index 7f253bba12..4e14c3d094 100644 --- a/libavcodec/riscv/Makefile +++ b/libavcodec/riscv/Makefile @@ -46,6 +46,8 @@ RVV-OBJS-$(CONFIG_OPUS_DECODER) += riscv/opusdsp_rvv.o OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_init.o RV-OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_rvi.o RVV-OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_rvv.o +OBJS-$(CONFIG_SVQ1_ENCODER) += riscv/svqenc_init.o +RVV-OBJS-$(CONFIG_SVQ1_ENCODER) += riscv/svqenc_rvv.o OBJS-$(CONFIG_TAK_DECODER) += riscv/takdsp_init.o RVV-OBJS-$(CONFIG_TAK_DECODER) += riscv/takdsp_rvv.o OBJS-$(CONFIG_UTVIDEO_DECODER) += riscv/utvideodsp_init.o diff --git a/libavcodec/riscv/svqenc_init.c b/libavcodec/riscv/svqenc_init.c new file mode 100644 index 00..f4c398960c --- /dev/null +++ b/libavcodec/riscv/svqenc_init.c @@ -0,0 +1,41 @@ +/* + * 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/attributes.h" +#include "libavutil/cpu.h" +#include "libavcodec/svq1encdsp.h" + +int ff_ssd_int8_vs_int16_rvv(const int8_t *pix1, const int16_t *pix2, + intptr_t size); + +av_cold void ff_svq1enc_init_riscv(SVQ1EncDSPContext *c) +{ +#if HAVE_RVV +int flags = av_get_cpu_flags(); + +if (flags & AV_CPU_FLAG_RVV_I32) { +if (flags & AV_CPU_FLAG_RVB_ADDR) { +c->ssd_int8_vs_int16 = ff_ssd_int8_vs_int16_rvv; +} +} +#endif +} diff --git a/libavcodec/riscv/svqenc_rvv.S b/libavcodec/riscv/svqenc_rvv.S new file mode 100644 index 00..c52913c2e7 --- /dev/null +++ b/libavcodec/riscv/svqenc_rvv.S @@ -0,0 +1,44 @@ +/* + * 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 + */
Re: [FFmpeg-devel] [PATCH 3/3] lavc/svq1enc: R-V V ssd_int8_vs_int16
> At a quick glance, it won't work if the input length is not a multiple of the vector length. Why? I tried 1024, 32*3, 32*7 and all passed the test. > Also do you really need to extend accumulators to 32 bits? It won't overflow after the test is changed, so it's not needed anymore. I have modified it in this reply. Rémi Denis-Courmont 于2023年12月30日周六 20:15写道: > > > Le 29 décembre 2023 12:57:20 GMT+01:00, flow gg a > écrit : > >C908 > >ssd_int8_vs_int16_c: 207.7 > >ssd_int8_vs_int16_rvv_i32: 28.0 > > At a quick glance, it won't work if the input length is not a multiple of > the vector length. > > Also do you really need to extend accumulators to 32 bits? > ___ > 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 2/3] checkasm/svqenc: add ssd_int8_vs_int16 test
Okay, it has been modified in this reply. Martin Storsjö 于2023年12月29日周五 22:35写道: > On Fri, 29 Dec 2023, James Almer wrote: > > > On 12/29/2023 9:16 AM, Martin Storsjö wrote: > >> On Fri, 29 Dec 2023, flow gg wrote: > >> > >>> Tests on x86 might fail, possibly due to a 16-bit sub overflow > >> > >> If this only happens in checkasm but not in real life use, it means > > that > >> the checkasm test input is out of range, and we should try to mimic the > >> real input data. > >> > >> If the issue is off-by-one due to rounding, we could allow it by making > >> a comparison per element, and tolerate a certain diff (maybe only on > > x86). > >> > >> But if it is an actual overflow on valid input data, the x86 asm > >> definitely needs to be fixed, by someone... Worst case, we might want > > to > >> disable that checkasm test on x86 temporarily. > > > > The function subtracts an int16 from an int8, whose result may not fit > > on an int16. The x86 asm expects it to do, hence the failures. > > > > I don't know if such cases exist in real world files, so like you said, > > if they don't then the test should generate in-range input. But if they > > do, i'll fix the x86 asm (sadly, this means sse4 will be required > > instead of sse2). > > I think it's probably best to limit the checkasm inputs that don't > overflow, for now. > > // 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". > From d62f363e3aad534c7ead5f3015029b3e7cbbff46 Mon Sep 17 00:00:00 2001 From: sunyuechi Date: Fri, 29 Dec 2023 13:09:21 +0800 Subject: [PATCH 2/3] checkasm/svqenc: add ssd_int8_vs_int16 test --- tests/checkasm/Makefile | 1 + tests/checkasm/checkasm.c | 3 ++ tests/checkasm/checkasm.h | 1 + tests/checkasm/svq1enc.c | 68 +++ tests/fate/checkasm.mak | 1 + 5 files changed, 74 insertions(+) create mode 100644 tests/checkasm/svq1enc.c diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile index 47328b59b9..f507e3 100644 --- a/tests/checkasm/Makefile +++ b/tests/checkasm/Makefile @@ -34,6 +34,7 @@ AVCODECOBJS-$(CONFIG_JPEG2000_DECODER) += jpeg2000dsp.o AVCODECOBJS-$(CONFIG_OPUS_DECODER) += opusdsp.o AVCODECOBJS-$(CONFIG_PIXBLOCKDSP) += pixblockdsp.o AVCODECOBJS-$(CONFIG_HEVC_DECODER) += hevc_add_res.o hevc_deblock.o hevc_idct.o hevc_sao.o hevc_pel.o +AVCODECOBJS-$(CONFIG_SVQ1_ENCODER) += svq1enc.o AVCODECOBJS-$(CONFIG_TAK_DECODER) += takdsp.o AVCODECOBJS-$(CONFIG_UTVIDEO_DECODER) += utvideodsp.o AVCODECOBJS-$(CONFIG_V210_DECODER) += v210dec.o diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index 57613af5f7..ff07d8b18d 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -162,6 +162,9 @@ static const struct { #if CONFIG_PIXBLOCKDSP { "pixblockdsp", checkasm_check_pixblockdsp }, #endif +#if CONFIG_SVQ1_ENCODER +{ "svq1enc", checkasm_check_svq1enc }, +#endif #if CONFIG_TAK_DECODER { "takdsp", checkasm_check_takdsp }, #endif diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h index d7974772d3..c1f11cfa36 100644 --- a/tests/checkasm/checkasm.h +++ b/tests/checkasm/checkasm.h @@ -82,6 +82,7 @@ void checkasm_check_nlmeans(void); void checkasm_check_opusdsp(void); void checkasm_check_pixblockdsp(void); void checkasm_check_sbrdsp(void); +void checkasm_check_svq1enc(void); void checkasm_check_synth_filter(void); void checkasm_check_sw_gbrp(void); void checkasm_check_sw_rgb(void); diff --git a/tests/checkasm/svq1enc.c b/tests/checkasm/svq1enc.c new file mode 100644 index 00..065dd798ca --- /dev/null +++ b/tests/checkasm/svq1enc.c @@ -0,0 +1,68 @@ +/* + * 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 "libavutil/mem.h" +#include "libavutil/mem_internal.h" + +#include "libavcodec/svq1encdsp.h" + +#include "checkasm.h" + +#define BUF_SIZE 1024 + +#define randomize(buf, len) \ +do { \ +for (int i = 0; i < len; i++) \ +
Re: [FFmpeg-devel] [PATCH 3/3] lavc/svq1enc: R-V V ssd_int8_vs_int16
Le 29 décembre 2023 12:57:20 GMT+01:00, flow gg a écrit : >C908 >ssd_int8_vs_int16_c: 207.7 >ssd_int8_vs_int16_rvv_i32: 28.0 At a quick glance, it won't work if the input length is not a multiple of the vector length. Also do you really need to extend accumulators to 32 bits? ___ 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] checkasm/svqenc: add ssd_int8_vs_int16 test
Le 29 décembre 2023 12:57:01 GMT+01:00, flow gg a écrit : >Tests on x86 might fail, possibly due to a 16-bit sub overflow I don't know anything about the SVQ encoder. Still, especially for an encoder, overflows are probably not expected. So then it is as Martin wrote. ___ 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] fftool/ffplay: avoid same name in local variable
There is a warning in XCode:"Declaration shadows a local variable" Signed-off-by: xufuji456 <839789...@qq.com> --- fftools/ffplay.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fftools/ffplay.c b/fftools/ffplay.c index ea5ff31393..17861e60be 100644 --- a/fftools/ffplay.c +++ b/fftools/ffplay.c @@ -1930,11 +1930,11 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c if (sd) displaymatrix = (int32_t *)sd->data; if (!displaymatrix) { -const AVPacketSideData *sd = av_packet_side_data_get(is->video_st->codecpar->coded_side_data, - is->video_st->codecpar->nb_coded_side_data, - AV_PKT_DATA_DISPLAYMATRIX); -if (sd) -displaymatrix = (int32_t *)sd->data; +const AVPacketSideData *psd = av_packet_side_data_get(is->video_st->codecpar->coded_side_data, + is->video_st->codecpar->nb_coded_side_data, + AV_PKT_DATA_DISPLAYMATRIX); +if (psd) +displaymatrix = (int32_t *)psd->data; } theta = get_rotation(displaymatrix); -- 2.39.3 (Apple Git-145) ___ 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".