History

avfft: wrap lavu/tx instead of ff_fft

Lynne committed 4 years ago

Commit dfcd4bb1 parent 4acd08b1 file · +31 −9Browse files

Showing the changes to libavcodec (1 of 1 file). Show all

Unified · Split

libavcodec/avfft.c+31−9
@@ -18,38 +18,60 @@ · 17 unmodified lines
18 18
19#include "libavutil/attributes.h"19#include "libavutil/attributes.h"
20#include "libavutil/mem.h"20#include "libavutil/mem.h"
21#include "libavutil/tx.h"
21#include "avfft.h"22#include "avfft.h"
22#include "fft.h"23#include "fft.h"
23#include "rdft.h"24#include "rdft.h"
24#include "dct.h"25#include "dct.h"
25 26
27typedef struct AVTXWrapper {
28 AVTXContext *ctx;
29 av_tx_fn fn;
30
31 AVTXContext *ctx2;
32 av_tx_fn fn2;
33
34 ptrdiff_t stride;
35} AVTXWrapper;
36
26/* FFT */37/* FFT */
27 38
28FFTContext *av_fft_init(int nbits, int inverse)39FFTContext *av_fft_init(int nbits, int inverse)
29{40{
30 FFTContext *s = av_mallocz(sizeof(*s));41 int ret;
31 42 float scale = 1.0f;
32 if (s && ff_fft_init(s, nbits, inverse))43 AVTXWrapper *s = av_malloc(sizeof(*s));
33 av_freep(&s);44 if (!s)
45 return NULL;
46
47 ret = av_tx_init(&s->ctx, &s->fn, AV_TX_FLOAT_FFT, inverse, 1 << nbits,
48 &scale, AV_TX_INPLACE);
49 if (ret < 0) {
50 av_free(s);
51 return NULL;
52 }
34 53
35 return s;54 return (FFTContext *)s;
36}55}
37 56
38void av_fft_permute(FFTContext *s, FFTComplex *z)57void av_fft_permute(FFTContext *s, FFTComplex *z)
39{58{
40 s->fft_permute(s, z);59 /* Empty */
41}60}
42 61
43void av_fft_calc(FFTContext *s, FFTComplex *z)62void av_fft_calc(FFTContext *s, FFTComplex *z)
44{63{
45 s->fft_calc(s, z);64 AVTXWrapper *w = (AVTXWrapper *)s;
65 w->fn(w->ctx, z, (void *)z, sizeof(AVComplexFloat));
46}66}
47 67
48av_cold void av_fft_end(FFTContext *s)68av_cold void av_fft_end(FFTContext *s)
49{69{
50 if (s) {70 if (s) {
51 ff_fft_end(s);71 AVTXWrapper *w = (AVTXWrapper *)s;
52 av_free(s);72 av_tx_uninit(&w->ctx);
73 av_tx_uninit(&w->ctx2);
74 av_free(w);
53 }75 }
54}76}
55 77

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t