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 103949ll
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
50 static inline void extend53(
int *p,
int i0,
int i1)
52 p[i0 - 1] = p[i0 + 1];
54 p[i0 - 2] = p[i0 + 2];
55 p[i1 + 1] = p[i1 - 3];
62 for (
i = 1;
i <= 4;
i++) {
63 p[i0 -
i] = p[i0 +
i];
64 p[i1 +
i - 1] = p[i1 -
i - 1];
72 for (
i = 1;
i <= 4;
i++) {
73 p[i0 -
i] = p[i0 +
i];
74 p[i1 +
i - 1] = p[i1 -
i - 1];
78 static void sd_1d53(
int *p,
int i0,
int i1)
90 for (
i = ((i0+1)>>1) - 1;
i < (i1+1)>>1;
i++)
91 p[2*
i+1] -= (p[2*
i] + p[2*
i+2]) >> 1;
92 for (
i = ((i0+1)>>1);
i < (i1+1)>>1;
i++)
93 p[2*
i] += (p[2*
i-1] + p[2*
i+1] + 2) >> 2;
99 w =
s->linelen[
s->ndeclevels-1][0];
100 int *
line =
s->i_linebuf;
104 int lh =
s->linelen[
lev][0],
105 lv =
s->linelen[
lev][1],
113 for (lp = 0; lp < lh; lp++) {
116 for (
i = 0;
i < lv;
i++)
122 for (
i =
mv;
i < lv;
i+=2, j++)
124 for (
i = 1-
mv;
i < lv;
i+=2, j++)
130 for (lp = 0; lp < lv; lp++){
133 for (
i = 0;
i < lh;
i++)
139 for (
i =
mh;
i < lh;
i+=2, j++)
141 for (
i = 1-
mh;
i < lh;
i+=2, j++)
161 for (
i = (i0>>1) - 2;
i < (i1>>1) + 1;
i++)
162 p[2*
i+1] -= 1.586134 * (p[2*
i] + p[2*
i+2]);
163 for (
i = (i0>>1) - 1;
i < (i1>>1) + 1;
i++)
164 p[2*
i] -= 0.052980 * (p[2*
i-1] + p[2*
i+1]);
165 for (
i = (i0>>1) - 1;
i < (i1>>1);
i++)
166 p[2*
i+1] += 0.882911 * (p[2*
i] + p[2*
i+2]);
167 for (
i = (i0>>1);
i < (i1>>1);
i++)
168 p[2*
i] += 0.443506 * (p[2*
i-1] + p[2*
i+1]);
174 w =
s->linelen[
s->ndeclevels-1][0];
175 float *
line =
s->f_linebuf;
179 int lh =
s->linelen[
lev][0],
180 lv =
s->linelen[
lev][1],
188 for (lp = 0; lp < lv; lp++){
191 for (
i = 0;
i < lh;
i++)
197 for (
i =
mh;
i < lh;
i+=2, j++)
199 for (
i = 1-
mh;
i < lh;
i+=2, j++)
205 for (lp = 0; lp < lh; lp++) {
208 for (
i = 0;
i < lv;
i++)
214 for (
i =
mv;
i < lv;
i+=2, j++)
216 for (
i = 1-
mv;
i < lv;
i+=2, j++)
228 p[1] = (p[1] *
I_LFTG_X + (1<<14)) >> 15;
230 p[0] = (p[0] *
I_LFTG_K + (1<<15)) >> 16;
237 for (
i = (i0>>1) - 2;
i < (i1>>1) + 1;
i++)
238 p[2 *
i + 1] -= (
I_LFTG_ALPHA * (p[2 *
i] + p[2 *
i + 2]) + (1 << 15)) >> 16;
239 for (
i = (i0>>1) - 1;
i < (i1>>1) + 1;
i++)
240 p[2 *
i] -= (
I_LFTG_BETA * (p[2 *
i - 1] + p[2 *
i + 1]) + (1 << 15)) >> 16;
241 for (
i = (i0>>1) - 1;
i < (i1>>1);
i++)
242 p[2 *
i + 1] += (
I_LFTG_GAMMA * (p[2 *
i] + p[2 *
i + 2]) + (1 << 15)) >> 16;
243 for (
i = (i0>>1);
i < (i1>>1);
i++)
244 p[2 *
i] += (
I_LFTG_DELTA * (p[2 *
i - 1] + p[2 *
i + 1]) + (1 << 15)) >> 16;
250 int w =
s->linelen[
s->ndeclevels-1][0];
251 int h =
s->linelen[
s->ndeclevels-1][1];
253 int *
line =
s->i_linebuf;
256 for (
i = 0;
i <
w *
h;
i++)
260 int lh =
s->linelen[
lev][0],
261 lv =
s->linelen[
lev][1],
269 for (lp = 0; lp < lh; lp++) {
272 for (
i = 0;
i < lv;
i++)
278 for (
i =
mv;
i < lv;
i+=2, j++)
279 t[
w*j + lp] = ((l[
i] *
I_LFTG_X) + (1 << 15)) >> 16;
280 for (
i = 1-
mv;
i < lv;
i+=2, j++)
286 for (lp = 0; lp < lv; lp++){
289 for (
i = 0;
i < lh;
i++)
295 for (
i =
mh;
i < lh;
i+=2, j++)
296 t[
w*lp + j] = ((l[
i] *
I_LFTG_X) + (1 << 15)) >> 16;
297 for (
i = 1-
mh;
i < lh;
i+=2, j++)
303 for (
i = 0;
i <
w *
h;
i++)
307 static void sr_1d53(
unsigned *p,
int i0,
int i1)
313 p[1] = (
int)p[1] >> 1;
319 for (
i = (i0 >> 1);
i < (i1 >> 1) + 1;
i++)
320 p[2 *
i] -= (
int)(p[2 *
i - 1] + p[2 *
i + 1] + 2) >> 2;
321 for (
i = (i0 >> 1);
i < (i1 >> 1);
i++)
322 p[2 *
i + 1] += (
int)(p[2 *
i] + p[2 *
i + 2]) >> 1;
328 int w =
s->linelen[
s->ndeclevels - 1][0];
333 int lh =
s->linelen[
lev][0],
334 lv =
s->linelen[
lev][1],
342 for (lp = 0; lp < lv; lp++) {
345 for (
i =
mh;
i < lh;
i += 2, j++)
346 l[
i] = t[
w * lp + j];
347 for (
i = 1 -
mh;
i < lh;
i += 2, j++)
348 l[
i] = t[
w * lp + j];
352 for (
i = 0;
i < lh;
i++)
353 t[
w * lp +
i] = l[
i];
358 for (lp = 0; lp < lh; lp++) {
361 for (
i =
mv;
i < lv;
i += 2, j++)
362 l[
i] = t[
w * j + lp];
363 for (
i = 1 -
mv;
i < lv;
i += 2, j++)
364 l[
i] = t[
w * j + lp];
368 for (
i = 0;
i < lv;
i++)
369 t[
w *
i + lp] = l[
i];
388 for (
i = (i0 >> 1) - 1;
i < (i1 >> 1) + 2;
i++)
391 for (
i = (i0 >> 1) - 1;
i < (i1 >> 1) + 1;
i++)
394 for (
i = (i0 >> 1);
i < (i1 >> 1) + 1;
i++)
397 for (
i = (i0 >> 1);
i < (i1 >> 1);
i++)
404 int w =
s->linelen[
s->ndeclevels - 1][0];
405 float *
line =
s->f_linebuf;
411 int lh =
s->linelen[
lev][0],
412 lv =
s->linelen[
lev][1],
419 for (lp = 0; lp < lv; lp++) {
422 for (
i =
mh;
i < lh;
i += 2, j++)
424 for (
i = 1 -
mh;
i < lh;
i += 2, j++)
429 for (
i = 0;
i < lh;
i++)
435 for (lp = 0; lp < lh; lp++) {
438 for (
i =
mv;
i < lv;
i += 2, j++)
440 for (
i = 1 -
mv;
i < lv;
i += 2, j++)
445 for (
i = 0;
i < lv;
i++)
457 p[1] = (p[1] *
I_LFTG_K + (1<<16)) >> 17;
459 p[0] = (p[0] *
I_LFTG_X + (1<<15)) >> 16;
465 for (
i = (i0 >> 1) - 1;
i < (i1 >> 1) + 2;
i++)
466 p[2 *
i] -= (
I_LFTG_DELTA * (p[2 *
i - 1] + (int64_t)p[2 *
i + 1]) + (1 << 15)) >> 16;
468 for (
i = (i0 >> 1) - 1;
i < (i1 >> 1) + 1;
i++)
469 p[2 *
i + 1] -= (
I_LFTG_GAMMA * (p[2 *
i] + (int64_t)p[2 *
i + 2]) + (1 << 15)) >> 16;
471 for (
i = (i0 >> 1);
i < (i1 >> 1) + 1;
i++)
472 p[2 *
i] += (
I_LFTG_BETA * (p[2 *
i - 1] + (int64_t)p[2 *
i + 1]) + (1 << 15)) >> 16;
474 for (
i = (i0 >> 1);
i < (i1 >> 1);
i++)
475 p[2 *
i + 1] += (
I_LFTG_ALPHA * (p[2 *
i] + (int64_t)p[2 *
i + 2]) + (1 << 15)) >> 16;
481 int w =
s->linelen[
s->ndeclevels - 1][0];
482 int h =
s->linelen[
s->ndeclevels - 1][1];
489 for (
i = 0;
i <
w *
h;
i++)
493 int lh =
s->linelen[
lev][0],
494 lv =
s->linelen[
lev][1],
501 for (lp = 0; lp < lv; lp++) {
504 for (
i =
mh;
i < lh;
i += 2, j++)
506 for (
i = 1 -
mh;
i < lh;
i += 2, j++)
511 for (
i = 0;
i < lh;
i++)
517 for (lp = 0; lp < lh; lp++) {
520 for (
i =
mv;
i < lv;
i += 2, j++)
522 for (
i = 1 -
mv;
i < lv;
i += 2, j++)
527 for (
i = 0;
i < lv;
i++)
532 for (
i = 0;
i <
w *
h;
i++)
537 int decomp_levels,
int type)
539 int i, j,
lev = decomp_levels, maxlen,
542 s->ndeclevels = decomp_levels;
545 for (
i = 0;
i < 2;
i++)
546 for (j = 0; j < 2; j++)
547 b[
i][j] = border[
i][j];
549 maxlen =
FFMAX(
b[0][1] -
b[0][0],
552 for (
i = 0;
i < 2;
i++) {
555 for (j = 0; j < 2; j++)
556 b[
i][j] = (
b[
i][j] + 1) >> 1;
582 if (
s->ndeclevels == 0)
600 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 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)