62                              const float *
src, 
int src_linesize,
 
   63                              float *dst, 
int dst_linesize,
 
   69                               float **
src, 
int src_linesize,
 
   75 #define DEFAULT_NBITS 3 
   77 #define OFFSET(x) offsetof(DCTdnoizContext, x) 
   78 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM 
   92                                       int dst_stridea, 
int dst_strideb,
 
   93                                       int src_stridea, 
int src_strideb)
 
   97     for (i = 0; i < 8; i++) {
 
   98         const float x00 = src[0*src_stridea] + src[7*src_stridea];
 
   99         const float x01 = src[1*src_stridea] + src[6*src_stridea];
 
  100         const float x02 = src[2*src_stridea] + src[5*src_stridea];
 
  101         const float x03 = src[3*src_stridea] + src[4*src_stridea];
 
  102         const float x04 = src[0*src_stridea] - src[7*src_stridea];
 
  103         const float x05 = src[1*src_stridea] - src[6*src_stridea];
 
  104         const float x06 = src[2*src_stridea] - src[5*src_stridea];
 
  105         const float x07 = src[3*src_stridea] - src[4*src_stridea];
 
  106         const float x08 = x00 + x03;
 
  107         const float x09 = x01 + x02;
 
  108         const float x0a = x00 - x03;
 
  109         const float x0b = x01 - x02;
 
  110         const float x0c = 1.38703984532215f*x04 + 0.275899379282943f*x07;
 
  111         const float x0d = 1.17587560241936f*x05 + 0.785694958387102f*x06;
 
  112         const float x0e = -0.785694958387102f*x05 + 1.17587560241936f*x06;
 
  113         const float x0f = 0.275899379282943f*x04 - 1.38703984532215f*x07;
 
  114         const float x10 = 0.353553390593274f * (x0c - x0d);
 
  115         const float x11 = 0.353553390593274f * (x0e - x0f);
 
  116         dst[0*dst_stridea] = 0.353553390593274f * (x08 + x09);
 
  117         dst[1*dst_stridea] = 0.353553390593274f * (x0c + x0d);
 
  118         dst[2*dst_stridea] = 0.461939766255643f*x0a + 0.191341716182545f*x0b;
 
  119         dst[3*dst_stridea] = 0.707106781186547f * (x10 - x11);
 
  120         dst[4*dst_stridea] = 0.353553390593274f * (x08 - x09);
 
  121         dst[5*dst_stridea] = 0.707106781186547f * (x10 + x11);
 
  122         dst[6*dst_stridea] = 0.191341716182545f*x0a - 0.461939766255643f*x0b;
 
  123         dst[7*dst_stridea] = 0.353553390593274f * (x0e + x0f);
 
  130                                       int dst_stridea, 
int dst_strideb,
 
  131                                       int src_stridea, 
int src_strideb,
 
  136     for (i = 0; i < 8; i++) {
 
  137         const float x00 =  1.4142135623731f  *src[0*src_stridea];
 
  138         const float x01 =  1.38703984532215f *src[1*src_stridea] + 0.275899379282943f*src[7*src_stridea];
 
  139         const float x02 =  1.30656296487638f *src[2*src_stridea] + 0.541196100146197f*src[6*src_stridea];
 
  140         const float x03 =  1.17587560241936f *src[3*src_stridea] + 0.785694958387102f*src[5*src_stridea];
 
  141         const float x04 =  1.4142135623731f  *src[4*src_stridea];
 
  142         const float x05 = -0.785694958387102f*src[3*src_stridea] + 1.17587560241936f*src[5*src_stridea];
 
  143         const float x06 =  0.541196100146197f*src[2*src_stridea] - 1.30656296487638f*src[6*src_stridea];
 
  144         const float x07 = -0.275899379282943f*src[1*src_stridea] + 1.38703984532215f*src[7*src_stridea];
 
  145         const float x09 = x00 + x04;
 
  146         const float x0a = x01 + x03;
 
  147         const float x0b = 1.4142135623731f*x02;
 
  148         const float x0c = x00 - x04;
 
  149         const float x0d = x01 - x03;
 
  150         const float x0e = 0.353553390593274f * (x09 - x0b);
 
  151         const float x0f = 0.353553390593274f * (x0c + x0d);
 
  152         const float x10 = 0.353553390593274f * (x0c - x0d);
 
  153         const float x11 = 1.4142135623731f*x06;
 
  154         const float x12 = x05 + x07;
 
  155         const float x13 = x05 - x07;
 
  156         const float x14 = 0.353553390593274f * (x11 + x12);
 
  157         const float x15 = 0.353553390593274f * (x11 - x12);
 
  158         const float x16 = 0.5f*x13;
 
  159         dst[0*dst_stridea] = (add ? dst[ 0*dst_stridea] : 0) + 0.25f * (x09 + x0b) + 0.353553390593274f*x0a;
 
  160         dst[1*dst_stridea] = (add ? dst[ 1*dst_stridea] : 0) + 0.707106781186547f * (x0f + x15);
 
  161         dst[2*dst_stridea] = (add ? dst[ 2*dst_stridea] : 0) + 0.707106781186547f * (x0f - x15);
 
  162         dst[3*dst_stridea] = (add ? dst[ 3*dst_stridea] : 0) + 0.707106781186547f * (x0e + x16);
 
  163         dst[4*dst_stridea] = (add ? dst[ 4*dst_stridea] : 0) + 0.707106781186547f * (x0e - x16);
 
  164         dst[5*dst_stridea] = (add ? dst[ 5*dst_stridea] : 0) + 0.707106781186547f * (x10 - x14);
 
  165         dst[6*dst_stridea] = (add ? dst[ 6*dst_stridea] : 0) + 0.707106781186547f * (x10 + x14);
 
  166         dst[7*dst_stridea] = (add ? dst[ 7*dst_stridea] : 0) + 0.25f * (x09 + x0b) - 0.353553390593274f*x0a;
 
  174                                        int dst_stridea, 
int dst_strideb,
 
  175                                        int src_stridea, 
int src_strideb)
 
  179     for (i = 0; i < 16; i++) {
 
  180         const float x00 = src[ 0*src_stridea] + src[15*src_stridea];
 
  181         const float x01 = src[ 1*src_stridea] + src[14*src_stridea];
 
  182         const float x02 = src[ 2*src_stridea] + src[13*src_stridea];
 
  183         const float x03 = src[ 3*src_stridea] + src[12*src_stridea];
 
  184         const float x04 = src[ 4*src_stridea] + src[11*src_stridea];
 
  185         const float x05 = src[ 5*src_stridea] + src[10*src_stridea];
 
  186         const float x06 = src[ 6*src_stridea] + src[ 9*src_stridea];
 
  187         const float x07 = src[ 7*src_stridea] + src[ 8*src_stridea];
 
  188         const float x08 = src[ 0*src_stridea] - src[15*src_stridea];
 
  189         const float x09 = src[ 1*src_stridea] - src[14*src_stridea];
 
  190         const float x0a = src[ 2*src_stridea] - src[13*src_stridea];
 
  191         const float x0b = src[ 3*src_stridea] - src[12*src_stridea];
 
  192         const float x0c = src[ 4*src_stridea] - src[11*src_stridea];
 
  193         const float x0d = src[ 5*src_stridea] - src[10*src_stridea];
 
  194         const float x0e = src[ 6*src_stridea] - src[ 9*src_stridea];
 
  195         const float x0f = src[ 7*src_stridea] - src[ 8*src_stridea];
 
  196         const float x10 = x00 + x07;
 
  197         const float x11 = x01 + x06;
 
  198         const float x12 = x02 + x05;
 
  199         const float x13 = x03 + x04;
 
  200         const float x14 = x00 - x07;
 
  201         const float x15 = x01 - x06;
 
  202         const float x16 = x02 - x05;
 
  203         const float x17 = x03 - x04;
 
  204         const float x18 = x10 + x13;
 
  205         const float x19 = x11 + x12;
 
  206         const float x1a = x10 - x13;
 
  207         const float x1b = x11 - x12;
 
  208         const float x1c =   1.38703984532215f*x14 + 0.275899379282943f*x17;
 
  209         const float x1d =   1.17587560241936f*x15 + 0.785694958387102f*x16;
 
  210         const float x1e = -0.785694958387102f*x15 + 1.17587560241936f *x16;
 
  211         const float x1f =  0.275899379282943f*x14 - 1.38703984532215f *x17;
 
  212         const float x20 = 0.25f * (x1c - x1d);
 
  213         const float x21 = 0.25f * (x1e - x1f);
 
  214         const float x22 =  1.40740373752638f *x08 + 0.138617169199091f*x0f;
 
  215         const float x23 =  1.35331800117435f *x09 + 0.410524527522357f*x0e;
 
  216         const float x24 =  1.24722501298667f *x0a + 0.666655658477747f*x0d;
 
  217         const float x25 =  1.09320186700176f *x0b + 0.897167586342636f*x0c;
 
  218         const float x26 = -0.897167586342636f*x0b + 1.09320186700176f *x0c;
 
  219         const float x27 =  0.666655658477747f*x0a - 1.24722501298667f *x0d;
 
  220         const float x28 = -0.410524527522357f*x09 + 1.35331800117435f *x0e;
 
  221         const float x29 =  0.138617169199091f*x08 - 1.40740373752638f *x0f;
 
  222         const float x2a = x22 + x25;
 
  223         const float x2b = x23 + x24;
 
  224         const float x2c = x22 - x25;
 
  225         const float x2d = x23 - x24;
 
  226         const float x2e = 0.25f * (x2a - x2b);
 
  227         const float x2f = 0.326640741219094f*x2c + 0.135299025036549f*x2d;
 
  228         const float x30 = 0.135299025036549f*x2c - 0.326640741219094f*x2d;
 
  229         const float x31 = x26 + x29;
 
  230         const float x32 = x27 + x28;
 
  231         const float x33 = x26 - x29;
 
  232         const float x34 = x27 - x28;
 
  233         const float x35 = 0.25f * (x31 - x32);
 
  234         const float x36 = 0.326640741219094f*x33 + 0.135299025036549f*x34;
 
  235         const float x37 = 0.135299025036549f*x33 - 0.326640741219094f*x34;
 
  236         dst[ 0*dst_stridea] = 0.25f * (x18 + x19);
 
  237         dst[ 1*dst_stridea] = 0.25f * (x2a + x2b);
 
  238         dst[ 2*dst_stridea] = 0.25f * (x1c + x1d);
 
  239         dst[ 3*dst_stridea] = 0.707106781186547f * (x2f - x37);
 
  240         dst[ 4*dst_stridea] = 0.326640741219094f*x1a + 0.135299025036549f*x1b;
 
  241         dst[ 5*dst_stridea] = 0.707106781186547f * (x2f + x37);
 
  242         dst[ 6*dst_stridea] = 0.707106781186547f * (x20 - x21);
 
  243         dst[ 7*dst_stridea] = 0.707106781186547f * (x2e + x35);
 
  244         dst[ 8*dst_stridea] = 0.25f * (x18 - x19);
 
  245         dst[ 9*dst_stridea] = 0.707106781186547f * (x2e - x35);
 
  246         dst[10*dst_stridea] = 0.707106781186547f * (x20 + x21);
 
  247         dst[11*dst_stridea] = 0.707106781186547f * (x30 - x36);
 
  248         dst[12*dst_stridea] = 0.135299025036549f*x1a - 0.326640741219094f*x1b;
 
  249         dst[13*dst_stridea] = 0.707106781186547f * (x30 + x36);
 
  250         dst[14*dst_stridea] = 0.25f * (x1e + x1f);
 
  251         dst[15*dst_stridea] = 0.25f * (x31 + x32);
 
  258                                        int dst_stridea, 
int dst_strideb,
 
  259                                        int src_stridea, 
int src_strideb,
 
  264     for (i = 0; i < 16; i++) {
 
  265         const float x00 =  1.4142135623731f  *src[ 0*src_stridea];
 
  266         const float x01 =  1.40740373752638f *src[ 1*src_stridea] + 0.138617169199091f*src[15*src_stridea];
 
  267         const float x02 =  1.38703984532215f *src[ 2*src_stridea] + 0.275899379282943f*src[14*src_stridea];
 
  268         const float x03 =  1.35331800117435f *src[ 3*src_stridea] + 0.410524527522357f*src[13*src_stridea];
 
  269         const float x04 =  1.30656296487638f *src[ 4*src_stridea] + 0.541196100146197f*src[12*src_stridea];
 
  270         const float x05 =  1.24722501298667f *src[ 5*src_stridea] + 0.666655658477747f*src[11*src_stridea];
 
  271         const float x06 =  1.17587560241936f *src[ 6*src_stridea] + 0.785694958387102f*src[10*src_stridea];
 
  272         const float x07 =  1.09320186700176f *src[ 7*src_stridea] + 0.897167586342636f*src[ 9*src_stridea];
 
  273         const float x08 =  1.4142135623731f  *src[ 8*src_stridea];
 
  274         const float x09 = -0.897167586342636f*src[ 7*src_stridea] + 1.09320186700176f*src[ 9*src_stridea];
 
  275         const float x0a =  0.785694958387102f*src[ 6*src_stridea] - 1.17587560241936f*src[10*src_stridea];
 
  276         const float x0b = -0.666655658477747f*src[ 5*src_stridea] + 1.24722501298667f*src[11*src_stridea];
 
  277         const float x0c =  0.541196100146197f*src[ 4*src_stridea] - 1.30656296487638f*src[12*src_stridea];
 
  278         const float x0d = -0.410524527522357f*src[ 3*src_stridea] + 1.35331800117435f*src[13*src_stridea];
 
  279         const float x0e =  0.275899379282943f*src[ 2*src_stridea] - 1.38703984532215f*src[14*src_stridea];
 
  280         const float x0f = -0.138617169199091f*src[ 1*src_stridea] + 1.40740373752638f*src[15*src_stridea];
 
  281         const float x12 = x00 + x08;
 
  282         const float x13 = x01 + x07;
 
  283         const float x14 = x02 + x06;
 
  284         const float x15 = x03 + x05;
 
  285         const float x16 = 1.4142135623731f*x04;
 
  286         const float x17 = x00 - x08;
 
  287         const float x18 = x01 - x07;
 
  288         const float x19 = x02 - x06;
 
  289         const float x1a = x03 - x05;
 
  290         const float x1d = x12 + x16;
 
  291         const float x1e = x13 + x15;
 
  292         const float x1f = 1.4142135623731f*x14;
 
  293         const float x20 = x12 - x16;
 
  294         const float x21 = x13 - x15;
 
  295         const float x22 = 0.25f * (x1d - x1f);
 
  296         const float x23 = 0.25f * (x20 + x21);
 
  297         const float x24 = 0.25f * (x20 - x21);
 
  298         const float x25 = 1.4142135623731f*x17;
 
  299         const float x26 = 1.30656296487638f*x18 + 0.541196100146197f*x1a;
 
  300         const float x27 = 1.4142135623731f*x19;
 
  301         const float x28 = -0.541196100146197f*x18 + 1.30656296487638f*x1a;
 
  302         const float x29 = 0.176776695296637f * (x25 + x27) + 0.25f*x26;
 
  303         const float x2a = 0.25f * (x25 - x27);
 
  304         const float x2b = 0.176776695296637f * (x25 + x27) - 0.25f*x26;
 
  305         const float x2c = 0.353553390593274f*x28;
 
  306         const float x1b = 0.707106781186547f * (x2a - x2c);
 
  307         const float x1c = 0.707106781186547f * (x2a + x2c);
 
  308         const float x2d = 1.4142135623731f*x0c;
 
  309         const float x2e = x0b + x0d;
 
  310         const float x2f = x0a + x0e;
 
  311         const float x30 = x09 + x0f;
 
  312         const float x31 = x09 - x0f;
 
  313         const float x32 = x0a - x0e;
 
  314         const float x33 = x0b - x0d;
 
  315         const float x37 = 1.4142135623731f*x2d;
 
  316         const float x38 = 1.30656296487638f*x2e + 0.541196100146197f*x30;
 
  317         const float x39 = 1.4142135623731f*x2f;
 
  318         const float x3a = -0.541196100146197f*x2e + 1.30656296487638f*x30;
 
  319         const float x3b = 0.176776695296637f * (x37 + x39) + 0.25f*x38;
 
  320         const float x3c = 0.25f * (x37 - x39);
 
  321         const float x3d = 0.176776695296637f * (x37 + x39) - 0.25f*x38;
 
  322         const float x3e = 0.353553390593274f*x3a;
 
  323         const float x34 = 0.707106781186547f * (x3c - x3e);
 
  324         const float x35 = 0.707106781186547f * (x3c + x3e);
 
  325         const float x3f = 1.4142135623731f*x32;
 
  326         const float x40 = x31 + x33;
 
  327         const float x41 = x31 - x33;
 
  328         const float x42 = 0.25f * (x3f + x40);
 
  329         const float x43 = 0.25f * (x3f - x40);
 
  330         const float x44 = 0.353553390593274f*x41;
 
  331         dst[ 0*dst_stridea] = (add ? dst[ 0*dst_stridea] : 0) + 0.176776695296637f * (x1d + x1f) + 0.25f*x1e;
 
  332         dst[ 1*dst_stridea] = (add ? dst[ 1*dst_stridea] : 0) + 0.707106781186547f * (x29 + x3d);
 
  333         dst[ 2*dst_stridea] = (add ? dst[ 2*dst_stridea] : 0) + 0.707106781186547f * (x29 - x3d);
 
  334         dst[ 3*dst_stridea] = (add ? dst[ 3*dst_stridea] : 0) + 0.707106781186547f * (x23 - x43);
 
  335         dst[ 4*dst_stridea] = (add ? dst[ 4*dst_stridea] : 0) + 0.707106781186547f * (x23 + x43);
 
  336         dst[ 5*dst_stridea] = (add ? dst[ 5*dst_stridea] : 0) + 0.707106781186547f * (x1b - x35);
 
  337         dst[ 6*dst_stridea] = (add ? dst[ 6*dst_stridea] : 0) + 0.707106781186547f * (x1b + x35);
 
  338         dst[ 7*dst_stridea] = (add ? dst[ 7*dst_stridea] : 0) + 0.707106781186547f * (x22 + x44);
 
  339         dst[ 8*dst_stridea] = (add ? dst[ 8*dst_stridea] : 0) + 0.707106781186547f * (x22 - x44);
 
  340         dst[ 9*dst_stridea] = (add ? dst[ 9*dst_stridea] : 0) + 0.707106781186547f * (x1c + x34);
 
  341         dst[10*dst_stridea] = (add ? dst[10*dst_stridea] : 0) + 0.707106781186547f * (x1c - x34);
 
  342         dst[11*dst_stridea] = (add ? dst[11*dst_stridea] : 0) + 0.707106781186547f * (x24 + x42);
 
  343         dst[12*dst_stridea] = (add ? dst[12*dst_stridea] : 0) + 0.707106781186547f * (x24 - x42);
 
  344         dst[13*dst_stridea] = (add ? dst[13*dst_stridea] : 0) + 0.707106781186547f * (x2b - x3b);
 
  345         dst[14*dst_stridea] = (add ? dst[14*dst_stridea] : 0) + 0.707106781186547f * (x2b + x3b);
 
  346         dst[15*dst_stridea] = (add ? dst[15*dst_stridea] : 0) + 0.176776695296637f * (x1d + x1f) - 0.25f*x1e;
 
  352 #define DEF_FILTER_FREQ_FUNCS(bsize)                                                        \ 
  353 static av_always_inline void filter_freq_##bsize(const float *src, int src_linesize,        \ 
  354                                                  float *dst, int dst_linesize,              \ 
  355                                                  AVExpr *expr, double *var_values,          \ 
  359     DECLARE_ALIGNED(32, float, tmp_block1)[bsize * bsize];                                  \ 
  360     DECLARE_ALIGNED(32, float, tmp_block2)[bsize * bsize];                                  \ 
  363     fdct##bsize##_1d(tmp_block1, src, 1, bsize, 1, src_linesize);                           \ 
  364     fdct##bsize##_1d(tmp_block2, tmp_block1, bsize, 1, bsize, 1);                           \ 
  366     for (i = 0; i < bsize*bsize; i++) {                                                     \ 
  367         float *b = &tmp_block2[i];                                                          \ 
  370             var_values[VAR_C] = FFABS(*b);                                                  \ 
  371             *b *= av_expr_eval(expr, var_values, NULL);                                     \ 
  373             if (FFABS(*b) < sigma_th)                                                       \ 
  379     idct##bsize##_1d(tmp_block1, tmp_block2, 1, bsize, 1, bsize, 0);                        \ 
  380     idct##bsize##_1d(dst, tmp_block1, dst_linesize, 1, bsize, 1, 1);                        \ 
  383 static void filter_freq_sigma_##bsize(DCTdnoizContext *s,                                   \ 
  384                                       const float *src, int src_linesize,                   \ 
  385                                       float *dst, int dst_linesize, int thread_id)          \ 
  387     filter_freq_##bsize(src, src_linesize, dst, dst_linesize, NULL, NULL, s->th);           \ 
  390 static void filter_freq_expr_##bsize(DCTdnoizContext *s,                                    \ 
  391                                      const float *src, int src_linesize,                    \ 
  392                                      float *dst, int dst_linesize, int thread_id)           \ 
  394     filter_freq_##bsize(src, src_linesize, dst, dst_linesize,                               \ 
  395                         s->expr[thread_id], s->var_values[thread_id], 0);                   \ 
  401 #define DCT3X3_0_0  0.5773502691896258f  
  402 #define DCT3X3_0_1  0.5773502691896258f  
  403 #define DCT3X3_0_2  0.5773502691896258f  
  404 #define DCT3X3_1_0  0.7071067811865475f  
  405 #define DCT3X3_1_2 -0.7071067811865475f  
  406 #define DCT3X3_2_0  0.4082482904638631f  
  407 #define DCT3X3_2_1 -0.8164965809277261f  
  408 #define DCT3X3_2_2  0.4082482904638631f  
  416     float *dstp_r = dst[0];
 
  417     float *dstp_g = dst[1];
 
  418     float *dstp_b = dst[2];
 
  420     for (y = 0; y < 
h; y++) {
 
  423         for (x = 0; x < w; x++) {
 
  430         dstp_r += dst_linesize;
 
  431         dstp_g += dst_linesize;
 
  432         dstp_b += dst_linesize;
 
  437                                                float **
src, 
int src_linesize,
 
  442     const float *src_r = src[0];
 
  443     const float *src_g = src[1];
 
  444     const float *src_b = src[2];
 
  446     for (y = 0; y < 
h; y++) {
 
  449         for (x = 0; x < w; x++) {
 
  456         src_r += src_linesize;
 
  457         src_g += src_linesize;
 
  458         src_b += src_linesize;
 
  462 #define DECLARE_COLOR_FUNCS(name, r, g, b)                                          \ 
  463 static void color_decorrelation_##name(float **dst, int dst_linesize,               \ 
  464                                        const uint8_t *src, int src_linesize,        \ 
  467     color_decorrelation(dst, dst_linesize, src, src_linesize, w, h, r, g, b);       \ 
  470 static void color_correlation_##name(uint8_t *dst, int dst_linesize,                \ 
  471                                      float **src, int src_linesize,                 \ 
  474     color_correlation(dst, dst_linesize, src, src_linesize, w, h, r, g, b);         \ 
  484     int i, x, 
y, bx, by, linesize, *iweights, max_slice_h, slice_h;
 
  485     const int bsize = 1 << s->
n;
 
  487     switch (inlink->format) {
 
  515     for (i = 0; i < 2; i++) {
 
  552             for (by = 0; by < 
bsize; by++)
 
  553                 for (bx = 0; bx < 
bsize; bx++)
 
  554                     iweights[(y + by)*linesize + x + bx]++;
 
  557             s->
weights[y*linesize + x] = 1. / iweights[y*linesize + x];
 
  573                "with a block size of %dx%d\n",
 
  614                         void *
arg, 
int jobnr, 
int nb_jobs)
 
  621     const int slice_start = (h *  jobnr   ) / nb_jobs;
 
  622     const int slice_end   = (h * (jobnr+1)) / nb_jobs;
 
  623     const int slice_start_ctx = 
FFMAX(slice_start - s->
bsize + 1, 0);
 
  624     const int slice_end_ctx   = 
FFMIN(slice_end, h - s->
bsize + 1);
 
  625     const int slice_h = slice_end_ctx - slice_start_ctx;
 
  630     const float *
src = td->
src + slice_start_ctx * src_linesize;
 
  631     const float *weights = s->
weights + slice_start * dst_linesize;
 
  632     float *slice = s->
slices[jobnr];
 
  635     memset(slice, 0, (slice_h + s->
bsize - 1) * dst_linesize * 
sizeof(*slice));
 
  638     for (y = 0; y < slice_h; y += s->
step) {
 
  639         for (x = 0; x < w - s->
bsize + 1; x += s->
step)
 
  641                                 slice + x, slice_linesize,
 
  643         src += s->
step * src_linesize;
 
  644         slice += s->
step * slice_linesize;
 
  648     slice = s->
slices[jobnr] + (slice_start - slice_start_ctx) * slice_linesize;
 
  649     dst = td->
dst + slice_start * dst_linesize;
 
  650     for (y = slice_start; y < 
slice_end; y++) {
 
  651         for (x = 0; x < w; x++)
 
  652             dst[x] = slice[x] * weights[x];
 
  653         slice += slice_linesize;
 
  655         weights += dst_linesize;
 
  685     for (plane = 0; plane < 3; plane++) {
 
  700         const int dst_linesize = out->
linesize[0];
 
  701         const int src_linesize = in->
linesize[0];
 
  702         const int hpad = (inlink->
w - s->
pr_width) * 3;
 
  710                 memcpy(dstp, srcp, hpad);
 
  711                 dstp += dst_linesize;
 
  712                 srcp += src_linesize;
 
  719             for (y = 0; y < vpad; y++) {
 
  720                 memcpy(dstp, srcp, inlink->
w * 3);
 
  721                 dstp += dst_linesize;
 
  722                 srcp += src_linesize;
 
  738     for (i = 0; i < 2; i++) {
 
  774     .
inputs        = dctdnoiz_inputs,
 
  776     .priv_class    = &dctdnoiz_class,
 
static void av_always_inline fdct8_1d(float *dst, const float *src, int dst_stridea, int dst_strideb, int src_stridea, int src_strideb)
 
#define DECLARE_COLOR_FUNCS(name, r, g, b)
 
void(* color_correlation)(uint8_t *dst, int dst_linesize, float **src, int src_linesize, int w, int h)
 
This structure describes decoded (raw) audio or video data. 
 
#define AV_LOG_WARNING
Something somehow does not look correct. 
 
static const AVFilterPad outputs[]
 
packed RGB 8:8:8, 24bpp, RGBRGB... 
 
int h
agreed upon image height 
 
static void av_always_inline fdct16_1d(float *dst, const float *src, int dst_stridea, int dst_strideb, int src_stridea, int src_strideb)
 
int av_expr_parse(AVExpr **expr, const char *s, const char *const *const_names, const char *const *func1_names, double(*const *funcs1)(void *, double), const char *const *func2_names, double(*const *funcs2)(void *, double, double), int log_offset, void *log_ctx)
Parse an expression. 
 
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions. 
 
struct AVFilterGraph * graph
filtergraph this filter belongs to 
 
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
 
BYTE int const BYTE * srcp
 
static const AVOption dctdnoiz_options[]
 
const char * name
Pad name. 
 
#define av_assert0(cond)
assert() equivalent, that is always enabled. 
 
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter. 
 
static const AVFilterPad dctdnoiz_inputs[]
 
static int query_formats(AVFilterContext *ctx)
 
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 
int nb_threads
Maximum number of threads used by filters in this graph. 
 
double var_values[MAX_THREADS][VAR_VARS_NB]
 
static av_always_inline void color_correlation(uint8_t *dst, int dst_linesize, float **src, int src_linesize, int w, int h, int r, int g, int b)
 
A filter pad used for either input or output. 
 
A link between two filters. 
 
float * slices[MAX_THREADS]
 
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered. 
 
static av_cold void uninit(AVFilterContext *ctx)
 
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g. 
 
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
 
void * priv
private data for use by the filter 
 
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
 
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers. 
 
simple assert() macros that are a bit more flexible than ISO C assert(). 
 
AVExpr * expr[MAX_THREADS]
 
static const char *const var_names[]
A simple, relatively efficient and slow DCT image denoiser. 
 
int w
agreed upon image width 
 
typedef void(APIENTRY *FF_PFNGLACTIVETEXTUREPROC)(GLenum texture)
 
static av_always_inline void color_decorrelation(float **dst, int dst_linesize, const uint8_t *src, int src_linesize, int w, int h, int r, int g, int b)
 
packed RGB 8:8:8, 24bpp, BGRBGR... 
 
AVFILTER_DEFINE_CLASS(dctdnoiz)
 
static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
void av_expr_free(AVExpr *e)
Free a parsed expression previously created with av_expr_parse(). 
 
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable. 
 
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line. 
 
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt)>2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);returnNULL;}returnac;}in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> in
 
Describe the class of an AVClass context structure. 
 
static void av_always_inline idct16_1d(float *dst, const float *src, int dst_stridea, int dst_strideb, int src_stridea, int src_strideb, int add)
 
static const AVFilterPad inputs[]
 
#define DEF_FILTER_FREQ_FUNCS(bsize)
 
const char * name
Filter name. 
 
AVFilterLink ** outputs
array of pointers to output links 
 
void * av_calloc(size_t nmemb, size_t size)
Allocate a block of nmemb * size bytes with alignment suitable for all memory accesses (including vec...
 
void(* filter_freq_func)(struct DCTdnoizContext *s, const float *src, int src_linesize, float *dst, int dst_linesize, int thread_id)
 
AVFilterInternal * internal
An opaque struct for libavfilter internal use. 
 
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes. 
 
avfilter_execute_func * execute
 
static int slice_end(AVCodecContext *avctx, AVFrame *pict)
Handle slice ends. 
 
static const AVFilterPad dctdnoiz_outputs[]
 
AVFilterContext * dst
dest filter 
 
static int config_input(AVFilterLink *inlink)
 
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt)>2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);returnNULL;}returnac;}in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> out
 
void(* color_decorrelation)(float **dst, int dst_linesize, const uint8_t *src, int src_linesize, int w, int h)
 
#define av_malloc_array(a, b)
 
static void av_always_inline idct8_1d(float *dst, const float *src, int dst_stridea, int dst_strideb, int src_stridea, int src_strideb, int add)
 
static av_cold int init(AVFilterContext *ctx)
 
AVPixelFormat
Pixel format. 
 
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst. 
 
simple arithmetic expression evaluator