How to do H.264 SVC transmission simulations?
1. In this tutorial, I ported what I have done in NS2 environment to the NCTUns. Therefore, please refer to http://csie.nqu.edu.tw/smallko/ns2/svc.htm for more information first.
2. The main differences between the work done in NS2 and in NCTUns: (a) myEvalSVC in NS2 is replaced by mystg_svc (b) myEvalSVC_Sink is replaced by sfifo_svc. In NS2, we can add any field in the common header. However, the applications run on NCTUns are socket-based applications. Therefore, I modify the mystg program to add setsockopt() in it. This function is mainly used to set the TOS field in the IP header. Different TOS values can represent different LId/TId/QId values for H.264 SVC transmission simulations. Moreover, I re-write the FIFO module (sfifo_svc) to record the received packet information.
1. Download the related from http://hpds.ee.ncku.edu.tw/~smallko/nctuns/myevalsvc.tar.bz2 (All are included, except the JSVM.) Put this file under /root.
2. Decompress this file and you will find a sFIFO_svc folder in it. Refer to How to insert a new module (simple FIFO, sFIFO) into NCTUNS? and install it into NCTUNS.
3. You can also find mystg_svc.c in it. Compile this file with “gcc –o mystg_svc mystg_svc.c –l m”. After that, refer to How to add real applications into NCTUns? and add this program into NCTUNS.
1. Encode the raw YUV with the main.cfg. (This step may take some time. Be patient !!!)
After encoding, you can find temporal.264 and temporal_encoding.txt. You can open the temporal_encoding.txt to know the encoding process.
Decode the temporal.264 and record the decoding process into temporal_originaldecoderoutput.txt. We need some information in it.
Use the JSVM BitStreamExtractor to generate the original NALU trace file (temporal_originaltrace)
4. Use f-nstamp to add the frame-number in temporal_originaltrace.txt. (It will generate temporal_originaltrace-frameno.txt)
5. Prepare the sending trace needed by SVEF with the aid of prepare_sendtrace.awk.
After executing this command, you will find sent.txt.
Prepare the NS2 sending trace needed by myEvalSVC agent with the aid of prepare_ns2sendtrace.awk. (Do it. Because my work was ported from NS2 enviroment.)
7. Execute the following command to transform the ns2send to the format that is required by mystg_svc
Create a topology that contains one sender and one receiver.
9. Click “E” to edit property. Add the applications for Node 1 (sender). [Note] We need to send out some packets first. Otherwise, the receiver may not receive the first few packets. I don’t know why. But with this method, the first few packets can be correctly received.
10. Click “R” but don’t click Simulation/Run.
11. Assume the project name is test. Copy the st to test.sim. Modify the test.tcl. Because we need to change the FIFO of Node 2 to sFIFO_svc.
12. Click Simulation/Run to start simulation.
13. After simulation, you can find myrd_2 under /tmp. Copy it to /root/myevalsvc folder.
Convert the rd file to the format required for SVEF file.
After these two steps, you can get received.txt. This file is the receiver trace file required for SVEF.
Based on temporal_originaltrace-frameno.txt and received file, nalufilter will discard too late frames and frames that cannot be decoded due to frame dependencies. (In this example, no packets are lost.)
16. The current version of JSVM (9.19.8) cannot decode video streams affected by out of order, corrupted, or missing NALUs. Therefore, SVEF uses filtered packet trace file to extract the corresponding packets in original h.264 video file by means of BitStreamExtractorStatic. (You can think that processed video file corresponds to the actually useful data received at the receiving side.)
17. Decode the temporal-filtered.264 file.
18. We need the same number of video frames when we want to calculate the PSNR of original YUV and receiving YUV file. So we need to conceal the missing frames by copying the previous frame.
Now you can compare the PSNR.
Department of Computer Science and Information Engineering, National Quemoy University, Taiwan