Go to the documentation of this file.
35 #define F_LFTG_ALPHA 1.586134342059924f
36 #define F_LFTG_BETA 0.052980118572961f
37 #define F_LFTG_GAMMA 0.882911075530934f
38 #define F_LFTG_DELTA 0.443506852043971f
42 #define I_LFTG_ALPHA_PRIME 38413ll // = 103949 - 65536, (= alpha - 1.0)
43 #define I_LFTG_BETA 3472ll
44 #define I_LFTG_GAMMA 57862ll
45 #define I_LFTG_DELTA 29066ll
46 #define I_LFTG_K 80621ll
47 #define I_LFTG_X 53274ll
49 static inline void extend53(
int *p,
int i0,
int i1)
51 p[i0 - 1] = p[i0 + 1];
53 p[i0 - 2] = p[i0 + 2];
54 p[i1 + 1] = p[i1 - 3];
61 for (
i = 1;
i <= 4;
i++) {
62 p[i0 -
i] = p[i0 +
i];
63 p[i1 +
i - 1] = p[i1 -
i - 1];
71 for (
i = 1;
i <= 4;
i++) {
72 p[i0 -
i] = p[i0 +
i];
73 p[i1 +
i - 1] = p[i1 -
i - 1];
77 static void sd_1d53(
int *p,
int i0,
int i1)
89 for (
i = ((i0+1)>>1) - 1;
i < (i1+1)>>1;
i++)
90 p[2*
i+1] -= (p[2*
i] + p[2*
i+2]) >> 1;
91 for (
i = ((i0+1)>>1);
i < (i1+1)>>1;
i++)
92 p[2*
i] += (p[2*
i-1] + p[2*
i+1] + 2) >> 2;
98 w =
s->linelen[
s->ndeclevels-1][0];
99 int *
line =
s->i_linebuf;
103 int lh =
s->linelen[
lev][0],
104 lv =
s->linelen[
lev][1],
112 for (lp = 0; lp < lh; lp++) {
115 for (
i = 0;
i < lv;
i++)
121 for (
i =
mv;
i < lv;
i+=2, j++)
123 for (
i = 1-
mv;
i < lv;
i+=2, j++)
129 for (lp = 0; lp < lv; lp++){
132 for (
i = 0;
i < lh;
i++)
138 for (
i =
mh;
i < lh;
i+=2, j++)
140 for (
i = 1-
mh;
i < lh;
i+=2, j++)
160 for (
i = (i0>>1) - 2;
i < (i1>>1) + 1;
i++)
161 p[2*
i+1] -= 1.586134 * (p[2*
i] + p[2*
i+2]);
162 for (
i = (i0>>1) - 1;
i < (i1>>1) + 1;
i++)
163 p[2*
i] -= 0.052980 * (p[2*
i-1] + p[2*
i+1]);
164 for (
i = (i0>>1) - 1;
i < (i1>>1);
i++)
165 p[2*
i+1] += 0.882911 * (p[2*
i] + p[2*
i+2]);
166 for (
i = (i0>>1);
i < (i1>>1);
i++)
167 p[2*
i] += 0.443506 * (p[2*
i-1] + p[2*
i+1]);
173 w =
s->linelen[
s->ndeclevels-1][0];
174 float *
line =
s->f_linebuf;
178 int lh =
s->linelen[
lev][0],
179 lv =
s->linelen[
lev][1],
187 for (lp = 0; lp < lv; lp++){
190 for (
i = 0;
i < lh;
i++)
196 for (
i =
mh;
i < lh;
i+=2, j++)
198 for (
i = 1-
mh;
i < lh;
i+=2, j++)
204 for (lp = 0; lp < lh; lp++) {
207 for (
i = 0;
i < lv;
i++)
213 for (
i =
mv;
i < lv;
i+=2, j++)
215 for (
i = 1-
mv;
i < lv;
i+=2, j++)
227 p[1] = (p[1] *
I_LFTG_X + (1<<14)) >> 15;
229 p[0] = (p[0] *
I_LFTG_K + (1<<15)) >> 16;
236 for (
i = (i0>>1) - 2;
i < (i1>>1) + 1;
i++) {
237 const int64_t sum = p[2 *
i] + p[2 *
i + 2];
241 for (
i = (i0>>1) - 1;
i < (i1>>1) + 1;
i++)
242 p[2 *
i] -= (
I_LFTG_BETA * (p[2 *
i - 1] + p[2 *
i + 1]) + (1 << 15)) >> 16;
243 for (
i = (i0>>1) - 1;
i < (i1>>1);
i++)
244 p[2 *
i + 1] += (
I_LFTG_GAMMA * (p[2 *
i] + p[2 *
i + 2]) + (1 << 15)) >> 16;
245 for (
i = (i0>>1);
i < (i1>>1);
i++)
246 p[2 *
i] += (
I_LFTG_DELTA * (p[2 *
i - 1] + p[2 *
i + 1]) + (1 << 15)) >> 16;
252 int w =
s->linelen[
s->ndeclevels-1][0];
253 int h =
s->linelen[
s->ndeclevels-1][1];
255 int *
line =
s->i_linebuf;
258 for (
i = 0;
i <
w *
h;
i++)
262 int lh =
s->linelen[
lev][0],
263 lv =
s->linelen[
lev][1],
271 for (lp = 0; lp < lh; lp++) {
274 for (
i = 0;
i < lv;
i++)
280 for (
i =
mv;
i < lv;
i+=2, j++)
282 for (
i = 1-
mv;
i < lv;
i+=2, j++)
288 for (lp = 0; lp < lv; lp++){
291 for (
i = 0;
i < lh;
i++)
297 for (
i =
mh;
i < lh;
i+=2, j++)
299 for (
i = 1-
mh;
i < lh;
i+=2, j++)
305 for (
i = 0;
i <
w *
h;
i++)
309 static void sr_1d53(
unsigned *p,
int i0,
int i1)
315 p[1] = (int)p[1] >> 1;
321 for (
i = (i0 >> 1);
i < (i1 >> 1) + 1;
i++)
322 p[2 *
i] -= (
int)(p[2 *
i - 1] + p[2 *
i + 1] + 2) >> 2;
323 for (
i = (i0 >> 1);
i < (i1 >> 1);
i++)
324 p[2 *
i + 1] += (
int)(p[2 *
i] + p[2 *
i + 2]) >> 1;
330 int w =
s->linelen[
s->ndeclevels - 1][0];
335 int lh =
s->linelen[
lev][0],
336 lv =
s->linelen[
lev][1],
344 for (lp = 0; lp < lv; lp++) {
347 for (
i =
mh;
i < lh;
i += 2, j++)
348 l[
i] = t[
w * lp + j];
349 for (
i = 1 -
mh;
i < lh;
i += 2, j++)
350 l[
i] = t[
w * lp + j];
354 for (
i = 0;
i < lh;
i++)
355 t[
w * lp +
i] = l[
i];
360 for (lp = 0; lp < lh; lp++) {
363 for (
i =
mv;
i < lv;
i += 2, j++)
364 l[
i] = t[
w * j + lp];
365 for (
i = 1 -
mv;
i < lv;
i += 2, j++)
366 l[
i] = t[
w * j + lp];
370 for (
i = 0;
i < lv;
i++)
371 t[
w *
i + lp] = l[
i];
390 for (
i = (i0 >> 1) - 1;
i < (i1 >> 1) + 2;
i++)
393 for (
i = (i0 >> 1) - 1;
i < (i1 >> 1) + 1;
i++)
396 for (
i = (i0 >> 1);
i < (i1 >> 1) + 1;
i++)
399 for (
i = (i0 >> 1);
i < (i1 >> 1);
i++)
406 int w =
s->linelen[
s->ndeclevels - 1][0];
407 float *
line =
s->f_linebuf;
413 int lh =
s->linelen[
lev][0],
414 lv =
s->linelen[
lev][1],
421 for (lp = 0; lp < lv; lp++) {
424 for (
i =
mh;
i < lh;
i += 2, j++)
426 for (
i = 1 -
mh;
i < lh;
i += 2, j++)
431 for (
i = 0;
i < lh;
i++)
437 for (lp = 0; lp < lh; lp++) {
440 for (
i =
mv;
i < lv;
i += 2, j++)
442 for (
i = 1 -
mv;
i < lv;
i += 2, j++)
447 for (
i = 0;
i < lv;
i++)
459 p[1] = (p[1] *
I_LFTG_K + (1<<16)) >> 17;
461 p[0] = (p[0] *
I_LFTG_X + (1<<15)) >> 16;
467 for (
i = (i0 >> 1) - 1;
i < (i1 >> 1) + 2;
i++)
470 for (
i = (i0 >> 1) - 1;
i < (i1 >> 1) + 1;
i++)
473 for (
i = (i0 >> 1);
i < (i1 >> 1) + 1;
i++)
476 for (
i = (i0 >> 1);
i < (i1 >> 1);
i++) {
486 int w =
s->linelen[
s->ndeclevels - 1][0];
487 int h =
s->linelen[
s->ndeclevels - 1][1];
495 int lh =
s->linelen[
lev][0],
496 lv =
s->linelen[
lev][1],
503 for (lp = 0; lp < lv; lp++) {
506 for (
i =
mh;
i < lh;
i += 2, j++)
508 for (
i = 1 -
mh;
i < lh;
i += 2, j++)
513 for (
i = 0;
i < lh;
i++)
519 for (lp = 0; lp < lh; lp++) {
522 for (
i =
mv;
i < lv;
i += 2, j++)
524 for (
i = 1 -
mv;
i < lv;
i += 2, j++)
529 for (
i = 0;
i < lv;
i++)
534 for (
i = 0;
i <
w *
h;
i++)
540 int decomp_levels,
int type)
542 int i, j,
lev = decomp_levels, maxlen,
545 s->ndeclevels = decomp_levels;
548 for (
i = 0;
i < 2;
i++)
549 for (j = 0; j < 2; j++)
550 b[
i][j] = border[
i][j];
552 maxlen =
FFMAX(
b[0][1] -
b[0][0],
555 for (
i = 0;
i < 2;
i++) {
558 for (j = 0; j < 2; j++)
559 b[
i][j] = (
b[
i][j] + 1) >> 1;
585 if (
s->ndeclevels == 0)
603 if (
s->ndeclevels == 0)
static void sd_1d53(int *p, int i0, int i1)
int ff_dwt_decode(DWTContext *s, void *t)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
static const int8_t mv[256][2]
static void extend53(int *p, int i0, int i1)
int ff_dwt_encode(DWTContext *s, void *t)
static void dwt_decode97_int(DWTContext *s, int32_t *t)
static void sr_1d53(unsigned *p, int i0, int i1)
static void dwt_encode97_int(DWTContext *s, int *t)
static void sr_1d97_int(int32_t *p, int i0, int i1)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
#define I_LFTG_ALPHA_PRIME
static void dwt_decode53(DWTContext *s, int *t)
static void dwt_decode97_float(DWTContext *s, float *t)
static void extend97_float(float *p, int i0, int i1)
static void sd_1d97_int(int *p, int i0, int i1)
static void dwt_encode53(DWTContext *s, int *t)
int ff_jpeg2000_dwt_init(DWTContext *s, int border[2][2], int decomp_levels, int type)
Initialize DWT.
static void dwt_encode97_float(DWTContext *s, float *t)
void ff_dwt_destroy(DWTContext *s)
#define i(width, name, range_min, range_max)
#define av_malloc_array(a, b)
static LevelCodes lev[4+3+3]
static void extend97_int(int32_t *p, int i0, int i1)
static void sr_1d97_float(float *p, int i0, int i1)
static void sd_1d97_float(float *p, int i0, int i1)