# @brief Generate a sequence of video/x-raw frames
# @todo Generate corresponding golden results
# @author MyungJoo Ham <myungjoo.ham@samsung.com>
+# @author Jijoong Moon <jijoong.moon@samsung.com>
# @url https://github.com/nnsuite/nnstreamer/issues/738
import os
import array as arr
+def location(c, w, h):
+ return c+4*(w+4*h)
+
##
# @brief Generate a video/x-raw single frame
# @return The frame buffer contents
-def genFrame(seq):
+def genFrame(seq, out):
frame = arr.array('B', [0] * 64)
width = 4
height = 4
# (RED, 1, 1), 0 to 255
frame[bpp * ( 1 + width * 1 ) + 2] = seq # R
- return frame.tostring()
+ for h in range(0,4):
+ w=0
+ for i in range(0,4):
+ out[location(i,w,h)]=frame[location(i,w,h)]
+ for w in range(1,3):
+ for c in range(0,4):
+ sum = frame[location(0,w,h)]
+ sum += out[location(0,w,h)]
+ out[location(0,w,h)] = sum/2
+ w=3
+ for i in range(0,4):
+ out[location(i,w,h)] = out[location(i,w,h)]
+
+ return frame.tostring(), out
filename = "video_4x4xBGRx.xraw"
f = open(filename, "w")
-for seq in range(0, 256):
- f.write(genFrame(seq))
+out = arr.array('B',[0]*64)
+
+for seq in range(0, 10):
+ outfilename = "rnn.golden"
+ string, out=genFrame(seq,out)
+ if(seq == 9):
+ with open(outfilename,'wb') as file:
+ file.write(out.tostring())
+
+ f.write(string)
f.close()
--- /dev/null
+#!/usr/bin/env bash
+##
+## @file runTest.sh
+## @author MyungJoo Ham <myungjoo.ham@gmail.com>
+## @author Jijoong Moon <jijoong.moon@gmail.com>
+## @date Nov 01 2018
+## @brief This is a template file for SSAT test cases. You may designate your own license.
+##
+if [[ "$SSATAPILOADED" != "1" ]]
+then
+ SILENT=0
+ INDEPENDENT=1
+ search="ssat-api.sh"
+ source $search
+ printf "${Blue}Independent Mode${NC}
+"
+fi
+testInit $1 # You may replace this with Test Group Name
+
+# Generate video_4x4xBGRx.xraw
+python generateTestCase.py
+
+gstTest "--gst-plugin-path=../../build tensor_mux name=mux ! tensor_filter framework=custom model=../../build/nnstreamer_example/custom_example_RNN/libdummyRNN.so ! tee name=t ! queue ! tensor_reposink slot-index=0 silent=false filesrc location=\"video_4x4xBGRx.xraw\" ! application/octet-stream ! tensor_converter input-dim=4:4:4:1 input-type=uint8 ! mux.sink_0 tensor_reposrc slot-index=0 silent=false caps=\"other/tensor, dim1=4, dim2=4, dim3=4, dim4=1, type=uint8, framerate=30/1\" ! mux.sink_1 t. ! queue ! multifilesink location=\"out_%1d.log\"" 1 0 0 $PERFORMANCE
+
+callCompareTest rnn.golden out_9.log 1-1 "Compare 1-1" 1 0
+
+report
+++ /dev/null
-#!/usr/bin/env bash
-##
-## @file runTest.sh
-## @author MyungJoo Ham <myungjoo.ham@gmail.com>
-## @date Nov 01 2018
-## @brief This is a template file for SSAT test cases. You may designate your own license.
-##
-if [[ "$SSATAPILOADED" != "1" ]]
-then
- SILENT=0
- INDEPENDENT=1
- search="ssat-api.sh"
- source $search
- printf "${Blue}Independent Mode${NC}
-"
-fi
-testInit $1 # You may replace this with Test Group Name
-
-# Generate video_4x4xBGRx.xraw
-python generateTestCase.py
-
-# This test case is WIP. So do not fail unittest even if this case fails.
-gstTest "filesrc location=video_4x4xBGRx.xraw ! application/octet-stream ! tensor_converter input-dim=4:4:4:1 input-type=uint8 ! fakesink" 1R 1 0 0
-
-report