Go to the documentation of this file.
36 #define F_LFTG_ALPHA 1.586134342059924f
37 #define F_LFTG_BETA 0.052980118572961f
38 #define F_LFTG_GAMMA 0.882911075530934f
39 #define F_LFTG_DELTA 0.443506852043971f
43 #define I_LFTG_ALPHA 103949ll
44 #define I_LFTG_BETA 3472ll
45 #define I_LFTG_GAMMA 57862ll
46 #define I_LFTG_DELTA 29066ll
47 #define I_LFTG_K 80621ll
48 #define I_LFTG_X 53274ll
51 static inline void extend53(
int *p,
int i0,
int i1)
53 p[i0 - 1] = p[i0 + 1];
55 p[i0 - 2] = p[i0 + 2];
56 p[i1 + 1] = p[i1 - 3];
63 for (
i = 1;
i <= 4;
i++) {
64 p[i0 -
i] = p[i0 +
i];
65 p[i1 +
i - 1] = p[i1 -
i - 1];
73 for (
i = 1;
i <= 4;
i++) {
74 p[i0 -
i] = p[i0 +
i];
75 p[i1 +
i - 1] = p[i1 -
i - 1];
79 static void sd_1d53(
int *p,
int i0,
int i1)
91 for (
i = ((i0+1)>>1) - 1;
i < (i1+1)>>1;
i++)
92 p[2*
i+1] -= (p[2*
i] + p[2*
i+2]) >> 1;
93 for (
i = ((i0+1)>>1);
i < (i1+1)>>1;
i++)
94 p[2*
i] += (p[2*
i-1] + p[2*
i+1] + 2) >> 2;
100 w =
s->linelen[
s->ndeclevels-1][0];
101 int *
line =
s->i_linebuf;
104 for (lev =
s->ndeclevels-1; lev >= 0; lev--){
105 int lh =
s->linelen[lev][0],
106 lv =
s->linelen[lev][1],
114 for (lp = 0; lp < lh; lp++) {
117 for (
i = 0;
i < lv;
i++)
123 for (
i =
mv;
i < lv;
i+=2, j++)
125 for (
i = 1-
mv;
i < lv;
i+=2, j++)
131 for (lp = 0; lp < lv; lp++){
134 for (
i = 0;
i < lh;
i++)
140 for (
i =
mh;
i < lh;
i+=2, j++)
142 for (
i = 1-
mh;
i < lh;
i+=2, j++)
162 for (
i = (i0>>1) - 2;
i < (i1>>1) + 1;
i++)
163 p[2*
i+1] -= 1.586134 * (p[2*
i] + p[2*
i+2]);
164 for (
i = (i0>>1) - 1;
i < (i1>>1) + 1;
i++)
165 p[2*
i] -= 0.052980 * (p[2*
i-1] + p[2*
i+1]);
166 for (
i = (i0>>1) - 1;
i < (i1>>1);
i++)
167 p[2*
i+1] += 0.882911 * (p[2*
i] + p[2*
i+2]);
168 for (
i = (i0>>1);
i < (i1>>1);
i++)
169 p[2*
i] += 0.443506 * (p[2*
i-1] + p[2*
i+1]);
175 w =
s->linelen[
s->ndeclevels-1][0];
176 float *
line =
s->f_linebuf;
179 for (lev =
s->ndeclevels-1; lev >= 0; lev--){
180 int lh =
s->linelen[lev][0],
181 lv =
s->linelen[lev][1],
189 for (lp = 0; lp < lv; lp++){
192 for (
i = 0;
i < lh;
i++)
198 for (
i =
mh;
i < lh;
i+=2, j++)
200 for (
i = 1-
mh;
i < lh;
i+=2, j++)
206 for (lp = 0; lp < lh; lp++) {
209 for (
i = 0;
i < lv;
i++)
215 for (
i =
mv;
i < lv;
i+=2, j++)
217 for (
i = 1-
mv;
i < lv;
i+=2, j++)
229 p[1] = (p[1] *
I_LFTG_X + (1<<14)) >> 15;
231 p[0] = (p[0] *
I_LFTG_K + (1<<15)) >> 16;
238 for (
i = (i0>>1) - 2;
i < (i1>>1) + 1;
i++)
239 p[2 *
i + 1] -= (
I_LFTG_ALPHA * (p[2 *
i] + p[2 *
i + 2]) + (1 << 15)) >> 16;
240 for (
i = (i0>>1) - 1;
i < (i1>>1) + 1;
i++)
241 p[2 *
i] -= (
I_LFTG_BETA * (p[2 *
i - 1] + p[2 *
i + 1]) + (1 << 15)) >> 16;
242 for (
i = (i0>>1) - 1;
i < (i1>>1);
i++)
243 p[2 *
i + 1] += (
I_LFTG_GAMMA * (p[2 *
i] + p[2 *
i + 2]) + (1 << 15)) >> 16;
244 for (
i = (i0>>1);
i < (i1>>1);
i++)
245 p[2 *
i] += (
I_LFTG_DELTA * (p[2 *
i - 1] + p[2 *
i + 1]) + (1 << 15)) >> 16;
251 int w =
s->linelen[
s->ndeclevels-1][0];
252 int h =
s->linelen[
s->ndeclevels-1][1];
254 int *
line =
s->i_linebuf;
257 for (
i = 0;
i <
w *
h;
i++)
260 for (lev =
s->ndeclevels-1; lev >= 0; lev--){
261 int lh =
s->linelen[lev][0],
262 lv =
s->linelen[lev][1],
270 for (lp = 0; lp < lh; lp++) {
273 for (
i = 0;
i < lv;
i++)
279 for (
i =
mv;
i < lv;
i+=2, j++)
280 t[
w*j + lp] = ((l[
i] *
I_LFTG_X) + (1 << 15)) >> 16;
281 for (
i = 1-
mv;
i < lv;
i+=2, j++)
287 for (lp = 0; lp < lv; lp++){
290 for (
i = 0;
i < lh;
i++)
296 for (
i =
mh;
i < lh;
i+=2, j++)
297 t[
w*lp + j] = ((l[
i] *
I_LFTG_X) + (1 << 15)) >> 16;
298 for (
i = 1-
mh;
i < lh;
i+=2, j++)
304 for (
i = 0;
i <
w *
h;
i++)
308 static void sr_1d53(
unsigned *p,
int i0,
int i1)
314 p[1] = (
int)p[1] >> 1;
320 for (
i = (i0 >> 1);
i < (i1 >> 1) + 1;
i++)
321 p[2 *
i] -= (
int)(p[2 *
i - 1] + p[2 *
i + 1] + 2) >> 2;
322 for (
i = (i0 >> 1);
i < (i1 >> 1);
i++)
323 p[2 *
i + 1] += (
int)(p[2 *
i] + p[2 *
i + 2]) >> 1;
329 int w =
s->linelen[
s->ndeclevels - 1][0];
333 for (lev = 0; lev <
s->ndeclevels; lev++) {
334 int lh =
s->linelen[lev][0],
335 lv =
s->linelen[lev][1],
343 for (lp = 0; lp < lv; lp++) {
346 for (
i =
mh;
i < lh;
i += 2, j++)
347 l[
i] = t[
w * lp + j];
348 for (
i = 1 -
mh;
i < lh;
i += 2, j++)
349 l[
i] = t[
w * lp + j];
353 for (
i = 0;
i < lh;
i++)
354 t[
w * lp +
i] = l[
i];
359 for (lp = 0; lp < lh; lp++) {
362 for (
i =
mv;
i < lv;
i += 2, j++)
363 l[
i] = t[
w * j + lp];
364 for (
i = 1 -
mv;
i < lv;
i += 2, j++)
365 l[
i] = t[
w * j + lp];
369 for (
i = 0;
i < lv;
i++)
370 t[
w *
i + lp] = l[
i];
389 for (
i = (i0 >> 1) - 1;
i < (i1 >> 1) + 2;
i++)
392 for (
i = (i0 >> 1) - 1;
i < (i1 >> 1) + 1;
i++)
395 for (
i = (i0 >> 1);
i < (i1 >> 1) + 1;
i++)
398 for (
i = (i0 >> 1);
i < (i1 >> 1);
i++)
405 int w =
s->linelen[
s->ndeclevels - 1][0];
406 float *
line =
s->f_linebuf;
411 for (lev = 0; lev <
s->ndeclevels; lev++) {
412 int lh =
s->linelen[lev][0],
413 lv =
s->linelen[lev][1],
420 for (lp = 0; lp < lv; lp++) {
423 for (
i =
mh;
i < lh;
i += 2, j++)
425 for (
i = 1 -
mh;
i < lh;
i += 2, j++)
430 for (
i = 0;
i < lh;
i++)
436 for (lp = 0; lp < lh; lp++) {
439 for (
i =
mv;
i < lv;
i += 2, j++)
441 for (
i = 1 -
mv;
i < lv;
i += 2, j++)
446 for (
i = 0;
i < lv;
i++)
458 p[1] = (p[1] *
I_LFTG_K + (1<<16)) >> 17;
460 p[0] = (p[0] *
I_LFTG_X + (1<<15)) >> 16;
466 for (
i = (i0 >> 1) - 1;
i < (i1 >> 1) + 2;
i++)
467 p[2 *
i] -= (
I_LFTG_DELTA * (p[2 *
i - 1] + (int64_t)p[2 *
i + 1]) + (1 << 15)) >> 16;
469 for (
i = (i0 >> 1) - 1;
i < (i1 >> 1) + 1;
i++)
470 p[2 *
i + 1] -= (
I_LFTG_GAMMA * (p[2 *
i] + (int64_t)p[2 *
i + 2]) + (1 << 15)) >> 16;
472 for (
i = (i0 >> 1);
i < (i1 >> 1) + 1;
i++)
473 p[2 *
i] += (
I_LFTG_BETA * (p[2 *
i - 1] + (int64_t)p[2 *
i + 1]) + (1 << 15)) >> 16;
475 for (
i = (i0 >> 1);
i < (i1 >> 1);
i++)
476 p[2 *
i + 1] += (
I_LFTG_ALPHA * (p[2 *
i] + (int64_t)p[2 *
i + 2]) + (1 << 15)) >> 16;
482 int w =
s->linelen[
s->ndeclevels - 1][0];
483 int h =
s->linelen[
s->ndeclevels - 1][1];
490 for (
i = 0;
i <
w *
h;
i++)
493 for (lev = 0; lev <
s->ndeclevels; lev++) {
494 int lh =
s->linelen[lev][0],
495 lv =
s->linelen[lev][1],
502 for (lp = 0; lp < lv; lp++) {
505 for (
i =
mh;
i < lh;
i += 2, j++)
507 for (
i = 1 -
mh;
i < lh;
i += 2, j++)
512 for (
i = 0;
i < lh;
i++)
518 for (lp = 0; lp < lh; lp++) {
521 for (
i =
mv;
i < lv;
i += 2, j++)
523 for (
i = 1 -
mv;
i < lv;
i += 2, j++)
528 for (
i = 0;
i < lv;
i++)
533 for (
i = 0;
i <
w *
h;
i++)
538 int decomp_levels,
int type)
540 int i, j, lev = decomp_levels, maxlen,
543 s->ndeclevels = decomp_levels;
546 for (
i = 0;
i < 2;
i++)
547 for (j = 0; j < 2; j++)
548 b[
i][j] = border[
i][j];
550 maxlen =
FFMAX(
b[0][1] -
b[0][0],
553 for (
i = 0;
i < 2;
i++) {
554 s->linelen[lev][
i] =
b[
i][1] -
b[
i][0];
555 s->mod[lev][
i] =
b[
i][0] & 1;
556 for (j = 0; j < 2; j++)
557 b[
i][j] = (
b[
i][j] + 1) >> 1;
583 if (
s->ndeclevels == 0)
601 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
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 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)