45#define MAX_NB_THREADS 32
121 const uint8_t *
src,
int src_stride,
124 int plane,
int nb_jobs);
126 const uint8_t *
src,
int src_linesize,
127 const uint8_t *
ref,
int ref_linesize,
128 int y,
int x,
int plane,
int jobnr);
131#define OFFSET(x) offsetof(BM3DContext, x)
132#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
135 {
"sigma",
"set denoising strength",
137 {
"block",
"set size of local patch",
139 {
"bstep",
"set sliding step for processing blocks",
141 {
"group",
"set maximal number of similar blocks",
143 {
"range",
"set block matching range",
145 {
"mstep",
"set step for block matching",
147 {
"thmse",
"set threshold of mean square error for block matching",
149 {
"hdthr",
"set hard threshold for 3D transfer domain",
151 {
"estim",
"set filtering estimation mode",
153 {
"basic",
"basic estimate",
155 {
"final",
"final estimate",
157 {
"ref",
"have reference stream",
159 {
"planes",
"set planes to filter",
196 search_range = search_range / search_step * search_step;
198 if (
pos == plane_boundary) {
200 }
else if (
pos > plane_boundary) {
217static int search_boundary(
int plane_boundary,
int search_range,
int search_step,
int vertical,
int y,
int x)
219 return do_search_boundary(vertical ? y : x, plane_boundary, search_range, search_step);
231 const uint8_t *srcp =
src +
pos->y * src_stride +
pos->x;
232 const uint8_t *refp =
src + r_y * src_stride + r_x;
233 const int block_size =
s->block_size;
237 for (
y = 0;
y < block_size;
y++) {
238 for (
x = 0;
x < block_size;
x++) {
239 double temp = refp[
x] - srcp[
x];
252 const uint16_t *srcp = (uint16_t *)
src +
pos->y * src_stride / 2 +
pos->x;
253 const uint16_t *refp = (uint16_t *)
src + r_y * src_stride / 2 + r_x;
254 const int block_size =
s->block_size;
258 for (
y = 0;
y < block_size;
y++) {
259 for (
x = 0;
x < block_size;
x++) {
260 double temp = refp[
x] - srcp[
x];
264 srcp += src_stride / 2;
265 refp += src_stride / 2;
272 const PosCode *search_pos,
int search_size,
float th_mse,
273 int r_y,
int r_x,
int plane,
int jobnr)
276 double MSE2SSE =
s->group_size *
s->block_size *
s->block_size * src_range * src_range / (
double)(
s->max *
s->max);
277 double distMul = 1. / MSE2SSE;
278 double th_sse = th_mse * MSE2SSE;
281 for (
int i = 0;
i < search_size;
i++) {
285 dist =
s->do_block_ssd(
s, &
pos,
src, src_stride, r_y, r_x);
288 if (dist <= th_sse && dist != 0) {
289 const double score = dist * distMul;
295 if (
index >=
s->group_size)
296 index =
s->group_size - 1;
310 int exclude_cur_pos,
int plane,
int jobnr)
313 const int width =
s->planewidth[plane];
314 const int height =
s->planeheight[plane];
315 const int block_size =
s->block_size;
316 const int step =
s->bm_step;
317 const int range =
s->bm_range / step * step;
324 for (
int j = t; j <=
b; j += step) {
325 for (
int i = l;
i <=
r;
i += step) {
328 if (exclude_cur_pos > 0 && j ==
y &&
i ==
x) {
338 if (exclude_cur_pos == 1) {
350 int j,
int i,
int plane,
int jobnr)
354 if (
s->group_size == 1 ||
s->th_mse <= 0.f) {
367 int y,
int x,
int block_size,
float *
dst)
369 const uint8_t *
src = srcp +
y * src_linesize +
x;
371 for (
int j = 0; j < block_size; j++)
376 int y,
int x,
int block_size,
float *
dst)
378 const uint16_t *
src = (uint16_t *)srcp +
y * src_linesize / 2 +
x;
380 for (
int j = 0; j < block_size; j++)
385 const uint8_t *
ref,
int ref_linesize,
386 int y,
int x,
int plane,
int jobnr)
389 const int pblock_size =
s->pblock_size;
390 const int buffer_linesize =
s->pblock_size *
s->pblock_size;
392 const int block_size =
s->block_size;
393 const int width =
s->planewidth[plane];
394 const int pgroup_size =
s->pgroup_size;
395 const int group_size =
s->group_size;
402 float den_weight, num_weight;
405 for (
int k = 0; k < nb_match_blocks; k++) {
409 for (
int i = 0;
i < block_size;
i++) {
410 s->get_block_row(
src, src_linesize,
y +
i,
x, block_size, bufferh + pblock_size *
i);
411 sc->
tx_fn(sc->
dctf, buffert, bufferh + pblock_size *
i,
sizeof(
float));
412 for (
int j = 0; j < block_size; j++)
413 bufferv[j * pblock_size +
i] = buffert[j];
416 for (
int i = 0;
i < block_size;
i++) {
417 sc->
tx_fn(sc->
dctf, buffert, bufferv +
i * pblock_size,
sizeof(
float));
418 memcpy(
buffer + k * buffer_linesize +
i * pblock_size,
419 buffert, block_size *
sizeof(
float));
423 for (
int i = 0;
i < block_size;
i++) {
424 for (
int j = 0; j < block_size; j++) {
425 for (
int k = 0; k < nb_match_blocks; k++)
426 bufferz[k] =
buffer[buffer_linesize * k +
i * pblock_size + j];
428 sc->
tx_fn_g(sc->
gdctf, bufferz, bufferz,
sizeof(
float));
429 bufferz += pgroup_size;
433 threshold[0] =
s->hard_threshold *
s->sigma *
M_SQRT2 * 4.f * block_size * block_size * (1 << (
s->depth - 8)) / 255.f;
434 threshold[1] = threshold[0] *
sqrtf(2.f);
435 threshold[2] = threshold[0] * 2.f;
436 threshold[3] = threshold[0] *
sqrtf(8.f);
439 for (
int i = 0;
i < block_size;
i++) {
440 for (
int j = 0; j < block_size; j++) {
441 for (
int k = 0; k < nb_match_blocks; k++) {
442 const float thresh = threshold[(j == 0) + (
i == 0) + (k == 0)];
444 if (bufferz[k] > thresh || bufferz[k] < -thresh) {
450 bufferz += pgroup_size;
456 for (
int i = 0;
i < block_size;
i++) {
457 for (
int j = 0; j < block_size; j++) {
460 for (
int k = 0; k < nb_match_blocks; k++)
461 buffer[buffer_linesize * k +
i * pblock_size + j] = bufferz[k];
462 bufferz += pgroup_size;
466 den_weight = retained < 1 ? 1.f : 1.f / retained;
467 num_weight = den_weight;
470 for (
int k = 0; k < nb_match_blocks; k++) {
474 for (
int i = 0;
i < block_size;
i++) {
475 memcpy(bufferv +
i * pblock_size,
476 buffer + k * buffer_linesize +
i * pblock_size,
477 block_size *
sizeof(
float));
480 for (
int i = 0;
i < block_size;
i++) {
481 sc->
itx_fn(sc->
dcti, buffert, bufferv +
i * pblock_size,
sizeof(
float));
482 for (
int j = 0; j < block_size; j++)
483 bufferh[j * pblock_size +
i] = buffert[j];
486 for (
int i = 0;
i < block_size;
i++) {
487 sc->
itx_fn(sc->
dcti, buffert, bufferh + pblock_size *
i,
sizeof(
float));
488 for (
int j = 0; j < block_size; j++) {
489 num[j] += buffert[j] * num_weight;
490 den[j] += den_weight;
499 const uint8_t *
ref,
int ref_linesize,
500 int y,
int x,
int plane,
int jobnr)
503 const int pblock_size =
s->pblock_size;
504 const int buffer_linesize =
s->pblock_size *
s->pblock_size;
506 const int block_size =
s->block_size;
507 const int width =
s->planewidth[plane];
508 const int pgroup_size =
s->pgroup_size;
509 const int group_size =
s->group_size;
510 const float sigma_sqr =
s->sigma *
s->sigma;
519 float den_weight, num_weight;
522 for (
int k = 0; k < nb_match_blocks; k++) {
526 for (
int i = 0;
i < block_size;
i++) {
527 s->get_block_row(
src, src_linesize,
y +
i,
x, block_size, bufferh + pblock_size *
i);
528 s->get_block_row(
ref, ref_linesize,
y +
i,
x, block_size, rbufferh + pblock_size *
i);
529 sc->
tx_fn(sc->
dctf, bufferh + pblock_size *
i, bufferh + pblock_size *
i,
sizeof(
float));
530 sc->
tx_fn(sc->
dctf, rbufferh + pblock_size *
i, rbufferh + pblock_size *
i,
sizeof(
float));
533 for (
int i = 0;
i < block_size;
i++) {
534 for (
int j = 0; j < block_size; j++) {
535 bufferv[
i * pblock_size + j] = bufferh[j * pblock_size +
i];
536 rbufferv[
i * pblock_size + j] = rbufferh[j * pblock_size +
i];
538 sc->
tx_fn(sc->
dctf, bufferv +
i * pblock_size, bufferv +
i * pblock_size,
sizeof(
float));
539 sc->
tx_fn(sc->
dctf, rbufferv +
i * pblock_size, rbufferv +
i * pblock_size,
sizeof(
float));
542 for (
int i = 0;
i < block_size;
i++) {
543 memcpy(
buffer + k * buffer_linesize +
i * pblock_size,
544 bufferv +
i * pblock_size, block_size *
sizeof(
float));
545 memcpy(rbuffer + k * buffer_linesize +
i * pblock_size,
546 rbufferv +
i * pblock_size, block_size *
sizeof(
float));
550 for (
int i = 0;
i < block_size;
i++) {
551 for (
int j = 0; j < block_size; j++) {
552 for (
int k = 0; k < nb_match_blocks; k++) {
553 bufferz[k] =
buffer[buffer_linesize * k +
i * pblock_size + j];
554 rbufferz[k] = rbuffer[buffer_linesize * k +
i * pblock_size + j];
556 if (group_size > 1) {
557 sc->
tx_fn_g(sc->
gdctf, bufferz, bufferz,
sizeof(
float));
558 sc->
tx_fn_g(sc->
gdctf, rbufferz, rbufferz,
sizeof(
float));
560 bufferz += pgroup_size;
561 rbufferz += pgroup_size;
568 for (
int i = 0;
i < block_size;
i++) {
569 for (
int j = 0; j < block_size; j++) {
570 for (
int k = 0; k < nb_match_blocks; k++) {
571 const float ref_sqr = rbufferz[k] * rbufferz[k];
572 float wiener_coef = ref_sqr / (ref_sqr + sigma_sqr);
574 if (
isnan(wiener_coef))
576 bufferz[k] *= wiener_coef;
577 l2_wiener += wiener_coef * wiener_coef;
579 bufferz += pgroup_size;
580 rbufferz += pgroup_size;
586 for (
int i = 0;
i < block_size;
i++) {
587 for (
int j = 0; j < block_size; j++) {
590 for (
int k = 0; k < nb_match_blocks; k++) {
591 buffer[buffer_linesize * k +
i * pblock_size + j] = bufferz[k];
593 bufferz += pgroup_size;
597 l2_wiener =
FFMAX(l2_wiener, 1e-15f);
598 den_weight = 1.f / l2_wiener;
599 num_weight = den_weight;
601 for (
int k = 0; k < nb_match_blocks; k++) {
605 for (
int i = 0;
i < block_size;
i++) {
606 memcpy(bufferv +
i * pblock_size,
607 buffer + k * buffer_linesize +
i * pblock_size,
608 block_size *
sizeof(
float));
611 for (
int i = 0;
i < block_size;
i++) {
612 sc->
itx_fn(sc->
dcti, bufferv + pblock_size *
i, bufferv + pblock_size *
i,
sizeof(
float));
613 for (
int j = 0; j < block_size; j++) {
614 bufferh[j * pblock_size +
i] = bufferv[
i * pblock_size + j];
618 for (
int i = 0;
i < block_size;
i++) {
619 sc->
itx_fn(sc->
dcti, bufferh + pblock_size *
i, bufferh + pblock_size *
i,
sizeof(
float));
620 for (
int j = 0; j < block_size; j++) {
621 num[j] += bufferh[
i * pblock_size + j] * num_weight;
622 den[j] += den_weight;
631 int plane,
int nb_jobs)
633 const int height =
s->planeheight[plane];
634 const int width =
s->planewidth[plane];
637 for (
int j = 0; j <
width; j++) {
638 uint8_t *dstp =
dst +
i * dst_linesize;
642 for (
int k = 0; k < nb_jobs; k++) {
657 int plane,
int nb_jobs)
659 const int height =
s->planeheight[plane];
660 const int width =
s->planewidth[plane];
661 const int depth =
s->depth;
664 for (
int j = 0; j <
width; j++) {
665 uint16_t *dstp = (uint16_t *)
dst +
i * dst_linesize / 2;
669 for (
int k = 0; k < nb_jobs; k++) {
687 const int block_step =
s->block_step;
689 const uint8_t *
src = td->
src;
690 const uint8_t *
ref = td->
ref;
693 const int plane = td->
plane;
694 const int width =
s->planewidth[plane];
695 const int height =
s->planeheight[plane];
696 const int block_pos_bottom =
FFMAX(0,
height -
s->block_size);
697 const int block_pos_right =
FFMAX(0,
width -
s->block_size);
699 const int slice_end = (jobnr == nb_jobs - 1) ? block_pos_bottom + block_step :
700 ff_slice_pos((
height + block_step - 1) / block_step, jobnr + 1, nb_jobs) * block_step;
706 if (j > block_pos_bottom) {
707 j = block_pos_bottom;
710 for (
int i = 0;
i < block_pos_right + block_step;
i += block_step) {
711 if (
i > block_pos_right) {
717 s->block_filtering(
s,
src, src_linesize,
718 ref, ref_linesize, j,
i, plane, jobnr);
736 for (p = 0; p <
s->nb_planes; p++) {
737 const int nb_jobs =
FFMAX(1,
FFMIN(
s->nb_threads,
s->planeheight[p] /
s->block_size));
740 if (!((1 << p) &
s->planes) ||
ctx->is_disabled) {
743 s->planewidth[p] * (1 + (
s->depth > 8)),
s->planeheight[p]);
754 s->do_output(
s, (*out)->data[p], (*out)->linesize[p], p, nb_jobs);
760#define SQR(x) ((x) * (x))
770 s->depth =
desc->comp[0].depth;
771 s->max = (1 <<
s->depth) - 1;
773 s->planeheight[0] =
s->planeheight[3] = inlink->
h;
775 s->planewidth[0] =
s->planewidth[3] = inlink->
w;
779 for (
int i = 0;
i <
s->nb_threads;
i++) {
781 float iscale = 0.5f /
s->block_size;
798 if (
s->group_size > 1) {
799 float iscale = 0.5f /
s->group_size;
906 if (
s->th_mse == 0.f)
907 s->th_mse = 400.f +
s->sigma * 80.f;
909 }
else if (
s->mode ==
FINAL) {
914 if (
s->th_mse == 0.f)
915 s->th_mse = 200.f +
s->sigma * 10.f;
922 if (
s->block_step >
s->block_size) {
924 s->block_step,
s->block_size);
925 s->block_step =
s->block_size;
928 if (
s->bm_step >
s->bm_range) {
930 s->bm_step,
s->bm_range);
931 s->bm_step =
s->bm_range;
943 pad.
name =
"reference";
970 "(size %dx%d) do not match the corresponding "
971 "second input link %s parameters (%dx%d) ",
973 ctx->input_pads[1].name,
ref->w,
ref->h);
1012 for (
int i = 0;
i <
s->nb_threads;
i++) {
1049 .p.priv_class = &bm3d_class,
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static int config_input(AVFilterLink *inlink)
const FFFilter ff_vf_bm3d
static AVFormatContext * ctx
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_append_inpad(AVFilterContext *f, AVFilterPad *p)
Append a new input/output pad to the filter's list of such pads.
int ff_outlink_frame_wanted(AVFilterLink *link)
Test if a frame is wanted on an output link.
int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
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 i(width, name, range_min, range_max)
#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.
static __device__ float sqrtf(float a)
int(* init)(AVBSFContext *ctx)
static av_always_inline int process_frame(AVTextFormatContext *tfc, InputFile *ifile, AVFrame *frame, const AVPacket *pkt, int *packet_new)
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.
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
@ AV_OPT_TYPE_INT
Underlying C type is int.
@ AV_OPT_TYPE_FLOAT
Underlying C type is float.
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
#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_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 void scale(int *out, const int *in, const int w, const int h, const int shift)
static av_cold void uninit(AVBitStreamFilterContext *ctx)
static int activate(AVBitStreamFilterContext *ctx)
static int config_output(AVBitStreamFilterLink *outlink)
#define FILTER_OUTPUTS(array)
static int ff_slice_pos(int total, int jobnr, int nb_jobs)
Compute the boundary index for a slice when work of size total is split into nb_jobs slices.
#define FILTER_PIXFMTS_ARRAY(array)
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 FilterLink * ff_filter_link(AVFilterLink *link)
#define AVFILTER_DEFINE_CLASS(fname)
size_t av_cpu_max_align(void)
Get the maximum data alignment that may be required by FFmpeg.
#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 @257111027162314367033347246032313251342043035002 planes[]
#define FFDIFFSIGN(x, y)
Comparator.
void * av_calloc(size_t nmemb, size_t size)
Memory handling functions.
static int slice_end(AVCodecContext *avctx, AVFrame *pict, int *got_output)
Handle slice ends.
@ EXT_STOP
Completely stop all streams with this one.
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
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
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.
This structure describes decoded (raw) audio or video data.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
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]
enum FFFrameSyncExtMode after
Extrapolation mode for timestamps after the last frame.
enum FFFrameSyncExtMode before
Extrapolation mode for timestamps before the first frame.
AVRational time_base
Time base for the incoming frames.
unsigned sync
Synchronization level: frames on input at the highest sync level will generate output frame events.
Link properties exposed to filter code, but not external callers.
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable.
PosPairCode match_blocks[256]
PosCode * search_positions
Used for passing data between threads.
static int ref[MAX_W *MAX_W]
av_cold void av_tx_uninit(AVTXContext **ctx)
Frees a context and sets *ctx to NULL, does nothing when *ctx == NULL.
av_cold int av_tx_init(AVTXContext **ctx, av_tx_fn *tx, enum AVTXType type, int inv, int len, const void *scale, uint64_t flags)
Initialize a transform context with the given configuration (i)MDCTs with an odd length are currently...
@ AV_TX_FLOAT_DCT
Real to real (DCT) transforms.
void(* av_tx_fn)(AVTXContext *s, void *out, void *in, ptrdiff_t stride)
Function pointer to a function to perform the transform.
static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
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 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 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.
static int slice_start(SliceContext *sc, VVCContext *s, VVCFrameContext *fc, const CodedBitstreamUnit *unit, const int is_first_slice)