Lines Matching refs:vmixer

49    vlVdpVideoMixer *vmixer = NULL;
60 vmixer = CALLOC(1, sizeof(vlVdpVideoMixer));
61 if (!vmixer)
64 vmixer->device = dev;
68 vl_compositor_init_state(&vmixer->cstate, dev->context);
70 vl_csc_get_matrix(VL_CSC_COLOR_STANDARD_BT_601, NULL, true, &vmixer->csc);
72 vl_compositor_set_csc_matrix(&vmixer->cstate, (const vl_csc_matrix *)&vmixer->csc);
74 *mixer = vlAddDataHTAB(vmixer);
100 vmixer->sharpness.supported = true;
104 vmixer->noise_reduction.supported = true;
111 vmixer->chroma_format = PIPE_VIDEO_CHROMA_FORMAT_420;
116 vmixer->video_width = *(uint32_t*)parameter_values[i];
119 vmixer->video_height = *(uint32_t*)parameter_values[i];
122 vmixer->chroma_format = ChromaToPipe(*(VdpChromaType*)parameter_values[i]);
125 vmixer->max_layers = *(uint32_t*)parameter_values[i];
131 if (vmixer->max_layers > 4) {
132 VDPAU_MSG(VDPAU_WARN, "[VDPAU] Max layers > 4 not supported\n", vmixer->max_layers);
137 if (vmixer->video_width < 48 ||
138 vmixer->video_width > max_width) {
139 VDPAU_MSG(VDPAU_WARN, "[VDPAU] 48 < %u < %u not valid for width\n", vmixer->video_width, max_width);
142 if (vmixer->video_height < 48 ||
143 vmixer->video_height > max_height) {
144 VDPAU_MSG(VDPAU_WARN, "[VDPAU] 48 < %u < %u not valid for height\n", vmixer->video_height, max_height);
147 vmixer->luma_key_min = 0.f;
148 vmixer->luma_key_max = 1.f;
157 vl_compositor_cleanup_state(&vmixer->cstate);
159 FREE(vmixer);
169 vlVdpVideoMixer *vmixer;
171 vmixer = vlGetDataHTAB(mixer);
172 if (!vmixer)
175 pipe_mutex_lock(vmixer->device->mutex);
177 vlVdpResolveDelayedRendering(vmixer->device, NULL, NULL);
181 vl_compositor_cleanup_state(&vmixer->cstate);
183 if (vmixer->noise_reduction.filter) {
184 vl_median_filter_cleanup(vmixer->noise_reduction.filter);
185 FREE(vmixer->noise_reduction.filter);
188 if (vmixer->sharpness.filter) {
189 vl_matrix_filter_cleanup(vmixer->sharpness.filter);
190 FREE(vmixer->sharpness.filter);
192 pipe_mutex_unlock(vmixer->device->mutex);
194 FREE(vmixer);
222 vlVdpVideoMixer *vmixer;
228 vmixer = vlGetDataHTAB(mixer);
229 if (!vmixer)
232 compositor = &vmixer->device->compositor;
238 if (surf->device != vmixer->device)
241 if (vmixer->video_width > surf->video_buffer->width ||
242 vmixer->video_height > surf->video_buffer->height ||
243 vmixer->chroma_format != surf->video_buffer->chroma_format)
246 if (layer_count > vmixer->max_layers)
253 pipe_mutex_lock(vmixer->device->mutex);
254 vlVdpResolveDelayedRendering(vmixer->device, NULL, NULL);
258 pipe_mutex_unlock(vmixer->device->mutex);
261 vl_compositor_set_rgba_layer(&vmixer->cstate, compositor, layer++, bg->sampler_view,
265 vl_compositor_clear_layers(&vmixer->cstate);
281 pipe_mutex_unlock(vmixer->device->mutex);
292 vl_compositor_set_buffer_layer(&vmixer->cstate, compositor, layer, surf->video_buffer, prect, NULL, deinterlace);
293 vl_compositor_set_layer_dst_area(&vmixer->cstate, layer++, RectToPipe(destination_video_rect, &rect));
298 pipe_mutex_unlock(vmixer->device->mutex);
304 vl_compositor_set_rgba_layer(&vmixer->cstate, compositor, layer, src->sampler_view,
306 vl_compositor_set_layer_dst_area(&vmixer->cstate, layer++, RectToPipe(layers->destination_rect, &rect));
311 vl_compositor_set_dst_clip(&vmixer->cstate, RectToPipe(destination_rect, &clip));
312 if (!vmixer->noise_reduction.filter && !vmixer->sharpness.filter)
313 vlVdpSave4DelayedRendering(vmixer->device, destination_surface, &vmixer->cstate);
315 vl_compositor_render(&vmixer->cstate, compositor, dst->surface, &dst->dirty_area);
320 if (vmixer->noise_reduction.filter)
321 vl_median_filter_render(vmixer->noise_reduction.filter,
324 if (vmixer->sharpness.filter)
325 vl_matrix_filter_render(vmixer->sharpness.filter,
328 pipe_mutex_unlock(vmixer->device->mutex);
337 vlVdpVideoMixerUpdateNoiseReductionFilter(vlVdpVideoMixer *vmixer)
339 assert(vmixer);
342 if (vmixer->noise_reduction.filter) {
343 vl_median_filter_cleanup(vmixer->noise_reduction.filter);
344 FREE(vmixer->noise_reduction.filter);
345 vmixer->noise_reduction.filter = NULL;
349 if (vmixer->noise_reduction. enabled && vmixer->noise_reduction.level > 0) {
350 vmixer->noise_reduction.filter = MALLOC(sizeof(struct vl_median_filter));
351 vl_median_filter_init(vmixer->noise_reduction.filter, vmixer->device->context,
352 vmixer->video_width, vmixer->video_height,
353 vmixer->noise_reduction.level + 1,
359 vlVdpVideoMixerUpdateSharpnessFilter(vlVdpVideoMixer *vmixer)
361 assert(vmixer);
364 if (vmixer->sharpness.filter) {
365 vl_matrix_filter_cleanup(vmixer->sharpness.filter);
366 FREE(vmixer->sharpness.filter);
367 vmixer->sharpness.filter = NULL;
371 if (vmixer->sharpness.enabled && vmixer->sharpness.value != 0.0f) {
375 if (vmixer->sharpness.value > 0.0f) {
381 matrix[i] *= vmixer->sharpness.value;
391 matrix[i] *= fabsf(vmixer->sharpness.value) / 16.0f;
393 matrix[4] += 1.0f - fabsf(vmixer->sharpness.value);
396 vmixer->sharpness.filter = MALLOC(sizeof(struct vl_matrix_filter));
397 vl_matrix_filter_init(vmixer->sharpness.filter, vmixer->device->context,
398 vmixer->video_width, vmixer->video_height,
412 vlVdpVideoMixer *vmixer;
418 vmixer = vlGetDataHTAB(mixer);
419 if (!vmixer)
442 feature_supports[i] = vmixer->sharpness.supported;
446 feature_supports[i] = vmixer->noise_reduction.supported;
466 vlVdpVideoMixer *vmixer;
472 vmixer = vlGetDataHTAB(mixer);
473 if (!vmixer)
476 pipe_mutex_lock(vmixer->device->mutex);
496 vmixer->sharpness.enabled = feature_enables[i];
497 vlVdpVideoMixerUpdateSharpnessFilter(vmixer);
501 vmixer->noise_reduction.enabled = feature_enables[i];
502 vlVdpVideoMixerUpdateNoiseReductionFilter(vmixer);
506 pipe_mutex_unlock(vmixer->device->mutex);
510 pipe_mutex_unlock(vmixer->device->mutex);
524 vlVdpVideoMixer *vmixer;
530 vmixer = vlGetDataHTAB(mixer);
531 if (!vmixer)
553 feature_enables[i] = vmixer->sharpness.enabled;
557 feature_enables[i] = vmixer->noise_reduction.enabled;
586 vlVdpVideoMixer *vmixer = vlGetDataHTAB(mixer);
587 if (!vmixer)
590 pipe_mutex_lock(vmixer->device->mutex);
599 vl_compositor_set_clear_color(&vmixer->cstate, &color);
603 vmixer->custom_csc = !!vdp_csc;
605 vl_csc_get_matrix(VL_CSC_COLOR_STANDARD_BT_601, NULL, 1, &vmixer->csc);
607 memcpy(vmixer->csc, vdp_csc, sizeof(vl_csc_matrix));
609 vl_compositor_set_csc_matrix(&vmixer->cstate, (const vl_csc_matrix *)&vmixer->csc);
618 vmixer->noise_reduction.level = val * 10;
619 vlVdpVideoMixerUpdateNoiseReductionFilter(vmixer);
626 vmixer->luma_key_min = val;
632 vmixer->luma_key_max = val;
641 vmixer->sharpness.value = val;
642 vlVdpVideoMixerUpdateSharpnessFilter(vmixer);
648 vmixer->skip_chroma_deint = *(uint8_t*)attribute_values[i];
651 pipe_mutex_unlock(vmixer->device->mutex);
655 pipe_mutex_unlock(vmixer->device->mutex);
669 vlVdpVideoMixer *vmixer = vlGetDataHTAB(mixer);
671 if (!vmixer)
681 *(uint32_t*)parameter_values[i] = vmixer->video_width;
684 *(uint32_t*)parameter_values[i] = vmixer->video_height;
687 *(VdpChromaType*)parameter_values[i] = PipeToChroma(vmixer->chroma_format);
690 *(uint32_t*)parameter_values[i] = vmixer->max_layers;
714 vlVdpVideoMixer *vmixer = vlGetDataHTAB(mixer);
715 if (!vmixer)
718 pipe_mutex_lock(vmixer->device->mutex);
722 vl_compositor_get_clear_color(&vmixer->cstate, attribute_values[i]);
726 if (!vmixer->custom_csc) {
730 memcpy(*vdp_csc, vmixer->csc, sizeof(float)*12);
734 *(float*)attribute_values[i] = (float)vmixer->noise_reduction.level / 10.0f;
738 *(float*)attribute_values[i] = vmixer->luma_key_min;
741 *(float*)attribute_values[i] = vmixer->luma_key_max;
744 *(float*)attribute_values[i] = vmixer->sharpness.value;
747 *(uint8_t*)attribute_values[i] = vmixer->skip_chroma_deint;
750 pipe_mutex_unlock(vmixer->device->mutex);
754 pipe_mutex_unlock(vmixer->device->mutex);