}
-#define do_avg(type) do {\
- type *avg = (type *) malloc(sizeof(type) * prop->inputDimension[0]); \
+#define do_avg(type, sumtype) do {\
+ sumtype *avg = (sumtype *) malloc(sizeof(sumtype) * prop->inputDimension[0]); \
type *iptr = (type *) inptr; \
type *optr = (type *) outptr; \
for (z = 0; z < prop->inputDimension[3]; z++) { \
switch (prop->inputType) {
case _NNS_INT8:
- do_avg (int8_t);
+ do_avg (int8_t, int64_t);
break;
case _NNS_INT16:
- do_avg (int16_t);
+ do_avg (int16_t, int64_t);
break;
case _NNS_INT32:
- do_avg (int32_t);
+ do_avg (int32_t, int64_t);
break;
case _NNS_UINT8:
- do_avg (uint8_t);
+ do_avg (uint8_t, uint64_t);
break;
case _NNS_UINT16:
- do_avg (uint16_t);
+ do_avg (uint16_t, uint64_t);
break;
case _NNS_UINT32:
- do_avg (uint32_t);
+ do_avg (uint32_t, uint64_t);
break;
case _NNS_FLOAT32:
- do_avg (float);
+ do_avg (float, long double);
break;
case _NNS_FLOAT64:
- do_avg (double);
+ do_avg (double, long double);
break;
default:
# Test scaler (5, 6, 7)
PATH_TO_MODEL_S="../../build/nnstreamer_example/custom_example_scaler/libnnstreamer_customfilter_scaler.so"
-gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} videotestsrc num-buffers=1 ! video/x-raw,format=RGB,width=640,height=480,framerate=0/1 ! videoconvert ! video/x-raw, format=RGB ! tensor_converter ! tee name=t ! queue ! tensor_filter framework=\"custom\" model=\"${PATH_TO_MODEL_S}\" custom=\"640x480\" ! filesink location=\"testcase05.passthrough.log\" sync=true t. ! queue ! filesink location=\"testcase05.direct.log\" sync=true" 5
+gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} videotestsrc num-buffers=1 ! video/x-raw,format=RGB,width=640,height=480,framerate=0/1 ! videoconvert ! video/x-raw, format=RGB ! tensor_converter ! tee name=t ! queue ! tensor_filter framework=\"custom\" model=\"${PATH_TO_MODEL_S}\" ! filesink location=\"testcase05.passthrough.log\" sync=true t. ! queue ! filesink location=\"testcase05.direct.log\" sync=true" 5
compareAll testcase05.direct.log testcase05.passthrough.log 5
gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} videotestsrc num-buffers=1 ! video/x-raw,format=RGB,width=640,height=480,framerate=0/1 ! videoconvert ! video/x-raw, format=RGB ! tensor_converter ! tee name=t ! queue ! tensor_filter framework=\"custom\" model=\"${PATH_TO_MODEL_S}\" custom=\"320x240\" ! filesink location=\"testcase06.scaled.log\" sync=true t. ! queue ! filesink location=\"testcase06.direct.log\" sync=true" 6
python checkScaledTensor.py testcase06.direct.log 640 480 testcase06.scaled.log 320 240 3
casereport 6 $? "Golden test comparison"
+gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} videotestsrc num-buffers=1 ! video/x-raw,format=RGB,width=640,height=480,framerate=0/1 ! videoconvert ! video/x-raw, format=RGB ! tensor_converter ! tee name=t ! queue ! tensor_filter framework=\"custom\" model=\"${PATH_TO_MODEL_S}\" custom=\"1280X960\" ! filesink location=\"testcase07.scaled.log\" sync=true t. ! queue ! filesink location=\"testcase07.direct.log\" sync=true" 6
+python checkScaledTensor.py testcase07.direct.log 640 480 testcase07.scaled.log 1280 960 3
+casereport 7 $? "Golden test comparison"
+
+# Test average (8)
+PATH_TO_MODEL_A="../../build/nnstreamer_example/custom_example_average/libnnstreamer_customfilter_average.so"
+gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} videotestsrc num-buffers=1 ! video/x-raw,format=RGB,width=640,height=480,framerate=0/1 ! videoconvert ! video/x-raw, format=RGB ! tensor_converter ! tee name=t ! queue ! tensor_filter framework=\"custom\" model=\"${PATH_TO_MODEL_A}\" ! filesink location=\"testcase08.average.log\" sync=true t. ! queue ! filesink location=\"testcase08.direct.log\" sync=true" 8
report