[vlc-commits] [Git][videolan/vlc][master] 5 commits: vdpau/mixer: do not clobber filter_t on error
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Sun May 29 10:19:01 UTC 2022
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
ae8a7532 by Rémi Denis-Courmont at 2022-05-29T09:52:58+00:00
vdpau/mixer: do not clobber filter_t on error
- - - - -
448a6ba6 by Rémi Denis-Courmont at 2022-05-29T09:52:58+00:00
vdpau/avcodec: track chroma type in context
This stores the VDPAU video surface chroma type within the
corresponding VLC video context. This will be used in the following
changes.
- - - - -
7075de49 by Rémi Denis-Courmont at 2022-05-29T09:52:58+00:00
vdpau/mixer: get chroma type from input context
- - - - -
bd32c12b by Rémi Denis-Courmont at 2022-05-29T09:52:58+00:00
vdpau/export: get chroma type from input context
- - - - -
aadbaeb4 by Rémi Denis-Courmont at 2022-05-29T09:52:58+00:00
vdpau: merge all video surface formats
This approach does not scale up very well to various bit depths.
- - - - -
13 changed files:
- include/vlc_fourcc.h
- include/vlc_picture.h
- modules/hw/vdpau/adjust.c
- modules/hw/vdpau/avcodec.c
- modules/hw/vdpau/chroma.c
- modules/hw/vdpau/deinterlace.c
- modules/hw/vdpau/display.c
- modules/hw/vdpau/picture.c
- modules/hw/vdpau/sharpen.c
- modules/video_output/opengl/display.c
- modules/video_output/opengl/interop_vdpau.c
- src/misc/fourcc.c
- src/misc/fourcc_list.h
Changes:
=====================================
include/vlc_fourcc.h
=====================================
@@ -397,12 +397,8 @@
#define VLC_CODEC_GREY_16L VLC_FOURCC('G','R','F','L')
#define VLC_CODEC_GREY_16B VLC_FOURCC('G','R','F','B')
-/* VDPAU video surface YCbCr 4:2:0 */
-#define VLC_CODEC_VDPAU_VIDEO_420 VLC_FOURCC('V','D','V','0')
-/* VDPAU video surface YCbCr 4:2:2 */
-#define VLC_CODEC_VDPAU_VIDEO_422 VLC_FOURCC('V','D','V','2')
-/* VDPAU video surface YCbCr 4:4:4 */
-#define VLC_CODEC_VDPAU_VIDEO_444 VLC_FOURCC('V','D','V','4')
+/* VDPAU video surface YCbCr */
+#define VLC_CODEC_VDPAU_VIDEO VLC_FOURCC('V','D','V','Y')
/* VDPAU output surface RGBA */
#define VLC_CODEC_VDPAU_OUTPUT VLC_FOURCC('V','D','O','R')
=====================================
include/vlc_picture.h
=====================================
@@ -91,7 +91,7 @@ struct vlc_video_context_operations
enum vlc_video_context_type
{
VLC_VIDEO_CONTEXT_VAAPI = 1, //!< private: vaapi_vctx* or empty
- VLC_VIDEO_CONTEXT_VDPAU, //!< empty
+ VLC_VIDEO_CONTEXT_VDPAU, //!< private: chroma type (YUV) or empty (RGB)
VLC_VIDEO_CONTEXT_DXVA2, //!< private: d3d9_video_context_t*
VLC_VIDEO_CONTEXT_D3D11VA, //!< private: d3d11_video_context_t*
VLC_VIDEO_CONTEXT_AWINDOW, //!< private: android_video_context_t*
=====================================
modules/hw/vdpau/adjust.c
=====================================
@@ -161,9 +161,7 @@ static int Open(filter_t *filter)
if ( filter->vctx_in == NULL ||
vlc_video_context_GetType(filter->vctx_in) != VLC_VIDEO_CONTEXT_VDPAU )
return VLC_EGENERIC;
- if (filter->fmt_in.video.i_chroma != VLC_CODEC_VDPAU_VIDEO_420
- && filter->fmt_in.video.i_chroma != VLC_CODEC_VDPAU_VIDEO_422
- && filter->fmt_in.video.i_chroma != VLC_CODEC_VDPAU_VIDEO_444)
+ if (filter->fmt_in.video.i_chroma != VLC_CODEC_VDPAU_VIDEO)
return VLC_EGENERIC;
if (!video_format_IsSimilar(&filter->fmt_in.video, &filter->fmt_out.video))
return VLC_EGENERIC;
=====================================
modules/hw/vdpau/avcodec.c
=====================================
@@ -146,27 +146,13 @@ static int Open(vlc_va_t *va, AVCodecContext *avctx, enum AVPixelFormat hwfmt, c
(void) desc;
void *func;
VdpStatus err;
- VdpChromaType type;
+ VdpChromaType type, *chroma;
uint32_t width, height;
if (av_vdpau_get_surface_parameters(avctx, &type, &width, &height))
return VLC_EGENERIC;
- switch (type)
- {
- case VDP_CHROMA_TYPE_420:
- fmt_out->i_chroma = VLC_CODEC_VDPAU_VIDEO_420;
- break;
- case VDP_CHROMA_TYPE_422:
- fmt_out->i_chroma = VLC_CODEC_VDPAU_VIDEO_422;
- break;
- case VDP_CHROMA_TYPE_444:
- fmt_out->i_chroma = VLC_CODEC_VDPAU_VIDEO_444;
- break;
- default:
- msg_Err(va, "unsupported chroma type %"PRIu32, type);
- return VLC_EGENERIC;
- }
+ fmt_out->i_chroma = VLC_CODEC_VDPAU_VIDEO;
unsigned codec_refs;
switch (avctx->codec_id)
@@ -193,13 +179,16 @@ static int Open(vlc_va_t *va, AVCodecContext *avctx, enum AVPixelFormat hwfmt, c
return VLC_ENOMEM;
sys->vctx = vlc_video_context_Create(dec_device, VLC_VIDEO_CONTEXT_VDPAU,
- 0, &vdpau_vctx_ops);
+ sizeof (VdpChromaType),
+ &vdpau_vctx_ops);
if (sys->vctx == NULL)
{
free(sys);
return VLC_ENOMEM;
}
+ chroma = vlc_video_context_GetPrivate(sys->vctx, VLC_VIDEO_CONTEXT_VDPAU);
+ *chroma = type;
sys->type = type;
sys->width = width;
sys->height = height;
=====================================
modules/hw/vdpau/chroma.c
=====================================
@@ -650,8 +650,9 @@ static const struct vlc_filter_operations filter_output_opaque_ops = {
static int OutputOpen(filter_t *filter)
{
- if (filter->fmt_out.video.i_chroma != VLC_CODEC_VDPAU_OUTPUT)
- return VLC_EGENERIC;
+ if (filter->fmt_in.video.i_chroma != VLC_CODEC_VDPAU_VIDEO
+ || filter->fmt_out.video.i_chroma != VLC_CODEC_VDPAU_OUTPUT)
+ return VLC_ENOTSUP;
assert(filter->fmt_out.video.orientation == ORIENT_TOP_LEFT
|| filter->fmt_in.video.orientation == filter->fmt_out.video.orientation);
@@ -669,46 +670,33 @@ static int OutputOpen(filter_t *filter)
filter->p_sys = sys;
- VdpChromaType chroma;
-
- if (filter->fmt_in.video.i_chroma == VLC_CODEC_VDPAU_VIDEO_444)
- chroma = VDP_CHROMA_TYPE_444;
- else
- if (filter->fmt_in.video.i_chroma == VLC_CODEC_VDPAU_VIDEO_422)
- chroma = VDP_CHROMA_TYPE_422;
- else
- if (filter->fmt_in.video.i_chroma == VLC_CODEC_VDPAU_VIDEO_420)
- chroma = VDP_CHROMA_TYPE_420;
- else
- {
- vlc_decoder_device_Release(dec_device);
- return VLC_EGENERIC;
- }
+ const VdpChromaType *chroma;
+ struct vlc_video_context *vctx_out;
sys->device = GetVDPAUOpaqueDevice(dec_device);
- filter->vctx_out = vlc_video_context_Create(dec_device, VLC_VIDEO_CONTEXT_VDPAU,
- 0, &vdpau_vctx_ops);
+ vctx_out = vlc_video_context_Create(dec_device, VLC_VIDEO_CONTEXT_VDPAU,
+ 0, &vdpau_vctx_ops);
vlc_decoder_device_Release(dec_device);
- if (unlikely(filter->vctx_out == NULL))
+ if (unlikely(vctx_out == NULL))
return VLC_EGENERIC;
/* Allocate the output surface picture pool */
- sys->pool = OutputPoolAlloc(VLC_OBJECT(filter), filter->vctx_out,
+ sys->pool = OutputPoolAlloc(VLC_OBJECT(filter), vctx_out,
&filter->fmt_out.video);
if (sys->pool == NULL)
{
- vlc_video_context_Release(filter->vctx_out);
- filter->vctx_out = NULL;
+ vlc_video_context_Release(vctx_out);
return VLC_EGENERIC;
}
/* Create the video-to-output mixer */
- sys->mixer = MixerCreate(filter, chroma);
+ chroma = vlc_video_context_GetPrivate(filter->vctx_in,
+ VLC_VIDEO_CONTEXT_VDPAU);
+ sys->mixer = MixerCreate(filter, *chroma);
if (sys->mixer == VDP_INVALID_HANDLE)
{
picture_pool_Release(sys->pool);
- vlc_video_context_Release(filter->vctx_out);
- filter->vctx_out = NULL;
+ vlc_video_context_Release(vctx_out);
return VLC_EGENERIC;
}
@@ -721,6 +709,7 @@ static int OutputOpen(filter_t *filter)
sys->procamp.hue = 0.f;
filter->ops = &filter_output_opaque_ops;
+ filter->vctx_out = vctx_out;
return VLC_SUCCESS;
}
@@ -747,21 +736,6 @@ static picture_t *VideoExport_Filter(filter_t *filter, picture_t *src)
return VideoExport(filter, src, dst, sys->format);
}
-static bool ChromaMatches(VdpChromaType vdp_type, vlc_fourcc_t vlc_chroma)
-{
- switch (vlc_chroma)
- {
- case VLC_CODEC_VDPAU_VIDEO_420:
- return vdp_type == VDP_CHROMA_TYPE_420;
- case VLC_CODEC_VDPAU_VIDEO_422:
- return vdp_type == VDP_CHROMA_TYPE_422;
- case VLC_CODEC_VDPAU_VIDEO_444:
- return vdp_type == VDP_CHROMA_TYPE_444;
- default:
- return false;
- }
-}
-
static const struct vlc_filter_operations filter_ycbcr_ops = {
.filter_video = VideoExport_Filter,
};
@@ -771,8 +745,16 @@ static int YCbCrOpen(filter_t *filter)
VdpChromaType type;
VdpYCbCrFormat format;
+ if (filter->fmt_in.video.i_chroma != VLC_CODEC_VDPAU_VIDEO)
+ return VLC_ENOTSUP;
+ if (filter->vctx_in == NULL)
+ return VLC_EINVAL;
+
+ const VdpChromaType *chroma = vlc_video_context_GetPrivate(filter->vctx_in,
+ VLC_VIDEO_CONTEXT_VDPAU);
+
if (!vlc_fourcc_to_vdp_ycc(filter->fmt_out.video.i_chroma, &type, &format)
- || !ChromaMatches(type, filter->fmt_in.video.i_chroma))
+ || type != *chroma)
return VLC_EGENERIC;
if (filter->fmt_in.video.i_visible_width
=====================================
modules/hw/vdpau/deinterlace.c
=====================================
@@ -117,9 +117,7 @@ static int Open(filter_t *filter)
if ( filter->vctx_in == NULL ||
vlc_video_context_GetType(filter->vctx_in) != VLC_VIDEO_CONTEXT_VDPAU )
return VLC_EGENERIC;
- if (filter->fmt_in.video.i_chroma != VLC_CODEC_VDPAU_VIDEO_420
- && filter->fmt_in.video.i_chroma != VLC_CODEC_VDPAU_VIDEO_422
- && filter->fmt_in.video.i_chroma != VLC_CODEC_VDPAU_VIDEO_444)
+ if (filter->fmt_in.video.i_chroma != VLC_CODEC_VDPAU_VIDEO)
return VLC_EGENERIC;
if (!video_format_IsSimilar(&filter->fmt_in.video, &filter->fmt_out.video))
return VLC_EGENERIC;
=====================================
modules/hw/vdpau/display.c
=====================================
@@ -296,9 +296,7 @@ static const struct vlc_display_operations ops = {
static int Open(vout_display_t *vd,
video_format_t *fmtp, vlc_video_context *context)
{
- if (fmtp->i_chroma != VLC_CODEC_VDPAU_VIDEO_420
- && fmtp->i_chroma != VLC_CODEC_VDPAU_VIDEO_422
- && fmtp->i_chroma != VLC_CODEC_VDPAU_VIDEO_444)
+ if (fmtp->i_chroma != VLC_CODEC_VDPAU_VIDEO)
return VLC_ENOTSUP;
vout_display_sys_t *sys = malloc(sizeof (*sys));
=====================================
modules/hw/vdpau/picture.c
=====================================
@@ -117,9 +117,7 @@ VdpStatus vlc_vdp_video_attach(struct vlc_video_context *vctx,
if (unlikely(field == NULL))
return VDP_STATUS_RESOURCES;
- assert(pic->format.i_chroma == VLC_CODEC_VDPAU_VIDEO_420
- || pic->format.i_chroma == VLC_CODEC_VDPAU_VIDEO_422
- || pic->format.i_chroma == VLC_CODEC_VDPAU_VIDEO_444);
+ assert(pic->format.i_chroma == VLC_CODEC_VDPAU_VIDEO);
assert(pic->context == NULL);
pic->context = &field->context;
return VDP_STATUS_OK;
=====================================
modules/hw/vdpau/sharpen.c
=====================================
@@ -96,9 +96,7 @@ static int Open(filter_t *filter)
if ( filter->vctx_in == NULL ||
vlc_video_context_GetType(filter->vctx_in) != VLC_VIDEO_CONTEXT_VDPAU )
return VLC_EGENERIC;
- if (filter->fmt_in.video.i_chroma != VLC_CODEC_VDPAU_VIDEO_420
- && filter->fmt_in.video.i_chroma != VLC_CODEC_VDPAU_VIDEO_422
- && filter->fmt_in.video.i_chroma != VLC_CODEC_VDPAU_VIDEO_444)
+ if (filter->fmt_in.video.i_chroma != VLC_CODEC_VDPAU_VIDEO)
return VLC_EGENERIC;
if (!video_format_IsSimilar(&filter->fmt_in.video, &filter->fmt_out.video))
return VLC_EGENERIC;
=====================================
modules/video_output/opengl/display.c
=====================================
@@ -136,9 +136,7 @@ static int Open(vout_display_t *vd,
{
switch (vd->source->i_chroma)
{
- case VLC_CODEC_VDPAU_VIDEO_444:
- case VLC_CODEC_VDPAU_VIDEO_422:
- case VLC_CODEC_VDPAU_VIDEO_420:
+ case VLC_CODEC_VDPAU_VIDEO:
{
/* Force the option only if it was not previously set */
if (gl_name == NULL || gl_name[0] == 0
=====================================
modules/video_output/opengl/interop_vdpau.c
=====================================
@@ -131,9 +131,7 @@ Open(vlc_object_t *obj)
vlc_decoder_device *dec_device = vlc_video_context_HoldDevice(interop->vctx);
if (GetVDPAUOpaqueDevice(dec_device) == NULL
- || (interop->fmt_in.i_chroma != VLC_CODEC_VDPAU_VIDEO_420
- && interop->fmt_in.i_chroma != VLC_CODEC_VDPAU_VIDEO_422
- && interop->fmt_in.i_chroma != VLC_CODEC_VDPAU_VIDEO_444)
+ || interop->fmt_in.i_chroma != VLC_CODEC_VDPAU_VIDEO
|| !vlc_gl_HasExtension(&extension_vt, "GL_NV_vdpau_interop"))
{
vlc_decoder_device_Release(dec_device);
=====================================
src/misc/fourcc.c
=====================================
@@ -546,9 +546,7 @@ static const vlc_fourcc_t p_list_YUV[] = {
VLC_CODEC_YUV_SEMIPLANAR_420_16,
VLC_CODEC_YUV_PLANAR_422_16,
VLC_CODEC_YUV_PLANAR_444_16,
- VLC_CODEC_VDPAU_VIDEO_420,
- VLC_CODEC_VDPAU_VIDEO_422,
- VLC_CODEC_VDPAU_VIDEO_444,
+ VLC_CODEC_VDPAU_VIDEO,
VLC_CODEC_CVPX_NV12,
VLC_CODEC_CVPX_UYVY,
VLC_CODEC_CVPX_I420,
@@ -814,8 +812,7 @@ static const struct
{ { VLC_CODEC_Y211, 0 }, { 1, { {{1,4}, {1,1}} }, 4, 32 } },
{ { VLC_CODEC_XYZ12, 0 }, PACKED_FMT(6, 48) },
- { { VLC_CODEC_VDPAU_VIDEO_420, VLC_CODEC_VDPAU_VIDEO_422,
- VLC_CODEC_VDPAU_VIDEO_444, VLC_CODEC_VDPAU_OUTPUT },
+ { { VLC_CODEC_VDPAU_VIDEO, VLC_CODEC_VDPAU_OUTPUT },
FAKE_FMT() },
{ { VLC_CODEC_ANDROID_OPAQUE, VLC_CODEC_MMAL_OPAQUE,
VLC_CODEC_D3D9_OPAQUE, VLC_CODEC_D3D11_OPAQUE },
=====================================
src/misc/fourcc_list.h
=====================================
@@ -1204,17 +1204,9 @@ static const staticentry_t p_list_video[] = {
B(VLC_CODEC_IMM5, "Infinity IMM5"),
A("IMM5"),
- B(VLC_CODEC_VDPAU_VIDEO_420, "4:2:0 VDPAU opaque"),
- A("VDV0"),
+ B(VLC_CODEC_VDPAU_VIDEO, "VDPAU video"),
- B(VLC_CODEC_VDPAU_VIDEO_422, "4:2:2 VDPAU opaque"),
- A("VDV2"),
-
- B(VLC_CODEC_VDPAU_VIDEO_444, "4:4:4 VDPAU opaque"),
- A("VDV4"),
-
- B(VLC_CODEC_VDPAU_OUTPUT, "VDPAU opaque"),
- A("VDVR"),
+ B(VLC_CODEC_VDPAU_OUTPUT, "VDPAU output"),
B(VLC_CODEC_VAAPI_420, "4:2:0 VAAPI opaque"),
A("VAOP"),
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/aaed19ff50e2afc407abd5875d4b995022f9ad3c...aadbaeb440e59071744d85847b4101d87c4105a4
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/aaed19ff50e2afc407abd5875d4b995022f9ad3c...aadbaeb440e59071744d85847b4101d87c4105a4
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list