mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
surface: rework render flags.
Pack render flags per category and provide more flags into the color standard category. In particular, cover for SMPTE-240M.
This commit is contained in:
parent
467bf95c09
commit
751aa05937
3 changed files with 52 additions and 23 deletions
|
@ -110,19 +110,32 @@ typedef enum {
|
|||
* uses ITU-R BT.601 standard for color space conversion
|
||||
* @GST_VAAPI_COLOR_STANDARD_ITUR_BT_709:
|
||||
* uses ITU-R BT.709 standard for color space conversion
|
||||
* @GST_VAAPI_COLOR_STANDARD_ITUR_BT_470M:
|
||||
* uses ITU-R BT.470-2 System M standard for color space conversion
|
||||
* @GST_VAAPI_COLOR_STANDARD_ITUR_BT_470BG:
|
||||
* uses ITU-R BT.470-2 System B, G standard for color space conversion
|
||||
* @GST_VAAPI_COLOR_STANDARD_SMPTE_170M:
|
||||
* uses SMPTE-170M standard for color space conversion
|
||||
* @GST_VAAPI_COLOR_STANDARD_SMPTE_240M:
|
||||
* uses SMPTE-240M standard for color space conversion
|
||||
*
|
||||
* The set of all render flags for gst_vaapi_window_put_surface().
|
||||
*/
|
||||
typedef enum {
|
||||
GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD = 1 << 0,
|
||||
GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD = 1 << 1,
|
||||
GST_VAAPI_PICTURE_STRUCTURE_FRAME =
|
||||
(
|
||||
GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD |
|
||||
GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD
|
||||
),
|
||||
GST_VAAPI_COLOR_STANDARD_ITUR_BT_601 = 1 << 2,
|
||||
GST_VAAPI_COLOR_STANDARD_ITUR_BT_709 = 1 << 3,
|
||||
/* Picture structure */
|
||||
GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD = 0x01 << 0,
|
||||
GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD = 0x02 << 0,
|
||||
GST_VAAPI_PICTURE_STRUCTURE_FRAME = 0x03 << 0,
|
||||
GST_VAAPI_PICTURE_STRUCTURE_MASK = 0x00000003, /* 2 bits */
|
||||
|
||||
/* Color standard */
|
||||
GST_VAAPI_COLOR_STANDARD_ITUR_BT_601 = 0x01 << 2,
|
||||
GST_VAAPI_COLOR_STANDARD_ITUR_BT_709 = 0x02 << 2,
|
||||
GST_VAAPI_COLOR_STANDARD_ITUR_BT_470M = 0x03 << 2,
|
||||
GST_VAAPI_COLOR_STANDARD_ITUR_BT_470BG = 0x04 << 2,
|
||||
GST_VAAPI_COLOR_STANDARD_SMPTE_170M = 0x05 << 2,
|
||||
GST_VAAPI_COLOR_STANDARD_SMPTE_240M = 0x06 << 2,
|
||||
GST_VAAPI_COLOR_STANDARD_MASK = 0x0000003c, /* 4 bits */
|
||||
} GstVaapiSurfaceRenderFlags;
|
||||
|
||||
#define GST_VAAPI_SURFACE(obj) \
|
||||
|
|
|
@ -366,24 +366,42 @@ to_GstVideoOverlayFormatFlags(guint flags)
|
|||
guint
|
||||
from_GstVaapiSurfaceRenderFlags(guint flags)
|
||||
{
|
||||
guint va_fields = 0, va_csc = 0;
|
||||
guint va_fields, va_csc;
|
||||
|
||||
if (flags & GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD)
|
||||
va_fields |= VA_TOP_FIELD;
|
||||
if (flags & GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD)
|
||||
va_fields |= VA_BOTTOM_FIELD;
|
||||
if ((va_fields ^ (VA_TOP_FIELD|VA_BOTTOM_FIELD)) == 0)
|
||||
va_fields = VA_FRAME_PICTURE;
|
||||
/* Picture structure */
|
||||
switch (flags & GST_VAAPI_PICTURE_STRUCTURE_MASK) {
|
||||
case GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD:
|
||||
va_fields = VA_TOP_FIELD;
|
||||
break;
|
||||
case GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD:
|
||||
va_fields = VA_BOTTOM_FIELD;
|
||||
break;
|
||||
default:
|
||||
va_fields = VA_FRAME_PICTURE;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Color standard */
|
||||
switch (flags & GST_VAAPI_COLOR_STANDARD_MASK) {
|
||||
#ifdef VA_SRC_BT601
|
||||
if (flags & GST_VAAPI_COLOR_STANDARD_ITUR_BT_601)
|
||||
case GST_VAAPI_COLOR_STANDARD_ITUR_BT_601:
|
||||
va_csc = VA_SRC_BT601;
|
||||
break;
|
||||
#endif
|
||||
#ifdef VA_SRC_BT709
|
||||
if (flags & GST_VAAPI_COLOR_STANDARD_ITUR_BT_709)
|
||||
case GST_VAAPI_COLOR_STANDARD_ITUR_BT_709:
|
||||
va_csc = VA_SRC_BT709;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef VA_SRC_SMPTE_240
|
||||
case GST_VAAPI_COLOR_STANDARD_SMPTE_240M:
|
||||
va_csc = VA_SRC_SMPTE_240;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
va_csc = 0;
|
||||
break;
|
||||
}
|
||||
return va_fields|va_csc;
|
||||
}
|
||||
|
||||
|
|
|
@ -489,8 +489,7 @@ gst_vaapipostproc_process_vpp(GstBaseTransform *trans, GstBuffer *inbuf,
|
|||
ds->tff = tff;
|
||||
|
||||
flags = gst_vaapi_video_meta_get_render_flags(inbuf_meta) &
|
||||
~(GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD|
|
||||
GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD);
|
||||
~GST_VAAPI_PICTURE_STRUCTURE_MASK;
|
||||
|
||||
/* First field */
|
||||
deint_method = postproc->deinterlace_method;
|
||||
|
@ -652,8 +651,7 @@ gst_vaapipostproc_process(GstBaseTransform *trans, GstBuffer *inbuf,
|
|||
deint = is_interlaced_buffer(postproc, inbuf);
|
||||
|
||||
flags = gst_vaapi_video_meta_get_render_flags(meta) &
|
||||
~(GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD|
|
||||
GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD);
|
||||
~GST_VAAPI_PICTURE_STRUCTURE_MASK;
|
||||
|
||||
/* First field */
|
||||
fieldbuf = create_output_buffer(postproc);
|
||||
|
|
Loading…
Reference in a new issue