47 #define MAX_NB_THREADS 32 
  123                       int plane, 
int nb_jobs);
 
  127                             int y, 
int x, 
int plane, 
int jobnr);
 
  130 #define OFFSET(x) offsetof(BM3DContext, x) 
  131 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM 
  133     { 
"sigma",  
"set denoising strength",
 
  135     { 
"block",  
"set log2(size) of local patch",
 
  137     { 
"bstep",  
"set sliding step for processing blocks",
 
  139     { 
"group",  
"set maximal number of similar blocks",
 
  141     { 
"range",  
"set block matching range",
 
  143     { 
"mstep",  
"set step for block matching",
 
  145     { 
"thmse",  
"set threshold of mean square error for block matching",
 
  147     { 
"hdthr",  
"set hard threshold for 3D transfer domain",
 
  149     { 
"estim",  
"set filtering estimation mode",
 
  151     { 
"basic",  
"basic estimate",
 
  153     { 
"final",  
"final estimate",
 
  155     { 
"ref",    
"have reference stream",
 
  157     { 
"planes", 
"set planes to filter",
 
  198     search_range = search_range / search_step * search_step;
 
  200     if (pos == plane_boundary) {
 
  201         search_boundary = plane_boundary;
 
  202     } 
else if (pos > plane_boundary) {
 
  203         search_boundary = pos - search_range;
 
  205         while (search_boundary < plane_boundary) {
 
  206             search_boundary += search_step;
 
  209         search_boundary = pos + search_range;
 
  211         while (search_boundary > plane_boundary) {
 
  212             search_boundary -= search_step;
 
  219 static int search_boundary(
int plane_boundary, 
int search_range, 
int search_step, 
int vertical, 
int y, 
int x)
 
  221     return do_search_boundary(vertical ? y : x, plane_boundary, search_range, search_step);
 
  234     const uint8_t *refp = src + r_y * src_stride + r_x;
 
  239     for (y = 0; y < block_size; y++) {
 
  240         for (x = 0; x < block_size; x++) {
 
  241             double temp = refp[
x] - srcp[
x];
 
  254     const uint16_t *
srcp = (uint16_t *)src + pos->
y * src_stride / 2 + pos->
x;
 
  255     const uint16_t *refp = (uint16_t *)src + r_y * src_stride / 2 + r_x;
 
  260     for (y = 0; y < block_size; y++) {
 
  261         for (x = 0; x < block_size; x++) {
 
  262             double temp = refp[
x] - srcp[
x];
 
  266         srcp += src_stride / 2;
 
  267         refp += src_stride / 2;
 
  274                                     const PosCode *search_pos, 
int search_size, 
float th_mse,
 
  275                                     int r_y, 
int r_x, 
int plane, 
int jobnr)
 
  279     double distMul = 1. / MSE2SSE;
 
  280     double th_sse = th_mse * MSE2SSE;
 
  283     for (i = 0; i < search_size; i++) {
 
  287         dist = s->
do_block_ssd(s, &pos, src, src_stride, r_y, r_x);
 
  290         if (dist <= th_sse && dist != 0) {
 
  291             const double score = dist * distMul;
 
  312                                  int exclude_cur_pos, 
int plane, 
int jobnr)
 
  319     const int range = s->
bm_range / step * step;
 
  326     for (j = t; j <= 
b; j += step) {
 
  327         for (i = l; i <= 
r; i += step) {
 
  330             if (exclude_cur_pos > 0 && j == y && i == x) {
 
  340     if (exclude_cur_pos == 1) {
 
  352                            int j, 
int i, 
int plane, 
int jobnr)
 
  369                           int y, 
int x, 
int block_size, 
float *dst)
 
  374     for (j = 0; j < block_size; j++) {
 
  380                             int y, 
int x, 
int block_size, 
float *dst)
 
  382     const uint16_t *
src = (uint16_t *)srcp + y * src_linesize / 2 + x;
 
  385     for (j = 0; j < block_size; j++) {
 
  392                                   int y, 
int x, 
int plane, 
int jobnr)
 
  406     float den_weight, num_weight;
 
  410     for (k = 0; k < nb_match_blocks; k++) {
 
  414         for (i = 0; i < block_size; i++) {
 
  415             s->
get_block_row(src, src_linesize, y + i, x, block_size, bufferh + block_size * i);
 
  419         for (i = 0; i < block_size; i++) {
 
  420             for (j = 0; j < block_size; j++) {
 
  421                 bufferv[i * block_size + j] = bufferh[j * block_size + i];
 
  426         for (i = 0; i < block_size; i++) {
 
  427             memcpy(buffer + k * buffer_linesize + i * block_size,
 
  428                    bufferv + i * block_size, block_size * 4);
 
  432     for (i = 0; i < block_size; i++) {
 
  433         for (j = 0; j < block_size; j++) {
 
  434             for (k = 0; k < nb_match_blocks; k++)
 
  435                 bufferz[k] = buffer[buffer_linesize * k + i * block_size + j];
 
  438             bufferz += pgroup_size;
 
  443     threshold[1] = threshold[0] * sqrtf(2.
f);
 
  444     threshold[2] = threshold[0] * 2.f;
 
  445     threshold[3] = threshold[0] * sqrtf(8.
f);
 
  448     for (i = 0; i < block_size; i++) {
 
  449         for (j = 0; j < block_size; j++) {
 
  450             for (k = 0; k < nb_match_blocks; k++) {
 
  451                 const float thresh = threshold[(j == 0) + (i == 0) + (k == 0)];
 
  453                 if (bufferz[k] > thresh || bufferz[k] < -thresh) {
 
  459             bufferz += pgroup_size;
 
  465     for (i = 0; i < block_size; i++) {
 
  466         for (j = 0; j < block_size; j++) {
 
  469             for (k = 0; k < nb_match_blocks; k++) {
 
  470                 buffer[buffer_linesize * k + i * block_size + j] = bufferz[k];
 
  472             bufferz += pgroup_size;
 
  476     den_weight = retained < 1 ? 1.f : 1.f / retained;
 
  477     num_weight = den_weight;
 
  480     for (k = 0; k < nb_match_blocks; k++) {
 
  481         float *num = sc->
num + y * width + 
x;
 
  482         float *den = sc->
den + y * width + 
x;
 
  484         for (i = 0; i < block_size; i++) {
 
  485             memcpy(bufferv + i * block_size,
 
  486                    buffer + k * buffer_linesize + i * block_size,
 
  490         for (i = 0; i < block_size; i++) {
 
  492             for (j = 0; j < block_size; j++) {
 
  493                 bufferh[j * block_size + i] = bufferv[i * block_size + j];
 
  497         for (i = 0; i < block_size; i++) {
 
  499             for (j = 0; j < block_size; j++) {
 
  500                 num[j] += bufferh[i * block_size + j] * num_weight;
 
  501                 den[j] += den_weight;
 
  511                                   int y, 
int x, 
int plane, 
int jobnr)
 
  529     float den_weight, num_weight;
 
  533     for (k = 0; k < nb_match_blocks; k++) {
 
  537         for (i = 0; i < block_size; i++) {
 
  538             s->
get_block_row(src, src_linesize, y + i, x, block_size, bufferh + block_size * i);
 
  539             s->
get_block_row(ref, ref_linesize, y + i, x, block_size, rbufferh + block_size * i);
 
  544         for (i = 0; i < block_size; i++) {
 
  545             for (j = 0; j < block_size; j++) {
 
  546                 bufferv[i * block_size + j] = bufferh[j * block_size + i];
 
  547                 rbufferv[i * block_size + j] = rbufferh[j * block_size + i];
 
  553         for (i = 0; i < block_size; i++) {
 
  554             memcpy(buffer + k * buffer_linesize + i * block_size,
 
  555                    bufferv + i * block_size, block_size * 4);
 
  556             memcpy(rbuffer + k * buffer_linesize + i * block_size,
 
  557                    rbufferv + i * block_size, block_size * 4);
 
  561     for (i = 0; i < block_size; i++) {
 
  562         for (j = 0; j < block_size; j++) {
 
  563             for (k = 0; k < nb_match_blocks; k++) {
 
  564                 bufferz[k] = buffer[buffer_linesize * k + i * block_size + j];
 
  565                 rbufferz[k] = rbuffer[buffer_linesize * k + i * block_size + j];
 
  567             if (group_size > 1) {
 
  571             bufferz += pgroup_size;
 
  572             rbufferz += pgroup_size;
 
  579     for (i = 0; i < block_size; i++) {
 
  580         for (j = 0; j < block_size; j++) {
 
  581             for (k = 0; k < nb_match_blocks; k++) {
 
  582                 const float ref_sqr = rbufferz[k] * rbufferz[k];
 
  583                 float wiener_coef = ref_sqr / (ref_sqr + sigma_sqr);
 
  585                 if (
isnan(wiener_coef))
 
  587                 bufferz[k] *= wiener_coef;
 
  588                 l2_wiener += wiener_coef * wiener_coef;
 
  590             bufferz += pgroup_size;
 
  591             rbufferz += pgroup_size;
 
  597     for (i = 0; i < block_size; i++) {
 
  598         for (j = 0; j < block_size; j++) {
 
  601             for (k = 0; k < nb_match_blocks; k++) {
 
  602                 buffer[buffer_linesize * k + i * block_size + j] = bufferz[k];
 
  604             bufferz += pgroup_size;
 
  608     l2_wiener = 
FFMAX(l2_wiener, 1e-15
f);
 
  609     den_weight = 1.f / l2_wiener;
 
  610     num_weight = den_weight;
 
  612     for (k = 0; k < nb_match_blocks; k++) {
 
  613         float *num = sc->
num + y * width + 
x;
 
  614         float *den = sc->
den + y * width + 
x;
 
  616         for (i = 0; i < block_size; i++) {
 
  617             memcpy(bufferv + i * block_size,
 
  618                    buffer + k * buffer_linesize + i * block_size,
 
  622         for (i = 0; i < block_size; i++) {
 
  624             for (j = 0; j < block_size; j++) {
 
  625                 bufferh[j * block_size + i] = bufferv[i * block_size + j];
 
  629         for (i = 0; i < block_size; i++) {
 
  631             for (j = 0; j < block_size; j++) {
 
  632                 num[j] += bufferh[i * block_size + j] * num_weight;
 
  633                 den[j] += den_weight;
 
  642                       int plane, 
int nb_jobs)
 
  648     for (i = 0; i < 
height; i++) {
 
  649         for (j = 0; j < 
width; j++) {
 
  654             for (k = 0; k < nb_jobs; k++) {
 
  656                 float num = sc->
num[i * width + j];
 
  657                 float den = sc->
den[i * width + j];
 
  663             dstp[j] = av_clip_uint8(sum_num / sum_den);
 
  669                         int plane, 
int nb_jobs)
 
  673     const int depth = s->
depth;
 
  676     for (i = 0; i < 
height; i++) {
 
  677         for (j = 0; j < 
width; j++) {
 
  678             uint16_t *
dstp = (uint16_t *)dst + i * dst_linesize / 2;
 
  682             for (k = 0; k < nb_jobs; k++) {
 
  684                 float num = sc->
num[i * width + j];
 
  685                 float den = sc->
den[i * width + j];
 
  709     const int block_pos_bottom = height - s->
block_size;
 
  710     const int block_pos_right  = width - s->
block_size;
 
  711     const int slice_start = (((height + block_step - 1) / block_step) * jobnr / nb_jobs) * block_step;
 
  712     const int slice_end = (jobnr == nb_jobs - 1) ? block_pos_bottom + block_step :
 
  713                           (((height + block_step - 1) / block_step) * (jobnr + 1) / nb_jobs) * block_step;
 
  719     for (j = slice_start; j < 
slice_end; j += block_step) {
 
  720         if (j > block_pos_bottom) {
 
  721             j = block_pos_bottom;
 
  724         for (i = 0; i < block_pos_right + block_step; i += block_step) {
 
  725             if (i > block_pos_right) {
 
  732                                ref, ref_linesize, j, i, plane, jobnr);
 
  768         s->
do_output(s, (*out)->data[p], (*out)->linesize[p], p, nb_jobs);
 
  774 #define SQR(x) ((x) * (x)) 
  792     for (group_bits = 4; 1 << group_bits < s->
group_size; group_bits++);
 
  933         av_log(ctx, 
AV_LOG_WARNING, 
"mstep: %d can't be bigger than block matching range. Changing to %d.\n",
 
  981         if (src->
w                       != ref->
w ||
 
  984                    "(size %dx%d) do not match the corresponding " 
  985                    "second input link %s parameters (%dx%d) ",
 
 1073     .priv_class    = &bm3d_class,
 
int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe)
Take a frame from the link's FIFO and update the link's stats. 
static int filter_frame(AVFilterContext *ctx, AVFrame **out, AVFrame *in, AVFrame *ref)
#define AV_PIX_FMT_YUV440P10
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
This structure describes decoded (raw) audio or video data. 
static void do_output(BM3DContext *s, uint8_t *dst, int dst_linesize, int plane, int nb_jobs)
AVFILTER_DEFINE_CLASS(bm3d)
#define AV_PIX_FMT_YUV444P14
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples) 
#define AV_LOG_WARNING
Something somehow does not look correct. 
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Main libavfilter public API header. 
static int search_boundary(int plane_boundary, int search_range, int search_step, int vertical, int y, int x)
int h
agreed upon image height 
int(* on_event)(struct FFFrameSync *fs)
Callback called when a frame event is ready. 
#define AVFILTER_FLAG_DYNAMIC_INPUTS
The number of the filter inputs is not determined just by AVFilter.inputs. 
DCTContext * av_dct_init(int nbits, enum DCTTransformType type)
Set up DCT. 
#define AV_PIX_FMT_GBRP10
SliceContext slices[MAX_NB_THREADS]
enum AVMediaType type
AVFilterPad type. 
#define AV_PIX_FMT_YUV420P12
int ff_framesync_configure(FFFrameSync *fs)
Configure a frame sync structure. 
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions. 
void(* block_filtering)(struct BM3DContext *s, const uint8_t *src, int src_linesize, const uint8_t *ref, int ref_linesize, int y, int x, int plane, int jobnr)
int is_disabled
the enabled state from the last expression evaluation 
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width. 
static void ff_outlink_set_status(AVFilterLink *link, int status, int64_t pts)
Set the status field of a link from the source filter. 
void ff_inlink_request_frame(AVFilterLink *link)
Mark that a frame is wanted on the link. 
static int ff_outlink_frame_wanted(AVFilterLink *link)
Test if a frame is wanted on an output link. 
enum FFFrameSyncExtMode before
Extrapolation mode for timestamps before the first frame. 
void * av_calloc(size_t nmemb, size_t size)
Non-inlined equivalent of av_mallocz_array(). 
#define AV_PIX_FMT_GRAY10
static void get_block_row(const uint8_t *srcp, int src_linesize, int y, int x, int block_size, float *dst)
static const AVFilterPad bm3d_outputs[]
BYTE int const BYTE * srcp
const char * name
Pad name. 
AVFilterContext * parent
Parent filter context. 
#define AV_PIX_FMT_GRAY12
AVFilterLink ** inputs
array of pointers to input links 
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter. 
static const AVOption bm3d_options[]
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed. 
#define fs(width, name, subs,...)
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user). 
FFFrameSyncIn * in
Pointer to array of inputs. 
static void do_output16(BM3DContext *s, uint8_t *dst, int dst_linesize, int plane, int nb_jobs)
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range...
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
#define AV_PIX_FMT_YUV444P16
enum FFFrameSyncExtMode after
Extrapolation mode for timestamps after the last frame. 
static void get_block_row16(const uint8_t *srcp, int src_linesize, int y, int x, int block_size, float *dst)
static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
#define AV_PIX_FMT_YUV422P12
A filter pad used for either input or output. 
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers. 
A link between two filters. 
int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts)
Test and acknowledge the change of status on the link. 
AVFilterPad * input_pads
array of input pads 
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered. 
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height. 
void ff_framesync_uninit(FFFrameSync *fs)
Free all memory currently allocated. 
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable; if left to 0/0, will be automatically copied from the first input of the source filter if it exists. 
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g. 
double(* do_block_ssd)(struct BM3DContext *s, PosCode *pos, const uint8_t *src, int src_stride, int r_y, int r_x)
#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...
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link...
simple assert() macros that are a bit more flexible than ISO C assert(). 
AVRational time_base
Time base for the incoming frames. 
int ff_framesync_activate(FFFrameSync *fs)
Examine the frames in the filter's input and try to produce output. 
#define AV_PIX_FMT_YUV444P10
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) 
int w
agreed upon image width 
#define FFDIFFSIGN(x, y)
Comparator. 
#define AV_PIX_FMT_YUV422P9
static const struct @304 planes[]
#define AV_PIX_FMT_GBRP16
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance. 
unsigned nb_inputs
number of input pads 
#define AV_PIX_FMT_GRAY16
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
typedef void(APIENTRY *FF_PFNGLACTIVETEXTUREPROC)(GLenum texture)
static av_cold int init(AVFilterContext *ctx)
static int cmp_scores(const void *a, const void *b)
static void do_block_matching_multi(BM3DContext *s, const uint8_t *src, int src_stride, int src_range, const PosCode *search_pos, int search_size, float th_mse, int r_y, int r_x, int plane, int jobnr)
AVRational time_base
Time base for the output events. 
AVFilterContext * src
source filter 
static int process_frame(FFFrameSync *fs)
static const AVFilterPad inputs[]
void * opaque
Opaque pointer, not used by the API. 
#define AV_PIX_FMT_YUV444P9
static double do_block_ssd(BM3DContext *s, PosCode *pos, const uint8_t *src, int src_stride, int r_y, int r_x)
#define AV_PIX_FMT_GBRP14
static int do_search_boundary(int pos, int plane_boundary, int search_range, int search_step)
static const AVFilterPad outputs[]
int format
agreed upon media format 
static int activate(AVFilterContext *ctx)
#define AV_PIX_FMT_YUV420P16
static double do_block_ssd16(BM3DContext *s, PosCode *pos, const uint8_t *src, int src_stride, int r_y, int r_x)
#define AV_PIX_FMT_YUV420P14
char * av_strdup(const char *s)
Duplicate a string. 
Used for passing data between threads. 
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line. 
int ff_framesync_init(FFFrameSync *fs, AVFilterContext *parent, unsigned nb_in)
Initialize a frame sync structure. 
static av_cold void uninit(AVFilterContext *ctx)
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
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
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2. 
void av_dct_end(DCTContext *s)
#define AV_PIX_FMT_YUV420P10
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples) 
void(* do_output)(struct BM3DContext *s, uint8_t *dst, int dst_linesize, int plane, int nb_jobs)
unsigned sync
Synchronization level: frames on input at the highest sync level will generate output frame events...
Describe the class of an AVClass context structure. 
const char * name
Filter name. 
#define AV_PIX_FMT_YUV440P12
#define AV_PIX_FMT_YUV420P9
AVRational sample_aspect_ratio
agreed upon sample aspect ratio 
#define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will have its filter_frame() c...
AVFilterLink ** outputs
array of pointers to output links 
static enum AVPixelFormat pix_fmts[]
#define AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_GBRP12
#define flags(name, subs,...)
AVFilterInternal * internal
An opaque struct for libavfilter internal use. 
#define AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV444P12
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes. 
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples) 
static int ref[MAX_W *MAX_W]
PosPairCode match_blocks[256]
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) 
avfilter_execute_func * execute
void av_dct_calc(DCTContext *s, FFTSample *data)
static int slice_end(AVCodecContext *avctx, AVFrame *pict)
Handle slice ends. 
void(* get_block_row)(const uint8_t *srcp, int src_linesize, int y, int x, int block_size, float *dst)
Completely stop all streams with this one. 
static void final_block_filtering(BM3DContext *s, const uint8_t *src, int src_linesize, const uint8_t *ref, int ref_linesize, int y, int x, int plane, int jobnr)
AVFilterContext * dst
dest filter 
static void block_matching(BM3DContext *s, const uint8_t *ref, int ref_linesize, int j, int i, int plane, int jobnr)
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
static int config_input(AVFilterLink *inlink)
static void block_matching_multi(BM3DContext *s, const uint8_t *ref, int ref_linesize, int y, int x, int exclude_cur_pos, int plane, int jobnr)
int(* config_props)(AVFilterLink *link)
Link configuration callback. 
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples) 
static int query_formats(AVFilterContext *ctx)
void av_image_copy_plane(uint8_t *dst, int dst_linesize, const uint8_t *src, int src_linesize, int bytewidth, int height)
Copy image plane from src to dst. 
PosCode * search_positions
int ff_framesync_get_frame(FFFrameSync *fs, unsigned in, AVFrame **rframe, unsigned get)
Get the current frame in an input. 
int depth
Number of bits in the component. 
AVPixelFormat
Pixel format. 
mode
Use these values in ebur128_init (or'ed). 
#define AV_PIX_FMT_YUV422P16
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst. 
#define AV_CEIL_RSHIFT(a, b)
static int ff_insert_inpad(AVFilterContext *f, unsigned index, AVFilterPad *p)
Insert a new input pad for the filter. 
static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p)
Clip a signed integer to an unsigned power of two range. 
static int config_output(AVFilterLink *outlink)
static void basic_block_filtering(BM3DContext *s, const uint8_t *src, int src_linesize, const uint8_t *ref, int ref_linesize, int y, int x, int plane, int jobnr)