Lines Matching refs:vmixer
49 vlVdpVideoMixer *vmixer = NULL; in vlVdpVideoMixerCreate() local
60 vmixer = CALLOC(1, sizeof(vlVdpVideoMixer)); in vlVdpVideoMixerCreate()
61 if (!vmixer) in vlVdpVideoMixerCreate()
64 DeviceReference(&vmixer->device, dev); in vlVdpVideoMixerCreate()
68 if (!vl_compositor_init_state(&vmixer->cstate, dev->context)) { in vlVdpVideoMixerCreate()
73 vl_csc_get_matrix(VL_CSC_COLOR_STANDARD_BT_601, NULL, true, &vmixer->csc); in vlVdpVideoMixerCreate()
75 …if (!vl_compositor_set_csc_matrix(&vmixer->cstate, (const vl_csc_matrix *)&vmixer->csc, 1.0f, 0.0f… in vlVdpVideoMixerCreate()
81 *mixer = vlAddDataHTAB(vmixer); in vlVdpVideoMixerCreate()
104 vmixer->deint.supported = true; in vlVdpVideoMixerCreate()
108 vmixer->sharpness.supported = true; in vlVdpVideoMixerCreate()
112 vmixer->noise_reduction.supported = true; in vlVdpVideoMixerCreate()
116 vmixer->luma_key.supported = true; in vlVdpVideoMixerCreate()
120 vmixer->bicubic.supported = true; in vlVdpVideoMixerCreate()
126 vmixer->chroma_format = PIPE_VIDEO_CHROMA_FORMAT_420; in vlVdpVideoMixerCreate()
131 vmixer->video_width = *(uint32_t*)parameter_values[i]; in vlVdpVideoMixerCreate()
134 vmixer->video_height = *(uint32_t*)parameter_values[i]; in vlVdpVideoMixerCreate()
137 vmixer->chroma_format = ChromaToPipe(*(VdpChromaType*)parameter_values[i]); in vlVdpVideoMixerCreate()
140 vmixer->max_layers = *(uint32_t*)parameter_values[i]; in vlVdpVideoMixerCreate()
146 if (vmixer->max_layers > 4) { in vlVdpVideoMixerCreate()
147 VDPAU_MSG(VDPAU_WARN, "[VDPAU] Max layers > 4 not supported\n", vmixer->max_layers); in vlVdpVideoMixerCreate()
153 if (vmixer->video_width < 48 || vmixer->video_width > max_size) { in vlVdpVideoMixerCreate()
155 vmixer->video_width, max_size); in vlVdpVideoMixerCreate()
158 if (vmixer->video_height < 48 || vmixer->video_height > max_size) { in vlVdpVideoMixerCreate()
160 vmixer->video_height, max_size); in vlVdpVideoMixerCreate()
163 vmixer->luma_key.luma_min = 1.0f; in vlVdpVideoMixerCreate()
164 vmixer->luma_key.luma_max = 0.0f; in vlVdpVideoMixerCreate()
174 vl_compositor_cleanup_state(&vmixer->cstate); in vlVdpVideoMixerCreate()
177 DeviceReference(&vmixer->device, NULL); in vlVdpVideoMixerCreate()
178 FREE(vmixer); in vlVdpVideoMixerCreate()
188 vlVdpVideoMixer *vmixer; in vlVdpVideoMixerDestroy() local
190 vmixer = vlGetDataHTAB(mixer); in vlVdpVideoMixerDestroy()
191 if (!vmixer) in vlVdpVideoMixerDestroy()
194 mtx_lock(&vmixer->device->mutex); in vlVdpVideoMixerDestroy()
198 vl_compositor_cleanup_state(&vmixer->cstate); in vlVdpVideoMixerDestroy()
200 if (vmixer->deint.filter) { in vlVdpVideoMixerDestroy()
201 vl_deint_filter_cleanup(vmixer->deint.filter); in vlVdpVideoMixerDestroy()
202 FREE(vmixer->deint.filter); in vlVdpVideoMixerDestroy()
205 if (vmixer->noise_reduction.filter) { in vlVdpVideoMixerDestroy()
206 vl_median_filter_cleanup(vmixer->noise_reduction.filter); in vlVdpVideoMixerDestroy()
207 FREE(vmixer->noise_reduction.filter); in vlVdpVideoMixerDestroy()
210 if (vmixer->sharpness.filter) { in vlVdpVideoMixerDestroy()
211 vl_matrix_filter_cleanup(vmixer->sharpness.filter); in vlVdpVideoMixerDestroy()
212 FREE(vmixer->sharpness.filter); in vlVdpVideoMixerDestroy()
215 if (vmixer->bicubic.filter) { in vlVdpVideoMixerDestroy()
216 vl_bicubic_filter_cleanup(vmixer->bicubic.filter); in vlVdpVideoMixerDestroy()
217 FREE(vmixer->bicubic.filter); in vlVdpVideoMixerDestroy()
219 mtx_unlock(&vmixer->device->mutex); in vlVdpVideoMixerDestroy()
220 DeviceReference(&vmixer->device, NULL); in vlVdpVideoMixerDestroy()
222 FREE(vmixer); in vlVdpVideoMixerDestroy()
255 vlVdpVideoMixer *vmixer; in vlVdpVideoMixerRender() local
261 vmixer = vlGetDataHTAB(mixer); in vlVdpVideoMixerRender()
262 if (!vmixer) in vlVdpVideoMixerRender()
265 compositor = &vmixer->device->compositor; in vlVdpVideoMixerRender()
272 if (surf->device != vmixer->device) in vlVdpVideoMixerRender()
275 if (vmixer->video_width > video_buffer->width || in vlVdpVideoMixerRender()
276 vmixer->video_height > video_buffer->height || in vlVdpVideoMixerRender()
277 vmixer->chroma_format != video_buffer->chroma_format) in vlVdpVideoMixerRender()
280 if (layer_count > vmixer->max_layers) in vlVdpVideoMixerRender()
293 mtx_lock(&vmixer->device->mutex); in vlVdpVideoMixerRender()
295 vl_compositor_clear_layers(&vmixer->cstate); in vlVdpVideoMixerRender()
298 vl_compositor_set_rgba_layer(&vmixer->cstate, compositor, layer++, bg->sampler_view, in vlVdpVideoMixerRender()
315 mtx_unlock(&vmixer->device->mutex); in vlVdpVideoMixerRender()
319 if (deinterlace != VL_COMPOSITOR_WEAVE && vmixer->deint.enabled && in vlVdpVideoMixerRender()
325 vl_deint_filter_check_buffers(vmixer->deint.filter, in vlVdpVideoMixerRender()
327 vl_deint_filter_render(vmixer->deint.filter, prevprev->video_buffer, in vlVdpVideoMixerRender()
332 video_buffer = vmixer->deint.filter->video_buffer; in vlVdpVideoMixerRender()
344 …vl_compositor_set_buffer_layer(&vmixer->cstate, compositor, layer, video_buffer, prect, NULL, dein… in vlVdpVideoMixerRender()
346 if (vmixer->bicubic.filter || vmixer->sharpness.filter || vmixer->noise_reduction.filter) { in vlVdpVideoMixerRender()
347 pipe = vmixer->device->context; in vlVdpVideoMixerRender()
357 if (!vmixer->bicubic.filter) { in vlVdpVideoMixerRender()
382 if (!vmixer->bicubic.filter) { in vlVdpVideoMixerRender()
383 …vl_compositor_set_layer_dst_area(&vmixer->cstate, layer++, RectToPipe(destination_video_rect, &rec… in vlVdpVideoMixerRender()
384 vl_compositor_set_dst_clip(&vmixer->cstate, RectToPipe(destination_rect, &clip)); in vlVdpVideoMixerRender()
390 mtx_unlock(&vmixer->device->mutex); in vlVdpVideoMixerRender()
396 vl_compositor_set_rgba_layer(&vmixer->cstate, compositor, layer, src->sampler_view, in vlVdpVideoMixerRender()
398 …vl_compositor_set_layer_dst_area(&vmixer->cstate, layer++, RectToPipe(layers->destination_rect, &r… in vlVdpVideoMixerRender()
403 vl_compositor_render(&vmixer->cstate, compositor, surface, &dirty_area, true); in vlVdpVideoMixerRender()
405 if (vmixer->noise_reduction.filter) { in vlVdpVideoMixerRender()
406 if (!vmixer->sharpness.filter && !vmixer->bicubic.filter) { in vlVdpVideoMixerRender()
407 vl_median_filter_render(vmixer->noise_reduction.filter, in vlVdpVideoMixerRender()
415 vl_median_filter_render(vmixer->noise_reduction.filter, in vlVdpVideoMixerRender()
426 if (vmixer->sharpness.filter) { in vlVdpVideoMixerRender()
427 if (!vmixer->bicubic.filter) { in vlVdpVideoMixerRender()
428 vl_matrix_filter_render(vmixer->sharpness.filter, in vlVdpVideoMixerRender()
436 vl_matrix_filter_render(vmixer->sharpness.filter, in vlVdpVideoMixerRender()
447 if (vmixer->bicubic.filter) in vlVdpVideoMixerRender()
448 vl_bicubic_filter_render(vmixer->bicubic.filter, in vlVdpVideoMixerRender()
457 mtx_unlock(&vmixer->device->mutex); in vlVdpVideoMixerRender()
463 vlVdpVideoMixerUpdateDeinterlaceFilter(vlVdpVideoMixer *vmixer) in vlVdpVideoMixerUpdateDeinterlaceFilter() argument
465 struct pipe_context *pipe = vmixer->device->context; in vlVdpVideoMixerUpdateDeinterlaceFilter()
466 assert(vmixer); in vlVdpVideoMixerUpdateDeinterlaceFilter()
469 if (vmixer->deint.filter) { in vlVdpVideoMixerUpdateDeinterlaceFilter()
470 vl_deint_filter_cleanup(vmixer->deint.filter); in vlVdpVideoMixerUpdateDeinterlaceFilter()
471 FREE(vmixer->deint.filter); in vlVdpVideoMixerUpdateDeinterlaceFilter()
472 vmixer->deint.filter = NULL; in vlVdpVideoMixerUpdateDeinterlaceFilter()
476 if (vmixer->deint.enabled && vmixer->chroma_format == PIPE_VIDEO_CHROMA_FORMAT_420) { in vlVdpVideoMixerUpdateDeinterlaceFilter()
477 vmixer->deint.filter = MALLOC(sizeof(struct vl_deint_filter)); in vlVdpVideoMixerUpdateDeinterlaceFilter()
478 vmixer->deint.enabled = vl_deint_filter_init(vmixer->deint.filter, pipe, in vlVdpVideoMixerUpdateDeinterlaceFilter()
479 vmixer->video_width, vmixer->video_height, in vlVdpVideoMixerUpdateDeinterlaceFilter()
480 vmixer->skip_chroma_deint, vmixer->deint.spatial); in vlVdpVideoMixerUpdateDeinterlaceFilter()
481 if (!vmixer->deint.enabled) { in vlVdpVideoMixerUpdateDeinterlaceFilter()
482 FREE(vmixer->deint.filter); in vlVdpVideoMixerUpdateDeinterlaceFilter()
491 vlVdpVideoMixerUpdateNoiseReductionFilter(vlVdpVideoMixer *vmixer) in vlVdpVideoMixerUpdateNoiseReductionFilter() argument
493 assert(vmixer); in vlVdpVideoMixerUpdateNoiseReductionFilter()
496 if (vmixer->noise_reduction.filter) { in vlVdpVideoMixerUpdateNoiseReductionFilter()
497 vl_median_filter_cleanup(vmixer->noise_reduction.filter); in vlVdpVideoMixerUpdateNoiseReductionFilter()
498 FREE(vmixer->noise_reduction.filter); in vlVdpVideoMixerUpdateNoiseReductionFilter()
499 vmixer->noise_reduction.filter = NULL; in vlVdpVideoMixerUpdateNoiseReductionFilter()
503 if (vmixer->noise_reduction. enabled && vmixer->noise_reduction.level > 0) { in vlVdpVideoMixerUpdateNoiseReductionFilter()
504 vmixer->noise_reduction.filter = MALLOC(sizeof(struct vl_median_filter)); in vlVdpVideoMixerUpdateNoiseReductionFilter()
505 vl_median_filter_init(vmixer->noise_reduction.filter, vmixer->device->context, in vlVdpVideoMixerUpdateNoiseReductionFilter()
506 vmixer->video_width, vmixer->video_height, in vlVdpVideoMixerUpdateNoiseReductionFilter()
507 vmixer->noise_reduction.level + 1, in vlVdpVideoMixerUpdateNoiseReductionFilter()
513 vlVdpVideoMixerUpdateSharpnessFilter(vlVdpVideoMixer *vmixer) in vlVdpVideoMixerUpdateSharpnessFilter() argument
515 assert(vmixer); in vlVdpVideoMixerUpdateSharpnessFilter()
518 if (vmixer->sharpness.filter) { in vlVdpVideoMixerUpdateSharpnessFilter()
519 vl_matrix_filter_cleanup(vmixer->sharpness.filter); in vlVdpVideoMixerUpdateSharpnessFilter()
520 FREE(vmixer->sharpness.filter); in vlVdpVideoMixerUpdateSharpnessFilter()
521 vmixer->sharpness.filter = NULL; in vlVdpVideoMixerUpdateSharpnessFilter()
525 if (vmixer->sharpness.enabled && vmixer->sharpness.value != 0.0f) { in vlVdpVideoMixerUpdateSharpnessFilter()
529 if (vmixer->sharpness.value > 0.0f) { in vlVdpVideoMixerUpdateSharpnessFilter()
535 matrix[i] *= vmixer->sharpness.value; in vlVdpVideoMixerUpdateSharpnessFilter()
545 matrix[i] *= fabsf(vmixer->sharpness.value) / 16.0f; in vlVdpVideoMixerUpdateSharpnessFilter()
547 matrix[4] += 1.0f - fabsf(vmixer->sharpness.value); in vlVdpVideoMixerUpdateSharpnessFilter()
550 vmixer->sharpness.filter = MALLOC(sizeof(struct vl_matrix_filter)); in vlVdpVideoMixerUpdateSharpnessFilter()
551 vl_matrix_filter_init(vmixer->sharpness.filter, vmixer->device->context, in vlVdpVideoMixerUpdateSharpnessFilter()
552 vmixer->video_width, vmixer->video_height, in vlVdpVideoMixerUpdateSharpnessFilter()
561 vlVdpVideoMixerUpdateBicubicFilter(vlVdpVideoMixer *vmixer) in vlVdpVideoMixerUpdateBicubicFilter() argument
563 assert(vmixer); in vlVdpVideoMixerUpdateBicubicFilter()
566 if (vmixer->bicubic.filter) { in vlVdpVideoMixerUpdateBicubicFilter()
567 vl_bicubic_filter_cleanup(vmixer->bicubic.filter); in vlVdpVideoMixerUpdateBicubicFilter()
568 FREE(vmixer->bicubic.filter); in vlVdpVideoMixerUpdateBicubicFilter()
569 vmixer->bicubic.filter = NULL; in vlVdpVideoMixerUpdateBicubicFilter()
572 if (vmixer->bicubic.enabled) { in vlVdpVideoMixerUpdateBicubicFilter()
573 vmixer->bicubic.filter = MALLOC(sizeof(struct vl_bicubic_filter)); in vlVdpVideoMixerUpdateBicubicFilter()
574 vl_bicubic_filter_init(vmixer->bicubic.filter, vmixer->device->context, in vlVdpVideoMixerUpdateBicubicFilter()
575 vmixer->video_width, vmixer->video_height); in vlVdpVideoMixerUpdateBicubicFilter()
588 vlVdpVideoMixer *vmixer; in vlVdpVideoMixerGetFeatureSupport() local
594 vmixer = vlGetDataHTAB(mixer); in vlVdpVideoMixerGetFeatureSupport()
595 if (!vmixer) in vlVdpVideoMixerGetFeatureSupport()
615 feature_supports[i] = vmixer->deint.supported; in vlVdpVideoMixerGetFeatureSupport()
619 feature_supports[i] = vmixer->sharpness.supported; in vlVdpVideoMixerGetFeatureSupport()
623 feature_supports[i] = vmixer->noise_reduction.supported; in vlVdpVideoMixerGetFeatureSupport()
627 feature_supports[i] = vmixer->luma_key.supported; in vlVdpVideoMixerGetFeatureSupport()
631 feature_supports[i] = vmixer->bicubic.supported; in vlVdpVideoMixerGetFeatureSupport()
651 vlVdpVideoMixer *vmixer; in vlVdpVideoMixerSetFeatureEnables() local
657 vmixer = vlGetDataHTAB(mixer); in vlVdpVideoMixerSetFeatureEnables()
658 if (!vmixer) in vlVdpVideoMixerSetFeatureEnables()
661 mtx_lock(&vmixer->device->mutex); in vlVdpVideoMixerSetFeatureEnables()
678 vmixer->deint.enabled = feature_enables[i]; in vlVdpVideoMixerSetFeatureEnables()
679 vlVdpVideoMixerUpdateDeinterlaceFilter(vmixer); in vlVdpVideoMixerSetFeatureEnables()
683 vmixer->sharpness.enabled = feature_enables[i]; in vlVdpVideoMixerSetFeatureEnables()
684 vlVdpVideoMixerUpdateSharpnessFilter(vmixer); in vlVdpVideoMixerSetFeatureEnables()
688 vmixer->noise_reduction.enabled = feature_enables[i]; in vlVdpVideoMixerSetFeatureEnables()
689 vlVdpVideoMixerUpdateNoiseReductionFilter(vmixer); in vlVdpVideoMixerSetFeatureEnables()
693 vmixer->luma_key.enabled = feature_enables[i]; in vlVdpVideoMixerSetFeatureEnables()
695 if (!vl_compositor_set_csc_matrix(&vmixer->cstate, (const vl_csc_matrix *)&vmixer->csc, in vlVdpVideoMixerSetFeatureEnables()
696 vmixer->luma_key.luma_min, vmixer->luma_key.luma_max)) { in vlVdpVideoMixerSetFeatureEnables()
697 mtx_unlock(&vmixer->device->mutex); in vlVdpVideoMixerSetFeatureEnables()
703 vmixer->bicubic.enabled = feature_enables[i]; in vlVdpVideoMixerSetFeatureEnables()
704 vlVdpVideoMixerUpdateBicubicFilter(vmixer); in vlVdpVideoMixerSetFeatureEnables()
708 mtx_unlock(&vmixer->device->mutex); in vlVdpVideoMixerSetFeatureEnables()
712 mtx_unlock(&vmixer->device->mutex); in vlVdpVideoMixerSetFeatureEnables()
726 vlVdpVideoMixer *vmixer; in vlVdpVideoMixerGetFeatureEnables() local
732 vmixer = vlGetDataHTAB(mixer); in vlVdpVideoMixerGetFeatureEnables()
733 if (!vmixer) in vlVdpVideoMixerGetFeatureEnables()
753 feature_enables[i] = vmixer->sharpness.enabled; in vlVdpVideoMixerGetFeatureEnables()
757 feature_enables[i] = vmixer->noise_reduction.enabled; in vlVdpVideoMixerGetFeatureEnables()
761 feature_enables[i] = vmixer->luma_key.enabled; in vlVdpVideoMixerGetFeatureEnables()
765 feature_enables[i] = vmixer->bicubic.enabled; in vlVdpVideoMixerGetFeatureEnables()
795 vlVdpVideoMixer *vmixer = vlGetDataHTAB(mixer); in vlVdpVideoMixerSetAttributeValues() local
796 if (!vmixer) in vlVdpVideoMixerSetAttributeValues()
799 mtx_lock(&vmixer->device->mutex); in vlVdpVideoMixerSetAttributeValues()
808 vl_compositor_set_clear_color(&vmixer->cstate, &color); in vlVdpVideoMixerSetAttributeValues()
812 vmixer->custom_csc = !!vdp_csc; in vlVdpVideoMixerSetAttributeValues()
814 vl_csc_get_matrix(VL_CSC_COLOR_STANDARD_BT_601, NULL, 1, &vmixer->csc); in vlVdpVideoMixerSetAttributeValues()
816 memcpy(vmixer->csc, vdp_csc, sizeof(vl_csc_matrix)); in vlVdpVideoMixerSetAttributeValues()
818 if (!vl_compositor_set_csc_matrix(&vmixer->cstate, (const vl_csc_matrix *)&vmixer->csc, in vlVdpVideoMixerSetAttributeValues()
819 vmixer->luma_key.luma_min, vmixer->luma_key.luma_max)) { in vlVdpVideoMixerSetAttributeValues()
833 vmixer->noise_reduction.level = val * 10; in vlVdpVideoMixerSetAttributeValues()
834 vlVdpVideoMixerUpdateNoiseReductionFilter(vmixer); in vlVdpVideoMixerSetAttributeValues()
843 vmixer->luma_key.luma_min = val; in vlVdpVideoMixerSetAttributeValues()
845 if (!vl_compositor_set_csc_matrix(&vmixer->cstate, (const vl_csc_matrix *)&vmixer->csc, in vlVdpVideoMixerSetAttributeValues()
846 vmixer->luma_key.luma_min, vmixer->luma_key.luma_max)) { in vlVdpVideoMixerSetAttributeValues()
858 vmixer->luma_key.luma_max = val; in vlVdpVideoMixerSetAttributeValues()
860 if (!vl_compositor_set_csc_matrix(&vmixer->cstate, (const vl_csc_matrix *)&vmixer->csc, in vlVdpVideoMixerSetAttributeValues()
861 vmixer->luma_key.luma_min, vmixer->luma_key.luma_max)) { in vlVdpVideoMixerSetAttributeValues()
875 vmixer->sharpness.value = val; in vlVdpVideoMixerSetAttributeValues()
876 vlVdpVideoMixerUpdateSharpnessFilter(vmixer); in vlVdpVideoMixerSetAttributeValues()
884 vmixer->skip_chroma_deint = *(uint8_t*)attribute_values[i]; in vlVdpVideoMixerSetAttributeValues()
885 vlVdpVideoMixerUpdateDeinterlaceFilter(vmixer); in vlVdpVideoMixerSetAttributeValues()
892 mtx_unlock(&vmixer->device->mutex); in vlVdpVideoMixerSetAttributeValues()
896 mtx_unlock(&vmixer->device->mutex); in vlVdpVideoMixerSetAttributeValues()
909 vlVdpVideoMixer *vmixer = vlGetDataHTAB(mixer); in vlVdpVideoMixerGetParameterValues() local
911 if (!vmixer) in vlVdpVideoMixerGetParameterValues()
921 *(uint32_t*)parameter_values[i] = vmixer->video_width; in vlVdpVideoMixerGetParameterValues()
924 *(uint32_t*)parameter_values[i] = vmixer->video_height; in vlVdpVideoMixerGetParameterValues()
927 *(VdpChromaType*)parameter_values[i] = PipeToChroma(vmixer->chroma_format); in vlVdpVideoMixerGetParameterValues()
930 *(uint32_t*)parameter_values[i] = vmixer->max_layers; in vlVdpVideoMixerGetParameterValues()
954 vlVdpVideoMixer *vmixer = vlGetDataHTAB(mixer); in vlVdpVideoMixerGetAttributeValues() local
955 if (!vmixer) in vlVdpVideoMixerGetAttributeValues()
958 mtx_lock(&vmixer->device->mutex); in vlVdpVideoMixerGetAttributeValues()
962 vl_compositor_get_clear_color(&vmixer->cstate, attribute_values[i]); in vlVdpVideoMixerGetAttributeValues()
966 if (!vmixer->custom_csc) { in vlVdpVideoMixerGetAttributeValues()
970 memcpy(*vdp_csc, vmixer->csc, sizeof(float)*12); in vlVdpVideoMixerGetAttributeValues()
974 *(float*)attribute_values[i] = (float)vmixer->noise_reduction.level / 10.0f; in vlVdpVideoMixerGetAttributeValues()
978 *(float*)attribute_values[i] = vmixer->luma_key.luma_min; in vlVdpVideoMixerGetAttributeValues()
981 *(float*)attribute_values[i] = vmixer->luma_key.luma_max; in vlVdpVideoMixerGetAttributeValues()
984 *(float*)attribute_values[i] = vmixer->sharpness.value; in vlVdpVideoMixerGetAttributeValues()
987 *(uint8_t*)attribute_values[i] = vmixer->skip_chroma_deint; in vlVdpVideoMixerGetAttributeValues()
990 mtx_unlock(&vmixer->device->mutex); in vlVdpVideoMixerGetAttributeValues()
994 mtx_unlock(&vmixer->device->mutex); in vlVdpVideoMixerGetAttributeValues()