Multiple Description Coding (MDC)

 

l          What is MDC?

MDC splits one source of information in multiple entities, where each of the entities is decodable in a stand-alone fashion. The more of these entities are received the more information of the original source can be restored.

 

From Frank H.P. Fitzek, B. Can, R. Prasad, and M. Katz, “Overhead and Quality Measurements for Multiple Description Coding for Video Services”, Wireless. Personal Multimedia Communications (WPMC), September 2004

 

l          How to do MDC video transmission simulation?

Method 1: Use the prepared MDC traffic traces (Download from http://trace.eas.asu.edu/MDC/index.html)

Advantage: Network researchers do not need to know how to encode the video in MDC mode in detail.

Disadvantage: It is hard to study the effects of proposed network mechanisms on different characteristics of the same video extensively because the encoding settings for the publicly available video traffic traces are limited.

p.s. If you want to use the traces provided on that link, remember to correct the unit in the Verbose Video Trace File. Compare the RAW Trace File and the Verbose Video Trace File, and then you will find the unit is different. In the RAW Trace File, the “unit” for each encoded frame is bit while “byte” in the Verbose Video Trace File. So when you want to use the Verbose Video Trace File, remember to divide the frame size by 8 (bit à byte).

 

Method 2: Start from encoding.

 

 

The MDC video transmission evaluation framework is shown above. The main components of the evaluation framework are described as follows:

·         Raw Video Sequence: The video source can be either in the YUV QCIF (176 x 144) or in the YUV CIF (352 x 288) formats.

·         Spliter: In this framework, I choose frame based approach to split the video into multiple descriptors. The spliter program takes the raw video sequence and splits them into i sub-streams such that the n-th sub-stream contains picture n, 2n, 3n, and so on.

·         Video Encoder: The current codecs are Xvid (MPEG4), ffmpeg (H.263, MPEG4), x264 (H.264), and JM 10.1 (H.264).

·         Parser: The parser program reads the each compressed video sub-stream from the output of video encoder and generates a traffic trace file that contains frame id, frame type, frame size, and designated sending time.

·         MyTrafficTrace: This application is used to read the records in the traffic trace file and generate the corresponding packets in NS2. Then it will send the packets to the lower UDP layer at the appropriate time specified according to the user setting specified in the simulation script file.

·         MyUDP: Essentially, MyUDP is an extension of the UDP agent. This new agent allows users to specify the output file name of the sender trace file and it records the timestamp of each transmitted packet, the packet id, and the packet size.

·         MyUDPSink: It is the receiving agent for the slice packets sent by MyUDP. This agent also records the timestamp, packet ID, and size of each received packet in the user specified file.

·         Evaluate Trace: After simulation, count the number of records in the sender trace file and the receiver trace file will make us know how many packets are sent and received. Then the packet loss rate can be easily calculated. Also, the end-to-end packet delay can be obtained by subtracting the sending time from the receiving time. Besides, a distorted video file, which corresponds to the possibly corrupted video found at the receiver side, can be produced. The generation of the possibly corrupted video can be regarded as a process of copying the original compressed video file packet by packet, omitting packets which are lost or corrupted during transmission.

·         Merger: After decoding each received reconstructed video file, the decoded distorted video sequences are fed into the merger program to generate the reconstructed raw video sequence. Because digital video quality assessment, e.g. PSNR, is performed frame by frame. Therefore, the total number of video frames in the reconstructed raw video sequence must be the same as that of the original video. If some sub-streams are lost, the merger program does very simple error concealment by copying the last successfully decoded frame to the lost frames until a correct decoded frame is found. For example, if the video is divided into 4 sub-streams and the third sub-stream is lost, the reconstructed video frame will be frame 1, 2, 2, 4, 5, 6, 6, 8,…and so on.

 

[Possible research uses]

The application of MDC can be approximately classified into two groups, i.e. path diversity and heterogeneous terminals. The combination of multiple path transport and MDC can provide robustness against severe network conditions and reach load balance. Therefore, in this evaluation framework, network researchers can replace the routing module in NS2 with their designed multiple path routing algorithms. In addition, MDC can be exploited to support heterogeneous terminal. The next generation Internet is envisioned to offer services to a wide variety of equipment ranging from mobile phones and PDAs to Laptops and Desktops. With higher computation power and more memory, the terminal can receive more sub-streams. As consequence, the study of the combination of MDC and multicast algorithm is an interesting research topic for network researchers. Moreover, for the people working on video codec and network protocol design, they can adjust the encoding parameters and measure the performance to find out the better settings for video transmission over a specific network topology.

 

[An example to demonstrate how to use the evaluation framework]

1.      Install MyTrafficeTrace, MyUDP, and MyUDPSink into your NS2.

a.       refer to http://csie.nqu.edu.tw/smallko/ns2_old/myevalvid2.htm ( see “The steps to install my module into NS2”), or

b.      download http://csie.nqu.edu.tw/smallko/ns2_old/ns-allinone-2.28.rar . Decompress this file and run the command “./configure; make clean; make)

2.      simulation topology

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

3.      The related files are available from here. (I only provide the example using xvid on cygwin. If you want to use other codecs or want to run the script on Linux, you can refer to http://www.tkn.tu-berlin.de/research/evalvid/EvalVid/docevalvid.html)

4.      [steps to evaluate the MDC video transmission simulation]

a.split the original raw video file into multiple descriptors

Usage : spliter.exe  <original yuv file>  <cif/qcif>  <number of frames> <number of descriptors>

Example: spliter.exe foreman qcif 400 4

Description: The above example will split the foreman in qcif format with 400 frames into 4 descriptors (foreman0.yuv, foreman1.yuv, foreman2.yuv, foreman3.yuv)

 

b. Encode each descriptor.

 

c. Following command lines create ISO MP4 files containing the video samples (frames) and a hint track which describes how to packetize the frames for the transport with RTP.

 

d. The mp4trace tool (parser in the evaluation framework) is able to send a hinted mp4-file per RTP/UDP to a specified destination host. Here the IP address and port number is not important. Because we just need the information for video. The information will be diverted to st0, st1, st2, st3.

       

       

 

        e. Run the simulation.

set max_fragmented_size   1024

set packetSize 1500

 

set ns [new Simulator]

$ns multicast

 

set f [open out.tr w]

$ns trace-all $f

$ns namtrace-all [open out.nam w]

 

# allocate a multicast address;

set group0 [Node allocaddr] 

set group1 [Node allocaddr]   

set group2 [Node allocaddr]

set group3 [Node allocaddr]             

 

# nod is the number of nodes

set nod 5                          

 

# create multicast capable nodes;

for {set i 0} {$i <= $nod} {incr i} {

   set n($i) [$ns node]                     

}

 

#Create links between the nodes

$ns duplex-link $n(0) $n(1) 10Mb 1ms DropTail

$ns duplex-link $n(1) $n(2) 10Mb 1ms DropTail

$ns duplex-link $n(1) $n(3) 10Mb 1ms DropTail

$ns duplex-link $n(1) $n(4) 10Mb 1ms DropTail

$ns duplex-link $n(1) $n(5) 10Mb 1ms DropTail

 

# configure multicast protocol;

DM set CacheMissMode dvmrp

set mproto DM                                

 

# all nodes will contain multicast protocol agents;

set mrthandle [$ns mrtproto $mproto]

 

set udp0 [new Agent/myUDP]

$ns attach-agent $n(0) $udp0

$udp0 set packetSize_ $packetSize

$udp0 set_filename sd_0

$udp0 set dst_addr_ $group0

$udp0 set dst_port_ 0

 

set udp1 [new Agent/myUDP]

$ns attach-agent $n(0) $udp1

$udp1 set packetSize_ $packetSize

$udp1 set_filename sd_1

$udp1 set dst_addr_ $group1

$udp1 set dst_port_ 0

 

set udp2 [new Agent/myUDP]

$ns attach-agent $n(0) $udp2

$udp2 set packetSize_ $packetSize

$udp2 set_filename sd_2

$udp2 set dst_addr_ $group2

$udp2 set dst_port_ 0

 

set udp3 [new Agent/myUDP]

$ns attach-agent $n(0) $udp3

$udp3 set packetSize_ $packetSize

$udp3 set_filename sd_3

$udp3 set dst_addr_ $group3

$udp3 set dst_port_ 0

 

set null1 [new Agent/myEvalvid_Sink]

$ns attach-agent $n(2) $null1

$null1 set_filename rd_2_0

 

set null2 [new Agent/myEvalvid_Sink]

$ns attach-agent $n(3) $null2

$null2 set_filename rd_3_0

 

set null3 [new Agent/myEvalvid_Sink]

$ns attach-agent $n(3) $null3

$null3 set_filename rd_3_1

 

set null4 [new Agent/myEvalvid_Sink]

$ns attach-agent $n(4) $null4

$null4 set_filename rd_4_0

 

set null5 [new Agent/myUdpSink2]

$ns attach-agent $n(4) $null5

$null5 set_trace_filename rd_4_1

 

set null6 [new Agent/myEvalvid_Sink]

$ns attach-agent $n(4) $null6

$null6 set_filename rd_4_2

 

set null7 [new Agent/myEvalvid_Sink]

$ns attach-agent $n(5) $null7

$null7 set_filename rd_5_0

 

set null8 [new Agent/myEvalvid_Sink]

$ns attach-agent $n(5) $null8

$null8 set_filename rd_5_1

 

set null9 [new Agent/myEvalvid_Sink]

$ns attach-agent $n(5) $null9

$null9 set_filename rd_5_2

 

set null10 [new Agent/myEvalvid_Sink]

$ns attach-agent $n(5) $null10

$null10 set_filename rd_5_3

 

set original_file_name0 st0

set trace_file_name0 video0.dat

set original_file_id0 [open $original_file_name0 r]

set trace_file_id0 [open $trace_file_name0 w]

 

set flag0 0

 

while {[eof $original_file_id0] == 0} {

    gets $original_file_id0 current_line

    

    scan $current_line "%d%s%d%d%f" no_ frametype_ length_ tmp1_ tmp2_

    set time [expr int(1000000.0/7.5)]

   

    if { $flag0==0} {

            set time 0

            set flag0 1

    }

         

    if { $frametype_ == "I" } {

      set type_v 1

      set prio_p 0

    }     

 

    if { $frametype_ == "P" } {

      set type_v 2

      set prio_p 0

    }     

 

    if { $frametype_ == "B" } {

      set type_v 3

      set prio_p 0

    }     

   

    if { $frametype_ == "H" } {

      set type_v 1

      set prio_p 0

    }

 

    puts  $trace_file_id0 "$time $length_ $type_v $prio_p $max_fragmented_size"

    set pre_time $tmp2_

}

 

close $original_file_id0

close $trace_file_id0

 

set trace_file0 [new Tracefile]

$trace_file0 filename $trace_file_name0

set video0 [new Application/Traffic/myEvalvid]

$video0 attach-agent $udp0

$video0 attach-tracefile $trace_file0

 

set original_file_name1 st1

set trace_file_name1 video1.dat

set original_file_id1 [open $original_file_name1 r]

set trace_file_id1 [open $trace_file_name1 w]

 

set flag1 0

 

while {[eof $original_file_id1] == 0} {

    gets $original_file_id1 current_line

     

    scan $current_line "%d%s%d%d%f" no_ frametype_ length_ tmp1_ tmp2_

    set time [expr int(1000000.0/7.5)]

   

    if { $flag1==0} {

            set time [expr int(1000000.0/30)]

            set flag1 1

    }

         

    if { $frametype_ == "I" } {

      set type_v 1

      set prio_p 0

    }     

 

    if { $frametype_ == "P" } {

      set type_v 2

      set prio_p 0

    }     

 

    if { $frametype_ == "B" } {

      set type_v 3

      set prio_p 0

    }     

   

    if { $frametype_ == "H" } {

      set type_v 1

      set prio_p 0

    }

 

    puts  $trace_file_id1 "$time $length_ $type_v $prio_p $max_fragmented_size"

    set pre_time $tmp2_

}

 

close $original_file_id1

close $trace_file_id1

 

set trace_file1 [new Tracefile]

$trace_file1 filename $trace_file_name1

set video1 [new Application/Traffic/myEvalvid]

$video1 attach-agent $udp1

$video1 attach-tracefile $trace_file1

 

set original_file_name2 st2

set trace_file_name2 video2.dat

set original_file_id2 [open $original_file_name2 r]

set trace_file_id2 [open $trace_file_name2 w]

 

set flag2 0

 

while {[eof $original_file_id2] == 0} {

    gets $original_file_id2 current_line

    

    scan $current_line "%d%s%d%d%f" no_ frametype_ length_ tmp1_ tmp2_

    set time [expr int(1000000.0/7.5)]

   

    if { $flag2==0} {

            set time [expr int(1000000.0/30*2)]

            set flag2 1

    }

        

    if { $frametype_ == "I" } {

      set type_v 1

      set prio_p 0

    }     

 

    if { $frametype_ == "P" } {

      set type_v 2

      set prio_p 0

    }     

 

    if { $frametype_ == "B" } {

      set type_v 3

      set prio_p 0

    }     

   

    if { $frametype_ == "H" } {

      set type_v 1

      set prio_p 0

    }

 

    puts  $trace_file_id2 "$time $length_ $type_v $prio_p $max_fragmented_size"

    set pre_time $tmp2_

}

 

close $original_file_id2

close $trace_file_id2

 

set trace_file2 [new Tracefile]

$trace_file2 filename $trace_file_name2

set video2 [new Application/Traffic/myEvalvid]

$video2 attach-agent $udp2

$video2 attach-tracefile $trace_file2

 

set original_file_name3 st3

set trace_file_name3 video3.dat

set original_file_id3 [open $original_file_name3 r]

set trace_file_id3 [open $trace_file_name3 w]

 

set flag3 0

 

while {[eof $original_file_id3] == 0} {

    gets $original_file_id3 current_line

    

    scan $current_line "%d%s%d%d%f" no_ frametype_ length_ tmp1_ tmp2_

   set time [expr int(1000000.0/7.5)]

   

    if { $flag3==0} {

            set time [expr int(1000000.0/30*3)]

            set flag3 1

    }

         

    if { $frametype_ == "I" } {

      set type_v 1

      set prio_p 0

    }     

 

    if { $frametype_ == "P" } {

      set type_v 2

      set prio_p 0

    }     

 

    if { $frametype_ == "B" } {

      set type_v 3

      set prio_p 0

    }     

   

    if { $frametype_ == "H" } {

      set type_v 1

      set prio_p 0

    }

 

    puts  $trace_file_id3 "$time $length_ $type_v $prio_p $max_fragmented_size"

    set pre_time $tmp2_

}

 

close $original_file_id3

close $trace_file_id3

 

set trace_file3 [new Tracefile]

$trace_file3 filename $trace_file_name3

set video3 [new Application/Traffic/myEvalvid]

$video3 attach-agent $udp3

$video3 attach-tracefile $trace_file3

 

$ns at 1.0 "$video0 start"

$ns at 1.0 "$video1 start"

$ns at 1.0 "$video2 start"

$ns at 1.0 "$video3 start"

 

# joining and leaving the group;

$ns at 0.1 "$n(2) join-group $null1 $group0"

$ns at 0.2 "$n(3) join-group $null2 $group0"

$ns at 0.2 "$n(3) join-group $null3 $group1"

$ns at 0.3 "$n(4) join-group $null4 $group0"

$ns at 0.3 "$n(4) join-group $null5 $group1"

$ns at 0.3 "$n(4) join-group $null6 $group2"

$ns at 0.4 "$n(5) join-group $null7 $group0"

$ns at 0.4 "$n(5) join-group $null8 $group1"

$ns at 0.4 "$n(5) join-group $null9 $group2"

$ns at 0.4 "$n(5) join-group $null10 $group3"

 

$ns at 20.0 "finish"

 

proc finish {} {

        global ns

        $ns flush-trace

        #exec nam out.nam &

        exit 0

}

 

$ns run

 

       

       

        f. Evaluate trace for node2

       

       

merger.exe is the program used to merge the multiple descriptiors into one video sequence.

Usage: merger <descriptor filename> <result filename > <cif/qcif> <number of frames> <number of descriptors> <descriptor list>

Example 1:  merger.exe  foreman_qcif_dec  distorted  qcif  400  4  0  1  2  3

       

        Finally, run the command “avgpsnr.exe” to get the average PSNR.

       

        g. Evaluate trace for node3

       

       

       

 

        h. Evaluate trace for node4

       

       

       

       

 

i.Evaluate trace for node5

 

        j. You can run the program “yuvviewer.exe” to compare the videos by naked eyes.

 

Last modified: 2006/02/06

 

Author : Chih-Heng, Ke

Website: http://csie.nqu.edu.tw/smallko

Email: smallko@ee.ncku.edu.tw

Phd candidate, EE Department, NCKU, Taiwan