Subversion Repositories shark

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1671 tullio 1
This demos reads a mpeg file named test.m2v.
2
Make sure that the BASE path in makefile points on your shark directory.
3
 
4
To start the application push 1.
5
Thereafter you can create a dummy task that will take around 10% of the time (wcet: 19344, mit: 200000).
6
This application use fsf frame work.
7
 
8
 
9
To be able to change the application this is how you should do.
10
The decoder is split into 3 parts: a input task (readTask), a decoder task (mpeg2decoder) and a display task (displayTask)
11
 
12
There are 5 files that are change from the original decoder. These files are gvideo.c, getbits.c, test2.c, getpic.c and global.h.
13
 
14
gvideo.c
15
The different body of the tasks is in this file.
16
 
17
readTask:
18
Reads a buffer of size 2048 from a bigger buffer and sends it throug a port to the decoder task.
19
 
20
mpeg2decoder:
21
This task decodes a sequence in the movie, this means that in one execution the task will receive several buffers from readTask and sends several decoded pictures to the display. This task use moste of the files in the application. The files that I have change in that the decoder use is getbits.c, getpic.c.
22
 
23
displayTask:
24
This function receive a decoded picture from the decoder and sends it to a function called displayTaskFunction. This function was named Write_Frame in the original decoder. I change the name so I could use this interface in the decoder.
25
 
26
 
27
getbits.c:
28
A new function was written in this file, named int read(int Infile, void *Rdbfr, int rdsize). This function overrides the os read function. What this function does is receive a buffer from readTask.
29
 
30
getpic.c:
31
A new function was written in this file, named void Write_Frame(unsigned char *src[], int frame). This function takes a decoded picture and sends it throug a port to the displayTask.
32
 
33
decoder.c:
34
This file handle the times for the task, the server and so on that a required for shark.
35
 
36
global.h
37
This file has global variable, some structs for message between the task and so on.
38
 
39
Some special notes:
40
When we are sending a decoded picture between the decoder and display task we must copy the picture. This because the decoder use a global buffer and the display can't use it because then we will get a race condition between the decoder and display e.g. the decoder will overwrite the decoded picture at the same time as display try to display it. So the solution is to create a dynamic allocated buffer copy the decoded picture to it. Sends the pointer to the allocated buffer to the display. Display takes the pointer to the buffer. Displays the buffer and after this deallocated the buffer.