From 2dbba91056483d72c594372ab0f3ba9ea3ef047b Mon Sep 17 00:00:00 2001 From: MyungJoo Ham Date: Tue, 12 Jun 2018 15:36:39 +0900 Subject: [PATCH] [Style] ANSI-C89 Comment Style https://gstreamer.freedesktop.org/documentation/frequently-asked-questions/developing.html#what-is-the-coding-style-for-gstreamer-code states: Comments should be in /* ANSI C comment style */ and code should generally be compatible with ANSI C89, so please declare all variables at the beginning of the block, etc. Thus, we have updated commenting style. Signed-off-by: MyungJoo Ham --- tensor_converter/tensor_converter.c | 18 +++++++++--------- tensor_filter/tensor_filter.c | 21 ++++++++++----------- tensor_filter/tensor_filter_custom.c | 2 +- tensor_filter/tensor_filter_tensorflow_lite.c | 10 +++++----- 4 files changed, 25 insertions(+), 26 deletions(-) diff --git a/tensor_converter/tensor_converter.c b/tensor_converter/tensor_converter.c index c857ba1..2101a31 100644 --- a/tensor_converter/tensor_converter.c +++ b/tensor_converter/tensor_converter.c @@ -421,14 +421,14 @@ GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, g_assert (offset % 4); - // @TODO: We don't know if outbuf is already allocated at this point, yet! + /* @TODO: We don't know if outbuf is already allocated at this point, yet! */ g_assert (gst_buffer_get_size (outbuf) >= filter->dimension[0] * filter->dimension[1] * filter->dimension[2] * filter->dimension[3]); if (offset % 4) offset += 4 - (offset % 4); - // Refer: https://gstreamer.freedesktop.org/documentation/design/mediatype-video-raw.html + /* Refer: https://gstreamer.freedesktop.org/documentation/design/mediatype-video-raw.html */ gst_buffer_map (inbuf, &src_info, GST_MAP_READ); gst_buffer_map (outbuf, &dest_info, GST_MAP_WRITE); @@ -436,9 +436,9 @@ GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, srcptr = src_info.data; destptr = dest_info.data; - for (d0 = 0; d0 < filter->dimension[3]; d0++) { // Supposed to be 0 only + for (d0 = 0; d0 < filter->dimension[3]; d0++) { /* Supposed to be 0 only */ g_assert (d0 == 0); - for (d1 = 0; d1 < filter->dimension[2]; d1++) { // Height + for (d1 = 0; d1 < filter->dimension[2]; d1++) { /* Height */ memcpy (destptr + dest_idx, srcptr + src_idx, size); dest_idx += size; src_idx += offset; @@ -523,7 +523,7 @@ gst_tensor_converter_transform_ip (GstBaseTransform * trans, GstBuffer * buf) switch (filter->input_media_type) { case _NNS_VIDEO: if (filter->removePadding == TRUE) { - // Remove zero-padding between rows + /* Remove zero-padding between rows */ unsigned char *ptr; unsigned int row, d0; unsigned int dest_idx = 0, src_idx = 0; @@ -534,21 +534,21 @@ gst_tensor_converter_transform_ip (GstBaseTransform * trans, GstBuffer * buf) g_assert (offset % 4); if (offset % 4) offset += 4 - (offset % 4); - // Refer: https://gstreamer.freedesktop.org/documentation/design/mediatype-video-raw.html + /* Refer: https://gstreamer.freedesktop.org/documentation/design/mediatype-video-raw.html */ gst_buffer_map (buf, &info, GST_MAP_READWRITE); ptr = info.data; - for (d0 = 0; d0 < filter->dimension[3]; d0++) { // Supposed to be 0 only + for (d0 = 0; d0 < filter->dimension[3]; d0++) { /* Supposed to be 0 only */ g_assert (d0 == 0); - for (row = 0; row < filter->dimension[2]; row++) { // Height + for (row = 0; row < filter->dimension[2]; row++) { /* Height */ if (dest_idx != src_idx) memmove (ptr + dest_idx, ptr + src_idx, size); dest_idx += size; src_idx += offset; } } - // @TODO: Remove the clutter (reduce the size?) after memcpy. (Check if that's really helpful, first) + /* @TODO: Remove the clutter (reduce the size?) after memcpy. (Check if that's really helpful, first) */ gst_buffer_unmap (buf, &info); g_printerr diff --git a/tensor_filter/tensor_filter.c b/tensor_filter/tensor_filter.c index ca188b0..eb76792 100644 --- a/tensor_filter/tensor_filter.c +++ b/tensor_filter/tensor_filter.c @@ -237,8 +237,7 @@ gst_tensor_filter_class_init (GstTensor_FilterClass * g_class) trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_tensor_filter_set_caps); /* Allocation units */ - // @TODO Fill these in! - // trans_class-> ... + /* @TODO Fill these in! trans_class-> ... */ } /* initialize the new element @@ -257,21 +256,21 @@ gst_tensor_filter_init (GstTensor_Filter * filter) filter->outputConfigured = FALSE; filter->modelFilename = NULL; - filter->inputDimension[0] = 1; // innermost + filter->inputDimension[0] = 1; /* innermost */ filter->inputDimension[1] = 1; filter->inputDimension[2] = 1; - filter->inputDimension[3] = 1; // out - filter->inputType = _NNS_END; // not initialized + filter->inputDimension[3] = 1; /* out */ + filter->inputType = _NNS_END; /* not initialized */ filter->inputCapNegotiated = FALSE; - filter->outputDimension[0] = 1; // innermost + filter->outputDimension[0] = 1; /* innermost */ filter->outputDimension[1] = 1; filter->outputDimension[2] = 1; - filter->outputDimension[3] = 1; // out - filter->outputType = _NNS_END; // not initialized + filter->outputDimension[3] = 1; /* out */ + filter->outputType = _NNS_END; /* not initialized */ filter->outputCapNegotiated = FALSE; - filter->privateData = NULL; // mark not initialized. + filter->privateData = NULL; /* mark not initialized. */ } /** @@ -520,7 +519,7 @@ gst_tensor_filter_get_property (GObject * object, guint prop_id, for (i = 0; i < NNS_TENSOR_RANK_LIMIT; i++) g_array_append_val (input, filter->inputDimension[i]); g_value_take_boxed (value, input); - // take function hands the object over from here so that we don't need to free it. + /* take function hands the object over from here so that we don't need to free it. */ } break; case PROP_OUTPUT:{ @@ -530,7 +529,7 @@ gst_tensor_filter_get_property (GObject * object, guint prop_id, for (i = 0; i < NNS_TENSOR_RANK_LIMIT; i++) g_array_append_val (output, filter->outputDimension[i]); g_value_take_boxed (value, output); - // take function hands the object over from here so that we don't need to free it. + /* take function hands the object over from here so that we don't need to free it. */ } break; case PROP_INPUTTYPE: diff --git a/tensor_filter/tensor_filter_custom.c b/tensor_filter/tensor_filter_custom.c index 82c223f..b2a50b8 100644 --- a/tensor_filter/tensor_filter_custom.c +++ b/tensor_filter/tensor_filter_custom.c @@ -191,7 +191,7 @@ custom_close (GstTensor_Filter * filter) GstTensor_Filter_Framework NNS_support_custom = { .name = "custom", - .allow_in_place = FALSE, // custom cannot support in-place (outptr == inptr). + .allow_in_place = FALSE, /* custom cannot support in-place (outptr == inptr). */ .invoke_NN = custom_invoke, .getInputDimension = custom_getInputDim, .getOutputDimension = custom_getOutputDim, diff --git a/tensor_filter/tensor_filter_tensorflow_lite.c b/tensor_filter/tensor_filter_tensorflow_lite.c index a1d4c4c..ecdb41a 100644 --- a/tensor_filter/tensor_filter_tensorflow_lite.c +++ b/tensor_filter/tensor_filter_tensorflow_lite.c @@ -60,7 +60,7 @@ static int tflite_invoke (GstTensor_Filter * filter, uint8_t * inptr, uint8_t * outptr) { - return 0; // NYI + return 0; /* NYI */ } /** @@ -70,7 +70,7 @@ static int tflite_getInputDim (GstTensor_Filter * filter, uint32_t * inputDimension, tensor_type * type) { - // @TODO fill in *inputDimension (uint32_t[MAX_RANK]), *type + /* @TODO fill in *inputDimension (uint32_t[MAX_RANK]), *type */ return 0; // NYI } @@ -81,13 +81,13 @@ static int tflite_getOutputDim (GstTensor_Filter * filter, uint32_t * outputDimension, tensor_type * type) { - // @TODO fill in *outputDimension (uint32_t[MAX_RANK]), *type - return 0; // NYI + /* @TODO fill in *outputDimension (uint32_t[MAX_RANK]), *type */ + return 0; /* NYI */ } GstTensor_Filter_Framework NNS_support_tensorflow_lite = { .name = "tensorflow-lite", - .allow_in_place = FALSE, // Let's not do this yet. @TODO: support this to optimize performance later. + .allow_in_place = FALSE, /* Let's not do this yet. @TODO: support this to optimize performance later. */ .invoke_NN = tflite_invoke, .getInputDimension = tflite_getInputDim, .getOutputDimension = tflite_getOutputDim, -- 2.7.4