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",
202 search_range = search_range / search_step * search_step;
204 if (
pos == plane_boundary) {
206 }
else if (
pos > plane_boundary) {
223 static int search_boundary(
int plane_boundary,
int search_range,
int search_step,
int vertical,
int y,
int x)
225 return do_search_boundary(vertical ? y : x, plane_boundary, search_range, search_step);
238 const uint8_t *refp =
src + r_y * src_stride + r_x;
239 const int block_size =
s->block_size;
243 for (
y = 0;
y < block_size;
y++) {
244 for (
x = 0;
x < block_size;
x++) {
245 double temp = refp[
x] - srcp[
x];
258 const uint16_t *srcp = (uint16_t *)
src +
pos->y * src_stride / 2 +
pos->x;
259 const uint16_t *refp = (uint16_t *)
src + r_y * src_stride / 2 + r_x;
260 const int block_size =
s->block_size;
264 for (
y = 0;
y < block_size;
y++) {
265 for (
x = 0;
x < block_size;
x++) {
266 double temp = refp[
x] - srcp[
x];
270 srcp += src_stride / 2;
271 refp += src_stride / 2;
278 const PosCode *search_pos,
int search_size,
float th_mse,
279 int r_y,
int r_x,
int plane,
int jobnr)
282 double MSE2SSE =
s->group_size *
s->block_size *
s->block_size * src_range * src_range / (double)(
s->max *
s->max);
283 double distMul = 1. / MSE2SSE;
284 double th_sse = th_mse * MSE2SSE;
287 for (
i = 0;
i < search_size;
i++) {
291 dist =
s->do_block_ssd(
s, &
pos,
src, src_stride, r_y, r_x);
294 if (dist <= th_sse && dist != 0) {
295 const double score = dist * distMul;
301 if (
index >=
s->group_size)
302 index =
s->group_size - 1;
316 int exclude_cur_pos,
int plane,
int jobnr)
319 const int width =
s->planewidth[plane];
320 const int height =
s->planeheight[plane];
321 const int block_size =
s->block_size;
322 const int step =
s->bm_step;
323 const int range =
s->bm_range / step * step;
330 for (j = t; j <=
b; j += step) {
331 for (
i = l;
i <=
r;
i += step) {
334 if (exclude_cur_pos > 0 && j ==
y &&
i ==
x) {
344 if (exclude_cur_pos == 1) {
356 int j,
int i,
int plane,
int jobnr)
360 if (
s->group_size == 1 ||
s->th_mse <= 0.f) {
373 int y,
int x,
int block_size,
float *dst)
378 for (j = 0; j < block_size; j++) {
384 int y,
int x,
int block_size,
float *dst)
386 const uint16_t *
src = (uint16_t *)srcp +
y * src_linesize / 2 +
x;
389 for (j = 0; j < block_size; j++) {
396 int y,
int x,
int plane,
int jobnr)
399 const int buffer_linesize =
s->block_size *
s->block_size;
401 const int block_size =
s->block_size;
402 const int width =
s->planewidth[plane];
403 const int pgroup_size =
s->pgroup_size;
404 const int group_size =
s->group_size;
410 float den_weight, num_weight;
414 for (k = 0; k < nb_match_blocks; k++) {
418 for (
i = 0;
i < block_size;
i++) {
419 s->get_block_row(
src, src_linesize,
y +
i,
x, block_size, bufferh + block_size *
i);
423 for (
i = 0;
i < block_size;
i++) {
424 for (j = 0; j < block_size; j++) {
425 bufferv[
i * block_size + j] = bufferh[j * block_size +
i];
430 for (
i = 0;
i < block_size;
i++) {
431 memcpy(
buffer + k * buffer_linesize +
i * block_size,
432 bufferv +
i * block_size, block_size * 4);
436 for (
i = 0;
i < block_size;
i++) {
437 for (j = 0; j < block_size; j++) {
438 for (k = 0; k < nb_match_blocks; k++)
439 bufferz[k] =
buffer[buffer_linesize * k +
i * block_size + j];
442 bufferz += pgroup_size;
446 threshold[0] =
s->hard_threshold *
s->sigma *
M_SQRT2 * block_size * block_size * (1 << (
s->depth - 8)) / 255.f;
447 threshold[1] = threshold[0] * sqrtf(2.f);
448 threshold[2] = threshold[0] * 2.f;
449 threshold[3] = threshold[0] * sqrtf(8.f);
452 for (
i = 0;
i < block_size;
i++) {
453 for (j = 0; j < block_size; j++) {
454 for (k = 0; k < nb_match_blocks; k++) {
455 const float thresh = threshold[(j == 0) + (
i == 0) + (k == 0)];
457 if (bufferz[k] > thresh || bufferz[k] < -thresh) {
463 bufferz += pgroup_size;
469 for (
i = 0;
i < block_size;
i++) {
470 for (j = 0; j < block_size; j++) {
473 for (k = 0; k < nb_match_blocks; k++) {
474 buffer[buffer_linesize * k +
i * block_size + j] = bufferz[k];
476 bufferz += pgroup_size;
480 den_weight = retained < 1 ? 1.f : 1.f / retained;
481 num_weight = den_weight;
484 for (k = 0; k < nb_match_blocks; k++) {
488 for (
i = 0;
i < block_size;
i++) {
489 memcpy(bufferv +
i * block_size,
490 buffer + k * buffer_linesize +
i * block_size,
494 for (
i = 0;
i < block_size;
i++) {
496 for (j = 0; j < block_size; j++) {
497 bufferh[j * block_size +
i] = bufferv[
i * block_size + j];
501 for (
i = 0;
i < block_size;
i++) {
503 for (j = 0; j < block_size; j++) {
504 num[j] += bufferh[
i * block_size + j] * num_weight;
505 den[j] += den_weight;
515 int y,
int x,
int plane,
int jobnr)
518 const int buffer_linesize =
s->block_size *
s->block_size;
520 const int block_size =
s->block_size;
521 const int width =
s->planewidth[plane];
522 const int pgroup_size =
s->pgroup_size;
523 const int group_size =
s->group_size;
524 const float sigma_sqr =
s->sigma *
s->sigma;
533 float den_weight, num_weight;
537 for (k = 0; k < nb_match_blocks; k++) {
541 for (
i = 0;
i < block_size;
i++) {
542 s->get_block_row(
src, src_linesize,
y +
i,
x, block_size, bufferh + block_size *
i);
543 s->get_block_row(
ref, ref_linesize,
y +
i,
x, block_size, rbufferh + block_size *
i);
548 for (
i = 0;
i < block_size;
i++) {
549 for (j = 0; j < block_size; j++) {
550 bufferv[
i * block_size + j] = bufferh[j * block_size +
i];
551 rbufferv[
i * block_size + j] = rbufferh[j * block_size +
i];
557 for (
i = 0;
i < block_size;
i++) {
558 memcpy(
buffer + k * buffer_linesize +
i * block_size,
559 bufferv +
i * block_size, block_size * 4);
560 memcpy(rbuffer + k * buffer_linesize +
i * block_size,
561 rbufferv +
i * block_size, block_size * 4);
565 for (
i = 0;
i < block_size;
i++) {
566 for (j = 0; j < block_size; j++) {
567 for (k = 0; k < nb_match_blocks; k++) {
568 bufferz[k] =
buffer[buffer_linesize * k +
i * block_size + j];
569 rbufferz[k] = rbuffer[buffer_linesize * k +
i * block_size + j];
571 if (group_size > 1) {
575 bufferz += pgroup_size;
576 rbufferz += pgroup_size;
583 for (
i = 0;
i < block_size;
i++) {
584 for (j = 0; j < block_size; j++) {
585 for (k = 0; k < nb_match_blocks; k++) {
586 const float ref_sqr = rbufferz[k] * rbufferz[k];
587 float wiener_coef = ref_sqr / (ref_sqr + sigma_sqr);
589 if (
isnan(wiener_coef))
591 bufferz[k] *= wiener_coef;
592 l2_wiener += wiener_coef * wiener_coef;
594 bufferz += pgroup_size;
595 rbufferz += pgroup_size;
601 for (
i = 0;
i < block_size;
i++) {
602 for (j = 0; j < block_size; j++) {
605 for (k = 0; k < nb_match_blocks; k++) {
606 buffer[buffer_linesize * k +
i * block_size + j] = bufferz[k];
608 bufferz += pgroup_size;
612 l2_wiener =
FFMAX(l2_wiener, 1e-15f);
613 den_weight = 1.f / l2_wiener;
614 num_weight = den_weight;
616 for (k = 0; k < nb_match_blocks; k++) {
620 for (
i = 0;
i < block_size;
i++) {
621 memcpy(bufferv +
i * block_size,
622 buffer + k * buffer_linesize +
i * block_size,
626 for (
i = 0;
i < block_size;
i++) {
628 for (j = 0; j < block_size; j++) {
629 bufferh[j * block_size +
i] = bufferv[
i * block_size + j];
633 for (
i = 0;
i < block_size;
i++) {
635 for (j = 0; j < block_size; j++) {
636 num[j] += bufferh[
i * block_size + j] * num_weight;
637 den[j] += den_weight;
646 int plane,
int nb_jobs)
648 const int height =
s->planeheight[plane];
649 const int width =
s->planewidth[plane];
653 for (j = 0; j <
width; j++) {
654 uint8_t *dstp = dst +
i * dst_linesize;
658 for (k = 0; k < nb_jobs; k++) {
673 int plane,
int nb_jobs)
675 const int height =
s->planeheight[plane];
676 const int width =
s->planewidth[plane];
677 const int depth =
s->depth;
681 for (j = 0; j <
width; j++) {
682 uint16_t *dstp = (uint16_t *)dst +
i * dst_linesize / 2;
686 for (k = 0; k < nb_jobs; k++) {
704 const int block_step =
s->block_step;
708 const int src_linesize =
td->src_linesize;
709 const int ref_linesize =
td->ref_linesize;
710 const int plane =
td->plane;
711 const int width =
s->planewidth[plane];
712 const int height =
s->planeheight[plane];
713 const int block_pos_bottom =
FFMAX(0,
height -
s->block_size);
714 const int block_pos_right =
FFMAX(0,
width -
s->block_size);
715 const int slice_start = (((
height + block_step - 1) / block_step) * jobnr / nb_jobs) * block_step;
716 const int slice_end = (jobnr == nb_jobs - 1) ? block_pos_bottom + block_step :
717 (((
height + block_step - 1) / block_step) * (jobnr + 1) / nb_jobs) * block_step;
723 for (j = slice_start; j <
slice_end; j += block_step) {
724 if (j > block_pos_bottom) {
725 j = block_pos_bottom;
728 for (
i = 0;
i < block_pos_right + block_step;
i += block_step) {
729 if (
i > block_pos_right) {
735 s->block_filtering(
s,
src, src_linesize,
736 ref, ref_linesize, j,
i, plane, jobnr);
754 for (p = 0; p <
s->nb_planes; p++) {
755 const int nb_jobs =
FFMAX(1,
FFMIN(
s->nb_threads,
s->planeheight[p] /
s->block_size));
758 if (!((1 << p) &
s->planes) ||
ctx->is_disabled) {
760 in->data[p],
in->linesize[p],
761 s->planewidth[p],
s->planeheight[p]);
765 td.src =
in->data[p];
766 td.src_linesize =
in->linesize[p];
767 td.ref =
ref->data[p];
768 td.ref_linesize =
ref->linesize[p];
772 s->do_output(
s, (*out)->data[p], (*out)->linesize[p], p, nb_jobs);
778 #define SQR(x) ((x) * (x))
789 s->depth =
desc->comp[0].depth;
790 s->max = (1 <<
s->depth) - 1;
792 s->planeheight[0] =
s->planeheight[3] = inlink->
h;
794 s->planewidth[0] =
s->planewidth[3] = inlink->
w;
796 for (group_bits = 4; 1 << group_bits <
s->group_size; group_bits++);
797 s->group_bits = group_bits;
798 s->pgroup_size = 1 << group_bits;
800 for (
i = 0;
i <
s->nb_threads;
i++) {
813 if (
s->group_bits > 1) {
915 if (
s->th_mse == 0.f)
916 s->th_mse = 400.f +
s->sigma * 80.f;
918 }
else if (
s->mode ==
FINAL) {
923 if (
s->th_mse == 0.f)
924 s->th_mse = 200.f +
s->sigma * 10.f;
931 s->block_size = 1 <<
s->block_size;
933 if (
s->block_step >
s->block_size) {
935 s->block_step,
s->block_size);
936 s->block_step =
s->block_size;
938 if (
s->bm_step >
s->bm_range) {
940 s->bm_step,
s->bm_range);
941 s->bm_step =
s->bm_range;
953 pad.
name =
"reference";
975 if (
src->format !=
ref->format) {
982 "(size %dx%d) do not match the corresponding "
983 "second input link %s parameters (%dx%d) ",
985 ctx->input_pads[1].name,
ref->w,
ref->h);
1003 in[0].time_base =
src->time_base;
1004 in[1].time_base =
ref->time_base;
1025 for (
i = 0;
i <
s->nb_threads;
i++) {
1068 .priv_class = &bm3d_class,
static const AVFilterPad inputs[]
static const AVFilterPad outputs[]
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) #define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac) { } void ff_audio_convert_free(AudioConvert **ac) { if(! *ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);} AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map) { AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;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);return NULL;} return ac;} 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;} else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->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);return ac;} int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in) { int use_generic=1;int len=in->nb_samples;int p;if(ac->dc) { av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> in
simple assert() macros that are a bit more flexible than ISO C assert().
int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts)
Test and acknowledge the change of status on the link.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe)
Take a frame from the link's FIFO and update the link's stats.
void ff_inlink_request_frame(AVFilterLink *link)
Mark that a frame is wanted on the link.
Main libavfilter public API header.
#define flags(name, subs,...)
#define fs(width, name, subs,...)
#define AV_CEIL_RSHIFT(a, b)
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.
#define FFDIFFSIGN(x, y)
Comparator.
mode
Use these values in ebur128_init (or'ed).
static void ff_outlink_set_status(AVFilterLink *link, int status, int64_t pts)
Set the status field of a link from the source filter.
#define FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink)
Forward the status on an output link to an input link.
static int ff_outlink_frame_wanted(AVFilterLink *link)
Test if a frame is wanted on an output link.
int ff_framesync_configure(FFFrameSync *fs)
Configure a frame sync structure.
int ff_framesync_activate(FFFrameSync *fs)
Examine the frames in the filter's input and try to produce output.
int ff_framesync_get_frame(FFFrameSync *fs, unsigned in, AVFrame **rframe, unsigned get)
Get the current frame in an input.
void ff_framesync_uninit(FFFrameSync *fs)
Free all memory currently allocated.
int ff_framesync_init(FFFrameSync *fs, AVFilterContext *parent, unsigned nb_in)
Initialize a frame sync structure.
@ EXT_STOP
Completely stop all streams with this one.
void av_dct_calc(DCTContext *s, FFTSample *data)
DCTContext * av_dct_init(int nbits, enum DCTTransformType type)
Set up DCT.
void av_dct_end(DCTContext *s)
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
#define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will have its filter_frame() c...
#define AVFILTER_FLAG_DYNAMIC_INPUTS
The number of the filter inputs is not determined just by AVFilter.inputs.
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
void * av_calloc(size_t nmemb, size_t size)
Non-inlined equivalent of av_mallocz_array().
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.
static int ff_insert_inpad(AVFilterContext *f, unsigned index, AVFilterPad *p)
Insert a new input pad for the filter.
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static enum AVPixelFormat pix_fmts[]
static const struct @322 planes[]
static int slice_end(AVCodecContext *avctx, AVFrame *pict)
Handle slice ends.
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define AV_PIX_FMT_GBRAP12
#define AV_PIX_FMT_YUV420P16
#define AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P9
#define AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV440P12
#define AV_PIX_FMT_GBRAP16
#define AV_PIX_FMT_YUV422P9
#define AV_PIX_FMT_YUVA444P10
#define AV_PIX_FMT_YUVA420P16
#define AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUVA422P9
#define AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_GRAY12
#define AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_YUV420P9
#define AV_PIX_FMT_YUVA420P9
#define AV_PIX_FMT_YUVA422P10
#define AV_PIX_FMT_YUV420P14
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
@ AV_PIX_FMT_YUVJ440P
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
@ AV_PIX_FMT_YUVJ411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
#define AV_PIX_FMT_YUVA422P12
#define AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_GRAY10
#define AV_PIX_FMT_GRAY14
#define AV_PIX_FMT_YUV422P16
#define AV_PIX_FMT_YUV440P10
#define AV_PIX_FMT_GRAY16
#define AV_PIX_FMT_GBRAP10
#define AV_PIX_FMT_YUVA444P16
#define AV_PIX_FMT_YUVA422P16
#define AV_PIX_FMT_GBRP16
#define AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_YUVA444P9
#define AV_PIX_FMT_GBRP14
#define AV_PIX_FMT_YUVA444P12
#define AV_PIX_FMT_YUV444P16
#define AV_PIX_FMT_YUV444P10
typedef void(RENAME(mix_any_func_type))
Describe the class of an AVClass context structure.
A link between two filters.
int w
agreed upon image width
int h
agreed upon image height
AVFilterContext * src
source filter
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link.
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable; if left to 0/0,...
AVFilterContext * dst
dest filter
int format
agreed upon media format
A filter pad used for either input or output.
int(* config_props)(AVFilterLink *link)
Link configuration callback.
enum AVMediaType type
AVFilterPad type.
const char * name
Pad name.
const char * name
Filter name.
AVFormatInternal * internal
An opaque field for libavformat internal usage.
This structure describes decoded (raw) audio or video data.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
double(* do_block_ssd)(struct BM3DContext *s, PosCode *pos, const uint8_t *src, int src_stride, int r_y, int r_x)
void(* do_output)(struct BM3DContext *s, uint8_t *dst, int dst_linesize, int plane, int nb_jobs)
void(* get_block_row)(const uint8_t *srcp, int src_linesize, int y, int x, int block_size, float *dst)
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)
SliceContext slices[MAX_NB_THREADS]
PosPairCode match_blocks[256]
PosCode * search_positions
Used for passing data between threads.
static int ref[MAX_W *MAX_W]
static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
AVFILTER_DEFINE_CLASS(bm3d)
static int do_search_boundary(int pos, int plane_boundary, int search_range, int search_step)
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)
static int cmp_scores(const void *a, const void *b)
static int query_formats(AVFilterContext *ctx)
static int config_input(AVFilterLink *inlink)
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)
static int filter_frame(AVFilterContext *ctx, AVFrame **out, AVFrame *in, AVFrame *ref)
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)
static double do_block_ssd(BM3DContext *s, PosCode *pos, const uint8_t *src, int src_stride, int r_y, int r_x)
static void block_matching(BM3DContext *s, const uint8_t *ref, int ref_linesize, int j, int i, int plane, int jobnr)
static void get_block_row16(const uint8_t *srcp, int src_linesize, int y, int x, int block_size, float *dst)
static void get_block_row(const uint8_t *srcp, int src_linesize, int y, int x, int block_size, float *dst)
static const AVOption bm3d_options[]
static int activate(AVFilterContext *ctx)
static av_cold int init(AVFilterContext *ctx)
static void do_output(BM3DContext *s, uint8_t *dst, int dst_linesize, int plane, int nb_jobs)
static av_cold void uninit(AVFilterContext *ctx)
static double do_block_ssd16(BM3DContext *s, PosCode *pos, const uint8_t *src, int src_stride, int r_y, int r_x)
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)
static const AVFilterPad bm3d_outputs[]
static int config_output(AVFilterLink *outlink)
static void do_output16(BM3DContext *s, uint8_t *dst, int dst_linesize, int plane, int nb_jobs)
static int process_frame(FFFrameSync *fs)
static int search_boundary(int plane_boundary, int search_range, int search_step, int vertical, int y, int x)
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.