@@ -34,14 +34,14 @@ GST_DEBUG_CATEGORY_STATIC(gst_pisp_convert_debug);
3434/* Supported GStreamer formats */
3535#define PISP_FORMATS " { RGB, RGBx, BGRx, I420, YV12, Y42B, Y444, YUY2, UYVY, NV12, NV12_128C8, NV12_10LE32_128C8 }"
3636/* Supported DRM fourccs */
37- #define PISP_DRM_FORMATS " { RG24, XB24, XR24, YU12, YV12, YU16, YU24, YUYV, UYVY, NV12, NV12:0x0700000000000004, P030:0x0700000000000004 }"
37+ #define PISP_DRM_FORMATS \
38+ " { RG24, XB24, XR24, YU12, YV12, YU16, YU24, YUYV, UYVY, NV12, NV12:0x0700000000000004, P030:0x0700000000000004 }"
3839
39- #define PISP_SRC_CAPS \
40- " video/x-raw(memory:DMABuf), format=(string)DMA_DRM, drm-format=(string)" PISP_DRM_FORMATS \
41- " , width=(int)[1,32768], height=(int)[1,32768], framerate=(fraction)[0/1,2147483647/1]" \
42- " ;" \
43- GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_DMABUF, PISP_FORMATS) ";" \
44- GST_VIDEO_CAPS_MAKE(PISP_FORMATS)
40+ #define PISP_SRC_CAPS \
41+ " video/x-raw(memory:DMABuf), format=(string)DMA_DRM, drm-format=(string)" PISP_DRM_FORMATS \
42+ " , width=(int)[1,32768], height=(int)[1,32768], framerate=(fraction)[0/1,2147483647/1]" \
43+ " ;" GST_VIDEO_CAPS_MAKE_WITH_FEATURES(GST_CAPS_FEATURE_MEMORY_DMABUF, \
44+ PISP_FORMATS) " ;" GST_VIDEO_CAPS_MAKE(PISP_FORMATS)
4545
4646static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE(
4747 " sink" , GST_PAD_SINK, GST_PAD_ALWAYS,
@@ -53,13 +53,11 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE(
5353 /* System memory */
5454 GST_VIDEO_CAPS_MAKE (PISP_FORMATS)));
5555
56- static GstStaticPadTemplate src0_template = GST_STATIC_PAD_TEMPLATE(
57- " src0" , GST_PAD_SRC, GST_PAD_ALWAYS,
58- GST_STATIC_CAPS(PISP_SRC_CAPS));
56+ static GstStaticPadTemplate src0_template =
57+ GST_STATIC_PAD_TEMPLATE (" src0" , GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS(PISP_SRC_CAPS));
5958
60- static GstStaticPadTemplate src1_template = GST_STATIC_PAD_TEMPLATE(
61- " src1" , GST_PAD_SRC, GST_PAD_ALWAYS,
62- GST_STATIC_CAPS(PISP_SRC_CAPS));
59+ static GstStaticPadTemplate src1_template =
60+ GST_STATIC_PAD_TEMPLATE (" src1" , GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS(PISP_SRC_CAPS));
6361
6462#define gst_pisp_convert_parent_class parent_class
6563G_DEFINE_TYPE (GstPispConvert, gst_pisp_convert, GST_TYPE_ELEMENT);
@@ -154,9 +152,9 @@ static const char *colorimetry_to_pisp(const GstVideoColorimetry *colorimetry)
154152}
155153
156154/* Configure colour space conversion blocks for the backend */
157- static uint32_t configure_colour_conversion(libpisp::BackEnd *backend, const char *in_format,
158- const char *in_colorspace , const char *out_format ,
159- const char *out_colorspace, unsigned int output_index)
155+ static uint32_t configure_colour_conversion (libpisp::BackEnd *backend, const char *in_format, const char *in_colorspace,
156+ const char *out_format , const char *out_colorspace ,
157+ unsigned int output_index)
160158{
161159 uint32_t rgb_enables = 0 ;
162160
@@ -177,8 +175,7 @@ static uint32_t configure_colour_conversion(libpisp::BackEnd *backend, const cha
177175 backend->SetCsc (output_index, csc);
178176 rgb_enables |= PISP_BE_RGB_ENABLE_CSC (output_index);
179177 }
180- else if (g_str_equal(out_format, " RGB888" ) ||
181- g_str_equal(out_format, " RGBX8888" ) ||
178+ else if (g_str_equal (out_format, " RGB888" ) || g_str_equal (out_format, " RGBX8888" ) ||
182179 g_str_equal (out_format, " XRGB8888" ))
183180 {
184181 /* R/B channel swap to match GStreamer/DRM byte ordering */
@@ -252,21 +249,18 @@ static void gst_pisp_convert_class_init(GstPispConvertClass *klass)
252249 gobject_class, PROP_CROP,
253250 g_param_spec_string (" crop" , " Crop region for all outputs" ,
254251 " Crop region as 'x,y,width,height' applied to all outputs (0,0,0,0 = full input)" ,
255- " 0,0,0,0" ,
256- static_cast <GParamFlags>(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
252+ " 0,0,0,0" , static_cast <GParamFlags>(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
257253
258254 g_object_class_install_property (
259255 gobject_class, PROP_CROP0,
260256 g_param_spec_string (" crop0" , " Crop region for output 0" ,
261- " Crop region as 'x,y,width,height' (0,0,0,0 = no crop / full input)" ,
262- " 0,0,0,0" ,
257+ " Crop region as 'x,y,width,height' (0,0,0,0 = no crop / full input)" , " 0,0,0,0" ,
263258 static_cast <GParamFlags>(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
264259
265260 g_object_class_install_property (
266261 gobject_class, PROP_CROP1,
267262 g_param_spec_string (" crop1" , " Crop region for output 1" ,
268- " Crop region as 'x,y,width,height' (0,0,0,0 = no crop / full input)" ,
269- " 0,0,0,0" ,
263+ " Crop region as 'x,y,width,height' (0,0,0,0 = no crop / full input)" , " 0,0,0,0" ,
270264 static_cast <GParamFlags>(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
271265
272266 element_class->change_state = GST_DEBUG_FUNCPTR (gst_pisp_convert_change_state);
@@ -533,8 +527,8 @@ static gboolean parse_input_caps(GstPispConvert *self, GstCaps *caps)
533527 self->priv ->in_colorspace = colorimetry_to_pisp (&colorimetry);
534528
535529 GST_INFO_OBJECT (self, " Input DMA-DRM format: drm-format=%s, pisp=%s, colorspace=%s (matrix=%d, range=%d)" ,
536- drm_format, self->priv ->in_format , self->priv ->in_colorspace ,
537- colorimetry.matrix , colorimetry. range );
530+ drm_format, self->priv ->in_format , self->priv ->in_colorspace , colorimetry. matrix ,
531+ colorimetry.range );
538532 }
539533 else
540534 {
@@ -548,9 +542,9 @@ static gboolean parse_input_caps(GstPispConvert *self, GstCaps *caps)
548542 self->priv ->in_stride = GST_VIDEO_INFO_PLANE_STRIDE (&in_info, 0 );
549543 self->priv ->in_format = gst_format_to_pisp (GST_VIDEO_INFO_FORMAT (&in_info));
550544 self->priv ->in_colorspace = colorimetry_to_pisp (&GST_VIDEO_INFO_COLORIMETRY (&in_info));
551- GST_INFO_OBJECT (self, " Input format: pisp=%s, colorspace=%s (matrix=%d, range=%d)" ,
552- self->priv ->in_format , self-> priv -> in_colorspace ,
553- GST_VIDEO_INFO_COLORIMETRY (&in_info).matrix , GST_VIDEO_INFO_COLORIMETRY (&in_info). range );
545+ GST_INFO_OBJECT (self, " Input format: pisp=%s, colorspace=%s (matrix=%d, range=%d)" , self-> priv -> in_format ,
546+ self->priv ->in_colorspace , GST_VIDEO_INFO_COLORIMETRY (&in_info). matrix ,
547+ GST_VIDEO_INFO_COLORIMETRY (&in_info).range );
554548 }
555549
556550 if (!self->priv ->in_colorspace )
@@ -661,14 +655,13 @@ static void add_video_meta(GstBuffer *buffer, const char *pisp_format, guint wid
661655 for (guint p = 0 ; p < n_planes; p++)
662656 {
663657 offsets[p] = offset;
664- strides[p] = hw_stride * GST_VIDEO_INFO_PLANE_STRIDE (&vinfo, p) /
665- GST_VIDEO_INFO_PLANE_STRIDE (&vinfo, 0 );
666- mem = gst_buffer_peek_memory (buffer, p);
658+ strides[p] = hw_stride * GST_VIDEO_INFO_PLANE_STRIDE (&vinfo, p) / GST_VIDEO_INFO_PLANE_STRIDE (&vinfo, 0 );
659+ mem = gst_buffer_peek_memory (buffer, p);
667660 offset += mem->size ;
668661 }
669662
670- gst_buffer_add_video_meta_full (buffer, GST_VIDEO_FRAME_FLAG_NONE, gst_fmt,
671- width, height, n_planes, offsets, strides);
663+ gst_buffer_add_video_meta_full (buffer, GST_VIDEO_FRAME_FLAG_NONE, gst_fmt, width, height, n_planes, offsets,
664+ strides);
672665}
673666
674667static void copy_planes (std::array<uint8_t *, 3 > src, guint src_stride, std::array<uint8_t *, 3 > dst, guint dst_stride,
@@ -887,19 +880,20 @@ static gboolean gst_pisp_convert_configure(GstPispConvert *self)
887880 self->priv ->backend ->SetOutputFormat (i, output_cfg[i]);
888881
889882 if ((g_str_equal (self->priv ->out_format [i], " RGBX8888" ) ||
890- g_str_equal (self->priv ->out_format [i], " XRGB8888" )) && !self->priv ->variant ->BackendRGB32Supported (0 ))
883+ g_str_equal (self->priv ->out_format [i], " XRGB8888" )) &&
884+ !self->priv ->variant ->BackendRGB32Supported (0 ))
891885 GST_WARNING_OBJECT (self, " pisp_be HW does not support 32-bit RGB output, the image will be corrupt." );
892886
893887 if (!self->priv ->out_colorspace [i])
894888 self->priv ->out_colorspace [i] = self->priv ->in_colorspace ;
895889
896- global.rgb_enables |= configure_colour_conversion (self->priv ->backend .get (),
897- self->priv ->in_format , self->priv ->in_colorspace ,
898- self-> priv -> out_format [i], self->priv ->out_colorspace [i], i);
890+ global.rgb_enables |= configure_colour_conversion (self->priv ->backend .get (), self-> priv -> in_format ,
891+ self->priv ->in_colorspace , self->priv ->out_format [i] ,
892+ self->priv ->out_colorspace [i], i);
899893
900- GST_INFO_OBJECT (self, " Output%d: %ux%u %s (stride: gst=%u hw=%u) colorspace %s" , i, self-> priv -> out_width [i],
901- self->priv ->out_height [i], self->priv ->out_format [i], self->priv ->out_stride [i],
902- self->priv ->out_hw_stride [i], self->priv ->out_colorspace [i]);
894+ GST_INFO_OBJECT (self, " Output%d: %ux%u %s (stride: gst=%u hw=%u) colorspace %s" , i,
895+ self->priv ->out_width [i], self->priv ->out_height [i], self->priv ->out_format [i],
896+ self->priv ->out_stride [i], self-> priv -> out_hw_stride [i], self->priv ->out_colorspace [i]);
903897 }
904898
905899 self->priv ->backend ->SetGlobal (global);
@@ -1141,8 +1135,8 @@ static GstFlowReturn gst_pisp_convert_chain(GstPad *pad [[maybe_unused]], GstObj
11411135 goto cleanup;
11421136 }
11431137
1144- add_video_meta (outbuf[i], self->priv ->out_format [i], self->priv ->out_width [i],
1145- self->priv ->out_height [i], self-> priv -> out_hw_stride [i]);
1138+ add_video_meta (outbuf[i], self->priv ->out_format [i], self->priv ->out_width [i], self-> priv -> out_height [i],
1139+ self->priv ->out_hw_stride [i]);
11461140
11471141 GST_DEBUG_OBJECT (self, " Using zero-copy output%d path" , i);
11481142 }
0 commit comments