Re: [FFmpeg-devel] [PATCH 1/2] lavu/tx: add real to real and real to imaginary RDFT transforms
Aug 3, 2023, 22:39 by andreas.rheinha...@outlook.com: > Michael Niedermayer: > >> On Thu, Aug 03, 2023 at 06:26:16PM +0200, Lynne wrote: >> >>> These are in-place transforms, required for DCT-I and DST-I. >>> >>> Templated as the mod2 variant requires minor modifications, and is >>> required specifically for DCT-I/DST-I. >>> >>> Quite optimized, as there's no need for any additional buffer storage. >>> >>> doc/APIchanges |3 >>> libavutil/tx.c | 18 >>> libavutil/tx.h | 10 ++ >>> libavutil/tx_template.c | 175 >>> +--- >>> libavutil/version.h |2 >>> 5 files changed, 167 insertions(+), 41 deletions(-) >>> 6e6308365cd78a84c7db5800207e6b5977945079 >>> 0001-lavu-tx-add-real-to-real-and-real-to-imaginary-RDFT-.patch >>> From 2ea5e2541c2551bf1b56e967d35946289a85aa49 Mon Sep 17 00:00:00 2001 >>> From: Lynne >>> Date: Thu, 3 Aug 2023 18:21:23 +0200 >>> Subject: [PATCH 1/2] lavu/tx: add real to real and real to imaginary RDFT >>> transforms >>> >>> These are in-place transforms, required for DCT-I and DST-I. >>> >>> Templated as the mod2 variant requires minor modifications, and is >>> required specifically for DCT-I/DST-I. >>> >> >> not sure if i forgot some patch but >> this seems to break fate-binkaudio-dct >> > > It's not just you; patchwork reported four failing tests: > make: *** [fate-filter-firequalizer] Error 218 > make: *** [fate-binkaudio-rdft] Error 218 > make: *** [fate-binkaudio-dct] Error 218 > make: *** [fate-qdm2] Error 218 > > - Andreas > Thanks, I had a typo on the standard, non-half RDFTs. One line change: @@ -1711,7 +1703,7 @@ static const FFTXCodelet TX_NAME(ff_tx_rdft_ ##n## _def) = { \ .function = TX_NAME(ff_tx_rdft_ ##n), \ .type = TX_TYPE(RDFT), \ .flags = AV_TX_UNALIGNED | AV_TX_INPLACE | FF_TX_OUT_OF_PLACE | \ - inv ? FF_TX_INVERSE_ONLY : FF_TX_FORWARD_ONLY, \ + (inv ? FF_TX_INVERSE_ONLY : FF_TX_FORWARD_ONLY), \ .factors = { 4, TX_FACTOR_ANY }, \ .nb_factors = 2, \ .min_len = 4, \ V2 sent. ___ 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] lavu/tx: add real to real and real to imaginary RDFT transforms
Michael Niedermayer: > On Thu, Aug 03, 2023 at 06:26:16PM +0200, Lynne wrote: >> These are in-place transforms, required for DCT-I and DST-I. >> >> Templated as the mod2 variant requires minor modifications, and is >> required specifically for DCT-I/DST-I. >> >> Quite optimized, as there's no need for any additional buffer storage. >> > >> doc/APIchanges |3 >> libavutil/tx.c | 18 >> libavutil/tx.h | 10 ++ >> libavutil/tx_template.c | 175 >> +--- >> libavutil/version.h |2 >> 5 files changed, 167 insertions(+), 41 deletions(-) >> 6e6308365cd78a84c7db5800207e6b5977945079 >> 0001-lavu-tx-add-real-to-real-and-real-to-imaginary-RDFT-.patch >> From 2ea5e2541c2551bf1b56e967d35946289a85aa49 Mon Sep 17 00:00:00 2001 >> From: Lynne >> Date: Thu, 3 Aug 2023 18:21:23 +0200 >> Subject: [PATCH 1/2] lavu/tx: add real to real and real to imaginary RDFT >> transforms >> >> These are in-place transforms, required for DCT-I and DST-I. >> >> Templated as the mod2 variant requires minor modifications, and is >> required specifically for DCT-I/DST-I. > > not sure if i forgot some patch but > this seems to break fate-binkaudio-dct > It's not just you; patchwork reported four failing tests: make: *** [fate-filter-firequalizer] Error 218 make: *** [fate-binkaudio-rdft] Error 218 make: *** [fate-binkaudio-dct] Error 218 make: *** [fate-qdm2] Error 218 - Andreas ___ 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] lavu/tx: add real to real and real to imaginary RDFT transforms
On Thu, Aug 03, 2023 at 06:26:16PM +0200, Lynne wrote: > These are in-place transforms, required for DCT-I and DST-I. > > Templated as the mod2 variant requires minor modifications, and is > required specifically for DCT-I/DST-I. > > Quite optimized, as there's no need for any additional buffer storage. > > doc/APIchanges |3 > libavutil/tx.c | 18 > libavutil/tx.h | 10 ++ > libavutil/tx_template.c | 175 > +--- > libavutil/version.h |2 > 5 files changed, 167 insertions(+), 41 deletions(-) > 6e6308365cd78a84c7db5800207e6b5977945079 > 0001-lavu-tx-add-real-to-real-and-real-to-imaginary-RDFT-.patch > From 2ea5e2541c2551bf1b56e967d35946289a85aa49 Mon Sep 17 00:00:00 2001 > From: Lynne > Date: Thu, 3 Aug 2023 18:21:23 +0200 > Subject: [PATCH 1/2] lavu/tx: add real to real and real to imaginary RDFT > transforms > > These are in-place transforms, required for DCT-I and DST-I. > > Templated as the mod2 variant requires minor modifications, and is > required specifically for DCT-I/DST-I. not sure if i forgot some patch but this seems to break fate-binkaudio-dct make V=2 fate-binkaudio-dct -j32 ... [bink @ 0x559fc8d8dcc0] Failed to open codec in avformat_find_stream_info [bink @ 0x559fc8d8dcc0] Packet corrupt (stream = 0, dts = NOPTS). [bink @ 0x559fc8d8dcc0] Failed to open codec in avformat_find_stream_info [bink @ 0x559fc8d8dcc0] Could not find codec parameters for stream 1 (Audio: binkaudio_dct, 44000 Hz, 0 channels, fltp): unspecified number of channels Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (500) options Input #0, bink, from 'fate/fate-suite//bink/binkaudio_dct.bik': Duration: 00:00:08.87, start: 0.00, bitrate: 183 kb/s Stream #0:0[0x0]: Video: binkvideo (BIKi / 0x694B4942), yuv420p(tv), 640x480, 30 fps, 30 tbr, 30 tbn Stream #0:1[0x0]: Audio: binkaudio_dct, 44000 Hz, stereo, fltp [aist#0:1/binkaudio_dct @ 0x559fc8d93080] Error while opening decoder: Function not implemented [aost#0:0/pcm_s16le @ 0x559fc8de5c40] Error initializing a simple filtergraph Error opening output file -. Error opening output files: Function not implemented threads=1 tests/Makefile:308: recipe for target 'fate-binkaudio-dct' failed make: *** [fate-binkaudio-dct] Error 218 [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Nations do behave wisely once they have exhausted all other alternatives. -- Abba Eban 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 1/2] lavu/tx: add real to real and real to imaginary RDFT transforms
Aug 3, 2023, 18:26 by d...@lynne.ee: > These are in-place transforms, required for DCT-I and DST-I. > > Templated as the mod2 variant requires minor modifications, and is > required specifically for DCT-I/DST-I. > > Quite optimized, as there's no need for any additional buffer storage. > Specifically, for R2R, vs fftw 26280 decicycles in av_tx (r2c), 1048574 runs, 2 skips 69940 decicycles in fftwf_execute, 1048576 runs, 0 skips And for R2I 25856 decicycles in av_tx (r2c), 1048571 runs, 5 skips 65561 decicycles in fftwf_execute, 1048576 runs, 0 skips ___ 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] lavu/tx: add real to real and real to imaginary RDFT transforms
These are in-place transforms, required for DCT-I and DST-I. Templated as the mod2 variant requires minor modifications, and is required specifically for DCT-I/DST-I. Quite optimized, as there's no need for any additional buffer storage. >From 2ea5e2541c2551bf1b56e967d35946289a85aa49 Mon Sep 17 00:00:00 2001 From: Lynne Date: Thu, 3 Aug 2023 18:21:23 +0200 Subject: [PATCH 1/2] lavu/tx: add real to real and real to imaginary RDFT transforms These are in-place transforms, required for DCT-I and DST-I. Templated as the mod2 variant requires minor modifications, and is required specifically for DCT-I/DST-I. --- doc/APIchanges | 3 + libavutil/tx.c | 18 - libavutil/tx.h | 10 +++ libavutil/tx_template.c | 175 +++- libavutil/version.h | 2 +- 5 files changed, 167 insertions(+), 41 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 5afe8bcb75..edd178be4f 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2023-02-09 API changes, most recent first: +2023-07-xx - xx - lavu 58.15.100 - tx.h + Add AV_TX_REAL_TO_REAL and AV_TX_REAL_TO_IMAGINARY + 2023-07-xx - xx - lavc 60 - avcodec.h Deprecate AV_CODEC_FLAG_DROPCHANGED without replacement. diff --git a/libavutil/tx.c b/libavutil/tx.c index e25abf998f..e9826e6107 100644 --- a/libavutil/tx.c +++ b/libavutil/tx.c @@ -437,7 +437,9 @@ int ff_tx_decompose_length(int dst[TX_MAX_DECOMPOSITIONS], enum AVTXType type, /* Check direction for non-orthogonal codelets */ if (((cd->flags & FF_TX_FORWARD_ONLY) && inv) || -((cd->flags & (FF_TX_INVERSE_ONLY | AV_TX_FULL_IMDCT)) && !inv)) +((cd->flags & (FF_TX_INVERSE_ONLY | AV_TX_FULL_IMDCT)) && !inv) || +((cd->flags & (FF_TX_FORWARD_ONLY | AV_TX_REAL_TO_REAL)) && inv) || +((cd->flags & (FF_TX_FORWARD_ONLY | AV_TX_REAL_TO_IMAGINARY)) && inv)) continue; /* Check if the CPU supports the required ISA */ @@ -560,6 +562,10 @@ static void print_flags(AVBPrint *bp, uint64_t f) av_bprintf(bp, "%spreshuf", prev > 1 ? sep : ""); if ((f & AV_TX_FULL_IMDCT) && ++prev) av_bprintf(bp, "%simdct_full", prev > 1 ? sep : ""); +if ((f & AV_TX_REAL_TO_REAL) && ++prev) +av_bprintf(bp, "%sreal_to_real", prev > 1 ? sep : ""); +if ((f & AV_TX_REAL_TO_IMAGINARY) && ++prev) +av_bprintf(bp, "%sreal_to_imaginary", prev > 1 ? sep : ""); if ((f & FF_TX_ASM_CALL) && ++prev) av_bprintf(bp, "%sasm_call", prev > 1 ? sep : ""); av_bprintf(bp, "]"); @@ -717,7 +723,11 @@ av_cold int ff_tx_init_subtx(AVTXContext *s, enum AVTXType type, uint64_t req_flags = flags; /* Flags the codelet may require to be present */ -uint64_t inv_req_mask = AV_TX_FULL_IMDCT | FF_TX_PRESHUFFLE | FF_TX_ASM_CALL; +uint64_t inv_req_mask = AV_TX_FULL_IMDCT | +AV_TX_REAL_TO_REAL | +AV_TX_REAL_TO_IMAGINARY | +FF_TX_PRESHUFFLE | +FF_TX_ASM_CALL; /* Unaligned codelets are compatible with the aligned flag */ if (req_flags & FF_TX_ALIGNED) @@ -742,7 +752,9 @@ av_cold int ff_tx_init_subtx(AVTXContext *s, enum AVTXType type, /* Check direction for non-orthogonal codelets */ if (((cd->flags & FF_TX_FORWARD_ONLY) && inv) || -((cd->flags & (FF_TX_INVERSE_ONLY | AV_TX_FULL_IMDCT)) && !inv)) +((cd->flags & (FF_TX_INVERSE_ONLY | AV_TX_FULL_IMDCT)) && !inv) || +((cd->flags & (FF_TX_FORWARD_ONLY | AV_TX_REAL_TO_REAL)) && inv) || +((cd->flags & (FF_TX_FORWARD_ONLY | AV_TX_REAL_TO_IMAGINARY)) && inv)) continue; /* Check if the requested flags match from both sides */ diff --git a/libavutil/tx.h b/libavutil/tx.h index 064edbc097..d178e8ee9d 100644 --- a/libavutil/tx.h +++ b/libavutil/tx.h @@ -149,6 +149,16 @@ enum AVTXFlags { * Ignored for all transforms but inverse MDCTs. */ AV_TX_FULL_IMDCT = 1ULL << 2, + +/** + * Perform a real to half-complex RDFT. + * Only the real, or imaginary coefficients will + * be output, depending on the flag used. Only available for forward RDFTs. + * Output array must have enough space to hold N complex values + * (regular size for a real to complex transform). + */ +AV_TX_REAL_TO_REAL = 1ULL << 3, +AV_TX_REAL_TO_IMAGINARY = 1ULL << 4, }; /** diff --git a/libavutil/tx_template.c b/libavutil/tx_template.c index c4ec9502e0..50c65d00b5 100644 --- a/libavutil/tx_template.c +++ b/libavutil/tx_template.c @@ -1613,14 +1613,17 @@ static av_cold int TX_NAME(ff_tx_rdft_init)(AVTXContext *s, int ret; double f, m; TXSample *tab; +int len4 = FFALIGN(len, 4) / 4; s->scale_d