MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / hb_denoise_work

Function hb_denoise_work

libhb/denoise.c:323–370  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

321}
322
323static int hb_denoise_work(hb_filter_object_t *filter,
324 hb_buffer_t **buf_in,
325 hb_buffer_t **buf_out)
326{
327 hb_filter_private_t *pv = filter->private_data;
328 hb_buffer_t *in = *buf_in, *out;
329
330 if (in->s.flags & HB_BUF_FLAG_EOF)
331 {
332 *buf_out = in;
333 *buf_in = NULL;
334 return HB_FILTER_DONE;
335 }
336
337 out = hb_frame_buffer_init(pv->output.pix_fmt, in->f.width, in->f.height);
338 out->f.color_prim = pv->output.color_prim;
339 out->f.color_transfer = pv->output.color_transfer;
340 out->f.color_matrix = pv->output.color_matrix;
341 out->f.color_range = pv->output.color_range;
342 out->f.chroma_location = pv->output.chroma_location;
343
344 if (!pv->hqdn3d_line)
345 {
346 pv->hqdn3d_line = malloc(in->plane[0].stride * sizeof(uint16_t));
347 }
348
349 int c, coef_index;
350
351 for (c = 0; c < 3; c++)
352 {
353 coef_index = c * 2;
354 hqdn3d_denoise(in->plane[c].data,
355 out->plane[c].data,
356 pv->hqdn3d_line,
357 &pv->hqdn3d_frame[c],
358 AV_CEIL_RSHIFT(in->f.width, (!!c * pv->hsub)),
359 AV_CEIL_RSHIFT(in->f.height, (!!c * pv->vsub)),
360 in->plane[c].stride,
361 out->plane[c].stride,
362 pv->hqdn3d_coef[coef_index],
363 pv->hqdn3d_coef[coef_index+1]);
364 }
365
366 hb_buffer_copy_props(out, in);
367 *buf_out = out;
368
369 return HB_FILTER_OK;
370}

Callers

nothing calls this directly

Calls 2

hb_frame_buffer_initFunction · 0.85
hb_buffer_copy_propsFunction · 0.85

Tested by

no test coverage detected